edu.neu.ccs.gui
Class Mutator

java.lang.Object
  extended byedu.neu.ccs.gui.Mutator

public class Mutator
extends Object

Class Mutator encapsulates an abstract class Strategy that defines a mutator strategy for general Paintable objects and an abstract class StrategyUsage that decribes how to use a mutator strategy for a PaintableSequence.

This class also provides:

Class Mutator cannot itself be instantiated.

Since:
2.3
Version:
2.3.5
See Also:
AffineTransform, TransformFactory

Nested Class Summary
static class Mutator.Strategy
          Class Strategy encapsulates an algorithm that will produce a mutator AffineTransform given the center of an associated object.
static class Mutator.StrategyUsage
          Class StrategyUsage is used to define constants to be used to control the usage of Strategy objects.
 
Field Summary
static Mutator.StrategyUsage MUTATE_AS_GROUP
          The constant MUTATE_AS_GROUP signifies that a Strategy should mutate a collection as a group.
static Mutator.StrategyUsage MUTATE_AS_ITEMS
          The constant MUTATE_AS_ITEMS signifies that a Strategy should mutate a collection by acting on the individual items of the collection.
 
Constructor Summary
private Mutator()
          Private constructor to prevent instantiation.
 
Method Summary
static Mutator.Strategy centeredTransform(double m00, double m10, double m01, double m11, double m02, double m12)
          Returns the Mutator.Strategy encapsulation of centeredTransform in TransformFactory.
static Mutator.Strategy compose(Mutator.Strategy[] strategylist)
          Returns the composition of an array of Mutator.Strategy objects into a Mutator.Strategy object.
static Mutator.Strategy glidereflect(double degrees, double distance)
          Returns the Mutator.Strategy encapsulation of glidereflect in TransformFactory.
static Mutator.Strategy randomCenteredTransform(double maxshift)
          Returns the Mutator.Strategy encapsulation of randomCenteredTransform in TransformFactory.
static Mutator.Strategy randomRotate(double maxangle)
          Returns the Mutator.Strategy encapsulation of randomRotate in TransformFactory.
static Mutator.Strategy randomScale(double degrees, double maxdelta)
          Returns the Mutator.Strategy encapsulation of randomScale in TransformFactory.
static Mutator.Strategy randomTranslate(double maxshift)
          Returns the Mutator.Strategy encapsulation of randomTranslate in TransformFactory.
static Mutator.Strategy randomTranslateRotate(double maxshift, double maxangle)
          Returns the Mutator.Strategy encapsulation of randomTranslateRotate in TransformFactory.
static Mutator.Strategy reflect(double degrees)
          Returns the Mutator.Strategy encapsulation of reflect in TransformFactory.
static Mutator.Strategy rotate(double degrees)
          Returns the Mutator.Strategy encapsulation of rotate in TransformFactory.
static Mutator.Strategy scale(double degrees, double s, double t)
          Returns the Mutator.Strategy encapsulation of scale in TransformFactory.
static Mutator.Strategy shear(double degrees, double s)
          Returns the Mutator.Strategy encapsulation of shear in TransformFactory.
static Mutator.Strategy transform(AffineTransform T)
          Returns the Mutator.Strategy encapsulation of a specific transform that may be used independent of a center.
static Mutator.Strategy translate(double tx, double ty)
          Returns the Mutator.Strategy encapsulation of translate in TransformFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MUTATE_AS_GROUP

public static final Mutator.StrategyUsage MUTATE_AS_GROUP
The constant MUTATE_AS_GROUP signifies that a Strategy should mutate a collection as a group.

See Also:
MUTATE_AS_ITEMS

MUTATE_AS_ITEMS

public static final Mutator.StrategyUsage MUTATE_AS_ITEMS
The constant MUTATE_AS_ITEMS signifies that a Strategy should mutate a collection by acting on the individual items of the collection.

See Also:
MUTATE_AS_GROUP
Constructor Detail

Mutator

private Mutator()
Private constructor to prevent instantiation.

Method Detail

translate

public static Mutator.Strategy translate(double tx,
                                         double ty)
Returns the Mutator.Strategy encapsulation of translate in TransformFactory.

Parameters:
tx - the x-coordinate of the translate
ty - the y-coordinate of the translate
Returns:
the encapsulation of translate
See Also:
TransformFactory.translate(double, double)

rotate

public static Mutator.Strategy rotate(double degrees)
Returns the Mutator.Strategy encapsulation of rotate in TransformFactory.

Parameters:
degrees - the rotation angle in degrees
Returns:
the encapsulation of rotate
See Also:
TransformFactory.rotate(double, double, double)

scale

public static Mutator.Strategy scale(double degrees,
                                     double s,
                                     double t)
Returns the Mutator.Strategy encapsulation of scale in TransformFactory.

