public abstract class SetEndPointCommand extends AbstractTransaction
Modifier and Type | Field and 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.
|
commandManager, committed
version
Constructor and Description |
---|
SetEndPointCommand(CommandManager commandManager,
Edge edge)
Constructor
|
Modifier and Type | Method and 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() |
cancel, commit, execute, move, undo
getVersion, setVersion
protected Edge edge
protected AbstractLocation location
protected Nail nail
public SetEndPointCommand(CommandManager commandManager, Edge edge)
commandManager
- - The command manageredge
- - The edgepublic abstract AbstractLocation getLocation()
protected abstract void setLocation(AbstractLocation location)
location
- - The set locationprotected abstract void insertNail(Nail nail)
nail
- - The nail objectpublic Nail convertToNail(int x, int y)
x
- - The x valuey
- - The y valuepublic void moveNailTo(int x, int y)
x
- - The x valuey
- - The y valuepublic void setEndPoint(AbstractLocation location)
location
- - The abstract locationprotected void doCancel()
doCancel
in class AbstractTransaction
protected void doExecute()
doExecute
in class AbstractTransaction
protected void doUndo()
doUndo
in class AbstractTransaction
protected void swap()
public Element getModifiedElement()
Copyright © 2014 Uppsala University and Aalborg University. All Rights Reserved.