/[schmitzm]/trunk/src/skrueger/AttributeMetadataImpl.java
ViewVC logotype

Diff of /trunk/src/skrueger/AttributeMetadataImpl.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 658 by alfonx, Wed Feb 3 15:32:21 2010 UTC revision 678 by alfonx, Fri Feb 5 15:21:33 2010 UTC
# Line 29  Line 29 
29   ******************************************************************************/   ******************************************************************************/
30  package skrueger;  package skrueger;
31    
 import java.util.ArrayList;  
32  import java.util.HashSet;  import java.util.HashSet;
33  import java.util.List;  import java.util.List;
34    
35  import org.apache.log4j.Logger;  import org.apache.log4j.Logger;
36  import org.geotools.feature.NameImpl;  import org.geotools.feature.NameImpl;
 import org.geotools.feature.Feature.NULL;  
37  import org.opengis.feature.type.AttributeDescriptor;  import org.opengis.feature.type.AttributeDescriptor;
38  import org.opengis.feature.type.Name;  import org.opengis.feature.type.Name;
39    
# Line 244  public class AttributeMetadata implement Line 242  public class AttributeMetadata implement
242                  amd.setFunctionX(getFunctionX());                  amd.setFunctionX(getFunctionX());
243                  amd.setFunctionA(getFunctionA());                  amd.setFunctionA(getFunctionA());
244    
245                  for (final Object nodataValue : getNodataValues()) {                  amd.setNodataValues(getNodataValues());
                         amd.getNodataValues().add(nodataValue);  
                 }  
246    
247                  return amd;                  return amd;
248          }          }
249    
250            // only to be used by copyTo()
251            private void setNodataValues(HashSet<Object> nodataValues2) {
252                    nodataValues = nodataValues2;
253            }
254    
255          public Translation getDesc() {          public Translation getDesc() {
256                  return desc;                  return desc;
257          }          }
# Line 340  public class AttributeMetadata implement Line 341  public class AttributeMetadata implement
341                  this.name = name;                  this.name = name;
342          }          }
343    
344          public void setNodataValues(final HashSet<Object> nodataValues) {          public void addNodataValue(Object nodataValue) {
345                  this.nodataValues = nodataValues;                  this.nodataValues.add(nodataValue);
346            }
347            
348            public void removeNodataValue(Object nodataValue) {
349                    this.nodataValues.remove(nodataValue);
350          }          }
351    
352          public void setTitle(final Translation title) {          public void setTitle(final Translation title) {
# Line 387  public class AttributeMetadata implement Line 392  public class AttributeMetadata implement
392          }          }
393    
394          /**          /**
395           * Takes any value object and checks it againsts the NODATA values. If the           * Takes any value object and checks it against the NODATA values. If the
396           * value equals a NODATA value, <code>null</code> is returned. Otherwise the           * value equals a NODATA value, <code>null</code> is returned. Otherwise the
397           * same object is returned.           * same object is returned.
398           *           *
399           * Note: This method is called often.           * Note: This method is called often.
400           */           */
401          public Object fiterNodata(final Object value) {          public Object fiterNodata(final Object value) {
402                    if (nodataValues.contains(value)) return null;
                 // contains.. hash  
                 for (final Object nodataValue : getNodataValues()) {  
                         if (nodataValue.equals(value))  
                                 return null;  
                 }  
403                  return value;                  return value;
404          }          }
405  }  }

Legend:
Removed from v.658  
changed lines
  Added in v.678

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26