cdm/src/main/java/ucar/nc2/Structure.java
public boolean replaceMemberVariable( Variable newVar) {
    if (isImmutable()) throw new IllegalStateException("Cant modify");
    //smembers = null;
    boolean found = false;
    for (int i = 0; i < members.size(); i++) {
      Variable v =  members.get(i);
      if (v.getShortName() == null)
          System.out.println("BAD null short name"); // E:/work/ghansham/iasi_20110513_045057_metopa_23676_eps_o.l1_bufr
      if (v.getShortName().equals( newVar.getShortName())) {
        members.set( i, newVar);
        found = true;
      }
    }

    if (!found)
      members.add( newVar);
    return found;
  }
public boolean replaceMemberVariable( Variable newVar) {
    if (isImmutable()) throw new IllegalStateException("Cant modify");
    //smembers = null;
    boolean found = false;
    for (int i = 0; i < members.size(); i++) {
      Variable v =  members.get(i);
      if (v.getShortName() == null)
          System.out.println("BAD null short name"); // E:/work/ghansham/iasi_20110513_045057_metopa_23676_eps_o.l1_bufr
      if (v.getShortName().equals( newVar.getShortName())) {
        members.set( i, newVar);
        found = true;
      }
    }

    if (!found)
      members.add( newVar);
    return found;
  }
public boolean replaceMemberVariable ( Variable newVar ) { if ( isImmutable ( ) ) throw new IllegalStateException ( "Cant modify" ) ; //smembers = null; boolean found = false ; for ( int i = 0 ; i < members . size ( ) ; i ++ ) { Variable v = members . get ( i ) ; if ( v . getShortName ( ) == null ) System . out . println ( "BAD null short name" ) ; // E:/work/ghansham/iasi_20110513_045057_metopa_23676_eps_o.l1_bufr if ( v . getShortName ( ) . equals ( newVar . getShortName ( ) ) ) { members . set ( i , newVar ) ; found = true ; } } if ( ! found ) members . add ( newVar ) ; return found ; }
Replace a Variable with another that has the same name : uses the variable name to find it.
If old Var is not found, just add the new one
@param newVar add this variable as a member of this structure
@return true if was found and replaced
Replace a Variable with another that has the same name : uses the variable name to find it . If old Var is not found just add the new one