static public ArrayStructureMA factoryMA ( Structure from , int [ ] shape ) throws IOException { StructureMembers sm = from . makeStructureMembers ( ) ; for ( Variable v : from . getVariables ( ) ) { Array data ; if ( v instanceof Sequence ) { data = Array . factory ( DataType . SEQUENCE , shape ) ; // an array sequence - one for each parent element //Structure s = (Structure) v; //StructureMembers smn = s.makeStructureMembers(); // data = new ArraySequenceNested(smn, (int) Index.computeSize(v.getShapeAll())); // ?? } else if ( v instanceof Structure ) data = ArrayStructureMA . factoryMA ( ( Structure ) v , combine ( shape , v . getShape ( ) ) ) ; else data = Array . factory ( v . getDataType ( ) , combine ( shape , v . getShape ( ) ) ) ; StructureMembers . Member m = sm . findMember ( v . getShortName ( ) ) ; m . setDataArray ( data ) ; } return new ArrayStructureMA ( sm , shape ) ; }
Create an ArrayStructure for a Structure . Allow nested Structures . Create the data arrays and an iterator .