|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.yosokumo.core.Block com.yosokumo.core.SpecimenBlock
class SpecimenBlock
A block of Specimens
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.yosokumo.core.Block |
---|
Block.Type |
Field Summary | |
---|---|
private java.util.List<Specimen> |
specimenSequence
A sequence of Specimens . |
Constructor Summary | |
---|---|
SpecimenBlock()
Initializes a newly created SpecimenBlock object with default
attributes. |
|
SpecimenBlock(java.util.Collection<Specimen> specimenCollection)
Initializes a newly created SpecimenBlock object with the
specimen sequence specified by the input parameter. |
|
SpecimenBlock(java.lang.String id)
Initializes a newly created SpecimenBlock object with a study
identifier. |
|
SpecimenBlock(java.lang.String id,
java.util.Collection<Specimen> specimenCollection)
Initializes a newly created SpecimenBlock object with the
study identifier and the specimen sequence specified by the input
parameters. |
Method Summary | |
---|---|
(package private) void |
addSpecimen(Specimen specimen)
Add a Specimen to the block. |
(package private) boolean |
addSpecimens(java.util.Collection<Specimen> specimens)
Add a collection of Specimens to the block. |
(package private) void |
clearSpecimens()
Remove all specimens from the block. |
(package private) Specimen |
getSpecimen(int index)
Return a specimen from the block. |
(package private) java.util.List<Specimen> |
getSpecimenSequence()
Return all specimens in the block as a List<Specimen> . |
(package private) Block.Type |
getType()
Return the specimen block type. |
(package private) boolean |
isEmpty()
Return true if the block contains no specimens. |
(package private) boolean |
removeSpecimens(int numSpecimensToRemove)
Remove specimens from the end of the block. |
(package private) int |
size()
Return the number of specimens in the block. |
java.lang.String |
toString()
Return a string representation of this SpecimenBlock . |
Methods inherited from class com.yosokumo.core.Block |
---|
getStudyIdentifier, setStudyIdentifier |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.util.List<Specimen> specimenSequence
Specimens
.
Constructor Detail |
---|
SpecimenBlock()
SpecimenBlock
object with default
attributes.
SpecimenBlock(java.lang.String id)
SpecimenBlock
object with a study
identifier.
id
- a study identifier for the block.SpecimenBlock(java.util.Collection<Specimen> specimenCollection)
SpecimenBlock
object with the
specimen sequence specified by the input parameter.
specimenCollection
- the specimen sequence of the specimen.SpecimenBlock(java.lang.String id, java.util.Collection<Specimen> specimenCollection)
SpecimenBlock
object with the
study identifier and the specimen sequence specified by the input
parameters.
id
- a study identifier for the block.specimenCollection
- the specimen sequence of the specimen.Method Detail |
---|
Block.Type getType()
getType
in class Block
void addSpecimen(Specimen specimen)
Specimen
to the block. The specimen parameter is
appended to the end of the specimen sequence.
specimen
- the Specimen
to add to the block.boolean addSpecimens(java.util.Collection<Specimen> specimens)
Specimens
to the block. The
Specimens
in the collection specified by the parameter are
appended to the end of the specimen sequence. The order the
specimens are appended is the order in which the collection's
Iterator
returns the specimens.
specimens
- the collection of Specimens
to add to the
block.
boolean removeSpecimens(int numSpecimensToRemove)
numSpecimensToRemove
- is the number of specimens to remove
from the end of the block. If this value is zero or negative,
no specimens are removed. If this value exceeds the number
of specimens in the block, then all specimens are removed.
Specimen getSpecimen(int index)
for (int i = 0; i < specimenSequence.size(); ++i) { Specimen c = specimenSequence.getSpecimen(i) process specimen c }Caution: It is better to iterate over all specimens by using getSpecimenSequence as shown below because that approach is efficient no matter what kind of List is used to implement the sequence. Iterating as shown just above is extremely expensive if the LinkedList implementation is used.
index
- specifying the specimen of the 0-based block.
Specimen
at the location specified by the index.java.util.List<Specimen> getSpecimenSequence()
List<Specimen>
.
This makes it possible to iterate over all specimens in the block
like this:
for (Specimen c : specimenSequence.getSpecimenSequence()) { process specimen c }
void clearSpecimens()
int size()
boolean isEmpty()
true
if the block contains no specimens.
true
if the block contains no specimens.
false
otherwise.public java.lang.String toString()
SpecimenBlock
.
toString
in class Block
SpecimenBlock
.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |