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.
-
bpos
- BytePackOutputStream using which the instance details are sent over the
network.
-
buis
- ByteUnPackInputStream using which the instance details are received
over the network.
-
color
- Color of the GraphUnit
-
hashkey
- HashCode of this unit
this is assigned at the time of creation using the hashCode() of Object.
-
select
- boolean to indicate that the object is in select mode
this data is not transported.
-
type
- Type of the GraphUnit
-
xmax
- bounds of the GraphUnit.
-
xmin
- bounds of the GraphUnit.
-
ymax
- bounds of the GraphUnit.
-
ymin
- bounds of the GraphUnit.
-
GraphUnit(Color)
- Creates an instance of GraphUnit with Color "arg"
-
GraphUnit(int, int, int, int)
- Creates an instance of GraphUnit with Color "arg"
-
GraphUnit(int, int, int, int, Color)
- Creates an instance of GraphUnit with Color "arg"
-
GraphUnit(DataInputStream)
- Creates an instance of GraphUnit by reading data from the
DataInputStream.
-
ResetSelect()
- Method to Reset the graphunit in select mode
-
addnext(int, int)
- Add the next coordinate.
-
addnext(char)
- Add the next char.
-
addnext(int)
- Add the next integer.
-
addnext(String)
- Append the String
-
basedepacketize(DataInputStream)
- Helper routine for Stream based constructor.
-
basepacketize(DataOutputStream)
- Helper routine for Object transport.
-
erase(Graphics, Color)
- helper routine to render the graph unit in the background color
to the graphics.
-
gethashkey()
-
gets the hashkey of graphunit
-
gettype()
-
gets the type of graphunit
-
isInside(int, int)
- Method to check if the current object handles enclose the passed
point
-
isSelect()
- Method to check the select status
-
isValid()
- isValid is very useful in determine'g miscellaneous objects
at the time of creation.
-
packetize(DataOutputStream)
- method for Object transport.
-
paint(Graphics)
- helper routine to render the graph unit to the graphics.
-
setSelect()
- Method to set the graphunit in select mode
-
setcolor(Color)
-
set the color of this graphunit
-
settype(int)
-
Sets the type of graphunit
-
setup(int, int, int, int)
- Helper routine for base setup
-
setup(int, int, int, int, Color)
- Helper routine for base setup
type
protected int type
- Type of the GraphUnit
xmin
protected int xmin
- bounds of the GraphUnit. these could be used in a varity of ways
ymin
protected int ymin
- bounds of the GraphUnit. these could be used in a varity of ways
xmax
protected int xmax
- bounds of the GraphUnit. these could be used in a varity of ways
ymax
protected int ymax
- bounds of the GraphUnit. these could be used in a varity of ways
color
protected Color color
- Color of the GraphUnit
bpos
protected BytePackOutputStream bpos
- BytePackOutputStream using which the instance details are sent over the
network.
buis
protected ByteUnPackInputStream buis
- ByteUnPackInputStream using which the instance details are received
over the network.
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.
select
protected boolean select
- boolean to indicate that the object is in select mode
this data is not transported.
GraphUnit
public GraphUnit(Color arg)
- Creates an instance of GraphUnit with Color "arg"
- Parameters:
- arg - the Color of the GraphUnit
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
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
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
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)
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
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
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
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
gettype
public int gettype()
- gets the type of graphunit
- Returns:
- int the type of this graph unit
- See Also:
- settype, GTypes
gethashkey
public int gethashkey()
- gets the hashkey of graphunit
- Returns:
- int the hashkey of this graph unit
setcolor
public void setcolor(Color arg)
- set the color of this graphunit
- Parameters:
- arg - the Color of this graph unit
paint
public void paint(Graphics g)
- helper routine to render the graph unit to the graphics.
called for screen update
- Parameters:
- g - Graphics
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
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
addnext
public void addnext(int x,
int y)
- Add the next coordinate.
- Parameters:
- x - the x-coridinate
- y - the y-coridinate
addnext
public void addnext(char key)
- Add the next char.
- Parameters:
- key - the character
addnext
public void addnext(int x)
- Add the next integer.
- Parameters:
- x - the integer
addnext
public void addnext(String chardata)
- Append the String
- Parameters:
- chardata - the String
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
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.
setSelect
public void setSelect()
- Method to set the graphunit in select mode
ResetSelect
public void ResetSelect()
- Method to Reset the graphunit in select mode
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