signature:
public class AbstractReasonerState { /** * Computes all direct instances of the supplied ( possibly complex ) class
 * expression . The query state is updated accordingly .
 * @ param classExpression
 * The queried class expression .
 * @ return all direct instances of the supplied class expression .
 * @ throws ElkInconsistentOntologyException
 * if the ontology is inconsistent
 * @ throws ElkException
 * if the reasoning process cannot be completed successfully */
protected Set < ? extends Node < ElkNamedIndividual > > queryDirectInstances ( final ElkClassExpression classExpression ) throws ElkInconsistentOntologyException , ElkException { } }

implementation:
final Set < ? extends Node < ElkNamedIndividual > > result ; if ( computeQuery ( classExpression , true ) ) { final InstanceTaxonomy < ElkClass , ElkNamedIndividual > taxonomy = instanceTaxonomyState . getTaxonomy ( ) ; final Set < ? extends Node < ElkNamedIndividual > > r = classExpressionQueryState_ . getDirectInstances ( classExpression , taxonomy ) ; if ( r == null ) { result = taxonomy . getBottomNode ( ) . getDirectInstanceNodes ( ) ; } else { result = r ; } } else { // classExpression couldn ' t be indexed ; pretend it is a fresh class
result = Collections . emptySet ( ) ; } incompleteness_ . log ( incompleteness_ . getIncompletenessMonitorForClassExpressionQuery ( classExpressionQueryState_ . getOccurrenceStore ( classExpression ) ) ) ; return result ;


signature:
public class AbstractReasonerState { /** * Decides whether the supplied { @ code axioms } are entailed by the currently
 * loaded ontology .
 * @ param axioms
 * Entailment of what axioms is queried .
 * @ return A map from each queried axiom to the
 * { @ link EntailmentQueryResult } for that axiom .
 * @ throws ElkException */
public synchronized Map < ElkAxiom , EntailmentQueryResult > isEntailed ( final Iterable < ? extends ElkAxiom > axioms ) throws ElkException { } }

implementation: entailmentQueryState_ . registerQueries ( axioms ) ; restoreSaturation ( ) ; stageManager . entailmentQueryStage . invalidateRecursive ( ) ; complete ( stageManager . entailmentQueryStage ) ; return entailmentQueryState_ . isEntailed ( axioms ) ;


signature:
public class AbstractReasonerState { /** * Decides whether the supplied { @ code axiom } is entailed by the currently
 * loaded ontology .
 * @ param axiom
 * The queries axiom .
 * @ return the { @ link EntailmentQueryResult } for the queried axiom .
 * @ throws ElkException */
public synchronized EntailmentQueryResult isEntailed ( final ElkAxiom axiom ) throws ElkException { } }

implementation: return isEntailed ( Collections . singleton ( axiom ) ) . get ( axiom ) ;


signature:
public class ContextImpl { /** * @ Override public boolean isInconsistForDisjointnessAxiom (
 * IndexedDisjointnessAxiom axiom ) { if ( disjointnessAxioms _ = = null ) return
 * false ; IndexedClassExpression [ ] positions = disjointnessAxioms _ . get ( axiom ) ;
 * if ( positions = = null ) return false ; / / check if both positions are not null ;
 * this is always when the second / / position is not null return ( positions [ 1]
 * ! = null ) ; } */
@ Override public Set < ? extends Integer > getSubsumerPositions ( IndexedClassExpressionList disjoint ) { } }

implementation: if ( disjointnessAxioms_ == null ) { return null ; } return disjointnessAxioms_ . get ( disjoint ) ;


signature:
public class ConsistencyCheckingState { /** * Removes from { @ link # toDoEntities _ } the entities which no longer occur in
 * the ontology or for the context is already saturated ( thus consistency is
 * already checked )
 * @ return the number of the remaining entries in { @ link # toDoEntities _ } */
private int pruneToDo ( ) { } }

implementation:
int size = 0 ; Iterator < IndexedClassEntity > itr = toDoEntities_ . iterator ( ) ; while ( itr . hasNext ( ) ) { IndexedClassEntity next = itr . next ( ) ; if ( ! next . occurs ( ) ) { itr . remove ( ) ; continue ; } // else
Context context = saturationState_ . getContext ( next ) ; if ( context != null && context . isSaturated ( ) ) { itr . remove ( ) ; } else { size ++ ; } } return size ;


signature:
public class ConsistencyCheckingState { /** * Explains why an ontology inconsistency is entailed . If it is not
 * entailed , the returned proof is empty .
 * @ param atMostOne
 * Whether at most one explanation should be returned .
 * @ return An evidence of entailment of ontology inconsistency . */
public Proof < ? extends EntailmentInference > getEvidence ( final boolean atMostOne ) { } }

implementation:
return new Proof < EntailmentInference > ( ) { @ SuppressWarnings ( "unchecked" ) @ Override public Collection < OntologyInconsistencyEntailmentInference > getInferences ( final Object conclusion ) { if ( ! OntologyInconsistencyImpl . INSTANCE . equals ( conclusion ) ) { return Collections . emptyList ( ) ; } // else
final Collection < ? extends IndexedIndividual > inconsistentIndividuals = getInconsistentIndividuals ( ) ; Iterable < OntologyInconsistencyEntailmentInference > result = Operations . map ( inconsistentIndividuals , INDIVIDUAL_TO_ENTAILMENT_INFERENCE ) ; int size = inconsistentIndividuals . size ( ) ; if ( isTopObjectPropertyInBottom_ ) { result = Operations . concat ( Operations . < OntologyInconsistencyEntailmentInference > singleton ( new TopObjectPropertyInBottomEntailsOntologyInconsistencyImpl ( conclusionFactory_ . getSubPropertyChain ( topProperty_ , bottomProperty_ ) ) ) , result ) ; size ++ ; } if ( isOwlThingInconsistent_ ) { result = Operations . concat ( Operations . < OntologyInconsistencyEntailmentInference > singleton ( new OwlThingInconsistencyEntailsOntologyInconsistencyImpl ( conclusionFactory_ . getContradiction ( owlThing_ ) ) ) , result ) ; size ++ ; } if ( atMostOne ) { final Iterator < OntologyInconsistencyEntailmentInference > iter = result . iterator ( ) ; if ( ! iter . hasNext ( ) ) { return Collections . emptyList ( ) ; } // else
return Collections . singleton ( iter . next ( ) ) ; } // else
return Operations . getCollection ( result , size ) ; } } ;


signature:
public class EntailmentQueryState { /** * Registers the supplied axioms for querying . If all necessary stages are
 * run after calling this method for some axioms , neither
 * { @ link # isEntailed ( Iterable ) } nor a
 * { @ link org . semanticweb . elk . reasoner . query . ProperEntailmentQueryResult
 * ProperEntailmentQueryResult } for any of these axioms will throw
 * { @ link ElkQueryException } .
 * @ param axioms
 * @ return { @ code true } if this is a new query , { @ code false } if this class
 * expression has already been registered . */
void registerQueries ( final Iterable < ? extends ElkAxiom > axioms ) { } }

implementation:
lastQueries_ . clear ( ) ; for ( final ElkAxiom axiom : axioms ) { LOGGER_ . trace ( "entailment query registered {}" , axiom ) ; lastQueries_ . add ( axiom ) ; QueryState state = queried_ . get ( axiom ) ; if ( state != null ) { queriedEvictor_ . add ( state ) ; continue ; } // Create query state .
state = new QueryState ( axiom ) ; queried_ . put ( axiom , state ) ; queriedEvictor_ . add ( state ) ; toLoad_ . offer ( axiom ) ; }


signature:
public class EntailmentQueryState { /** * Decides whether the supplied { @ code axioms } are entailed . If some of the
 * supplied axioms was not registered by { @ link # registerQueries ( Iterable ) } .
 * @ param axioms
 * Entailment of what axioms is queried .
 * @ return A map from each queried axiom to the result of entailment query
 * for that axiom .
 * @ param axioms
 * @ return
 * @ throws ElkQueryException
 * When some of the axioms was not registered by
 * { @ link # registerQueries ( Iterable ) } . */
Map < ElkAxiom , EntailmentQueryResult > isEntailed ( final Iterable < ? extends ElkAxiom > axioms ) throws ElkQueryException { } }

implementation:
final Map < ElkAxiom , EntailmentQueryResult > results = new ArrayHashMap < ElkAxiom , EntailmentQueryResult > ( ) ; for ( final ElkAxiom axiom : axioms ) { if ( ! EntailmentQueryConverter . isEntailmentCheckingSupported ( axiom . getClass ( ) ) ) { results . put ( axiom , new UnsupportedQueryTypeEntailmentQueryResultImpl ( axiom ) ) ; continue ; } // else
final QueryState state = queried_ . get ( axiom ) ; if ( state == null ) { throw new ElkQueryException ( "Query was not registered: " + axiom ) ; } // else
if ( state . indexed == null ) { results . put ( axiom , new UnsupportedIndexingEntailmentQueryResultImpl ( axiom ) ) ; continue ; } // else
state . lock ( ) ; results . put ( axiom , state ) ; } return results ;


signature:
public class AbstractReasonerStage { /** * Initialize the parameters of the computation for this stage ; this is the
 * first thing to be done before stage is executed
 * @ return { @ code true } if the operation is successful */
@ Override public boolean preExecute ( ) { } }

implementation: if ( isInitialized_ ) return false ; LOGGER_ . trace ( "{}: initialized" , this ) ; this . workerNo = reasoner . getNumberOfWorkers ( ) ; return isInitialized_ = true ;


signature:
public class AbstractReasonerStage { /** * Clear the parameters of the computation for this stage ; this is the last
 * thing to be done when the stage is executed *
 * @ return { @ code true } if the operation is successful */
@ Override public boolean postExecute ( ) { } }

implementation: if ( ! isInitialized_ ) return false ; LOGGER_ . trace ( "{}: done" , this ) ; this . isCompleted_ = true ; this . workerNo = 0 ; this . isInitialized_ = false ; return true ;


signature:
public class AbstractReasonerStage { /** * Marks this { @ link AbstractReasonerStage } as not completed ; this will
 * require its execution next time unless { @ link # setCompleted ( ) } is called
 * @ return { @ code true } if this stage was not invalidated and { @ code false }
 * if this stage was already invalidated before the call */
boolean invalidate ( ) { } }

implementation: if ( ! isCompleted_ && ! isInitialized_ ) { return false ; } LOGGER_ . trace ( "{}: invalidated" , this ) ; isCompleted_ = false ; isInitialized_ = false ; return true ;


signature:
public class AbstractReasonerStage { /** * Invalidates this stage and all subsequent stages if not already done so */
public void invalidateRecursive ( ) { } }

implementation: Queue < AbstractReasonerStage > toInvalidate_ = new LinkedList < AbstractReasonerStage > ( ) ; toInvalidate_ . add ( this ) ; AbstractReasonerStage next ; while ( ( next = toInvalidate_ . poll ( ) ) != null ) { if ( next . invalidate ( ) ) { for ( AbstractReasonerStage postStage : next . postStages_ ) { toInvalidate_ . add ( postStage ) ; } } }


signature:
public class NodeHasher { /** * Compute the hash for an entity node . This method implements a simple
 * cache for nodes with unusually large numbers of members . This mainly
 * covers the case where a huge number of classes is equal to owl : Nothing
 * due to modelling errors .
 * @ param node
 * @ return the has for the given entity node */
@ Override public int hash ( Node < ? extends ElkEntity > node ) { } }

implementation:
if ( node . size ( ) >= cacheNodeMemberNo ) { if ( hashCache . containsKey ( node ) ) { return hashCache . get ( node ) ; } // else
int hash = HashGenerator . combineMultisetHash ( true , node , elkEntityHasher ) ; hashCache . put ( node , hash ) ; return hash ; } // else
return HashGenerator . combineMultisetHash ( true , node , elkEntityHasher ) ;


signature:
public class InstanceTaxonomyState { /** * Prunes { @ link # toAdd _ } .
 * < strong > { @ code taxonomy _ } must not be { @ code null } ! < / strong >
 * @ return The resulting size of { @ link # toAdd _ } . */
private int pruneToAdd ( ) { } }

implementation:
final Iterator < IndexedIndividual > iter = toAdd_ . iterator ( ) ; int size = 0 ; while ( iter . hasNext ( ) ) { final IndexedIndividual ind = iter . next ( ) ; /* @ formatter : off
 * Should be pruned when :
 * it is not in ontology , or
 * it has types in taxonomy .
 * @ formatter : on */
if ( ! ind . occurs ( ) ) { iter . remove ( ) ; continue ; } // else
final Context context = saturationState_ . getContext ( ind ) ; if ( context == null || ! context . isInitialized ( ) || ! context . isSaturated ( ) ) { // it is not saturated .
size ++ ; continue ; } // else
final InstanceNode < ElkClass , ElkNamedIndividual > node = taxonomy_ . getInstanceNode ( ind . getElkEntity ( ) ) ; if ( node == null ) { // it is not in taxonomy
size ++ ; continue ; } // else
if ( ! node . getDirectTypeNodes ( ) . isEmpty ( ) ) { iter . remove ( ) ; continue ; } // else
size ++ ; } return size ;


