Package com.clarkparsia.pellet.datatypes.types.real

Examples of com.clarkparsia.pellet.datatypes.types.real.IntegerInterval


* @author Mike Smith
*/
public class IntegerIntervalTests {

  public static IntegerInterval interval(Integer l, Integer u) {
    return new IntegerInterval( l, u );
  }
View Full Code Here


  /**
   * Test getting a sub-interval greater than an integer on an integer line.
   */
  @Test
  public void greater1() {
    final IntegerInterval i = interval( 1, 5 );
    assertEquals( interval( 3, 5 ), i.greater( 2 ) );
  }
View Full Code Here

   * Test getting a sub-interval greater than the lower endpoint of an integer
   * line.
   */
  @Test
  public void greater2() {
    final IntegerInterval i = interval( 1, 5 );
    assertEquals( interval( 2, 5 ), i.greater( 1 ) );
  }
View Full Code Here

  /**
   * Verify that endpoints are contained within the interval.
   */
  @Test
  public void inclusiveEndpoints() {
    final IntegerInterval interval = interval( -1, 3 );
    assertTrue( interval.contains( -1 ) );
    assertTrue( interval.contains( 3 ) );
    assertTrue( interval.contains( 0 ) );
  }
View Full Code Here

   * Verify that if no overlap exists between the bounds an empty intersection
   * is identified
   */
  @Test
  public void intersectionEmpty() {
    final IntegerInterval a = interval( null, 0 );
    final IntegerInterval b = interval( 1, null );

    assertNull( a.intersection( b ) );
    assertNull( b.intersection( a ) );
  }
View Full Code Here

   * Verify that intervals overlapping just on an inclusive bound intersect to
   * a point.
   */
  @Test
  public void intersectionPoint() {
    final IntegerInterval a = interval( null, 2 );
    final IntegerInterval b = interval( 2, null );

    final IntegerInterval expected = new IntegerInterval( Integer.valueOf( 2 ) );

    assertEquals( expected, a.intersection( b ) );
    assertEquals( expected, b.intersection( a ) );

    assertTrue( a.intersection( b ).contains( Integer.valueOf( 2 ) ) );
View Full Code Here

  /**
   * Test getting a sub-interval less than an integer.
   */
  @Test
  public void less1() {
    final IntegerInterval i = interval( 1, 5 );
    assertEquals( interval( 1, 3 ), i.less( 4 ) );
  }
View Full Code Here

  /**
   * Test getting a sub-interval less than the upper endpoint of an interval
   */
  @Test
  public void less2() {
    final IntegerInterval i = interval( 1, 5 );
    assertEquals( interval( 1, 4 ), i.less( 5 ) );
  }
View Full Code Here

    assertEquals( interval( 1, 4 ), i.less( 5 ) );
  }

  @Test
  public void unboundContainsAll() {
    final IntegerInterval interval = new IntegerInterval( null, null );

    assertTrue( interval.contains( -1 ) );
    assertTrue( interval.contains( 0 ) );
    assertTrue( interval.contains( 1 ) );
    assertTrue( interval.contains( Long.MAX_VALUE ) );
    assertTrue( interval.contains( BigInteger.valueOf( Long.MAX_VALUE ).multiply(
        BigInteger.TEN ) ) );
  }
View Full Code Here

TOP

Related Classes of com.clarkparsia.pellet.datatypes.types.real.IntegerInterval

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.