nl.tudelft.simulation.jstats.distributions.empirical
Class Observations

java.lang.Object
  extended by nl.tudelft.simulation.jstats.distributions.empirical.Observations
All Implemented Interfaces:
ObservationsInterface

public class Observations
extends Object
implements ObservationsInterface

The histogram specifies a histogram chart for the DSOL framework. (c) copyright 2004 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl/dsol
License of use: General Public License (GPL) , no warranty

Since:
1.2
Version:
$Revision: 1.1 $ $Date: 2007/01/06 13:25:44 $
Author:
Peter Jacobs

Nested Class Summary
 class Observations.Observation
          The Observation class holds one observation, cummulative probability entry.
 
Nested classes/interfaces inherited from interface nl.tudelft.simulation.jstats.distributions.empirical.ObservationsInterface
ObservationsInterface.Entry
 
Field Summary
 
Fields inherited from interface nl.tudelft.simulation.jstats.distributions.empirical.ObservationsInterface
CUMPROBABILITY, OBSERVATION
 
Constructor Summary
Observations(Number[] observations)
          constructs a new Observations
Observations(Number[][] observations, boolean cummulative)
          constructs a new Observations
Observations(SortedMap observations, boolean cummulative)
          constructs a new Observations
 
Method Summary
 boolean contains(Number object, byte type)
          returns whether the structure contains this specific object (either an observation or a probability).
 ObservationsInterface.Entry get(int index)
          Returns the element at the specified position in this structure.
 ObservationsInterface.Entry getCeilingEntry(Number object, byte type, boolean inclusive)
          Gets the entry corresponding to the specified key if inclusive; if not inclusive or such entry does not exists, returns the entry for the least key greater than the specified key; if no such entry exists (i.e., the greatest key in the Tree is less than the specified key), returns null.
 List getCumProbabilities()
          Returns the cummulative probabilities
 ObservationsInterface.Entry getEntry(Number object, byte type)
          Returns the entry to which the structure maps the specific object.
protected  int getIndex(Number object, byte type)
          returns the preceding index of the object
 int getIndex(ObservationsInterface.Entry entry)
          Returns the index of the entry of this structure.
 List getObservations()
          Returns the observations
 ObservationsInterface.Entry getPrecedingEntry(Number object, byte type, boolean inclusive)
          Gets the entry corresponding to the specified key if inclusive; if not inclusive or such entry does not exists, returns the entry for the greatest key less than the specified key; if no such entry exists (i.e., the least key in the Tree is greater than the specified key), returns null.
protected  int getPrecedingIndex(Number object, byte type)
          returns the preceding index of the object
 boolean isEmpty()
          Returns true if this structure contains no object-value mappings.
 boolean isGrouped()
          Returns true if this structure contains grouped empirical data.
 int size()
          Returns the number of observation-probability mappings in this structure.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Observations

public Observations(Number[] observations)
constructs a new Observations

Parameters:
observations - the observations

Observations

public Observations(SortedMap observations,
                    boolean cummulative)
constructs a new Observations

Parameters:
observations - a sortedMap of observations. The double values in the map either represent actual times of observation, or represent a probability
cummulative - are the probabilities in the map cummulative?

Observations

public Observations(Number[][] observations,
                    boolean cummulative)
constructs a new Observations

Parameters:
observations - a sortedMap of observations. The double values in the map either represent actual times of observation, or represent a probability
cummulative - are the probabilities in the map cummulative?
Method Detail

size

public int size()
Description copied from interface: ObservationsInterface
Returns the number of observation-probability mappings in this structure. If the structure contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Specified by:
size in interface ObservationsInterface
Returns:
the number of object-value mappings in this structure.
See Also:
ObservationsInterface.size()

isEmpty

public boolean isEmpty()
Description copied from interface: ObservationsInterface
Returns true if this structure contains no object-value mappings.

Specified by:
isEmpty in interface ObservationsInterface
Returns:
true if this structure contains no object-value mappings.
See Also:
ObservationsInterface.isEmpty()

isGrouped

