signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Director { /** * Fires an install progress event to be displayed
* @ param progress the progress integer
* @ param installAsset the install asset necessitating the progress event
* @ throws InstallException */
public void fireInstallProgressEvent ( int progress , InstallAsset installAsset ) throws InstallException { } } | if ( installAsset . isServerPackage ( ) ) fireProgressEvent ( InstallProgressEvent . DEPLOY , progress , Messages . INSTALL_KERNEL_MESSAGES . getLogMessage ( "STATE_DEPLOYING" , installAsset . toString ( ) ) , true ) ; else if ( installAsset . isFeature ( ) ) { ESAAsset esaa = ( ( ESAAsset ) installAsset ) ; if ( esaa . isPublic ( ) ) { String resourceName = ( esaa . getShortName ( ) == null ) ? esaa . getDisplayName ( ) : esaa . getShortName ( ) ; fireProgressEvent ( InstallProgressEvent . INSTALL , progress , Messages . INSTALL_KERNEL_MESSAGES . getLogMessage ( "STATE_INSTALLING" , resourceName ) , true ) ; } else if ( ! firePublicAssetOnly ) { fireProgressEvent ( InstallProgressEvent . INSTALL , progress , Messages . INSTALL_KERNEL_MESSAGES . getLogMessage ( "STATE_INSTALLING_DEPENDENCY" ) , true ) ; } } else { fireProgressEvent ( InstallProgressEvent . INSTALL , progress , Messages . INSTALL_KERNEL_MESSAGES . getLogMessage ( "STATE_INSTALLING" , installAsset . toString ( ) ) , true ) ; } |
public class RadialPickerLayout { /** * Set either the hour or the minute . Will set the internal value , and set the selection . */
private void setItem ( int index , int value ) { } } | if ( index == HOUR_INDEX ) { setValueForItem ( HOUR_INDEX , value ) ; int hourDegrees = ( value % 12 ) * HOUR_VALUE_TO_DEGREES_STEP_SIZE ; mHourRadialSelectorView . setSelection ( hourDegrees , isHourInnerCircle ( value ) , false ) ; mHourRadialSelectorView . invalidate ( ) ; } else if ( index == MINUTE_INDEX ) { setValueForItem ( MINUTE_INDEX , value ) ; int minuteDegrees = value * MINUTE_VALUE_TO_DEGREES_STEP_SIZE ; mMinuteRadialSelectorView . setSelection ( minuteDegrees , false , false ) ; mMinuteRadialSelectorView . invalidate ( ) ; } |
public class ManagedProcess { /** * Returns the exit value for the subprocess .
* @ return the exit value of the subprocess represented by this < code > Process < / code > object . by
* convention , the value < code > 0 < / code > indicates normal termination .
* @ exception ManagedProcessException if the subprocess represented by this
* < code > ManagedProcess < / code > object has not yet terminated . */
@ Override public int exitValue ( ) throws ManagedProcessException { } } | try { return resultHandler . getExitValue ( ) ; } catch ( IllegalStateException e ) { throw new ManagedProcessException ( "Exit Value not (yet) available for " + getProcLongName ( ) , e ) ; } |
public class TemplateCodeGenerator { /** * ( non - Javadoc )
* @ see com . baidu . bjf . remoting . protobuf . code . ICodeGenerator # getCode ( ) */
@ Override public String getCode ( ) { } } | String pkg = getPackage ( ) ; if ( ! StringUtils . isEmpty ( pkg ) ) { pkg = "package " + pkg + ";" ; } // set package
templator . setVariable ( "package" , pkg ) ; // add loop block for import packages
genImportCode ( ) ; // generate class
String className = getClassName ( ) ; templator . setVariable ( "className" , className ) ; // to implements Codec interface
templator . setVariable ( "codecClassName" , Codec . class . getName ( ) ) ; templator . setVariable ( "targetProxyClassName" , getTargetProxyClassname ( ) ) ; // define Descriptor field
String descriptorClsName = ClassHelper . getInternalName ( Descriptor . class . getCanonicalName ( ) ) ; templator . setVariable ( "descriptorClsName" , descriptorClsName ) ; // create methods
initEncodeMethodTemplateVariable ( ) ; initDecodeMethodTemplateVariable ( ) ; StringBuilderWriter writer = new StringBuilderWriter ( ) ; try { templator . generateOutput ( writer ) ; } catch ( IOException e ) { throw new RuntimeException ( e . getMessage ( ) , e ) ; } return writer . toString ( ) ; |
public class CodeGenerator { /** * This function adds a comma - separated list as is specified by an ARRAYLIT
* node with the associated skipIndexes array . This is a space optimization
* since we avoid creating a whole Node object for each empty array literal
* slot .
* @ param firstInList The first in the node list ( chained through the next
* property ) . */
void addArrayList ( Node firstInList ) { } } | boolean lastWasEmpty = false ; for ( Node n = firstInList ; n != null ; n = n . getNext ( ) ) { if ( n != firstInList ) { cc . listSeparator ( ) ; } addExpr ( n , 1 , Context . OTHER ) ; lastWasEmpty = n . isEmpty ( ) ; } if ( lastWasEmpty ) { cc . listSeparator ( ) ; } |
public class SimpleChannelPool { /** * Tries to retrieve healthy channel from the pool if any or creates a new channel otherwise .
* @ param promise the promise to provide acquire result .
* @ return future for acquiring a channel . */
private Future < Channel > acquireHealthyFromPoolOrNew ( final Promise < Channel > promise ) { } } | try { final Channel ch = pollChannel ( ) ; if ( ch == null ) { // No Channel left in the pool bootstrap a new Channel
Bootstrap bs = bootstrap . clone ( ) ; bs . attr ( POOL_KEY , this ) ; ChannelFuture f = connectChannel ( bs ) ; if ( f . isDone ( ) ) { notifyConnect ( f , promise ) ; } else { f . addListener ( new ChannelFutureListener ( ) { @ Override public void operationComplete ( ChannelFuture future ) throws Exception { notifyConnect ( future , promise ) ; } } ) ; } return promise ; } EventLoop loop = ch . eventLoop ( ) ; if ( loop . inEventLoop ( ) ) { doHealthCheck ( ch , promise ) ; } else { loop . execute ( new Runnable ( ) { @ Override public void run ( ) { doHealthCheck ( ch , promise ) ; } } ) ; } } catch ( Throwable cause ) { promise . tryFailure ( cause ) ; } return promise ; |
public class Code { /** * pc is increased by 1. */
public void emitGeneric ( int opcode , Object [ ] args ) { } } | Instruction instr ; InstructionType type ; type = Set . TYPES [ opcode ] ; instr = new Instruction ( - 1 , type , args ) ; instructions . add ( instr ) ; |
public class DOM2DTM { /** * Retrieves an attribute node by by qualified name and namespace URI .
* @ param nodeHandle int Handle of the node upon which to look up this attribute . .
* @ param namespaceURI The namespace URI of the attribute to
* retrieve , or null .
* @ param name The local name of the attribute to
* retrieve .
* @ return The attribute node handle with the specified name (
* < code > nodeName < / code > ) or < code > DTM . NULL < / code > if there is no such
* attribute . */
public int getAttributeNode ( int nodeHandle , String namespaceURI , String name ) { } } | // % OPT % This is probably slower than it needs to be .
if ( null == namespaceURI ) namespaceURI = "" ; int type = getNodeType ( nodeHandle ) ; if ( DTM . ELEMENT_NODE == type ) { // Assume that attributes immediately follow the element .
int identity = makeNodeIdentity ( nodeHandle ) ; while ( DTM . NULL != ( identity = getNextNodeIdentity ( identity ) ) ) { // Assume this can not be null .
type = _type ( identity ) ; // % REVIEW %
// Should namespace nodes be retrievable DOM - style as attrs ?
// If not we need a separate function . . . which may be desirable
// architecturally , but which is ugly from a code point of view .
// ( If we REALLY insist on it , this code should become a subroutine
// of both - - retrieve the node , then test if the type matches
// what you ' re looking for . )
if ( type == DTM . ATTRIBUTE_NODE || type == DTM . NAMESPACE_NODE ) { Node node = lookupNode ( identity ) ; String nodeuri = node . getNamespaceURI ( ) ; if ( null == nodeuri ) nodeuri = "" ; String nodelocalname = node . getLocalName ( ) ; if ( nodeuri . equals ( namespaceURI ) && name . equals ( nodelocalname ) ) return makeNodeHandle ( identity ) ; } else // if ( DTM . NAMESPACE _ NODE ! = type )
{ break ; } } } return DTM . NULL ; |
public class PathImpl { /** * Creates the file named by this Path and returns true if the
* file is new . */
public boolean createNewFile ( ) throws IOException { } } | synchronized ( LOCK ) { if ( ! exists ( ) ) { clearStatusCache ( ) ; WriteStreamOld s = openWrite ( ) ; s . close ( ) ; return true ; } } return false ; |
public class DescribeDefaultAuthorizerRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeDefaultAuthorizerRequest describeDefaultAuthorizerRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeDefaultAuthorizerRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class FastCloner { /** * reflection utils */
private List < Field > allFields ( final Class < ? > c ) { } } | List < Field > l = this . fieldsCache . get ( c ) ; if ( l == null ) { l = new LinkedList < Field > ( ) ; final Field [ ] fields = c . getDeclaredFields ( ) ; addAll ( l , fields ) ; Class < ? > sc = c ; while ( ( ( sc = sc . getSuperclass ( ) ) != Object . class ) && ( sc != null ) ) { addAll ( l , sc . getDeclaredFields ( ) ) ; } this . fieldsCache . putIfAbsent ( c , l ) ; } return l ; |
public class StageCommand { /** * { @ inheritDoc } */
@ Override protected void perform ( final Wave wave ) { } } | LOGGER . info ( "Trigger stage action " + waveBean ( wave ) . action ( ) ) ; switch ( waveBean ( wave ) . action ( ) ) { case show : returnData ( StageService . class , StageService . DO_OPEN_STAGE , waveBean ( wave ) ) ; break ; case hide : returnData ( StageService . class , StageService . DO_CLOSE_STAGE , waveBean ( wave ) ) ; break ; case destroy : returnData ( StageService . class , StageService . DO_DESTROY_STAGE , waveBean ( wave ) ) ; break ; default : LOGGER . error ( "Undefined StageAction" ) ; } |
public class Smb2TreeDisconnectRequest { /** * { @ inheritDoc }
* @ see jcifs . internal . smb2 . ServerMessageBlock2 # writeBytesWireFormat ( byte [ ] , int ) */
@ Override protected int writeBytesWireFormat ( byte [ ] dst , int dstIndex ) { } } | SMBUtil . writeInt2 ( 4 , dst , dstIndex ) ; SMBUtil . writeInt2 ( 0 , dst , dstIndex + 2 ) ; return 4 ; |
public class LoadingAnimation { /** * GEN - LAST : event _ formComponentResized */
@ Override public void paint ( Graphics g ) { } } | super . paint ( g ) ; boolean change = indeterminate ; Graphics2D g2 = ( Graphics2D ) g . create ( ) ; updateComponentMiddelpoint ( g2 ) ; for ( int animationPointID = animationPointCount - 1 ; animationPointID >= 0 ; animationPointID -- ) { if ( indeterminate ) { indeterminateAnimation ( g2 , animationPointID ) ; } else { progressAnimation ( g2 , animationPoint [ animationPointID ] , animationPointID ) ; if ( ! ( animationPoint [ animationPointID ] == 0 || animationPoint [ animationPointID ] == 255 ) ) { change = true ; } } Thread . yield ( ) ; } if ( ! change ) { synchronized ( animationTimer ) { animationTimer . stop ( ) ; animationTimer . notifyAll ( ) ; } } // Rectangle rec = g2 . getClipBounds ( ) ;
// ( ( GroupLayout ) this . getLayout ( ) ) .
// stateTextLabel . setPreferredSize ( new Dimension ( ( int ) stateTextLabel . getWidth ( ) , ) ) ;
// debugPaint ( g2 ) ;
g2 . dispose ( ) ; |
public class ThreadBoundJschLogger { /** * Set the thread - inherited logger with a loglevel on Jsch
* @ param logger logger
* @ param loggingLevel level */
private void setThreadLogger ( PluginLogger logger , int loggingLevel ) { } } | pluginLogger . set ( logger ) ; logLevel . set ( loggingLevel ) ; JSch . setLogger ( this ) ; |
public class RoundedMoney { /** * ( non - Javadoc )
* @ see MonetaryAmount # negate ( ) */
@ Override public RoundedMoney negate ( ) { } } | MathContext mc = monetaryContext . get ( MathContext . class ) ; if ( mc == null ) { mc = MathContext . DECIMAL64 ; } return new RoundedMoney ( number . negate ( mc ) , currency , rounding ) ; |
public class RouteBuilder { /** * Specifies that this route is mapped to HTTP POST method .
* @ return instance of { @ link RouteBuilder } . */
public RouteBuilder post ( ) { } } | if ( ! methods . contains ( HttpMethod . POST ) ) { methods . add ( HttpMethod . POST ) ; } return this ; |
public class TapestryExtension { /** * allow activation of the extension w / o specifying any modules . */
private Set < Class < ? > > collectModules ( SpecInfo spec ) { } } | Set < Class < ? > > modules = null ; for ( SpecInfo curr : spec . getSpecsTopToBottom ( ) ) { if ( importModuleAnnotation != null && spec . isAnnotationPresent ( importModuleAnnotation ) ) { org . apache . tapestry5 . ioc . annotations . ImportModule importModule = curr . getAnnotation ( org . apache . tapestry5 . ioc . annotations . ImportModule . class ) ; if ( importModule != null ) { if ( modules == null ) { modules = new HashSet < > ( ) ; } modules . addAll ( Arrays . < Class < ? > > asList ( importModule . value ( ) ) ) ; } } if ( submoduleAnnotation != null && spec . isAnnotationPresent ( submoduleAnnotation ) ) { @ SuppressWarnings ( "deprecation" ) SubModule subModule = curr . getAnnotation ( SubModule . class ) ; if ( subModule != null ) { if ( modules == null ) { modules = new HashSet < > ( ) ; } modules . addAll ( Arrays . < Class < ? > > asList ( subModule . value ( ) ) ) ; } } } return modules ; |
public class VMath { /** * Set a submatrix .
* @ param m1 Input matrix
* @ param r Array of row indices .
* @ param c0 Initial column index
* @ param c1 Final column index ( exclusive )
* @ param m2 New values for m1 ( r ( : ) , c0 : c1-1) */
public static void setMatrix ( final double [ ] [ ] m1 , final int [ ] r , final int c0 , final int c1 , final double [ ] [ ] m2 ) { } } | assert c0 <= c1 : ERR_INVALID_RANGE ; assert c1 <= m1 [ 0 ] . length : ERR_MATRIX_DIMENSIONS ; for ( int i = 0 ; i < r . length ; i ++ ) { System . arraycopy ( m2 [ i ] , 0 , m1 [ r [ i ] ] , c0 , c1 - c0 ) ; } |
public class ParserUtils { /** * Returns a list of ColumnMetaData objects . This is for use with delimited
* files . The first line of the file which contains data will be used as the
* column names
* @ param line
* @ param delimiter
* @ param qualifier
* @ param p
* PZParser used to specify additional option when working with the ColumnMetaData . Can be null
* @ param addSuffixToDuplicateColumnNames
* @ return PZMetaData */
public static MetaData getPZMetaDataFromFile ( final String line , final char delimiter , final char qualifier , final Parser p , final boolean addSuffixToDuplicateColumnNames ) { } } | final List < ColumnMetaData > results = new ArrayList < > ( ) ; final Set < String > dupCheck = new HashSet < > ( ) ; final List < String > lineData = splitLine ( line , delimiter , qualifier , FPConstants . SPLITLINE_SIZE_INIT , false , false ) ; for ( final String colName : lineData ) { final ColumnMetaData cmd = new ColumnMetaData ( ) ; String colNameToUse = colName ; if ( dupCheck . contains ( colNameToUse ) ) { if ( ! addSuffixToDuplicateColumnNames ) { throw new FPException ( "Duplicate Column Name In File: " + colNameToUse ) ; } else { int count = 2 ; while ( dupCheck . contains ( colNameToUse + count ) ) { count ++ ; } colNameToUse = colName + count ; } } cmd . setColName ( colNameToUse ) ; results . add ( cmd ) ; dupCheck . add ( cmd . getColName ( ) ) ; } return new MetaData ( results , buidColumnIndexMap ( results , p ) ) ; |
public class Matrix3x2d { /** * Apply a translation to this matrix by translating by the given number of units in x and y and store the result
* in < code > dest < / code > .
* If < code > M < / code > is < code > this < / code > matrix and < code > T < / code > the translation
* matrix , then the new matrix will be < code > M * T < / code > . So when
* transforming a vector < code > v < / code > with the new matrix by using
* < code > M * T * v < / code > , the translation will be applied first !
* In order to set the matrix to a translation transformation without post - multiplying
* it , use { @ link # translation ( double , double ) } .
* @ see # translation ( double , double )
* @ param x
* the offset to translate in x
* @ param y
* the offset to translate in y
* @ param dest
* will hold the result
* @ return dest */
public Matrix3x2d translate ( double x , double y , Matrix3x2d dest ) { } } | double rm20 = x ; double rm21 = y ; dest . m20 = m00 * rm20 + m10 * rm21 + m20 ; dest . m21 = m01 * rm20 + m11 * rm21 + m21 ; dest . m00 = m00 ; dest . m01 = m01 ; dest . m10 = m10 ; dest . m11 = m11 ; return dest ; |
public class FirestoreClient { /** * Commits a transaction , while optionally updating documents .
* < p > Sample code :
* < pre > < code >
* try ( FirestoreClient firestoreClient = FirestoreClient . create ( ) ) {
* String formattedDatabase = DatabaseRootName . format ( " [ PROJECT ] " , " [ DATABASE ] " ) ;
* List & lt ; Write & gt ; writes = new ArrayList & lt ; & gt ; ( ) ;
* CommitResponse response = firestoreClient . commit ( formattedDatabase , writes ) ;
* < / code > < / pre >
* @ param database The database name . In the format :
* ` projects / { project _ id } / databases / { database _ id } ` .
* @ param writes The writes to apply .
* < p > Always executed atomically and in order .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final CommitResponse commit ( String database , List < Write > writes ) { } } | CommitRequest request = CommitRequest . newBuilder ( ) . setDatabase ( database ) . addAllWrites ( writes ) . build ( ) ; return commit ( request ) ; |
public class StanfordAgigaSentence { /** * / * ( non - Javadoc )
* @ see edu . jhu . hltcoe . sp . data . depparse . AgigaSentence # getStanfordContituencyTree ( ) */
public Tree getStanfordContituencyTree ( ) { } } | TreeFactory tf = new LabeledScoredTreeFactory ( ) ; StringReader r = new StringReader ( getParseText ( ) ) ; TreeReader tr = new PennTreeReader ( r , tf ) ; try { return tr . readTree ( ) ; } catch ( IOException e ) { throw new RuntimeException ( "Error: IOException should not be thrown by StringReader" ) ; } |
public class FileDeleteFromComputeNodeOptions { /** * Set the time the request was issued . Client libraries typically set this to the current system clock time ; set it explicitly if you are calling the REST API directly .
* @ param ocpDate the ocpDate value to set
* @ return the FileDeleteFromComputeNodeOptions object itself . */
public FileDeleteFromComputeNodeOptions withOcpDate ( DateTime ocpDate ) { } } | if ( ocpDate == null ) { this . ocpDate = null ; } else { this . ocpDate = new DateTimeRfc1123 ( ocpDate ) ; } return this ; |
public class WaitingWordsi { /** * Adds the context vector to the end of the list of context vectors
* associated with { @ code focusKey } . */
public void handleContextVector ( String focusKey , String secondaryKey , SparseDoubleVector context ) { } } | // Get the list of context vectors for the focus key .
List < SparseDoubleVector > termContexts = dataVectors . get ( focusKey ) ; if ( termContexts == null ) { synchronized ( this ) { termContexts = dataVectors . get ( focusKey ) ; if ( termContexts == null ) { termContexts = new ArrayList < SparseDoubleVector > ( ) ; dataVectors . put ( focusKey , termContexts ) ; } } } // Add the new context vector .
int contextId = 0 ; synchronized ( termContexts ) { contextId = termContexts . size ( ) ; termContexts . add ( context ) ; } // Record the association .
if ( reporter != null ) reporter . assignContextToKey ( focusKey , secondaryKey , contextId ) ; |
public class MPAlarmManager { /** * Create a new alarm .
* @ param delta The amount of time before the alarm should be fired , in ms
* @ param percentLate The percentage by which the alarm can be late
* @ param listener The alarm listener which is called when the alarm fires .
* @ param context A context object for the alarm
* @ return An Alarm object through which the alarm can be canceled */
public Alarm create ( long delta , int percentLate , AlarmListener listener , Object context ) throws SIErrorException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "create" , new Object [ ] { this , Long . valueOf ( delta ) , Integer . valueOf ( percentLate ) , listener , context } ) ; // calculate the target time for the new alarm
long time = System . currentTimeMillis ( ) + delta ; // Defect 516583 - catch and report the situation where an arithmetic overflow has occurred
if ( time < 0 ) { SIErrorException e = new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.utils.am.MPAlarmManager" , "1:269:1.28" } , null ) ) ; FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.utils.am.MPAlarmManager.create" , "1:274:1.28" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.utils.am.MPAlarmManager" , "1:280:1.28" } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "MPAlarmManager" , e ) ; throw e ; } // calculate the latest time the alarm can be fired
long latest = time + ( ( delta / 100 ) * percentLate ) ; // try to get an existing alarm object from the pool
MPAlarmImpl alarm = ( MPAlarmImpl ) _alarmPool . remove ( ) ; // if we were unable to get one from the pool
if ( alarm == null ) { // create a new one
alarm = new MPAlarmImpl ( time , latest , listener , context , index ++ ) ; } else { // reset the values on the alarm retrieved from the pool
alarm . reset ( time , latest , listener , context , index ++ ) ; } // take the pending alarms list lock
synchronized ( _pendingAlarmsLock ) { // start at the bottom of the list
// new alarms should generally come chronologically after existing ones
// the insertPoint is the entry before where we are going to put the new alarm
MPAlarmImpl insertPoint = ( MPAlarmImpl ) _pendingAlarms . getLast ( ) ; // if the list is empty
if ( insertPoint == null ) { // just put the new alarm in to the list
_pendingAlarms . put ( alarm ) ; } else // otherwise search for the correct place in the list
{ // if the current entry is after the time for the new alarm
if ( insertPoint . time ( ) > time ) { do { // go to the next entry up
insertPoint = insertPoint . previous ( ) ; } // until either we reach the top of the list or the current one is before the new one
while ( insertPoint != null && insertPoint . time ( ) > time ) ; } // if we did reach the top of the list
if ( insertPoint == null ) { // up the new alarm in at the top
_pendingAlarms . insertAtTop ( alarm ) ; } else // if we are somewhere in the middle of the list
{ // insert the new alarm after the one we just found
_pendingAlarms . insertAfter ( alarm , insertPoint ) ; } } // if the next alarm is MPAlarmThread . SUSPEND ( i . e . the alarm thread is suspended )
// or the time for the new alarm is before the time that the
// alarm thread is currently due to wake up
if ( _nextAlarm == MPAlarmThread . SUSPEND || time < _nextAlarm ) { // set the new target wakeup time
_nextAlarm = time ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { long now = System . currentTimeMillis ( ) ; SibTr . debug ( tc , "now " + now + "Alarm Start : " + listener + " - " + ( time - now ) + " (" + ( latest - now ) + ")" ) ; SibTr . debug ( tc , "" + _pendingAlarms ) ; } } // and wake up the the alarm thread with the new time
_alarmThread . requestNextWakeup ( _nextAlarm ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "create" , alarm ) ; // return the alarm reference
return alarm ; |
public class MultiImageForm { /** * Check to make sure the client hasn ' t exceeded the maximum allowed upload
* size inside of this validate method . */
public ActionErrors validate ( ActionMapping mapping , HttpServletRequest request ) { } } | ActionErrors errors = null ; // has the maximum length been exceeded ?
Boolean maxLengthExceeded = ( Boolean ) request . getAttribute ( MultipartRequestHandler . ATTRIBUTE_MAX_LENGTH_EXCEEDED ) ; if ( ( maxLengthExceeded != null ) && ( maxLengthExceeded . booleanValue ( ) ) ) { errors = new ActionErrors ( ) ; errors . add ( ERROR_PROPERTY_MAX_LENGTH_EXCEEDED , new ActionMessage ( "maxLengthExceeded" ) ) ; } else if ( fileMap . size ( ) > MAX_IMAGES_COUNT ) { errors = new ActionErrors ( ) ; errors . add ( ERROR_PROPERTY_MAX_LENGTH_EXCEEDED , new ActionMessage ( "maxLengthExceeded" ) ) ; } else { // retrieve the file name
Iterator iter = fileMap . values ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { FormFile file = ( FormFile ) iter . next ( ) ; String fileName = file . getFileName ( ) ; if ( ( ! fileName . toLowerCase ( ) . endsWith ( ".gif" ) ) && ! ( fileName . toLowerCase ( ) . endsWith ( ".jpg" ) ) && ! ( fileName . toLowerCase ( ) . endsWith ( ".png" ) ) ) { errors = new ActionErrors ( ) ; errors . add ( "notImage" , new ActionMessage ( "notImage" ) ) ; } } } return errors ; |
public class MMDCfgPanel { /** * GEN - LAST : event _ spinnerConnectorWidthStateChanged */
private void colorChooserConnectorColorActionPerformed ( java . awt . event . ActionEvent evt ) { } } | // GEN - FIRST : event _ colorChooserConnectorColorActionPerformed
if ( this . colorChooserConnectorColor . isLastOkPressed ( ) && changeNotificationAllowed ) { this . controller . changed ( ) ; } |
public class FileTree { /** * Return a filtered set of resources
* @ param path path
* @ param test predicate test , or null to match all
* @ return set of matching resources */
private Set < Resource < T > > filterResources ( Path path , Predicate < Resource > test ) { } } | validatePath ( path ) ; if ( ! hasDirectory ( path ) ) { throw StorageException . listException ( path , "not a directory path: " + path ) ; } File file = filepathMapper . directoryForPath ( path ) ; HashSet < Resource < T > > files = new HashSet < Resource < T > > ( ) ; try { for ( File file1 : file . listFiles ( ) ) { Resource < T > res = loadResource ( filepathMapper . pathForContentFile ( file1 ) , false ) ; if ( null == test || test . apply ( res ) ) { files . add ( res ) ; } } } catch ( IOException e ) { throw StorageException . listException ( path , "Failed to list directory: " + path + ": " + e . getMessage ( ) , e ) ; } return files ; |
public class SeekBarPreference { /** * Sets the symbol , which should be used to separate floating point numbers for textual
* representation .
* @ param floatingPointSeparator
* The symbol , which should be set , as an instance of the type { @ link CharSequence } or
* null , if the default symbol should be used . The length of the symbol must be 1 */
public final void setFloatingPointSeparator ( @ Nullable final CharSequence floatingPointSeparator ) { } } | if ( floatingPointSeparator != null ) { Condition . INSTANCE . ensureAtMaximum ( floatingPointSeparator . length ( ) , 1 , "The floating point separator's length must be 1" ) ; } this . floatingPointSeparator = floatingPointSeparator ; |
public class BSHAllocationExpression { /** * Fill boxed numeric types with default numbers instead of nulls .
* @ param arr the array to fill . */
private void arrayFillDefaultValue ( Object arr ) { } } | if ( null == arr ) return ; Class < ? > clas = arr . getClass ( ) ; Class < ? > comp = Types . arrayElementType ( clas ) ; if ( ! comp . isPrimitive ( ) ) if ( Types . arrayDimensions ( clas ) > 1 ) for ( int i = 0 ; i < Array . getLength ( arr ) ; i ++ ) arrayFillDefaultValue ( Array . get ( arr , i ) ) ; else Arrays . fill ( ( Object [ ] ) arr , Primitive . unwrap ( Primitive . getDefaultValue ( comp ) ) ) ; |
public class KEYConverter { /** * Builds a DNSKEY or KEY record from a PublicKey */
public static Record buildRecord ( Name name , int type , int dclass , long ttl , int flags , int proto , int alg , PublicKey key ) { } } | byte [ ] data ; if ( type != Type . KEY && type != Type . DNSKEY ) throw new IllegalArgumentException ( "type must be KEY " + "or DNSKEY" ) ; if ( key instanceof RSAPublicKey ) { data = buildRSA ( ( RSAPublicKey ) key ) ; } else if ( key instanceof DHPublicKey ) { data = buildDH ( ( DHPublicKey ) key ) ; } else if ( key instanceof DSAPublicKey ) { data = buildDSA ( ( DSAPublicKey ) key ) ; } else return null ; if ( data == null ) return null ; if ( type == Type . DNSKEY ) return new DNSKEYRecord ( name , dclass , ttl , flags , proto , alg , data ) ; else return new KEYRecord ( name , dclass , ttl , flags , proto , alg , data ) ; |
public class BookMgrImpl { /** * query */
public Book get ( int id , String name ) { } } | System . out . println ( "this is get(id, name)" ) ; if ( bookMap . containsKey ( id ) && bookMap . containsKey ( name ) ) { return bookMap . get ( id ) ; } return null ; |
public class Utils { /** * Throws a { @ link NullPointerException } if the argument is null . This method is similar to { @ code
* Preconditions . checkNotNull ( Object , Object ) } from Guava .
* @ param arg the argument to check for null .
* @ param errorMessage the message to use for the exception . Will be converted to a string using
* { @ link String # valueOf ( Object ) } .
* @ return the argument , if it passes the null check . */
public static < T /* > > > extends @ NonNull Object */
> T checkNotNull ( T arg , @ javax . annotation . Nullable Object errorMessage ) { } } | if ( arg == null ) { throw new NullPointerException ( String . valueOf ( errorMessage ) ) ; } return arg ; |
public class CmsEditSiteForm { /** * Returns the correct varaint of a resource name accoreding to locale . < p >
* @ param path where the considered resource is .
* @ param baseName of the resource
* @ return localized name of resource */
private String getAvailableLocalVariant ( String path , String baseName ) { } } | // First look for a bundle with the locale of the folder . .
try { CmsProperty propLoc = m_clonedCms . readPropertyObject ( path , CmsPropertyDefinition . PROPERTY_LOCALE , true ) ; if ( ! propLoc . isNullProperty ( ) ) { if ( m_clonedCms . existsResource ( path + baseName + "_" + propLoc . getValue ( ) ) ) { return baseName + "_" + propLoc . getValue ( ) ; } } } catch ( CmsException e ) { LOG . error ( "Can not read locale property" , e ) ; } // If no bundle was found with the locale of the folder , or the property was not set , search for other locales
A_CmsUI . get ( ) ; List < String > localVariations = CmsLocaleManager . getLocaleVariants ( baseName , UI . getCurrent ( ) . getLocale ( ) , false , true ) ; for ( String name : localVariations ) { if ( m_clonedCms . existsResource ( path + name ) ) { return name ; } } return null ; |
public class EvernoteUtil { /** * Create an ENML & lt ; en - media & gt ; tag for the specified Resource object . */
public static String createEnMediaTag ( Resource resource ) { } } | return "<en-media hash=\"" + bytesToHex ( resource . getData ( ) . getBodyHash ( ) ) + "\" type=\"" + resource . getMime ( ) + "\"/>" ; |
public class SuspiciousComparatorReturnValues { /** * implements the visitor to check to see what Const were returned from a comparator . If no Const were returned it can ' t determine anything , however if only
* Const were returned , it looks to see if negative positive and zero was returned . It also looks to see if a non zero value is returned unconditionally .
* While it is possible that later check is ok , it usually means something is wrong .
* @ param obj
* the currently parsed code block */
@ Override public void visitCode ( Code obj ) { } } | if ( getMethod ( ) . isSynthetic ( ) ) { return ; } String methodName = getMethodName ( ) ; String methodSig = getMethodSig ( ) ; if ( methodName . equals ( methodInfo . methodName ) && methodSig . endsWith ( methodInfo . signatureEnding ) && ( SignatureUtils . getNumParameters ( methodSig ) == methodInfo . argumentCount ) ) { stack . resetForMethodEntry ( this ) ; seenNegative = false ; seenPositive = false ; seenZero = false ; seenUnconditionalNonZero = false ; furthestBranchTarget = - 1 ; sawConstant = null ; try { super . visitCode ( obj ) ; if ( ! seenZero || seenUnconditionalNonZero || ( obj . getCode ( ) . length > 2 ) ) { boolean seenAll = seenNegative & seenPositive & seenZero ; if ( ! seenAll || seenUnconditionalNonZero ) { bugReporter . reportBug ( new BugInstance ( this , BugType . SCRV_SUSPICIOUS_COMPARATOR_RETURN_VALUES . name ( ) , seenAll ? LOW_PRIORITY : NORMAL_PRIORITY ) . addClass ( this ) . addMethod ( this ) . addSourceLine ( this , 0 ) ) ; } } } catch ( StopOpcodeParsingException e ) { // indeterminate
} } |
public class ReportExecutor { /** * End the application . */
private void endApplication ( @ Nullable Thread uncaughtExceptionThread , Throwable th ) { } } | final boolean letDefaultHandlerEndApplication = config . alsoReportToAndroidFramework ( ) ; final boolean handlingUncaughtException = uncaughtExceptionThread != null ; if ( handlingUncaughtException && letDefaultHandlerEndApplication && defaultExceptionHandler != null ) { // Let the system default handler do it ' s job and display the force close dialog .
if ( ACRA . DEV_LOGGING ) ACRA . log . d ( LOG_TAG , "Handing Exception on to default ExceptionHandler" ) ; defaultExceptionHandler . uncaughtException ( uncaughtExceptionThread , th ) ; } else { processFinisher . endApplication ( ) ; } |
public class BundleUtils { /** * Returns a list of all bundles with the given symbolic name .
* @ param bc bundle context
* @ param symbolicName bundle symbolic name
* @ return matching bundles . The list may be empty , but never null . */
public static List < Bundle > getBundles ( BundleContext bc , String symbolicName ) { } } | List < Bundle > bundles = new ArrayList < Bundle > ( ) ; for ( Bundle bundle : bc . getBundles ( ) ) { if ( bundle . getSymbolicName ( ) . equals ( symbolicName ) ) { bundles . add ( bundle ) ; } } return bundles ; |
public class Rc4Utils { /** * Generates a 128 - bit key ( 16 bytes ) randomly for RC4 encryption / decryption .
* @ return generated key bytes */
public static byte [ ] generateKey ( ) { } } | CipherKeyGenerator cipherKeyGenerator = new CipherKeyGenerator ( ) ; cipherKeyGenerator . init ( new KeyGenerationParameters ( new SecureRandom ( ) , 128 ) ) ; return cipherKeyGenerator . generateKey ( ) ; |
public class Base64 { /** * Decodes a BASE64 encoded string that is known to be resonably well formatted . The method is about twice as
* fast as { @ link # decode ( String ) } . The preconditions are : < br >
* + The array must have a line length of 76 chars OR no line separators at all ( one line ) . < br >
* + Line separator must be " \ r \ n " , as specified in RFC 2045
* + The array must not contain illegal characters within the encoded string < br >
* + The array CAN have illegal characters at the beginning and end , those will be dealt with appropriately . < br >
* @ param s The source string . Length 0 will return an empty array . < code > null < / code > will throw an exception .
* @ return The decoded array of bytes . May be of length 0. */
public final static byte [ ] decodeFast ( String s , boolean urlSafe ) { } } | // Check special case
int sLen = s . length ( ) ; if ( sLen == 0 ) { return new byte [ 0 ] ; } int sIx = 0 , eIx = sLen - 1 ; // Start and end index after trimming .
// Trim illegal chars from start
if ( ! urlSafe ) { while ( sIx < eIx && IA [ s . charAt ( sIx ) & 0xff ] < 0 ) { sIx ++ ; } } else { while ( sIx < eIx && IA_URL_SAFE [ s . charAt ( sIx ) & 0xff ] < 0 ) { sIx ++ ; } } // Trim illegal chars from end
if ( ! urlSafe ) { while ( eIx > 0 && IA [ s . charAt ( eIx ) & 0xff ] < 0 ) { eIx -- ; } } else { while ( eIx > 0 && IA_URL_SAFE [ s . charAt ( eIx ) & 0xff ] < 0 ) { eIx -- ; } } // get the padding count ( = ) ( 0 , 1 or 2)
int pad = s . charAt ( eIx ) == '=' ? ( s . charAt ( eIx - 1 ) == '=' ? 2 : 1 ) : 0 ; // Count ' = ' at end .
int cCnt = eIx - sIx + 1 ; // Content count including possible separators
int sepCnt = sLen > 76 ? ( s . charAt ( 76 ) == '\r' ? cCnt / 78 : 0 ) << 1 : 0 ; int len = ( ( cCnt - sepCnt ) * 6 >> 3 ) - pad ; // The number of decoded bytes
byte [ ] dArr = new byte [ len ] ; // Preallocate byte [ ] of exact length
// Decode all but the last 0 - 2 bytes .
int d = 0 ; for ( int cc = 0 , eLen = ( len / 3 ) * 3 ; d < eLen ; ) { // Assemble three bytes into an int from four " valid " characters .
int i ; if ( ! urlSafe ) { i = IA [ s . charAt ( sIx ++ ) ] << 18 | IA [ s . charAt ( sIx ++ ) ] << 12 | IA [ s . charAt ( sIx ++ ) ] << 6 | IA [ s . charAt ( sIx ++ ) ] ; } else { i = IA_URL_SAFE [ s . charAt ( sIx ++ ) ] << 18 | IA_URL_SAFE [ s . charAt ( sIx ++ ) ] << 12 | IA_URL_SAFE [ s . charAt ( sIx ++ ) ] << 6 | IA_URL_SAFE [ s . charAt ( sIx ++ ) ] ; } // Add the bytes
dArr [ d ++ ] = ( byte ) ( i >> 16 ) ; dArr [ d ++ ] = ( byte ) ( i >> 8 ) ; dArr [ d ++ ] = ( byte ) i ; // If line separator , jump over it .
if ( sepCnt > 0 && ++ cc == 19 ) { sIx += 2 ; cc = 0 ; } } if ( d < len ) { // Decode last 1-3 bytes ( incl ' = ' ) into 1-3 bytes
int i = 0 ; for ( int j = 0 ; sIx <= eIx - pad ; j ++ ) { if ( ! urlSafe ) { i |= IA [ s . charAt ( sIx ++ ) ] << ( 18 - j * 6 ) ; } else { i |= IA_URL_SAFE [ s . charAt ( sIx ++ ) ] << ( 18 - j * 6 ) ; } } for ( int r = 16 ; d < len ; r -= 8 ) { dArr [ d ++ ] = ( byte ) ( i >> r ) ; } } return dArr ; |
public class FormLayout { /** * Computes and returns the grid ' s origins .
* @ param container the layout container
* @ param totalSize the total size to assign
* @ param offset the offset from left or top margin
* @ param formSpecs the column or row specs , resp .
* @ param componentListsthe components list for each col / row
* @ param minMeasurethe measure used to determine min sizes
* @ param prefMeasurethe measure used to determine pre sizes
* @ param groupIndicesthe group specification
* @ return an int array with the origins */
private static int [ ] computeGridOrigins ( Container container , int totalSize , int offset , List formSpecs , List [ ] componentLists , int [ ] [ ] groupIndices , Measure minMeasure , Measure prefMeasure ) { } } | /* For each spec compute the minimum and preferred size that is
* the maximum of all component minimum and preferred sizes resp . */
int [ ] minSizes = maximumSizes ( container , formSpecs , componentLists , minMeasure , prefMeasure , minMeasure ) ; int [ ] prefSizes = maximumSizes ( container , formSpecs , componentLists , minMeasure , prefMeasure , prefMeasure ) ; int [ ] groupedMinSizes = groupedSizes ( groupIndices , minSizes ) ; int [ ] groupedPrefSizes = groupedSizes ( groupIndices , prefSizes ) ; int totalMinSize = sum ( groupedMinSizes ) ; int totalPrefSize = sum ( groupedPrefSizes ) ; int [ ] compressedSizes = compressedSizes ( formSpecs , totalSize , totalMinSize , totalPrefSize , groupedMinSizes , prefSizes ) ; int [ ] groupedSizes = groupedSizes ( groupIndices , compressedSizes ) ; int totalGroupedSize = sum ( groupedSizes ) ; int [ ] sizes = distributedSizes ( formSpecs , totalSize , totalGroupedSize , groupedSizes ) ; return computeOrigins ( sizes , offset ) ; |
public class JvmTypeReferenceBuilder { /** * Creates a new { @ link JvmTypeReference } pointing to the given class and containing the given type arguments .
* @ param type
* the type the reference shall point to .
* @ param typeArgs
* type arguments
* @ return the newly created { @ link JvmTypeReference } */
public JvmTypeReference typeRef ( JvmType type , JvmTypeReference ... typeArgs ) { } } | int typeParams = 0 ; if ( type instanceof JvmGenericType ) { typeParams = ( ( JvmGenericType ) type ) . getTypeParameters ( ) . size ( ) ; } if ( typeParams < typeArgs . length ) { throw new IllegalArgumentException ( "The type " + type . getIdentifier ( ) + " only declares " + typeParams + " type parameters. You passed " + typeArgs . length + "." ) ; } LightweightTypeReference reference = typeReferenceOwner . toPlainTypeReference ( type ) ; for ( JvmTypeReference jvmTypeReference : typeArgs ) { ( ( ParameterizedTypeReference ) reference ) . addTypeArgument ( typeReferenceOwner . toLightweightTypeReference ( jvmTypeReference ) ) ; } return reference . toJavaCompliantTypeReference ( ) ; |
public class Util { /** * Given a query result from a SPARQL query , check if the given variable has
* a value or not
* @ param resultRow the result from a SPARQL query
* @ param variableName the name of the variable to obtain
* @ return true if the variable has a value , false otherwise */
public static boolean isVariableSet ( QuerySolution resultRow , String variableName ) { } } | if ( resultRow != null ) { return resultRow . contains ( variableName ) ; } return false ; |
public class CountdownTimer { /** * @ param now Current unix time
* @ param timeUnit Time unit that current time is given in
* @ return Amount of time left on the timer , in the time unit that the timer was initialized with . If the timer
* never started to begin with , or if the timer has ended , then return a 0. */
public long getRemainingTime ( final long now , final TimeUnit timeUnit ) { } } | if ( intervalStartInNanos == - 1 ) { return 0 ; } final long remainingNanos = Math . max ( 0 , timeIntervalInNanos - ( timeUnit . toNanos ( now ) - intervalStartInNanos ) ) ; return TimeUnit . NANOSECONDS . convert ( remainingNanos , this . timeUnit ) ; |
public class PdfContentByte { /** * Generates an array of bezier curves to draw an arc .
* ( x1 , y1 ) and ( x2 , y2 ) are the corners of the enclosing rectangle .
* Angles , measured in degrees , start with 0 to the right ( the positive X
* axis ) and increase counter - clockwise . The arc extends from startAng
* to startAng + extent . I . e . startAng = 0 and extent = 180 yields an openside - down
* semi - circle .
* The resulting coordinates are of the form float [ ] { x1 , y1 , x2 , y2 , x3 , y3 , x4 , y4}
* such that the curve goes from ( x1 , y1 ) to ( x4 , y4 ) with ( x2 , y2 ) and
* ( x3 , y3 ) as their respective Bezier control points .
* Note : this code was taken from ReportLab ( www . reportlab . org ) , an excellent
* PDF generator for Python ( BSD license : http : / / www . reportlab . org / devfaq . html # 1.3 ) .
* @ param x1 a corner of the enclosing rectangle
* @ param y1 a corner of the enclosing rectangle
* @ param x2 a corner of the enclosing rectangle
* @ param y2 a corner of the enclosing rectangle
* @ param startAng starting angle in degrees
* @ param extent angle extent in degrees
* @ return a list of float [ ] with the bezier curves */
public static ArrayList bezierArc ( float x1 , float y1 , float x2 , float y2 , float startAng , float extent ) { } } | float tmp ; if ( x1 > x2 ) { tmp = x1 ; x1 = x2 ; x2 = tmp ; } if ( y2 > y1 ) { tmp = y1 ; y1 = y2 ; y2 = tmp ; } float fragAngle ; int Nfrag ; if ( Math . abs ( extent ) <= 90f ) { fragAngle = extent ; Nfrag = 1 ; } else { Nfrag = ( int ) ( Math . ceil ( Math . abs ( extent ) / 90f ) ) ; fragAngle = extent / Nfrag ; } float x_cen = ( x1 + x2 ) / 2f ; float y_cen = ( y1 + y2 ) / 2f ; float rx = ( x2 - x1 ) / 2f ; float ry = ( y2 - y1 ) / 2f ; float halfAng = ( float ) ( fragAngle * Math . PI / 360. ) ; float kappa = ( float ) ( Math . abs ( 4. / 3. * ( 1. - Math . cos ( halfAng ) ) / Math . sin ( halfAng ) ) ) ; ArrayList pointList = new ArrayList ( ) ; for ( int i = 0 ; i < Nfrag ; ++ i ) { float theta0 = ( float ) ( ( startAng + i * fragAngle ) * Math . PI / 180. ) ; float theta1 = ( float ) ( ( startAng + ( i + 1 ) * fragAngle ) * Math . PI / 180. ) ; float cos0 = ( float ) Math . cos ( theta0 ) ; float cos1 = ( float ) Math . cos ( theta1 ) ; float sin0 = ( float ) Math . sin ( theta0 ) ; float sin1 = ( float ) Math . sin ( theta1 ) ; if ( fragAngle > 0f ) { pointList . add ( new float [ ] { x_cen + rx * cos0 , y_cen - ry * sin0 , x_cen + rx * ( cos0 - kappa * sin0 ) , y_cen - ry * ( sin0 + kappa * cos0 ) , x_cen + rx * ( cos1 + kappa * sin1 ) , y_cen - ry * ( sin1 - kappa * cos1 ) , x_cen + rx * cos1 , y_cen - ry * sin1 } ) ; } else { pointList . add ( new float [ ] { x_cen + rx * cos0 , y_cen - ry * sin0 , x_cen + rx * ( cos0 + kappa * sin0 ) , y_cen - ry * ( sin0 - kappa * cos0 ) , x_cen + rx * ( cos1 - kappa * sin1 ) , y_cen - ry * ( sin1 + kappa * cos1 ) , x_cen + rx * cos1 , y_cen - ry * sin1 } ) ; } } return pointList ; |
public class ST_GeometryN { /** * Return Geometry number n from the given GeometryCollection .
* @ param geometry GeometryCollection
* @ param n Index of Geometry number n in [ 1 - N ]
* @ return Geometry number n or Null if parameter is null .
* @ throws SQLException */
public static Geometry getGeometryN ( Geometry geometry , Integer n ) throws SQLException { } } | if ( geometry == null ) { return null ; } if ( n >= 1 && n <= geometry . getNumGeometries ( ) ) { return geometry . getGeometryN ( n - 1 ) ; } else { throw new SQLException ( OUT_OF_BOUNDS_ERR_MESSAGE ) ; } |
public class FATHelper { /** * Reset the marks in all Liberty logs .
* @ param server The server for the logs to reset the marks .
* @ throws Exception If there was an error resetting the marks . */
public static void resetMarksInLogs ( LibertyServer server ) throws Exception { } } | server . setMarkToEndOfLog ( server . getDefaultLogFile ( ) ) ; server . setMarkToEndOfLog ( server . getMostRecentTraceFile ( ) ) ; |
public class Filter { /** * Check the number of parameters and throws an exception if needed .
* @ param params
* the parameters to check .
* @ param expected
* the expected number of parameters . */
public final void checkParams ( Object [ ] params , int expected ) { } } | if ( params == null || params . length != expected ) { throw new RuntimeException ( "Liquid error: wrong number of arguments (" + ( params == null ? 0 : params . length + 1 ) + " for " + ( expected + 1 ) + ")" ) ; } |
public class EnsureUniqueAssociation { /** * Removes ambiguous associations . Call { @ link # getMatches ( ) } to get the list of unambiguous
* matches .
* @ param matches List of candidate associations
* @ param sizeDst Number of ' dst ' features */
public void process ( FastQueue < AssociatedIndex > matches , int sizeDst ) { } } | // initialize data structures
if ( bestScores . length < sizeDst ) bestScores = new AssociatedIndex [ sizeDst ] ; for ( int i = 0 ; i < matches . size ; i ++ ) { AssociatedIndex match = matches . data [ i ] ; if ( bestScores [ match . dst ] == null || match . fitScore < bestScores [ match . dst ] . fitScore ) { bestScores [ match . dst ] = match ; } } // add the best unambiguous pairs back
unambiguous . reset ( ) ; for ( int i = 0 ; i < sizeDst ; i ++ ) { if ( bestScores [ i ] != null ) { unambiguous . add ( bestScores [ i ] ) ; // clean up so that you don ' t have a dangling reference
bestScores [ i ] = null ; } } |
public class NumberParser { /** * Parse a Float from a String without exceptions . If the String is not a Float then null is
* returned
* @ param str the String to parse
* @ return The Float represented by the String , or null if it could not be parsed . */
public static Float parseFloat ( final String str ) { } } | if ( null != str ) { try { return new Float ( Float . parseFloat ( str . trim ( ) ) ) ; } catch ( final Exception e ) { // : IGNORE :
} } return null ; |
public class SimpleMDAGNode { /** * Follows an outgoing _ transition from this node .
* @ param mdagDataArray the array of SimpleMDAGNodes containing this node
* @ param letter the char representation of the desired _ transition ' s label
* @ return the SimpleMDAGNode that is the target of the _ transition labeled with { @ code letter } ,
* or null if there is no such labeled _ transition from this node */
public SimpleMDAGNode transition ( SimpleMDAGNode [ ] mdagDataArray , char letter ) { } } | SimpleMDAGNode targetNode = null ; int offset = binarySearch ( mdagDataArray , letter ) ; if ( offset >= 0 ) { targetNode = mdagDataArray [ offset ] ; } return targetNode ; |
public class DescribeClusterTracksResult { /** * A list of maintenance tracks output by the < code > DescribeClusterTracks < / code > operation .
* @ param maintenanceTracks
* A list of maintenance tracks output by the < code > DescribeClusterTracks < / code > operation . */
public void setMaintenanceTracks ( java . util . Collection < MaintenanceTrack > maintenanceTracks ) { } } | if ( maintenanceTracks == null ) { this . maintenanceTracks = null ; return ; } this . maintenanceTracks = new com . amazonaws . internal . SdkInternalList < MaintenanceTrack > ( maintenanceTracks ) ; |
public class SchedulerUtility { /** * Convert a text in properties file format to DataMap that can be used by Quartz
* @ param textthe text in properties file format
* @ return a Map that can be used as JobDataMap by Quartz
* @ throws IOException if the text is not in proper properties file format */
public static Map < String , Object > convertTextToDataMap ( String text ) throws IOException { } } | Map < String , Object > dataMap = null ; Properties p = new Properties ( ) ; p . load ( new StringReader ( text ) ) ; dataMap = new HashMap < String , Object > ( ) ; for ( Entry < Object , Object > entry : p . entrySet ( ) ) { dataMap . put ( ( String ) entry . getKey ( ) , entry . getValue ( ) ) ; } return dataMap ; |
public class Proxy { /** * Marks this proxy object as being closed . */
protected void setClosed ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setClosed" ) ; closed = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setClosed" ) ; |
public class CmsConfigurationReader { /** * Parses the formatter change set . < p >
* @ param basePath the configuration base path
* @ param node the parent node
* @ param removeAllFormatters flag , indicating if all formatters that are not explicitly added should be removed
* @ return the formatter change set */
protected CmsFormatterChangeSet parseFormatterChangeSet ( String basePath , I_CmsXmlContentLocation node , boolean removeAllFormatters ) { } } | Set < String > addFormatters = parseAddFormatters ( node ) ; addFormatters . addAll ( readLocalFormatters ( node ) ) ; Set < String > removeFormatters = removeAllFormatters ? new HashSet < String > ( ) : parseRemoveFormatters ( node ) ; String siteRoot = null ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( basePath ) ) { siteRoot = OpenCms . getSiteManager ( ) . getSiteRoot ( basePath ) ; } CmsFormatterChangeSet result = new CmsFormatterChangeSet ( removeFormatters , addFormatters , siteRoot , removeAllFormatters ) ; return result ; |
public class CPInstancePersistenceImpl { /** * Clears the cache for the cp instance .
* The { @ link EntityCache } and { @ link FinderCache } are both cleared by this method . */
@ Override public void clearCache ( CPInstance cpInstance ) { } } | entityCache . removeResult ( CPInstanceModelImpl . ENTITY_CACHE_ENABLED , CPInstanceImpl . class , cpInstance . getPrimaryKey ( ) ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; clearUniqueFindersCache ( ( CPInstanceModelImpl ) cpInstance , true ) ; |
public class TypeUtils { /** * < p > Checks if the subject type may be implicitly cast to the target type
* following the Java generics rules . < / p >
* @ param type the subject type to be assigned to the target type
* @ param toType the target type
* @ param typeVarAssigns optional map of type variable assignments
* @ return { @ code true } if { @ code type } is assignable to { @ code toType } . */
private static boolean isAssignable ( final Type type , final Type toType , final Map < TypeVariable < ? > , Type > typeVarAssigns ) { } } | if ( toType == null || toType instanceof Class < ? > ) { return isAssignable ( type , ( Class < ? > ) toType ) ; } if ( toType instanceof ParameterizedType ) { return isAssignable ( type , ( ParameterizedType ) toType , typeVarAssigns ) ; } if ( toType instanceof GenericArrayType ) { return isAssignable ( type , ( GenericArrayType ) toType , typeVarAssigns ) ; } if ( toType instanceof WildcardType ) { return isAssignable ( type , ( WildcardType ) toType , typeVarAssigns ) ; } if ( toType instanceof TypeVariable < ? > ) { return isAssignable ( type , ( TypeVariable < ? > ) toType , typeVarAssigns ) ; } throw new IllegalStateException ( "found an unhandled type: " + toType ) ; |
public class AstNodeFactory { /** * Constructs an { @ link AstNode } with the given string name
* @ param name the name property of the node ; may not be null
* @ return the tree node */
public AstNode node ( String name ) { } } | CheckArg . isNotNull ( name , "name" ) ; AstNode node = new AstNode ( name ) ; node . setProperty ( JCR_PRIMARY_TYPE , NT_UNSTRUCTURED ) ; return node ; |
public class PersistenceController { /** * Get single conversations from store implementation as an Observable .
* @ return Observable returning single conversation from store . */
Observable < ChatConversationBase > getConversation ( @ NonNull String conversationId ) { } } | return Observable . create ( emitter -> storeFactory . execute ( new StoreTransaction < ChatStore > ( ) { @ Override protected void execute ( ChatStore store ) { store . open ( ) ; ChatConversationBase c = store . getConversation ( conversationId ) ; store . close ( ) ; emitter . onNext ( c ) ; emitter . onCompleted ( ) ; } } ) , Emitter . BackpressureMode . BUFFER ) ; |
public class SarlEnumerationBuilderImpl { /** * Add a modifier .
* @ param modifier the modifier to add . */
public void addModifier ( String modifier ) { } } | if ( ! Strings . isEmpty ( modifier ) ) { this . sarlEnumeration . getModifiers ( ) . add ( modifier ) ; } |
public class CmsLock { /** * Returns < code > true < / code > if this is an exclusive , temporary exclusive , or
* directly inherited lock , and the given user is the owner of this lock ,
* checking also the project of the lock . < p >
* @ param user the user to compare to the owner of this lock
* @ param project the project to compare to the project of this lock
* @ return < code > true < / code > if this is an exclusive , temporary exclusive , or
* directly inherited lock , and the given user is the owner of this lock */
public boolean isDirectlyOwnedInProjectBy ( CmsUser user , CmsProject project ) { } } | return ( isExclusive ( ) || isDirectlyInherited ( ) ) && isOwnedInProjectBy ( user , project ) ; |
public class OptionHandlerRegistry { /** * Registers the default handlers . */
private void initHandlers ( ) { } } | registerHandler ( Boolean . class , BooleanOptionHandler . class ) ; registerHandler ( boolean . class , BooleanOptionHandler . class ) ; registerHandler ( File . class , FileOptionHandler . class ) ; registerHandler ( URL . class , URLOptionHandler . class ) ; registerHandler ( URI . class , URIOptionHandler . class ) ; registerHandler ( Integer . class , IntOptionHandler . class ) ; registerHandler ( int . class , IntOptionHandler . class ) ; registerHandler ( Double . class , DoubleOptionHandler . class ) ; registerHandler ( double . class , DoubleOptionHandler . class ) ; registerHandler ( String . class , StringOptionHandler . class ) ; registerHandler ( Byte . class , ByteOptionHandler . class ) ; registerHandler ( byte . class , ByteOptionHandler . class ) ; registerHandler ( Character . class , CharOptionHandler . class ) ; registerHandler ( char . class , CharOptionHandler . class ) ; registerHandler ( Float . class , FloatOptionHandler . class ) ; registerHandler ( float . class , FloatOptionHandler . class ) ; registerHandler ( Long . class , LongOptionHandler . class ) ; registerHandler ( long . class , LongOptionHandler . class ) ; registerHandler ( Short . class , ShortOptionHandler . class ) ; registerHandler ( short . class , ShortOptionHandler . class ) ; registerHandler ( InetAddress . class , InetAddressOptionHandler . class ) ; registerHandler ( Pattern . class , PatternOptionHandler . class ) ; // enum is a special case
registerHandler ( Map . class , MapOptionHandler . class ) ; try { Class p = Class . forName ( "java.nio.file.Path" ) ; registerHandler ( p , PathOptionHandler . class ) ; } catch ( ClassNotFoundException e ) { // running in Java6 or earlier
} |
public class KriptonLibrary { /** * Method to invoke during application initialization .
* @ param contextValue
* the context value
* @ param executorService
* the executor service */
public static void init ( Context contextValue , ExecutorService service ) { } } | context = contextValue ; if ( service == null ) { executerService = Executors . newFixedThreadPool ( THREAD_POOL_SIZE_DEFAULT ) ; } else { executerService = service ; } |
public class StreamWriter { /** * Writes an iCalendar object to the data stream .
* @ param ical the iCalendar object to write
* @ throws IllegalArgumentException if the scribe class for a component or
* property object cannot be found ( only happens when an experimental
* property / component scribe is not registered with the
* { @ code registerScribe } method . )
* @ throws IOException if there ' s a problem writing to the data stream */
public void write ( ICalendar ical ) throws IOException { } } | Collection < Class < ? > > unregistered = findScribeless ( ical ) ; if ( ! unregistered . isEmpty ( ) ) { List < String > classNames = new ArrayList < String > ( unregistered . size ( ) ) ; for ( Class < ? > clazz : unregistered ) { classNames . add ( clazz . getName ( ) ) ; } throw Messages . INSTANCE . getIllegalArgumentException ( 13 , classNames ) ; } tzinfo = ical . getTimezoneInfo ( ) ; context = new WriteContext ( getTargetVersion ( ) , tzinfo , globalTimezone ) ; _write ( ical ) ; |
public class RuleCallImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case XtextPackage . RULE_CALL__RULE : return rule != null ; case XtextPackage . RULE_CALL__ARGUMENTS : return arguments != null && ! arguments . isEmpty ( ) ; case XtextPackage . RULE_CALL__EXPLICITLY_CALLED : return explicitlyCalled != EXPLICITLY_CALLED_EDEFAULT ; } return super . eIsSet ( featureID ) ; |
public class Html5WebSocket { /** * { @ inheritDoc } */
@ Override public void send ( @ Nonnull final ArrayBufferView data ) throws IllegalStateException { } } | checkConnected ( ) ; _webSocket . send ( data ) ; |
public class DbUtil { /** * Runs a SQL query that returns a single integer value .
* @ param stmt The < code > PreparedStatement < / code > to run .
* @ param def The default value to return if the query returns no results .
* @ return The value returned by the query , or < code > def < / code > if the
* query returns no results . It is assumed that the query
* returns a result set consisting of a single row and column , and
* that this value is an integer . Any additional rows or columns
* returned will be ignored .
* @ throws SQLException If an error occurs while attempting to communicate
* with the database . */
public static int queryInt ( PreparedStatement stmt , int def ) throws SQLException { } } | ResultSet rs = null ; try { rs = stmt . executeQuery ( ) ; if ( rs . next ( ) ) { int value = rs . getInt ( 1 ) ; if ( ! rs . wasNull ( ) ) { return value ; } } return def ; } finally { close ( rs ) ; } |
public class MethodUtils { /** * < p > Gets the annotation object with the given annotation type that is present on the given method
* or optionally on any equivalent method in super classes and interfaces . Returns null if the annotation
* type was not present . < / p >
* < p > Stops searching for an annotation once the first annotation of the specified type has been
* found . Additional annotations of the specified type will be silently ignored . < / p >
* @ param < A >
* the annotation type
* @ param method
* the { @ link Method } to query
* @ param annotationCls
* the { @ link Annotation } to check if is present on the method
* @ param searchSupers
* determines if a lookup in the entire inheritance hierarchy of the given class is performed
* if the annotation was not directly present
* @ param ignoreAccess
* determines if underlying method has to be accessible
* @ return the first matching annotation , or { @ code null } if not found
* @ throws IllegalArgumentException
* if the method or annotation are { @ code null }
* @ since 3.6 */
public static < A extends Annotation > A getAnnotation ( final Method method , final Class < A > annotationCls , final boolean searchSupers , final boolean ignoreAccess ) { } } | Validate . isTrue ( method != null , "The method must not be null" ) ; Validate . isTrue ( annotationCls != null , "The annotation class must not be null" ) ; if ( ! ignoreAccess && ! MemberUtils . isAccessible ( method ) ) { return null ; } A annotation = method . getAnnotation ( annotationCls ) ; if ( annotation == null && searchSupers ) { final Class < ? > mcls = method . getDeclaringClass ( ) ; final List < Class < ? > > classes = getAllSuperclassesAndInterfaces ( mcls ) ; for ( final Class < ? > acls : classes ) { Method equivalentMethod ; try { equivalentMethod = ( ignoreAccess ? acls . getDeclaredMethod ( method . getName ( ) , method . getParameterTypes ( ) ) : acls . getMethod ( method . getName ( ) , method . getParameterTypes ( ) ) ) ; } catch ( final NoSuchMethodException e ) { // if not found , just keep searching
continue ; } annotation = equivalentMethod . getAnnotation ( annotationCls ) ; if ( annotation != null ) { break ; } } } return annotation ; |
public class StringManager { /** * Get a string from the underlying resource bundle and format
* it with the given set of arguments .
* @ param key
* @ param args */
public String getString ( final String key , final Object ... args ) { } } | String value = getString ( key ) ; if ( value == null ) { value = key ; } MessageFormat mf = new MessageFormat ( value ) ; mf . setLocale ( locale ) ; return mf . format ( args , new StringBuffer ( ) , null ) . toString ( ) ; |
public class MultimapWithProtoValuesSubject { MultimapWithProtoValuesFluentAssertion < M > usingConfig ( FluentEqualityConfig newConfig ) { } } | Subject . Factory < MultimapWithMessageValuesSubject < K , M > , Multimap < K , M > > factory = multimapWithMessageValues ( newConfig ) ; MultimapWithMessageValuesSubject < K , M > newSubject = check ( ) . about ( factory ) . that ( actual ( ) ) ; if ( internalCustomName ( ) != null ) { newSubject = newSubject . named ( internalCustomName ( ) ) ; } return new MultimapWithProtoValuesFluentAssertionImpl < > ( newSubject ) ; |
public class FlipTableConverters { /** * Create a table from an array of objects using { @ link String # valueOf } . */
public static String fromObjects ( String [ ] headers , Object [ ] [ ] data ) { } } | if ( headers == null ) throw new NullPointerException ( "headers == null" ) ; if ( data == null ) throw new NullPointerException ( "data == null" ) ; List < String [ ] > stringData = new ArrayList < > ( ) ; for ( Object [ ] row : data ) { String [ ] stringRow = new String [ row . length ] ; for ( int column = 0 ; column < row . length ; column ++ ) { stringRow [ column ] = String . valueOf ( row [ column ] ) ; } stringData . add ( stringRow ) ; } String [ ] [ ] dataArray = stringData . toArray ( new String [ stringData . size ( ) ] [ ] ) ; return FlipTable . of ( headers , dataArray ) ; |
public class DoubleTuples { /** * Creates a new array from the contents of the given tuple
* @ param t The tuple
* @ return The array */
public static double [ ] toArray ( DoubleTuple t ) { } } | int d = t . getSize ( ) ; double result [ ] = new double [ d ] ; for ( int i = 0 ; i < d ; i ++ ) { result [ i ] = t . get ( i ) ; } return result ; |
public class Setting { /** * Creates a setting of a custom defined field .
* @ param description the title of this setting
* @ param field custom Field object from FormsFX
* @ param property to be bound , saved / loaded and used for undo / redo
* @ return the constructed setting */
public static < F extends Field < F > , P extends Property > Setting of ( String description , F field , P property ) { } } | return new Setting < > ( description , field . label ( description ) , property ) ; |
public class RebalanceUtils { /** * Verify store definitions are congruent with cluster definition .
* @ param cluster
* @ param storeDefs */
public static void validateClusterStores ( final Cluster cluster , final List < StoreDefinition > storeDefs ) { } } | // Constructing a StoreRoutingPlan has the ( desirable in this
// case ) side - effect of verifying that the store definition is congruent
// with the cluster definition . If there are issues , exceptions are
// thrown .
for ( StoreDefinition storeDefinition : storeDefs ) { new StoreRoutingPlan ( cluster , storeDefinition ) ; } return ; |
public class AuditLogUsedEvent { /** * Adds the Active Participant of the User or System that accessed the log
* @ param userId The Active Participant ' s User ID
* @ param altUserId The Active Participant ' s Alternate UserID
* @ param userName The Active Participant ' s UserName
* @ param networkId The Active Participant ' s Network Access Point ID */
public void addAccessingParticipant ( String userId , String altUserId , String userName , String networkId ) { } } | addActiveParticipant ( userId , altUserId , userName , true , null , networkId ) ; |
public class DirectedGraphAdaptor { /** * { @ inheritDoc } */
public int outDegree ( int vertex ) { } } | int degree = 0 ; Set < T > edges = getAdjacencyList ( vertex ) ; for ( T e : edges ) { if ( e . from ( ) == vertex ) degree ++ ; } return degree ; |
public class AbstractJobLauncher { /** * Staging data cannot be cleaned if exactly once semantics is used , and the job has unfinished
* commit sequences . */
private boolean canCleanStagingData ( JobState jobState ) throws IOException { } } | return this . jobContext . getSemantics ( ) != DeliverySemantics . EXACTLY_ONCE || ! this . jobContext . getCommitSequenceStore ( ) . get ( ) . exists ( jobState . getJobName ( ) ) ; |
public class DBIFactory { /** * Build a fully configured DBI instance managed by the DropWizard lifecycle
* with the configured health check ; this method should not be overridden
* ( instead , override { @ link # configure ( DBI , PooledDataSourceFactory ) } and / or
* { @ link # newInstance ( ManagedDataSource ) } )
* @ param environment
* @ param configuration
* @ param dataSource
* @ param name
* @ return A fully configured { @ link DBI } object */
public DBI build ( Environment environment , PooledDataSourceFactory configuration , ManagedDataSource dataSource , String name ) { } } | // Create the instance
final DBI dbi = this . newInstance ( dataSource ) ; // Manage the data source that created this instance .
environment . lifecycle ( ) . manage ( dataSource ) ; // Setup the required health checks .
final Optional < String > validationQuery = configuration . getValidationQuery ( ) ; environment . healthChecks ( ) . register ( name , new DBIHealthCheck ( environment . getHealthCheckExecutorService ( ) , configuration . getValidationQueryTimeout ( ) . orElseGet ( ( ) -> Duration . seconds ( 5 ) ) , dbi , validationQuery ) ) ; // Setup logging .
dbi . setSQLLog ( new LogbackLog ( LOGGER , Level . TRACE ) ) ; // Setup the timing collector
dbi . setTimingCollector ( new InstrumentedTimingCollector ( environment . metrics ( ) , new SanerNamingStrategy ( ) ) ) ; if ( configuration . isAutoCommentsEnabled ( ) ) { dbi . setStatementRewriter ( new NamePrependingStatementRewriter ( new ColonPrefixNamedParamStatementRewriter ( ) ) ) ; } // Add the default argument and column mapper factories .
this . configure ( dbi , configuration ) ; return dbi ; |
public class EncoderUtil { /** * Encodes the specified text into an encoded word or a sequence of encoded
* words separated by space . The text is separated into a sequence of encoded
* words if it does not fit in a single one .
* @ param text
* text to encode .
* @ param usage
* whether the encoded - word is to be used to replace a text token or
* a word entity ( see RFC 822 ) .
* @ param usedCharacters
* number of characters already used up (
* < code > 0 < = usedCharacters < = 50 < / code > ) .
* @ param charset
* the Java charset that should be used to encode the specified
* string into a byte array . A suitable charset is detected
* automatically if this parameter is < code > null < / code > .
* @ param encoding
* the encoding to use for the encoded - word ( either B or Q ) . A
* suitable encoding is automatically chosen if this parameter is
* < code > null < / code > .
* @ return the encoded word ( or sequence of encoded words if the given text
* does not fit in a single encoded word ) .
* @ see # hasToBeEncoded ( String , int ) */
public static String encodeEncodedWord ( String text , Usage usage , int usedCharacters , Charset charset , Encoding encoding ) { } } | if ( text == null ) throw new IllegalArgumentException ( ) ; if ( usedCharacters < 0 || usedCharacters > MAX_USED_CHARACTERS ) throw new IllegalArgumentException ( ) ; if ( charset == null ) charset = determineCharset ( text ) ; String mimeCharset = charset . name ( ) ; // no canonical names needed
if ( mimeCharset == null ) { // cannot happen if charset was originally null
throw new IllegalArgumentException ( "Unsupported charset" ) ; } byte [ ] bytes = encode ( text , charset ) ; if ( encoding == null ) encoding = determineEncoding ( bytes , usage ) ; if ( encoding == Encoding . B ) { String prefix = ENC_WORD_PREFIX + mimeCharset + "?B?" ; return encodeB ( prefix , text , usedCharacters , charset , bytes ) ; } else { String prefix = ENC_WORD_PREFIX + mimeCharset + "?Q?" ; return encodeQ ( prefix , text , usage , usedCharacters , charset , bytes ) ; } |
public class CreateKeyRequest { /** * One or more tags . Each tag consists of a tag key and a tag value . Tag keys and tag values are both required , but
* tag values can be empty ( null ) strings .
* Use this parameter to tag the CMK when it is created . Alternately , you can omit this parameter and instead tag
* the CMK after it is created using < a > TagResource < / a > .
* @ param tags
* One or more tags . Each tag consists of a tag key and a tag value . Tag keys and tag values are both
* required , but tag values can be empty ( null ) strings . < / p >
* Use this parameter to tag the CMK when it is created . Alternately , you can omit this parameter and instead
* tag the CMK after it is created using < a > TagResource < / a > . */
public void setTags ( java . util . Collection < Tag > tags ) { } } | if ( tags == null ) { this . tags = null ; return ; } this . tags = new com . ibm . cloud . objectstorage . internal . SdkInternalList < Tag > ( tags ) ; |
public class IntLongDenseVector { /** * Updates this vector to be the entrywise product ( i . e . Hadamard product ) of this vector with the other . */
public void product ( IntLongVector other ) { } } | // TODO : Add special case for IntLongDenseVector .
for ( int i = 0 ; i < idxAfterLast ; i ++ ) { elements [ i ] *= other . get ( i ) ; } |
public class LdapTemplate { /** * { @ inheritDoc } */
@ Override public < T > List < T > search ( String base , String filter , SearchControls controls , AttributesMapper < T > mapper , DirContextProcessor processor ) { } } | AttributesMapperCallbackHandler < T > handler = new AttributesMapperCallbackHandler < T > ( mapper ) ; search ( base , filter , controls , handler , processor ) ; return handler . getList ( ) ; |
public class AmazonEC2Waiters { /** * Builds a VolumeAvailable waiter by using custom parameters waiterParameters and other parameters defined in the
* waiters specification , and then polls until it determines whether the resource entered the desired state or not ,
* where polling criteria is bound by either default polling strategy or custom polling strategy . */
public Waiter < DescribeVolumesRequest > volumeAvailable ( ) { } } | return new WaiterBuilder < DescribeVolumesRequest , DescribeVolumesResult > ( ) . withSdkFunction ( new DescribeVolumesFunction ( client ) ) . withAcceptors ( new VolumeAvailable . IsAvailableMatcher ( ) , new VolumeAvailable . IsDeletedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; |
public class InternalContext { /** * Create a peer - context used by include / import .
* Only share locals and out
* @ param template template
* @ param indexers indexers
* @ param varSize var size
* @ param rootParams root params
* @ return a new peer context */
public InternalContext createPeerContext ( Template template , VariantIndexer [ ] indexers , int varSize , Vars rootParams ) { } } | InternalContext newContext = new InternalContext ( template , this . out , rootParams , indexers , varSize , null ) ; newContext . localContext = this ; return newContext ; |
public class ClientSessionManager { /** * Kills the client session manager .
* @ return A completable future to be completed once the session manager is killed . */
public CompletableFuture < Void > kill ( ) { } } | return CompletableFuture . runAsync ( ( ) -> { if ( keepAlive != null ) keepAlive . cancel ( ) ; state . setState ( Session . State . CLOSED ) ; } , context . executor ( ) ) ; |
public class GoogleDefaultChannelBuilder { /** * " Overrides " the static method in { @ link ManagedChannelBuilder } . */
public static GoogleDefaultChannelBuilder forAddress ( String name , int port ) { } } | return forTarget ( GrpcUtil . authorityFromHostAndPort ( name , port ) ) ; |
public class PinViewBaseHelper { /** * Set results in current { @ link PinView } , considering the number of character PinBoxes and each PinBox .
* @ param pinResults saved results to set */
void setPinResults ( String pinResults ) { } } | for ( int i = 0 ; i < mNumberPinBoxes ; i ++ ) { if ( pinResults != null ) { int start = i * mNumberCharacters ; String valuePinBox = pinResults . substring ( start , start + mNumberCharacters ) ; if ( ! valuePinBox . trim ( ) . isEmpty ( ) ) { getPinBox ( i ) . setText ( valuePinBox ) ; } else { break ; } } } |
public class Packer { /** * Sets the usage of Hash - MAC for authentication ( default no )
* @ param hMacAlg
* HMAC algorithm ( HmacSHA1 , HmacSHA256 , . . . )
* @ param passphrase
* shared secret
* @ return
* @ throws NoSuchAlgorithmException
* @ throws InvalidKeyException
* @ see { @ link javax . crypto . Mac # getInstance ( String ) }
* @ see < a
* href = " http : / / docs . oracle . com / javase / 6 / docs / technotes / guides / security / SunProviders . html # SunJCEProvider " > JCE
* Provider < / a > */
public Packer useHMAC ( final String hMacAlg , final String passphrase ) throws NoSuchAlgorithmException , InvalidKeyException { } } | hMac = Mac . getInstance ( hMacAlg ) ; // " HmacSHA256"
hMac . init ( new SecretKeySpec ( passphrase . getBytes ( charsetUTF8 ) , hMacAlg ) ) ; return this ; |
public class JVMId { /** * Compare TaskInProgressIds by first jobIds , then by tip numbers . Reduces are
* defined as greater then maps . */
@ Override public int compareTo ( org . apache . hadoop . mapreduce . ID o ) { } } | JVMId that = ( JVMId ) o ; int jobComp = this . jobId . compareTo ( that . jobId ) ; if ( jobComp == 0 ) { if ( this . isMap == that . isMap ) { return this . id - that . id ; } else { return this . isMap ? - 1 : 1 ; } } else { return jobComp ; } |
public class BatchListIncomingTypedLinksResponse { /** * Returns one or more typed link specifiers as output .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setLinkSpecifiers ( java . util . Collection ) } or { @ link # withLinkSpecifiers ( java . util . Collection ) } if you want
* to override the existing values .
* @ param linkSpecifiers
* Returns one or more typed link specifiers as output .
* @ return Returns a reference to this object so that method calls can be chained together . */
public BatchListIncomingTypedLinksResponse withLinkSpecifiers ( TypedLinkSpecifier ... linkSpecifiers ) { } } | if ( this . linkSpecifiers == null ) { setLinkSpecifiers ( new java . util . ArrayList < TypedLinkSpecifier > ( linkSpecifiers . length ) ) ; } for ( TypedLinkSpecifier ele : linkSpecifiers ) { this . linkSpecifiers . add ( ele ) ; } return this ; |
public class BufferingXmlWriter { /** * Low - level ( pass - through ) methods */
@ Override public void close ( boolean forceRealClose ) throws IOException { } } | flush ( ) ; mTextWriter = null ; mAttrValueWriter = null ; // Buffers to free ?
char [ ] buf = mOutputBuffer ; if ( buf != null ) { mOutputBuffer = null ; mConfig . freeFullCBuffer ( buf ) ; } // Plus may need to close the actual writer
if ( forceRealClose || mAutoCloseOutput ) { /* 14 - Nov - 2008 , TSa : To resolve [ WSTX - 163 ] , need to have a way
* to force UTF8Writer to close the underlying stream . . . */
if ( mOut instanceof CompletelyCloseable ) { ( ( CompletelyCloseable ) mOut ) . closeCompletely ( ) ; } else { mOut . close ( ) ; } } |
public class PrepareRequestInterceptor { /** * Method to construct the IPS URI
* @ param action
* the entity name
* @ param context
* the context
* @ return the IPS URI
* @ throws FMSException
* the FMSException */
private String prepareIPSUri ( String action , Context context ) throws FMSException { } } | StringBuilder uri = new StringBuilder ( ) ; uri . append ( Config . getProperty ( Config . BASE_URL_PLATFORMSERVICE ) ) . append ( "/" ) . append ( context . getAppDBID ( ) ) . append ( "?act=" ) . append ( action ) . append ( "&token=" ) . append ( context . getAppToken ( ) ) ; return uri . toString ( ) ; |
public class FactionWarfareApi { /** * List of the top corporations in faction warfare ( asynchronously ) Top 10
* leaderboard of corporations for kills and victory points separated by
* total , last week and yesterday - - - This route expires daily at 11:05
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param ifNoneMatch
* ETag from a previous request . A 304 will be returned if this
* matches the current ETag ( optional )
* @ param callback
* The callback to be executed when the API call finishes
* @ return The request call
* @ throws ApiException
* If fail to process the API call , e . g . serializing the request
* body object */
public com . squareup . okhttp . Call getFwLeaderboardsCorporationsAsync ( String datasource , String ifNoneMatch , final ApiCallback < FactionWarfareLeaderboardCorporationsResponse > callback ) throws ApiException { } } | com . squareup . okhttp . Call call = getFwLeaderboardsCorporationsValidateBeforeCall ( datasource , ifNoneMatch , callback ) ; Type localVarReturnType = new TypeToken < FactionWarfareLeaderboardCorporationsResponse > ( ) { } . getType ( ) ; apiClient . executeAsync ( call , localVarReturnType , callback ) ; return call ; |
public class SparseHashDoubleVector { /** * { @ inheritDoc } */
public int [ ] getNonZeroIndices ( ) { } } | if ( nonZeroIndices == null ) { nonZeroIndices = vector . keys ( ) ; Arrays . sort ( nonZeroIndices ) ; } return nonZeroIndices ; |
public class ComposableBody { /** * { @ inheritDoc } */
public String toXML ( ) { } } | String comp = computed . get ( ) ; if ( comp == null ) { comp = computeXML ( ) ; computed . set ( comp ) ; } return comp ; |
public class AbstractSpecWithPrimaryKey { /** * Sets the primary key with the specified hash - only key name and value . */
public AbstractSpecWithPrimaryKey < T > withPrimaryKey ( String hashKeyName , Object hashKeyValue ) { } } | if ( hashKeyName == null ) throw new IllegalArgumentException ( ) ; withPrimaryKey ( new PrimaryKey ( hashKeyName , hashKeyValue ) ) ; return this ; |
public class XmlCharacters { /** * Determine if the supplied name is a valid XML Name .
* @ param name the string being checked
* @ return true if the supplied name is indeed a valid XML Name , or false otherwise */
public static boolean isValidName ( String name ) { } } | if ( name == null || name . length ( ) == 0 ) return false ; CharacterIterator iter = new StringCharacterIterator ( name ) ; char c = iter . first ( ) ; if ( ! isValidNameStart ( c ) ) return false ; while ( c != CharacterIterator . DONE ) { if ( ! isValidName ( c ) ) return false ; c = iter . next ( ) ; } return true ; |
public class DefaultNamingStrategy { @ Override public String getColumnName ( Facet facet ) { } } | Column column = facet . getAnnotation ( Column . class ) ; return column == null ? underscoreSeparated ( facet . getName ( ) ) : column . value ( ) ; |
public class V1OperationsModel { /** * { @ inheritDoc } */
@ Override public OperationsModel addOperation ( OperationModel operation ) { } } | addChildModel ( operation ) ; _operations . add ( operation ) ; return this ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.