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

项目:parabuild-ci    文件:TimePeriodValuesCollectionTests.java   
/**
 * Tests the equals() method.
 */
public void testEquals() {

    TimePeriodValuesCollection c1 = new TimePeriodValuesCollection();
    TimePeriodValuesCollection c2 = new TimePeriodValuesCollection();
    assertTrue(c1.equals(c2));

    c1.setDomainIsPointsInTime(!c1.getDomainIsPointsInTime());
    assertFalse(c1.equals(c2));
    c2.setDomainIsPointsInTime(c1.getDomainIsPointsInTime());
    assertTrue(c1.equals(c2));

    c1.setXPosition(TimePeriodAnchor.END);
    assertFalse(c1.equals(c2));
    c2.setXPosition(TimePeriodAnchor.END);
    assertTrue(c1.equals(c2));

    TimePeriodValues v1 = new TimePeriodValues("Test");
    TimePeriodValues v2 = new TimePeriodValues("Test");

    c1.addSeries(v1);
    assertFalse(c1.equals(c2));
    c2.addSeries(v2);
    assertTrue(c1.equals(c2));
}
项目:WS-Attacker    文件:ChartObject.java   
private IntervalXYDataset createDatasetNumberRequestsUntampered()
{

    Date currentDate;
    long currentMsTs;
    final TimeSeries series = new TimeSeries( "Sent Untampered Requests per Second" );
    if ( model.getMapLogEntryIntervalUntampered() != null )
    {
        for ( Map.Entry<Integer, LogEntryInterval> log : model.getMapLogEntryIntervalUntampered().entrySet() )
        {
            // Create TS from model.startTime and log.getIntervalNumber();
            currentMsTs = model.getTsAttackStart() + log.getValue().getIntervalNumber();
            currentDate = new Date( currentMsTs );
            series.add( new Second( currentDate ), ( log.getValue().getNumberRequests() ) );
        }
    }

    final TimeSeriesCollection dataset = new TimeSeriesCollection( series );
    dataset.setXPosition( TimePeriodAnchor.MIDDLE );

    return dataset;
}
项目:WS-Attacker    文件:ChartObject.java   
private IntervalXYDataset createDatasetNumberRequestsTampered()
{

    Date currentDate;
    long currentMsTs;
    final TimeSeries series = new TimeSeries( "Sent Tampered Requests per Second" );
    if ( model.getMapLogEntryIntervalTampered() != null )
    {
        for ( Map.Entry<Integer, LogEntryInterval> log : model.getMapLogEntryIntervalTampered().entrySet() )
        {
            // Create TS from model.startTime and log.getIntervalNumber();
            currentMsTs = model.getTsAttackStart() + log.getValue().getIntervalNumber();
            currentDate = new Date( currentMsTs );
            series.add( new Second( currentDate ), ( log.getValue().getNumberRequests() ) );
        }
    }

    final TimeSeriesCollection dataset = new TimeSeriesCollection( series );
    dataset.setXPosition( TimePeriodAnchor.MIDDLE );

    return dataset;
}
项目:nabs    文件:TimePeriodValuesCollectionTests.java   
/**
 * Tests the equals() method.
 */
public void testEquals() {

    TimePeriodValuesCollection c1 = new TimePeriodValuesCollection();
    TimePeriodValuesCollection c2 = new TimePeriodValuesCollection();
    assertTrue(c1.equals(c2));

    c1.setDomainIsPointsInTime(!c1.getDomainIsPointsInTime());
    assertFalse(c1.equals(c2));
    c2.setDomainIsPointsInTime(c1.getDomainIsPointsInTime());
    assertTrue(c1.equals(c2));

    c1.setXPosition(TimePeriodAnchor.END);
    assertFalse(c1.equals(c2));
    c2.setXPosition(TimePeriodAnchor.END);
    assertTrue(c1.equals(c2));

    TimePeriodValues v1 = new TimePeriodValues("Test");
    TimePeriodValues v2 = new TimePeriodValues("Test");

    c1.addSeries(v1);
    assertFalse(c1.equals(c2));
    c2.addSeries(v2);
    assertTrue(c1.equals(c2));
}
项目:astor    文件:TimePeriodValuesCollectionTests.java   
/**
 * Tests the equals() method.
 */
