com.rubecula.darwin.domain.world
Class TraitFrequencyMap
java.lang.Object
com.rubecula.darwin.domain.world.FrequencyMap<java.lang.Object>
com.rubecula.darwin.domain.world.TraitFrequencyMap
- All Implemented Interfaces:
- HasMean
public class TraitFrequencyMap
- extends FrequencyMap<java.lang.Object>
- implements HasMean
Note that the objects that go into this frequency map may be variable and
therefore we call Trait.getKey()
to determine how to uniquely
identify the trait for purposes of the frequency map.
If you are sure that your traits are discrete you can use
FrequencyMap
based on Trait
.
You should not use this class for discrete traits.
- Author:
- Robin Hillyard
Methods inherited from class com.rubecula.darwin.domain.world.FrequencyMap |
add, add, clear, containsKey, get, getMap, getName, getTotal, isEmpty, keySet, log, output, output, remove, size |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TraitFrequencyMap
public TraitFrequencyMap(java.lang.String name)
- Parameters:
name
-
add
public void add(Trait key)
- Parameters:
key
- - See Also:
FrequencyMap.add(java.lang.Object)
add
public void add(Trait key,
int increment)
- Parameters:
key
- increment
- - See Also:
FrequencyMap.add(java.lang.Object,
int)
containsTrait
public boolean containsTrait(Trait trait)
- Parameters:
trait
-
- Returns:
- true if the map contains the value of trait as a key.
- See Also:
FrequencyMap.containsKey(java.lang.Object)
get
public int get(Trait trait)
- Parameters:
trait
-
- Returns:
- the frequency value of trait.
- See Also:
FrequencyMap.get(java.lang.Object)
mean
public double mean()
- Specified by:
mean
in interface HasMean
- Returns:
- the weighted mean of the values in the map.
remove
public int remove(Trait trait)
- Parameters:
trait
-
- Returns:
- the (former) frequency of the value of trait.
- See Also:
FrequencyMap.remove(java.lang.Object)
Copyright © 2010 Rubecula Software, LLC. All Rights Reserved.