signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class ParosTableAlert { /** * / * ( non - Javadoc )
* @ see org . parosproxy . paros . db . paros . TableAlert # write ( int , int , java . lang . String , int , int , java . lang . String , java . lang . String , java . lang . String , java . lang . String , java . lang . String , java . lang . String , java . lang . String , java . lang . String , int , int , int , int ) */
@ Override public synchronized RecordAlert write ( int scanId , int pluginId , String alert , int risk , int confidence , String description , String uri , String param , String attack , String otherInfo , String solution , String reference , String evidence , int cweId , int wascId , int historyId , int sourceHistoryId , int sourceId ) throws DatabaseException { } }
|
try { psInsert . setInt ( 1 , scanId ) ; psInsert . setInt ( 2 , pluginId ) ; psInsert . setString ( 3 , alert ) ; psInsert . setInt ( 4 , risk ) ; psInsert . setInt ( 5 , confidence ) ; psInsert . setString ( 6 , description ) ; psInsert . setString ( 7 , uri ) ; psInsert . setString ( 8 , param ) ; psInsert . setString ( 9 , attack ) ; psInsert . setString ( 10 , otherInfo ) ; psInsert . setString ( 11 , solution ) ; psInsert . setString ( 12 , reference ) ; psInsert . setString ( 13 , evidence ) ; psInsert . setInt ( 14 , cweId ) ; psInsert . setInt ( 15 , wascId ) ; psInsert . setInt ( 16 , historyId ) ; psInsert . setInt ( 17 , sourceHistoryId ) ; psInsert . setInt ( 18 , sourceId ) ; psInsert . executeUpdate ( ) ; int id ; try ( ResultSet rs = psGetIdLastInsert . executeQuery ( ) ) { rs . next ( ) ; id = rs . getInt ( 1 ) ; } return read ( id ) ; } catch ( SQLException e ) { throw new DatabaseException ( e ) ; }
|
public class EnglishGrammaticalStructure { /** * Destructively modifies this < code > Collection & lt ; TypedDependency & gt ; < / code >
* by collapsing several types of transitive pairs of dependencies , but
* keeping the tree structure .
* < dl >
* < dt > prepositional object dependencies : pobj < / dt >
* < dd >
* < code > prep ( cat , in ) < / code > and < code > pobj ( in , hat ) < / code > are collapsed to
* < code > prep _ in ( cat , hat ) < / code > < / dd >
* < dt > prepositional complement dependencies : pcomp < / dt >
* < dd >
* < code > prep ( heard , of ) < / code > and < code > pcomp ( of , attacking ) < / code > are
* collapsed to < code > prepc _ of ( heard , attacking ) < / code > < / dd >
* < dt > conjunct dependencies < / dt >
* < dd >
* < code > cc ( investors , and ) < / code > and
* < code > conj ( investors , regulators ) < / code > are collapsed to
* < code > conj _ and ( investors , regulators ) < / code > < / dd >
* < dt > possessive dependencies : possessive < / dt >
* < dd >
* < code > possessive ( Montezuma , ' s ) < / code > will be erased . This is like a collapsing , but
* due to the flatness of NPs , two dependencies are not actually composed . < / dd > */
@ Override protected void collapseDependenciesTree ( List < TypedDependency > list ) { } }
|
correctDependencies ( list ) ; if ( DEBUG ) { printListSorted ( "After correctDependencies:" , list ) ; } eraseMultiConj ( list ) ; if ( DEBUG ) { printListSorted ( "After collapse multi conj:" , list ) ; } collapse2WP ( list ) ; if ( DEBUG ) { printListSorted ( "After collapse2WP:" , list ) ; } collapseFlatMWP ( list ) ; if ( DEBUG ) { printListSorted ( "After collapseFlatMWP:" , list ) ; } collapse2WPbis ( list ) ; if ( DEBUG ) { printListSorted ( "After collapse2WPbis:" , list ) ; } collapse3WP ( list ) ; if ( DEBUG ) { printListSorted ( "After collapse3WP:" , list ) ; } collapsePrepAndPoss ( list ) ; if ( DEBUG ) { printListSorted ( "After PrepAndPoss:" , list ) ; } collapseConj ( list ) ; if ( DEBUG ) { printListSorted ( "After conj:" , list ) ; } Collections . sort ( list ) ; if ( DEBUG ) { printListSorted ( "After all collapse:" , list ) ; }
|
public class DCompiler { /** * Sql - > Json .
* @ param query
* @ return */
public static Program compileSql ( String query ) { } }
|
try { ANTLRStringStream in = new ANTLRStringStream ( query ) ; druidGLexer lexer = new druidGLexer ( in ) ; CommonTokenStream tokens = new CommonTokenStream ( lexer ) ; druidGParser parser = new druidGParser ( tokens ) ; Program pgm = parser . program ( ) ; return pgm ; } catch ( RecognitionException ex ) { System . out . println ( ex ) ; Logger . getLogger ( DCompiler . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ; } return null ;
|
public class Game { /** * Creates a new Game instance with the specified name .
* < br > This will display as { @ code Listening name } in the official client
* @ param name
* The not - null name of the newly created game
* @ throws IllegalArgumentException
* if the specified name is null , empty or blank
* @ return A valid Game instance with the provided name with { @ link GameType # LISTENING } */
public static Game listening ( String name ) { } }
|
Checks . notBlank ( name , "Name" ) ; return new Game ( name , null , GameType . LISTENING ) ;
|
public class AbstractSequenceClassifier { /** * Classify stdin by documents seperated by 3 blank line
* @ param readerWriter
* @ return boolean reached end of IO
* @ throws IOException */
public boolean classifyDocumentStdin ( DocumentReaderAndWriter < IN > readerWriter ) throws IOException { } }
|
BufferedReader is = new BufferedReader ( new InputStreamReader ( System . in , flags . inputEncoding ) ) ; String line ; String text = "" ; String eol = "\n" ; String sentence = "<s>" ; int blankLines = 0 ; while ( ( line = is . readLine ( ) ) != null ) { if ( line . trim ( ) . equals ( "" ) ) { ++ blankLines ; if ( blankLines > 3 ) { return false ; } else if ( blankLines > 2 ) { ObjectBank < List < IN > > documents = makeObjectBankFromString ( text , readerWriter ) ; classifyAndWriteAnswers ( documents , readerWriter ) ; text = "" ; } else { text += sentence + eol ; } } else { text += line + eol ; blankLines = 0 ; } } // Classify last document before input stream end
if ( text . trim ( ) != "" ) { ObjectBank < List < IN > > documents = makeObjectBankFromString ( text , readerWriter ) ; classifyAndWriteAnswers ( documents , readerWriter ) ; } return ( line == null ) ; // reached eol
|
public class CPOptionCategoryLocalServiceWrapper { /** * Returns the cp option category matching the UUID and group .
* @ param uuid the cp option category ' s UUID
* @ param groupId the primary key of the group
* @ return the matching cp option category , or < code > null < / code > if a matching cp option category could not be found */
@ Override public com . liferay . commerce . product . model . CPOptionCategory fetchCPOptionCategoryByUuidAndGroupId ( String uuid , long groupId ) { } }
|
return _cpOptionCategoryLocalService . fetchCPOptionCategoryByUuidAndGroupId ( uuid , groupId ) ;
|
public class AppEngineCoordinator { /** * Puts the specified entity instance into the datastore newly within the
* current transaction .
* @ param entity The entity to be put into the datastore . */
@ Override public void put ( Object entity ) { } }
|
ResourceManager < Transaction > manager = new AppEngineResourceManager ( datastore , datastore . beginTransaction ( ) , transaction ) ; manager . put ( entity ) ; Log log = new Log ( transaction . logs ( ) . size ( ) + 1 , Log . Operation . PUT , entity ) ; log . state ( State . UNCOMMITTED ) ; transaction . logs ( ) . add ( log ) ; managers . put ( keyValue ( entity ) , manager ) ; logger . fine ( "Transaction [" + transaction . id ( ) + "]: Entity [" + entity + "] has been put" ) ;
|
public class AlertsEngineCache { /** * Remove all DataEntry for a specified trigger .
* @ param triggerId to remove */
public void remove ( String tenantId , String triggerId ) { } }
|
if ( tenantId == null ) { throw new IllegalArgumentException ( "tenantId must be not null" ) ; } if ( triggerId == null ) { throw new IllegalArgumentException ( "triggerId must be not null" ) ; } Set < DataEntry > dataEntriesToRemove = new HashSet < > ( ) ; activeDataEntries . stream ( ) . forEach ( e -> { if ( e . getTenantId ( ) . equals ( tenantId ) && e . getTriggerId ( ) . equals ( triggerId ) ) { dataEntriesToRemove . add ( e ) ; } } ) ; activeDataEntries . removeAll ( dataEntriesToRemove ) ; Set < DataId > dataIdToCheck = new HashSet < > ( ) ; dataEntriesToRemove . stream ( ) . forEach ( e -> { dataIdToCheck . add ( new DataId ( e . getTenantId ( ) , e . getDataId ( ) ) ) ; } ) ; Set < DataId > dataIdToRemove = new HashSet < > ( ) ; dataIdToCheck . stream ( ) . forEach ( dataId -> { boolean found = false ; for ( DataEntry entry : activeDataEntries ) { DataId currentDataId = new DataId ( entry . getTenantId ( ) , entry . getDataId ( ) ) ; if ( currentDataId . equals ( dataId ) ) { found = true ; break ; } } if ( ! found ) { dataIdToRemove . add ( dataId ) ; } } ) ; activeDataIds . removeAll ( dataIdToRemove ) ;
|
public class service_stats { /** * Use this API to fetch the statistics of all service _ stats resources that are configured on netscaler . */
public static service_stats [ ] get ( nitro_service service ) throws Exception { } }
|
service_stats obj = new service_stats ( ) ; service_stats [ ] response = ( service_stats [ ] ) obj . stat_resources ( service ) ; return response ;
|
public class TelemetryService { /** * configure telemetry deployment based on connection url and info
* Note : it is not thread - safe while connecting to different deployments
* simultaneously .
* @ param url
* @ param account */
private void configureDeployment ( final String url , final String account , final String port ) { } }
|
// default value
TELEMETRY_SERVER_DEPLOYMENT deployment = TELEMETRY_SERVER_DEPLOYMENT . PROD ; if ( url != null ) { if ( url . contains ( "reg" ) || url . contains ( "local" ) ) { deployment = TELEMETRY_SERVER_DEPLOYMENT . REG ; if ( ( port != null && port . compareTo ( "8080" ) == 0 ) || url . contains ( "8080" ) ) { deployment = TELEMETRY_SERVER_DEPLOYMENT . DEV ; } } else if ( url . contains ( "qa1" ) || ( account != null && account . contains ( "qa1" ) ) ) { deployment = TELEMETRY_SERVER_DEPLOYMENT . QA1 ; } else if ( url . contains ( "preprod2" ) ) { deployment = TELEMETRY_SERVER_DEPLOYMENT . PREPROD2 ; } } this . setDeployment ( deployment ) ;
|
public class Tensor { /** * Gets the max value in the tensor . */
public double getMax ( ) { } }
|
double max = s . minValue ( ) ; for ( int c = 0 ; c < this . values . length ; c ++ ) { if ( s . gte ( values [ c ] , max ) ) { max = values [ c ] ; } } return max ;
|
public class VarOptItemsUnion { /** * Gets the varopt sketch resulting from the union of any input sketches .
* @ return A varopt sketch */
public VarOptItemsSketch < T > getResult ( ) { } }
|
// If no marked items in H , gadget is already valid mathematically . We can return what is
// basically just a copy of the gadget .
if ( gadget_ . getNumMarksInH ( ) == 0 ) { return simpleGadgetCoercer ( ) ; } else { // At this point , we know that marked items are present in H . So :
// 1 . Result will necessarily be in estimation mode
// 2 . Marked items currently in H need to be absorbed into reservoir ( R )
final VarOptItemsSketch < T > tmp = detectAndHandleSubcaseOfPseudoExact ( ) ; if ( tmp != null ) { // sub - case detected and handled , so return the result
return tmp ; } else { // continue with main logic
return migrateMarkedItemsByDecreasingK ( ) ; } }
|
public class IncludeExcludeExtension { /** * in contrast to the three other handleXXX methods , this one includes nodes */
private void handleFeatureIncludes ( SpecInfo spec , IncludeExcludeCriteria criteria ) { } }
|
if ( criteria . isEmpty ( ) ) return ; for ( FeatureInfo feature : spec . getAllFeatures ( ) ) if ( hasAnyAnnotation ( feature . getFeatureMethod ( ) , criteria . annotations ) ) feature . setExcluded ( false ) ;
|
public class EvernoteClientFactory { /** * Returns an async wrapper providing several helper methods for business notebooks . With
* { @ link EvernoteBusinessNotebookHelper # getClient ( ) } you can get access to the underlying { @ link EvernoteNoteStoreClient } ,
* which references the business note store URL .
* @ return An async wrapper providing several helper methods . */
public synchronized EvernoteBusinessNotebookHelper getBusinessNotebookHelper ( ) throws TException , EDAMUserException , EDAMSystemException { } }
|
if ( mBusinessNotebookHelper == null || isBusinessAuthExpired ( ) ) { mBusinessNotebookHelper = createBusinessNotebookHelper ( ) ; } return mBusinessNotebookHelper ;
|
public class ChannelAction { /** * Sets the { @ link net . dv8tion . jda . core . entities . Category Category } for the new Channel
* @ param category
* The parent for the new Channel
* @ throws UnsupportedOperationException
* If this ChannelAction is for a Category
* @ throws IllegalArgumentException
* If the provided category is { @ code null }
* or not from this Guild
* @ return The current ChannelAction , for chaining convenience */
@ CheckReturnValue public ChannelAction setParent ( Category category ) { } }
|
Checks . check ( category == null || category . getGuild ( ) . equals ( guild ) , "Category is not from same guild!" ) ; this . parent = category ; return this ;
|
public class JMStats { /** * Gets percentile value .
* @ param targetPercentile the target percentile
* @ param unorderedNumberList the unordered number list
* @ return the percentile value */
public static Number getPercentileValue ( int targetPercentile , List < Number > unorderedNumberList ) { } }
|
return getPercentileValueWithSorted ( targetPercentile , sortedDoubleList ( unorderedNumberList ) ) ;
|
public class WebConfigParamUtils { /** * Gets the String init parameter value from the specified context . If the parameter is an
* empty String or a String
* containing only white space , this method returns < code > null < / code >
* @ param context
* the application ' s external context
* @ param names
* the init parameter ' s names , the first one is scanned first . Usually used when a
* param has multiple aliases
* @ return the parameter if it was specified and was not empty , < code > null < / code > otherwise
* @ throws NullPointerException
* if context or name is < code > null < / code > */
public static String getStringInitParameter ( ExternalContext context , String [ ] names ) { } }
|
return getStringInitParameter ( context , names , null ) ;
|
public class ViewDragHelper { /** * Sets the sensitivity of the dragger .
* @ param context The application context .
* @ param sensitivity value between 0 and 1 , the final value for touchSlop =
* ViewConfiguration . getScaledTouchSlop * ( 1 / s ) ; */
public void setSensitivity ( Context context , float sensitivity ) { } }
|
float s = Math . max ( 0f , Math . min ( 1.0f , sensitivity ) ) ; ViewConfiguration viewConfiguration = ViewConfiguration . get ( context ) ; mTouchSlop = ( int ) ( viewConfiguration . getScaledTouchSlop ( ) * ( 1 / s ) ) ;
|
public class Objects { /** * Verifies input objects are equal .
* @ param o1 the first argument to compare
* @ param o2 the second argument to compare
* @ return true , if the input arguments are equal , false otherwise . */
public static < O > boolean eq ( O o1 , O o2 ) { } }
|
return o1 != null ? o1 . equals ( o2 ) : o2 == null ;
|
public class ResponderTask { /** * Look for the detect pattern in the input , if seen return true . If the failure pattern is detected , return false .
* If a max timeout or max number of lines to read is exceeded , throw threshhold error . */
static boolean detect ( final String detectPattern , final String failurePattern , final long timeout , final int maxLines , final InputStreamReader reader , final PartialLineBuffer buffer ) throws IOException , ThreshholdException { } }
|
if ( null == detectPattern && null == failurePattern ) { throw new IllegalArgumentException ( "detectPattern or failurePattern required" ) ; } long start = System . currentTimeMillis ( ) ; int linecount = 0 ; final Pattern success ; if ( null != detectPattern ) { success = Pattern . compile ( detectPattern ) ; } else { success = null ; } final Pattern failure ; if ( null != failurePattern ) { failure = Pattern . compile ( failurePattern ) ; } else { failure = null ; } outer : while ( System . currentTimeMillis ( ) < start + timeout && linecount < maxLines && ! Thread . currentThread ( ) . isInterrupted ( ) ) { // check buffer first , it may already contain data
String line = buffer . readLine ( ) ; while ( null != line ) { logger . debug ( "read line: " + line ) ; start = System . currentTimeMillis ( ) ; linecount ++ ; if ( null != success && success . matcher ( line ) . matches ( ) ) { logger . debug ( "success matched" ) ; return true ; } else if ( null != failure && failure . matcher ( line ) . matches ( ) ) { logger . debug ( "failure matched" ) ; return false ; } if ( linecount >= maxLines ) { break outer ; } line = buffer . readLine ( ) ; } line = buffer . getPartialLine ( ) ; if ( null != line ) { logger . debug ( "read partial: " + line ) ; if ( null != success && success . matcher ( line ) . matches ( ) ) { logger . debug ( "success matched partial" ) ; buffer . clearPartial ( ) ; return true ; } else if ( null != failure && failure . matcher ( line ) . matches ( ) ) { logger . debug ( "failure matched partial" ) ; buffer . clearPartial ( ) ; return false ; } else { buffer . unmarkPartial ( ) ; } } if ( ! reader . ready ( ) ) { try { Thread . sleep ( 500 ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; return false ; } continue ; } final int c = buffer . read ( reader ) ; if ( c < 0 ) { // end of stream
logger . debug ( "end of input" ) ; } else if ( c > 0 ) { logger . debug ( "read " + c ) ; } } if ( Thread . currentThread ( ) . isInterrupted ( ) ) { logger . debug ( "detect interrupted" ) ; } if ( linecount >= maxLines ) { logger . debug ( "max input lines" ) ; throw new ThreshholdException ( maxLines , ThresholdType . lines ) ; } else if ( System . currentTimeMillis ( ) >= start + timeout ) { logger . debug ( "max timeout" ) ; throw new ThreshholdException ( timeout , ThresholdType . milliseconds ) ; } else { return false ; }
|
public class LifecycleManager { /** * Add the objects to the container . Their assets will be loaded , post construct methods called , etc .
* @ param objects objects to add
* @ throws Exception errors */
@ Deprecated public void add ( Object ... objects ) throws Exception { } }
|
for ( Object obj : objects ) { add ( obj ) ; }
|
public class MArray { /** * Returns a reference to the MValue of the item at the given index .
* If the index is out of range , returns an empty MValue . */
public MValue get ( long index ) { } }
|
if ( index < 0 || index >= values . size ( ) ) { return MValue . EMPTY ; } MValue value = values . get ( ( int ) index ) ; if ( value . isEmpty ( ) && ( baseArray != null ) ) { value = new MValue ( baseArray . get ( index ) ) ; values . set ( ( int ) index , value ) ; } return value ;
|
public class ChatResource { /** * Suspend the response without writing anything back to the client .
* @ return a white space */
@ GET public String suspend ( ) { } }
|
AtmosphereResource r = ( AtmosphereResource ) req . getAttribute ( "org.atmosphere.cpr.AtmosphereResource" ) ; r . setBroadcaster ( r . getAtmosphereConfig ( ) . getBroadcasterFactory ( ) . lookup ( "/cxf-chat" , true ) ) . suspend ( ) ; return "" ;
|
public class RebindConfiguration { /** * Return a { @ link MapperInstance } instantiating the serializer for the given type
* @ param type a { @ link com . google . gwt . core . ext . typeinfo . JType } object .
* @ return a { @ link com . google . gwt . thirdparty . guava . common . base . Optional } object . */
public Optional < MapperInstance > getSerializer ( JType type ) { } }
|
return Optional . fromNullable ( serializers . get ( type . getQualifiedSourceName ( ) ) ) ;
|
public class RuleBasedNumberFormat { /** * lazily initialize relevant items */
@ Override public void setContext ( DisplayContext context ) { } }
|
super . setContext ( context ) ; if ( ! capitalizationInfoIsSet && ( context == DisplayContext . CAPITALIZATION_FOR_UI_LIST_OR_MENU || context == DisplayContext . CAPITALIZATION_FOR_STANDALONE ) ) { initCapitalizationContextInfo ( locale ) ; capitalizationInfoIsSet = true ; } if ( capitalizationBrkIter == null && ( context == DisplayContext . CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || ( context == DisplayContext . CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForListOrMenu ) || ( context == DisplayContext . CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone ) ) ) { capitalizationBrkIter = BreakIterator . getSentenceInstance ( locale ) ; }
|
public class ConcurrentLinkedHashMap { /** * Moves the tasks from the specified buffer into the output array .
* @ param tasks the ordered array of the pending operations
* @ param bufferIndex the buffer to drain into the tasks array
* @ return the highest index location of a task that was added to the array */
int moveTasksFromBuffer ( Task [ ] tasks , int bufferIndex ) { } }
|
// While a buffer is being drained it may be concurrently appended to .
// The
// number of tasks removed are tracked so that the length can be
// decremented
// by the delta rather than set to zero .
Queue < Task > buffer = buffers [ bufferIndex ] ; int removedFromBuffer = 0 ; Task task ; int maxIndex = - 1 ; while ( ( task = buffer . poll ( ) ) != null ) { removedFromBuffer ++ ; // The index into the output array is determined by calculating the
// offset
// since the last drain
int index = task . getOrder ( ) - drainedOrder ; if ( index < 0 ) { // The task was missed by the last drain and can be run
// immediately
task . run ( ) ; } else if ( index >= tasks . length ) { // Due to concurrent additions , the order exceeds the capacity
// of the
// output array . It is added to the end as overflow and the
// remaining
// tasks in the buffer will be handled by the next drain .
maxIndex = tasks . length - 1 ; addTaskToChain ( tasks , task , maxIndex ) ; break ; } else { // Add the task to the array so that it is run in sequence
maxIndex = Math . max ( index , maxIndex ) ; addTaskToChain ( tasks , task , index ) ; } } bufferLengths . addAndGet ( bufferIndex , - removedFromBuffer ) ; return maxIndex ;
|
public class ExpiryIndex { /** * Add an ExpirableReference to the expiry index .
* @ param expirable an ExpirableReference .
* @ return true if the object was added to the index successfully . */
public boolean put ( ExpirableReference expirable ) { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "put" , "ObjId=" + expirable . getID ( ) + " ET=" + expirable . getExpiryTime ( ) ) ; boolean reply = tree . insert ( expirable ) ; if ( reply ) { size ++ ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "put" , "reply=" + reply ) ; return reply ;
|
public class ReportingController { /** * Convert a query parameter to the correct object type based on the first letter of the name .
* @ param name parameter name
* @ param value parameter value
* @ return parameter object as
* @ throws ParseException value could not be parsed
* @ throws NumberFormatException value could not be parsed */
private Object getParameter ( String name , String value ) throws ParseException , NumberFormatException { } }
|
Object result = null ; if ( name . length ( ) > 0 ) { switch ( name . charAt ( 0 ) ) { case 'i' : if ( null == value || value . length ( ) == 0 ) { value = "0" ; } result = new Integer ( value ) ; break ; case 'f' : if ( name . startsWith ( "form" ) ) { result = value ; } else { if ( null == value || value . length ( ) == 0 ) { value = "0.0" ; } result = new Double ( value ) ; } break ; case 'd' : if ( null == value || value . length ( ) == 0 ) { result = null ; } else { SimpleDateFormat dateParser = new SimpleDateFormat ( "yyyy-MM-dd" ) ; result = dateParser . parse ( value ) ; } break ; case 't' : if ( null == value || value . length ( ) == 0 ) { result = null ; } else { SimpleDateFormat timeParser = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss" ) ; result = timeParser . parse ( value ) ; } break ; case 'b' : result = "true" . equalsIgnoreCase ( value ) ? Boolean . TRUE : Boolean . FALSE ; break ; default : result = value ; } if ( log . isDebugEnabled ( ) ) { if ( result != null ) { log . debug ( "parameter " + name + " value " + result + " class " + result . getClass ( ) . getName ( ) ) ; } else { log . debug ( "parameter" + name + "is null" ) ; } } } return result ;
|
public class LDblToByteFuncMemento { /** * < editor - fold desc = " object " > */
public static boolean argEquals ( LDblToByteFuncMemento the , Object that ) { } }
|
return Null . < LDblToByteFuncMemento > equals ( the , that , ( one , two ) -> { if ( one . getClass ( ) != two . getClass ( ) ) { return false ; } LDblToByteFuncMemento other = ( LDblToByteFuncMemento ) two ; return LObjBytePair . argEquals ( one . function , one . lastValue ( ) , other . function , other . lastValue ( ) ) ; } ) ;
|
public class QueryResponse { /** * This method flats the two levels ( QueryResponse and QueryResult ) into a single list of T .
* @ return a single list with all the results , or null if no response exists */
public List < T > allResults ( ) { } }
|
List < T > results = null ; if ( response != null && response . size ( ) > 0 ) { // We first calculate the total size needed
int totalSize = allResultsSize ( ) ; // We init the list and copy data
results = new ArrayList < > ( totalSize ) ; for ( QueryResult < T > queryResult : response ) { results . addAll ( queryResult . getResult ( ) ) ; } } return results ;
|
public class CatalogUtil { /** * Given plan graphs and a SQL statement , compute a bidirectional usage map between
* schema ( indexes , table & views ) and SQL / Procedures .
* Use " annotation " objects to store this extra information in the catalog
* during compilation and catalog report generation . */
public static void updateUsageAnnotations ( Database db , Statement stmt , AbstractPlanNode topPlan , AbstractPlanNode bottomPlan ) { } }
|
Map < String , StmtTargetTableScan > tablesRead = new TreeMap < > ( ) ; Collection < String > indexes = new TreeSet < > ( ) ; if ( topPlan != null ) { topPlan . getTablesAndIndexes ( tablesRead , indexes ) ; } if ( bottomPlan != null ) { bottomPlan . getTablesAndIndexes ( tablesRead , indexes ) ; } String updated = "" ; if ( ! stmt . getReadonly ( ) ) { updated = topPlan . getUpdatedTable ( ) ; if ( updated == null ) { updated = bottomPlan . getUpdatedTable ( ) ; } assert ( updated . length ( ) > 0 ) ; } Set < String > readTableNames = tablesRead . keySet ( ) ; stmt . setTablesread ( StringUtils . join ( readTableNames , "," ) ) ; stmt . setTablesupdated ( updated ) ; Set < String > tableDotIndexNames = new TreeSet < > ( ) ; for ( Table table : db . getTables ( ) ) { if ( readTableNames . contains ( table . getTypeName ( ) ) ) { readTableNames . remove ( table . getTypeName ( ) ) ; for ( String indexName : indexes ) { Index index = table . getIndexes ( ) . get ( indexName ) ; if ( index != null ) { tableDotIndexNames . add ( table . getTypeName ( ) + "." + index . getTypeName ( ) ) ; } } } } String indexString = StringUtils . join ( tableDotIndexNames , "," ) ; stmt . setIndexesused ( indexString ) ; assert ( tablesRead . size ( ) == 0 ) ;
|
public class UcsApi { /** * Get the history of interactions for a contact
* @ param id id of the Contact ( required )
* @ param contactHistoryData ( required )
* @ return ApiSuccessResponse
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiSuccessResponse getContactHistory ( String id , ContactHistoryData contactHistoryData ) throws ApiException { } }
|
ApiResponse < ApiSuccessResponse > resp = getContactHistoryWithHttpInfo ( id , contactHistoryData ) ; return resp . getData ( ) ;
|
public class FrameworkProjectConfig { /** * Create PropertyLookup for a project from the framework basedir
* @ param filesystemFramework the filesystem */
private static PropertyLookup createProjectPropertyLookup ( IFilesystemFramework filesystemFramework , String projectName ) { } }
|
PropertyLookup lookup ; final Properties ownProps = new Properties ( ) ; ownProps . setProperty ( "project.name" , projectName ) ; File baseDir = filesystemFramework . getBaseDir ( ) ; File projectsBaseDir = filesystemFramework . getFrameworkProjectsBaseDir ( ) ; // generic framework properties for a project
final File fwkProjectPropertyFile = FilesystemFramework . getPropertyFile ( filesystemFramework . getConfigDir ( ) ) ; final Properties nodeWideDepotProps = PropertyLookup . fetchProperties ( fwkProjectPropertyFile ) ; nodeWideDepotProps . putAll ( ownProps ) ; final File propertyFile = getProjectPropertyFile ( new File ( projectsBaseDir , projectName ) ) ; if ( propertyFile . exists ( ) ) { lookup = PropertyLookup . create ( propertyFile , nodeWideDepotProps , FilesystemFramework . createPropertyLookupFromBasedir ( baseDir ) ) ; } else { lookup = PropertyLookup . create ( fwkProjectPropertyFile , ownProps , FilesystemFramework . createPropertyLookupFromBasedir ( baseDir ) ) ; } lookup . expand ( ) ; return lookup ;
|
public class Crypto { /** * Encrypts a given plain text using the application secret property ( application . secret ) as key
* Encryption is done by using AES and CBC Cipher and a key length of 256 bit
* @ param plainText The plain text to encrypt
* @ return The encrypted text or null if encryption fails */
public String encrypt ( String plainText ) { } }
|
Objects . requireNonNull ( plainText , Required . PLAIN_TEXT . toString ( ) ) ; return encrypt ( plainText , getSizedSecret ( this . config . getApplicationSecret ( ) ) ) ;
|
public class KeyVerifyParameters { /** * Set the signature value .
* @ param signature the signature value to set
* @ return the KeyVerifyParameters object itself . */
public KeyVerifyParameters withSignature ( byte [ ] signature ) { } }
|
if ( signature == null ) { this . signature = null ; } else { this . signature = Base64Url . encode ( signature ) ; } return this ;
|
public class ConnectionImpl { /** * Internal method for creating the consumer .
* @ param destAddr
* @ param alternateUser
* @ param destinationType
* @ param discriminator
* @ param selector
* @ param reliability
* @ param enableReadAhead
* @ param nolocal
* @ param forwardScanning
* @ param system
* @ param unrecoverableReliability
* @ param bifurcatable
* @ param mqinterop
* @ return */
private ConsumerSession internalCreateConsumerSession ( SIDestinationAddress destAddr , String alternateUser , DestinationType destinationType , SelectionCriteria criteria , Reliability reliability , boolean enableReadAhead , boolean nolocal , boolean forwardScanning , boolean system , Reliability unrecoverableReliability , boolean bifurcatable , boolean mqinterop , boolean ignoreInitialIndoubts , boolean gatherMessages ) throws SIConnectionUnavailableException , SIConnectionDroppedException , SIResourceException , SIConnectionLostException , SILimitExceededException , SIErrorException , SINotAuthorizedException , SIIncorrectCallException , SIDestinationLockedException , SINotPossibleInCurrentConfigurationException , SITemporaryDestinationNotFoundException { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "internalCreateConsumerSession" , new Object [ ] { destAddr , alternateUser , destinationType , criteria , reliability , Boolean . valueOf ( enableReadAhead ) , Boolean . valueOf ( nolocal ) , Boolean . valueOf ( forwardScanning ) , Boolean . valueOf ( system ) , unrecoverableReliability , Boolean . valueOf ( bifurcatable ) , Boolean . valueOf ( mqinterop ) , Boolean . valueOf ( ignoreInitialIndoubts ) , Boolean . valueOf ( gatherMessages ) } ) ; try { return internalCreateConsumerSession ( null , destAddr , alternateUser , destinationType , criteria , reliability , enableReadAhead , nolocal , forwardScanning , system , unrecoverableReliability , bifurcatable , mqinterop , ignoreInitialIndoubts , gatherMessages ) ; } finally { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "internalCreateConsumerSession" ) ; }
|
public class Kit { /** * Get listener at < i > index < / i > position in < i > bag < / i > or null if
* < i > index < / i > equals to number of listeners in < i > bag < / i > .
* For usage example , see { @ link # addListener ( Object bag , Object listener ) } .
* @ param bag Current collection of listeners .
* @ param index Index of the listener to access .
* @ return Listener at the given index or null .
* @ see # addListener ( Object bag , Object listener )
* @ see # removeListener ( Object bag , Object listener ) */
public static Object getListener ( Object bag , int index ) { } }
|
if ( index == 0 ) { if ( bag == null ) return null ; if ( ! ( bag instanceof Object [ ] ) ) return bag ; Object [ ] array = ( Object [ ] ) bag ; // bag has at least 2 elements if it is array
if ( array . length < 2 ) throw new IllegalArgumentException ( ) ; return array [ 0 ] ; } else if ( index == 1 ) { if ( ! ( bag instanceof Object [ ] ) ) { if ( bag == null ) throw new IllegalArgumentException ( ) ; return null ; } Object [ ] array = ( Object [ ] ) bag ; // the array access will check for index on its own
return array [ 1 ] ; } else { // bag has to array
Object [ ] array = ( Object [ ] ) bag ; int L = array . length ; if ( L < 2 ) throw new IllegalArgumentException ( ) ; if ( index == L ) return null ; return array [ index ] ; }
|
public class ExpressionToken { /** * Get the value from < code > array < / code > at < code > index < / code >
* @ param array the array
* @ param index the index
* @ return the value returned from < code > Array . get ( array , index ) < / code > */
protected final Object arrayLookup ( Object array , int index ) { } }
|
LOGGER . trace ( "get value from array index " + index ) ; return Array . get ( array , index ) ;
|
public class ListPoliciesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListPoliciesRequest listPoliciesRequest , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( listPoliciesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listPoliciesRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listPoliciesRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class ClassificationService { /** * Attach a { @ link ClassificationModel } with the given classificationText and description to the provided { @ link FileModel } .
* If an existing Model exists with the provided classificationText , that one will be used instead .
* The classification is looked up by name and created only if not found .
* That means that the new description is discarded . FIXME */
public ClassificationModel attachClassification ( GraphRewrite event , Rule rule , FileModel fileModel , String categoryId , String classificationTitle , String description ) { } }
|
Traversal < ? , ? > classificationTraversal = getQuery ( ) . traverse ( g -> g . has ( ClassificationModel . CLASSIFICATION , classificationTitle ) ) . getRawTraversal ( ) ; ClassificationModel classification = getUnique ( classificationTraversal ) ; if ( classification == null ) { classification = create ( ) ; classification . setClassification ( classificationTitle ) ; classification . setDescription ( description ) ; classification . setEffort ( 0 ) ; IssueCategoryModel cat = IssueCategoryRegistry . loadFromGraph ( event . getGraphContext ( ) , categoryId ) ; classification . setIssueCategory ( cat ) ; classification . setRuleID ( rule . getId ( ) ) ; if ( fileModel instanceof DuplicateArchiveModel ) { fileModel = ( ( DuplicateArchiveModel ) fileModel ) . getCanonicalArchive ( ) ; } classification . addFileModel ( fileModel ) ; if ( fileModel instanceof SourceFileModel ) ( ( SourceFileModel ) fileModel ) . setGenerateSourceReport ( true ) ; ClassificationServiceCache . cacheClassificationFileModel ( event , classification , fileModel , true ) ; return classification ; } else { if ( ! StringUtils . equals ( description , classification . getDescription ( ) ) ) LOG . warning ( "The description of the newly attached classification differs from the same-titled existing one, so the old description is being changed." + System . lineSeparator ( ) + " Clsf title: " + classification . getClassification ( ) + System . lineSeparator ( ) + " Old desc: " + classification . getDescription ( ) + System . lineSeparator ( ) + " New desc: " + description ) ; classification . setDescription ( description ) ; } return attachClassification ( event , classification , fileModel ) ;
|
public class CompositeArtifactStore { /** * { @ inheritDoc } */
public Metadata getMetadata ( String path ) throws IOException , MetadataNotFoundException { } }
|
boolean found = false ; Metadata result = new Metadata ( ) ; Set < String > pluginArtifactIds = new HashSet < String > ( ) ; Set < String > snapshotVersions = new HashSet < String > ( ) ; for ( int i = 0 ; i < stores . length ; i ++ ) { try { Metadata partial = stores [ i ] . getMetadata ( path ) ; if ( StringUtils . isEmpty ( result . getArtifactId ( ) ) && ! StringUtils . isEmpty ( partial . getArtifactId ( ) ) ) { result . setArtifactId ( partial . getArtifactId ( ) ) ; found = true ; } if ( StringUtils . isEmpty ( result . getGroupId ( ) ) && ! StringUtils . isEmpty ( partial . getGroupId ( ) ) ) { result . setGroupId ( partial . getGroupId ( ) ) ; found = true ; } if ( StringUtils . isEmpty ( result . getVersion ( ) ) && ! StringUtils . isEmpty ( partial . getVersion ( ) ) ) { result . setVersion ( partial . getVersion ( ) ) ; found = true ; } if ( partial . getPlugins ( ) != null && ! partial . getPlugins ( ) . isEmpty ( ) ) { for ( Plugin plugin : partial . getPlugins ( ) ) { if ( ! pluginArtifactIds . contains ( plugin . getArtifactId ( ) ) ) { result . addPlugin ( plugin ) ; pluginArtifactIds . add ( plugin . getArtifactId ( ) ) ; } } found = true ; } if ( partial . getVersioning ( ) != null ) { Versioning rVers = result . getVersioning ( ) ; if ( rVers == null ) { rVers = new Versioning ( ) ; } Versioning pVers = partial . getVersioning ( ) ; String rLU = found ? rVers . getLastUpdated ( ) : null ; String pLU = pVers . getLastUpdated ( ) ; if ( pLU != null && ( rLU == null || rLU . compareTo ( pLU ) < 0 ) ) { // partial is newer or only
if ( ! StringUtils . isEmpty ( pVers . getLatest ( ) ) ) { rVers . setLatest ( pVers . getLatest ( ) ) ; } if ( ! StringUtils . isEmpty ( pVers . getRelease ( ) ) ) { rVers . setLatest ( pVers . getRelease ( ) ) ; } rVers . setLastUpdated ( pVers . getLastUpdated ( ) ) ; } for ( String version : pVers . getVersions ( ) ) { if ( ! rVers . getVersions ( ) . contains ( version ) ) { rVers . addVersion ( version ) ; } } if ( pVers . getSnapshot ( ) != null ) { if ( rVers . getSnapshot ( ) == null || pVers . getSnapshot ( ) . getBuildNumber ( ) > rVers . getSnapshot ( ) . getBuildNumber ( ) ) { Snapshot snapshot = new Snapshot ( ) ; snapshot . setBuildNumber ( pVers . getSnapshot ( ) . getBuildNumber ( ) ) ; snapshot . setTimestamp ( pVers . getSnapshot ( ) . getTimestamp ( ) ) ; rVers . setSnapshot ( snapshot ) ; } } try { if ( pVers . getSnapshotVersions ( ) != null && ! pVers . getSnapshotVersions ( ) . isEmpty ( ) ) { for ( SnapshotVersion snapshotVersion : pVers . getSnapshotVersions ( ) ) { String key = snapshotVersion . getVersion ( ) + "-" + snapshotVersion . getClassifier ( ) + "." + snapshotVersion . getExtension ( ) ; if ( ! snapshotVersions . contains ( key ) ) { rVers . addSnapshotVersion ( snapshotVersion ) ; snapshotVersions . add ( key ) ; } } } } catch ( NoSuchMethodError e ) { // Maven 2
} result . setVersioning ( rVers ) ; found = true ; } } catch ( MetadataNotFoundException e ) { // ignore
} } if ( ! found ) { throw new MetadataNotFoundException ( path ) ; } return result ;
|
public class InvalidationAuditDaemon { /** * This ensures the specified CacheEntrys have not been invalidated .
* @ param cacheEntry The unfiltered CacheEntry .
* @ return The filtered CacheEntry . */
public CacheEntry filterEntry ( String cacheName , CacheEntry cacheEntry ) { } }
|
InvalidationTableList invalidationTableList = getInvalidationTableList ( cacheName ) ; try { invalidationTableList . readWriteLock . readLock ( ) . lock ( ) ; return internalFilterEntry ( cacheName , invalidationTableList , cacheEntry ) ; } finally { invalidationTableList . readWriteLock . readLock ( ) . unlock ( ) ; }
|
public class AmazonConfigClient { /** * Indicates whether the specified AWS resources are compliant . If a resource is noncompliant , this action returns
* the number of AWS Config rules that the resource does not comply with .
* A resource is compliant if it complies with all the AWS Config rules that evaluate it . It is noncompliant if it
* does not comply with one or more of these rules .
* If AWS Config has no current evaluation results for the resource , it returns < code > INSUFFICIENT _ DATA < / code > . This
* result might indicate one of the following conditions about the rules that evaluate the resource :
* < ul >
* < li >
* AWS Config has never invoked an evaluation for the rule . To check whether it has , use the
* < code > DescribeConfigRuleEvaluationStatus < / code > action to get the < code > LastSuccessfulInvocationTime < / code > and
* < code > LastFailedInvocationTime < / code > .
* < / li >
* < li >
* The rule ' s AWS Lambda function is failing to send evaluation results to AWS Config . Verify that the role that you
* assigned to your configuration recorder includes the < code > config : PutEvaluations < / code > permission . If the rule
* is a custom rule , verify that the AWS Lambda execution role includes the < code > config : PutEvaluations < / code >
* permission .
* < / li >
* < li >
* The rule ' s AWS Lambda function has returned < code > NOT _ APPLICABLE < / code > for all evaluation results . This can
* occur if the resources were deleted or removed from the rule ' s scope .
* < / li >
* < / ul >
* @ param describeComplianceByResourceRequest
* @ return Result of the DescribeComplianceByResource operation returned by the service .
* @ throws InvalidParameterValueException
* One or more of the specified parameters are invalid . Verify that your parameters are valid and try again .
* @ throws InvalidNextTokenException
* The specified next token is invalid . Specify the < code > nextToken < / code > string that was returned in the
* previous response to get the next page of results .
* @ sample AmazonConfig . DescribeComplianceByResource
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / config - 2014-11-12 / DescribeComplianceByResource "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DescribeComplianceByResourceResult describeComplianceByResource ( DescribeComplianceByResourceRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executeDescribeComplianceByResource ( request ) ;
|
public class SqlExecutor { /** * 执行查询语句并关闭PreparedStatement
* @ param < T > 处理结果类型
* @ param ps PreparedStatement
* @ param rsh 结果集处理对象
* @ param params 参数
* @ return 结果对象
* @ throws SQLException SQL执行异常 */
public static < T > T queryAndClosePs ( PreparedStatement ps , RsHandler < T > rsh , Object ... params ) throws SQLException { } }
|
try { return query ( ps , rsh , params ) ; } finally { DbUtil . close ( ps ) ; }
|
public class AbstractOpenTracingFilter { /** * Resolve the span name to use for the request .
* @ param request The request
* @ return The span name */
protected String resolveSpanName ( HttpRequest < ? > request ) { } }
|
Optional < String > route = request . getAttribute ( HttpAttributes . URI_TEMPLATE , String . class ) ; return route . map ( s -> request . getMethod ( ) + " " + s ) . orElse ( request . getMethod ( ) + " " + request . getPath ( ) ) ;
|
public class SocketTransport { /** * Connects to the mentioned host and port with SSL and checks the certificate against the pinned version .
* @ param address host : port to connect to
* @ param pinnedcert expected certificate of the server
* @ return instance of this class
* @ throws IOException if establishing the connection fails */
public static SocketTransport connect ( InetSocketAddress address , X509Certificate pinnedcert ) throws IOException { } }
|
SSLSocketFactory factory = get_ssl_socket_factory ( pinnedcert ) ; Socket s = factory . createSocket ( address . getHostString ( ) , address . getPort ( ) ) ; return new SocketTransport ( s ) ;
|
public class Optionals { /** * Adapter to create an Optional out of the first element of a List . If the list is empty , we get
* an empty optional . Also , if the first element is null , return an empty optional .
* @ param < T > the type of objects in the list
* @ param list the list to look at
* @ return the possible first element in list */
public static < T > Optional < T > firstInList ( List < T > list ) { } }
|
return list . isEmpty ( ) ? Optional . empty ( ) : Optional . ofNullable ( list . get ( 0 ) ) ;
|
public class FileSystemUtils { /** * Lists all files in the given directory accepted by the { @ link FileFilter } . This method uses recursion to list
* all files in the given directory as well as any sub - directories of the given directory accepted by
* the { @ link FileFilter } .
* @ param directory the directory to search for files .
* @ param fileFilter the { @ link FileFilter } used to filter and match files .
* @ return an array of all files in the given directory and any sub - directories of the given directory accepted by
* the { @ link FileFilter } .
* @ see # safeListFiles ( File , FileFilter )
* @ see java . io . FileFilter
* @ see java . io . File */
@ NullSafe public static File [ ] listFiles ( File directory , FileFilter fileFilter ) { } }
|
List < File > files = new ArrayList < > ( ) ; for ( File file : safeListFiles ( directory , fileFilter ) ) { files . addAll ( isDirectory ( file ) ? Arrays . asList ( listFiles ( file , fileFilter ) ) : Collections . singletonList ( file ) ) ; } return ( files . isEmpty ( ) ? NO_FILES : files . toArray ( new File [ files . size ( ) ] ) ) ;
|
public class CanonicalPlanner { /** * Attach DUP _ REMOVE node at top of tree . The DUP _ REMOVE may be pushed down to a source ( or sources ) if possible by the
* optimizer .
* @ param context the context in which the query is being planned
* @ param plan the existing plan
* @ return the updated plan */
protected PlanNode attachDuplicateRemoval ( QueryContext context , PlanNode plan ) { } }
|
PlanNode dupNode = new PlanNode ( Type . DUP_REMOVE ) ; plan . setParent ( dupNode ) ; return dupNode ;
|
public class TDHttpClient { /** * Submit an API request , and bind the returned JSON data into an object of the given result jackson JavaType .
* For mapping it uses Jackson object mapper .
* @ param apiRequest
* @ param resultType
* @ param < Result >
* @ return
* @ throws TDClientException */
@ SuppressWarnings ( value = "unchecked cast" ) public < Result > Result call ( TDApiRequest apiRequest , Optional < String > apiKeyCache , final JavaType resultType ) throws TDClientException { } }
|
try { byte [ ] content = submitRequest ( apiRequest , apiKeyCache , byteArrayContentHandler ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "response:\n{}" , new String ( content , StandardCharsets . UTF_8 ) ) ; } if ( resultType . getRawClass ( ) == String . class ) { return ( Result ) new String ( content , StandardCharsets . UTF_8 ) ; } else { return getJsonReader ( resultType ) . readValue ( content ) ; } } catch ( JsonMappingException e ) { logger . error ( "Jackson mapping error" , e ) ; throw new TDClientException ( INVALID_JSON_RESPONSE , e ) ; } catch ( IOException e ) { throw new TDClientException ( INVALID_JSON_RESPONSE , e ) ; }
|
public class AbstractContextSelectToolbarStatusPanel { /** * Gets the Context select combo box .
* @ return the context select combo box */
protected ContextSelectComboBox getContextSelectComboBox ( ) { } }
|
if ( contextSelectBox == null ) { contextSelectBox = new ContextSelectComboBox ( ) ; contextSelectBox . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent e ) { contextSelected ( ( Context ) contextSelectBox . getSelectedItem ( ) ) ; } } ) ; } return contextSelectBox ;
|
public class BELUtilities { /** * Check equality of two substrings . This method does not create
* intermediate { @ link String } objects and is roughly equivalent to :
* < pre >
* < code >
* String sub1 = s1 . substring ( fromIndex1 , toIndex1 ) ;
* String sub2 = s2 . substring ( fromIndex2 , toIndex2 ) ;
* sub1 . equals ( sub2 ) ;
* < / code >
* < / pre >
* @ param s1 First string
* @ param fromIndex1 Starting index within { @ code s1}
* @ param toIndex1 Ending index within { @ code s1}
* @ param s2 Second string
* @ param fromIndex2 Starting index within { @ code s2}
* @ param toIndex2 Ending index within { @ code s2}
* @ return { @ code boolean } */
public static boolean substringEquals ( final String s1 , final int fromIndex1 , final int toIndex1 , final String s2 , final int fromIndex2 , final int toIndex2 ) { } }
|
if ( toIndex1 < fromIndex1 ) { throw new IndexOutOfBoundsException ( ) ; } if ( toIndex2 < fromIndex2 ) { throw new IndexOutOfBoundsException ( ) ; } final int len1 = toIndex1 - fromIndex1 ; final int len2 = toIndex2 - fromIndex2 ; if ( len1 != len2 ) { return false ; } for ( int i = 0 ; i < len1 ; ++ i ) { if ( s1 . charAt ( fromIndex1 + i ) != s2 . charAt ( fromIndex2 + i ) ) { return false ; } } return true ;
|
public class MetamodelImpl { /** * Returns entity attribute for given managed entity class .
* @ param clazz
* Entity class
* @ param fieldName
* field name
* @ return entity attribute */
public Attribute getEntityAttribute ( Class clazz , String fieldName ) { } }
|
if ( entityTypes != null && entityTypes . containsKey ( clazz ) ) { EntityType entityType = entityTypes . get ( clazz ) ; return entityType . getAttribute ( fieldName ) ; } throw new IllegalArgumentException ( "No entity found: " + clazz ) ;
|
public class CmsToolBar { /** * Refreshes the user drop down . < p > */
public void refreshUserInfoDropDown ( ) { } }
|
Component oldVersion = m_userDropDown ; m_userDropDown = createUserInfoDropDown ( ) ; m_itemsRight . replaceComponent ( oldVersion , m_userDropDown ) ;
|
public class JSONHelper { /** * This method parses the skip token from a json formatted string .
* @ param jsonData
* The JSON Formatted String .
* @ return The skipToken .
* @ throws Exception */
public static String fetchNextSkiptoken ( JSONObject jsonObject ) throws Exception { } }
|
String skipToken = "" ; // Parse the skip token out of the string .
skipToken = jsonObject . optJSONObject ( "responseMsg" ) . optString ( "odata.nextLink" ) ; if ( ! skipToken . equalsIgnoreCase ( "" ) ) { // Remove the unnecessary prefix from the skip token .
int index = skipToken . indexOf ( "$skiptoken=" ) + ( new String ( "$skiptoken=" ) ) . length ( ) ; skipToken = skipToken . substring ( index ) ; } return skipToken ;
|
public class BaseConfiguration { /** * { @ inheritDoc }
* @ see jcifs . Configuration # isAllowCompound ( java . lang . String ) */
@ Override public boolean isAllowCompound ( String command ) { } }
|
if ( this . disallowCompound == null ) { return true ; } return ! this . disallowCompound . contains ( command ) ;
|
public class VdmRefreshAction { /** * ( non - Javadoc )
* @ see
* org . eclipse . ui . navigator . CommonActionProvider # init ( org . eclipse . ui . navigator . ICommonActionExtensionSite ) */
@ Override public void init ( ICommonActionExtensionSite aSite ) { } }
|
super . init ( aSite ) ; shell = aSite . getViewSite ( ) . getShell ( ) ; makeActions ( ) ;
|
public class CATAsynchReadAheadReader { /** * This method is called by the core API when a message is available .
* Here , we must send the message back to the client and keep track of
* how many bytes we have sent .
* Pacing works by the read ahead consumer on the server ( us ) sending
* messages to the server . We will send up to x bytes of messages , as
* requested by the client . When we have sent enough messages , we will
* stop the consumer , to prevent any more messages being sent .
* The client application will then consume the messages that it has
* been delivered . When the amount of bytes left to consume falls below
* a threshold value , the client will request more messages and will
* inform us how much has been consumed , and the total bytes they are
* prepared to cope with . We then will resend enough messages to keep
* the client topped up .
* @ param vEnum */
public void consumeMessages ( LockedMessageEnumeration vEnum ) { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "consumeMessages" , vEnum ) ; if ( mainConsumer . getConversation ( ) . getConnectionReference ( ) . isClosed ( ) ) { // stop consumer to avoid infinite loop
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "The connection is closed so we shouldn't consume anymore messages. Consumer Session should be closed soon" ) ; stopConsumer ( ) ; } else { String xctErrStr = null ; try { // Get the next message in the vEnum
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Getting next locked message" ) ; SIBusMessage sibMessage = vEnum . nextLocked ( ) ; // d172528
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Received message" , sibMessage ) ; // Send the message
int msgLen = consumerSession . sendMessage ( sibMessage ) ; // d172528 / / D221806
// If the messages are unrecoverable then we can optimise this by deleting
// the message now
if ( ! CommsUtils . isRecoverable ( sibMessage , consumerSession . getUnrecoverableReliability ( ) ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Deleting the message" ) ; vEnum . deleteCurrent ( null ) ; } consumerSession . setLowestPriority ( JFapChannelConstants . getJFAPPriority ( sibMessage . getPriority ( ) ) ) ; // d172528
// Start D221806
// Ensure we take a lock on the consumer session so that the request for more messages
// doesn ' t corrupt the counters .
synchronized ( consumerSession ) { int oldSentBytes = consumerSession . getSentBytes ( ) ; int newSentBytes = oldSentBytes + msgLen ; consumerSession . setSentBytes ( newSentBytes ) ; if ( msgLen == 0 || newSentBytes >= consumerSession . getRequestedBytes ( ) ) { // in addition to the pacing control , we must avoid an infinite loop
// attempting to send messages that don ' t get through . If msgLen
// is 0 then no message was sent , and we must stop the consumer
// and crucially , give up the asynchconsumerbusylock so the consumer
// can be closed if need be .
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Stopping consumer session (sent bytes >= requested bytes || msgLen = 0)" ) ; stopConsumer ( ) ; } } // End D221806
} // start d172528
catch ( Throwable e ) { // No FFDC code needed
// Only FFDC if we haven ' t received a meTerminated event OR if e isn ' t a SIException
final ConversationState convState = ( ConversationState ) consumerSession . getConversation ( ) . getAttachment ( ) ; if ( ! ( e instanceof SIException ) || ! convState . hasMETerminated ( ) ) { FFDCFilter . processException ( e , CLASS_NAME + ".consumeMessages" , CommsConstants . CATASYNCHRHREADER_CONSUME_MSGS_01 , this ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , e . getMessage ( ) , e ) ; StaticCATHelper . sendAsyncExceptionToClient ( e , CommsConstants . CATASYNCHRHREADER_CONSUME_MSGS_01 , // d186970
consumerSession . getClientSessionId ( ) , consumerSession . getConversation ( ) , 0 ) ; } // end d172528
} if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "consumeMessages" ) ;
|
public class Graph { /** * Restores the node annotations on the top of stack and pops stack . */
private static void popAnnotations ( Deque < GraphAnnotationState > stack ) { } }
|
for ( AnnotationState as : stack . pop ( ) ) { as . first . setAnnotation ( as . second ) ; }
|
public class ChemModelManipulator { /** * Get the total number of atoms inside an IChemModel .
* @ param chemModel The IChemModel object .
* @ return The number of Atom object inside . */
public static int getAtomCount ( IChemModel chemModel ) { } }
|
int count = 0 ; ICrystal crystal = chemModel . getCrystal ( ) ; if ( crystal != null ) { count += crystal . getAtomCount ( ) ; } IAtomContainerSet moleculeSet = chemModel . getMoleculeSet ( ) ; if ( moleculeSet != null ) { count += MoleculeSetManipulator . getAtomCount ( moleculeSet ) ; } IReactionSet reactionSet = chemModel . getReactionSet ( ) ; if ( reactionSet != null ) { count += ReactionSetManipulator . getAtomCount ( reactionSet ) ; } return count ;
|
public class QueryImpl { /** * Returns true , if associated entity holds relational references ( e . g . @ OneToMany
* etc . ) else false .
* @ param m
* entity metadata
* @ return true , if holds relation else false */
private boolean isRelational ( EntityMetadata m ) { } }
|
// if related via join table OR contains relations .
return m . isRelationViaJoinTable ( ) || ( m . getRelationNames ( ) != null && ( ! m . getRelationNames ( ) . isEmpty ( ) ) ) ;
|
public class HiveAvroORCQueryGenerator { /** * Escape the Hive nested field names .
* @ param type Primitive or nested Hive type .
* @ return Escaped Hive nested field . */
public static String escapeHiveType ( String type ) { } }
|
TypeInfo typeInfo = TypeInfoUtils . getTypeInfoFromTypeString ( type ) ; // Primitve
if ( ObjectInspector . Category . PRIMITIVE . equals ( typeInfo . getCategory ( ) ) ) { return type ; } // List
else if ( ObjectInspector . Category . LIST . equals ( typeInfo . getCategory ( ) ) ) { ListTypeInfo listTypeInfo = ( ListTypeInfo ) typeInfo ; return org . apache . hadoop . hive . serde . serdeConstants . LIST_TYPE_NAME + "<" + escapeHiveType ( listTypeInfo . getListElementTypeInfo ( ) . getTypeName ( ) ) + ">" ; } // Map
else if ( ObjectInspector . Category . MAP . equals ( typeInfo . getCategory ( ) ) ) { MapTypeInfo mapTypeInfo = ( MapTypeInfo ) typeInfo ; return org . apache . hadoop . hive . serde . serdeConstants . MAP_TYPE_NAME + "<" + escapeHiveType ( mapTypeInfo . getMapKeyTypeInfo ( ) . getTypeName ( ) ) + "," + escapeHiveType ( mapTypeInfo . getMapValueTypeInfo ( ) . getTypeName ( ) ) + ">" ; } // Struct
else if ( ObjectInspector . Category . STRUCT . equals ( typeInfo . getCategory ( ) ) ) { StructTypeInfo structTypeInfo = ( StructTypeInfo ) typeInfo ; List < String > allStructFieldNames = structTypeInfo . getAllStructFieldNames ( ) ; List < TypeInfo > allStructFieldTypeInfos = structTypeInfo . getAllStructFieldTypeInfos ( ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( serdeConstants . STRUCT_TYPE_NAME + "<" ) ; for ( int i = 0 ; i < allStructFieldNames . size ( ) ; i ++ ) { if ( i > 0 ) { sb . append ( "," ) ; } sb . append ( "`" ) ; sb . append ( allStructFieldNames . get ( i ) ) ; sb . append ( "`" ) ; sb . append ( ":" ) ; sb . append ( escapeHiveType ( allStructFieldTypeInfos . get ( i ) . getTypeName ( ) ) ) ; } sb . append ( ">" ) ; return sb . toString ( ) ; } // Union
else if ( ObjectInspector . Category . UNION . equals ( typeInfo . getCategory ( ) ) ) { UnionTypeInfo unionTypeInfo = ( UnionTypeInfo ) typeInfo ; List < TypeInfo > allUnionObjectTypeInfos = unionTypeInfo . getAllUnionObjectTypeInfos ( ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( serdeConstants . UNION_TYPE_NAME + "<" ) ; for ( int i = 0 ; i < allUnionObjectTypeInfos . size ( ) ; i ++ ) { if ( i > 0 ) { sb . append ( "," ) ; } sb . append ( escapeHiveType ( allUnionObjectTypeInfos . get ( i ) . getTypeName ( ) ) ) ; } sb . append ( ">" ) ; return sb . toString ( ) ; } else { throw new RuntimeException ( "Unknown type encountered: " + type ) ; }
|
public class XmlDocumentReader { /** * Parses XML to a W3C Document object with deactivated validation .
* Equivalent to { @ link # parse ( String , boolean ) } with validation on .
* @ param xml in string format
* @ return Document of XML object .
* @ throws IOException if an IO error occurs
* @ throws SAXException if an error due parsing or validating occurs
* @ throws IllegalArgumentException if the argument is somehow invalid */
public static Document parse ( String xml ) throws IOException , SAXException , IllegalArgumentException { } }
|
return parse ( xml , true ) ;
|
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcTaskTimeRecurring ( ) { } }
|
if ( ifcTaskTimeRecurringEClass == null ) { ifcTaskTimeRecurringEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 702 ) ; } return ifcTaskTimeRecurringEClass ;
|
public class SecurityDomainManager { /** * Converts a well - formed URI containing a hostname and port into
* string which allows for lookups in the Security Domain table
* @ param uri URI to convert
* @ return A string with " host : port " concatenated
* @ throws URISyntaxException */
public String formatKey ( URI uri ) throws URISyntaxException { } }
|
if ( uri == null ) { throw new URISyntaxException ( "" , "URI specified is null" ) ; } return formatKey ( uri . getHost ( ) , uri . getPort ( ) ) ;
|
public class PartitionedStepControllerImpl { /** * Today we know the PartitionedStepControllerImpl always runs in the JVM of the top - level job , and so
* will be notified on the top - level stop .
* Doing xJVM split - flow would be more complicated , since not only do we lose the single JVM for
* the top - level job , the split and the child flows . . . . . we also can ' t count on the top - level
* portion of the partition , the PartitionedStepControllerImpl , being in the same JVM as the
* top - level job .
* If we add xJVM split - flow . . not only do we have to worry about the flows themselves . . . we also have to recode
* some assumptions for partitions . . . since the partitioned step might be itself part of a split - flow .
* Note we also might have to worry about ensuring the STEP - level status was moved to STOPPING if we
* were only checking the job level status remotely ( see defect 203063 ) .
* We could just check the DB . . but I guess we don ' t have to for now .
* @ return true if the job is stopping , stopped , or failed . */
private boolean isStoppingStoppedOrFailed ( ) { } }
|
BatchStatus jobBatchStatus = runtimeWorkUnitExecution . getBatchStatus ( ) ; if ( jobBatchStatus . equals ( BatchStatus . STOPPING ) || jobBatchStatus . equals ( BatchStatus . STOPPED ) || jobBatchStatus . equals ( BatchStatus . FAILED ) ) { return true ; } return false ;
|
public class DBUtils { /** * 查找所有符合查找条件的记录 , 并包装成相应对象返回 , 传入的T类的定义必须符合JavaBean规范 。
* @ param clazz 需要查找的对象的所属类的一个类 ( Class )
* @ param sql 只能是SELECT语句 , SQL语句中的字段别名必须与T类里的相应属性相同
* @ param arg SQL语句中的参数占位符参数
* @ return 将所有符合条件的记录包装成相应对象 , 并返回所有对象的集合 , 若没有记录将返回一个空数组 */
public static < T > List < T > getList ( Class < T > clazz , String sql , Object ... arg ) { } }
|
Connection connection = JDBCUtils . getConnection ( ) ; List < T > list = null ; // 存放返回的集合对象
// 存放所有获取的记录的Map对象
List < Map < String , Object > > listProperties = new ArrayList < Map < String , Object > > ( ) ; PreparedStatement ps = null ; ResultSet result = null ; // 填充占位符
try { ps = connection . prepareStatement ( sql ) ; for ( int i = 0 ; i < arg . length ; i ++ ) { ps . setObject ( i + 1 , arg [ i ] ) ; } // 执行SQL语句
result = ps . executeQuery ( ) ; // 获取结果集中所有记录
listProperties = handleResultSetToMapList ( result , listProperties ) ; // 获取每条记录中相应的对象
list = DBUtils . transformMapListToBeanList ( clazz , listProperties ) ; } catch ( SQLException e ) { e . printStackTrace ( ) ; } catch ( InstantiationException e ) { e . printStackTrace ( ) ; } catch ( IllegalAccessException e ) { e . printStackTrace ( ) ; } catch ( InvocationTargetException e ) { e . printStackTrace ( ) ; } finally { JDBCUtils . release ( result , ps , connection ) ; } return list ;
|
public class RunScriptProcess { /** * Run Method . */
public void run ( ) { } }
|
String strID = null ; String strCode = this . getProperty ( CODE ) ; if ( ( strCode == null ) || ( strCode . length ( ) == 0 ) ) { strID = this . getProperty ( DBParams . ID ) ; if ( ( strID == null ) || ( strID . length ( ) == 0 ) ) return ; } Script recScript = ( Script ) this . getMainRecord ( ) ; if ( ( strCode == null ) || ( strCode . length ( ) == 0 ) ) { recScript . setKeyArea ( Script . CODE_KEY ) ; recScript . getField ( Script . CODE ) . setString ( strCode ) ; } else { recScript . setKeyArea ( Script . ID_KEY ) ; recScript . getField ( Script . ID ) . setString ( strID ) ; } try { if ( recScript . seek ( null ) == false ) return ; this . doCommand ( recScript , null ) ; } catch ( DBException ex ) { ex . printStackTrace ( ) ; }
|
public class RedundentExprEliminator { /** * Count the number of ancestors that a ElemTemplateElement has .
* @ param elem An representation of an element in an XSLT stylesheet .
* @ return The number of ancestors of elem ( including the element itself ) . */
protected int countAncestors ( ElemTemplateElement elem ) { } }
|
int count = 0 ; while ( null != elem ) { count ++ ; elem = elem . getParentElem ( ) ; } return count ;
|
public class Announce { /** * Returns the current tracker client used for announces . */
public TrackerClient getCurrentTrackerClient ( AnnounceableInformation torrent ) { } }
|
final URI uri = getURIForTorrent ( torrent ) ; if ( uri == null ) return null ; return this . clients . get ( uri . toString ( ) ) ;
|
public class AkkaRpcActor { /** * Stop the actor immediately . */
private void stop ( RpcEndpointTerminationResult rpcEndpointTerminationResult ) { } }
|
if ( rpcEndpointStopped . compareAndSet ( false , true ) ) { this . rpcEndpointTerminationResult = rpcEndpointTerminationResult ; getContext ( ) . stop ( getSelf ( ) ) ; }
|
public class AbstractBiclustering { /** * Convert a bitset into integer column ids .
* @ param cols
* @ return integer column ids */
protected int [ ] colsBitsetToIDs ( long [ ] cols ) { } }
|
int [ ] colIDs = new int [ BitsUtil . cardinality ( cols ) ] ; int colsIndex = 0 ; for ( int cpos = 0 , clpos = 0 ; clpos < cols . length ; ++ clpos ) { long clong = cols [ clpos ] ; if ( clong == 0L ) { cpos += Long . SIZE ; continue ; } for ( int j = 0 ; j < Long . SIZE ; ++ j , ++ cpos , clong >>>= 1 ) { if ( ( clong & 1L ) == 1L ) { colIDs [ colsIndex ] = cpos ; ++ colsIndex ; } } } return colIDs ;
|
public class WebFragmentTypeImpl { /** * If not already created , a new < code > locale - encoding - mapping - list < / code > element will be created and returned .
* Otherwise , the first existing < code > locale - encoding - mapping - list < / code > element will be returned .
* @ return the instance defined for the element < code > locale - encoding - mapping - list < / code > */
public LocaleEncodingMappingListType < WebFragmentType < T > > getOrCreateLocaleEncodingMappingList ( ) { } }
|
List < Node > nodeList = childNode . get ( "locale-encoding-mapping-list" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new LocaleEncodingMappingListTypeImpl < WebFragmentType < T > > ( this , "locale-encoding-mapping-list" , childNode , nodeList . get ( 0 ) ) ; } return createLocaleEncodingMappingList ( ) ;
|
public class RadialCounter { /** * < editor - fold defaultstate = " collapsed " desc = " Image related " > */
private BufferedImage create_TICKMARKS_Image ( final int WIDTH ) { } }
|
if ( WIDTH <= 0 ) { return null ; } final BufferedImage IMAGE = UTIL . createImage ( WIDTH , WIDTH , Transparency . TRANSLUCENT ) ; final Graphics2D G2 = IMAGE . createGraphics ( ) ; G2 . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ; G2 . setRenderingHint ( RenderingHints . KEY_FRACTIONALMETRICS , RenderingHints . VALUE_FRACTIONALMETRICS_ON ) ; G2 . setRenderingHint ( RenderingHints . KEY_TEXT_ANTIALIASING , RenderingHints . VALUE_TEXT_ANTIALIAS_ON ) ; G2 . setRenderingHint ( RenderingHints . KEY_ALPHA_INTERPOLATION , RenderingHints . VALUE_ALPHA_INTERPOLATION_QUALITY ) ; G2 . setRenderingHint ( RenderingHints . KEY_RENDERING , RenderingHints . VALUE_RENDER_QUALITY ) ; G2 . setRenderingHint ( RenderingHints . KEY_STROKE_CONTROL , RenderingHints . VALUE_STROKE_NORMALIZE ) ; G2 . setRenderingHint ( RenderingHints . KEY_INTERPOLATION , RenderingHints . VALUE_INTERPOLATION_BICUBIC ) ; final int IMAGE_WIDTH = IMAGE . getWidth ( ) ; final AffineTransform OLD_TRANSFORM = G2 . getTransform ( ) ; final BasicStroke THIN_STROKE = new BasicStroke ( 0.01f * IMAGE_WIDTH , BasicStroke . CAP_ROUND , BasicStroke . JOIN_BEVEL ) ; final Font FONT = new Font ( "Verdana" , 0 , ( int ) ( 0.0747663551f * IMAGE_WIDTH ) ) ; final float TEXT_DISTANCE = 0.1f * IMAGE_WIDTH ; final float MIN_LENGTH = 0.02f * IMAGE_WIDTH ; final float MED_LENGTH = 0.04f * IMAGE_WIDTH ; // Create the watch itself
final float RADIUS = IMAGE_WIDTH * 0.37f ; CENTER . setLocation ( IMAGE_WIDTH / 2.0f , IMAGE_WIDTH / 2.0f ) ; // Draw ticks
Point2D innerPoint = new Point2D . Double ( ) ; Point2D outerPoint = new Point2D . Double ( ) ; Point2D textPoint = new Point2D . Double ( ) ; Line2D tick ; int tickCounterFull = 0 ; int tickCounterHalf = 0 ; int counter = 0 ; double sinValue = 0 ; double cosValue = 0 ; final double STEP = ( 2.0 * Math . PI ) / ( 20.0 ) ; if ( isTickmarkColorFromThemeEnabled ( ) ) { G2 . setColor ( getBackgroundColor ( ) . LABEL_COLOR ) ; } else { G2 . setColor ( getTickmarkColor ( ) ) ; } for ( double alpha = 2.0 * Math . PI ; alpha >= 0 ; alpha -= STEP ) { G2 . setStroke ( THIN_STROKE ) ; sinValue = Math . sin ( alpha ) ; cosValue = Math . cos ( alpha ) ; if ( tickCounterHalf == 1 ) { G2 . setStroke ( THIN_STROKE ) ; innerPoint . setLocation ( CENTER . getX ( ) + ( RADIUS - MIN_LENGTH ) * sinValue , CENTER . getY ( ) + ( RADIUS - MIN_LENGTH ) * cosValue ) ; outerPoint . setLocation ( CENTER . getX ( ) + RADIUS * sinValue , CENTER . getY ( ) + RADIUS * cosValue ) ; // Draw ticks
tick = new Line2D . Double ( innerPoint . getX ( ) , innerPoint . getY ( ) , outerPoint . getX ( ) , outerPoint . getY ( ) ) ; G2 . draw ( tick ) ; tickCounterHalf = 0 ; } // Different tickmark every 15 units
if ( tickCounterFull == 2 ) { G2 . setStroke ( THIN_STROKE ) ; innerPoint . setLocation ( CENTER . getX ( ) + ( RADIUS - MED_LENGTH ) * sinValue , CENTER . getY ( ) + ( RADIUS - MED_LENGTH ) * cosValue ) ; outerPoint . setLocation ( CENTER . getX ( ) + RADIUS * sinValue , CENTER . getY ( ) + RADIUS * cosValue ) ; // Draw ticks
tick = new Line2D . Double ( innerPoint . getX ( ) , innerPoint . getY ( ) , outerPoint . getX ( ) , outerPoint . getY ( ) ) ; G2 . draw ( tick ) ; tickCounterFull = 0 ; } // Draw text
G2 . setFont ( FONT ) ; textPoint . setLocation ( CENTER . getX ( ) + ( RADIUS - TEXT_DISTANCE ) * sinValue , CENTER . getY ( ) + ( RADIUS - TEXT_DISTANCE ) * cosValue ) ; if ( counter != 20 && counter % 2 == 0 ) { G2 . rotate ( Math . toRadians ( 0 ) , CENTER . getX ( ) , CENTER . getY ( ) ) ; G2 . fill ( UTIL . rotateTextAroundCenter ( G2 , String . valueOf ( counter / 2 ) , ( int ) textPoint . getX ( ) , ( int ) textPoint . getY ( ) , ( 2 * Math . PI - alpha ) ) ) ; } G2 . setTransform ( OLD_TRANSFORM ) ; tickCounterHalf ++ ; tickCounterFull ++ ; counter ++ ; } G2 . dispose ( ) ; return IMAGE ;
|
public class ModelsImpl { /** * Gets all custom prebuilt models information of this application .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the List & lt ; CustomPrebuiltModel & gt ; object if successful . */
public List < CustomPrebuiltModel > listCustomPrebuiltModels ( UUID appId , String versionId ) { } }
|
return listCustomPrebuiltModelsWithServiceResponseAsync ( appId , versionId ) . toBlocking ( ) . single ( ) . body ( ) ;
|
public class WSJobOperatorImpl { /** * Trace job xml file . . */
protected void traceJobXML ( String jobXML ) { } }
|
if ( logger . isLoggable ( Level . FINE ) ) { int concatLen = jobXML . length ( ) > 200 ? 200 : jobXML . length ( ) ; logger . fine ( "Starting job: " + jobXML . substring ( 0 , concatLen ) + "... truncated ..." ) ; }
|
public class XmlProcessor { /** * Sets the original xml that should be sorted . Builds a dom document of the
* xml .
* @ param originalXml the new original xml
* @ throws org . jdom . JDOMException the jDOM exception
* @ throws java . io . IOException Signals that an I / O exception has occurred . */
public void setOriginalXml ( final InputStream originalXml ) throws JDOMException , IOException { } }
|
SAXBuilder parser = new SAXBuilder ( ) ; originalDocument = parser . build ( originalXml ) ;
|
public class WebPage { /** * Gets the < code > WebPage < / code > that follows this one in the parents
* list of pages .
* @ return the < code > WebPage < / code > or < code > null < / code > if not found */
final public WebPage getNextPage ( WebSiteRequest req ) throws IOException , SQLException { } }
|
WebPage parent = getParent ( ) ; if ( parent != null ) { WebPage [ ] myPages = parent . getCachedPages ( req ) ; int len = myPages . length ; for ( int c = 0 ; c < len ; c ++ ) { if ( myPages [ c ] . getClass ( ) == getClass ( ) ) { if ( c < ( len - 1 ) ) return myPages [ c + 1 ] ; return null ; } } } return null ;
|
public class RequestStatics { /** * Returns the name of the JSON property pretty printed . That is spaces
* instead of underscores and capital first letter .
* @ param name
* @ return */
public static String JSON2HTML ( String name ) { } }
|
if ( name . length ( ) < 1 ) return name ; if ( name == "row" ) { return name . substring ( 0 , 1 ) . toUpperCase ( ) + name . replace ( "_" , " " ) . substring ( 1 ) ; } return name . substring ( 0 , 1 ) + name . replace ( "_" , " " ) . substring ( 1 ) ;
|
public class TrueTypeFont { /** * The information in the maps of the table ' cmap ' is coded in several formats .
* Format 0 is the Apple standard character to glyph index mapping table .
* @ return a < CODE > HashMap < / CODE > representing this map
* @ throws IOException the font file could not be read */
HashMap readFormat0 ( ) throws IOException { } }
|
HashMap h = new HashMap ( ) ; rf . skipBytes ( 4 ) ; for ( int k = 0 ; k < 256 ; ++ k ) { int r [ ] = new int [ 2 ] ; r [ 0 ] = rf . readUnsignedByte ( ) ; r [ 1 ] = getGlyphWidth ( r [ 0 ] ) ; h . put ( Integer . valueOf ( k ) , r ) ; } return h ;
|
public class PeerEurekaNode { /** * Delete instance status override .
* @ param appName
* the application name of the instance .
* @ param id
* the unique identifier of the instance .
* @ param info
* the instance information of the instance . */
public void deleteStatusOverride ( final String appName , final String id , final InstanceInfo info ) { } }
|
long expiryTime = System . currentTimeMillis ( ) + maxProcessingDelayMs ; batchingDispatcher . process ( taskId ( "deleteStatusOverride" , appName , id ) , new InstanceReplicationTask ( targetHost , Action . DeleteStatusOverride , info , null , false ) { @ Override public EurekaHttpResponse < Void > execute ( ) { return replicationClient . deleteStatusOverride ( appName , id , info ) ; } } , expiryTime ) ;
|
public class FormatTag { /** * Method called at end of Tag
* @ return EVAL _ PAGE */
@ Override public final int doEndTag ( ) throws JspException { } }
|
String date_formatted = default_text ; if ( output_date != null ) { // Get the pattern to use
SimpleDateFormat sdf ; String pat = pattern ; if ( pat == null && patternid != null ) { Object attr = pageContext . findAttribute ( patternid ) ; if ( attr != null ) pat = attr . toString ( ) ; } if ( pat == null ) { sdf = new SimpleDateFormat ( ) ; pat = sdf . toPattern ( ) ; } // Get a DateFormatSymbols
if ( symbolsRef != null ) { symbols = ( DateFormatSymbols ) pageContext . findAttribute ( symbolsRef ) ; if ( symbols == null ) { throw new JspException ( "datetime format tag could not find dateFormatSymbols for symbolsRef \"" + symbolsRef + "\"." ) ; } } // Get a SimpleDateFormat using locale if necessary
if ( localeRef != null ) { Locale locale = ( Locale ) pageContext . findAttribute ( localeRef ) ; if ( locale == null ) { throw new JspException ( "datetime format tag could not find locale for localeRef \"" + localeRef + "\"." ) ; } sdf = new SimpleDateFormat ( pat , locale ) ; } else if ( locale_flag ) { sdf = new SimpleDateFormat ( pat , pageContext . getRequest ( ) . getLocale ( ) ) ; } else if ( symbols != null ) { sdf = new SimpleDateFormat ( pat , symbols ) ; } else { sdf = new SimpleDateFormat ( pat ) ; } // See if there is a timeZone
if ( timeZone_string != null ) { TimeZone timeZone = ( TimeZone ) pageContext . getAttribute ( timeZone_string , PageContext . SESSION_SCOPE ) ; if ( timeZone == null ) { throw new JspTagException ( "Datetime format tag timeZone " + "script variable \"" + timeZone_string + " \" does not exist" ) ; } sdf . setTimeZone ( timeZone ) ; } // Format the date for display
date_formatted = sdf . format ( output_date ) ; } try { pageContext . getOut ( ) . write ( date_formatted ) ; } catch ( Exception e ) { throw new JspException ( "IO Error: " + e . getMessage ( ) ) ; } return EVAL_PAGE ;
|
public class MongoCollectionRemover { /** * Convenience function */
public static void removeAnnotations ( String [ ] conn , String ... annotationsToDelete ) throws UIMAException , IOException { } }
|
CollectionReader cr = createReader ( MongoCollectionRemover . class , PARAM_DB_CONNECTION , conn , PARAM_DELETE_ANNOTATIONS , annotationsToDelete ) ; AnalysisEngine noAE = AnalysisEngineFactory . createEngine ( StatsAnnotatorPlus . class ) ; SimplePipeline . runPipeline ( cr , noAE ) ; LOG . debug ( "done removing annotations" ) ;
|
public class BenchmarkMethod { /** * Checks if this method is executable via reflection for perfidix purposes .
* That means that the method has no parameters ( except for , no
* return - value , is non - static , is public and throws no exceptions .
* @ param meth
* method to be checked
* @ param anno
* anno for method to be check , necessary since different
* attributes are possible depending on the anno
* @ return true if method matches requirements . */
public static boolean isReflectedExecutable ( final Method meth , final Class < ? extends Annotation > anno ) { } }
|
boolean returnVal = true ; // Check if DataProvider is valid if set .
if ( anno . equals ( DataProvider . class ) && ! meth . getReturnType ( ) . isAssignableFrom ( Object [ ] [ ] . class ) ) { returnVal = false ; } // for all other methods , the return type must be void
if ( ! anno . equals ( DataProvider . class ) && ! meth . getGenericReturnType ( ) . equals ( Void . TYPE ) ) { returnVal = false ; } // if method is static , the method is not benchmarkable
if ( ! ( anno . equals ( BeforeBenchClass . class ) ) && Modifier . isStatic ( meth . getModifiers ( ) ) ) { returnVal = false ; } // if method is not public , the method is not benchmarkable
if ( ! Modifier . isPublic ( meth . getModifiers ( ) ) ) { returnVal = false ; } return returnVal ;
|
public class ExecutionEngine { /** * Execute a large block task synchronously . Log errors if they occur .
* Return true if successful and false otherwise . */
protected boolean executeLargeBlockTaskSynchronously ( LargeBlockTask task ) { } }
|
LargeBlockManager lbm = LargeBlockManager . getInstance ( ) ; assert ( lbm != null ) ; LargeBlockResponse response = null ; try { // The call to get ( ) will block until the task completes .
response = lbm . submitTask ( task ) . get ( ) ; } catch ( RejectedExecutionException ree ) { LOG . error ( "Could not queue large block task: " + ree . getMessage ( ) ) ; } catch ( ExecutionException ee ) { LOG . error ( "Could not execute large block task: " + ee . getMessage ( ) ) ; } catch ( InterruptedException ie ) { LOG . error ( "Large block task was interrupted: " + ie . getMessage ( ) ) ; } if ( response != null && ! response . wasSuccessful ( ) ) { LOG . error ( "Large block task failed: " + response . getException ( ) . getMessage ( ) ) ; } return response == null ? false : response . wasSuccessful ( ) ;
|
public class TransactionSnippets { /** * [ VARIABLE " my _ key _ name2 " ] */
public void multiplePutEntities ( String keyName1 , String keyName2 ) { } }
|
Datastore datastore = transaction . getDatastore ( ) ; // [ START multiplePutEntities ]
Key key1 = datastore . newKeyFactory ( ) . setKind ( "MyKind" ) . newKey ( keyName1 ) ; Entity . Builder entityBuilder1 = Entity . newBuilder ( key1 ) ; entityBuilder1 . set ( "propertyName" , "value1" ) ; Entity entity1 = entityBuilder1 . build ( ) ; Key key2 = datastore . newKeyFactory ( ) . setKind ( "MyKind" ) . newKey ( keyName2 ) ; Entity . Builder entityBuilder2 = Entity . newBuilder ( key2 ) ; entityBuilder2 . set ( "propertyName" , "value2" ) ; Entity entity2 = entityBuilder2 . build ( ) ; transaction . put ( entity1 , entity2 ) ; transaction . commit ( ) ; // [ END multiplePutEntities ]
|
public class Command { /** * Creates a command line from the current configuration .
* The command line is represented as a string list .
* The options are filtered by the specified list .
* @ param filterOptions
* the options contained in the result if they are set .
* @ return
* the command line . */
public List < String > createCommandList ( final List < String > filterOptions ) { } }
|
List < String > list = new ArrayList < String > ( ) ; list . add ( getExecutable ( ) ) ; for ( String opt : filterOptions ) { if ( isOptionSet ( opt ) ) { list . add ( opt ) ; final String value = getOption ( opt ) ; if ( value != NO_OPTION_VALUE ) { list . add ( value ) ; } } } return list ;
|
public class ModuleXmlReader { /** * Parse the module . xml file .
* @ param moduleXml The file to parse
* @ return Module representation
* @ throws Exception In case of parsing error */
protected static Module parse ( final File moduleXml ) throws Exception { } }
|
InputStream is = new FileInputStream ( moduleXml ) ; try { Document document = parseXml ( is ) ; Element root = document . getDocumentElement ( ) ; ModuleIdentifier main = getModuleIdentifier ( root ) ; Module module = new Module ( main ) ; Element dependencies = getChildElement ( root , "dependencies" ) ; if ( dependencies != null ) { for ( Element dependency : getElements ( dependencies , "module" ) ) { module . addDependency ( getModuleIdentifier ( dependency ) ) ; } } return module ; } finally { is . close ( ) ; }
|
public class EmbeddedIntrospector { /** * Introspects the given embedded field and returns its metadata .
* @ param field
* the embedded field to introspect
* @ param entityMetadata
* metadata of the owning entity
* @ return the metadata of the embedded field */
public static EmbeddedMetadata introspect ( EmbeddedField field , EntityMetadata entityMetadata ) { } }
|
EmbeddedIntrospector introspector = new EmbeddedIntrospector ( field , entityMetadata ) ; introspector . process ( ) ; return introspector . metadata ;
|
public class EJBJavaColonNamingHelper { /** * can suppress warning - if cmd is null NamingException will be thrown by getComponentMetaData */
@ Override public boolean hasObjectWithPrefix ( JavaColonNamespace namespace , String name ) throws NamingException { } }
|
JavaColonNamespaceBindings < EJBBinding > bindings ; boolean result = false ; Lock readLock = null ; ComponentMetaData cmd = null ; try { // This helper only provides support for java : global , java : app , and java : module
if ( namespace == JavaColonNamespace . GLOBAL ) { // Called to ensure that the java : global code path
// is coming from a Java EE thread . If not this will reject this
// method call with the correct Java EE error message .
cmd = getComponentMetaData ( namespace , name ) ; bindings = javaColonGlobalBindings ; readLock = javaColonLock . readLock ( ) ; readLock . lock ( ) ; } else if ( namespace == JavaColonNamespace . APP ) { // Get the ComponentMetaData for the currently active component .
// There is no component name space if there is no active component .
cmd = getComponentMetaData ( namespace , name ) ; bindings = getAppBindingMap ( cmd . getModuleMetaData ( ) . getApplicationMetaData ( ) ) ; readLock = javaColonLock . readLock ( ) ; readLock . lock ( ) ; } else if ( namespace == JavaColonNamespace . MODULE ) { cmd = getComponentMetaData ( namespace , name ) ; bindings = getModuleBindingMap ( cmd . getModuleMetaData ( ) ) ; } else { bindings = null ; } result = bindings != null && bindings . hasObjectWithPrefix ( name ) ; } finally { if ( readLock != null ) { readLock . unlock ( ) ; } } return result ;
|
public class Configuration { /** * Parse the given attribute as a set of integer ranges .
* @ param name the attribute name
* @ throws NullPointerException if the configuration property does not exist
* @ return a new set of ranges from the configured value */
public IntegerRanges getRange ( String name ) { } }
|
String valueString = get ( name ) ; Preconditions . checkNotNull ( valueString ) ; return new IntegerRanges ( valueString ) ;
|
public class R2RMLManager { /** * This method return the list of mappings from the Model main method to be
* called , assembles everything
* @ param myModel - the Model structure containing mappings
* @ return ArrayList < OBDAMappingAxiom > - list of mapping axioms read from the Model */
public ImmutableList < SQLPPTriplesMap > getMappings ( Graph myModel ) throws InvalidR2RMLMappingException { } }
|
List < SQLPPTriplesMap > mappings = new ArrayList < SQLPPTriplesMap > ( ) ; // retrieve the TriplesMap nodes
Collection < TriplesMap > tripleMaps = r2rmlParser . getMappingNodes ( myModel ) ; for ( TriplesMap tm : tripleMaps ) { // for each node get a mapping
SQLPPTriplesMap mapping ; try { mapping = getMapping ( tm ) ; if ( mapping != null ) { // add it to the list of mappings
mappings . add ( mapping ) ; } // pass 2 - check for join conditions , add to list
List < SQLPPTriplesMap > joinMappings = getJoinMappings ( tripleMaps , tm ) ; if ( joinMappings != null ) { mappings . addAll ( joinMappings ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; throw new RuntimeException ( e ) ; } } return ImmutableList . copyOf ( mappings ) ;
|
public class KeysAndAttributes { /** * The primary key attribute values that define the items and the attributes associated with the items .
* @ param keys
* The primary key attribute values that define the items and the attributes associated with the items .
* @ return Returns a reference to this object so that method calls can be chained together . */
public KeysAndAttributes withKeys ( java . util . Collection < java . util . Map < String , AttributeValue > > keys ) { } }
|
setKeys ( keys ) ; return this ;
|
public class LogHandle { /** * Private method to read the records stored in the active log file back into memory . This
* method should only be called from the LogHandle . openLog method . Once loaded , these
* records can be accessed through the LogHandle . recoveredRecords method .
* @ return ArrayList An array of the recovered records .
* @ exception InternalLogException An unexpected failure has occured . */
private ArrayList < ReadableLogRecord > readRecords ( ) throws InternalLogException { } }
|
if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "readRecords" , this ) ; // Check that the file is actually open
if ( _activeFile == null ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "readRecords" , "InternalLogException" ) ; throw new InternalLogException ( null ) ; } ArrayList < ReadableLogRecord > records = null ; // Retrieve the first record sequence number from the header . If this file has
// been freshly created ( ie cold start ) then this will be zero , the sequence
// number for the first ever record . Otherwise , the sequence number will be
// been retrieved from the active file .
_recordSequenceNumber = _activeFile . logFileHeader ( ) . firstRecordSequenceNumber ( ) ; // Keep extracting log records until no more are found .
ReadableLogRecord readableLogRecord = _activeFile . getReadableLogRecord ( _recordSequenceNumber ) ; // If there is a " first " record then create the array that will be used to store these
// records as they are retrieved .
if ( readableLogRecord != null ) { records = new ArrayList < ReadableLogRecord > ( ) ; } while ( readableLogRecord != null ) { records . add ( readableLogRecord ) ; // 776666 / PI69183 - may need to adjust sequence number if byte - by - byte scanning finds more records .
long realSequenceNumber = readableLogRecord . getSequenceNumber ( ) ; if ( _recordSequenceNumber != realSequenceNumber ) { if ( realSequenceNumber > _recordSequenceNumber ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "byte-by-byte scanning found records. Adjusting record sequence number:" + _recordSequenceNumber + " to:" + realSequenceNumber ) ; _recordSequenceNumber = realSequenceNumber ; } else { // This SHOULD and I think CAN ' T happen
if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "ERROR byte-by-byte scanning found records. Expected to find record sequence number:" + _recordSequenceNumber + " but found :" + realSequenceNumber ) ; FFDCFilter . processException ( new Exception ( ) , "com.ibm.ws.recoverylog.spi.LogHandle.readRecords" , "685" , this , new Object [ ] { String . valueOf ( _recordSequenceNumber ) , String . valueOf ( realSequenceNumber ) } ) ; } } _recordSequenceNumber ++ ; readableLogRecord = _activeFile . getReadableLogRecord ( _recordSequenceNumber ) ; } if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Next record sequence number is " + _recordSequenceNumber ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "readRecords" , records ) ; return records ;
|
public class NaaccrXmlUtils { /** * Returns a generic reader for the provided file , taking care of the optional GZ compression .
* @ param file file to create the reader from , cannot be null
* @ return a generic reader to the file , never null
* @ throws NaaccrIOException if the reader cannot be created */
public static Reader createReader ( File file ) throws NaaccrIOException { } }
|
InputStream is = null ; try { is = new FileInputStream ( file ) ; if ( file . getName ( ) . endsWith ( ".gz" ) ) is = new GZIPInputStream ( is ) ; return new InputStreamReader ( is , StandardCharsets . UTF_8 ) ; } catch ( IOException e ) { if ( is != null ) { try { is . close ( ) ; } catch ( IOException e1 ) { // give up
} } throw new NaaccrIOException ( e . getMessage ( ) ) ; }
|
public class EntryViewBase { /** * The date control where the entry view is shown .
* @ return the date control */
public final ReadOnlyObjectProperty < T > dateControlProperty ( ) { } }
|
if ( dateControl == null ) { dateControl = new ReadOnlyObjectWrapper < > ( this , "dateControl" , _dateControl ) ; // $ NON - NLS - 1 $
} return dateControl . getReadOnlyProperty ( ) ;
|
public class PixelMath { /** * Bounds image pixels to be between these two values
* @ param img Image
* @ param min minimum value .
* @ param max maximum value . */
public static void boundImage ( GrayS64 img , long min , long max ) { } }
|
ImplPixelMath . boundImage ( img , min , max ) ;
|
public class dnsnsecrec { /** * Use this API to fetch dnsnsecrec resource of given name . */
public static dnsnsecrec get ( nitro_service service , String hostname ) throws Exception { } }
|
dnsnsecrec obj = new dnsnsecrec ( ) ; obj . set_hostname ( hostname ) ; dnsnsecrec response = ( dnsnsecrec ) obj . get_resource ( service ) ; return response ;
|
public class CopyState { /** * Asserts that there are no pending listeners .
* < p > This can be useful in a test environment to ensure that the copy worked correctly . N . B . it
* is possible for a copy to be ' correct ' and for not all listeners to fire , this is common when
* copying small parts of the AST ( anything below a template ) . */
public void checkAllListenersFired ( ) { } }
|
for ( Map . Entry < Object , Object > entry : mappings . entrySet ( ) ) { if ( entry . getValue ( ) instanceof Listener ) { throw new IllegalStateException ( "Listener for " + entry . getKey ( ) + " never fired: " + entry . getValue ( ) ) ; } }
|
public class AbstractResultSetWrapper { /** * { @ inheritDoc }
* @ see java . sql . ResultSet # getTime ( int , java . util . Calendar ) */
@ Override public Time getTime ( final int columnIndex , final Calendar cal ) throws SQLException { } }
|
return wrapped . getTime ( columnIndex , cal ) ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.