|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ShapingRule
Shaping rule: the converter of an abstract object to 3D figure, that can be drawn by this toolkit.
The set of several shaping rules allows the main class Drawer3D
of this toolkit to draw
a collection of absolutely random objects (Collection<?>).
If you want to "teach" this toolkit to draw a new type of objects, you just need to provide necessary
implementation of this interface, which will convert them to 3D figures, "known" to this toolkit.
This interface is used by Drawer3D.draw(java.util.Collection)
for conversion of the passed objects
(Object type) into 3D figures (Shape3D
), which are drawn with help of corresponding
drawing rules
.
The classes, implementing this interface, are usually immutable and always thread-safe: they can be used simultaneously in several threads.
AlgART Laboratory 2010
Modifier and Type | Method and Description |
---|---|
Shape3D |
getShape(java.lang.Object item)
Returns the newly created shape of the specified 3D object. |
boolean |
isApplicable(java.lang.Object item)
Checks whether this shaping rule is applicable to the given object (item), i.e. this shaping rule "knows" which 3D shape describes this object. |
Method Detail |
---|
boolean isApplicable(java.lang.Object item)
3D shape
describes this object.
If this method returns false, you should not call getShape(Object)
method of this interface
for this object: it can throw an exception.
If this method returns true, you can freely use getShape(Object)
method.
If this method returns false for the given item for all shaping rules, available
in Drawer3D
object, and if this item does not implement Shape3D
interface itself,
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.Shape3D getShape(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 |