public void testEquals() {

    TimePeriodValuesCollection c1 = new TimePeriodValuesCollection();
    TimePeriodValuesCollection c2 = new TimePeriodValuesCollection();
    assertTrue(c1.equals(c2));

    c1.setXPosition(TimePeriodAnchor.END);
    assertFalse(c1.equals(c2));
    c2.setXPosition(TimePeriodAnchor.END);
    assertTrue(c1.equals(c2));

    TimePeriodValues v1 = new TimePeriodValues("Test");
    TimePeriodValues v2 = new TimePeriodValues("Test");

    c1.addSeries(v1);
    assertFalse(c1.equals(c2));
    c2.addSeries(v2);
    assertTrue(c1.equals(c2));
}
项目:parabuild-ci    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond(); 
    }
    return result;
}
项目:ccu-historian    文件:OHLCSeriesCollectionTest.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    OHLCSeriesCollection c1 = new OHLCSeriesCollection();
    OHLCSeriesCollection c2 = new OHLCSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    OHLCSeries s1 = new OHLCSeries("Series");
    s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    OHLCSeries s2 = new OHLCSeries("Series");
    s2.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new OHLCSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new OHLCSeries("Empty Series"));
    assertTrue(c1.equals(c2));

    c1.setXPosition(TimePeriodAnchor.END);
    assertFalse(c1.equals(c2));
    c2.setXPosition(TimePeriodAnchor.END);
    assertTrue(c1.equals(c2));

}
项目:ccu-historian    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond();
    }
    return result;
}
项目:jfreechart    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period ({@code null} not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond();
    }
    return result;
}
项目:jfreechart    文件:OHLCSeriesCollectionTest.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    OHLCSeriesCollection c1 = new OHLCSeriesCollection();
    OHLCSeriesCollection c2 = new OHLCSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    OHLCSeries s1 = new OHLCSeries("Series");
    s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    OHLCSeries s2 = new OHLCSeries("Series");
    s2.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new OHLCSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new OHLCSeries("Empty Series"));
    assertTrue(c1.equals(c2));

    c1.setXPosition(TimePeriodAnchor.END);
    assertFalse(c1.equals(c2));
    c2.setXPosition(TimePeriodAnchor.END);
    assertTrue(c1.equals(c2));

}
项目:aya-lang    文件:OHLCSeriesCollectionTest.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    OHLCSeriesCollection c1 = new OHLCSeriesCollection();
    OHLCSeriesCollection c2 = new OHLCSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    OHLCSeries s1 = new OHLCSeries("Series");
    s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    OHLCSeries s2 = new OHLCSeries("Series");
    s2.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new OHLCSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new OHLCSeries("Empty Series"));
    assertTrue(c1.equals(c2));

    c1.setXPosition(TimePeriodAnchor.END);
    assertFalse(c1.equals(c2));
    c2.setXPosition(TimePeriodAnchor.END);
    assertTrue(c1.equals(c2));

}
项目:aya-lang    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond();
    }
    return result;
}
项目:HTML5_WebSite    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond();
    }
    return result;
}
项目:populus    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond();
    }
    return result;
}
项目:PI    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond();
    }
    return result;
}
项目:nabs    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond(); 
    }
    return result;
}
项目:ECG-Viewer    文件:OHLCSeriesCollectionTest.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    OHLCSeriesCollection c1 = new OHLCSeriesCollection();
    OHLCSeriesCollection c2 = new OHLCSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    OHLCSeries s1 = new OHLCSeries("Series");
    s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    OHLCSeries s2 = new OHLCSeries("Series");
    s2.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new OHLCSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new OHLCSeries("Empty Series"));
    assertTrue(c1.equals(c2));

    c1.setXPosition(TimePeriodAnchor.END);
    assertFalse(c1.equals(c2));
    c2.setXPosition(TimePeriodAnchor.END);
    assertTrue(c1.equals(c2));

}
项目:ECG-Viewer    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond();
    }
    return result;
}
项目:astor    文件:OHLCSeriesCollectionTests.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    OHLCSeriesCollection c1 = new OHLCSeriesCollection();
    OHLCSeriesCollection c2 = new OHLCSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    OHLCSeries s1 = new OHLCSeries("Series");
    s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    OHLCSeries s2 = new OHLCSeries("Series");
    s2.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new OHLCSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new OHLCSeries("Empty Series"));
    assertTrue(c1.equals(c2));

    c1.setXPosition(TimePeriodAnchor.END);
    assertFalse(c1.equals(c2));
    c2.setXPosition(TimePeriodAnchor.END);
    assertTrue(c1.equals(c2));

}
项目:astor    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond();
    }
    return result;
}
项目:opensim-gui    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond(); 
    }
    return result;
}
项目:group-five    文件:OHLCSeriesCollectionTest.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    OHLCSeriesCollection c1 = new OHLCSeriesCollection();
    OHLCSeriesCollection c2 = new OHLCSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    OHLCSeries s1 = new OHLCSeries("Series");
    s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    OHLCSeries s2 = new OHLCSeries("Series");
    s2.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new OHLCSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new OHLCSeries("Empty Series"));
    assertTrue(c1.equals(c2));

    c1.setXPosition(TimePeriodAnchor.END);
    assertFalse(c1.equals(c2));
    c2.setXPosition(TimePeriodAnchor.END);
    assertTrue(c1.equals(c2));

}
项目:group-five    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond();
    }
    return result;
}
项目:manydesigns.cn    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond();
    }
    return result;
}
项目:buffer_bci    文件:OHLCSeriesCollectionTest.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    OHLCSeriesCollection c1 = new OHLCSeriesCollection();
    OHLCSeriesCollection c2 = new OHLCSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    OHLCSeries s1 = new OHLCSeries("Series");
    s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    OHLCSeries s2 = new OHLCSeries("Series");
    s2.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new OHLCSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new OHLCSeries("Empty Series"));
    assertTrue(c1.equals(c2));

    c1.setXPosition(TimePeriodAnchor.END);
    assertFalse(c1.equals(c2));
    c2.setXPosition(TimePeriodAnchor.END);
    assertTrue(c1.equals(c2));

}
项目:buffer_bci    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond();
    }
    return result;
}
项目:buffer_bci    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond();
    }
    return result;
}
项目:proyecto-teoria-control-utn-frro    文件:OHLCSeriesCollectionTest.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    OHLCSeriesCollection c1 = new OHLCSeriesCollection();
    OHLCSeriesCollection c2 = new OHLCSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    OHLCSeries s1 = new OHLCSeries("Series");
    s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    OHLCSeries s2 = new OHLCSeries("Series");
    s2.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new OHLCSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new OHLCSeries("Empty Series"));
    assertTrue(c1.equals(c2));

    c1.setXPosition(TimePeriodAnchor.END);
    assertFalse(c1.equals(c2));
    c2.setXPosition(TimePeriodAnchor.END);
    assertTrue(c1.equals(c2));

}
项目:proyecto-teoria-control-utn-frro    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond();
    }
    return result;
}
项目:Memetic-Algorithm-for-TSP    文件:OHLCSeriesCollectionTest.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
@Test
public void testEquals() {
    OHLCSeriesCollection c1 = new OHLCSeriesCollection();
    OHLCSeriesCollection c2 = new OHLCSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    OHLCSeries s1 = new OHLCSeries("Series");
    s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    OHLCSeries s2 = new OHLCSeries("Series");
    s2.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new OHLCSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new OHLCSeries("Empty Series"));
    assertTrue(c1.equals(c2));

    c1.setXPosition(TimePeriodAnchor.END);
    assertFalse(c1.equals(c2));
    c2.setXPosition(TimePeriodAnchor.END);
    assertTrue(c1.equals(c2));

}
项目:Memetic-Algorithm-for-TSP    文件:OHLCSeriesCollection.java   
/**
 * Returns the x-value for a time period.
 *
 * @param period  the time period (<code>null</code> not permitted).
 *
 * @return The x-value.
 */
