當前位置: 首頁>>代碼示例>>Java>>正文


Java TimeSeries.removeAgedItems方法代碼示例

本文整理匯總了Java中org.jfree.data.time.TimeSeries.removeAgedItems方法的典型用法代碼示例。如果您正苦於以下問題:Java TimeSeries.removeAgedItems方法的具體用法?Java TimeSeries.removeAgedItems怎麽用?Java TimeSeries.removeAgedItems使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jfree.data.time.TimeSeries的用法示例。


在下文中一共展示了TimeSeries.removeAgedItems方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testRemoveAgedItems

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
/**
 * Some checks for the removeAgedItems() method.
 */
public void testRemoveAgedItems() {
	TimeSeries series = new TimeSeries("Test Series", Year.class);
	series.addChangeListener(this);
	assertEquals(Long.MAX_VALUE, series.getMaximumItemAge());
	assertEquals(Integer.MAX_VALUE, series.getMaximumItemCount());
	this.gotSeriesChangeEvent = false;
	
	// test empty series
	series.removeAgedItems(true);
	assertEquals(0, series.getItemCount());
	assertFalse(this.gotSeriesChangeEvent);
	
	// test series with one item
	series.add(new Year(1999), 1.0);
	series.setMaximumItemAge(0);
	this.gotSeriesChangeEvent = false;
	series.removeAgedItems(true);
	assertEquals(1, series.getItemCount());
	assertFalse(this.gotSeriesChangeEvent);

	// test series with two items
	series.setMaximumItemAge(10);
	series.add(new Year(2001), 2.0);
	this.gotSeriesChangeEvent = false;
	series.setMaximumItemAge(2);
	assertEquals(2, series.getItemCount());
	assertEquals(0, series.getIndex(new Year(1999)));
	assertFalse(this.gotSeriesChangeEvent);
	series.setMaximumItemAge(1);
	assertEquals(1, series.getItemCount());
	assertEquals(0, series.getIndex(new Year(2001)));
	assertTrue(this.gotSeriesChangeEvent);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:37,代碼來源:TimeSeriesTests.java

示例2: testRemoveAgedItems2

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
/**
 * Some checks for the removeAgedItems(long, boolean) method.
 */
public void testRemoveAgedItems2() {
    long y2006 = 1157087372534L;  // milliseconds somewhere in 2006
	TimeSeries series = new TimeSeries("Test Series", Year.class);
	series.addChangeListener(this);
	assertEquals(Long.MAX_VALUE, series.getMaximumItemAge());
	assertEquals(Integer.MAX_VALUE, series.getMaximumItemCount());
	this.gotSeriesChangeEvent = false;
	
	// test empty series
	series.removeAgedItems(y2006, true);
	assertEquals(0, series.getItemCount());
	assertFalse(this.gotSeriesChangeEvent);
    
    // test a series with 1 item
    series.add(new Year(2004), 1.0);
    series.setMaximumItemAge(1);
    this.gotSeriesChangeEvent = false;
    series.removeAgedItems(new Year(2005).getMiddleMillisecond(), true);
    assertEquals(1, series.getItemCount());
    assertFalse(this.gotSeriesChangeEvent);
    series.removeAgedItems(y2006, true);
    assertEquals(0, series.getItemCount());
    assertTrue(this.gotSeriesChangeEvent);

    // test a series with two items
    series.setMaximumItemAge(2);
    series.add(new Year(2003), 1.0);
    series.add(new Year(2005), 2.0);
    assertEquals(2, series.getItemCount());
    this.gotSeriesChangeEvent = false;
    assertEquals(2, series.getItemCount());
    
    series.removeAgedItems(new Year(2005).getMiddleMillisecond(), true);
    assertEquals(2, series.getItemCount());
    assertFalse(this.gotSeriesChangeEvent);
    series.removeAgedItems(y2006, true);
    assertEquals(1, series.getItemCount());
    assertTrue(this.gotSeriesChangeEvent);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:43,代碼來源:TimeSeriesTests.java

示例3: testRemoveAgedItems

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
/**
 * Some checks for the removeAgedItems() method.
 */
public void testRemoveAgedItems() {
    TimeSeries series = new TimeSeries("Test Series");
    series.addChangeListener(this);
    assertEquals(Long.MAX_VALUE, series.getMaximumItemAge());
    assertEquals(Integer.MAX_VALUE, series.getMaximumItemCount());
    this.gotSeriesChangeEvent = false;

    // test empty series
    series.removeAgedItems(true);
    assertEquals(0, series.getItemCount());
    assertFalse(this.gotSeriesChangeEvent);

    // test series with one item
    series.add(new Year(1999), 1.0);
    series.setMaximumItemAge(0);
    this.gotSeriesChangeEvent = false;
    series.removeAgedItems(true);
    assertEquals(1, series.getItemCount());
    assertFalse(this.gotSeriesChangeEvent);

    // test series with two items
    series.setMaximumItemAge(10);
    series.add(new Year(2001), 2.0);
    this.gotSeriesChangeEvent = false;
    series.setMaximumItemAge(2);
    assertEquals(2, series.getItemCount());
    assertEquals(0, series.getIndex(new Year(1999)));
    assertFalse(this.gotSeriesChangeEvent);
    series.setMaximumItemAge(1);
    assertEquals(1, series.getItemCount());
    assertEquals(0, series.getIndex(new Year(2001)));
    assertTrue(this.gotSeriesChangeEvent);
}
 
開發者ID:SpoonLabs,項目名稱:astor,代碼行數:37,代碼來源:TimeSeriesTests.java

示例4: testRemoveAgedItems2

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
/**
 * Some checks for the removeAgedItems(long, boolean) method.
 */
public void testRemoveAgedItems2() {
    long y2006 = 1157087372534L;  // milliseconds somewhere in 2006
    TimeSeries series = new TimeSeries("Test Series");
    series.addChangeListener(this);
    assertEquals(Long.MAX_VALUE, series.getMaximumItemAge());
    assertEquals(Integer.MAX_VALUE, series.getMaximumItemCount());
    this.gotSeriesChangeEvent = false;

    // test empty series
    series.removeAgedItems(y2006, true);
    assertEquals(0, series.getItemCount());
    assertFalse(this.gotSeriesChangeEvent);

    // test a series with 1 item
    series.add(new Year(2004), 1.0);
    series.setMaximumItemAge(1);
    this.gotSeriesChangeEvent = false;
    series.removeAgedItems(new Year(2005).getMiddleMillisecond(), true);
    assertEquals(1, series.getItemCount());
    assertFalse(this.gotSeriesChangeEvent);
    series.removeAgedItems(y2006, true);
    assertEquals(0, series.getItemCount());
    assertTrue(this.gotSeriesChangeEvent);

    // test a series with two items
    series.setMaximumItemAge(2);
    series.add(new Year(2003), 1.0);
    series.add(new Year(2005), 2.0);
    assertEquals(2, series.getItemCount());
    this.gotSeriesChangeEvent = false;
    assertEquals(2, series.getItemCount());

    series.removeAgedItems(new Year(2005).getMiddleMillisecond(), true);
    assertEquals(2, series.getItemCount());
    assertFalse(this.gotSeriesChangeEvent);
    series.removeAgedItems(y2006, true);
    assertEquals(1, series.getItemCount());
    assertTrue(this.gotSeriesChangeEvent);
}
 
開發者ID:SpoonLabs,項目名稱:astor,代碼行數:43,代碼來源:TimeSeriesTests.java

示例5: testRemoveAgedItems3

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
/**
 * Calling removeAgedItems() on an empty series should not throw any
 * exception.
 */
public void testRemoveAgedItems3() {
    TimeSeries s = new TimeSeries("Test");
    boolean pass = true;
    try {
        s.removeAgedItems(0L, true);
    }
    catch (Exception e) {
        pass = false;
    }
    assertTrue(pass);
}
 
開發者ID:SpoonLabs,項目名稱:astor,代碼行數:16,代碼來源:TimeSeriesTests.java

示例6: testRemoveAgedItems5

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
/**
 * Check that the item bounds are determined correctly after a call to
 * removeAgedItems().
 */
public void testRemoveAgedItems5() {
    TimeSeries s1 = new TimeSeries("S1");
    s1.setMaximumItemAge(4);
    s1.add(new Year(2010), 1.1);
    s1.add(new Year(2011), 2.2);
    s1.add(new Year(2012), 3.3);
    s1.add(new Year(2013), 2.5);
    s1.removeAgedItems(new Year(2015).getMiddleMillisecond(), true);
    assertEquals(3, s1.getItemCount());
    assertEquals(2.2, s1.getMinY(), EPSILON);
    assertEquals(3.3, s1.getMaxY(), EPSILON);
}
 
開發者ID:SpoonLabs,項目名稱:astor,代碼行數:17,代碼來源:TimeSeriesTests.java

示例7: addSeries

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
public void addSeries(final String name, double[] data, Paint linePaint){
//System.out.println("TimeGraphPanel: Adding series to graph " + title +  ", series name = " + name + "=" + Utils.arrayString(data));
		TimeSeries timeSeries = new TimeSeries(name, Week.class);
		timeSeries.setMaximumItemCount(Time.WEEKS_YEAR);
		timeSeries.removeAgedItems(true);
		if(data != null){
			for(int j = 0; j < data.length; j++){
				timeSeries.add(new Week(j % Time.WEEKS_YEAR, 1900 + (int)(j / Time.WEEKS_YEAR)), data[j]);
			}
		}
		addSeries(name, timeSeries, linePaint);
		// Add checkbox if editable, label otherwise
		JComponent kItem = null;
		if(editable){
			final JCheckBox c = new JCheckBox(drawLegend ? name : null);
			c.setSelected(true);
			c.addActionListener(new ActionListener(){
				public void actionPerformed(ActionEvent e){
					setVisible(name, c.isSelected());
				}
			});
			selectBoxes.put(name, c);
			kItem = c;
		}
		else kItem = new JLabel(drawLegend ? name : " ");
		kItem.setToolTipText(name);
		Paint p = seriesPaint.get(name);
		if(p != null && p instanceof Color){
			if(drawLegend) kItem.setForeground((Color)p);
			else kItem.setBackground((Color)p);
		}
		if(!drawLegend){
			kItem.setOpaque(true);
			kItem.setPreferredSize(new Dimension(19, 18));
		}
//		kItem.setMinimumSize(new Dimension(15, 15));
//		kItem.setMaximumSize(new Dimension(15, 15));
		lpLayout.setConstraints(kItem, lpC);
		legandPanel.add(kItem);
//		kItem.setPreferredSize(new Dimension(kItem.getPreferredSize().width, 15));
	}
 
開發者ID:Cride5,項目名稱:jablus,代碼行數:42,代碼來源:TimeGraphPanel.java


注:本文中的org.jfree.data.time.TimeSeries.removeAgedItems方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。