jvx.cellular

## Class PwSnake

- java.lang.Object
- - jv.object.PsObject
  - - jvx.project.PjWorkshop
    - - jvx.cellular.PwSnake

- All Implemented Interfaces:
    java.awt.event.KeyListener, java.io.Serializable, java.lang.Cloneable, java.lang.Runnable, java.util.EventListener, PsUpdateIf, PjWorkshopIf

      public class PwSnake
      extends PjWorkshop
      implements java.awt.event.KeyListener, java.lang.Runnable

  Snake game on arbitrary polyhedral surfaces.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class jv.object.PsObject

      `HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS`

    - ### Fields inherited from interface jv.project.PjWorkshopIf

      `MODE_BUG, MODE_STANDARD, MODE_VALIDATE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PwSnake()` Constructor

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Remove key listener from display, reset elementSet to state before starting the game, and destroy dialog window.
    `void` | `init()` Resets all properties to default values.
    `void` | `keyPressed(java.awt.event.KeyEvent e)` Store, if "Right" or "Left" key is pressed.
    `void` | `keyReleased(java.awt.event.KeyEvent e)` Store, if "Right" or "Left" key is pressed.
    `void` | `keyTyped(java.awt.event.KeyEvent e)` Just to fullfill KeyListener interface.
    `void` | `pause()` Pauses the game.
    `void` | `reset()` Reset workshop and geometry to original state.
    `void` | `resume()` Resumes a paused game.
    `void` | `run()` Run the snake until it dies.
    `void` | `setDisplay(PvDisplayIf display)` Store currently active display.
    `void` | `setGeometry(PgGeometry geom)` Assign a geometry on which this workshop operates,
    `void` | `start()` Start snake game in separate thread.
    `void` | `stop()` Stop snake game in separate thread.
    `boolean` | `update(java.lang.Object event)` Update the class whenever a child has changed.

    - ### Methods inherited from class jvx.project.PjWorkshop

      `cancel, getDisplay, getDisplays, getGeometry, getMode, getSavedGeometry, getViewer, isModal, isStandalone, ok, removeGeometry, setDisplays, setModal, setMode, setStandalone, setViewer`

    - ### Methods inherited from class jv.object.PsObject

      `addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface jv.object.PsUpdateIf

      `getFather, getName, setParent`

- - ### Constructor Detail

    - #### PwSnake

          public PwSnake()

      Constructor

  - ### Method Detail

    - #### init

          public void init()

      Resets all properties to default values.
      Overrides:
        `init` in class `PjWorkshop`

    - #### setGeometry

          public void setGeometry(PgGeometry geom)

      Assign a geometry on which this workshop operates,
      Specified by:
        `setGeometry` in interface `PjWorkshopIf`
      Overrides:
        `setGeometry` in class `PjWorkshop`
      Parameters:
        `geom` - the workshop modifies this geometry.

    - #### reset

          public void reset()

      Reset workshop and geometry to original state. Initialize necessary data to run the snake game.
      Overrides:
        `reset` in class `PjWorkshop`

    - #### update

          public boolean update(java.lang.Object event)

      Update the class whenever a child has changed. Method is usually invoked from the children.
      Specified by:
        `update` in interface `PsUpdateIf`
      Overrides:
        `update` in class `PjWorkshop`
      Parameters:
        `event` - sender of this update.
      Returns:
        true if update was correctly handled by superclass.
      See Also:
        `PsObject.setParent(PsUpdateIf)`, `PsObject.getFather()`, `PsObject.addUpdateListener(PsUpdateIf)`

    - #### setDisplay

          public void setDisplay(PvDisplayIf display)

      Store currently active display. This is necessary to get key events.
      Specified by:
        `setDisplay` in interface `PjWorkshopIf`
      Overrides:
        `setDisplay` in class `PjWorkshop`

    - #### close

          public void close()

      Remove key listener from display, reset elementSet to state before starting the game, and destroy dialog window.
      Overrides:
        `close` in class `PjWorkshop`

    - #### keyPressed

          public void keyPressed(java.awt.event.KeyEvent e)

      Store, if "Right" or "Left" key is pressed.
      Specified by:
        `keyPressed` in interface `java.awt.event.KeyListener`

    - #### keyReleased

          public void keyReleased(java.awt.event.KeyEvent e)

      Store, if "Right" or "Left" key is pressed.
      Specified by:
        `keyReleased` in interface `java.awt.event.KeyListener`

    - #### keyTyped

          public void keyTyped(java.awt.event.KeyEvent e)

      Just to fullfill KeyListener interface.
      Specified by:
        `keyTyped` in interface `java.awt.event.KeyListener`

    - #### start

          public void start()

      Start snake game in separate thread.

    - #### stop

          public void stop()

      Stop snake game in separate thread.

    - #### pause

          public void pause()

      Pauses the game.

    - #### resume

          public void resume()

      Resumes a paused game.

    - #### run

          public void run()

      Run the snake until it dies.
      Specified by:
        `run` in interface `java.lang.Runnable`

"

The software JavaView? is copyright protected. All Rights Reserved.
"