Package ucar.array

Class Section.Builder

  • Enclosing class:
    Section

    public static class Section.Builder
    extends Object
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • appendRange

        public Section.Builder appendRange​(@Nullable
                                           Range range)
        Append a Range to the Section, may be null.
      • appendRange

        public Section.Builder appendRange​(int size)
        Append a new Range(0,size-1)
      • appendRange

        public Section.Builder appendRange​(int first,
                                           int last)
                                    throws InvalidRangeException
        Append a new Range(first, last) to the Section
        Parameters:
        first - starting index
        last - last index, inclusive. If last < 0, then append a VLEN Range.
        Throws:
        InvalidRangeException
      • appendRange

        public Section.Builder appendRange​(String name,
                                           int first,
                                           int last,
                                           int stride)
                                    throws InvalidRangeException
        Append a new Range(name,first,last,stride) to the Section
        Parameters:
        name - name of Range
        first - starting index
        last - last index, inclusive
        stride - stride
        Throws:
        InvalidRangeException
      • appendRanges

        public Section.Builder appendRanges​(int[] shape)
        Append Ranges to the Section, Range(shape[i]) for each i.
      • insertRange

        public Section.Builder insertRange​(int index,
                                           Range r)
        Insert a range at the specified index in the list.
        Parameters:
        index - insert here in the list, existing ranges at or after this index get shifted by one
        r - insert this Range
      • removeRange

        public Section.Builder removeRange​(int index)
        Remove a range at the specified index in the list.
        Parameters:
        index - remove here in the list, existing ranges after this index get shifted by one
      • replaceRange

        public Section.Builder replaceRange​(int index,
                                            Range r)
        Replace a range at the specified index in the list.
        Parameters:
        index - replace here in the list.
        r - use this Range
        Returns:
        this
        Throws:
        IndexOutOfBoundsException - if bad index
      • setRange

        public Section.Builder setRange​(int index,
                                        Range r)
        Set the range at the specified index in the list, previous Range is discarded
        Parameters:
        index - list index, must be in interval [0,size).
        r - insert this Range
      • removeLast

        public Section.Builder removeLast()
        Remove the last range, if it exists.
      • removeFirst

        public Section.Builder removeFirst​(int n)
        Remove the first n Ranges, n ≤ number of ranges.
      • removeVlen

        public Section.Builder removeVlen()
        Remove the last range, if it exists and is a Vlen.