|
|||||||||
PREV CLASS NEXT CLASS | All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjhplot.P0I
public class P0I
A container to hold data points in one dimension. All numbers are expected to be integers. It extends ArrayList and adds many new features for data manipulation. The class does not have graphical option (use H1D to show the data or methods of this class which transform P0I to a H1D histogram).
Constructor Summary | |
---|---|
P0I()
Construct an empty container with a title |
|
P0I(int[] d)
Construct P0I from an integer array. |
|
P0I(IntArrayList d)
Construct P0I from IntegerArrayList from cern.colt.list.IntegerArrayList; |
|
P0I(Integer[] d)
Construct P0I from array; |
|
P0I(String title)
Construct an empty container with a title |
|
P0I(String title,
boolean shallow,
P0I P0I)
Construct a copy from a P0I. |
|
P0I(String title,
int[] d)
Create P0I from an array. |
|
P0I(String title,
Integer[] d)
Construct P0I from integers. |
|
P0I(String title,
String sfile)
Construct a P0I from a file. |
Method Summary | |
---|---|
void |
add(int value)
Adds (appends) the specified element to the end of this list. |
void |
add(Integer value)
Adds (appends) the specified element to the end of this list. |
void |
clear()
Clear the container |
boolean |
contains(Integer d)
Returns true if value exists |
P0I |
copy()
Get a copy of the current holder |
P0I |
copy(String newtitle)
Create an exact copy of the current P0I. |
double |
correlation(P0I P0I)
Returns the correlation coefficient. |
double |
covariance(P0I P0I)
Returns the covariance |
void |
doc()
Show online documentation. |
void |
fill(int[] values)
Fill a P0I container from an array. |
void |
fill(Integer[] values)
Fill a P0I container from an array. |
void |
fill(int TotNumber,
Integer min,
Integer max)
Fill with a sequence of numbers between min and max. |
int |
find(Integer d)
Returns the index of first occurrence of the specified element |
P0I |
func(F1D f1d)
Transform P0I array to array with values given by a function. |
P0I |
func(String title,
F1D f1d)
Make transformation of P0I using a function. |
Integer |
get(int i)
Return a specific value at ith position. |
P0I |
get(int d,
String opi)
Get P0I with values below, above or equal a specified value. |
int[] |
getArray()
Get integer array with P0I values. |
double[] |
getArrayDouble()
Get a double array with P0I values. |
ArrayList<Integer> |
getArrayList()
Get data in form of ArrayList |
H1D |
getH1D(int bins)
Return H1D histogram with P0I content. |
H1D |
getH1D(int bins,
double min,
double max)
Return H1D histogram with P0I content. |
H1D |
getH1D(int bins,
Integer min,
Integer max)
Return H1D histogram with P0I content. |
IntArrayList |
getIntArrayList()
Get data in form of IntArrayList from cern.colt package |
DoubleArrayList |
getIntegerArrayList()
Get data in form of DoubleArrayList from cern.colt package |
Integer |
getMax()
Returns the maximum value. |
int |
getMaxIndex()
Returns index corresponding to maximum value. |
Integer |
getMin()
Returns the minimum value. |
int |
getMinIndex()
Returns index corresponding to minimum value. |
Map<String,Double> |
getStat()
Get complete statistics for this container. |
String |
getStatString()
Get string with all statistics |
String |
getStringValues()
Return all values as a string. |
Integer |
getSum()
Returns the sum of all values. |
String |
getTitle()
Get a new title |
double |
kurtosis()
Returns the kurtosis. |
double |
mean()
Returns the mean value. |
double |
median()
Returns the median. |
P0I |
merge(P0I a)
Merge two P0I containers |
double |
moment(int k,
Integer c)
Returns the moment of k-th order with value c, which is Sum( (x[i]-c)k ) / size(). |
P0I |
oper(P0I P0I,
String what)
Operations on P0I containers: add, subtract, multiply, divide. |
P0I |
oper(P0I P0I,
String title,
String what)
Operations on P0I containers: add, subtract, multiply, divide. |
P0I |
operScale(Integer scale)
Scale P0I with a factor scale. |
P0I |
operShift(Integer shift)
Shift all values in the array by a constant. |
P0I |
operShiftAndScale(Integer shift,
Integer scale)
Shift all values by a constant "shift", then scale it. |
void |
print()
Print a P0I container. |
void |
random(int TotNumber,
AbstractDistribution dist)
Fill array with random numbers |
void |
randomNormal(int TotNumber,
double mu,
double sigma)
Fill with random numbers distributed using the normal (gaussian) distribution. |
void |
randomUniform(int TotNumber,
Integer min,
Integer max)
Fill with with uniform random numbers between min and max. |
P0I |
range(int min,
int max)
Get range between min and max |
int |
read(BufferedReader br)
Read one dimensional data from uncompressed ASCII file. |
int |
read(File sfile)
Read P0D from a file. |
int |
read(String sfile)
Read PNI from a file. |
int |
read(URL url)
Read data from URL. |
int |
readBinary(String name)
Read a P0I from a binary file (big endian by default). |
int |
readGZip(File sfile)
Read PNI from a GZiped file. |
int |
readGZip(String sfile)
Read P0D from a GZiped file. |
P0I |
readSerialized(String name)
Read a P0I object from a serialized file |
int |
readZip(String sfile)
Read one dimensional data from ZIP ASCII file. |
void |
remove(int i)
Remove a value at the specified position. |
P0I |
reverse()
Reverse the order of elements |
int |
search(Integer value)
Search for the first occurrence of the given argument |
void |
set(int i,
Integer value)
Sets a value at the specified position. |
void |
setArray(int[] array)
Set an integer array. |
void |
setArray(Integer[] array)
Set a Integer array. |
void |
setArrayList(ArrayList<Integer> array)
Set the data in form of ArrayList |
void |
setTitle(String title)
Set a new title |
int |
size()
Return the P10 data length. |
double |
skew()
Returns the skew, which is moment(3,mean()) / standardDeviation() Run getStat(0 for evaluation |
P0I |
sort()
Sort into ascending order |
int[] |
sortIndex()
Return indexes of sorted array in increasing order. |
double |
standardError()
Returns the sample standard error, which is Math.sqrt(variance() / size()). |
double |
stddeviation()
Returns the standard deviation (square root of variance) |
void |
toFile(String name)
Write a P0I to an external file. |
String |
toString()
Get a P0I as a string. |
void |
toTable()
Print the P0I container to a Table in a separate Frame. |
void |
toTable(boolean format)
Print the P0I array to a Table in a separate Frame. |
double |
variance()
Returns the variance. |
void |
writeBinary(String name)
Write a P0I to a binary file (big endian by default). |
int |
writeSerialized(String name)
Write a P0I object to a serialized file |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public P0I(String title)
title
- New titlepublic P0I(IntArrayList d)
d
- IntegerArrayList frompublic P0I(Integer[] d)
d
- array (Integer)public P0I(String title, int[] d)
title
- titled
- input arraypublic P0I(int[] d)
d
- integer arraypublic P0I(String title, Integer[] d)
title
- title;d
- input arraypublic P0I(String title, boolean shallow, P0I P0I)
title
- new titleshallow
- if true, a shallow copy of a collection.P0I
- input data in form of P0Ipublic P0I()
public P0I(String title, String sfile)
title
- Title of the containersfile
- File name with input or URL with file location (must start as http or ftp)Method Detail |
---|
public void setTitle(String title)
title
- New Titlepublic String getTitle()
public int read(File sfile)
sfile
- input file
public int read(URL url)
url
- URL location of input filepublic int readGZip(String sfile)
Use a space to separate values in columns and new line to put new row.
sfile
- File name with input (extension .gz)
public int read(String sfile)
The old content will be lost. Use a space to separate values in columns and new line to put new row. Comment lines starting with "#" and "*" are ignored.
sfile
- File name with input
public int readGZip(File sfile)
sfile
- File name with input (extension .gz)
public int read(BufferedReader br)
sfile
- File name with input
public int readZip(String sfile)
sfile
- Zipped file name with input (file extension .zip)
public void toFile(String name)
name
- File name with outputpublic void writeBinary(String name)
name
- Binary file name for the output.public int writeSerialized(String name)
name
- serialized file name for output.
public P0I readSerialized(String name)
name
- serialized file name for input.
public int readBinary(String name)
name
- Binary file name for input.
public String toString()
toString
in class Object
public void randomNormal(int TotNumber, double mu, double sigma)
TotNumber
- total number of random valuesmu
- mean valuesigma
- Standard deviation of the random variable.public void fill(int TotNumber, Integer min, Integer max)
The step is evaluated as (max-min) / (TotNumber -1). For example, fill(11,0,10) will fill with 11 number: 0,1,2,3,4,5,6,7,8,9,10
TotNumber
- total number of values.min
- min valuemax
- max valuepublic void randomUniform(int TotNumber, Integer min, Integer max)
TotNumber
- of random valuesmin
- min random valuemax
- max random valuepublic void random(int TotNumber, AbstractDistribution dist)
TotNumber
- Total number in arraydist
- A custom random distributionpublic H1D getH1D(int bins)
bins
- Number of bins for the histogram.
public H1D getH1D(int bins, double min, double max)
bins
- Number of bins for the histogram.min
- Min value of histogrammax
- Max value of histogram
public H1D getH1D(int bins, Integer min, Integer max)
min
- Min value of histogrammax
- Max value of histogrambins
- Number of bins for the histogram.
public void print()
public P0I merge(P0I a)
a
- Container to be merged
public void add(Integer value)
value
- value to be added.public void add(int value)
value
- value to be added.public void fill(Integer[] values)
values
- array with Integer valuespublic void fill(int[] values)
values
- array with Integer valuespublic void set(int i, Integer value)
i
- positionvalue
- value to be insertedpublic void remove(int i)
i
- position of a value to be removedpublic int size()
public P0I copy()
public ArrayList<Integer> getArrayList()
public IntArrayList getIntArrayList()
public DoubleArrayList getIntegerArrayList()
public void setArrayList(ArrayList<Integer> array)
array
- ArrayList to be set.public void setArray(Integer[] array)
array
- array used to fill P0Ipublic void setArray(int[] array)
array
- array used to fill P0Ipublic P0I copy(String newtitle)
newtitle
- new titlepublic P0I get(int d, String opi)
d
- input valuesopi
- if "=", take equal values; public boolean contains(Integer d)
d
- Integer valuepublic int find(Integer d)
d
- input valuepublic int[] getArray()
public double[] getArrayDouble()
public Integer get(int i)
i
- index of the array
public int search(Integer value)
value
- value for searching
public Integer getMax()
public int getMaxIndex()
public int getMinIndex()
public Integer getMin()
public Integer getSum()
public P0I range(int min, int max)
min
- indexmax
- index
public P0I oper(P0I P0I, String what)
P0I
- Input P0I container for operationwhat
- String representing the operation: "+" add a P0I container to
the original; "-" subtract a P0I from the original; "*"
multiply; "/" divide by P0I
public P0I operScale(Integer scale)
scale
- Scale factor
public P0I operShift(Integer shift)
shift
- constants used to add
public P0I operShiftAndScale(Integer shift, Integer scale)
shift
- constants used to add to all valuesscale
- constant used to scale after shifting.
public P0I oper(P0I P0I, String title, String what)
P0I
- Input P0I container for operationtitle
- New titlewhat
- String representing the operation: "+" add a P0I container to
the original; "-" subtract a P0I from the original; "*"
multiply; "/" divide by P0I
public double mean()
public double kurtosis()
public double median()
public String getStatString()
public double moment(int k, Integer c)
k
- k-th orderc
- c
public double standardError()
public double skew()
public Map<String,Double> getStat()
The key for the output map are: mean, error, rms, variance, stddev . Print the key to find out what is inside.
public double variance()
public double stddeviation()
public double covariance(P0I P0I)
P0I
- P0I object for covariance calculations
public double correlation(P0I P0I)
P0I
- P0I object for correlation calculation.
public void clear()
public String getStringValues()
public P0I func(F1D f1d)
This class is not fool proof. If the answer is wrong then use the parenthesis to force the order of evaluation. The most likely place this will be needed is in the use of the power command. The exponent is not evaluated correctly if it begins with a unary operator.
f1d
- function for transformation
public int[] sortIndex()
public P0I func(String title, F1D f1d)
title
- new titlef1d
- function for transformation
public P0I sort()
public P0I reverse()
public void toTable()
public void toTable(boolean format)
format
- if false, numbers will not be formatted to scientific format
##.#####E00public void doc()
|
|||||||||
PREV CLASS NEXT CLASS | All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |