de.grogra.xl.impl.base
Class RuntimeModel

java.lang.Object
  extended by de.grogra.xl.impl.base.RuntimeModel
All Implemented Interfaces:
RuntimeModel
Direct Known Subclasses:
Runtime, RuntimeModel, RuntimeModel

public abstract class RuntimeModel
extends java.lang.Object
implements RuntimeModel


Field Summary
static int BRANCH_EDGE
          The edge bit mask that encodes a branch edge.
protected  Neighbors branchIn
           
static int CONTAINMENT_EDGE
          The edge bit mask that encodes a containment edge.
static int CONTAINMENT_END_EDGE
          The edge bit mask that encodes an end-of-containment edge.
protected  Neighbors copyIn
           
protected  Neighbors copyOut
           
static int MARK_EDGE
          The edge bit mask that encodes some general-purpose mark edge.
static int MIN_NORMAL_BIT_INDEX
           
static int MIN_USER_EDGE
          The first unused edge bit mask.
static int REFINEMENT_EDGE
          The edge bit mask that encodes a refinement edge.
static int SPECIAL_MASK
          The edge bit mask that covers the special edge.
static int SUCCESSOR_EDGE
          The edge bit mask that encodes a successor edge.
 
Constructor Summary
RuntimeModel()
           
 
Method Summary
abstract  void addEdgeBits(java.lang.Object source, java.lang.Object target, int bits)
          Adds a set of edge bits from a source node to a target node.
abstract  EdgeIterator createEdgeIterator(java.lang.Object node, EdgeDirection dir)
          Creates an iterator over the edges of node.
 Graph currentGraph()
          Returns the graph that shall be used in the context of the current thread.
static int edgeBitsIntersection(int edgeBits, int mask)
           
static int edgeBitsUnion(int a, int b)
           
abstract  int getEdgeBits(java.lang.Object source, java.lang.Object target)
          Return the edge bits between a source node and a target node.
abstract  java.lang.Class getNodeType()
          Specifies the base type of nodes of this runtime model.
 int getStandardEdgeFor(int edgeType)
           
 void initialize(java.lang.String params)
          Initializes this model.
 boolean isNode(java.lang.Object value)
          Determines if value represents a valid node for this run-time model.
 boolean isWrapperFor(java.lang.Object object, Type type)
          Tests if the object is a wrapper for values of the given type.
 void setCurrentGraph(Graph extent)
           
static boolean testEdgeBits(int edgeBits, int mask)
           
 boolean unwrapBoolean(java.lang.Object wrapper)
          Extracts the boolean value of a wrapper.
 byte unwrapByte(java.lang.Object wrapper)
          Extracts the byte value of a wrapper.
 char unwrapChar(java.lang.Object wrapper)
          Extracts the char value of a wrapper.
 double unwrapDouble(java.lang.Object wrapper)
          Extracts the double value of a wrapper.
 float unwrapFloat(java.lang.Object wrapper)
          Extracts the float value of a wrapper.
 int unwrapInt(java.lang.Object wrapper)
          Extracts the int value of a wrapper.
 long unwrapLong(java.lang.Object wrapper)
          Extracts the long value of a wrapper.
 java.lang.Object unwrapObject(java.lang.Object wrapper)
          Extracts the Object value of a wrapper.
 short unwrapShort(java.lang.Object wrapper)
          Extracts the short value of a wrapper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BRANCH_EDGE

public static final int BRANCH_EDGE
The edge bit mask that encodes a branch edge.

This bit mask represents bit 9, i.e., its value is 512.

See Also:
Constant Field Values

branchIn

protected Neighbors branchIn

CONTAINMENT_EDGE

public static final int CONTAINMENT_EDGE
The edge bit mask that encodes a containment edge.

This bit mask represents bit 10, i.e., its value is 1024.

See Also:
Constant Field Values

CONTAINMENT_END_EDGE

public static final int CONTAINMENT_END_EDGE
The edge bit mask that encodes an end-of-containment edge.

This bit mask represents bit 11.

See Also:
Constant Field Values

copyIn

protected Neighbors copyIn

copyOut

protected Neighbors copyOut

MARK_EDGE

public static final int MARK_EDGE
The edge bit mask that encodes some general-purpose mark edge.

This bit mask represents bit 13.

See Also:
Constant Field Values

MIN_NORMAL_BIT_INDEX

public static final int MIN_NORMAL_BIT_INDEX
See Also:
Constant Field Values

MIN_USER_EDGE

public static final int MIN_USER_EDGE
The first unused edge bit mask. This and all higher bit masks can be used freely.

This bit mask represents bit 14.

See Also:
Constant Field Values

REFINEMENT_EDGE

public static final int REFINEMENT_EDGE
The edge bit mask that encodes a refinement edge.

This bit mask represents bit 12.

See Also:
Constant Field Values

SPECIAL_MASK

public static final int SPECIAL_MASK
The edge bit mask that covers the special edge.

This bit mask represents the bits 0 - 7, i.e., its value is 255.

See Also:
Constant Field Values

SUCCESSOR_EDGE

public static final int SUCCESSOR_EDGE
The edge bit mask that encodes a successor edge.

