Package ucar.ma2
Class Section.Builder
- java.lang.Object
-
- ucar.ma2.Section.Builder
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Section.BuilderappendRange(int size)Append a new Range(0,size-1)Section.BuilderappendRange(int first, int last)Append a new Range(first, last) to the SectionSection.BuilderappendRange(int first, int last, int stride)Append a new Range(first,last,stride) to the Section.Section.BuilderappendRange(String name, int first, int last, int stride)Append a new Range(name,first,last,stride) to the SectionSection.BuilderappendRange(Range range)Append a Range to the SectionSection.BuilderappendRangeAll()Append a Range to the Section meaning "all"Section.BuilderappendRanges(int[] shape)Create Section from a shape array, assumes 0 origin.Section.BuilderappendRanges(List<Range> ranges)Append Ranges to the SectionSectionbuild()Section.BuilderinsertRange(int index, Range r)Insert a range at the specified index in the list.Section.BuilderremoveFirst(int n)Remove the first n Ranges, n <= number of ranges.Section.BuilderremoveLast()Remove the last range, if it exists.Section.BuilderremoveRange(int index)Remove a range at the specified index in the list.Section.BuilderremoveVlen()Remove the last range, if it exists and is a Vlen.Section.BuilderreplaceRange(int index, Range r)Replace a range at the specified index in the list.Section.BuildersetRange(int index, Range r)Set the range at the specified index in the list, previous Range is discarded
-
-
-
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 indexlast- last index, inclusive. If last < 0, then append a VLEN Range.- Throws:
InvalidRangeException
-
appendRange
public Section.Builder appendRange(int first, int last, int stride) throws InvalidRangeException
Append a new Range(first,last,stride) to the Section.- Parameters:
first- starting indexlast- last index, inclusivestride- stride- 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 Rangefirst- starting indexlast- last index, inclusivestride- 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 oner- 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.
-
build
public Section build()
-
-