org.freeplane.plugin.script.proxy

## Interface Proxy.AttributesRO

- All Known Subinterfaces:
    Proxy.Attributes
  Enclosing interface:
    Proxy

      public static interface Proxy.AttributesRO

  Node's attribute table: `node.attributes` - read-only.

  Attributes are name - value pairs assigned to a node. A node may have multiple attributes with the same name.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `containsKey(java.lang.String name)` returns true if there is any attribute with key name.
    `int` | `findAttribute(java.lang.String name)` Deprecated. since 1.2 - use `findFirst(String)` instead.
    `int` | `findFirst(java.lang.String name)` returns the index of the first attribute with the given name if one exists or -1 otherwise.
    `java.util.List<? extends Convertible>` | `findValues(groovy.lang.Closure<java.lang.Boolean> closure)` returns the values of all attributes for which the closure returns true.
    `java.lang.Object` | `get(int index)` returns the attribute value at the given index.
    `java.lang.Object` | `get(java.lang.String name)` Deprecated. before 1.1 - use `get(int)`, `getFirst(String)` or `getAll(String)` instead.
    `java.util.List<java.lang.Object>` | `getAll(java.lang.String name)` returns all values for the attribute name.
    `java.util.List<java.lang.String>` | `getAttributeNames()` Deprecated. since 1.2 use #getNames() instead.
    `java.lang.Object` | `getFirst(java.lang.String name)` returns the first value of an attribute with the given name or null otherwise.
    `java.lang.String` | `getKey(int index)` returns the attribute key at the given index.
    `java.util.Map<java.lang.String,java.lang.Object>` | `getMap()` returns all attributes as a map.
    `java.util.List<java.lang.String>` | `getNames()` returns all attribute names in the proper sequence.
    `java.util.List<? extends Convertible>` | `getValues()` returns all values as a list of `Convertible`.
    `boolean` | `isEmpty()` returns `getAttributeNames().isEmpty()`.
    `int` | `size()` the number of attributes.

- - ### Method Detail

    - #### get

          @Deprecated
          java.lang.Object get(java.lang.String name)

      Deprecated. before 1.1 - use `get(int)`, `getFirst(String)` or `getAll(String)` instead.
      alias for `getFirst(String)`.

    - #### getFirst

          java.lang.Object getFirst(java.lang.String name)

      returns the first value of an attribute with the given name or null otherwise.
      Since:
        1.2

    - #### containsKey

          boolean containsKey(java.lang.String name)

      returns true if there is any attribute with key name.
      Since:
        1.4

    - #### getAll

          java.util.List<java.lang.Object> getAll(java.lang.String name)

      returns all values for the attribute name.

    - #### getNames

          java.util.List<java.lang.String> getNames()

      returns all attribute names in the proper sequence. The number of names returned is equal to the number of attributes.

             // rename attribute
             int i = 0;
             for (String name : attributes.getNames()) {
                 if (name.equals("xy"))
                     attributes.set(i, "xyz", attributes.get(i));
                 ++i;
             }

    - #### getAttributeNames

          java.util.List<java.lang.String> getAttributeNames()

      Deprecated. since 1.2 use #getNames() instead.

    - #### getValues

          java.util.List<? extends Convertible> getValues()

      returns all values as a list of `Convertible`.
      Since:
        1.2

    - #### getMap

          java.util.Map<java.lang.String,java.lang.Object> getMap()

      returns all attributes as a map. Note that this will erase duplicate keys. `node.attributes = otherNode.attributes.map`
      Since:
        1.2

    - #### get

          java.lang.Object get(int index)

      returns the attribute value at the given index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if index is out of range, i. e. `index < 0 || index >= size()`.

    - #### getKey

          java.lang.String getKey(int index)

      returns the attribute key at the given index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if index is out of range, i. e. `index < 0 || index >= size()`.

    - #### findAttribute

          int findAttribute(java.lang.String name)

      Deprecated. since 1.2 - use `findFirst(String)` instead.

    - #### findFirst

          int findFirst(java.lang.String name)

      returns the index of the first attribute with the given name if one exists or -1 otherwise. For searches for all attributes with a given name `getAttributeNames()` must be used.
      Since:
        1.2

    - #### findValues

          java.util.List<? extends Convertible> findValues(groovy.lang.Closure<java.lang.Boolean> closure)

      returns the values of all attributes for which the closure returns true. The fact that the values are returned as a list of `Convertible` enables conversion. The following formula sums all attributes whose names are not equal to 'TOTAL':

            = attributes.findValues{key, val -> key != 'TOTAL'}.sum(0){it.num0}

      Parameters:
        `closure` - A closure that accepts two arguments (String key, Object value) and returns boolean/Boolean.
      Since:
        1.2

    - #### size

          int size()

      the number of attributes. It is `size() == getAttributeNames().size()`.

    - #### isEmpty

          boolean isEmpty()

      returns `getAttributeNames().isEmpty()`.
      Since:
        1.2