idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
10,600
public void addZone ( String id , Component zone , String constraints ) { Component previousZone = getZone ( id ) ; if ( previousZone != null ) { remove ( previousZone ) ; idToZones . remove ( id ) ; } if ( zone instanceof JComponent ) { JComponent jc = ( JComponent ) zone ; if ( jc . getBorder ( ) == null || jc . getB...
Adds a new zone in the StatusBar .
10,601
public IContext loadContext ( String function ) throws ContextLoaderException { IContext result = new Context ( ) ; parse ( function , result , null ) ; createIds ( result ) ; log . info ( "Parsed nodes: " + nodesParsed ) ; return result ; }
Converts the string with a function into a tree .
10,602
static void parse ( String inString , IContext context , INode parent ) { List < String > tokens = getCommaTokens ( inString ) ; for ( String token : tokens ) { int isFunction = token . indexOf ( OPEN_PARENTHESIS ) ; if ( isFunction >= 0 ) { String funcName = token . substring ( 0 , isFunction ) ; INode newParent = add...
Parses the string to get the children of the given node .
10,603
static List < String > getCommaTokens ( String inString ) { String input = inString . trim ( ) ; List < String > tokens = new ArrayList < String > ( ) ; String token ; while ( 0 < input . length ( ) ) { if ( COMMA == input . charAt ( 0 ) ) { input = input . substring ( 1 ) ; } token = getNextCommaToken ( input ) ; inpu...
Tokenizes the string into siblings .
10,604
static String getNextCommaToken ( String inString ) { String token = "" ; int parenthesis = 0 ; for ( int i = 0 ; i < inString . length ( ) ; i ++ ) { if ( OPEN_PARENTHESIS == inString . charAt ( i ) ) { parenthesis ++ ; token += inString . charAt ( i ) ; } else if ( CLOSE_PARENTHESIS == inString . charAt ( i ) ) { par...
Computes the first argument from a list of arguments
10,605
public String get ( String key ) { if ( "dn" . equals ( key ) ) { return this . dn ; } else if ( key != null && attributes != null && getKeys ( ) . contains ( key ) && attributes . get ( key ) != null ) { return attributes . get ( key ) . toString ( ) . replace ( key + ":" , "" ) . trim ( ) ; } return null ; }
Returns an entry for a given key .
10,606
public void set ( String key , String value ) { if ( "dn" . equals ( key ) ) { this . dn = value ; } else if ( value != null && ! value . isEmpty ( ) && key != null && ! key . isEmpty ( ) ) { addAttribute ( new BasicAttribute ( key , value , true ) ) ; } }
Sets the value of an entry .
10,607
public synchronized void deleteAtExit ( FileNode node ) { if ( delete == null ) { tryDelete ( node ) ; } else { delete . add ( node ) ; } }
Use this instead of File . deleteAtExist because it can delete none - empty directories
10,608
public AutoComplete union ( AutoComplete other ) { if ( possibilities . isEmpty ( ) ) { return other ; } if ( other . possibilities . isEmpty ( ) ) { return this ; } if ( ! this . prefix . equals ( other . prefix ) ) { throw new IllegalArgumentException ( "Trying to perform union on different prefixes: prefix1='" + thi...
Create a new auto - complete by merging this auto - complete with the given auto - complete . The resulting auto - complete will contain possibilities from both this and the given auto - complete .
10,609
public TrieBuilder < T > add ( String word , T value ) { assertNotEmptyWord ( word ) ; if ( map . containsKey ( word ) ) { throw new IllegalArgumentException ( "Trie already contains a value for '" + word + "': " + map . get ( word ) ) ; } map . put ( word , value ) ; return this ; }
Add a word - value mapping to the Trie . Expects there not to be a previous mapping for the word .
10,610
public TrieBuilder < T > addAll ( Map < String , T > map ) { for ( Entry < String , T > entry : map . entrySet ( ) ) { add ( entry . getKey ( ) , entry . getValue ( ) ) ; } return this ; }
Add all word - value pairs from the given map to the Trie . Expects there not to be any previous mappings for any of the words .
10,611
public TrieBuilder < T > set ( String word , T value ) { assertNotEmptyWord ( word ) ; map . put ( word , value ) ; return this ; }
Set a word - value mapping on the Trie . If a previous mapping exists it will be overwritten . Otherwise will create a new word - value mapping .
10,612
public TrieBuilder < T > setAll ( Map < String , T > map ) { for ( Entry < String , T > entry : map . entrySet ( ) ) { set ( entry . getKey ( ) , entry . getValue ( ) ) ; } return this ; }
Set all word - value pairs in the given map to the Trie . If any previous mapping exists it will be overwritten .
10,613
public final void setTable ( PropertySheetTable table ) { if ( table == null ) { throw new IllegalArgumentException ( "table must not be null" ) ; } if ( model != null ) { model . removePropertyChangeListener ( this ) ; } model = ( PropertySheetTableModel ) table . getModel ( ) ; model . addPropertyChangeListener ( thi...
Sets the table used by this panel .
10,614
public void setDescriptionVisible ( boolean visible ) { if ( visible ) { add ( "Center" , split ) ; split . setTopComponent ( tableScroll ) ; split . setBottomComponent ( descriptionScrollPane ) ; split . setDividerLocation ( split . getHeight ( ) - lastDescriptionHeight ) ; } else { lastDescriptionHeight = split . get...
Toggles the visibility of the description panel .
10,615
public void readFromObject ( Object data ) { getTable ( ) . cancelEditing ( ) ; Property [ ] properties = model . getProperties ( ) ; for ( int i = 0 , c = properties . length ; i < c ; i ++ ) { properties [ i ] . readFromObject ( data ) ; } repaint ( ) ; }
Initializes the PropertySheet from the given object . If any it cancels pending edit before proceeding with properties .
10,616
public void writeToObject ( Object data ) { getTable ( ) . commitEditing ( ) ; Property [ ] properties = getProperties ( ) ; for ( int i = 0 , c = properties . length ; i < c ; i ++ ) { properties [ i ] . writeToObject ( data ) ; } }
Writes the PropertySheet to the given object . If any it commits pending edit before proceeding with properties .
10,617
public void setSorting ( boolean value ) { model . setSortingCategories ( value ) ; model . setSortingProperties ( value ) ; sortButton . setSelected ( value ) ; }
Sets sorting properties and categories enabled or disabled .
10,618
public void writeMessage ( final int fieldNumber , final MessageLite value ) throws IOException { writeTag ( fieldNumber , WireFormat . WIRETYPE_LENGTH_DELIMITED ) ; writeMessageNoTag ( value ) ; }
Write an embedded message field including tag to the stream .
10,619
public void writeEnum ( final int fieldNumber , final int value ) throws IOException { writeTag ( fieldNumber , WireFormat . WIRETYPE_VARINT ) ; writeEnumNoTag ( value ) ; }
Write an enum field including tag to the stream . Caller is responsible for converting the enum value to its numeric value .
10,620
public void writeMessageSetExtension ( final int fieldNumber , final MessageLite value ) throws IOException { writeTag ( WireFormat . MESSAGE_SET_ITEM , WireFormat . WIRETYPE_START_GROUP ) ; writeUInt32 ( WireFormat . MESSAGE_SET_TYPE_ID , fieldNumber ) ; writeMessage ( WireFormat . MESSAGE_SET_MESSAGE , value ) ; writ...
Write a MessageSet extension field to the stream . For historical reasons the wire format differs from normal fields .
10,621
public void writeRawMessageSetExtension ( final int fieldNumber , final ByteString value ) throws IOException { writeTag ( WireFormat . MESSAGE_SET_ITEM , WireFormat . WIRETYPE_START_GROUP ) ; writeUInt32 ( WireFormat . MESSAGE_SET_TYPE_ID , fieldNumber ) ; writeBytes ( WireFormat . MESSAGE_SET_MESSAGE , value ) ; writ...
Write an unparsed MessageSet extension field to the stream . For historical reasons the wire format differs from normal fields .
10,622
public static int computeMessageSetExtensionSize ( final int fieldNumber , final MessageLite value ) { return computeTagSize ( WireFormat . MESSAGE_SET_ITEM ) * 2 + computeUInt32Size ( WireFormat . MESSAGE_SET_TYPE_ID , fieldNumber ) + computeMessageSize ( WireFormat . MESSAGE_SET_MESSAGE , value ) ; }
Compute the number of bytes that would be needed to encode a MessageSet extension to the stream . For historical reasons the wire format differs from normal fields .
10,623
public static int computeRawMessageSetExtensionSize ( final int fieldNumber , final ByteString value ) { return computeTagSize ( WireFormat . MESSAGE_SET_ITEM ) * 2 + computeUInt32Size ( WireFormat . MESSAGE_SET_TYPE_ID , fieldNumber ) + computeBytesSize ( WireFormat . MESSAGE_SET_MESSAGE , value ) ; }
Compute the number of bytes that would be needed to encode an unparsed MessageSet extension field to the stream . For historical reasons the wire format differs from normal fields .
10,624
public static int computeLazyFieldMessageSetExtensionSize ( final int fieldNumber , final LazyField value ) { return computeTagSize ( WireFormat . MESSAGE_SET_ITEM ) * 2 + computeUInt32Size ( WireFormat . MESSAGE_SET_TYPE_ID , fieldNumber ) + computeLazyFieldSize ( WireFormat . MESSAGE_SET_MESSAGE , value ) ; }
Compute the number of bytes that would be needed to encode an lazily parsed MessageSet extension field to the stream . For historical reasons the wire format differs from normal fields .
10,625
private void refreshBuffer ( ) throws IOException { if ( output == null ) { throw new OutOfSpaceException ( ) ; } output . write ( buffer , 0 , position ) ; position = 0 ; }
Internal helper that writes the current buffer to the output . The buffer position is reset to its initial value when this returns .
10,626
public void writeRawBytes ( final byte [ ] value , int offset , int length ) throws IOException { if ( limit - position >= length ) { System . arraycopy ( value , offset , buffer , position , length ) ; position += length ; } else { final int bytesWritten = limit - position ; System . arraycopy ( value , offset , buffe...
Write part of an array of bytes .
10,627
public void writeRawBytes ( final ByteString value , int offset , int length ) throws IOException { if ( limit - position >= length ) { value . copyTo ( buffer , offset , position , length ) ; position += length ; } else { final int bytesWritten = limit - position ; value . copyTo ( buffer , offset , position , bytesWr...
Write part of a byte string .
10,628
public void writeRawLittleEndian32 ( final int value ) throws IOException { writeRawByte ( ( value ) & 0xFF ) ; writeRawByte ( ( value >> 8 ) & 0xFF ) ; writeRawByte ( ( value >> 16 ) & 0xFF ) ; writeRawByte ( ( value >> 24 ) & 0xFF ) ; }
Write a little - endian 32 - bit integer .
10,629
public void writeRawLittleEndian64 ( final long value ) throws IOException { writeRawByte ( ( int ) ( value ) & 0xFF ) ; writeRawByte ( ( int ) ( value >> 8 ) & 0xFF ) ; writeRawByte ( ( int ) ( value >> 16 ) & 0xFF ) ; writeRawByte ( ( int ) ( value >> 24 ) & 0xFF ) ; writeRawByte ( ( int ) ( value >> 32 ) & 0xFF ) ; ...
Write a little - endian 64 - bit integer .
10,630
public static < T extends MatchResult , S extends MatchType > Predicate < T > greaterThan ( S matchType ) { return new GreaterThanPredicate < T , S > ( matchType ) ; }
Generates a Predicate that only accepts the Match Results that have a Match Type greater than matchType
10,631
public static < T extends MatchResult , S extends MatchType > Predicate < T > lowerThan ( S matchType ) { return new LowerThanPredicate < T , S > ( matchType ) ; }
Generates a Predicate that only accepts the Match Results that have a Match Type lower than matchType
10,632
public static < T extends MatchResult , S extends MatchType > Predicate < T > equalTo ( S matchType ) { return new EqualToPredicate < T , S > ( matchType ) ; }
Generates a Predicate that only accepts the Match Results that have a Match Type equal to matchType
10,633
public static < T extends MatchResult , S extends MatchType > Predicate < T > greaterOrEqualTo ( S matchType ) { return Predicates . or ( greaterThan ( matchType ) , equalTo ( matchType ) ) ; }
Generates a Predicate that only accepts the Match Results that have a Match Type greater or equal to matchType
10,634
public static < T extends MatchResult , S extends MatchType > Predicate < T > lowerOrEqualTo ( S matchType ) { return Predicates . or ( lowerThan ( matchType ) , equalTo ( matchType ) ) ; }
Generates a Predicate that only accepts the Match Results that have a Match Type lower or equal to matchType
10,635
public LoopInfo < R > setValues ( int currentIndex , int effectiveIndex , R lastRes ) { this . currentIndex = currentIndex ; this . effectiveIndex = effectiveIndex ; this . lastRes = lastRes ; return this ; }
set all fields of the loop info
10,636
public java . lang . Iterable < ? > getIterable ( KProcess process ) { java . lang . Iterable < ? > iterable = null ; try { iterable = ( java . lang . Iterable < ? > ) this . field . get ( process . getContext ( ) ) ; } catch ( IllegalArgumentException e ) { e . printStackTrace ( ) ; } catch ( IllegalAccessException e ...
This will return Iterable to Calling method as parameter .
10,637
private String getItemKey ( int position ) { if ( mMap != null ) { return new ArrayList < > ( mMap . entrySet ( ) ) . get ( position ) . getKey ( ) ; } else if ( mJsonArray != null ) { return String . valueOf ( position ) ; } return null ; }
Provides the item key name . Number for array property for object .
10,638
private Object getItem ( int position ) { if ( mMap != null ) { return new ArrayList < > ( mMap . entrySet ( ) ) . get ( position ) . getValue ( ) ; } else if ( mJsonArray != null ) { return mJsonArray . opt ( position ) ; } return null ; }
Provides the item in a given position .
10,639
public static ConceptId getInstance ( String propId , String propertyName , Metadata metadata ) { return getInstance ( propId , propertyName , null , metadata ) ; }
Returns a concept propId with the given proposition propId and property name .
10,640
public static PropDefConceptId getInstance ( String propId , String propertyName , Value value , Metadata metadata ) { List < Object > key = new ArrayList < > ( 4 ) ; key . add ( propId ) ; key . add ( propertyName ) ; key . add ( value ) ; key . add ( Boolean . TRUE ) ; PropDefConceptId conceptId = ( PropDefConceptId ...
Returns a concept propId with the given proposition propId property name and value .
10,641
public static < T > ClassSup < T > cls ( Class < T > cls ) { return mapper . get ( cls . getName ( ) , ( ) -> new ClassSup < > ( cls ) ) ; }
create a class supporter with given class
10,642
@ SuppressWarnings ( "unchecked" ) public static < T > ClassSup < T > cls ( T obj ) { return mapper . get ( obj . getClass ( ) . getName ( ) , ( ) -> ( ClassSup < T > ) cls ( obj . getClass ( ) ) ) ; }
create a class supporter with given object
10,643
@ SuppressWarnings ( "unchecked" ) public static < T > T proxy ( InvocationHandler handler , T toProxy ) { return ( T ) Proxy . newProxyInstance ( toProxy . getClass ( ) . getClassLoader ( ) , toProxy . getClass ( ) . getInterfaces ( ) , handler ) ; }
generate proxy object with given InvocationHandler and the object to do proxy
10,644
private static boolean translate ( String glob , StringBuilder result ) { int i ; int max ; char c ; int j ; String stuff ; int escaped ; escaped = 0 ; max = glob . length ( ) ; for ( i = 0 ; i < max ; ) { c = glob . charAt ( i ++ ) ; if ( c == '*' ) { result . append ( ".*" ) ; } else if ( c == '?' ) { result . append...
Translate a glob PATTERN to a regular expression .
10,645
InputStream getContent ( String url ) throws IOException , NsApiException { Request request = new Request . Builder ( ) . url ( url ) . get ( ) . build ( ) ; try { Response response = client . newCall ( request ) . execute ( ) ; if ( response . body ( ) == null ) { log . error ( "Error while calling the webservice, ent...
Handling the webservice call
10,646
public final void add ( final GeneratedMessageLite . GeneratedExtension < ? , ? > extension ) { extensionsByNumber . put ( new ObjectIntPair ( extension . getContainingTypeDefaultInstance ( ) , extension . getNumber ( ) ) , extension ) ; }
Add an extension from a lite generated file to the registry .
10,647
public String value ( Object context ) { return this . property != null ? this . property . get ( context ) : null ; }
Return the value of the attribute
10,648
@ SuppressWarnings ( "unchecked" ) protected void set ( String property , Object value , boolean notify ) { uninstallListener ( property ) ; JsonEntity entity = null ; if ( value instanceof JsonValue ) { entity = getEntity ( ( JsonValue ) value ) ; } else if ( value instanceof JsonEntity ) { entity = ( JsonEntity ) val...
Sets a new value for the given property .
10,649
public void remove ( String property ) { uninstallListener ( property ) ; Object oldValue = get ( property ) ; properties . remove ( property ) ; firePropertyChange ( property , oldValue , null ) ; }
Removes the given property .
10,650
public static String [ ] toArray ( Collection < String > coll ) { String [ ] ar ; ar = new String [ coll . size ( ) ] ; coll . toArray ( ar ) ; return ar ; }
Turns a list of Strings into an array .
10,651
public static String escape ( String str ) { int i , max ; StringBuilder result ; char c ; max = str . length ( ) ; for ( i = 0 ; i < max ; i ++ ) { if ( str . charAt ( i ) < 32 ) { break ; } } if ( i == max ) { return str ; } result = new StringBuilder ( max + 10 ) ; for ( i = 0 ; i < max ; i ++ ) { c = str . charAt (...
escape Strings as in Java String literals
10,652
protected static Properties getComponentProperties ( String componentPrefix , Properties properties ) { Properties result = new Properties ( ) ; if ( null != componentPrefix ) { int componentPrefixLength = componentPrefix . length ( ) ; for ( String propertyName : properties . stringPropertyNames ( ) ) { if ( propertyN...
Returns only properties that start with componentPrefix removing this prefix .
10,653
protected static String makeComponentPrefix ( String tokenName , String className ) { String simpleClassName = className ; if ( null != className ) { int lastDotIdx = className . lastIndexOf ( "." ) ; if ( lastDotIdx > - 1 ) { simpleClassName = className . substring ( lastDotIdx + 1 , className . length ( ) ) ; } } ret...
Creates a prefix for component to search for its properties in properties .
10,654
public static Properties loadProperties ( String filename ) throws ConfigurableException { log . info ( "Loading properties from " + filename ) ; Properties properties = new Properties ( ) ; FileInputStream input = null ; try { input = new FileInputStream ( filename ) ; properties . load ( input ) ; } catch ( IOExcepti...
Loads the properties from the properties file .
10,655
public char match ( ISense source , ISense target ) throws MatcherLibraryException { int Equals = 0 ; int moreGeneral = 0 ; int lessGeneral = 0 ; int Opposite = 0 ; String sSynset = source . getGloss ( ) ; String tSynset = target . getGloss ( ) ; StringTokenizer stSource = new StringTokenizer ( sSynset , " ,.\"'()" ) ;...
Computes the relations with WordNet semantic gloss matcher .
10,656
public char match ( String str1 , String str2 ) { invocationCount ++ ; char rel = IMappingElement . IDK ; if ( str1 == null || str2 == null ) { rel = IMappingElement . IDK ; } else { if ( ( str1 . length ( ) > 3 ) && ( str2 . length ( ) > 3 ) ) { if ( str1 . startsWith ( str2 ) ) { if ( str1 . contains ( " " ) ) { rel ...
Computes the relation with prefix matcher .
10,657
public static CouchbaseOperation getOperation ( Configuration hadoopConfiguration ) throws ArgsException { String strCouchbaseOperation = hadoopConfiguration . get ( ARG_OPERATION . getPropertyName ( ) ) ; if ( strCouchbaseOperation == null ) { return CouchbaseOperation . SET ; } try { return CouchbaseOperation . value...
Reads Couchbase store operation from the Hadoop configuration type .
10,658
public static Map < String , String > attributes ( Object executable ) { if ( executable == null || ! Aspects . hasAspect ( PerExecutable . class , executable . getClass ( ) ) ) { return empty ; } PerExecutable perExecutable = Aspects . aspectOf ( PerExecutable . class , executable . getClass ( ) ) ; if ( perExecutable...
Return the values of the attributes
10,659
protected Map < String , Object > buildJobDataMap ( final JmxCommand jmxCommand , final Object [ ] params ) throws MBeanException { final Map < String , Object > jobDataMap = new HashMap < String , Object > ( ) ; try { int ind = 0 ; for ( JmxOption option : JmxOptions . getOptions ( ) ) { option . process ( jobDataMap ...
Initialize the JobDataMap with the Program arguments
10,660
public Optional < BioCNode > getNode ( String role ) { return getNodes ( ) . stream ( ) . filter ( n -> n . getRole ( ) . equals ( role ) ) . findFirst ( ) ; }
Gets the first node based on the role .
10,661
public Matcher getMatcher ( String str ) { Matcher m ; if ( matchers . containsKey ( str ) ) { m = matchers . get ( str ) ; } else { m = p . matcher ( str ) ; matchers . put ( str , m ) ; } return m ; }
get matcher of the given string
10,662
public String [ ] exec ( String toExec ) { Matcher m = getMatcher ( toExec ) ; if ( m . find ( ) ) { List < String > list = new ArrayList < > ( ) ; int count = m . groupCount ( ) ; For ( 1 ) . to ( count ) . loop ( i -> { list . add ( m . group ( i ) ) ; } ) ; return list . toArray ( new String [ list . size ( ) ] ) ; ...
same as JavaScript exec
10,663
public static Trie < String > toStringTrie ( List < String > words ) { final TrieBuilder < String > builder = new TrieBuilder < > ( ) ; for ( String word : words ) { builder . add ( word , "" ) ; } return builder . build ( ) ; }
Sometimes a Trie s values aren t important only the words matter . Convenience method that associates each word with an empty value .
10,664
private void flushBuffer ( byte [ ] append , int ofs , int len ) throws IOException { int count ; count = pos + len ; if ( count > 0 ) { dest . writeAsciiLn ( Integer . toHexString ( count ) ) ; dest . write ( buffer , 0 , pos ) ; dest . write ( append , ofs , len ) ; dest . writeAsciiLn ( ) ; pos = 0 ; } }
flush buffer and bytes in append
10,665
public int download ( ) { try { if ( url . startsWith ( "https://" ) ) { registerSSLContext ( client . getBackend ( ) ) ; } final HttpGet httpGet = new HttpGet ( url ) ; if ( httpGet . isAborted ( ) ) { httpGet . abort ( ) ; } client . execute ( httpGet , new FutureCallback < HttpResponse > ( ) { public void failed ( E...
Starts the async download . The returned number is the internal slot for this download transfer which can be used as parameter in abort to stop this specific transfer .
10,666
public void abort ( int slot ) { try { HttpGet httpGet = httpGets . get ( slot ) ; httpGet . abort ( ) ; abortListeners ( httpGet . getURI ( ) . toString ( ) ) ; } catch ( Exception e ) { log . error ( e . getMessage ( ) ) ; } }
Aborts a transfer at the given slot
10,667
public static ElementBuilder [ ] newBuilders ( Class < ? > type ) { List < ElementBuilder > builders = new ArrayList < ElementBuilder > ( ) ; for ( ElementBuilderFactory factory : loader ) { ElementBuilder b = factory . newBuilder ( type ) ; if ( b != null ) { builders . add ( b ) ; } } return builders . toArray ( new ...
Return an array of builders that will build one part of the program .
10,668
private void convertWordNetToFlat ( Properties properties ) throws SMatchException { InMemoryWordNetBinaryArray . createWordNetCaches ( GLOBAL_PREFIX + SENSE_MATCHER_KEY , properties ) ; WordNet . createWordNetCaches ( GLOBAL_PREFIX + LINGUISTIC_ORACLE_KEY , properties ) ; }
Converts WordNet dictionary to binary format for fast searching .
10,669
@ SuppressWarnings ( "unchecked" ) public < Coll extends CollectionFuncSup < T > > Coll add ( T t ) { Collection < T > coll = ( Collection < T > ) iterable ; coll . add ( t ) ; return ( Coll ) this ; }
a chain to simplify add process
10,670
public boolean assist ( ) { final String commandLine = commandLineManager . getCommandLine ( ) ; final int caret = commandLineManager . getCaret ( ) ; final String commandLineToAssist = commandLine . substring ( 0 , caret ) ; final Opt < String > autoCompletedSuffix = shell . assist ( commandLineToAssist ) ; if ( ! aut...
Provide assistance for the command line .
10,671
public Set < URI > listOutputs ( URI operationUri ) { if ( operationUri == null ) { return ImmutableSet . of ( ) ; } return ImmutableSet . copyOf ( this . opOutputMap . get ( operationUri ) ) ; }
Obtains the list of output URIs for a given Operation
10,672
public Set < URI > listOptionalParts ( URI messageContent ) { if ( messageContent == null ) { return ImmutableSet . of ( ) ; } return ImmutableSet . copyOf ( this . messageOptionalPartsMap . get ( messageContent ) ) ; }
Obtains the list of optional parts for a given Message Content
10,673
private void initialise ( ) { Stopwatch stopwatch = new Stopwatch ( ) ; stopwatch . start ( ) ; populateCache ( ) ; stopwatch . stop ( ) ; log . info ( "Cache populated. Time taken {}" , stopwatch ) ; }
This method will be called when the server is initialised . If necessary it should take care of updating any indexes on boot time .
10,674
public synchronized void handleOntologyCreated ( OntologyCreatedEvent event ) { log . info ( "Processing Ontology Created Event - {}" , event . getOntologyUri ( ) ) ; Set < URI > conceptUris = this . manager . getKnowledgeBaseManager ( ) . listConcepts ( event . getOntologyUri ( ) ) ; log . info ( "Fetching matches for...
A new ontology has been uploaded to the server and we need to update the indexes
10,675
public synchronized void handleOntologyDeleted ( OntologyDeletedEvent event ) { log . info ( "Processing Ontology Deleted Event - {}" , event . getOntologyUri ( ) ) ; Set < URI > conceptUris = this . manager . getKnowledgeBaseManager ( ) . listConcepts ( null ) ; Set < URI > difference = Sets . difference ( conceptUris...
An ontology has been deleted from the KB and we should thus update the indexes . By the time we want to process this event we won t know any longer which concepts need to be removed unless we keep this somewhere .
10,676
public Icon get ( String url ) { StackTraceElement [ ] stacks = new Exception ( ) . getStackTrace ( ) ; try { Class callerClazz = Class . forName ( stacks [ 1 ] . getClassName ( ) ) ; return get ( callerClazz . getResource ( url ) ) ; } catch ( ClassNotFoundException e ) { throw new RuntimeException ( e ) ; } }
Gets the icon denoted by url . If url is relative it is relative to the caller .
10,677
public void closeAssociated ( ) throws XAException { Xid associatedXid = cpoXaStateMap . getXaResourceMap ( ) . get ( this ) ; if ( associatedXid != null ) { close ( associatedXid ) ; } }
Closes the resource associated with this instance
10,678
public void close ( Xid xid ) throws XAException { synchronized ( cpoXaStateMap ) { CpoXaState < T > cpoXaState = cpoXaStateMap . getXidStateMap ( ) . get ( xid ) ; if ( cpoXaState == null ) throw CpoXaError . createXAException ( CpoXaError . XAER_NOTA , "Unknown XID" ) ; closeResource ( cpoXaState . getResource ( ) ) ...
Closes the resource for the specified xid
10,679
public void execute ( org . parallelj . mirror . Process process ) { if ( ! ( process instanceof KProcess ) ) { return ; } this . execute ( ( KProcess ) process ) ; }
Execute a process .
10,680
public static ConceptId getInstance ( String id , Metadata metadata ) { List < Object > key = new ArrayList < > ( 1 ) ; key . add ( id ) ; ConceptId result = metadata . getFromConceptIdCache ( key ) ; if ( result != null ) { return result ; } else { result = new SimpleConceptId ( id , metadata ) ; metadata . putInConce...
Returns a concept propId with the given string identifier .
10,681
public static < T > Spplr < T > reflectionSupplier ( Object instance , String methodName , Class < T > suppliedClass ) { final ReflectionMethod method = ReflectionUtils . getNoArgsMethod ( instance . getClass ( ) , methodName ) ; ReflectionUtils . assertReturnValue ( method , suppliedClass ) ; return new ReflectionSupp...
Create a supplier that will invoke the method specified by the give method name on the given object instance through reflection . The method must be no - args and must return a value of the specified type . The method may be private in which case it will be made accessible outside it s class .
10,682
public void write ( String key , String document ) throws IOException { try { outputStream . write ( key . getBytes ( "UTF-8" ) ) ; outputStream . write ( keyDocumentDelimiter . getBytes ( "UTF-8" ) ) ; outputStream . write ( document . getBytes ( "UTF-8" ) ) ; outputStream . write ( rowDelimiter . getBytes ( "UTF-8" )...
Write a Couchbase document
10,683
protected char getRelation ( IAtomicConceptOfLabel sourceACoL , IAtomicConceptOfLabel targetACoL ) throws MatcherLibraryException { try { char relation = senseMatcher . getRelation ( sourceACoL . getSenseList ( ) , targetACoL . getSenseList ( ) ) ; if ( IMappingElement . IDK == relation ) { if ( useWeakSemanticsElement...
Returns a semantic relation between two atomic concepts .
10,684
private char getRelationFromStringMatchers ( String sourceLabel , String targetLabel ) { char relation = IMappingElement . IDK ; int i = 0 ; while ( ( relation == IMappingElement . IDK ) && ( i < stringMatchers . size ( ) ) ) { relation = stringMatchers . get ( i ) . match ( sourceLabel , targetLabel ) ; i ++ ; } retur...
Returns semantic relation holding between two labels as computed by string based matchers .
10,685
private char getRelationFromSenseGlossMatchers ( List < ISense > sourceSenses , List < ISense > targetSenses ) throws MatcherLibraryException { char relation = IMappingElement . IDK ; if ( 0 < senseGlossMatchers . size ( ) ) { for ( ISense sourceSense : sourceSenses ) { for ( ISense targetSense : targetSenses ) { int k...
Returns semantic relation between two sets of senses by WordNet sense - based matchers .
10,686
public static List < Element > getChildElements ( Element root , String ... steps ) { List < Element > lst ; lst = new ArrayList < > ( ) ; doGetChildElements ( root , steps , 0 , lst ) ; return lst ; }
Steps may be empty strings
10,687
private ILabel processNode ( INode currentNode , ArrayList < ILabel > pathToRootPhrases ) throws ContextPreprocessorException { if ( debugLabels ) { log . debug ( "preprocessing node: " + currentNode . getNodeData ( ) . getId ( ) + ", label: " + currentNode . getNodeData ( ) . getName ( ) ) ; } currentNode . getNodeDat...
Converts current node label into a formula using path to root as a context
10,688
public char match ( ISense source , ISense target ) throws MatcherLibraryException { List < String > sourceLemmas = source . getLemmas ( ) ; List < String > targetLemmas = target . getLemmas ( ) ; for ( String sourceLemma : sourceLemmas ) { for ( String targetLemma : targetLemmas ) { if ( sourceLemma . equals ( targetL...
Computes the relation with WordNet lemma matcher .
10,689
protected String resolveIOSPlaceholders ( String original ) { int index = 1 ; String resolved = original ; final Pattern pattern = Pattern . compile ( "%[a-zA-Z@]" ) ; final Matcher matcher = pattern . matcher ( original ) ; while ( matcher . find ( ) ) { String placeholderIOS = matcher . group ( ) ; String placeholder...
Returns a string with resolved iOS placeholders .
10,690
private Map < URI , MatchResult > findSome ( URI entityType , URI relationship , Set < URI > types , MatchType matchType ) { if ( types == null || types . isEmpty ( ) || ( ! entityType . toASCIIString ( ) . equals ( MSM . Service . getURI ( ) ) && ! entityType . toASCIIString ( ) . equals ( MSM . Operation . getURI ( )...
Generic implementation for finding all the Services or Operations that have SOME of the given types as inputs or outputs .
10,691
private Set < URI > listEntitesWithModelReference ( URI entityType , URI modelReference ) { Set < URI > entities = ImmutableSet . of ( ) ; if ( entityType . toASCIIString ( ) . equals ( MSM . Service . getURI ( ) ) ) { entities = this . serviceManager . listServicesWithModelReference ( modelReference ) ; } else if ( en...
Generic implementation for finding all the Services or Operations that have one specific model reference .
10,692
private Set < URI > listEntitiesWithType ( URI entityType , URI relationship , URI type ) { Set < URI > entities = ImmutableSet . of ( ) ; if ( entityType . toASCIIString ( ) . equals ( MSM . Service . getURI ( ) ) ) { if ( relationship . toASCIIString ( ) . equals ( MSM . hasInput . getURI ( ) ) ) { entities = this . ...
Generic implementation for finding all the Services or Operations that have one specific type as input or output .
10,693
public Map < URI , MatchResult > findOperationsConsumingAll ( Set < URI > inputTypes ) { return findOperationsConsumingAll ( inputTypes , LogicConceptMatchType . Plugin ) ; }
Discover registered operations that consume all the types of input provided . That is all those that have as input the types provided . All the input types should be matched to different inputs .
10,694
public Map < URI , MatchResult > findServicesClassifiedByAll ( Set < URI > modelReferences ) { return findServicesClassifiedByAll ( modelReferences , LogicConceptMatchType . Subsume ) ; }
Discover the services that are classified by all the types given . That is all those that have some level of matching with respect to all services provided in the model references .
10,695
public Map < FieldDescriptorType , Object > getAllFields ( ) { if ( hasLazyField ) { SmallSortedMap < FieldDescriptorType , Object > result = SmallSortedMap . newFieldMap ( 16 ) ; for ( int i = 0 ; i < fields . getNumArrayEntries ( ) ; i ++ ) { cloneFieldEntry ( result , fields . getArrayEntryAt ( i ) ) ; } for ( Map ....
Get a simple map containing all the fields .
10,696
public Iterator < Map . Entry < FieldDescriptorType , Object > > iterator ( ) { if ( hasLazyField ) { return new LazyIterator < FieldDescriptorType > ( fields . entrySet ( ) . iterator ( ) ) ; } return fields . entrySet ( ) . iterator ( ) ; }
Get an iterator to the field map . This iterator should not be leaked out of the protobuf library as it is not protected from mutation when fields is not immutable .
10,697
private static void writeElementNoTag ( final CodedOutputStream output , final WireFormat . FieldType type , final Object value ) throws IOException { switch ( type ) { case DOUBLE : output . writeDoubleNoTag ( ( Double ) value ) ; break ; case FLOAT : output . writeFloatNoTag ( ( Float ) value ) ; break ; case INT64 :...
Write a field of arbitrary type without its tag to the stream .
10,698
public static void writeField ( final FieldDescriptorLite < ? > descriptor , final Object value , final CodedOutputStream output ) throws IOException { WireFormat . FieldType type = descriptor . getLiteType ( ) ; int number = descriptor . getNumber ( ) ; if ( descriptor . isRepeated ( ) ) { final List < ? > valueList =...
Write a single field .
10,699
public static int computeFieldSize ( final FieldDescriptorLite < ? > descriptor , final Object value ) { WireFormat . FieldType type = descriptor . getLiteType ( ) ; int number = descriptor . getNumber ( ) ; if ( descriptor . isRepeated ( ) ) { if ( descriptor . isPacked ( ) ) { int dataSize = 0 ; for ( final Object el...
Compute the number of bytes needed to encode a particular field .