text:
  <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Win">
  <TITLE>VRML97, ISO/IEC 14772-1:1997 -- Annex B, Java Platform Scripting Reference</TITLE>

The Virtual Reality Modeling Language

Annex B

(normative)

Java platform scripting reference

 B.1 Introduction

This annex describes the Java platform classes and methods that enable
Script nodes (see 6.40, Script)
to interact with VRML scenes. See 4.12, Scripting,
for a general description of scripting languages in ISO/IEC 14772. Note
that support for the Java platform is not required by ISO/IEC 14772, but
any access of the Java platform from within VRML Script nodes shall conform
with the requirements specified in this annex.

B.1 Introduction

B.2 Platform

B.3 Supported protocol in the Script node's url field

       B.3.1 url
field

       B.3.2 File extension

       B.3.3 MIME type

B.4 EventIn handling

       B.4.1 Description

       B.4.2 Parameter
passing with event objects

       B.4.3 processEvents()
and processEvent() methods

                 B.4.3.1 processEvents() method

                 B.4.3.2 processEvent() method

       B.4.4 eventsProcessed()
method

       B.4.5 shutdown()
method

       B.4.6 initialize()
method

B.5 Accessing fields and events

       B.5.1 Accessing
fields, eventIns and eventOuts of the script

       B.5.2 Accessing
fields, eventIns and eventOuts of other nodes

       B.5.3 Sending
eventOuts or eventIns

B.6 Exposed classes and methods for nodes and fields

       B.6.1 Introduction

       B.6.2 Field class
and ConstField class

       B.6.3 Array handling

                 B.6.3.1 Format

                 B.6.3.2 Constructors and methods

       B.6.4 Node class

       B.6.5 Browser
class

       B.6.6 User-defined
classes and packages

       B.6.7 Standard
Java platform packages

B.7 Exceptions

B.8 Examples

B.9 Class definitions

       B.9.1 Class hierarchy

       B.9.2 VRML packages

                 B.9.2.1 vrml package

                 B.9.2.2 vrml.field package

                 B.9.2.3 vrml.node package

B.10 Example of exception class

 B.2 Platform

The Javatm platform
is an object-oriented, hardware and operating system independent, multi-threaded,
general-purpose application environment developed by Sun
Microsystems, Inc. The Java platform consists of the language, the virtual
machine, and a set of core class libraries. A conforming Java platform implements
all three components according to their specifications. See 2.[JAVA]
for a description of the language, the virtual machine, and the three core
classes java.lang, java.util, and java.io. The other core class libraries,
which are not used in this annex, are described in E.[JAPI].

 B.3 Supported protocol in the script
node's url field

B.3.1 url field

The url field of the Script node may contain URL
references to Java bytecode as illustrated below:

    Script {
      url "http://foo.co.jp/Example.class"
      eventIn SFBool start
    }

B.3.2 File extension

The file extension for Java bytecode is <TT>.class</TT>.

B.3.3 MIME type

The MIME type for Java bytecode is defined as follows:

    application/x-java

 B.4 EventIn handling

B.4.1 Description

Events to the Script node are passed to the corresponding Java platform
method (processEvents() or processEvent())
in the script. The script is specified in the url field of the Script
node.

For a Java bytecode file specified in the url field, the following
three conditions hold:

it shall contain the class definition whose name is exactly the same
  as the body of the file name

it shall be a subclass of the Script class (see B.9.2.3, vrml.node package)

it shall be declared as a "public" class

For example, the following Script node has one eventIn whose name is
start.

    Script {
      url "http://foo.co.jp/Example1.class"
      eventIn SFBool start
    }

This node points to the script file Example1.class. Its source (Example1.java)
looks like this:

    import vrml.*;
    import vrml.field.*;
    import vrml.node.*;

    public class Example1 extends Script {
        ...
        // This method is called when any event is received
        public void processEvent(Event e){
           // ... perform some operation ...
        }
    }

In the above example, when the start eventIn is sent the processEvent()
method receives the eventIn and is executed.

B.4.2 Parameter passing with Event objects

When a Script node receives an eventIn, a processEvent() or processEvents()
method in the file specified in the url field of the Script node is called,
which receives the eventIn as a Java platform object (Event object, see
B.4.3, processEvents() and processEvent() methods).

The Event object has three fields of information associated with it:
name, value, and timestamp, whose values are passed by the eventIn. These
can be retrieved using the corresponding method on the Event object.

   public class Event implements Cloneable {
      public String getName();
      public ConstField getValue();
      public double getTimeStamp();
      // other methods ...
   }

Suppose that the eventIn type is SFXXX and eventIn name is eventInYYY,
then

getName() shall return the string "eventInYYY "

getValue() shall return ConstField containing the value of the eventIn

getTimeStamp() shall return a double (in seconds) containing the timestamp
  when the eventIn occurred (see 4.11, Time)

In the example below, the eventIn name is start and the eventIn
value is cast to ConstSFBool. Also, the timestamp for the time when the
eventIn occurred is available as a double. These are passed as an Event
object to the processEvent() method:

    public void processEvent(Event e){
        if(e.getName().equals("start")){
              ConstSFBool v = (ConstSFBool)e.getValue();
              if(v.getValue()==true){
                   // ... perform some operation with e.getTimeStamp()...
              }
         }
    }

B.4.3 processEvents() and processEvent() methods

B.4.3.1 processEvents() method

Authors can define a processEvents() method within a class that is called
when the script receives some set of events. The prototype of the processEvents()
method is <TT>public void processEvents(int count, Event events[]);</TT>

count indicates the number of events delivered. events
is the array of events delivered. Its default behaviour is to iterate over
each event, calling processEvent() on each one as follows:

    public void processEvents(int count, Event events[])
    {
        for (int i = 0; i < count; i++){
            processEvent(events[i]);
        }
    }

Although authors might change this operation by giving a user-defined
processEvents() method, in most cases, they only change the processEvent()
method and the eventsProcessed() method as described below.

When multiple eventIns are routed from a single node to a single Script
node and eventIns which have the same timestamp are received, processEvents()
receives multiple events as an event array. Otherwise, each incoming event
invokes separate processEvents().

For example, the processEvents() method receives two events in the following
case, when the TouchSensor is activated:

    Transform {
      children [
        DEF TS TouchSensor {}
        Shape { geometry Cone {} }
      ]
    }
    DEF SC Script {
      url "Example.class"
      eventIn SFBool isActive
      eventIn SFTime touchTime
    }
    ROUTE TS.isActive  TO SC.isActive
    ROUTE TS.touchTime TO SC.touchTime

B.4.3.2 processEvent() method

Authors can define a processEvent() method within a class. The prototype
of the processEvent() is <TT>public void processEvent(Event event);</TT>

Its default behaviour is no operation.

B.4.4 eventsProcessed() method

Authors may define an eventsProcessed() method within a class that is
called after some set of events has been received. This allows Script nodes
that do not rely on the ordering of events received to generate fewer events
than an equivalent Script node that generates events whenever events are
received (see B.4.3.1, processEvents() method).

The prototype of the eventsProcessed() method is <TT>public void eventsProcessed();</TT>

Its default behaviour is no operation.

B.4.5 shutdown() method

Authors may define a shutdown() method within the Script class that is
called when the corresponding Script node is deleted or the world containing
the Script node is unloaded or replaced by another world (see 4.12.3, Initialize() and shutdown()).

The prototype of the shutdown() method is <TT>public void shutdown();</TT>

Its default behaviour is no operation.

B.4.6 initialize() method

Authors may define an initialize() method within the Script class that
is called before the browser presents the world to the user and before any
events are processed by any nodes in the same VRML file as the Script node
containing this script (see 4.12.3, Initialize() and shutdown()).
The various methods of the Script class such as getEventIn(), getEventOut(),
getExposedField(), and getField() are not guaranteed to return correct values
before the initialize() method has been executed. The initialize() method
is called once during the life of the Script object.

The prototype of the initialize() method is <TT>public void initialize();</TT>

Its default behaviour is no operation. See Example2.java
in B.5.1 for an example of a user-specified initialize() method.

 B.5 Accessing fields and events

B.5.1 Accessing fields, eventIns and eventOuts of
the script

The fields, eventIns, and eventOuts of a Script node are accessible from
its corresponding Script class. Each field defined in the Script node is
available to the Script class by using its name. Its value can be read-from
or written-into. This value is persistent across function calls. EventOuts
defined in the Script node can be read. EventIns defined in the Script node
can be written to.

Accessing the fields of the Script node can be done by using the following
three types of Script class methods:

<TT>Field getField(String fieldName)</TT>

  is the method to get the reference to the Script node's field whose name
  is fieldName. The return value can be converted to the appropriate
  subclass of the Field class, (see B.6.2, Field class and ConstField class).

<TT>Field getEventOut(String eventOutName)</TT>

  is the method to get the reference to the Script node's eventOut whose
  name is eventOutName. The return value can be converted to the appropriate
  subclass of the Field class, (see B.6.2, Field class and ConstField class).

<TT>Field getEventIn(String eventInName)</TT>

  is the method to get the reference to the Script node's eventIn whose name
  is eventInName. The return value can be converted to the appropriate
  subclass of the Field class, (see B.6.2, Field class and ConstField class).
  EventIn is a write-only field. When the getValue() method is invoked on
  a Field object obtained by the getEventIn() method, the return value is
  unspecified.

When the setValue(), set1Value(), addValue(), insertValue(), delete()
or clear() methods are invoked on a Field object obtained by the getField()
method, the new value is stored in the corresponding VRML node's field (see
also B.6.2, Field class and ConstField class,
and B.6.3, Array handling). In the case of
the set1Value(), addValue(), insertValue() or delete() methods, all elements
of the VRML node's field are retrieved, then the value specified as an argument
is set, added, inserted, deleted (as appropriate) to/from the elements,
and then stored as the elements in the corresponding VRML node's field.
In the case of the clear() method, all elements of a VRML node's field are
cleared (see the definition of the clear() method).

When the setValue(), set1Value(), addValue(), insertValue(), delete()
or clear() methods are invoked on a Field object obtained by the getEventOut()
method, the call generates an eventOut in the VRML scene (see also B.6.2, Field class and ConstField class,
and B.6.3, Array handling). The effect of
this eventOut is specified by the associated Route(s) in the VRML scene.
In the case of the set1Value(), addValue(), insertValue() or delete() methods,
all elements of the VRML node's eventOut are retrieved, then the value specified
as an argument is set, added, inserted or deleted (as appropriate) to/from
the elements, then stored as the elements in the corresponding VRML node's
eventOut, and then the eventOut is sent. In the case of the clear() method,
all elements of VRML node's eventOut are cleared and an eventOut with zero
elements is sent (see the definition of the clear()
method).

