Class Observation
java.lang.Object
jwat.Observation
- All Implemented Interfaces:
Comparable<Object>
This class represents a single observation retrieved from a log file. Every element is a double number
that represents either the true value or the converted value representing a string, date or other types.
- Author:
- Brambilla Davide matr 667986, Fumagalli Claudio 667971
-
Constructor Summary
ConstructorsConstructorDescriptionObservation(double[] obsList, int ID) Constructor, creates an instance of observation which contains the values passed through obsList double list. -
Method Summary
Modifier and TypeMethodDescriptionintComparable interface method overridden, to allow to sort observations according to sortIndex valueintgetID()doublegetIndex(int Index) Return to Ith element stored in the observation instanceintgetSize()Returns the size ( number of elements ) of the observationbooleanisValid()GettervoidsetID(int ID) voidsetIndex(int Index, double val) Stores the val value passed in the Index-th element of the instancevoidsetSorter(int Index) Sets up element on which perform compareTo methodvoidsetValid(boolean b) Sets the validity of the observation.toString()
-
Constructor Details
-
Observation
public Observation(double[] obsList, int ID) Constructor, creates an instance of observation which contains the values passed through obsList double list.- Parameters:
obsList- Elements of observation
-
-
Method Details
-
getID
public int getID() -
setID
public void setID(int ID) -
compareTo
Comparable interface method overridden, to allow to sort observations according to sortIndex value- Specified by:
compareToin interfaceComparable<Object>- Parameters:
obj- element to compare to this instance- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
getIndex
Return to Ith element stored in the observation instance- Parameters:
Index- element position- Returns:
- Ith element
- Throws:
ArrayIndexOutOfBoundsException- Index out of the range allowed
-
setIndex
Stores the val value passed in the Index-th element of the instance- Parameters:
Index- element positionval- value to store- Throws:
ArrayIndexOutOfBoundsException- Index out of the range allowed
-
getSize
public int getSize()Returns the size ( number of elements ) of the observation- Returns:
- Size of the observation
-
setSorter
Sets up element on which perform compareTo method- Parameters:
Index- index of element- Throws:
ArrayIndexOutOfBoundsException- if the operation cannot be completed
-
toString
-
setValid
public void setValid(boolean b) Sets the validity of the observation. This method is used to apply sampling operation without the loss of the original observation and to sync on these values all variables- Parameters:
b- validity value
-
isValid
public boolean isValid()Getter- Returns:
- validity of the observation
-