Package geomss.geom

Interface LinearCombination<T extends LinearCombination,​E extends GeomElement>

  • Type Parameters:
    T - The type of this LinearCombination.
    E - The type of elements contained in this LinearCombination.
    All Superinterfaces:
    java.lang.Cloneable, java.util.Collection<E>, java.lang.Comparable, GeomElement<T>, GeometryList<T,​E>, java.lang.Iterable<E>, java.util.List<E>, java.io.Serializable, Transformable<T>, javolution.xml.XMLSerializable
    All Known Implementing Classes:
    LinearComboCurve

    public interface LinearCombination<T extends LinearCombination,​E extends GeomElement>
    extends GeometryList<T,​E>
    Represents a linear combination made up of a list of two or more GeomElement objects. A linear combination is formed by a weighted linear addition of a list of one or more objects. For example: B = W1*Obj_1 + ... + Wn*Obj_n where W1 through Wn are scalar weights. The linear addition is done independently of physical dimension (each dimension is added separately) and the weighted addition is done in parameter space in appropriate: B = W1*Srf_1(s,t) + ... + Wn*Srf_n(s,t).

    Modified by: Joseph A. Huwaldt

    Version:
    February 17, 2025
    Author:
    Joseph A. Huwaldt, Date: September 10, 2015
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void add​(int index, E value, java.lang.Double weight)
      Inserts the specified GeomElement at the specified position in this list.
      boolean add​(E value, java.lang.Double weight)
      Appends the specified GeomElement to the end of this list.
      boolean addAll​(int index, java.util.Collection<? extends E> elements, java.util.Collection<java.lang.Double> weights)
      Inserts all of the GeomElement objects in the specified collection and their associated weights into this linear combination at the specified position.
      boolean addAll​(java.util.Collection<? extends E> elements, java.util.Collection<java.lang.Double> weights)
      Appends all of the GeomElement objects in the specified collection to this list.
      java.lang.Double getFirstWeight()
      Returns the first linear combination weight from this list.
      java.lang.Double getLastWeight()
      Returns the last linear combination weight from this list.
      java.lang.Double getWeight​(int index)
      Returns the linear combination weight at the specified position in this list.
      java.util.List<java.lang.Double> getWeightRange​(int first, int last)
      Returns the range of linear combination weights in this list from the specified start and ending indexes as a List of double values.
      E set​(int index, E curve, java.lang.Double weight)
      Replaces the GeomElement and weight at the specified position in this linear combination with the specified GeomElement and weight.
      java.lang.Double setWeight​(int index, java.lang.Double weight)
      Replaces the weight at the specified position in this linear combination list with the specified weight.
      java.util.List<java.lang.Double> unmodifiableWeightList()
      Returns an unmodifiable list view of the list of weights in this linear combination.
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Comparable

        compareTo
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
    • Method Detail

      • unmodifiableWeightList

        java.util.List<java.lang.Double> unmodifiableWeightList()
        Returns an unmodifiable list view of the list of weights in this linear combination. Attempts to modify the returned collection result in an UnsupportedOperationException being thrown.
        Returns:
        the unmodifiable view over this list of weights.
      • getWeight

        java.lang.Double getWeight​(int index)
        Returns the linear combination weight at the specified position in this list.
        Parameters:
        index - index of weight to return (0 returns the 1st element, -1 returns the last, -2 returns the 2nd from last, etc).
        Returns:
        the linear combination weight at the specified position in this linear combination.
        Throws:
        java.lang.IndexOutOfBoundsException - if the given index is out of range: index > size()
      • getFirstWeight

        java.lang.Double getFirstWeight()
        Returns the first linear combination weight from this list.
        Returns:
        the first weight in this list.
      • getLastWeight

        java.lang.Double getLastWeight()
        Returns the last linear combination weight from this list.
        Returns:
        the last weight in this list.
      • getWeightRange

        java.util.List<java.lang.Double> getWeightRange​(int first,
                                                        int last)
        Returns the range of linear combination weights in this list from the specified start and ending indexes as a List of double values.
        Parameters:
        first - index of the first element to return (0 returns the 1st element, -1 returns the last, etc).
        last - index of the last element to return (0 returns the 1st element, -1 returns the last, etc).
        Returns:
        A List made up of the weights in the given range from this LinearComboCurve.
        Throws:
        java.lang.IndexOutOfBoundsException - if the given index is out of range: index ≥ size()
      • add

        void add​(int index,
                 E value,
                 java.lang.Double weight)
        Inserts the specified GeomElement at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices). Null values are ignored.

        Note: If this method is used concurrent access must be synchronized (the table is not thread-safe).

        Parameters:
        index - the index at which the specified element is to be inserted. (0 returns the 1st element, -1 returns the last, -2 returns the 2nd from last, etc).
        value - the element to be inserted. May not be null.
        weight - the linear combination weight of the element to be inserted. May not be null.
        Throws:
        java.lang.IndexOutOfBoundsException - if index > size()
      • add

        boolean add​(E value,
                    java.lang.Double weight)
        Appends the specified GeomElement to the end of this list. Null values are ignored.

        Note: If this method is used concurrent access must be synchronized (the table is not thread-safe).

        Parameters:
        value - the element to be appended to this list. May not be null.
        weight - the linear combination weight of the element to be appended. May not be null.
        Returns:
        true if this list changed as a result of this call.
        Throws:
        DimensionException - if the input element's dimensions are different from this list's dimensions.
      • addAll

        boolean addAll​(java.util.Collection<? extends E> elements,
                       java.util.Collection<java.lang.Double> weights)
        Appends all of the GeomElement objects in the specified collection to this list. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this collection, and this collection is nonempty.)
        Parameters:
        elements - the elements to be appended onto this list. May not be null.
        weights - the linear combination weights associated with all of the elements being appended. May not be null.
        Returns:
        true if this LinearComboCurve changed as a result of the call
      • addAll

        boolean addAll​(int index,
                       java.util.Collection<? extends E> elements,
                       java.util.Collection<java.lang.Double> weights)
        Inserts all of the GeomElement objects in the specified collection and their associated weights into this linear combination at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is unspecified if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)
        Parameters:
        index - index at which to insert first element from the specified collection.
        elements - the elements to be inserted into this linear combination. May not be null.
        weights - the linear combination weights associated with each element being inserted. May not be null.
        Returns:
        true if this LinearComboCurve changed as a result of the call
      • setWeight

        java.lang.Double setWeight​(int index,
                                   java.lang.Double weight)
        Replaces the weight at the specified position in this linear combination list with the specified weight. The GeomElement at that position is left unchanged. Null elements are ignored.
        Parameters:
        index - The index of the weight to replace (0 returns the 1st element, -1 returns the last, -2 returns the 2nd from last, etc).
        weight - The weight to be stored at the specified position. The GeomElement at that position is left unchanged. May not be null.
        Returns:
        The weight previously at the specified position in this list.
        Throws:
        java.lang.IndexOutOfBoundsException - - if index > size()
      • set

        E set​(int index,
              E curve,
              java.lang.Double weight)
        Replaces the GeomElement and weight at the specified position in this linear combination with the specified GeomElement and weight. Null elements are ignored.
        Parameters:
        index - The index of the element and weight to replace (0 returns the 1st element, -1 returns the last, -2 returns the 2nd from last, etc).
        curve - The GeomElement to be stored at the specified position. null elements are ignored.
        weight - The weight to be stored at the specified position. May not be null.
        Returns:
        The GeomElement previously at the specified position in this list. The previous weight is lost.
        Throws:
        java.lang.IndexOutOfBoundsException - - if index > size()