/*******************************************************************************
*                                                                              *
*  File:        Rhino_24.java                           Revision:  1.0         *
*                                                                              *
*  Contents:    a simple Rhino "Host Object"                                   *
*                                                                              *
*  Creation:    03.11.2001                     Last Modification:  03.11.2001  *
*                                                                              *
*  Platform:    IBM-compatible PC running Windows 98SE                         *
*                                                                              *
*  Environment: Java 1.3                                                       *
*                                                                              *
*  Author:      Andreas Rozek           Phone:  ++49 (711) 6770682             *
*               Kirschblütenweg 15      Fax:    -                              *
*             D-70569 Stuttgart         EMail:  Andreas.Rozek@T-Online.De      *
*               Germany                                                        *
*                                                                              *
*  URL:         http://www.Andreas-Rozek.de/                                   *
*                                                                              *
*  Copyright:   this software is published under the  "GNU Lesser General Pub- *
*               lic  License"  (see  "http://www.fsf.org/copyleft/lesser.html" *
*               for additional information)                                    *
*                                                                              *
*  Comments:    (none)                                                         *
*                                                                              *
*******************************************************************************/

import org.mozilla.javascript.*;                   // Rhino distribution classes

public class Rhino_24 extends ScriptableObject {
  static int StartValue = 0;              // just a non-public static "property"

  int Value;                                     // just a non-public "property"

/**** Java constructor without arguments - required to construct a new object ****/

  public Rhino_24 () {
    super();                                              // just to be complete
    Value = StartValue;
  };

/**** JavaScript "constructor" - used to initialize a recently created object ****/

  public void jsConstructor (int Value) {
    this.Value = Value;
  };

/**** JavaScript functions/methods ****/

  public static void jsStaticFunction_startWith (int newStartValue) {
    StartValue = newStartValue;
  };

  public boolean jsFunction_isZero () {
    return (Value == 0);
  };

  public void jsFunction_resetValue () {
    Value = StartValue;
  };

  public void jsFunction_throwException () {
    throw new NullPointerException("(exception thrown by a Rhino \"Host Object\")");
  };

/**** JavaScript accessor functions - implicitly define object properties ****/

  public int jsGet_StartValue () {
    return StartValue;
  };

  public int jsGet_Value () {
    return Value;
  };

  public void jsSet_Value (int Value) {
    this.Value = Value;
  };

/**** "getClassName" - used to determine the class name on the "JavaScript side" ****/

  public String getClassName () {
    return "Rhino_24";
  };
};

