org.opensourcephysics.cabrillo.tracker
Class TTrack.StepArray

java.lang.Object
  extended by org.opensourcephysics.cabrillo.tracker.TTrack.StepArray
Enclosing class:
TTrack

protected class TTrack.StepArray
extends java.lang.Object


Field Summary
protected  Step[] array
           
protected  int delta
           
protected  int length
           
 
Constructor Summary
TTrack.StepArray()
          Constructs a default StepArray.
TTrack.StepArray(Step step)
          Constructs an autofill StepArray and fills the array with clones of the specified step.
TTrack.StepArray(Step step, int increment)
          Constructs an autofill StepArray and fills the array with clones of the specified step.
 
Method Summary
 boolean contains(Step step)
          Determines if this step array contains the specified step.
 Step getStep(int n)
          Gets the step at the specified index.
 boolean isAutofill()
           
 boolean isEmpty()
          Determines if this is empty.
 boolean isPreceded(int n)
          Determines if the specified step is preceded by a lower index step.
 void setLength(int len)
          Sets the length of the array.
 void setStep(int n, Step step)
          Sets the step at the specified index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

length

protected int length

array

protected Step[] array

delta

protected int delta
Constructor Detail

TTrack.StepArray

public TTrack.StepArray()
Constructs a default StepArray.


TTrack.StepArray

public TTrack.StepArray(Step step)
Constructs an autofill StepArray and fills the array with clones of the specified step.

Parameters:
step - the step to fill the array with

TTrack.StepArray

public TTrack.StepArray(Step step,
                        int increment)
Constructs an autofill StepArray and fills the array with clones of the specified step.

Parameters:
step - the step to fill the array with
increment - the array sizing increment
Method Detail

getStep

public Step getStep(int n)
Gets the step at the specified index. May return null.

Parameters:
n - the array index
Returns:
the step

setStep

public void setStep(int n,
                    Step step)
Sets the step at the specified index. Accepts a null step argument for non-autofill arrays.

Parameters:
n - the array index
step - the new step

contains

public boolean contains(Step step)
Determines if this step array contains the specified step.

Parameters:
step - the new step
Returns:
true if this contains the step

setLength

public void setLength(int len)
Sets the length of the array.

Parameters:
len - the new length of the array

isEmpty

public boolean isEmpty()
Determines if this is empty.

Returns:
true if empty

isPreceded

public boolean isPreceded(int n)
Determines if the specified step is preceded by a lower index step.

Parameters:
n - the step index
Returns:
true if the step is preceded

isAutofill

public boolean isAutofill()