de.grogra.mtg
Class MTGGraphBuilder

java.lang.Object
  extended by de.grogra.mtg.MTGGraphBuilder

public class MTGGraphBuilder
extends java.lang.Object

Maintains state of the MTG data loading. Also maintains the generated graph structure.

Since:
2011-11-24
Author:
Ong Yongzhi

Field Summary
protected static int MTG_BODY_DATA
           
protected static int MTG_HEADER_ATTRIBUTES
           
protected static int MTG_HEADER_CLASSES
           
protected static int MTG_HEADER_CODE
           
protected static int MTG_HEADER_TOPO
           
 
Constructor Summary
MTGGraphBuilder(java.lang.String sysId)
           
 
Method Summary
 MTGNode getFirstNode()
           
 long getMTGNodeCount()
          Number of nodes generated.
protected  MTGNode getMTGRootNode()
          Allows MTGTranslator to obtain the root node of the graph generated from translating MTG data file.
 long getStage()
          Current stage being processed by the graph builder.
 boolean processTokens(java.lang.String[] tokens)
          Processes tokens and generates nodes and edges as necessary to the current graph.
 void removeInterScaleTopoRelations()
          Removes inter-scale topological relations (i.e. successor and branching edges).
 void removeTypes()
          Creates Node classes or Modules Types and stores them in the root node.
 void storeNodeListInRoot()
          Put node list into root node after building graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MTG_BODY_DATA

protected static final int MTG_BODY_DATA
See Also:
Constant Field Values

MTG_HEADER_ATTRIBUTES

protected static final int MTG_HEADER_ATTRIBUTES
See Also:
Constant Field Values

MTG_HEADER_CLASSES

protected static final int MTG_HEADER_CLASSES
See Also:
Constant Field Values

MTG_HEADER_CODE

protected static final int MTG_HEADER_CODE
See Also:
Constant Field Values

MTG_HEADER_TOPO

protected static final int MTG_HEADER_TOPO
See Also:
Constant Field Values
Constructor Detail

MTGGraphBuilder

public MTGGraphBuilder(java.lang.String sysId)
Method Detail

getFirstNode

public MTGNode getFirstNode()

getMTGNodeCount

public long getMTGNodeCount()
Number of nodes generated.

Returns:
long Number of nodes generated.

getMTGRootNode

protected MTGNode getMTGRootNode()
Allows MTGTranslator to obtain the root node of the graph generated from translating MTG data file.

Returns:
MTGNode The root node of the graph generated from MTG data file. Null if no graph generated.

getStage

public long getStage()
Current stage being processed by the graph builder.

Returns:
int Current stage being processed by the graph builder.

processTokens

public boolean processTokens(java.lang.String[] tokens)
                      throws MTGError.MTGGraphBuildException
Processes tokens and generates nodes and edges as necessary to the current graph.

Parameters:
tokens - Array of strings representing tokens.
Throws:
MTGError.MTGGraphBuildException

removeInterScaleTopoRelations

public void removeInterScaleTopoRelations()
                                   throws MTGError.MTGPlantFrameException
Removes inter-scale topological relations (i.e. successor and branching edges).

Throws:
MTGError.MTGPlantFrameException

removeTypes

public void removeTypes()
Creates Node classes or Modules Types and stores them in the root node.


storeNodeListInRoot

public void storeNodeListInRoot()
Put node list into root node after building graph.