本文整理汇总了Java中org.apache.commons.math.stat.descriptive.DescriptiveStatistics.INFINITE_WINDOW属性的典型用法代码示例。如果您正苦于以下问题:Java DescriptiveStatistics.INFINITE_WINDOW属性的具体用法?Java DescriptiveStatistics.INFINITE_WINDOW怎么用?Java DescriptiveStatistics.INFINITE_WINDOW使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.math.stat.descriptive.DescriptiveStatistics
的用法示例。
在下文中一共展示了DescriptiveStatistics.INFINITE_WINDOW属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValues
/**
* @see org.apache.commons.math.stat.descriptive.DescriptiveStatistics#getValues()
*/
public double[] getValues() {
int length = list.size();
// If the window size is not INFINITE_WINDOW AND
// the current list is larger that the window size, we need to
// take into account only the last n elements of the list
// as definied by windowSize
if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
windowSize < list.size())
{
length = list.size() - Math.max(0, list.size() - windowSize);
}
// Create an array to hold all values
double[] copiedArray = new double[length];
for (int i = 0; i < copiedArray.length; i++) {
copiedArray[i] = getElement(i);
}
return copiedArray;
}
示例2: getElement
/**
* @see org.apache.commons.math.stat.descriptive.DescriptiveStatistics#getElement(int)
*/
public double getElement(int index) {
double value = Double.NaN;
int calcIndex = index;
if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
windowSize < list.size())
{
calcIndex = (list.size() - windowSize) + index;
}
try {
value = transformer.transform(list.get(calcIndex));
} catch (MathException e) {
e.printStackTrace();
}
return value;
}
示例3: getValues
/** {@inheritDoc} */
@Override
public double[] getValues() {
int length = list.size();
// If the window size is not INFINITE_WINDOW AND
// the current list is larger that the window size, we need to
// take into account only the last n elements of the list
// as definied by windowSize
if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
windowSize < list.size())
{
length = list.size() - Math.max(0, list.size() - windowSize);
}
// Create an array to hold all values
double[] copiedArray = new double[length];
for (int i = 0; i < copiedArray.length; i++) {
copiedArray[i] = getElement(i);
}
return copiedArray;
}
示例4: getN
/** {@inheritDoc} */
@Override
public long getN() {
int n = 0;
if (windowSize != DescriptiveStatistics.INFINITE_WINDOW) {
if (list.size() > windowSize) {
n = windowSize;
} else {
n = list.size();
}
} else {
n = list.size();
}
return n;
}
示例5: getElement
/** {@inheritDoc} */
@Override
public double getElement(int index) {
double value = Double.NaN;
int calcIndex = index;
if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
windowSize < list.size())
{
calcIndex = (list.size() - windowSize) + index;
}
try {
value = transformer.transform(list.get(calcIndex));
} catch (MathException e) {
e.printStackTrace();
}
return value;
}
示例6: getElement
/** {@inheritDoc} */
@Override
public double getElement(int index) {
double value = Double.NaN;
int calcIndex = index;
if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
windowSize < list.size())
{
calcIndex = (list.size() - windowSize) + index;
}
try {
value = transformer.transform(list.get(calcIndex));
} catch (MathException e) {
e.printStackTrace();
}
return value;
}
示例7: getN
/**
* @see org.apache.commons.math.stat.descriptive.DescriptiveStatistics#getN()
*/
public long getN() {
int n = 0;
if (windowSize != DescriptiveStatistics.INFINITE_WINDOW) {
if (list.size() > windowSize) {
n = windowSize;
} else {
n = list.size();
}
} else {
n = list.size();
}
return n;
}