Java 类org.jfree.data.time.TimePeriodValue 实例源码

项目:parabuild-ci    文件:TimePeriodValuesTests.java   
/**
 * 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);
}
项目:nabs    文件:TimePeriodValuesTests.java   
/**
 * 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);
}
项目:astor    文件:TimePeriodValuesTests.java   
/**
 * 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);
}
项目:jasa    文件:ReportVariableBoard.java   
@SuppressWarnings({"unchecked", "rawtypes"})
public void reportValues(Map vars, MarketEvent event) {
    Millisecond time = new Millisecond(new Date(event.getPhysicalTime()));

    ArrayList list = new ArrayList(vars.keySet());
    Iterator i = list.iterator();
    while (i.hasNext()) {
        ReportVariable var = (ReportVariable) i.next();
        Object value = vars.get(var);
        if (value instanceof Number) {
            double v = ((Number) value).doubleValue();
            if (!Double.isNaN(v)) {
                reportValue(var.getName(), new TimePeriodValue(time, v));
            }
        } else if (value instanceof Boolean) {
            reportValue(var.getName(), new TimePeriodValue(time, ((Boolean) value)
                .booleanValue() ? 1 : 0));
        }
    }
}
项目:jasa    文件:ReportVariableWriterReport.java   
public void update() {
    TimePeriodValue tpValue;
    for (int i = 0; i < varNames.length; i++) {
        tpValue = ReportVariableBoard.getInstance().getValue(varNames[i]);
        if (tpValue != null) {
            if (tpValue.getValue() instanceof Double) {
                newData(formatter.format(((Double) tpValue.getValue())
                    .doubleValue()));
            } else {
                newData(tpValue.getValue());
            }
        } else {
            newData(-1);
        }
    }
}
项目:jasa    文件:ReportVariableWriterReport.java   
public void update() {

            TimePeriodValue tpValue;
            for (int i = 0; i < varNames.length; i++) {
                tpValue = ReportVariableBoard.getInstance().getValue(varNames[i]);
                if (tpValue != null) {
                    if (tpValue.getValue() instanceof Number) {
                        double v = ((Number) tpValue.getValue()).doubleValue();
                        if (!Double.isNaN(v)) {
                            resultsStats[i].newData(v);
                        }
                    }
                } else {
                    logger.fatal("Please make sure the historicalDataReport variable " + varNames[i]
                        + " exists!");
                }
            }
        }
项目:parabuild-ci    文件:TimePeriodValueTests.java   
/**
 * Tests the equals() method.
 */
public void testEquals() {
    final TimePeriodValue tpv1 = new TimePeriodValue(new Day(30, 7, 2003), 55.75);
    final TimePeriodValue tpv2 = new TimePeriodValue(new Day(30, 7, 2003), 55.75);
    assertTrue(tpv1.equals(tpv2));
    assertTrue(tpv2.equals(tpv1));
}
项目:parabuild-ci    文件:TimePeriodValueTests.java   
/**
 * Tests the equals() method.
 */
public void testEquals() {
    TimePeriodValue tpv1 = new TimePeriodValue(new Day(30, 7, 2003), 55.75);
    TimePeriodValue tpv2 = new TimePeriodValue(new Day(30, 7, 2003), 55.75);
    assertTrue(tpv1.equals(tpv2));
    assertTrue(tpv2.equals(tpv1));
}
项目:nabs    文件:TimePeriodValueTests.java   
/**
 * Tests the equals() method.
 */
public void testEquals() {
    TimePeriodValue tpv1 = new TimePeriodValue(new Day(30, 7, 2003), 55.75);
    TimePeriodValue tpv2 = new TimePeriodValue(new Day(30, 7, 2003), 55.75);
    assertTrue(tpv1.equals(tpv2));
    assertTrue(tpv2.equals(tpv1));
}
项目:astor    文件:TimePeriodValueTests.java   
/**
 * Tests the equals() method.
 */
public void testEquals() {
    TimePeriodValue tpv1 = new TimePeriodValue(new Day(30, 7, 2003), 55.75);
    TimePeriodValue tpv2 = new TimePeriodValue(new Day(30, 7, 2003), 55.75);
    assertTrue(tpv1.equals(tpv2));
    assertTrue(tpv2.equals(tpv1));
}
项目:jasa    文件:ReportVariableBoard.java   
private ReportVariableBoard() {
    if (instance != null)
        throw new Error("ReportVariableBoard cannot be instantiated twice!");

    instance = this;
    board = Collections.synchronizedMap(new HashMap<String, TimePeriodValue>());
}
项目:parabuild-ci    文件:TimePeriodValueTests.java   
/**
 * Test that an instance is equal to itself.
 */
public void testEqualsSelf() {
    final TimePeriodValue tpv = new TimePeriodValue(new Day(), 55.75);
    assertTrue(tpv.equals(tpv));
}
项目:parabuild-ci    文件:TimePeriodValueTests.java   
/**
 * Test that an instance is equal to itself.
 */
public void testEqualsSelf() {
    TimePeriodValue tpv = new TimePeriodValue(new Day(), 55.75);
    assertTrue(tpv.equals(tpv));
}
项目:nabs    文件:TimePeriodValueTests.java   
/**
 * Test that an instance is equal to itself.
 */
public void testEqualsSelf() {
    TimePeriodValue tpv = new TimePeriodValue(new Day(), 55.75);
    assertTrue(tpv.equals(tpv));
}
项目:astor    文件:TimePeriodValueTests.java   
/**
 * Test that an instance is equal to itself.
 */
public void testEqualsSelf() {
    TimePeriodValue tpv = new TimePeriodValue(new Day(), 55.75);
    assertTrue(tpv.equals(tpv));
}
项目:jasa    文件:ReportVariableBoard.java   
public TimePeriodValue getValue(String varName) {
    return board.get(varName);
}
项目:jasa    文件:ReportVariableBoard.java   
public TimePeriodValue getValue(ReportVariable var) {
    return getValue(var.getName());
}
项目:jasa    文件:ReportVariableBoard.java   
public void reportValue(ReportVariable var, TimePeriodValue value) {
    reportValue(var.getName(), value);
}
项目:jasa    文件:ReportVariableBoard.java   
public void reportValue(String varName, TimePeriodValue value) {
    board.put(varName, value);
}
项目:jasa    文件:ReportVariableBoard.java   
public void reportValue(String varName, double value, MarketEvent event) {
    Millisecond time = new Millisecond(new Date(event.getPhysicalTime()));
    reportValue(varName, new TimePeriodValue(time, value));
}