protected synchronized long getX(RegularTimePeriod period) {
    long result = 0L;
    if (this.xPosition == TimePeriodAnchor.START) {
        result = period.getFirstMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.MIDDLE) {
        result = period.getMiddleMillisecond();
    }
    else if (this.xPosition == TimePeriodAnchor.END) {
        result = period.getLastMillisecond();
    }
    return result;
}
项目:parabuild-ci    文件:TimeSeriesCollectionTests.java   
/**
 * Test the getSurroundingItems() method to ensure it is returning the values we expect.
 */
public void testGetSurroundingItems() {

    final TimeSeries series = new TimeSeries("Series 1", Day.class);
    final TimeSeriesCollection collection = new TimeSeriesCollection(series);
    collection.setXPosition(TimePeriodAnchor.MIDDLE);

    // for a series with no data, we expect {-1, -1}...
    int[] result = collection.getSurroundingItems(0, 1000L);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == -1);

    // now test with a single value in the series...
    final Day today = new Day();
    final long start1 = today.getFirstMillisecond();
    final long middle1 = today.getMiddleMillisecond();
    final long end1 = today.getLastMillisecond();

    series.add(today, 99.9);
    result = collection.getSurroundingItems(0, start1);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, middle1);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, end1);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == -1);

    // now add a second value to the series...
    final Day tomorrow = (Day) today.next();
    final long start2 = tomorrow.getFirstMillisecond();
    final long middle2 = tomorrow.getMiddleMillisecond();
    final long end2 = tomorrow.getLastMillisecond();

    series.add(tomorrow, 199.9);
    result = collection.getSurroundingItems(0, start2);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 1);

    result = collection.getSurroundingItems(0, middle2);
    assertTrue(result[0] == 1);
    assertTrue(result[1] == 1);

    result = collection.getSurroundingItems(0, end2);
    assertTrue(result[0] == 1);
    assertTrue(result[1] == -1);

    // now add a third value to the series...
    final Day yesterday = (Day) today.previous();
    final long start3 = yesterday.getFirstMillisecond();
    final long middle3 = yesterday.getMiddleMillisecond();
    final long end3 = yesterday.getLastMillisecond();

    series.add(yesterday, 1.23);
    result = collection.getSurroundingItems(0, start3);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, middle3);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, end3);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 1);

}
项目:parabuild-ci    文件:TimePeriodAnchorTests.java   
/**
 * Test the equals() method.
 */