Parameters:
degrees - the angle in degrees of the main scaling axis
s - the scale factor along the axis at angle degrees
t - the scale factor along the axis at angle degrees+90
Returns:
the encapsulation of scale
See Also:
TransformFactory.scale(double, double, double, double, double)

shear

public static Mutator.Strategy shear(double degrees,
                                     double s)
Returns the Mutator.Strategy encapsulation of shear in TransformFactory.

Parameters:
degrees - the angle in degrees of the fixed axis for shear
s - determines the amount of shear along lines parallel to the fixed axis for shear
Returns:
the encapsulation of shear
See Also:
TransformFactory.shear(double, double, double, double)

reflect

public static Mutator.Strategy reflect(double degrees)
Returns the Mutator.Strategy encapsulation of reflect in TransformFactory.

Parameters:
degrees - the angle in degrees of the line of reflection
Returns:
the encapsulation of reflect
See Also:
TransformFactory.reflect(double, double, double)

glidereflect

public static Mutator.Strategy glidereflect(double degrees,
                                            double distance)
Returns the Mutator.Strategy encapsulation of glidereflect in TransformFactory.

Parameters:
degrees - the angle in degrees of the line of glide reflection
distance - the translation distance along the line of glide reflection
Returns:
the encapsulation of glidereflect
See Also:
TransformFactory.glidereflect(double, double, double, double)

centeredTransform

public static Mutator.Strategy centeredTransform(double m00,
                                                 double m10,
                                                 double m01,
                                                 double m11,
                                                 double m02,
                                                 double m12)
Returns the Mutator.Strategy encapsulation of centeredTransform in TransformFactory.

Parameters:
m00 - matrix coefficient for row 0 and column 0
m10 - matrix coefficient for row 1 and column 0
m01 - matrix coefficient for row 0 and column 1
m11 - matrix coefficient for row 1 and column 1
m02 - matrix coefficient for row 0 and column 2
m12 - matrix coefficient for row 1 and column 2
Returns:
the encapsulation of centeredTransform
See Also:
(double, double, double, double, double, double, double, double)

transform

public static Mutator.Strategy transform(AffineTransform T)
Returns the Mutator.Strategy encapsulation of a specific transform that may be used independent of a center.

Parameters:
T - the specific transform to encapsulate
Returns:
the encapsulation of T

randomTranslate

public static Mutator.Strategy randomTranslate(double maxshift)
Returns the Mutator.Strategy encapsulation of randomTranslate in TransformFactory.

Parameters:
maxshift - the bound for the translation along each axis
Returns:
the encapsulation of randomTranslate
See Also:
TransformFactory.randomTranslate(double)

randomRotate

public static Mutator.Strategy randomRotate(double maxangle)
Returns the Mutator.Strategy encapsulation of randomRotate in TransformFactory.

Parameters:
maxangle - the bound for the rotation angle in degrees
Returns:
the encapsulation of randomRotate
See Also:
TransformFactory.randomRotate(double, double, double)

randomTranslateRotate

public static Mutator.Strategy randomTranslateRotate(double maxshift,
                                                     double maxangle)
Returns the Mutator.Strategy encapsulation of randomTranslateRotate in TransformFactory.

Parameters:
maxshift - the bound for the translation along each axis
maxangle - the bound for the rotation angle in degrees
Returns:
the encapsulation of randomTranslateRotate
See Also:
TransformFactory.randomTranslateRotate(double, double, double, double)

randomScale

public static Mutator.Strategy randomScale(double degrees,
                                           double maxdelta)
Returns the Mutator.Strategy encapsulation of randomScale in TransformFactory.

Parameters:
degrees - the angle in degrees of the main scaling axis
maxdelta - the bound relative to 1 of the scale factors
Returns:
the encapsulation of randomScale
See Also:
TransformFactory.randomScale(double, double, double, double)

randomCenteredTransform

public static Mutator.Strategy randomCenteredTransform(double maxshift)
Returns the Mutator.Strategy encapsulation of randomCenteredTransform in TransformFactory.

Parameters:
maxshift - the bound on the perturbation coefficients
Returns:
the encapsulation of randomCenteredTransform
See Also:
TransformFactory.randomCenteredTransform(double, double, double)

compose

public static Mutator.Strategy compose(Mutator.Strategy[] strategylist)

Returns the composition of an array of Mutator.Strategy objects into a Mutator.Strategy object.

Given a center (x, y), the composite strategy computes an AffineTransform as follows.

For each strategy in the given list compute a transform corresponding to the center (x, y). Then compose these transforms to produce the resulting transform.

Parameters:
strategylist - the strategy objects to compose
Returns:
the composition of the strategy objects
See Also:
TransformFactory.compose(AffineTransform[])