idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
13,000 | public final void reset ( ) { for ( int i = 0 ; i < position . length ; i ++ ) { position [ i ] = i ; } permLeft = new BigInteger ( permTotal . toString ( ) ) ; } | Resets the permutation generator . |
13,001 | private static BigInteger getFactorial ( int number ) { BigInteger factorial = BigInteger . ONE ; for ( int i = number ; i > 1 ; i -- ) { factorial = factorial . multiply ( new BigInteger ( Integer . toString ( i ) ) ) ; } return factorial ; } | Computes the factorial of the given number |
13,002 | public T create ( ) throws Exception { if ( type == TYPE_DEFAULT ) { if ( args == null || args . length == 0 ) { return aClass . newInstance ( ) ; } } else if ( type == TYPE_CREATOR ) { return creator . create ( ) ; } throw new RuntimeException ( "Unsupported create method" ) ; } | Creating actor from Props |
13,003 | public Mailbox createMailbox ( MailboxesQueue queue ) { if ( mailboxCreator != null ) { return mailboxCreator . createMailbox ( queue ) ; } else { return new Mailbox ( queue ) ; } } | Creating mailbox for actor |
13,004 | public static < T extends Actor > Props < T > create ( Class < T > tClass ) { return new Props ( tClass , null , TYPE_DEFAULT , null , null , null ) ; } | Create props from class |
13,005 | public static < T extends Actor > Props < T > create ( Class < T > clazz , ActorCreator < T > creator , MailboxCreator mailboxCreator ) { return new Props < T > ( clazz , null , TYPE_CREATOR , null , creator , mailboxCreator ) ; } | Create props from Actor creator with custom mailbox |
13,006 | public static void drawCircle ( Graphics g , Point center , int diameter ) { drawCircle ( g , ( int ) center . getX ( ) , ( int ) center . getY ( ) , diameter ) ; } | Draws a circle with the specified diameter using the given point as center . |
13,007 | public static void drawCircle ( Graphics g , int centerX , int centerY , int diameter ) { g . drawOval ( ( int ) ( centerX - diameter / 2 ) , ( int ) ( centerY - diameter / 2 ) , diameter , diameter ) ; } | Draws a circle with the specified diameter using the given point coordinates as center . |
13,008 | public static void fillCircle ( Graphics g , Point center , int diameter ) { fillCircle ( g , ( int ) center . getX ( ) , ( int ) center . getY ( ) , diameter ) ; } | Draws a circle with the specified diameter using the given point as center and fills it with the current color of the graphics context . |
13,009 | public static void fillCircle ( Graphics g , int centerX , int centerY , int diam ) { g . fillOval ( ( int ) ( centerX - diam / 2 ) , ( int ) ( centerY - diam / 2 ) , diam , diam ) ; } | Draws a circle with the specified diameter using the given point coordinates as center and fills it with the current color of the graphics context . |
13,010 | public static void fillCircle ( Graphics g , Point center , int diameter , Color color ) { fillCircle ( g , ( int ) center . x , ( int ) center . y , diameter , color ) ; } | Draws a circle with the specified diameter using the given point as center and fills it with the given color . |
13,011 | public static void fillCircle ( Graphics g , int centerX , int centerY , int diam , Color color ) { Color c = g . getColor ( ) ; g . setColor ( color ) ; fillCircle ( g , centerX , centerY , diam ) ; g . setColor ( c ) ; } | Draws a circle with the specified diameter using the given point coordinates as center and fills it with the given color . |
13,012 | public static boolean start ( final String configurationFilename ) { try { if ( getPm ( ) == null ) { instance = new PresentationManager ( configurationFilename ) ; } return isActive ( ) ; } catch ( Exception ex ) { instance = null ; Logger . getRootLogger ( ) . fatal ( "Unable to initialize jPM" , ex ) ; return false ... | Initialize the Presentation Manager singleton |
13,013 | public final boolean initialize ( ) { notifyObservers ( ) ; try { this . cfg = ( Properties ) new MainParser ( this ) . parseFile ( getCfgFilename ( ) ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; error = true ; return false ; } logger = ( JPMLogger ) newInstance ( getCfg ( ) . getProperty ( "logger-class" ... | Initialize the Presentation Manager . |
13,014 | public void logItem ( String s1 , String s2 , String symbol ) { info ( String . format ( "(%s) %-25s %s" , symbol , s1 , ( s2 != null ) ? s2 : "" ) ) ; } | Formatting helper for startup |
13,015 | public List < Entity > weakEntities ( Entity e ) { final List < Entity > res = new ArrayList < Entity > ( ) ; for ( Entity entity : getEntities ( ) . values ( ) ) { if ( entity . getOwner ( ) != null && entity . getOwner ( ) . getEntityId ( ) . compareTo ( e . getId ( ) ) == 0 ) { res . add ( entity ) ; } } if ( res . ... | Return the list of weak entities of the given entity . |
13,016 | public Entity getEntity ( String id ) { Entity e = getEntities ( ) . get ( id ) ; if ( e == null ) { return null ; } return e ; } | Return the entity of the given id |
13,017 | public EntityContainer newEntityContainer ( String id ) { final Entity e = lookupEntity ( id ) ; if ( e == null ) { return null ; } e . setWeaks ( weakEntities ( e ) ) ; return new EntityContainer ( e ) ; } | Create and fill a new Entity Container |
13,018 | private Entity lookupEntity ( String sid ) { for ( Integer i = 0 ; i < getEntities ( ) . size ( ) ; i ++ ) { Entity e = getEntities ( ) . get ( i ) ; if ( e != null && sid . compareTo ( EntityContainer . buildId ( e . getId ( ) ) ) == 0 ) { return getEntity ( e . getId ( ) ) ; } } return null ; } | Looks for an Entity with the given id |
13,019 | public void debug ( Object invoquer , Object o ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "[" + invoquer . getClass ( ) . getName ( ) + "] " + o ) ; } } | If debug flag is active create a debug information log |
13,020 | public void warn ( Object o ) { if ( o instanceof Throwable ) { logger . warn ( o , ( Throwable ) o ) ; } else { logger . warn ( o ) ; } } | Generate a warn entry on the local logger |
13,021 | public void error ( Object o ) { if ( o instanceof Throwable ) { logger . error ( o , ( Throwable ) o ) ; } else { logger . error ( o ) ; } } | Generate an error entry on the local logger |
13,022 | public String getAsString ( Object obj , String propertyName ) { Object o = get ( obj , propertyName ) ; if ( o != null ) { return o . toString ( ) ; } else { return "" ; } } | Getter for an object property value as String |
13,023 | public Object get ( Object obj , String propertyName ) { try { if ( obj != null && propertyName != null ) { return PropertyUtils . getNestedProperty ( obj , propertyName ) ; } } catch ( NullPointerException e ) { } catch ( NestedNullException e ) { } catch ( Exception e ) { error ( e ) ; return "-undefined-" ; } return... | Getter for an object property value |
13,024 | public void set ( Object obj , String name , Object value ) { try { PropertyUtils . setNestedProperty ( obj , name , value ) ; } catch ( Exception e ) { error ( e ) ; } } | Setter for an object property value |
13,025 | public Object newInstance ( String clazz ) { try { return Class . forName ( clazz ) . newInstance ( ) ; } catch ( Exception e ) { error ( e ) ; return null ; } } | Creates a new instance object of the given class . |
13,026 | public PMSession registerSession ( String sessionId ) { synchronized ( sessions ) { if ( sessionId != null ) { if ( ! sessions . containsKey ( sessionId ) ) { sessions . put ( sessionId , new PMSession ( sessionId ) ) ; } return getSession ( sessionId ) ; } else { return registerSession ( newSessionId ( ) ) ; } } } | Creates a new session with the given id . If null is used an automatic session id will be generated |
13,027 | public PMSession getSession ( String sessionId ) { final PMSession s = sessions . get ( sessionId ) ; if ( s != null ) { s . setLastAccess ( new Date ( ) ) ; } return s ; } | Return the session for the given id |
13,028 | public ResourceBundle getResourceBundle ( ) { if ( bundle == null ) { String lang = "" ; String country = "" ; final String _locale = getPm ( ) . getCfg ( ) . getProperty ( "locale" , "" ) ; if ( _locale != null && ! "" . equals ( _locale . trim ( ) ) ) { final String [ ] __locale = _locale . split ( "[_]" ) ; lang = _... | Returns local resource bundle for internationalization |
13,029 | public Converter getExternalConverter ( String id ) { for ( ExternalConverters ec : getExternalConverters ( ) ) { for ( ConverterWrapper cw : ec . getConverters ( ) ) { if ( cw . getId ( ) . equals ( id ) ) { return cw . getConverter ( ) ; } } } return null ; } | Search external converter by id |
13,030 | public AuditService getAuditService ( ) { if ( auditService == null ) { auditService = ( AuditService ) newInstance ( cfg . getProperty ( "audit-service" , "jpaoletti.jpm.core.audit.SimpleAudit" ) ) ; auditService . setLevel ( cfg . getInt ( "audit-level" , - 1 ) ) ; } return auditService ; } | Returns audit service |
13,031 | private void customLoad ( ) { final String s = getCfg ( ) . getProperty ( "custom-loader" ) ; if ( s != null ) { try { final CustomLoader customLoader = ( CustomLoader ) Class . forName ( s ) . newInstance ( ) ; logItem ( "Custom Loader" , s , "*" ) ; customLoader . execute ( this ) ; } catch ( ClassNotFoundException e... | Executes a custom loader . |
13,032 | protected String startMonitoring ( ) { String result ; if ( ! this . started . getAndSet ( true ) ) { synchronized ( this . brokerPollerMap ) { for ( ActiveMQBrokerPoller onePoller : this . brokerPollerMap . values ( ) ) { onePoller . start ( ) ; } } result = "started" ; } else { result = "already running" ; } return r... | Start monitoring now . |
13,033 | protected String prepareBrokerPoller ( String brokerName , String address ) throws Exception { MBeanAccessConnectionFactory mBeanAccessConnectionFactory = this . jmxActiveMQUtil . getLocationConnectionFactory ( address ) ; if ( brokerName . equals ( "*" ) ) { String [ ] brokersAtLocation = this . jmxActiveMQUtil . quer... | Prepare polling for the named broker at the given polling address . |
13,034 | public int doFilter ( final float [ ] ringBuffer , final int start , final int length , final int useBands ) { final float internalPreAmp = 1f / useBands ; final float rest = 1.0f - internalPreAmp ; final int end = start + length ; int index = start ; while ( index < end ) { for ( int c = 0 ; c < channels ; c ++ ) { fi... | This will perform the filter on the samples |
13,035 | public int getPhaseId ( ) { if ( ProcessingStep_Type . featOkTst && ( ( ProcessingStep_Type ) jcasType ) . casFeat_phaseId == null ) jcasType . jcas . throwFeatMissing ( "phaseId" , "edu.cmu.lti.oaqa.framework.types.ProcessingStep" ) ; return jcasType . ll_cas . ll_getIntValue ( addr , ( ( ProcessingStep_Type ) jcasTyp... | getter for phaseId - gets |
13,036 | public void setPhaseId ( int v ) { if ( ProcessingStep_Type . featOkTst && ( ( ProcessingStep_Type ) jcasType ) . casFeat_phaseId == null ) jcasType . jcas . throwFeatMissing ( "phaseId" , "edu.cmu.lti.oaqa.framework.types.ProcessingStep" ) ; jcasType . ll_cas . ll_setIntValue ( addr , ( ( ProcessingStep_Type ) jcasTyp... | setter for phaseId - sets |
13,037 | public String getComponent ( ) { if ( ProcessingStep_Type . featOkTst && ( ( ProcessingStep_Type ) jcasType ) . casFeat_component == null ) jcasType . jcas . throwFeatMissing ( "component" , "edu.cmu.lti.oaqa.framework.types.ProcessingStep" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( ProcessingStep_Ty... | getter for component - gets |
13,038 | public void setComponent ( String v ) { if ( ProcessingStep_Type . featOkTst && ( ( ProcessingStep_Type ) jcasType ) . casFeat_component == null ) jcasType . jcas . throwFeatMissing ( "component" , "edu.cmu.lti.oaqa.framework.types.ProcessingStep" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( ProcessingStep_Ty... | setter for component - sets |
13,039 | public String getCasId ( ) { if ( ProcessingStep_Type . featOkTst && ( ( ProcessingStep_Type ) jcasType ) . casFeat_casId == null ) jcasType . jcas . throwFeatMissing ( "casId" , "edu.cmu.lti.oaqa.framework.types.ProcessingStep" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( ProcessingStep_Type ) jcasTyp... | getter for casId - gets |
13,040 | public void setCasId ( String v ) { if ( ProcessingStep_Type . featOkTst && ( ( ProcessingStep_Type ) jcasType ) . casFeat_casId == null ) jcasType . jcas . throwFeatMissing ( "casId" , "edu.cmu.lti.oaqa.framework.types.ProcessingStep" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( ProcessingStep_Type ) jcasTyp... | setter for casId - sets |
13,041 | public List < V > load ( final int first , final int pageSize , final List < SortMeta > multiSortMeta , final Map < String , Object > filters ) { final boolean filtersChanged = handleFilters ( filters ) ; final boolean sortOrderChanged = handleSortOrder ( multiSortMeta ) ; boolean notify = false ; if ( filtersChanged |... | PF load for multiple sort support |
13,042 | boolean handleFilters ( Map < String , Object > filters ) { Validate . notNull ( filters , "Filters required" ) ; boolean changed = false ; for ( Object filterKey : CollectionUtils . subtract ( lastFilters . keySet ( ) , filters . keySet ( ) ) ) { BeanProperty . clearBeanProperty ( adaptee , ( String ) filterKey ) ; la... | Clears previously passed filters sets new filters on adaptee . |
13,043 | boolean handleSortOrder ( final List < SortMeta > sortOrder ) { boolean changed = false ; if ( sortOrder == null ) { if ( multiSortBy != null ) { adaptee . clearSorting ( ) ; multiSortBy = null ; lastSorting = null ; changed = true ; } } else { final List < SortProperty > newSorting = convert2SortProperty ( sortOrder )... | Updates sorting on the adaptee . |
13,044 | List < SortProperty > convert2SortProperty ( final List < SortMeta > sortMetas ) { List < SortProperty > sortProperties = new ArrayList < SortProperty > ( sortMetas . size ( ) ) ; for ( SortMeta sortMeta : sortMetas ) { final SortOrder order = sortMeta . getSortOrder ( ) ; if ( order == SortOrder . ASCENDING || order =... | Converts a list of PrimeFaces SortMeta to a list of DC SortPropertyOrder |
13,045 | SortPropertyOrder convert2SortPropertyOrder ( final SortOrder order ) { switch ( order ) { case ASCENDING : return SortPropertyOrder . ASCENDING ; case DESCENDING : return SortPropertyOrder . DESCENDING ; default : throw new IllegalArgumentException ( "Unknown SortOrder: " + order ) ; } } | Converts PrimeFaces SortOrder to DC SortPropertyOrder . |
13,046 | public void deleted ( String pid ) { LOGGER . entering ( CLASS_NAME , "deleted" , pid ) ; ServiceRegistration serviceRegistration = serviceAgents . remove ( pid ) ; if ( serviceRegistration != null ) { ServiceReference serviceReference = serviceRegistration . getReference ( ) ; ServiceAgent serviceAgent = ( ServiceAgen... | Remove the SLP service agent identified by a pid that it was associated with when it was first created . |
13,047 | public void close ( ) { LOGGER . entering ( CLASS_NAME , "close" ) ; for ( String pid : serviceAgents . keySet ( ) ) { deleted ( pid ) ; } LOGGER . exiting ( CLASS_NAME , "close" ) ; } | Close all the configured service agents . |
13,048 | public boolean matches ( Action < ? , ? > action , Object object ) { return this . action == action && object != null && entityType . isAssignableFrom ( object . getClass ( ) ) ; } | Checks whether given object is of interest to this interest instance . |
13,049 | protected Message createMessage ( ConnectionContext context , BasicMessage basicMessage , Map < String , String > headers ) throws JMSException { if ( context == null ) { throw new IllegalArgumentException ( "The context is null" ) ; } if ( basicMessage == null ) { throw new IllegalArgumentException ( "The message is n... | Creates a text message that can be send via a producer that contains the given BasicMessage s JSON encoded data . |
13,050 | protected Message createMessageWithBinaryData ( ConnectionContext context , BasicMessage basicMessage , InputStream inputStream , Map < String , String > headers ) throws JMSException { if ( context == null ) { throw new IllegalArgumentException ( "The context is null" ) ; } if ( basicMessage == null ) { throw new Ille... | Creates a blob message that can be send via a producer that contains the given BasicMessage s JSON encoded data along with binary data . |
13,051 | public static boolean deleteDirectory ( File dir ) { if ( dir . canWrite ( ) ) { File [ ] subFiles = dir . listFiles ( ) ; for ( int i = 0 ; i < subFiles . length ; i ++ ) { if ( subFiles [ i ] . isDirectory ( ) ) deleteDirectory ( subFiles [ i ] ) ; else subFiles [ i ] . delete ( ) ; } } return dir . delete ( ) ; } | Deletes a directory and its contents . |
13,052 | public int getChunkId ( byte [ ] key ) { int idx = Arrays . binarySearch ( maxKeyPerChunk , 0 , filledUpTo + 1 , key , comparator ) ; idx = idx < 0 ? - idx - 1 : idx ; if ( idx > filledUpTo ) { return - 1 ; } else { return idx ; } } | returns the index of the chunk where the element could be found . If the element can t be in one of the chunks the method will return - 1 . |
13,053 | public boolean isConsistent ( ) { for ( int i = 1 ; i < filledUpTo ; i ++ ) { int comp1 = KeyUtils . compareKey ( maxKeyPerChunk [ i ] , maxKeyPerChunk [ i - 1 ] ) ; if ( comp1 <= 0 ) { return false ; } } return true ; } | Checks if this index is consistent . All inserted keys have to be inserted incrementally . |
13,054 | public void setLargestKey ( int chunkIdx , byte [ ] largestKeyInChunk ) { maxKeyPerChunk [ chunkIdx ] = largestKeyInChunk ; filledUpTo = Math . max ( filledUpTo , chunkIdx ) ; indexBuffer . position ( chunkIdx * keySize ) ; indexBuffer . put ( largestKeyInChunk ) ; } | Sets a new largest key in the chunk with the given index . |
13,055 | public String obfuscate ( char [ ] masterKey , byte [ ] data , int version ) { Objects . requireNonNull ( masterKey ) ; Objects . requireNonNull ( data ) ; switch ( version ) { case 1 : return v1Obfuscator . obfuscate ( masterKey , data ) . toString ( ) ; default : throw new IllegalArgumentException ( "Unsupported vers... | Obfuscate data using supplied master key and algorithm version . |
13,056 | protected void updateRates ( QueueStatMeasurements rateMeasurements , long dequeueCountDelta , long enqueueCountDelta ) { double oldDequeueRateOneMinute = rateMeasurements . messageRates . getOneMinuteAverageDequeueRate ( ) ; double oldDequeueRateOneHour = rateMeasurements . messageRates . getOneHourAverageDequeueRate ... | Update message rates given the change in dequeue and enqueue counts for one broker queue . |
13,057 | public int openForWrite ( String Filename , WaveFile OtherWave ) { return openForWrite ( Filename , OtherWave . getSamplingRate ( ) , OtherWave . getBitsPerSample ( ) , OtherWave . getNumChannels ( ) ) ; } | Open for write using another wave file s parameters ... |
13,058 | public int writeSamples ( short [ ] data , int numSamples ) { int numBytes = numSamples << 1 ; byte [ ] theData = new byte [ numBytes ] ; for ( int y = 0 , yc = 0 ; y < numBytes ; y += 2 ) { theData [ y ] = ( byte ) ( data [ yc ] & 0x00FF ) ; theData [ y + 1 ] = ( byte ) ( ( data [ yc ++ ] >>> 8 ) & 0x00FF ) ; } return... | Write 16 - bit audio |
13,059 | public static TinyPlugz getInstance ( ) { final TinyPlugz plugz = instance ; Require . state ( plugz != null , "TinyPlugz has not been initialized" ) ; return plugz ; } | Gets the single TinyPlugz instance . |
13,060 | public static void logMemory ( long interval , Level level ) { Task < Void , NoException > task = new Task . Cpu < Void , NoException > ( "Logging memory" , Task . PRIORITY_BACKGROUND ) { public Void run ( ) { logMemory ( level ) ; return null ; } } ; task . executeEvery ( interval , interval ) ; task . start ( ) ; } | Log memory usage to the console at regular interval . |
13,061 | public void addNamedParameter ( String parameterName , int startIndex , int endIndex ) { delegate . addNamedParameter ( parameterName , startIndex , endIndex ) ; } | Add a named parameter parsed from this SQL statement . |
13,062 | public boolean containsInstance ( int value , T instance ) { if ( root == null ) return false ; if ( value < first . value ) return false ; if ( value > last . value ) return false ; if ( value == first . value && instance == first . element ) return true ; if ( value == last . value && instance == last . element ) ret... | Returns true if the given key exists in the tree and its associated value is the given element . Comparison of the element is using the == operator . |
13,063 | public Node < T > searchNearestLower ( int value , boolean acceptEquals ) { if ( root == null ) return null ; return searchNearestLower ( root , value , acceptEquals ) ; } | Returns the node containing the highest value strictly lower than the given one . |
13,064 | public void removeMin ( ) { if ( root == null ) return ; if ( ( root . left == null || ! root . left . red ) && ( root . right == null || ! root . right . red ) ) root . red = true ; root = removeMin ( root , true ) ; if ( root != null ) root . red = false ; else first = last = null ; } | Remove the first element . |
13,065 | public void remove ( Node < T > node ) { if ( first == node ) { removeMin ( ) ; return ; } if ( last == node ) { removeMax ( ) ; return ; } if ( ( root . left == null || ! root . left . red ) && ( root . right == null || ! root . right . red ) ) root . red = true ; root = remove ( root , node ) ; if ( root != null ) ro... | Remove the given node . |
13,066 | public void removeKey ( int key ) { if ( key == first . value ) { removeMin ( ) ; return ; } if ( key == last . value ) { removeMax ( ) ; return ; } if ( ( root . left == null || ! root . left . red ) && ( root . right == null || ! root . right . red ) ) root . red = true ; root = removeKey ( root , key ) ; if ( root !... | Remove the given key . The key MUST exists else the tree won t be valid anymore . |
13,067 | public static Related with ( CanonicalPath entityPath , String relationship ) { return new Related ( entityPath , relationship , EntityRole . SOURCE ) ; } | Specifies a filter for entities that are sources of a relationship with the specified entity . |
13,068 | public static Related asTargetWith ( CanonicalPath entityPath , String relationship ) { return new Related ( entityPath , relationship , EntityRole . TARGET ) ; } | Specifies a filter for entities that are targets of a relationship with the specified entity . |
13,069 | public synchronized void addToJoinDoNotCancel ( ISynchronizationPoint < ? extends TError > sp ) { nbToJoin ++ ; sp . listenInline ( new Runnable ( ) { public void run ( ) { if ( sp . hasError ( ) ) error ( sp . getError ( ) ) ; else joined ( ) ; } } ) ; if ( Threading . debugSynchronization ) ThreadingDebugHelper . reg... | Similar to addToJoin but in case the synchronization point is cancelled it is simply consider as done and do not cancel this JoinPoint . |
13,070 | public static void listenInline ( Runnable listener , ISynchronizationPoint < ? > ... synchPoints ) { JoinPoint < Exception > jp = new JoinPoint < > ( ) ; for ( int i = 0 ; i < synchPoints . length ; ++ i ) if ( synchPoints [ i ] != null ) jp . addToJoin ( synchPoints [ i ] ) ; jp . start ( ) ; jp . listenInline ( list... | Shortcut method to create a JoinPoint waiting for the given synchronization points start the JoinPoint and add the given listener to be called when the JoinPoint is unblocked . If any synchronization point has an error or is cancelled the JoinPoint is immediately unblocked . If some given synchronization points are nul... |
13,071 | public static void listenInlineOnAllDone ( Runnable listener , ISynchronizationPoint < ? > ... synchPoints ) { JoinPoint < NoException > jp = new JoinPoint < > ( ) ; jp . addToJoin ( synchPoints . length ) ; Runnable jpr = new Runnable ( ) { public void run ( ) { jp . joined ( ) ; } } ; for ( int i = 0 ; i < synchPoint... | Shortcut method to create a JoinPoint waiting for the given synchronization points start the JoinPoint and add the given listener to be called when the JoinPoint is unblocked . The JoinPoint is not unblocked until all synchronization points are unblocked . If any has error or is cancel the error or cancellation reason ... |
13,072 | public static DirectoryAgentInfo from ( DAAdvert daAdvert ) { return new DirectoryAgentInfo ( daAdvert . getURL ( ) , daAdvert . getScopes ( ) , daAdvert . getAttributes ( ) , daAdvert . getLanguage ( ) , daAdvert . getBootTime ( ) ) ; } | Creates a new DirectoryAgentInfo from the given DAAdvert message . |
13,073 | public static DirectoryAgentInfo from ( String address ) { return from ( address , Scopes . ANY , Attributes . NONE , null , - 1 ) ; } | Creates a new DirectoryAgentInfo from the given IP address . |
13,074 | public static DirectoryAgentInfo from ( String address , Scopes scopes , Attributes attributes , String language , int bootTime ) { return new DirectoryAgentInfo ( SERVICE_TYPE . asString ( ) + "://" + address , scopes , attributes , language , bootTime ) ; } | Creates a new DirectoryAgentInfo from the given arguments . |
13,075 | public static < T > Iterator < T > singleIterator ( T t ) { Require . nonNull ( t , "t" ) ; return Collections . singleton ( t ) . iterator ( ) ; } | Creates an Iterator over the single given element . |
13,076 | public static < T > Iterator < T > filter ( Iterator < T > it , Predicate < T > filter ) { return new Iterator < T > ( ) { private T cached = null ; public boolean hasNext ( ) { if ( this . cached != null ) { return true ; } boolean test = false ; while ( it . hasNext ( ) && ! test ) { this . cached = it . next ( ) ; t... | Creates an iterator that returns a filtered view of the input iterator . |
13,077 | public static < T > Iterable < T > iterableOf ( Iterator < T > it ) { final Iterator < T > theIt = Require . nonNull ( it , "it" ) ; return new Iterable < T > ( ) { public Iterator < T > iterator ( ) { return theIt ; } } ; } | Wraps the given Iterator into an Iterable . |
13,078 | public static < T > ElementIterator < T > compositeIterator ( Iterator < T > ... iterators ) { Require . nonNull ( iterators , "iterators" ) ; final Iterator < T > result ; if ( iterators . length == 0 ) { result = Collections . emptyIterator ( ) ; } else if ( iterators . length == 1 ) { if ( iterators [ 0 ] instanceof... | Creates an iterator which subsequently iterates over all given iterators . |
13,079 | @ SuppressWarnings ( "unchecked" ) public static < T > Iterable < T > compositeIterable ( Iterable < T > ... iterables ) { Require . nonNull ( iterables , "iterables" ) ; final Iterator < T > it ; if ( iterables . length == 0 ) { it = Collections . emptyIterator ( ) ; } else if ( iterables . length == 1 ) { return iter... | Creates an iterable which returns a composite iterator over all iterators of the given iterables . |
13,080 | public static DZcs cs_permute ( DZcs A , int [ ] pinv , int [ ] q , boolean values ) { int t , j , k , nz = 0 , m , n , Ap [ ] , Ai [ ] , Cp [ ] , Ci [ ] ; DZcsa Cx = new DZcsa ( ) , Ax = new DZcsa ( ) ; DZcs C ; if ( ! CS_CSC ( A ) ) return ( null ) ; m = A . m ; n = A . n ; Ap = A . p ; Ai = A . i ; Ax . x = A . x ; ... | Permutes a sparse matrix C = PAQ . |
13,081 | public int size ( ) { int result = 0 ; for ( O o : multiplicities . keySet ( ) ) { result += multiplicity ( o ) ; } return result ; } | Returns the number of elements i . e . the sum of all multiplicities . |
13,082 | public void addAll ( O ... objects ) throws ParameterException { Validate . notNull ( objects ) ; for ( O o : objects ) { incMultiplicity ( o ) ; } } | Adds all given objects to this multiset . |
13,083 | public boolean remove ( O object ) { Integer multiplicity = multiplicities . get ( object ) ; if ( multiplicities . remove ( object ) == null ) { return false ; } decMultiplicityCount ( multiplicity ) ; return true ; } | Removes the given object from this multiset . |
13,084 | public void reset ( ) { document = null ; systemId = null ; xsiNamespaces . clear ( ) ; schemas . clear ( ) ; bDtdUsed = false ; bXsdUsed = false ; bWellformed = false ; bValid = false ; } | Reset fields . |
13,085 | public void startRead ( ) { SynchronizationPoint < NoException > sp ; synchronized ( this ) { if ( ! writer ) { readers ++ ; return ; } if ( readerWaiting == null ) readerWaiting = new SynchronizationPoint < NoException > ( ) ; sp = readerWaiting ; readers ++ ; } sp . block ( 0 ) ; } | To call when a thread wants to enter read mode . If the lock point is used in write mode this method will block until it is released . |
13,086 | public SynchronizationPoint < NoException > startReadAsync ( boolean returnNullIfReady ) { SynchronizationPoint < NoException > sp ; synchronized ( this ) { if ( ! writer ) { readers ++ ; return returnNullIfReady ? null : new SynchronizationPoint < > ( true ) ; } if ( readerWaiting == null ) readerWaiting = new Synchro... | To call when a thread wants to enter read mode . If the lock point is used in write mode this method will return a SynchronizationPoint unblocked when read can start . |
13,087 | public void endRead ( ) { SynchronizationPoint < NoException > sp ; synchronized ( this ) { if ( -- readers > 0 ) return ; if ( writersWaiting == null ) return ; sp = writersWaiting . removeFirst ( ) ; if ( writersWaiting . isEmpty ( ) ) writersWaiting = null ; writer = true ; } sp . unblock ( ) ; } | To call when the thread leaves the read mode and release this lock point . |
13,088 | public void startWrite ( ) { SynchronizationPoint < NoException > sp ; synchronized ( this ) { if ( readers == 0 && ! writer ) { writer = true ; return ; } sp = new SynchronizationPoint < NoException > ( ) ; if ( writersWaiting == null ) writersWaiting = new LinkedList < > ( ) ; writersWaiting . add ( sp ) ; } sp . blo... | To call when a thread wants to enter write mode . If the lock point is used in read mode this method will block until it is released . |
13,089 | public SynchronizationPoint < NoException > startWriteAsync ( boolean returnNullIfReady ) { SynchronizationPoint < NoException > sp ; synchronized ( this ) { if ( readers == 0 && ! writer ) { writer = true ; return returnNullIfReady ? null : new SynchronizationPoint < > ( true ) ; } sp = new SynchronizationPoint < NoEx... | To call when a thread wants to enter write mode . If write can start immediately this method returns null . If the lock point is used in read mode this method will return a SynchronizationPoint unblocked when write can start . |
13,090 | public void endWrite ( ) { SynchronizationPoint < NoException > sp ; synchronized ( this ) { if ( readerWaiting != null ) { sp = readerWaiting ; readerWaiting = null ; writer = false ; } else if ( writersWaiting != null ) { sp = writersWaiting . removeFirst ( ) ; if ( writersWaiting . isEmpty ( ) ) writersWaiting = nul... | To call when the thread leaves the write mode and release this lock point . |
13,091 | public void update ( Observable o , Object arg ) { if ( arg instanceof String ) { lines . add ( ( String ) arg ) ; } if ( arg instanceof List < ? > ) { lines . addAll ( ( List < String > ) arg ) ; } if ( arg instanceof Exception ) { Exception e = ( Exception ) arg ; PresentationManager . getPm ( ) . error ( e ) ; lines... | Inherited from Observer |
13,092 | public static boolean isValidLocalIP ( InetAddress ip ) throws SocketException { String ipStr = ip . getHostAddress ( ) ; Iterator ips = getAllIPAddresses ( ) . iterator ( ) ; while ( ips . hasNext ( ) ) { InetAddress ip2 = ( InetAddress ) ips . next ( ) ; if ( ip2 . getHostAddress ( ) . equals ( ipStr ) ) { return tru... | Decides whether an IP is local or not |
13,093 | public static LinkedHashSet < Class < ? > > getInterfaces ( Class < ? > clazz ) throws ReflectionException { Validate . notNull ( clazz ) ; try { LinkedHashSet < Class < ? > > interfaces = new LinkedHashSet < > ( ) ; interfaces . addAll ( Arrays . asList ( clazz . getInterfaces ( ) ) ) ; LinkedHashSet < Class < ? > > s... | Returns all implemented interfaces of the given class . |
13,094 | public String getExpressionString ( String name , Object permission ) { String expression = properties . getProperty ( CONFIG_EXPRESSION_PREFIX + name + "." + permission ) ; if ( expression == null ) { expression = properties . getProperty ( CONFIG_EXPRESSION_PREFIX + name ) ; } if ( expression == null && StringUtils .... | Find the expression string recursively from the config file |
13,095 | private String createMailToLink ( String to , String bcc , String cc , String subject , String body ) { Validate . notNull ( to , "You must define a to-address" ) ; final StringBuilder urlBuilder = new StringBuilder ( "mailto:" ) ; addEncodedValue ( urlBuilder , "to" , to ) ; if ( bcc != null || cc != null || subject !... | Creates the mailto - link . |
13,096 | private void addEncodedValue ( final StringBuilder urlBuilder , final String name , String value ) { if ( value != null ) { String encodedValue ; if ( ! "to" . equals ( name ) && ! urlBuilder . toString ( ) . endsWith ( "?" ) ) { urlBuilder . append ( '&' ) ; } try { encodedValue = URLEncoder . encode ( value , "utf-8"... | Added more information to the urlbuilder . |
13,097 | private String extractAttribute ( Element element , Arguments arguments , String attributeName ) { final String toExpr = element . getAttributeValue ( attributeName ) ; if ( toExpr == null ) { return null ; } final String to ; if ( toExpr . contains ( "#" ) || toExpr . contains ( "$" ) ) { to = parse ( arguments , toEx... | Extract the attribute . |
13,098 | private String parse ( final Arguments arguments , String input ) { final Configuration configuration = arguments . getConfiguration ( ) ; final IStandardExpressionParser parser = StandardExpressions . getExpressionParser ( configuration ) ; final IStandardExpression expression = parser . parseExpression ( configuratio... | Parse the expression of an value . |
13,099 | private boolean checkHeader ( RandomAccessInputStream raf ) throws IOException { raf . seek ( HEAD_LOCATION ) ; byte [ ] buf = new byte [ HEAD_SIZE ] ; if ( raf . read ( buf ) != HEAD_SIZE ) { throw new IOException ( "Error encountered finding id3v2 header" ) ; } String result = new String ( buf , ENC_TYPE ) ; if ( res... | Checks to see if there is an id3v2 header in the file provided to the constructor . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.