com.rubecula.darwin.domain.environment
Class Trait_

java.lang.Object
  extended by net.sf.tostring0.AToString
      extended by com.rubecula.darwin.domain.environment.Trait_
All Implemented Interfaces:
Censusible, Expression, Trait, net.sf.tostring0.Identifiable, net.sf.tostring0.IToString
Direct Known Subclasses:
Trait_Discrete, Trait_Variable

public abstract class Trait_
extends net.sf.tostring0.AToString
implements Trait

Base implementation of Trait. TODO we should declare the type of value as Object and have the subtypes set values as appropriate (String, Number, etc.).

Author:
Robin Hillyard

Field Summary
 
Fields inherited from interface net.sf.tostring0.IToString
ANGBR_OPEN, ANGBRA_CLSE, BRA_CLSE, BRA_OPEN, BRCE_OPEN, BRCS_CLSE, COLON, LIST_SEPARATOR, MAX_ELEMENTS_DEFAULT, S_MT, S_PERCENT, SEPARATOR, SPACE
 
Constructor Summary
protected Trait_(Pharacter character, java.lang.String variant)
           
 
Method Summary
 boolean censusMe(Census census, java.lang.Object context)
          Method to census this object.
 boolean equals(java.lang.Object obj)
           
 java.util.Collection<? extends Censusible> getCensusibleChildren()
          Method to return a list of censusible children of this object.
 Pharacter getCharacter()
           
 java.lang.String getCharacterKey()
          TODO consider eliminating this method.
 java.lang.String getIdentifier()
           
 Phenotype getPhenotype()
          TODO consider renaming this method as getParent().
 java.lang.Object getValue()
          TODO consider eliminating this method.
 Variant getVariant()
          TODO consider eliminating this method.
 java.lang.String getVariantKey()
           
 int hashCode()
           
 void setPhenotype(Phenotype phenotype)
           
 
Methods inherited from class net.sf.tostring0.AToString
toString, toString, toStringBrief, toStringId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rubecula.darwin.domain.helper.Trait
getKey
 
Methods inherited from interface net.sf.tostring0.IToString
toString, toStringBrief, toStringId
 

Constructor Detail

Trait_

protected Trait_(Pharacter character,
                 java.lang.String variant)
Parameters:
character - the Pharacter of which this Trait is an instance.
variant - the key of the specific variant for this Trait
Method Detail

censusMe

public boolean censusMe(Census census,
                        java.lang.Object context)
Description copied from interface: Censusible
Method to census this object.

Specified by:
censusMe in interface Censusible
Parameters:
census - the census object which will present the results of taking this census
context - an arbitrary object which can be used by the census object to provide appropriate context for this object.
Returns:
true if we should continue censusing this object at deeper levels. If the result is false, then we do not call Censusible.getCensusibleChildren().
See Also:
Censusible.censusMe(com.rubecula.darwin.domain.helper.Census, java.lang.Object)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

getCensusibleChildren

public java.util.Collection<? extends Censusible> getCensusibleChildren()
Description copied from interface: Censusible
Method to return a list of censusible children of this object.

Specified by:
getCensusibleChildren in interface Censusible
Returns:
either null or an ArrayList of censusible objects.
See Also:
Censusible.getCensusibleChildren()

getCharacter

public Pharacter getCharacter()
Specified by:
getCharacter in interface Trait
Returns:
the Phenotypic character of which this Trait is a specific value.
See Also:
Trait.getCharacter()

getCharacterKey

public java.lang.String getCharacterKey()
Description copied from interface: Trait
TODO consider eliminating this method.

Specified by:
getCharacterKey in interface Trait
Returns:
the identifier of this character

getIdentifier

public java.lang.String getIdentifier()
Specified by:
getIdentifier in interface net.sf.tostring0.Identifiable
Returns:
getCharacterKey() ':' getVariantKey()
See Also:
Identifiable.getIdentifier()

getPhenotype

public Phenotype getPhenotype()
Description copied from interface: Trait
TODO consider renaming this method as getParent().

Specified by:
getPhenotype in interface Trait
Returns:
the phenotype to which this trait belongs.
See Also:
Trait.getPhenotype()

getValue

public java.lang.Object getValue()
Description copied from interface: Trait
TODO consider eliminating this method.

Specified by:
getValue in interface Trait
Returns:
the value of the underlying variant.
See Also:
Trait.getValue()

getVariant

public Variant getVariant()
Description copied from interface: Trait
TODO consider eliminating this method.

Specified by:
getVariant in interface Trait
Returns:
the variant for this trait.

getVariantKey

public java.lang.String getVariantKey()
Specified by:
getVariantKey in interface Trait
Returns:
the value of the _variant field.
See Also:
Trait.getVariantKey()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

setPhenotype

public void setPhenotype(Phenotype phenotype)
Specified by:
setPhenotype in interface Trait
See Also:
Trait.setPhenotype(com.rubecula.darwin.domain.helper.Phenotype)


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