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
-
CarrierInPipe()
-
Creates a Pipe with default values.
width=80, height=30, densityLevel=4 Orientation='East'.
-
CarrierInPipe(int, int, int, char)
-
Creates a Pipe with some of the default values.
-
CarrierInPipe(int, int, int, int, int, char, boolean, Color, boolean)
-
Creates a Pipe.
-
draw(Graphics)
-
Draws the pipe, which should be implemented in the containers.
-
isHorizon()
-
See if the pipe is a horizontal one.
-
move()
-
Makes the carriers in the pipe moving.
-
setDotsNumber(int)
-
Sets the carrier densityLevel in the pipe.
-
setHeight(int)
-
Sets the height of the pipe.
-
setOrientation(char)
-
Sets the orientation of the pipe.
-
setType(boolean)
-
Sets the carrier type in the pipe,
-
setXInit(int)
-
Sets x of the pipe.
-
setYInit(int)
-
Sets y of the pipe.
CarrierInPipe
public CarrierInPipe()
- Creates a Pipe with default values.
width=80, height=30, densityLevel=4 Orientation='East'.
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
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
draw
public void draw(Graphics g)
- Draws the pipe, which should be implemented in the containers.
- Parameters:
- g - the graphics context
move
public void move()
- Makes the carriers in the pipe moving.
setHeight
public void setHeight(int height)
- Sets the height of the pipe.
- Parameters:
- height - new pipe height
setXInit
public void setXInit(int xInit)
- Sets x of the pipe.
- Parameters:
- xInit - new x of the pipe
setYInit
public void setYInit(int yInit)
- Sets y of the pipe.
- Parameters:
- yInit - new y of the pipe
setType
public void setType(boolean isElectron)
- Sets the carrier type in the pipe,
- Parameters:
- isElectron - new carrier type
setDotsNumber
public void setDotsNumber(int dotsNumber)
- Sets the carrier densityLevel in the pipe.
- Parameters:
- dotsNumber - new carrier densityLevel
setOrientation
public void setOrientation(char orientation)
- Sets the orientation of the pipe.
- Parameters:
- orientation - new orientation of the pipe
isHorizon
public boolean isHorizon()
- See if the pipe is a horizontal one.
- Returns:
- isHorizon
All Packages Class Hierarchy This Package Previous Next Index