public void testEquals() {
    assertTrue(TimePeriodAnchor.START.equals(TimePeriodAnchor.START));
    assertTrue(TimePeriodAnchor.MIDDLE.equals(TimePeriodAnchor.MIDDLE));
    assertTrue(TimePeriodAnchor.END.equals(TimePeriodAnchor.END));
}
项目:parabuild-ci    文件:TimeSeriesCollectionTests.java   
/**
 * Test the getSurroundingItems() method to ensure it is returning the 
 * values we expect.
 */
public void testGetSurroundingItems() {

    TimeSeries series = new TimeSeries("Series 1", Day.class);
    TimeSeriesCollection collection = new TimeSeriesCollection(series);
    collection.setXPosition(TimePeriodAnchor.MIDDLE);

    // for a series with no data, we expect {-1, -1}...
    int[] result = collection.getSurroundingItems(0, 1000L);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == -1);

    // now test with a single value in the series...
    Day today = new Day();
    long start1 = today.getFirstMillisecond();
    long middle1 = today.getMiddleMillisecond();
    long end1 = today.getLastMillisecond();

    series.add(today, 99.9);
    result = collection.getSurroundingItems(0, start1);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, middle1);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, end1);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == -1);

    // now add a second value to the series...
    Day tomorrow = (Day) today.next();
    long start2 = tomorrow.getFirstMillisecond();
    long middle2 = tomorrow.getMiddleMillisecond();
    long end2 = tomorrow.getLastMillisecond();

    series.add(tomorrow, 199.9);
    result = collection.getSurroundingItems(0, start2);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 1);

    result = collection.getSurroundingItems(0, middle2);
    assertTrue(result[0] == 1);
    assertTrue(result[1] == 1);

    result = collection.getSurroundingItems(0, end2);
    assertTrue(result[0] == 1);
    assertTrue(result[1] == -1);

    // now add a third value to the series...
    Day yesterday = (Day) today.previous();
    long start3 = yesterday.getFirstMillisecond();
    long middle3 = yesterday.getMiddleMillisecond();
    long end3 = yesterday.getLastMillisecond();

    series.add(yesterday, 1.23);
    result = collection.getSurroundingItems(0, start3);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, middle3);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, end3);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 1);

}
项目:parabuild-ci    文件:TimePeriodAnchorTests.java   
/**
 * Test the equals() method.
 */
