SEdit
Class Structure

java.lang.Object
  extended bySEdit.Structure
Direct Known Subclasses:
AutomatonStructure, MobileStructure, PetriStructure, WorldStructure

public class Structure
extends Object

A structure is the basic model data type. It contains nodes and arrows, and is responsible for creation, I/O, and identificaiton. The structure data type is completely decoupled from actual graphic representation (which is managed by the StructureEditor, and GObject plus its subclasses)

Version:
2.0
Author:
Jacques Ferber and Olivier Gutknecht
See Also:
StructureEditor

Field Summary
protected  StructureAgent agent
           
protected  Vector arrowList
           
protected  String description
           
protected  boolean displayGrid
           
protected  StructureEditor editor
           
protected  Formalism formalism
          The model formalism
protected  int gridSize
           
protected  boolean modified
          Ol: FIXME nobody sets this flag JF: right, but somebody should!!
protected  Vector nodeList
           
protected  boolean snapToGrid
           
 
Constructor Summary
Structure()
           
 
Method Summary
 void activate()
           
 void addArrow(SArrow o, SNode from, SNode to)
           
 void addArrow(SArrow o, String s, SNode from, SNode to)
           
 void addNode(SNode o)
           
 void addNode(SNode o, String s)
           
 void clearAll()
           
 SNode createNode(String nameDescr, int x, int y)
          create a node and install it into the editor.
 void deleteAll()
           
 void drawBackground(Graphics g)
          draw the background.
 void dump()
           
 void end()
          Called by the StructureAgent when the agent is killed Does nothing by default.
 boolean existID(String id)
          Find if a given ID exists already in the structure
 StructureAgent getAgent()
           
 SArrow getArrow(String id)
          Find an arrow by its ID
 SArrow getArrowFromLabel(String id)
          Return the *first* node with a given label in the structure
 Vector getArrows()
           
 String getDescription()
           
 boolean getDisplayGrid()
           
 StructureEditor getEditor()
           
 Formalism getFormalism()
           
 int getGridSize()
           
 SNode getNode(String id)
          Find a node by its ID
 SNode getNodeFromLabel(String name)
          Return the *first* node with a given label in the structure
 Vector getNodes()
           
 boolean getSnapToGrid()
           
 void initStructure()
          Initialize a structure when everything is OK.
 boolean isConnectable(SArrow edge, SNode from, SNode to)
           
 String newArrowID()
          Returns a new arrow ID not existing yet in the structure
 String newNodeID()
          Returns a new node ID not existing yet in the structure
 void preactivate()
           
 void removeArrow(SArrow o)
           
 void removeNode(SNode o)
           
 void setAgent(StructureAgent s)
           
 void setDescription(String s)
           
 void setDisplayGrid(boolean b)
           
 void setEditor(StructureEditor s)
           
 void setFormalism(Formalism f)
           
 void setGridSize(int n)
           
 void setSnapToGrid(boolean b)
           
 void setSnapToGrid1(boolean b)
           
 void toggleShowGrid()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

formalism

protected Formalism formalism
The model formalism


description

protected String description

nodeList

protected Vector nodeList

arrowList

protected Vector arrowList

modified

protected boolean modified
Ol: FIXME nobody sets this flag JF: right, but somebody should!! Ol: Not sure. Who sould know if a structure is modified or not ? The structure itself or the editor ?


editor

protected StructureEditor editor

agent

protected StructureAgent agent

snapToGrid

protected boolean snapToGrid

displayGrid

protected boolean displayGrid

gridSize

protected int gridSize
Constructor Detail

Structure

public Structure()
Method Detail

setFormalism

public void setFormalism(Formalism f)

getFormalism

public Formalism getFormalism()

getDescription

public String getDescription()

setDescription

public void setDescription(String s)

getNodes

public Vector getNodes()

getArrows

public Vector getArrows()

getEditor

public StructureEditor getEditor()

setEditor

public void setEditor(StructureEditor s)

getAgent

public StructureAgent getAgent()

setAgent

public void setAgent(StructureAgent s)

setSnapToGrid

public void setSnapToGrid(boolean b)

getSnapToGrid

public boolean getSnapToGrid()

setSnapToGrid1

public void setSnapToGrid1(boolean b)

setDisplayGrid

public void setDisplayGrid(boolean b)

getDisplayGrid

public boolean getDisplayGrid()

toggleShowGrid

public void toggleShowGrid()

setGridSize

public void setGridSize(int n)

getGridSize

public int getGridSize()

initStructure

public void initStructure()
Initialize a structure when everything is OK. Does nothing by default. May be redefined by subclasses.


end

public void end()
Called by the StructureAgent when the agent is killed Does nothing by default. May be used by subclasses.


activate

public void activate()

preactivate

public void preactivate()

clearAll

public void clearAll()

newNodeID

public String newNodeID()
Returns a new node ID not existing yet in the structure


newArrowID

public String newArrowID()
Returns a new arrow ID not existing yet in the structure


existID

public boolean existID(String id)
Find if a given ID exists already in the structure


addNode

public void addNode(SNode o)

addNode

public void addNode(SNode o,
                    String s)

addArrow

public void addArrow(SArrow o,
                     SNode from,
                     SNode to)

addArrow

public void addArrow(SArrow o,
                     String s,
                     SNode from,
                     SNode to)

isConnectable

public boolean isConnectable(SArrow edge,
                             SNode from,
                             SNode to)

removeNode

public void removeNode(SNode o)

removeArrow

public void removeArrow(SArrow o)

deleteAll

public void deleteAll()

getNode

public SNode getNode(String id)
Find a node by its ID


getArrow

public SArrow getArrow(String id)
Find an arrow by its ID


getNodeFromLabel

public SNode getNodeFromLabel(String name)
Return the *first* node with a given label in the structure


getArrowFromLabel

public SArrow getArrowFromLabel(String id)
Return the *first* node with a given label in the structure


drawBackground

public void drawBackground(Graphics g)
draw the background. Does nothing in Structure. May be overridden by subclasses.


createNode

public SNode createNode(String nameDescr,
                        int x,
                        int y)
create a node and install it into the editor.


dump

public void dump()

toString

public String toString()


Copyright © J. Ferber, O. Gutknecht All Rights Reserved.