/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* ident "%Z%%M% %I% %E% SMI"
*/
/**
* Contains the information relating to a specific statistic for an
* object. The Statistic has no notion of the source of the data, it
* is simply a repository for holding statistical information.
*/
interface Statistic
{
/**
* Return the start of the sample period for which the
* statistic is representative.
*/
/**
* Return the end of the sample period for which the
* statistic is representative.
*/
/**
* Get the value of this statistic.
*/
/**
* Get the value of this statistic as a Long.
*/
/**
* Get the value of this statistic as a Double.
*/
/**
* Get the value of this statistic as a UnsignedInt64.
*/
}
/**
* An interface for Statistics which may be aggregated.
*/
{
/**
* Add the supplied statistic to this.
*
* @param o The other statistic.
*/
/**
* Subtract the supplied statistic from this.
*
* @param o The other statistic.
*/
/**
* Produce the aggregate of all objects in the supplied
* iterator (which must be of the same type) whose start and
* end dates lie within the supplied ranges. If either start
* or end is null, then that bound is not applied. i.e. if no
* start date is supplied, then start checking is disabled.
*
* @param start The start date for qualification in the snapshot.
* @param end The end date for qualification in the snapshot.
* @throws IllegalArgumentException If the iterator is empty.
*/
}
/**
* A basic Statistic implementation which makes it easy to derive
* concrete statistic types. This is an immutable class, the state is
* set when the object is constructed and cannot be later changed.
*/
{
/**
* The value of the statistic.
*/
/**
* The start of the interval during which the statistic was
* captured.
*/
/**
* The end of the interval during which the statistic was
* captured.
*/
/**
* Formatter for the sample start time, used by toString().
*/
/**
* Constructor. This is provided as a mechanism to allow
* inherited classes to correctly initialize their state.
*
* @param value The value of this statistic.
*/
{
}
/**
* Constructor. This is provided as a mechanism to allow
* inherited classes to correctly initialize their state.
*
* @param value The value of this statistic.
* @param start The start of the sample period which this
* statistic represents.
* @param end The end of the sample period which this
* statistic represents.
*/
{
}
/**
* Return the start of the sample period for which the
* statistic is representative.
*/
{
return (start);
}
/**
* Return the end of the sample period for which the
* statistic is representative.
*/
{
return (end);
}
/**
* Get the value of this statistic.
*/
{
return (value);
}
/**
* Return the string representation of this statistic.
*/
{
}
}
}
/**
* A statistic of type Double.
*/
implements AggregateStatistic
{
/**
* Constructor.
*
* @param value The value of this statistic.
*/
{
super(value);
}
/**
* Constructor.
*
* @param value The value of this statistic.
* @param start The start of the interval over which this
* statistic is representative.
* @param end The end of the interval over which this
* statistic is representative.
*/
{
}
{
}
{
}
{
longValue())));
}
{
v2.doubleValue()),
}
{
v2.doubleValue()),
}
{
double total = 0;
int count = 0;
continue;
}
continue;
}
count++;
}
if (count == 0)
throw new IllegalArgumentException("Cannot derive a " +
"snapshot from an empty iterator");
last));
}
}
/**
* A statistic of type Long.
*/
implements AggregateStatistic
{
/**
* Constructor.
*
* @param value The value of this statistic.
* @param start The start of the interval over which this
* statistic is representative.
* @param end The end of the interval over which this
* statistic is representative.
*/
{
}
{
}
{
}
{
longValue())));
}
{
}
{
}
{
long total = 0;
int count = 0;
continue;
}
continue;
}
count++;
}
if (count == 0)
throw new IllegalArgumentException("Cannot derive a " +
"snapshot from an empty iterator");
last));
}
}
/**
* A statistic of type UnsignedInt64.
*/
implements AggregateStatistic
{
/**
* Constructor.
*
* @param value The value of this statistic.
* @param start The start of the interval over which this
* statistic is representative.
* @param end The end of the interval over which this
* statistic is representative.
*/
{
}
{
}
{
}
{
return ((UnsignedInt64) getValue());
}
{
return (new UnsignedInt64Statistic(
}
{
return (new UnsignedInt64Statistic(
}
{
int count = 0;
continue;
}
continue;
}
count++;
}
if (count == 0)
throw new IllegalArgumentException("Cannot derive a " +
"snapshot from an empty iterator");
return (new UnsignedInt64Statistic(
}
}