Examples of Interval


Examples of it.unimi.dsi.util.Interval

      }
    }
   
    public Interval nextInterval() {
      if ( next != null ) {
        final Interval result = next;
        next = null;
        return result;
      }

      if ( endOfProcess ) return null;
View Full Code Here

Examples of it.unimi.dsi.util.Interval

          secondIterator.next()
          /** Compare position IntIterator*/
          IntervalIterator firstIntervalIt = firstIterator.intervalIterator(firstIndex);
          IntervalIterator secondIntervalIt = secondIterator.intervalIterator(secondIndex);
          while(firstIntervalIt.hasNext()){             
            Interval firstIntv = firstIntervalIt.nextInterval();
            Interval secondIntv = secondIntervalIt.nextInterval();
           
            System.out.println("left:" +  firstIntv.left + "   " + "right:" + firstIntv.right);
            Assert.assertEquals(firstIntv.left,secondIntv.left);
            Assert.assertEquals(firstIntv.right,secondIntv.right);
          }                 
View Full Code Here

Examples of it.unimi.dsi.util.Interval

      minuendIntervalIterator.intervalTerms( terms );
    }
   
    public Interval nextInterval() throws IOException {
      if ( next != null ) {
        final Interval result = next;
        next = null;
        return result;
      }
     
      if ( subtrahendInterval == Intervals.MINUS_INFINITY ) subtrahendInterval = subtrahendIntervalIterator.nextInterval();
     
      Interval minuendInterval;
      while( ( minuendInterval = minuendIntervalIterator.nextInterval() ) != null ) {
          whilesubtrahendInterval != null &&
              subtrahendInterval.left - leftMargin < minuendInterval.left &&
              subtrahendInterval.right + rightMargin < minuendInterval.right )
            subtrahendInterval = subtrahendIntervalIterator.nextInterval();
View Full Code Here

Examples of it.unimi.dsi.util.Interval

      for( int i = frontSize; i-- != 0; ) intervalIterator[ intervalFront[ i ] ].intervalTerms( terms );
    }
   
    public Interval nextInterval () throws IOException {
      if ( next != null ) {
        final Interval result = next;
        next = null;
        return result;
      }

      if ( intervalQueue.isEmpty() ) return null;
View Full Code Here

Examples of it.unimi.dsi.util.Interval

      for( int i = frontSize; i-- != 0; ) terms.add( indexIterator[ positionFront[ i ] ].termNumber() );
    }
   
    public Interval nextInterval() {
      if ( next != null ) {
        final Interval result = next;
        next = null;
        return result;
      }
     
      if ( positionQueue.isEmpty() ) return null;
View Full Code Here

Examples of it.unimi.dsi.util.Interval

  public double score( final Index index ) throws IOException {
    final IntervalIterator it = documentIterator.intervalIterator( index );
    if ( it == IntervalIterators.TRUE || it == IntervalIterators.FALSE ) return 0;
    double score = 0, residual = 1, t;
    int extent = it.extent(), length;
    Interval interval;
    while ( ( interval = it.nextInterval() ) != null ) {
      length = interval.length();
      t = residual * Math.min( (double)extent / length, 1 ) / 2;
      residual -= t;
      score += t;
      if ( score > .99 ) return 1;
    }
View Full Code Here

Examples of it.unimi.dsi.util.Interval

  public double score( final Index index ) throws IOException {
    final IntervalIterator it = documentIterator.intervalIterator( index );
    if ( it == IntervalIterators.TRUE || it == IntervalIterators.FALSE ) return 0;
    double result = 0;
    int lt, count = 0;
    Interval interval;
    while ( ( interval = it.nextInterval() ) != null ) {
      count++;
      lt = interval.length();
      if ( lt < h ) result += 1;
      else result += Math.pow( h / (double) lt, alpha );
    }
    return normalize? result / count : result;
  }
View Full Code Here

Examples of it.unimi.dsi.util.Interval

    /* We reset the interval set, add the sentinels and the (certainly existing) first interval.
     * If the first interval is too long, we shorten it. */
    leftOrderedIntervals.add( INIT[ 0 ] );
    leftOrderedIntervals.add( INIT[ 1 ] );

    Interval interval;
    interval = shortIntervals.dequeue();
    if ( interval.length() < intervalMaxLength ) leftOrderedIntervals.add( new SelectedInterval( interval, IntervalType.WHOLE ) );
    else {
      leftOrderedIntervals.add( new SelectedInterval( Interval.valueOf( interval.left, interval.left + intervalMaxLength / 2 ), IntervalType.PREFIX ) );
      leftOrderedIntervals.add( new SelectedInterval( Interval.valueOf( interval.right - intervalMaxLength / 2, interval.right ), IntervalType.SUFFIX ) );
    }

    /* We now iteratively extract intervals from the queue, check that they do not overlap
     * any interval already chosen, and in case add it to the set of chosen intervals. */
    //System.err.println( "Starting with " + shortIntervals.size() + " intervals");
   
    ObjectBidirectionalIterator<SelectedInterval> iterator;
    SelectedInterval left, right;
    while( leftOrderedIntervals.size() - INIT.length < maxIntervals && ! shortIntervals.isEmpty() ) {
      //System.err.println( "Map is now: " + leftOrderedIntervals );
      interval = shortIntervals.dequeue();
      // If all remaining intervals are too large, stop iteration.
      if ( interval.length() > intervalMaxLength ) break;
     
      // This iterator falls exactly in the middle of the intervals preceding and following interval.
      iterator = leftOrderedIntervals.iterator( new SelectedInterval( interval, null ) );
      iterator.previous();
      left = iterator.next();
View Full Code Here

Examples of jflex.Interval

        int end = propertyIntervals.codePointAt(index);
        index += (end <= 0xFFFF ? 1 : 2);
        //TODO: Remove BMP boundary condition
        if (start <= 0xFFFF) {
          //TODO: Change the character type from char to int and remove boundary condition
          set.add(new Interval((char)start, (char)Math.min(end, 0xFFFF)));
        }
      }
      propertyValueIntervals.put(propertyValue, set);
      if (2 == propertyValue.length()) {
        String singleLetter = propertyValue.substring(0, 1);
View Full Code Here

Examples of jmathexpr.number.set.Interval

    }
   
    @Test(dependsOnMethods = { "testFunctions" })
    public void testIntervals() {
        Expression contains, evaluated;
        Interval interval = new Interval(true, N.create(0), N.create(1), true); // [0, 1]
        System.out.printf("%s%n", interval);

        contains = new ElementOf(R.create(-1), interval);
        evaluated = contains.evaluate();
        System.out.printf("  %s : %s%n", contains, evaluated);
        assertEquals(evaluated, TruthValue.False);
       
        contains = new ElementOf(R.create(0), interval);
        evaluated = contains.evaluate();       
        System.out.printf("  %s : %s%n", contains, evaluated);
        assertEquals(evaluated, TruthValue.True);
       
        interval = new Interval(false, N.create(0), N.create(1), true); // (0, 1]
        System.out.printf("%s%n", interval);
       
        contains = new ElementOf(R.create(0), interval);
        evaluated = contains.evaluate();
        System.out.printf("  %s : %s%n", contains, evaluated);
        assertEquals(evaluated, TruthValue.False);
       
        contains = new ElementOf(Z.create(13), interval);
        evaluated = contains.evaluate();
        System.out.printf("  %s : %s%n", contains, evaluated);
        assertEquals(evaluated, TruthValue.False);
       
        interval = new Interval(false, N.create(0), Infinity.PLUS_INFINITY, false); // (0, inf)
        System.out.printf("%s%n", interval);

        contains = new ElementOf(R.create(3.14), interval);
        evaluated = contains.evaluate();
        System.out.printf("  %s : %s%n", contains, evaluated);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.