Package org.tensorics.core.tree.domain
Class RebuildingContextImpl
- java.lang.Object
-
- org.tensorics.core.tree.domain.RebuildingContextImpl
-
- All Implemented Interfaces:
RebuildingContext
public class RebuildingContextImpl extends java.lang.Object implements RebuildingContext
RebuildingContextImpl
implementsRebuildingContext
storing the relation from an old node to the new node in aMap
in which the key is the old node.
-
-
Constructor Summary
Constructors Constructor Description RebuildingContextImpl()
Default constructorRebuildingContextImpl(RebuildingContext oldContext)
Constructor creating aRebuildingContext
out of an oldRebuildingContext
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsUpdated(Node node)
Checks if the context contains already an updated version of the given node.java.util.Map<Node,Node>
getRebuildingMap()
Returns a map of instruction nodes to instruction nodes, which contains the nodes to be replaced as key and the nodes which shall replace the old nodes as values.<T extends Node>
TgetUpdated(T node)
Returns resolved node of type T or null if is not yet resolved.<T extends Node>
TgetUpdatedOrSame(T node)
Returns updated or same(given) node from context.<T extends Node>
voidput(T key, T newNode)
Holds relation between old node and new node
-
-
-
Constructor Detail
-
RebuildingContextImpl
public RebuildingContextImpl()
Default constructor
-
RebuildingContextImpl
public RebuildingContextImpl(RebuildingContext oldContext)
Constructor creating aRebuildingContext
out of an oldRebuildingContext
- Parameters:
oldContext
- the old rebuilding context
-
-
Method Detail
-
put
public <T extends Node> void put(T key, T newNode)
Description copied from interface:RebuildingContext
Holds relation between old node and new node- Specified by:
put
in interfaceRebuildingContext
- Type Parameters:
T
- the type ofNode
- Parameters:
key
- as existing nodenewNode
- as enhanced node
-
containsUpdated
public boolean containsUpdated(Node node)
Description copied from interface:RebuildingContext
Checks if the context contains already an updated version of the given node.- Specified by:
containsUpdated
in interfaceRebuildingContext
- Parameters:
node
- the instruction node for which it shall be checked if an updated version exists for it- Returns:
true
if the context contains an updated version,false
if not.
-
getUpdatedOrSame
public <T extends Node> T getUpdatedOrSame(T node)
Description copied from interface:RebuildingContext
Returns updated or same(given) node from context.- Specified by:
getUpdatedOrSame
in interfaceRebuildingContext
- Type Parameters:
T
- the type ofNode
- Parameters:
node
- to be see if updated.- Returns:
- node or updated node from context.
-
getRebuildingMap
public java.util.Map<Node,Node> getRebuildingMap()
Description copied from interface:RebuildingContext
Returns a map of instruction nodes to instruction nodes, which contains the nodes to be replaced as key and the nodes which shall replace the old nodes as values.- Specified by:
getRebuildingMap
in interfaceRebuildingContext
- Returns:
- the replacement mapping
-
getUpdated
public <T extends Node> T getUpdated(T node)
Description copied from interface:RebuildingContext
Returns resolved node of type T or null if is not yet resolved.- Specified by:
getUpdated
in interfaceRebuildingContext
- Type Parameters:
T
- the type ofNode
- Parameters:
node
- to get the update from- Returns:
- the updated node
-
-