de.upb.swt.epctools.model
Class Node

java.lang.Object
  extended by de.upb.swt.epctools.model.Node
All Implemented Interfaces:
ModelListener
Direct Known Subclasses:
Item, SimNode

public abstract class Node
extends java.lang.Object
implements ModelListener

This is an important EPC model class representing an EPC node


Field Summary
private  int m_color
           
protected  java.lang.String m_description
           
private  EPC m_epc
           
private  int m_height
           
private  byte m_highlighted
           
private  int m_id
           
private  java.util.Vector<Arc> m_incoming_arcs
           
private  ModelListenerList m_listener
           
protected  java.lang.String m_name
           
private  java.util.Vector<Arc> m_outgoing_arcs
           
private  int m_pos_x
           
private  int m_pos_y
           
private  int m_type
           
private  int m_width
           
 NodePart part
           
static byte STATE_FALSE
           
static byte STATE_TRUE
           
static byte STATE_UNKNOWN
           
static int TYPE_AND
           
static int TYPE_EVENT
           
static int TYPE_FUNCTION
           
static int TYPE_NONE
          Note: This is a complete list of all Node types.
static int TYPE_OBJECT
           
static int TYPE_OR
           
static int TYPE_RANGE
           
static int TYPE_ROLE
           
static int TYPE_XOR
           
 
Fields inherited from interface de.upb.swt.epctools.model.tools.ModelListener
MSG_ARC_ADDED, MSG_ARC_RECONNECTED, MSG_ARC_REMOVED, MSG_BEND_POINT_CHANGE, MSG_CHANGED_ALGORITHM, MSG_CONSTRAINT_CHANGED, MSG_DESCRIPTION_CHANGED, MSG_FOLDERS_CHANGED, MSG_HIGHLIGHTING_CHANGED, MSG_IN_ARC_ADDED, MSG_IN_ARC_REMOVED, MSG_INFO_CHANGED, MSG_LOCATION_CHANGED, MSG_NAME_CHANGED, MSG_NODE_ADDED, MSG_NODE_REMOVED, MSG_OUT_ARC_ADDED, MSG_OUT_ARC_REMOVED, MSG_SIZE_CHANGED, MSG_SOURCE_CHANGED, MSG_STRUCTURE_CHANGED, MSG_TARGET_CHANGED
 
Constructor Summary
Node(EPC parent_epc)
          Initialization
 
Method Summary
 void addListener(ModelListener obj)
          ...
abstract  void computeNextState()
          This function must be overwritten by derived classes; it computes the resulting state when process folders are processed to outgoing Arcs.
static Node createNode(EPC parent_epc, int type)
          Returns a new Node of given type.
 void forwardMessage(int message)
          Forwards a message to all listener objects.
 int getColor()
          Returns the current color
 java.lang.String getDescription()
          Returns the description of "this" Node.
 Node getDistantParent()
          This function scans parent Nodes and return a Node as far as possible from "this" Therefore a random path is traversed starting at "this".
 EPC getEPC()
          Returns the parent EPC.
 int getHeight()
          Returns the height.
 int getId()
          Returns the id of "this" Node.
 java.util.Vector<Arc> getIncomingArcs()
          Returns all incoming Arcs.
 ModelListenerList getListeners()
          Returns a list of all listeners.
 void getMessage(int msg_id)
          This function is the listener callback function
 java.lang.String getName()
          Returns the name of "this" Node.
 java.util.Vector<Arc> getOutgoingArcs()
          Returns all outgoing Arcs.
 int getPosX()
          Returns the x position.
 int getPosY()
          Returns the y position.
 int getType()
          Returns the type of "this" Node
static java.util.Vector getTypes()
          Returns a new Vector with all types.
static java.lang.String getTypeString(int type)
          Returns a string corresponding to the parameter type.
 int getWidth()
          Returns the width of "this" Node.
 boolean hasLocalSemantics()
          Returns true if the semantics of "this" Node can be computed with local information.
 byte isEnabled()
          This function should be overwritten by derived classes to return whether the concerned Node may process folders to the Outgoing Arcs.
 byte isHighlighted()
          Returns whether the Node should be highlighted or not in the graphical editor.
 byte isInContact()
          Returns true if the Node is in a contact situation in the actual state.
 void removeListener(ModelListener obj)
          ...
 void sendRefreshMessage()
          This method sends a refresh message to the NodePart.
 void setColor(int color)
          Sets the color of "this".
 void setConstraint(int x, int y, int w, int h)
          This function can be used instead of setWidth(...), setHeight(...) etc.
 void setDescription(java.lang.String description)
          This function sets the description of "this" Node.
 void setHeight(int height)
          ...
 void setHighlighted(byte enabled)
          This function sets the state of this Node; it will influence the displayed graphics in the editor only.
 void setId(int id)
          This function sets the id of "this" Node.
 void setName(java.lang.String name)
          This function sets the name of "this" Node.
 void setPosition(int x, int y)
           
 void setType(int type)
          Sets the type of "this" Node, but only if it is not already defined.
 void setWidth(int width)
          ...
protected  byte simpleIsEnabled()
          Returns a positive result (it can be used by derived classes to define isEnabled()) iff all incoming arcs have at least 1 folder.
 byte simpleIsInContact()
          This function is a default function for computeContactFormula()
protected  void simpleNextStateComputation()
          This function computes the following changes to the state of process folders: All incoming folders are removed and the number of folders at outgoing arcs is increased by one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_id

private int m_id

m_name

protected java.lang.String m_name

m_description

protected java.lang.String m_description

m_pos_x

private int m_pos_x

m_pos_y

private int m_pos_y

m_width

private int m_width

m_height

private int m_height

m_outgoing_arcs

private java.util.Vector<Arc> m_outgoing_arcs