signature:
public class InstanceTaxonomyState { /** * Returns collection that contains at least all individuals that are in
 * ontology , but either are removed from taxonomy or their type nodes in
 * taxonomy were removed .
 * @ return collection that contains at least all individuals that are in
 * ontology , but either are removed from taxonomy or their type
 * nodes in taxonomy were removed . */
Collection < IndexedIndividual > getToAdd ( ) { } }

implementation:
if ( taxonomy_ == null ) { // No individual can be pruned .
return toAdd_ ; } // else
final int size = pruneToAdd ( ) ; /* * since getting the size of the queue is a linear operation , use the
 * computed size */
return Operations . getCollection ( toAdd_ , size ) ;


signature:
public class InstanceTaxonomyState { /** * Prunes { @ link # toRemove _ } .
 * < strong > { @ code taxonomy _ } must not be { @ code null } ! < / strong >
 * @ return The resulting size of { @ link # toRemove _ } . */
private int pruneToRemove ( ) { } }

implementation:
final Iterator < IndexedIndividual > iter = toRemove_ . iterator ( ) ; int size = 0 ; while ( iter . hasNext ( ) ) { final IndexedIndividual cls = iter . next ( ) ; /* @ formatter : off
 * Should be pruned when
 * it is not in taxonomy .
 * @ formatter : on */
final InstanceNode < ElkClass , ElkNamedIndividual > node = taxonomy_ . getInstanceNode ( cls . getElkEntity ( ) ) ; if ( node == null ) { iter . remove ( ) ; continue ; } // else
size ++ ; } return size ;


signature:
public class InstanceTaxonomyState { /** * Returns collection that contains at least all individuals that are in
 * taxonomy , but either are removed from ontology or their context became
 * not saturated .
 * @ return collection that contains at least all individuals that are in
 * taxonomy , but either are removed from ontology or their context
 * became not saturated . */
Collection < IndexedIndividual > getToRemove ( ) { } }

implementation:
if ( taxonomy_ == null ) { // TODO : Never set taxonomy _ to null ! ! !
// no individuals are in taxonomy
toRemove_ . clear ( ) ; return Collections . emptyList ( ) ; } // else
final int size = pruneToRemove ( ) ; /* * since getting the size of the queue is a linear operation , use the
 * computed size */
return Operations . getCollection ( toRemove_ , size ) ;


signature:
public class ConcurrentInstanceTaxonomy { /** * Obtain a { @ link TypeNode } object for a given { @ link ElkClass } , or
 * { @ code null } if none assigned .
 * @ param individual
 * @ return instance node object for elkClass , possibly still incomplete */
@ Override public IndividualNode . Projection < ElkClass , ElkNamedIndividual > getInstanceNode ( final ElkNamedIndividual individual ) { } }

implementation: return individualNodeStore_ . getNode ( individual ) ;


signature:
public class AbstractBackwardLinkInference { /** * @ param factory
 * the factory for creating conclusions
 * @ return the conclusion produced by this inference */
public BackwardLink getConclusion ( BackwardLink . Factory factory ) { } }

implementation: return factory . getBackwardLink ( getDestination ( ) , conclusionRelation_ , conclusionSource_ ) ;


signature:
public class ElkReasoner { /** * Logs a warning message for unsupported OWL API method
 * @ param method
 * the method which is not supported
 * @ return the { @ link UnsupportedOperationException } saying that this method
 * is not supported */
private static UnsupportedOperationException unsupportedOwlApiMethod ( String method ) { } }

implementation:
String message = "OWL API reasoner method is not implemented: " + method + "." ; /* * TODO : The method String can be used to create more specific message
 * types , but with the current large amount of unsupported methods and
 * non - persistent settings for ignoring them , we better use only one
 * message type to make it easier to ignore them . */
LoggerWrap . log ( LOGGER_ , LogLevel . WARN , MARKER_UNSUPPORTED_METHOD_ , message ) ; return new UnsupportedOperationException ( message ) ;


signature:
public class ElkReasoner { /** * / * Methods required by the OWLReasoner interface */
@ Override public void dispose ( ) { } }

implementation: LOGGER_ . trace ( "dispose()" ) ; owlOntologymanager_ . removeOntologyChangeListener ( ontologyChangeListener_ ) ; owlOntologymanager_ . removeOntologyChangeProgessListener ( ontologyChangeProgressListener_ ) ; try { for ( ; ; ) { try { if ( ! reasoner_ . shutdown ( ) ) throw new ReasonerInternalException ( "Failed to shut down ELK!" ) ; break ; } catch ( InterruptedException e ) { continue ; } } } catch ( ElkRuntimeException e ) { throw elkConverter_ . convert ( e ) ; }


signature:
public class LinearProbing { /** * Computes the initial capacity of the table for storing elements . The
 * capacity is the largest power of two that does not exceed the given value
 * or { @ link # MAXIMUM _ CAPACITY } .
 * @ param capacity
 * the input value used as a guideline
 * @ return the largest power of two that does not exceed the given value or
 * { @ link # MAXIMUM _ CAPACITY } */
static int getInitialCapacity ( int capacity ) { } }

implementation:
if ( capacity < 0 ) throw new IllegalArgumentException ( "Illegal Capacity: " + capacity ) ; if ( capacity > LinearProbing . MAXIMUM_CAPACITY ) capacity = LinearProbing . MAXIMUM_CAPACITY ; // Find a power of 2 > = initialCapacity
int result = 1 ; while ( result < capacity ) result <<= 1 ; return result ;


signature:
public class LinearProbing { /** * Removes the element at the given position of the table shifting , if
 * necessary , other elements so that all elements can be found by linear
 * probing .
 * @ param d
 * the array of the elements
 * @ param pos
 * the position of data at which to delete the element */
static < E > void remove ( E [ ] d , int pos ) { } }

implementation:
for ( ; ; ) { int next = getMovedPosition ( d , pos ) ; E moved = d [ pos ] = d [ next ] ; if ( moved == null ) return ; // else
pos = next ; }


signature:
public class LinearProbing { /** * Removes the element at the given position of the table and the
 * corresponding value at the same position , shifting , if necessary , other
 * elements and values so that all elements can be found by linear probing .
 * @ param d
 * the array of the elements
 * @ param pos
 * the position of data at which to delete the element */
static < K , V > void remove ( K [ ] k , V [ ] v , int pos ) { } }

implementation:
for ( ; ; ) { int next = getMovedPosition ( k , pos ) ; K moved = k [ pos ] = k [ next ] ; v [ pos ] = v [ next ] ; if ( moved == null ) return ; // else
pos = next ; }


signature:
public class LinearProbing { /** * Finds the position of the next element starting from the given position
 * that would not be found by linear probing if the element at the given
 * position are deleted . This should be the element whose index is smaller
 * than this position .
 * @ param d
 * @ param del
 * @ return */
static < E > int getMovedPosition ( E [ ] d , int del ) { } }

implementation:
int j = del ; for ( ; ; ) { if ( ++ j == d . length ) j = 0 ; // invariant : interval ] del , j ] contains only non - null elements
// whose index is in ] del , j ]
E test = d [ j ] ; if ( test == null ) return j ; int k = getIndex ( test , d . length ) ; // check if k is in ] del , j ] ( this interval can wrap over )
if ( ( del < j ) ? ( del < k ) && ( k <= j ) : ( del < k ) || ( k <= j ) ) // the test element should not be shifted
continue ; // else it should be shifted
return j ; }


signature:
public class LinearProbing { /** * Tests if the set represented by given data array contains a given object .
 * @ param d
 * the elements representing the set
 * @ param o
 * the object to be tested on inclusion in the set
 * @ return { @ code true } if the object occurs in the array and { @ code false }
 * otherwise */
static < E > boolean contains ( E [ ] d , Object o ) { } }

implementation:
int pos = getPosition ( d , o ) ; if ( d [ pos ] == null ) return false ; // else
return true ;


signature:
public class LinearProbing { /** * Adds the element to the set represented by given data array , if it did
 * not contain there already .
 * @ param d
 * the elements of the set
 * @ param e
 * the element to be added to the set
 * @ return { @ code true } if the set has changed ( the element is added ) ,
 * { @ code false } otherwise */
static < E > boolean add ( E [ ] d , E e ) { } }

implementation:
int pos = getPosition ( d , e ) ; if ( d [ pos ] == null ) { d [ pos ] = e ; return true ; } // else the element is already there
return false ;


signature:
public class CachedIndexedComplexClassExpressionImpl { /** * verifies that occurrence numbers are not negative */
public final void checkOccurrenceNumbers ( ) { } }

implementation: if ( LOGGER_ . isTraceEnabled ( ) ) LOGGER_ . trace ( toString ( ) + " occurences: " + printOccurrenceNumbers ( ) ) ; if ( positiveOccurrenceNo < 0 || negativeOccurrenceNo < 0 ) throw new ElkUnexpectedIndexingException ( toString ( ) + " has a negative occurrence: " + printOccurrenceNumbers ( ) ) ;


signature:
public class ElkConverter { /** * TODO : perhaps convert using some visitor */
public OWLRuntimeException convert ( ElkException e ) { } }

implementation: if ( e instanceof ElkFreshEntitiesException ) return convert ( ( ElkFreshEntitiesException ) e ) ; else if ( e instanceof ElkInconsistentOntologyException ) return convert ( ( ElkInconsistentOntologyException ) e ) ; else if ( e instanceof ElkInterruptedException ) return convert ( ( ElkInterruptedException ) e ) ; else return new OWLRuntimeException ( e ) ;


signature:
public class ClassConclusionTimer { /** * Adds all timers of the argument to the corresponding counters of this
 * object . The timers should not be directly modified other than using this
 * method during this operation . The timers in the argument will be reseted
 * after this operation .
 * @ param timer
 * the object which counters should be added */
public synchronized void add ( ClassConclusionTimer timer ) { } }

implementation: this . timeComposedSubsumers += timer . timeComposedSubsumers ; this . timeDecomposedSubsumers += timer . timeDecomposedSubsumers ; this . timeBackwardLinks += timer . timeBackwardLinks ; this . timeForwardLinks += timer . timeForwardLinks ; this . timeContradictions += timer . timeContradictions ; this . timePropagations += timer . timePropagations ; this . timeDisjointSubsumers += timer . timeDisjointSubsumers ; this . timeContextInitializations += timer . timeContextInitializations ; this . timeSubContextInitializations += timer . timeSubContextInitializations ;


signature:
public class ElkObjectEntityRecyclingFactory { /** * TODO : simplify the implementation to use just one weak wrapper */
@ SuppressWarnings ( "unchecked" ) @ Override protected < C extends ElkObject > C filter ( C candidate ) { } }

implementation: if ( candidate instanceof ElkEntity ) return ( C ) getCanonicalElkEntity ( ( ElkEntity ) candidate ) ; else return candidate ;


signature:
public class RuleApplicationTimer { /** * Add the values the corresponding values of the given timer
 * @ param timer */
public synchronized void add ( RuleApplicationTimer timer ) { } }

