Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ascape.view.nonvis
Class ScapeFromFileView

    java.lang.Object
      org.ascape.model.event.DefaultScapeListener
          org.ascape.view.nonvis.NonGraphicView
              org.ascape.view.nonvis.ScapeFromFileView

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, java.util.EventListener, ScapeListener, HasName

    public class ScapeFromFileView

extends NonGraphicView

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.

Since:
  2.0
Version:
  2.0
Author:
  Miles Parker
See Also:
  Serialized Form

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

### UNDEFINED_MODE

    public static final int UNDEFINED_MODE

  The Constant UNDEFINED_MODE.

  See Also:
    Constant Field Values

### SIZE_BY_FILE_SEQUENTIAL_MODE

    public static final int SIZE_BY_FILE_SEQUENTIAL_MODE

  The Constant SIZE_BY_FILE_SEQUENTIAL_MODE.

  See Also:
    Constant Field Values

### SIZE_BY_SCAPE_SEQUENTIAL_MODE

    public static final int SIZE_BY_SCAPE_SEQUENTIAL_MODE

  The Constant SIZE_BY_SCAPE_SEQUENTIAL_MODE.

  See Also:
    Constant Field Values

### SIZE_BY_SCAPE_RANDOM_SAMPLE_MODE

    public static final int SIZE_BY_SCAPE_RANDOM_SAMPLE_MODE

  The Constant SIZE_BY_SCAPE_RANDOM_SAMPLE_MODE.

  See Also:
    Constant Field Values

### UNDEFINED_ORDER

    public static final int UNDEFINED_ORDER

  The Constant UNDEFINED_ORDER.

  See Also:
    Constant Field Values

### ASSIGN_RANDOM_ORDER

    public static final int ASSIGN_RANDOM_ORDER

  The Constant ASSIGN_RANDOM_ORDER.

  See Also:
    Constant Field Values

### ASSIGN_SEQUENTIAL_ORDER

    public static final int ASSIGN_SEQUENTIAL_ORDER

  The Constant ASSIGN_SEQUENTIAL_ORDER.

  See Also:
    Constant Field Values

### BACKWARD_COMPARE

    public static final java.util.Comparator BACKWARD_COMPARE

  The Constant BACKWARD_COMPARE.

Constructor Detail

### ScapeFromFileView

    public ScapeFromFileView()

Method Detail

### setFile

    public void setFile(java.lang.String filename)
                 throws java.io.IOException

  Sets the file.

  Parameters:
    `filename` - the new file
  Throws:
    `java.io.IOException` - Signals that an I/O exception has occurred.

### setInputStream

    public void setInputStream(java.io.InputStream inputStream)
                        throws java.io.IOException

  Sets the input stream.

  Parameters:
    `inputStream` - the new input stream
  Throws:
    `java.io.IOException` - Signals that an I/O exception has occurred.

### scapeInitialized

    public void scapeInitialized(ScapeEvent scapeEvent)

  When scape is initialized, load appropriate values into scape.

  Specified by:
    `scapeInitialized` in interface `ScapeListener`
  Overrides:
    `scapeInitialized` in class `DefaultScapeListener`
  Parameters:
    `scapeEvent` - the scape event

### scapeAdded

    public void scapeAdded(ScapeEvent scapeEvent)
                    throws java.util.TooManyListenersException

  Notifies the listener that the scape has added it.

  Specified by:
    `scapeAdded` in interface `ScapeListener`
  Overrides:
    `scapeAdded` in class `DefaultScapeListener`
  Parameters:
    `scapeEvent` - the scape added notification event
  Throws:
    `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 assigned

### getOrder

    public int getOrder()

  Gets the order.

  Returns:
    the order

### setOrder

    public void setOrder(int order)

  Sets the order.

  Parameters:
    `order` - the new order

### getMode

    public int getMode()

  Gets the mode.

  Returns:
    the mode

### setMode

    public void setMode(int mode)

  Sets the mode.

  Parameters:
    `mode` - the new mode

### scapeDeserialized

    public void scapeDeserialized(ScapeEvent event)

  Description copied from class: `DefaultScapeListener`
  Method called immediatly after a model is deserialized.

  Specified by:
    `scapeDeserialized` in interface `ScapeListener`
  Overrides:
    `scapeDeserialized` in class `DefaultScapeListener`
  Parameters:
    `event` - the scape event

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD