public abstract class WeightedInstance extends PuzzleInstance
Constructor and Description |
---|
WeightedInstance() |
WeightedInstance(WeightedInstance wgi) |
Modifier and Type | Method and Description |
---|---|
boolean |
addEdge(Vertex from,
Vertex to,
int weight)
Adds an edge with a specified weight to the graph in PuzzleInstance
|
java.lang.String |
getAdjacencyMatrixAsString() |
int |
getWeightForEdge(Edge e)
Given an edge, get its weight
|
boolean |
isEventForThisPuzzleType(Event<?> e)
Return true iff this event is of type T.
|
boolean |
setWeight(Vertex from,
Vertex to,
int weight)
Changes the weight of the edge between the two passed-in vertices
|
void |
setWeights(java.lang.String weightsList)
Sets the weights for the edges in the graph, according to the passed-in String.
|
void |
setWeightsBetween(java.util.List<Vertex> verts,
int weight) |
void |
setWeightsForEdges(java.util.ArrayList<Edge> edges,
int weight) |
void |
setWeightsForEdges(java.util.ArrayList<Edge> edges,
int[] weights) |
java.lang.String |
weightsToString()
Dictates how the weights in this Object's graph are arranged in a String
|
addDoppelganger, addGraph, addGraphWithData, addToSelected, addToSelected, addVertex, canRedo, canUndo, checkAndHandlePuzzleCompletion, clearAllSelections, clearHistory, clearTutorial, computeGlobalPoints, connectAllSelectedVertices, connectToSelected, convertMovesToTutorial, copyPuzzle, copyPuzzleSoItHasInitialStateTheSameAsMyCurrentState, copyRequested, copySelected, createNewVertexForPuzzle, currentPuzzleDataToString, deleteSelected, disableHistory, disconnectFromSelected, disconnectSelected, doNotRecordGraphEvents, enableHistory, endGame, forceRedo, getAttemptName, getBasePoints, getCurrentAnnotation, getCurrentMoveOverview, getCurrentUndoableEvent, getData, getDefaultVertexDataObject, getDescription, getDiameter, getDifficultyLevel, getEdgeDataClassName, getEditHelpClassName, getEditorClassName, getFamilyName, getFirstSelected, getFirstTimeBonus, getGameName, getGlobalBest, getGraph, getHelpClassName, getHighScoreBonus, getImprovementBonus, getInstanceClassName, getInterestingTutorialVertices, getMaximumXCoordinate, getMaximumYCoordinate, getMessage, getMinimumSelectedXCoordinate, getMinimumSelectedYCoordinate, getMinimumXCoordinate, getMinimumYCoordinate, getMode, getNumberOfEdges, getNumberOfMoves, getNumberOfVertices, getNumberSelected, getOldHighScore, getPersonalBest, getPlayClassName, getProcessedSolution, getPuzzleID, getPuzzleInstanceName, getPuzzleName, getScore, getSelectedVertices, getSolution, getSolutionAsString, getSolutionID, getThemeClassName, getTimeTaken, getTopOfUndoStack, getTryItInstanceForUseOnPlayScreen, getTutorialData, getUserID, getVertexIndex, getVertices, getVisibility, getVisibleSources, goToNextEvent, grossHistoryDeleteLastEvent, grossHistoryGetLastAddedEvent, grossHistoryGetNextEvent, grossHistoryGetNextEventIndex, grossHistoryIsSaved, grossHistoryIteratorAtBeginning, grossHistoryIteratorAtEnd, grossHistoryNext, grossHistoryPrevious, grossHistorySetSaved, grossHistorySize, grossHistoryToBeginning, grossHistoryToEnd, initialPuzzleDataToString, isCurrentStateValidSolution, isFinishable, isInReplayOrEditTutorialMode, isLocked, isLowerScoreBetter, isPlayable, isSaved, isShowIndices, isSolutionRefinable, isSpecialCopyOK, isTutorial, isValidToTranslationSelection, isVisibleSource, makeCurrentStateInitialState, moveGraphEnded, moveSelectedVerticesEnded, moveStarted, pasteAndConnectCopyOfSelected, pasteCopyOfSelected, performEvents, performEvents, performTutorialEvents, reallySetLocked, recordGraphEvents, redo, removeFromSelected, removeFromSelected, resetVerticesToInitialLocations, restart, runAlgorithms, runuTryIt, selectAll, sendAlgorithmResult, sendMeaninglessEvent, setAttemptName, setData, setDefaultData, setDescription, setFinishable, setGlobalBest, setGraph, setInReplayOrEditTutorialMode, setLocked, setMessage, setMode, setPersonalBest, setPlayable, setPuzzle, setPuzzleID, setPuzzleName, setSaved, setShowIndices, setSolutionData, setSolutionID, setSolutionInformation, setUserID, setVisibleSources, startTimer, stopTimer, stringToPuzzleData, submit, toggleSelected, tryItResultsAreBinding, tutorialModeEnabled, undo, uniqueIdentifier, update, updateStateBasedOnAlgorithmResult, updateTimeTaken, usesAlgorithms
public WeightedInstance()
public WeightedInstance(WeightedInstance wgi)
public void setWeights(java.lang.String weightsList)
weightsList
- The String of weights for all the edges in the graph. It should
be arranged as weightsToString() dictates.public void setWeightsForEdges(java.util.ArrayList<Edge> edges, int weight)
public void setWeightsForEdges(java.util.ArrayList<Edge> edges, int[] weights)
public void setWeightsBetween(java.util.List<Vertex> verts, int weight)
verts
- weight
- public int getWeightForEdge(Edge e)
e
- The edge whose weight we want to knowpublic boolean isEventForThisPuzzleType(Event<?> e)
PuzzleInstance
isEventForThisPuzzleType
in class PuzzleInstance
public java.lang.String weightsToString()
public boolean setWeight(Vertex from, Vertex to, int weight)
from
- The vertex the edge starts atto
- The vertex the edge ends atweight
- The new weightpublic boolean addEdge(Vertex from, Vertex to, int weight)
from
- The starting vertexto
- The vertex to end atweight
- The weight for this edgepublic java.lang.String getAdjacencyMatrixAsString()