Class MoveNodes
- java.lang.Object
-
- de.aristaflow.adept2.core.changeoperations.MoveNodes
-
public class MoveNodes extends Object
Change operation for moving nodes. Call isValidMoveBlock to determine if a given block is a valid move block. Then call isPossible to check the validity of the target point for the move operation as well. If isPossible returns true, call perform operation to execute the change. TODO Refactor; use a common interface for change operations.
-
-
Constructor Summary
Constructors Constructor Description MoveNodes()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isPossible(ChangeableInstance instance, Node first, Node last, Node pred, Node succ)
Check if it is possible (concerning structural and state-based aspects) to move the nodes between first and last to the position between pred and succ in the given instance.static boolean
isPossible(ChangeableInstance instance, Node first, Node last, Node pred, Node succ, CheckReport checkReport)
Check if it is possible (concerning structural and state-based aspects) to move the nodes between first and last to the position between pred and succ in the given instance.static boolean
isPossible(ChangeableTemplate template, Node first, Node last, Node pred, Node succ)
Check if it is possible (concerning structural aspects) to move the nodes between first and last to the position between pred and succ in the given template.static boolean
isPossible(Template template, Node first, Node last, Node pred, Node succ, CheckReport checkReport)
Check if it is possible (concerning structural aspects) to move the nodes between first and last to the position between pred and succ in the given template.static boolean
isValidMoveBlock(ChangeableInstance instance, Node first, Node last)
Checks if the block given by first and last is valid (concerning structural and state-based aspects) for a move operation on the given instance.static boolean
isValidMoveBlock(ChangeableInstance instance, Node first, Node last, CheckReport checkReport)
Checks if the block given by first and last is valid (concerning structural and state-based aspects) for a move operation on the given instance.static boolean
isValidMoveBlock(Template template, Node first, Node last)
Checks if the block given by first and last is valid (concerning structural aspects) for a move operation on the given template.static boolean
isValidMoveBlock(Template template, Node first, Node last, CheckReport checkReport)
Checks if the block given by first and last is valid (concerning structural aspects) for a move operation on the given template.static void
performOperation(SessionToken session, ChangeableInstance instance, Node first, Node last, Node pred, Node succ)
Moves the nodes between first and last to the position between pred and succ in the instance.static void
performOperation(SessionToken session, ChangeableInstance instance, Node first, Node last, Node pred, Node succ, UpdateManager updateManager)
Moves the nodes between first and last to the position between pred and succstatic void
performOperation(SessionToken session, ChangeableTemplate template, Node first, Node last, Node pred, Node succ)
Moves the nodes between first and last to the position between pred and succ in the template.static void
performOperation(SessionToken session, ChangeableTemplate template, Node first, Node last, Node pred, Node succ, UpdateManager updateManager)
Moves the nodes between first and last to the position between pred and succ in the template.protected static void
performOperation(SessionToken session, ChangePrimitives processGraph, Node first, Node last, Node pred, Node succ, UpdateManager updateManager)
Worker method to do the structural changes for both changeable templates and changeable instances.
-
-
-
Field Detail
-
logger
protected static final Logger logger
a Logger
-
-
Method Detail
-
isPossible
public static boolean isPossible(ChangeableTemplate template, Node first, Node last, Node pred, Node succ)
Check if it is possible (concerning structural aspects) to move the nodes between first and last to the position between pred and succ in the given template.- Parameters:
template
- The template where the method is performed on.first
- the first node of the set which should be movedlast
- the last node of the set which should be movedpred
- The predecessor of the target area.succ
- The successor of the target area.- Returns:
- True, if the movement is possible.
-
isPossible
public static boolean isPossible(Template template, Node first, Node last, Node pred, Node succ, CheckReport checkReport)
Check if it is possible (concerning structural aspects) to move the nodes between first and last to the position between pred and succ in the given template. If it is not possible the reasons are stored in the checkReport.- Parameters:
template
- The template where the method is performed on.first
- the first node of the set which should be movedlast
- the last node of the set which should be movedpred
- The predecessor of the target area.succ
- The successor of the target area.checkReport
- a checkReport object which can be filled with the reason why the isPossible failed (i.e. in the case the method returns false), may be null- Returns:
- True, if the movement is possible.
-
isValidMoveBlock
public static boolean isValidMoveBlock(Template template, Node first, Node last)
Checks if the block given by first and last is valid (concerning structural aspects) for a move operation on the given template.- Parameters:
template
- The template where the method is performed on.first
- the first node of the block which should be movedlast
- the last node of the block which should be moved- Returns:
- True, if the block is valid.
-
isValidMoveBlock
public static boolean isValidMoveBlock(Template template, Node first, Node last, CheckReport checkReport)
Checks if the block given by first and last is valid (concerning structural aspects) for a move operation on the given template. If it is not possible the reasons are stored in the checkReport.- Parameters:
template
- The template where the method is performed on.first
- the first node of the block which should be movedlast
- the last node of the block which should be movedcheckReport
- a checkReport object which can be filled with the reason why the isPossible failed (i.e. in the case the method returns false), may be null- Returns:
- True, if the block is valid.
-
isPossible
public static boolean isPossible(ChangeableInstance instance, Node first, Node last, Node pred, Node succ)
Check if it is possible (concerning structural and state-based aspects) to move the nodes between first and last to the position between pred and succ in the given instance.- Parameters:
instance
- The changeable instance where the method is performed on.first
- the first node of the set which should be movedlast
- the last node of the set which should be movedpred
- The predecessor of the target area.succ
- The successor of the target area.- Returns:
- True, if the movement is possible.
-
isPossible
public static boolean isPossible(ChangeableInstance instance, Node first, Node last, Node pred, Node succ, CheckReport checkReport)
Check if it is possible (concerning structural and state-based aspects) to move the nodes between first and last to the position between pred and succ in the given instance. If it is not possible the reasons are stored in the checkReport.- Parameters:
instance
- The changeable instance where the method is performed on.first
- the first node of the set which should be movedlast
- the last node of the set which should be movedpred
- The predecessor of the target area.succ
- The successor of the target area.checkReport
- a checkReport object which can be filled with the reason why the isPossible failed (i.e. in the case the method returns false), may be null- Returns:
- True, if the movement is possible.
-
isValidMoveBlock
public static boolean isValidMoveBlock(ChangeableInstance instance, Node first, Node last)
Checks if the block given by first and last is valid (concerning structural and state-based aspects) for a move operation on the given instance.- Parameters:
instance
- the changeable instance where the method is performed on.first
- the first node of the block which should be movedlast
- the last node of the block which should be moved- Returns:
- True, if the block is valid.
-
isValidMoveBlock
public static boolean isValidMoveBlock(ChangeableInstance instance, Node first, Node last, CheckReport checkReport)
Checks if the block given by first and last is valid (concerning structural and state-based aspects) for a move operation on the given instance. If it is not possible the reasons are stored in the checkReport.- Parameters:
instance
- The changeable instance where the method is performed on.first
- the first node of the block which should be movedlast
- the last node of the block which should be movedcheckReport
- a checkReport object which can be filled with the reason why the isPossible failed (i.e. in the case the method returns false), may be null- Returns:
- True, if the block is valid.
-
performOperation
public static void performOperation(SessionToken session, ChangeableTemplate template, Node first, Node last, Node pred, Node succ)
Moves the nodes between first and last to the position between pred and succ in the template.- Parameters:
session
- The session which is used to check for access rights on this method.template
- The changeable template where the method is performed on.first
- the first node of the set which will be movedlast
- the last node of the set which will be movedpred
- The predecessor of the target area.succ
- The successor of the target area.
-
performOperation
public static void performOperation(SessionToken session, ChangeableTemplate template, Node first, Node last, Node pred, Node succ, UpdateManager updateManager)
Moves the nodes between first and last to the position between pred and succ in the template.- Parameters:
session
- The session which is used to check for access rights on this method.template
- The changeable template where the method is performed on.first
- the first node of the set which will be movedlast
- the last node of the set which will be movedpred
- The predecessor of the target area.succ
- The successor of the target area.updateManager
- The UpdateManager where modifications are logged, may be null
-
performOperation
public static void performOperation(SessionToken session, ChangeableInstance instance, Node first, Node last, Node pred, Node succ)
Moves the nodes between first and last to the position between pred and succ in the instance.- Parameters:
session
- The session which is used to check for access rights on this method.instance
- The changeable instance where the method is performed on.first
- the first node of the set which will be movedlast
- the last node of the set which will be movedpred
- The predecessor of the target area.succ
- The successor of the target area.
-
performOperation
public static void performOperation(SessionToken session, ChangeableInstance instance, Node first, Node last, Node pred, Node succ, UpdateManager updateManager)
Moves the nodes between first and last to the position between pred and succ- Parameters:
session
- The session which is used to check for access rights on this method.instance
- The changeable instance where the method is performed on.first
- the first node of the set which will be movedlast
- the last node of the set which will be movedpred
- The predecessor of the target area.succ
- The successor of the target area.updateManager
- The UpdateManager where modifications are logged, may be null
-
performOperation
protected static void performOperation(SessionToken session, ChangePrimitives processGraph, Node first, Node last, Node pred, Node succ, UpdateManager updateManager)
Worker method to do the structural changes for both changeable templates and changeable instances.- Parameters:
session
- The session which is used to check for access rights on this method.processGraph
- an instance of type ChangeableTemplate or ChangeableInstancefirst
- the first node of the set which should be movedlast
- the last node of the set which should be movedpred
- The predecessor of the target area.succ
- The successor of the target area.updateManager
- The UpdateManager where modifications are logged, may be null
-
-