This is an example Java Bean that creates a 3D array of values given a height, width, and depth.
Download Cube.java (Use right-click/Save As...)
import com.phoenix_int.aserver.*; import com.phoenix_int.aserver.types.*; import java.util.*; public class Cube extends PHXSimpleSelfManager2 implements IPHXAnalysis { private PHXLong _width = new PHXLong(); private PHXLong _height = new PHXLong(); private PHXLong _depth = new PHXLong(); private PHXLong _volume = new PHXLong(); private PHXLongArray _array = new PHXLongArray(); public Cube() throws PHXInvalidNameException, PHXNameAlreadyInUseException { // tell the super class about the variables we want to expose to // the Analysis Server: // // addVariable( varName, isInput?, varObject ) // super.makeGroup("Inputs"); super.addVariable( "Inputs","width", true, _width ); super.addVariable( "Inputs","height", true, _height ); super.addVariable( "Inputs","depth", true, _depth ); super.makeGroup("Outputs"); super.addVariable( "Outputs","volume", false, _volume ); super.addVariable( "Outputs","arrayOut", false, _array ); } public void execute() throws Exception { _volume.setValue( _width.getValue()*_height.getValue()*_depth.getValue() ); // Allocate array int[] size = { (int)_width.getValue(), (int)_height.getValue(), (int)_depth.getValue() }; _array.resize( size ); for(int i=0;i<_width.getValue();i++) { for(int j=0;j<_height.getValue();j++) { for(int k=0;k<_depth.getValue();k++) { int[] index = {i, j, k}; _array.setValue(index, i+j+k); } } } } public void end() { } public String invoke( String method ) throws Exception { throw new NoSuchMethodException( method ); } }