79 |
* 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 |
80 |
* be ignored. This overcomes the problem, that |
* be ignored. This overcomes the problem, that |
81 |
**/ |
**/ |
82 |
protected HashSet<Object> nodataValues = new HashSet<Object>(); |
protected final HashSet<Object> nodataValues = new HashSet<Object>(); |
83 |
|
|
84 |
/** Translation of the attribute's title **/ |
/** Translation of the attribute's title **/ |
85 |
protected Translation title = new Translation(); |
protected Translation title = new Translation(); |
340 |
this.name = name; |
this.name = name; |
341 |
} |
} |
342 |
|
|
343 |
public void setNodataValues(final HashSet<Object> nodataValues) { |
public void addNodataValue(Object nodataValue) { |
344 |
this.nodataValues = nodataValues; |
this.nodataValues.add(nodataValue); |
345 |
|
} |
346 |
|
|
347 |
|
public void removeNodataValue(Object nodataValue) { |
348 |
|
this.nodataValues.remove(nodataValue); |
349 |
} |
} |
350 |
|
|
351 |
public void setTitle(final Translation title) { |
public void setTitle(final Translation title) { |
391 |
} |
} |
392 |
|
|
393 |
/** |
/** |
394 |
* 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 |
395 |
* value equals a NODATA value, <code>null</code> is returned. Otherwise the |
* value equals a NODATA value, <code>null</code> is returned. Otherwise the |
396 |
* same object is returned. |
* same object is returned. |
397 |
* |
* |
398 |
* Note: This method is called often. |
* Note: This method is called often. |
399 |
*/ |
*/ |
400 |
public Object fiterNodata(final Object value) { |
public Object fiterNodata(final Object value) { |
401 |
|
if (nodataValues.contains(value)) return null; |
|
// contains.. hash |
|
|
for (final Object nodataValue : getNodataValues()) { |
|
|
if (nodataValue.equals(value)) |
|
|
return null; |
|
|
} |
|
402 |
return value; |
return value; |
403 |
} |
} |
404 |
} |
} |