idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
10,400
public boolean contains ( int ele ) { int idx ; idx = ele >> SHIFT ; if ( idx >= data . length ) { return false ; } return ( data [ idx ] & ( 1 << ele ) ) != 0 ; }
Lookup a specific element .
10,401
public void add ( int ele ) { int idx ; idx = ele >> SHIFT ; if ( idx >= data . length ) { resize ( idx + 1 + GROW ) ; } data [ ele >> SHIFT ] |= ( 1 << ele ) ; }
Add an element .
10,402
public void addRange ( int first , int last ) { int ele ; for ( ele = first ; ele <= last ; ele ++ ) { add ( ele ) ; } }
Add all elements in the indicated range . Nothing is set for first &gt ; last .
10,403
public void remove ( int ele ) { int idx ; idx = ele >> SHIFT ; if ( idx < data . length ) { data [ idx ] &= ~ ( 1 << ele ) ; } }
Remove an element from the set .
10,404
public void removeRange ( int first , int last ) { int ele ; for ( ele = first ; ele <= last ; ele ++ ) { remove ( ele ) ; } }
Remove all elements in the indicated range .
10,405
public boolean containsAll ( IntBitSet set ) { int i , end ; if ( data . length < set . data . length ) { end = data . length ; for ( i = end ; i < set . data . length ; i ++ ) { if ( set . data [ i ] != 0 ) { return false ; } } } else { end = set . data . length ; } for ( i = 0 ; i < end ; i ++ ) { if ( ( set . data [...
The subset test .
10,406
public void retainAll ( IntBitSet set ) { int i ; if ( set . data . length > data . length ) { resize ( set . data . length ) ; } for ( i = 0 ; i < set . data . length ; i ++ ) { data [ i ] &= set . data [ i ] ; } for ( ; i < data . length ; i ++ ) { data [ i ] = 0 ; } }
Computes the intersection . The result is stored in this set .
10,407
public void removeAll ( IntBitSet set ) { int i , end ; end = ( set . data . length < data . length ) ? set . data . length : data . length ; for ( i = 0 ; i < end ; i ++ ) { data [ i ] &= ~ set . data [ i ] ; } }
Computes the set difference . The result is stored in this set .
10,408
public void addAll ( IntBitSet set ) { int i ; if ( set . data . length > data . length ) { resize ( set . data . length ) ; } for ( i = 0 ; i < set . data . length ; i ++ ) { data [ i ] |= set . data [ i ] ; } }
Computes the union . The result is stored in this set .
10,409
public int size ( ) { int ele , count ; count = 0 ; for ( ele = first ( ) ; ele != - 1 ; ele = next ( ele ) ) { count ++ ; } return count ; }
Counts the elements .
10,410
public int [ ] toArray ( ) { int i , ele ; int [ ] result ; result = new int [ size ( ) ] ; for ( ele = first ( ) , i = 0 ; ele != - 1 ; ele = next ( ele ) , i ++ ) { result [ i ] = ele ; } return result ; }
Creates an array with all elements of the set .
10,411
private void resize ( int s ) { int [ ] n ; int count ; n = new int [ s ] ; count = ( s < data . length ) ? s : data . length ; System . arraycopy ( data , 0 , n , 0 , count ) ; data = n ; }
Changes data to have data . length > = s components . All data components that fit into the new size are preserved .
10,412
public final synchronized void start ( ) throws IOException { LaunchingMessageKind . IJMX0001 . format ( this . host , this . port ) ; this . mbs = ManagementFactory . getPlatformMBeanServer ( ) ; final String oldRmiServerName = System . getProperty ( "java.rmi.server.hostname" ) ; System . setProperty ( "java.rmi.serv...
Start the JMX Server
10,413
public final synchronized void stop ( ) { LaunchingMessageKind . IJMX0003 . format ( ) ; unRegisterMBeans ( ) ; try { if ( this . jmxConnectorServer != null ) { this . jmxConnectorServer . stop ( ) ; } } catch ( IOException e1 ) { } try { UnicastRemoteObject . unexportObject ( register , true ) ; } catch ( NoSuchObject...
Stop the JMX Server
10,414
public static Object getClassForName ( String className ) { Object object = null ; try { Class classDefinition = Class . forName ( className ) ; object = classDefinition . newInstance ( ) ; } catch ( ClassNotFoundException e ) { if ( log . isEnabledFor ( Level . ERROR ) ) { log . error ( "ClassNotFoundException" , e ) ...
Returns object instance from the string representing its class name .
10,415
@ SuppressWarnings ( "unchecked" ) public static Object getClassInstance ( String className , Class [ ] attrTypes , Object [ ] attrValues ) throws DISIException { Constructor constr ; try { Class cl = Class . forName ( className ) ; constr = cl . getConstructor ( attrTypes ) ; } catch ( ClassNotFoundException e ) { fin...
Creates an instance of the class whose name is passed as the parameter .
10,416
public Set < String > getSupportedInputMediaTypes ( ) { ImmutableSet . Builder < String > result = ImmutableSet . builder ( ) ; result . addAll ( MediaType . NATIVE_MEDIATYPE_SYNTAX_MAP . keySet ( ) ) ; result . addAll ( this . serviceTransformationEngine . getSupportedMediaTypes ( ) ) ; return result . build ( ) ; }
Obtains the list of supported media types the engine can import
10,417
public boolean canImport ( String mediaType ) { return ( MediaType . NATIVE_MEDIATYPE_SYNTAX_MAP . containsKey ( mediaType ) || this . serviceTransformationEngine . canTransform ( mediaType ) ) ; }
Checks if the given media type can be imported
10,418
public FilenameFilter getFilenameFilter ( String mediaType ) { if ( mediaType == null ) { return null ; } if ( MediaType . NATIVE_MEDIATYPE_SYNTAX_MAP . containsKey ( mediaType ) ) { return new FilenameFilterBySyntax ( MediaType . NATIVE_MEDIATYPE_SYNTAX_MAP . get ( mediaType ) ) ; } else if ( this . getServiceTransfor...
Gets the corresponding filename filter to a given media type by checking both native formats and those supported through transformation
10,419
public List < URI > importServices ( InputStream servicesContentStream , String mediaType ) throws SalException { boolean isNativeFormat = MediaType . NATIVE_MEDIATYPE_SYNTAX_MAP . containsKey ( mediaType ) ; if ( ! isNativeFormat && ! this . serviceTransformationEngine . canTransform ( mediaType ) ) { log . error ( "T...
Imports a new service within iServe . The original document is stored in the server and the transformed version registered within iServe .
10,420
public boolean unregisterService ( URI serviceUri ) throws SalException { if ( serviceUri == null || ! UriUtil . isResourceLocalToServer ( serviceUri , this . getIserveUri ( ) ) ) { return false ; } if ( this . serviceManager . deleteService ( serviceUri ) ) { Set < URI > docs = this . serviceManager . listDocumentsFor...
Unregisters a service from the registry . Effectively this will delete the service description and remove any related documents on the server .
10,421
public void add ( final GeneratedMessage . GeneratedExtension < ? , ? > extension ) { if ( extension . getDescriptor ( ) . getJavaType ( ) == FieldDescriptor . JavaType . MESSAGE ) { if ( extension . getMessageDefaultInstance ( ) == null ) { throw new IllegalStateException ( "Registered message-type extension had null ...
Add an extension from a generated file to the registry .
10,422
public void add ( final FieldDescriptor type ) { if ( type . getJavaType ( ) == FieldDescriptor . JavaType . MESSAGE ) { throw new IllegalArgumentException ( "ExtensionRegistry.add() must be provided a default instance when " + "adding an embedded message extension." ) ; } add ( new ExtensionInfo ( type , null ) ) ; }
Add a non - message - type extension to the registry by descriptor .
10,423
public void add ( final FieldDescriptor type , final Message defaultInstance ) { if ( type . getJavaType ( ) != FieldDescriptor . JavaType . MESSAGE ) { throw new IllegalArgumentException ( "ExtensionRegistry.add() provided a default instance for a " + "non-message extension." ) ; } add ( new ExtensionInfo ( type , def...
Add a message - type extension to the registry by descriptor .
10,424
public String [ ] getMinors ( String major ) { prepareDetailedVersions ( ) ; if ( majors . containsKey ( major ) ) { return majors . get ( major ) . toArray ( new String [ ] { } ) ; } return null ; }
Returns all minor versions for the given major version or null if major version does not exist .
10,425
public String getRecentMinor ( String major ) { if ( major == null ) { return null ; } prepareDetailedVersions ( ) ; if ( majors . containsKey ( major ) && majors . get ( major ) . size ( ) > 0 ) { return majors . get ( major ) . get ( 0 ) ; } return null ; }
Returns the recent minor version for the given major version or null if neither major version or no minor version exists .
10,426
public Version getDetailedVersion ( String version ) { prepareDetailedVersions ( ) ; if ( detailedVersions . containsKey ( version ) ) { return detailedVersions . get ( version ) ; } return null ; }
Returns the detailed version for a given string version or null if the version doesn t exist in this version collection
10,427
@ SuppressWarnings ( "unchecked" ) public IType getMessageOrBuilder ( int index ) { if ( this . builders == null ) { return ( IType ) messages . get ( index ) ; } SingleFieldBuilder < MType , BType , IType > builder = builders . get ( index ) ; if ( builder == null ) { return ( IType ) messages . get ( index ) ; } else...
Gets the base class interface for the specified index . This may either be a builder or a message . It will return whatever is more efficient .
10,428
public RepeatedFieldBuilder < MType , BType , IType > setMessage ( int index , MType message ) { if ( message == null ) { throw new NullPointerException ( ) ; } ensureMutableMessageList ( ) ; messages . set ( index , message ) ; if ( builders != null ) { SingleFieldBuilder < MType , BType , IType > entry = builders . s...
Sets a message at the specified index replacing the existing item at that index .
10,429
public List < MType > build ( ) { isClean = true ; if ( ! isMessagesListMutable && builders == null ) { return messages ; } boolean allMessagesInSync = true ; if ( ! isMessagesListMutable ) { for ( int i = 0 ; i < messages . size ( ) ; i ++ ) { Message message = messages . get ( i ) ; SingleFieldBuilder < MType , BType...
Builds the list of messages from the builder and returns them .
10,430
public Separator trim ( LineFormat . Trim trim ) { return new Separator ( separator , pattern , trim , skipEmpty , forNull , skipNull ) ; }
Trim elements before joining or after splitting
10,431
public Object getValue ( ) { Date d = Calendar . getInstance ( ) . getTime ( ) ; try { d = DEFAULT_DATE_FORMAT . parse ( ( ( JTextField ) editor ) . getText ( ) ) ; } catch ( ParseException ex ) { Logger . getLogger ( CalendarStringPropertyEditor . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ; } Calendar...
Returns the Date of the Calendar .
10,432
public void setValue ( Object value ) { if ( value != null ) { Calendar c = ( Calendar ) value ; ( ( JTextField ) editor ) . setText ( DEFAULT_DATE_FORMAT . format ( c . getTime ( ) ) ) ; } }
Sets the Date of the Calendar .
10,433
public String getAsText ( ) { Calendar localDate = ( Calendar ) getValue ( ) ; String s = DEFAULT_DATE_FORMAT . format ( localDate . getTime ( ) ) ; LOGGER . log ( Level . WARNING , "getAsText(): {0}" , s ) ; return s ; }
Returns the Date formated with the locale and formatString set .
10,434
public static BooleanCliParam optional ( Identifier identifier , boolean defaultValue , boolean nullable ) { return new BooleanCliParam ( identifier , Opt . of ( MoreSuppliers . of ( defaultValue ) ) , nullable ) ; }
Construct an optional CLI boolean parameter with the given default value .
10,435
public FileNode locateClasspathEntry ( Class < ? > c ) { return locateEntry ( c , Reflect . resourceName ( c ) , false ) ; }
Returns the file or directory containing the specified class . Does not search modules
10,436
public FileNode locatePathEntry ( Class < ? > c ) { return locateEntry ( c , Reflect . resourceName ( c ) , true ) ; }
Returns the file or directory or module containing the specified class .
10,437
public long copyFileTo ( OutputStream dest , long skip ) throws FileNotFoundException , CopyFileToException { ChannelSftp sftp ; Progress monitor ; try { sftp = alloc ( ) ; monitor = new Progress ( ) ; try { sftp . get ( escape ( slashPath ) , dest , monitor , ChannelSftp . RESUME , skip ) ; } finally { free ( sftp ) ;...
This is the core function to read an ssh node . Does not close dest .
10,438
public void copyFileFrom ( InputStream src , boolean append ) throws CopyFileFromException { ChannelSftp sftp ; try { sftp = alloc ( ) ; try { sftp . put ( src , escape ( slashPath ) , append ? ChannelSftp . APPEND : ChannelSftp . OVERWRITE ) ; } finally { free ( sftp ) ; } } catch ( SftpException | JSchException e ) {...
This is the core function to write an ssh node . Does not close src .
10,439
public void pushCommandLine ( String commandLine ) { history . add ( commandLine ) ; if ( history . size ( ) > maxHistory ) { history . remove ( 0 ) ; } resetCurrentIndex ( ) ; }
Adds a new command line to the history buffer . Resets the current history index .
10,440
public static String getDescription ( Change change ) { switch ( change . getType ( ) ) { case Change . TYPE_MASTER_VALUE_CHANGED : return "The master value has changed" ; case Change . TYPE_IMPORTED_STATUS_OLDER : return "The imported status is older than the database status" ; case Change . TYPE_IMPORTED_STATUS_NEWER...
Gets a human readable description for a given change .
10,441
public boolean is ( String property , Type type ) { if ( super . has ( property ) ) { return get ( property ) . is ( type ) ; } return false ; }
Returns whether the property is instance of the given type .
10,442
public JsonArray getAsArray ( String property ) { if ( ! super . has ( property ) ) { super . set ( property , new JsonValue ( new JsonArray ( ) ) , false ) ; } return get ( property ) . getAsArray ( ) ; }
Returns the property value as array .
10,443
public JsonObject getAsObject ( String property ) { if ( ! super . has ( property ) ) { super . set ( property , new JsonValue ( new JsonObject ( ) ) , false ) ; } return get ( property ) . getAsObject ( ) ; }
Returns the property value as object .
10,444
public CpoOrderBy newOrderBy ( String attribute , boolean ascending ) throws CpoException { return new BindableCpoOrderBy ( attribute , ascending ) ; }
newOrderBy allows you to dynamically change the order of the objects in the resulting collection . This allows you to apply user input in determining the order of the collection
10,445
protected Session getReadSession ( ) throws CpoException { Session session ; try { if ( ! ( invalidReadSession ) ) { session = getReadDataSource ( ) . getSession ( ) ; } else { session = getWriteDataSource ( ) . getSession ( ) ; } } catch ( Exception e ) { invalidReadSession = true ; String msg = "getReadConnection(): ...
getReadSession returns the read session for Cassandra
10,446
protected Session getWriteSession ( ) throws CpoException { Session session ; try { session = getWriteDataSource ( ) . getSession ( ) ; } catch ( Throwable t ) { String msg = "getWriteConnection(): failed" ; logger . error ( msg , t ) ; throw new CpoException ( msg , t ) ; } return session ; }
getWriteSession returns the write session for Cassandra
10,447
public List < CpoAttribute > getCpoAttributes ( String expression ) throws CpoException { List < CpoAttribute > attributes = new ArrayList < > ( ) ; if ( expression != null && ! expression . isEmpty ( ) ) { Session session ; ResultSet rs ; try { session = getWriteSession ( ) ; rs = session . execute ( expression ) ; Co...
Get the cpo attributes for this expression
10,448
public static BeanInfo createBeanInfo ( Class < ? extends Object > c ) { BeanInfo bi = DefaultBeanInfoResolver . getBeanInfoHelper ( c ) ; if ( bi == null ) { bi = new ConfigBeanInfo ( c ) ; DefaultBeanInfoResolver . addBeanInfo ( c , bi ) ; } return bi ; }
Get the bean information of a type .
10,449
public void check ( BioCDocument document ) { String text = checkText ( document ) ; check ( document , 0 , text ) ; for ( BioCPassage passage : document . getPassages ( ) ) { check ( passage , 0 , text , document ) ; for ( BioCSentence sentence : passage . getSentences ( ) ) { check ( sentence , 0 , text , document , ...
Checks text annotations and relations of the document .
10,450
public void check ( BioCPassage passage ) { String text = checkText ( passage ) ; check ( passage , passage . getOffset ( ) , text ) ; for ( BioCSentence sentence : passage . getSentences ( ) ) { check ( sentence , 0 , text , passage ) ; } }
Checks text annotations and relations of the passage .
10,451
public void check ( BioCSentence sentence ) { String text = checkText ( sentence ) ; check ( sentence , sentence . getOffset ( ) , text ) ; }
Checks text annotations and relations of the sentence .
10,452
public void check ( BioCStructure structure , int offset , String text , BioCStructure ... parents ) { BioCStructure [ ] path = new BioCStructure [ parents . length + 1 ] ; System . arraycopy ( parents , 0 , path , 0 , parents . length ) ; path [ path . length - 1 ] = structure ; String location = log ( path ) ; checkA...
Check the annotation and relation in the structure .
10,453
public static Method getReadMethod ( Class < ? > clazz , String propertyName ) { Method readMethod = null ; try { PropertyDescriptor [ ] thisProps = Introspector . getBeanInfo ( clazz ) . getPropertyDescriptors ( ) ; for ( PropertyDescriptor pd : thisProps ) { if ( pd . getName ( ) . equals ( propertyName ) && pd . get...
Helper method for getting a read method for a property .
10,454
public static JdbcCpoAdapter getInstance ( JdbcCpoMetaDescriptor metaDescriptor , DataSourceInfo < DataSource > jdsiWrite , DataSourceInfo < DataSource > jdsiRead ) throws CpoException { String adapterKey = metaDescriptor + ":" + jdsiWrite . getDataSourceName ( ) + ":" + jdsiRead . getDataSourceName ( ) ; JdbcCpoAdapte...
Creates a JdbcCpoAdapter .
10,455
protected < T , C > T processExecuteGroup ( String name , C criteria , T result ) throws CpoException { Connection c = null ; T obj = null ; try { c = getWriteConnection ( ) ; obj = processExecuteGroup ( name , criteria , result , c ) ; commitLocalConnection ( c ) ; } catch ( Exception e ) { rollbackLocalConnection ( c...
Executes an Object whose MetaData contains a stored procedure . An assumption is that the object exists in the datasource .
10,456
public JsonArray getAsArray ( ) { if ( ! ( value instanceof JsonArray ) ) { JsonArray val = new JsonArray ( ) ; val . add ( value ) ; value = val ; } return ( JsonArray ) value ; }
Returns the value as array .
10,457
public Boolean getAsBoolean ( ) { if ( value instanceof String ) { return Boolean . parseBoolean ( ( String ) value ) ; } return ( Boolean ) value ; }
Returns the value as boolean .
10,458
public Integer getAsInteger ( ) { if ( value instanceof String ) { return Integer . valueOf ( ( String ) value ) ; } else if ( value instanceof Long ) { return ( ( Long ) value ) . intValue ( ) ; } return ( Integer ) value ; }
Returns the value as integer .
10,459
public char match ( String str1 , String str2 ) { if ( null == str1 || null == str2 || 0 == str1 . length ( ) || 0 == str2 . length ( ) ) { return IMappingElement . IDK ; } float sim = 1 - ( float ) getLevenshteinDistance ( str1 , str2 ) / java . lang . Math . max ( str1 . length ( ) , str2 . length ( ) ) ; if ( thresh...
Computes the relation with optimized edit distance matcher .
10,460
void init ( KProcess process ) { process . markings = new Object [ this . elements . size ( ) ] ; for ( KElement element : this . elements ) { element . init ( process ) ; } }
Initialize a process .
10,461
void addElement ( KElement element ) { if ( ! this . elements . contains ( element ) ) { element . setIndex ( this . elements . size ( ) ) ; this . elements . add ( element ) ; } }
Add an element
10,462
private static String getStringValueFromRow ( QuerySolution resultRow , String variableName ) { if ( resultRow == null ) { return null ; } String result = null ; Resource res = resultRow . getResource ( variableName ) ; if ( res != null && res . isLiteral ( ) ) { result = res . asLiteral ( ) . getString ( ) ; } return ...
Given a query result from a SPARQL query obtain the given variable value as a String
10,463
private static URL getUrlValueFromRow ( QuerySolution resultRow , String variableName ) { if ( resultRow == null ) { return null ; } URL result = null ; Resource res = resultRow . getResource ( variableName ) ; if ( res . isAnon ( ) ) { log . warn ( "Blank node found and ignored " + res . toString ( ) ) ; } else if ( r...
Given a query result from a SPARQL query obtain the given variable value as a URL
10,464
public static boolean isVariableSet ( QuerySolution resultRow , String variableName ) { if ( resultRow != null ) { return resultRow . contains ( variableName ) ; } return false ; }
Given a query result from a SPARQL query check if the given variable has a value or not
10,465
public static Integer getIntegerValue ( QuerySolution resultRow , String variableName ) { if ( resultRow != null ) { Resource res = resultRow . getResource ( variableName ) ; if ( res != null && res . isLiteral ( ) ) { Literal val = res . asLiteral ( ) ; if ( val != null ) { return Integer . valueOf ( val . getInt ( ) ...
Given a query result from a SPARQL query obtain the number value at the given variable
10,466
public static String generateLabelPattern ( String var , String labelVar ) { return new StringBuilder ( ) . append ( "?" ) . append ( var ) . append ( " " ) . append ( sparqlWrapUri ( RDFS . label . getURI ( ) ) ) . append ( " " ) . append ( "?" ) . append ( labelVar ) . append ( ". " ) . toString ( ) ; }
Generate a pattern for binding to a label
10,467
public static String generateSubclassPattern ( URI origin , URI destination ) { return new StringBuilder ( ) . append ( sparqlWrapUri ( destination ) ) . append ( " " ) . append ( sparqlWrapUri ( RDFS . subClassOf . getURI ( ) ) ) . append ( "+ " ) . append ( sparqlWrapUri ( origin ) ) . append ( " ." ) . toString ( ) ...
Generate a pattern for checking if destination is a subclass of origin
10,468
public static String generateSuperclassPattern ( URI origin , String matchVariable ) { return new StringBuilder ( ) . append ( sparqlWrapUri ( origin ) ) . append ( " " ) . append ( sparqlWrapUri ( RDFS . subClassOf . getURI ( ) ) ) . append ( "+ " ) . append ( "?" ) . append ( matchVariable ) . append ( " ." ) . toStr...
Generate a pattern for matching var to the superclasses of clazz
10,469
public static String generateUnionStatement ( List < String > patterns ) { if ( patterns == null || patterns . isEmpty ( ) ) { return "" ; } if ( patterns . size ( ) == 1 ) { return patterns . get ( 0 ) ; } StringBuffer query = new StringBuffer ( ) ; query . append ( " {" + NL ) ; query . append ( patterns . get ( 0 )...
Generates a UNION SPARQL statement for the patterns passed in the input
10,470
public static String generateExactMatchPattern ( URI origin , URI destination , String bindingVar , boolean includeUrisBound ) { List < String > patterns = new ArrayList < String > ( ) ; StringBuffer query = new StringBuffer ( ) ; query . append ( Util . generateSubclassPattern ( origin , destination ) + NL ) ; query ....
Generate a pattern for check if two concepts have an exact match . Basically we look for either identical classes or equivalent ones Uses BIND which Requires SPARQL 1 . 1
10,471
public static String generateMatchStrictSubclassesPattern ( URI origin , String matchVariable , String flagVar , boolean includeUrisBound ) { StringBuffer query = new StringBuffer ( ) ; query . append ( Util . generateSubclassPattern ( origin , matchVariable ) + NL ) ; query . append ( "FILTER NOT EXISTS { " ) . append...
Generate a pattern for obtaining the strict subclasses of a concept . Uses BIND which Requires SPARQL 1 . 1
10,472
public static String generateMatchStrictSuperclassesPattern ( URI origin , String matchVariable , String bindingVar , boolean includeUrisBound ) { StringBuffer query = new StringBuffer ( ) ; query . append ( Util . generateSuperclassPattern ( origin , matchVariable ) + NL ) ; query . append ( "FILTER NOT EXISTS { " + U...
Generate a pattern for obtaining the strict superclasses of a concept . Uses BIND which Requires SPARQL 1 . 1
10,473
public static DiscoMatchType getMatchType ( boolean isSubsume , boolean isPlugin ) { if ( isSubsume ) { if ( isPlugin ) { return DiscoMatchType . Exact ; } return DiscoMatchType . Subsume ; } else { if ( isPlugin ) { return DiscoMatchType . Plugin ; } } return DiscoMatchType . Fail ; }
Given the match between concepts obtain the match type
10,474
public static DiscoMatchType calculateCompositeMatchType ( MatchType bestMatch , MatchType worstMatch ) { if ( bestMatch instanceof LogicConceptMatchType && worstMatch instanceof LogicConceptMatchType ) { return calculateCompositeMatchType ( ( LogicConceptMatchType ) bestMatch , ( LogicConceptMatchType ) worstMatch ) ;...
Given the best and worst match figure out the match type for the composite . The composite match type is determined by the worst case except when it is a FAIL . In this case if the best is EXACT or PLUGIN the composite match will be PARTIAL_PLUGIN . If the best is SUBSUMES it is PARTIAL_SUBSUMES .
10,475
public static URL getMatchUrl ( QuerySolution row , boolean operationDiscovery ) { if ( row == null ) { return null ; } URL matchUrl ; if ( operationDiscovery ) { matchUrl = Util . getOperationUrl ( row ) ; } else { matchUrl = Util . getServiceUrl ( row ) ; } return matchUrl ; }
Obtain the match url given the query row and the kind of discovery we are carrying out
10,476
public static String getOrGenerateMatchLabel ( QuerySolution row , boolean operationDiscovery ) { String label ; if ( operationDiscovery ) { label = getOrGenerateOperationLabel ( row ) ; } else { label = getOrGenerateServiceLabel ( row ) ; } return label ; }
Obtain or generate a label for the match result given a row resulting from a query .
10,477
private static String getOrGenerateOperationLabel ( QuerySolution row ) { String result ; String svcLabel = getOrGenerateServiceLabel ( row ) ; String opLabel = getOperationLabel ( row ) ; if ( opLabel == null ) { URL opUrl = getOperationUrl ( row ) ; result = URIUtil . generateItemLabel ( svcLabel , opUrl ) ; } else {...
Obtain or generate a label for an operation .
10,478
private static void showMapDetails ( Map < URL , MatchResult > map ) { for ( Entry < URL , MatchResult > entry : map . entrySet ( ) ) { log . info ( "Match " + entry . getKey ( ) . toString ( ) + NL ) ; } }
Expose the data within the map
10,479
public static CodedInputStream newInstance ( final byte [ ] buf , final int off , final int len ) { CodedInputStream result = new CodedInputStream ( buf , off , len ) ; try { result . pushLimit ( len ) ; } catch ( InvalidProtocolBufferException ex ) { throw new IllegalArgumentException ( ex ) ; } return result ; }
Create a new CodedInputStream wrapping the given byte array slice .
10,480
protected static String escapeXmlSpecialCharacters ( String aText ) { String result = aText ; result = result . replaceAll ( "&" , "&amp;" ) ; result = result . replaceAll ( "\'" , "\\\\&#039;" ) ; result = result . replaceAll ( "'" , "\\\\&#039;" ) ; return result ; }
Android specific escaping of characters . Note that since this is no real XML escaping the output string . xml file is potentially not valid XML . However this is explicitly allowed by Android .
10,481
protected String [ ] getRow ( String masterLanguage , ITextNode textNode , IValueNode valueNode ) { List < String > row = new ArrayList < > ( ) ; row . add ( textNode . getKey ( ) ) ; row . add ( valueNode . getStatus ( ) . getName ( ) ) ; if ( ! valueNode . getLanguage ( ) . equals ( masterLanguage ) ) { IValueNode ma...
Constructs a row for a Trema CSV export file .
10,482
protected String [ ] [ ] getValues ( ITextNode [ ] textNodes , String masterLanguage , String language , Status [ ] status ) { int numberOfColumns = ( masterLanguage . equals ( language ) ) ? 4 : 5 ; List < String [ ] > rows = new ArrayList < > ( ) ; rows . add ( getHeaderRow ( masterLanguage , new String [ ] { languag...
Gets a 2 dimensional string array representation of the CSV export data ready to be written to a CSV file .
10,483
public void build ( Concept parent ) throws OntologyBuildException { if ( ! this . skipProviderHierarchy ) { try { root = this . metadata . getOrCreateHardCodedFolder ( "Provider" ) ; root . setFactTableColumn ( "provider_id" ) ; root . setTableName ( "provider_dimension" ) ; root . setColumnName ( "provider_path" ) ; ...
Create a hierarchy of providers organized by first letter of their full name .
10,484
private PropertyEditor loadPropertyEditor ( Class < ? > clz ) { PropertyEditor editor = null ; try { editor = ( PropertyEditor ) clz . newInstance ( ) ; } catch ( InstantiationException e ) { Logger . getLogger ( PropertyEditorRegistry . class . getName ( ) ) . log ( Level . SEVERE , null , e ) ; } catch ( IllegalAcces...
Load PropertyEditor from clz through reflection .
10,485
IteratorInfo < R > setValues ( int previousIndex , int nextIndex , boolean hasPrevious , boolean hasNext , int currentIndex , int effectiveIndex , R res ) { this . previousIndex = previousIndex ; this . nextIndex = nextIndex ; this . hasPrevious = hasPrevious ; this . hasNext = hasNext ; return ( IteratorInfo < R > ) s...
set all fields of the Iterator Info
10,486
public static LdapHelper getInstance ( String instance ) { if ( ! helpers . containsKey ( instance ) ) { helpers . put ( instance , new LdapHelper ( instance ) ) ; } LdapHelper helper = helpers . get ( instance ) ; if ( ! helper . online ) { helper . loadProperties ( ) ; } return helper ; }
Returns a new Instance of LdapHelper .
10,487
public boolean setUserAsUser ( Node node , String uid , String password ) throws Exception { boolean status = false ; StringBuilder sb = new StringBuilder ( userIdentifyer + "=" ) . append ( uid ) . append ( "," ) ; sb . append ( Configuration . getProperty ( instanceName + LdapKeys . ATTR_OU_PEOPLE ) ) . append ( "," ...
Writes the modifications on an user object back to the LDAP using a specific context .
10,488
public boolean rmUser ( final Node node ) { LdapUser user = ( LdapUser ) node ; if ( node == null ) { return false ; } try { deletionCount ++ ; ctx . unbind ( getOuForNode ( user ) ) ; } catch ( NamingException ex ) { handleNamingException ( user , ex ) ; } Node ldapUser = getUser ( user . getUid ( ) ) ; return ldapUse...
Deletes an LDAP - User .
10,489
public boolean rmGroup ( Node node ) { LdapGroup group = ( LdapGroup ) node ; try { deletionCount ++ ; ctx . unbind ( getOuForNode ( group ) ) ; } catch ( NamingException ex ) { handleNamingException ( group , ex ) ; } Node ldapGroup = getGroup ( group . getCn ( ) ) ; return ldapGroup . isEmpty ( ) ; }
Deletes a LDAP - Group .
10,490
public boolean setGroup ( Node node ) throws Exception { LdapGroup newLdapGroup = ( LdapGroup ) node ; newLdapGroup = updateGroupMembers ( newLdapGroup ) ; LdapGroup oldLdapGroup = ( LdapGroup ) getGroup ( newLdapGroup . getCn ( ) ) ; if ( oldLdapGroup . isEmpty ( ) ) { creationCount ++ ; Logger . info ( LOG_BIND + get...
Adds or updates a LDAP - Group .
10,491
public Node getUser ( final String uid ) { try { String query = "(&(objectClass=" + userObjectClass + ")(" + userIdentifyer + "=" + uid + "))" ; SearchResult searchResult ; Attributes attributes ; SearchControls controls = new SearchControls ( ) ; controls . setReturningAttributes ( new String [ ] { LdapKeys . ASTERISK...
Returns an LDAP - User .
10,492
public Set < Node > findUsers ( final String uid ) { QueryBuilder qb = new LdapQueryBuilder ( ) ; if ( "*" . equals ( uid ) ) { qb . append ( LdapKeys . OBJECT_CLASS , userObjectClass ) ; } else { qb . append ( LdapKeys . OBJECT_CLASS , userObjectClass ) ; qb . append ( userIdentifyer , uid + "*" ) ; } return findUsers...
Returns several LDAP - Users for a given search - String .
10,493
public Node getGroup ( final String cn ) { try { String query = "(&(objectClass=" + groupObjectClass + ")(" + groupIdentifyer + "=" + cn + "))" ; SearchResult searchResult ; Attributes attributes ; SearchControls controls = new SearchControls ( ) ; controls . setReturningAttributes ( new String [ ] { LdapKeys . ASTERIS...
Returns a LDAP - Group .
10,494
public Set < Node > findGroups ( final String cn ) { QueryBuilder qb = new LdapQueryBuilder ( ) ; if ( "*" . equals ( cn ) ) { qb . append ( LdapKeys . OBJECT_CLASS , groupObjectClass ) ; } else { qb . append ( LdapKeys . OBJECT_CLASS , groupObjectClass ) ; qb . append ( groupIdentifyer , cn + "*" ) ; } return findGrou...
Returns several LDAP - Groups for a given search - String .
10,495
public Node getPrincipal ( ) { if ( principal == null ) { principal = new LdapUser ( ) ; LdapUser p = ( LdapUser ) principal ; p . setDn ( Configuration . getProperty ( instanceName + ".principal" ) . trim ( ) ) ; p . setUid ( getUidForDN ( p . getDn ( ) ) ) ; } return principal ; }
Returns the LDAP - Principal as a LdapUser .
10,496
public String getDefault ( final String key ) { if ( defaultValues . containsKey ( key ) ) { return defaultValues . get ( key ) ; } return "" ; }
Returns a Value from the Default Collection .
10,497
public Set < Node > getGroupsForUser ( Node user ) { Set < Node > groups = new TreeSet < > ( ) ; try { String query = "(& (objectClass=" + groupObjectClass + ") (" + groupMemberAttribut + "=" + ( ( LdapUser ) user ) . getDn ( ) + "))" ; SearchResult searchResult ; Attributes attributes ; SearchControls controls = new S...
Load all Groups for a given User .
10,498
public Set < Node > getUsersForGroup ( Node group ) { Set < Node > users = new TreeSet < > ( ) ; try { String query = "(" + groupIdentifyer + "=" + group . getName ( ) + ")" ; SearchResult searchResult ; Attributes attributes ; SearchControls controls = new SearchControls ( ) ; controls . setSearchScope ( SearchControl...
Load all Users for a given Group .
10,499
public LdapUser getUserTemplate ( String uid ) { LdapUser user = new LdapUser ( uid , this ) ; user . set ( "dn" , getDNForNode ( user ) ) ; for ( String oc : userObjectClasses ) { user . addObjectClass ( oc . trim ( ) ) ; } user = ( LdapUser ) updateObjectClasses ( user ) ; if ( user . getObjectClasses ( ) . contains ...
Returns a basic LDAP - User - Template for a new LDAP - User .