Class InsertBetweenNodeSets
- java.lang.Object
-
- de.aristaflow.adept2.core.changeoperations.InsertBetweenNodeSets
-
public class InsertBetweenNodeSets extends Object
Change operation for inserting a new node between a set of nodes which should be executed before and a set of nodes which should be executed after the newly inserted node. To be able to do this high level operation, a minimal block is calculated which contains all given nodes and where an AND-Block can be inserted without violating the block structure. After that the new node is inserted in a new parallel branch. To guarantee the execution path, all nodes which should be executed before the newly inserted node are connected with a write sync-edge to the new node while all nodes which should be executed after the newly inserted node are connected with a read sync edge. Call isPossible first to check if the insertion is valid, than call perform operation to execute the change. TODO Refactor; use a common interface for change operations.
-
-
Constructor Summary
Constructors Constructor Description InsertBetweenNodeSets()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isPossible(Instance instance, List<Integer> preds, List<Integer> succs)
Check if it is possible (concerning structural and state based correctness) to insert a node which is executed after the nodes given in preds and before the nodes given in succs in the given instance.static boolean
isPossible(Instance instance, List<Integer> preds, List<Integer> succs, CheckReport checkReport)
Check if it is possible (concerning structural and state based correctness) to insert a node which is executed after the nodes given in preds and before the nodes given in succs in the given instance.static boolean
isPossible(Template template, List<Integer> preds, List<Integer> succs)
Check if it is possible (concerning structural correctness) to insert a node which is executed after the nodes given in preds and before the nodes given in succs in the given template.static boolean
isPossible(Template template, List<Integer> preds, List<Integer> succs, CheckReport checkReport)
Check if it is possible (concerning structural correctness) to insert a node which is executed after the nodes given in preds and before the nodes given in succs in the given template.static Node
performOperation(SessionToken session, ChangeableInstance instance, List<Integer> preds, List<Integer> succs)
Insert a new node between two nodes in the given instance.static Node
performOperation(SessionToken session, ChangeableInstance instance, List<Integer> preds, List<Integer> succs, UpdateManager updateManager)
Insert a new node of type NT_NORMAL between two nodes in the given instance.static Node
performOperation(SessionToken session, ChangeableTemplate template, List<Integer> preds, List<Integer> succs)
Insert a new node between the nodes given as predecessors and the nodes given as successors in the given template.static Node
performOperation(SessionToken session, ChangeableTemplate template, List<Integer> preds, List<Integer> succs, UpdateManager updateManager)
Insert a new node of type NT_NORMAL between two nodes in the given template.protected static Node
performOperation(SessionToken session, ChangePrimitives processGraph, List<Integer> preds, List<Integer> succs, ProcessConstants.NodeType type, 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(Template template, List<Integer> preds, List<Integer> succs)
Check if it is possible (concerning structural correctness) to insert a node which is executed after the nodes given in preds and before the nodes given in succs in the given template.- Parameters:
template
- The template where the node should be inserted.preds
- The IDs of the nodes which should be executed before the new node.succs
- The IDs of the nodes which should be executed after the new node.- Returns:
- True, if the insertion is possible.
-
isPossible
public static boolean isPossible(Template template, List<Integer> preds, List<Integer> succs, CheckReport checkReport)
Check if it is possible (concerning structural correctness) to insert a node which is executed after the nodes given in preds and before the nodes given in succs in the given template. If it is not possible the reasons are stored in the checkReport.- Parameters:
template
- The template where the node should be inserted.preds
- The IDs of the nodes which should be executed before the new node.succs
- The IDs of the nodes which should be executed after the new node.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 insertion is possible.
-
isPossible
public static boolean isPossible(Instance instance, List<Integer> preds, List<Integer> succs)
Check if it is possible (concerning structural and state based correctness) to insert a node which is executed after the nodes given in preds and before the nodes given in succs in the given instance. If it is not possible the reasons are stored in the checkReport.- Parameters:
instance
- The changeable instance where the node should be inserted.preds
- The IDs of the nodes which should be executed before the new node.succs
- The IDs of the nodes which should be executed after the new node.- Returns:
- True, if the insertion is possible.
-
isPossible
public static boolean isPossible(Instance instance, List<Integer> preds, List<Integer> succs, CheckReport checkReport)
Check if it is possible (concerning structural and state based correctness) to insert a node which is executed after the nodes given in preds and before the nodes given in succs in the given instance. If it is not possible the reasons are stored in the checkReport.- Parameters:
instance
- The changeable instance where the node should be inserted.preds
- The IDs of the nodes which should be executed before the new node.succs
- The IDs of the nodes which should be executed after the new node.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 insertion is possible.
-
performOperation
public static Node performOperation(SessionToken session, ChangeableTemplate template, List<Integer> preds, List<Integer> succs)
Insert a new node between the nodes given as predecessors and the nodes given as successors in the given template.- Parameters:
session
- The session which is used to check for access rights on this method.template
- The changeable template where the node will be inserted.preds
- The IDs of the nodes which should be executed before the new node.succs
- The IDs of the nodes which should be executed after the new node.- Returns:
- The newly inserted node.
-
performOperation
public static Node performOperation(SessionToken session, ChangeableTemplate template, List<Integer> preds, List<Integer> succs, UpdateManager updateManager)
Insert a new node of type NT_NORMAL between two nodes in the given template.- Parameters:
session
- The session which is used to check for access rights on this method.template
- The changeable template where the node will be inserted.preds
- The IDs of the nodes which should be executed before the new node.succs
- The IDs of the nodes which should be executed after the new node.updateManager
- The UpdateManager where modifications are logged, may be null- Returns:
- The newly inserted node.
-
performOperation
public static Node performOperation(SessionToken session, ChangeableInstance instance, List<Integer> preds, List<Integer> succs)
Insert a new node between two nodes in the given instance.- Parameters:
session
- The session which is used to check for access rights on this method.instance
- The changeable instance where the node will be inserted.preds
- The IDs of the nodes which should be executed before the new node.succs
- The IDs of the nodes which should be executed after the new node.- Returns:
- The newly inserted node.
-
performOperation
public static Node performOperation(SessionToken session, ChangeableInstance instance, List<Integer> preds, List<Integer> succs, UpdateManager updateManager)
Insert a new node of type NT_NORMAL between two nodes in the given instance.- Parameters:
session
- The session which is used to check for access rights on this method.instance
- The changeable instance where the node will be inserted.preds
- The IDs of the nodes which should be executed before the new node.succs
- The IDs of the nodes which should be executed after the new node.updateManager
- the manager which is responsible for the graphical adaptation of the template (maybe null)- Returns:
- The newly inserted node.
-
performOperation
protected static Node performOperation(SessionToken session, ChangePrimitives processGraph, List<Integer> preds, List<Integer> succs, ProcessConstants.NodeType type, 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 ChangeableInstancepreds
- The IDs of the nodes which should be executed before the new node.succs
- The IDs of the nodes which should be executed after the new node.type
- the type of the new nodeupdateManager
- the manager which is responsible for the graphical adaptation of the template (maybe null)- Returns:
- The newly inserted node.
-
-