implementation: timeOwlThingContextInitRule += timer . timeOwlThingContextInitRule ; timeRootContextInitializationRule += timer . timeRootContextInitializationRule ; timeDisjointSubsumerFromMemberRule += timer . timeDisjointSubsumerFromMemberRule ; timeContradictionFromNegationRule += timer . timeContradictionFromNegationRule ; timeObjectIntersectionFromFirstConjunctRule += timer . timeObjectIntersectionFromFirstConjunctRule ; timeObjectIntersectionFromSecondConjunctRule += timer . timeObjectIntersectionFromSecondConjunctRule ; timeSuperClassFromSubClassRule += timer . timeSuperClassFromSubClassRule ; timePropagationFromExistentialFillerRule += timer . timePropagationFromExistentialFillerRule ; timeObjectUnionFromDisjunctRule += timer . timeObjectUnionFromDisjunctRule ; timeBackwardLinkChainFromBackwardLinkRule += timer . timeBackwardLinkChainFromBackwardLinkRule ; timeReflexiveBackwardLinkCompositionRule += timer . timeReflexiveBackwardLinkCompositionRule ; timeNonReflexiveBackwardLinkCompositionRule += timer . timeNonReflexiveBackwardLinkCompositionRule ; timeSubsumerBackwardLinkRule += timer . timeSubsumerBackwardLinkRule ; timeContradictionOverBackwardLinkRule += timer . timeContradictionOverBackwardLinkRule ; timeContradictionPropagationRule += timer . timeContradictionPropagationRule ; timeContradictionCompositionRule += timer . timeContradictionCompositionRule ; timeIndexedObjectIntersectionOfDecomposition += timer . timeIndexedObjectIntersectionOfDecomposition ; timeIndexedObjectSomeValuesFromDecomposition += timer . timeIndexedObjectSomeValuesFromDecomposition ; timeIndexedObjectComplementOfDecomposition += timer . timeIndexedObjectComplementOfDecomposition ; timeIndexedObjectHasSelfDecomposition += timer . timeIndexedObjectHasSelfDecomposition ; timeContradictionFromOwlNothingRule += timer . timeContradictionFromOwlNothingRule ; timeSubsumerPropagationRule += timer . timeSubsumerPropagationRule ; timePropagationInitializationRule += timer . timePropagationInitializationRule ; timeBackwardLinkFromForwardLinkRule += timer . timeBackwardLinkFromForwardLinkRule ; timeComposedFromDecomposedSubsumerRule += timer . timeComposedFromDecomposedSubsumerRule ; timeIndexedClassDecompositionRule += timer . timeIndexedClassDecompositionRule ; timeIndexedClassFromDefinitionRule += timer . timeIndexedClassFromDefinitionRule ; timeEquivalentClassFirstFromSecondRule += timer . timeEquivalentClassFirstFromSecondRule ; timeEquivalentClassSecondFromFirstRule += timer . timeEquivalentClassSecondFromFirstRule ;


signature:
public class ClassConclusionOccurrenceCheckingVisitor { /** * logging is switched off */
@ Override protected Boolean defaultVisit ( ClassConclusion conclusion ) { } }

implementation: ClassConclusionSet conclusions = conclusionsRef_ . get ( ) ; boolean result = conclusions == null ? false : conclusions . containsConclusion ( conclusion ) ; if ( LOGGER_ . isTraceEnabled ( ) ) { LOGGER_ . trace ( "{}: check occurrence of {}: {}" , conclusions , conclusion , result ? "success" : "failure" ) ; } return result ;


signature:
public class ForwardLinkOfObjectHasSelf { /** * @ param factory
 * the factory for creating conclusions
 * @ return the conclusion produced by this inference */
public ForwardLink getConclusion ( ForwardLink . Factory factory ) { } }

implementation: return factory . getForwardLink ( getDestination ( ) , existential_ . getProperty ( ) , getOrigin ( ) ) ;


signature:
public class OwlThingContextInitRule { /** * Add an { @ link OwlThingContextInitRule } to the given
 * { @ link ModifiableOntologyIndex }
 * @ param owlThing
 * @ param index
 * @ return { @ code true } if the operation was successful and { @ code false }
 * otherwise ; if { @ code false } is returned , the index remains
 * unchanged */
public static boolean addRuleFor ( IndexedClass owlThing , ModifiableOntologyIndex index ) { } }

implementation: LOGGER_ . trace ( "{}: adding {}" , owlThing , NAME ) ; return index . addContextInitRule ( new OwlThingContextInitRule ( owlThing ) ) ;


signature:
public class OwlThingContextInitRule { /** * Removes an { @ link OwlThingContextInitRule } from the given
 * { @ link ModifiableOntologyIndex }
 * @ param owlThing
 * @ param index
 * @ return { @ code true } if the operation was successful and { @ code false }
 * otherwise ; if { @ code false } is returned , the index remains
 * unchanged */
public static boolean removeRuleFor ( IndexedClass owlThing , ModifiableOntologyIndex index ) { } }

implementation: LOGGER_ . trace ( "{}: removing {}" , owlThing , NAME ) ; return index . removeContextInitRule ( new OwlThingContextInitRule ( owlThing ) ) ;


signature:
public class ArrayHashMap { /** * Associates the given key with the given value in the map defined by the
 * keys and value arrays . If an entry with the key equal to the given one
 * already exists in the map , the value for this key will be overwritten
 * with the given value .
 * @ param keys
 * the keys of the map
 * @ param values
 * the values of the map
 * @ param key
 * the key of the entry
 * @ param value
 * the value of the entry
 * @ return the previous value associated with the key or < tt > null < / tt > if
 * there was no such a previous value . */
private static < K , V > V putKeyValue ( K [ ] keys , V [ ] values , K key , V value ) { } }

implementation:
int pos = LinearProbing . getPosition ( keys , key ) ; if ( keys [ pos ] == null ) { keys [ pos ] = key ; values [ pos ] = value ; return null ; } // else
V oldValue = values [ pos ] ; values [ pos ] = value ; return oldValue ;


signature:
public class ArrayHashMap { /** * Remove the entry in the keys and values such that the key of the entry is
 * equal to the given object according to the equality function .
 * @ param keys
 * the array of keys
 * @ param values
 * the arrays of values
 * @ param key
 * the key for which to delete the entry
 * @ return the value of the deleted entry , < tt > null < / tt > if nothing has been
 * deleted */
private static < K , V > V removeEntry ( K [ ] keys , V [ ] values , Object key ) { } }

implementation:
int pos = LinearProbing . getPosition ( keys , key ) ; if ( keys [ pos ] == null ) return null ; // else
V result = values [ pos ] ; LinearProbing . remove ( keys , values , pos ) ; return result ;


signature:
public class ArrayHashMap { /** * Increasing the capacity of the map */
private void enlarge ( ) { } }

implementation: int oldCapacity = keys . length ; if ( oldCapacity == LinearProbing . MAXIMUM_CAPACITY ) throw new IllegalArgumentException ( "Map cannot grow beyond capacity: " + LinearProbing . MAXIMUM_CAPACITY ) ; K oldKeys [ ] = keys ; V oldValues [ ] = values ; int newCapacity = oldCapacity << 1 ; @ SuppressWarnings ( "unchecked" ) K newKeys [ ] = ( K [ ] ) new Object [ newCapacity ] ; @ SuppressWarnings ( "unchecked" ) V newValues [ ] = ( V [ ] ) new Object [ newCapacity ] ; for ( int i = 0 ; i < oldCapacity ; i ++ ) { K key = oldKeys [ i ] ; if ( key != null ) putKeyValue ( newKeys , newValues , key , oldValues [ i ] ) ; } this . keys = newKeys ; this . values = newValues ;


signature:
public class ArrayHashMap { /** * Decreasing the capacity of the map */
private void shrink ( ) { } }

implementation: int oldCapacity = keys . length ; if ( oldCapacity <= LinearProbing . DEFAULT_INITIAL_CAPACITY ) return ; K oldKeys [ ] = keys ; V oldValues [ ] = values ; int newCapacity = oldCapacity >> 1 ; @ SuppressWarnings ( "unchecked" ) K newKeys [ ] = ( K [ ] ) new Object [ newCapacity ] ; @ SuppressWarnings ( "unchecked" ) V newValues [ ] = ( V [ ] ) new Object [ newCapacity ] ; for ( int i = 0 ; i < oldCapacity ; i ++ ) { K key = oldKeys [ i ] ; if ( key != null ) putKeyValue ( newKeys , newValues , key , oldValues [ i ] ) ; } this . keys = newKeys ; this . values = newValues ;


signature:
public class ConfigurationFactory { /** * Not a thread - safe method . Shouldn ' t be invoked concurrently .
 * @ param configOnDisk
 * @ param config
 * @ throws ConfigurationException
 * @ throws IOException */
public void saveConfiguration ( File configOnDisk , BaseConfiguration config ) throws ConfigurationException , IOException { } }

implementation:
/* * Unfortunately , we can ' t directly write the config on disk because the
 * parameters in it may be just a subset of those on disk . So we load it
 * first ( alternatively one may use a singleton , which I typically try
 * to avoid ) . It should work reasonably well unless there ' re too many
 * parameters ( in which case we should think of a mini key - value store ) . */
InputStream stream = null ; BaseConfiguration loadedConfig = null ; Properties diskProps = new Properties ( ) ; try { stream = new FileInputStream ( configOnDisk ) ; loadedConfig = getConfiguration ( stream , "" , config . getClass ( ) ) ; // copy parameters
copyParameters ( loadedConfig , diskProps ) ; } catch ( Throwable e ) { LOGGER_ . info ( "Overwriting configuration since it can't be loaded (perhaps doesn't exist?)" ) ; } finally { IOUtils . closeQuietly ( stream ) ; } copyParameters ( config , diskProps ) ; // now save it to the file
saveProperties ( diskProps , configOnDisk ) ;


signature:
public class LinearProbingIterator { /** * Searches for the next non - { @ code null } element after the given position
 * before the start position
 * @ param pos
 * position after which to search
 * @ return the position of the non - { @ code null } element , or { @ link # start _ }
 * if there are no such element */
int seekNext ( int pos ) { } }

implementation: for ( ; ; ) { if ( ++ pos == dataSnapshot . length ) pos = 0 ; if ( pos == start_ || isOccupied ( pos ) ) return pos ; }


signature:
public class OreTaxonomyPrinter { /** * prints SubClassOf ( A , owl : Thing ) for all direct subclasses of owl : Thing */
static void printClassTaxonomy ( Taxonomy < ElkClass > taxonomy , File out ) throws IOException { } }

implementation: FileWriter fstream = null ; BufferedWriter writer = null ; try { fstream = new FileWriter ( out ) ; writer = new BufferedWriter ( fstream ) ; writer . append ( "Ontology(\n" ) ; processTaxomomy ( taxonomy , writer ) ; writer . append ( ")\n" ) ; writer . flush ( ) ; } finally { IOUtils . closeQuietly ( fstream ) ; IOUtils . closeQuietly ( writer ) ; }


signature:
public class OreTaxonomyPrinter { /** * Prints class declarations
 * @ param classTaxonomy
 * @ param objectFactory
 * @ param writer
 * @ throws IOException */
protected static void printDeclarations ( Taxonomy < ElkClass > classTaxonomy , ElkObject . Factory objectFactory , Appendable writer ) throws IOException { } }

implementation: List < ElkClass > classes = new ArrayList < ElkClass > ( classTaxonomy . getNodes ( ) . size ( ) * 2 ) ; for ( TaxonomyNode < ElkClass > classNode : classTaxonomy . getNodes ( ) ) { for ( ElkClass clazz : classNode ) { if ( ! clazz . getIri ( ) . equals ( PredefinedElkIris . OWL_THING ) && ! clazz . getIri ( ) . equals ( PredefinedElkIris . OWL_NOTHING ) ) { classes . add ( clazz ) ; } } } Collections . sort ( classes , CLASS_COMPARATOR ) ; for ( ElkClass clazz : classes ) { ElkDeclarationAxiom decl = objectFactory . getDeclarationAxiom ( clazz ) ; OwlFunctionalStylePrinter . append ( writer , decl , true ) ; writer . append ( '\n' ) ; }


signature:
public class TaxonomyNodeUtils { /** * Returns all super - nodes of a node whose direct super - nodes are
 * < code > direct < / code > .
 * @ param direct
 * The direct super - nodes .
 * @ return all super - nodes of a node whose direct super - nodes are
 * < code > direct < / code > . */
public static < T extends ElkEntity , N extends GenericTaxonomyNode < T , N > > Set < ? extends N > getAllSuperNodes ( final Collection < ? extends N > direct ) { } }

implementation: return getAllReachable ( direct , new Functor < N , Set < ? extends N > > ( ) { @ Override public Set < ? extends N > apply ( final N node ) { return node . getDirectSuperNodes ( ) ; } } ) ;


signature:
public class TaxonomyNodeUtils { /** * Returns all sub - nodes of a node whose direct sub - nodes are
 * < code > direct < / code > .
 * @ param direct
 * The direct sub - nodes .
 * @ return all sub - nodes of a node whose direct sub - nodes are
 * < code > direct < / code > . */
public static < T extends ElkEntity , N extends GenericTaxonomyNode < T , N > > Set < ? extends N > getAllSubNodes ( final Collection < ? extends N > direct ) { } }

implementation: return getAllReachable ( direct , new Functor < N , Set < ? extends N > > ( ) { @ Override public Set < ? extends N > apply ( final N node ) { return node . getDirectSubNodes ( ) ; } } ) ;


signature:
public class TaxonomyNodeUtils { /** * Returns all instance nodes of the specified type node and all its
 * sub - nodes .
 * @ param node
 * The type node whose instances should be returned .
 * @ return all instance nodes of the specified type node and all its
 * sub - nodes . */
public static < T extends ElkEntity , I extends ElkEntity , TN extends GenericTypeNode < T , I , TN , IN > , IN extends GenericInstanceNode < T , I , TN , IN > > Set < ? extends IN > getAllInstanceNodes ( final GenericTypeNode < T , I , TN , IN > node ) { } }

