|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ascape.model.event.DefaultScapeListener
org.ascape.view.nonvis.NonGraphicView
org.ascape.view.nonvis.ScapeFromFileView
public class ScapeFromFileView
A view that instantiates a scape with the contents of a file or input stream.
Agents will be assigned properties based on the values for a given record as
defined in the file header (first record.) The file is expected to be record
(agent) delimited in native format and field (property) delimited with a tab
character. For example a file with the contencts:
Age Wealth Size
12 150 200
20 1200 150
30 1300 110
Might create an agent of age 20, wealth 1200, and size 150. All values
specified in the header must be Java properties; that is, there must be
getters and setters defined in the agent for each value. How these agents are
created is specified by this control view's mode and order.
Field Summary | |
---|---|
static int |
ASSIGN_RANDOM_ORDER
The Constant ASSIGN_RANDOM_ORDER. |
static int |
ASSIGN_SEQUENTIAL_ORDER
The Constant ASSIGN_SEQUENTIAL_ORDER. |
static java.util.Comparator |
BACKWARD_COMPARE
The Constant BACKWARD_COMPARE. |
static int |
SIZE_BY_FILE_SEQUENTIAL_MODE
The Constant SIZE_BY_FILE_SEQUENTIAL_MODE. |
static int |
SIZE_BY_SCAPE_RANDOM_SAMPLE_MODE
The Constant SIZE_BY_SCAPE_RANDOM_SAMPLE_MODE. |
static int |
SIZE_BY_SCAPE_SEQUENTIAL_MODE
The Constant SIZE_BY_SCAPE_SEQUENTIAL_MODE. |
static int |
UNDEFINED_MODE
The Constant UNDEFINED_MODE. |
static int |
UNDEFINED_ORDER
The Constant UNDEFINED_ORDER. |
Fields inherited from class org.ascape.model.event.DefaultScapeListener |
---|
listeningToScape, name, scape |
Constructor Summary | |
---|---|
ScapeFromFileView()
|
Method Summary | |
---|---|
int |
getMode()
Gets the mode. |
int |
getOrder()
Gets the order. |
void |
scapeAdded(ScapeEvent scapeEvent)
Notifies the listener that the scape has added it. |
void |
scapeDeserialized(ScapeEvent event)
Method called immediatly after a model is deserialized. |
void |
scapeInitialized(ScapeEvent scapeEvent)
When scape is initialized, load appropriate values into scape. |
void |
setFile(java.lang.String filename)
Sets the file. |
void |
setInputStream(java.io.InputStream inputStream)
Sets the input stream. |
void |
setMode(int mode)
Sets the mode. |
void |
setOrder(int order)
Sets the order. |
Methods inherited from class org.ascape.view.nonvis.NonGraphicView |
---|
isGraphic |
Methods inherited from class org.ascape.model.event.DefaultScapeListener |
---|
clone, environmentQuiting, getName, getScape, isLifeOfScape, isNotifyScapeAutomatically, notifyScapeUpdated, scapeClosing, scapeIterated, scapeNotification, scapeRemoved, scapeSetup, scapeStarted, scapeStopped, setName, setNotifyScapeAutomatically, toString |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int UNDEFINED_MODE
public static final int SIZE_BY_FILE_SEQUENTIAL_MODE
public static final int SIZE_BY_SCAPE_SEQUENTIAL_MODE
public static final int SIZE_BY_SCAPE_RANDOM_SAMPLE_MODE
public static final int UNDEFINED_ORDER
public static final int ASSIGN_RANDOM_ORDER
public static final int ASSIGN_SEQUENTIAL_ORDER
public static final java.util.Comparator BACKWARD_COMPARE
Constructor Detail |
---|
public ScapeFromFileView()
Method Detail |
---|
public void setFile(java.lang.String filename) throws java.io.IOException
filename
- the new file
java.io.IOException
- Signals that an I/O exception has occurred.public void setInputStream(java.io.InputStream inputStream) throws java.io.IOException
inputStream
- the new input stream
java.io.IOException
- Signals that an I/O exception has occurred.public void scapeInitialized(ScapeEvent scapeEvent)
scapeInitialized
in interface ScapeListener
scapeInitialized
in class DefaultScapeListener
scapeEvent
- the scape eventpublic void scapeAdded(ScapeEvent scapeEvent) throws java.util.TooManyListenersException
scapeAdded
in interface ScapeListener
scapeAdded
in class DefaultScapeListener
scapeEvent
- the scape added notification event
java.util.TooManyListenersException
- the too many listeners exception
java.util.TooManyListenersException
- on attempt to add this listener to another scape when one
has already been assignedpublic int getOrder()
public void setOrder(int order)
order
- the new orderpublic int getMode()
public void setMode(int mode)
mode
- the new modepublic void scapeDeserialized(ScapeEvent event)
DefaultScapeListener
scapeDeserialized
in interface ScapeListener
scapeDeserialized
in class DefaultScapeListener
event
- the scape event
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |