signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class LByteToDblFunctionBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */
@ Nonnull public static LByteToDblFunction byteToDblFunctionFrom ( Consumer < LByteToDblFunctionBuilder > buildingFunction ) { } } | LByteToDblFunctionBuilder builder = new LByteToDblFunctionBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class FbBotMillBean { /** * Gets the video message .
* @ param envelope the envelope
* @ return the video message */
protected Attachment getVideoMessage ( MessageEnvelope envelope ) { } } | if ( envelope != null && envelope . getMessage ( ) != null && envelope . getMessage ( ) . getAttachments ( ) != null && envelope . getMessage ( ) . getAttachments ( ) . get ( 0 ) != null && envelope . getMessage ( ) . getAttachments ( ) . get ( 0 ) . getType ( ) == AttachmentType . VIDEO ) { return envelope . getMessag... |
public class JobExecutionEventSubmitter { /** * Submits an event for a given { @ link TaskState } . It will include all metadata specified in the jobMetadata parameter . */
private void submitTaskStateEvent ( TaskState taskState , Map < String , String > jobMetadata ) { } } | ImmutableMap . Builder < String , String > taskMetadataBuilder = new ImmutableMap . Builder < > ( ) ; taskMetadataBuilder . putAll ( jobMetadata ) ; taskMetadataBuilder . put ( METADATA_TASK_ID , taskState . getTaskId ( ) ) ; taskMetadataBuilder . put ( METADATA_TASK_START_TIME , Long . toString ( taskState . getStartT... |
public class RadioButtonGroup { /** * Does the specified value match one of those we are looking for ?
* @ param value Value to be compared */
public boolean isMatched ( String value , Boolean defaultValue ) { } } | // @ todo : there isn ' t a defaultValue for radio button , what should we do here ?
if ( value == null ) return false ; if ( _match != null ) return value . equals ( _match ) ; if ( _defaultRadio != null ) return value . equals ( _defaultRadio ) ; return false ; |
public class RebalanceUtils { /** * Confirms that both clusters have the same set of zones defined .
* @ param lhs
* @ param rhs */
public static void validateClusterZonesSame ( final Cluster lhs , final Cluster rhs ) { } } | Set < Zone > lhsSet = new HashSet < Zone > ( lhs . getZones ( ) ) ; Set < Zone > rhsSet = new HashSet < Zone > ( rhs . getZones ( ) ) ; if ( ! lhsSet . equals ( rhsSet ) ) throw new VoldemortException ( "Zones are not the same [ lhs cluster zones (" + lhs . getZones ( ) + ") not equal to rhs cluster zones (" + rhs . ge... |
public class CommerceShippingMethodLocalServiceBaseImpl { /** * Returns a range of all the commerce shipping methods .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in th... | return commerceShippingMethodPersistence . findAll ( start , end ) ; |
public class JSONObject { /** * Creates a bean from a JSONObject , with the specific configuration . */
public static Object toBean ( JSONObject jsonObject , JsonConfig jsonConfig ) { } } | if ( jsonObject == null || jsonObject . isNullObject ( ) ) { return null ; } Class beanClass = jsonConfig . getRootClass ( ) ; Map classMap = jsonConfig . getClassMap ( ) ; if ( beanClass == null ) { return toBean ( jsonObject ) ; } if ( classMap == null ) { classMap = Collections . EMPTY_MAP ; } Object bean = null ; t... |
public class Evaluation { /** * Eval .
* @ param _ permissionSet the PermissionSet
* @ throws EFapsException on error */
public static void eval ( final PermissionSet _permissionSet ) throws EFapsException { } } | Evaluation . LOG . debug ( "Evaluating PermissionSet {}" , _permissionSet ) ; final Person person = Person . get ( _permissionSet . getPersonId ( ) ) ; final Set < Long > ids = new HashSet < > ( person . getRoles ( ) ) ; ids . addAll ( person . getGroups ( ) ) ; ids . add ( person . getId ( ) ) ; final QueryBuilder use... |
public class DMatrixUtils { /** * Get the order of the specified elements in descending or ascending order .
* @ param values A vector of integer values .
* @ param indices The indices which will be considered for ordering .
* @ param descending Flag indicating if we go descending or not .
* @ return A vector o... | // Create an index series :
Integer [ ] opIndices = ArrayUtils . toObject ( indices ) ; // Sort indices :
Arrays . sort ( opIndices , new Comparator < Integer > ( ) { @ Override public int compare ( Integer o1 , Integer o2 ) { if ( descending ) { return Double . compare ( values [ o2 ] , values [ o1 ] ) ; } else { retu... |
public class MethodCompiler { /** * Push item from runtime constant pool .
* Creates new constant if needed
* < p > Stack : . . . = & gt ; . . . , value
* @ param constant int constant
* @ throws IOException
* @ see nameArgument
* @ see addVariable */
@ Override public void ldc ( int constant ) throws IOExc... | int index = subClass . resolveConstantIndex ( constant ) ; super . ldc ( index ) ; |
public class RefundService { /** * This function refunds a { @ link Transaction } that has been created previously and was refunded in parts or wasn ' t refunded at
* all . The inserted amount will be refunded to the credit card / direct debit of the original { @ link Transaction } . There will
* be some fees for t... | return this . refundTransaction ( new Transaction ( transactionId ) , amount , null ) ; |
public class OkCoinFuturesTradeService { /** * Parameters : see { @ link OkCoinFuturesTradeService . OkCoinFuturesTradeHistoryParams } */
@ Override public UserTrades getTradeHistory ( TradeHistoryParams params ) throws IOException { } } | OkCoinFuturesTradeHistoryParams myParams = ( OkCoinFuturesTradeHistoryParams ) params ; long orderId = myParams . getOrderId ( ) != null ? Long . valueOf ( myParams . getOrderId ( ) ) : - 1 ; CurrencyPair currencyPair = myParams . getCurrencyPair ( ) ; String date = myParams . getDate ( ) ; String page = myParams . get... |
public class EntityMappingsImpl { /** * If not already created , a new < code > sequence - generator < / code > element will be created and returned .
* Otherwise , the first existing < code > sequence - generator < / code > element will be returned .
* @ return the instance defined for the element < code > sequenc... | List < Node > nodeList = childNode . get ( "sequence-generator" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new SequenceGeneratorImpl < EntityMappings < T > > ( this , "sequence-generator" , childNode , nodeList . get ( 0 ) ) ; } return createSequenceGenerator ( ) ; |
public class InvocationWriter { /** * we match only on the number of arguments , not anything else */
private static ConstructorNode getMatchingConstructor ( List < ConstructorNode > constructors , List < Expression > argumentList ) { } } | ConstructorNode lastMatch = null ; for ( int i = 0 ; i < constructors . size ( ) ; i ++ ) { ConstructorNode cn = constructors . get ( i ) ; Parameter [ ] params = cn . getParameters ( ) ; // if number of parameters does not match we have no match
if ( argumentList . size ( ) != params . length ) continue ; if ( lastMat... |
public class Html5WebSocket { /** * { @ inheritDoc } */
@ Override public final ReadyState getReadyState ( ) { } } | if ( null == _webSocket ) { return ReadyState . CLOSED ; } else { return ReadyState . values ( ) [ _webSocket . getReadyState ( ) ] ; } |
public class JobTracker { /** * lock " is under JobTracker lock to avoid deadlocks . */
synchronized public List < List < String > > taskTrackerNames ( ) { } } | List < String > activeTrackers = new ArrayList < String > ( ) ; List < String > blacklistedTrackers = new ArrayList < String > ( ) ; synchronized ( taskTrackers ) { for ( TaskTracker tt : taskTrackers . values ( ) ) { TaskTrackerStatus status = tt . getStatus ( ) ; if ( ! faultyTrackers . isBlacklisted ( status . getHo... |
public class CmsPropertyEditorHelper { /** * Helper method to get the default property configuration for the given resource type . < p >
* @ param typeName the name of the resource type
* @ return the default property configuration for the given type */
protected Map < String , CmsXmlContentProperty > getDefaultPro... | Map < String , CmsXmlContentProperty > propertyConfig = new LinkedHashMap < String , CmsXmlContentProperty > ( ) ; CmsExplorerTypeSettings explorerType = OpenCms . getWorkplaceManager ( ) . getExplorerTypeSetting ( typeName ) ; if ( explorerType != null ) { List < String > defaultProps = explorerType . getProperties ( ... |
public class EditController { /** * Disables all the overrides for a specific profile
* @ param model
* @ param profileID
* @ param clientUUID
* @ return */
@ RequestMapping ( value = "api/edit/disableAll" , method = RequestMethod . POST ) public @ ResponseBody String disableAll ( Model model , int profileID , ... | editService . disableAll ( profileID , clientUUID ) ; return null ; |
public class SimonStatement { /** * Starts the split for the SQL specific stopwatch , sets the note and returns the split .
* Used in the statment and prepared statement classes to measure runs of " execute " methods .
* @ return split for the execution of the specific SQL command */
protected Split startSplit ( ) ... | Stopwatch stopwatch = SimonManager . getStopwatch ( sqlCmdLabel + Manager . HIERARCHY_DELIMITER + sqlNormalizer . getNormalizedSql ( ) . hashCode ( ) ) ; if ( stopwatch . getNote ( ) == null ) { stopwatch . setNote ( sqlNormalizer . getNormalizedSql ( ) ) ; } return stopwatch . start ( ) ; |
public class ProcessorGlobalVariableDecl { /** * Receive notification of the end of an element .
* @ param name The element type name .
* @ param attributes The specified or defaulted attributes .
* @ param handler non - null reference to current StylesheetHandler that is constructing the Templates .
* @ param ... | ElemVariable v = ( ElemVariable ) handler . getElemTemplateElement ( ) ; handler . getStylesheet ( ) . appendChild ( v ) ; handler . getStylesheet ( ) . setVariable ( v ) ; super . endElement ( handler , uri , localName , rawName ) ; |
public class DynamicMessage { /** * Parse a message of the given type from { @ code input } and return it . */
public static DynamicMessage parseFrom ( Descriptor type , InputStream input ) throws IOException { } } | return newBuilder ( type ) . mergeFrom ( input ) . buildParsed ( ) ; |
public class UpdateDirectConnectGatewayAssociationRequest { /** * The Amazon VPC prefixes to no longer advertise to the Direct Connect gateway .
* @ return The Amazon VPC prefixes to no longer advertise to the Direct Connect gateway . */
public java . util . List < RouteFilterPrefix > getRemoveAllowedPrefixesToDirect... | if ( removeAllowedPrefixesToDirectConnectGateway == null ) { removeAllowedPrefixesToDirectConnectGateway = new com . amazonaws . internal . SdkInternalList < RouteFilterPrefix > ( ) ; } return removeAllowedPrefixesToDirectConnectGateway ; |
public class ArmeriaMessageDeframer { /** * Closes this deframer and frees any resources . After this method is called , additional
* calls will have no effect . */
@ Override public void close ( ) { } } | if ( unprocessed != null ) { try { unprocessed . forEach ( ByteBuf :: release ) ; } finally { unprocessed = null ; } if ( endOfStream ) { listener . endOfStream ( ) ; } } |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link String } { @ code > } } */
@ XmlElementDecl ( namespace = "http://www.ibm.com/websphere/wim" , name = "street" ) public JAXBElement < String > createStreet ( String value ) { } } | return new JAXBElement < String > ( _Street_QNAME , String . class , null , value ) ; |
public class TileBoundingBoxUtils { /** * Get the overlapping bounding box between the two bounding boxes
* @ param boundingBox
* bounding box
* @ param boundingBox2
* bounding box 2
* @ param allowEmpty
* allow empty latitude and / or longitude ranges when determining
* overlap
* @ return bounding box ... | return boundingBox . overlap ( boundingBox2 , allowEmpty ) ; |
public class HBCIUtils { /** * Berechnet die IBAN fuer ein angegebenes deutsches Konto .
* @ param k das Konto .
* @ return die berechnete IBAN . */
public static String getIBANForKonto ( Konto k ) { } } | String konto = k . number ; // Die Unterkonto - Nummer muss mit eingerechnet werden .
// Aber nur , wenn sie numerisch ist . Bei irgendeiner Bank wurde
// " EUR " als Unterkontonummer verwendet . Das geht natuerlich nicht ,
// weil damit nicht gerechnet werden kann
// Wir machen das auch nur dann , wenn beide Nummern z... |
public class PresenceImpl { /** * / * - - Internal Methods - - */
public JSONObject getFullPresence ( ) { } } | JSONObject game = getGameJson ( this . game ) ; return new JSONObject ( ) . put ( "afk" , idle ) . put ( "since" , System . currentTimeMillis ( ) ) . put ( "game" , game == null ? JSONObject . NULL : game ) . put ( "status" , getStatus ( ) . getKey ( ) ) ; |
public class JCalendarPopup { /** * This method is called from within the constructor to initialize the form . */
private void initComponents ( ) { } } | ClassLoader cl = this . getClass ( ) . getClassLoader ( ) ; this . setLayout ( new BoxLayout ( this , BoxLayout . Y_AXIS ) ) ; monthPanel = new JPanel ( ) ; monthPanel . setName ( "monthPanel" ) ; monthPanel . setLayout ( new BoxLayout ( monthPanel , BoxLayout . X_AXIS ) ) ; previousMonthButton = new JButton ( ) ; prev... |
public class DockerPathUtil { /** * Resolves the supplied resource ( a path or directory on the filesystem ) relative the supplied { @ code
* baseDir } . The returned { @ code File } is guaranteed to be { @ link File # isAbsolute ( ) absolute } . The returned file
* is < em > not < / em > guaranteed to exist .
* ... | // TODO : handle the case where pathToResolve specifies a non - existent path , for example , a base directory equal to " / " and a relative path of " . . / . . / foo " .
File fileToResolve = new File ( pathToResolve ) ; if ( fileToResolve . isAbsolute ( ) ) { return fileToResolve ; } if ( baseDir == null ) { throw new... |
public class Category { /** * Delegates to { @ link org . slf4j . Logger # debug ( String ) } method of SLF4J . */
public void debug ( Object message ) { } } | differentiatedLog ( null , CATEGORY_FQCN , LocationAwareLogger . DEBUG_INT , message , null ) ; |
public class MethodWriter { /** * Visit the implicit first frame of this method . */
private void visitImplicitFirstFrame ( ) { } } | // There can be at most descriptor . length ( ) + 1 locals
int frameIndex = startFrame ( 0 , descriptor . length ( ) + 1 , 0 ) ; if ( ( access & Opcodes . ACC_STATIC ) == 0 ) { if ( ( access & ACC_CONSTRUCTOR ) == 0 ) { frame [ frameIndex ++ ] = Frame . OBJECT | cw . addType ( cw . thisName ) ; } else { frame [ frameIn... |
public class Groovy2CompilerHelper { /** * Compile the given source and load the resultant classes into a new { @ link ClassNotFoundException }
* @ return initialized and laoded classes
* @ throws ScriptCompilationException */
@ SuppressWarnings ( "unchecked" ) public Set < GroovyClass > compile ( ) throws ScriptCo... | final CompilerConfiguration conf = compileConfig != null ? compileConfig : CompilerConfiguration . DEFAULT ; conf . setTolerance ( 0 ) ; conf . setVerbose ( true ) ; conf . setTargetDirectory ( targetDir . toFile ( ) ) ; final ClassLoader buildParentClassloader = parentClassLoader != null ? parentClassLoader : Thread .... |
public class InternalSARLParser { /** * InternalSARL . g : 9229:1 : ruleTypeReferenceWithTypeArgs returns [ EObject current = null ] : ( ( this _ ParameterizedTypeReferenceWithTypeArgs _ 0 = ruleParameterizedTypeReferenceWithTypeArgs ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) * ) | ( this _ TypeRef... | EObject current = null ; EObject this_ParameterizedTypeReferenceWithTypeArgs_0 = null ; EObject this_TypeReferenceNoTypeArgs_3 = null ; EObject this_XFunctionTypeRef_6 = null ; enterRule ( ) ; try { // InternalSARL . g : 9235:2 : ( ( ( this _ ParameterizedTypeReferenceWithTypeArgs _ 0 = ruleParameterizedTypeReferenceWi... |
public class NameMatcher { /** * Create a NameMatcher that matches names equaling the given string . */
public static < T extends Key < T > > NameMatcher < T > nameEquals ( final String compareTo ) { } } | return new NameMatcher < > ( compareTo , StringOperatorName . EQUALS ) ; |
public class TagsUtil { /** * Creates tags info beans from given
* tags map with tag names as keys and tag values as map values
* @ param tagsMap map of tag names and values
* @ return list of tag entries */
public static List < TagEntryAO > tagsMapToTagEntries ( Map < String , String > tagsMap ) { } } | if ( tagsMap == null ) return Collections . EMPTY_LIST ; List < TagEntryAO > tagEntries = new ArrayList < > ( tagsMap . size ( ) ) ; for ( Map . Entry < String , String > entry : tagsMap . entrySet ( ) ) tagEntries . add ( new TagEntryAO ( entry . getKey ( ) , entry . getValue ( ) ) ) ; return tagEntries ; |
public class PandaApi { /** * Ask the Flickr Pandas for a list of recent public ( and " safe " ) photos .
* < br >
* More information about the pandas can be found on the
* < a href = " http : / / code . flickr . com / blog / 2009/03/03 / panda - tuesday - the - history - of - the - panda - new - apis - explore -... | JinxUtils . validateParams ( pandaName ) ; Map < String , String > params = new TreeMap < > ( ) ; params . put ( "method" , "flickr.panda.getPhotos" ) ; params . put ( "panda_name" , pandaName ) ; if ( ! JinxUtils . isNullOrEmpty ( extras ) ) { params . put ( "extras" , JinxUtils . buildCommaDelimitedList ( extras ) ) ... |
public class Waiter { /** * Waits for a log message to appear .
* Requires read logs permission ( android . permission . READ _ LOGS ) in AndroidManifest . xml of the application under test .
* @ param logMessage the log message to wait for
* @ param timeout the amount of time in milliseconds to wait
* @ return... | StringBuilder stringBuilder = new StringBuilder ( ) ; long endTime = SystemClock . uptimeMillis ( ) + timeout ; while ( SystemClock . uptimeMillis ( ) <= endTime ) { if ( getLog ( stringBuilder ) . lastIndexOf ( logMessage ) != - 1 ) { return true ; } sleeper . sleep ( ) ; } return false ; |
public class ExpressionUtils { /** * Create the intersection of the given arguments
* @ param exprs predicates
* @ return intersection */
@ Nullable public static Predicate allOf ( Collection < Predicate > exprs ) { } } | Predicate rv = null ; for ( Predicate b : exprs ) { if ( b != null ) { rv = rv == null ? b : ExpressionUtils . and ( rv , b ) ; } } return rv ; |
public class ResourceDescriptionsData { /** * Put a new resource description into the index , or remove one if the delta has no new description . A delta for a
* particular URI may be registered more than once ; overwriting any earlier registration .
* @ param delta
* The resource change .
* @ since 2.9 */
publ... | final IResourceDescription newDesc = delta . getNew ( ) ; if ( newDesc == null ) { removeDescription ( delta . getUri ( ) ) ; } else { addDescription ( delta . getUri ( ) , newDesc ) ; } |
public class JournalConsumer { /** * Reject API calls from outside while we are in recovery mode . */
public Date setDatastreamState ( Context context , String pid , String dsID , String dsState , String logMessage ) throws ServerException { } } | throw rejectCallsFromOutsideWhileInRecoveryMode ( ) ; |
public class CanonicalPlanner { /** * Validate the supplied query .
* @ param context the context in which the query is being planned
* @ param query the set query to be planned
* @ param usedSelectors the map of { @ link SelectorName } s ( aliases or names ) used in the query . */
protected void validate ( Query... | // / / Resolve everything . . .
// Visitors . visitAll ( query , new Validator ( context , usedSelectors ) ) ;
// Resolve everything ( except subqueries ) . . .
Validator validator = new Validator ( context , usedSelectors ) ; query . accept ( new WalkAllVisitor ( validator ) { @ Override protected void enqueue ( Visit... |
public class IntArrayList { /** * Removes all of the elements from this list . The list will
* be empty after this call returns . */
@ Override public void clear ( ) { } } | modCount ++ ; // Let gc do its work
for ( int i = 0 ; i < size ; i ++ ) elementData [ i ] = 0 ; size = 0 ; |
public class MemoizeExtension { /** * True if one of the given annotations is { @ code @ Nullable } in any package . */
private static boolean containsNullable ( List < ? extends AnnotationMirror > annotations ) { } } | return annotations . stream ( ) . map ( a -> a . getAnnotationType ( ) . asElement ( ) . getSimpleName ( ) ) . anyMatch ( n -> n . contentEquals ( "Nullable" ) ) ; |
public class LDPathWrapper { /** * Execute an LDPath query
* @ param uri the URI to query
* @ param program the LDPath program
* @ return a result object wrapped in a List
* @ throws LDPathParseException if the LDPath program was malformed */
public List < Map < String , Collection < ? > > > programQuery ( fina... | return singletonList ( ldpath . programQuery ( new URIImpl ( uri ) , new InputStreamReader ( program ) ) ) ; |
public class ST_Densify { /** * Densify a geometry using the given distance tolerance .
* @ param geometry Geometry
* @ param tolerance Distance tolerance
* @ return Densified geometry */
public static Geometry densify ( Geometry geometry , double tolerance ) { } } | if ( geometry == null ) { return null ; } return Densifier . densify ( geometry , tolerance ) ; |
public class JPAEntityManager { /** * ( non - Javadoc )
* @ see javax . persistence . EntityManager # setFlushMode ( javax . persistence . FlushModeType ) */
@ Override public void setFlushMode ( FlushModeType flushMode ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "em.setFlushMode(" + flushMode + ");\n" + toString ( ) ) ; getEMInvocationInfo ( false ) . setFlushMode ( flushMode ) ; |
public class BaseDestinationHandler { /** * Check permission to access a Discriminator
* @ param secContext
* @ param operation
* @ return */
@ Override public boolean checkDiscriminatorAccess ( SecurityContext secContext , OperationType operation ) throws SIDiscriminatorSyntaxException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "checkDiscriminatorAccess" , new Object [ ] { secContext , operation } ) ; boolean allow = true ; if ( isTopicAccessCheckRequired ( ) ) { if ( ! accessChecker . checkDiscriminatorAccess ( secContext , this , secContext . get... |
public class Types { /** * Insert a type in a closure */
public List < Type > insert ( List < Type > cl , Type t , BiPredicate < Type , Type > shouldSkip ) { } } | if ( cl . isEmpty ( ) ) { return cl . prepend ( t ) ; } else if ( shouldSkip . test ( t , cl . head ) ) { return cl ; } else if ( t . tsym . precedes ( cl . head . tsym , this ) ) { return cl . prepend ( t ) ; } else { // t comes after head , or the two are unrelated
return insert ( cl . tail , t , shouldSkip ) . prepe... |
public class DateUtils { /** * Adds a number of days to a date returning a new object .
* The original date object is unchanged .
* @ param date the date , not null
* @ param numberOfDays the amount to add , may be negative
* @ return the new date object with the amount added */
public static Date addDays ( Dat... | return Date . from ( date . toInstant ( ) . plus ( numberOfDays , ChronoUnit . DAYS ) ) ; |
public class SyncPointInfo { /** * < code > optional string syncPointUri = 1 ; < / code > */
public com . google . protobuf . ByteString getSyncPointUriBytes ( ) { } } | java . lang . Object ref = syncPointUri_ ; if ( ref instanceof java . lang . String ) { com . google . protobuf . ByteString b = com . google . protobuf . ByteString . copyFromUtf8 ( ( java . lang . String ) ref ) ; syncPointUri_ = b ; return b ; } else { return ( com . google . protobuf . ByteString ) ref ; } |
public class ComputationGraphConfiguration { /** * Handle { @ link WeightInit } and { @ link Distribution } from legacy configs in Json format . Copied from handling of { @ link Activation }
* above .
* @ return True if all is well and layer iteration shall continue . False else - wise . */
private static void hand... | if ( layer instanceof BaseLayer && ( ( BaseLayer ) layer ) . getWeightInitFn ( ) == null ) { String layerName = layer . getLayerName ( ) ; try { if ( vertices == null ) { JsonNode jsonNode = mapper . readTree ( json ) ; vertices = jsonNode . get ( "vertices" ) ; } JsonNode vertexNode = vertices . get ( layerName ) ; Js... |
public class SqlBuilder { /** * 构建SQL语句参数表
* @ param parameters 参数对象
* @ return 参数表 < 参数名称 , 参数值 > */
@ SuppressWarnings ( "unchecked" ) private Map < String , Object > buildParameters ( Object parameters ) { } } | Map < String , Object > parameterMap = new HashMap < String , Object > ( ) ; if ( parameters != null ) { if ( parameters . getClass ( ) . isArray ( ) ) { Object [ ] paramValues = ( Object [ ] ) parameters ; for ( int i = 0 ; i < paramValues . length ; i ++ ) { if ( paramValues [ i ] == null ) { paramValues [ i ] = "" ;... |
public class UCSDAnomalyVideoFrameViewer { /** * Create the tree
* @ param top */
private void createNodes ( DefaultMutableTreeNode top ) { } } | // leaves
DefaultMutableTreeNode defaultMutableTreeNode = null ; // Train Files
DefaultMutableTreeNode trainCategory = new DefaultMutableTreeNode ( "Train" ) ; top . add ( trainCategory ) ; // Test Files
DefaultMutableTreeNode testCategory = new DefaultMutableTreeNode ( "Test" ) ; top . add ( testCategory ) ; // long c... |
public class PushManager { /** * Checks if Google Play Services is available on the device .
* @ return True if Google Play Services is available . */
boolean checkAvailablePush ( Context context ) { } } | int connectionStatus = GoogleApiAvailability . getInstance ( ) . isGooglePlayServicesAvailable ( context ) ; if ( connectionStatus == ConnectionResult . SUCCESS ) { log . i ( "Google Play Services are available on this device." ) ; return true ; } else { if ( GoogleApiAvailability . getInstance ( ) . isUserResolvableEr... |
public class BinaryEnricher { /** * Iterates through all nodes of the given KeePass file and replace the
* nodes with enriched attachment data nodes .
* @ param keePassFile
* the KeePass file which should be iterated
* @ return an enriched KeePass file */
public KeePassFile enrichNodesWithBinaryData ( KeePassFi... | Binaries binaryLibrary = keePassFile . getMeta ( ) . getBinaries ( ) ; GroupZipper zipper = new GroupZipper ( keePassFile ) ; Iterator < Group > iter = zipper . iterator ( ) ; while ( iter . hasNext ( ) ) { Group group = iter . next ( ) ; enrichEntriesWithBinaryData ( binaryLibrary , group ) ; } return zipper . close (... |
public class IntPoint { /** * Calculate Euclidean distance between two points .
* @ param anotherPoint Point to calculate distance to .
* @ return Euclidean distance between this point and anotherPoint points . */
public float DistanceTo ( IntPoint anotherPoint ) { } } | float dx = this . x - anotherPoint . x ; float dy = this . y - anotherPoint . y ; return ( float ) Math . sqrt ( dx * dx + dy * dy ) ; |
public class RelativePath { /** * figure out a string representing the relative path of
* ' f ' with respect to ' r '
* @ param basePath home path
* @ param filePath path of file */
private static String matchPathLists ( List < String > basePath , List < String > filePath ) { } } | // start at the beginning of the lists
// iterate while both lists are equal
final StringBuilder relativePath = new StringBuilder ( ) ; final ListIterator < String > basePathItr = basePath . listIterator ( basePath . size ( ) - 1 ) ; final ListIterator < String > filePathItr = filePath . listIterator ( filePath . size ... |
public class JSONParser { /** * Stream processing of JSON text .
* @ see JsonContentHandler
* @ param in
* @ param contentHandler
* @ param isResume - Indicates if it continues previous parsing operation .
* If set to true , resume parsing the old stream , and parameter ' in ' will be ignored .
* If this me... | if ( ! isResume ) { reset ( in ) ; handlerStatusStack = new LinkedList < Object > ( ) ; } else { if ( handlerStatusStack == null ) { isResume = false ; reset ( in ) ; handlerStatusStack = new LinkedList < Object > ( ) ; } } LinkedList < Object > statusStack = handlerStatusStack ; try { do { switch ( status ) { case S_I... |
public class JCalendarPopup { /** * Create this calendar in a popup menu and synchronize the text field on change .
* @ param dateTarget The initial date for this button .
* @ param button The calling button . */
public static JCalendarPopup createCalendarPopup ( Date dateTarget , Component button ) { } } | return JCalendarPopup . createCalendarPopup ( null , dateTarget , button , null ) ; |
public class RecaptchaEnterpriseServiceV1Beta1Client { /** * Creates an Assessment of the likelihood an event is legitimate .
* < p > Sample code :
* < pre > < code >
* try ( RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client . create ( ) ) { ... | CreateAssessmentRequest request = CreateAssessmentRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . setAssessment ( assessment ) . build ( ) ; return createAssessment ( request ) ; |
public class MediaDescriptorField { /** * Creates or updates application format using payload number and text format description .
* @ param payload the payload number of the format .
* @ param description text description of the format
* @ return format object */
private RTPFormat createApplicationFormat ( int p... | Iterator < Text > it = description . split ( '/' ) . iterator ( ) ; // encoding name
Text token = it . next ( ) ; token . trim ( ) ; EncodingName name = new EncodingName ( token ) ; // clock rate
token = it . next ( ) ; token . trim ( ) ; RTPFormat rtpFormat = getFormat ( payload ) ; if ( rtpFormat == null ) { formats ... |
public class HttpClientModule { /** * Register a HttpClientObserver which observes only requests from a HttpClient with the given Guice binding annotation .
* @ return the binding builder you should register with */
public static LinkedBindingBuilder < HttpClientObserver > bindNewObserver ( final Binder binder , fina... | return Multibinder . newSetBinder ( binder , HttpClientObserver . class , annotation ) . addBinding ( ) ; |
public class ClassBuilder { /** * Construct a new ClassBuilder .
* @ param context the build context
* @ param classDoc the class being documented .
* @ param writer the doclet specific writer . */
public static ClassBuilder getInstance ( Context context , ClassDoc classDoc , ClassWriter writer ) { } } | return new ClassBuilder ( context , classDoc , writer ) ; |
public class ContentKey { /** * Create an operation that will retrieve the given content key .
* @ param contentKeyId
* id of content key to retrieve
* @ return the operation */
public static EntityGetOperation < ContentKeyInfo > get ( String contentKeyId ) { } } | return new DefaultGetOperation < ContentKeyInfo > ( ENTITY_SET , contentKeyId , ContentKeyInfo . class ) ; |
public class Reflect { /** * Check for a field with the given name in a java object or scripted object
* if the field exists fetch the value , if not check for a property value .
* If neither is found return Primitive . VOID . */
public static Object getObjectFieldValue ( Object object , String fieldName ) throws U... | if ( object instanceof This ) { return ( ( This ) object ) . namespace . getVariable ( fieldName ) ; } else if ( object == Primitive . NULL ) { throw new UtilTargetError ( new NullPointerException ( "Attempt to access field '" + fieldName + "' on null value" ) ) ; } else { try { return getFieldValue ( object . getClass... |
public class TextProtocolUtil { /** * In the particular case of Memcached , the end of operation / command
* is signaled by " \ r \ n " characters . So , if end of operation is
* found , this method would return true . On the contrary , if space was
* found instead of end of operation character , then it ' d retu... | for ( ; ; ) { byte next = buffer . readByte ( ) ; if ( next == SP ) { // Space
return false ; } else if ( next == CR ) { // CR
next = buffer . readByte ( ) ; if ( next == LF ) { // LF
return true ; } else { byteBuffer . write ( next ) ; } } else { byteBuffer . write ( next ) ; } } |
public class AnyUnblockedGrantPermissionPolicy { /** * This method performs the actual , low - level checking of a single activity and target . Is IS
* responsible for performing the same check for affiliated groups in the Groups hierarchy , but
* it is NOT responsible for understanding the nuances of relationships... | if ( log . isTraceEnabled ( ) ) { log . trace ( "Searching for unblocked path to GRANT for principal '{}' to " + "'{}' on target '{}' having already checked: {}" , principal . getKey ( ) , activity . getFname ( ) , target . getKey ( ) , seenGroups ) ; } /* * Step # 1 : Specific GRANT / DENY attached to this principal ... |
public class AwsSecurityFindingMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AwsSecurityFinding awsSecurityFinding , ProtocolMarshaller protocolMarshaller ) { } } | if ( awsSecurityFinding == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( awsSecurityFinding . getSchemaVersion ( ) , SCHEMAVERSION_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getId ( ) , ID_BINDING ) ; protocolMarshall... |
public class ArrayUtils { /** * Convert an array of any type to an array of strings
* @ param array
* @ return */
public static String [ ] toStringArray ( final Object array ) { } } | final int length = Array . getLength ( array ) ; final String [ ] result = new String [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { result [ i ] = Array . get ( array , i ) . toString ( ) ; } return result ; |
public class DefaultBlitz4jConfig { /** * ( non - Javadoc )
* @ see com . netflix . blitz4j . BlitzConfig # getAsyncAppenders ( ) */
@ Override public String [ ] getAsyncAppenders ( ) { } } | return CONFIGURATION . getStringProperty ( PROP_ASYNC_APPENDERS , this . getPropertyValue ( PROP_ASYNC_APPENDERS , "OFF" ) ) . get ( ) . split ( "," ) ; |
public class DescribeSpotFleetInstancesResult { /** * The running instances . This list is refreshed periodically and might be out of date .
* @ param activeInstances
* The running instances . This list is refreshed periodically and might be out of date . */
public void setActiveInstances ( java . util . Collection... | if ( activeInstances == null ) { this . activeInstances = null ; return ; } this . activeInstances = new com . amazonaws . internal . SdkInternalList < ActiveInstance > ( activeInstances ) ; |
public class JdbcTemplateJdbcHelper { /** * Get { @ link JdbcTemplate } instance for a given { @ link Connection } .
* Note : the returned { @ link JdbcTemplate } will not automatically close the
* { @ link Connection } .
* @ param conn
* @ return */
protected JdbcTemplate jdbcTemplate ( Connection conn ) { } } | DataSource ds = new SingleConnectionDataSource ( conn , true ) ; return new JdbcTemplate ( ds ) ; |
public class TaskServiceEJBImpl { /** * implemented methods */
@ Override public List < TaskSummary > getTasksAssignedAsBusinessAdministrator ( String userId , String language ) { } } | return delegate . getTasksAssignedAsBusinessAdministrator ( userId , language ) ; |
public class TemplateElasticsearchUpdater { /** * Check if a template exists
* @ param client Elasticsearch client
* @ param template template name
* @ return true if the template exists
* @ throws IOException if something goes wrong */
public static boolean isTemplateExist ( RestClient client , String template... | Response response = client . performRequest ( new Request ( "HEAD" , "/_template/" + template ) ) ; return response . getStatusLine ( ) . getStatusCode ( ) == 200 ; |
public class StreamingWriterInterceptor { /** * < p > applyStreaming . < / p >
* @ param requestContext a { @ link javax . ws . rs . container . ContainerRequestContext } object .
* @ param context a { @ link javax . ws . rs . ext . WriterInterceptorContext } object .
* @ throws java . io . IOException if any . *... | Object entity = context . getEntity ( ) ; StreamingProcess < Object > process = MessageHelper . getStreamingProcess ( context . getEntity ( ) , manager ) ; if ( process != null ) { ContainerResponseContext responseContext = ( ContainerResponseContext ) requestContext . getProperty ( RESP_PROP_N ) ; responseContext . se... |
public class CommonOps_DDF2 { /** * < p > Performs an element by element division operation : < br >
* < br >
* c < sub > i < / sub > = a < sub > i < / sub > / b < sub > i < / sub > < br >
* @ param a The left vector in the division operation . Not modified .
* @ param b The right vector in the division operati... | c . a1 = a . a1 / b . a1 ; c . a2 = a . a2 / b . a2 ; |
public class arp { /** * Use this API to fetch all the arp resources that are configured on netscaler . */
public static arp [ ] get ( nitro_service service ) throws Exception { } } | arp obj = new arp ( ) ; arp [ ] response = ( arp [ ] ) obj . get_resources ( service ) ; return response ; |
public class Flowable { /** * Returns a Flowable that emits the items emitted by the source Publisher or a specified default item
* if the source Publisher is empty .
* < img width = " 640 " height = " 305 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / defaultIfEmpt... | ObjectHelper . requireNonNull ( defaultItem , "item is null" ) ; return switchIfEmpty ( just ( defaultItem ) ) ; |
public class YarnDependencyCollector { /** * preventing circular dependencies by making sure the dependency is not a descendant of its own */
private boolean isDescendant ( DependencyInfo ancestor , DependencyInfo descendant ) { } } | for ( DependencyInfo child : ancestor . getChildren ( ) ) { if ( child . equals ( descendant ) ) { return true ; } if ( isDescendant ( child , descendant ) ) { return true ; } } return false ; |
public class AnnotationUtils { /** * Tries to find required annotation in scope of all annotations of incoming ' source ' .
* @ param source
* { @ link AnnotatedElement }
* @ param targetAnnotationClass
* { @ link Class } - actually required annotation class
* @ param < A >
* - type param
* @ return { @ l... | final Annotation [ ] allAnnotations = source . getAnnotations ( ) ; for ( final Annotation annotation : allAnnotations ) { final A result = findAnnotation ( annotation , targetAnnotationClass ) ; if ( result != null ) return result ; } return null ; |
public class QueryResultsRowImpl { /** * Return the Object for the given Declaration . */
public Object get ( final Declaration declaration ) { } } | return declaration . getValue ( ( InternalWorkingMemory ) workingMemory , getObject ( getFactHandle ( declaration ) ) ) ; |
public class RegistrationManagerImpl { /** * { @ inheritDoc } */
@ Override public void registerService ( ProvidedServiceInstance serviceInstance ) throws ServiceException { } } | ServiceInstanceUtils . validateManagerIsStarted ( isStarted ) ; ServiceInstanceUtils . validateProvidedServiceInstance ( serviceInstance ) ; getRegistrationService ( ) . registerService ( serviceInstance ) ; |
public class GetDomainNamesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetDomainNamesRequest getDomainNamesRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getDomainNamesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getDomainNamesRequest . getPosition ( ) , POSITION_BINDING ) ; protocolMarshaller . marshall ( getDomainNamesRequest . getLimit ( ) , LIMIT_BINDING ) ; } catch ( E... |
public class ModuleLoader { /** * Normalizes the given root paths , which are path prefixes to be removed from a module path when
* resolved . */
private static ImmutableList < String > createRootPaths ( Iterable < String > roots , PathResolver resolver , PathEscaper escaper ) { } } | // Sort longest length to shortest so that paths are applied most specific to least .
Set < String > builder = new TreeSet < > ( Comparator . comparingInt ( String :: length ) . thenComparing ( String :: compareTo ) . reversed ( ) ) ; for ( String root : roots ) { String rootModuleName = escaper . escape ( resolver . a... |
public class ServiceClientImpl { /** * / * ( non - Javadoc )
* @ see com . ibm . g11n . pipeline . client . ServiceClient # getTRSegment ( java . lang . String , com . ibm . g11n . pipeline . client . DocumentType , java . lang . String , java . lang . String , java . lang . String ) */
@ Override public SegmentData ... | if ( trId == null || trId . isEmpty ( ) ) { throw new IllegalArgumentException ( "Non-empty trId must be specified." ) ; } if ( documentId == null || documentId . isEmpty ( ) ) { throw new IllegalArgumentException ( "Non-empty documentId must be specified." ) ; } if ( language == null || language . isEmpty ( ) ) { thro... |
public class PHS398FellowshipSupplementalV1_1Generator { /** * This method is used to get PHSFellowshipSupplemental11 XMLObject and set
* the data to it from DevelopmentProposal data . */
private PHSFellowshipSupplemental11 getPHSFellowshipSupplemental11 ( ) { } } | PHSFellowshipSupplemental11 phsFellowshipSupplemental = PHSFellowshipSupplemental11 . Factory . newInstance ( ) ; phsFellowshipSupplemental . setFormVersion ( FormVersion . v1_1 . getVersion ( ) ) ; phsFellowshipSupplemental . setApplicationType ( getApplicationType ( ) ) ; phsFellowshipSupplemental . setAppendix ( get... |
public class CmsDriverManager { /** * Returns a filtered list of resources for publishing . < p >
* Contains all resources , which are not locked
* and which have a parent folder that is already published or will be published , too . < p >
* @ param dbc the current database context
* @ param publishList the fil... | List < CmsResource > result = new ArrayList < CmsResource > ( ) ; // local folder list for adding new publishing subfolders
// this solves the { @ link org . opencms . file . TestPublishIssues # testPublishScenarioD } problem .
List < CmsResource > newFolderList = new ArrayList < CmsResource > ( publishList == null ? r... |
public class WebDriverHelper { /** * Returns a new WebDriver instance and loads an existing profile from the
* disk . You must pass the path to the profile .
* @ param pathToProfile
* the path to the profile folder
* @ return a new FirefoxDriver that loads the supplied profile */
public static WebDriver getFire... | FirefoxProfile profile = new FirefoxProfile ( new File ( pathToProfile ) ) ; return new FirefoxDriver ( profile ) ; |
public class Utils { /** * Reads the content of an URL ( assumed to be text content ) .
* @ param url an URL
* @ return a non - null string
* @ throws IOException
* @ throws URISyntaxException */
public static String readUrlContent ( String url ) throws IOException , URISyntaxException { } } | InputStream in = null ; try { URI uri = UriUtils . urlToUri ( url ) ; in = uri . toURL ( ) . openStream ( ) ; ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; Utils . copyStreamSafely ( in , os ) ; return os . toString ( "UTF-8" ) ; } finally { closeQuietly ( in ) ; } |
public class JacksonSingleton { /** * Registers a new Jackson Module .
* @ param module the module to register */
@ Override public void register ( Module module ) { } } | if ( module == null ) { return ; } LOGGER . info ( "Adding JSON module {}" , module . getModuleName ( ) ) ; synchronized ( lock ) { modules . add ( module ) ; rebuildMappers ( ) ; } |
public class MeetingSettingMarshaller { /** * Marshall the given parameter object . */
public void marshall ( MeetingSetting meetingSetting , ProtocolMarshaller protocolMarshaller ) { } } | if ( meetingSetting == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( meetingSetting . getRequirePin ( ) , REQUIREPIN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessa... |
public class MessagingClientFactoryRegistry { /** * Notifies the messaging client factory listeners that a factory has been added / removed .
* @ param factory the incoming / outgoing messaging client factory .
* @ param isAdded flag indicating whether the factory has been added or removed . */
private void notifyL... | for ( MessagingClientFactoryListener listener : this . listeners ) { try { if ( isAdded ) listener . addMessagingClientFactory ( factory ) ; else listener . removeMessagingClientFactory ( factory ) ; } catch ( Throwable t ) { // Log the exception , but * do not * interrupt the notification of the other listeners .
this... |
public class RestRequestValidator { /** * Method to read a key ( or keys ) present in the HTTP request URI . The URI
* must be of the format / < store _ name > / < key > [ , < key > , . . . ]
* @ param requestURI The URI of the HTTP request */
protected void parseKeys ( String requestURI ) { } } | this . parsedKeys = null ; String [ ] parts = requestURI . split ( "/" ) ; if ( parts . length > 2 ) { String base64KeyList = parts [ 2 ] ; this . parsedKeys = new ArrayList < ByteArray > ( ) ; if ( ! base64KeyList . contains ( "," ) ) { String rawKey = base64KeyList . trim ( ) ; this . parsedKeys . add ( new ByteArray... |
public class Vulnerability { /** * Adds a reference .
* @ param referenceSource the source of the reference
* @ param referenceName the referenceName of the reference
* @ param referenceUrl the url of the reference */
public void addReference ( String referenceSource , String referenceName , String referenceUrl )... | final Reference ref = new Reference ( ) ; ref . setSource ( referenceSource ) ; ref . setName ( referenceName ) ; ref . setUrl ( referenceUrl ) ; this . references . add ( ref ) ; |
public class TopologySpec { /** * Creates a builder for the TopologySpec based on values in a topology properties config . */
public static TopologySpec . Builder builder ( URI catalogURI , Properties topologyProps ) { } } | String name = topologyProps . getProperty ( ConfigurationKeys . TOPOLOGY_NAME_KEY ) ; String group = topologyProps . getProperty ( ConfigurationKeys . TOPOLOGY_GROUP_KEY , "default" ) ; try { URI topologyURI = new URI ( catalogURI . getScheme ( ) , catalogURI . getAuthority ( ) , "/" + group + "/" + name , null ) ; Top... |
public class Parser { /** * originalText may be null if not available */
private static Path parsePathExpression ( Iterator < Token > expression , ConfigOrigin origin , String originalText ) { } } | // each builder in " buf " is an element in the path .
List < Element > buf = new ArrayList < Element > ( ) ; buf . add ( new Element ( "" , false ) ) ; if ( ! expression . hasNext ( ) ) { throw new ConfigException . BadPath ( origin , originalText , "Expecting a field name or path here, but got nothing" ) ; } while ( ... |
public class BeanMap { /** * Sets the bean property with the given name to the given value .
* @ param name the name of the property to set
* @ param value the value to set that property to
* @ return the previous value of that property */
@ Override public Object put ( String name , Object value ) { } } | if ( bean != null ) { Object oldValue = get ( name ) ; Method method = getWriteMethod ( name ) ; if ( method == null ) { throw new IllegalArgumentException ( "The bean of type: " + bean . getClass ( ) . getName ( ) + " has no property called: " + name ) ; } try { Object [ ] arguments = createWriteMethodArguments ( meth... |
public class NetworkWatchersInner { /** * Gets the current network topology by resource group .
* @ param resourceGroupName The name of the resource group .
* @ param networkWatcherName The name of the network watcher .
* @ param parameters Parameters that define the representation of topology .
* @ throws Ille... | return getTopologyWithServiceResponseAsync ( resourceGroupName , networkWatcherName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class Moment { /** * / * [ deutsch ]
* < p > Addiert einen Betrag in der angegegebenen SI - Zeiteinheit auf die
* UTC - Zeit dieses Zeitstempels . < / p >
* @ param amount amount in units to be added
* @ param unit time unit defined in UTC time space
* @ return changed copy of this instance
* @ throw... | Moment . check1972 ( this ) ; if ( amount == 0 ) { return this ; } Moment result ; try { switch ( unit ) { case SECONDS : if ( LeapSeconds . getInstance ( ) . isEnabled ( ) ) { result = new Moment ( Math . addExact ( this . getElapsedTimeUTC ( ) , amount ) , this . getNanosecond ( ) , UTC ) ; } else { result = Moment .... |
public class GPXPoint { /** * Set the number of satellites used to calculate the GPX fix for a point .
* @ param contentBuffer Contains the information to put in the table */
public final void setSat ( StringBuilder contentBuffer ) { } } | ptValues [ GpxMetadata . PTSAT ] = Integer . parseInt ( contentBuffer . toString ( ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.