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
Fields Modifier and Type Field Description protected Edge
edge
The edge on which we set the end point.protected AbstractLocation
location
The original endpoint (or the new endpoint in case the command is undone.protected Nail
nail
Any nails created as a side effect of changing the endpoint.-
Fields inherited from class com.uppaal.model.core2.AbstractTransaction
commandManager, committed
-
Fields inherited from class com.uppaal.model.core2.AbstractCommand
version
-
-
Constructor Summary
Constructors Constructor Description SetEndPointCommand(CommandManager commandManager, Edge edge)
Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Nail
convertToNail(int x, int y)
Inserts a new nail next to the endpoint and the given position.protected void
doCancel()
protected void
doExecute()
protected void
doUndo()
abstract AbstractLocation
getLocation()
Returns the current end point.Element
getModifiedElement()
protected abstract void
insertNail(Nail nail)
Inserts a nail next to the end point.void
moveNailTo(int x, int y)
Move nail created with convertToNail() to a new position.void
setEndPoint(AbstractLocation location)
Set the endpoint to the given location.protected abstract void
setLocation(AbstractLocation location)
Sets the current end point on the edge.protected void
swap()
-
Methods inherited from class com.uppaal.model.core2.AbstractTransaction
cancel, commit, execute, move, undo
-
Methods inherited from class com.uppaal.model.core2.AbstractCommand
getVersion, merge, setVersion
-
-
-
-
Field Detail
-
edge
protected Edge edge
The edge on which we set the end point.
-
location
protected AbstractLocation location
The original endpoint (or the new endpoint in case the command is undone.
-
nail
protected Nail nail
Any nails created as a side effect of changing the endpoint.
-
-
Constructor Detail
-
SetEndPointCommand
public SetEndPointCommand(CommandManager commandManager, Edge edge)
Constructor- Parameters:
commandManager
- - The command manageredge
- - The edge
-
-
Method Detail
-
getLocation
public abstract AbstractLocation getLocation()
Returns the current end point.- Returns:
- The abstract location
-
setLocation
protected abstract void setLocation(AbstractLocation location)
Sets the current end point on the edge.- Parameters:
location
- - The set location
-
insertNail
protected abstract void insertNail(Nail nail)
Inserts a nail next to the end point.- Parameters:
nail
- - The nail object
-
convertToNail
public Nail convertToNail(int x, int y)
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
public void setEndPoint(AbstractLocation location)
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:
doCancel
in classAbstractTransaction
-
doExecute
protected void doExecute()
- Specified by:
doExecute
in classAbstractTransaction
-
doUndo
protected void doUndo()
- Specified by:
doUndo
in classAbstractTransaction
-
swap
protected void swap()
-
getModifiedElement
public Element getModifiedElement()
- Returns:
- the modified element or its closest relative (sibling or parent) if the element is not displayed.
-
-