/** Get the variables contained directly in this Structure. * @return List of type Variable. */ public java.util.List<Variable> getVariables() { return isImmutable() ? members : new ArrayList<>(members); }
/** Get the variables contained directly in this Structure. * @return List of type Variable. */ public java.util.List<Variable> getVariables() { return isImmutable() ? members : new ArrayList<Variable>(members); }
/** Get the variables contained directly in this Structure. * @return List of type Variable. */ public java.util.List<Variable> getVariables() { return isImmutable() ? members : new ArrayList<>(members); }
/** Set the list of member variables. * @param vars this is the list of member variables */ public void setMemberVariables( List<Variable> vars) { if (isImmutable()) throw new IllegalStateException("Cant modify"); members = new ArrayList<Variable>(); memberHash = new HashMap<String, Variable>(2*vars.size()); for (Variable v : vars) { members.add(v); memberHash.put( v.getShortName(), v); } }
/** Set the list of member variables. * @param vars this is the list of member variables */ public void setMemberVariables( List<Variable> vars) { if (isImmutable()) throw new IllegalStateException("Cant modify"); members = new ArrayList<>(); memberHash = new HashMap<>(2*vars.size()); for (Variable v : vars) { addMemberVariable(v); } }
/** Set the list of member variables. * @param vars this is the list of member variables */ public void setMemberVariables( List<Variable> vars) { if (isImmutable()) throw new IllegalStateException("Cant modify"); members = new ArrayList<>(); memberHash = new HashMap<>(2*vars.size()); for (Variable v : vars) { addMemberVariable(v); } }
/** Add a member variable * @param v add this variable as a member of this structure * @return the added variable */ public Variable addMemberVariable( Variable v) { if (isImmutable()) throw new IllegalStateException("Cant modify"); members.add( v); memberHash.put( v.getShortName(), v); v.setParentStructure( this); return v; }
/** Add a member variable * @param v add this variable as a member of this structure * @return the added variable */ public Variable addMemberVariable( Variable v) { if (isImmutable()) throw new IllegalStateException("Cant modify"); members.add( v); memberHash.put( v.getShortName(), v); v.setParentStructure( this); return v; }
/** Add a member variable * @param v add this variable as a member of this structure * @return the added variable */ public Variable addMemberVariable( Variable v) { if (isImmutable()) throw new IllegalStateException("Cant modify"); members.add( v); memberHash.put( v.getShortName(), v); v.setParentStructure( this); return v; }
/** Set the parent group of this Structure, and all member variables. */ @Override public void setParentGroup(Group group) { if (isImmutable()) throw new IllegalStateException("Cant modify"); super.setParentGroup(group); if(members != null) { for (Variable v : members) { v.setParentGroup(group); } } }
/** Set the parent group of this Structure, and all member variables. */ @Override public void setParentGroup(Group group) { if (isImmutable()) throw new IllegalStateException("Cant modify"); super.setParentGroup(group); if(members != null) { for (Variable v : members) { v.setParentGroup(group); } } }
/** Set the parent group of this Structure, and all member variables. */ @Override public void setParentGroup(Group group) { if (isImmutable()) throw new IllegalStateException("Cant modify"); super.setParentGroup(group); if(members != null) { for (Variable v : members) { v.setParentGroup(group); } } }
/** 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 */ 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; }
/** Remove a Variable : uses the Variable name to find it. * @param v remove this variable as a member of this structure * @return true if was found and removed */ public boolean removeMemberVariable( Variable v) { if (isImmutable()) throw new IllegalStateException("Cant modify"); if (v == null) return false; //smembers = null; java.util.Iterator<Variable> iter = members.iterator(); while (iter.hasNext()) { Variable mv = iter.next(); if (mv.getShortName().equals(v.getShortName())) { iter.remove(); memberHash.remove( v.getShortName()); return true; } } return false; }
/** Remove a Variable : uses the Variable name to find it. * @param v remove this variable as a member of this structure * @return true if was found and removed */ public boolean removeMemberVariable( Variable v) { if (isImmutable()) throw new IllegalStateException("Cant modify"); if (v == null) return false; //smembers = null; java.util.Iterator<Variable> iter = members.iterator(); while (iter.hasNext()) { Variable mv = iter.next(); if (mv.getShortName().equals(v.getShortName())) { iter.remove(); memberHash.remove( v.getShortName()); return true; } } return false; }
/** Remove a Variable : uses the Variable name to find it. * @param v remove this variable as a member of this structure * @return true if was found and removed */ public boolean removeMemberVariable( Variable v) { if (isImmutable()) throw new IllegalStateException("Cant modify"); if (v == null) return false; //smembers = null; java.util.Iterator<Variable> iter = members.iterator(); while (iter.hasNext()) { Variable mv = iter.next(); if (mv.getShortName().equals(v.getShortName())) { iter.remove(); memberHash.remove( v.getShortName()); return true; } } return false; }
/** 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 */ 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 */ 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; }