private Set < TableEntry > search ( final ProtoNetwork pn , String ... literals ) { Set < TableEntry > ret ; if ( noItems ( literals ) ) { return emptySet ( ) ; } // An initial capacity would be ideal for this set, but we don't // have any reasonable estimations. ret = new HashSet < TableEntry > ( ) ; // Establish access to the relevant table objects final ParameterTable paramTbl = pn . getParameterTable ( ) ; final TermTable termTbl = pn . getTermTable ( ) ; final List < String > terms = termTbl . getTermValues ( ) ; final NamespaceTable nsTbl = pn . getNamespaceTable ( ) ; final int [ ] [ ] indata = pn . getTermIndices ( ) ; final Set < String > literalSet = constrainedHashSet ( literals . length ) ; for ( final String s : literals ) { literalSet . add ( s ) ; } // Search indata for elements of the term literal set for ( int i = 0 ; i < indata . length ; i ++ ) { int tid = indata [ i ] [ TERM_INDEX ] ; String string = terms . get ( tid ) ; if ( ! literalSet . contains ( string ) ) { continue ; } int pid = indata [ i ] [ PARAM_INDEX ] ; final TableParameter tp = paramTbl . getTableParameter ( pid ) ; final String inval = tp . getValue ( ) ; int nid = indata [ i ] [ NAMESPACE_INDEX ] ; final TableNamespace tns = nsTbl . getTableNamespace ( nid ) ; String inrl = null ; if ( tns != null ) inrl = tns . getResourceLocation ( ) ; final TableEntry te = new TableEntry ( inval , inrl ) ; ret . add ( te ) ; } return ret ; }
Aggregate the set of all table entries for a proto - network that match at least one of the provided term literals .