public final class TractCollection
extends java.lang.Object
Tract
objects.
Tract
objects.
Bounds checking is performed as Tract
's are added, and the capacity of the
TractCollection
will increase as necessary.
Tract
Constructor and Description |
---|
TractCollection()
Default constructor.
|
TractCollection(int initialCapacity,
double growFactor)
Construct a TractCollection with a specified capacity and growth factor.
|
Modifier and Type | Method and Description |
---|---|
void |
addTract(Tract t)
Adds a tract to this collection.
|
void |
addTractCollection(TractCollection tc)
Adds all tracts from another
TractCollection to this TractCollection . |
Tract |
getTract(int n)
Get a Tract.
|
int |
numberOfTracts() |
static TractCollection |
removeShortTracts(TractCollection original,
int threshold)
Remove small Tracts from a collection.
|
void |
replaceTract(Tract t,
int n)
Replace a Tract in this collection.
|
java.lang.String |
toString() |
int |
totalPoints() |
void |
writeRawTracts(java.io.DataOutputStream dout)
Writes tracts so that they can be read later with
readTracts . |
public TractCollection()
Tract
's, grow factor is 100%.public TractCollection(int initialCapacity, double growFactor)
initialCapacity
- the initial number of Tract
's the collection can hold.growFactor
- the percentage to increase capacity by when this
TractCollection
is full.public int numberOfTracts()
public int totalPoints()
public void addTract(Tract t)
public void addTractCollection(TractCollection tc)
TractCollection
to this TractCollection
.public java.lang.String toString()
toString
in class java.lang.Object
Class name
Total Number Of Points
Number of Tracts
#print()
public Tract getTract(int n)
n
- the Tract index.public void replaceTract(Tract t, int n)
t
- the Tract to be inserted into this collection.n
- the index of the Tract to be replaced.public static TractCollection removeShortTracts(TractCollection original, int threshold)
Tract
containing one point
to be returned. This method removes Tracts below a specified length from the collection.original
- the TractCollection to be optimised.threshold
- the minimum number of points that a Tract may contain.threshold
.public void writeRawTracts(java.io.DataOutputStream dout) throws java.io.IOException
readTracts
.java.io.IOException