com.rubecula.darwin.domain.environment
Class TraitFactory

java.lang.Object
  extended by com.rubecula.darwin.domain.environment.TraitFactory

public final class TraitFactory
extends java.lang.Object

Factory Class to create Trait objects. Applications can't change this class (it is final) but they can override the methods which call these methods.

Author:
Robin Hillyard

Method Summary
static Trait makeDiscrete(Pharacter character, java.lang.String variant)
          Factory method to create a discrete trait -- that is where the value is one of a finite set of variants, as opposed to the variable trait as in the case of makeVariable(Pharacter, double).
static Trait makeTrait(java.lang.Class<? extends Trait> clazz, java.lang.Character character, java.lang.Object value)
          TEST
static Trait makeVariable(Pharacter character, double value)
          Factory method to create a variable trait -- that is where the value is infinitely (or relatively infinitely) variable (as opposed to one of a discrete set) as in the case of makeDiscrete(Pharacter, String).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

makeDiscrete

public static Trait makeDiscrete(Pharacter character,
                                 java.lang.String variant)
Factory method to create a discrete trait -- that is where the value is one of a finite set of variants, as opposed to the variable trait as in the case of makeVariable(Pharacter, double).

Parameters:
character - the phenotypic character of which this is a variant.
variant - the key to the variant.
Returns:
a newly constructed trait

makeTrait

public static Trait makeTrait(java.lang.Class<? extends Trait> clazz,
                              java.lang.Character character,
                              java.lang.Object value)
TEST

Parameters:
clazz - the class of Trait to instantiate, which must have a constructor of form Trait(Character,Object).
character - the phenotypic character to which this trait refers.
value - the value.
Returns:
a newly constructed trait

makeVariable

public static Trait makeVariable(Pharacter character,
                                 double value)
Factory method to create a variable trait -- that is where the value is infinitely (or relatively infinitely) variable (as opposed to one of a discrete set) as in the case of makeDiscrete(Pharacter, String). XXX check why there are two calls to this method. It seems to me there should be only one.

Parameters:
character - the phenotypic character of which this is an instance.
value - the value of the trait
Returns:
a newly constructed trait


Copyright © 2010 Rubecula Software, LLC. All Rights Reserved.