signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class AbstractInterruptibleASTTransformation { /** * Shortcut method which avoids duplicating code for every type of loop . * Actually wraps the loopBlock of different types of loop statements . */ private void visitLoop ( LoopingStatement loopStatement ) { } }
Statement statement = loopStatement . getLoopBlock ( ) ; loopStatement . setLoopBlock ( wrapBlock ( statement ) ) ;
public class ProtostuffIOUtil { /** * Merges the { @ code message } with the byte array using the given { @ code schema } . */ public static < T > void mergeFrom ( byte [ ] data , T message , Schema < T > schema ) { } }
IOUtil . mergeFrom ( data , 0 , data . length , message , schema , true ) ;
public class XMLEmitter { /** * Get the XML representation of a document type . * @ param eXMLVersion * The XML version to use . May not be < code > null < / code > . * @ param eIncorrectCharHandling * The incorrect character handling . May not be < code > null < / code > . * @ param sQualifiedName * The qualified element name . May not be < code > null < / code > . * @ param sPublicID * The optional public ID . May be < code > null < / code > . If the public ID is * not < code > null < / code > the system ID must also be set ! * @ param sSystemID * The optional system ID . May be < code > null < / code > . * @ return The string DOCTYPE representation . */ @ Nonnull public static String getDocTypeXMLRepresentation ( @ Nonnull final EXMLSerializeVersion eXMLVersion , @ Nonnull final EXMLIncorrectCharacterHandling eIncorrectCharHandling , @ Nonnull final String sQualifiedName , @ Nullable final String sPublicID , @ Nullable final String sSystemID ) { } }
// do not return a line break at the end ! ( JS variable assignment ) final StringBuilder aSB = new StringBuilder ( 128 ) ; aSB . append ( "<!DOCTYPE " ) . append ( sQualifiedName ) ; if ( sPublicID != null && sSystemID != null ) { // Public and system ID present aSB . append ( " PUBLIC \"" ) . append ( XMLMaskHelper . getMaskedXMLText ( eXMLVersion , EXMLCharMode . ATTRIBUTE_VALUE_DOUBLE_QUOTES , eIncorrectCharHandling , sPublicID ) ) . append ( "\" \"" ) . append ( XMLMaskHelper . getMaskedXMLText ( eXMLVersion , EXMLCharMode . ATTRIBUTE_VALUE_DOUBLE_QUOTES , eIncorrectCharHandling , sSystemID ) ) . append ( '"' ) ; } else if ( sSystemID != null ) { // Only system ID present aSB . append ( " SYSTEM \"" ) . append ( XMLMaskHelper . getMaskedXMLText ( eXMLVersion , EXMLCharMode . ATTRIBUTE_VALUE_DOUBLE_QUOTES , eIncorrectCharHandling , sSystemID ) ) . append ( '"' ) ; } return aSB . append ( '>' ) . toString ( ) ;
public class SipPhone { /** * @ see org . cafesip . sipunit . RequestListener # processEvent ( java . util . EventObject ) */ public void processEvent ( EventObject event ) { } }
if ( event instanceof RequestEvent ) { processRequestEvent ( ( RequestEvent ) event ) ; } else { LOG . error ( "invalid event type received: " + event . getClass ( ) . getName ( ) + ": " + event . toString ( ) ) ; }
public class CPInstanceModelImpl { /** * Converts the soap model instances into normal model instances . * @ param soapModels the soap model instances to convert * @ return the normal model instances */ public static List < CPInstance > toModels ( CPInstanceSoap [ ] soapModels ) { } }
if ( soapModels == null ) { return null ; } List < CPInstance > models = new ArrayList < CPInstance > ( soapModels . length ) ; for ( CPInstanceSoap soapModel : soapModels ) { models . add ( toModel ( soapModel ) ) ; } return models ;
public class BeanPathProperties { /** * Get the properties for a given path . * @ param path path * @ return properties */ public Set < String > getProperties ( String path ) { } }
Props props = pathMap . get ( path ) ; return props == null ? null : props . getProperties ( ) ;
public class Path { /** * Get absolute parent of given path . * If the path is a version history or launch path the path level is adjusted accordingly . * This is a replacement for { @ link com . day . text . Text # getAbsoluteParent ( String , int ) } . * @ param path Path * @ param parentLevel Parent level * @ param resourceResolver Resource resolver * @ return Absolute parent path or empty string if path is invalid */ public static String getAbsoluteParent ( @ NotNull String path , int parentLevel , @ NotNull ResourceResolver resourceResolver ) { } }
if ( parentLevel < 0 ) { return "" ; } int level = parentLevel + getAbsoluteLevelOffset ( path , resourceResolver ) ; return Text . getAbsoluteParent ( path , level ) ;
public class AbstractExtendedSet { /** * { @ inheritDoc } */ @ SuppressWarnings ( "unchecked" ) @ Override public void clear ( T from , T to ) { } }
ExtendedIterator < T > itr = iterator ( ) ; itr . skipAllBefore ( from ) ; while ( itr . hasNext ( ) ) { if ( ( ( Comparable ) itr . next ( ) ) . compareTo ( to ) < 0 ) itr . remove ( ) ; }
public class ReceiveMessageBuilder { /** * Gets the validation context as XML validation context an raises exception if existing validation context is * not a XML validation context . * @ return */ private XpathMessageValidationContext getXPathValidationContext ( ) { } }
if ( xmlMessageValidationContext instanceof XpathMessageValidationContext ) { return ( ( XpathMessageValidationContext ) xmlMessageValidationContext ) ; } else { XpathMessageValidationContext xPathContext = new XpathMessageValidationContext ( ) ; xPathContext . setNamespaces ( xmlMessageValidationContext . getNamespaces ( ) ) ; xPathContext . setControlNamespaces ( xmlMessageValidationContext . getControlNamespaces ( ) ) ; xPathContext . setIgnoreExpressions ( xmlMessageValidationContext . getIgnoreExpressions ( ) ) ; xPathContext . setSchema ( xmlMessageValidationContext . getSchema ( ) ) ; xPathContext . setSchemaRepository ( xmlMessageValidationContext . getSchemaRepository ( ) ) ; xPathContext . setSchemaValidation ( xmlMessageValidationContext . isSchemaValidationEnabled ( ) ) ; xPathContext . setDTDResource ( xmlMessageValidationContext . getDTDResource ( ) ) ; getAction ( ) . getValidationContexts ( ) . remove ( xmlMessageValidationContext ) ; getAction ( ) . getValidationContexts ( ) . add ( xPathContext ) ; xmlMessageValidationContext = xPathContext ; return xPathContext ; }
public class MpScheduler { /** * Hacky way to only run @ BalancePartitions as n - partition transactions for now . * @ return true if it ' s an n - partition transaction */ private boolean isNpTxn ( Iv2InitiateTaskMessage msg ) { } }
return msg . getStoredProcedureName ( ) . startsWith ( "@" ) && msg . getStoredProcedureName ( ) . equalsIgnoreCase ( "@BalancePartitions" ) && ( byte ) msg . getParameters ( ) [ 1 ] != 1 ; // clearIndex is MP , normal rebalance is NP
public class CompressCssFormatter { /** * { @ inheritDoc } */ @ Override void appendProperty ( String name , Expression value ) { } }
checkSemicolon ( ) ; super . appendProperty ( name , value ) ;
public class ClassReader { /** * Reads a class constant pool item in { @ link # b b } . < i > This method is * intended for { @ link Attribute } sub classes , and is normally not needed by * class generators or adapters . < / i > * @ param index * the start index of an unsigned short value in { @ link # b b } , * whose value is the index of a class constant pool item . * @ param buf * buffer to be used to read the item . This buffer must be * sufficiently large . It is not automatically resized . * @ return the String corresponding to the specified class item . */ public String readClass ( final int index , final char [ ] buf ) { } }
// computes the start index of the CONSTANT _ Class item in b // and reads the CONSTANT _ Utf8 item designated by // the first two bytes of this CONSTANT _ Class item String name = readUTF8 ( items [ readUnsignedShort ( index ) ] , buf ) ; return ( name != null ? name . intern ( ) : null ) ;
public class DescribeTaskDefinitionRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DescribeTaskDefinitionRequest describeTaskDefinitionRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( describeTaskDefinitionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeTaskDefinitionRequest . getTaskDefinition ( ) , TASKDEFINITION_BINDING ) ; protocolMarshaller . marshall ( describeTaskDefinitionRequest . getInclude ( ) , INCLUDE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Ekstazi { /** * Saves info about the results of running the given test class . */ public void endClassCoverage ( String className , boolean isFailOrError ) { } }
File testResultsDir = new File ( Config . ROOT_DIR_V , Names . TEST_RESULTS_DIR_NAME ) ; File outcomeFile = new File ( testResultsDir , className ) ; if ( isFailOrError ) { // TODO : long names . testResultsDir . mkdirs ( ) ; try { outcomeFile . createNewFile ( ) ; } catch ( IOException e ) { Log . e ( "Unable to create file for a failing test: " + className , e ) ; } } else { outcomeFile . delete ( ) ; } endClassCoverage ( className ) ;
public class VAlarm { /** * Creates an email alarm . * @ param trigger the trigger * @ param subject the email subject * @ param body the email body * @ param recipients the email address ( es ) to send the alert to * @ return the alarm */ public static VAlarm email ( Trigger trigger , String subject , String body , String ... recipients ) { } }
return email ( trigger , subject , body , Arrays . asList ( recipients ) ) ;
public class GLShader { /** * Returns the texture fragment shader program . Note that this program < em > must < / em > preserve the * use of the existing varying attributes . You can add new varying attributes , but you cannot * remove or change the defaults . */ protected String textureFragmentShader ( ) { } }
StringBuilder str = new StringBuilder ( FRAGMENT_PREAMBLE ) ; str . append ( textureUniforms ( ) ) ; str . append ( textureVaryings ( ) ) ; str . append ( "void main(void) {\n" ) ; str . append ( textureColor ( ) ) ; str . append ( textureTint ( ) ) ; str . append ( textureAlpha ( ) ) ; str . append ( " gl_FragColor = textureColor;\n" + "}" ) ; return str . toString ( ) ;
public class ManipulationUtils { /** * Creates the logic which is needed to handle fields which are File types , since they need special treatment . */ private static String handleFileField ( String property , CtClass clazz ) throws NotFoundException , CannotCompileException { } }
String wrapperName = property + "wrapper" ; StringBuilder builder = new StringBuilder ( ) ; builder . append ( createTrace ( String . format ( "Handle File type property '%s'" , property ) ) ) . append ( String . format ( "if(%s == null) {" , property ) ) . append ( String . format ( "elements.add(new OpenEngSBModelEntry(\"%s\"" , wrapperName ) ) . append ( ", null, FileWrapper.class));}\n else {" ) . append ( String . format ( "FileWrapper %s = new FileWrapper(%s);\n" , wrapperName , property ) ) . append ( String . format ( "%s.serialize();\n" , wrapperName ) ) . append ( String . format ( "elements.add(new OpenEngSBModelEntry(\"%s\",%s,%s.getClass()));}\n" , wrapperName , wrapperName , wrapperName ) ) ; addFileFunction ( clazz , property ) ; return builder . toString ( ) ;
public class ComputerRetentionWork { /** * { @ inheritDoc } */ @ SuppressWarnings ( "unchecked" ) @ Override protected void doRun ( ) { } }
final long startRun = System . currentTimeMillis ( ) ; for ( final Computer c : Jenkins . get ( ) . getComputers ( ) ) { Queue . withLock ( new Runnable ( ) { @ Override public void run ( ) { Node n = c . getNode ( ) ; if ( n != null && n . isHoldOffLaunchUntilSave ( ) ) return ; if ( ! nextCheck . containsKey ( c ) || startRun > nextCheck . get ( c ) ) { // at the moment I don ' t trust strategies to wait more than 60 minutes // strategies need to wait at least one minute final long waitInMins = Math . max ( 1 , Math . min ( 60 , c . getRetentionStrategy ( ) . check ( c ) ) ) ; nextCheck . put ( c , startRun + TimeUnit . MINUTES . toMillis ( waitInMins ) ) ; } } } ) ; }
public class XmlIOUtil { /** * Creates an xml pipe from a byte array . */ public static Pipe newPipe ( byte [ ] data , int offset , int length ) throws IOException { } }
return newPipe ( new ByteArrayInputStream ( data , offset , length ) ) ;
public class AdminCommandOther { /** * Parses command - line and directs to command groups or non - grouped * sub - commands . * @ param args Command - line input * @ throws Exception */ public static void executeCommand ( String [ ] args ) throws Exception { } }
String subCmd = ( args . length > 0 ) ? args [ 0 ] : "" ; args = AdminToolUtils . copyArrayCutFirst ( args ) ; if ( subCmd . equals ( "native-backup" ) ) { SubCommandNativeBackup . executeCommand ( args ) ; } else if ( subCmd . equals ( "restore-from-replica" ) ) { SubCommandRestoreFromReplica . executeCommand ( args ) ; } else { AdminCommand . printHelp ( System . out ) ; }
public class Parser { /** * Parse a fragment of XML into a list of nodes . * @ param fragmentXml the fragment of XML to parse * @ param baseUri base URI of document ( i . e . original fetch location ) , for resolving relative URLs . * @ return list of nodes parsed from the input XML . */ public static List < Node > parseXmlFragment ( String fragmentXml , String baseUri ) { } }
XmlTreeBuilder treeBuilder = new XmlTreeBuilder ( ) ; return treeBuilder . parseFragment ( fragmentXml , baseUri , new Parser ( treeBuilder ) ) ;
public class AndConditionImpl { /** * The order of the conditions is irrelevant , just check the set is the same . */ private boolean conditionsEqual ( Collection < Condition > conditions ) { } }
if ( conditions . size ( ) != _conditions . size ( ) ) { return false ; } List < Condition > unvalidatedConditions = new ArrayList < > ( conditions ) ; for ( Condition condition : _conditions ) { if ( ! unvalidatedConditions . remove ( condition ) ) { return false ; } } return true ;
public class NavMeshBuilder { /** * Check if a particular space is clear of blockages * @ param map The map the spaces are being built from * @ param space The space to check * @ return True if there are no blockages in the space */ public boolean clear ( TileBasedMap map , Space space ) { } }
if ( tileBased ) { return true ; } float x = 0 ; boolean donex = false ; while ( x < space . getWidth ( ) ) { float y = 0 ; boolean doney = false ; while ( y < space . getHeight ( ) ) { sx = ( int ) ( space . getX ( ) + x ) ; sy = ( int ) ( space . getY ( ) + y ) ; if ( map . blocked ( this , sx , sy ) ) { return false ; } y += 0.1f ; if ( ( y > space . getHeight ( ) ) && ( ! doney ) ) { y = space . getHeight ( ) ; doney = true ; } } x += 0.1f ; if ( ( x > space . getWidth ( ) ) && ( ! donex ) ) { x = space . getWidth ( ) ; donex = true ; } } return true ;
public class OpenAPIModelFilterAdapter { /** * { @ inheritDoc } */ @ Override public Components visitComponents ( Context context , Components components ) { } }
visitor . visitComponents ( context , components ) ; return components ;
public class CPDefinitionSpecificationOptionValueWrapper { /** * Sets the localized values of this cp definition specification option value from the map of locales and localized values , and sets the default locale . * @ param valueMap the locales and localized values of this cp definition specification option value * @ param defaultLocale the default locale */ @ Override public void setValueMap ( Map < java . util . Locale , String > valueMap , java . util . Locale defaultLocale ) { } }
_cpDefinitionSpecificationOptionValue . setValueMap ( valueMap , defaultLocale ) ;
public class FastList { /** * { @ inheritDoc } */ @ Override public T remove ( int index ) { } }
if ( size == 0 ) { return null ; } final T old = elementData [ index ] ; final int numMoved = size - index - 1 ; if ( numMoved > 0 ) { System . arraycopy ( elementData , index + 1 , elementData , index , numMoved ) ; } elementData [ -- size ] = null ; return old ;
public class InterpretedFunction { /** * Create function embedded in script or another function . */ static InterpretedFunction createFunction ( Context cx , Scriptable scope , InterpretedFunction parent , int index ) { } }
InterpretedFunction f = new InterpretedFunction ( parent , index ) ; f . initScriptFunction ( cx , scope ) ; return f ;
public class WSRdbXaResourceImpl { /** * Tell the resource manager to forget about a heuristically completed transaction branch . * @ param Xid xid - A global transaction identifier * @ exception XAException - An error has occurred . Possible exception values are XAER _ RMERR , XAER _ RMFAIL , * XAER _ NOTA , XAER _ INVAL , or XAER _ PROTO . * Possible causes for this exception are : * 1 ) the forget call on the physical XAResource failed * 2 ) forget was called in an invalid transaction state */ public void forget ( Xid xid ) throws XAException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "forget" , new Object [ ] { ivManagedConnection , AdapterUtil . toString ( xid ) } ) ; // if the MC marked Stale , it means the user requested a purge pool with an immediate option // so don ' t allow any work to continue . In this case , we throw XAER _ RMFAIL xa error // which indicates that the resource manager is not available if ( ivManagedConnection . _mcStale ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "MC is stale throwing XAER_RMFAIL" , ivManagedConnection ) ; Tr . error ( tc , "INVALID_CONNECTION" ) ; throw new XAException ( XAException . XAER_RMFAIL ) ; } if ( ivXid == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "XAResource.start was never issued; allowing to forget for recovery." ) ; } // For XAResource . forget , only trace an Xid mismatch . if ( TraceComponent . isAnyTracingEnabled ( ) && ! xid . equals ( ivXid ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Xid does not match." , new Object [ ] { "XAResource.start: " , AdapterUtil . toString ( ivXid ) , "XAResource.forget: " , AdapterUtil . toString ( xid ) } ) ; try { // since we are not forgetting the tran when we get heuristic exception in commit / rollback , we will really pass forget // to the database here . ivXaRes . forget ( xid ) ; ivStateManager . setState ( WSStateManager . XA_FORGET ) ; } catch ( TransactionException te ) { // Exception means setState failed because it was invalid to set the state in this case FFDCFilter . processException ( te , "com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.forget" , "284" , this ) ; Tr . error ( tc , "INVALID_TX_STATE" , new Object [ ] { "XAResource.forget()" , ivManagedConnection . getTransactionStateAsString ( ) } ) ; traceXAException ( new XAException ( XAException . XA_RBPROTO ) , currClass ) ; } catch ( XAException xaE ) { FFDCFilter . processException ( xaE , "com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.forget" , "489" , this ) ; traceXAException ( xaE , currClass ) ; checkXAException ( xaE ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "forget" , xaE ) ; throw xaE ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "forget" ) ;
public class ItemsUnion { /** * Gets the result of this Union operation ( without a copy ) and resets this Union to the * virgin state . * @ return the result of this Union operation and reset . */ public ItemsSketch < T > getResultAndReset ( ) { } }
if ( gadget_ == null ) { return null ; } // Intentionally return null here for speed . final ItemsSketch < T > hqs = gadget_ ; gadget_ = null ; return hqs ;
public class PortletDefinitionForm { /** * Replaces this form ' s collection of principals and < em > optionally < / em > sets default * permissions ( SUBSCRIBE + BROWSE ) for new principals * @ param newPrincipals * @ param initPermissionsForNew Give new principals < code > BROWSE < / code > and < code > SUBSCRIBE * < / code > permission when true */ public void setPrincipals ( Set < JsonEntityBean > newPrincipals , boolean initPermissionsForNew ) { } }
final Set < JsonEntityBean > previousPrincipals = new HashSet < > ( principals ) ; principals . clear ( ) ; principals . addAll ( newPrincipals ) ; if ( initPermissionsForNew ) { principals . stream ( ) . forEach ( bean -> { if ( ! previousPrincipals . contains ( bean ) ) { /* * Previously unknown principals receive BROWSE & SUBSCRIBE by * default ( but not CONFIGURE ! ) ; known principals do not receive * this treatment b / c we don ' t want to reset previous selections . */ initPermissionsForPrincipal ( bean ) ; } } ) ; }
public class ICUHumanize { /** * Formats a number of seconds as hours , minutes and seconds . * @ param value * Number of seconds * @ return Number of seconds as hours , minutes and seconds */ public static String duration ( final Number value ) { } }
// NOTE : does not support any other locale return withinLocale ( new Callable < String > ( ) { public String call ( ) throws Exception { return context . get ( ) . getRuleBasedNumberFormat ( RuleBasedNumberFormat . DURATION ) . format ( value ) ; } } , Locale . ENGLISH ) ;
public class Pattern { /** * the end of the found portion . */ private boolean find ( Clause clause , char [ ] chars , int [ ] cursor ) { } }
int start = cursor [ 0 ] ; int end = cursor [ 1 ] ; while ( end - start >= clause . minlen ) if ( matchClause ( clause , chars , cursor ) ) return true ; else cursor [ 0 ] = ++ start ; return false ;
public class JaversExtendedRepository { /** * last snapshot with commitId < = given timePoint */ public List < CdoSnapshot > getHistoricals ( GlobalId globalId , CommitId timePoint , boolean withChildValueObjects , int limit ) { } }
argumentsAreNotNull ( globalId , timePoint ) ; return delegate . getStateHistory ( globalId , QueryParamsBuilder . withLimit ( limit ) . withChildValueObjects ( withChildValueObjects ) . toCommitId ( timePoint ) . build ( ) ) ;
public class ModelResourceStructure { /** * Find a model or model list given its Ids . * @ param id The id use for path matching type * @ param ids the id of the model . * @ param includeDeleted a boolean . * @ return a { @ link javax . ws . rs . core . Response } object . * @ throws java . lang . Exception if any . * @ see javax . ws . rs . GET * @ see AbstractModelResource # findByIds */ public Response findByIds ( @ NotNull @ PathParam ( "ids" ) URI_ID id , @ NotNull @ PathParam ( "ids" ) final PathSegment ids , @ QueryParam ( "include_deleted" ) final boolean includeDeleted ) throws Exception { } }
final Query < MODEL > query = server . find ( modelType ) ; final MODEL_ID firstId = tryConvertId ( ids . getPath ( ) ) ; Set < String > idSet = ids . getMatrixParameters ( ) . keySet ( ) ; final Set < MODEL_ID > idCollection = Sets . newLinkedHashSet ( ) ; idCollection . add ( firstId ) ; if ( ! idSet . isEmpty ( ) ) { idCollection . addAll ( Collections2 . transform ( idSet , this :: tryConvertId ) ) ; } matchedFindByIds ( firstId , idCollection , includeDeleted ) ; Object model ; if ( includeDeleted ) { query . setIncludeSoftDeletes ( ) ; } final TxRunnable configureQuery = t -> { configDefaultQuery ( query ) ; configFindByIdsQuery ( query , includeDeleted ) ; applyUriQuery ( query , false ) ; } ; if ( ! idSet . isEmpty ( ) ) { model = executeTx ( t -> { configureQuery . run ( t ) ; List < MODEL > m = query . where ( ) . idIn ( idCollection . toArray ( ) ) . findList ( ) ; return processFoundByIdsModelList ( m , includeDeleted ) ; } ) ; } else { model = executeTx ( t -> { configureQuery . run ( t ) ; MODEL m = query . setId ( firstId ) . findOne ( ) ; return processFoundByIdModel ( m , includeDeleted ) ; } ) ; } if ( isEmptyEntity ( model ) ) { throw new NotFoundException ( ) ; } return Response . ok ( model ) . build ( ) ;
public class AbstractDLock { /** * Get lock ' s custom property . * @ param key * @ return */ protected String getLockProperty ( String key ) { } }
return lockProps != null ? lockProps . getProperty ( key ) : null ;
public class DefaultTaskController { /** * Enables the task for cleanup by changing permissions of the specified path * in the local filesystem */ @ Override void enableTaskForCleanup ( PathDeletionContext context ) throws IOException { } }
try { FileUtil . chmod ( context . fullPath , "a+rwx" , true ) ; } catch ( InterruptedException e ) { LOG . warn ( "Interrupted while setting permissions for " + context . fullPath + " for deletion." ) ; } catch ( IOException ioe ) { LOG . warn ( "Unable to change permissions of " + context . fullPath ) ; }
public class ContentsIdDao { /** * Delete by table name * @ param tableName * table name * @ return rows deleted * @ throws SQLException * upon failure */ public int deleteByTableName ( String tableName ) throws SQLException { } }
DeleteBuilder < ContentsId , Long > db = deleteBuilder ( ) ; db . where ( ) . eq ( ContentsId . COLUMN_TABLE_NAME , tableName ) ; PreparedDelete < ContentsId > deleteQuery = db . prepare ( ) ; int deleted = delete ( deleteQuery ) ; return deleted ;
public class ConfluenceGreenPepper { /** * Get the repositories from the GreenPepper Server wich are requirements dedicated * @ return List of requirement repositories * @ throws com . greenpepper . server . GreenPepperServerException if any . * @ param spaceKey a { @ link java . lang . String } object . */ public List < Repository > getRepositories ( String spaceKey ) throws GreenPepperServerException { } }
Repository repository = getHomeRepository ( spaceKey ) ; List < Repository > repositories = getGPServerService ( ) . getRequirementRepositoriesOfAssociatedProject ( repository . getUid ( ) ) ; return repositories ;
public class ValueAggregatorMapper { /** * Do nothing . Should not be called . */ public void reduce ( Text arg0 , Iterator < Text > arg1 , OutputCollector < Text , Text > arg2 , Reporter arg3 ) throws IOException { } }
throw new IOException ( "should not be called\n" ) ;
public class XML { /** * Create a new XML stream reader from the given { @ code input } stream . * < em > * The caller is responsible for closing the returned { @ code XMLStreamReader } . * < / em > * < pre > { @ code * try ( AutoCloseableXMLStreamReader xml = XML . reader ( in ) ) { * / / Move XML stream to first element . * xml . next ( ) ; * return reader . read ( xml ) ; * } < / pre > * @ param input the input stream * @ return a new { @ code Closeable } XML stream reader * @ throws XMLStreamException if the creation of the XML stream reader fails * @ throws NullPointerException if the given { @ code input } stream is * { @ code null } */ public static AutoCloseableXMLStreamReader reader ( final InputStream input ) throws XMLStreamException { } }
requireNonNull ( input ) ; // final XMLInputFactory factory = XMLInputFactory // . newFactory ( XMLInputFactory . class . getName ( ) , null ) ; final XMLInputFactory factory = XMLInputFactory . newFactory ( ) ; return new XMLReaderProxy ( factory . createXMLStreamReader ( input , "UTF-8" ) ) ;
public class Writer { /** * Writes a single character . The character to be written is contained in * the 16 low - order bits of the given integer value ; the 16 high - order bits * are ignored . * < p > Subclasses that intend to support efficient single - character output * should override this method . * @ param c * int specifying a character to be written * @ throws IOException * If an I / O error occurs */ public void write ( int c ) throws IOException { } }
synchronized ( lock ) { if ( writeBuffer == null ) { writeBuffer = new char [ WRITE_BUFFER_SIZE ] ; } writeBuffer [ 0 ] = ( char ) c ; write ( writeBuffer , 0 , 1 ) ; }
public class AbstractSession { /** * Unregister a browser */ protected final void unregisterBrowser ( AbstractQueueBrowser browserToRemove ) { } }
if ( browsersMap . remove ( browserToRemove . getId ( ) ) == null ) log . warn ( "Unknown browser : " + browserToRemove ) ;
public class RESTServlet { /** * Map an HTTP method to the permission needed to execute it . */ private Permission permissionForMethod ( String method ) { } }
switch ( method . toUpperCase ( ) ) { case "GET" : return Permission . READ ; case "PUT" : case "DELETE" : return Permission . UPDATE ; case "POST" : return Permission . APPEND ; default : throw new RuntimeException ( "Unexpected REST method: " + method ) ; }
public class RoadPolyline { /** * Replies the nearest start / end point to the specified point . * @ param < CT > is the type of the connection to reply * @ param connectionClass is the type of the connection to reply * @ param x x coordinate . * @ param y y coordinate . * @ return the nearest point */ @ Pure < CT extends RoadConnection > CT getNearestPoint ( Class < CT > connectionClass , double x , double y ) { } }
final int index = getNearestEndIndex ( x , y ) ; if ( index == 0 ) { return getBeginPoint ( connectionClass ) ; } return getEndPoint ( connectionClass ) ;
public class BICO { /** * ( non - Javadoc ) * @ see * moa . clusterers . AbstractClusterer # trainOnInstanceImpl ( weka . core . Instance ) */ @ Override public void trainOnInstanceImpl ( Instance inst ) { } }
double [ ] x = inst . toDoubleArray ( ) ; if ( this . numDimensions != x . length ) { System . out . println ( "Line skipped because line dimension is " + x . length + " instead of " + this . numDimensions ) ; return ; } // Starts with the buffer phase to calculate the starting threshold if ( this . bufferPhase ) { // Calculates the pairwise distance to all unequal point in the // buffer for ( double [ ] point : this . buffer ) { double d = Metric . distanceSquared ( point , x ) ; if ( d > 0 ) { this . pairwiseDifferent ++ ; if ( d < minDistance ) { minDistance = d ; } } } this . buffer . add ( x ) ; // Checks if the buffer is large enough if ( this . pairwiseDifferent >= this . maxNumClusterFeatures + 1 ) { // Calculates the starting threshold this . T = 16 * minDistance ; this . root . setThreshold ( calcRSquared ( 1 ) ) ; this . bufferPhase = false ; // Adds all points to the ClusteringFeature tree for ( double [ ] point : this . buffer ) { bicoUpdate ( point ) ; } this . buffer . clear ( ) ; this . buffer = null ; } } else { // Adds the point directly to the ClusteringFeature tree bicoUpdate ( x ) ; }
public class SeaGlassRootPaneUI { /** * Invokes supers implementation to uninstall any of its state . This will * also reset the < code > LayoutManager < / code > of the < code > JRootPane < / code > . * If a < code > Component < / code > has been added to the < code > JRootPane < / code > * to render the window decoration style , this method will remove it . * Similarly , this will revert the Border and LayoutManager of the < code > * JRootPane < / code > to what it was before < code > installUI < / code > was * invoked . * @ param c the JRootPane to uninstall state from */ public void uninstallUI ( JComponent c ) { } }
super . uninstallUI ( c ) ; uninstallClientDecorations ( root ) ; layoutManager = null ; mouseInputListener = null ; root = null ;
public class OrderItemUrl { /** * Get Resource Url for CreateOrderItem * @ param orderId Unique identifier of the order . * @ param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object . This parameter should only be used to retrieve data . Attempting to update data using this parameter may cause data loss . * @ param skipInventoryCheck If true , skip the process to validate inventory when creating this product reservation . * @ param updateMode Specifies whether to update the original order , update the order in draft mode , or update the order in draft mode and then commit the changes to the original . Draft mode enables users to make incremental order changes before committing the changes to the original order . Valid values are " ApplyToOriginal , " " ApplyToDraft , " or " ApplyAndCommit . " * @ param version Determines whether or not to check versioning of items for concurrency purposes . * @ return String Resource Url */ public static MozuUrl createOrderItemUrl ( String orderId , String responseFields , Boolean skipInventoryCheck , String updateMode , String version ) { } }
UrlFormatter formatter = new UrlFormatter ( "/api/commerce/orders/{orderId}/items?updatemode={updateMode}&version={version}&skipInventoryCheck={skipInventoryCheck}&responseFields={responseFields}" ) ; formatter . formatUrl ( "orderId" , orderId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "skipInventoryCheck" , skipInventoryCheck ) ; formatter . formatUrl ( "updateMode" , updateMode ) ; formatter . formatUrl ( "version" , version ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ;
public class PlanNodeTree { /** * Scan node , join node can have predicate , so does the Aggregate node ( Having clause ) . */ private void connectNodesIfNecessary ( AbstractPlanNode node ) { } }
NodeSchema outputSchema = node . getOutputSchema ( ) ; if ( outputSchema != null ) { for ( SchemaColumn col : outputSchema ) { connectPredicateStmt ( col . getExpression ( ) ) ; } } if ( node instanceof AbstractScanPlanNode ) { AbstractScanPlanNode scanNode = ( AbstractScanPlanNode ) node ; connectPredicateStmt ( scanNode . getPredicate ( ) ) ; // If this is common table scan , we connect the scan node to the // plan nodes for the base and recursive query . if ( scanNode instanceof SeqScanPlanNode ) { SeqScanPlanNode seqScanNode = ( SeqScanPlanNode ) scanNode ; connectCTENodesIfAny ( seqScanNode ) ; } } else if ( node instanceof AbstractJoinPlanNode ) { AbstractJoinPlanNode joinNode = ( AbstractJoinPlanNode ) node ; connectPredicateStmt ( joinNode . getPreJoinPredicate ( ) ) ; connectPredicateStmt ( joinNode . getJoinPredicate ( ) ) ; connectPredicateStmt ( joinNode . getWherePredicate ( ) ) ; } else if ( node instanceof AggregatePlanNode ) { AggregatePlanNode aggNode = ( AggregatePlanNode ) node ; connectPredicateStmt ( aggNode . getPostPredicate ( ) ) ; } for ( AbstractPlanNode inlineNode : node . getInlinePlanNodes ( ) . values ( ) ) { connectNodesIfNecessary ( inlineNode ) ; }
public class DiffBase { /** * Find the ' middle snake ' of a diff , split the problem in two * and return the recursively constructed diff . * See Myers 1986 paper : An O ( ND ) Difference Algorithm and Its Variations . * @ param text1 Old string to be diffed . * @ param text2 New string to be diffed . * @ return LinkedList of DiffBase objects . */ LinkedList < Change > bisect ( String text1 , String text2 ) { } }
// Cache the text lengths to prevent multiple calls . int text1_length = text1 . length ( ) ; int text2_length = text2 . length ( ) ; int max_d = ( text1_length + text2_length + 1 ) / 2 ; int v_offset = max_d ; int v_length = 2 * max_d ; int [ ] v1 = new int [ v_length ] ; int [ ] v2 = new int [ v_length ] ; for ( int x = 0 ; x < v_length ; x ++ ) { v1 [ x ] = - 1 ; v2 [ x ] = - 1 ; } v1 [ v_offset + 1 ] = 0 ; v2 [ v_offset + 1 ] = 0 ; int delta = text1_length - text2_length ; // If the total number of characters is odd , then the front path will // collide with the reverse path . boolean front = ( delta % 2 != 0 ) ; // Offsets for start and end of k loop . // Prevents mapping of space beyond the grid . int k1start = 0 ; int k1end = 0 ; int k2start = 0 ; int k2end = 0 ; for ( int d = 0 ; d < max_d ; d ++ ) { // Bail out if deadline is reached . if ( options . getClock ( ) . millis ( ) > deadline ) { break ; } // Walk the front path one step . for ( int k1 = - d + k1start ; k1 <= d - k1end ; k1 += 2 ) { int k1_offset = v_offset + k1 ; int x1 ; if ( k1 == - d || ( k1 != d && v1 [ k1_offset - 1 ] < v1 [ k1_offset + 1 ] ) ) { x1 = v1 [ k1_offset + 1 ] ; } else { x1 = v1 [ k1_offset - 1 ] + 1 ; } int y1 = x1 - k1 ; while ( x1 < text1_length && y1 < text2_length && text1 . charAt ( x1 ) == text2 . charAt ( y1 ) ) { x1 ++ ; y1 ++ ; } v1 [ k1_offset ] = x1 ; if ( x1 > text1_length ) { // Ran off the right of the graph . k1end += 2 ; } else if ( y1 > text2_length ) { // Ran off the bottom of the graph . k1start += 2 ; } else if ( front ) { int k2_offset = v_offset + delta - k1 ; if ( k2_offset >= 0 && k2_offset < v_length && v2 [ k2_offset ] != - 1 ) { // Mirror x2 onto top - left coordinate system . int x2 = text1_length - v2 [ k2_offset ] ; if ( x1 >= x2 ) { // Overlap detected . return bisectSplit ( text1 , text2 , x1 , y1 ) ; } } } } // Walk the reverse path one step . for ( int k2 = - d + k2start ; k2 <= d - k2end ; k2 += 2 ) { int k2_offset = v_offset + k2 ; int x2 ; if ( k2 == - d || ( k2 != d && v2 [ k2_offset - 1 ] < v2 [ k2_offset + 1 ] ) ) { x2 = v2 [ k2_offset + 1 ] ; } else { x2 = v2 [ k2_offset - 1 ] + 1 ; } int y2 = x2 - k2 ; while ( x2 < text1_length && y2 < text2_length && text1 . charAt ( text1_length - x2 - 1 ) == text2 . charAt ( text2_length - y2 - 1 ) ) { x2 ++ ; y2 ++ ; } v2 [ k2_offset ] = x2 ; if ( x2 > text1_length ) { // Ran off the left of the graph . k2end += 2 ; } else if ( y2 > text2_length ) { // Ran off the top of the graph . k2start += 2 ; } else if ( ! front ) { int k1_offset = v_offset + delta - k2 ; if ( k1_offset >= 0 && k1_offset < v_length && v1 [ k1_offset ] != - 1 ) { int x1 = v1 [ k1_offset ] ; int y1 = v_offset + x1 - k1_offset ; // Mirror x2 onto top - left coordinate system . x2 = text1_length - x2 ; if ( x1 >= x2 ) { // Overlap detected . return bisectSplit ( text1 , text2 , x1 , y1 ) ; } } } } } // DiffBase took too long and hit the deadline or // number of diffs equals number of characters , no commonality at all . LinkedList < Change > diffs = new LinkedList < Change > ( ) ; diffs . add ( new Change ( Operation . DELETE , text1 ) ) ; diffs . add ( new Change ( Operation . INSERT , text2 ) ) ; return diffs ;
public class XCatchClauseImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setDeclaredParam ( JvmFormalParameter newDeclaredParam ) { } }
if ( newDeclaredParam != declaredParam ) { NotificationChain msgs = null ; if ( declaredParam != null ) msgs = ( ( InternalEObject ) declaredParam ) . eInverseRemove ( this , EOPPOSITE_FEATURE_BASE - XbasePackage . XCATCH_CLAUSE__DECLARED_PARAM , null , msgs ) ; if ( newDeclaredParam != null ) msgs = ( ( InternalEObject ) newDeclaredParam ) . eInverseAdd ( this , EOPPOSITE_FEATURE_BASE - XbasePackage . XCATCH_CLAUSE__DECLARED_PARAM , null , msgs ) ; msgs = basicSetDeclaredParam ( newDeclaredParam , msgs ) ; if ( msgs != null ) msgs . dispatch ( ) ; } else if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , XbasePackage . XCATCH_CLAUSE__DECLARED_PARAM , newDeclaredParam , newDeclaredParam ) ) ;
public class ApiOvhOrder { /** * Get prices and contracts information * REST : GET / order / dedicated / server / { serviceName } / staticIP / { duration } * @ param country [ required ] Ip localization * @ param serviceName [ required ] The internal name of your dedicated server * @ param duration [ required ] Duration */ public OvhOrder dedicated_server_serviceName_staticIP_duration_GET ( String serviceName , String duration , OvhIpStaticCountryEnum country ) throws IOException { } }
String qPath = "/order/dedicated/server/{serviceName}/staticIP/{duration}" ; StringBuilder sb = path ( qPath , serviceName , duration ) ; query ( sb , "country" , country ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhOrder . class ) ;
public class UpdateSecretRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateSecretRequest updateSecretRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateSecretRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateSecretRequest . getSecretId ( ) , SECRETID_BINDING ) ; protocolMarshaller . marshall ( updateSecretRequest . getClientRequestToken ( ) , CLIENTREQUESTTOKEN_BINDING ) ; protocolMarshaller . marshall ( updateSecretRequest . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( updateSecretRequest . getKmsKeyId ( ) , KMSKEYID_BINDING ) ; protocolMarshaller . marshall ( updateSecretRequest . getSecretBinary ( ) , SECRETBINARY_BINDING ) ; protocolMarshaller . marshall ( updateSecretRequest . getSecretString ( ) , SECRETSTRING_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ConditionalFunctions { /** * Returned expression results in PosInf if expression1 = expression2 , otherwise returns expression1. * Returns MISSING or NULL if either input is MISSING or NULL . */ public static Expression posInfIf ( Expression expression1 , Expression expression2 ) { } }
return x ( "POSINFIF(" + expression1 . toString ( ) + ", " + expression2 . toString ( ) + ")" ) ;
public class Connection { /** * If there is no current connection , start a new tcp connection asynchronously . * @ throws RpcException */ protected void connect ( ) throws RpcException { } }
if ( _state . equals ( State . CONNECTED ) ) { return ; } final ChannelFuture oldChannelFuture = _channelFuture ; if ( LOG . isDebugEnabled ( ) ) { String logPrefix = _usePrivilegedPort ? "usePrivilegedPort " : "" ; LOG . debug ( "{}connecting to {}" , logPrefix , getRemoteAddress ( ) ) ; } _state = State . CONNECTING ; if ( _usePrivilegedPort ) { _channel = bindToPrivilegedPort ( ) ; _channelFuture = _channel . connect ( getRemoteAddress ( ) ) ; } else { _channelFuture = _clientBootstrap . connect ( ) ; _channel = _channelFuture . getChannel ( ) ; } NioSocketChannelConfig cfg = ( NioSocketChannelConfig ) _channel . getConfig ( ) ; cfg . setWriteBufferHighWaterMark ( MAX_SENDING_QUEUE_SIZE ) ; _channelFuture . addListener ( new ChannelFutureListener ( ) { /* ( non - Javadoc ) * @ see org . jboss . netty . channel . ChannelFutureListener # operationComplete ( org . jboss . netty . channel . ChannelFuture ) */ public void operationComplete ( ChannelFuture future ) { if ( _channelFuture . isSuccess ( ) ) { _state = State . CONNECTED ; oldChannelFuture . setSuccess ( ) ; } else { _state = State . DISCONNECTED ; oldChannelFuture . cancel ( ) ; } } } ) ;
public class Condition { /** * Checks HTTP parameters . Also work with multi - valued parameters */ public static Condition parameter ( final String key , final String ... parameterValues ) { } }
return new Condition ( input -> Arrays . equals ( input . getParameters ( ) . get ( key ) , parameterValues ) ) ;
public class MsgHtmlTagNode { /** * Validates and returns the given attribute , or { @ code null } if it doesn ' t exist . */ @ Nullable private static RawTextNode getAttributeValue ( HtmlAttributeNode htmlAttributeNode , String name , ErrorReporter errorReporter ) { } }
StandaloneNode valueNode = htmlAttributeNode . getChild ( 1 ) ; if ( valueNode instanceof HtmlAttributeValueNode ) { HtmlAttributeValueNode attributeValueNode = ( HtmlAttributeValueNode ) valueNode ; if ( attributeValueNode . numChildren ( ) == 1 && attributeValueNode . getChild ( 0 ) instanceof RawTextNode ) { return ( RawTextNode ) attributeValueNode . getChild ( 0 ) ; } } errorReporter . report ( valueNode . getSourceLocation ( ) , INVALID_ATTRIBUTE , name ) ; return null ;
public class MaterialComboBox { /** * Will get the Selection dropdown container rendered */ public JQueryElement getDropdownContainerElement ( ) { } }
JQueryElement element = $ ( getElement ( ) ) . find ( ".select2 .selection .select2-selection__rendered" ) ; if ( element == null ) { GWT . log ( "The element dropdown-container element is undefined." , new NullPointerException ( ) ) ; } return element ;
public class PropertiesField { /** * Set this property in the user ' s property area . * @ param strProperty The property key . * @ param strValue The property value . */ public void setProperty ( String strProperty , String strValue ) { } }
this . setProperty ( strProperty , strValue , DBConstants . DISPLAY , DBConstants . SCREEN_MOVE ) ;
public class MenuItemImpl { /** * Gets the title for a particular { @ link ItemView } * @ param itemView The ItemView that is receiving the title * @ return Either the title or condensed title based on what the ItemView * prefers */ CharSequence getTitleForItemView ( MenuView . ItemView itemView ) { } }
return ( ( itemView != null ) && itemView . prefersCondensedTitle ( ) ) ? getTitleCondensed ( ) : getTitle ( ) ;
public class JsonModelCoder { /** * Encodes the given value into the JSON format , and writes it using the given writer . < br > * Writes " null " if null is given . * @ param writer { @ link Writer } to be used for writing value * @ param obj Value to encoded * @ throws IOException */ public void encodeNullToNull ( Writer writer , T obj ) throws IOException { } }
if ( obj == null ) { writer . write ( "null" ) ; return ; } JsonUtil . startHash ( writer ) ; encodeValue ( writer , obj ) ; JsonUtil . endHash ( writer ) ; writer . flush ( ) ;
public class ArchiveBase { /** * { @ inheritDoc } * @ see org . jboss . shrinkwrap . api . Archive # merge ( org . jboss . shrinkwrap . api . Archive , org . jboss . shrinkwrap . api . Filter ) */ @ Override public T merge ( Archive < ? > source , Filter < ArchivePath > filter ) throws IllegalArgumentException { } }
return merge ( source , new BasicPath ( ) , filter ) ;
public class CmsContainerpageController { /** * Returns all element id ' s related to the given one . < p > * @ param id the element id * @ return the related id ' s */ private Set < String > getRelatedElementIds ( String id ) { } }
Set < String > result = new HashSet < String > ( ) ; if ( id != null ) { result . add ( id ) ; String serverId = getServerId ( id ) ; Iterator < String > it = m_elements . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { String elId = it . next ( ) ; if ( elId . startsWith ( serverId ) ) { result . add ( elId ) ; } } Iterator < org . opencms . ade . containerpage . client . ui . CmsContainerPageElementPanel > itEl = getAllDragElements ( ) . iterator ( ) ; while ( itEl . hasNext ( ) ) { org . opencms . ade . containerpage . client . ui . CmsContainerPageElementPanel element = itEl . next ( ) ; if ( element . getId ( ) . startsWith ( serverId ) ) { result . add ( element . getId ( ) ) ; } } } return result ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link DatumRefType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link DatumRefType } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "datumRef" ) public JAXBElement < DatumRefType > createDatumRef ( DatumRefType value ) { } }
return new JAXBElement < DatumRefType > ( _DatumRef_QNAME , DatumRefType . class , null , value ) ;
public class AbstractMatcherElement { /** * Exports the successful result of the match as a set of properties with the given prefix . * The properties key / value * format is as follows : * < ul > * < li > { @ code prefix + " . before " = result . getBefore ( ) } < / li > * < li > { @ code prefix + " . group " = result . group ( ) } < / li > * < li > { @ code prefix + " . success " = true } < / li > * < li > { @ code prefix + " . group . " + & lt ; number & gt ; = result . group ( & lt ; number & gt ; ) } , * where the { @ code number } * is between 1 and { @ code result . groupCount ( ) } < / li > * < / ul > * If the { @ code prefix } is { @ code null } , or the { @ code result } is not successful , * then this method does nothing . * @ param prefix the property prefix * @ param result the result */ protected void exportSuccessfulResult ( String prefix , R result ) { } }
if ( prefix == null ) { return ; } setPropertyIfNoNull ( prefix , "input" , result . getInput ( ) ) ; if ( ! result . isSuccessful ( ) ) { return ; } setPropertyIfNoNull ( prefix , "input" , result . getInput ( ) ) ; setPropertyIfNoNull ( prefix , "before" , result . getBefore ( ) ) ; setPropertyIfNoNull ( prefix , "group" , result . group ( ) ) ; setPropertyIfNoNull ( prefix , "success" , "true" ) ; for ( int i = 1 ; i <= result . groupCount ( ) ; i ++ ) { setPropertyIfNoNull ( prefix , "group." + i , result . group ( i ) ) ; }
public class DateInterval { /** * / * [ deutsch ] * < p > Liefert die L & auml ; nge dieses Intervalls in Jahren , Monaten und * Tagen . < / p > * @ return duration in years , months and days * @ throws UnsupportedOperationException if this interval is infinite * @ since 2.0 * @ see # getLengthInDays ( ) * @ see # getDuration ( CalendarUnit [ ] ) getDuration ( CalendarUnit . . . ) */ public Duration < CalendarUnit > getDurationInYearsMonthsDays ( ) { } }
PlainDate date = this . getTemporalOfOpenEnd ( ) ; boolean max = ( date == null ) ; if ( max ) { // max reached date = this . getEnd ( ) . getTemporal ( ) ; } Duration < CalendarUnit > result = Duration . inYearsMonthsDays ( ) . between ( this . getTemporalOfClosedStart ( ) , date ) ; if ( max ) { return result . plus ( 1 , CalendarUnit . DAYS ) ; } return result ;
public class BindTypeBuilder { /** * Generate parse on xml attributes . * @ param context * the context * @ param methodBuilder * the method builder * @ param entity * the entity */ private static void generateParseOnXmlAttributes ( BindTypeContext context , MethodSpec . Builder methodBuilder , BindEntity entity ) { } }
BindTransform bindTransform ; int count = 0 ; // count property to manage { // for each elements for ( BindProperty property : entity . getCollection ( ) ) { if ( property . xmlInfo . xmlType != XmlType . ATTRIBUTE ) continue ; count ++ ; } } if ( count > 0 ) { // @ formatter : off methodBuilder . addCode ( "\n// attributes \n" ) ; methodBuilder . addStatement ( "String attributeName = null" ) ; // methodBuilder . addStatement ( " String attributeValue = null " ) ; methodBuilder . addStatement ( "int attributesCount = xmlParser.getAttributeCount();" ) ; methodBuilder . beginControlFlow ( "for (int attributeIndex = 0; attributeIndex < attributesCount; attributeIndex++)" ) ; methodBuilder . addStatement ( "attributeName = xmlParser.getAttributeName(attributeIndex)" ) ; // methodBuilder . addStatement ( " attributeValue = // $ T . unescapeXml ( xmlParser . getAttributeValue ( attributeIndex ) ) " , // StringEscapeUtils . class ) ; methodBuilder . beginControlFlow ( "switch(attributeName)$>" ) ; for ( BindProperty property : entity . getCollection ( ) ) { if ( property . xmlInfo . xmlType != XmlType . ATTRIBUTE ) continue ; methodBuilder . addCode ( "case $S:\n$>" , BindProperty . xmlName ( property ) ) ; bindTransform = BindTransformer . lookup ( property ) ; methodBuilder . addCode ( "// field $L (mapped by $S)\n" , property . getName ( ) , BindProperty . xmlName ( property ) ) ; bindTransform . generateParseOnXml ( context , methodBuilder , "xmlParser" , property . getPropertyType ( ) . getTypeName ( ) , "instance" , property ) ; methodBuilder . addStatement ( "$<break" ) ; } methodBuilder . addCode ( "default:\n$>" ) ; methodBuilder . addStatement ( "$<break$<" ) ; methodBuilder . endControlFlow ( ) ; methodBuilder . endControlFlow ( ) ; // @ formatter : on } else { methodBuilder . addCode ( "// No attributes found\n" ) ; }
public class DefaultJPAService { /** * Locates an entity based on it ' s primary key value . * @ param < E > The type of the entity . * @ param em The entity manager to use . Cannot be null . * @ param id The primary key of the entity . Cannot be null and must be a positive non - zero number . * @ param type The runtime type of the entity . Cannot be null . * @ return The entity or null if no entity exists for the primary key . */ protected < E extends Identifiable > E findEntity ( EntityManager em , BigInteger id , Class < E > type ) { } }
requireArgument ( em != null , "The entity manager cannot be null." ) ; requireArgument ( id != null && id . compareTo ( ZERO ) > 0 , "ID must be positive and non-zero" ) ; requireArgument ( type != null , "The entity cannot be null." ) ; em . getEntityManagerFactory ( ) . getCache ( ) . evictAll ( ) ; return em . find ( type , id ) ;
public class TitlePaneButtonForegroundPainter { /** * Paint the pressed state of the button foreground . * @ param g the Graphics2D context to paint with . * @ param c the button to paint . * @ param width the width to paint . * @ param height the height to paint . */ public void paintPressed ( Graphics2D g , JComponent c , int width , int height ) { } }
paint ( g , c , width , height , pressedBorder , pressedCorner , pressedInterior ) ;
public class DtmfBuffer { /** * Queues specified event . * @ param evt the event to be queued . */ protected void queue ( DtmfEventImpl evt ) { } }
if ( queue . size ( ) == size ) { queue . poll ( ) ; } queue . offer ( evt ) ; logger . info ( String . format ( "(%s) Buffer size: %d" , detectorImpl . getName ( ) , queue . size ( ) ) ) ;
public class StandardDdlParser { /** * This utility method provides this parser the ability to distinguish between a CreateTable Constraint and a ColumnDefinition * Definition which are the only two statement segment types allowed within the CREATE TABLE parenthesis ( xxxxx ) ; * @ param tokens the { @ link DdlTokenStream } representing the tokenized DDL content ; may not be null * @ return is table constraint * @ throws ParsingException */ protected boolean isTableConstraint ( DdlTokenStream tokens ) throws ParsingException { } }
boolean result = false ; if ( ( tokens . matches ( "PRIMARY" , "KEY" ) ) || ( tokens . matches ( "FOREIGN" , "KEY" ) ) || ( tokens . matches ( "UNIQUE" ) ) || tokens . matches ( CHECK ) ) { result = true ; } else if ( tokens . matches ( CONSTRAINT ) ) { if ( tokens . matches ( CONSTRAINT , TokenStream . ANY_VALUE , "UNIQUE" ) || tokens . matches ( CONSTRAINT , TokenStream . ANY_VALUE , "PRIMARY" , "KEY" ) || tokens . matches ( CONSTRAINT , TokenStream . ANY_VALUE , "FOREIGN" , "KEY" ) || tokens . matches ( CONSTRAINT , TokenStream . ANY_VALUE , CHECK ) ) { result = true ; } } return result ;
public class InterpretedContainerImpl { /** * { @ inheritDoc } */ @ SuppressWarnings ( "unchecked" ) @ Override public < T > T adapt ( Class < T > adaptTarget ) throws UnableToAdaptException { } }
// intercept the adapt to parent entry , to return interpreted entry if ( adaptTarget == Entry . class ) { return ( T ) getInterpretedEntryInEnclosingContainer ( ) ; } else if ( adaptTarget == Notifier . class && structureHelper != null ) { // We only adapt roots so if we aren ' t root then grab the root if ( isRoot ( ) ) { // Lazily create the notifier if ( this . notifier == null ) { final ArtifactContainer rootArtifactContainer ; if ( structureHelperLocalRootDelegate == null ) { // We are a real root so we know that the delegate is the root rootArtifactContainer = delegate ; } else { // we are creating a notifier and are a fake root so use the fake delegate root rootArtifactContainer = structureHelperLocalRootDelegate ; } this . notifier = new InterpretedNotifier ( this , rootArtifactContainer , structureHelper ) ; } return ( T ) this . notifier ; } else { return ( T ) getRoot ( ) . adapt ( Notifier . class ) ; } } else if ( adaptTarget != InterpretedContainer . class ) // safety feature . . the above if prevents adapting interpreted into another interpreted . return super . adapt ( adaptTarget ) ; else { // adaptTarget was Interpreted , so we prevent the adapt . return null ; }
public class ChangeHistoryValue { /** * Sets the entityType value for this ChangeHistoryValue . * @ param entityType */ public void setEntityType ( com . google . api . ads . admanager . axis . v201808 . ChangeHistoryEntityType entityType ) { } }
this . entityType = entityType ;
public class PropertyCollection { /** * Loads all property objects beginning with the specified prefix . The property objects are * stored in a map indexed by the property name for easy retrieval . * @ param prefix The property prefix . */ public void loadProperties ( String prefix ) { } }
List < Property > props = null ; try { props = getListByPrefix ( prefix ) ; } catch ( Exception e ) { log . error ( "Error retrieving properties with prefix: " + prefix , e ) ; return ; } for ( Property prop : props ) { if ( prop . getName ( ) != null ) { this . properties . put ( prop . getName ( ) , prop ) ; } }
public class AuthenticationEndpoint { @ POST @ Path ( "/user/data/{userId}" ) @ Consumes ( MediaType . APPLICATION_JSON ) @ Produces ( MediaType . APPLICATION_JSON ) public Response recieveUserData ( @ Context Session session , @ PathParam ( "userId" ) String userId , Map < String , ? > data ) { } }
try { authServerLogic . recieveUserData ( userId , data ) ; return Response . ok ( ) . build ( ) ; } catch ( ServerDAO . DAOException e ) { logger . severe ( ExceptionUtils . getStackTrace ( e ) ) ; return fromDAOExpection ( e ) ; }
public class TimestampFilterUtil { /** * Converts a [ startMicros , endNons ) timestamps to a Cloud Bigtable [ startMicros , endMicros ) * filter . * @ param bigtableStartTimestamp a long value . * @ param bigtableEndTimestamp a long value . * @ return a { @ link Filter } object . */ public static Filter toTimestampRangeFilter ( long bigtableStartTimestamp , long bigtableEndTimestamp ) { } }
return FILTERS . timestamp ( ) . range ( ) . of ( bigtableStartTimestamp , bigtableEndTimestamp ) ;
public class PropertyParametersImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case BpsimPackage . PROPERTY_PARAMETERS__PROPERTY : return property != null && ! property . isEmpty ( ) ; } return super . eIsSet ( featureID ) ;
public class AjaxAddableTabbedPanel { /** * { @ inheritDoc } */ @ Override protected void onBeforeRender ( ) { } }
int index = getSelectedTab ( ) ; if ( ( index == - 1 ) || ( getVisiblityCache ( ) . isVisible ( index ) == false ) ) { // find first visible tab index = - 1 ; for ( int i = 0 ; i < tabs . size ( ) ; i ++ ) { if ( getVisiblityCache ( ) . isVisible ( i ) ) { index = i ; break ; } } if ( index != - 1 ) { // found a visible tab , so select it setSelectedTab ( index ) ; } } setCurrentTab ( index ) ; super . onBeforeRender ( ) ;
public class BaseBuffer { /** * { @ inheritDoc } */ @ Override public final Buffer readLine ( ) throws IOException { } }
final int start = getReaderIndex ( ) ; boolean foundCR = false ; while ( hasReadableBytes ( ) ) { final byte b = readByte ( ) ; switch ( b ) { case LF : return slice ( start , getReaderIndex ( ) - ( foundCR ? 2 : 1 ) ) ; case CR : foundCR = true ; break ; default : if ( foundCR ) { setReaderIndex ( getReaderIndex ( ) - 1 ) ; // return slice ( start , this . lowerBoundary + this . readerIndex - 1 ) ; return slice ( start , getReaderIndex ( ) - 1 ) ; } } } // i guess there were nothing for us to read if ( start >= getReaderIndex ( ) ) { return null ; } return slice ( start , getReaderIndex ( ) ) ;
public class FacebookCookie { /** * Decodes and validates the cookie . * @ param cookie is the fbsr _ YOURAPPID cookie from Facebook * @ param appSecret is your application secret from the Facebook Developer application console * @ throws IllegalStateException if the cookie does not validate */ public static FacebookCookie decode ( String cookie , String appSecret ) { } }
// Parsing and verifying signature seems to be poorly documented , but here ' s what I ' ve found : // Look at parseSignedRequest ( ) in https : / / github . com / facebook / php - sdk / blob / master / src / base _ facebook . php // Python version : https : / / developers . facebook . com / docs / samples / canvas / try { String [ ] parts = cookie . split ( "\\." ) ; byte [ ] sig = Base64 . decodeBase64 ( parts [ 0 ] ) ; byte [ ] json = Base64 . decodeBase64 ( parts [ 1 ] ) ; byte [ ] plaintext = parts [ 1 ] . getBytes ( ) ; // careful , we compute against the base64 encoded version FacebookCookie decoded = MAPPER . readValue ( json , FacebookCookie . class ) ; // " HMAC - SHA256 " doesn ' t work , but " HMACSHA256 " does . String algorithm = decoded . algorithm . replace ( "-" , "" ) ; SecretKey secret = new SecretKeySpec ( appSecret . getBytes ( ) , algorithm ) ; Mac mac = Mac . getInstance ( algorithm ) ; mac . init ( secret ) ; byte [ ] digested = mac . doFinal ( plaintext ) ; if ( ! Arrays . equals ( sig , digested ) ) throw new IllegalStateException ( "Signature failed" ) ; return decoded ; } catch ( Exception ex ) { throw new IllegalStateException ( "Unable to decode cookie" , ex ) ; }
public class SipStack { /** * This method is used to tear down the SipStack object . All resources are freed up . Before * calling this method , you should call the dispose ( ) nethod on any SipPhones you ' ve created using * this sip stack . */ public void dispose ( ) { } }
try { if ( sipProvider . getListeningPoints ( ) . length > 0 ) sipStack . deleteListeningPoint ( sipProvider . getListeningPoints ( ) [ 0 ] ) ; sipProvider . removeSipListener ( this ) ; sipStack . deleteSipProvider ( sipProvider ) ; sipFactory . resetFactory ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; }
public class BeginImageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eSet ( int featureID , Object newValue ) { } }
switch ( featureID ) { case AfplibPackage . BEGIN_IMAGE__OBJTYPE : setOBJTYPE ( ( Integer ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ;
public class CmsValidationHandler { /** * Registers the validation handler for the given entity . < p > * @ param entity the entity */ public void registerEntity ( CmsEntity entity ) { } }
if ( m_validationContext == null ) { m_validationContext = new CmsValidationContext ( ) ; } if ( m_handlerRegistration != null ) { m_handlerRegistration . removeHandler ( ) ; } m_paused = false ; m_handlerRegistration = entity . addValueChangeHandler ( this ) ;
public class StringHelper { /** * Compress a string value using GZIP . */ public static String compress ( String uncompressedValue ) throws IOException { } }
if ( uncompressedValue == null ) return null ; ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; GZIPOutputStream gzip = null ; try { gzip = new GZIPOutputStream ( out ) ; gzip . write ( uncompressedValue . getBytes ( ) ) ; gzip . close ( ) ; return out . toString ( "ISO-8859-1" ) ; } finally { if ( gzip != null ) gzip . close ( ) ; }
public class SchemaService { /** * Create the application with the given name in the given Tenant . If the given * application already exists , the request is treated as an application update . If the * update is successfully validated , its schema is stored in the database , and the * appropriate storage service is notified to implement required physical database * changes , if any . * @ param tenant { @ link Tenant } in which application is being created or updated . * @ param appDef { @ link ApplicationDefinition } of application to create or update . * Note that appDef is updated with the " Tenant " option . */ public void defineApplication ( Tenant tenant , ApplicationDefinition appDef ) { } }
checkServiceState ( ) ; appDef . setTenantName ( tenant . getName ( ) ) ; ApplicationDefinition currAppDef = checkApplicationKey ( appDef ) ; StorageService storageService = verifyStorageServiceOption ( currAppDef , appDef ) ; storageService . validateSchema ( appDef ) ; initializeApplication ( currAppDef , appDef ) ;
public class ImageDeformPointMLS_F32 { /** * Precompute the portion of the equation which only concerns the undistorted location of each point on the * grid even the current undistorted location of each control point . */ public void fixateUndistorted ( ) { } }
if ( controls . size ( ) < 2 ) throw new RuntimeException ( "Not enough control points specified. Found " + controls . size ( ) ) ; for ( int row = 0 ; row < gridRows ; row ++ ) { for ( int col = 0 ; col < gridCols ; col ++ ) { Cache cache = getGrid ( row , col ) ; cache . weights . resize ( controls . size ) ; cache . A . resize ( controls . size ) ; cache . A_s . resize ( controls . size ( ) ) ; float v_x = col ; float v_y = row ; computeWeights ( cache , v_x , v_y ) ; computeAverageP ( cache ) ; model . computeCache ( cache , v_x , v_y ) ; } }
public class RtedAlgorithm { /** * The recursion step according to the optimal strategy . * @ param it1 * @ param it2 * @ return */ private double computeDistUsingStrArray ( InfoTree it1 , InfoTree it2 ) { } }
int postorder1 = it1 . getCurrentNode ( ) ; int postorder2 = it2 . getCurrentNode ( ) ; int stepStrategy = str [ postorder1 ] [ postorder2 ] ; int tmpPostorder ; int [ ] stepPath ; int [ ] stepRelSubtrees ; ArrayList < Integer > heavyPath ; switch ( stepStrategy ) { case LEFT : tmpPostorder = postorder1 ; stepPath = it1 . getPath ( LEFT ) ; // go along the path while ( stepPath [ postorder1 ] > - 1 ) { stepRelSubtrees = it1 . getNodeRelSubtrees ( LEFT , postorder1 ) ; if ( stepRelSubtrees != null ) { // iterate over rel subtrees for a specific node on the path for ( int rs : stepRelSubtrees ) { it1 . setCurrentNode ( rs ) ; // make the recursion computeDistUsingStrArray ( it1 , it2 ) ; } } postorder1 = stepPath [ postorder1 ] ; } // set current node it1 . setCurrentNode ( tmpPostorder ) ; it1 . setSwitched ( false ) ; it2 . setSwitched ( false ) ; // count the distance using a single - path function strStat [ 3 ] ++ ; strStat [ LEFT ] ++ ; return spfL ( it1 , it2 ) ; case RIGHT : tmpPostorder = postorder1 ; stepPath = it1 . getPath ( RIGHT ) ; while ( stepPath [ postorder1 ] > - 1 ) { stepRelSubtrees = it1 . getNodeRelSubtrees ( RIGHT , postorder1 ) ; if ( stepRelSubtrees != null ) { for ( int rs : stepRelSubtrees ) { it1 . setCurrentNode ( rs ) ; computeDistUsingStrArray ( it1 , it2 ) ; } } postorder1 = stepPath [ postorder1 ] ; } it1 . setCurrentNode ( tmpPostorder ) ; it1 . setSwitched ( false ) ; it2 . setSwitched ( false ) ; strStat [ 3 ] ++ ; strStat [ RIGHT ] ++ ; return spfR ( it1 , it2 ) ; case HEAVY : tmpPostorder = postorder1 ; stepPath = it1 . getPath ( HEAVY ) ; heavyPath = new ArrayList < Integer > ( ) ; heavyPath . add ( postorder1 ) ; while ( stepPath [ postorder1 ] > - 1 ) { stepRelSubtrees = it1 . getNodeRelSubtrees ( HEAVY , postorder1 ) ; if ( stepRelSubtrees != null ) { for ( int rs : stepRelSubtrees ) { it1 . setCurrentNode ( rs ) ; computeDistUsingStrArray ( it1 , it2 ) ; } } postorder1 = stepPath [ postorder1 ] ; heavyPath . add ( postorder1 ) ; } it1 . setCurrentNode ( tmpPostorder ) ; it1 . setSwitched ( false ) ; it2 . setSwitched ( false ) ; strStat [ 3 ] ++ ; strStat [ HEAVY ] ++ ; return spfH ( it1 , it2 , InfoTree . toIntArray ( heavyPath ) ) ; case REVLEFT : tmpPostorder = postorder2 ; stepPath = it2 . getPath ( LEFT ) ; while ( stepPath [ postorder2 ] > - 1 ) { stepRelSubtrees = it2 . getNodeRelSubtrees ( LEFT , postorder2 ) ; if ( stepRelSubtrees != null ) { for ( int rs : stepRelSubtrees ) { it2 . setCurrentNode ( rs ) ; computeDistUsingStrArray ( it1 , it2 ) ; } } postorder2 = stepPath [ postorder2 ] ; } it2 . setCurrentNode ( tmpPostorder ) ; it1 . setSwitched ( true ) ; it2 . setSwitched ( true ) ; strStat [ 3 ] ++ ; strStat [ LEFT ] ++ ; return spfL ( it2 , it1 ) ; case REVRIGHT : tmpPostorder = postorder2 ; stepPath = it2 . getPath ( RIGHT ) ; while ( stepPath [ postorder2 ] > - 1 ) { stepRelSubtrees = it2 . getNodeRelSubtrees ( RIGHT , postorder2 ) ; if ( stepRelSubtrees != null ) { for ( int rs : stepRelSubtrees ) { it2 . setCurrentNode ( rs ) ; computeDistUsingStrArray ( it1 , it2 ) ; } } postorder2 = stepPath [ postorder2 ] ; } it2 . setCurrentNode ( tmpPostorder ) ; it1 . setSwitched ( true ) ; it2 . setSwitched ( true ) ; strStat [ 3 ] ++ ; strStat [ RIGHT ] ++ ; return spfR ( it2 , it1 ) ; case REVHEAVY : tmpPostorder = postorder2 ; stepPath = it2 . getPath ( HEAVY ) ; heavyPath = new ArrayList < Integer > ( ) ; heavyPath . add ( postorder2 ) ; while ( stepPath [ postorder2 ] > - 1 ) { stepRelSubtrees = it2 . getNodeRelSubtrees ( HEAVY , postorder2 ) ; if ( stepRelSubtrees != null ) { for ( int rs : stepRelSubtrees ) { it2 . setCurrentNode ( rs ) ; computeDistUsingStrArray ( it1 , it2 ) ; } } postorder2 = stepPath [ postorder2 ] ; heavyPath . add ( postorder2 ) ; } it2 . setCurrentNode ( tmpPostorder ) ; it1 . setSwitched ( true ) ; it2 . setSwitched ( true ) ; strStat [ 3 ] ++ ; strStat [ HEAVY ] ++ ; return spfH ( it2 , it1 , InfoTree . toIntArray ( heavyPath ) ) ; default : return - 1 ; }
import java . util . HashMap ; import java . util . HashSet ; public class CheckPatternMatch { /** * Validate if the sequence of colors matches the given pattern list . * Two sequences match if all elements correspond to each other as per the pattern . * Parameters : * color _ list : List of colors . * pattern _ list : List of patterns . * Returns : * bool : True if the sequences match , False otherwise . * Examples : * > > > check _ pattern _ match ( [ ' red ' , ' green ' , ' green ' ] , [ ' a ' , ' b ' , ' b ' ] ) * True * > > > check _ pattern _ match ( [ ' red ' , ' green ' , ' greenn ' ] , [ ' a ' , ' b ' , ' b ' ] ) * False * > > > check _ pattern _ match ( [ ' red ' , ' green ' , ' greenn ' ] , [ ' a ' , ' b ' ] ) * False */ public static boolean checkPatternMatch ( String [ ] colorList , String [ ] patternList ) { } }
if ( colorList . length != patternList . length ) { return false ; } HashMap < String , String > patternDict = new HashMap < > ( ) ; HashSet < String > colorSet = new HashSet < > ( ) ; HashSet < String > patternSet = new HashSet < > ( ) ; for ( String color : colorList ) { colorSet . add ( color ) ; } for ( String pattern : patternList ) { patternSet . add ( pattern ) ; } if ( colorSet . size ( ) != patternSet . size ( ) ) { return false ; } for ( int i = 0 ; i < patternList . length ; i ++ ) { if ( patternDict . containsKey ( patternList [ i ] ) ) { if ( ! patternDict . get ( patternList [ i ] ) . equals ( colorList [ i ] ) ) { return false ; } } else { patternDict . put ( patternList [ i ] , colorList [ i ] ) ; } } return true ;
public class ContextItems { /** * Returns a map consisting of suffixes of context items that match the specified prefix . * @ param prefix Item name less any suffix . * @ param firstOnly If true , only the first match is returned . Otherwise , all matches are * returned . * @ return Map of suffixes whose prefix matches the specified value . The value of each map entry * is the value of the original context item . */ private Map < String , String > getSuffixes ( String prefix , Boolean firstOnly ) { } }
HashMap < String , String > matches = new HashMap < > ( ) ; prefix = normalizePrefix ( prefix ) ; int i = prefix . length ( ) ; for ( String itemName : index . keySet ( ) ) { if ( itemName . startsWith ( prefix ) ) { String suffix = lookupItemName ( itemName , false ) . substring ( i ) ; matches . put ( suffix , getItem ( itemName ) ) ; if ( firstOnly ) { break ; } } } return matches ;
public class VertxJdbcResultSet { /** * / * ( non - Javadoc ) * @ see io . apiman . gateway . engine . components . jdbc . IJdbcResultSet # getLong ( int ) */ @ Override public Long getLong ( int index ) { } }
indexCheck ( ) ; return rows . get ( row ) . getLong ( index ) ;
public class LenientDateTimeField { /** * Set values which may be out of bounds by adding the difference between * the new value and the current value . */ public long set ( long instant , int value ) { } }
// lenient needs to handle time zone chronologies // so we do the calculation using local milliseconds long localInstant = iBase . getZone ( ) . convertUTCToLocal ( instant ) ; long difference = FieldUtils . safeSubtract ( value , get ( instant ) ) ; localInstant = getType ( ) . getField ( iBase . withUTC ( ) ) . add ( localInstant , difference ) ; return iBase . getZone ( ) . convertLocalToUTC ( localInstant , false , instant ) ;
public class NetUtils { /** * 是否合法地址 ( 非本地 , 非默认的IPv4地址 ) * @ param address InetAddress * @ return 是否合法 */ private static boolean isValidAddress ( InetAddress address ) { } }
if ( address == null || address . isLoopbackAddress ( ) ) { return false ; } String name = address . getHostAddress ( ) ; return ( name != null && ! isAnyHost ( name ) && ! isLocalHost ( name ) && isIPv4Host ( name ) ) ;
public class CalendarPeriod { /** * / * [ deutsch ] * Erzeugt eine { @ code CalendarPeriod } f & uuml ; r die angegebene Jahresspanne . * @ param y1 first calendar year * @ param y2 last calendar year ( inclusive ) * @ return CalendarPeriod */ public static CalendarPeriod < CalendarYear > between ( CalendarYear y1 , CalendarYear y2 ) { } }
return new FixedCalendarPeriod < > ( y1 , y2 , FixedCalendarTimeLine . forYears ( ) ) ;
public class EntityInfo { /** * 获取Entity的INSERT SQL * @ param bean Entity对象 * @ return String */ public String getInsertDollarPrepareSQL ( T bean ) { } }
if ( this . tableStrategy == null ) return insertDollarPrepareSQL ; return insertDollarPrepareSQL . replace ( "${newtable}" , getTable ( bean ) ) ;
public class CharacterBenchmark { /** * A fake benchmark to give us a baseline . */ @ Benchmark boolean isSpace ( int reps ) { } }
boolean dummy = false ; if ( overload == Overload . CHAR ) { for ( int i = 0 ; i < reps ; ++ i ) { for ( int ch = 0 ; ch < 65536 ; ++ ch ) { dummy ^= ( ( char ) ch == ' ' ) ; } } } else { for ( int i = 0 ; i < reps ; ++ i ) { for ( int ch = 0 ; ch < 65536 ; ++ ch ) { dummy ^= ( ch == ' ' ) ; } } } return dummy ;
public class CollapseProperties { /** * Runs through all namespaces ( prefixes of classes and enums ) , and checks if any of them have * been used in an unsafe way . */ private void checkNamespaces ( ) { } }
for ( Name name : nameMap . values ( ) ) { if ( name . isNamespaceObjectLit ( ) && ( name . getAliasingGets ( ) > 0 || name . getLocalSets ( ) + name . getGlobalSets ( ) > 1 || name . getDeleteProps ( ) > 0 ) ) { boolean initialized = name . getDeclaration ( ) != null ; for ( Ref ref : name . getRefs ( ) ) { if ( ref == name . getDeclaration ( ) ) { continue ; } if ( ref . type == Ref . Type . DELETE_PROP ) { if ( initialized ) { warnAboutNamespaceRedefinition ( name , ref ) ; } } else if ( ref . type == Ref . Type . SET_FROM_GLOBAL || ref . type == Ref . Type . SET_FROM_LOCAL ) { if ( initialized && ! isSafeNamespaceReinit ( ref ) ) { warnAboutNamespaceRedefinition ( name , ref ) ; } initialized = true ; } else if ( ref . type == Ref . Type . ALIASING_GET ) { warnAboutNamespaceAliasing ( name , ref ) ; } } } }
public class FontLoader { /** * Apply a typeface to a given view by id * @ param viewId the TextView to apply to id * @ param parent the parent of the text view * @ param type the typeface type argument */ public static void apply ( View parent , int viewId , Face type ) { } }
TextView text = ( TextView ) parent . findViewById ( viewId ) ; if ( text != null ) apply ( text , type ) ;
public class EnvironmentCheck { /** * Programmatic entrypoint : Report on basic Java environment * and CLASSPATH settings that affect Xalan . * < p > Note that this class is not advanced enough to tell you * everything about the environment that affects Xalan , and * sometimes reports errors that will not actually affect * Xalan ' s behavior . Currently , it very simplistically * checks the JVM ' s environment for some basic properties and * logs them out ; it will report a problem if it finds a setting * or . jar file that is < i > likely < / i > to cause problems . < / p > * < p > Advanced users can peruse the code herein to help them * investigate potential environment problems found ; other users * may simply send the output from this tool along with any bugs * they submit to help us in the debugging process . < / p > * @ param pw PrintWriter to send output to ; can be sent to a * file that will look similar to a Properties file ; defaults * to System . out if null * @ return true if your environment appears to have no major * problems ; false if potential environment problems found * @ see # getEnvironmentHash ( ) */ public boolean checkEnvironment ( PrintWriter pw ) { } }
// Use user - specified output writer if non - null if ( null != pw ) outWriter = pw ; // Setup a hash to store various environment information in Hashtable hash = getEnvironmentHash ( ) ; // Check for ERROR keys in the hashtable , and print report boolean environmentHasErrors = writeEnvironmentReport ( hash ) ; if ( environmentHasErrors ) { // Note : many logMsg calls have # at the start to // fake a property - file like output logMsg ( "# WARNING: Potential problems found in your environment!" ) ; logMsg ( "# Check any 'ERROR' items above against the Xalan FAQs" ) ; logMsg ( "# to correct potential problems with your classes/jars" ) ; logMsg ( "# http://xml.apache.org/xalan-j/faq.html" ) ; if ( null != outWriter ) outWriter . flush ( ) ; return false ; } else { logMsg ( "# YAHOO! Your environment seems to be OK." ) ; if ( null != outWriter ) outWriter . flush ( ) ; return true ; }
public class HMM { /** * Here , the xi ( and , thus , gamma ) values are not divided by the probability * of the sequence because this probability might be too small and induce an * underflow . xi [ t ] [ i ] [ j ] still can be interpreted as P ( q _ t = i and q _ ( t + 1) * = j | O , HMM ) because we assume that the scaling factors are such that * their product is equal to the inverse of the probability of the sequence . */ private double [ ] [ ] [ ] estimateXi ( int [ ] o , double [ ] [ ] alpha , double [ ] [ ] beta ) { } }
if ( o . length <= 1 ) { throw new IllegalArgumentException ( "Observation sequence is too short." ) ; } int n = o . length - 1 ; double xi [ ] [ ] [ ] = new double [ n ] [ numStates ] [ numStates ] ; for ( int t = 0 ; t < n ; t ++ ) { for ( int i = 0 ; i < numStates ; i ++ ) { for ( int j = 0 ; j < numStates ; j ++ ) { xi [ t ] [ i ] [ j ] = alpha [ t ] [ i ] * a [ i ] [ j ] * b [ j ] [ o [ t + 1 ] ] * beta [ t + 1 ] [ j ] ; } } } return xi ;
public class RepositoryQuotaManager { /** * Returns repository data size by summing size of all workspaces . */ public long getRepositoryDataSizeDirectly ( ) throws QuotaManagerException { } }
long size = 0 ; for ( WorkspaceQuotaManager wQuotaManager : wsQuotaManagers . values ( ) ) { size += wQuotaManager . getWorkspaceDataSizeDirectly ( ) ; } return size ;
public class IVFPQ { /** * This is a utility method that can be used to dump the contents of the iidToIvfpqDB to a txt file . < br > * Currently , only the list id of each item is dumped . * @ param dumpFilename * Full path to the file where the dump will be written . * @ throws Exception */ public void dumpIidToIvfpqDB ( String dumpFilename ) throws Exception { } }
DatabaseEntry foundKey = new DatabaseEntry ( ) ; DatabaseEntry foundData = new DatabaseEntry ( ) ; ForwardCursor cursor = iidToIvfpqDB . openCursor ( null , null ) ; BufferedWriter out = new BufferedWriter ( new FileWriter ( new File ( dumpFilename ) ) ) ; while ( cursor . getNext ( foundKey , foundData , LockMode . DEFAULT ) == OperationStatus . SUCCESS ) { int iid = IntegerBinding . entryToInt ( foundKey ) ; TupleInput input = TupleBinding . entryToInput ( foundData ) ; int listId = input . readInt ( ) ; out . write ( iid + " " + listId + "\n" ) ; } cursor . close ( ) ; out . close ( ) ;