public boolean isGrouped()
Description copied from interface: ObservationsInterface
Returns true if this structure contains grouped empirical data.

Specified by:
isGrouped in interface ObservationsInterface
Returns:
true if this structure contains grouped empirical data.
See Also:
ObservationsInterface.isGrouped()

getIndex

public int getIndex(ObservationsInterface.Entry entry)
Returns the index of the entry of this structure. Returns -1 if entry not in structure.

Specified by:
getIndex in interface ObservationsInterface
Parameters:
entry - the entry
Returns:
the index of this entry.

getCumProbabilities

public List getCumProbabilities()
Returns the cummulative probabilities

Specified by:
getCumProbabilities in interface ObservationsInterface
Returns:
the list of cummulative probabilities

getObservations

public List getObservations()
Returns the observations

Specified by:
getObservations in interface ObservationsInterface
Returns:
the list of observations

contains

public boolean contains(Number object,
                        byte type)
returns whether the structure contains this specific object (either an observation or a probability).

Specified by:
contains in interface ObservationsInterface
Parameters:
object - the object to look for
type - the type (either the ObservationsInterface.OBSERVATION or the ObservationsInterface.CUMPROBABILITY)
Returns:
true if object in observation.

getEntry

public ObservationsInterface.Entry getEntry(Number object,
                                            byte type)
Returns the entry to which the structure maps the specific object. Returns null if the structure contains no entry for the object. The object might either refer to an observation or to a probability. If multiple entries match the search, there is no garantuee which entry is returned.

Specified by:
getEntry in interface ObservationsInterface
Parameters:
object - entry whose associated entry is to be returned.
type - the type (either the ObservationsInterface.OBSERVATION or the ObservationsInterface.CUMPROBABILITY)
Returns:
the entries which comply.

getPrecedingEntry

public ObservationsInterface.Entry getPrecedingEntry(Number object,
                                                     byte type,
                                                     boolean inclusive)
Gets the entry corresponding to the specified key if inclusive; if not inclusive or such entry does not exists, returns the entry for the greatest key less than the specified key; if no such entry exists (i.e., the least key in the Tree is greater than the specified key), returns null. If multiple entries match the search, there is no garantuee which entry is returned.

Specified by:
getPrecedingEntry in interface ObservationsInterface
Parameters:
object - object whose next key associated value is to be returned.
type - the type (either the ObservationsInterface.OBSERVATION or the ObservationsInterface.CUMPROBABILITY)
inclusive - if inclusive and structure contains key key is returned
Returns:
the value to which this structure maps the specified key, or null if the structure contains no mapping for this key.

getCeilingEntry

public ObservationsInterface.Entry getCeilingEntry(Number object,
                                                   byte type,
                                                   boolean inclusive)
Gets the entry corresponding to the specified key if inclusive; if not inclusive or such entry does not exists, returns the entry for the least key greater than the specified key; if no such entry exists (i.e., the greatest key in the Tree is less than the specified key), returns null. If multiple entries match the search, there is no garantuee which entry is returned.

Specified by:
getCeilingEntry in interface ObservationsInterface
Parameters:
object - object whose associated value is to be returned.
type - the type (either the ObservationsInterface.OBSERVATION or the ObservationsInterface.CUMPROBABILITY)
inclusive - if inclusive and structure contains key key is returned
Returns:
the value to which this structure maps the specified key, or null if the structure contains no mapping for this key.

get

public ObservationsInterface.Entry get(int index)
Returns the element at the specified position in this structure.

Specified by:
get in interface ObservationsInterface
Parameters:
index - index of element to return.
Returns:
the entry at the specified position in this list.
Throws:
IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size()).

getIndex

protected int getIndex(Number object,
                       byte type)
returns the preceding index of the object

Parameters:
object - the object
type - the type
Returns:
the index.

getPrecedingIndex

protected int getPrecedingIndex(Number object,
                                byte type)
returns the preceding index of the object

Parameters:
object - the object
type - the type
Returns:
the index.

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2002-2011 Delft University of Technology, the Netherlands. All Rights Reserved.