algoanim.primitives
Class Primitive

java.lang.Object
  extended by algoanim.primitives.Primitive
Direct Known Subclasses:
AdvancedTextSupport, Arc, ArrayMarker, ArrayPrimitive, Circle, CircleSeg, Ellipse, EllipseSeg, Graph, Group, ListElement, MatrixPrimitive, Point, Polygon, Polyline, Rect, SourceCode, Square, Triangle, Variables, VHDLElement, VHDLWire, VisualQueue, VisualStack

public abstract class Primitive
extends java.lang.Object

A Primitive is an object which can be worked with in any animation script language. Since all Primitive types share a common administrative functionality this code is implemented in this class.

Author:
jens

Field Summary
protected  GeneratorInterface gen
           
 
Constructor Summary
protected Primitive(GeneratorInterface g, DisplayOptions d)
           
 
Method Summary
 void changeColor(java.lang.String colorType, java.awt.Color newColor, Timing t, Timing d)
          Changes the color of a part of this Primitive which is specified by colorType.
 void exchange(Primitive q)
          Changes the position of this Primitive with the given one.
 DisplayOptions getDisplayOptions()
          Returns the DisplayOptions of this Primitive.
 java.lang.String getName()
          Returns the name of this Primitive.
 void hide()
          Hides this Primitive now.
 void hide(Timing t)
          Hides this Primitive after the given time.
 void moveBy(java.lang.String moveType, int dx, int dy, Timing delay, Timing duration)
          Moves this Primitive to a Node.
 void moveTo(java.lang.String direction, java.lang.String moveType, Node target, Timing delay, Timing duration)
          TODO Über die Exceptions nachdenken...
 void moveVia(java.lang.String direction, java.lang.String moveType, Primitive via, Timing delay, Timing duration)
          Moves this Primitive along another one into a specific direction.
 void rotate(Node center, int degrees, Timing t, Timing d)
          Rotates this Primitive around a given center.
 void rotate(Primitive around, int degrees, Timing t, Timing d)
          Rotates this Primitive around another one after a time offset.
 void setName(java.lang.String newName)
          Sets the name of this Primitive.
 void show()
          Show this Primitive now.
 void show(Timing t)
          Show this Primitive after the given offset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gen

protected GeneratorInterface gen
Constructor Detail

Primitive

protected Primitive(GeneratorInterface g,
                    DisplayOptions d)
Parameters:
g - the appropriate code Generator for this Primitive.
d - [optional] the DisplayOptions for this Primitive.
Method Detail

getName

public java.lang.String getName()
Returns the name of this Primitive.

Returns:
the name of this Primitive.

setName

public void setName(java.lang.String newName)
Sets the name of this Primitive.

Parameters:
newName - the new name for this Primitive.

getDisplayOptions

public DisplayOptions getDisplayOptions()
Returns the DisplayOptions of this Primitive.

Returns:
the DisplayOptions of this Primitive.

exchange

public void exchange(Primitive q)
Changes the position of this Primitive with the given one.

Parameters:
q - the other Primitive.

rotate

public void rotate(Primitive around,
                   int degrees,
                   Timing t,
                   Timing d)
Rotates this Primitive around another one after a time offset. The duration of this operation may also be specified.

Parameters:
around - the center of the rotation.
degrees - the degrees by which the Primitive shall be rotated.
t - [optional] the offset until the operation shall be performed.
d - [optional] the time, this operation shall last.

rotate

public void rotate(Node center,
                   int degrees,
                   Timing t,
                   Timing d)
Rotates this Primitive around a given center.

Parameters:
center - the center of the rotation.
degrees - the degrees by which the Primitive shall be rotated.
t - [optional] the offset until the operation shall be performed.
d - [optional] the time, this operation shall last.

changeColor

public void changeColor(java.lang.String colorType,
                        java.awt.Color newColor,
                        Timing t,
                        Timing d)
Changes the color of a part of this Primitive which is specified by colorType. Please have a look at the appropriate Language class, where valid color types may be specified.

Parameters:
colorType - the part of this Primitive of which the color shall be changed.
newColor - the new color.
t - [optional] the offset until the operation shall be performed.
d - [optional] the time, this operation shall last.

moveVia

public void moveVia(java.lang.String direction,
                    java.lang.String moveType,
                    Primitive via,
                    Timing delay,
                    Timing duration)
             throws IllegalDirectionException
Moves this Primitive along another one into a specific direction.

Parameters:
direction - the direction to move the Primitive.
moveType - the type of the movement.
via - the Arc, along which the Primitive is moved.
delay - the delay, before the operation is performed.
duration - the duration of the operation.
Throws:
IllegalDirectionException

moveBy

public void moveBy(java.lang.String moveType,
                   int dx,
                   int dy,
                   Timing delay,
                   Timing duration)
Moves this Primitive to a Node.

Parameters:
moveType - the type of the movement.
dx - the x offset to move
dy - the y offset to move
delay - the delay, before the operation is performed.
duration - the duration of the operation.

moveTo

public void moveTo(java.lang.String direction,
                   java.lang.String moveType,
                   Node target,
                   Timing delay,
                   Timing duration)
            throws IllegalDirectionException
TODO Über die Exceptions nachdenken... (read on) So ist es äußerst inkonsequent und inkonsistent und ganz schlecht zu handhaben. Entweder wir statten das ganze mit deutlich mehr Exceptions aus, oder wir schmeissen diese eine auch raus. Moves this Primitive to a Node.

Parameters:
direction - the direction to move the Primitive.
moveType - the type of the movement.
target - the point where the Primitive is moved to.
delay - the delay, before the operation is performed.
duration - the duration of the operation.
Throws:
IllegalDirectionException

show

public void show(Timing t)
Show this Primitive after the given offset.

Parameters:
t - the offset until the operation shall be performed.

show

public void show()
Show this Primitive now.


hide

public void hide(Timing t)
Hides this Primitive after the given time.

Parameters:
t - the offset until the operation shall be performed.

hide

public void hide()
Hides this Primitive now.