When the setValue() or clear() methods are invoked on a Field object
obtained by the getEventIn() method, the call generates an eventIn
to the Script node. When the set1Value(), addValue(), insertValue() or delete()
methods are invoked on a Field object obtained by the getEventIn() method,
the exception (InvalidFieldChangeException) is thrown.

For example, the following Script node (Example2) defines an eventIn
start, a field state, and an eventOut on. The method
initialize() is invoked before any events are received, and the method processEvent()
is invoked when start receives an event:

    Script {
      url      "Example2.class"
      eventIn  SFBool start
      field    SFBool state TRUE
      eventOut SFBool on
    }

Example2.java:

    // Example2 toggles a persistent field variable "state" in the VRML
    // Script node each time an eventIn "start" is received, then sets
    // eventOut "on" equal to the value of "state"
    import vrml.*;
    import vrml.field.*;
    import vrml.node.*;

    public class Example2 extends Script {
        private SFBool state; // field
        private SFBool on;    // eventOut

        public void initialize(){
            state = (SFBool) getField("state");
            on = (SFBool) getEventOut("on");
        }

        public void processEvent(Event e){
            if(state.getValue()==true){
                on.setValue(false); // set false to eventOut 'on'
                state.setValue(false);
            }
            else {
                on.setValue(true);  // set true to eventOut 'on'
                state.setValue(true);
            }
        }
    }

B.5.2 Accessing fields, eventIns and eventOuts of
other nodes

If a script program has an access to a node, any eventIn, eventOut or
exposedField of that node is accessible by using the getEventIn(), getEventOut()
or getExposedField() method defined in the node's class (see B.6.4,
Node class).

The typical way for a Script node to have an access to another VRML node
is to have an SFNode field which provides a reference to the other node.
The following Example3 shows how this is done:

    DEF SomeNode Transform {}
    Script {
      field SFNode node USE SomeNode # SomeNode is a Transform node
      eventIn SFVec3f pos            # new value to be inserted in
                                     #   SomeNode's translation field
      url "Example3.class"
    }

Example3.java:

    import vrml.*;
    import vrml.field.*;
    import vrml.node.*;

    public class Example3 extends Script {
        private SFNode node;   // field
        private SFVec3f trans; // translation field captured from remote
                               // Transform node

        public void initialize(){
            node = (SFNode) getField("node");
        }

        public void processEvent(Event e){
            // get the reference to the 'translation' field of the Transform node
            trans = (SFVec3f)((Node) node.getValue()).getExposedField("translation");
            // reset translation to value given in Event e, which is eventIn pos
            // in the VRML Script node.
            trans.setValue((ConstSFVec3f)e.getValue());
        }
    }

B.5.3 Sending eventOuts or eventIns

Assume that the thread which executes processEvent() (or processEvents())
is called 'main' thread and any other thread spawned by the Script, except
for the 'main' thread, is called 'sub' thread. Sending eventOuts/eventIns
in the 'main' thread follows the model described in 4.10.3, Execution model,
and sending eventOuts/eventIns in any 'sub' thread follows the model described
in 4.12.6, Asynchronous scripts.

In the 'main' thread: Calling one of the setValue(), set1Value,
addValue(), insertValue(), clear() or delete() methods on an eventOut/eventIn
sends that event at that time. Calling the methods multiple times during
one execution of the thread still only sends one event which corresponds
to the first call of the method. All other calls are ignored. The event
is assigned the same timestamp as the initial event which caused the main
thread to execute.

In the 'sub' thread: Calling one of the setValue(), set1Value,
addValue(), insertValue(), clear() or delete() method on an eventOut/eventIn
sends that event at that time. Calling the methods multiple times during
one execution of the thread sends one event per call of the method. The
browser assigns the timestamp to the event.

Note: sending eventIns is ordinarily performed by the VRML scene,
not by Java platform scripts. Exceptions are possible as specified in B.5.1, Accessing fields, eventIns and
eventOuts of the script.

 B.6 Exposed classes and methods for
nodes and fields

B.6.1 Introduction

Java platform classes for VRML are defined in the packages: vrml,
vrml.node and vrml.field.

The Field class extends the Java platform's Object
class by default; thus, Field has the full functionality of the Object
class, including the getClass()
method. The rest of the package defines a "Const" read-only class
for each VRML field type, with a getValue()
method for each class; and another read/write class for each VRML field
type, with both getValue() and setValue() methods for each class. A getValue()
method converts a VRML type value into a Java platform type value. A setValue()
method converts a Java platform type value into a VRML type value and sets
it to the VRML field.

