signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class RuleModelDRLPersistenceImpl { /** * Simple fall - back parser of DRL */ public RuleModel getSimpleRuleModel ( final String drl ) { } }
final RuleModel rm = new RuleModel ( ) ; rm . setPackageName ( PackageNameParser . parsePackageName ( drl ) ) ; rm . setImports ( ImportsParser . parseImports ( drl ) ) ; final Pattern rulePattern = Pattern . compile ( ".*\\s?rule\\s+(.+?)\\s+.*" , Pattern . DOTALL ) ; final Pattern lhsPattern = Pattern . compile ( ".*\\s+when\\s+(.+?)\\s+then.*" , Pattern . DOTALL ) ; final Pattern rhsPattern = Pattern . compile ( ".*\\s+then\\s+(.+?)\\s+end.*" , Pattern . DOTALL ) ; final Matcher ruleMatcher = rulePattern . matcher ( drl ) ; if ( ruleMatcher . matches ( ) ) { String name = ruleMatcher . group ( 1 ) ; if ( name . startsWith ( "\"" ) ) { name = name . substring ( 1 ) ; } if ( name . endsWith ( "\"" ) ) { name = name . substring ( 0 , name . length ( ) - 1 ) ; } rm . name = name ; } final Matcher lhsMatcher = lhsPattern . matcher ( drl ) ; if ( lhsMatcher . matches ( ) ) { final FreeFormLine lhs = new FreeFormLine ( ) ; lhs . setText ( lhsMatcher . group ( 1 ) == null ? "" : lhsMatcher . group ( 1 ) . trim ( ) ) ; rm . addLhsItem ( lhs ) ; } final Matcher rhsMatcher = rhsPattern . matcher ( drl ) ; if ( rhsMatcher . matches ( ) ) { final FreeFormLine rhs = new FreeFormLine ( ) ; rhs . setText ( rhsMatcher . group ( 1 ) == null ? "" : rhsMatcher . group ( 1 ) . trim ( ) ) ; rm . addRhsItem ( rhs ) ; } return rm ;
public class ProtoUtils { /** * Returns a { @ link SoyExpression } for initializing a new proto . * @ param node The proto initialization node * @ param args Args for the proto initialization call * @ param varManager Local variables manager */ static SoyExpression createProto ( ProtoInitNode node , Function < ExprNode , SoyExpression > compilerFunction , Supplier < ? extends ExpressionDetacher > detacher , TemplateVariableManager varManager ) { } }
return new ProtoInitGenerator ( node , compilerFunction , detacher , varManager ) . generate ( ) ;
public class DateTime { /** * 转换字符串为Date * @ param dateStr 日期字符串 * @ param dateFormat { @ link SimpleDateFormat } * @ return { @ link Date } */ private static Date parse ( String dateStr , DateFormat dateFormat ) { } }
try { return dateFormat . parse ( dateStr ) ; } catch ( Exception e ) { String pattern ; if ( dateFormat instanceof SimpleDateFormat ) { pattern = ( ( SimpleDateFormat ) dateFormat ) . toPattern ( ) ; } else { pattern = dateFormat . toString ( ) ; } throw new DateException ( StrUtil . format ( "Parse [{}] with format [{}] error!" , dateStr , pattern ) , e ) ; }
public class Client { /** * Look up an object in the client name space . This looks up an object in the client object name space by its * object ID . * @ param id The object id * @ return The object or null if there is not object for the given ID */ public Resource < ? > getObject ( final int id ) { } }
return ObjectCache . from ( WaylandServerCore . INSTANCE ( ) . wl_client_get_object ( this . pointer , id ) ) ;
public class AgentManager { /** * Retrieves all agents registered at Asterisk server by sending an * AgentsAction . * @ throws ManagerCommunicationException if communication with Asterisk * server fails . */ void initialize ( ) throws ManagerCommunicationException { } }
ResponseEvents re ; re = server . sendEventGeneratingAction ( new AgentsAction ( ) ) ; for ( ManagerEvent event : re . getEvents ( ) ) { if ( event instanceof AgentsEvent ) { logger . info ( event ) ; handleAgentsEvent ( ( AgentsEvent ) event ) ; } }
public class NvdCveUpdater { /** * Downloads the latest NVD CVE XML file from the web and imports it into * the current CVE Database . * @ param updateable a collection of NVD CVE data file references that need * to be downloaded and processed to update the database * @ throws UpdateException is thrown if there is an error updating the * database */ @ SuppressWarnings ( "FutureReturnValueIgnored" ) private void performUpdate ( UpdateableNvdCve updateable ) throws UpdateException { } }
int maxUpdates = 0 ; for ( NvdCveInfo cve : updateable ) { if ( cve . getNeedsUpdate ( ) ) { maxUpdates += 1 ; } } if ( maxUpdates <= 0 ) { return ; } if ( maxUpdates > 3 ) { LOGGER . info ( "NVD CVE requires several updates; this could take a couple of minutes." ) ; } DownloadTask runLast = null ; final Set < Future < Future < ProcessTask > > > downloadFutures = new HashSet < > ( maxUpdates ) ; for ( NvdCveInfo cve : updateable ) { if ( cve . getNeedsUpdate ( ) ) { final DownloadTask call = new DownloadTask ( cve , processingExecutorService , cveDb , settings ) ; if ( call . isModified ( ) ) { runLast = call ; } else { final boolean added = downloadFutures . add ( downloadExecutorService . submit ( call ) ) ; if ( ! added ) { throw new UpdateException ( "Unable to add the download task for " + cve . getId ( ) ) ; } } } } // next , move the future future processTasks to just future processTasks and check for errors . final Set < Future < ProcessTask > > processFutures = new HashSet < > ( maxUpdates ) ; for ( Future < Future < ProcessTask > > future : downloadFutures ) { final Future < ProcessTask > task ; try { task = future . get ( ) ; if ( task != null ) { processFutures . add ( task ) ; } } catch ( InterruptedException ex ) { LOGGER . debug ( "Thread was interrupted during download" , ex ) ; Thread . currentThread ( ) . interrupt ( ) ; throw new UpdateException ( "The download was interrupted" , ex ) ; } catch ( ExecutionException ex ) { LOGGER . debug ( "Thread was interrupted during download execution" , ex ) ; throw new UpdateException ( "The execution of the download was interrupted" , ex ) ; } } for ( Future < ProcessTask > future : processFutures ) { try { final ProcessTask task = future . get ( ) ; if ( task . getException ( ) != null ) { throw task . getException ( ) ; } } catch ( InterruptedException ex ) { LOGGER . debug ( "Thread was interrupted during processing" , ex ) ; Thread . currentThread ( ) . interrupt ( ) ; throw new UpdateException ( ex ) ; } catch ( ExecutionException ex ) { LOGGER . debug ( "Execution Exception during process" , ex ) ; throw new UpdateException ( ex ) ; } } if ( runLast != null ) { final Future < Future < ProcessTask > > modified = downloadExecutorService . submit ( runLast ) ; final Future < ProcessTask > task ; try { task = modified . get ( ) ; final ProcessTask last = task . get ( ) ; if ( last . getException ( ) != null ) { throw last . getException ( ) ; } } catch ( InterruptedException ex ) { LOGGER . debug ( "Thread was interrupted during download" , ex ) ; Thread . currentThread ( ) . interrupt ( ) ; throw new UpdateException ( "The download was interrupted" , ex ) ; } catch ( ExecutionException ex ) { LOGGER . debug ( "Thread was interrupted during download execution" , ex ) ; throw new UpdateException ( "The execution of the download was interrupted" , ex ) ; } } // always true because < = 0 exits early above // if ( maxUpdates > = 1 ) { // ensure the modified file date gets written ( we may not have actually updated it ) dbProperties . save ( updateable . get ( MODIFIED ) ) ; cveDb . cleanupDatabase ( ) ;
public class AlignmentTools { /** * It replaces an optimal alignment of an AFPChain and calculates all the new alignment scores and variables . */ public static AFPChain replaceOptAln ( int [ ] [ ] [ ] newAlgn , AFPChain afpChain , Atom [ ] ca1 , Atom [ ] ca2 ) throws StructureException { } }
// The order is the number of groups in the newAlgn int order = newAlgn . length ; // Calculate the alignment length from all the subunits lengths int [ ] optLens = new int [ order ] ; for ( int s = 0 ; s < order ; s ++ ) { optLens [ s ] = newAlgn [ s ] [ 0 ] . length ; } int optLength = 0 ; for ( int s = 0 ; s < order ; s ++ ) { optLength += optLens [ s ] ; } // Create a copy of the original AFPChain and set everything needed for the structure update AFPChain copyAFP = ( AFPChain ) afpChain . clone ( ) ; // Set the new parameters of the optimal alignment copyAFP . setOptLength ( optLength ) ; copyAFP . setOptLen ( optLens ) ; copyAFP . setOptAln ( newAlgn ) ; // Set the block information of the new alignment copyAFP . setBlockNum ( order ) ; copyAFP . setBlockSize ( optLens ) ; copyAFP . setBlockResList ( newAlgn ) ; copyAFP . setBlockResSize ( optLens ) ; copyAFP . setBlockGap ( calculateBlockGap ( newAlgn ) ) ; // Recalculate properties : superposition , tm - score , etc Atom [ ] ca2clone = StructureTools . cloneAtomArray ( ca2 ) ; // don ' t modify ca2 positions AlignmentTools . updateSuperposition ( copyAFP , ca1 , ca2clone ) ; // It re - does the sequence alignment strings from the OptAlgn information only copyAFP . setAlnsymb ( null ) ; AFPAlignmentDisplay . getAlign ( copyAFP , ca1 , ca2clone ) ; return copyAFP ;
public class MathUtils { /** * This returns the x values of the given vector . * These are assumed to be the even values of the vector . * @ param vector the vector to getFromOrigin the values for * @ return the x values of the given vector */ public static double [ ] xVals ( double [ ] vector ) { } }
if ( vector == null ) return null ; double [ ] x = new double [ vector . length / 2 ] ; int count = 0 ; for ( int i = 0 ; i < vector . length ; i ++ ) { if ( i % 2 != 0 ) x [ count ++ ] = vector [ i ] ; } return x ;
public class CmsRole { /** * Returns the role for the given group name . < p > * @ param groupName a group name to check for role representation * @ return the role for the given group name */ public static CmsRole valueOfGroupName ( String groupName ) { } }
String groupOu = CmsOrganizationalUnit . getParentFqn ( groupName ) ; Iterator < CmsRole > it = SYSTEM_ROLES . iterator ( ) ; while ( it . hasNext ( ) ) { CmsRole role = it . next ( ) ; // direct check if ( groupName . equals ( role . getGroupName ( ) ) ) { return role . forOrgUnit ( groupOu ) ; } if ( ! role . isOrganizationalUnitIndependent ( ) ) { // the role group name does not start with " / " , but the given group fqn does if ( groupName . endsWith ( CmsOrganizationalUnit . SEPARATOR + role . getGroupName ( ) ) ) { return role . forOrgUnit ( groupOu ) ; } } } return null ;
public class MulticastPublisherReader { private void accept ( final SelectionKey key ) throws IOException { } }
final ServerSocketChannel serverChannel = ( ServerSocketChannel ) key . channel ( ) ; if ( serverChannel . isOpen ( ) ) { final SocketChannel clientChannel = serverChannel . accept ( ) ; clientChannel . configureBlocking ( false ) ; final SelectionKey clientChannelKey = clientChannel . register ( selector , SelectionKey . OP_READ ) ; clientChannelKey . attach ( new RawMessageBuilder ( messageBuffer . capacity ( ) ) ) ; }
public class ChunkAnnotationUtils { /** * Give an list of character offsets for chunk , fix sentence splitting * so sentences doesn ' t break the chunks * @ param docAnnotation Document with sentences * @ param chunkCharOffsets ordered pairs of different chunks that should appear in sentences * @ return true if fix was okay ( chunks are in all sentences ) , false otherwise */ public static boolean fixChunkSentenceBoundaries ( CoreMap docAnnotation , List < IntPair > chunkCharOffsets ) { } }
return fixChunkSentenceBoundaries ( docAnnotation , chunkCharOffsets , false , false , false ) ;
public class GeometryIndexDao { /** * Query by table name * @ param tableName * table name * @ return geometry indices */ public List < GeometryIndex > queryForTableName ( String tableName ) { } }
List < GeometryIndex > results = null ; try { results = queryForEq ( GeometryIndex . COLUMN_TABLE_NAME , tableName ) ; } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to query for Geometry Index objects by Table Name: " + tableName ) ; } return results ;
public class WriteFileExtensions { /** * The Method string2File ( ) writes a String to the file . * @ param string2write * The String to write into the file . * @ param nameOfFile * The path to the file and name from the file from where we want to write the * String . * @ throws IOException * Signals that an I / O exception has occurred . */ public static void string2File ( final String string2write , final String nameOfFile ) throws IOException { } }
try ( BufferedWriter bufferedWriter = new BufferedWriter ( new FileWriter ( nameOfFile ) ) ) { bufferedWriter . write ( string2write ) ; bufferedWriter . flush ( ) ; }
public class Handler { /** * Build " handlerListById " and " reqTypeMatcherMap " from the paths in the config . */ static void initPaths ( ) { } }
if ( config != null && config . getPaths ( ) != null ) { for ( PathChain pathChain : config . getPaths ( ) ) { pathChain . validate ( configName + " config" ) ; // raises exception on misconfiguration if ( pathChain . getPath ( ) == null ) { addSourceChain ( pathChain ) ; } else { addPathChain ( pathChain ) ; } } }
public class CategoryGraph { /** * This parameter is already set in the constructor as it is needed for computation of relatedness values . * Therefore its computation does not trigger setGraphParameters ( it is too slow ) , even if the depth is implicitly determined there , too . * @ return The depth of the category graph , i . e . the maximum path length starting with the root node . * @ throws WikiApiException Thrown if errors occurred . */ public double getDepth ( ) throws WikiApiException { } }
if ( depth < 0 ) { // has not been initialized if ( rootPathMap != null ) { this . depth = getDepthFromRootPathMap ( ) ; logger . info ( "Getting depth from RootPathMap: " + this . depth ) ; } else { depth = computeDepth ( ) ; logger . info ( "Computing depth of the hierarchy: " + this . depth ) ; } } return depth ;
public class ActionExecutionDetailMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ActionExecutionDetail actionExecutionDetail , ProtocolMarshaller protocolMarshaller ) { } }
if ( actionExecutionDetail == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( actionExecutionDetail . getPipelineExecutionId ( ) , PIPELINEEXECUTIONID_BINDING ) ; protocolMarshaller . marshall ( actionExecutionDetail . getActionExecutionId ( ) , ACTIONEXECUTIONID_BINDING ) ; protocolMarshaller . marshall ( actionExecutionDetail . getPipelineVersion ( ) , PIPELINEVERSION_BINDING ) ; protocolMarshaller . marshall ( actionExecutionDetail . getStageName ( ) , STAGENAME_BINDING ) ; protocolMarshaller . marshall ( actionExecutionDetail . getActionName ( ) , ACTIONNAME_BINDING ) ; protocolMarshaller . marshall ( actionExecutionDetail . getStartTime ( ) , STARTTIME_BINDING ) ; protocolMarshaller . marshall ( actionExecutionDetail . getLastUpdateTime ( ) , LASTUPDATETIME_BINDING ) ; protocolMarshaller . marshall ( actionExecutionDetail . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( actionExecutionDetail . getInput ( ) , INPUT_BINDING ) ; protocolMarshaller . marshall ( actionExecutionDetail . getOutput ( ) , OUTPUT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CompoundElementImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EList < AbstractElement > getElements ( ) { } }
if ( elements == null ) { elements = new EObjectContainmentEList < AbstractElement > ( AbstractElement . class , this , XtextPackage . COMPOUND_ELEMENT__ELEMENTS ) ; } return elements ;
public class PopupIndicator { /** * I ' m NOT completely sure how all this bitwise things work . . . * @ param curFlags Cur Flags * @ return Flags */ private int computeFlags ( int curFlags ) { } }
curFlags &= ~ ( WindowManager . LayoutParams . FLAG_IGNORE_CHEEK_PRESSES | WindowManager . LayoutParams . FLAG_NOT_FOCUSABLE | WindowManager . LayoutParams . FLAG_NOT_TOUCHABLE | WindowManager . LayoutParams . FLAG_WATCH_OUTSIDE_TOUCH | WindowManager . LayoutParams . FLAG_LAYOUT_NO_LIMITS | WindowManager . LayoutParams . FLAG_ALT_FOCUSABLE_IM ) ; curFlags |= WindowManager . LayoutParams . FLAG_IGNORE_CHEEK_PRESSES ; curFlags |= WindowManager . LayoutParams . FLAG_NOT_FOCUSABLE ; curFlags |= WindowManager . LayoutParams . FLAG_NOT_TOUCHABLE ; curFlags |= WindowManager . LayoutParams . FLAG_LAYOUT_NO_LIMITS ; return curFlags ;
public class NotesApi { /** * Gets a Stream of all notes for a single merge request . * < pre > < code > GitLab Endpoint : GET / projects / : id / merge _ requests / : merge _ request _ iid / notes < / code > < / pre > * @ param projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance * @ param mergeRequestIid the issue ID to get the notes for * @ param sortOrder return merge request notes sorted in the specified sort order , default is DESC * @ param orderBy return merge request notes ordered by CREATED _ AT or UPDATED _ AT , default is CREATED _ AT * @ return a Stream of the merge request ' s notes * @ throws GitLabApiException if any exception occurs */ public Stream < Note > getMergeRequestNotesStream ( Object projectIdOrPath , Integer mergeRequestIid , SortOrder sortOrder , Note . OrderBy orderBy ) throws GitLabApiException { } }
return ( getMergeRequestNotes ( projectIdOrPath , mergeRequestIid , sortOrder , orderBy , getDefaultPerPage ( ) ) . stream ( ) ) ;
public class CPDefinitionSpecificationOptionValueWrapper { /** * Returns the localized value of this cp definition specification option value in the language . Uses the default language if no localization exists for the requested language . * @ param locale the locale of the language * @ return the localized value of this cp definition specification option value */ @ Override public String getValue ( java . util . Locale locale ) { } }
return _cpDefinitionSpecificationOptionValue . getValue ( locale ) ;
public class JSPtoPRealization { /** * Method registerDestination . * < p > Register the destination vith WLM via TRM < / p > * System destinations and Temporary destinations are not registered * with WLM . The destinations themselves have their own addressing * mechanisms . */ @ Override public void registerDestination ( boolean hasLocal , boolean isDeleted ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "registerDestination" , new Object [ ] { Boolean . valueOf ( hasLocal ) , Boolean . valueOf ( isDeleted ) , this } ) ; // Dont register temporary destinations or system destinations . if ( ! _baseDestinationHandler . isTemporary ( ) && ! _baseDestinationHandler . isSystem ( ) ) { if ( _pToPLocalMsgsItemStream != null && ! ( _pToPLocalMsgsItemStream instanceof MQLinkMessageItemStream ) ) _localisationManager . registerDestination ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "registerDestination" ) ;
public class VersionParser { /** * This method try to determine the version number of an operating system of a < i > BSD < / i > platform more accurately . * @ param userAgent * user agent string * @ return more accurately identified version number or { @ code null } */ static VersionNumber identifyBSDVersion ( final String userAgent ) { } }
VersionNumber version = VersionNumber . UNKNOWN ; final Pattern pattern = Pattern . compile ( "\\w+bsd\\s?((\\d+)((\\.\\d+)+)?((\\-|_)[\\w\\d\\-]+)?)" , Pattern . CASE_INSENSITIVE ) ; final Matcher m = pattern . matcher ( userAgent ) ; if ( m . find ( ) ) { version = parseFirstVersionNumber ( m . group ( MAJOR_INDEX ) ) ; } return version ;
public class BounceProxySystemPropertyLoader { /** * Loads all properties for the bounce proxy that have to be set as system * properties ( see * { @ link BounceProxyPropertyKeys # bounceProxySystemPropertyKeys } ) or in the * file { @ value # CONTROLLED _ BOUNCE _ PROXY _ SYSTEM _ PROPERTIES } . System * properties have precedence over the file . * @ return * all properties for the bounce proxy that have to be set as * system properties * @ throws JoynrRuntimeException * if not all of the properties were set so that bounce proxy * won ' t be able to start up correctly */ public static Properties loadProperties ( ) { } }
Properties properties = new Properties ( ) ; for ( String key : BounceProxyPropertyKeys . getPropertyKeysForSystemProperties ( ) ) { String value = System . getProperty ( key ) ; if ( value == null ) { value = loadPropertyFromFile ( key ) ; if ( value == null ) { throw new JoynrRuntimeException ( "No value for system property '" + key + "' set. Unable to start Bounce Proxy" ) ; } } properties . put ( key , value ) ; } return properties ;
public class Strings { /** * JavaScript - unescapes all the elements in the target array . * @ param target the array of Strings to be unescaped . * If non - String objects , toString ( ) will be called . * @ return a String [ ] with the result of each * each element of the target . * @ since 2.0.11 */ public String [ ] arrayUnescapeJavaScript ( final Object [ ] target ) { } }
if ( target == null ) { return null ; } final String [ ] result = new String [ target . length ] ; for ( int i = 0 ; i < target . length ; i ++ ) { result [ i ] = unescapeJavaScript ( target [ i ] ) ; } return result ;
public class ObjectFactory { /** * Create an instance of { @ link Project . Storepoints . Storepoint . Activities . Activity . CodeAssignment } */ public Project . Storepoints . Storepoint . Activities . Activity . CodeAssignment createProjectStorepointsStorepointActivitiesActivityCodeAssignment ( ) { } }
return new Project . Storepoints . Storepoint . Activities . Activity . CodeAssignment ( ) ;
public class JaxRsClientFactory { /** * Register many features at once . Mostly a convenience for DI environments . */ public synchronized JaxRsClientFactory addFeatureMap ( Map < JaxRsFeatureGroup , Set < Feature > > map ) { } }
map . forEach ( ( g , fs ) -> fs . forEach ( f -> addFeatureToGroup ( g , f ) ) ) ; return this ;
public class TreeScanner { /** * { @ inheritDoc } This implementation scans the children in left to right order . * @ param node { @ inheritDoc } * @ param p { @ inheritDoc } * @ return the result of scanning */ @ Override public R visitParenthesized ( ParenthesizedTree node , P p ) { } }
return scan ( node . getExpression ( ) , p ) ;
public class EnumRule { /** * Applies this schema rule to take the required code generation steps . * A Java { @ link Enum } is created , with constants for each of the enum * values present in the schema . The enum name is derived from the nodeName , * and the enum type itself is created as an inner class of the owning type . * In the rare case that no owning type exists ( the enum is the root of the * schema ) , then the enum becomes a public class in its own right . * The actual JSON value for each enum constant is held in a property called * " value " in the generated type . A static factory method * < code > fromValue ( String ) < / code > is added to the generated enum , and the * methods are annotated to allow Jackson to marshal / unmarshal values * correctly . * @ param nodeName * the name of the property which is an " enum " * @ param node * the enum node * @ param parent * the parent node * @ param container * the class container ( class or package ) to which this enum * should be added * @ return the newly generated Java type that was created to represent the * given enum */ @ Override public JType apply ( String nodeName , JsonNode node , JsonNode parent , JClassContainer container , Schema schema ) { } }
JDefinedClass _enum ; try { _enum = createEnum ( node , nodeName , container ) ; } catch ( ClassAlreadyExistsException e ) { return e . getExistingClass ( ) ; } schema . setJavaTypeIfEmpty ( _enum ) ; if ( node . has ( "javaInterfaces" ) ) { addInterfaces ( _enum , node . get ( "javaInterfaces" ) ) ; } // copy our node ; remove the javaType as it will throw off the TypeRule for our case ObjectNode typeNode = ( ObjectNode ) node . deepCopy ( ) ; typeNode . remove ( "javaType" ) ; // If type is specified on the enum , get a type rule for it . Otherwise , we ' re a string . // ( This is different from the default of Object , which is why we don ' t do this for every case . ) JType backingType = node . has ( "type" ) ? ruleFactory . getTypeRule ( ) . apply ( nodeName , typeNode , parent , container , schema ) : container . owner ( ) . ref ( String . class ) ; JFieldVar valueField = addValueField ( _enum , backingType ) ; // override toString only if we have a sensible string to return if ( isString ( backingType ) ) { addToString ( _enum , valueField ) ; } addValueMethod ( _enum , valueField ) ; addEnumConstants ( node . path ( "enum" ) , _enum , node . path ( "javaEnumNames" ) , backingType ) ; addFactoryMethod ( _enum , backingType ) ; return _enum ;
public class DDPStateSingleton { /** * Gets current Meteor user info * @ return user Info or null if not logged in */ public Map < String , Object > getUser ( ) { } }
Map < String , Object > userFields = DDPStateSingleton . getInstance ( ) . getDocument ( "users" , getUserId ( ) ) ; if ( userFields != null ) { return userFields ; } return null ;
public class TransactionManager { /** * rollback the row actions from start index in list and * the given timestamp */ void rollbackPartial ( Session session , int start , long timestamp ) { } }
Object [ ] list = session . rowActionList . getArray ( ) ; int limit = session . rowActionList . size ( ) ; if ( start == limit ) { return ; } for ( int i = start ; i < limit ; i ++ ) { RowAction action = ( RowAction ) list [ i ] ; if ( action != null ) { action . rollback ( session , timestamp ) ; } else { System . out . println ( "null action in rollback " + start ) ; } } // rolled back transactions can always be merged as they have never been // seen by other sessions mergeRolledBackTransaction ( session . rowActionList . getArray ( ) , start , limit ) ; rowActionMapRemoveTransaction ( session . rowActionList . getArray ( ) , start , limit , false ) ; session . rowActionList . setSize ( start ) ;
public class Helpers { /** * Send a mail message using a JNDI resource . < br > * As JNDI resource providers are inside the EXT class loader , this uses reflection . This method is basically a bonus on top of the * MailSessionFactory offered to payloads , making it accessible also to the engine . * @ param to * @ param subject * @ param body * @ param mailSessionJndiAlias * @ throws MessagingException */ @ SuppressWarnings ( { } }
"unchecked" , "rawtypes" } ) static void sendMessage ( String to , String subject , String body , String mailSessionJndiAlias ) { jqmlogger . debug ( "sending mail to " + to + " - subject is " + subject ) ; ClassLoader extLoader = getExtClassLoader ( ) ; extLoader = extLoader == null ? Helpers . class . getClassLoader ( ) : extLoader ; ClassLoader old = Thread . currentThread ( ) . getContextClassLoader ( ) ; Object mailSession = null ; try { mailSession = InitialContext . doLookup ( mailSessionJndiAlias ) ; } catch ( NamingException e ) { throw new JqmRuntimeException ( "could not find mail session description" , e ) ; } try { Thread . currentThread ( ) . setContextClassLoader ( extLoader ) ; Class transportZ = extLoader . loadClass ( "javax.mail.Transport" ) ; Class sessionZ = extLoader . loadClass ( "javax.mail.Session" ) ; Class mimeMessageZ = extLoader . loadClass ( "javax.mail.internet.MimeMessage" ) ; Class messageZ = extLoader . loadClass ( "javax.mail.Message" ) ; Class recipientTypeZ = extLoader . loadClass ( "javax.mail.Message$RecipientType" ) ; Object msg = mimeMessageZ . getConstructor ( sessionZ ) . newInstance ( mailSession ) ; mimeMessageZ . getMethod ( "setRecipients" , recipientTypeZ , String . class ) . invoke ( msg , recipientTypeZ . getField ( "TO" ) . get ( null ) , to ) ; mimeMessageZ . getMethod ( "setSubject" , String . class ) . invoke ( msg , subject ) ; mimeMessageZ . getMethod ( "setText" , String . class ) . invoke ( msg , body ) ; transportZ . getMethod ( "send" , messageZ ) . invoke ( null , msg ) ; jqmlogger . trace ( "Mail was sent" ) ; } catch ( Exception e ) { throw new JqmRuntimeException ( "an exception occurred during mail sending" , e ) ; } finally { Thread . currentThread ( ) . setContextClassLoader ( old ) ; }
public class nsip6 { /** * Use this API to fetch filtered set of nsip6 resources . * filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */ public static nsip6 [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } }
nsip6 obj = new nsip6 ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; nsip6 [ ] response = ( nsip6 [ ] ) obj . getfiltered ( service , option ) ; return response ;
public class CPRuleAssetCategoryRelLocalServiceUtil { /** * Updates the cp rule asset category rel in the database or adds it if it does not yet exist . Also notifies the appropriate model listeners . * @ param cpRuleAssetCategoryRel the cp rule asset category rel * @ return the cp rule asset category rel that was updated */ public static com . liferay . commerce . product . model . CPRuleAssetCategoryRel updateCPRuleAssetCategoryRel ( com . liferay . commerce . product . model . CPRuleAssetCategoryRel cpRuleAssetCategoryRel ) { } }
return getService ( ) . updateCPRuleAssetCategoryRel ( cpRuleAssetCategoryRel ) ;
public class FSDirectory { /** * Block until the object is ready to be used . */ void waitForReady ( ) { } }
if ( ! ready ) { writeLock ( ) ; try { while ( ! ready ) { try { cond . await ( 5000 , TimeUnit . MILLISECONDS ) ; } catch ( InterruptedException ie ) { } } } finally { writeUnlock ( ) ; } }
public class JavaScriptEscape { /** * Perform a ( configurable ) JavaScript < strong > escape < / strong > operation on a < tt > String < / tt > input . * This method will perform an escape operation according to the specified * { @ link org . unbescape . javascript . JavaScriptEscapeType } and * { @ link org . unbescape . javascript . JavaScriptEscapeLevel } argument values . * All other < tt > String < / tt > - based < tt > escapeJavaScript * ( . . . ) < / tt > methods call this one with preconfigured * < tt > type < / tt > and < tt > level < / tt > values . * This method is < strong > thread - safe < / strong > . * @ param text the < tt > String < / tt > to be escaped . * @ param type the type of escape operation to be performed , see * { @ link org . unbescape . javascript . JavaScriptEscapeType } . * @ param level the escape level to be applied , see { @ link org . unbescape . javascript . JavaScriptEscapeLevel } . * @ return The escaped result < tt > String < / tt > . As a memory - performance improvement , will return the exact * same object as the < tt > text < / tt > input argument if no escaping modifications were required ( and * no additional < tt > String < / tt > objects will be created during processing ) . Will * return < tt > null < / tt > if input is < tt > null < / tt > . */ public static String escapeJavaScript ( final String text , final JavaScriptEscapeType type , final JavaScriptEscapeLevel level ) { } }
if ( type == null ) { throw new IllegalArgumentException ( "The 'type' argument cannot be null" ) ; } if ( level == null ) { throw new IllegalArgumentException ( "The 'level' argument cannot be null" ) ; } return JavaScriptEscapeUtil . escape ( text , type , level ) ;
public class JobGetHeaders { /** * Set the time at which the resource was last modified . * @ param lastModified the lastModified value to set * @ return the JobGetHeaders object itself . */ public JobGetHeaders withLastModified ( DateTime lastModified ) { } }
if ( lastModified == null ) { this . lastModified = null ; } else { this . lastModified = new DateTimeRfc1123 ( lastModified ) ; } return this ;
public class Altimeter { /** * < editor - fold defaultstate = " collapsed " desc = " Misc " > */ private void calcAngleStep ( ) { } }
this . angleStep100ft = ( 2 * Math . PI ) / ( getMaxValue ( ) - getMinValue ( ) ) ; this . angleStep1000ft = angleStep100ft / 10.0 ; this . angleStep10000ft = angleStep1000ft / 10.0 ;
public class AutoConfig { /** * Make zero - config logback logging honor mdw . logging . level in mdw . yaml . */ private static void initializeLogging ( ) { } }
try { String mdwLogLevel = LoggerUtil . initializeLogging ( ) ; if ( mdwLogLevel != null ) { LoggerContext loggerContext = ( LoggerContext ) LoggerFactory . getILoggerFactory ( ) ; loggerContext . getLogger ( "com.centurylink.mdw" ) . setLevel ( Level . toLevel ( mdwLogLevel . toLowerCase ( ) ) ) ; } } catch ( IOException ex ) { ex . printStackTrace ( ) ; }
public class Services { /** * Get the service name of a subdeployment . * @ param parent the parent deployment name * @ param name the subdeployment name * @ return the service name */ public static ServiceName deploymentUnitName ( String parent , String name ) { } }
return JBOSS_DEPLOYMENT_SUB_UNIT . append ( parent , name ) ;
public class ElasticNetworkInterfaceBinder { /** * Binds an ENI to the instance . * The candidate ENI ' s are deduced in the same wa the EIP binder works : Via dns records or via service urls , * depending on configuration . * It will try to attach the first ENI that is : * Available * For this subnet * In the list of candidate ENI ' s * @ throws MalformedURLException */ public void bind ( ) throws MalformedURLException { } }
InstanceInfo myInfo = ApplicationInfoManager . getInstance ( ) . getInfo ( ) ; String myInstanceId = ( ( AmazonInfo ) myInfo . getDataCenterInfo ( ) ) . get ( AmazonInfo . MetaDataKey . instanceId ) ; String myZone = ( ( AmazonInfo ) myInfo . getDataCenterInfo ( ) ) . get ( AmazonInfo . MetaDataKey . availabilityZone ) ; final List < String > ips = getCandidateIps ( ) ; Ordering < NetworkInterface > ipsOrder = Ordering . natural ( ) . onResultOf ( new Function < NetworkInterface , Integer > ( ) { public Integer apply ( NetworkInterface networkInterface ) { return ips . indexOf ( networkInterface . getPrivateIpAddress ( ) ) ; } } ) ; AmazonEC2 ec2Service = getEC2Service ( ) ; String subnetId = instanceData ( myInstanceId , ec2Service ) . getSubnetId ( ) ; DescribeNetworkInterfacesResult result = ec2Service . describeNetworkInterfaces ( new DescribeNetworkInterfacesRequest ( ) . withFilters ( new Filter ( "private-ip-address" , ips ) ) . withFilters ( new Filter ( "status" , Lists . newArrayList ( "available" ) ) ) . withFilters ( new Filter ( "subnet-id" , Lists . newArrayList ( subnetId ) ) ) ) ; if ( result . getNetworkInterfaces ( ) . isEmpty ( ) ) { logger . info ( "No ip is free to be associated with this instance. Candidate ips are: {} for zone: {}" , ips , myZone ) ; } else { NetworkInterface selected = ipsOrder . min ( result . getNetworkInterfaces ( ) ) ; ec2Service . attachNetworkInterface ( new AttachNetworkInterfaceRequest ( ) . withNetworkInterfaceId ( selected . getNetworkInterfaceId ( ) ) . withDeviceIndex ( 1 ) . withInstanceId ( myInstanceId ) ) ; }
public class JvmIntAnnotationValueImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case TypesPackage . JVM_INT_ANNOTATION_VALUE__VALUES : getValues ( ) . clear ( ) ; return ; } super . eUnset ( featureID ) ;
public class SliceUtf8 { /** * This function is an exact duplicate of lastNonWhitespacePosition ( Slice , int ) except for one line . */ private static int lastNonMatchPosition ( Slice utf8 , int minPosition , int [ ] codePointsToMatch ) { } }
int position = utf8 . length ( ) ; while ( position > minPosition ) { // decode the code point before position if possible int codePoint ; int codePointLength ; byte unsignedByte = utf8 . getByte ( position - 1 ) ; if ( ! isContinuationByte ( unsignedByte ) ) { codePoint = unsignedByte & 0xFF ; codePointLength = 1 ; } else if ( minPosition <= position - 2 && ! isContinuationByte ( utf8 . getByte ( position - 2 ) ) ) { codePoint = tryGetCodePointAt ( utf8 , position - 2 ) ; codePointLength = 2 ; } else if ( minPosition <= position - 3 && ! isContinuationByte ( utf8 . getByte ( position - 3 ) ) ) { codePoint = tryGetCodePointAt ( utf8 , position - 3 ) ; codePointLength = 3 ; } else if ( minPosition <= position - 4 && ! isContinuationByte ( utf8 . getByte ( position - 4 ) ) ) { codePoint = tryGetCodePointAt ( utf8 , position - 4 ) ; codePointLength = 4 ; } else { break ; } if ( codePoint < 0 || codePointLength != lengthOfCodePoint ( codePoint ) ) { break ; } if ( ! matches ( codePoint , codePointsToMatch ) ) { break ; } position -= codePointLength ; } return position ;
public class IdentityMatMulStart { /** * Perform a simple vector multiplication on Vortex . */ @ Override public void start ( final VortexThreadPool vortexThreadPool ) { } }
final List < Matrix < Double > > leftSplits = generateMatrixSplits ( numRows , numColumns , divideFactor ) ; final Matrix < Double > right = generateIdentityMatrix ( numColumns ) ; // Measure job finish time starting from here . . final double start = System . currentTimeMillis ( ) ; // Define callback that is invoked when Tasklets finish . final CountDownLatch latch = new CountDownLatch ( divideFactor ) ; final FutureCallback < MatMulOutput > callback = new FutureCallback < MatMulOutput > ( ) { @ Override public void onSuccess ( final MatMulOutput output ) { final int index = output . getIndex ( ) ; final Matrix < Double > result = output . getResult ( ) ; // Compare the result from the original matrix . if ( result . equals ( leftSplits . get ( index ) ) ) { latch . countDown ( ) ; } else { throw new RuntimeException ( index + " th result is not correct." ) ; } } @ Override public void onFailure ( final Throwable t ) { throw new RuntimeException ( t ) ; } } ; // Submit Tasklets and register callback . final MatMulFunction matMulFunction = new MatMulFunction ( ) ; for ( int i = 0 ; i < divideFactor ; i ++ ) { vortexThreadPool . submit ( matMulFunction , new MatMulInput ( i , leftSplits . get ( i ) , right ) , callback ) ; } try { // Wait until all Tasklets finish . latch . await ( ) ; LOG . log ( Level . INFO , "Job Finish Time: " + ( System . currentTimeMillis ( ) - start ) ) ; } catch ( final InterruptedException e ) { throw new RuntimeException ( e ) ; }
public class CommonsMultipartFormDataParserFactory { /** * Creates a new MultipartFormDataParser object . * @ return the multipart form data parser */ public MultipartFormDataParser createMultipartFormDataParser ( ) { } }
MultipartFormDataParser parser = new CommonsMultipartFormDataParser ( ) ; if ( tempDirectoryPath != null ) { parser . setTempDirectoryPath ( tempDirectoryPath ) ; } else { parser . setTempDirectoryPath ( SystemUtils . getProperty ( "java.io.tmpdir" ) ) ; } if ( maxRequestSize > - 1L ) { parser . setMaxRequestSize ( maxRequestSize ) ; } if ( maxFileSize > - 1L ) { parser . setMaxFileSize ( maxFileSize ) ; } if ( maxInMemorySize > - 1 ) { parser . setMaxInMemorySize ( maxInMemorySize ) ; } parser . setAllowedFileExtensions ( allowedFileExtensions ) ; parser . setDeniedFileExtensions ( deniedFileExtensions ) ; return parser ;
public class CommerceShippingMethodLocalServiceBaseImpl { /** * Updates the commerce shipping method in the database or adds it if it does not yet exist . Also notifies the appropriate model listeners . * @ param commerceShippingMethod the commerce shipping method * @ return the commerce shipping method that was updated */ @ Indexable ( type = IndexableType . REINDEX ) @ Override public CommerceShippingMethod updateCommerceShippingMethod ( CommerceShippingMethod commerceShippingMethod ) { } }
return commerceShippingMethodPersistence . update ( commerceShippingMethod ) ;
public class URIUtils { /** * Hashes a string for a URI hash , while ignoring the case . * @ param hash the input hash * @ param s the string to hash and combine with the input hash * @ return the resulting hash */ public static int hashIgnoreCase ( int hash , String s ) { } }
if ( s == null ) { return hash ; } int length = s . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { hash = 31 * hash + URIUtils . toLower ( s . charAt ( i ) ) ; } return hash ;
public class ST_Reverse { /** * Returns the MultiPoint with vertex order reversed . We do our own * implementation here because JTS does not handle it . * @ param mp MultiPoint * @ return MultiPoint with vertex order reversed */ public static Geometry reverseMultiPoint ( MultiPoint mp ) { } }
int nPoints = mp . getNumGeometries ( ) ; Point [ ] revPoints = new Point [ nPoints ] ; for ( int i = 0 ; i < nPoints ; i ++ ) { revPoints [ nPoints - 1 - i ] = ( Point ) mp . getGeometryN ( i ) . reverse ( ) ; } return mp . getFactory ( ) . createMultiPoint ( revPoints ) ;
public class DirectoryBasedOverlayContainerImpl { /** * Clones an ArtifactEntry to the overlay directory , by reading the data from the ArtifactEntry , and writing * it to the directory at the requested path , or converting it to a ArtifactContainer and processing * the entries recursively . < br > * Entries that convert to ArtifactContainers that claim to be isRoot true , are not processed recursively . * @ param e The ArtifactEntry to add * @ param path The path to add the ArtifactEntry at * @ param addAsRoot If the ArtifactEntry converts to a ArtifactContainer , should the isRoot be overridden ? null = no , non - null = override value * @ return true if the ArtifactEntry added successfully * @ throws IOException if error occurred during reading of the streams . */ private synchronized boolean cloneEntryToOverlay ( ArtifactEntry e , String path , Boolean addAsRoot ) throws IOException { } }
// validate the ArtifactEntry . . InputStream i = null ; ArtifactContainer c = null ; try { i = e . getInputStream ( ) ; c = e . convertToContainer ( ) ; if ( i == null && c == null ) { return false ; // reject nonsense entries with no data & no ArtifactContainer . } if ( i == null && c != null ) { boolean root = addAsRoot != null ? addAsRoot . booleanValue ( ) : c . isRoot ( ) ; if ( root ) return false ; // reject ArtifactContainers with no data that wish to be a new root . } if ( i != null ) { File f = new File ( overlayDirectory , path ) ; // make a dir to put it in if there isnt one yet . . File parent = f . getParentFile ( ) ; if ( ! FileUtils . fileExists ( parent ) ) { // might not be able to add this , if there ' s a file already clashing where we need a dir . if ( ! FileUtils . fileMkDirs ( parent ) ) return false ; } FileOutputStream fos = null ; try { // set false to overwrite if its already there . . fos = Utils . getOutputStream ( f , false ) ; // wrap it up in an attempt to ensure it ' s got some buffering . i = new BufferedInputStream ( i ) ; // rip out the data & spew it to the file . byte buf [ ] = new byte [ 1024 ] ; int len ; while ( ( len = i . read ( buf ) ) > 0 ) { fos . write ( buf , 0 , len ) ; } fos . close ( ) ; } finally { if ( fos != null ) { fos . close ( ) ; } } } else { // can ' t obtain inputstream . . is this convertible ? ? if ( c != null ) { for ( ArtifactEntry nested : c ) { // we don ' t use the boolean root , as the override only applies for the 1st conversion . // where it prevents us adding c . isRoot when we are told not to care . cloneEntryToOverlay ( nested , path + "/" + nested . getName ( ) , c . isRoot ( ) ) ; } } } } finally { if ( i != null ) { try { i . close ( ) ; } catch ( IOException e1 ) { } } } return true ;
public class BackchannelAuthenticationCompleteRequest { /** * Set additional claims which will be embedded in the ID token . * The argument is converted into a JSON string and passed to * { @ link # setClaims ( String ) } method . * @ param claims * Additional claims . Keys are claim names . * @ return * { @ code this } object . */ public BackchannelAuthenticationCompleteRequest setClaims ( Map < String , Object > claims ) { } }
if ( claims == null || claims . size ( ) == 0 ) { this . claims = null ; } else { setClaims ( Utils . toJson ( claims ) ) ; } return this ;
public class TemplateSignatureRequest { /** * Internal method used to retrieve the necessary POST fields to submit the * signature request . * @ return Map * @ throws HelloSignException thrown if there is a problem parsing the POST * fields . */ public Map < String , Serializable > getPostFields ( ) throws HelloSignException { } }
Map < String , Serializable > fields = super . getPostFields ( ) ; try { // Mandatory fields List < String > templateIds = getTemplateIds ( ) ; for ( int i = 0 ; i < templateIds . size ( ) ; i ++ ) { fields . put ( TEMPLATE_IDS + "[" + i + "]" , templateIds . get ( i ) ) ; } Map < String , Signer > signerz = getSigners ( ) ; for ( String role : signerz . keySet ( ) ) { Signer s = signerz . get ( role ) ; fields . put ( TEMPLATE_SIGNERS + "[" + role + "][" + TEMPLATE_SIGNERS_EMAIL + "]" , s . getEmail ( ) ) ; fields . put ( TEMPLATE_SIGNERS + "[" + role + "][" + TEMPLATE_SIGNERS_NAME + "]" , s . getNameOrRole ( ) ) ; } // Optional fields if ( hasTitle ( ) ) { fields . put ( REQUEST_TITLE , getTitle ( ) ) ; } if ( hasSubject ( ) ) { fields . put ( REQUEST_SUBJECT , getSubject ( ) ) ; } if ( hasMessage ( ) ) { fields . put ( REQUEST_MESSAGE , getMessage ( ) ) ; } if ( hasRedirectUrl ( ) ) { fields . put ( REQUEST_REDIRECT_URL , getRedirectUrl ( ) ) ; } Map < String , String > ccz = getCCs ( ) ; for ( String role : ccz . keySet ( ) ) { fields . put ( TEMPLATE_CCS + "[" + role + "][" + TEMPLATE_CCS_EMAIL + "]" , ccz . get ( role ) ) ; } if ( customFields . size ( ) > 0 ) { JSONArray array = new JSONArray ( ) ; for ( CustomField f : customFields ) { array . put ( f . getJSONObject ( ) ) ; } fields . put ( TEMPLATE_CUSTOM_FIELDS , array . toString ( ) ) ; } if ( isTestMode ( ) ) { fields . put ( REQUEST_TEST_MODE , true ) ; } } catch ( Exception ex ) { throw new HelloSignException ( "Could not extract form fields from TemplateSignatureRequest." , ex ) ; } return fields ;
public class TextAccessor { /** * / * [ deutsch ] * < p > Interpretiert die angegebene Textform als Enum - Elementwert . < / p > * < p > Es werden die Attribute { @ code Attributes . PARSE _ CASE _ INSENSITIVE } * und { @ code Attributes . PARSE _ PARTIAL _ COMPARE } ausgewertet . < / p > * @ param < V > generic value type of element * @ param parseable text to be parsed * @ param status current parsing position * @ param valueType value class of element * @ param attributes format attributes * @ return element value ( as enum ) or { @ code null } if not found * @ see Attributes # PARSE _ CASE _ INSENSITIVE * @ see Attributes # PARSE _ PARTIAL _ COMPARE */ public < V extends Enum < V > > V parse ( CharSequence parseable , ParsePosition status , Class < V > valueType , AttributeQuery attributes ) { } }
boolean caseInsensitive = attributes . get ( Attributes . PARSE_CASE_INSENSITIVE , Boolean . TRUE ) . booleanValue ( ) ; boolean partialCompare = attributes . get ( Attributes . PARSE_PARTIAL_COMPARE , Boolean . FALSE ) . booleanValue ( ) ; boolean smart = attributes . get ( Attributes . PARSE_MULTIPLE_CONTEXT , Boolean . TRUE ) . booleanValue ( ) ; return this . parse ( parseable , status , valueType , caseInsensitive , partialCompare , smart ) ;
public class SmpteTtDestinationSettingsMarshaller { /** * Marshall the given parameter object . */ public void marshall ( SmpteTtDestinationSettings smpteTtDestinationSettings , ProtocolMarshaller protocolMarshaller ) { } }
if ( smpteTtDestinationSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DescribeSnapshotsRequest { /** * Describes the snapshots owned by these owners . * @ param ownerIds * Describes the snapshots owned by these owners . */ public void setOwnerIds ( java . util . Collection < String > ownerIds ) { } }
if ( ownerIds == null ) { this . ownerIds = null ; return ; } this . ownerIds = new com . amazonaws . internal . SdkInternalList < String > ( ownerIds ) ;
public class JavascriptHTMLBundleLinkRenderer { /** * ( non - Javadoc ) * @ see * net . jawr . web . resource . bundle . renderer . JsBundleLinkRenderer # init ( net . jawr . * web . resource . bundle . handler . ResourceBundlesHandler , java . lang . String , * java . lang . Boolean , java . lang . Boolean , java . lang . Boolean ) */ @ Override public void init ( ResourceBundlesHandler bundler , String type , Boolean useRandomParam , Boolean async , Boolean defer , String crossorigin ) { } }
init ( bundler , useRandomParam ) ; if ( async != null ) { this . async = async ; } if ( defer != null ) { this . defer = defer ; } this . crossorigin = crossorigin ; if ( StringUtils . isEmpty ( type ) ) { this . type = DEFAULT_TYPE ; } else { this . type = type ; }
public class IntegrationAccountsInner { /** * Gets the integration account callback URL . * @ param resourceGroupName The resource group name . * @ param integrationAccountName The integration account name . * @ param parameters The callback URL parameters . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the CallbackUrlInner object */ public Observable < CallbackUrlInner > getCallbackUrlAsync ( String resourceGroupName , String integrationAccountName , GetCallbackUrlParameters parameters ) { } }
return getCallbackUrlWithServiceResponseAsync ( resourceGroupName , integrationAccountName , parameters ) . map ( new Func1 < ServiceResponse < CallbackUrlInner > , CallbackUrlInner > ( ) { @ Override public CallbackUrlInner call ( ServiceResponse < CallbackUrlInner > response ) { return response . body ( ) ; } } ) ;
public class ResourcesUtilities { /** * Encode the utf - 16 characters in this line to escaped java strings . */ public static String encodeLine ( String string , boolean bResourceListBundle ) { } }
if ( string == null ) return string ; for ( int i = 0 ; i < string . length ( ) ; i ++ ) { if ( ( ( string . charAt ( i ) == '\"' ) || ( string . charAt ( i ) == '\\' ) ) || ( ( ! bResourceListBundle ) && ( string . charAt ( i ) == ':' ) ) ) { // must preceed these special characters with a " \ " string = string . substring ( 0 , i ) + "\\" + string . substring ( i ) ; i ++ ; } else if ( string . charAt ( i ) > 127 ) { String strHex = "0123456789ABCDEF" ; String strOut = "\\u" ; strOut += strHex . charAt ( ( string . charAt ( i ) & 0xF000 ) >> 12 ) ; strOut += strHex . charAt ( ( string . charAt ( i ) & 0xF00 ) >> 8 ) ; strOut += strHex . charAt ( ( string . charAt ( i ) & 0xF0 ) >> 4 ) ; strOut += strHex . charAt ( string . charAt ( i ) & 0xF ) ; string = string . substring ( 0 , i ) + strOut + string . substring ( i + 1 ) ; i = i + strOut . length ( ) - 1 ; } } return string ;
public class Costs { /** * Adds the heuristic costs for disk to the current heuristic disk costs * for this Costs object . * @ param cost The heuristic disk cost to add . */ public void addHeuristicDiskCost ( double cost ) { } }
if ( cost <= 0 ) { throw new IllegalArgumentException ( "Heuristic costs must be positive." ) ; } this . heuristicDiskCost += cost ; // check for overflow if ( this . heuristicDiskCost < 0 ) { this . heuristicDiskCost = Double . MAX_VALUE ; }
public class WorkflowTriggersInner { /** * Get the callback URL for a workflow trigger . * @ param resourceGroupName The resource group name . * @ param workflowName The workflow name . * @ param triggerName The workflow trigger name . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < WorkflowTriggerCallbackUrlInner > listCallbackUrlAsync ( String resourceGroupName , String workflowName , String triggerName , final ServiceCallback < WorkflowTriggerCallbackUrlInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( listCallbackUrlWithServiceResponseAsync ( resourceGroupName , workflowName , triggerName ) , serviceCallback ) ;
public class TenantService { /** * Define a new tenant */ private void defineNewTenant ( TenantDefinition tenantDef ) { } }
validateTenantUsers ( tenantDef ) ; addTenantOptions ( tenantDef ) ; addTenantProperties ( tenantDef ) ; Tenant tenant = new Tenant ( tenantDef ) ; DBService dbService = DBService . instance ( tenant ) ; dbService . createNamespace ( ) ; initializeTenantStores ( tenant ) ; storeTenantDefinition ( tenantDef ) ;
public class FileUtil { /** * NOTE : Assumes filename and no path */ private static String getExtension0 ( final String pFileName ) { } }
int index = pFileName . lastIndexOf ( '.' ) ; if ( index >= 0 ) { return pFileName . substring ( index + 1 ) ; } // No period found return null ;
public class ParserDDL { /** * / This adapts XreadExpressions output to the format originally produced by readColumnNames */ private OrderedHashSet getSimpleColumnNames ( java . util . List < Expression > indexExprs ) { } }
OrderedHashSet set = new OrderedHashSet ( ) ; for ( Expression expression : indexExprs ) { if ( expression instanceof ExpressionColumn ) { String colName = ( ( ExpressionColumn ) expression ) . columnName ; if ( ! set . add ( colName ) ) { throw Error . error ( ErrorCode . X_42577 , colName ) ; } } else { return null ; } } return set ;
public class IfcStructuralReactionImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) public EList < IfcStructuralAction > getCauses ( ) { } }
return ( EList < IfcStructuralAction > ) eGet ( Ifc2x3tc1Package . Literals . IFC_STRUCTURAL_REACTION__CAUSES , true ) ;
public class StringUtils { /** * Assemble all elements in map to a string . * @ param value map to serializer * @ param delim entry delimiter * @ return concatenated map */ @ SuppressWarnings ( { } }
"rawtypes" , "unchecked" } ) public static String join ( final Map value , final String delim ) { if ( value == null || value . isEmpty ( ) ) { return "" ; } final StringBuilder buf = new StringBuilder ( ) ; for ( final Iterator < Map . Entry < String , String > > i = value . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { final Map . Entry < String , String > e = i . next ( ) ; buf . append ( e . getKey ( ) ) . append ( EQUAL ) . append ( e . getValue ( ) ) ; if ( i . hasNext ( ) ) { buf . append ( delim ) ; } } return buf . toString ( ) ;
public class forwardingsession { /** * Use this API to fetch forwardingsession resource of given name . */ public static forwardingsession get ( nitro_service service , String name ) throws Exception { } }
forwardingsession obj = new forwardingsession ( ) ; obj . set_name ( name ) ; forwardingsession response = ( forwardingsession ) obj . get_resource ( service ) ; return response ;
public class MtasFieldsConsumer { /** * Token stats add . * @ param min * the min * @ param max * the max */ private void tokenStatsAdd ( int min , int max ) { } }
tokenStatsNumber ++ ; if ( tokenStatsMinPos == null ) { tokenStatsMinPos = min ; } else { tokenStatsMinPos = Math . min ( tokenStatsMinPos , min ) ; } if ( tokenStatsMaxPos == null ) { tokenStatsMaxPos = max ; } else { tokenStatsMaxPos = Math . max ( tokenStatsMaxPos , max ) ; }
public class CommerceNotificationAttachmentLocalServiceWrapper { /** * Deletes the commerce notification attachment with the primary key from the database . Also notifies the appropriate model listeners . * @ param commerceNotificationAttachmentId the primary key of the commerce notification attachment * @ return the commerce notification attachment that was removed * @ throws PortalException if a commerce notification attachment with the primary key could not be found */ @ Override public com . liferay . commerce . notification . model . CommerceNotificationAttachment deleteCommerceNotificationAttachment ( long commerceNotificationAttachmentId ) throws com . liferay . portal . kernel . exception . PortalException { } }
return _commerceNotificationAttachmentLocalService . deleteCommerceNotificationAttachment ( commerceNotificationAttachmentId ) ;
public class DomainsInner { /** * Delete a domain . * Delete existing domain . * @ param resourceGroupName The name of the resource group within the user ' s subscription . * @ param domainName Name of the domain * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void beginDelete ( String resourceGroupName , String domainName ) { } }
beginDeleteWithServiceResponseAsync ( resourceGroupName , domainName ) . toBlocking ( ) . single ( ) . body ( ) ;
public class DescribeRdsDbInstancesRequest { /** * An array containing the ARNs of the instances to be described . * @ param rdsDbInstanceArns * An array containing the ARNs of the instances to be described . */ public void setRdsDbInstanceArns ( java . util . Collection < String > rdsDbInstanceArns ) { } }
if ( rdsDbInstanceArns == null ) { this . rdsDbInstanceArns = null ; return ; } this . rdsDbInstanceArns = new com . amazonaws . internal . SdkInternalList < String > ( rdsDbInstanceArns ) ;
public class ZonesInner { /** * Lists the DNS zones within a resource group . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; ZoneInner & gt ; object */ public Observable < Page < ZoneInner > > listByResourceGroupNextAsync ( final String nextPageLink ) { } }
return listByResourceGroupNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < ZoneInner > > , Page < ZoneInner > > ( ) { @ Override public Page < ZoneInner > call ( ServiceResponse < Page < ZoneInner > > response ) { return response . body ( ) ; } } ) ;
public class CmsContainerpageDNDController { /** * Checks if the draggable item is a copy model . < p > * @ param draggable the draggable item * @ return true if the item is a copy model */ private boolean isCopyModel ( I_CmsDraggable draggable ) { } }
if ( ! ( draggable instanceof CmsResultListItem ) ) { return false ; } return ( ( CmsResultListItem ) draggable ) . getResult ( ) . isCopyModel ( ) ;
public class ErrorList { /** * Returns the Axis deserializer for this object . */ public static Deserializer getDeserializer ( @ SuppressWarnings ( "unused" ) java . lang . String mechType , java . lang . Class < ? extends Operation > javaType , javax . xml . namespace . QName xmlType ) { } }
return new org . apache . axis . encoding . ser . BeanDeserializer ( javaType , xmlType , TYPE_DESC ) ;
public class ReportService { /** * Checks the report URL every 5 seconds until the report has a finished time available , then we know it is done being generated . Throws BlackDuckIntegrationException after 30 minutes if the report has not been generated yet . */ public ReportView isReportFinishedGenerating ( String reportUri ) throws InterruptedException , IntegrationException { } }
long startTime = System . currentTimeMillis ( ) ; long elapsedTime = 0 ; Date timeFinished = null ; ReportView reportInfo = null ; while ( timeFinished == null ) { reportInfo = blackDuckService . getResponse ( reportUri , ReportView . class ) ; timeFinished = reportInfo . getFinishedAt ( ) ; if ( timeFinished != null ) { break ; } if ( elapsedTime >= timeoutInMilliseconds ) { String formattedTime = String . format ( "%d minutes" , TimeUnit . MILLISECONDS . toMinutes ( timeoutInMilliseconds ) ) ; throw new BlackDuckIntegrationException ( "The Report has not finished generating in : " + formattedTime ) ; } // Retry every 5 seconds Thread . sleep ( 5000 ) ; elapsedTime = System . currentTimeMillis ( ) - startTime ; } return reportInfo ;
public class CorruptFileBlocks { /** * { @ inheritDoc } */ @ Override public void readFields ( DataInput in ) throws IOException { } }
int fileCount = in . readInt ( ) ; files = new String [ fileCount ] ; for ( int i = 0 ; i < fileCount ; i ++ ) { files [ i ] = Text . readString ( in ) ; } cookie = Text . readString ( in ) ;
public class AstCompatGeneratingVisitor { /** * / / - > ^ ( FRAGMENT _ PART sequence ) */ @ Override public T visitFragment_ ( Fragment_Context ctx ) { } }
// on ( ctx ) ; appendAst ( ctx , tok ( FRAGMENT_PART ) ) ; return super . visitFragment_ ( ctx ) ;
public class ToUnknownStream { /** * Pass the call on to the underlying handler * @ see org . xml . sax . ext . LexicalHandler # comment ( char [ ] , int , int ) */ public void comment ( char [ ] ch , int start , int length ) throws SAXException { } }
if ( m_firstTagNotEmitted ) { flush ( ) ; } m_handler . comment ( ch , start , length ) ;
public class WaitForEquals { /** * Waits for the element ' s text in a particular cell equals the provided * expected text . If the element isn ' t present , or a table , this will * constitute a failure , same as a mismatch . * The provided wait time will be used and if the element doesn ' t * have the desired match count at that time , it will fail , and log * the issue with a screenshot for traceability and added debugging support . * @ param row - the number of the row in the table - note , row numbering * starts at 1 , NOT 0 * @ param col - the number of the column in the table - note , column * numbering starts at 1 , NOT 0 * @ param expectedText - what text do we expect to be in the table cell * @ param seconds - how many seconds to wait for */ public void text ( int row , int col , String expectedText , double seconds ) { } }
double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; try { elementPresent ( seconds ) ; while ( ! element . get ( ) . tableCell ( row , col ) . get ( ) . text ( ) . equals ( expectedText ) && System . currentTimeMillis ( ) < end ) ; double timeTook = Math . min ( ( seconds * 1000 ) - ( end - System . currentTimeMillis ( ) ) , seconds * 1000 ) / 1000 ; checkText ( row , col , expectedText , seconds , timeTook ) ; } catch ( TimeoutException e ) { checkText ( row , col , expectedText , seconds , seconds ) ; }
public class SipSessionImpl { /** * Notifies the listeners that a lifecycle event occured on that sip session * @ param sipSessionEventType the type of event that happened */ public void notifySipSessionListeners ( SipSessionEventType sipSessionEventType ) { } }
MobicentsSipApplicationSession sipApplicationSession = getSipApplicationSession ( ) ; if ( sipApplicationSession != null ) { SipContext sipContext = sipApplicationSession . getSipContext ( ) ; List < SipSessionListener > sipSessionListeners = sipContext . getListeners ( ) . getSipSessionListeners ( ) ; if ( sipSessionListeners . size ( ) > 0 ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "notifying sip session listeners of context " + sipContext . getApplicationName ( ) + " of following event " + sipSessionEventType ) ; } ClassLoader oldClassLoader = java . lang . Thread . currentThread ( ) . getContextClassLoader ( ) ; sipContext . enterSipContext ( ) ; SipSessionEvent sipSessionEvent = new SipSessionEvent ( this . getFacade ( ) ) ; for ( SipSessionListener sipSessionListener : sipSessionListeners ) { try { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "notifying sip session listener " + sipSessionListener . getClass ( ) . getName ( ) + " of context " + key . getApplicationName ( ) + " of following event " + sipSessionEventType ) ; } if ( SipSessionEventType . CREATION . equals ( sipSessionEventType ) ) { sipSessionListener . sessionCreated ( sipSessionEvent ) ; } else if ( SipSessionEventType . DELETION . equals ( sipSessionEventType ) ) { sipSessionListener . sessionDestroyed ( sipSessionEvent ) ; } else if ( SipSessionEventType . READYTOINVALIDATE . equals ( sipSessionEventType ) ) { sipSessionListener . sessionReadyToInvalidate ( sipSessionEvent ) ; } } catch ( Throwable t ) { logger . error ( "SipSessionListener threw exception" , t ) ; } } sipContext . exitSipContext ( oldClassLoader ) ; } }
public class TimeRestrictedAccessPolicy { /** * Returns true if the given DateTime matches the time range indicated by the * filter / rule . * @ param currentTime * @ param filter */ private boolean matchesTime ( TimeRestrictedAccess filter ) { } }
Date start = filter . getTimeStart ( ) ; Date end = filter . getTimeEnd ( ) ; if ( end == null || start == null ) { return true ; } long startMs = start . getTime ( ) ; long endMs = end . getTime ( ) ; DateTime currentTime = new LocalTime ( DateTimeZone . UTC ) . toDateTime ( new DateTime ( 0l ) ) ; long nowMs = currentTime . toDate ( ) . getTime ( ) ; return nowMs >= startMs && nowMs < endMs ;
public class ThriftClientManager { /** * Returns the { @ link RequestChannel } backing a Swift client * @ throws IllegalArgumentException if the client is not a Swift client */ public RequestChannel getRequestChannel ( Object client ) { } }
try { InvocationHandler genericHandler = Proxy . getInvocationHandler ( client ) ; ThriftInvocationHandler thriftHandler = ( ThriftInvocationHandler ) genericHandler ; return thriftHandler . getChannel ( ) ; } catch ( IllegalArgumentException | ClassCastException e ) { throw new IllegalArgumentException ( "Invalid swift client object" , e ) ; }
public class JavaWriter { /** * Emit an import for { @ code type } . For the duration of the file , all * references to this class will be automatically shortened . */ public void addImport ( String type ) throws IOException { } }
Matcher matcher = TYPE_PATTERN . matcher ( type ) ; if ( ! matcher . matches ( ) ) { throw new IllegalArgumentException ( type ) ; } if ( importedTypes . put ( type , matcher . group ( 1 ) ) != null ) { throw new IllegalArgumentException ( type ) ; } out . write ( "import " ) ; out . write ( type ) ; out . write ( ";\n" ) ;
public class DefaultUsageFormatter { /** * Returns the description of the command corresponding to the argument command name . The commands are resolved * by calling { @ link JCommander # findCommandByAlias ( String ) } , and the default resource bundle used from * { @ link JCommander # getBundle ( ) } on the underlying commander instance . * @ param commandName the name of the command to get the description for * @ return the description of the command . */ public String getCommandDescription ( String commandName ) { } }
JCommander jc = commander . findCommandByAlias ( commandName ) ; if ( jc == null ) { throw new ParameterException ( "Asking description for unknown command: " + commandName ) ; } Object arg = jc . getObjects ( ) . get ( 0 ) ; Parameters p = arg . getClass ( ) . getAnnotation ( Parameters . class ) ; java . util . ResourceBundle bundle ; String result = null ; if ( p != null ) { result = p . commandDescription ( ) ; String bundleName = p . resourceBundle ( ) ; if ( ! bundleName . isEmpty ( ) ) { bundle = ResourceBundle . getBundle ( bundleName , Locale . getDefault ( ) ) ; } else { bundle = commander . getBundle ( ) ; } if ( bundle != null ) { String descriptionKey = p . commandDescriptionKey ( ) ; if ( ! descriptionKey . isEmpty ( ) ) { result = getI18nString ( bundle , descriptionKey , p . commandDescription ( ) ) ; } } } return result ;
public class FutureType { /** * TODO add static methods */ @ Override public Method getMethod ( String methodName , int parameterCount ) { } }
for ( Method method : methods ) { if ( method . getName ( ) . equals ( methodName ) && method . getParameters ( ) . size ( ) == parameterCount ) { return method ; } } if ( extending != null ) { return extending . getMethod ( methodName , parameterCount ) ; } return null ;
public class AuthInterface { /** * Get a signature for a list of parameters using the given shared secret . * @ param sharedSecret * The shared secret * @ param params * The parameters * @ return The signature String */ private String getSignature ( String sharedSecret , Map < String , String > params ) { } }
StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( sharedSecret ) ; for ( Map . Entry < String , String > entry : params . entrySet ( ) ) { buffer . append ( entry . getKey ( ) ) ; buffer . append ( entry . getValue ( ) ) ; } try { MessageDigest md = MessageDigest . getInstance ( "MD5" ) ; return ByteUtilities . toHexString ( md . digest ( buffer . toString ( ) . getBytes ( "UTF-8" ) ) ) ; } catch ( NoSuchAlgorithmException e ) { throw new RuntimeException ( e ) ; } catch ( UnsupportedEncodingException u ) { throw new RuntimeException ( u ) ; }
public class GroovyClassLoader { /** * Parses the given code source into a Java class . If there is a class file * for the given code source , then no parsing is done , instead the cached class is returned . * @ param shouldCacheSource if true then the generated class will be stored in the source cache * @ return the main class defined in the given script */ public Class parseClass ( final GroovyCodeSource codeSource , boolean shouldCacheSource ) throws CompilationFailedException { } }
// it ' s better to cache class instances by the source code // GCL will load the unique class instance for the same source code // and avoid occupying Permanent Area / Metaspace repeatedly String cacheKey = genSourceCacheKey ( codeSource ) ; return ( ( StampedCommonCache < String , Class > ) sourceCache ) . getAndPut ( cacheKey , new EvictableCache . ValueProvider < String , Class > ( ) { @ Override public Class provide ( String key ) { return doParseClass ( codeSource ) ; } } , shouldCacheSource ) ;
public class InternalNodeModelUtils { /** * Obtain the line breaks from the document and search / compute the line number * and column number at the given document offset . */ protected static LineAndColumn getLineAndColumn ( INode anyNode , int documentOffset ) { } }
INode rootNode = anyNode . getRootNode ( ) ; int [ ] lineBreaks = getLineBreakOffsets ( rootNode ) ; String document = rootNode . getText ( ) ; return getLineAndColumn ( document , lineBreaks , documentOffset ) ;
public class ExtensionSpider { /** * Gets the { @ code HttpPrefixFetchFilter } from the given { @ code customConfigurations } . * @ param customConfigurations the custom configurations of the spider * @ return the { @ code HttpPrefixFetchFilter } found , { @ code null } otherwise . */ private HttpPrefixFetchFilter getUriPrefixFecthFilter ( Object [ ] customConfigurations ) { } }
if ( customConfigurations != null ) { for ( Object customConfiguration : customConfigurations ) { if ( customConfiguration instanceof HttpPrefixFetchFilter ) { return ( HttpPrefixFetchFilter ) customConfiguration ; } } } return null ;
public class server { /** * Use this API to fetch all the server resources that are configured on netscaler . */ public static server [ ] get ( nitro_service service ) throws Exception { } }
server obj = new server ( ) ; server [ ] response = ( server [ ] ) obj . get_resources ( service ) ; return response ;
public class FormSpec { /** * Returns a short and parseable string representation of this form specification . The string * will omit the alignment and resize specifications if these are the default values . < p > * @ return a string representation of the form specification . * @ see # toShortString ( ) for a more verbose string representation * @ since 1.2 */ public final String encode ( ) { } }
StringBuffer buffer = new StringBuffer ( ) ; DefaultAlignment alignmentDefault = isHorizontal ( ) ? ColumnSpec . DEFAULT : RowSpec . DEFAULT ; if ( ! alignmentDefault . equals ( defaultAlignment ) ) { buffer . append ( defaultAlignment . abbreviation ( ) ) ; buffer . append ( ":" ) ; } buffer . append ( size . encode ( ) ) ; if ( resizeWeight == NO_GROW ) { // Omit the resize part } else if ( resizeWeight == DEFAULT_GROW ) { buffer . append ( ':' ) ; buffer . append ( "g" ) ; } else { buffer . append ( ':' ) ; buffer . append ( "g(" ) ; buffer . append ( resizeWeight ) ; buffer . append ( ')' ) ; } return buffer . toString ( ) ;
public class QueryHandler { /** * Base method to handle the response for the generic query request . * It waits for the first few bytes on the actual response to determine if an error is raised or if a successful * response can be expected . The actual error and / or chunk parsing is deferred to other parts of this handler . * @ return a { @ link CouchbaseResponse } if eligible . */ private CouchbaseResponse handleGenericQueryResponse ( boolean lastChunk ) { } }
String requestId ; String clientId = "" ; if ( responseContent . readableBytes ( ) < MINIMUM_WINDOW_FOR_REQUESTID + MINIMUM_WINDOW_FOR_CLIENTID_TOKEN && ! lastChunk ) { return null ; // wait for more data } int startIndex = responseContent . readerIndex ( ) ; if ( responseContent . readableBytes ( ) >= MINIMUM_WINDOW_FOR_REQUESTID ) { responseContent . skipBytes ( findNextChar ( responseContent , ':' ) ) ; responseContent . skipBytes ( findNextChar ( responseContent , '"' ) + 1 ) ; int endOfId = findNextChar ( responseContent , '"' ) ; ByteBuf slice = responseContent . readSlice ( endOfId ) ; requestId = slice . toString ( CHARSET ) ; } else { return null ; } // IMPORTANT : from there on , before returning null to get more data you need to reset // the cursor , since following code will consume data from the buffer . if ( responseContent . readableBytes ( ) >= MINIMUM_WINDOW_FOR_CLIENTID_TOKEN && findNextChar ( responseContent , ':' ) < MINIMUM_WINDOW_FOR_CLIENTID_TOKEN ) { responseContent . markReaderIndex ( ) ; ByteBuf slice = responseContent . readSlice ( findNextChar ( responseContent , ':' ) ) ; if ( slice . toString ( CHARSET ) . contains ( "clientContextID" ) ) { // find the size of the client id responseContent . skipBytes ( findNextChar ( responseContent , '"' ) + 1 ) ; // opening of clientId int clientIdSize = findNextCharNotPrefixedBy ( responseContent , '"' , '\\' ) ; if ( clientIdSize < 0 ) { // reset the cursor way back before requestID , there was not enough data to get the whole id responseContent . readerIndex ( startIndex ) ; // wait for more data return null ; } // read it clientId = responseContent . readSlice ( clientIdSize ) . toString ( CHARSET ) ; // advance to next token if possible // closing quote boolean hasClosingQuote = responseContent . readableBytes ( ) > 0 ; if ( hasClosingQuote ) { responseContent . skipBytes ( 1 ) ; } // next token ' s quote int openingNextToken = findNextChar ( responseContent , '"' ) ; if ( openingNextToken > - 1 ) { responseContent . skipBytes ( openingNextToken ) ; } } else { // reset the cursor , there was no client id responseContent . resetReaderIndex ( ) ; } } boolean success = true ; if ( responseContent . readableBytes ( ) >= 20 ) { ByteBuf peekForErrors = responseContent . slice ( responseContent . readerIndex ( ) , 20 ) ; if ( peekForErrors . toString ( CHARSET ) . contains ( "errors" ) ) { success = false ; } } else { // it is important to reset the readerIndex if returning null , in order to allow for complete retry responseContent . readerIndex ( startIndex ) ; return null ; } ResponseStatus status = ResponseStatusConverter . fromHttp ( responseHeader . getStatus ( ) . code ( ) ) ; if ( ! success ) { status = ResponseStatus . FAILURE ; } Scheduler scheduler = env ( ) . scheduler ( ) ; long ttl = env ( ) . autoreleaseAfter ( ) ; queryRowObservable = UnicastAutoReleaseSubject . create ( ttl , TimeUnit . MILLISECONDS , scheduler ) ; queryErrorObservable = UnicastAutoReleaseSubject . create ( ttl , TimeUnit . MILLISECONDS , scheduler ) ; queryStatusObservable = AsyncSubject . create ( ) ; queryInfoObservable = UnicastAutoReleaseSubject . create ( ttl , TimeUnit . MILLISECONDS , scheduler ) ; querySignatureObservable = UnicastAutoReleaseSubject . create ( ttl , TimeUnit . MILLISECONDS , scheduler ) ; queryProfileInfoObservable = UnicastAutoReleaseSubject . create ( ttl , TimeUnit . MILLISECONDS , scheduler ) ; // set up trace ids on all these UnicastAutoReleaseSubjects , so that if they get in a bad state // ( multiple subscribers or subscriber coming in too late ) we can trace back to here String rid = clientId == null ? requestId : clientId + " / " + requestId ; queryRowObservable . withTraceIdentifier ( "queryRow." + rid ) . onBackpressureBuffer ( ) ; queryErrorObservable . withTraceIdentifier ( "queryError." + rid ) . onBackpressureBuffer ( ) ; queryInfoObservable . withTraceIdentifier ( "queryInfo." + rid ) . onBackpressureBuffer ( ) ; querySignatureObservable . withTraceIdentifier ( "querySignature." + rid ) . onBackpressureBuffer ( ) ; queryProfileInfoObservable . withTraceIdentifier ( "queryProfileInfo." + rid ) . onBackpressureBuffer ( ) ; queryStatusObservable . onBackpressureBuffer ( ) ; if ( ! env ( ) . callbacksOnIoPool ( ) ) { queryErrorObservable . observeOn ( scheduler ) ; queryRowObservable . observeOn ( scheduler ) ; querySignatureObservable . observeOn ( scheduler ) ; queryStatusObservable . observeOn ( scheduler ) ; queryInfoObservable . observeOn ( scheduler ) ; } return new GenericQueryResponse ( queryErrorObservable , queryRowObservable , querySignatureObservable , queryStatusObservable , queryInfoObservable , queryProfileInfoObservable , currentRequest ( ) , status , requestId , clientId ) ;
public class ReferenceCache { /** * Retrieve a referenced value from a future and dereference it . * @ param futureValue a future value * @ return dereferenced value */ private V dereferenceValue ( Future < CacheReference < V > > futureValue ) { } }
try { return dereferenceValue ( futureValue . get ( ) ) ; } catch ( final Throwable e ) { return null ; }
public class EmailSettingsApi { /** * Modify inbound settings . * Adds or updates inbound settings . * @ param body Body Data ( required ) * @ return ApiSuccessResponse * @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */ public ApiSuccessResponse modifyInboundSettings ( ModifyInboundData body ) throws ApiException { } }
ApiResponse < ApiSuccessResponse > resp = modifyInboundSettingsWithHttpInfo ( body ) ; return resp . getData ( ) ;
public class ModelMapper { /** * Validates that < b > every < / b > top level destination property for each configured TypeMap is * mapped to one and only one source property , or that a { @ code Converter } was * { @ link TypeMap # setConverter ( Converter ) set } for the TypeMap . If not , a ConfigurationException * is thrown detailing any missing mappings . * @ throws ValidationException if any TypeMaps contain unmapped properties */ public void validate ( ) { } }
Errors errors = new Errors ( ) ; for ( TypeMap < ? , ? > typeMap : getTypeMaps ( ) ) { try { typeMap . validate ( ) ; } catch ( ValidationException e ) { errors . merge ( e . getErrorMessages ( ) ) ; } } errors . throwValidationExceptionIfErrorsExist ( ) ;
public class AmazonComprehendClient { /** * Inspects text and returns an inference of the prevailing sentiment ( < code > POSITIVE < / code > , < code > NEUTRAL < / code > , * < code > MIXED < / code > , or < code > NEGATIVE < / code > ) . * @ param detectSentimentRequest * @ return Result of the DetectSentiment operation returned by the service . * @ throws InvalidRequestException * The request is invalid . * @ throws TextSizeLimitExceededException * The size of the input text exceeds the limit . Use a smaller document . * @ throws UnsupportedLanguageException * Amazon Comprehend can ' t process the language of the input text . For all custom entity recognition APIs * ( such as < code > CreateEntityRecognizer < / code > ) , only English is accepted . For most other APIs , Amazon * Comprehend accepts only English or Spanish text . * @ throws InternalServerException * An internal server error occurred . Retry your request . * @ sample AmazonComprehend . DetectSentiment * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / comprehend - 2017-11-27 / DetectSentiment " target = " _ top " > AWS API * Documentation < / a > */ @ Override public DetectSentimentResult detectSentiment ( DetectSentimentRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDetectSentiment ( request ) ;
public class MoreCollectors { /** * Creates an { @ link com . google . common . collect . ImmutableListMultimap } from the stream where the values are the values * in the stream and the keys are the result of the provided { @ link Function keyFunction } applied to each value in the * stream . * Neither { @ link Function keyFunction } nor { @ link Function valueFunction } can return { @ code null } , otherwise a * { @ link NullPointerException } will be thrown . * @ throws NullPointerException if { @ code keyFunction } or { @ code valueFunction } is { @ code null } . * @ throws NullPointerException if result of { @ code keyFunction } or { @ code valueFunction } is { @ code null } . */ public static < K , E > Collector < E , ImmutableListMultimap . Builder < K , E > , ImmutableListMultimap < K , E > > index ( Function < ? super E , K > keyFunction ) { } }
return index ( keyFunction , Function . < E > identity ( ) ) ;
public class AtomContainer { /** * { @ inheritDoc } */ @ Override public void removeSingleElectron ( ISingleElectron singleElectron ) { } }
int pos = indexOf ( singleElectron ) ; if ( pos != - 1 ) removeSingleElectron ( pos ) ;
public class appflowpolicy_appflowglobal_binding { /** * Use this API to fetch appflowpolicy _ appflowglobal _ binding resources of given name . */ public static appflowpolicy_appflowglobal_binding [ ] get ( nitro_service service , String name ) throws Exception { } }
appflowpolicy_appflowglobal_binding obj = new appflowpolicy_appflowglobal_binding ( ) ; obj . set_name ( name ) ; appflowpolicy_appflowglobal_binding response [ ] = ( appflowpolicy_appflowglobal_binding [ ] ) obj . get_resources ( service ) ; return response ;
public class BaseMessageEndpointFactory { /** * Method mapTranEnlistmentNotNeededToException . * This method maps the reason code that was passed to the setTranEnlistmentNotNeeded method * to an appropriate UnavailableException method to throw if a RA had called createEndpoint * and passed a non - null XAResource object to it . Also , an appropriate error message is * written to the activity log file . */ private UnavailableException mapAndLogTranEnlistmentNotNeeded ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "MEF.mapAndLogTranEnlistmentNotNeeded for enterprise class " + beanMetaData . enterpriseBeanName ) ; } UnavailableException ex = null ; switch ( ivEnlistNotNeededReason ) { case ( RA_DOES_NOT_SUPPORT_XATRANSACTIONS ) : { if ( ivEnlistNotNeededMessageLogged == false ) { // CNTR0087E : Resource adapter { 0 } is not allowed to pass a non null XAResource to createEndpoint method for MDB { 1 } . Tr . error ( tc , "RA_DOES_NOT_SUPPORT_XATRANSACTIONS_CNTR0087E" , ivRAKey , beanMetaData . j2eeName ) ; } ex = new UnavailableException ( "Transaction recovery not setup for this RA since RA does not support XA transactions" ) ; break ; } case ( ERROR_DURING_TRAN_RECOVERY_SETUP ) : { if ( ivEnlistNotNeededMessageLogged == false ) { // CNTR0086E : Transaction recovery setup error occurred for resource adapter { 0 } , MDB { 1 } . Tr . error ( tc , "ERROR_DURING_TRAN_RECOVERY_SETUP_CNTR0086E" , ivRAKey , beanMetaData . j2eeName ) ; } ex = new UnavailableException ( "Error occured during transaction recovery setup for this Resource Adapter" ) ; break ; } default : { if ( ivEnlistNotNeededMessageLogged == false ) { // CNTR0081E : setTranEnlistmentNotNeeded called with an unrecognized reason code of { 0 } . Tr . error ( tc , "REASON_CODE_NOT_RECOGNIZED_CNTR0081E" , Integer . valueOf ( ivEnlistNotNeededReason ) ) ; } ex = new UnavailableException ( "Error occured during transaction recovery setup for this Resource Adapter" ) ; break ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "MEF.mapAndLogTranEnlistmentNotNeeded for enterprise class " + beanMetaData . enterpriseBeanName ) ; } // Indicate error message is logged to prevent logging next time this method is called // for this MessageEndpointFactory instance . ivEnlistNotNeededMessageLogged = true ; // Return exception to the caller to throw . return ex ;
public class AssetInfo { /** * If not mapped , content - type is application / octet - stream for binary and test / plain otherwise . * TODO : extensibility */ public static String getContentType ( String ext ) { } }
String ct = extToContentType . get ( ext ) ; if ( ct == null ) ct = isBinary ( ext ) ? "application/octet-stream" : "text/plain" ; return ct ;
public class GoyyaSmsService { /** * Creates the send time URL parameter value . * @ param sendTime the send time as { @ link Date } * @ return the send time URL parameter value */ protected String createSendTime ( final Date sendTime ) { } }
if ( sendTime == null || new Date ( System . currentTimeMillis ( ) + 1000L * 60L ) . after ( sendTime ) ) { return null ; } String customSendTimePattern = StringUtils . isBlank ( this . sendTimePattern ) ? DEFAULT_SEND_TIME_PATTERN : this . sendTimePattern ; SimpleDateFormat sdf = new SimpleDateFormat ( customSendTimePattern , Locale . GERMANY ) ; sdf . setTimeZone ( TimeZone . getTimeZone ( "Europe/Berlin" ) ) ; return sdf . format ( sendTime ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link Task } { @ code > } } */ @ XmlElementDecl ( namespace = "http://schema.intuit.com/finance/v3" , name = "Task" , substitutionHeadNamespace = "http://schema.intuit.com/finance/v3" , substitutionHeadName = "IntuitObject" ) public JAXBElement < Task > createTask ( Task value ) { } }
return new JAXBElement < Task > ( _Task_QNAME , Task . class , null , value ) ;