fluids
Class FluidContainer

java.lang.Object
  extended by objectdraw.ObjectDrawObject
      extended by objectdraw.ObjectDrawShape
          extended by objectdraw.ObjectDrawRectangularShape
              extended by objectdraw.FramedRect
                  extended by fluids.FluidContainer
All Implemented Interfaces:
Dependent, Drawable2DInterface, DrawableInterface, DrawableStrokeInterface, LocatableInterface, Resizable2DInterface
Direct Known Subclasses:
Pipe, Tank

public abstract class FluidContainer
extends FramedRect

FluidContainer is the shared superclass of both Tankand Pipe. It contains method to set the color that that container will appear in if its volume or flow rate is negative.

Author:
Russell Zahniser (russell@zahniser.net)

Field Summary
 
Fields inherited from interface objectdraw.DrawableStrokeInterface
CLICK_SIZE, DEFAULT_STROKE
 
Method Summary
 boolean contains(Location point)
          Determine whether a point is one of the pixels painted by this fluid container.
 Background getBackground()
          Return the Background object that this fluid container is placed on.
 Color getNegativeColor()
          Get the Color that will be used to draw this container when its volume or flow rate is negative.
 void removeFromCanvas()
          Removing a fluid container from its canvas also removes it from the background.
 void setColor(Color c)
          Set the color that will be used to draw this container when its volume or flow rate is positive.
 void setNegativeColor(Color c)
          Set the color that will be used to draw this container when its volume or flow rate is negative.
 
Methods inherited from class objectdraw.FramedRect
addToCanvas, getCanvas, getColor, getDoubleHeight, getDoubleWidth, getDoubleX, getDoubleY, getHeight, getLineWidth, getLocation, getStroke, getWidth, getX, getY, hide, isHidden, makeShape, move, moveTo, moveTo, overlaps, sendBackward, sendForward, sendToBack, sendToFront, setHeight, setLineWidth, setSize, setStroke, setWidth, show, toString
 
Methods inherited from class objectdraw.ObjectDrawRectangularShape
getBounds
 
Methods inherited from class objectdraw.ObjectDrawShape
clearCanvas, draw, draw, getDrawables, getShape, removeCanvas, setMyShape, update
 
Methods inherited from class objectdraw.ObjectDrawObject
deferUpdates, depend, runUpdates, undepend
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface objectdraw.DrawableInterface
draw, getShape
 

Method Detail

contains

public boolean contains(Location point)
Determine whether a point is one of the pixels painted by this fluid container.

Specified by:
contains in interface DrawableInterface
Overrides:
contains in class FramedRect
Parameters:
point - Location to check

getBackground

public Background getBackground()
Return the Background object that this fluid container is placed on.

Returns:
the Background

getNegativeColor

public Color getNegativeColor()
Get the Color that will be used to draw this container when its volume or flow rate is negative.

Returns:
the color negative flow is drawn with

removeFromCanvas

public void removeFromCanvas()
Removing a fluid container from its canvas also removes it from the background.

Specified by:
removeFromCanvas in interface DrawableInterface
Overrides:
removeFromCanvas in class FramedRect

setColor

public void setColor(Color c)
Set the color that will be used to draw this container when its volume or flow rate is positive.

Specified by:
setColor in interface DrawableInterface
Overrides:
setColor in class FramedRect
Parameters:
c - Color to draw with

setNegativeColor

public void setNegativeColor(Color c)
Set the color that will be used to draw this container when its volume or flow rate is negative.

Parameters:
c - Color to draw with