Package ucar.nc2

Class AttributeContainerMutable

    • Constructor Detail

      • AttributeContainerMutable

        public AttributeContainerMutable​(@Nullable
                                         String name)
        Constructor with container name.
      • AttributeContainerMutable

        public AttributeContainerMutable​(@Nullable
                                         String name,
                                         Iterable<Attribute> from)
        Constructor with container name and list of Attributes to copy in.
    • Method Detail

      • addAttribute

        public Attribute addAttribute​(Attribute att)
        Add an attribute to the container. If an attrribute of the same name already exists, replace it with this one.
        Returns:
        the added attribute.
      • addAttribute

        public Attribute addAttribute​(String name,
                                      String value)
        Add Attribute; name and value must not be null.
      • addAttribute

        public Attribute addAttribute​(String name,
                                      Number value)
        Add Attribute; name and value must not be null.
      • addAll

        public void addAll​(Iterable<Attribute> atts)
        Add all; replace old if has same name.
      • findAttributeString

        public String findAttributeString​(String attName,
                                          String defaultValue)
        Description copied from interface: AttributeContainer
        Find a String Attribute by name (ignore case), return the String value of the Attribute.
        Specified by:
        findAttributeString in interface AttributeContainer
        Returns:
        the attribute value, or defaultValue if not found
      • findAttributeDouble

        public double findAttributeDouble​(String attName,
                                          double defaultValue)
        Description copied from interface: AttributeContainer
        Find a Numeric Attribute by name (ignore case), return the double value of the Attribute. Must be numeric or a string that parses as an Integer.
        Specified by:
        findAttributeDouble in interface AttributeContainer
        Returns:
        the attribute value, or defaultValue if not found
      • findAttributeInteger

        public int findAttributeInteger​(String attName,
                                        int defaultValue)
        Description copied from interface: AttributeContainer
        Find a Numeric Attribute by name (ignore case), return the integer value of the Attribute. Must be numeric or a string that parses as an Integer.
        Specified by:
        findAttributeInteger in interface AttributeContainer
        Returns:
        the attribute value, or defaultValue if not found
      • remove

        public boolean remove​(Attribute a)
        Remove an Attribute : uses the attribute hashCode to find it.
        Parameters:
        a - remove this attribute
        Returns:
        true if was found and removed
      • replace

        public boolean replace​(Attribute a,
                               String newName)
        Replace an Attribute with a different name, same value.
        Parameters:
        a - remove this attribute
        Returns:
        true if old attribute exists.
      • removeAttribute

        public boolean removeAttribute​(String attName)
        Remove an Attribute by name.
        Parameters:
        attName - if exists, remove this attribute
        Returns:
        true if was found and removed
      • removeAttributeIgnoreCase

        public boolean removeAttributeIgnoreCase​(String attName)
        Remove an Attribute by name, ignoring case
        Parameters:
        attName - if exists, remove this attribute
        Returns:
        true if was found and removed
      • toImmutable

        public AttributeContainer toImmutable()
        Turn into an immutable AttributeContainer