implementation: return TaxonomyNodeUtils . collectFromAllReachable ( node . getDirectSubNodes ( ) , node . getDirectInstanceNodes ( ) , new Operations . Functor < GenericTypeNode < T , I , TN , IN > , Set < ? extends GenericTypeNode < T , I , TN , IN > > > ( ) { @ Override public Set < ? extends TN > apply ( final GenericTypeNode < T , I , TN , IN > node ) { return node . getDirectSubNodes ( ) ; } } , new Operations . Functor < GenericTypeNode < T , I , TN , IN > , Set < ? extends IN > > ( ) { @ Override public Set < ? extends IN > apply ( final GenericTypeNode < T , I , TN , IN > node ) { return node . getDirectInstanceNodes ( ) ; } } ) ;


signature:
public class AbstractChain { /** * Creates a { @ link Chain } view of the value associated with the given key
 * in the given { @ link Map } . The values of the map must be instances of the
 * type that can be used in the { @ link Chain } interface . All operations with
 * the returned { @ link Chain } , such as addition or removal , will be
 * reflected accordingly in the corresponding value in the { @ link Map } .
 * @ param map
 * the { @ link Map } that backs the data
 * @ param key
 * the key for which to return the { @ link Chain } view of the data
 * @ return the { @ link Chain } view of the data associated with key in map */
public static < K , T extends ModifiableLink < T > > Chain < T > getMapBackedChain ( final Map < K , T > map , final K key ) { } }

implementation: return new AbstractChain < T > ( ) { @ Override public T next ( ) { return map . get ( key ) ; } @ Override public void setNext ( T next ) { if ( next == null ) map . remove ( key ) ; else map . put ( key , next ) ; } } ;


signature:
public class EntryCollection { /** * Finds and returns the entry in set that is structurally equal to the
 * input entry if there is one . Equality of entries is decided using
 * { @ link Entry # structuralHashCode ( ) } and
 * { @ link Entry # structuralEquals ( Object ) } methods .
 * @ param entry
 * the entry for which the equal entry should be found
 * @ return the entry in the set that is equal to the input entry if there is
 * one , or { @ code null } otherwise */
public < T extends Entry < T , ? > > T findStructural ( Entry < T , ? > entry ) { } }

implementation:
int h = entry . structuralHashCode ( ) ; int i = indexFor ( h , buckets . length ) ; T result = null ; for ( E r = buckets [ i ] ; r != null ; r = r . getNext ( ) ) { if ( r . structuralHashCode ( ) == h && ( result = entry . structuralEquals ( r ) ) != null ) return result ; } // else fail
return null ;


signature:
public class EntryCollection { /** * Adds the given entry to this collection ; the entry is added even if a
 * structurally equal entry ( modulo { @ link Entry # structuralHashCode ( ) } and
 * { @ link Entry # structuralEquals ( Object ) } ) is already present in the
 * collection
 * @ param entry
 * the entry to be inserted ; it is not allowed to have linked
 * elements : { @ link Entry # getNext ( ) } should be { @ code null } */
public void addStructural ( E entry ) { } }

implementation: if ( entry . getNext ( ) != null ) throw new IllegalArgumentException ( "The given entry should be fresh!" ) ; int h = entry . structuralHashCode ( ) ; int i = indexFor ( h , buckets . length ) ; modCount ++ ; E e = buckets [ i ] ; entry . setNext ( e ) ; buckets [ i ] = entry ; if ( size ++ >= oversize ) resize ( 2 * buckets . length ) ;


signature:
public class EntryCollection { /** * Removes and returns the entry in the set that is structurally equal to
 * the specified entry . Returns { @ code null } if the set contains no such
 * entry . Equality of entries is decided using
 * { @ link Entry # structuralHashCode ( ) } and
 * { @ link Entry # structuralEquals ( Object ) } methods .
 * @ param entry
 * the entry that is used for finding the entry to be removed
 * @ return the removed entry , or { @ code null } if no entry that is equal to
 * the input object is found */
public < T extends Entry < T , ? > > T removeStructural ( Entry < T , ? > entry ) { } }

implementation:
int h = entry . structuralHashCode ( ) ; int i = indexFor ( h , buckets . length ) ; E prev = buckets [ i ] ; E r = prev ; T result = null ; while ( r != null ) { E next = r . getNext ( ) ; if ( r . structuralHashCode ( ) == h && ( result = entry . structuralEquals ( r ) ) != null ) { modCount ++ ; if ( prev == r ) buckets [ i ] = next ; else prev . setNext ( next ) ; if ( size -- <= undersize && buckets . length >= 2 * minsize ) resize ( buckets . length / 2 ) ; return result ; } prev = r ; r = next ; } // not found
return null ;


signature:
public class EntryCollection { /** * Rehashes the contents of this map into a new array with a new capacity .
 * This method is called automatically when the number of entries in this
 * set becomes below the { @ link # undersize } or above the { @ link # oversize } .
 * If current capacity is MAXIMUM _ CAPACITY , this method does not resize the
 * map , but sets threshold to Integer . MAX _ VALUE . This has the effect of
 * preventing future calls .
 * @ param newCapacity
 * the new capacity , MUST be a power of two */
void resize ( int newCapacity ) { } }

implementation: E [ ] oldTable = buckets ; int oldCapacity = oldTable . length ; if ( oldCapacity == MAXIMUM_CAPACITY ) { oversize = Integer . MAX_VALUE ; oversize = ( int ) ( newCapacity * overloadFactor ) ; return ; } @ SuppressWarnings ( "unchecked" ) E [ ] newTable = ( E [ ] ) new Entry [ newCapacity ] ; transfer ( newTable ) ; buckets = newTable ; undersize = ( int ) ( newCapacity * underloadFactor ) ; oversize = ( int ) ( newCapacity * overloadFactor ) ;


signature:
public class EntryCollection { /** * Removes all entries from this set . The set will be empty after this call
 * returns . */
@ Override public void clear ( ) { } }

implementation: modCount ++ ; E [ ] tab = buckets ; for ( int i = 0 ; i < tab . length ; i ++ ) tab [ i ] = null ; size = 0 ;


signature:
public class ClassConclusionDeletionVisitor { /** * logging is switched off */
@ Override protected Boolean defaultVisit ( ClassConclusion conclusion ) { } }

implementation: ClassConclusionSet conclusions = conclusionsRef . get ( ) ; boolean result = conclusions . removeConclusion ( conclusion ) ; if ( LOGGER_ . isTraceEnabled ( ) ) { LOGGER_ . trace ( "{}: deleting {}: {}" , conclusions , conclusion , result ? "success" : "failure" ) ; } return result ;


signature:
public class AbstractPropagationInference { /** * @ param factory
 * the factory for creating conclusions
 * @ return the conclusion produced by this inference */
public final Propagation getConclusion ( Propagation . Factory factory ) { } }

implementation: return factory . getPropagation ( getDestination ( ) , getRelation ( ) , getCarry ( ) ) ;


signature:
public class HashGenerator { /** * Compute the combined hash code of several objects using their
 * { @ link # hashCode ( ) } functions . The combined hash code depends on the
 * order in which the objects are listed .
 * The current implementation is based on the Jenkins One - at - a - Time hash ,
 * see http : / / www . burtleburtle . net / bob / hash / doobs . html and also
 * http : / / en . wikipedia . org / wiki / Jenkins _ hash _ function .
 * @ param objects
 * the list of objects for which to compute the combined hash
 * code
 * @ return the combined hash code */
public static int combinedHashCode ( Object ... objects ) { } }

implementation: int result = 0 ; for ( Object obj : objects ) { int h = obj . hashCode ( ) ; result += h ; result += ( h << 10 ) ; result ^= ( h >> 6 ) ; } result += ( result << 3 ) ; result ^= ( result >> 11 ) ; result += ( result << 15 ) ; return result ;


signature:
public class HashGenerator { /** * Combine many hash codes with an associative commutative hash function .
 * Associativity ensures that the result of this functions can be further
 * combined with other hash codes for getting the same result as if all hash
 * codes had been combined in one step .
 * If finalize is false , then the method as such represents an associative
 * commutative hash , i . e . the return value can be combined with other
 * set - based hash codes in any order without making a difference . If
 * finalize is true , then the method combines its arguments with a
 * commutative hash , but shuffles the overall result . The method as such
 * then is neither an associative nor a commutative operation . This mode of
 * operation should be used whenever no further elements are to be added to
 * the set of hashes .
 * @ param finalize
 * @ param hashes
 * @ return the combined hash code */
public static int combineMultisetHash ( boolean finalize , int ... hashes ) { } }

implementation: int hash = 0 ; for ( int h : hashes ) { hash = hash + h ; } if ( finalize ) { hash = combineListHash ( hash ) ; } return hash ;


signature:
public class HashGenerator { /** * Combine the hash codes of a collection of objects with an associative
 * commutative hash function . Associativity ensures that the result of this
 * functions can be further combined with other hash codes for getting the
 * same result as if all hash codes had been combined in one step .
 * If finalize is false , then the method as such represents an associative
 * commutative hash , i . e . the return value can be combined with other
 * set - based hash codes in any order without making a difference . If
 * finalize is true , then the method combines its arguments with a
 * commutative hash , but shuffles the overall result . The method as such
 * then is neither an associative nor a commutative operation . This mode of
 * operation should be used whenever no further elements are to be added to
 * the set of hashes .
 * @ param finalize
 * @ param hashObjects
 * @ param hasher
 * @ return the combined hash code */
public static < T > int combineMultisetHash ( boolean finalize , Iterable < ? extends T > hashObjects , Hasher < T > hasher ) { } }

implementation: return combineMultisetHash ( finalize , hashObjects . iterator ( ) , hasher ) ;


signature:
public class HashGenerator { /** * Combine the hash codes of a collection of objects with an associative
 * commutative hash function . Associativity ensures that the result of this
 * functions can be further combined with other hash codes for getting the
 * same result as if all hash codes had been combined in one step .
 * If finalize is false , then the method as such represents an associative
 * commutative hash , i . e . the return value can be combined with other
 * set - based hash codes in any order without making a difference . If
 * finalize is true , then the method combines its arguments with a
 * commutative hash , but shuffles the overall result . The method as such
 * then is neither an associative nor a commutative operation . This mode of
 * operation should be used whenever no further elements are to be added to
 * the set of hashes .
 * @ param < T >
 * @ param finalize
 * @ param hashObjectIterator
 * @ param hasher
 * @ return the combined hash code */
public static < T > int combineMultisetHash ( boolean finalize , Iterator < ? extends T > hashObjectIterator , Hasher < T > hasher ) { } }

implementation: int hash = 0 ; while ( hashObjectIterator . hasNext ( ) ) { hash += hasher . hash ( hashObjectIterator . next ( ) ) ; } if ( finalize ) { hash = combineListHash ( hash ) ; } return hash ;


signature:
public class HashGenerator { /** * Combine many hash codes into one in a way that depends on their order .
 * The current implementation is based on the Jenkins One - at - a - Time hash ,
 * see http : / / www . burtleburtle . net / bob / hash / doobs . html and also
 * http : / / en . wikipedia . org / wiki / Jenkins _ hash _ function .
 * @ param hashes
 * @ return the combined hash code */
public static int combineListHash ( int ... hashes ) { } }

implementation: int hash = 0 ; for ( int h : hashes ) { hash += h ; hash += ( hash << 10 ) ; hash ^= ( hash >> 6 ) ; } hash += ( hash << 3 ) ; hash ^= ( hash >> 11 ) ; hash += ( hash << 15 ) ; return hash ;


signature:
public class HashGenerator { /** * Combine the hash codes of a collection of objects into one in a way that
 * depends on their order .
 * The current implementation is based on the Jenkins One - at - a - Time hash ,
 * see http : / / www . burtleburtle . net / bob / hash / doobs . html and also
 * http : / / en . wikipedia . org / wiki / Jenkins _ hash _ function .
 * @ param hashObjects
 * @ param hasher
 * @ return the combined hash code */
public static < T > int combineListHash ( List < ? extends T > hashObjects , Hasher < T > hasher ) { } }

implementation: return combineListHash ( hashObjects . iterator ( ) , hasher ) ;


signature:
public class HashGenerator { /** * Combine the hash codes of a collection of objects into one in a way that
 * depends on their order .
 * The current implementation is based on the Jenkins One - at - a - Time hash ,
 * see http : / / www . burtleburtle . net / bob / hash / doobs . html and also
 * http : / / en . wikipedia . org / wiki / Jenkins _ hash _ function .
 * @ param hashObjectIterator
 * @ param hasher
 * @ return the combined hash code */
public static < T > int combineListHash ( Iterator < ? extends T > hashObjectIterator , Hasher < T > hasher ) { } }

