com.rubecula.darwin.domain.environment
Class Pharacter_

java.lang.Object
  extended by net.sf.tostring0.AToString
      extended by com.rubecula.darwin.domain.environment.Pharacter_
All Implemented Interfaces:
Pharacter, SexLinked, net.sf.tostring0.Identifiable, net.sf.tostring0.IToString
Direct Known Subclasses:
Pharacter_Fisherian, Pharacter_Sex

public abstract class Pharacter_
extends net.sf.tostring0.AToString
implements Pharacter

Base implementation of Pharacter (a Phenotypic Character). This class is the environmental analog to Locus_.

Author:
Robin Hillyard

Field Summary
 
Fields inherited from interface com.rubecula.darwin.domain.helper.Pharacter
SEX
 
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 Pharacter_(java.lang.String identifier, boolean sexLinked)
          Protected abstract constructor.
 
Method Summary
 java.lang.String addVariant(Variant variant)
          Add the variant to this Pharacter, set its character to be this; then return its key.
 boolean equals(java.lang.Object obj)
           
 java.lang.String getIdentifier()
          Get the identifier for this phenotypic character, for example "Eye Color".
 java.lang.String getKey(Variant variant)
          if _variants contains an element whose key is the variant's id, then return the key else null.
 Variant getVariant(java.lang.String key)
          Method to get the specific variant referred to by the key.
 java.util.Set<java.lang.String> getVariantKeys()
           
 java.util.Collection<Variant> getVariants()
           
 int hashCode()
           
 boolean isSexLinked()
           
 void setVariants(java.util.Collection<? extends Variant> variants)
          Clear the list of variants and add in all those from the given list.
 
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
 

Constructor Detail

Pharacter_

protected Pharacter_(java.lang.String identifier,
                     boolean sexLinked)
Protected abstract constructor.

Parameters:
identifier - the identifier for this character
sexLinked - XXX
Method Detail

addVariant

public java.lang.String addVariant(Variant variant)
Add the variant to this Pharacter, set its character to be this; then return its key.

Specified by:
addVariant in interface Pharacter
Parameters:
variant - A value which this character can take.
Returns:
the variant's key.
See Also:
com.rubecula.darwin.domain.helper.Pharacter#addVariant(com.rubecula .darwin.domain.helper.Variant)

equals

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

getIdentifier

public java.lang.String getIdentifier()
Get the identifier for this phenotypic character, for example "Eye Color".

Specified by:
getIdentifier in interface net.sf.tostring0.Identifiable
See Also:
Identifiable.getIdentifier()

getKey

public java.lang.String getKey(Variant variant)
if _variants contains an element whose key is the variant's id, then return the key else null.

Specified by:
getKey in interface Pharacter
Returns:
the key of the trait for this Pharacter, otherwise null
See Also:
Pharacter.getKey(com.rubecula.darwin.domain.helper.Variant)

getVariant

public Variant getVariant(java.lang.String key)
Method to get the specific variant referred to by the key.

Specified by:
getVariant in interface Pharacter
Parameters:
key - a string which identifies the variant from among those which are legal for this character. If the key is null, then we return null as the result. This is the case when a trait is variable and there is no registered variants.
Returns:
the trait for this character indicated by key.
See Also:
Pharacter.getVariant(java.lang.String)

getVariantKeys

public java.util.Set<java.lang.String> getVariantKeys()
Specified by:
getVariantKeys in interface Pharacter
Returns:
the set of keys of the variants.
See Also:
Pharacter.getVariantKeys()

getVariants

public java.util.Collection<Variant> getVariants()
Specified by:
getVariants in interface Pharacter
Returns:
the entire list of traits for this character. Getter/setter typically used by reflection.
See Also:
Pharacter.getVariants()

hashCode

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

isSexLinked

public boolean isSexLinked()
Specified by:
isSexLinked in interface SexLinked
Returns:
true if this object is sex-linked, that is to say it is a sex chromosome, a locus on a sex chromosome, or a phenotypic character which derives from one/more sex-linked gene(s).
See Also:
SexLinked.isSexLinked()

setVariants

public void setVariants(java.util.Collection<? extends Variant> variants)
Clear the list of variants and add in all those from the given list. For each of the variants, set its character to this.

Parameters:
variants - a collection of variants which will make up the variants for this phenotypic character.


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