Some methods are listed as "throws
exception," meaning that errors are possible. It may be necessary
to write exception handlers (using the Java platform's catch() method)
when those methods are used. Any method not listed as "throws exception"
is guaranteed to generate no exceptions. Each method that throws an exception
includes a prototype showing which exception(s) can be thrown.

B.6.2 Field class and ConstField class

All VRML data types have equivalent Java platform classes. The Field
class is the root of all field types.

    public abstract class Field implements Cloneable {
        // methods
    }

This class has two types of subclasses: read-only classes and read/write
classes

Read-only classes

  These classes support the getValue() method. Some classes support additional
  convenience methods to get value(s) from the object.

  ConstSFBool, ConstSFColor,
  ConstMFColor, ConstSFFloat,
  ConstMFFloat, ConstSFImage,
  ConstSFInt32, ConstMFInt32,
  ConstSFNode, ConstMFNode,
  ConstSFRotation, ConstMFRotation,
  ConstSFString, ConstMFString,
  ConstSFVec2f, ConstMFVec2f,
  ConstSFVec3f, ConstMFVec3f,
  ConstSFTime, ConstMFTime

Read/write classes

  These classes support both getValue() and setValue() methods. If the class
  name is prefixed with MF (meaning that it is a multiple valued field
  class), the class also supports the set1Value(), addValue() and insertValue()
  methods. Some classes support additional convenience methods to get and
  set value(s) from the object.

SFBool, SFColor,
  MFColor, SFFloat,
  MFFloat, SFImage,
  SFInt32, MFInt32,
  SFNode, MFNode, SFRotation, MFRotation,
  SFString, MFString,
  SFVec2f, MFVec2f,
  SFVec3f, MFVec3f,
  SFTime, MFTime

The VRML Field class and its subclasses have several methods to get and
set value(s): getSize(), getValue(), get1Value(), setValue(), set1Value(),
addValue(), insertValue(), clear(), delete() and toString(). In these methods,
getSize(), get1Value(), set1Value(), addValue(), insertValue(), clear()
and delete() are only available for multiple value field classes (MF classes).

<TT>getSize()</TT>

  is the method to return the number of elements of each multiple value field
  class (MF class).

<TT>getValue()</TT>

  is the method to convert a VRML type value into a Java platform type value
  and return it.

<TT>get1Value(int index)</TT>

  is the method to convert a single VRML type value (index-th element
  of an array) and return it as a single Java platform type value. The index
  of the first element is 0. Attempting to get an element beyond the length
  of the element array throws an exception (ArrayIndexOutOfBoundsException).

<TT>setValue(value)</TT>

  is the method to convert a Java platform type value into a VRML
  type value and copy it to the target object.

<TT>set1Value(int index, value)</TT>

  is the method to convert from a Java platform type value to a VRML
  type value and copy it to the index-th element of the target object.
  The index of the first element is 0. Attempting to set an element beyond
  the length of the element array throws an exception (ArrayIndexOutOfBoundsException).

<TT>addValue(value)</TT>

  is the method to convert from a Java platform type value to a VRML
  type value and append it to the target object, thus adding an element.

<TT>insertValue(int index, value)</TT>

  is the method to convert from a Java platform type value to a VRML
  type value and insert it as a new element at the index-th position,
  thus adding an element. The index of the first element is 0. Attempting
  to insert the element beyond the length of the element array throws an
  exception (ArrayIndexOutOfBoundsException).

<TT>clear()</TT>

  is the method to clear all elements in the target object so that it has
  no more elements in it.

<TT>delete(int index)</TT>

  is the method to delete the index-th element from the target object,
  thus decreasing the length of the element array by one. The index of the
  first element is 0. Attempting to delete the element beyond the length
  of the element array throws an exception (ArrayIndexOutOfBoundsException).

<TT>toString()</TT>

  is the method to return a String containing the VRML utf8 encoded value
  (or values) of the equivalent of the field. In the case of the SFNode(ConstSFNode)
  and MFNode (ConstMFNode),

SFNode(ConstSFNode): the method returns the VRML utf8 string
    that, if parsed as the value of an SFNode field, would produce this node.
    If the browser is unable to reproduce this node, the name of the node followed
    by the open brace and close brace shall be returned. Additional information
    may be included as one or more VRML comment strings.

MFNode(ConstMFNode): the method returns the VRML utf8 string
    that, if parsed as the value of a MFNode field, would produce this array
    of nodes. If the browser is unable to reproduce this node, the name of
    the nodes followed by the open brace and close brace shall be returned.
    Additional information may be included as one or more VRML comment strings

See also B.5.1, Accessing fields, eventIns and eventOuts of the Script,
B.6.3, Array handling, B.6.4, Node class,
and B.9.2.1, vrml package, for each class'
methods definition.

B.6.3 Array handling

B.6.3.1 Format

Some constructors and other methods of the field classes take an array
as an argument.

A single-dimensional
  array

Some constructors and other methods of the following classes take a
  single-dimensional array as an argument. The array is treated as follows:

ConstSFColor, ConstMFColor, SFColor and MFColor
float colors[]

colors[] consists of a set of three float-values (representing red,
    green and blue).

ConstSFRotation, ConstMFRotation, SFRotation and MFRotation

float rotations[]

rotations[] consists of a set of four float-values (representing axisX,
    axisY, axisZ and angle).

ConstSFVec2f, ConstMFVec2f, SFVec2f and MFVec2f
float vec2s[]

vec2s[] consists of a set of two float-values (representing x and y).

ConstSFVec3f, ConstMFVec3f, SFVec3f and MFVec3f
float vec3s[]

vec3s[] consists of a set of three float-values (representing x, y and
    z).

ConstSFImage and SFImage
byte pixels[]

pixels[] consists of 2-dimensional pixel image. The ordering of the
    individual components for an individual pixel within the array of bytes
    will be as follows:

 # Comp.   byte[i]  byte[i + 1] byte[i + 2] byte[i + 3]

 ------- ---------- ---------- ----------- -----------

    1    intensity1 intensity2  intensity3 intensity4

    2    intensity1   alpha1    intensity2  alpha2

    3       red1      green1      blue1      red2

    4       red1      green1      blue1     alpha1

The order of pixels in the array are to follow that defined in 5.5, SFImage. byte 0 is pixel
    0, starting from the bottom left corner.

A single integer and a single-dimensional array

Some constructors and other methods take a single integer value (called
  size) and a single-dimensional array as arguments: for example,
  MFFloat(int size, float values[]). The size parameter specifies
  the number of valid elements in the array, from 0-th element to (size
  - 1)-th element, all other values are ignored. This means that the method
  may be passed an array of length size or larger. The same rule for a single-dimensional array
  is applied to the valid elements.

An array of arrays

Some constructors and other methods alternatively take an array of arrays
  as an argument. The array is treated as follows:

ConstMFColor and MFColor
float colors[][]

colors[][] consists of an array of sets of three float-values (representing
    red, green and blue).

ConstMFRotation and MFRotation
float rotations[][]

rotations[][] consists of an array of sets of four float-values (representing
    axisX, axisY, axisZ and angle).

ConstMFVec2f and MFVec2f
float vec2s[][]

vec2s[][] consists of an array of sets of two float-values (representing
    x and y).

ConstMFVec3f and MFVec3f
float vec3s[][]

vec3s[][] consists of an array of sets of three float-values (representing
    x, y and z).

B.6.3.2 Constructors and methods

The following describes how arrays are interpreted in detail for each
constructor and method.

Suppose NA represents the number of elements in the array specified
as an argument of some constructors and other methods, and NT represents
the number of elements which the target object requires or has. For example,
if the target object is SFColor, it requires exactly 3 float values.

In the following description, suppose SF* represents subclasses of Field
class, ConstSF* represents subclasses of ConstField class, MF* represents
subclasses of MField class and ConstMF* represents subclasses of ConstMField
class.

A single-dimensional
  array

In the following description, if the target object is:

ConstSFColor and SFColor, NT is exactly 3

ConstMFColor and MFColor, NT is a multiple of 3, and NA
    is rounded down to a multiple of 3

ConstSFRotation and SFRotation, NT is exactly 4

ConstMFRotation and MFRotation, NT is a multiple of 4, and NA
    is rounded down to a multiple of 4

ConstSFVec2f and SFVec2f, NT is exactly 2

ConstMFVec2f and MFVec2f, NT is a multiple of 2, and NA
    is rounded down to a multiple of 2

ConstSFVec3f and SFVec3f, NT is exactly 3

ConstMFVec3f and MFVec3f, NT is a multiple of 3, and NA
    is rounded down to a multiple of 3

ConstSFImage and SFImage, NT is exactly width*height*components
    (width, height and number of components in the image,
    see 5.5, SFImage)

For ConstSF*
    objects and SF* objects

    For all constructors and methods which take a single-dimensional array
    as an argument, the following rules are applied.

    NA shall be larger than or equal to NT. If NA is larger
    than NT, the elements from the 0-th to the (NT - 1)-th element
    are used and remaining elements are ignored. Otherwise, an exception(ArrayIndexOutOfBoundsException)
    is thrown.

For example, when the array is used as an argument of the setValue()
    for SFColor, the array shall contain at least 3 float values. If the array
    contains more than 3 float values, the first 3 values are used.

For ConstMF* objects and MF* objects

For constructor.

The same rule for ConstSF*
      and SF* objects is applied.

For example, when the array is used as an argument of the constructor
      for MFColor, the array shall contain at least 3 float values. If the array
      contains 3N, 3N +1 or 3N + 2 float values, the first 3N values are used.

For setValue() method.

If NT is smaller than or equal to NA, NT is increased
      to NA and then all elements of the array are copied into the target
      object. If NT is larger than NA, NT is decreased to
      NA and then all elements of the array are copied into the target
      object.

For getValue() method.

If NT is smaller than or equal to NA, all elements of
      the target object are copied into the first NT elemets of the array.
      If NT is larger than NA, an exception (ArrayIndexOutOfBoundsException)
      is thrown.

For set1Value() method.

The target element (the index-th element) is treated as an SF*
      object. So the same rule
      for ConstSF* and SF* objects is applied.

For get1Value() method.

The target element (the index-th element) is treated as an SF*
      (or ConstSF*) object. So the same rule
      for ConstSF* and SF* objects is applied.

For addValue() and insertValue() method.

The corresponding SF* object is created using the argument, and then
      added to the target object or inserted into the target object.

A single integer and a single-dimensional array

For all constructors and methods which take a single integer value (called
  size) and a single-dimensional array as arguments, for example,
  MFFloat(int size, float values[]), the following rule is applied.

  The size parameter specifies the number of valid elements in the
  array from the 0-th element to the (size - 1)-th element;
  all other values are ignored. This means that the method may be passed
  an array of length size or larger.

The valid elements are copied to a new array and the
  rules for a single-dimensional array are applied to the new array for
  all methods.

An array of arrays

This argument is used only for MF* objects and ConstMF* objects. In
  the following case, suppose NA is the number of arrays (for example
  float f[4][3], NA is 4) specified as an argument of some constructors
  and other methods and NT is the return value of getSize()
  method of each object.

For constructor.

    The object which has NA elements is created.

For setValue() method.

    If NT is smaller than or equal to NA, NT is increased
    to NA and then all elements of the array are copied into the target
    object. If NT is larger than NA, NT is decreased to
    NA and then all elements of the array are copied into the target
    object.

For getValue() method.

    If NT is smaller than or equal to NA, all elements of the
    target object are copied into the array. If NT is larger than NA,
    an exception(ArrayIndexOutOfBoundsException) is thrown.

B.6.4 Node class

The Node class has several methods:

<TT>String getType()</TT>

  is the method to return the type of the node.

<TT>ConstField getEventOut(String eventOutName)</TT>

  is the method to get the reference to the node's eventOut whose name is
  eventOutName. The return value can be converted to the appropriate
  subclass of the Field class, (see B.6.2, Field class and ConstField class).

<TT>Field getEventIn(String eventInName)</TT>

  is the method to get the reference to the node's eventIn whose name is
  eventInName. The return value can be converted to the appropriate
  subclass of the Field class, (see B.6.2, Field class and ConstField class).
  EventIn is a write-only field. When the getValue() method is invoked on
  a Field object obtained by the getEventIn() method, the return value is
  unspecified.

<TT>Field getExposedField(String exposedFieldName)</TT>

  is the method to get the reference to the node's exposedField whose name
  is exposedFieldName. The return value can be converted to the appropriate
  subclass of the Field class, (see B.6.2, Field class and ConstField class).

<TT>Browser getBrowser()</TT>

  is the method to get the browser object that this node is contained in
  (see B.6.5, Browser class).

<TT>String toString()</TT>

  is the same as the toString() method of SFNode
  (ConstSFNode).

When the setValue(), set1Value(), addValue(), insertValue(), delete()
or clear() methods are invoked on a Field object obtained by the getExposedField()
method, the call generates an eventOut in the VRML scene (see also B.6.2, Field class and ConstField class,
and B.6.3, Array handling). The effect of
this eventOut is specified by the associated Route(s) in the VRML scene.
In the case of the set1Value(), addValue(), insertValue() or delete() methods,
all elements of the VRML node's exposedField are retrieved, then the value
specified as an argument is set, added, inserted or deleted (as appropriate)
to/from the elements, then stored as the elements in the corresponding VRML
node's exposedField, and then the eventOut is sent. In the case of the clear()
method, all elements of VRML node's exposedField are cleared and an eventOut
with zero elements is sent (see the definition of
the clear() method).

When the setValue() or clear() methods are invoked on a Field object
obtained by the getEventIn() method, the call generates an eventIn
in the VRML scene. When the set1Value(), addValue(), insertValue() or delete()
methods are invoked on the Field object, an exception (InvalidFieldChangeException)
is thrown.

B.6.5 Browser class

This section lists the public Java platform interfaces to the Browser class, which allows scripts to get
and set browser information. For descriptions of the following methods,
see 4.12.10, Browser script interface.
Table B.1 lists the Browser class methods.

Table B.1 -- Browser class methods

Return value
Method name

<TT>String</TT>
<TT>getName</TT><TT>()</TT>

<TT>String</TT>
<TT>getVersion</TT><TT>()</TT>

<TT>float</TT>
<TT>getCurrentSpeed</TT><TT>()</TT>

<TT>float</TT>
<TT>getCurrentFrameRate</TT><TT>()</TT>

<TT>String</TT>
<TT>getWorldURL</TT><TT>()</TT>

<TT>void</TT>
<TT>replaceWorld</TT><TT>(BaseNode[] nodes)</TT>

<TT>BaseNode[]</TT>
<TT>createVrmlFromString</TT><TT>(String vrmlSyntax)</TT>

<TT>void</TT>
<TT>createVrmlFromURL</TT><TT>(String[] url, BaseNode node,

                  String
event)</TT>

<TT>void</TT>
<TT>addRoute</TT><TT>(BaseNode fromNode, String fromEventOut, </TT>

                  <TT>BaseNode
toNode, String toEventIn)</TT>

<TT>void</TT>
<TT>deleteRoute</TT><TT>(BaseNode fromNode,</TT> <TT> String
fromEventOut, </TT>

                         <TT>BaseNode
toNode, String toEventIn)</TT>

<TT>void</TT>
<TT>loadURL</TT><TT>(String[] url, String[] parameter)</TT>

<TT>void</TT>
<TT>setDescription</TT><TT>(String description)</TT>

See B.9.2.1, vrml package, for each
method's definition.

Table B.2 contains conversions from the types
used in Browser class to Java platform types.

Table B.2 -- VRML and Java platform types

VRML type
Java platform type

SFString

String

SFFloat

float

MFString

String[]

MFNode

BaseNode[]

When a relative URL is specified as an argument of the loadURL() and
createVrmlFromURL() method, the path is relative to the script file containing
these methods (see 4.5.3, Relative URLs).

B.6.6 User-defined classes and packages

The Java platform classes defined by a user can be used in the Java program.
They are first searched from the directories specified in the CLASSPATH
environment variable and then the directory where the Java program's class
file is placed.

If the Java platform class is in a package, this package is searched
from the directories specified in the CLASSPATH environment variable and
then the directory where the Java program's class file is placed.

B.6.7 Standard Java platform packages

Java programs have access to the full set of classes available in <TT>java.*</TT>.
All parts of the Java platform are required to work as "normal"
for the Java platform. So all methods specified in this annex are required
to be thread-safe. The security model is browser specific.

 B.7 Exceptions

Java platform methods may throw the following exceptions:

InvalidFieldException

  is thrown at the time getField() is executed and the field name is invalid.

InvalidEventInException

  is thrown at the time getEventIn() is executed and the eventIn name is
  invalid.

InvalidEventOutException

  is thrown at the time getEventOut() is executed and the eventOut name is
  invalid.

InvalidExposedFieldException

  is thrown at the time getExposedField() is executed and the exposedField
  name is invalid.

InvalidVRMLSyntaxException

  is thrown at the time createVrmlFromString(), createVrmlFromURL() or loadURL()
  is executed and the vrml syntax is invalid.

InvalidRouteException

  is thrown at the time addRoute() or deleteRoute() is executed and one or
  more of the arguments is invalid.

InvalidFieldChangeException

  may be thrown as a result of all sorts of illegal field changes, for example:

Adding a node from one World as the child of a node in another World.

Creating a circularity in a scene graph.

Setting an invalid string on enumerated fields, such as the fogType
    field of the Fog node.

Calling the set1Value(), addValue() or delete() on a Field object obtained
    by the getEventIn() method.

ArrayIndexOutOfBoundsException

  is generated at the time getValue(), set1Value(), insertValue() or delete()
  is executed and the index is out of bound
  (see B.6.2, Field class and ConstField class). This is the standard exception
  defined in the Java platform Array class.

IllegalArgumentException

  is generated at the time loadURL() or createVrmlFromURL() is executed and
  an error is occurred before retrieving the content of the url (see B.6.5, Browser class). This is the standard exception
  defined by the Java platform.

If exceptions are not caught by authors, a browser's behaviour is unspecified
(see B.10, Example of exception class).

 B.8 Examples

The following is an example of a Script
node which determines whether a given color contains a lot of red. The Script
node exposes a field, an eventIn, and an eventOut:

    Script {
      field    SFColor currentColor 0 0 0
      eventIn  SFColor colorIn
      eventOut SFBool  isRed
      url      "Example4.class"
    }

The following is the source code for the Example4.java file that gets
called every time an eventIn is routed to the above Script node:

Example4.java:

import vrml.*;
import vrml.field.*;
import vrml.node.*;

public class Example4 extends Script {
    // Declare field(s)
    private SFColor currentColor;

    // Declare eventOut
    private SFBool isRed;

    // buffer for  SFColor.getValue().
    private float colorBuff[] = new float[3];

    public void initialize(){
       currentColor = (SFColor) getField("currentColor");
       isRed = (SFBool) getEventOut("isRed");
    }

    public void processEvent(Event e){
        // This method is called when a colorIn event is received
        currentColor.setValue((ConstSFColor)e.getValue());
    }

    public void eventsProcessed(){
        currentColor.getValue(colorBuff);
        if (colorBuff[0] >= 0.5) // if red is at or above 50%
            isRed.setValue(true);
    }
}

Details on when the methods defined in Example4.java are called may be
found in 4.10.3, Execution model.

Example5: createVrmlFromUrl()

    Script {
      url "Example5.class"
      field   MFString target_url "foo.wrl"
      eventIn MFNode   nodesLoaded
      eventIn SFBool   trigger_event
    }

Example5.java:
  import vrml.*;
  import vrml.field.*;
  import vrml.node.*;

  public class Example5 extends Script {
      private MFString target_url; // field
      private Browser browser;

      public void initialize(){
          target_url = (MFString)getField("target_url");
          browser = this.getBrowser();
      }

      public void processEvent(Event e){
          if(e.getName().equals("trigger_event")){
               // do something and then fetch values
               String[] urls;
               urls = new String[target_url.getSize()];
               target_url.getValue(urls);
               browser.createVrmlFromURL(urls, this, "nodesLoaded");
          }
          if(e.getName().equals("nodesLoaded")){
              // do something
          }
      }
  }

Example6: addRoute()

    DEF TS TouchSensor {}
    Script {
      url     "Example6.class"
      field   SFNode fromNode USE TS
      eventIn SFBool clicked
      eventIn SFBool trigger_event
    }

Example6.java:

  import vrml.*;
  import vrml.field.*;
  import vrml.node.*;

  public class Example6 extends Script {

      private SFNode fromNode;
      private Browser browser;

      public void initialize(){
          fromNode = (SFNode) getField("fromNode");
          browser = this.getBrowser();
      }

      public void processEvent(Event e){
          if(e.getName().equals("trigger_event")){
              // do something and then add routing
              browser.addRoute(fromNode.getValue(), "isActive", this, "clicked");
          }
          if(e.getName().equals("clicked")){
              // do something
          }
      }
  }

 B.9 Class definitions

B.9.1 Class hierarchy

The classes are divided into three packages: vrml,
vrml.field and vrml.node.

java.lang.Object
     |
     +- vrml.Event
     +- vrml.Browser
     +- vrml.Field
     |       +- vrml.field.SFBool
     |       +- vrml.field.SFColor
     |       +- vrml.field.SFFloat
     |       +- vrml.field.SFImage
     |       +- vrml.field.SFInt32
     |       +- vrml.field.SFNode
     |       +- vrml.field.SFRotation
     |       +- vrml.field.SFString
     |       +- vrml.field.SFTime
     |       +- vrml.field.SFVec2f
     |       +- vrml.field.SFVec3f
     |       |
     |       +- vrml.MField
     |       |       +- vrml.field.MFColor
     |       |       +- vrml.field.MFFloat
     |       |       +- vrml.field.MFInt32
     |       |       +- vrml.field.MFNode
     |       |       +- vrml.field.MFRotation
     |       |       +- vrml.field.MFString
     |       |       +- vrml.field.MFTime
     |       |       +- vrml.field.MFVec2f
     |       |       +- vrml.field.MFVec3f
     |       |
     |       +- vrml.ConstField
     |               +- vrml.field.ConstSFBool
     |               +- vrml.field.ConstSFColor
     |               +- vrml.field.ConstSFFloat
     |               +- vrml.field.ConstSFImage
     |               +- vrml.field.ConstSFInt32
     |               +- vrml.field.ConstSFNode
     |               +- vrml.field.ConstSFRotation
     |               +- vrml.field.ConstSFString
     |               +- vrml.field.ConstSFTime
     |               +- vrml.field.ConstSFVec2f
     |               +- vrml.field.ConstSFVec3f
     |               |
     |               +- vrml.ConstMField
     |                       +- vrml.field.ConstMFColor
     |                       +- vrml.field.ConstMFFloat
     |                       +- vrml.field.ConstMFInt32
     |                       +- vrml.field.ConstMFNode
     |                       +- vrml.field.ConstMFRotation
     |                       +- vrml.field.ConstMFString
     |                       +- vrml.field.ConstMFTime
     |                       +- vrml.field.ConstMFVec2f
     |                       +- vrml.field.ConstMFVec3f
     |
     +- vrml.BaseNode
             +- vrml.node.Node
             +- vrml.node.Script

java.lang.Exception
     |
     +- java.lang.RuntimeException
     |       +- java.lang.IllegalArgumentException
     |               +- vrml.InvalidEventInException
     |               +- vrml.InvalidEventOutException
     |               +- vrml.InvalidExposedFieldException
     |               +- vrml.InvalidFieldChangeException
     |               +- vrml.InvalidFieldException
     |               +- vrml.InvalidRouteException
     |
     +- vrml.InvalidVRMLSyntaxException

B.9.2 VRML packages

B.9.2.1 vrml package

package vrml;

public class Event implements Cloneable
{
   public String getName();
   public double getTimeStamp();
   public ConstField getValue();
   public Object clone();

   public String toString();   // This overrides a method in Object
}

public class Browser
{
   private Browser();
   public String toString();   // This overrides a method in Object

   // Browser interface
   public String getName();
   public String getVersion();

   public float getCurrentSpeed();

   public float getCurrentFrameRate();

   public String getWorldURL();
   public void replaceWorld(BaseNode[] nodes);

   public BaseNode[] createVrmlFromString(String vrmlSyntax)
     throws InvalidVRMLSyntaxException;

   public void createVrmlFromURL(String[] url, BaseNode node, String event)
     throws InvalidVRMLSyntaxException;

   public void addRoute(BaseNode fromNode, String fromEventOut,
                        BaseNode toNode, String toEventIn);

   public void deleteRoute(BaseNode fromNode, String fromEventOut,
                           BaseNode toNode, String toEventIn);

   public void loadURL(String[] url, String[] parameter)
     throws InvalidVRMLSyntaxException;

   public void setDescription(String description);
}

public abstract class Field implements Cloneable
{
   public Object clone();
}

public abstract class MField extends Field
{
   public abstract int getSize();
   public abstract void clear();
   public abstract void delete(int index);
}

public abstract class ConstField extends Field
{
}

public abstract class ConstMField extends ConstField
{
   public abstract int getSize();
}

//
// This is the general BaseNode class
//
public abstract class BaseNode
{
   // Returns the type of the node.  If the node is a prototype
   // it returns the name of the prototype.
   public String getType();

   // Get the Browser that this node is contained in.
   public Browser getBrowser();
}

B.9.2.2 vrml.field package

package vrml.field;

public class SFBool extends Field
{
   public SFBool();
   public SFBool(boolean value);

   public boolean getValue();

   public void setValue(boolean b);
   public void setValue(ConstSFBool b);
   public void setValue(SFBool b);

   public String toString();   // This overrides a method in Object
}

public class SFColor extends Field
{
   public SFColor();
   public SFColor(float red, float green, float blue);

   public void getValue(float colors[]);
   public float getRed();
   public float getGreen();
   public float getBlue();

   public void setValue(float colors[]);
   public void setValue(float red, float green, float blue);
   public void setValue(ConstSFColor color);
   public void setValue(SFColor color);

   public String toString();   // This overrides a method in Object
}

public class SFFloat extends Field
{
   public SFFloat();
   public SFFloat(float f);

   public float getValue();

   public void setValue(float f);
   public void setValue(ConstSFFloat f);
   public void setValue(SFFloat f);

   public String toString();   // This overrides a method in Object
}

public class SFImage extends Field
{
   public SFImage();
   public SFImage(int width, int height, int components, byte pixels[]);

   public int getWidth();
   public int getHeight();
   public int getComponents();
   public void getPixels(byte pixels[]);

   public void setValue(int width, int height, int components,
                        byte pixels[]);
   public void setValue(ConstSFImage image);
   public void setValue(SFImage image);

   public String toString();   // This overrides a method in Object
}

public class SFInt32 extends Field
{
   public SFInt32();
   public SFInt32(int value);

   public int getValue();

   public void setValue(int i);
   public void setValue(ConstSFInt32 i);
   public void setValue(SFInt32 i);

   public String toString();   // This overrides a method in Object
}

public class SFNode extends Field
{
   public SFNode();
   public SFNode(BaseNode node);

   public BaseNode getValue();

   public void setValue(BaseNode node);
   public void setValue(ConstSFNode node);
   public void setValue(SFNode node);

   public String toString();   // This overrides a method in Object
}

public class SFRotation extends Field
{
   public SFRotation();
   public SFRotation(float axisX, float axisY, float axisZ, float angle);

   public void getValue(float rotations[]);

   public void setValue(float rotations[]);
   public void setValue(float axisX, float axisY, float axisZ,
                        float angle);
   public void setValue(ConstSFRotation rotation);
   public void setValue(SFRotation rotation);

   public String toString();   // This overrides a method in Object
}

public class SFString extends Field
{
   public SFString();
   public SFString(String s);

   public String getValue();

   public void setValue(String s);
   public void setValue(ConstSFString s);
   public void setValue(SFString s);

   public String toString();   // This overrides a method in Object
}

public class SFTime extends Field
{
   public SFTime();
   public SFTime(double time);

   public double getValue();

   public void setValue(double time);
   public void setValue(ConstSFTime time);
   public void setValue(SFTime time);

   public String toString();   // This overrides a method in Object
}

public class SFVec2f extends Field
{
   public SFVec2f();
   public SFVec2f(float x, float y);

   public void getValue(float vec2s[]);
   public float getX();
   public float getY();

   public void setValue(float vec2s[]);
   public void setValue(float x, float y);
   public void setValue(ConstSFVec2f vec);
   public void setValue(SFVec2f vec);

   public String toString();   // This overrides a method in Object
}

public class SFVec3f extends Field
{
   public SFVec3f();
   public SFVec3f(float x, float y, float z);

   public void getValue(float vec3s[]);
   public float getX();
   public float getY();
   public float getZ();

   public void setValue(float vec3s[]);
   public void setValue(float x, float y, float z);
   public void setValue(ConstSFVec3f vec);
   public void setValue(SFVec3f vec);

   public String toString();   // This overrides a method in Object
}

public class MFColor extends MField
{
   public MFColor();
   public MFColor(float colors[][]);
   public MFColor(float colors[]);
   public MFColor(int size, float colors[]);

   public void getValue(float colors[][]);
   public void getValue(float colors[]);

   public void get1Value(int index, float colors[]);
   public void get1Value(int index, SFColor color);

   public void setValue(float colors[][]);
   public void setValue(float colors[]);
   public void setValue(int size, float colors[]);
   /****************************************************
    color[0] ... color[size - 1] are used as color data
    in the way that color[0], color[1], and color[2]
    represent the first color. The number of colors
    is defined as "size / 3".
    ***************************************************/
   public void setValue(MFColor colors);
   public void setValue(ConstMFColor colors);

   public void set1Value(int index, ConstSFColor color);
   public void set1Value(int index, SFColor color);
   public void set1Value(int index, float red, float green, float blue);

   public void addValue(ConstSFColor color);
   public void addValue(SFColor color);
   public void addValue(float red, float green, float blue);

   public void insertValue(int index, ConstSFColor color);
   public void insertValue(int index, SFColor color);
   public void insertValue(int index, float red, float green, float blue);

   public String toString();   // This overrides a method in Object
}

public class MFFloat extends MField
{
   public MFFloat();
   public MFFloat(int size, float values[]);
   public MFFloat(float values[]);

   public void getValue(float values[]);

   public float get1Value(int index);

   public void setValue(float values[]);
   public void setValue(int size, float values[]);
   public void setValue(MFFloat value);
   public void setValue(ConstMFFloat value);

   public void set1Value(int index, float f);
   public void set1Value(int index, ConstSFFloat f);
   public void set1Value(int index, SFFloat f);

   public void addValue(float f);
   public void addValue(ConstSFFloat f);
   public void addValue(SFFloat f);

   public void insertValue(int index, float f);
   public void insertValue(int index, ConstSFFloat f);
   public void insertValue(int index, SFFloat f);

   public String toString();   // This overrides a method in Object
}

public class MFInt32 extends MField
{
   public MFInt32();
   public MFInt32(int size, int values[]);
   public MFInt32(int values[]);

   public void getValue(int values[]);

   public int get1Value(int index);

   public void setValue(int values[]);
   public void setValue(int size, int values[]);
   public void setValue(MFInt32 value);
   public void setValue(ConstMFInt32 value);

   public void set1Value(int index, int i);
   public void set1Value(int index, ConstSFInt32 i);
   public void set1Value(int index, SFInt32 i);

   public void addValue(int i);
   public void addValue(ConstSFInt32 i);
   public void addValue(SFInt32 i);

   public void insertValue(int index, int i);
   public void insertValue(int index, ConstSFInt32 i);
   public void insertValue(int index, SFInt32 i);

   public String toString();   // This overrides a method in Object
}

public class MFNode extends MField
{
   public MFNode();
   public MFNode(int size, BaseNode node[]);
   public MFNode(BaseNode node[]);

   public void getValue(BaseNode node[]);

   public BaseNode get1Value(int index);

   public void setValue(BaseNode node[]);
   public void setValue(int size, BaseNode node[]);
   public void setValue(MFNode node);
   public void setValue(ConstMFNode node);

   public void set1Value(int index, BaseNode node);
   public void set1Value(int index, ConstSFNode node);
   public void set1Value(int index, SFNode node);

   public void addValue(BaseNode node);
   public void addValue(ConstSFNode node);
   public void addValue(SFNode node);

   public void insertValue(int index, BaseNode node);
   public void insertValue(int index, ConstSFNode node);
   public void insertValue(int index, SFNode node);

   public String toString();   // This overrides a method in Object
}

public class MFRotation extends MField
{
   public MFRotation();
   public MFRotation(float rotations[][]);
   public MFRotation(float rotations[]);
   public MFRotation(int size, float rotations[]);

   public void getValue(float rotations[][]);
   public void getValue(float rotations[]);

   public void get1Value(int index, float rotations[]);
   public void get1Value(int index, SFRotation rotation);

   public void setValue(float rotations[][]);
   public void setValue(float rotations[]);
   public void setValue(int size, float rotations[]);
   public void setValue(MFRotation rotations);
   public void setValue(ConstMFRotation rotations);

   public void set1Value(int index, ConstSFRotation rotation);
   public void set1Value(int index, SFRotation rotation);
   public void set1Value(int index, float axisX, float axisY, float axisZ, float angle);

   public void addValue(ConstSFRotation rotation);
   public void addValue(SFRotation rotation);
   public void addValue(float axisX, float axisY, float axisZ, float angle);

   public void insertValue(int index, ConstSFRotation rotation);
   public void insertValue(int index, SFRotation rotation);
   public void insertValue(int index, float axisX, float axisY, float axisZ, float angle);

   public String toString();   // This overrides a method in Object
}

public class MFString extends MField
{
   public MFString();
   public MFString(int size, String s[]);
   public MFString(String s[]);

   public void getValue(String s[]);

   public String get1Value(int index);

   public void setValue(String s[]);
   public void setValue(int size, String s[]);
   public void setValue(MFString s);
   public void setValue(ConstMFString s);

   public void set1Value(int index, String s);
   public void set1Value(int index, ConstSFString s);
   public void set1Value(int index, SFString s);

   public void addValue(String s);
   public void addValue(ConstSFString s);
   public void addValue(SFString s);

   public void insertValue(int index, String s);
   public void insertValue(int index, ConstSFString s);
   public void insertValue(int index, SFString s);

   public String toString();   // This overrides a method in Object
}

public class MFTime extends MField
{
   public MFTime();
   public MFTime(int size, double times[]);
   public MFTime(double times[]);

   public void getValue(double times[]);

   public double get1Value(int index);

   public void setValue(double times[]);
   public void setValue(int size, double times[]);
   public void setValue(MFTime times);
   public void setValue(ConstMFTime times);

   public void set1Value(int index, double time);
   public void set1Value(int index, ConstSFTime time);
   public void set1Value(int index, SFTime time);

   public void addValue(double time);
   public void addValue(ConstSFTime time);
   public void addValue(SFTime time);

   public void insertValue(int index, double time);
   public void insertValue(int index, ConstSFTime time);
   public void insertValue(int index, SFTime time);

   public String toString();   // This overrides a method in Object
}

public class MFVec2f extends MField
{
   public MFVec2f();
   public MFVec2f(float vec2s[][]);
   public MFVec2f(float vec2s[]);
   public MFVec2f(int size, float vec2s[]);

   public void getValue(float vec2s[][]);
   public void getValue(float vec2s[]);

   public void get1Value(int index, float vec2s[]);
   public void get1Value(int index, SFVec2f vec);

   public void setValue(float vec2s[][]);
   public void setValue(float vec2s[]);
   public void setValue(int size, float vec2s[]);
   public void setValue(MFVec2f vecs);
   public void setValue(ConstMFVec2f vecs);

   public void set1Value(int index, float x, float y);
   public void set1Value(int index, ConstSFVec2f vec);
   public void set1Value(int index, SFVec2f vec);

   public void addValue(float x, float y);
   public void addValue(ConstSFVec2f vec);
   public void addValue(SFVec2f vec);

   public void insertValue(int index, float x, float y);
   public void insertValue(int index, ConstSFVec2f vec);
   public void insertValue(int index, SFVec2f vec);

   public String toString();   // This overrides a method in Object
}

public class MFVec3f extends MField
{
   public MFVec3f();
   public MFVec3f(float vec3s[][]);
   public MFVec3f(float vec3s[]);
   public MFVec3f(int size, float vec3s[]);

   public void getValue(float vec3s[][]);
   public void getValue(float vec3s[]);

   public void get1Value(int index, float vec3s[]);
   public void get1Value(int index, SFVec3f vec);

   public void setValue(float vec3s[][]);
   public void setValue(float vec3s[]);
   public void setValue(int size, float vec3s[]);
   public void setValue(MFVec3f vecs);
   public void setValue(ConstMFVec3f vecs);

   public void set1Value(int index, float x, float y, float z);
   public void set1Value(int index, ConstSFVec3f vec);
   public void set1Value(int index, SFVec3f vec);

   public void addValue(float x, float y, float z);
   public void addValue(ConstSFVec3f vec);
   public void addValue(SFVec3f vec);

   public void insertValue(int index, float x, float y, float z);
   public void insertValue(int index, ConstSFVec3f vec);
   public void insertValue(int index, SFVec3f vec);

   public String toString();   // This overrides a method in Object
}

public class ConstSFBool extends ConstField
{
   public ConstSFBool(boolean value);

   public boolean getValue();

   public String toString();   // This overrides a method in Object
}

public class ConstSFColor extends ConstField
{
   public ConstSFColor(float red, float green, float blue);

   public void getValue(float colors[]);
   public float getRed();
   public float getGreen();
   public float getBlue();

   public String toString();   // This overrides a method in Object
}

public class ConstSFFloat extends ConstField
{
   public ConstSFFloat(float value);

   public float getValue();

   public String toString();   // This overrides a method in Object
}

public class ConstSFImage extends ConstField
{
   public ConstSFImage(int width, int height, int components, byte pixels[]);

   public int getWidth();
   public int getHeight();
   public int getComponents();
   public void getPixels(byte pixels[]);

   public String toString();   // This overrides a method in Object
}

public class ConstSFInt32 extends ConstField
{
   public ConstSFInt32(int value);

   public int getValue();

   public String toString();   // This overrides a method in Object
}

public class ConstSFNode extends ConstField
{
   public ConstSFNode(BaseNode node);

   public BaseNode getValue();

   public String toString();   // This overrides a method in Object
}

public class ConstSFRotation extends ConstField
{
   public ConstSFRotation(float axisX, float axisY, float axisZ, float angle);

   public void getValue(float rotations[]);

   public String toString();   // This overrides a method in Object
}

public class ConstSFString extends ConstField
{
   public ConstSFString(String value);

   public String getValue();

   public String toString();   // This overrides a method in Object
}

public class ConstSFTime extends ConstField
{
   public ConstSFTime(double time);

   public double getValue();

   public String toString();   // This overrides a method in Object
}

public class ConstSFVec2f extends ConstField
{
   public ConstSFVec2f(float x, float y);

   public void getValue(float vec2s[]);
   public float getX();
   public float getY();

   public String toString();   // This overrides a method in Object
}

public class ConstSFVec3f extends ConstField
{
   public ConstSFVec3f(float x, float y, float z);

   public void getValue(float vec3s[]);
   public float getX();
   public float getY();
   public float getZ();

   public String toString();   // This overrides a method in Object
}

public class ConstMFColor extends ConstMField
{
   public ConstMFColor(float colors[][]);
   public ConstMFColor(float colors[]);
   public ConstMFColor(int size, float colors[]);

   public void getValue(float colors[][]);
   public void getValue(float colors[]);

   public void get1Value(int index, float colors[]);
   public void get1Value(int index, SFColor color);

   public String toString();   // This overrides a method in Object
}

public class ConstMFFloat extends ConstMField
{
   public ConstMFFloat(int size, float values[]);
   public ConstMFFloat(float values[]);

   public void getValue(float values[]);

   public float get1Value(int index);

   public String toString();   // This overrides a method in Object
}

public class ConstMFInt32 extends ConstMField
{
   public ConstMFInt32(int size, int values[]);
   public ConstMFInt32(int values[]);

   public void getValue(int values[]);

   public int get1Value(int index);

   public String toString();   // This overrides a method in Object
}

public class ConstMFNode extends ConstMField
{
   public ConstMFNode(int size, BaseNode node[]);
   public ConstMFNode(BaseNode node[]);

   public void getValue(BaseNode node[]);

   public BaseNode get1Value(int index);

   public String toString();   // This overrides a method in Object
}

public class ConstMFRotation extends ConstMField
{
   public ConstMFRotation(float rotations[][]);
   public ConstMFRotation(float rotations[]);
   public ConstMFRotation(int size, float rotations[]);

   public void getValue(float rotations[][]);
   public void getValue(float rotations[]);

   public void get1Value(int index, float rotations[]);
   public void get1Value(int index, SFRotation rotation);

   public String toString();   // This overrides a method in Object
}

public class ConstMFString extends ConstMField
{
   public ConstMFString(int size, String s[]);
   public ConstMFString(String s[]);

   public void getValue(String values[]);

   public String get1Value(int index);

   public String toString();   // This overrides a method in Object
}

public class ConstMFTime extends ConstMField
{
   public ConstMFTime(int size, double times[]);
   public ConstMFTime(double times[]);

   public void getValue(double times[]);

   public double get1Value(int index);

   public String toString();   // This overrides a method in Object
}

public class ConstMFVec2f extends ConstMField
{
   public ConstMFVec2f(float vec2s[][]);
   public ConstMFVec2f(float vec2s[]);
   public ConstMFVec2f(int size, float vec2s[]);

   public void getValue(float vec2s[][]);
   public void getValue(float vec2s[]);

   public void get1Value(int index, float vec2s[]);
   public void get1Value(int index, SFVec2f vec);

   public String toString();   // This overrides a method in Object
}

public class ConstMFVec3f extends ConstMField
{
   public ConstMFVec3f(float vec3s[][]);
   public ConstMFVec3f(float vec3s[]);
   public ConstMFVec3f(int size, float vec3s[]);

   public void getValue(float vec3s[][]);
   public void getValue(float vec3s[]);

   public void get1Value(int index, float vec3s[]);
   public void get1Value(int index, SFVec3f vec);

   public String toString();   // This overrides a method in Object
}

B.9.2.3 vrml.node package

package vrml.node;

//
// This is the general Node class
//
public abstract class Node extends BaseNode
{
   // Get an EventIn by name. Return value is write-only.
   //   Throws an InvalidEventInException if eventInName isn't a valid
   //   eventIn name for a node of this type.
   public final Field getEventIn(String eventInName);

   // Get an EventOut by name. Return value is read-only.
   //   Throws an InvalidEventOutException if eventOutName isn't a valid
   //   eventOut name for a node of this type.
   public final ConstField getEventOut(String eventOutName);

   // Get an exposed field by name.
   //   Throws an InvalidExposedFieldException if exposedFieldName isn't a valid
   //   exposedField name for a node of this type.
   public final Field getExposedField(String exposedFieldName);

   public String toString();   // This overrides a method in Object
}

//
// This is the general Script class, to be subclassed by all scripts.
// Note that the provided methods allow the script author to explicitly
// throw tailored exceptions in case something goes wrong in the
// script.
//
public abstract class Script extends BaseNode
{
   // This method is called before any event is generated
   public void initialize();

   // Get a Field by name.
   //   Throws an InvalidFieldException if fieldName isn't a valid
   //   field name for a node of this type.
   protected final Field getField(String fieldName);

   // Get an EventOut by name.
   //   Throws an InvalidEventOutException if eventOutName isn't a valid
   //   eventOut name for a node of this type.
   protected final Field getEventOut(String eventOutName);

   // Get an EventIn by name.
   //   Throws an InvalidEventInException if eventInName isn't a valid
   //   eventIn name for a node of this type.
   protected final Field getEventIn(String eventInName);

   // processEvents() is called automatically when the script receives
   //   some set of events. It shall not be called directly except by its subclass.
   //   count indicates the number of events delivered.
   public void processEvents(int count, Event events[]);

   // processEvent() is called automatically when the script receives
   // an event.
   public void processEvent(Event event);

   // eventsProcessed() is called after every invocation of processEvents().
   public void eventsProcessed()

   // shutdown() is called when this Script node is deleted.
   public void shutdown();

   public String toString();   // This overrides a method in Object
}

 B.10 Example of exception class

public class InvalidEventInException
extends IllegalArgumentException

{
   /**
    * Constructs an InvalidEventInException with no detail message.
    */
   public InvalidEventInException(){
      super();
   }
   /**
    * Constructs an InvalidEventInException with the specified detail message.
    * A detail message is a String that describes this particular exception.
    * @param s the detail message
    */
   public InvalidEventInException(String s){
      super(s);
   }
}

public class InvalidEventOutException extends IllegalArgumentException
{
   public InvalidEventOutException(){
      super();
   }
   public InvalidEventOutException(String s){
      super(s);
   }
}

public class InvalidExposedFieldException extends IllegalArgumentException
{
   public InvalidExposedFieldException(){
      super();
   }
   public InvalidExposedFieldException(String s){
      super(s);
   }
}

public class InvalidFieldChangeException extends IllegalArgumentException
{
   public InvalidFieldChangeException(){
      super();
   }
   public InvalidFieldChangeException(String s){
      super(s);
   }
}

public class InvalidFieldException extends IllegalArgumentException
{
   public InvalidFieldException(){
      super();
   }
   public InvalidFieldException(String s){
      super(s);
   }
}

public class InvalidRouteException extends IllegalArgumentException
{
   public InvalidRouteException(){
      super();
   }
   public InvalidRouteException(String s){
      super(s);
   }
}

public class InvalidVRMLSyntaxException extends Exception
{
   public InvalidVRMLSyntaxException(){
      super();
   }
   public InvalidVRMLSyntaxException(String s){
      super(s);
   }

   public String getMessage();  // This overrides a method in Exception
}

Questions
or comments.

Copyright © 1997 The
VRML Consortium Incorporated.

<TT>http://www.vrml.org/Specifications/VRML97/part1/java.html</TT>

redpajama_set_name: RedPajamaGithub


text:
Some critics argue that Modafinil is an expression of that, a symptom of a new 24/7 work routine. But what if the opposite is true? Let's say you could perform a task in significantly less time than usual. You could then use the rest of your time differently, spending it with family, volunteering, or taking part in a leisure activity. And imagine that a drug helped you focus on clearing your desk and inbox before leaving work. Wouldn't that help you relax once you get home?
"Piracetam is not a vitamin, mineral, amino acid, herb or other botanical, or dietary substance for use by man to supplement the diet by increasing the total dietary intake. Further, piracetam is not a concentrate, metabolite, constituent, extract or combination of any such dietary ingredient. [...] Accordingly, these products are drugs, under section 201(g)(1)(C) of the Act, 21 U.S.C. § 321(g)(1)(C), because they are not foods and they are intended to affect the structure or any function of the body. Moreover, these products are new drugs as defined by section 201(p) of the Act, 21 U.S.C. § 321(p), because they are not generally recognized as safe and effective for use under the conditions prescribed, recommended, or suggested in their labeling."[33]
How exactly – and if – nootropics work varies widely. Some may work, for example, by strengthening certain brain pathways for neurotransmitters like dopamine, which is involved in motivation, Barbour says. Others aim to boost blood flow – and therefore funnel nutrients – to the brain to support cell growth and regeneration. Others protect brain cells and connections from inflammation, which is believed to be a factor in conditions like Alzheimer's, Barbour explains. Still others boost metabolism or pack in vitamins that may help protect the brain and the rest of the nervous system, explains Dr. Anna Hohler, an associate professor of neurology at Boston University School of Medicine and a fellow of the American Academy of Neurology.
This looks interesting: the Noopept effect is positive for all the dose levels, but it looks like a U-curve - low at 10mg, high at 15mg, lower at 20mg, and even lower at 30mg 48mg and 60mg aren't estimated because they are hit by the missingness problem: the magnesium citrate variable is unavailable for the days the higher doses were taken on, and so their days are omitted and those levels of the factor are not estimated. One way to fix this is to drop magnesium from the model entirely, at the cost of fitting the data much more poorly and losing a lot of R2:
There's been a lot of talk about the ketogenic diet recently—proponents say that minimizing the carbohydrates you eat and ingesting lots of fat can train your body to burn fat more effectively. It's meant to help you both lose weight and keep your energy levels constant. The diet was first studied and used in patients with epilepsy, who suffered fewer seizures when their bodies were in a state of ketosis. Because seizures originate in the brain, this discovery showed researchers that a ketogenic diet can definitely affect the way the brain works. Brain hackers naturally started experimenting with diets to enhance their cognitive abilities, and now a company called HVMN even sells ketone esters in a bottle; to achieve these compounds naturally, you'd have to avoid bread and cake. Here are 6 ways exercise makes your brain better.
There is no clear answer to this question. Many of the smart drugs have decades of medical research and widespread use behind them, as well as only minor, manageable, or nonexistent side effects, but are still used primarily as a crutch for people already experiencing cognitive decline, rather than as a booster-rocket for people with healthy brains. Unfortunately, there is a bias in Western medicine in favor of prescribing drugs once something bad has already begun, rather than for up-front prevention. There's also the principle of "leave well enough alone" – in this case, extended to mean, don't add unnecessary or unnatural drugs to the human body in place of a normal diet. [Smart Drug Smarts would argue that the average human diet has strayed so far from what is physiologically "normal" that leaving well enough alone is already a failed proposition.]
Caffeine dose dependently decreased the 1,25(OH)(2)D(3) induced VDR expression and at concentrations of 1 and 10mM, VDR expression was decreased by about 50-70%, respectively. In addition, the 1,25(OH)(2)D(3) induced alkaline phosphatase activity was also reduced at similar doses thus affecting the osteoblastic function. The basal ALP activity was not affected with increasing doses of caffeine. Overall, our results suggest that caffeine affects 1,25(OH)(2)D(3) stimulated VDR protein expression and 1,25(OH)(2)D(3) mediated actions in human osteoblast cells.
The general cost of fish oil made me interested in possible substitutes. Seth Roberts uses exclusively flaxseed oil or flaxseed meal, and this seems to work well for him with subjective effects (eg. noticing his Chinese brands seemed to not work, possibly because they were unrefrigerated and slightly rancid). It's been studied much less than fish oil, but omega acids are confusing enough in general (is there a right ratio? McCluskey's roundup gives the impression claims about ratios may have been overstated) that I'm not convinced ALA is a much inferior replacement for fish oil's mixes of EPA & DHA.
There is much to be appreciated in a brain supplement like BrainPill (never mind the confusion that may stem from the generic-sounding name) that combines tried-and-tested ingredients in a single one-a-day formulation. The consistency in claims and what users see in real life is an exemplary one, which convinces us to rate this powerhouse as the second on this review list. Feeding one's brain with nootropics and related supplements entails due diligence in research and seeking the highest quality, and we think BrainPill is up to task. Learn More...
My first impression of ~1g around 12:30PM was that while I do not feel like running around, within an hour I did feel like the brain fog was lighter than before. The effect wasn't dramatic, so I can't be very confident. Operationalizing brain fog for an experiment might be hard: it doesn't necessarily feel like I would do better on dual n-back. I took 2 smaller doses 3 and 6 hours later, to no further effect. Over the following weeks and months, I continued to randomly alternate between potassium & non-potassium days. I noticed no effects other than sleep problems.
Texas-based entrepreneur and podcaster Mansal Denton takes phenylpiracetam, a close relative of piracetam originally developed by the Soviet Union as a medication for cosmonauts, to help them endure the stresses of life in space. "I have a much easier time articulating certain things when I take it, so I typically do a lot of recording [of podcasts] on those days," he says.
Some smart drugs can be found in health food stores; others are imported or are drugs that are intended for other disorders such as Alzheimer's disease and Parkinson's disease. There are many Internet web sites, books, magazines and newspaper articles detailing the supposed effects of smart drugs. There are also plenty of advertisements and mail-order businesses that try to sell "smart drugs" to the public. However, rarely do these businesses or the popular press report results that show the failure of smart drugs to improve memory or learning. Rather, they try to show that their products have miraculous effects on the brain and can improve mental functioning. Wouldn't it be easy to learn something by "popping a pill" or drinking a soda laced with a smart drug? This would be much easier than taking the time to study. Feeling dull? Take your brain in for a mental tune up by popping a pill!
Of course, there are drugs out there with more transformative powers. "I think it's very clear that some do work," says Andrew Huberman, a neuroscientist based at Stanford University. In fact, there's one category of smart drugs which has received more attention from scientists and biohackers – those looking to alter their own biology and abilities – than any other. These are the stimulants.
2 commenters point out that my possible lack of result is due to my mistaken assumption that if nicotine is absorbable through skin, mouth, and lungs it ought to be perfectly fine to absorb it through my stomach by drinking it (rather than vaporizing it and breathing it with an e-cigarette machine) - it's apparently known that absorption differs in the stomach.
On 15 March 2014, I disabled light sensor: the complete absence of subjective effects since the first sessions made me wonder if the LED device was even turning on - a little bit of ambient light seems to disable it thanks to the light sensor. So I stuffed the sensor full of putty, verified it was now always-on with the cellphone camera, and began again; this time it seemed to warm up much faster, making me wonder if all the previous sessions' sense of warmth was simply heat from my hand holding the LEDs
These are quite abstract concepts, though. There is a large gap, a grey area in between these concepts and our knowledge of how the brain functions physiologically – and it's in this grey area that cognitive enhancer development has to operate. Amy Arnsten, Professor of Neurobiology at Yale Medical School, is investigating how the cells in the brain work together to produce our higher cognition and executive function, which she describes as "being able to think about things that aren't currently stimulating your senses, the fundamentals of abstraction. This involves mental representations of our goals for the future, even if it's the future in just a few seconds."
My general impression is positive; it does seem to help with endurance and extended the effect of piracetam+choline, but is not as effective as that combo. At $20 for 30g (bought from Smart Powders), I'm not sure it's worthwhile, but I think at $10-15 it would probably be worthwhile. Sulbutiamine seems to affect my sleep negatively, like caffeine. I bought 2 or 3 canisters for my third batch of pills along with the theanine. For a few nights in a row, I slept terribly and stayed awake thinking until the wee hours of the morning; eventually I realized it was because I was taking the theanine pills along with the sleep-mix pills, and the only ingredient that was a stimulant in the batch was - sulbutiamine. I cut out the theanine pills at night, and my sleep went back to normal. (While very annoying, this, like the creatine & taekwondo example, does tend to prove to me that sulbutiamine was doing something and it is not pure placebo effect.)
In August 2011, after winning the spaced repetition contest and finishing up the Adderall double-blind testing, I decided the time was right to try nicotine again. I had since learned that e-cigarettes use nicotine dissolved in water, and that nicotine-water was a vastly cheaper source of nicotine than either gum or patches. So I ordered 250ml of water at 12mg/ml (total cost: $18.20). A cigarette apparently delivers around 1mg of nicotine, so half a ml would be a solid dose of nicotine, making that ~500 doses. Plenty to experiment with. The question is, besides the stimulant effect, nicotine also causes habit formation; what habits should I reinforce with nicotine? Exercise, and spaced repetition seem like 2 good targets.
Looking at the prices, the overwhelming expense is for modafinil. It's a powerful stimulant - possibly the single most effective ingredient in the list - but dang expensive. Worse, there's anecdotal evidence that one can develop tolerance to modafinil, so we might be wasting a great deal of money on it. (And for me, modafinil isn't even very useful in the daytime: I can't even notice it.) If we drop it, the cost drops by a full $800 from $1761 to $961 (almost halving) and to $0.96 per day. A remarkable difference, and if one were genetically insensitive to modafinil, one would definitely want to remove it.
For instance, they point to the U.S. Army's use of stimulants for soldiers to stave off sleep and to stay sharp. But the Army cares little about the long-term health effects of soldiers, who come home scarred physically or mentally, if they come home at all. It's a risk-benefit decision for the Army, and in a life-or-death situation, stimulants help.
However, they fell short in several categories. The key issue with their product is that it does not contain DHA Omega 3 and the other essential vitamins and nutrients needed to support the absorption of Huperzine A and Phosphatidylserine. Without having DHA Omega 3 it will not have an essential piece to maximum effectiveness. This means that you would need to take a separate pill of DHA Omega 3 and several other essential vitamins to ensure you are able to reach optimal memory support. They also are still far less effective than our #1 pick's complete array of the 3 essential brain supporting ingredients and over 30 supporting nutrients, making their product less effective.
Flow diagram of cognitive neuroscience literature search completed July 2, 2010. Search terms were dextroamphetamine, Aderrall, methylphenidate, or Ritalin, and cognitive, cognition, learning, memory, or executive function, and healthy or normal. Stages of subsequent review used the information contained in the titles, abstracts, and articles to determine whether articles reported studies meeting the inclusion criteria stated in the text.
Of all the smart drugs in the world, Modafinil is most often touted as the best. It's a powerful cognitive enhancer, great for boosting alertness, and has very few, mild side effects that most healthy users will never experience. And no, you can't have any. Sorry. Modafinil is a prescription medication used to treat disorders like narcolepsy, shift work sleep disorder, and for those who suffer from obstructive sleep apnea.
One fairly powerful nootropic substance that, appropriately, has fallen out of favor is nicotine. It's the chemical that gives tobacco products their stimulating kick. It isn't what makes them so deadly, but it does make smoking very addictive. When Europeans learned about tobacco's use from indigenous tribes they encountered in the Americas in the 15th and 16th centuries, they got hooked on its mood-altering effects right away and even believed it could cure joint pain, epilepsy, and the plague. Recently, researchers have been testing the effects of nicotine that's been removed from tobacco, and they believe that it might help treat neurological disorders including Parkinson's disease and schizophrenia; it may also improve attention and focus. But, please, don't start smoking or vaping. Check out these 14 weird brain exercises that make you smarter.
Elaborating on why the psychological side effects of testosterone injection are individual dependent: Not everyone get the same amount of motivation and increased goal seeking from the steroid and most people do not experience periods of chronic avolition. Another psychological effect is a potentially drastic increase in aggression which in turn can have negative social consequences. In the case of counterfactual Wedrifid he gets a net improvement in social consequences. He has observed that aggression and anger are a prompt for increased ruthless self-interested goal seeking. Ruthless self-interested goal seeking involves actually bothering to pay attention to social politics. People like people who do social politics well. Most particularly it prevents acting on contempt which is what Wedrifid finds prompts the most hostility and resentment in others. Point is, what is a sanity promoting change in one person may not be in another.
Nootropics are a responsible way of using smart drugs to enhance productivity. As defined by Giurgea in the 1960's, nootropics should have little to no side-effects. With nootropics, there should be no dependency. And maybe the effects of nootropics are smaller than for instance Adderall, you still improve your productivity without risking your life. This is what separates nootropics from other drugs.
"Cavin's personal experience and humble writing to help educate, not only people who have suffered brain injuries, but anyone interested in the best nutritional advice for optimum brain function is a great introduction to proper nutrition filled with many recommendations of how you can make a changes to your diet immediately. This book provides amazing personal insight related to Cavin's recovery accompanied with well cited peer reviewed sources throughout the entire book detailing the most recent findings around functional neurology!
Or in other words, since the standard deviation of my previous self-ratings is 0.75 (see the Weather and my productivity data), a mean rating increase of >0.39 on the self-rating. This is, unfortunately, implying an extreme shift in my self-assessments (for example, 3s are ~50% of the self-ratings and 4s ~25%; to cause an increase of 0.25 while leaving 2s alone in a sample of 23 days, one would have to push 3s down to ~25% and 4s up to ~47%). So in advance, we can see that the weak plausible effects for Noopept are not going to be detected here at our usual statistical levels with just the sample I have (a more plausible experiment might use 178 pairs over a year, detecting down to d>=0.18). But if the sign is right, it might make Noopept worthwhile to investigate further. And the hardest part of this was just making the pills, so it's not a waste of effort.
The amphetamine mix branded Adderall is terribly expensive to obtain even compared to modafinil, due to its tight regulation (a lower schedule than modafinil), popularity in college as a study drug, and reportedly moves by its manufacture to exploit its privileged position as a licensed amphetamine maker to extract more consumer surplus. I paid roughly $4 a pill but could have paid up to $10. Good stimulant hygiene involves recovery periods to avoid one's body adapting to eliminate the stimulating effects, so even if Adderall was the answer to all my woes, I would not be using it more than 2 or 3 times a week. Assuming 50 uses a year (for specific projects, let's say, and not ordinary aimless usage), that's a cool $200 a year. My general belief was that Adderall would be too much of a stimulant for me, as I am amphetamine-naive and Adderall has a bad reputation for letting one waste time on unimportant things. We could say my prediction was 50% that Adderall would be useful and worth investigating further. The experiment was pretty simple: blind randomized pills, 10 placebo & 10 active. I took notes on how productive I was and the next day guessed whether it was placebo or Adderall before breaking the seal and finding out. I didn't do any formal statistics for it, much less a power calculation, so let's try to be conservative by penalizing the information quality heavily and assume it had 25%. So \frac{200 - 0}{\ln 1.05} \times 0.50 \times 0.25 = 512! The experiment probably used up no more than an hour or two total.
Second, users are concerned with the possibility of withdrawal if they stop taking the nootropics. They worry that if they stop taking nootropics they won't be as smart as when they were taking nootropics, and will need to continue taking them to function. Some users report feeling a slight brain fog when discontinuing nootropics, but that isn't a sign of regression.
More recently, the drug modafinil (brand name: Provigil) has become the brain-booster of choice for a growing number of Americans. According to the FDA, modafinil is intended to bolster "wakefulness" in people with narcolepsy, obstructive sleep apnea or shift work disorder. But when people without those conditions take it, it has been linked with improvements in alertness, energy, focus and decision-making. A 2017 study found evidence that modafinil may enhance some aspects of brain connectivity, which could explain these benefits.
One last note on tolerance; after the first few days of using smart drugs, just like with other drugs, you may not get the same effects as before. You've just experienced the honeymoon period. This is where you feel a large effect the first few times, but after that, you can't replicate it. Be careful not to exceed recommended doses, and try cycling to get the desired effects again.
On the plus side: - I noticed the less-fatigue thing to a greater extent, getting out of my classes much less tired than usual. (Caveat: my sleep schedule recently changed for the saner, so it's possible that's responsible. I think it's more the piracetam+choline, though.) - One thing I wasn't expecting was a decrease in my appetite - nobody had mentioned that in their reports.I don't like being bothered by my appetite (I know how to eat fine without it reminding me), so I count this as a plus. - Fidgeting was reduced further
With something like creatine, you'd know if it helps you pump out another rep at the gym on a sustainable basis. With nootropics, you can easily trick yourself into believing they help your mindset. The ideal is to do a trial on yourself. Take identical looking nootropic pills and placebo pills for a couple weeks each, then see what the difference is. With only a third party knowing the difference, of course.
I took the pill at 11 PM the evening of (technically, the day before); that day was a little low on sleep than usual, since I had woken up an hour or half-hour early. I didn't yawn at all during the movie (merely mediocre to my eyes with some questionable parts)22. It worked much the same as it did the previous time - as I walked around at 5 AM or so, I felt perfectly alert. I made good use of the hours and wrote up my memories of ICON 2011.
Iluminal is an example of an over-the-counter serotonergic drug used by people looking for performance enhancement, memory improvements, and mood-brightening. Also noteworthy, a wide class of prescription anti-depression drugs are based on serotonin reuptake inhibitors that slow the absorption of serotonin by the presynaptic cell, increasing the effect of the neurotransmitter on the receptor neuron – essentially facilitating the free flow of serotonin throughout the brain.
The concept of neuroenhancement and the use of substances to improve cognitive functioning in healthy individuals, is certainly not a new one. In fact, one of the first cognitive enhancement drugs, Piracetam, was developed over fifty years ago by psychologist and chemist C.C. Giurgea. Although he did not know the exact mechanism, Giurgia believed the drug boosted brain power and so began his exploration into "smart pills", or nootropics, a term he coined from the Greek nous, meaning "mind," and trepein, meaning "to bend.
Two variants of the Towers of London task were used by Elliott et al. (1997) to study the effects of MPH on planning. The object of this task is for subjects to move game pieces from one position to another while adhering to rules that constrain the ways in which they can move the pieces, thus requiring subjects to plan their moves several steps ahead. Neither version of the task revealed overall effects of the drug, but one version showed impairment for the group that received the drug first, and the other version showed enhancement for the group that received the placebo first.
Adaptogens are plant-derived chemicals whose activity helps the body maintain or regain homeostasis (equilibrium between the body's metabolic processes). Almost without exception, adaptogens are available over-the-counter as dietary supplements, not controlled drugs. Well-known adaptogens include Ginseng, Kava Kava, Passion Flower, St. Johns Wort, and Gotu Kola. Many of these traditional remedies border on being "folk wisdom," and have been in use for hundreds or thousands of years, and are used to treat everything from anxiety and mild depression to low libido. While these smart drugs work in a many different ways (their commonality is their resultant function within the body, not their chemical makeup), it can generally be said that the cognitive boost users receive is mostly a result of fixing an imbalance in people with poor diets, body toxicity, or other metabolic problems, rather than directly promoting the growth of new brain cells or neural connections.
Bacopa is a supplement herb often used for memory or stress adaptation. Its chronic effects reportedly take many weeks to manifest, with no important acute effects. Out of curiosity, I bought 2 bottles of Bacognize Bacopa pills and ran a non-randomized non-blinded ABABA quasi-self-experiment from June 2014 to September 2015, measuring effects on my memory performance, sleep, and daily self-ratings of mood/productivity. Because of the very slow onset, small effective sample size, definite temporal trends probably unrelated to Bacopa, and noise in the variables, the results were as expected, ambiguous, and do not strongly support any correlation between Bacopa and memory/sleep/self-rating (+/-/- respectively).
One of the other suggested benefits is for boosting serotonin levels; low levels of serotonin are implicated in a number of issues like depression. I'm not yet sure whether tryptophan has helped with motivation or happiness. Trial and error has taught me that it's a bad idea to take tryptophan in the morning or afternoon, however, even smaller quantities like 0.25g. Like melatonin, the dose-response curve is a U: ~1g is great and induces multiple vivid dreams for me, but ~1.5g leads to an awful night and a headache the next day that was worse, if anything, than melatonin. (One morning I woke up with traces of at least 7 dreams, although I managed to write down only 2. No lucid dreams, though.)
"My husband and I (Ryan Cedermark) are so impressed with the research Cavin did when writing this book. If you, a family member or friend has suffered a TBI, concussion or are just looking to be nicer to your brain, then we highly recommend this book! Your brain is only as good as the body's internal environment and Cavin has done an amazing job on providing the information needed to obtain such!"
Certain pharmaceuticals could also qualify as nootropics. For at least the past 20 years, a lot of people—students, especially—have turned to attention deficit hyperactivity disorder (ADHD) drugs like Ritalin and Adderall for their supposed concentration-strengthening effects. While there's some evidence that these stimulants can improve focus in people without ADHD, they have also been linked, in both people with and without an ADHD diagnosis, to insomnia, hallucinations, seizures, heart trouble and sudden death, according to a 2012 review of the research in the journal Brain and Behavior. They're also addictive.
The methodology would be essentially the same as the vitamin D in the morning experiment: put a multiple of 7 placebos in one container, the same number of actives in another identical container, hide & randomly pick one of them, use container for 7 days then the other for 7 days, look inside them for the label to determine which period was active and which was placebo, refill them, and start again.
Blinding stymied me for a few months since the nasty taste was unmistakable and I couldn't think of any gums with a similar flavor to serve as placebo. (The nasty taste does not seem to be due to the nicotine despite what one might expect; Vaniver plausibly suggested the bad taste might be intended to prevent over-consumption, but nothing in the Habitrol ingredient list seemed to be noted for its bad taste, and a number of ingredients were sweetening sugars of various sorts. So I couldn't simply flavor some gum.)
For 2 weeks, upon awakening I took close-up photographs of my right eye. Then I ordered two jars of Life-Extension Sea-Iodine (60x1mg) (1mg being an apparently safe dose), and when it arrived on 10 September 2012, I stopped the photography and began taking 1 iodine pill every other day. I noticed no ill effects (or benefits) after a few weeks and upped the dose to 1 pill daily. After the first jar of 60 pills was used up, I switched to the second jar, and began photography as before for 2 weeks. The photographs were uploaded, cropped by hand in Gimp, and shrunk to more reasonable dimensions; both sets are available in a Zip file.
One of the most common strategies to beat this is cycling. Users who cycle their nootropics take them for a predetermined period, (usually around five days) before taking a two-day break from using them. Once the two days are up, they resume the cycle. By taking a break, nootropic users reduce the tolerance for nootropics and lessen the risk of regression and tolerance symptoms.

redpajama_set_name: RedPajamaCommonCrawl


Recently there has been a lot of talk about home prices and if they are accelerating too quickly. In some areas of the country, seller supply (that is, the number of homes for sale) cannot keep up with the number of buyers out looking for a home. This has caused prices to rise.
At Coastal Realty Connections, we believe in silver linings. The great news about rising pricesis that according to CoreLogic's latest US Economic Outlook, the average American household gained over $11,000 in equity over the course of the last year, largely due to home value increases.
CoreLogic predicts that home prices will appreciate by another 5% by this time next year. If you're a homeowner looking to take advantage of your home equity by moving up to your dream home, contact Coastal Realty Connections today to discuss your options!