Class BasicArray

    • Constructor Detail

      • BasicArray

        BasicArray()
      • BasicArray

        BasicArray​(List<Value> values)
      • BasicArray

        BasicArray​(Value[] values)
    • Method Detail

      • indexFrom

        protected final int indexFrom​(CharSequence name)
      • isValidIndex

        protected final boolean isValidIndex​(int index)
      • size

        public int size()
        Description copied from interface: Array
        Return the number of name-value fields in this object.
        Specified by:
        size in interface Array
        Returns:
        the number of name-value fields; never negative
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: Array
        Return whether this document contains no fields and is therefore empty.
        Specified by:
        isEmpty in interface Array
        Returns:
        true if there are no fields in this document, or false if there is at least one.
      • remove

        public Value remove​(int index)
        Description copied from interface: Array
        Remove the specified entry from this array
        Specified by:
        remove in interface Array
        Parameters:
        index - the index
        Returns:
        the value in the removed entry, or null if there is no such entry
      • removeAll

        public Array removeAll()
        Description copied from interface: Array
        Remove all entries from this array.
        Specified by:
        removeAll in interface Array
        Returns:
        this array to allow for chaining methods
      • has

        public boolean has​(int index)
        Description copied from interface: Array
        Determine if this contains an entry at the given index.
        Specified by:
        has in interface Array
        Parameters:
        index - the index
        Returns:
        true if the entry exists, or false otherwise
      • get

        public Value get​(int index)
        Description copied from interface: Array
        Gets the value in this array at the given index.
        Specified by:
        get in interface Array
        Parameters:
        index - the index
        Returns:
        The field value, if found, or null otherwise
      • setValue

        public Array setValue​(int index,
                              Value value)
        Description copied from interface: Array
        Set the value for the field with the given name to be a value.
        Specified by:
        setValue in interface Array
        Parameters:
        index - the index of the field; must be greater than or equal to 0 and less than or equal to size
        value - the new value
        Returns:
        this array to allow for chaining methods
      • expand

        public Array expand​(int desiredSize,
                            Value value)
        Description copied from interface: Array
        If the current size of the array is smaller than the given size, expand it and use the supplied value for all new entries. This method does nothing if the current size is larger than the supplied desiredSize.
        Specified by:
        expand in interface Array
        Parameters:
        desiredSize - the desired size of the array; may be negative
        value - the new value for any new entries
        Returns:
        this array to allow for chaining methods
      • increment

        public Array increment​(int index,
                               Value increment)
        Description copied from interface: Array
        Increment the numeric value at the given location by the designated amount.
        Specified by:
        increment in interface Array
        Parameters:
        index - the index of the field; must be greater than or equal to 0 and less than or equal to size
        increment - the amount to increment the existing value; may be negative to decrement
        Returns:
        this array to allow for chaining methods
      • add

        public Array add​(Value value)
        Description copied from interface: Array
        Adds the value to the end of this array.
        Specified by:
        add in interface Array
        Parameters:
        value - the value; may not be null
        Returns:
        this array to allow for chaining methods
      • clone

        public Array clone()
        Description copied from interface: Array
        Obtain a complete copy of this array.
        Specified by:
        clone in interface Array
        Overrides:
        clone in class Object
        Returns:
        the clone of this array; never null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object