当前位置: 首页>>代码示例>>Java>>正文


Java DoubleDataPoint类代码示例

本文整理汇总了Java中org.kairosdb.core.datapoints.DoubleDataPoint的典型用法代码示例。如果您正苦于以下问题:Java DoubleDataPoint类的具体用法?Java DoubleDataPoint怎么用?Java DoubleDataPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DoubleDataPoint类属于org.kairosdb.core.datapoints包,在下文中一共展示了DoubleDataPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetGroupId

import org.kairosdb.core.datapoints.DoubleDataPoint; //导入依赖的package包/类
/**
 * Test of getGroupId method, of class FiscalCalendarGroubBy.
 */
@Test
public void testGetGroupId() {
	FiscalCalendarGroubBy groupBy = new FiscalCalendarGroubBy();

	assertEquals("Should be 1st period 1970",197001,groupBy.getGroupId(new DoubleDataPoint(1000L, 1.0), null));
	assertEquals("Should be 1st period 2013",201301,groupBy.getGroupId(new DoubleDataPoint(1356951600000L, 1.0), null));
	assertEquals("Should be 1st period 2015",201501,groupBy.getGroupId(new DoubleDataPoint(1422273600000L, 1.0), null));
	assertEquals("Should be 11th period 2013",201311,groupBy.getGroupId(new DoubleDataPoint(1385809200000L, 1.0), null));
}
 
开发者ID:Kratos-ISE,项目名称:kise-kairosdb-module,代码行数:13,代码来源:FiscalCalendarGroubByTest.java

示例2: testSetCalendarType

import org.kairosdb.core.datapoints.DoubleDataPoint; //导入依赖的package包/类
/**
 * Test of getGroupId method, of class FiscalCalendarGroubBy.
 */
@Test
public void testSetCalendarType() {
	FiscalCalendarGroubBy groupBy = new FiscalCalendarGroubBy();
	groupBy.setCalendarType("calendar_445");
	assertEquals("Should be 1st period 1970",197001,groupBy.getGroupId(new DoubleDataPoint(1000L, 1.0), null));
	assertEquals("Should be 1st period 2013",201301,groupBy.getGroupId(new DoubleDataPoint(1356951600000L, 1.0), null));
        assertEquals("Should be 2nd period 2015",201502,groupBy.getGroupId(new DoubleDataPoint(1422273600000L, 1.0), null));
	assertEquals("Should be 11th period 2013",201311,groupBy.getGroupId(new DoubleDataPoint(1385809200000L, 1.0), null));
}
 
开发者ID:Kratos-ISE,项目名称:kise-kairosdb-module,代码行数:13,代码来源:FiscalCalendarGroubByTest.java

示例3: testGetGroupByResult

import org.kairosdb.core.datapoints.DoubleDataPoint; //导入依赖的package包/类
/**
 * Test of getGroupByResult method, of class FiscalCalendarGroubBy.
 */
@Test
public void testGetGroupByResult() throws FormatterException {
	FiscalCalendarGroubBy groupBy = new FiscalCalendarGroubBy();

	groupBy.getGroupId(new DoubleDataPoint(1000L, 1.0), null);
	GroupByResult groupByResult = groupBy.getGroupByResult(197001);

	assertThat(groupByResult.toJson(), equalTo("{\"name\":\"fiscal_period\",\"group\":{\"name\":\"FY1970-P1\",\"fiscal_year\":1970,\"quarter\":\"Q1\",\"fiscal_period\":1}}"));
}
 
开发者ID:Kratos-ISE,项目名称:kise-kairosdb-module,代码行数:13,代码来源:FiscalCalendarGroubByTest.java

示例4: testAverage

