Package lupos.datastructures.items

Examples of lupos.datastructures.items.TimestampedTriple


    } else {
      if (this.start == -1){
        this.start = 0;
      }
    }
    final TimestampedTriple t = new TimestampedTriple(triple, (new Date()).getTime());
    this.triplesInWindow[this.end] = t;
    this.end = (this.end + 1) % this.numberOfTriples;
    super.consume(t);
  }
View Full Code Here


    } else {
      if (this.start == -1){
        this.start = 0;
      }
    }
    final TimestampedTriple t = new TimestampedTriple(triple, (new Date())
        .getTime());
    this.triplesInWindow[this.end] = t;
    this.end = (this.end + 1) % this.numberOfTriples;
    super.consumeDebug(t, debugstep);
  }
View Full Code Here

    return message;
  }

  @Override
  public void consume(final Triple triple) {
    final TimestampedTriple t = new TimestampedTriple(triple, (new Date()).getTime());
   
    if(isMatchingTypeTriple(t)) {
      super.consume(t);
     
      // search for triples with same subject to consume
      for(Triple tmp : this.tripleBuffer) {
        if(haveSameSubject(tmp,t)) {
          super.consume(tmp);
        }
      }
     
      // add type triple to extra buffer     
      this.typeTripleBuffer.addLast(t);
    } else {
      // consume triple if a type-triple with same subject exists
      for(Triple tmp : this.typeTripleBuffer) {
        if(haveSameSubject(tmp,t)) {
          super.consume(t);
          break;
        }
      }
    }
   
    this.tripleBuffer.addLast(t);
   
    // remove all instances where the type-triple is too old
    long now = t.getTimestamp();
    int index = 0;
    for(TimestampedTriple tmp : this.typeTripleBuffer) {
      if (now - tmp.getTimestamp() >= this.duration) {
        deleteInstance(tmp);
        index++;
View Full Code Here

    this.tripleBuffer.addLast(t);
  }
 
  @Override
  public void consumeDebug(final Triple triple, final DebugStep debugstep) {
    final TimestampedTriple t = new TimestampedTriple(triple, (new Date()).getTime());
   
    if(isMatchingTypeTriple(t)) {
      super.consumeDebug(t, debugstep);
     
      // search for triples with same subject to consume
      for(Triple tmp : this.tripleBuffer) {
        if(haveSameSubject(tmp,t)) {
          super.consumeDebug(tmp, debugstep);
        }
      }
     
      // add type triple to extra buffer     
      this.typeTripleBuffer.addLast(t);
    } else {
      // consume triple if a type-triple with same subject exists
      for(Triple tmp : this.typeTripleBuffer) {
        if(haveSameSubject(tmp,t)) {
          super.consumeDebug(t, debugstep);
          break;
        }
      }
    }
   
    this.tripleBuffer.addLast(t);
   
    // remove all instances where the type-triple is too old
    long now = t.getTimestamp();
    int index = 0;
    for(TimestampedTriple tmp : this.typeTripleBuffer) {
      if (now - tmp.getTimestamp() >= this.duration) {
        deleteInstanceDebug(tmp, debugstep);
        index++;
View Full Code Here

    return message;
  }

  @Override
  public void consume(final Triple triple) {
    final TimestampedTriple timestampedTriple = (TimestampedTriple) triple;
    final long now = timestampedTriple.getTimestamp();
    int index = 0;
    for (final TimestampedTriple t : this.tripleList) {
      if (now - t.getTimestamp() >= this.duration) {
        this.deleteTriple(t);
        index++;
View Full Code Here

    super.consume(timestampedTriple);
  }
 
  @Override
  public void consumeDebug(final Triple triple, final DebugStep debugstep) {
    final TimestampedTriple timestampedTriple = (TimestampedTriple) triple;
    final long now = timestampedTriple.getTimestamp();
    int index = 0;
    for (final TimestampedTriple t : this.tripleList) {
      if (now - t.getTimestamp() >= this.duration) {
        this.deleteTripleDebug(t, debugstep);
        index++;
View Full Code Here

  }

  @Override
  public void consume(final Triple triple) {
    for (final OperatorIDTuple oid : this.getSucceedingOperators()) {
      ((TripleConsumer) oid.getOperator()).consume(new TimestampedTriple(
          triple, (new Date()).getTime()));
    }
  }
View Full Code Here

  }
 
  @Override
  public void consumeDebug(final Triple triple, final DebugStep debugstep) {
    for (final OperatorIDTuple oid : this.getSucceedingOperators()) {
      final TimestampedTriple timestampedTriple = new TimestampedTriple(
          triple, (new Date()).getTime());
      debugstep.step(this, oid.getOperator(), timestampedTriple);
      ((TripleOperator) oid.getOperator()).consumeDebug(
          timestampedTriple, debugstep);
    }
View Full Code Here

    return message;
  }

  @Override
  public void consume(final Triple triple) {
    final TimestampedTriple t = new TimestampedTriple(triple, (new Date()).getTime());
   
    if(isMatchingTypeTriple(t)) {
      // consume type-triple
      super.consume(t);
     
      // search for triples with same subject to consume
      for(Triple tmp : this.tripleBuffer) {
        if(haveSameSubject(tmp,t)) {
          super.consume(tmp);
        }
      }
     
      // add type triple to extra buffer     
      this.typeTripleBuffer.addLast(t);
     
      // keep only the last n type-triples
      if(this.typeTripleBuffer.size() > this.numberOfInstances) {
        TimestampedTriple removedTypeTriple = this.typeTripleBuffer.removeFirst();
       
        // delete old triples
        // 1. delete instance of the removed type-triple
        this.deleteInstance(removedTypeTriple);
        // 2. delete all triples that are at least as old as the removed type-triple
        while(!this.tripleBuffer.isEmpty() && this.tripleBuffer.peekFirst().getTimestamp() <= removedTypeTriple.getTimestamp()) {
          TimestampedTriple tmp = this.tripleBuffer.removeFirst();
          //System.out.println("delete: " + tmp.toString());
          super.deleteTriple(tmp);
        }
      }   
    } else {
View Full Code Here

  }
 
 
  @Override
  public void consumeDebug(final Triple triple, final DebugStep debugstep) {
    final TimestampedTriple t = new TimestampedTriple(triple, (new Date()).getTime());
   
    if(isMatchingTypeTriple(t)) {
      // consume type-triple
      super.consumeDebug(t, debugstep);
     
      // search for triples with same subject to consume
      for(Triple tmp : this.tripleBuffer) {
        if(haveSameSubject(tmp,t)) {
          super.consumeDebug(tmp, debugstep);
        }
      }
     
      // add type triple to extra buffer     
      this.typeTripleBuffer.addLast(t);
     
      // keep only the last n type-triples
      if(this.typeTripleBuffer.size() > this.numberOfInstances) {
        TimestampedTriple removedTypeTriple = this.typeTripleBuffer.removeFirst();
       
        // delete old triples
        // 1. delete instance of the removed type-triple
        this.deleteInstanceDebug(removedTypeTriple, debugstep);
        // 2. delete all triples that are at least as old as the removed type-triple
        while(!this.tripleBuffer.isEmpty() && this.tripleBuffer.peekFirst().getTimestamp() <= removedTypeTriple.getTimestamp()) {
          TimestampedTriple tmp = this.tripleBuffer.removeFirst();
          //System.out.println("delete: " + tmp.toString());
          super.deleteTripleDebug(tmp, debugstep);
        }
      }   
    } else {
View Full Code Here

TOP

Related Classes of lupos.datastructures.items.TimestampedTriple

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.