本文整理汇总了Java中org.jfree.data.time.SimpleTimePeriod类的典型用法代码示例。如果您正苦于以下问题:Java SimpleTimePeriod类的具体用法?Java SimpleTimePeriod怎么用?Java SimpleTimePeriod使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleTimePeriod类属于org.jfree.data.time包,在下文中一共展示了SimpleTimePeriod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test697153
import org.jfree.data.time.SimpleTimePeriod; //导入依赖的package包/类
/**
* A test for bug report 697153.
*/
public void test697153() {
final TaskSeries s1 = new TaskSeries("S1");
s1.add(new Task("Task 1", new SimpleTimePeriod(new Date(), new Date())));
s1.add(new Task("Task 2", new SimpleTimePeriod(new Date(), new Date())));
s1.add(new Task("Task 3", new SimpleTimePeriod(new Date(), new Date())));
final TaskSeries s2 = new TaskSeries("S2");
s2.add(new Task("Task 2", new SimpleTimePeriod(new Date(), new Date())));
s2.add(new Task("Task 3", new SimpleTimePeriod(new Date(), new Date())));
s2.add(new Task("Task 4", new SimpleTimePeriod(new Date(), new Date())));
final TaskSeriesCollection tsc = new TaskSeriesCollection();
tsc.add(s1);
tsc.add(s2);
s1.removeAll();
final int taskCount = tsc.getColumnCount();
assertEquals(3, taskCount);
}
示例2: test800324
import org.jfree.data.time.SimpleTimePeriod; //导入依赖的package包/类
/**
* A test for bug report 800324.
*/
public void test800324() {
final TaskSeries s1 = new TaskSeries("S1");
s1.add(new Task("Task 1", new SimpleTimePeriod(new Date(), new Date())));
s1.add(new Task("Task 2", new SimpleTimePeriod(new Date(), new Date())));
s1.add(new Task("Task 3", new SimpleTimePeriod(new Date(), new Date())));
final TaskSeriesCollection tsc = new TaskSeriesCollection();
tsc.add(s1);
// these methods should return null since the column number is too high...
final Number start = tsc.getStartValue(0, 3);
assertEquals(start, null);
final Number end = tsc.getEndValue(0, 3);
assertEquals(end, null);
final int count = tsc.getSubIntervalCount(0, 3);
assertEquals(0, count);
}
示例3: testEquals
import org.jfree.data.time.SimpleTimePeriod; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
Task t1 = new Task("T", new Date(1), new Date(2));
Task t2 = new Task("T", new Date(1), new Date(2));
assertTrue(t1.equals(t2));
assertTrue(t2.equals(t1));
t1.setDescription("X");
assertFalse(t1.equals(t2));
t2.setDescription("X");
assertTrue(t1.equals(t2));
t1.setDuration(new SimpleTimePeriod(new Date(2), new Date(3)));
assertFalse(t1.equals(t2));
t2.setDuration(new SimpleTimePeriod(new Date(2), new Date(3)));
assertTrue(t1.equals(t2));
t1.setPercentComplete(0.5);
assertFalse(t1.equals(t2));
t2.setPercentComplete(0.5);
assertTrue(t1.equals(t2));
}
示例4: testAdd
import org.jfree.data.time.SimpleTimePeriod; //导入依赖的package包/类
/**
* Some checks for the add() methods.
*/
public void testAdd() {
TimePeriodValues tpv = new TimePeriodValues("Test");
MySeriesChangeListener listener = new MySeriesChangeListener();
tpv.addChangeListener(listener);
tpv.add(new TimePeriodValue(new SimpleTimePeriod(new Date(1L),
new Date(3L)), 99.0));
assertEquals(99.0, tpv.getValue(0).doubleValue(), EPSILON);
assertEquals(tpv, listener.getLastEvent().getSource());
// a null item should throw an IllegalArgumentException
boolean pass = false;
try {
tpv.add((TimePeriodValue) null);
}
catch (IllegalArgumentException e) {
pass = true;
}
assertTrue(pass);
}
示例5: resetUI
import org.jfree.data.time.SimpleTimePeriod; //导入依赖的package包/类
/**
* Resets the display.
*/
@Override
void resetUI() {
super.resetUI();
XYPlot xyPlot = mChart.getXYPlot();
AbstractXYItemRenderer br = new XYBarRenderer();
mDatasetsSyncHist = new TimePeriodValues[NUM_AUTHS+1];
@SuppressWarnings("unchecked")
Map<SimpleTimePeriod, Integer> mTimePeriodMapTmp[] = new HashMap[NUM_AUTHS + 1];
mTimePeriodMap = mTimePeriodMapTmp;
TimePeriodValuesCollection tpvc = new TimePeriodValuesCollection();
xyPlot.setDataset(tpvc);
xyPlot.setRenderer(br);
for (int i = 0; i < NUM_AUTHS + 1; i++) {
br.setSeriesPaint(i, AUTH_COLORS[i]);
mDatasetsSyncHist[i] = new TimePeriodValues(AUTH_NAMES[i]);
tpvc.addSeries(mDatasetsSyncHist[i]);
mTimePeriodMap[i] = new HashMap<SimpleTimePeriod, Integer>();
}
}
示例6: processSyncEvent
import org.jfree.data.time.SimpleTimePeriod; //导入依赖的package包/类
/**
* Callback to process a sync event.
*/
@Override
void processSyncEvent(EventContainer event, int auth, long startTime, long stopTime,
String details, boolean newEvent, int syncSource) {
if (!newEvent) {
// Details arrived for a previous sync event
// Remove event before reinserting.
int lastItem = mDatasetsSync[auth].getItemCount();
mDatasetsSync[auth].delete(lastItem-1, lastItem-1);
mTooltipsSync[auth].remove(lastItem-1);
}
double height = getHeightFromDetails(details);
height = height / (stopTime - startTime + 1) * 10000;
if (height > 30) {
height = 30;
}
mDatasetsSync[auth].add(new SimpleTimePeriod(startTime, stopTime), height);
mTooltipsSync[auth].add(getTextFromDetails(auth, details, syncSource));
mTooltipGenerators[auth].addToolTipSeries(mTooltipsSync[auth]);
if (details.indexOf('x') >= 0 || details.indexOf('X') >= 0) {
long msec = event.sec * 1000L + (event.nsec / 1000000L);
mDatasetError.addOrUpdate(new FixedMillisecond(msec), -1);
}
}
示例7: testGetDomainBoundsWithoutInterval
import org.jfree.data.time.SimpleTimePeriod; //导入依赖的package包/类
/**
* Some checks for the getDomainBounds() method.
*/
public void testGetDomainBoundsWithoutInterval() {
// check empty dataset
TimePeriodValuesCollection dataset = new TimePeriodValuesCollection();
Range r = dataset.getDomainBounds(false);
assertNull(r);
// check dataset with one time period
TimePeriodValues s1 = new TimePeriodValues("S1");
s1.add(new SimpleTimePeriod(1000L, 2000L), 1.0);
dataset.addSeries(s1);
r = dataset.getDomainBounds(false);
assertEquals(1500.0, r.getLowerBound(), EPSILON);
assertEquals(1500.0, r.getUpperBound(), EPSILON);
// check dataset with two time periods
s1.add(new SimpleTimePeriod(1500L, 3000L), 2.0);
r = dataset.getDomainBounds(false);
assertEquals(1500.0, r.getLowerBound(), EPSILON);
assertEquals(2250.0, r.getUpperBound(), EPSILON);
}
示例8: createBarDataset
import org.jfree.data.time.SimpleTimePeriod; //导入依赖的package包/类
private XYDataset createBarDataset() {
final TimePeriodValuesCollection result = new TimePeriodValuesCollection();
Set<String> nameSet = this.m_dataSetMap.keySet();
for (String name : nameSet) {
final TimePeriodValues series = new TimePeriodValues(name);
Map<Date, ? extends Number> map = m_dataSetMap.get(name);
Iterator<Date> ir = map.keySet().iterator();
while (ir.hasNext()) {
Date key = ir.next();
series.add(new SimpleTimePeriod(key, new Date(key.getTime()
+ (m_interval * OneDay))), map.get(key));
}
result.addSeries(series);
}
return result;
}
示例9: testEquals
import org.jfree.data.time.SimpleTimePeriod; //导入依赖的package包/类
/**
* Test the equals() method.
*/
public void testEquals() {
final SimpleTimePeriod p1 = new SimpleTimePeriod(new Date(1000L), new Date(1001L));
final SimpleTimePeriod p2 = new SimpleTimePeriod(new Date(1000L), new Date(1001L));
assertTrue(p1.equals(p2));
assertTrue(p2.equals(p1));
}
示例10: testHashcode
import org.jfree.data.time.SimpleTimePeriod; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashcode() {
final SimpleTimePeriod s1 = new SimpleTimePeriod(new Date(10L), new Date(20L));
final SimpleTimePeriod s2 = new SimpleTimePeriod(new Date(10L), new Date(20L));
assertTrue(s1.equals(s2));
final int h1 = s1.hashCode();
final int h2 = s2.hashCode();
assertEquals(h1, h2);
}
示例11: testEqualsSelf
import org.jfree.data.time.SimpleTimePeriod; //导入依赖的package包/类
/**
* Check that an instance is equal to itself.
*
* SourceForge Bug ID: 558850.
*/
public void testEqualsSelf() {
SimpleTimePeriod p = new SimpleTimePeriod(
new Date(1000L), new Date(1001L)
);
assertTrue(p.equals(p));
}
示例12: testHashcode
import org.jfree.data.time.SimpleTimePeriod; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashcode() {
SimpleTimePeriod s1 = new SimpleTimePeriod(
new Date(10L), new Date(20L)
);
SimpleTimePeriod s2 = new SimpleTimePeriod(
new Date(10L), new Date(20L)
);
assertTrue(s1.equals(s2));
int h1 = s1.hashCode();
int h2 = s2.hashCode();
assertEquals(h1, h2);
}
示例13: testClone
import org.jfree.data.time.SimpleTimePeriod; //导入依赖的package包/类
/**
* This class is immutable, so it should not implement Cloneable.
*/
public void testClone() {
SimpleTimePeriod s1 = new SimpleTimePeriod(
new Date(10L), new Date(20L)
);
assertFalse(s1 instanceof Cloneable);
}
示例14: testEquals
import org.jfree.data.time.SimpleTimePeriod; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
Task t1 = new Task("T", new Date(1), new Date(2));
Task t2 = new Task("T", new Date(1), new Date(2));
assertTrue(t1.equals(t2));
assertTrue(t2.equals(t1));
t1.setDescription("X");
assertFalse(t1.equals(t2));
t2.setDescription("X");
assertTrue(t1.equals(t2));
t1.setDuration(new SimpleTimePeriod(new Date(2), new Date(3)));
assertFalse(t1.equals(t2));
t2.setDuration(new SimpleTimePeriod(new Date(2), new Date(3)));
assertTrue(t1.equals(t2));
t1.setPercentComplete(0.5);
assertFalse(t1.equals(t2));
t2.setPercentComplete(0.5);
assertTrue(t1.equals(t2));
t1.addSubtask(new Task("T", new Date(22), new Date(33)));
assertFalse(t1.equals(t2));
t2.addSubtask(new Task("T", new Date(22), new Date(33)));
assertTrue(t1.equals(t2));
}
示例15: test697153
import org.jfree.data.time.SimpleTimePeriod; //导入依赖的package包/类
/**
* A test for bug report 697153.
*/
public void test697153() {
TaskSeries s1 = new TaskSeries("S1");
s1.add(new Task("Task 1", new SimpleTimePeriod(new Date(),
new Date())));
s1.add(new Task("Task 2", new SimpleTimePeriod(new Date(),
new Date())));
s1.add(new Task("Task 3", new SimpleTimePeriod(new Date(),
new Date())));
TaskSeries s2 = new TaskSeries("S2");
s2.add(new Task("Task 2", new SimpleTimePeriod(new Date(),
new Date())));
s2.add(new Task("Task 3", new SimpleTimePeriod(new Date(),
new Date())));
s2.add(new Task("Task 4", new SimpleTimePeriod(new Date(),
new Date())));
TaskSeriesCollection tsc = new TaskSeriesCollection();
tsc.add(s1);
tsc.add(s2);
s1.removeAll();
int taskCount = tsc.getColumnCount();
assertEquals(3, taskCount);
}