import org.kairosdb.core.datapoints.DoubleDataPoint; //导入依赖的package包/类
@Test
public void testAverage() throws ScriptException, KairosDBException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
	ListDataPointGroup group = new ListDataPointGroup("group");
	group.addDataPoint(new DoubleDataPoint(1, 10.0));
	group.addDataPoint(new DoubleDataPoint(1, 20.3));
	group.addDataPoint(new DoubleDataPoint(1, 3.0));
	group.addDataPoint(new DoubleDataPoint(2, 1.0));
	group.addDataPoint(new DoubleDataPoint(2, 3.2));
	group.addDataPoint(new DoubleDataPoint(2, 5.0));
	group.addDataPoint(new DoubleDataPoint(3, 25.1));
	
	JsRangeAggregator fAggregator = new JsRangeAggregator(new DoubleDataPointFactoryImpl(),1000);
	fAggregator.setScript("var sum = 0; for(var i=0; i<valueArray.size();i++){sum+=valueArray.get(i).getDoubleValue();} return sum/valueArray.size(); ");
	fAggregator.setAllocateArray(true);
	DataPointGroup results = fAggregator.aggregate(group);
	
	
	DataPoint dataPoint = results.next();
	assertThat(dataPoint.getTimestamp(), equalTo(1L));
	assertThat(dataPoint.getDoubleValue(), equalTo(11.1));
	
	dataPoint = results.next();
	assertThat(dataPoint.getTimestamp(), equalTo(2L));
	assertThat(dataPoint.getDoubleValue(), closeTo(3.067, 2));
	
	dataPoint = results.next();
	assertThat(dataPoint.getTimestamp(), equalTo(3L));
	assertThat(dataPoint.getDoubleValue(), equalTo(25.1));
	
	assertThat(results.hasNext(), equalTo(false));
	
}
 
开发者ID:Kratos-ISE,项目名称:kise-kairosdb-module,代码行数:33,代码来源:JsRangeAggregatorTest.java

示例5: testSum

import org.kairosdb.core.datapoints.DoubleDataPoint; //导入依赖的package包/类
@Test
public void testSum() throws ScriptException, KairosDBException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
	ListDataPointGroup group = new ListDataPointGroup("group");
	group.addDataPoint(new DoubleDataPoint(1030, 10.0));
	group.addDataPoint(new DoubleDataPoint(1050, 20.3));
	group.addDataPoint(new DoubleDataPoint(1603, 3.0));
	group.addDataPoint(new DoubleDataPoint(2005, 1.0));
	group.addDataPoint(new DoubleDataPoint(2400, 3.2));
	group.addDataPoint(new DoubleDataPoint(2803, 5.0));
	group.addDataPoint(new DoubleDataPoint(3068, 25.1));
	
	JsRangeAggregator fAggregator = new JsRangeAggregator(new DoubleDataPointFactoryImpl(),1000);
	fAggregator.setSampling(new Sampling(1, TimeUnit.SECONDS));
	fAggregator.setStartTime(1000);
	fAggregator.setAlignStartTime(true);
	fAggregator.setAllocateArray(true);
	fAggregator.setScript("var count= 0.; \n" +
		"for(var i=0;i<valueArray.size();i++){\n" +
		"  count+=valueArray.get(i).getDoubleValue();\n" +
		"}\n" +
		"return count; ");
	DataPointGroup results = fAggregator.aggregate(group);
	
	
	DataPoint dataPoint = results.next();
	assertThat(dataPoint.getTimestamp(), equalTo(1000L));
	assertThat(dataPoint.getDoubleValue(), equalTo(33.3));
	
	dataPoint = results.next();
	assertThat(dataPoint.getTimestamp(), equalTo(2000L));
	assertThat(dataPoint.getDoubleValue(), closeTo(9.2, 2));
	
	dataPoint = results.next();
	assertThat(dataPoint.getTimestamp(), equalTo(3000L));
	assertThat(dataPoint.getDoubleValue(), equalTo(25.1));
	
	assertThat(results.hasNext(), equalTo(false));
	
}
 
开发者ID:Kratos-ISE,项目名称:kise-kairosdb-module,代码行数:40,代码来源:JsRangeAggregatorTest.java

示例6: testSumCount

