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 qu...
// 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 ....
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 ...
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 . getNamespace...
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 } ,...
// 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 . getInclu...
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 creat...
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...
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 =...
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 OpenEngSBModelEnt...
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 ) ||...
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 )...
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...
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...
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 ...
_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 , XAE...
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 continu...
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 > SUBSCRI...
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 BR...
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 i...
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 ( ) ) ...
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 . */ publi...
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 t...
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 . * @ ...
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...
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 ) { // ...
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 ...
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 ....
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...
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 ( scanN...
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 . * @ re...
// 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 ...
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 = ( ( InternalEObjec...
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 ]...
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_BIN...
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 ...
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 ...
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 encodeNullToN...
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 )...
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 > } */ @ Xm...
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 ...
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 , "gr...
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 ( ) ...
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 ...
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 e...
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// attri...
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 Th...
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...
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 , J...
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 DdlToke...
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 , "UN...
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 ( ...
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 toTime...
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 visibl...
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 ( ) -...
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 Face...
// 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 / t...
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 (...
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 != n...
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...
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 ...
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 = it...
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 ...
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 patt...
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...
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 , getIte...
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 (...
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...
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 =...
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 actua...
// 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 ( e...
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...
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 ++ ) ...
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 dumpIid...
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 . DE...