Package ucar.ma2

Class Section.Builder

  • Enclosing class:
    Section

    public static class Section.Builder
    extends Object
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • appendRangeAll

        public Section.Builder appendRangeAll()
        Append a Range to the Section meaning "all"
      • appendRange

        public Section.Builder appendRange​(Range range)
        Append a Range to the Section
        Parameters:
        range - not 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​(List<Range> ranges)
        Append Ranges to the Section
        Parameters:
        ranges - not null.
      • appendRanges

        public Section.Builder appendRanges​(int[] shape)
        Create Section from a shape array, assumes 0 origin.
        Parameters:
        shape - array of lengths for each Range. 0 = EMPTY, < 0 = VLEN
      • 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.