cdm/src/main/java/ucar/ma2/StructureDataA.java
public String[] getJavaArrayString(StructureMembers.Member m) {
    if (m.getDataType() == DataType.STRING) {
      Array data = getArray(m);
      int n = m.getSize();
      String[] result = new String[n];
      for (int i = 0; i < result.length; i++)
        result[i] = (String) data.getObject(i);
      return result;

    } else if (m.getDataType() == DataType.CHAR) {
      ArrayChar data = (ArrayChar) getArray(m);
      ArrayChar.StringIterator iter = data.getStringIterator();
      String[] result = new String[iter.getNumElems()];
      int count = 0;
      while (iter.hasNext())
        result[count++] = iter.next();
      return result;
    }

    throw new IllegalArgumentException("getJavaArrayString: not String DataType :" + m.getDataType());
  }
public String[] getJavaArrayString(StructureMembers.Member m) {
    if (m.getDataType() == DataType.STRING) {
      Array data = getArray(m);
      int n = m.getSize();
      String[] result = new String[n];
      for (int i = 0; i < result.length; i++)
        result[i] = (String) data.getObject(i);
      return result;

    } else if (m.getDataType() == DataType.CHAR) {
      ArrayChar data = (ArrayChar) getArray(m);
      ArrayChar.StringIterator iter = data.getStringIterator();
      String[] result = new String[iter.getNumElems()];
      int count = 0;
      while (iter.hasNext())
        result[count++] = iter.next();
      return result;
    }

    throw new IllegalArgumentException("getJavaArrayString: not String DataType :" + m.getDataType());
  }
public String [ ] getJavaArrayString ( StructureMembers . Member m ) { if ( m . getDataType ( ) == DataType . STRING ) { Array data = getArray ( m ) ; int n = m . getSize ( ) ; String [ ] result = new String [ n ] ; for ( int i = 0 ; i < result . length ; i ++ ) result [ i ] = ( String ) data . getObject ( i ) ; return result ; } else if ( m . getDataType ( ) == DataType . CHAR ) { ArrayChar data = ( ArrayChar ) getArray ( m ) ; ArrayChar . StringIterator iter = data . getStringIterator ( ) ; String [ ] result = new String [ iter . getNumElems ( ) ] ; int count = 0 ; while ( iter . hasNext ( ) ) result [ count ++ ] = iter . next ( ) ; return result ; } throw new IllegalArgumentException ( "getJavaArrayString: not String DataType :" + m . getDataType ( ) ) ; }
LOOK can we optimize ??
LOOK can we optimize ??