All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class crw.device.CarrierInPipe

java.lang.Object
   |
   +----crw.device.CarrierInPipe

public class CarrierInPipe
extends Object
This class simulates moving particles in different direction,
which should be implemented by other containers, like a canvas.
It provides the draw() method to visualize the moving carriers.
The particle shape in this version now is 'dot'.
Both V & H are available.

Version:
0.2 3/29/1999
Author:
Hongyu Lu
See Also:
CarrierMover

Constructor Index

 o CarrierInPipe()
Creates a Pipe with default values.
width=80, height=30, densityLevel=4 Orientation='East'.
 o CarrierInPipe(int, int, int, char)
Creates a Pipe with some of the default values.
 o CarrierInPipe(int, int, int, int, int, char, boolean, Color, boolean)
Creates a Pipe.

Method Index

 o draw(Graphics)
Draws the pipe, which should be implemented in the containers.
 o isHorizon()
See if the pipe is a horizontal one.
 o move()
Makes the carriers in the pipe moving.
 o setDotsNumber(int)
Sets the carrier densityLevel in the pipe.
 o setHeight(int)
Sets the height of the pipe.
 o setOrientation(char)
Sets the orientation of the pipe.
 o setType(boolean)
Sets the carrier type in the pipe,
 o setXInit(int)
Sets x of the pipe.
 o setYInit(int)
Sets y of the pipe.

Constructors

 o CarrierInPipe
 public CarrierInPipe()
Creates a Pipe with default values.
width=80, height=30, densityLevel=4 Orientation='East'.

 o CarrierInPipe
 public CarrierInPipe(int width,
                      int height,
                      int dotsNumber,
                      char orientation)
Creates a Pipe with some of the default values.

Parameters:
width - pipe width
height - pipe height
dotsNumber - densityLevel max=1, min=50
orientation - pipe orientation
 o CarrierInPipe
 public CarrierInPipe(int xInit,
                      int yInit,
                      int width,
                      int height,
                      int dotsNumber,
                      char orientation,
                      boolean isElectron,
                      Color background,
                      boolean withBorder)
Creates a Pipe.

Parameters:
xInit - x of pipe
yInit - y of pipe
width - pipe width
height - pipe height
dotsNumber - densityLevel max=1, min=50
orientation - pipe orientation
isElectron - carrier type
background - background color
withBorder - if drawing pipe with borders

Methods

 o draw
 public void draw(Graphics g)
Draws the pipe, which should be implemented in the containers.

Parameters:
g - the graphics context
 o move
 public void move()
Makes the carriers in the pipe moving.

 o setHeight
 public void setHeight(int height)
Sets the height of the pipe.

Parameters:
height - new pipe height
 o setXInit
 public void setXInit(int xInit)
Sets x of the pipe.

Parameters:
xInit - new x of the pipe
 o setYInit
 public void setYInit(int yInit)
Sets y of the pipe.

Parameters:
yInit - new y of the pipe
 o setType
 public void setType(boolean isElectron)
Sets the carrier type in the pipe,

Parameters:
isElectron - new carrier type
 o setDotsNumber
 public void setDotsNumber(int dotsNumber)
Sets the carrier densityLevel in the pipe.

Parameters:
dotsNumber - new carrier densityLevel
 o setOrientation
 public void setOrientation(char orientation)
Sets the orientation of the pipe.

Parameters:
orientation - new orientation of the pipe
 o isHorizon
 public boolean isHorizon()
See if the pipe is a horizontal one.

Returns:
isHorizon

All Packages  Class Hierarchy  This Package  Previous  Next  Index