This bit mask represents bit 8, i.e., its value is 256.

See Also:
Constant Field Values
Constructor Detail

RuntimeModel

public RuntimeModel()
Method Detail

addEdgeBits

public abstract void addEdgeBits(java.lang.Object source,
                                 java.lang.Object target,
                                 int bits)
Adds a set of edge bits from a source node to a target node.

Parameters:
source - the source node of the edge
target - the target node of the edge
bits - the edge bits that are to be added

createEdgeIterator

public abstract EdgeIterator createEdgeIterator(java.lang.Object node,
                                                EdgeDirection dir)
Creates an iterator over the edges of node. The iterator is set to the first edge of the node, if any. The direction dir has to be respected by the iterator.

Parameters:
node - the node whose edges are to be iterated
dir - direction in which edges are traversed (seen from node)
Returns:
an edge iterator

currentGraph

public Graph currentGraph()
Description copied from interface: RuntimeModel
Returns the graph that shall be used in the context of the current thread. This is needed by graph-related XL statements which do not explicitly specify the graph to use.

Specified by:
currentGraph in interface RuntimeModel
Returns:
the current graph for this model

edgeBitsIntersection

public static final int edgeBitsIntersection(int edgeBits,
                                             int mask)

edgeBitsUnion

public static final int edgeBitsUnion(int a,
                                      int b)

getEdgeBits

public abstract int getEdgeBits(java.lang.Object source,
                                java.lang.Object target)
Return the edge bits between a source node and a target node. If there is no edge at all, 0 is returned.

Parameters:
source - the source node of the edge
target - the target node of the edge
Returns:
the edge bits

getNodeType

public abstract java.lang.Class getNodeType()
Specifies the base type of nodes of this runtime model. This should return the same type as CompiletimeModel.getNodeType() for the corresponding CompiletimeModel implementation.

Returns:
base type of nodes

getStandardEdgeFor

public int getStandardEdgeFor(int edgeType)

initialize

public void initialize(java.lang.String params)
Description copied from interface: RuntimeModel
Initializes this model. This method is invoked by RuntimeModelFactory.modelForName(java.lang.String, java.lang.ClassLoader) after a new RuntimeModel instance has been created. The format of params depends on implementations of RuntimeModel.

Specified by:
initialize in interface RuntimeModel
Parameters:
params - initialization parameters, possibly null

isNode

public boolean isNode(java.lang.Object value)
Description copied from interface: RuntimeModel
Determines if value represents a valid node for this run-time model.

Specified by:
isNode in interface RuntimeModel
Parameters:
value - the value to be tested
Returns:
true iff the value represents a node

isWrapperFor

public boolean isWrapperFor(java.lang.Object object,
                            Type type)
Description copied from interface: RuntimeModel
Tests if the object is a wrapper for values of the given type.

Specified by:
isWrapperFor in interface RuntimeModel
Parameters:
object - the potential wrapper to be tested
type - the value type
Returns:
true iff object is a wrapper for values of type type

setCurrentGraph

public void setCurrentGraph(Graph extent)

testEdgeBits

public static final boolean testEdgeBits(int edgeBits,
                                         int mask)

unwrapBoolean

public boolean unwrapBoolean(java.lang.Object wrapper)
Description copied from interface: RuntimeModel
Extracts the boolean value of a wrapper.

Specified by:
unwrapBoolean in interface RuntimeModel
Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper

unwrapByte

public byte unwrapByte(java.lang.Object wrapper)
Description copied from interface: RuntimeModel
Extracts the byte value of a wrapper.

Specified by:
unwrapByte in interface RuntimeModel
Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper

unwrapChar

public char unwrapChar(java.lang.Object wrapper)
Description copied from interface: RuntimeModel
Extracts the char value of a wrapper.

Specified by:
unwrapChar in interface RuntimeModel
Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper

unwrapDouble

public double unwrapDouble(java.lang.Object wrapper)
Description copied from interface: RuntimeModel
Extracts the double value of a wrapper.

Specified by:
unwrapDouble in interface RuntimeModel
Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper

unwrapFloat

public float unwrapFloat(java.lang.Object wrapper)
Description copied from interface: RuntimeModel
Extracts the float value of a wrapper.

Specified by:
unwrapFloat in interface RuntimeModel
Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper

unwrapInt

public int unwrapInt(java.lang.Object wrapper)
Description copied from interface: RuntimeModel
Extracts the int value of a wrapper.

Specified by:
unwrapInt in interface RuntimeModel
Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper

unwrapLong

public long unwrapLong(java.lang.Object wrapper)
Description copied from interface: RuntimeModel
Extracts the long value of a wrapper.

Specified by:
unwrapLong in interface RuntimeModel
Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper

unwrapObject

public java.lang.Object unwrapObject(java.lang.Object wrapper)
Description copied from interface: RuntimeModel
Extracts the Object value of a wrapper.

Specified by:
unwrapObject in interface RuntimeModel
Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper

unwrapShort

public short unwrapShort(java.lang.Object wrapper)
Description copied from interface: RuntimeModel
Extracts the short value of a wrapper.

Specified by:
unwrapShort in interface RuntimeModel
Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper