|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ColoringRule
Coloring rule: the tool, choosing the color for drawing an abstract object.
The set of several coloring rules allows the main class Drawer3D
of this toolkit to get colors
for the passed collection of any objects (Collection<?>).
If you want to "teach" this toolkit to choose colors of drawn objects, you just need to provide necessary
implementation of this interface, which will choose for them some concrete colors.
This interface is used by Drawer3D.draw(java.util.Collection)
for choosing colors
of the passed objects, which are drawn with help of corresponding
drawing rules
.
The classes, implementing this interface, are thread-safe: they can be used simultaneously in several threads.
AlgART Laboratory 2010
Modifier and Type | Method and Description |
---|---|
java.awt.Color |
getColor(java.lang.Object item)
Returns the color of the specified object. |
boolean |
isApplicable(java.lang.Object item)
Checks whether this coloring rule is applicable to the given object (item), i.e. this coloring rule "knows" which color should be used for drawing this object. |
Method Detail |
---|
boolean isApplicable(java.lang.Object item)
getColor(Object)
method of this interface
for this object: it can throw an exception.
If this method returns true, you can freely use getColor(Object)
method.
If this method returns false for the given item for all coloring rules, available
in Drawer3D
object, then this item is not drawn by the
Drawer3D.draw(java.util.Collection)
method.
The argument of this method can be null; in this case, this method returns false.
item
- the object which you want to draw; can be null, then this method returns false.java.awt.Color getColor(java.lang.Object item)
isApplicable(Object)
returns false, this method usually throws
ClassCastException, but other runtime exceptions are also possible.
item
- some 3D object.java.lang.NullPointerException
- if the argument is null.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |