public class ArrayBvr extends Behavior { // Methods public NumberBvr length(); public Behavior nth(NumberBvr a); public static ArrayBvr newUninitBvr(ArrayBvr arr); }
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); ...
Finds the length of an array behavior.
public NumberBvr length( );
Returns a NumberBvr object that is the length of an array behavior.
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 runtime error.
public Behavior nth(
NumberBvr a
);
Returns the Behavior object.
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.)
public static ArrayBvr newUninitBvr(
ArrayBvr arr
);
Returns the ArrayBvr object.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.