m_incoming_arcs

private java.util.Vector<Arc> m_incoming_arcs

m_epc

private EPC m_epc

m_color

private int m_color

m_type

private int m_type

m_listener

private ModelListenerList m_listener

part

public NodePart part

m_highlighted

private byte m_highlighted

STATE_FALSE

public static final byte STATE_FALSE
See Also:
Constant Field Values

STATE_TRUE

public static final byte STATE_TRUE
See Also:
Constant Field Values

STATE_UNKNOWN

public static final byte STATE_UNKNOWN
See Also:
Constant Field Values

TYPE_NONE

public static final int TYPE_NONE
Note: This is a complete list of all Node types. If a Node type was added, then the constructor and the static functions below must be changed too

See Also:
Constant Field Values

TYPE_EVENT

public static final int TYPE_EVENT
See Also:
Constant Field Values

TYPE_FUNCTION

public static final int TYPE_FUNCTION
See Also:
Constant Field Values

TYPE_ROLE

public static final int TYPE_ROLE
See Also:
Constant Field Values

TYPE_OBJECT

public static final int TYPE_OBJECT
See Also:
Constant Field Values

TYPE_OR

public static final int TYPE_OR
See Also:
Constant Field Values

TYPE_AND

public static final int TYPE_AND
See Also:
Constant Field Values

TYPE_XOR

public static final int TYPE_XOR
See Also:
Constant Field Values

TYPE_RANGE

public static final int TYPE_RANGE
See Also:
Constant Field Values
Constructor Detail

Node

public Node(EPC parent_epc)
Initialization

Method Detail

getEPC

public EPC getEPC()
Returns the parent EPC.


getListeners

public ModelListenerList getListeners()
Returns a list of all listeners.


getId

public int getId()
Returns the id of "this" Node.


setId

public void setId(int id)
This function sets the id of "this" Node.


setHighlighted

public void setHighlighted(byte enabled)
This function sets the state of this Node; it will influence the displayed graphics in the editor only.


sendRefreshMessage

public void sendRefreshMessage()
This method sends a refresh message to the NodePart. Note: This function does not really belong to the model, but there is no other possibility to solve the ComputationThread/SWT problem.


isHighlighted

public byte isHighlighted()
Returns whether the Node should be highlighted or not in the graphical editor. This does not always correspond to the fact that the Node can process a folder to outgoing arcs, so it is not equivalent to isEnabled().


isInContact

public byte isInContact()
Returns true if the Node is in a contact situation in the actual state.


isEnabled

public byte isEnabled()
This function should be overwritten by derived classes to return whether the concerned Node may process folders to the Outgoing Arcs. The return value can be Node.STATE_TRUE or Node.STATE_FALSE, all other results mean that the state could not be computed using local information only (i.e. incoming and outgoing arcs). The computation depends on whether multiple folders on Arcs are allowed or not.


computeNextState

public abstract void computeNextState()
This function must be overwritten by derived classes; it computes the resulting state when process folders are processed to outgoing Arcs.


simpleIsInContact

public byte simpleIsInContact()
This function is a default function for computeContactFormula()


simpleNextStateComputation

protected void simpleNextStateComputation()
This function computes the following changes to the state of process folders: All incoming folders are removed and the number of folders at outgoing arcs is increased by one.


simpleIsEnabled

protected byte simpleIsEnabled()
Returns a positive result (it can be used by derived classes to define isEnabled()) iff all incoming arcs have at least 1 folder.


getName

public java.lang.String getName()
Returns the name of "this" Node.


setName

public void setName(java.lang.String name)
This function sets the name of "this" Node.


getDescription

public java.lang.String getDescription()
Returns the description of "this" Node.


setDescription

public void setDescription(java.lang.String description)
This function sets the description of "this" Node.


getPosX

public int getPosX()
Returns the x position.


getPosY

public int getPosY()
Returns the y position.


getWidth

public int getWidth()
Returns the width of "this" Node.


getHeight

public int getHeight()
Returns the height.


setWidth

public void setWidth(int width)
...


setHeight

public void setHeight(int height)
...


setPosition

public void setPosition(int x,
                        int y)

setConstraint

public void setConstraint(int x,
                          int y,
                          int w,
                          int h)
This function can be used instead of setWidth(...), setHeight(...) etc. to set the position and size of "this" Node.


addListener

public void addListener(ModelListener obj)
...


removeListener

public void removeListener(ModelListener obj)
...


forwardMessage

public void forwardMessage(int message)
Forwards a message to all listener objects.


getOutgoingArcs

public java.util.Vector<Arc> getOutgoingArcs()
Returns all outgoing Arcs.


getIncomingArcs

public java.util.Vector<Arc> getIncomingArcs()
Returns all incoming Arcs.


getDistantParent

public Node getDistantParent()
This function scans parent Nodes and return a Node as far as possible from "this" Therefore a random path is traversed starting at "this".


setColor

public void setColor(int color)
Sets the color of "this". The color can be used to implement a search on the graph.


getColor

public int getColor()
Returns the current color


getType

public int getType()
Returns the type of "this" Node


setType

public void setType(int type)
Sets the type of "this" Node, but only if it is not already defined.


hasLocalSemantics

public boolean hasLocalSemantics()
Returns true if the semantics of "this" Node can be computed with local information.


createNode

public static Node createNode(EPC parent_epc,
                              int type)
Returns a new Node of given type.


getTypes

public static java.util.Vector getTypes()
Returns a new Vector with all types.


getTypeString

public static java.lang.String getTypeString(int type)
Returns a string corresponding to the parameter type.


getMessage

public void getMessage(int msg_id)
Description copied from interface: ModelListener
This function is the listener callback function

Specified by:
getMessage in interface ModelListener
Parameters:
msg_id - Message id