muskel
Class MdfGraph

java.lang.Object
  extended by muskel.MdfGraph

public class MdfGraph
extends java.lang.Object

This is the class used to store a whole graph. Accessory methods are provided to interact with and use the graph.


Field Summary
 boolean debug
           
 
Constructor Summary
MdfGraph()
          standard constructor
MdfGraph(int ggid)
          constructor with a given graph id (not used at the moment)
 
Method Summary
 void addInstruction(Mdfi instr)
          adds an instruction to the graph
 java.lang.Object clone()
          unused at the moment.
 java.lang.Object compute(java.lang.Object task)
          This is the method computing an MDF Graph on a given input token.
 int getGraphId()
          this is used to get the graph id.
 int getInputInstrId()
          This is used to get the index of the input instruction, the one where the input token has to be stored
 int getMaxInstrId()
          used to understand how to relocate next graph in compositions
 MdfGraph mdfClone()
          overrides the Object clone.
 void reloc(int offset)
          used to move the instruction ids in a graph in a new range.
 void setGid(int ggid)
          used to set graph id to a given value.
 void setId(int ggid)
          used to set the graph id when the graph is instantiated
 int setOutputInstrId(Dest d)
          looks for the only one instruction whose unique output token dest is NoInstrId and stores in it the given destination (if not null)
 java.lang.String toString()
          overrides Object toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

debug

public final boolean debug
See Also:
Constant Field Values
Constructor Detail

MdfGraph

public MdfGraph()
standard constructor


MdfGraph

public MdfGraph(int ggid)
constructor with a given graph id (not used at the moment)

Parameters:
ggid -
Method Detail

mdfClone

public MdfGraph mdfClone()
overrides the Object clone. Used to create a new instance of the graph each time a new item is got from the input stream.

Returns:
the (empty) graph

setId

public void setId(int ggid)
used to set the graph id when the graph is instantiated

Parameters:
ggid -

getGraphId

public int getGraphId()
this is used to get the graph id. It will be used to instantiate new instructions ... not derived from skeleton compilation

Returns:
the id of the graph

addInstruction

public void addInstruction(Mdfi instr)
adds an instruction to the graph

Parameters:
instr - the instruction to be added

reloc

public void reloc(int offset)
used to move the instruction ids in a graph in a new range. The offset is added to the all the instructions ids and token destinations are arranged accordingly

Parameters:
offset - the offset to be added to instruction ids

getInputInstrId

public int getInputInstrId()
This is used to get the index of the input instruction, the one where the input token has to be stored

Returns:
the index of the first instruction

setOutputInstrId

public int setOutputInstrId(Dest d)
looks for the only one instruction whose unique output token dest is NoInstrId and stores in it the given destination (if not null)

Parameters:
d - the Destination to be given to the last instruction
Returns:

getMaxInstrId

public int getMaxInstrId()
used to understand how to relocate next graph in compositions

Returns:

toString

public java.lang.String toString()
overrides Object toString

Overrides:
toString in class java.lang.Object
Returns:
the pretty printed graph

setGid

public void setGid(int ggid)
used to set graph id to a given value. It is used when a graph is instantiated with the new input stream token

Parameters:
ggid - the graph id

compute

public java.lang.Object compute(java.lang.Object task)
This is the method computing an MDF Graph on a given input token.
As the types are not known, the input token is actually an Object.

Parameters:
token - the value of the input task
Returns:
the value of the unique computed token

clone

public java.lang.Object clone()
unused at the moment.

Overrides:
clone in class java.lang.Object