com.clarkparsia.pellet.datatypes
Class UnionDataRange<T>

java.lang.Object
  extended by com.clarkparsia.pellet.datatypes.UnionDataRange<T>
All Implemented Interfaces:
DataRange<T>

public class UnionDataRange<T>
extends java.lang.Object
implements DataRange<T>

Title: Union data range

Description: A disjunction of DataRange objects

Copyright: Copyright (c) 2009

Company: Clark & Parsia, LLC.

Author:
Mike Smith

Constructor Summary
UnionDataRange(java.util.Collection<RestrictedDatatype<? extends T>> ranges, java.util.Collection<? extends T> values)
           
 
Method Summary
 boolean contains(java.lang.Object value)
          Check if a data range contains a particular value
 boolean containsAtLeast(int n)
          Check that a data range contains a minimum number of elements
 T getValue(int i)
          Return a value from an enumerable data range.
 boolean isEmpty()
          Convenience method equivalent to !containsAtLeast(0)
 boolean isEnumerable()
          Query if values in the data range can be enumerated.
 boolean isFinite()
          Query if there are a finite number of values in the data range.
 int size()
          Return the size of the data range.
 java.util.Iterator<T> valueIterator()
          Get a (possibly infinite) iterator over values in the data range.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnionDataRange

public UnionDataRange(java.util.Collection<RestrictedDatatype<? extends T>> ranges,
                      java.util.Collection<? extends T> values)
Method Detail

contains

public boolean contains(java.lang.Object value)
Description copied from interface: DataRange
Check if a data range contains a particular value

Specified by:
contains in interface DataRange<T>
Parameters:
value - the value to check
Returns:
true if the data range contains value, false else

containsAtLeast

public boolean containsAtLeast(int n)
Description copied from interface: DataRange
Check that a data range contains a minimum number of elements

Specified by:
containsAtLeast in interface DataRange<T>
Parameters:
n - the number of elements
Returns:
true if the data range contains n or more elements, false otherwise

getValue

public T getValue(int i)
Description copied from interface: DataRange
Return a value from an enumerable data range. Necessary to support LiteralValueBranch shiftTryNext

Specified by:
getValue in interface DataRange<T>
Parameters:
i - the index of the value in the data range
Returns:
the value

isEmpty

public boolean isEmpty()
Description copied from interface: DataRange
Convenience method equivalent to !containsAtLeast(0)

Specified by:
isEmpty in interface DataRange<T>
Returns:
true if the data range contains no elements, false otherwise

isEnumerable

public boolean isEnumerable()
Description copied from interface: DataRange
Query if values in the data range can be enumerated.

Specified by:
isEnumerable in interface DataRange<T>
Returns:
true if the data range is enumerable, false otherwise

isFinite

public boolean isFinite()
Description copied from interface: DataRange
Query if there are a finite number of values in the data range.

Specified by:
isFinite in interface DataRange<T>
Returns:
true if the data range is finite, false otherwise

size

public int size()
Description copied from interface: DataRange
Return the size of the data range. Necessary to support LiteralValueBranch constructor

Specified by:
size in interface DataRange<T>
Returns:
the size of the data range

valueIterator

public java.util.Iterator<T> valueIterator()
Description copied from interface: DataRange
Get a (possibly infinite) iterator over values in the data range.

Specified by:
valueIterator in interface DataRange<T>
Returns:
an Iterator


Copyright © 2004 Evren Sirin. All Rights Reserved.