Class wb.GraphUnit
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class wb.GraphUnit

java.lang.Object
   |
   +----wb.GraphUnit

public class GraphUnit
extends Object
implements GTypes
GraphUnit, base class of all the objects and messages that float around all the participants over the network. This is the base representation of graph objects that are stored in the repositary. A lot of things like selection, alteration, Id (Key/hashcode) are not yet incorporated. Definitions about the possible types are imported indirectly thro the Interface GTypes. Clonability, user level finalization (public) has to be incorporated for better memory management.

Variable Index

 o bpos
BytePackOutputStream using which the instance details are sent over the network.
 o buis
ByteUnPackInputStream using which the instance details are received over the network.
 o color
Color of the GraphUnit
 o hashkey
HashCode of this unit this is assigned at the time of creation using the hashCode() of Object.
 o select
boolean to indicate that the object is in select mode this data is not transported.
 o type
Type of the GraphUnit
 o xmax
bounds of the GraphUnit.
 o xmin
bounds of the GraphUnit.
 o ymax
bounds of the GraphUnit.
 o ymin
bounds of the GraphUnit.

Constructor Index

 o GraphUnit(Color)
Creates an instance of GraphUnit with Color "arg"
 o GraphUnit(int, int, int, int)
Creates an instance of GraphUnit with Color "arg"
 o GraphUnit(int, int, int, int, Color)
Creates an instance of GraphUnit with Color "arg"
 o GraphUnit(DataInputStream)
Creates an instance of GraphUnit by reading data from the DataInputStream.

Method Index

 o ResetSelect()
Method to Reset the graphunit in select mode
 o addnext(int, int)
Add the next coordinate.
 o addnext(char)
Add the next char.
 o addnext(int)
Add the next integer.
 o addnext(String)
Append the String
 o basedepacketize(DataInputStream)
Helper routine for Stream based constructor.
 o basepacketize(DataOutputStream)
Helper routine for Object transport.
 o erase(Graphics, Color)
helper routine to render the graph unit in the background color to the graphics.
 o gethashkey()
gets the hashkey of graphunit
 o gettype()
gets the type of graphunit
 o isInside(int, int)
Method to check if the current object handles enclose the passed point
 o isSelect()
Method to check the select status
 o isValid()
isValid is very useful in determine'g miscellaneous objects at the time of creation.
 o packetize(DataOutputStream)
method for Object transport.
 o paint(Graphics)
helper routine to render the graph unit to the graphics.
 o setSelect()
Method to set the graphunit in select mode
 o setcolor(Color)
set the color of this graphunit
 o settype(int)
Sets the type of graphunit
 o setup(int, int, int, int)
Helper routine for base setup
 o setup(int, int, int, int, Color)
Helper routine for base setup

Variables

 o type
  protected int type
Type of the GraphUnit
 o xmin
  protected int xmin
bounds of the GraphUnit. these could be used in a varity of ways
 o ymin
  protected int ymin
bounds of the GraphUnit. these could be used in a varity of ways
 o xmax
  protected int xmax
bounds of the GraphUnit. these could be used in a varity of ways
 o ymax
  protected int ymax
bounds of the GraphUnit. these could be used in a varity of ways
 o color
  protected Color color
Color of the GraphUnit
 o bpos
  protected BytePackOutputStream bpos
BytePackOutputStream using which the instance details are sent over the network.
 o buis
  protected ByteUnPackInputStream buis
ByteUnPackInputStream using which the instance details are received over the network.
 o hashkey
  protected int hashkey
HashCode of this unit this is assigned at the time of creation using the hashCode() of Object. however, this is set appropriately when read from stream.
 o select
  protected boolean select
boolean to indicate that the object is in select mode this data is not transported.

Constructors

 o GraphUnit
  public GraphUnit(Color arg)
Creates an instance of GraphUnit with Color "arg"
Parameters:
arg - the Color of the GraphUnit
 o GraphUnit
  public GraphUnit(int x1,
                   int y1,
                   int x2,
                   int y2)
Creates an instance of GraphUnit with Color "arg"
Parameters:
x1 - x-coordinate of the min x (bound)
y1 - y-coordinate of the min y (bound)
x2 - x-coordinate of the max x (bound)
y2 - y-coordinate of the max y (bound)
arg - the Color of the GraphUnit
 o GraphUnit
  public GraphUnit(int x1,
                   int y1,
                   int x2,
                   int y2,
                   Color arg)
Creates an instance of GraphUnit with Color "arg"
Parameters:
x1 - x-coordinate of the min x (bound)
y1 - y-coordinate of the min y (bound)
x2 - x-coordinate of the max x (bound)
y2 - y-coordinate of the max y (bound)
arg - the Color of the GraphUnit
 o GraphUnit
  public GraphUnit(DataInputStream din) throws IOException
