Package ucar.nc2
Class AttributeContainerMutable
java.lang.Object
ucar.nc2.AttributeContainerMutable
- All Implemented Interfaces:
Iterable<Attribute>,AttributeContainer
A mutable collection of Attributes.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor with container name.AttributeContainerMutable(String name, Iterable<Attribute> from) Constructor with container name and list of Attributes to copy in. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd all; replace old if has same name.addAttribute(String name, Number value) Add Attribute; name and value must not be null.addAttribute(String name, String value) Add Attribute; name and value must not be null.addAttribute(Attribute att) Add new or replace old if has same namestatic AttributeContainerMutablecopyFrom(AttributeContainer from) Create mutable from immutable container.findAttribute(String name) Find an Attribute by exact match on name.doublefindAttributeDouble(String attName, double defaultValue) Find a Numeric Attribute by name (ignore case), return the double value of the Attribute.Find an Attribute by name, first doing an exact match, then ignoring case.intfindAttributeInteger(String attName, int defaultValue) Find a Numeric Attribute by name (ignore case), return the integer value of the Attribute.findAttributeString(String attName, String defaultValue) Find a String Attribute by name (ignore case), return the String value of the Attribute.Returns immutable list of attributes.getName()Get the (optional) name of the AttributeContainer.booleanisEmpty()True is there are no attributes in the container.booleanRemove an Attribute : uses the attribute hashCode to find it.booleanremoveAttribute(String attName) Remove an Attribute by name.booleanremoveAttributeIgnoreCase(String attName) Remove an Attribute by name, ignoring casevoidReplace an Attribute with a different name, same value.voidDeprecated.do not use.voidTurn into an immutable AttributeContainerMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ucar.nc2.AttributeContainer
findAttValueIgnoreCase, hasAttribute, hasAttributeIgnoreCase, iteratorMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
AttributeContainerMutable
Constructor with container name. -
AttributeContainerMutable
Constructor with container name and list of Attributes to copy in.
-
-
Method Details
-
copyFrom
Create mutable from immutable container. -
setName
-
getName
Description copied from interface:AttributeContainerGet the (optional) name of the AttributeContainer.- Specified by:
getNamein interfaceAttributeContainer
-
setImmutable
Deprecated.do not use. -
getAttributes
Description copied from interface:AttributeContainerReturns immutable list of attributes.- Specified by:
getAttributesin interfaceAttributeContainer
-
addAttribute
Description copied from interface:AttributeContainerAdd new or replace old if has same name- Specified by:
addAttributein interfaceAttributeContainer- Parameters:
att- add this Attribute- Returns:
- the added attribute
-
addAttribute
Add Attribute; name and value must not be null. -
addAttribute
Add Attribute; name and value must not be null. -
addAll
Add all; replace old if has same name.- Specified by:
addAllin interfaceAttributeContainer
-
findAttributeString
Description copied from interface:AttributeContainerFind a String Attribute by name (ignore case), return the String value of the Attribute.- Specified by:
findAttributeStringin interfaceAttributeContainer- Returns:
- the attribute value, or defaultValue if not found
-
findAttribute
Description copied from interface:AttributeContainerFind an Attribute by exact match on name.- Specified by:
findAttributein interfaceAttributeContainer
-
findAttributeIgnoreCase
Description copied from interface:AttributeContainerFind an Attribute by name, first doing an exact match, then ignoring case.- Specified by:
findAttributeIgnoreCasein interfaceAttributeContainer
-
findAttributeDouble
Description copied from interface:AttributeContainerFind a Numeric Attribute by name (ignore case), return the double value of the Attribute.- Specified by:
findAttributeDoublein interfaceAttributeContainer- Returns:
- the attribute value, or defaultValue if not found
-
findAttributeInteger
Description copied from interface:AttributeContainerFind a Numeric Attribute by name (ignore case), return the integer value of the Attribute.- Specified by:
findAttributeIntegerin interfaceAttributeContainer- Returns:
- the attribute value, or defaultValue if not found
-
remove
Remove an Attribute : uses the attribute hashCode to find it.- Specified by:
removein interfaceAttributeContainer- Parameters:
a- remove this attribute- Returns:
- true if was found and removed
-
replace
Replace an Attribute with a different name, same value.- Parameters:
a- remove this attribute
-
removeAttribute
Remove an Attribute by name.- Specified by:
removeAttributein interfaceAttributeContainer- Parameters:
attName- if exists, remove this attribute- Returns:
- true if was found and removed
-
removeAttributeIgnoreCase
Remove an Attribute by name, ignoring case- Specified by:
removeAttributeIgnoreCasein interfaceAttributeContainer- Parameters:
attName- if exists, remove this attribute- Returns:
- true if was found and removed
-
toImmutable
Turn into an immutable AttributeContainer -
isEmpty
public boolean isEmpty()Description copied from interface:AttributeContainerTrue is there are no attributes in the container.- Specified by:
isEmptyin interfaceAttributeContainer
-