JNISpice
version 2.0.0

spice.basic
Class SpiceWindow

java.lang.Object
  extended by spice.basic.SpiceWindow

public class SpiceWindow
extends java.lang.Object

Class SpiceWindow represents unions of disjoint intervals on the real line. SpiceWindows are frequently used to represent time periods, for example periods when a specified geometric condition occurs.

SpiceWindows are used in JNISpice where the abstract data type Window is used in SPICELIB, or where the SpiceCell structure is used to represent windows in CSPICE.

Each SpiceWindow instance contains a one-dimensional array of interval endpoints; the endpoints are arranged in increasing order. Unlike windows in SPICELIB and CSPICE, SpiceWindow objects don't have separate cardinality and size values: all of the elements of the array of endpoints are considered to be valid data.

Version 1.0.1 20-DEC-2016 (NJB)

Updated class description and constructor documentation.

Version 1.0.0 02-JAN-2010 (NJB)


Constructor Summary
SpiceWindow()
          Default constructor.
SpiceWindow(double[] endpoints)
          Construct a SpiceWindow from a one-dimensional array of double precision endpoints.
SpiceWindow(double[][] intervals)
          Construct a SpiceWindow from an array of double precision endpoint intervals.
SpiceWindow(SpiceWindow s)
          Copy constructor.
 
Method Summary
 int card()
          Get the cardinality (number of intervals) of a SpiceWindow.
 SpiceWindow complement(double left, double right)
          Complement a SpiceWindow with respect to a specified interval.
 void contract(double left, double right)
          Contract a SpiceWindow using specified inset values.
 void expand(double left, double right)
          Expand a SpiceWindow using specified inset values.
 void fill(double small)
          Fill in gaps shorter than a specified in from a SpiceWindow.
 void filter(double small)
          Filter intervals shorter than a specified length from a SpiceWindow.
 double[] getInterval(int index)
          Fetch an interval, specified by index, from a SpiceWindow.
 double getMeasure()
          Get the measure of this SpiceWindow.
 SpiceWindow insert(double left, double right)
          Insert an interval into a SpiceWindow.
 SpiceWindow intersect(SpiceWindow b)
          Compute the intersection of two SpiceWindows.
 SpiceWindow sub(SpiceWindow b)
          Compute the difference of two SpiceWindows: subtract a specified SpiceWindow from another.
 double[] toArray()
          Get an array of endpoints from a SpiceWindow.
 java.lang.String toString()
          Override Object's toString method.
 SpiceWindow union(SpiceWindow b)
          Compute the union of two SpiceWindows.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SpiceWindow

public SpiceWindow()
Default constructor.


SpiceWindow

public SpiceWindow(SpiceWindow s)
Copy constructor. This creates a deep copy.


SpiceWindow

public SpiceWindow(double[] endpoints)
            throws SpiceErrorException
Construct a SpiceWindow from a one-dimensional array of double precision endpoints.

All of the elements of the array are considered to be valid data. The cardinality of the SpiceWindow is one half of the array length.

Throws:
SpiceErrorException

SpiceWindow

public SpiceWindow(double[][] intervals)
            throws SpiceErrorException
Construct a SpiceWindow from an array of double precision endpoint intervals.

All of the elements of the array are considered to be valid data. The cardinality of the SpiceWindow is the length of the array `intervals'.

Throws:
SpiceErrorException
Method Detail

card

public int card()
Get the cardinality (number of intervals) of a SpiceWindow.


toArray

public double[] toArray()
Get an array of endpoints from a SpiceWindow.


getInterval

public double[] getInterval(int index)
                     throws SpiceErrorException
Fetch an interval, specified by index, from a SpiceWindow.

Throws:
SpiceErrorException

union

public SpiceWindow union(SpiceWindow b)
                  throws SpiceErrorException
Compute the union of two SpiceWindows.

Throws:
SpiceErrorException

intersect

public SpiceWindow intersect(SpiceWindow b)
                      throws SpiceErrorException
Compute the intersection of two SpiceWindows.

Throws:
SpiceErrorException

sub

public SpiceWindow sub(SpiceWindow b)
                throws SpiceErrorException
Compute the difference of two SpiceWindows: subtract a specified SpiceWindow from another.

Throws:
SpiceErrorException

insert

public SpiceWindow insert(double left,
                          double right)
                   throws SpiceErrorException
Insert an interval into a SpiceWindow.

Unlike windows in SPICELIB and CSPICE, SpiceWindows don't need to contain empty space to accommodate inserted intervals; in fact they don't contain empty space at all. The data array of a SpiceWindow is re-allocated as necessary to accommodate insertions. Thus the following code fragment is valid:

   SpiceWindow w = new SpiceWindow();

   w.insert( 1.0, 2.0 );
   

This method updates the SpiceWindow's endpoint array and returns a reference to the window.

Throws:
SpiceErrorException

complement

public SpiceWindow complement(double left,
                              double right)
                       throws SpiceErrorException
Complement a SpiceWindow with respect to a specified interval.

Throws:
SpiceErrorException

contract

public void contract(double left,
                     double right)
              throws SpiceErrorException
Contract a SpiceWindow using specified inset values.

Throws:
SpiceErrorException

expand

public void expand(double left,
                   double right)
            throws SpiceErrorException
Expand a SpiceWindow using specified inset values.

Throws:
SpiceErrorException

fill

public void fill(double small)
          throws SpiceErrorException
Fill in gaps shorter than a specified in from a SpiceWindow.

Throws:
SpiceErrorException

filter

public void filter(double small)
            throws SpiceErrorException
Filter intervals shorter than a specified length from a SpiceWindow.

Throws:
SpiceErrorException

getMeasure

public double getMeasure()
Get the measure of this SpiceWindow.


toString

public java.lang.String toString()
Override Object's toString method.

Overrides:
toString in class java.lang.Object

JNISpice
version 2.0.0

JNISpice Alpha Test Version 2.0.0 28-JAN-2017 (NJB)