import org.kairosdb.core.datapoints.DoubleDataPoint; //导入依赖的package包/类
@Test
public void testSumCount() throws ScriptException, KairosDBException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
	ListDataPointGroup group = new ListDataPointGroup("group");
	group.addDataPoint(new DoubleDataPoint(1030, 10.0));
	group.addDataPoint(new DoubleDataPoint(1050, 20.3));
	group.addDataPoint(new DoubleDataPoint(1603, 3.0));
	group.addDataPoint(new DoubleDataPoint(2005, 1.0));
	group.addDataPoint(new DoubleDataPoint(2400, 3.2));
	group.addDataPoint(new DoubleDataPoint(2803, 5.0));
	group.addDataPoint(new DoubleDataPoint(3068, 25.1));
	
	JsRangeAggregator fAggregator = new JsRangeAggregator(new DoubleDataPointFactoryImpl(),1000);
	fAggregator.setSampling(new Sampling(1, TimeUnit.SECONDS));
	fAggregator.setStartTime(1000);
	fAggregator.setAlignStartTime(true);
	fAggregator.setAllocateArray(true);
	fAggregator.setArrayResult(true);
	fAggregator.setScript("var count= 0.; \n" +
		"for(var i=0;i<valueArray.size();i++){\n" +
		"  count+=valueArray.get(i).getDoubleValue();\n" +
		"}\n" +
		"return [count,valueArray.size()]; ");
	DataPointGroup results = fAggregator.aggregate(group);
	
	DoubleArrayDataPoint dataPoint = (DoubleArrayDataPoint) results.next();
	assertThat(dataPoint.getTimestamp(), equalTo(1000L));
	assertArrayEquals(dataPoint.getValueArray(), new double[]{33.3,3.},0);
	dataPoint = (DoubleArrayDataPoint)results.next();
	assertThat(dataPoint.getTimestamp(), equalTo(2000L));
	assertArrayEquals(dataPoint.getValueArray(), new double[]{9.2,3.},0);
	dataPoint = (DoubleArrayDataPoint)results.next();
	assertThat(dataPoint.getTimestamp(), equalTo(3000L));
	assertArrayEquals(dataPoint.getValueArray(), new double[]{25.1,1.},0);
	assertThat(results.hasNext(), equalTo(false));
}
 
开发者ID:Kratos-ISE,项目名称:kise-kairosdb-module,代码行数:36,代码来源:JsRangeAggregatorTest.java

示例7: testSumStream

import org.kairosdb.core.datapoints.DoubleDataPoint; //导入依赖的package包/类
@Test
public void testSumStream() throws ScriptException, KairosDBException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
	ListDataPointGroup group = new ListDataPointGroup("group");
	group.addDataPoint(new DoubleDataPoint(1030, 10.0));
	group.addDataPoint(new DoubleDataPoint(1050, 20.3));
	group.addDataPoint(new DoubleDataPoint(1603, 3.0));
	group.addDataPoint(new DoubleDataPoint(2005, 1.0));
	group.addDataPoint(new DoubleDataPoint(2400, 3.2));
	group.addDataPoint(new DoubleDataPoint(2803, 5.0));
	group.addDataPoint(new DoubleDataPoint(3068, 25.1));
	
	JsRangeAggregator fAggregator = new JsRangeAggregator(new DoubleDataPointFactoryImpl(),1000);
	fAggregator.setSampling(new Sampling(1, TimeUnit.SECONDS));
	fAggregator.setStartTime(1000);
	fAggregator.setAlignStartTime(true);
	fAggregator.setScript("var count= 0.; \n" +
		"while(values.hasNext()){\n" +
		"  count+=values.next().getDoubleValue();\n" +
		"}\n" +
		"return count; ");
	DataPointGroup results = fAggregator.aggregate(group);
	
	
	DataPoint dataPoint = results.next();
	assertThat(dataPoint.getTimestamp(), equalTo(1000L));
	assertThat(dataPoint.getDoubleValue(), equalTo(33.3));
	
	dataPoint = results.next();
	assertThat(dataPoint.getTimestamp(), equalTo(2000L));
	assertThat(dataPoint.getDoubleValue(), closeTo(9.2, 2));
	
	dataPoint = results.next();
	assertThat(dataPoint.getTimestamp(), equalTo(3000L));
	assertThat(dataPoint.getDoubleValue(), equalTo(25.1));
	
	assertThat(results.hasNext(), equalTo(false));
	
}
 
开发者ID:Kratos-ISE,项目名称:kise-kairosdb-module,代码行数:39,代码来源:JsRangeAggregatorTest.java

示例8: test_OneFormula