Creates an instance of GraphUnit by reading data from the DataInputStream. Useful for creating objects directly from the network. Uses helper routines like (basedepacketize). Must be handled with care when subclassed.
Parameters:
din, - DataInputStream from which the data is read.
Throws: IOException,
throws IOException when there is a read error
See Also:
basedepacketize

Methods

 o setup
  protected void setup(int x1,
                       int y1,
                       int x2,
                       int y2)
Helper routine for base setup
Parameters:
x1 - x-coordinate of the min x (bound)
y1 - y-coordinate of the min y (bound)
x2 - x-coordinate of the max x (bound)
y2 - y-coordinate of the max y (bound)
 o setup
  protected void setup(int x1,
                       int y1,
                       int x2,
                       int y2,
                       Color arg)
Helper routine for base setup
Parameters:
x1 - x-coordinate of the min x (bound)
y1 - y-coordinate of the min y (bound)
x2 - x-coordinate of the max x (bound)
y2 - y-coordinate of the max y (bound)
arg - Color of the Object
 o basedepacketize
  protected void basedepacketize(DataInputStream din) throws IOException
Helper routine for Stream based constructor. When sub-classed, care must be taken to match with the other helper method "basepacketize" while unpacking the data from the ByteUnPackInputSteam
Parameters:
din, - DataInputStream from which the data is read.
Throws: IOException,
throws IOException when there is a read error
See Also:
basepacketize, ByteUnPackInputStream
 o basepacketize
  protected void basepacketize(DataOutputStream dos) throws IOException
Helper routine for Object transport. When sub-classed, care must be taken to match with the other helper method "basedepacketize" while packing the data to the BytePackOutputStream. Once the data is sync'd to a buffer, if the object is modified there is no way this change would be reflected in the byte pack. I guess there should a way to resync, if this object is modified
Parameters:
dos, - DataOutputStream to which the data is to be written.
Throws: IOException,
throws IOException when there is a read error
See Also:
basedepacketize, BytePackOututStream
 o settype
  public void settype(int arg)
Sets the type of graphunit
Parameters:
arg - the type of GraphUnit. It should match with the type defined in the interface GTypes
See Also:
gettype, GTypes
 o gettype
  public int gettype()
gets the type of graphunit
Returns:
int the type of this graph unit
See Also:
settype, GTypes
 o gethashkey
  public int gethashkey()
gets the hashkey of graphunit
Returns:
int the hashkey of this graph unit
 o setcolor
  public void setcolor(Color arg)
set the color of this graphunit
Parameters:
arg - the Color of this graph unit
 o paint
  public void paint(Graphics g)
helper routine to render the graph unit to the graphics. called for screen update
Parameters:
g - Graphics
 o erase
  public void erase(Graphics g,
                    Color arg)
helper routine to render the graph unit in the background color to the graphics. Gives the effect of erasing the object
Parameters:
g - Graphics
arg - Color of the background
 o packetize
  public void packetize(DataOutputStream dos) throws IOException
method for Object transport. NOTE: Once the data is sync'd to a buffer, if the object is modified there is no way this change would be reflected in the byte pack. I guess there should a way to resync, if this object is modified
Parameters:
dos, - DataOutputStream to which the data is to be written.
Throws: IOException,
throws IOException when there is a read error
See Also:
basedepacketize, basepacketize, BytePackOututStream
 o addnext
  public void addnext(int x,
                      int y)
Add the next coordinate.
Parameters:
x - the x-coridinate
y - the y-coridinate
 o addnext
  public void addnext(char key)
Add the next char.
Parameters:
key - the character
 o addnext
  public void addnext(int x)
Add the next integer.
Parameters:
x - the integer
 o addnext
  public void addnext(String chardata)
Append the String
Parameters:
chardata - the String
 o isValid
  public boolean isValid()
isValid is very useful in determine'g miscellaneous objects at the time of creation.
Returns:
boolean true if valid else false
 o isInside
  public boolean isInside(int x,
                          int y)
Method to check if the current object handles enclose the passed point
Parameters:
x - x-coordinate of the point
y - y-coordinate of the point
Returns:
boolean true if the point(x,y) is enclosed in one of the handles assigned to this unit.
 o setSelect
  public void setSelect()
Method to set the graphunit in select mode
 o ResetSelect
  public void ResetSelect()
Method to Reset the graphunit in select mode
 o isSelect
  public boolean isSelect()
Method to check the select status
Returns:
true iff select is true

All Packages  Class Hierarchy  This Package  Previous  Next  Index