hades.symbols
Class Symbol

java.lang.Object
  extended byjfig.objects.FigBaseobject
      extended byjfig.objects.FigCompound
          extended byhades.symbols.Symbol
All Implemented Interfaces:
FigDrawable, FigObject, java.io.Serializable
Direct Known Subclasses:
SevenSegmentMultiplexed.DynSymbol

public class Symbol
extends FigCompound
implements java.io.Serializable

Symbol: the graphical abstraction for a Hades simulation model.

This class is realized as a subclass of FigCompound, default layer is 50.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class jfig.objects.FigCompound
 
Fields inherited from class jfig.objects.FigBaseobject
attribs, bbox, comment, painter, printer, sc_bbox, sc_bbox_timestamp, selected, showPoints, syncRedrawFlag, timestamp, trafo, visible, x, y
 
Constructor Summary
Symbol()
          construct an empty Symbol.
 
Method Summary
 void addMember(FigObject obj)
          Add a new member to this Symbol and update the bounding box information.
 FigObject copy()
          The copy() method for a compound object.
 java.util.Enumeration elements()
          elements(): return an Enumeration of all FigObjects in this Symbol
 void fastAddMember(FigObject obj)
          add a new member object to this Symbol, but don't update the bounding box information (to save time).
 java.lang.String getOrientationString()
           
 SimObject getParent()
          return a reference to the parent of this Symbol
 java.lang.String[] getPortNames()
          return an array with the names of all Ports defined in this Symbol
 java.awt.Point getPortPosition(Port port)
           
 java.awt.Point getPortPosition(java.lang.String name)
          return the position (in world-coordinates) of Port 'name' on this Symbol.
 PortSymbol getPortSymbol(java.lang.String name)
          return a reference to a Port called 'name' on this Symbol, if any.
 java.awt.Point getPos()
          get the current position of this symbol
 void initializeFromFile(java.lang.String filename)
          find and read a Symbol 'schematic' from a file.
 void initializeFromResource(SimObject parent)
          find and read a Symbol 'schematic' from a Java 1.1 "resource" for parent's class.
 void message(java.lang.String msg)
           
 void mirrorX(int x, int y)
          mirrorX: we just call mirrorX() for each object in this compound and finally update our bounding-box.
 void mirrorY(int x, int y)
          mirrorY: we just call mirrorY() for each object in this compound and finally update our bounding-box.
 void move(int dx, int dy)
          move this symbol.
 void printDebugInfo()
           
 void setDebug(boolean _debug)
          set debug on/off
 void setInstanceLabel(java.lang.String name)
          find the first InstanceLabel in the current symbol objects and set a new text 'name' for it.
 void setLayer(int layer)
           
 void setOrientation(java.lang.String s)
          set a Symbol's orientation from a String with the following encoding:
 void setParent(SimObject parent)
           
 void setVisibility(LayerTable lt)
          setVisibility(): set the visibility of all elements in this Symbol
 java.lang.String toString()
          toString() - the usual info method
 void writeAsResource(java.io.PrintWriter ps)
          default implementation of 'writeAsResource'.
 
Methods inherited from class jfig.objects.FigCompound
canRotate, changeLayerRecursively, deleteAllMembers, deleteMember, getMembers, isMember, minDistanceEuclid, paint, paint, paintInverse, paintSave, rebuild, rotate, scale, setObjectPainter, setTrafo, setVisible, update_bbox, update
 
Methods inherited from class jfig.objects.FigBaseobject
appendPoint, build_sc_bbox, clonePoints, deletePoint, deselect, get_sc_bbox, getAttributes, getBbox, getComment, getLayer, getMovePointNeighbors, getNearestPoint, getNeighborPoints, getPoints, getPosition, getSyncRedrawFlag, getText, getTimestamp, getTrafo, initialize, insertPoint, isClosed, isSelected, isShowPoints, isVisible, isVisible, keyPressed, manhattan, minDistance, movePoint, numPoints, paint, reset_debug, select, set_debug, setAttributes, setComment, setConsole, setPoints, setSyncRedrawFlag, setText, showPoints, supportsPointOps, updateAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Symbol