import org.kairosdb.core.datapoints.DoubleDataPoint; //导入依赖的package包/类
@Test
public void test_OneFormula()
{
	ListDataPointGroup group = new ListDataPointGroup("formula");
	group.addDataPoint(new DoubleDataPoint(1, 3.75));
	group.addDataPoint(new DoubleDataPoint(2, 4.75));
	group.addDataPoint(new DoubleDataPoint(3, 5.75));
	group.addDataPoint(new DoubleDataPoint(4, 6.75));
	
	JsFunctionAggregator fAggregator = new JsFunctionAggregator(new DoubleDataPointFactoryImpl());
	fAggregator.setScript("Math.pow((value-3.75),2)");
	DataPointGroup results = fAggregator.aggregate(group);
	
	DataPoint dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(1L));
	assertThat(dp.getDoubleValue(), equalTo(0.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(2L));
	assertThat(dp.getDoubleValue(), equalTo(1.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(3L));
	assertThat(dp.getDoubleValue(), equalTo(4.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(4L));
	assertThat(dp.getDoubleValue(), equalTo(9.0));
}
 
开发者ID:Kratos-ISE,项目名称:kise-kairosdb-module,代码行数:30,代码来源:JsFunctionAggregatorTest.java

示例9: test_FormulaUsingTime

import org.kairosdb.core.datapoints.DoubleDataPoint; //导入依赖的package包/类
@Test
public void test_FormulaUsingTime()
{
	ListDataPointGroup group = new ListDataPointGroup("formula");
	group.addDataPoint(new DoubleDataPoint(1, 1));
	group.addDataPoint(new DoubleDataPoint(2, 2));
	group.addDataPoint(new DoubleDataPoint(3, 3));
	group.addDataPoint(new DoubleDataPoint(4, 4));
	group.addDataPoint(new DoubleDataPoint(5, 10));
	
	JsFunctionAggregator fAggregator = new JsFunctionAggregator(new DoubleDataPointFactoryImpl());
	fAggregator.setScript("value/timestamp");
	DataPointGroup results = fAggregator.aggregate(group);
	
	DataPoint dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(1L));
	assertThat(dp.getDoubleValue(), equalTo(1.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(2L));
	assertThat(dp.getDoubleValue(), equalTo(1.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(3L));
	assertThat(dp.getDoubleValue(), equalTo(1.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(4L));
	assertThat(dp.getDoubleValue(), equalTo(1.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(5L));
	assertThat(dp.getDoubleValue(), equalTo(2.0));
}
 
开发者ID:Kratos-ISE,项目名称:kise-kairosdb-module,代码行数:35,代码来源:JsFunctionAggregatorTest.java

示例10: test_CurrentPlusPrevious

import org.kairosdb.core.datapoints.DoubleDataPoint; //导入依赖的package包/类
@Test
public void test_CurrentPlusPrevious()
{
	ListDataPointGroup group = new ListDataPointGroup("function");
	group.addDataPoint(new DoubleDataPoint(1, 1));
	group.addDataPoint(new DoubleDataPoint(2, 2));
	group.addDataPoint(new DoubleDataPoint(3, 3));
	group.addDataPoint(new DoubleDataPoint(4, 4));
	group.addDataPoint(new DoubleDataPoint(5, 6));
	
	JsFunctionAggregator fAggregator = new JsFunctionAggregator(new DoubleDataPointFactoryImpl());
	fAggregator.setScript("if( typeof this.prev_value === 'undefined'){ this.prev_value = value ; return value } \n else  {var tmp = this.prev_value; this.prev_value = value ; return tmp + this.prev_value;}");
	DataPointGroup results = fAggregator.aggregate(group);
	
	DataPoint dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(1L));
	assertThat(dp.getDoubleValue(), equalTo(1.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(2L));
	assertThat(dp.getDoubleValue(), equalTo(3.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(3L));
	assertThat(dp.getDoubleValue(), equalTo(5.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(4L));
	assertThat(dp.getDoubleValue(), equalTo(7.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(5L));
	assertThat(dp.getDoubleValue(), equalTo(10.0));
}
 
开发者ID:Kratos-ISE,项目名称:kise-kairosdb-module,代码行数:35,代码来源:JsFunctionAggregatorTest.java

示例11: test_Accumulator

import org.kairosdb.core.datapoints.DoubleDataPoint; //导入依赖的package包/类
@Test
public void test_Accumulator()
{
	ListDataPointGroup group = new ListDataPointGroup("function");
	group.addDataPoint(new DoubleDataPoint(1, 1));
	group.addDataPoint(new DoubleDataPoint(2, 2));
	group.addDataPoint(new DoubleDataPoint(3, 3));
	group.addDataPoint(new DoubleDataPoint(4, 4));
	group.addDataPoint(new DoubleDataPoint(5, 6));
	
	JsFunctionAggregator fAggregator = new JsFunctionAggregator(new DoubleDataPointFactoryImpl());
	fAggregator.setScript("if( typeof this.prev_value === 'undefined'){ this.prev_value = 0;} \n this.prev_value = value +  this.prev_value ; return this.prev_value;");
	DataPointGroup results = fAggregator.aggregate(group);
	
	DataPoint dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(1L));
	assertThat(dp.getDoubleValue(), equalTo(1.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(2L));
	assertThat(dp.getDoubleValue(), equalTo(3.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(3L));
	assertThat(dp.getDoubleValue(), equalTo(6.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(4L));
	assertThat(dp.getDoubleValue(), equalTo(10.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(5L));
	assertThat(dp.getDoubleValue(), equalTo(16.0));
}
 
开发者ID:Kratos-ISE,项目名称:kise-kairosdb-module,代码行数:35,代码来源:JsFunctionAggregatorTest.java

示例12: testFilterZeros

import org.kairosdb.core.datapoints.DoubleDataPoint; //导入依赖的package包/类
@Test
public void testFilterZeros() {
	ListDataPointGroup group = new ListDataPointGroup("function");
	group.addDataPoint(new DoubleDataPoint(1, 1));
	group.addDataPoint(new DoubleDataPoint(2, 0));
	group.addDataPoint(new DoubleDataPoint(3, 3));
	group.addDataPoint(new DoubleDataPoint(4, 4));
	group.addDataPoint(new DoubleDataPoint(5, 0));
	
	JsFilterAggregator fAggregator = new JsFilterAggregator(new DoubleDataPointFactoryImpl());
	fAggregator.setScript(" value!=0;");
	DataPointGroup results = fAggregator.aggregate(group);
	
	DataPoint dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(1L));
	assertThat(dp.getDoubleValue(), equalTo(1.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(3L));
	assertThat(dp.getDoubleValue(), equalTo(3.0));
	
	dp = results.next();
	assertThat(dp.getTimestamp(), equalTo(4L));
	assertThat(dp.getDoubleValue(), equalTo(4.0));
	
	assertFalse(results.hasNext());
}
 
开发者ID:Kratos-ISE,项目名称:kise-kairosdb-module,代码行数:28,代码来源:JsFilterAggregatorTest.java

示例13: test_putDataPoints_doubleValue

import org.kairosdb.core.datapoints.DoubleDataPoint; //导入依赖的package包/类
@Test
public void test_putDataPoints_doubleValue() throws DatastoreException, InterruptedException
{
	long now = System.currentTimeMillis() / 1000;

	m_client.sendText("test.host_name.metric_name", now, "12.34");

	ImmutableSortedMap<String, String> tags = Tags.create()
			.put("host", "host_name")
			.build();

	verify(m_datastore, timeout(5000).times(1))
			.putDataPoint("test.metric_name", tags,
					new DoubleDataPoint(now * 1000, 12.34));
}
 
开发者ID:kairosdb,项目名称:kairos-carbon,代码行数:16,代码来源:CarbonTextServerTest.java

示例14: test_putDataPoints_doubleValue

import org.kairosdb.core.datapoints.DoubleDataPoint; //导入依赖的package包/类
@Test
public void test_putDataPoints_doubleValue() throws DatastoreException, InterruptedException, IOException
{
	long now = System.currentTimeMillis() / 1000;

	m_client.sendPickle("test.host_name.metric_name", now, 12.34);

	ImmutableSortedMap<String, String> tags = Tags.create()
			.put("host", "host_name")
			.build();

	verify(m_datastore, timeout(5000).times(1))
			.putDataPoint("test.metric_name", tags,
					new DoubleDataPoint(now * 1000, 12.34));
}
 
开发者ID:kairosdb,项目名称:kairos-carbon,代码行数:16,代码来源:CarbonPickleServerTest.java

示例15: next

import org.kairosdb.core.datapoints.DoubleDataPoint; //导入依赖的package包/类
public DataPoint next() {
	currentPoint++;
	return new DoubleDataPoint(currentPoint*interval, Math.random());
}
 
开发者ID:Kratos-ISE,项目名称:kise-kairosdb-module,代码行数:5,代码来源:JsRangeAggregatorTest.java


注:本文中的org.kairosdb.core.datapoints.DoubleDataPoint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。