Package com.uppaal.model.core2
Class SetEndPointCommand
java.lang.Object
com.uppaal.model.core2.AbstractCommand
com.uppaal.model.core2.AbstractTransaction
com.uppaal.model.core2.SetEndPointCommand
- All Implemented Interfaces:
Command
- Direct Known Subclasses:
SetSourceCommand,SetTargetCommand
public abstract class SetEndPointCommand extends AbstractTransaction
Transaction for setting the end point on the edge
-
Field Summary
-
Constructor Summary
Constructors Constructor Description SetEndPointCommand(CommandManager commandManager, Edge edge)Constructor -
Method Summary
Modifier and Type Method Description NailconvertToNail(int x, int y)Inserts a new nail next to the endpoint and the given position.protected voiddoCancel()protected voiddoExecute()protected voiddoUndo()abstract AbstractLocationgetLocation()Returns the current end point.ElementgetModifiedElement()protected abstract voidinsertNail(Nail nail)Inserts a nail next to the end point.voidmoveNailTo(int x, int y)Move nail created with convertToNail() to a new position.voidsetEndPoint(AbstractLocation location)Set the endpoint to the given location.protected abstract voidsetLocation(AbstractLocation location)Sets the current end point on the edge.protected voidswap()
-
Field Details
-
Constructor Details
-
SetEndPointCommand
Constructor- Parameters:
commandManager- - The command manageredge- - The edge
-
-
Method Details
-
getLocation
Returns the current end point.- Returns:
- The abstract location
-
setLocation
Sets the current end point on the edge.- Parameters:
location- - The set location
-
insertNail
Inserts a nail next to the end point.- Parameters:
nail- - The nail object
-
convertToNail
Inserts a new nail next to the endpoint and the given position.- Parameters:
x- - The x valuey- - The y value- Returns:
- The convert nail object
-
moveNailTo
public void moveNailTo(int x, int y)Move nail created with convertToNail() to a new position.- Parameters:
x- - The x valuey- - The y value
-
setEndPoint
Set the endpoint to the given location. Any nail created with convertToNail() is removed.- Parameters:
location- - The abstract location
-
doCancel
protected void doCancel()- Specified by:
doCancelin classAbstractTransaction
-
doExecute
protected void doExecute()- Specified by:
doExecutein classAbstractTransaction
-
doUndo
protected void doUndo()- Specified by:
doUndoin classAbstractTransaction
-
swap
protected void swap() -
getModifiedElement
- Returns:
- the modified element or its closest relative (sibling or parent) if the element is not displayed.
-