implementation: int hash = 0 ; while ( hashObjectIterator . hasNext ( ) ) { hash += hasher . hash ( hashObjectIterator . next ( ) ) ; hash += ( hash << 10 ) ; hash ^= ( hash >> 6 ) ; } hash += ( hash << 3 ) ; hash ^= ( hash >> 11 ) ; hash += ( hash << 15 ) ; return hash ;


signature:
public class IOUtils { /** * Copies bytes from the input stream to the output stream
 * @ param input
 * @ param output
 * @ return The number of bytes copied
 * @ throws IOException */
public static int copy ( InputStream input , OutputStream output ) throws IOException { } }

implementation: byte [ ] buffer = new byte [ BUFFER_SIZE ] ; BufferedInputStream in = new BufferedInputStream ( input , BUFFER_SIZE ) ; BufferedOutputStream out = new BufferedOutputStream ( output , BUFFER_SIZE ) ; int count = 0 , n = 0 ; try { while ( ( n = in . read ( buffer , 0 , BUFFER_SIZE ) ) != - 1 ) { out . write ( buffer , 0 , n ) ; count += n ; } out . flush ( ) ; } finally { IOUtils . closeQuietly ( in ) ; IOUtils . closeQuietly ( out ) ; } return count ;


signature:
public class IOUtils { /** * Retrieves a set of resource names from a JAR file ( the code source for
 * the given Java class )
 * @ param path
 * @ param extension
 * @ param clazz
 * @ return the list of resource names from a JAR file
 * @ throws IOException */
public static List < String > getResourceNamesFromJAR ( String path , String extension , Class < ? > clazz ) throws IOException { } }

implementation: CodeSource src = clazz . getProtectionDomain ( ) . getCodeSource ( ) ; List < String > testResources = new ArrayList < String > ( ) ; ZipInputStream zip = null ; if ( src != null ) { URL jar = src . getLocation ( ) ; ZipEntry ze = null ; try { zip = new ZipInputStream ( jar . openStream ( ) ) ; while ( ( ze = zip . getNextEntry ( ) ) != null ) { String entryName = ze . getName ( ) ; if ( entryName . startsWith ( path ) && entryName . endsWith ( "." + extension ) ) { testResources . add ( entryName ) ; } } } finally { closeQuietly ( zip ) ; } } else { throw new IOException ( "Unable to get code source for " + clazz . getSimpleName ( ) ) ; } return testResources ;


signature:
public class ForwardLinkOfObjectSomeValuesFrom { /** * @ param factory
 * the factory for creating conclusions
 * @ return the conclusion produced by this inference */
public ForwardLink getConclusion ( ClassConclusion . Factory factory ) { } }

implementation: return factory . getForwardLink ( getDestination ( ) , existential_ . getProperty ( ) , IndexedObjectSomeValuesFrom . Helper . getTarget ( existential_ ) ) ;


signature:
public class ReasonerComputationWithInputs { /** * Process the given input concurrently using the provided input processor .
 * If the process has been interrupted , this method can be called again to
 * continue the computation . */
public void process ( ) { } }

implementation:
if ( ! start ( ) ) { String message = "Could not start workers required for reasoner computation!" ; LOGGER_ . error ( message ) ; throw new ElkRuntimeException ( message ) ; } try { // submit the leftover from the previous run
if ( nextInput != null ) { if ( ! processNextInput ( ) ) return ; } // repeatedly submit the next inputs from todo
while ( todo . hasNext ( ) ) { nextInput = todo . next ( ) ; if ( ! processNextInput ( ) ) return ; } finish ( ) ; } catch ( InterruptedException e ) { // restore interrupt status
Thread . currentThread ( ) . interrupt ( ) ; throw new ElkRuntimeException ( "Reasoner computation interrupted externally!" ) ; }


signature:
public class IncompletenessManager { /** * Combines the provided partial incompleteness monitors into the top - level
 * monitor for reasoning tasks .
 * @ param additionalMonitors
 * The partial monitors .
 * @ return The top - level monitor for reasoning tasks . */
public IncompletenessMonitor getReasonerIncompletenessMonitor ( final IncompletenessMonitor ... additionalMonitors ) { } }

implementation: final List < IncompletenessMonitor > monitors = new ArrayList < IncompletenessMonitor > ( additionalMonitors . length + 1 ) ; monitors . add ( getIncompletenessDueToStatedAxiomsMonitor ( ) ) ; monitors . addAll ( Arrays . asList ( additionalMonitors ) ) ; return new DelegatingIncompletenessMonitor ( monitors ) { @ Override public boolean logNewIncompletenessReasons ( final Logger logger ) { final boolean result = super . logNewIncompletenessReasons ( logger ) ; if ( result ) { LoggerWrap . log ( logger , LogLevel . WARN , MARKER_ , "Reasoning may be incomplete! See log level INFO for more details." ) ; } return result ; } } ;


signature:
public class IndexedObjectPrinter { /** * TODO : parentheses and precedence of symbols */
@ Override public String visit ( IndexedClass element ) { } }

implementation:
ElkClass entity = element . getElkEntity ( ) ; if ( entity . getIri ( ) . equals ( PredefinedElkIris . OWL_THING ) ) { return "⊤" ; } // else
if ( entity . getIri ( ) . equals ( PredefinedElkIris . OWL_NOTHING ) ) { return "⊥" ; } // else
return entity . toString ( ) ;


signature:
public class DifferentialIndex { /** * / * read - write methods */
@ Override public void add ( CachedIndexedObject < ? > input ) { } }

implementation:
if ( ! incrementalMode ) { super . add ( input ) ; return ; } // else incrementalMode
LOGGER_ . trace ( "{}: to add" , input ) ; if ( input instanceof IndexedEntity ) ( ( IndexedEntity ) input ) . accept ( entityInsertionListener_ ) ; if ( todoDeletions_ . remove ( input ) ) return ; // else
super . add ( input ) ;


signature:
public class DifferentialIndex { /** * Removes the deleted rules from this { @ link DifferentialIndex } ; these
 * rules should be already applied in the main index during their
 * registration */
public void clearDeletedRules ( ) { } }

implementation: for ( CachedIndexedObject < ? > deletion : todoDeletions_ ) { LOGGER_ . trace ( "{}: comitting removal" , deletion ) ; super . remove ( deletion ) ; } initDeletions ( ) ;


signature:
public class DifferentialIndex { /** * Commits the added rules to the main index and removes them from this
 * { @ link DifferentialIndex } . */
public void commitAddedRules ( ) { } }

implementation:
// commit changes in the context initialization rules
ChainableContextInitRule nextContextInitRule ; Chain < ChainableContextInitRule > contextInitRuleChain ; nextContextInitRule = addedContextInitRules_ ; contextInitRuleChain = getContextInitRuleChain ( ) ; while ( nextContextInitRule != null ) { nextContextInitRule . addTo ( contextInitRuleChain ) ; nextContextInitRule = nextContextInitRule . next ( ) ; } // commit changes in rules for IndexedClassExpression
ChainableSubsumerRule nextClassExpressionRule ; Chain < ChainableSubsumerRule > classExpressionRuleChain ; for ( ModifiableIndexedClassExpression target : addedContextRuleHeadByClassExpressions_ . keySet ( ) ) { LOGGER_ . trace ( "{}: committing context rule additions" , target ) ; nextClassExpressionRule = addedContextRuleHeadByClassExpressions_ . get ( target ) ; classExpressionRuleChain = target . getCompositionRuleChain ( ) ; while ( nextClassExpressionRule != null ) { nextClassExpressionRule . addTo ( classExpressionRuleChain ) ; nextClassExpressionRule = nextClassExpressionRule . next ( ) ; } } for ( ModifiableIndexedClass target : addedDefinitions_ . keySet ( ) ) { ModifiableIndexedClassExpression definition = addedDefinitions_ . get ( target ) ; ElkAxiom reason = addedDefinitionReasons_ . get ( target ) ; LOGGER_ . trace ( "{}: committing definition addition {}" , target , definition ) ; if ( ! target . setDefinition ( definition , reason ) ) throw new ElkUnexpectedIndexingException ( target ) ; } initAdditions ( ) ;


signature:
public class DifferentialIndex { /** * Sets the incremental mode for this { @ code DifferentialIndex } .
 * @ param incremental
 * if { @ code true } , deletions and additions to this indexed are
 * stored separately ; if { @ code false } all changes are
 * immediately applied to the index . */
public void setIncrementalMode ( boolean incremental ) { } }

implementation:
if ( this . incrementalMode == incremental ) // already set
return ; LOGGER_ . trace ( "set incremental mode: " + incremental ) ; this . incrementalMode = incremental ; if ( ! incremental ) { clearDeletedRules ( ) ; commitAddedRules ( ) ; initClassChanges ( ) ; initIndividualChanges ( ) ; }


signature:
public class ObjectIntersectionFromFirstConjunctRule { /** * Add { @ link ObjectIntersectionFromFirstConjunctRule } s for the given
 * { @ link ModifiableIndexedObjectIntersectionOf } in the given
 * { @ link ModifiableOntologyIndex }
 * @ param conjunction
 * @ param index */
public static boolean addRulesFor ( ModifiableIndexedObjectIntersectionOf conjunction , ModifiableOntologyIndex index ) { } }

implementation: return index . add ( conjunction . getSecondConjunct ( ) , new ObjectIntersectionFromFirstConjunctRule ( conjunction . getFirstConjunct ( ) , conjunction ) ) ;


signature:
public class ObjectIntersectionFromFirstConjunctRule { /** * Removes { @ link ObjectIntersectionFromFirstConjunctRule } s for the given
 * { @ link ModifiableIndexedObjectIntersectionOf } in the given
 * { @ link ModifiableOntologyIndex }
 * @ param conjunction
 * @ param index */
public static boolean removeRulesFor ( ModifiableIndexedObjectIntersectionOf conjunction , ModifiableOntologyIndex index ) { } }

implementation: return index . remove ( conjunction . getSecondConjunct ( ) , new ObjectIntersectionFromFirstConjunctRule ( conjunction . getFirstConjunct ( ) , conjunction ) ) ;


signature:
public class CachedIndexedObjectPropertyImpl { /** * TODO : create a generic method for this operation ( used in other places ) */
private int indexOf ( IndexedPropertyChain subChain , ElkAxiom reason ) { } }

implementation:
for ( int i = 0 ; i < toldSubChains_ . size ( ) ; i ++ ) { if ( toldSubChains_ . get ( i ) . equals ( subChain ) && toldSubChainsReasons_ . get ( i ) . equals ( reason ) ) return i ; } // else not found
return - 1 ;


signature:
public class AbstractDisjointSubsumerInference { /** * @ param factory
 * the factory for creating conclusions
 * @ return the conclusion produced by this inference */
public final DisjointSubsumer getConclusion ( DisjointSubsumer . Factory factory ) { } }

implementation: return factory . getDisjointSubsumer ( getDestination ( ) , getDisjointExpressions ( ) , getPosition ( ) ) ;


signature:
public class EntailmentQueryConverter { /** * One - parameter , public , non - static methods called " visit " and declared in
 * this class enumerate subclasses of { @ link ElkAxiom } ( parameter ) for which
 * entailment queries are supported . This method returns { @ code true } iff
 * the subclass of { @ link ElkAxiom } specified as the parameter is a
 * parameter type of some of these methods , e . g . , whether entailment query
 * of such an { @ link ElkAxiom } is supported .
 * @ param axiomClass
 * @ return */
public static boolean isEntailmentCheckingSupported ( final Class < ? extends ElkAxiom > axiomClass ) { } }

implementation:
for ( final Method declaredMethod : EntailmentQueryConverter . class . getDeclaredMethods ( ) ) { final int mod = declaredMethod . getModifiers ( ) ; final Class < ? > [ ] parameterTypes = declaredMethod . getParameterTypes ( ) ; if ( "visit" . equals ( declaredMethod . getName ( ) ) && Modifier . isPublic ( mod ) && ! Modifier . isStatic ( mod ) && parameterTypes . length == 1 && parameterTypes [ 0 ] . isAssignableFrom ( axiomClass ) ) { // There is a declared visit method that accepts axiomClass
return true ; } } return false ;


signature:
public class TaxonomyPrinter { /** * Convenience method for printing a { @ link Taxonomy } to a file at the given
 * location .
 * @ see # dumpTaxomomy ( Taxonomy , Writer , boolean )
 * @ param taxonomy
 * @ param fileName
 * @ param addHash
 * if true , a hash string will be added at the end of the output
 * using comment syntax of OWL 2 Functional Style
 * @ throws IOException
 * If an I / O error occurs */
public static void dumpTaxomomyToFile ( final Taxonomy < ? extends ElkEntity > taxonomy , final String fileName , final boolean addHash ) throws IOException { } }