public void testEquals() {
    assertTrue(TimePeriodAnchor.START.equals(TimePeriodAnchor.START));
    assertTrue(TimePeriodAnchor.MIDDLE.equals(TimePeriodAnchor.MIDDLE));
    assertTrue(TimePeriodAnchor.END.equals(TimePeriodAnchor.END));
}
项目:WS-Attacker    文件:ChartObject.java   
private synchronized XYDataset createDatasetResponseTime( String type )
{

    Map<Integer, LogEntryInterval> currentMap = null;
    String name = null;
    if ( type.equals( "tampered" ) )
    {
        currentMap = model.getMapLogEntryIntervalTampered();
        name = "Mean Response Time Tampered Requests"; // Roundtrip Time
    }
    else if ( type.equals( "untampered" ) )
    {
        currentMap = model.getMapLogEntryIntervalUntampered();
        name = "Mean Response Time Untampered Requests"; // Roundtrip Time
    }
    else if ( type.equals( "testprobe" ) )
    {
        currentMap = model.getMapLogEntryIntervalTestProbe();
        name = "Mean Response Time Simulated 3rd Party Requests"; // Roundtrip
                                                                  // Time
    }
    else
    {
    }

    Date currentDate;
    long currentMsTs;
    final TimeSeries series = new TimeSeries( name );
    if ( currentMap != null )
    {
        for ( Map.Entry<Integer, LogEntryInterval> log : currentMap.entrySet() )
        {
            // Create TS from model.startTime and log.getIntervalNumber();
            currentMsTs = model.getTsAttackStart() + log.getValue().getIntervalNumber();
            currentDate = new Date( currentMsTs );
            // System.out.println(name+" Sekunde"+log.getValue().getIntervalNumber()+" TS: "+currentMsTs+" time "+log.getValue().getMeanResponseTime());
            series.add( new Second( currentDate ), ( log.getValue().getMeanResponseTime() ) );
        }
    }

    final TimeSeriesCollection dataset = new TimeSeriesCollection( series );
    dataset.setXPosition( TimePeriodAnchor.MIDDLE );

    return dataset;
}
项目:nabs    文件:TimeSeriesCollectionTests.java   
/**
 * Test the getSurroundingItems() method to ensure it is returning the 
 * values we expect.
 */
