maspack.interpolation
Class Interpolation

java.lang.Object
  extended by maspack.interpolation.Interpolation
All Implemented Interfaces:
Scannable

public class Interpolation
extends java.lang.Object
implements Scannable

Describes how a numeric list should be interpolated.


Nested Class Summary
static class Interpolation.Order
          Order of the interpolation.
 
Constructor Summary
Interpolation()
          Creates a new Interpolation with LINEAR interpolation and no extension of end data.
Interpolation(Interpolation.Order order, boolean extendEnd)
          Creates a new Interpolation with a specified order and data extension policy.
Interpolation(Interpolation interp)
          Creates a new Interpolation which is a copy of an existing one.
 
Method Summary
 Interpolation.Order getOrder()
          Returns the interpolation order for this list.
 boolean isDataExtended()
          Returns true if the extension of data values beyond the last knot point is enabled.
 boolean isWritable()
          Returns true if this component should in fact be written to secondary storage.
 void scan(ReaderTokenizer rtok, java.lang.Object ref)
          Scans this element from a ReaderTokenizer.
 void set(Interpolation interp)
          Sets this interpolation to the value of another interpolation.
 void setDataExtended(boolean enable)
          Enables the extension of data values beyond the last knot point.
 void setOrder(Interpolation.Order order)
          Sets the interpolation order.
 java.lang.String toString()
           
 void write(java.io.PrintWriter pw, NumberFormat fmt, java.lang.Object ref)
          Writes a text description of this element to a PrintWriter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Interpolation

public Interpolation()
Creates a new Interpolation with LINEAR interpolation and no extension of end data.


Interpolation

public Interpolation(Interpolation interp)
Creates a new Interpolation which is a copy of an existing one.

Parameters:
interp - interpolation to copy

Interpolation

public Interpolation(Interpolation.Order order,
                     boolean extendEnd)
Creates a new Interpolation with a specified order and data extension policy.

Parameters:
order - order to the interpolation
extendEnd - if true, causes data to be extended past the last knot point
Method Detail

set

public void set(Interpolation interp)
Sets this interpolation to the value of another interpolation.

Parameters:
interp - interpolation to copy

setOrder

public void setOrder(Interpolation.Order order)
Sets the interpolation order. The default is Linear.

Parameters:
order - interpolation order

getOrder

public Interpolation.Order getOrder()
Returns the interpolation order for this list.

Returns:
interpolation order
See Also:
setOrder(maspack.interpolation.Interpolation.Order)

setDataExtended

public void setDataExtended(boolean enable)
Enables the extension of data values beyond the last knot point. If enabled, values beyond the last knot point are set to those of the last knot point. Otherwise, these values are set to zero.

Parameters:
enable - if true, enables extension of data values.

isDataExtended

public boolean isDataExtended()
Returns true if the extension of data values beyond the last knot point is enabled. See setDataExtended for details.

Returns:
true if the extension of data values is enabled.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isWritable

public boolean isWritable()
Returns true if this component should in fact be written to secondary storage. This gives subclasses control over whether or not they are actually written out.

Specified by:
isWritable in interface Scannable
Returns:
true if this component should be written to secondary storage.

write

public void write(java.io.PrintWriter pw,
                  NumberFormat fmt,
                  java.lang.Object ref)
           throws java.io.IOException
Writes a text description of this element to a PrintWriter. The text description should be compatable with scan and complete enough to allow full reconstruction of the element.

Specified by:
write in interface Scannable
Parameters:
pw - stream for writing the element
fmt - numeric formating information
ref - optional reference object which can be used for producing references to other objects
Throws:
java.io.IOException - if an I/O error occured

scan

public void scan(ReaderTokenizer rtok,
                 java.lang.Object ref)
          throws java.io.IOException
Scans this element from a ReaderTokenizer. The expected text format is assumed to be compatible with that produced by write.

Specified by:
scan in interface Scannable
Parameters:
rtok - Tokenizer from which to scan the element
ref - optional reference object which can be used for resolving references to other objects
Throws:
java.io.IOException - if an I/O or formatting error occured