public Symbol()
construct an empty Symbol. This constructor is used only for internal purposes.

Method Detail

setParent

public void setParent(SimObject parent)

setLayer

public void setLayer(int layer)

getPos

public java.awt.Point getPos()
get the current position of this symbol


move

public void move(int dx,
                 int dy)
move this symbol.

Specified by:
move in interface FigObject
Overrides:
move in class FigCompound

getParent

public SimObject getParent()
return a reference to the parent of this Symbol


setInstanceLabel

public void setInstanceLabel(java.lang.String name)
find the first InstanceLabel in the current symbol objects and set a new text 'name' for it.

The implementation of this method should be improved.


getPortSymbol

public PortSymbol getPortSymbol(java.lang.String name)
return a reference to a Port called 'name' on this Symbol, if any.


getPortPosition

public java.awt.Point getPortPosition(java.lang.String name)
return the position (in world-coordinates) of Port 'name' on this Symbol.


getPortPosition

public java.awt.Point getPortPosition(Port port)

getPortNames

public java.lang.String[] getPortNames()
return an array with the names of all Ports defined in this Symbol


elements

public java.util.Enumeration elements()
elements(): return an Enumeration of all FigObjects in this Symbol


setVisibility

public void setVisibility(LayerTable lt)
setVisibility(): set the visibility of all elements in this Symbol


getOrientationString

public java.lang.String getOrientationString()

setOrientation

public void setOrientation(java.lang.String s)
set a Symbol's orientation from a String with the following encoding:
     '@' : start of the orientation encoding.
     'N' : normal orientation
     'X' : mirror along x axis
     'Y' : mirror along y axis
     'Rnumber' : rotate 'number' degrees
     

Examples: @N, @XR90, @XYR135.6


initializeFromResource

public void initializeFromResource(SimObject parent)
find and read a Symbol 'schematic' from a Java 1.1 "resource" for parent's class.


initializeFromFile

public void initializeFromFile(java.lang.String filename)
find and read a Symbol 'schematic' from a file.


writeAsResource

public void writeAsResource(java.io.PrintWriter ps)
Description copied from class: FigBaseobject
default implementation of 'writeAsResource'. This will write a nearly xfig-compatible version of all basic FigObjects.

Specified by:
writeAsResource in interface FigObject
Overrides:
writeAsResource in class FigBaseobject

copy

public FigObject copy()
Description copied from class: FigCompound
The copy() method for a compound object. We first create a new compound object. Then we create copies of all members of this compound and add them to the new one. Finally we return the new compound.

To get the xfig copy behaviour, the editor may combine copy() with a subsequent move().

Specified by:
copy in interface FigObject
Overrides:
copy in class FigCompound

addMember

public void addMember(FigObject obj)
Add a new member to this Symbol and update the bounding box information.

we need to override addMember() from FigCompound, in order to handle late adding of members to a mirrored Symbol: If the Symbol is mirrored, we have to mirror the objects as well (best before adding them).

Overrides:
addMember in class FigCompound
Parameters:
obj - The editor object to add to this compound.

fastAddMember

public void fastAddMember(FigObject obj)
add a new member object to this Symbol, but don't update the bounding box information (to save time). This method is typically used to add several new members, with one additional call to update_bbox() later.

Overrides:
fastAddMember in class FigCompound
See Also:
addMember

mirrorX

public void mirrorX(int x,
                    int y)
Description copied from class: FigCompound
mirrorX: we just call mirrorX() for each object in this compound and finally update our bounding-box.

Specified by:
mirrorX in interface FigObject
Overrides:
mirrorX in class FigCompound

mirrorY

public void mirrorY(int x,
                    int y)
Description copied from class: FigCompound
mirrorY: we just call mirrorY() for each object in this compound and finally update our bounding-box.

Specified by:
mirrorY in interface FigObject
Overrides:
mirrorY in class FigCompound

printDebugInfo

public void printDebugInfo()

message

public void message(java.lang.String msg)
Overrides:
message in class FigBaseobject

setDebug

public void setDebug(boolean _debug)
set debug on/off


toString

public java.lang.String toString()
toString() - the usual info method

Specified by:
toString in interface FigObject
Overrides:
toString in class FigCompound