public void testGetSurroundingItems() {

    TimeSeries series = new TimeSeries("Series 1", Day.class);
    TimeSeriesCollection collection = new TimeSeriesCollection(series);
    collection.setXPosition(TimePeriodAnchor.MIDDLE);

    // for a series with no data, we expect {-1, -1}...
    int[] result = collection.getSurroundingItems(0, 1000L);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == -1);

    // now test with a single value in the series...
    Day today = new Day();
    long start1 = today.getFirstMillisecond();
    long middle1 = today.getMiddleMillisecond();
    long end1 = today.getLastMillisecond();

    series.add(today, 99.9);
    result = collection.getSurroundingItems(0, start1);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, middle1);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, end1);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == -1);

    // now add a second value to the series...
    Day tomorrow = (Day) today.next();
    long start2 = tomorrow.getFirstMillisecond();
    long middle2 = tomorrow.getMiddleMillisecond();
    long end2 = tomorrow.getLastMillisecond();

    series.add(tomorrow, 199.9);
    result = collection.getSurroundingItems(0, start2);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 1);

    result = collection.getSurroundingItems(0, middle2);
    assertTrue(result[0] == 1);
    assertTrue(result[1] == 1);

    result = collection.getSurroundingItems(0, end2);
    assertTrue(result[0] == 1);
    assertTrue(result[1] == -1);

    // now add a third value to the series...
    Day yesterday = (Day) today.previous();
    long start3 = yesterday.getFirstMillisecond();
    long middle3 = yesterday.getMiddleMillisecond();
    long end3 = yesterday.getLastMillisecond();

    series.add(yesterday, 1.23);
    result = collection.getSurroundingItems(0, start3);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, middle3);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, end3);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 1);

}
项目:nabs    文件:TimePeriodAnchorTests.java   
/**
 * Test the equals() method.
 */
public void testEquals() {
    assertTrue(TimePeriodAnchor.START.equals(TimePeriodAnchor.START));
    assertTrue(TimePeriodAnchor.MIDDLE.equals(TimePeriodAnchor.MIDDLE));
    assertTrue(TimePeriodAnchor.END.equals(TimePeriodAnchor.END));
}
项目:astor    文件:TimeSeriesCollectionTests.java   
/**
 * Test the getSurroundingItems() method to ensure it is returning the
 * values we expect.
 */
public void testGetSurroundingItems() {

    TimeSeries series = new TimeSeries("Series 1");
    TimeSeriesCollection collection = new TimeSeriesCollection(series);
    collection.setXPosition(TimePeriodAnchor.MIDDLE);

    // for a series with no data, we expect {-1, -1}...
    int[] result = collection.getSurroundingItems(0, 1000L);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == -1);

    // now test with a single value in the series...
    Day today = new Day();
    long start1 = today.getFirstMillisecond();
    long middle1 = today.getMiddleMillisecond();
    long end1 = today.getLastMillisecond();

    series.add(today, 99.9);
    result = collection.getSurroundingItems(0, start1);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, middle1);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, end1);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == -1);

    // now add a second value to the series...
    Day tomorrow = (Day) today.next();
    long start2 = tomorrow.getFirstMillisecond();
    long middle2 = tomorrow.getMiddleMillisecond();
    long end2 = tomorrow.getLastMillisecond();

    series.add(tomorrow, 199.9);
    result = collection.getSurroundingItems(0, start2);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 1);

    result = collection.getSurroundingItems(0, middle2);
    assertTrue(result[0] == 1);
    assertTrue(result[1] == 1);

    result = collection.getSurroundingItems(0, end2);
    assertTrue(result[0] == 1);
    assertTrue(result[1] == -1);

    // now add a third value to the series...
    Day yesterday = (Day) today.previous();
    long start3 = yesterday.getFirstMillisecond();
    long middle3 = yesterday.getMiddleMillisecond();
    long end3 = yesterday.getLastMillisecond();

    series.add(yesterday, 1.23);
    result = collection.getSurroundingItems(0, start3);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, middle3);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, end3);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 1);

}
项目:astor    文件:TimePeriodAnchorTests.java   
/**
 * Test the equals() method.
 */
public void testEquals() {
    assertTrue(TimePeriodAnchor.START.equals(TimePeriodAnchor.START));
    assertTrue(TimePeriodAnchor.MIDDLE.equals(TimePeriodAnchor.MIDDLE));
    assertTrue(TimePeriodAnchor.END.equals(TimePeriodAnchor.END));
}