|
|||||||||
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.World
This class represents a BioLogica world. There is a single world per BioLogica file. An object of this class will generate the following property change events:
EngineProp.ID
,
EngineProp.CURRENT_SPECIES
,
EngineProp.DELETED
,
EngineProp.DIRTY
,
EngineProp.FILE
,
EngineProp.ENVIRONMENT_ADDED
,
EngineProp.ENVIRONMENT_REMOVED
,
EngineProp.FAMILY_ADDED
,
EngineProp.FAMILY_REMOVED
,
EngineProp.LOCKED_STATE
,
EngineProp.ORGANISM_ADDED
,
EngineProp.ORGANISM_REMOVED
,
EngineProp.SPECIES_ADDED
,
EngineProp.SPECIES_REMOVED
,
EngineProp.TERRAIN_ADDED
,
EngineProp.TERRAIN_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 | |
World()
Creates a new world, as when creating a new world that has no associated file yet. |
|
World(java.io.File aFile)
Creates a new world with by opening the given file and retrieving the contents of the file. |
|
World(java.lang.String urlString)
Creates a new world with by opening the given url and retrieving the contents of the url file. |
Method Summary | |
void |
characters(char[] ch,
int start,
int length)
Receive notification of character data. |
void |
close()
Close the current engine, which is identical to delete -- I think! |
void |
delete()
Delete this object, notifying parent objects and deleting any child objects. |
void |
delete(boolean notifyChange)
|
void |
deleteAllFamilies(boolean notifyChange,
boolean deleteChildren)
|
void |
deleteAllOrganisms(boolean notifyChange)
|
void |
deleteSpecifiedFamilies(java.util.Vector familyList,
boolean notifyChange,
boolean deleteChildren)
|
void |
deleteSpecifiedOrganisms(java.util.Vector orgList,
boolean notifyChange)
|
void |
endDocument()
Handle notification that a document parse has ended. |
void |
endElement(java.lang.String anElementName)
Handle notification that the parsing of the given element has ended. |
Species |
getCurrentSpecies()
Get the current species. |
java.util.Enumeration |
getEnvironments()
Returns an enumeration over the vector of environments in this engine. |
java.util.Enumeration |
getFamilies()
Returns an enumeration over the vector of families in this engine. |
java.io.File |
getFile()
Return the current world file. |
java.lang.String |
getName()
Return the name of this world. |
int |
getNumberOfEnvironments()
Return the number of environments. |
int |
getNumberOfFamilies()
Return the number of families. |
int |
getNumberOfOrganisms()
Return the number of organisms. |
int |
getNumberOfSpecies()
Return the number of species. |
int |
getNumberOfTerrains()
Return the number of terrains of this world. |
java.util.Enumeration |
getOrganisms()
Returns an enumeration over the vector of organisms in this world. |
java.util.Enumeration |
getSpecies()
Returns an enumeration over the vector of species in this world. |
java.util.Enumeration |
getTerrains()
Returns an enumeration over the world's terrains. |
World |
getWorld()
Get the world containing this object. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Receive notification of ignorable white space character data. |
void |
initLoadImages()
|
void |
initLoadImages(java.lang.String s)
|
boolean |
isDirty()
Return the dirty state of this engine. |
void |
save()
Save the world state to the current file. |
void |
saveAs(java.io.File aFile)
Save As the world state to the new given file. |
void |
setAutomaticLocked(boolean automaticLocked)
Set or unset the automatic locked state of this object, leaving other components of the locked state untouched. |
void |
setCurrentSpecies(Species aSpecies)
Set the current species. |
void |
setDirty()
Set the dirty state of this engine to true. |
void |
setFile(java.io.File aFile)
Set file. |
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 |
startDocument()
Handle notification that a new document parse has started. |
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 |
error, fatalError, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.xml.sax.DocumentHandler |
processingInstruction, setDocumentLocator |
Constructor Detail |
public World()
public World(java.io.File aFile)
aFile
- File - file to be opened to create this world, may not be nulljava.lang.IllegalArgumentException
- - input argument(s) illegalInternalEngineException
- - multiple Engine objects detected in processpublic World(java.lang.String urlString)
urlString
- String - file to be opened to create this world, may not be nulljava.lang.IllegalArgumentException
- - input argument(s) illegalInternalEngineException
- - multiple Engine objects detected in processMethod Detail |
public 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 deleteSpecifiedFamilies(java.util.Vector familyList, boolean notifyChange, boolean deleteChildren)
public void deleteAllFamilies(boolean notifyChange, boolean deleteChildren)
public void deleteSpecifiedOrganisms(java.util.Vector orgList, boolean notifyChange)
public void deleteAllOrganisms(boolean notifyChange)
public java.lang.String toString()
toString
in class EngineObject
public World getWorld()
getWorld
in class EngineObject
public java.lang.String getName()
public boolean isDirty()
public void setDirty()
When this method is successful, a property change event is fired for the property named EngineProp.DIRTY.
java.lang.IllegalArgumentException
- - input argument illegalpublic java.io.File getFile()
public void setFile(java.io.File aFile)
When this property is changed, a property change event is fired for the property named EngineProp.FILE.
aFile
- File - the new file, may be nullpublic 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.util.Enumeration getSpecies()
public void initLoadImages()
public void initLoadImages(java.lang.String s)
public int getNumberOfSpecies()
public Species getCurrentSpecies()
public void setCurrentSpecies(Species aSpecies)
aSpecies
- Species - a species, may be nullpublic java.util.Enumeration getEnvironments()
public int getNumberOfEnvironments()
public int getNumberOfOrganisms()
public java.util.Enumeration getOrganisms()
public int getNumberOfFamilies()
public java.util.Enumeration getFamilies()
public int getNumberOfTerrains()
public java.util.Enumeration getTerrains()
If there are no terrains in this world, an enumeration with no elements is returned.
public void saveAs(java.io.File aFile)
aFile
- File - file to use in savingjava.lang.IllegalArgumentException
- - file not a valid filepublic void save()
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.DocumentHandler
startDocument
in class org.xml.sax.HandlerBase
org.xml.sax.DocumentHandler
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.DocumentHandler
endDocument
in class org.xml.sax.HandlerBase
org.xml.sax.DocumentHandler
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.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 interface org.xml.sax.DocumentHandler
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 interface org.xml.sax.DocumentHandler
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 interface org.xml.sax.DocumentHandler
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 interface org.xml.sax.DocumentHandler
endElement
in class org.xml.sax.HandlerBase
anElementName
- String - the element namepublic void close()
public 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 |