/** * set current element at dimension 0 to v * * @param v set 0th dimension index to this value * @return this, so you can use A.get(i.set(i)) */ public Index set0(int v) { setDim(0, v); return this; }
public void setShape(int[] shape) { this.shape = shape; this.size = (int) Index.computeSize(shape); this.isVariableLength = (shape.length > 0 && shape[shape.length - 1] < 0); }
/** get the value at the specified index. */ public long get(Index i) { return storage[i.currentElement()]; } /** set the value at the sepcified index. */
public String toString() { if (counter == null || counter.toString().equals("")) // not sure about the second condition counter = Index.factory(maa.getShape()); counter.setCurrentCounter( currElement); return counter.toString(); }
public int[] getCurrentCounter() { if (counter == null) // or counter == "" ? counter = Index.factory(maa.getShape()); counter.setCurrentCounter( currElement); return counter.current; }
protected Object getObject(Array array) { Index index = array.getIndex(); index.set(0); return array.getObject(index); }
protected Array(DataType dataType, int[] shape) { this.dataType = dataType; this.rank = shape.length; this.indexCalc = Index.factory(shape); }
public void testString() { System.out.println("testString: testString"); // read for (i=0; i<m; i++) { ima.set0(i); String val = A.getString( ima); assert( val.equals("aaa")); } }
private void dump(Array data, int col) { int[] shape = data.getShape(); Index ima = data.getIndex(); for (int j = 0; j < shape[0]; j++) { float dd = data.getFloat(ima.set(j, col)); System.out.println(j + " value= " + dd); } }
/** * Generate new Array with given type and shape and zeroed storage. * * @param classType element Class type, eg double.class. * @param shape shape of the array. * @return new Array<type> or Array<type>.D<rank> if 0 <= rank <= 7. */ static public Array factory(Class classType, int[] shape) { Index index = Index.factory(shape); return factory(classType, index); }
public String toString() { if (counter == null || counter.toString().equals("")) // not sure about the second condition counter = Index.factory(maa.getShape()); counter.setCurrentCounter( currElement); return counter.toString(); }
public Attribute(String name, Number val, boolean isUnsigned) { super(name); if (name == null) throw new IllegalArgumentException("Trying to set name to null on " + this); int[] shape = new int[1]; shape[0] = 1; DataType dt = DataType.getType(val.getClass(), isUnsigned); setDataType(dt); Array vala = Array.factory(dt, shape); Index ima = vala.getIndex(); vala.setObject(ima.set0(0), val); setValues(vala); setImmutable(); }
public int[] getCurrentCounter() { if (counter == null) // or counter == "" ? counter = Index.factory(maa.getShape()); counter.setCurrentCounter( currElement); return counter.current; }
private void dump(Array data, int col) { int[] shape = data.getShape(); Index ima = data.getIndex(); for (int j = 0; j < shape[0]; j++) { float dd = data.getFloat(ima.set(j, col)); System.out.println(j + " value= " + dd); } }
/** * set current element at dimension 1 to v * * @param v set dimension 1 index to this value * @return this, so you can use A.get(i.set(i)) */ public Index set1(int v) { setDim(1, v); return this; }
public Member(String name, String desc, String units, DataType dtype, int[] shape) { this.name = name; this.desc = desc; this.units = units; this.dtype = dtype; this.shape = shape; this.size = (int) Index.computeSize(shape); }