|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xml.sax.HandlerBase | +--org.concord.biologica.engine.EngineObject | +--org.concord.biologica.engine.Family
This class represents a family of diploid organisms consisting of a female parent organism, a male parent organism and a set of child organisms.
An instance of this class is contained by one world.
An object of this class will generate the following property change events:
EngineProp.DELETED
,
EngineProp.ID
,
EngineProp.LOCKED_STATE
,
EngineProp.CHILD_ADDED
,
EngineProp.CHILD_REMOVED
,
PropertyChangeListener
, Serialized FormFields inherited from class org.concord.biologica.engine.EngineObject |
AUTOMATIC_LOCKED, AUTOMATIC_LOCKED_STRING, changes, deleted, FALSE, id, lockedState, MANUAL_AND_AUTOMATIC_LOCKED, MANUAL_AND_AUTOMATIC_LOCKED_STRING, MANUAL_LOCKED, MANUAL_LOCKED_STRING, NULL_ID, TRUE, UNLOCKED, UNLOCKED_STRING, xmlElementContext |
Constructor Summary | |
Family(Organism aParentOrganismOne,
Organism aParentOrganismTwo,
int aNumberOfChildren)
Create a family from a given set of 2 parents, creating the number of children specified. |
|
Family(Organism aParentOrganismOne,
Organism aParentOrganismTwo,
int aNumberOfChildren,
boolean onlyLiveChildren)
Create a family from a given set of 2 parents, creating the number of children specified and also respecting whether or not the children should all be alive. |
|
Family(Organism aParentOrganismOne,
Organism aParentOrganismTwo,
int aNumberOfFemaleChildren,
int aNumberOfMaleChildren)
Create a family from a given set of 2 parents, creating the number of female and male children specified. |
|
Family(Organism aParentOrganismOne,
Organism aParentOrganismTwo,
int aNumberOfFemaleChildren,
int aNumberOfMaleChildren,
boolean onlyLiveChildren)
Create a family from a given set of 2 parents, creating the number of female and male children specified. |
|
Family(Organism aParentOrganismOne,
Organism aParentOrganismTwo,
Organism aChildOrganism)
Create a family from a given set of 2 parents and one child. |
|
Family(Organism aParentOrganismOne,
Organism aParentOrganismTwo,
java.util.Vector aChildrenVector)
Create a family from a given set of 2 parents and optionally some children. |
|
Family(World aWorld,
java.lang.String anElementName,
int anElementID,
com.sun.xml.parser.Parser anXMLParser,
ImportContext importContext)
Create a new family and start handling XML parsing events to set the properties of this object. |
Method Summary | |
void |
addChild(Organism aChild)
Adds a child organism to this fammmily. |
java.util.Vector |
addChildren(int aNumberOfChildren,
boolean onlyLiveChildren)
|
java.util.Vector |
addChildren(int aNumberOfFemaleChildren,
int aNumberOfMaleChildren,
boolean onlyLiveChildren)
|
void |
characters(char[] ch,
int start,
int length)
Receive notification of character data. |
void |
delete()
Delete this object, notifying parent objects and deleting any child objects. |
void |
delete(boolean notifyChange)
|
void |
delete(boolean notifyChange,
boolean deleteChildren)
|
void |
endElement(java.lang.String anElementName)
Handle notification that the parsing of the given element has ended. |
int |
getCharacteristicCount(java.lang.String aCharacteristicName)
|
java.util.Enumeration |
getChildren()
Returns an enumeration over the children organisms of this family. |
Organism |
getFemaleParent()
Returns the female parent organism. |
int |
getGeneration()
Get the generation of this family. |
Organism |
getMaleParent()
Returns the male parent organism. |
int |
getNumberOfChildren()
Return the number of children of this family. |
World |
getWorld()
Get the world containing this object. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Receive notification of ignorable white space character data. |
boolean |
isChild(Organism organism)
|
void |
setAutomaticLocked(boolean automaticLocked)
Set or unset the automatic locked state of this object, leaving other components of the locked state untouched. |
void |
setLockedState(int aLockedState)
Set the locked state of the object, recursively setting the locked state of children objects. |
void |
setManualLocked(boolean manualLocked)
Set or unset the manual locked state of this object, leaving other components of the locked state untouched. |
void |
startElement(java.lang.String anElementName,
org.xml.sax.AttributeList amap)
Handle notification that the parser has hit the start of a new element with the given name and attributes. |
java.lang.String |
toString()
Return a string representation of this object, usually the object's name. |
void |
writeToStream(java.io.PrintWriter stream)
Writes this object to the given stream in XML format. |
Methods inherited from class org.concord.biologica.engine.EngineObject |
addPropertyChangeListener, getID, getLockedState, getLockedStateAsString, isAutomaticLocked, isDeleted, isLocked, isManualLocked, notifySelected, release, removePropertyChangeListener, setID, setLockedStateAsString |
Methods inherited from class org.xml.sax.HandlerBase |
endDocument, error, fatalError, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, startDocument, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Family(Organism aParentOrganismOne, Organism aParentOrganismTwo, java.util.Vector aChildrenVector)
aParentOrganismOne
- Organism - a parent organism, can be male or female, may not be null or NO_SEXaParentOrganismTwo
- Organism - a parent organism, must be other sex of anOrganismOne, may not be null or NO_SEXaChildrenVector
- Vector - a vector of children organisms, may be null or emptyjava.lang.IllegalArgumentException
- - input argument(s) illegalpublic Family(Organism aParentOrganismOne, Organism aParentOrganismTwo, Organism aChildOrganism)
aParentOrganismOne
- Organism - a parent organism, can be male or female, may not be null or NO_SEXaParentOrganismTwo
- Organism - a parent organism, must be other sex of anOrganismOne, may not be null or NO_SEXaChildOrganism
- Organism - a child organism, may be nulljava.lang.IllegalArgumentException
- - input argument(s) illegalpublic Family(Organism aParentOrganismOne, Organism aParentOrganismTwo, int aNumberOfChildren, boolean onlyLiveChildren)
aParentOrganismOne
- Organism - a parent organism, can be male or female, may not be null or NO_SEXaParentOrganismTwo
- Organism - a parent organism, must be other sex of anOrganismOne, may not be null or NO_SEXaNumberOfChildren
- int - the number of children to be createdonlyLiveChildren
- boolean - only create live childrenjava.lang.IllegalArgumentException
- - input argument(s) illegalpublic Family(Organism aParentOrganismOne, Organism aParentOrganismTwo, int aNumberOfChildren)
aParentOrganismOne
- Organism - a parent organism, can be male or female, may not be null or NO_SEXaParentOrganismTwo
- Organism - a parent organism, must be other sex of anOrganismOne, may not be null or NO_SEXaNumberOfChildren
- int - the number of children to be createdjava.lang.IllegalArgumentException
- - input argument(s) illegalpublic Family(Organism aParentOrganismOne, Organism aParentOrganismTwo, int aNumberOfFemaleChildren, int aNumberOfMaleChildren, boolean onlyLiveChildren)
aParentOrganismOne
- Organism - a parent organism, can be male or female, may not be null or NO_SEXaParentOrganismTwo
- Organism - a parent organism, must be other sex of anOrganismOne, may not be null or NO_SEXaNumberOfFemaleChildren
- int - the number of female children to be createdaNumberOfMaleChildren
- int - the number of male children to be createdonlyLiveChildren
- boolean - only create live childrenjava.lang.IllegalArgumentException
- - input argument(s) illegalpublic Family(Organism aParentOrganismOne, Organism aParentOrganismTwo, int aNumberOfFemaleChildren, int aNumberOfMaleChildren)
aParentOrganismOne
- Organism - a parent organism, can be male or female, may not be null or NO_SEXaParentOrganismTwo
- Organism - a parent organism, must be other sex of anOrganismOne, may not be null or NO_SEXaNumberOfFemaleChildren
- int - the number of female children to be createdaNumberOfMaleChildren
- int - the number of male children to be createdjava.lang.IllegalArgumentException
- - input argument(s) illegalpublic Family(World aWorld, java.lang.String anElementName, int anElementID, com.sun.xml.parser.Parser anXMLParser, ImportContext importContext)
aWorld
- World - the enclosing world for this new speciesanElementName
- String - the element nameanElementID
- int - the element idanXMLParser
- com.sun.xml.parser.Parser - the element parserimportContext
- ImportContext - import context for mapping ids from file to this worldjava.lang.IllegalArgumentException
- - input arguments illegalMethod Detail |
public java.util.Vector addChildren(int aNumberOfChildren, boolean onlyLiveChildren)
public java.util.Vector addChildren(int aNumberOfFemaleChildren, int aNumberOfMaleChildren, boolean onlyLiveChildren)
public void startElement(java.lang.String anElementName, org.xml.sax.AttributeList amap) throws org.xml.sax.SAXException
For internal elements (elements that are non-EngineObject instance variables of this object), call xmlElementContext.startElement() and xmlElementContext will receive the remaining element notifications. For external elements (elements that are EngineObject instance variables of this object), create an object of the appropriate class and that object will receive the remaining element notifications.
startElement
in class org.xml.sax.HandlerBase
anElementName
- String - name of elementamap
- AttributeList - an attribute listpublic void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in class org.xml.sax.HandlerBase
ch
- char[] - charactersstart
- int - start of stringlength
- int - length of stringpublic void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in class org.xml.sax.HandlerBase
ch
- char[] - charactersstart
- int - start of stringlength
- int - length of stringpublic void endElement(java.lang.String anElementName) throws org.xml.sax.SAXException
endElement
in class org.xml.sax.HandlerBase
anElementName
- String - the element namepublic void delete()
When this method is called, a property change event is generated for the property named EngineProp.DELETED.
delete
in class EngineObject
public void delete(boolean notifyChange)
public void delete(boolean notifyChange, boolean deleteChildren)
public void setAutomaticLocked(boolean automaticLocked)
When this property is changed, a property change event is fired for the property named EngineProp.LOCKED_STATE.
setAutomaticLocked
in class EngineObject
automaticLocked
- boolean - object should be automatic locked (true) or not (false)public void setManualLocked(boolean manualLocked)
When this property is changed, a property change event is fired for the property named EngineProp.LOCKED_STATE.
setManualLocked
in class EngineObject
manualLocked
- boolean - object should be manually locked (true) or not (false)public void setLockedState(int aLockedState)
When this property is changed, a property change event is fired for the property named EngineProp.LOCKED_STATE.
setLockedState
in class EngineObject
aLockedState
- int - new locked state of this objectjava.lang.IllegalArgumentException
- - new locked state invalidpublic java.lang.String toString()
toString
in class EngineObject
public Organism getFemaleParent()
public Organism getMaleParent()
public World getWorld()
getWorld
in class EngineObject
public java.util.Enumeration getChildren()
If there are no children in this family, an enumeration with no elements is returned.
If there are children in this family, the vector of children is cloned and an enumeration over that clone is returned. This enables you to safely modify the family and its children while using the enumeration.
public int getGeneration()
int
- - generation of this family (e.g. 1, 2, 3 as in F1, F2, F3)public int getCharacteristicCount(java.lang.String aCharacteristicName)
public boolean isChild(Organism organism)
public int getNumberOfChildren()
public void addChild(Organism aChild)
aChild
- Organism - the child organism to add to this family, may not be nulljava.lang.IllegalArgumentException
- - input argument(s) illegalpublic void writeToStream(java.io.PrintWriter stream) throws java.io.IOException
We could supply a default implementation that knows how to write the id value. But that convenience is not chosen because it's never correct to use just this implementation of these methods, so I'd rather have a compilation fail if a derived class fails to implement this method.
The inverse of this method is a constructor that takes a org.xml.sax.Parser argument and other arguments.
writeToStream
in class EngineObject
stream
- PrintWriter - print streamjava.lang.IllegalArgumentException
- - input arguments illegaljava.io.IOException
- - an IO error occurred in java libraries
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |