ArrayBvr Class

Selects an object based on a time-varying index. The following example constructs an ArrayBvr out of a Java array and uses the nth method with a time-varying parameter to cycle through the list of colors:

...ColorBvr[] arr = {red, green, blue, yellow, green, cyan,
magenta};
ArrayBvr arrBvr = new ArrayBvr(arr);

//Build an indexer to repeatedly go from 0 to (length - 1)
//at a rate of 1 unit per second.
NumberBvr indexer = mod(localTime, toBvr(arr.length - 1));

//Use indexer to index into the ArrayBvr.
ColorBvr cyclingCol = (ColorBvr)arrBvr.nth(indexer);

...

ArrayBvr Methods

length Finds the length of an array behavior.
nth Selects a Behavior object based on the time-varying value of a NumberBvr.
newUninitBvr Makes it possible to refer to an array behavior before that behavior has been defined.

length

ArrayBvr Class

Finds the length of an array behavior.

Syntax

public NumberBvr length( );

Return Value

Returns a NumberBvr object that is the length of an array behavior.

nth

ArrayBvr Class

Selects a Behavior object based on the time-varying value of a NumberBvr. It uses the greatest integer value less than the number's value to determine the index. An array's index begins at 0 and any attempt to index beyond its length results in a run-time error.

Syntax

public Behavior nth( NumberBvr a );

Parameters

a
NumberBvr object used as an index into the array behavior. This parameter can also be of type double.

Return Value

Returns the Behavior object.

newUninitBvr

ArrayBvr Class

Makes it possible to refer to an array behavior before that behavior has been defined. With this method, a behavior can be created and used in the definition of other behaviors, while its contents are defined at some later point. (This definition is accomplished with the init method, which is available on all behaviors.)

Syntax

public static ArrayBvr newUninitBvr( ArrayBvr arr );

Parameters

arr
Used to establish what type the array holds.

Return Value

Returns the ArrayBvr object.


Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.