Package jebl.evolution.characters

# Class DiscreteCharacter

java.lang.Object
jebl.evolution.characters.DiscreteCharacter

All Implemented Interfaces:
  `Character`

public class DiscreteCharacter extends Object implements Character

Author:
  Stephen A. Smith

## Constructor Summary

Constructors
Constructor
Description
`DiscreteCharacter(String name, String desc, int numOfStates)`
Constructs a basic DiscreteCharacter object with no taxa added yet
`DiscreteCharacter(String name, String desc, int numOfStates, Set<Taxon> taxa)`
Constructs a basic DiscreteCharacter object with taxa

## Method Summary

Modifier and Type
Method
Description
`void`
`addTaxon(Taxon taxon)`
add a taxon with this character
`String`
`getDesc()`
return the description of the character
`String`
`getName()`
return the name of the character
`double`
`getNumOfStates()`
`Map<Integer,String>`
`getStateDesc()`
`String`
`getStateDesc(int state)`
`Set<Taxon>`
`getTaxa()`
get a Set<Taxon> of all the taxa for this character
`CharacterType`
`getType()`
return the CharacterType of the character
`Object`
`getValue(Taxon taxon)`
get a value for a taxon containing the character
`boolean`
`isOrdered()`
`void`
`setDesc(String desc)`
set the description of the character
`void`
`setIsOrdered(boolean isOrdered)`
`void`
`setName(String name)`
set the name of the character
`void`
`setNumOfStates(int numOfStates)`
`void`
`setStateDesc(Map<Integer,String> stateDesc)`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DiscreteCharacter

public DiscreteCharacter(String name, String desc, int numOfStates)
Constructs a basic DiscreteCharacter object with no taxa added yet

Parameters:
  `name` - the name of the character
  `desc` - the description of the character
  `numOfStates` - the number of possible states for the character

### DiscreteCharacter

public DiscreteCharacter(String name, String desc, int numOfStates, Set<Taxon> taxa)
Constructs a basic DiscreteCharacter object with taxa

Parameters:
  `name` - the name of the character
  `desc` - the description of the character
  `numOfStates` - the number of possible states for the character
  `taxa` - the Set<Taxon> containing the taxa with this character

## Method Details

### setName

public void setName(String name)
Description copied from interface: `Character`
set the name of the character

Specified by:
  `setName` in interface `Character`
Parameters:
  `name` - the name of the character

### getName

public String getName()
Description copied from interface: `Character`
return the name of the character

Specified by:
  `getName` in interface `Character`
Returns:
  the name of the character

### setDesc

public void setDesc(String desc)
Description copied from interface: `Character`
set the description of the character

Specified by:
  `setDesc` in interface `Character`
Parameters:
  `desc` - the description of the character

### getDesc

public String getDesc()
Description copied from interface: `Character`
return the description of the character

Specified by:
  `getDesc` in interface `Character`
Returns:
  the description of the character

### getType

public CharacterType getType()
Description copied from interface: `Character`
return the CharacterType of the character

Specified by:
  `getType` in interface `Character`
Returns:
  the CharacterType of the character

### addTaxon

public void addTaxon(Taxon taxon)
Description copied from interface: `Character`
add a taxon with this character

Specified by:
  `addTaxon` in interface `Character`
Parameters:
  `taxon` - the taxon to add containing the character

### getValue

public Object getValue(Taxon taxon)
Description copied from interface: `Character`
get a value for a taxon containing the character

Specified by:
  `getValue` in interface `Character`
Parameters:
  `taxon` - the taxon to get the value for
Returns:
  the Object value of the character for the given taxon

### isOrdered

public boolean isOrdered()

Returns:
  whether character is ordered or not

### setIsOrdered

public void setIsOrdered(boolean isOrdered)

Parameters:
  `isOrdered` - set whether character is ordered or not

### getNumOfStates

public double getNumOfStates()

Returns:
  the number of possible states for the character

### setNumOfStates

public void setNumOfStates(int numOfStates)

Parameters:
  `numOfStates` - the number of possible states for the characeter

### getTaxa

public Set<Taxon> getTaxa()
Description copied from interface: `Character`
get a Set<Taxon> of all the taxa for this character

Specified by:
  `getTaxa` in interface `Character`
Returns:
  a Set<Taxon> containing all of the taxa for this character

### setStateDesc

public void setStateDesc(Map<Integer,String> stateDesc)

Parameters:
  `stateDesc` - a Mapinvalid input: '<'Integer, String> of the state descriptions corresponding to the values

### getStateDesc

public Map<Integer,String> getStateDesc()

Returns:
  the Mapinvalid input: '<'Integer, String> of the state descriptions corresponding to the values

### getStateDesc

public String getStateDesc(int state)

Parameters:
  `state` - corresponding to the state
Returns:
  state description