/[schmitzm]/branches/2.3.x/src/skrueger/AttributeMetadataInterface.java
ViewVC logotype

Diff of /branches/2.3.x/src/skrueger/AttributeMetadataInterface.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 675 by alfonx, Thu Feb 4 19:05:34 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 79  public class AttributeMetadata implement Line 77  public class AttributeMetadata implement
77           * be set and will always be interpreted as NULL internally and will usually           * be set and will always be interpreted as NULL internally and will usually
78           * be ignored. This overcomes the problem, that           * be ignored. This overcomes the problem, that
79           **/           **/
80          protected HashSet<Object> nodataValues = new HashSet<Object>();          protected final HashSet<Object> nodataValues = new HashSet<Object>();
81    
82          /** Translation of the attribute's title **/          /** Translation of the attribute's title **/
83          protected Translation title = new Translation();          protected Translation title = new Translation();
# Line 340  public class AttributeMetadata implement Line 338  public class AttributeMetadata implement
338                  this.name = name;                  this.name = name;
339          }          }
340    
341          public void setNodataValues(final HashSet<Object> nodataValues) {          public void addNodataValue(Object nodataValue) {
342                  this.nodataValues = nodataValues;                  this.nodataValues.add(nodataValue);
343            }
344            
345            public void removeNodataValue(Object nodataValue) {
346                    this.nodataValues.remove(nodataValue);
347          }          }
348    
349          public void setTitle(final Translation title) {          public void setTitle(final Translation title) {
# Line 387  public class AttributeMetadata implement Line 389  public class AttributeMetadata implement
389          }          }
390    
391          /**          /**
392           * 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
393           * value equals a NODATA value, <code>null</code> is returned. Otherwise the           * value equals a NODATA value, <code>null</code> is returned. Otherwise the
394           * same object is returned.           * same object is returned.
395           *           *
396           * Note: This method is called often.           * Note: This method is called often.
397           */           */
398          public Object fiterNodata(final Object value) {          public Object fiterNodata(final Object value) {
399                    if (nodataValues.contains(value)) return null;
                 // contains.. hash  
                 for (final Object nodataValue : getNodataValues()) {  
                         if (nodataValue.equals(value))  
                                 return null;  
                 }  
400                  return value;                  return value;
401          }          }
402  }  }

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26