implementation: final FileWriter fstream = new FileWriter ( fileName ) ; final BufferedWriter writer = new BufferedWriter ( fstream ) ; try { dumpTaxomomy ( taxonomy , writer , addHash ) ; } finally { writer . close ( ) ; }


signature:
public class TaxonomyPrinter { /** * Print the contents of the given { @ link Taxonomy } to the specified Writer .
 * Expressions are ordered for generating the output , ensuring that the
 * output is deterministic .
 * @ param taxonomy
 * @ param writer
 * @ param addHash
 * if true , a hash string will be added at the end of the output
 * using comment syntax of OWL 2 Functional Style
 * @ throws IOException
 * If an I / O error occurs */
public static void dumpTaxomomy ( final Taxonomy < ? extends ElkEntity > taxonomy , final Writer writer , final boolean addHash ) throws IOException { } }

implementation: writer . append ( "Ontology(\n" ) ; processTaxomomy ( taxonomy , writer ) ; writer . append ( ")\n" ) ; if ( addHash ) { writer . append ( "\n# Hash code: " + getHashString ( taxonomy ) + "\n" ) ; } writer . flush ( ) ;


signature:
public class TaxonomyPrinter { /** * Convenience method for printing an { @ link InstanceTaxonomy } to a file at
 * the given location .
 * @ see org . semanticweb . elk . reasoner . taxonomy . TaxonomyPrinter # dumpInstanceTaxomomy
 * @ param taxonomy
 * @ param fileName
 * @ param addHash
 * if true , a hash string will be added at the end of the output
 * using comment syntax of OWL 2 Functional Style
 * @ throws IOException
 * If an I / O error occurs */
public static void dumpInstanceTaxomomyToFile ( final InstanceTaxonomy < ? extends ElkEntity , ? extends ElkEntity > taxonomy , final String fileName , final boolean addHash ) throws IOException { } }

implementation: final FileWriter fstream = new FileWriter ( fileName ) ; final BufferedWriter writer = new BufferedWriter ( fstream ) ; try { dumpInstanceTaxomomy ( taxonomy , writer , addHash ) ; } finally { writer . close ( ) ; }


signature:
public class TaxonomyPrinter { /** * Print the contents of the given { @ link InstanceTaxonomy } to the specified
 * Writer . Expressions are ordered for generating the output , ensuring that
 * the output is deterministic .
 * @ param taxonomy
 * @ param writer
 * @ param addHash
 * if true , a hash string will be added at the end of the output
 * using comment syntax of OWL 2 Functional Style
 * @ throws IOException
 * If an I / O error occurs */
public static void dumpInstanceTaxomomy ( final InstanceTaxonomy < ? extends ElkEntity , ? extends ElkEntity > taxonomy , final Writer writer , final boolean addHash ) throws IOException { } }

implementation: writer . write ( "Ontology(\n" ) ; processInstanceTaxomomy ( taxonomy , writer ) ; writer . write ( ")\n" ) ; if ( addHash ) { writer . write ( "\n# Hash code: " + getInstanceHashString ( taxonomy ) + "\n" ) ; } writer . flush ( ) ;


signature:
public class TaxonomyPrinter { /** * Get a has string for the given { @ link Taxonomy } . Besides possible hash
 * collisions ( which have very low probability ) the hash string is the same
 * for two inputs if and only if the inputs describe the same taxonomy . So
 * it can be used to compare classification results .
 * @ param taxonomy
 * @ return hash string */
public static String getHashString ( Taxonomy < ? extends ElkEntity > taxonomy ) { } }

implementation: return Integer . toHexString ( TaxonomyHasher . hash ( taxonomy ) ) ;


signature:
public class TaxonomyPrinter { /** * Process a taxonomy and write a normalized serialization .
 * @ param taxonomy
 * @ param writer
 * @ throws IOException */
protected static < T extends ElkEntity > void processTaxomomy ( final Taxonomy < T > taxonomy , final Appendable writer ) throws IOException { } }

implementation:
final ElkObject . Factory factory = new ElkObjectEntityRecyclingFactory ( ) ; // Declarations .
final List < T > members = new ArrayList < T > ( taxonomy . getNodes ( ) . size ( ) * 2 ) ; for ( final TaxonomyNode < T > node : taxonomy . getNodes ( ) ) { for ( final T member : node ) { // TODO : this should check whether IRIs are predefined !
if ( ! member . getIri ( ) . equals ( taxonomy . getTopNode ( ) . getCanonicalMember ( ) . getIri ( ) ) && ! member . getIri ( ) . equals ( taxonomy . getBottomNode ( ) . getCanonicalMember ( ) . getIri ( ) ) ) { members . add ( member ) ; } } } Collections . sort ( members , taxonomy . getKeyProvider ( ) . getComparator ( ) ) ; printDeclarations ( members , factory , writer ) ; // Relations .
final TreeSet < T > canonicalMembers = new TreeSet < T > ( taxonomy . getKeyProvider ( ) . getComparator ( ) ) ; for ( final TaxonomyNode < T > node : taxonomy . getNodes ( ) ) { canonicalMembers . add ( node . getCanonicalMember ( ) ) ; } for ( final T canonicalMember : canonicalMembers ) { final TaxonomyNode < T > node = taxonomy . getNode ( canonicalMember ) ; final ArrayList < T > orderedEquivalentMembers = new ArrayList < T > ( node . size ( ) ) ; for ( final T member : node ) { orderedEquivalentMembers . add ( member ) ; } Collections . sort ( orderedEquivalentMembers , taxonomy . getKeyProvider ( ) . getComparator ( ) ) ; final TreeSet < T > orderedSuperMembers = new TreeSet < T > ( taxonomy . getKeyProvider ( ) . getComparator ( ) ) ; for ( final TaxonomyNode < T > superNode : node . getDirectSuperNodes ( ) ) { orderedSuperMembers . add ( superNode . getCanonicalMember ( ) ) ; } printMemberAxioms ( canonicalMember , orderedEquivalentMembers , orderedSuperMembers , taxonomy , factory , writer ) ; }


signature:
public class TaxonomyPrinter { /** * Process axioms related to one member of { @ link Taxonomy } , where the
 * relevant related members are given in two ordered collections of
 * equivalent members and super - members , respectively . The method serializes
 * the axioms to the Writer . */
protected static < T extends ElkEntity , I extends ElkEntity > void printMemberAxioms ( final I member , final List < I > equivalentMembers , final SortedSet < T > directSuperMembers , final Taxonomy < T > taxonomy , final ElkObject . Factory factory , final Appendable writer ) throws IOException { } }

implementation:
if ( equivalentMembers . size ( ) > 1 ) { final ElkAxiom axiom = member . accept ( getEquivalentAxiomProvider ( equivalentMembers , factory ) ) ; OwlFunctionalStylePrinter . append ( writer , axiom , true ) ; writer . append ( '\n' ) ; } // TODO : this should exclude implicit axioms as owl : Thing ⊑ owl : Nothing
if ( ! member . equals ( taxonomy . getBottomNode ( ) . getCanonicalMember ( ) ) ) { for ( final T superMember : directSuperMembers ) { if ( ! superMember . equals ( taxonomy . getTopNode ( ) . getCanonicalMember ( ) ) ) { final ElkAxiom axiom = member . accept ( getSubAxiomProvider ( superMember , factory ) ) ; OwlFunctionalStylePrinter . append ( writer , axiom , true ) ; writer . append ( '\n' ) ; } } }


signature:
public class ClassInferenceBlockingFilter { /** * Records that the given { @ link ClassInference } has the given premise
 * { @ code ClassConclusion } that is not a conclusion of any inference in
 * { @ link # output _ } that do not use the conclusion of this
 * { @ link ClassInference } as one of the premises
 * @ param inference
 * @ param conclusion */
private void block ( ClassInference inference , ClassConclusion conclusion ) { } }

implementation: List < ClassInference > blockedForConclusion = blocked_ . get ( conclusion ) ; if ( blockedForConclusion == null ) { blockedForConclusion = new ArrayList < ClassInference > ( ) ; blocked_ . put ( conclusion , blockedForConclusion ) ; } blockedForConclusion . add ( inference ) ;


signature:
public class InstanceTaxonomyHasher { /** * Compute the hash code of a taxonomy .
 * @ param taxonomy
 * @ return hash */
public static int hash ( InstanceTaxonomy < ? extends ElkEntity , ? extends ElkEntity > taxonomy ) { } }

implementation: int typeHash = HashGenerator . combineMultisetHash ( true , taxonomy . getNodes ( ) , TypeNodeHasher . INSTANCE ) ; int instanceHash = HashGenerator . combineMultisetHash ( true , taxonomy . getInstanceNodes ( ) , InstanceNodeHasher . INSTANCE ) ; return HashGenerator . combineListHash ( typeHash , instanceHash ) ;


signature:
public class PropagationFromExistentialFillerRule { /** * Produces propagations of { @ link IndexedObjectSomeValuesFrom } over the
 * given { @ link IndexedObjectProperty } in the given { @ link Context }
 * @ param property
 * @ param premises
 * @ param producer */
void applyForProperty ( IndexedObjectProperty property , ContextPremises premises , ClassInferenceProducer producer ) { } }

implementation: for ( IndexedObjectSomeValuesFrom e : negExistentials_ ) { if ( e . getProperty ( ) . getSaturated ( ) . getSubPropertyChains ( ) . contains ( property ) ) { producer . produce ( new PropagationGenerated ( premises . getRoot ( ) , property , e ) ) ; } }


signature:
public class ConcurrentComputationWithInputs { /** * Submitting a new input for processing . Submitted input jobs are first
 * buffered , and then concurrently processed by workers . If the buffer is
 * full , the method blocks until new space is available .
 * @ param input
 * the input to be processed
 * @ return { @ code true } if the input has been successfully submitted for
 * computation ; the input cannot be submitted , e . g . , if
 * { @ link # finish ( ) } has been called
 * @ throws InterruptedException
 * thrown if interrupted during waiting for space to be
 * available */
public synchronized boolean submit ( I input ) throws InterruptedException { } }

implementation: if ( termination || isInterrupted ( ) ) return false ; buffer_ . put ( input ) ; return true ;


signature:
public class OwlFunctionalStylePrinter { /** * Printing an ELK Object through an appender .
 * @ param appender
 * the appender used for printing
 * @ param elkObject
 * the ELK Object to print
 * @ throws IOException
 * if an I / O Error occurs */
public static void append ( Appendable appender , ElkObject elkObject ) throws IOException { } }

implementation: append ( appender , elkObject , false ) ;


signature:
public class SaturatedPropertyChain { /** * Clear all derived information for this { @ link SaturatedPropertyChain } */
public void clear ( ) { } }

implementation: derivedSubProperties = null ; derivedSubProperyChains = null ; derivedSubPropertiesComputed = false ; derivedRanges = null ; derivedRangesComputed = false ; leftSubComposableSubPropertiesByRightProperties = null ; leftSubComposableSubPropertiesByRightPropertiesComputed = false ; nonRedundantCompositionsByLeftSubProperty = null ; redundantCompositionsByLeftSubProperty = null ; nonRedundantCompositionsByRightSubProperty = null ; redundantCompositionsByRightSubProperty = null ;


signature:
public class SaturatedPropertyChain { /** * Prints differences with other { @ link SaturatedPropertyChain }
 * @ param other
 * the { @ link SaturatedPropertyChain } with which to compare this
 * { @ link SaturatedPropertyChain }
 * @ throws IOException */
public void dumpDiff ( SaturatedPropertyChain other , Writer writer ) throws IOException { } }

