com.uppaal.model.core2
Class SetEndPointCommand

java.lang.Object
  extended by com.uppaal.model.core2.AbstractCommand
      extended by com.uppaal.model.core2.AbstractTransaction
          extended by com.uppaal.model.core2.SetEndPointCommand
All Implemented Interfaces:
Command
Direct Known Subclasses:
SetSourceCommand, SetTargetCommand

public abstract class SetEndPointCommand
extends AbstractTransaction


Field Summary
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
committed, document
 
Fields inherited from class com.uppaal.model.core2.AbstractCommand
version
 
Constructor Summary
SetEndPointCommand(Document document, Edge edge)
           
 
Method Summary
 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, setVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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(Document document,
                          Edge edge)
Method Detail

getLocation

public abstract AbstractLocation getLocation()
Returns the current end point.


setLocation

protected abstract void setLocation(AbstractLocation location)
Sets the current end point on the edge.


insertNail

protected abstract void insertNail(Nail nail)
Inserts a nail next to the end point.


convertToNail

public Nail convertToNail(int x,
                          int y)
Inserts a new nail next to the endpoint and the given position.


moveNailTo

public void moveNailTo(int x,
                       int y)
Move nail created with convertToNail() to a new position.


setEndPoint

public void setEndPoint(AbstractLocation location)
Set the endpoint to the given location. Any nail created with convertToNail() is removed.


doCancel

protected void doCancel()
Specified by:
doCancel in class AbstractTransaction

doExecute

protected void doExecute()
Specified by:
doExecute in class AbstractTransaction

doUndo

protected void doUndo()
Specified by:
doUndo in class AbstractTransaction

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.


Copyright © 2012 Uppsala University and Aalborg University. All Rights Reserved.