Package srsim.persistence

Examples of srsim.persistence.SimulationRecord


      throws InstantiationException, IllegalAccessException,
      ClassNotFoundException, SQLException {

    DerbyEmbeddedDS ds = new DerbyEmbeddedDS();

    SimulationRecord record = new SimulationRecord();
    record.setBrightness(100.0D);
    record.setTemperature(15.0D);
    record.setEnergyConsumption(1400.0D);
    record.setTimeStamp(System.currentTimeMillis());
    ds.persist(record);
    Criterion criterion = new Criterion("temperature").lessEqual("20").and(
        new Criterion("brightness").lessThan("10000"));
    List<SimulationRecord> storedRecords = ds.find(criterion);
    Assert.assertFalse(storedRecords.isEmpty());
View Full Code Here


  @Test
  public void testDeletingRecord() throws InstantiationException,
      IllegalAccessException, ClassNotFoundException, SQLException {
    DerbyEmbeddedDS ds = new DerbyEmbeddedDS();
    SimulationRecord record = new SimulationRecord();
    record.setBrightness(42.0D);
    record.setTemperature(42.0D);
    record.setEnergyConsumption(42.0D);
    long timeStamp = System.currentTimeMillis();
    record.setTimeStamp(timeStamp);
    ds.persist(record);
    Criterion criterion = new Criterion("timestamp").equal(String.valueOf(timeStamp));
    List<SimulationRecord> storedRecords = ds.find(criterion);
    Assert.assertFalse(storedRecords.isEmpty());
    record = storedRecords.get(0);
View Full Code Here

    tracking = true;
    try {
      while (tracking) {
        synchronized (recordQueue) {
          if (!recordQueue.isEmpty()) {
            SimulationRecord record = recordQueue.poll();
            dataStore.persist(record);
          } else if (tracking) {
            recordQueue.wait();
          }
        }
View Full Code Here

  }

  @Override
  public void handleContextChange(final ContextChangedEvent event)
      throws SimulationContextException {
    SimulationRecord record = new SimulationRecord();
    SimulationContext context = event.getContext();
    record.setRoomId(context.getRoom().getName());
    record.setBrightness(context.getBrightness());
    record.setEnergyConsumption(context.getEnergyConsumption());
    record.setTemperature(context.getTemperature());
    record.setTimeStamp(event.getTimeStamp());
    record.setLightColor(context.getLightColor());
    record.setMudicGenre(context.getMusicGenre());
    record.setMusicVolume(context.getMusicVolume());
    synchronized (recordQueue) {
      recordQueue.add(record);
      recordQueue.notify();
    }
  }
View Full Code Here

TOP

Related Classes of srsim.persistence.SimulationRecord

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.