implementation:
// comparing roots
if ( this . root != other . root ) writer . append ( "this root: " + root + "; other root: " + other . root + "\n" ) ; // comparing derived sub - properties
Operations . dumpDiff ( this . getSubPropertyChains ( ) , other . getSubPropertyChains ( ) , writer , root + ": this sub-property not in other: " ) ; Operations . dumpDiff ( other . getSubPropertyChains ( ) , this . getSubPropertyChains ( ) , writer , root + ": other sub-property not in this: " ) ; // comparing derived compositions
Operations . dumpDiff ( this . getNonRedundantCompositionsByLeftSubProperty ( ) , other . getNonRedundantCompositionsByLeftSubProperty ( ) , writer , root + ": this non-redundant left composition not in other: " ) ; Operations . dumpDiff ( this . getRedundantCompositionsByLeftSubProperty ( ) , other . getRedundantCompositionsByLeftSubProperty ( ) , writer , root + ": this redundant left composition not in other: " ) ; Operations . dumpDiff ( other . getNonRedundantCompositionsByLeftSubProperty ( ) , this . getNonRedundantCompositionsByLeftSubProperty ( ) , writer , root + ": other non-redundant left composition not in this: " ) ; Operations . dumpDiff ( other . getRedundantCompositionsByLeftSubProperty ( ) , this . getRedundantCompositionsByLeftSubProperty ( ) , writer , root + ": other redundant left composition not in this: " ) ; Operations . dumpDiff ( this . getNonRedundantCompositionsByRightSubProperty ( ) , other . getNonRedundantCompositionsByRightSubProperty ( ) , writer , root + ": this non-redundant right composition not in other: " ) ; Operations . dumpDiff ( this . getRedundantCompositionsByRightSubProperty ( ) , other . getRedundantCompositionsByRightSubProperty ( ) , writer , root + ": this redundant right composition not in other: " ) ; Operations . dumpDiff ( other . getNonRedundantCompositionsByRightSubProperty ( ) , this . getNonRedundantCompositionsByRightSubProperty ( ) , writer , root + ": other non-redundant right composition not in this: " ) ; Operations . dumpDiff ( other . getRedundantCompositionsByRightSubProperty ( ) , this . getRedundantCompositionsByRightSubProperty ( ) , writer , root + ": other redundant right composition not in this: " ) ;


signature:
public class ArrayHashSet { /** * Increasing the capacity of the table */
private void enlarge ( ) { } }

implementation: int oldCapacity = data . length ; if ( oldCapacity == LinearProbing . MAXIMUM_CAPACITY ) throw new IllegalArgumentException ( "The set cannot grow beyond the capacity: " + LinearProbing . MAXIMUM_CAPACITY ) ; E [ ] oldData = data ; int newCapacity = oldCapacity << 1 ; @ SuppressWarnings ( "unchecked" ) E [ ] newData = ( E [ ] ) new Object [ newCapacity ] ; for ( int i = 0 ; i < oldCapacity ; i ++ ) { E e = oldData [ i ] ; if ( e != null ) LinearProbing . add ( newData , e ) ; } this . data = newData ;


signature:
public class ArrayHashSet { /** * Decreasing the capacity of the table */
private void shrink ( ) { } }

implementation: int oldCapacity = data . length ; if ( oldCapacity == 1 ) return ; E [ ] oldData = data ; int newCapacity = oldCapacity >> 1 ; @ SuppressWarnings ( "unchecked" ) E [ ] newData = ( E [ ] ) new Object [ newCapacity ] ; for ( int i = 0 ; i < oldCapacity ; i ++ ) { E e = oldData [ i ] ; if ( e != null ) LinearProbing . add ( newData , e ) ; } this . data = newData ;


signature:
public class BenchmarkUtils { /** * Checks that all System properties are set . We use System properties
 * ( other than cmd args ) because they ' re easier to pass parameters into
 * maven tests ( via Surefire or Failsafe plugins ) */
public static Map < String , String > getSystemProperties ( String ... names ) { } }

implementation: Map < String , String > propMap = new HashMap < String , String > ( ) ; for ( String name : names ) { checkIfSet ( name , propMap ) ; } return propMap ;


signature:
public class BenchmarkUtils { /** * A macro method , reads system properties , instantiates the task and runs
 * it */
public static void runTask ( ) throws Exception { } }

implementation:
Map < String , String > propMap = BenchmarkUtils . getSystemProperties ( new String [ ] { Constants . TASK_CLASS_NAME , Constants . WARM_UPS , Constants . RUNS , Constants . TASK_PARAMS } ) ; // First , need to instantiate the task
Task task = TaskFactory . createTask ( propMap . get ( Constants . TASK_CLASS_NAME ) , BenchmarkUtils . getCommaSeparatedParameter ( Constants . TASK_PARAMS ) ) ; TaskRunner runner = new TaskRunner ( Integer . valueOf ( propMap . get ( Constants . WARM_UPS ) ) , Integer . valueOf ( propMap . get ( Constants . RUNS ) ) ) ; runner . run ( task ) ;


signature:
public class BenchmarkUtils { /** * A macro method , reads system properties , instantiates the task collection
 * and runs it */
public static void runTaskCollection ( ) throws Exception { } }

implementation: Map < String , String > propMap = BenchmarkUtils . getSystemProperties ( new String [ ] { Constants . TASK_CLASS_NAME , Constants . WARM_UPS , Constants . RUNS , Constants . TASK_PARAMS } ) ; TaskCollection collection = TaskFactory . createTaskCollection ( propMap . get ( Constants . TASK_CLASS_NAME ) , BenchmarkUtils . getCommaSeparatedParameter ( Constants . TASK_PARAMS ) ) ; RepeatEachTaskRunner runner = new RepeatEachTaskRunner ( Integer . valueOf ( propMap . get ( Constants . WARM_UPS ) ) , Integer . valueOf ( propMap . get ( Constants . RUNS ) ) ) ; runner . run ( collection ) ;


signature:
public class BenchmarkUtils { /** * TODO need a better name */
public static void runTaskCollection2 ( String taskClass , int warmups , int runs , String [ ] params ) throws Exception { } }

