com.yosokumo.core
Class Specimen

java.lang.Object
  extended by com.yosokumo.core.Specimen

public class Specimen
extends java.lang.Object

A row of values. Other terminology that is sometimes used: An observation, a record, an example, or an instance. These are the primary characteristics of a Specimen:


Nested Class Summary
static class Specimen.Status
          Provides a logical delete facility.
 
Constructor Summary
Specimen(long key)
          Initializes a newly created Specimen object with key specified by the input parameter.
Specimen(long key, java.util.Collection<Cell> cells)
          Initializes a newly created Specimen object with key and cell sequence as specified by the input parameters.
Specimen(long key, Specimen.Status status, long weight, Value predictand, java.util.Collection<Cell> cells)
          Initializes a newly created Specimen object with attributes specified by the input parameters.
Specimen(long key, Value predictand, java.util.Collection<Cell> cells)
          Initializes a newly created Specimen object with key, predictand, and cell sequence as specified by the input parameters.
 
Method Summary
 java.util.List<Cell> getCells()
          Return all cells in the cell sequence as a List<Cell>.
 Value getPredictand()
          Return the specimen predictand.
 long getSpecimenKey()
          Return the specimen key.
 Specimen.Status getStatus()
          Return the specimen status.
 long getWeight()
          Return the specimen weight.
 boolean isEmpty()
          Return true if the sequence contains no cells.
 void setCells(java.util.List<Cell> cells)
          Set the cells of this Specimen to the cell list specified by the parameter.
 void setPredictand(Value v)
          Set the specimen predictand.
 void setSpecimenKey(long key)
          Set the specimen key.
 void setStatus(Specimen.Status s)
          Set the specimen status.
 void setWeight(long w)
          Set the specimen weight.
 int size()
          Return the number of cells in the sequence.
 java.lang.String toString()
          Return a string representation of this Specimen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Specimen

public Specimen(long key)
Initializes a newly created Specimen object with key specified by the input parameter. Other attributes are set to default values:

Parameters:
key - the key of the specimen.

Specimen

public Specimen(long key,
                java.util.Collection<Cell> cells)
Initializes a newly created Specimen object with key and cell sequence as specified by the input parameters. Other attributes are set to default values:

Parameters:
key - the key of the specimen.
cells - the cell sequence of the specimen.

Specimen

public Specimen(long key,
                Value predictand,
                java.util.Collection<Cell> cells)
Initializes a newly created Specimen object with key, predictand, and cell sequence as specified by the input parameters. Other attributes are set to default values:

Parameters:
key - the key of the specimen.
predictand - the predictand of the specimen.
cells - the cell sequence of the specimen.

Specimen

public Specimen(long key,
                Specimen.Status status,
                long weight,
                Value predictand,
                java.util.Collection<Cell> cells)
Initializes a newly created Specimen object with attributes specified by the input parameters.

Parameters:
key - the key of the specimen.
status - the status of the specimen.
weight - the weight of the specimen.
predictand - the predictand of the specimen.
cells - the cell sequence of the specimen.
Method Detail

setSpecimenKey

public void setSpecimenKey(long key)
Set the specimen key.

Parameters:
key - the key to assign to this specimen. This is the unique identification of the specimen. It must be positive.

getSpecimenKey

public long getSpecimenKey()
Return the specimen key.

Returns:
the key of this specimen, which is the unique identification of the specimen.

setStatus

public void setStatus(Specimen.Status s)
Set the specimen status.

Parameters:
s - the status to assign to this specimen.

getStatus

public Specimen.Status getStatus()
Return the specimen status.

Returns:
the status of this specimen.

setWeight

public void setWeight(long w)
Set the specimen weight.

Parameters:
w - the weight to assign to this specimen.

getWeight

public long getWeight()
Return the specimen weight.

Returns:
the weight of this specimen.

setPredictand

public void setPredictand(Value v)
Set the specimen predictand.

Parameters:
v - the predictand to assign to this specimen.

getPredictand

public Value getPredictand()
Return the specimen predictand.

Returns:
the predictand of this specimen.

getCells

public java.util.List<Cell> getCells()
Return all cells in the cell sequence as a List<Cell>. This makes it possible to iterate over all cells in the sequence like this:
   for (Cell c : cellSequence.getCells())
   {
       process cell c
   }
 

Returns:
a sequence of all cells in the cell sequence.

setCells

public void setCells(java.util.List<Cell> cells)
Set the cells of this Specimen to the cell list specified by the parameter.

Parameters:
cells - a list of cells to assign to this Specimen

size

public int size()
Return the number of cells in the sequence.

Returns:
the number of cells in the sequence.

isEmpty

public boolean isEmpty()
Return true if the sequence contains no cells.

Returns:
true if the sequence contains no cells. false otherwise.

toString

public java.lang.String toString()
Return a string representation of this Specimen.

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this Specimen.