signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class AbstractCipherExecutor { /** * Sets signing key . If the key provided is resolved as a private key , * then will create use the private key as is , and will sign values * using RSA . Otherwise , AES is used . * @ param signingSecretKey the signing secret key */ protected void configureSigningKey ( final String signingSecretKey ) { } }
try { if ( ResourceUtils . doesResourceExist ( signingSecretKey ) ) { configureSigningKeyFromPrivateKeyResource ( signingSecretKey ) ; } } finally { if ( this . signingKey == null ) { setSigningKey ( new AesKey ( signingSecretKey . getBytes ( StandardCharsets . UTF_8 ) ) ) ; LOGGER . trace ( "Created signing key instance [{}] based on provided secret key" , this . signingKey . getClass ( ) . getSimpleName ( ) ) ; } }
public class WriteResult { /** * Get the saved ID . This may be useful for finding out the ID that was generated by MongoDB if no ID was supplied . * @ return The saved ID * @ throws MongoException If no objects were saved */ public K getSavedId ( ) { } }
if ( dbObjects . length == 0 ) { throw new MongoException ( "No objects to return" ) ; } if ( dbObjects [ 0 ] instanceof JacksonDBObject ) { throw new UnsupportedOperationException ( "Generated _id retrieval not supported when using stream serialization" ) ; } return jacksonDBCollection . convertFromDbId ( dbObjects [ 0 ] . get ( "_id" ) ) ;
public class WireTapOut { /** * / * ( non - Javadoc ) * @ see org . apache . cxf . interceptor . Interceptor # handleMessage ( org . apache . cxf . message . Message ) */ @ Override public void handleMessage ( final Message message ) throws Fault { } }
OutputStream os = message . getContent ( OutputStream . class ) ; if ( null == os ) { String encoding = ( String ) message . get ( Message . ENCODING ) ; if ( encoding == null ) { encoding = "UTF-8" ; } final Writer writer = message . getContent ( Writer . class ) ; if ( null != writer ) { os = new WriterOutputStream ( writer , encoding ) ; message . setContent ( Writer . class , null ) ; } } if ( null != os ) { final CacheAndWriteTapOutputStream newOut = new CacheAndWriteTapOutputStream ( os ) ; message . setContent ( OutputStream . class , newOut ) ; if ( WireTapHelper . isMessageContentToBeLogged ( message , logMessageContent , logMessageContentOverride ) ) { message . setContent ( CachedOutputStream . class , newOut ) ; } else { try { final CachedOutputStream cos = new CachedOutputStream ( ) ; cos . write ( WireTapHelper . CONTENT_LOGGING_IS_DISABLED . getBytes ( Charset . forName ( "UTF-8" ) ) ) ; message . setContent ( CachedOutputStream . class , cos ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } if ( wireTap != null ) { newOut . registerCallback ( new CallBack ( message ) ) ; } }
public class BindingHelper { /** * Associates programmatically a view with a variant . * @ param view any existing view . * @ return the previous variant for this view , if any . */ @ Nullable public static String setVariantForView ( @ NonNull View view , @ Nullable String variant ) { } }
String previousVariant = null ; String previousAttribute = null ; for ( Map . Entry < String , HashMap < Integer , String > > entry : bindings . entrySet ( ) ) { if ( entry . getValue ( ) . containsKey ( view . getId ( ) ) ) { previousVariant = entry . getKey ( ) ; previousAttribute = entry . getValue ( ) . get ( view . getId ( ) ) ; bindings . remove ( previousVariant ) ; break ; } } mapAttribute ( previousAttribute , view . getId ( ) , variant , view . getClass ( ) . getSimpleName ( ) ) ; return previousVariant ;
public class Node { /** * Returns a < code > List < / code > of the nodes children . * @ return the nodes children */ public List children ( ) { } }
if ( value == null ) { return new NodeList ( ) ; } if ( value instanceof List ) { return ( List ) value ; } // we ' re probably just a String List result = new NodeList ( ) ; result . add ( value ) ; return result ;
public class ComponentRenderable { /** * ComponentRenderer */ @ Override public void render ( Graphic g , Handlables featurables ) { } }
for ( final Renderable renderable : featurables . get ( Renderable . class ) ) { renderable . render ( g ) ; }
public class RecurrenceUtility { /** * Convert Day instance to MPX day index . * @ param day Day instance * @ return day index */ public static Integer getDay ( Day day ) { } }
Integer result = null ; if ( day != null ) { result = DAY_MAP . get ( day ) ; } return ( result ) ;
public class ActionFormMapper { protected boolean handleJsonBody ( ActionRuntime runtime , VirtualForm virtualForm ) { } }
final ActionFormMeta formMeta = virtualForm . getFormMeta ( ) ; if ( formMeta . isJsonBodyMapping ( ) ) { if ( formMeta . isRootSymbolForm ( ) ) { mappingJsonBody ( runtime , virtualForm , prepareJsonFromRequestBody ( virtualForm ) ) ; } else if ( formMeta . isTypedListForm ( ) ) { mappingListJsonBody ( runtime , virtualForm , prepareJsonFromRequestBody ( virtualForm ) ) ; } // basically no way here ( but no exception just in case ) } return false ;
public class CurationManager { /** * This method encapsulates the logic for curation in ReDBox * @ param oid * The object ID being curated * @ throws TransactionException * @ returns JsonSimple The response object to send back to the queue * consumer */ private JsonSimple curation ( JsonSimple message , String task , String oid ) throws TransactionException { } }
JsonSimple response = new JsonSimple ( ) ; // Collect object data // Transformer config JsonSimple itemConfig = getConfigFromStorage ( oid ) ; if ( itemConfig == null ) { log . error ( "Error accessing item configuration!" ) ; return new JsonSimple ( ) ; } // Object properties Properties metadata = getObjectMetadata ( oid ) ; if ( metadata == null ) { log . error ( "Error accessing item metadata!" ) ; return new JsonSimple ( ) ; } // Object metadata JsonSimple data = getDataFromStorage ( oid ) ; if ( data == null ) { log . error ( "Error accessing item data!" ) ; return new JsonSimple ( ) ; } // Validate what we can see // Check object state boolean curated = false ; boolean alreadyCurated = itemConfig . getBoolean ( false , "curation" , "alreadyCurated" ) ; boolean errors = false ; // Can we already see this PID ? String thisPid = null ; if ( metadata . containsKey ( pidProperty ) ) { curated = true ; thisPid = metadata . getProperty ( pidProperty ) ; // Or does it claim to have one from pre - ingest curation ? } else { if ( alreadyCurated ) { // Make sure we can actually see an ID String id = data . getString ( null , "metadata" , "dc.identifier" ) ; if ( id == null ) { log . error ( "Item claims to be curated, but has no" + " 'dc.identifier': '{}'" , oid ) ; errors = true ; // Let ' s fix this so it doesn ' t show up again } else { try { log . info ( "Update object properties with ingested" + " ID: '{}'" , oid ) ; // Metadata writes can be awkward . . . thankfully this is // code that should only ever execute once per object . DigitalObject object = storage . getObject ( oid ) ; metadata = object . getMetadata ( ) ; metadata . setProperty ( pidProperty , id ) ; storeProperties ( object , metadata ) ; metadata = getObjectMetadata ( oid ) ; curated = true ; audit ( response , oid , "Persitent ID set in properties" ) ; } catch ( StorageException ex ) { log . error ( "Error accessing object '{}' in storage: " , oid , ex ) ; errors = true ; } } } } // Decision making // Errors have occurred , email someone and do nothing if ( errors ) { emailObjectLink ( response , oid , "An error occurred curating this object, some" + " manual intervention may be required; please see" + " the system logs." ) ; audit ( response , oid , "Errors during curation; aborted." ) ; return response ; } // What should happen per task if we have already been curated ? if ( curated ) { // Happy ending if ( task . equals ( "curation-response" ) ) { log . info ( "Confirmation of curated object '{}'." , oid ) ; // Send out upstream responses to objects waiting JSONArray responses = data . writeArray ( "responses" ) ; for ( Object thisResponse : responses ) { JsonSimple json = new JsonSimple ( ( JsonObject ) thisResponse ) ; String broker = json . getString ( brokerUrl , "broker" ) ; String responseOid = json . getString ( null , "oid" ) ; String responseTask = json . getString ( null , "task" ) ; JsonObject responseObj = createTask ( response , broker , responseOid , responseTask ) ; // Don ' t forget to tell them where it came from responseObj . put ( "originOid" , oid ) ; responseObj . put ( "curatedPid" , thisPid ) ; } // We ' ve responded so let ' s clear the response list for next time responses . clear ( ) ; saveObjectData ( data , oid ) ; // Set a flag to let publish events that may come in later // that this is ready to publish ( if not already set ) if ( ! metadata . containsKey ( READY_PROPERTY ) ) { try { DigitalObject object = storage . getObject ( oid ) ; metadata = object . getMetadata ( ) ; metadata . setProperty ( READY_PROPERTY , "ready" ) ; storeProperties ( object , metadata ) ; metadata = getObjectMetadata ( oid ) ; audit ( response , oid , "This object is ready for publication" ) ; } catch ( StorageException ex ) { log . error ( "Error accessing object '{}' in storage: " , oid , ex ) ; emailObjectLink ( response , oid , "This object is ready for publication, but an" + " error occured writing to storage. Please" + " see the system log" ) ; } // Since the flag hasn ' t been set we also know this is the // first time through , so generate some notifications emailObjectLink ( response , oid , "This email is confirming that the object linked" + " below has completed curation." ) ; audit ( response , oid , "Curation completed." ) ; // Schedule a followup to re - index and transform createTask ( response , oid , "reharvest" ) ; createTask ( response , oid , "publish" ) ; // This object was asked to curate again , so there may be // new ' children ' who do need to publish , and external // updates required ( like VITAL ) } else { createTask ( response , oid , "publish" ) ; } return response ; } // A response has come back from downstream if ( task . equals ( "curation-pending" ) ) { String childOid = message . getString ( null , "originOid" ) ; String childId = message . getString ( null , "originId" ) ; String curatedPid = message . getString ( null , "curatedPid" ) ; boolean isReady = false ; try { // False here will make sure we aren ' t sending out a bunch // of requests again . isReady = checkChildren ( response , data , oid , thisPid , false , childOid , childId , curatedPid ) ; } catch ( TransactionException ex ) { log . error ( "Error updating related objects '{}': " , oid , ex ) ; emailObjectLink ( response , oid , "An error occurred curating this object, some" + " manual intervention may be required; please see" + " the system logs." ) ; audit ( response , oid , "Errors curating relations; aborted." ) ; return response ; } // If it is ready if ( isReady ) { createTask ( response , oid , "curation-response" ) ; } return response ; } // The object has finished , work on downstream ' children ' if ( task . equals ( "curation-confirm" ) ) { boolean isReady = false ; try { isReady = checkChildren ( response , data , oid , thisPid , true ) ; } catch ( TransactionException ex ) { log . error ( "Error processing related objects '{}': " , oid , ex ) ; emailObjectLink ( response , oid , "An error occurred curating this object, some" + " manual intervention may be required; please see" + " the system logs." ) ; audit ( response , oid , "Errors curating relations; aborted." ) ; return response ; } // If it is ready ont he first pass . . . if ( isReady ) { createTask ( response , oid , "curation-response" ) ; } else { // Otherwise we are going to have to wait for children audit ( response , oid , "Curation complete, but still waiting" + " on relations." ) ; } return response ; } // Since it is already curated , we are just storing any new // relationships / responses and passing things along if ( task . equals ( "curation-request" ) || task . equals ( "curation-query" ) ) { try { storeRequestData ( message , oid ) ; } catch ( TransactionException ex ) { log . error ( "Error storing request data '{}': " , oid , ex ) ; emailObjectLink ( response , oid , "An error occurred curating this object, some" + " manual intervention may be required; please see" + " the system logs." ) ; audit ( response , oid , "Errors during curation; aborted." ) ; return response ; } // Requests if ( task . equals ( "curation-request" ) ) { JsonObject taskObj = createTask ( response , oid , "curation" ) ; taskObj . put ( "alreadyCurated" , true ) ; // Queries } else { // Rather then push to ' curation - response ' we are just // sending a single response to the querying object JsonSimple respond = new JsonSimple ( message . getObject ( "respond" ) ) ; String broker = respond . getString ( brokerUrl , "broker" ) ; String responseOid = respond . getString ( null , "oid" ) ; String responseTask = respond . getString ( null , "task" ) ; JsonObject responseObj = createTask ( response , broker , responseOid , responseTask ) ; // Don ' t forget to tell them where it came from responseObj . put ( "originOid" , oid ) ; responseObj . put ( "curatedPid" , thisPid ) ; } return response ; } // Same as above , but this is a second stage request , let ' s be a // little sterner in case log filtering is occurring if ( task . equals ( "curation" ) ) { log . info ( "Request to curate ignored. This object '{}' has" + " already been curated." , oid ) ; JsonObject taskObj = createTask ( response , oid , "curation-confirm" ) ; taskObj . put ( "alreadyCurated" , true ) ; return response ; } // What should happen per task if we have * NOT * already been // curated ? } else { // Whoops ! We shouldn ' t be confirming or responding to a non - curated // item ! ! ! if ( task . equals ( "curation-confirm" ) || task . equals ( "curation-pending" ) ) { emailObjectLink ( response , oid , "NOTICE: The system has received a '" + task + "'" + " event, but the record does not appear to be" + " curated. If your system is configured for VITAL" + " integration this should clear by itself soon." ) ; return response ; } // Standard stuff - a request to curate non - curated data if ( task . equals ( "curation-request" ) ) { try { storeRequestData ( message , oid ) ; } catch ( TransactionException ex ) { log . error ( "Error storing request data '{}': " , oid , ex ) ; emailObjectLink ( response , oid , "An error occurred curating this object, some" + " manual intervention may be required; please see" + " the system logs." ) ; audit ( response , oid , "Errors during curation; aborted." ) ; return response ; } // ReDBox will only curate if the workflow is finished if ( ! workflowCompleted ( oid ) ) { log . warn ( "Curation request recieved, but object has" + " not finished workflow." ) ; return response ; } if ( manualConfirmation ) { emailObjectLink ( response , oid , "A curation request has been recieved for this" + " object. You can find a link below to approve" + " the request." ) ; audit ( response , oid , "Curation request received. Pending" ) ; } else { createTask ( response , oid , "curation" ) ; } return response ; } // We can ' t do much here , just store the response address if ( task . equals ( "curation-query" ) ) { try { storeRequestData ( message , oid ) ; } catch ( TransactionException ex ) { log . error ( "Error storing request data '{}': " , oid , ex ) ; emailObjectLink ( response , oid , "An error occurred curating this object, some" + " manual intervention may be required; please see" + " the system logs." ) ; audit ( response , oid , "Errors during curation; aborted." ) ; return response ; } return response ; } // The actual curation event if ( task . equals ( "curation" ) ) { audit ( response , oid , "Object curation requested." ) ; List < String > list = itemConfig . getStringList ( "transformer" , "curation" ) ; // Pass through whichever curation transformer are configured if ( list != null && ! list . isEmpty ( ) ) { for ( String id : list ) { JsonObject order = newTransform ( response , id , oid ) ; JsonObject config = ( JsonObject ) order . get ( "config" ) ; JsonObject overrides = itemConfig . getObject ( "transformerOverrides" , id ) ; if ( overrides != null ) { config . putAll ( overrides ) ; } } } else { log . warn ( "This object has no configured transformers!" ) ; } // Force an index update after the ID has been created , // but before " curation - confirm " JsonObject order = newIndex ( response , oid ) ; order . put ( "forceCommit" , true ) ; // Don ' t forget to come back createTask ( response , oid , "curation-confirm" ) ; return response ; } } log . error ( "Invalid message received. Unknown task:\n{}" , message . toString ( true ) ) ; emailObjectLink ( response , oid , "The curation manager has received an invalid curation message" + " for this object. Please see the system logs." ) ; return response ;
public class CmsByteBuffer { /** * Transfers bytes from this buffer to a target byte array . < p > * @ param dest the byte array to which the bytes should be transferred * @ param srcStart the start index in this buffer * @ param destStart the start index in the destination buffer * @ param len the number of bytes to transfer */ public void readBytes ( byte [ ] dest , int srcStart , int destStart , int len ) { } }
System . arraycopy ( m_buffer , srcStart , dest , destStart , len ) ;
public class AnnotatedExtensions { /** * Finds a named declared method on the given class . * @ param name Name of declared method to retrieve * @ param cls Class to retrieve method from * @ return Named method on class */ public static Method findMethod ( String name , Class < ? > cls ) { } }
for ( Method method : cls . getDeclaredMethods ( ) ) { if ( method . getName ( ) . equals ( name ) ) { return method ; } } throw new ExecutionException ( "invalid auto-function: no '" + name + "' method declared" , null ) ;
public class openControlledVocabularyImpl { /** * TODO : think about this . * @ return false */ protected boolean semanticallyEquivalent ( BioPAXElement o ) { } }
if ( o != null && o instanceof openControlledVocabulary ) { openControlledVocabulary that = ( openControlledVocabulary ) o ; return this . equals ( that ) || hasCommonTerm ( that ) || ! this . findCommonUnifications ( that ) . isEmpty ( ) ; } return false ;
public class ExcelItemWriter { /** * writeItem . * @ param datas a { @ link java . lang . Object } object . */ protected void writeItem ( Object datas ) { } }
HSSFRow row = sheet . createRow ( index ) ; // 建立新行 if ( datas != null ) { if ( datas . getClass ( ) . isArray ( ) ) { Object [ ] values = ( Object [ ] ) datas ; for ( int i = 0 ; i < values . length ; i ++ ) { HSSFCell cell = row . createCell ( i ) ; if ( values [ i ] instanceof Number ) { cell . setCellType ( CellType . NUMERIC ) ; cell . setCellValue ( ( ( Number ) values [ i ] ) . doubleValue ( ) ) ; } else if ( values [ i ] instanceof java . sql . Date ) { cell . setCellValue ( ( Date ) values [ i ] ) ; cell . setCellStyle ( getDateStyle ( ) ) ; } else if ( values [ i ] instanceof java . util . Date ) { cell . setCellValue ( ( Date ) values [ i ] ) ; cell . setCellStyle ( getTimeStyle ( ) ) ; } else if ( values [ i ] instanceof Calendar ) { cell . setCellValue ( ( Calendar ) values [ i ] ) ; cell . setCellStyle ( getTimeStyle ( ) ) ; } else { cell . setCellValue ( new HSSFRichTextString ( ( values [ i ] == null ) ? "" : values [ i ] . toString ( ) ) ) ; } } } else { HSSFCell cell = row . createCell ( 0 ) ; if ( datas instanceof Number ) { cell . setCellType ( CellType . NUMERIC ) ; } cell . setCellValue ( new HSSFRichTextString ( datas . toString ( ) ) ) ; } }
public class ContactType { /** * MakeContactRecord Method . */ public Record makeContactRecord ( RecordOwner recordOwner ) { } }
String strRecordClass = this . getField ( ContactType . RECORD_CLASS ) . toString ( ) ; return Record . makeRecordFromClassName ( strRecordClass , recordOwner , true , false ) ;
public class ClassUtils { /** * < p > getContextClassLoader . < / p > * @ return a { @ link java . lang . ClassLoader } object . */ public static ClassLoader getContextClassLoader ( ) { } }
ClassLoader loader = null ; try { loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; } catch ( Throwable e ) { } if ( loader == null ) { loader = ClassUtils . class . getClassLoader ( ) ; } return loader ;
public class Argon2Factory { /** * Creates a new { @ link Argon2 } instance with the given type . * @ param type Argon2 type . * @ return Argon2 instance . */ public static Argon2 create ( Argon2Types type ) { } }
return createInternal ( type , Argon2Constants . DEFAULT_SALT_LENGTH , Argon2Constants . DEFAULT_HASH_LENGTH ) ;
public class EMRepository { /** * Removes EM * @ param sessionToken */ public void removeEm ( String sessionToken ) { } }
if ( emMap != null ) { EntityManager em = emMap . get ( sessionToken ) ; if ( em != null ) { em . close ( ) ; } emMap . remove ( sessionToken ) ; }
public class IcsSpinner { /** * Describes how the selected item view is positioned . Currently only the horizontal component * is used . The default is determined by the current theme . * @ param gravity See { @ link android . view . Gravity } * @ attr ref android . R . styleable # Spinner _ gravity */ public void setGravity ( int gravity ) { } }
if ( mGravity != gravity ) { if ( ( gravity & Gravity . HORIZONTAL_GRAVITY_MASK ) == 0 ) { gravity |= Gravity . LEFT ; } mGravity = gravity ; requestLayout ( ) ; }
public class Constraints { /** * Returns a constrained view of the specified list iterator , using the * specified constraint . Any operations that would add new elements to the * underlying list will be verified by the constraint . * @ param listIterator the iterator for which to return a constrained view * @ param constraint the constraint for elements in the list * @ return a constrained view of the specified iterator */ private static < E > ListIterator < E > constrainedListIterator ( ListIterator < E > listIterator , Constraint < ? super E > constraint ) { } }
return new ConstrainedListIterator < E > ( listIterator , constraint ) ;
public class FilePath { /** * Returns the full url for the given path . */ public String getURL ( ) { } }
if ( ! isWindows ( ) ) return escapeURL ( "file:" + getFullPath ( ) ) ; String path = getFullPath ( ) ; int length = path . length ( ) ; CharBuffer cb = new CharBuffer ( ) ; // #2725 , server / 1495 cb . append ( "file:" ) ; char ch ; int offset = 0 ; // For windows , convert / c : to c : if ( length >= 3 && path . charAt ( 0 ) == '/' && path . charAt ( 2 ) == ':' && ( 'a' <= ( ch = path . charAt ( 1 ) ) && ch <= 'z' || 'A' <= ch && ch <= 'Z' ) ) { // offset = 1; } else if ( length >= 3 && path . charAt ( 0 ) == '/' && path . charAt ( 1 ) == ':' && path . charAt ( 2 ) == '/' ) { cb . append ( '/' ) ; cb . append ( '/' ) ; cb . append ( '/' ) ; cb . append ( '/' ) ; offset = 3 ; } for ( ; offset < length ; offset ++ ) { ch = path . charAt ( offset ) ; if ( ch == '\\' ) cb . append ( '/' ) ; else cb . append ( ch ) ; } return escapeURL ( cb . toString ( ) ) ;
public class ExternalEntryPointHelper { /** * Based on the input for scanning annotations , look for @ ExternalEntryPoint and get the specific type black list elements . * @ param predefinedTypeBlacklist black list * @ param method method to check * @ param scanEntryPointAnnotation annotation * @ return Set */ public static Set < Class < ? > > getConsolidatedTypeBlacklist ( List < Class < ? > > predefinedTypeBlacklist , Method method , boolean scanEntryPointAnnotation ) { } }
final Set < Class < ? > > consolidatedBlacklist = new HashSet < Class < ? > > ( predefinedTypeBlacklist ) ; if ( scanEntryPointAnnotation ) { // first we look into the class level if ( method . getDeclaringClass ( ) . isAnnotationPresent ( ExternalEntryPoint . class ) ) { final ExternalEntryPoint externalEntryPoint = method . getDeclaringClass ( ) . getAnnotation ( ExternalEntryPoint . class ) ; if ( externalEntryPoint . typeBlacklist ( ) != null ) { consolidatedBlacklist . addAll ( Arrays . asList ( externalEntryPoint . typeBlacklist ( ) ) ) ; } } // then we look at the method level if ( method . isAnnotationPresent ( ExternalEntryPoint . class ) ) { final ExternalEntryPoint externalEntryPoint = method . getAnnotation ( ExternalEntryPoint . class ) ; if ( externalEntryPoint . typeBlacklist ( ) != null ) { consolidatedBlacklist . addAll ( Arrays . asList ( externalEntryPoint . typeBlacklist ( ) ) ) ; } } } return consolidatedBlacklist ;
public class AppContextFinder { /** * Returns the application context for the current scope . If no page exists or no application * context is associated with the page , looks for an application context registered to the * current thread . Failing that , returns the root application context . * @ see org . carewebframework . api . spring . IAppContextFinder # getChildAppContext ( ) * @ return An application context . */ @ Override public ApplicationContext getChildAppContext ( ) { } }
ApplicationContext appContext = getAppContext ( ExecutionContext . getPage ( ) ) ; return appContext == null ? getRootAppContext ( ) : appContext ;
public class GetServiceStatusResponse { /** * Read members from a MwsReader . * @ param r * The reader to read from . */ @ Override public void readFragmentFrom ( MwsReader r ) { } }
getServiceStatusResult = r . read ( "GetServiceStatusResult" , GetServiceStatusResult . class ) ; responseMetadata = r . read ( "ResponseMetadata" , ResponseMetadata . class ) ;
public class OAuth2Request { /** * Update the request parameters and return a new object with the same properties except the parameters . * @ param parameters new parameters replacing the existing ones * @ return a new OAuth2Request */ public OAuth2Request createOAuth2Request ( Map < String , String > parameters ) { } }
return new OAuth2Request ( parameters , getClientId ( ) , authorities , approved , getScope ( ) , resourceIds , redirectUri , responseTypes , extensions ) ;
public class UploadManager { /** * 上传文件 * @ param file 上传的文件对象 * @ param key 上传文件保存的文件名 * @ param token 上传凭证 * @ param complete 上传完成的后续处理动作 * @ param options 上传数据的可选参数 */ public void put ( final File file , final String key , String token , final UpCompletionHandler complete , final UploadOptions options ) { } }
final UpToken decodedToken = UpToken . parse ( token ) ; if ( areInvalidArg ( key , null , file , token , decodedToken , complete ) ) { return ; } Zone z = config . zone ; z . preQuery ( token , new Zone . QueryHandler ( ) { @ Override public void onSuccess ( ) { long size = file . length ( ) ; if ( size <= config . putThreshold ) { FormUploader . upload ( client , config , file , key , decodedToken , complete , options ) ; return ; } String recorderKey = config . keyGen . gen ( key , file ) ; final WarpHandler completionHandler = warpHandler ( complete , file != null ? file . length ( ) : 0 ) ; ResumeUploader uploader = new ResumeUploader ( client , config , file , key , decodedToken , completionHandler , options , recorderKey ) ; AsyncRun . runInMain ( uploader ) ; } @ Override public void onFailure ( int reason ) { final ResponseInfo info = ResponseInfo . isStatusCodeForBrokenNetwork ( reason ) ? ResponseInfo . networkError ( reason , decodedToken ) : ResponseInfo . invalidToken ( "invalid token" ) ; complete . complete ( key , info , null ) ; } } ) ;
public class AbstractSettings { /** * / * ( non - Javadoc ) * @ see nyla . solutions . core . util . Settings # getPropertyLong ( java . lang . String , long ) */ @ Override public Long getPropertyLong ( String key , long aDefault ) { } }
return getPropertyLong ( key , Long . valueOf ( aDefault ) ) ;
public class EndpointUtil { /** * This method converts the supplied URI and optional operation * into an endpoint descriptor . * @ param uri The URI * @ param operation The optional operation * @ return The endpoint descriptor */ public static String encodeEndpoint ( String uri , String operation ) { } }
StringBuilder buf = new StringBuilder ( ) ; if ( uri != null && ! uri . trim ( ) . isEmpty ( ) ) { buf . append ( uri ) ; } if ( operation != null && ! operation . trim ( ) . isEmpty ( ) ) { buf . append ( '[' ) ; buf . append ( operation ) ; buf . append ( ']' ) ; } return buf . toString ( ) ;
public class AtlasEntityType { /** * this method should be called from AtlasRelationshipType . resolveReferencesPhase2 ( ) */ void addRelationshipAttributeType ( String attributeName , AtlasRelationshipType relationshipType ) { } }
List < AtlasRelationshipType > relationshipTypes = relationshipAttributesType . get ( attributeName ) ; if ( relationshipTypes == null ) { relationshipTypes = new ArrayList < > ( ) ; relationshipAttributesType . put ( attributeName , relationshipTypes ) ; } relationshipTypes . add ( relationshipType ) ;
public class RecurlyClient { /** * Get Child Accounts * Returns information about a the child accounts of an account . * @ param accountCode recurly account id * @ return Accounts on success , null otherwise */ public Accounts getChildAccounts ( final String accountCode ) { } }
return doGET ( Account . ACCOUNT_RESOURCE + "/" + accountCode + "/child_accounts" , Accounts . class , new QueryParams ( ) ) ;
public class KeyManagementServiceClient { /** * Update the version of a [ CryptoKey ] [ google . cloud . kms . v1 . CryptoKey ] that will be used in * [ Encrypt ] [ google . cloud . kms . v1 . KeyManagementService . Encrypt ] . * < p > Returns an error if called on an asymmetric key . * < p > Sample code : * < pre > < code > * try ( KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient . create ( ) ) { * CryptoKeyName name = CryptoKeyName . of ( " [ PROJECT ] " , " [ LOCATION ] " , " [ KEY _ RING ] " , " [ CRYPTO _ KEY ] " ) ; * String cryptoKeyVersionId = " " ; * CryptoKey response = keyManagementServiceClient . updateCryptoKeyPrimaryVersion ( name , cryptoKeyVersionId ) ; * < / code > < / pre > * @ param name The resource name of the [ CryptoKey ] [ google . cloud . kms . v1 . CryptoKey ] to update . * @ param cryptoKeyVersionId The id of the child * [ CryptoKeyVersion ] [ google . cloud . kms . v1 . CryptoKeyVersion ] to use as primary . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ public final CryptoKey updateCryptoKeyPrimaryVersion ( CryptoKeyName name , String cryptoKeyVersionId ) { } }
UpdateCryptoKeyPrimaryVersionRequest request = UpdateCryptoKeyPrimaryVersionRequest . newBuilder ( ) . setName ( name == null ? null : name . toString ( ) ) . setCryptoKeyVersionId ( cryptoKeyVersionId ) . build ( ) ; return updateCryptoKeyPrimaryVersion ( request ) ;
public class DefaultClusterManager { /** * Selects a node . */ private void selectNode ( final Object key , final Handler < AsyncResult < String > > doneHandler ) { } }
context . execute ( new Action < String > ( ) { @ Override public String perform ( ) { String address = nodeSelectors . get ( key ) ; if ( address != null ) { return address ; } Set < String > nodes = new HashSet < > ( ) ; for ( String group : groups . keySet ( ) ) { nodes . addAll ( groups . get ( group ) ) ; } int index = new Random ( ) . nextInt ( nodes . size ( ) ) ; int i = 0 ; for ( String node : nodes ) { if ( i == index ) { nodeSelectors . put ( key , node ) ; return node ; } i ++ ; } return null ; } } , doneHandler ) ;
public class Index { /** * Drop the primary index of the given namespace : keyspace . * @ param namespace the namespace prefix ( will be escaped ) . * @ param keyspace the keyspace ( bucket , will be escaped ) . * @ see # dropNamedPrimaryIndex ( String , String , String ) if the primary index name has been customized . */ public static UsingPath dropPrimaryIndex ( String namespace , String keyspace ) { } }
return new DefaultDropPath ( ) . dropPrimary ( namespace , keyspace ) ;
public class NavigationAlertView { /** * Shows { @ link FeedbackBottomSheet } and adds a listener so * the proper feedback information is collected or the user dismisses the UI . */ public void showFeedbackBottomSheet ( ) { } }
if ( ! isEnabled ) { return ; } FragmentManager fragmentManager = obtainSupportFragmentManager ( ) ; if ( fragmentManager != null ) { long duration = NavigationConstants . FEEDBACK_BOTTOM_SHEET_DURATION ; FeedbackBottomSheet . newInstance ( this , duration ) . show ( fragmentManager , FeedbackBottomSheet . TAG ) ; }
public class DurableInputHandler { /** * Create a DeleteDurable request for an existing durable connection . * @ param subName the name of the subscription to delete . * @ param reqID The request ID to be used for the request . * @ param dme The dme to which the request should be sent */ protected static ControlDeleteDurable createDurableDeleteDurable ( MessageProcessor MP , String subName , String userName , long reqID , SIBUuid8 dme ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createDurableDeleteDurable" , new Object [ ] { MP , subName , userName , new Long ( reqID ) , dme } ) ; ControlDeleteDurable msg = null ; try { // Create and initialize the message msg = MessageProcessor . getControlMessageFactory ( ) . createNewControlDeleteDurable ( ) ; initializeControlMessage ( MP . getMessagingEngineUuid ( ) , msg , dme ) ; // Parameterize for CreateStream msg . setRequestID ( reqID ) ; msg . setDurableSubName ( subName ) ; msg . setSecurityUserid ( userName ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.DurableInputHandler.createDurableDeleteDurable" , "1:540:1.52.1.1" , DurableInputHandler . class ) ; SibTr . exception ( tc , e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createDurableDeleteDurable" , msg ) ; return msg ;
public class InterceptorMetaDataFactory { /** * d367572.9 update for xml and metadata - complete . */ private void addClassLevelInterceptors ( ) throws EJBConfigurationException { } }
final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "addClassLevelInterceptors for EJB name: " + ivEjbName ) ; } // Provided that metadata - complete is false , process annotation first // since the interceptor classes from annotation are the first ones // that need to be called . if ( ! ivMetadataComplete ) { Interceptors cli = ivEjbClass . getAnnotation ( Interceptors . class ) ; if ( cli != null ) { if ( isTraceOn && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "processing @Interceptor annotation for EJB name" ) ; } // Get list of interceptor names and classes . List < String > names = addLoadedInterceptorClasses ( cli . value ( ) ) ; // d630717 // Add to interceptor class name list . ivClassInterceptorNames . addAll ( names ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) // d453477 { Tr . debug ( tc , names + " were annotated with @Interceptor annotation at class level" ) ; } } } // Now augment this list by processing the class level InterceptorBinding from // WCCM for this EJB ( if one exists ) . if ( ivClassInterceptorBinding != null ) { // Get list of class interceptor names from interceptor - binding for EJBname . Collection < String > classInterceptorNames = ivClassInterceptorBinding . ivInterceptorClassNames ; // d453477 List < String > interceptorOrder = ivClassInterceptorBinding . ivInterceptorOrder ; // d453477 if ( ! classInterceptorNames . isEmpty ( ) ) // d453477 { if ( isTraceOn && tc . isDebugEnabled ( ) ) // d453477 { Tr . debug ( tc , "updating class level list with InterceptorBinding list: " + classInterceptorNames ) ; } // Update interceptor class name to Class object map and verify every // interceptor class can be loaded and there are does not duplicate a // name provided by annotation since xml is suppose to augment the // annotation set of interceptor class names . updateNamesToClassMap ( classInterceptorNames ) ; // Add all of the names to the interceptor class name list . ivClassInterceptorNames . addAll ( classInterceptorNames ) ; } else if ( ! interceptorOrder . isEmpty ( ) ) // d453477 { if ( isTraceOn && tc . isDebugEnabled ( ) ) // d453477 { Tr . debug ( tc , "updating class level list with InterceptorBinding order list: " + interceptorOrder ) ; } // interceptor - order and interceptor - classes are mutually exclusive // in xml schema . So only 1 will occur , not both . Get the total // set of ordered class names . HashSet < String > set = new HashSet < String > ( interceptorOrder ) ; // Remove the default interceptor class names from the set so // that only the names that remain are class level interceptors . set . removeAll ( ivDefaultInterceptorNames ) ; // d456352 // Remove the class level interceptor names that came from annotation // from the set so that only the class level interceptor names that came // from xml remain in the set . set . removeAll ( ivClassInterceptorNames ) ; // Now add the names from xml to the list of class level interceptor names // if there are any names remaining in the set . if ( set . isEmpty ( ) == false ) { // First update interceptor class name to Class object map and // verify the interceptor class can be loaded . updateNamesToClassMap ( set ) ; // Now add the names from xml to the list of interceptor class names . ivClassInterceptorNames . addAll ( set ) ; } } } if ( isTraceOn && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "addClassLevelInterceptors returning: " + ivClassInterceptorNames + " for EJB name: " + ivEjbName ) ; }
public class UnsignedLongs { /** * Returns the unsigned { @ code long } value represented by a string with the given radix . * @ param s the string containing the unsigned { @ code long } representation to be parsed . * @ param radix the radix to use while parsing { @ code string } * @ throws NumberFormatException if the string does not contain a valid unsigned { @ code long } with * the given radix , or if { @ code radix } is not between { @ link Character # MIN _ RADIX } and * { @ link Character # MAX _ RADIX } . * @ throws NullPointerException if { @ code string } is null ( in contrast to * { @ link Long # parseLong ( String ) } ) */ @ CanIgnoreReturnValue public static long parseUnsignedLong ( String string , int radix ) { } }
checkNotNull ( string ) ; if ( string . length ( ) == 0 ) { throw new NumberFormatException ( "empty string" ) ; } if ( radix < Character . MIN_RADIX || radix > Character . MAX_RADIX ) { throw new NumberFormatException ( "illegal radix: " + radix ) ; } int maxSafePos = maxSafeDigits [ radix ] - 1 ; long value = 0 ; for ( int pos = 0 ; pos < string . length ( ) ; pos ++ ) { int digit = Character . digit ( string . charAt ( pos ) , radix ) ; if ( digit == - 1 ) { throw new NumberFormatException ( string ) ; } if ( pos > maxSafePos && overflowInParse ( value , digit , radix ) ) { throw new NumberFormatException ( "Too large for unsigned long: " + string ) ; } value = ( value * radix ) + digit ; } return value ;
public class AbstractQuery { /** * Executes the query . The returning a result set that enumerates result rows one at a time . * You can run the query any number of times , and you can even have multiple ResultSet active at * once . * The results come from a snapshot of the database taken at the moment the run ( ) method * is called , so they will not reflect any changes made to the database afterwards . * @ return the ResultSet for the query result . * @ throws CouchbaseLiteException if there is an error when running the query . */ @ NonNull @ Override public ResultSet execute ( ) throws CouchbaseLiteException { } }
try { final C4QueryOptions options = new C4QueryOptions ( ) ; if ( parameters == null ) { parameters = new Parameters ( ) ; } final AllocSlice params = parameters . encode ( ) ; final C4QueryEnumerator c4enum ; synchronized ( getDatabase ( ) . getLock ( ) ) { check ( ) ; c4enum = c4query . run ( options , params ) ; } return new ResultSet ( this , c4enum , columnNames ) ; } catch ( LiteCoreException e ) { throw CBLStatus . convertException ( e ) ; }
public class OGraphDatabase { /** * Returns true if the document is a vertex ( its class is OGraphVertex or any subclasses ) * @ param iRecord * Document to analyze . * @ return true if the document is a vertex ( its class is OGraphVertex or any subclasses ) */ public boolean isVertex ( final ODocument iRecord ) { } }
return iRecord != null ? iRecord . getSchemaClass ( ) . isSubClassOf ( vertexBaseClass ) : false ;
public class IIMFile { /** * Adds a data set to IIM file . * @ param ds * data set id ( see constants in IIM class ) * @ param value * data set value . Null values are silently ignored . * @ throws SerializationException * if value can ' t be serialized by data set ' s serializer * @ throws InvalidDataSetException * if data set isn ' t defined */ public void add ( int ds , Object value ) throws SerializationException , InvalidDataSetException { } }
if ( value == null ) { return ; } DataSetInfo dsi = dsiFactory . create ( ds ) ; byte [ ] data = dsi . getSerializer ( ) . serialize ( value , activeSerializationContext ) ; DataSet dataSet = new DefaultDataSet ( dsi , data ) ; dataSets . add ( dataSet ) ;
public class RouteGuideServer { /** * Main method . This comment makes the linter happy . */ public static void main ( String [ ] args ) throws Exception { } }
RouteGuideServer server = new RouteGuideServer ( 8980 ) ; server . start ( ) ; server . blockUntilShutdown ( ) ;
public class Drawable { /** * Load a tiled sprite from a file , giving tile dimension . * Once created , sprite must call { @ link SpriteTiled # load ( ) } before any other operations . * @ param media The sprite media ( must not be < code > null < / code > ) . * @ param tileWidth The tile width ( must be strictly positive ) . * @ param tileHeight The tile height ( must be strictly positive ) . * @ return The loaded tiled sprite . * @ throws LionEngineException If arguments are invalid or image cannot be read . */ public static SpriteTiled loadSpriteTiled ( Media media , int tileWidth , int tileHeight ) { } }
return new SpriteTiledImpl ( getMediaDpi ( media ) , tileWidth , tileHeight ) ;
public class InitializrService { /** * Retrieves the meta - data of the service at the specified URL . * @ param url the URL * @ return the response */ private CloseableHttpResponse executeInitializrMetadataRetrieval ( String url ) { } }
HttpGet request = new HttpGet ( url ) ; request . setHeader ( new BasicHeader ( HttpHeaders . ACCEPT , ACCEPT_META_DATA ) ) ; return execute ( request , url , "retrieve metadata" ) ;
public class Supplier { /** * The predefined Supplier selects values using the given { @ link com . hazelcast . query . Predicate } * and does not perform any kind of data transformation . Input value types need to match the * aggregations expected value type to make this Supplier work . * @ param < KeyIn > the input key type * @ param < ValueIn > the input value type * @ param < ValueOut > the supplied value type * @ return selected values from the underlying data structure as stored */ public static < KeyIn , ValueIn , ValueOut > Supplier < KeyIn , ValueIn , ValueOut > fromPredicate ( Predicate < KeyIn , ValueIn > predicate ) { } }
return new PredicateSupplier < KeyIn , ValueIn , ValueOut > ( predicate ) ;
public class SecurityDomainJBossASClient { /** * Given the name of an existing security domain that uses the SecureIdentity authentication method , * this updates that domain with the new credentials . Use this to change credentials if you don ' t * want to use expressions as the username or password entry ( in some cases you can ' t , see the JIRA * https : / / issues . jboss . org / browse / AS7-5177 for more info ) . * @ param securityDomainName the name of the security domain whose credentials are to change * @ param username the new username to be associated with the security domain * @ param password the new value of the password to store in the configuration * ( e . g . the obfuscated password itself ) * @ throws Exception if failed to update security domain */ public void updateSecureIdentitySecurityDomainCredentials ( String securityDomainName , String username , String password ) throws Exception { } }
Address addr = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_SECURITY , SECURITY_DOMAIN , securityDomainName , AUTHENTICATION , CLASSIC ) ; ModelNode loginModule = new ModelNode ( ) ; loginModule . get ( CODE ) . set ( "SecureIdentity" ) ; loginModule . get ( FLAG ) . set ( "required" ) ; ModelNode moduleOptions = loginModule . get ( MODULE_OPTIONS ) ; moduleOptions . setEmptyList ( ) ; addPossibleExpression ( moduleOptions , USERNAME , username ) ; addPossibleExpression ( moduleOptions , PASSWORD , password ) ; // login modules attribute must be a list - we only have one item in it , the loginModule ModelNode loginModuleList = new ModelNode ( ) ; loginModuleList . setEmptyList ( ) ; loginModuleList . add ( loginModule ) ; final ModelNode op = createRequest ( WRITE_ATTRIBUTE , addr ) ; op . get ( NAME ) . set ( LOGIN_MODULES ) ; op . get ( VALUE ) . set ( loginModuleList ) ; ModelNode results = execute ( op ) ; if ( ! isSuccess ( results ) ) { throw new FailureException ( results , "Failed to update credentials for security domain [" + securityDomainName + "]" ) ; } return ;
public class Dataset { /** * Creates a new table in this dataset . * < p > Example of creating a table in the dataset with schema and time partitioning . * < pre > { @ code * String tableName = “ my _ table ” ; * String fieldName = “ my _ field ” ; * Schema schema = Schema . of ( Field . of ( fieldName , LegacySQLTypeName . STRING ) ) ; * StandardTableDefinition definition = StandardTableDefinition . newBuilder ( ) * . setSchema ( schema ) * . setTimePartitioning ( TimePartitioning . of ( TimePartitioning . Type . DAY ) ) * . build ( ) ; * Table table = dataset . create ( tableName , definition ) ; * } < / pre > * @ param tableId the table ' s user - defined id * @ param definition the table ' s definition * @ param options options for table creation * @ return a { @ code Table } object for the created table * @ throws BigQueryException upon failure */ public Table create ( String tableId , TableDefinition definition , TableOption ... options ) { } }
TableInfo tableInfo = TableInfo . of ( TableId . of ( getDatasetId ( ) . getDataset ( ) , tableId ) , definition ) ; return bigquery . create ( tableInfo , options ) ;
public class ExpandableRecyclerAdapter { /** * Notify any registered observers that the { @ code itemCount } parents previously * located at { @ code parentPositionStart } have been removed from the data set . The parents * previously located at and after { @ code parentPositionStart + itemCount } may now be * found at { @ code oldPosition - itemCount } . * This is a structural change event . Representations of other existing items in the * data set are still considered up to date and will not be rebound , though their positions * may be altered . * @ param parentPositionStart The previous position of the first parent that was * removed , relative to list of parents only . * @ param itemCount Number of parents removed from the data set */ public void notifyParentRangeRemoved ( int parentPositionStart , int itemCount ) { } }
int sizeChanged = 0 ; int flatParentPositionStart = getFlatParentPosition ( parentPositionStart ) ; for ( int i = 0 ; i < itemCount ; i ++ ) { sizeChanged += removeParentWrapper ( flatParentPositionStart ) ; } notifyItemRangeRemoved ( flatParentPositionStart , sizeChanged ) ;
public class ScanlineFiller { /** * Fills clipped ( minX , minY , maxX , maxY ) area starting at xx , yy . Area must * be surrounded with replacement ( or clip ) * @ param xx * @ param yy * @ param minX * @ param minY * @ param maxX * @ param maxY * @ param target * @ param replacement */ public void floodFill ( int xx , int yy , int minX , int minY , int maxX , int maxY , IntPredicate target , int replacement ) { } }
if ( xx < minX || yy < minY || xx > minX + width || yy > minY + height ) { return ; } this . x = xx ; this . y = yy ; ensure ( index , y ) ; ensure ( north ( ) , y - 1 ) ; ensure ( south ( ) , y + 1 ) ; int color = lines [ index ] [ x ] ; if ( color == replacement || ! target . test ( color ) ) { return ; } southQueue . add ( x , y ) ; while ( take ( ) ) { int [ ] n = lines [ north ( ) ] ; int [ ] l = lines [ index ] ; int [ ] s = lines [ south ( ) ] ; for ( int ii = x ; ii < maxX ; ii ++ ) { if ( target . test ( l [ ii ] ) ) { l [ ii ] = replacement ; if ( y - 1 >= minY && target . test ( n [ ii ] ) ) { northQueue . add ( ii , y - 1 ) ; } if ( y + 1 < maxY && target . test ( s [ ii ] ) ) { southQueue . add ( ii , y + 1 ) ; } } else { break ; } } for ( int ii = x - 1 ; ii >= minX ; ii -- ) { if ( target . test ( l [ ii ] ) ) { l [ ii ] = replacement ; if ( y - 1 >= minY && target . test ( n [ ii ] ) ) { northQueue . add ( ii , y - 1 ) ; } if ( y + 1 < maxY && target . test ( s [ ii ] ) ) { southQueue . add ( ii , y + 1 ) ; } } else { break ; } } } for ( int ii = 0 ; ii < 3 ; ii ++ ) { if ( lineNums [ ii ] >= 0 ) { storeLine ( lineNums [ ii ] , lines [ ii ] ) ; } lineNums [ ii ] = - 2 ; }
public class ReservationPurchaseRecommendation { /** * Details about the recommended purchases . * @ param recommendationDetails * Details about the recommended purchases . */ public void setRecommendationDetails ( java . util . Collection < ReservationPurchaseRecommendationDetail > recommendationDetails ) { } }
if ( recommendationDetails == null ) { this . recommendationDetails = null ; return ; } this . recommendationDetails = new java . util . ArrayList < ReservationPurchaseRecommendationDetail > ( recommendationDetails ) ;
public class CmsPropertySubmitHandler { /** * Check if a field name belongs to one of a given list of properties . < p > * @ param fieldName the field name * @ param propNames the property names * @ return true if the field name matches one of the property names */ private boolean checkContains ( String fieldName , String ... propNames ) { } }
for ( String propName : propNames ) { if ( fieldName . contains ( "/" + propName + "/" ) ) { return true ; } } return false ;
public class TypedCodeGenerator { /** * we should print it first , like users write it . Same for @ interface and @ record . */ private void appendClassAnnotations ( StringBuilder sb , FunctionType funType ) { } }
FunctionType superConstructor = funType . getInstanceType ( ) . getSuperClassConstructor ( ) ; if ( superConstructor != null ) { ObjectType superInstance = superConstructor . getInstanceType ( ) ; if ( ! superInstance . toString ( ) . equals ( "Object" ) ) { sb . append ( " * " ) ; appendAnnotation ( sb , "extends" , superInstance . toAnnotationString ( Nullability . IMPLICIT ) ) ; sb . append ( "\n" ) ; } } // Avoid duplicates , add implemented type to a set first Set < String > interfaces = new TreeSet < > ( ) ; for ( ObjectType interfaze : funType . getAncestorInterfaces ( ) ) { interfaces . add ( interfaze . toAnnotationString ( Nullability . IMPLICIT ) ) ; } for ( String interfaze : interfaces ) { sb . append ( " * " ) ; appendAnnotation ( sb , "implements" , interfaze ) ; sb . append ( "\n" ) ; }
public class StringUtils { /** * This returns a string from decimal digit smallestDigit to decimal digit * biggest digit . Smallest digit is labeled 1 , and the limits are * inclusive . */ public static String truncate ( int n , int smallestDigit , int biggestDigit ) { } }
int numDigits = biggestDigit - smallestDigit + 1 ; char [ ] result = new char [ numDigits ] ; for ( int j = 1 ; j < smallestDigit ; j ++ ) { n = n / 10 ; } for ( int j = numDigits - 1 ; j >= 0 ; j -- ) { result [ j ] = Character . forDigit ( n % 10 , 10 ) ; n = n / 10 ; } return new String ( result ) ;
public class PropertiesQuantilesCallback { /** * Create buckets using callback attributes . * @ param stopwatch Target stopwatch * @ return Created buckets for given stopwatch */ @ Override protected Buckets createBuckets ( Stopwatch stopwatch ) { } }
// Get configuration BucketsType type = bucketsTypeEnumPropertyType . get ( stopwatch , "type" ) ; Long min = longPropertyType . get ( stopwatch , "min" ) ; Long max = longPropertyType . get ( stopwatch , "max" ) ; Integer nb = integerPropertyType . get ( stopwatch , "nb" ) ; // Build buckets Buckets buckets = type . createBuckets ( stopwatch , min , max , nb ) ; buckets . setLogTemplate ( createLogTemplate ( stopwatch ) ) ; return buckets ;
public class DefaultPropertyMapper { /** * todo : abstract this via AtlasTypeSystem */ protected synchronized HierarchicalType getDataType ( String type ) { } }
HierarchicalType dataType = typeInstances . get ( type ) ; // todo : are there still cases where type can be null ? if ( dataType == null ) { dataType = createDataType ( type ) ; typeInstances . put ( type , dataType ) ; } return dataType ;
public class Buffer { /** * This transcodes a UTF - 16 Java String to UTF - 8 bytes . * < p > This looks most similar to { @ code io . netty . buffer . ByteBufUtil . writeUtf8 ( AbstractByteBuf , * int , CharSequence , int ) } v4.1 , modified including features to address ASCII runs of text . */ public void writeUtf8 ( CharSequence string ) { } }
for ( int i = 0 , len = string . length ( ) ; i < len ; i ++ ) { char ch = string . charAt ( i ) ; if ( ch < 0x80 ) { // 7 - bit ASCII character writeByte ( ch ) ; // This could be an ASCII run , or possibly entirely ASCII while ( i < len - 1 ) { ch = string . charAt ( i + 1 ) ; if ( ch >= 0x80 ) break ; i ++ ; writeByte ( ch ) ; // another 7 - bit ASCII character } } else if ( ch < 0x800 ) { // 11 - bit character writeByte ( 0xc0 | ( ch >> 6 ) ) ; writeByte ( 0x80 | ( ch & 0x3f ) ) ; } else if ( ch < 0xd800 || ch > 0xdfff ) { // 16 - bit character writeByte ( 0xe0 | ( ch >> 12 ) ) ; writeByte ( 0x80 | ( ( ch >> 6 ) & 0x3f ) ) ; writeByte ( 0x80 | ( ch & 0x3f ) ) ; } else { // Possibly a 21 - bit character if ( ! Character . isHighSurrogate ( ch ) ) { // Malformed or not UTF - 8 writeByte ( '?' ) ; continue ; } if ( i == len - 1 ) { // Truncated or not UTF - 8 writeByte ( '?' ) ; break ; } char low = string . charAt ( ++ i ) ; if ( ! Character . isLowSurrogate ( low ) ) { // Malformed or not UTF - 8 writeByte ( '?' ) ; writeByte ( Character . isHighSurrogate ( low ) ? '?' : low ) ; continue ; } // Write the 21 - bit character using 4 bytes // See http : / / www . unicode . org / versions / Unicode7.0.0 / ch03 . pdf # G2630 int codePoint = Character . toCodePoint ( ch , low ) ; writeByte ( 0xf0 | ( codePoint >> 18 ) ) ; writeByte ( 0x80 | ( ( codePoint >> 12 ) & 0x3f ) ) ; writeByte ( 0x80 | ( ( codePoint >> 6 ) & 0x3f ) ) ; writeByte ( 0x80 | ( codePoint & 0x3f ) ) ; } }
public class UnassignPrivateIpAddressesRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional * parameters to enable operation dry - run . */ @ Override public Request < UnassignPrivateIpAddressesRequest > getDryRunRequest ( ) { } }
Request < UnassignPrivateIpAddressesRequest > request = new UnassignPrivateIpAddressesRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ;
public class EthereumUtil { /** * Converts a variable size number ( e . g . byte , short , int , long ) in a RLPElement to long * @ param rawData byte array containing variable number * @ return number as long or null if not a correct number */ public static BigInteger convertVarNumberToBigInteger ( byte [ ] rawData ) { } }
BigInteger result = BigInteger . ZERO ; if ( rawData != null ) { if ( rawData . length > 0 ) { result = new BigInteger ( 1 , rawData ) ; // we know it is always positive } } return result ;
public class JMLimitedStack { /** * ( non - Javadoc ) * @ see java . util . Collection # add ( java . lang . Object ) */ @ Override public boolean add ( E e ) { } }
if ( capacity <= linkedBlockingDeque . size ( ) ) linkedBlockingDeque . removeFirst ( ) ; return linkedBlockingDeque . add ( e ) ;
public class BlocksMap { /** * Add block b belonging to the specified file inode to the map , this * overwrites the map with the new block information . */ public BlockInfo updateINode ( BlockInfo oldBlock , Block newBlock , INodeFile iNode , short replication , boolean forceUpdate ) throws IOException { } }
// If the old block is not same as the new block , probably the GS was // bumped up , hence update the block with new GS / size . // If forceUpdate is true , we will always remove the old block and // update with new block , it ' s used by raid List < DatanodeDescriptor > locations = null ; if ( oldBlock != null && ( ! oldBlock . equals ( newBlock ) || forceUpdate ) ) { if ( oldBlock . getBlockId ( ) != newBlock . getBlockId ( ) ) { throw new IOException ( "block ids don't match : " + oldBlock + ", " + newBlock ) ; } if ( forceUpdate ) { // save locations of the old block locations = new ArrayList < DatanodeDescriptor > ( ) ; for ( int i = 0 ; i < oldBlock . numNodes ( ) ; i ++ ) { locations . add ( oldBlock . getDatanode ( i ) ) ; } } else { if ( ! iNode . isUnderConstruction ( ) ) { throw new IOException ( "Try to update generation of a finalized block old block: " + oldBlock + ", new block: " + newBlock ) ; } } removeBlock ( oldBlock ) ; } BlockInfo info = checkBlockInfo ( newBlock , replication ) ; info . set ( newBlock . getBlockId ( ) , newBlock . getNumBytes ( ) , newBlock . getGenerationStamp ( ) ) ; info . inode = iNode ; if ( locations != null ) { // add back the locations if needed if ( locations != null ) { for ( DatanodeDescriptor d : locations ) { d . addBlock ( info ) ; } } } return info ;
public class VTensor { /** * Checks that the indices are valid . */ private void checkIndices ( int ... indices ) { } }
if ( indices . length != dims . length ) { throw new IllegalArgumentException ( String . format ( "Indices array is not the correct length. expected=%d actual=%d" , indices . length , dims . length ) ) ; } for ( int i = 0 ; i < indices . length ; i ++ ) { if ( indices [ i ] < 0 || dims [ i ] <= indices [ i ] ) { throw new IllegalArgumentException ( String . format ( "Indices array contains an index that is out of bounds: i=%d index=%d" , i , indices [ i ] ) ) ; } }
public class ListeFilme { /** * Check if list is older than specified parameter . * @ param sekunden The age in seconds . * @ return true if older . */ public boolean isOlderThan ( int sekunden ) { } }
int ret = getAge ( ) ; if ( ret != 0 ) { Log . sysLog ( "Die Filmliste ist " + ret / 60 + " Minuten alt" ) ; } return ret > sekunden ;
public class EncodingContext { /** * Decode the given Base64 encoded value into an integer array . * @ param input The Base64 encoded value to decode * @ return The array of decoded integers * @ throws IOException if an error occurs decoding the array stream * @ see # encodeIntArray ( int [ ] ) */ public int [ ] decodeIntArray ( String input ) throws IOException { } }
int [ ] result = null ; ByteArrayInputStream bis = new ByteArrayInputStream ( Base64 . decodeBase64 ( input ) ) ; DataInputStream dis = new DataInputStream ( bis ) ; int length = dis . readInt ( ) ; result = new int [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { result [ i ] = dis . readInt ( ) ; } return result ;
public class Mappers { /** * Gets a mapper which applies { @ code function } to each element . * @ param function * @ return */ public static < A , B > Mapper < A , B > fromFunction ( final Function < A , B > function ) { } }
return new Mapper < A , B > ( ) { @ Override public B map ( A item ) { return function . apply ( item ) ; } } ;
public class DocumentRevisionTree { /** * < p > Returns the { @ link InternalDocumentRevision } that is the current winning revision * for this { @ code DocumentRevisionTree } . < / p > * @ return the { @ link InternalDocumentRevision } that is the current winning revision * for this { @ code DocumentRevisionTree } . */ public InternalDocumentRevision getCurrentRevision ( ) { } }
for ( DocumentRevisionNode n : leafs ) { if ( n . getData ( ) . isCurrent ( ) ) { return n . getData ( ) ; } } throw new IllegalStateException ( "No current revision found." ) ;
public class NegatedElementImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case SimpleAntlrPackage . NEGATED_ELEMENT__ELEMENT : return element != null ; } return super . eIsSet ( featureID ) ;
public class SessionDescriptor { /** * Checks that specified format is described by this sdp . * @ param encoding the encoding name of the format to check * @ return true if format with specified encoding present in sdp . */ public boolean contains ( String encoding ) { } }
if ( encoding . equalsIgnoreCase ( "sendrecv" ) || encoding . equalsIgnoreCase ( "fmtp" ) || encoding . equalsIgnoreCase ( "audio" ) || encoding . equalsIgnoreCase ( "AS" ) || encoding . equalsIgnoreCase ( "IP4" ) ) { return true ; } for ( int i = 0 ; i < count ; i ++ ) { if ( md [ i ] . contains ( encoding ) ) { return true ; } } return false ;
public class LinearRankSelector { /** * This method sorts the population in descending order while calculating the * selection probabilities . */ @ Override protected double [ ] probabilities ( final Seq < Phenotype < G , C > > population , final int count ) { } }
assert population != null : "Population must not be null. " ; assert ! population . isEmpty ( ) : "Population is empty." ; assert count > 0 : "Population to select must be greater than zero. " ; final double N = population . size ( ) ; final double [ ] probabilities = new double [ population . size ( ) ] ; if ( N == 1 ) { probabilities [ 0 ] = 1 ; } else { for ( int i = probabilities . length ; -- i >= 0 ; ) { probabilities [ probabilities . length - i - 1 ] = ( _nminus + ( _nplus - _nminus ) * i / ( N - 1 ) ) / N ; } } return probabilities ;
public class Alignments { /** * Splits an alignment into many alignments based on a function mapping aligned items to some set * of keys . Returns a map where the keys are all observed outputs of the key function on items in * the alignment and the values are new alignments containing only elements which yield that * output when the key function is applied . For example , if you had an alignment of * EventMentions , you could use an " event type " key function to produce one alignment per event * type . */ @ SuppressWarnings ( "unchecked" ) public static < T , V > ImmutableMap < V , Alignment < T , T > > splitAlignmentByKeyFunction ( Alignment < ? extends T , ? extends T > alignment , Function < ? super T , ? extends V > keyFunction ) { } }
// we first determine all keys we could ever encounter to ensure we can construct our map // deterministically // Java will complain about this cast but it is safe because ImmutableSet if covariant in its // type parameter final ImmutableSet < ? extends V > allKeys = FluentIterable . from ( ( ImmutableSet < T > ) alignment . allLeftItems ( ) ) . append ( alignment . allRightItems ( ) ) . transform ( keyFunction ) . toSet ( ) ; final ImmutableMap . Builder < V , MultimapAlignment . Builder < T , T > > keysToAlignmentsB = ImmutableMap . builder ( ) ; for ( final V key : allKeys ) { keysToAlignmentsB . put ( key , MultimapAlignment . < T , T > builder ( ) ) ; } final ImmutableMap < V , MultimapAlignment . Builder < T , T > > keysToAlignments = keysToAlignmentsB . build ( ) ; for ( final T leftItem : alignment . allLeftItems ( ) ) { final V keyVal = keyFunction . apply ( leftItem ) ; final MultimapAlignment . Builder < T , T > alignmentForKey = keysToAlignments . get ( keyVal ) ; alignmentForKey . addLeftItem ( leftItem ) ; for ( T rightItem : alignment . alignedToLeftItem ( leftItem ) ) { if ( keyFunction . apply ( rightItem ) . equals ( keyVal ) ) { alignmentForKey . align ( leftItem , rightItem ) ; } } } for ( final T rightItem : alignment . allRightItems ( ) ) { final V keyVal = keyFunction . apply ( rightItem ) ; final MultimapAlignment . Builder < T , T > alignmentForKey = keysToAlignments . get ( keyVal ) ; alignmentForKey . addRightItem ( rightItem ) ; for ( final T leftItem : alignment . alignedToRightItem ( rightItem ) ) { if ( keyVal . equals ( keyFunction . apply ( leftItem ) ) ) { alignmentForKey . align ( leftItem , rightItem ) ; } } } final ImmutableMap . Builder < V , Alignment < T , T > > ret = ImmutableMap . builder ( ) ; for ( final Map . Entry < V , MultimapAlignment . Builder < T , T > > entry : keysToAlignments . entrySet ( ) ) { ret . put ( entry . getKey ( ) , entry . getValue ( ) . build ( ) ) ; } return ret . build ( ) ;
public class ExpressionResolver { /** * Resolve expression against current context . * @ param expression * Jinja expression . * @ return Value of expression . */ public Object resolveExpression ( String expression ) { } }
if ( StringUtils . isBlank ( expression ) ) { return null ; } interpreter . getContext ( ) . addResolvedExpression ( expression . trim ( ) ) ; try { String elExpression = EXPRESSION_START_TOKEN + expression . trim ( ) + EXPRESSION_END_TOKEN ; ValueExpression valueExp = expressionFactory . createValueExpression ( elContext , elExpression , Object . class ) ; Object result = valueExp . getValue ( elContext ) ; validateResult ( result ) ; return result ; } catch ( PropertyNotFoundException e ) { interpreter . addError ( new TemplateError ( ErrorType . WARNING , ErrorReason . UNKNOWN , ErrorItem . PROPERTY , e . getMessage ( ) , "" , interpreter . getLineNumber ( ) , interpreter . getPosition ( ) , e , BasicTemplateErrorCategory . UNKNOWN , ImmutableMap . of ( "exception" , e . getMessage ( ) ) ) ) ; } catch ( TreeBuilderException e ) { int position = interpreter . getPosition ( ) + e . getPosition ( ) ; // replacing the position in the string like this isn ' t great , but JUEL ' s parser does not allow passing in a starting position String errorMessage = StringUtils . substringAfter ( e . getMessage ( ) , "': " ) . replaceFirst ( "position [0-9]+" , "position " + position ) ; interpreter . addError ( TemplateError . fromException ( new TemplateSyntaxException ( expression . substring ( e . getPosition ( ) - EXPRESSION_START_TOKEN . length ( ) ) , "Error parsing '" + expression + "': " + errorMessage , interpreter . getLineNumber ( ) , position , e ) ) ) ; } catch ( ELException e ) { if ( e . getCause ( ) != null && e . getCause ( ) instanceof DeferredValueException ) { throw ( DeferredValueException ) e . getCause ( ) ; } if ( e . getCause ( ) != null && e . getCause ( ) instanceof TemplateSyntaxException ) { interpreter . addError ( TemplateError . fromException ( ( TemplateSyntaxException ) e . getCause ( ) ) ) ; } else if ( e . getCause ( ) != null && e . getCause ( ) instanceof InvalidInputException ) { interpreter . addError ( TemplateError . fromInvalidInputException ( ( InvalidInputException ) e . getCause ( ) ) ) ; } else if ( e . getCause ( ) != null && e . getCause ( ) instanceof InvalidArgumentException ) { interpreter . addError ( TemplateError . fromInvalidArgumentException ( ( InvalidArgumentException ) e . getCause ( ) ) ) ; } else { interpreter . addError ( TemplateError . fromException ( new TemplateSyntaxException ( expression , e . getMessage ( ) , interpreter . getLineNumber ( ) , e ) ) ) ; } } catch ( DisabledException e ) { interpreter . addError ( new TemplateError ( ErrorType . FATAL , ErrorReason . DISABLED , ErrorItem . FUNCTION , e . getMessage ( ) , expression , interpreter . getLineNumber ( ) , interpreter . getPosition ( ) , e ) ) ; } catch ( UnknownTokenException e ) { // Re - throw the exception because you only get this when the config failOnUnknownTokens is enabled . throw e ; } catch ( DeferredValueException e ) { // Re - throw so that it can be handled in JinjavaInterpreter throw e ; } catch ( InvalidInputException e ) { interpreter . addError ( TemplateError . fromInvalidInputException ( e ) ) ; } catch ( InvalidArgumentException e ) { interpreter . addError ( TemplateError . fromInvalidArgumentException ( e ) ) ; } catch ( Exception e ) { interpreter . addError ( TemplateError . fromException ( new InterpretException ( String . format ( "Error resolving expression [%s]: " + getRootCauseMessage ( e ) , expression ) , e , interpreter . getLineNumber ( ) , interpreter . getPosition ( ) ) ) ) ; } return null ;
public class FunctionDef { /** * < pre > * A mapping from the output arg names from ` signature ` to the * outputs from ` node _ def ` that should be returned by the function . * < / pre > * < code > map & lt ; string , string & gt ; ret = 4 ; < / code > */ public java . util . Map < java . lang . String , java . lang . String > getRetMap ( ) { } }
return internalGetRet ( ) . getMap ( ) ;
public class ResourceUtil { /** * check if file is a child of given directory * @ param file file to search * @ param dir directory to search * @ return is inside or not */ public static boolean isChildOf ( Resource file , Resource dir ) { } }
while ( file != null ) { if ( file . equals ( dir ) ) return true ; file = file . getParentResource ( ) ; } return false ;
public class MessagePattern { /** * Clears this MessagePattern . * countParts ( ) will return 0. */ public void clear ( ) { } }
// Mostly the same as preParse ( ) . if ( isFrozen ( ) ) { throw new UnsupportedOperationException ( "Attempt to clear() a frozen MessagePattern instance." ) ; } msg = null ; hasArgNames = hasArgNumbers = false ; needsAutoQuoting = false ; parts . clear ( ) ; if ( numericValues != null ) { numericValues . clear ( ) ; }
public class SipApplicationDispatcherImpl { /** * { @ inheritDoc } */ public SipContext removeSipApplication ( String sipApplicationName ) { } }
DispatcherFSM . Event ev = fsm . new Event ( DispatcherFSM . EventType . REMOVE_APP ) ; ev . data . put ( APP_NAME , sipApplicationName ) ; fsm . fireEvent ( ev ) ; return ( SipContext ) ev . data . get ( CONTEXT_EV_DATA ) ;
public class GroupHandlerImpl { /** * Read group properties from node . * @ param groupNode * the node where group properties are stored * @ return { @ link Group } * @ throws OrganizationServiceException * if unexpected exception is occurred during reading */ private Group readGroup ( Node groupNode ) throws Exception { } }
String groupName = groupNode . getName ( ) ; String desc = utils . readString ( groupNode , GroupProperties . JOS_DESCRIPTION ) ; String label = utils . readString ( groupNode , GroupProperties . JOS_LABEL ) ; String parentId = utils . getGroupIds ( groupNode ) . parentId ; GroupImpl group = new GroupImpl ( groupName , parentId ) ; group . setInternalId ( groupNode . getUUID ( ) ) ; group . setDescription ( desc ) ; group . setLabel ( label ) ; return group ;
public class InternalXtextParser { /** * InternalXtext . g : 298:1 : entryRuleAbstractRule returns [ EObject current = null ] : iv _ ruleAbstractRule = ruleAbstractRule EOF ; */ public final EObject entryRuleAbstractRule ( ) throws RecognitionException { } }
EObject current = null ; EObject iv_ruleAbstractRule = null ; try { // InternalXtext . g : 298:53 : ( iv _ ruleAbstractRule = ruleAbstractRule EOF ) // InternalXtext . g : 299:2 : iv _ ruleAbstractRule = ruleAbstractRule EOF { newCompositeNode ( grammarAccess . getAbstractRuleRule ( ) ) ; pushFollow ( FollowSets000 . FOLLOW_1 ) ; iv_ruleAbstractRule = ruleAbstractRule ( ) ; state . _fsp -- ; current = iv_ruleAbstractRule ; match ( input , EOF , FollowSets000 . FOLLOW_2 ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ;
public class ABITrace { /** * Test to see if the file is ABI format by checking to see that the first three bytes * are " ABI " . Also handle the special case where 128 bytes were prepended to the file * due to binary FTP from an older macintosh system . * @ return - if format of ABI file is correct */ private boolean isABI ( ) { } }
char ABI [ ] = new char [ 4 ] ; for ( int i = 0 ; i <= 2 ; i ++ ) { ABI [ i ] = ( char ) traceData [ i ] ; } if ( ABI [ 0 ] == 'A' && ( ABI [ 1 ] == 'B' && ABI [ 2 ] == 'I' ) ) { return true ; } else { for ( int i = 128 ; i <= 130 ; i ++ ) { ABI [ i - 128 ] = ( char ) traceData [ i ] ; } if ( ABI [ 0 ] == 'A' && ( ABI [ 1 ] == 'B' && ABI [ 2 ] == 'I' ) ) { macJunk = 128 ; return true ; } else return false ; }
public class DRL6Expressions { /** * src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 205:1 : annotationElementValuePairs [ AnnotationDescr descr , AnnotatedDescrBuilder inDescrBuilder ] : annotationElementValuePair [ descr , inDescrBuilder ] ( COMMA annotationElementValuePair [ descr , inDescrBuilder ] ) * ; */ public final void annotationElementValuePairs ( AnnotationDescr descr , AnnotatedDescrBuilder inDescrBuilder ) throws RecognitionException { } }
try { // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 206:3 : ( annotationElementValuePair [ descr , inDescrBuilder ] ( COMMA annotationElementValuePair [ descr , inDescrBuilder ] ) * ) // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 206:5 : annotationElementValuePair [ descr , inDescrBuilder ] ( COMMA annotationElementValuePair [ descr , inDescrBuilder ] ) * { pushFollow ( FOLLOW_annotationElementValuePair_in_annotationElementValuePairs1013 ) ; annotationElementValuePair ( descr , inDescrBuilder ) ; state . _fsp -- ; if ( state . failed ) return ; // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 206:55 : ( COMMA annotationElementValuePair [ descr , inDescrBuilder ] ) * loop20 : while ( true ) { int alt20 = 2 ; int LA20_0 = input . LA ( 1 ) ; if ( ( LA20_0 == COMMA ) ) { alt20 = 1 ; } switch ( alt20 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 206:57 : COMMA annotationElementValuePair [ descr , inDescrBuilder ] { match ( input , COMMA , FOLLOW_COMMA_in_annotationElementValuePairs1018 ) ; if ( state . failed ) return ; pushFollow ( FOLLOW_annotationElementValuePair_in_annotationElementValuePairs1020 ) ; annotationElementValuePair ( descr , inDescrBuilder ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; default : break loop20 ; } } } } catch ( RecognitionException re ) { throw re ; } finally { // do for sure before leaving }
public class RLogPanel { /** * GEN - LAST : event _ _ saveActionPerformed */ private void _updateActionPerformed ( java . awt . event . ActionEvent evt ) { } }
// GEN - FIRST : event _ _ updateActionPerformed jTextPane1 . setText ( "" ) ; String text = new String ( buffer , 0 , pos ) ; String [ ] lines = text . split ( "\n" ) ; Style style = jTextPane1 . getStyle ( "INFO" ) ; for ( String line : lines ) { if ( line . startsWith ( "o " ) ) { line = line . substring ( 2 ) ; style = jTextPane1 . getStyle ( "OUTPUT" ) ; } else if ( line . startsWith ( "i " ) ) { line = line . substring ( 2 ) ; style = jTextPane1 . getStyle ( "INFO" ) ; } else if ( line . startsWith ( "w " ) ) { line = line . substring ( 2 ) ; style = jTextPane1 . getStyle ( "WARN" ) ; } else if ( line . startsWith ( "e " ) ) { line = line . substring ( 2 ) ; style = jTextPane1 . getStyle ( "ERROR" ) ; } try { jTextPane1 . getDocument ( ) . insertString ( jTextPane1 . getDocument ( ) . getLength ( ) , line + "\n" , style ) ; jTextPane1 . setCaretPosition ( jTextPane1 . getDocument ( ) . getLength ( ) ) ; } catch ( Exception e ) { Log . Err . println ( e . getMessage ( ) ) ; } }
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcBoundingBox ( ) { } }
if ( ifcBoundingBoxEClass == null ) { ifcBoundingBoxEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 55 ) ; } return ifcBoundingBoxEClass ;
public class CmsHistorySettingsDialog { /** * Returns a list with the possible versions to choose from . < p > * @ return a list with the possible versions to choose from */ private List getVersions ( ) { } }
ArrayList ret = new ArrayList ( ) ; int defaultHistoryVersions = OpenCms . getSystemInfo ( ) . getHistoryVersions ( ) ; int historyVersions = 0 ; // Add the option for disabled version history ret . add ( new CmsSelectWidgetOption ( String . valueOf ( - 2 ) , defaultHistoryVersions == - 2 , key ( Messages . GUI_HISTORY_SETTINGS_VERSIONS_DISABLED_0 ) ) ) ; // Iterate from 1 to 50 with a stepping of 1 for the first 10 entries and a stepping of five for the entries from 10 to 50 while ( historyVersions < 50 ) { // increment the history version historyVersions ++ ; if ( ( ( historyVersions % 5 ) == 0 ) || ( historyVersions <= 10 ) ) { boolean defaultValue = defaultHistoryVersions == historyVersions ; ret . add ( new CmsSelectWidgetOption ( String . valueOf ( historyVersions ) , defaultValue , String . valueOf ( historyVersions ) ) ) ; } } // If the default setting for the version history is more than 50 if ( defaultHistoryVersions > historyVersions ) { ret . add ( new CmsSelectWidgetOption ( String . valueOf ( defaultHistoryVersions ) , true , String . valueOf ( defaultHistoryVersions ) ) ) ; } // Add the option for unlimited version history ret . add ( new CmsSelectWidgetOption ( String . valueOf ( - 1 ) , defaultHistoryVersions == - 1 , key ( Messages . GUI_HISTORY_SETTINGS_VERSIONS_UNLIMITED_0 ) ) ) ; return ret ;
public class JHtmlEditor { /** * Free this screen ( and get rid of the reference if this is the help screen ) . */ public void free ( ) { } }
if ( m_taskScheduler != null ) { m_taskScheduler . addTask ( PrivateTaskScheduler . CLEAR_JOBS ) ; m_taskScheduler . addTask ( PrivateTaskScheduler . END_OF_JOBS ) ; m_taskScheduler . free ( ) ; } if ( m_callingApplet != null ) { m_callingApplet . setHelpView ( null ) ; m_callingApplet = null ; } m_taskScheduler = null ; m_helpPane = null ; m_applet = null ;
public class PlayEngine { /** * Send message to output stream and handle exceptions . * @ param message * The message to send . */ private void doPushMessage ( AbstractMessage message ) { } }
if ( log . isTraceEnabled ( ) ) { String msgType = message . getMessageType ( ) ; log . trace ( "doPushMessage: {}" , msgType ) ; } IMessageOutput out = msgOutReference . get ( ) ; if ( out != null ) { try { out . pushMessage ( message ) ; if ( message instanceof RTMPMessage ) { IRTMPEvent body = ( ( RTMPMessage ) message ) . getBody ( ) ; // update the last message sent ' s timestamp lastMessageTs = body . getTimestamp ( ) ; IoBuffer streamData = null ; if ( body instanceof IStreamData && ( streamData = ( ( IStreamData < ? > ) body ) . getData ( ) ) != null ) { bytesSent . addAndGet ( streamData . limit ( ) ) ; } } } catch ( IOException err ) { log . warn ( "Error while pushing message" , err ) ; } } else { log . warn ( "Push message failed due to null output pipe" ) ; }
public class FunctionDef { /** * < pre > * Attributes specific to this function definition . * < / pre > * < code > map & lt ; string , . tensorflow . AttrValue & gt ; attr = 5 ; < / code > */ public java . util . Map < java . lang . String , org . tensorflow . framework . AttrValue > getAttrMap ( ) { } }
return internalGetAttr ( ) . getMap ( ) ;
public class FileSystemUtilities { /** * Acquires the file for a supplied URL , provided that its protocol is is either a file or a jar . * @ param anURL a non - null URL . * @ param encoding The encoding to be used by the URLDecoder to decode the path found . * @ return The File pointing to the supplied URL , for file or jar protocol URLs and null otherwise . */ public static File getFileFor ( final URL anURL , final String encoding ) { } }
// Check sanity Validate . notNull ( anURL , "anURL" ) ; Validate . notNull ( encoding , "encoding" ) ; final String protocol = anURL . getProtocol ( ) ; File toReturn = null ; if ( "file" . equalsIgnoreCase ( protocol ) ) { try { final String decodedPath = URLDecoder . decode ( anURL . getPath ( ) , encoding ) ; toReturn = new File ( decodedPath ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Could not get the File for [" + anURL + "]" , e ) ; } } else if ( "jar" . equalsIgnoreCase ( protocol ) ) { try { // Decode the JAR final String tmp = URLDecoder . decode ( anURL . getFile ( ) , encoding ) ; // JAR URLs generally contain layered protocols , such as : // jar : file : / some / path / to / nazgul - tools - validation - aspect - 4.0.2 . jar ! / the / package / ValidationAspect . class final URL innerURL = new URL ( tmp ) ; // We can handle File protocol URLs here . if ( "file" . equalsIgnoreCase ( innerURL . getProtocol ( ) ) ) { // Peel off the inner protocol final String innerUrlPath = innerURL . getPath ( ) ; final String filePath = innerUrlPath . contains ( "!" ) ? innerUrlPath . substring ( 0 , innerUrlPath . indexOf ( "!" ) ) : innerUrlPath ; toReturn = new File ( URLDecoder . decode ( filePath , encoding ) ) ; } } catch ( Exception e ) { throw new IllegalArgumentException ( "Could not get the File for [" + anURL + "]" , e ) ; } } // All done . return toReturn ;
public class DefaultQueryCache { /** * This tries to reset cursor position of the accumulator to the supplied sequence , * if that sequence is still there , it will be succeeded , otherwise query cache content stays inconsistent . */ private boolean isTryRecoverSucceeded ( ConcurrentMap < Integer , Long > brokenSequences ) { } }
int numberOfBrokenSequences = brokenSequences . size ( ) ; InvokerWrapper invokerWrapper = context . getInvokerWrapper ( ) ; SubscriberContext subscriberContext = context . getSubscriberContext ( ) ; SubscriberContextSupport subscriberContextSupport = subscriberContext . getSubscriberContextSupport ( ) ; List < Future < Object > > futures = new ArrayList < > ( numberOfBrokenSequences ) ; for ( Map . Entry < Integer , Long > entry : brokenSequences . entrySet ( ) ) { Integer partitionId = entry . getKey ( ) ; Long sequence = entry . getValue ( ) ; Object recoveryOperation = subscriberContextSupport . createRecoveryOperation ( mapName , cacheId , sequence , partitionId ) ; Future < Object > future = ( Future < Object > ) invokerWrapper . invokeOnPartitionOwner ( recoveryOperation , partitionId ) ; futures . add ( future ) ; } Collection < Object > results = FutureUtil . returnWithDeadline ( futures , 1 , MINUTES ) ; int successCount = 0 ; for ( Object object : results ) { Boolean resolvedResponse = subscriberContextSupport . resolveResponseForRecoveryOperation ( object ) ; if ( TRUE . equals ( resolvedResponse ) ) { successCount ++ ; } } return successCount == numberOfBrokenSequences ;
public class DataSetDtoConverters { /** * Converts valid JSON string that represents a { @ link IDataSet } to { @ link DataSetDto } . */ static DataSetDto toDataSetDto ( final String json ) { } }
try { return mapper . readValue ( json , DataSetDto . class ) ; } catch ( IOException e ) { throw new CalculationEngineException ( e ) ; }
public class CommercePriceListAccountRelPersistenceImpl { /** * Returns the commerce price list account rels before and after the current commerce price list account rel in the ordered set where uuid = & # 63 ; . * @ param commercePriceListAccountRelId the primary key of the current commerce price list account rel * @ param uuid the uuid * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the previous , current , and next commerce price list account rel * @ throws NoSuchPriceListAccountRelException if a commerce price list account rel with the primary key could not be found */ @ Override public CommercePriceListAccountRel [ ] findByUuid_PrevAndNext ( long commercePriceListAccountRelId , String uuid , OrderByComparator < CommercePriceListAccountRel > orderByComparator ) throws NoSuchPriceListAccountRelException { } }
CommercePriceListAccountRel commercePriceListAccountRel = findByPrimaryKey ( commercePriceListAccountRelId ) ; Session session = null ; try { session = openSession ( ) ; CommercePriceListAccountRel [ ] array = new CommercePriceListAccountRelImpl [ 3 ] ; array [ 0 ] = getByUuid_PrevAndNext ( session , commercePriceListAccountRel , uuid , orderByComparator , true ) ; array [ 1 ] = commercePriceListAccountRel ; array [ 2 ] = getByUuid_PrevAndNext ( session , commercePriceListAccountRel , uuid , orderByComparator , false ) ; return array ; } catch ( Exception e ) { throw processException ( e ) ; } finally { closeSession ( session ) ; }
public class StorageUtil { /** * sets a int value to a XML Element * @ param el Element to set value on it * @ param key key to set * @ param value value to set */ public void setInt ( Element el , String key , int value ) { } }
el . setAttribute ( key , String . valueOf ( value ) ) ;
public class MatrixDrawable { /** * TransformationCallback method * @ param transform */ @ Override public void getTransform ( Matrix transform ) { } }
super . getTransform ( transform ) ; if ( mDrawMatrix != null ) { transform . preConcat ( mDrawMatrix ) ; }
public class AuthorizationCodeAuthenticator { /** * Obtains access token ( and possibly ID token ) from the token endpoint . */ void getTokensFromTokenEndpoint ( ) throws SocialLoginException { } }
try { tokens = getTokensUsingAuthzCode ( ) ; } catch ( Exception e ) { throw createExceptionAndLogMessage ( e , "AUTH_CODE_ERROR_GETTING_TOKENS" , new Object [ ] { socialConfig . getUniqueId ( ) , e . getLocalizedMessage ( ) } ) ; }
public class RIMBeanServerRegistrationUtility { /** * TODO : was package - level originally */ public static < K , V > void registerCacheObject ( AbstractJCache < K , V > cache , ObjectNameType objectNameType ) { } }
// these can change during runtime , so always look it up MBeanServer mBeanServer = cache . getMBeanServer ( ) ; if ( mBeanServer != null ) { ObjectName registeredObjectName = calculateObjectName ( cache , objectNameType ) ; try { if ( objectNameType . equals ( ObjectNameType . CONFIGURATION ) ) { if ( ! isRegistered ( cache , objectNameType ) ) { SecurityActions . registerMBean ( cache . getCacheMXBean ( ) , registeredObjectName , mBeanServer ) ; } } else if ( objectNameType . equals ( ObjectNameType . STATISTICS ) ) { if ( ! isRegistered ( cache , objectNameType ) ) { SecurityActions . registerMBean ( cache . getCacheStatisticsMXBean ( ) , registeredObjectName , mBeanServer ) ; } } } catch ( Exception e ) { throw new CacheException ( "Error registering cache MXBeans for CacheManager " + registeredObjectName + " . Error was " + e . getMessage ( ) , e ) ; } }
public class BigDecimalMathExperimental { /** * variations on exp ( ) */ private static void printSqrtConvergence ( ) { } }
int precision = 10000 ; for ( BigDecimal x : Arrays . asList ( BigDecimal . valueOf ( 2 ) , BigDecimal . valueOf ( 16 ) ) ) { System . out . println ( "Newton sqrt(" + x + ")" ) ; sqrtUsingNewtonPrint ( x , new MathContext ( precision ) ) ; System . out . println ( ) ; System . out . println ( "Newton adaptive sqrt(" + x + ")" ) ; sqrtUsingNewtonAdaptivePrecisionPrint ( x , new MathContext ( precision ) ) ; System . out . println ( ) ; System . out . println ( "Halley sqrt(" + x + ")" ) ; sqrtUsingHalleyPrint ( x , new MathContext ( precision ) ) ; System . out . println ( ) ; }
public class LockFile { /** * Writes the current hearbeat timestamp value to this object ' s lock * file . < p > * @ throws FileSecurityException possibly never ( seek and write are native * methods whose JavaDoc entries do not actually specifiy throwing * < tt > SecurityException < / tt > ) . However , it is conceivable that these * native methods may , in turn , access Java methods that do throw * < tt > SecurityException < / tt > . In this case , a * < tt > SecurityException < / tt > might be thrown if a required system * property value cannot be accessed , or if a security manager exists * and its < tt > { @ link * java . lang . SecurityManager # checkWrite ( java . io . FileDescriptor ) } < / tt > * method denies write access to the file * @ throws UnexpectedEndOfFileException if an end of file exception is * thrown while attepting to write the heartbeat timestamp value to * the target file ( typically , this cannot happen , but the case is * included to distiguish it from the general IOException case ) . * @ throws UnexpectedFileIOException if the current heartbeat timestamp * value cannot be written due to an underlying I / O error */ private final void writeHeartbeat ( ) throws LockFile . FileSecurityException , LockFile . UnexpectedEndOfFileException , LockFile . UnexpectedFileIOException { } }
try { raf . seek ( MAGIC . length ) ; raf . writeLong ( System . currentTimeMillis ( ) ) ; } catch ( SecurityException ex ) { throw new FileSecurityException ( this , "writeHeartbeat" , ex ) ; } catch ( EOFException ex ) { throw new UnexpectedEndOfFileException ( this , "writeHeartbeat" , ex ) ; } catch ( IOException ex ) { throw new UnexpectedFileIOException ( this , "writeHeartbeat" , ex ) ; }
public class Configurable { /** * Returns only properties that start with componentPrefix , removing this prefix . * @ param componentPrefix a prefix to search * @ param properties properties * @ return properties that start with componentPrefix */ protected static Properties getComponentProperties ( String componentPrefix , Properties properties ) { } }
Properties result = new Properties ( ) ; if ( null != componentPrefix ) { int componentPrefixLength = componentPrefix . length ( ) ; for ( String propertyName : properties . stringPropertyNames ( ) ) { if ( propertyName . startsWith ( componentPrefix ) ) { result . put ( propertyName . substring ( componentPrefixLength ) , properties . getProperty ( propertyName ) ) ; } } } return result ;
public class KunderaCriteriaBuilder { /** * ( non - Javadoc ) * @ see * javax . persistence . criteria . CriteriaBuilder # ge ( javax . persistence . criteria * . Expression , java . lang . Number ) */ @ Override public Predicate ge ( Expression < ? extends Number > arg0 , Number arg1 ) { } }
// TODO Auto - generated method stub return new ComparisonPredicate ( arg0 , arg1 , ConditionalOperator . GTE ) ;
public class DelegatingController { /** * Handles the request . * Ask all delegates if they can handle the current request . * The first to answer true is elected as the delegate that will process the request . * If no controller answers true , we redirect to the error page . * @ param request the request to handle * @ param response the response to write to * @ return the model and view object * @ throws Exception if an error occurs during request handling */ @ Override protected ModelAndView handleRequestInternal ( final HttpServletRequest request , final HttpServletResponse response ) throws Exception { } }
for ( val delegate : this . delegates ) { if ( delegate . canHandle ( request , response ) ) { return delegate . handleRequestInternal ( request , response ) ; } } return generateErrorView ( CasProtocolConstants . ERROR_CODE_INVALID_REQUEST , null ) ;
public class Matrix4x3d { /** * Apply a symmetric orthographic projection transformation for a left - handed coordinate system * using the given NDC z range to this matrix and store the result in < code > dest < / code > . * This method is equivalent to calling { @ link # orthoLH ( double , double , double , double , double , double , boolean , Matrix4x3d ) orthoLH ( ) } with * < code > left = - width / 2 < / code > , < code > right = + width / 2 < / code > , < code > bottom = - height / 2 < / code > and < code > top = + height / 2 < / code > . * If < code > M < / code > is < code > this < / code > matrix and < code > O < / code > the orthographic projection matrix , * then the new matrix will be < code > M * O < / code > . So when transforming a * vector < code > v < / code > with the new matrix by using < code > M * O * v < / code > , the * orthographic projection transformation will be applied first ! * In order to set the matrix to a symmetric orthographic projection without post - multiplying it , * use { @ link # setOrthoSymmetricLH ( double , double , double , double , boolean ) setOrthoSymmetricLH ( ) } . * Reference : < a href = " http : / / www . songho . ca / opengl / gl _ projectionmatrix . html # ortho " > http : / / www . songho . ca < / a > * @ see # setOrthoSymmetricLH ( double , double , double , double , boolean ) * @ param width * the distance between the right and left frustum edges * @ param height * the distance between the top and bottom frustum edges * @ param zNear * near clipping plane distance * @ param zFar * far clipping plane distance * @ param dest * will hold the result * @ param zZeroToOne * whether to use Vulkan ' s and Direct3D ' s NDC z range of < code > [ 0 . . + 1 ] < / code > when < code > true < / code > * or whether to use OpenGL ' s NDC z range of < code > [ - 1 . . + 1 ] < / code > when < code > false < / code > * @ return dest */ public Matrix4x3d orthoSymmetricLH ( double width , double height , double zNear , double zFar , boolean zZeroToOne , Matrix4x3d dest ) { } }
// calculate right matrix elements double rm00 = 2.0 / width ; double rm11 = 2.0 / height ; double rm22 = ( zZeroToOne ? 1.0 : 2.0 ) / ( zFar - zNear ) ; double rm32 = ( zZeroToOne ? zNear : ( zFar + zNear ) ) / ( zNear - zFar ) ; // perform optimized multiplication // compute the last column first , because other columns do not depend on it dest . m30 = m20 * rm32 + m30 ; dest . m31 = m21 * rm32 + m31 ; dest . m32 = m22 * rm32 + m32 ; dest . m00 = m00 * rm00 ; dest . m01 = m01 * rm00 ; dest . m02 = m02 * rm00 ; dest . m10 = m10 * rm11 ; dest . m11 = m11 * rm11 ; dest . m12 = m12 * rm11 ; dest . m20 = m20 * rm22 ; dest . m21 = m21 * rm22 ; dest . m22 = m22 * rm22 ; dest . properties = properties & ~ ( PROPERTY_IDENTITY | PROPERTY_TRANSLATION | PROPERTY_ORTHONORMAL ) ; return dest ;
public class DashboardServiceImpl { /** * Takes Dashboard and checks to see if there is an existing Dashboard with the same business service and business application * Throws error if found * @ param dashboard * @ throws HygieiaException */ private void duplicateDashboardErrorCheck ( Dashboard dashboard ) throws HygieiaException { } }
String appName = dashboard . getConfigurationItemBusServName ( ) ; String compName = dashboard . getConfigurationItemBusAppName ( ) ; if ( appName != null && ! appName . isEmpty ( ) && compName != null && ! compName . isEmpty ( ) ) { Dashboard existingDashboard = dashboardRepository . findByConfigurationItemBusServNameIgnoreCaseAndConfigurationItemBusAppNameIgnoreCase ( appName , compName ) ; if ( existingDashboard != null && ! existingDashboard . getId ( ) . equals ( dashboard . getId ( ) ) ) { throw new HygieiaException ( "Existing Dashboard: " + existingDashboard . getTitle ( ) , HygieiaException . DUPLICATE_DATA ) ; } }
public class CFFFontSubset { /** * Function Adds the new LSubrs dicts ( only for the FDs used ) to the list * @ param Font The index of the font * @ param fdPrivateBase The IndexBaseItem array for the linked list * @ param fdSubrs OffsetItem array for the linked list */ void ReconstructPrivateSubrs ( int Font , IndexBaseItem [ ] fdPrivateBase , OffsetItem [ ] fdSubrs ) { } }
// For each private dict for ( int i = 0 ; i < fonts [ Font ] . fdprivateLengths . length ; i ++ ) { // If that private dict ' s Subrs are used insert the new LSubrs // computed earlier if ( fdSubrs [ i ] != null && fonts [ Font ] . PrivateSubrsOffset [ i ] >= 0 ) { OutputList . addLast ( new SubrMarkerItem ( fdSubrs [ i ] , fdPrivateBase [ i ] ) ) ; OutputList . addLast ( new RangeItem ( new RandomAccessFileOrArray ( NewLSubrsIndex [ i ] ) , 0 , NewLSubrsIndex [ i ] . length ) ) ; } }
public class FnFloat { /** * It returns the { @ link String } representation of the target as a currency in the * given { @ link Locale } * @ param locale the { @ link Locale } to be used * @ return the { @ link String } representation of the input as a currency */ public static final Function < Float , String > toCurrencyStr ( Locale locale ) { } }
return ( Function < Float , String > ) ( ( Function ) FnNumber . toCurrencyStr ( locale ) ) ;
public class ObjectMessage { /** * Returns the formatted object message . * @ return the formatted object message . */ @ Override public String getFormattedMessage ( ) { } }
// LOG4J2-763 : cache formatted string in case obj changes later if ( objectString == null ) { objectString = String . valueOf ( obj ) ; } return objectString ;