implementation: VisitorTaskCollection collection = TaskFactory . createTaskCollection2 ( taskClass , params ) ; RunAllOnceThenRepeatRunner runner = new RunAllOnceThenRepeatRunner ( warmups , runs ) ; try { runner . run ( collection ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; throw e ; }


signature:
public class AbstractForwardLinkInference { /** * @ param factory
 * the factory for creating conclusions
 * @ return the conclusion produced by this inference */
public final ForwardLink getConclusion ( ForwardLink . Factory factory ) { } }

implementation: return factory . getForwardLink ( getDestination ( ) , getChain ( ) , getTarget ( ) ) ;


signature: public class AbstractObjectPropertyInference { @ Override public final < O > O accept ( TracingInference . Visitor < O > visitor ) { } }

implementation: return accept ( ( ObjectPropertyInference . Visitor < O > ) visitor ) ;


signature:
public class OwlConverter { /** * One - parameter , public , non - static methods called " convert " and declared
 * in this class specify mapping between { @ link OWLObject } subclasses
 * ( parameter ) and { @ link ElkObject } subclasses ( return type ) . This method
 * returns a subclass of { @ link ElkObject } to which the subclass of
 * { @ link OWLObject } specified as the parameter is mapped , or { @ code null }
 * if it is not mapped .
 * @ param owlClass
 * @ return */
public static Class < ? extends ElkObject > convertType ( final Class < ? > owlClass ) { } }

implementation: if ( ! OWLObject . class . isAssignableFrom ( owlClass ) ) { return null ; } for ( final Method declaredMethod : OwlConverter . class . getDeclaredMethods ( ) ) { final int mod = declaredMethod . getModifiers ( ) ; final Class < ? > [ ] parameterTypes = declaredMethod . getParameterTypes ( ) ; final Class < ? > returnType = declaredMethod . getReturnType ( ) ; if ( "convert" . equals ( declaredMethod . getName ( ) ) && Modifier . isPublic ( mod ) && ! Modifier . isStatic ( mod ) && parameterTypes . length == 1 && parameterTypes [ 0 ] . equals ( owlClass ) && ElkObject . class . isAssignableFrom ( returnType ) ) { return returnType . asSubclass ( ElkObject . class ) ; } } return null ;


signature:
public class RuleVisitors { /** * @ param visitor
 * @ return A { @ link RuleVisitor } that delegates the calls to the provided
 * { @ link RuleVisitor } when for the { @ link Rule } which accepts this
 * visitor , { @ link Rule # isTracingRule ( ) } returns { @ code true } . Otherwise
 * the { @ link RuleVisitor } returns { @ code null } .
 * @ see Rule # isTracingRule ( ) */
public static < O > RuleVisitor < O > getTracingVisitor ( RuleVisitor < O > visitor ) { } }

implementation: return new ConditionalRuleVisitor < O > ( visitor , LOCALITY_CHECKER_ ) ;


signature:
public class RuleVisitors { /** * @ param visitor
 * the { @ link SubsumerDecompositionVisitor } used to execute the
 * methods
 * @ param timer
 * the { @ link RuleApplicationTimer } used to mesure the time spent
 * within the methods
 * @ return a new { @ link SubsumerDecompositionVisitor } that executes the
 * corresponding methods of the given
 * { @ link SubsumerDecompositionVisitor } and measures the time spent
 * within the corresponding methods using the given
 * { @ link RuleApplicationTimer } . */
public static < O > RuleVisitor < O > getTimedVisitor ( RuleVisitor < O > visitor , RuleApplicationTimer timer ) { } }

implementation: return new RuleApplicationTimerVisitor < O > ( visitor , timer ) ;


signature:
public class AbstractRuleEngine { /** * Process all pending { @ link ClassInference } s of the given { @ link Context }
 * @ param context
 * the active { @ link Context } with unprocessed
 * { @ link ClassInference } s */
void process ( Context context ) { } }

implementation:
activeContext_ . set ( context ) ; // at this point workerLocalTodo _ must be empty
workerLocalTodo_ . setActiveRoot ( context . getRoot ( ) ) ; for ( ; ; ) { ClassInference inference = workerLocalTodo_ . poll ( ) ; if ( inference == null ) { inference = context . takeToDo ( ) ; if ( inference == null ) return ; } LOGGER_ . trace ( "{}: processing inference {}" , context , inference ) ; inference . accept ( inferenceProcessor_ ) ; }


signature:
public class ClassExpressionQueryState { /** * If the specified query was added to the index , this method marks it as
 * computed . Does < strong > not < / strong > modify the cached query results .
 * @ param queryClass
 * @ return query state iff the parameter was queried , added to the index ,
 * and the query was not - computed just before the call and was
 * marked computed by this call , otherwise { @ code null } . */
private QueryState markComputed ( final IndexedClassExpression queryClass ) { } }

implementation: final QueryState state = indexed_ . get ( queryClass ) ; if ( state == null || state . isComputed ) { return null ; } state . isComputed = true ; LOGGER_ . trace ( "query computed {}" , queryClass ) ; return state ;


signature:
public class ClassExpressionQueryState { /** * If the specified query was added to the index , this method marks it as
 * not - computed and deletes the query results .
 * @ param queryClass
 * @ return query state iff the parameter was queried , added to the index ,
 * and the query was computed just before the call and was marked
 * not - computed by this call , otherwise { @ code null } . */
private QueryState markNotComputed ( final IndexedClassExpression queryClass ) { } }

implementation: final QueryState state = indexed_ . get ( queryClass ) ; if ( state == null || ! state . isComputed ) { return null ; } state . isComputed = false ; if ( state . node != null ) { removeAllRelated ( queryClass , state . node ) ; state . node = null ; } return state ;


signature:
public class ClassExpressionQueryState { /** * Registers the supplied class expression for querying . If the expression
 * has already been registered , returns { @ code false } . Otherwise , if this
 * state did not keep track of the expression yet , returns { @ code true } . If
 * all necessary stages are run after doing this , the result retrieval
 * methods , e . g . , { @ link # isSatisfiable ( ElkClassExpression ) } , will not throw
 * { @ link ElkQueryException } .
 * @ param classExpression
 * @ return { @ code true } if this is a new query , { @ code false } if this class
 * expression has already been registered . */
boolean registerQuery ( final ElkClassExpression classExpression ) { } }

implementation:
LOGGER_ . trace ( "class expression query registered {}" , classExpression ) ; lastQueries_ . clear ( ) ; queriedEvictor_ . add ( classExpression ) ; lastQueries_ . add ( classExpression ) ; QueryState state = queried_ . get ( classExpression ) ; if ( state != null ) { return false ; } // Create query state .
state = new QueryState ( ) ; queried_ . put ( classExpression , state ) ; toLoad_ . offer ( classExpression ) ; return true ;


signature:
public class ClassExpressionQueryState { /** * Checks whether the supplied class expression is satisfiable , if the
 * result was already computed . If the class expression was not registered
 * by { @ link # registerQuery ( ElkClassExpression ) } or the appropriate stage
 * was not completed yet , throws { @ link ElkQueryException } .
 * @ param classExpression
 * @ return whether the supplied class expression is satisfiable .
 * @ throws ElkQueryException
 * if the result is not ready */
boolean isSatisfiable ( final ElkClassExpression classExpression ) throws ElkQueryException { } }

implementation: final QueryState state = checkComputed ( classExpression ) ; return state . node != null ;


signature:
public class ClassExpressionQueryState { /** * Returns { @ link Node } containing all { @ link ElkClass } es equivalent to the
 * supplied class expression , if it is satisfiable . Returns
 * < code > null < / code > otherwise . If the class expression was not registered
 * by { @ link # registerQuery ( ElkClassExpression ) } or the appropriate stage
 * was not completed yet , throws { @ link ElkQueryException } .
 * @ param classExpression
 * @ return atomic classes equivalent to the supplied class expression , if it
 * is satisfiable , otherwise < code > null < / code > .
 * @ throws ElkQueryException
 * if the result is not ready */
Node < ElkClass > getEquivalentClasses ( final ElkClassExpression classExpression ) throws ElkQueryException { } }

implementation: final QueryState state = checkComputed ( classExpression ) ; return state . node ;


signature:
public class ClassExpressionQueryState { /** * Returns set of { @ link Node } s containing all { @ link ElkClass } es that are
 * direct strict super - classes of the supplied class expression , if it is
 * satisfiable . Returns < code > null < / code > otherwise . If the class expression
 * was not registered by { @ link # registerQuery ( ElkClassExpression ) } or the
 * appropriate stage was not completed yet , throws { @ link ElkQueryException }
 * @ param classExpression
 * @ return atomic direct strict super - classes of the supplied class
 * expression , if it is satisfiable , otherwise < code > null < / code > .
 * @ throws ElkQueryException
 * if the result is not ready */
Set < ? extends Node < ElkClass > > getDirectSuperClasses ( final ElkClassExpression classExpression ) throws ElkQueryException { } }

implementation: final QueryState state = checkComputed ( classExpression ) ; if ( state . node == null ) { return null ; } else { return state . node . getDirectSuperNodes ( ) ; }


signature:
public class ClassExpressionQueryState { /** * Returns set of { @ link Node } s containing all { @ link ElkClass } es that are
 * direct strict sub - classes of the supplied class expression , if it is
 * satisfiable . Returns < code > null < / code > otherwise . If the class expression
 * was not registered by { @ link # registerQuery ( ElkClassExpression ) } or the
 * appropriate stage was not completed yet , throws { @ link ElkQueryException }
 * @ param classExpression
 * @ param taxonomy
 * @ return atomic direct strict sub - classes of the supplied class
 * expression , if it is satisfiable , otherwise < code > null < / code > .
 * @ throws ElkQueryException
 * if the result is not ready */
Set < ? extends Node < ElkClass > > getDirectSubClasses ( final ElkClassExpression classExpression , final Taxonomy < ElkClass > taxonomy ) throws ElkQueryException { } }

implementation:
final QueryState state = checkComputed ( classExpression ) ; if ( state . node == null ) { return null ; } // else
final Iterator < ElkClass > iter = state . node . iterator ( ) ; if ( iter . hasNext ( ) ) { final ElkClass cls = iter . next ( ) ; return taxonomy . getNode ( cls ) . getDirectSubNodes ( ) ; } /* * Else , if classExpression is not equivalent to any atomic class ,
 * direct atomic sub - classes of classExpression are atomic classes that
 * have classExpression among their subsumers , but no other of their
 * strict subsumers have classExpression among its subsumers . */
final Collection < ? extends IndexedClass > allClasses = saturationState_ . getOntologyIndex ( ) . getClasses ( ) ; final Set < IndexedClass > strictSubclasses = new ArrayHashSet < IndexedClass > ( allClasses . size ( ) ) ; for ( final IndexedClass ic : allClasses ) { final Set < IndexedClassExpression > subsumers = ic . getContext ( ) . getComposedSubsumers ( ) ; if ( subsumers . contains ( state . indexed ) && state . indexed . getContext ( ) . getComposedSubsumers ( ) . size ( ) != subsumers . size ( ) ) { // is subclass , but not equivalent
strictSubclasses . add ( ic ) ; } } final Set < TaxonomyNode < ElkClass > > result = new ArrayHashSet < TaxonomyNode < ElkClass > > ( ) ; for ( final IndexedClass strictSubclass : strictSubclasses ) { /* * If some strict superclass of strictSubclass is a strict subclass
 * of classExpression , strictSubclass is not direct .
 * It is sufficient to check only direct superclasses of
 * strictSubclass . */
boolean isDirect = true ; for ( final TaxonomyNode < ElkClass > superNode : taxonomy . getNode ( strictSubclass . getElkEntity ( ) ) . getDirectSuperNodes ( ) ) { final IndexedClassExpression superClass = superNode . getCanonicalMember ( ) . accept ( resolvingExpressionConverter_ ) ; if ( strictSubclasses . contains ( superClass ) ) { isDirect = false ; break ; } } if ( isDirect ) { result . add ( taxonomy . getNode ( strictSubclass . getElkEntity ( ) ) ) ; } } if ( result . isEmpty ( ) ) { /* * No indexed class has classExpression among its subsumers and
 * classExpression is not equivalent to any atomic class , so the
 * only subclass of classExpression is Nothing and it is direct . */
result . add ( taxonomy . getBottomNode ( ) ) ; } return Collections . unmodifiableSet ( result ) ;


signature:
public class ClassExpressionQueryState { /** * Returns set of { @ link Node } s containing all { @ link ElkNamedIndividual } s
 * that are direct instances of the supplied class expression , if it is
 * satisfiable . Returns < code > null < / code > otherwise . If the class expression
 * was not registered by { @ link # registerQuery ( ElkClassExpression ) } or the
 * appropriate stage was not completed yet , throws { @ link ElkQueryException }
 * @ param classExpression
 * @ param taxonomy
 * @ return direct instances of the supplied class expression , if it is
 * satisfiable , otherwise < code > null < / code > .
 * @ throws ElkQueryException
 * if the result is not ready */
Set < ? extends Node < ElkNamedIndividual > > getDirectInstances ( final ElkClassExpression classExpression , final InstanceTaxonomy < ElkClass , ElkNamedIndividual > taxonomy ) throws ElkQueryException { } }

implementation:
final QueryState state = checkComputed ( classExpression ) ; if ( state . node == null ) { return null ; } // else
final Iterator < ElkClass > iter = state . node . iterator ( ) ; if ( iter . hasNext ( ) ) { final ElkClass cls = iter . next ( ) ; return taxonomy . getNode ( cls ) . getDirectInstanceNodes ( ) ; } /* * Else , if classExpression is not equivalent to any atomic class ,
 * direct instances of classExpression are instances that have
 * classExpression among their subsumers , but no other of their strict
 * subsumers have classExpression among its subsumers . */
final Collection < ? extends IndexedIndividual > allIndividuals = saturationState_ . getOntologyIndex ( ) . getIndividuals ( ) ; final Set < IndexedIndividual > instances = new ArrayHashSet < IndexedIndividual > ( allIndividuals . size ( ) ) ; for ( final IndexedIndividual ii : allIndividuals ) { final Set < IndexedClassExpression > subsumers = ii . getContext ( ) . getComposedSubsumers ( ) ; if ( subsumers . contains ( state . indexed ) ) { instances . add ( ii ) ; } } final Set < InstanceNode < ElkClass , ElkNamedIndividual > > result = new ArrayHashSet < InstanceNode < ElkClass , ElkNamedIndividual > > ( ) ; for ( final IndexedIndividual instance : instances ) { /* * If some type of instance is a strict subclass of classExpression ,
 * instance is not direct .
 * It is sufficient to check only direct types of instance . */
boolean isDirect = true ; for ( final TypeNode < ElkClass , ElkNamedIndividual > typeNode : taxonomy . getInstanceNode ( instance . getElkEntity ( ) ) . getDirectTypeNodes ( ) ) { final IndexedClassExpression type = typeNode . getCanonicalMember ( ) . accept ( resolvingExpressionConverter_ ) ; final Set < IndexedClassExpression > subsumers = type . getContext ( ) . getComposedSubsumers ( ) ; if ( subsumers . contains ( state . indexed ) && state . indexed . getContext ( ) . getComposedSubsumers ( ) . size ( ) != subsumers . size ( ) ) { // is subclass , but not equivalent
isDirect = false ; break ; } } if ( isDirect ) { result . add ( taxonomy . getInstanceNode ( instance . getElkEntity ( ) ) ) ; } } return Collections . unmodifiableSet ( result ) ;


signature:
public class ClassConclusionInsertionVisitor { /** * logging is switched off */
@ Override protected Boolean defaultVisit ( ClassConclusion conclusion ) { } }

implementation: Context context = get ( ) ; boolean result = context . addConclusion ( conclusion ) ; if ( LOGGER_ . isTraceEnabled ( ) ) { LOGGER_ . trace ( "{}: inserting {}: {}" , context , conclusion , result ? "success" : "failure" ) ; } return result ;


signature:
public class IncrementalClassificationTask { /** * can return a smaller subset than requested because one axiom can be
 * randomly picked more than once */
protected Set < ElkAxiom > getRandomSubset ( List < ElkAxiom > axioms , Random rnd ) { } }

implementation: int size = axiomsToChange > 0 ? axiomsToChange : Math . max ( 1 , axioms . size ( ) / 100 ) ; Set < ElkAxiom > subset = new ArrayHashSet < ElkAxiom > ( size ) ; if ( size >= axioms . size ( ) ) { subset . addAll ( axioms ) ; } else { for ( int i = 0 ; i < size ; i ++ ) { ElkAxiom axiom = axioms . get ( rnd . nextInt ( size ) ) ; subset . add ( axiom ) ; } } return subset ;


signature:
public class TaxonomyHasher { /** * Compute the hash code of a taxonomy .
 * @ param taxonomy
 * @ return hash */
public static int hash ( Taxonomy < ? extends ElkEntity > taxonomy ) { } }

implementation: return HashGenerator . combineMultisetHash ( true , taxonomy . getNodes ( ) , TaxonomyNodeHasher . INSTANCE ) ;


signature:
public class IndividualNode { /** * Add a direct super - class node . This method is not thread safe .
 * @ param typeNode
 * node to add */
@ Override public synchronized void addDirectTypeNode ( final UTN typeNode ) { } }

implementation: LOGGER_ . trace ( "{}: new direct type-node {}" , this , typeNode ) ; directTypeNodes_ . add ( typeNode ) ;


signature:
public class AbstractRuleApplicationFactory { /** * Creates a new primary { @ link SaturationStateWriter } for the
 * { @ link SaturationState } to be used by an engine of this
 * { @ link RuleApplicationFactory } . This { @ link SaturationStateWriter } can be
 * further extended and optimized .
 * @ param creationListener
 * @ param modificationListener
 * @ return a new writer for the main { @ link SaturationState } to be used by
 * engine . */
SaturationStateWriter < ? extends C > getBaseWriter ( ContextCreationListener creationListener , ContextModificationListener modificationListener ) { } }

implementation:
// by default the writer can create new contexts
return saturationState_ . getContextCreatingWriter ( creationListener , modificationListener ) ;


signature:
public class AbstractMatch { /** * some methods for checking correctness of arguments */
protected static void checkChainMatch ( final ElkSubObjectPropertyExpression fullChain , final int startPos ) { } }

implementation:
// verifies that start position exists in full chain
fullChain . accept ( new ElkSubObjectPropertyExpressionVisitor < Void > ( ) { void fail ( ) { throw new IllegalArgumentException ( fullChain + ", " + startPos ) ; } Void defaultVisit ( ElkObjectPropertyExpression expression ) { if ( startPos != 0 ) { fail ( ) ; } return null ; } @ Override public Void visit ( ElkObjectPropertyChain expression ) { if ( startPos < 0 || startPos >= expression . getObjectPropertyExpressions ( ) . size ( ) ) fail ( ) ; return null ; } @ Override public Void visit ( ElkObjectInverseOf expression ) { return defaultVisit ( expression ) ; } @ Override public Void visit ( ElkObjectProperty expression ) { return defaultVisit ( expression ) ; } } ) ;


signature:
public class Operations { /** * Concatenates several { @ link Iterable } s into one
 * @ param inputs
 * the { @ link Iterable } of { @ link Iterable } s to be concatenated
 * @ return { @ link Iterable } consisting of all elements found in input
 * { @ link Iterable } s */
public static < T > Iterable < T > concat ( final Iterable < ? extends Iterable < ? extends T > > inputs ) { } }

implementation: assert inputs != null ; return new Iterable < T > ( ) { @ Override public Iterator < T > iterator ( ) { return new Iterator < T > ( ) { Iterator < ? extends Iterable < ? extends T > > outer = inputs . iterator ( ) ; Iterator < ? extends T > inner ; boolean hasNext = advance ( ) ; @ Override public boolean hasNext ( ) { return hasNext ; } @ Override public T next ( ) { if ( hasNext ) { T result = inner . next ( ) ; hasNext = advance ( ) ; return result ; } throw new NoSuchElementException ( ) ; } @ Override public void remove ( ) { throw new UnsupportedOperationException ( ) ; } boolean advance ( ) { while ( true ) { if ( inner != null && inner . hasNext ( ) ) return true ; if ( outer . hasNext ( ) ) inner = outer . next ( ) . iterator ( ) ; else return false ; } } } ; } } ;