signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class NettyUtils { /** * Create a pooled ByteBuf allocator but disables the thread - local cache . Thread - local caches
* are disabled for TransportClients because the ByteBufs are allocated by the event loop thread ,
* but released by the executor thread rather than the event loop thread . Those thread - l... | if ( numCores == 0 ) { numCores = Runtime . getRuntime ( ) . availableProcessors ( ) ; } return new PooledByteBufAllocator ( allowDirectBufs && PlatformDependent . directBufferPreferred ( ) , Math . min ( PooledByteBufAllocator . defaultNumHeapArena ( ) , numCores ) , Math . min ( PooledByteBufAllocator . defaultNumDir... |
public class DomainSpecificValue { /** * Sort DomainSpecificValue in reverse order as specified by ordering , changeSet and patternStr .
* This ordering defines the order of resolution that Roperty uses when a key is accessed .
* Values with a changeSet are ordered before values without a changeSet .
* Values wit... | int order = other . ordering - this . ordering ; if ( order == 0 ) { if ( changeSet != null && other . changeSet != null ) { int changeSetCompare = other . changeSet . compareTo ( changeSet ) ; if ( changeSetCompare != 0 ) return changeSetCompare ; else return patternStr . compareTo ( other . patternStr ) ; } if ( chan... |
public class CloseableReference { /** * Returns the cloned reference if valid , null otherwise .
* @ param ref the reference to clone */
@ Nullable public static < T > CloseableReference < T > cloneOrNull ( @ Nullable CloseableReference < T > ref ) { } } | return ( ref != null ) ? ref . cloneOrNull ( ) : null ; |
public class LdiSrl { /** * Extract sub - string by begin index . ( skip front string )
* < pre >
* substring ( " flute " , 2)
* returns " ute "
* < / pre >
* @ param str The target string . ( NotNull )
* @ param beginIndex The from - index .
* @ return The part of string . ( NotNull ) */
public static St... | assertStringNotNull ( str ) ; if ( str . length ( ) < beginIndex ) { String msg = "The length of the string was smaller than the begin index:" ; msg = msg + " str=" + str + ", beginIndex=" + beginIndex ; throw new StringIndexOutOfBoundsException ( msg ) ; } return str . substring ( beginIndex ) ; |
public class AccountManager { /** * Sets the email for the currently logged in client account .
* @ param email
* The new email
* @ param currentPassword
* The < b > valid < / b > current password for the represented account
* @ throws net . dv8tion . jda . core . exceptions . AccountTypeException
* If the ... | Checks . notNull ( email , "email" ) ; this . currentPassword = currentPassword ; this . email = email ; set |= EMAIL ; return this ; |
public class FnFunc { /** * Builds a function that will execute the specified function < tt > thenFunction < / tt >
* only if the result of executing < tt > condition < / tt > on the target object is false ,
* and will execute the specified function < tt > elseFunction < / tt > otherwise .
* The built function ca... | return new IfThenElse < T , R > ( false , targetType , condition , thenFunction , elseFunction ) ; |
public class CmsToolDialog { /** * Initializes the admin tool main view . < p >
* @ return the new modified parameters array
* @ throws CmsRoleViolationException in case the dialog is opened by a user without the necessary privileges */
public Map < String , String [ ] > initAdminTool ( ) throws CmsRoleViolationExc... | Map < String , String [ ] > params = new HashMap < String , String [ ] > ( getParameterMap ( ) ) ; // initialize
getToolManager ( ) . initParams ( this ) ; // adjust parameters if called as default
if ( ! useNewStyle ( ) ) { params . put ( PARAM_STYLE , new String [ ] { CmsToolDialog . STYLE_NEW } ) ; setParamStyle ( C... |
public class HttpSessionImpl { /** * Method removeAttribute
* @ see javax . servlet . http . HttpSession # removeAttribute ( java . lang . String ) */
public void removeAttribute ( String attributeName ) { } } | synchronized ( _iSession ) { if ( ! _iSession . isValid ( ) ) throw new IllegalStateException ( ) ; Object object = _iSession . removeAttribute ( attributeName ) ; } |
public class AbstractGpxParserWpt { /** * Fires whenever an XML end markup is encountered . It catches attributes of
* the waypoint and saves them in corresponding values [ ] .
* @ param uri URI of the local element
* @ param localName Name of the local element ( without prefix )
* @ param qName qName of the lo... | // currentElement represents the last string encountered in the document
setCurrentElement ( getElementNames ( ) . pop ( ) ) ; if ( getCurrentElement ( ) . equalsIgnoreCase ( GPXTags . WPT ) ) { // if < / wpt > markup is found , the currentPoint is added in the table wptdbd and the default contentHandler is setted .
tr... |
public class RTPDataChannel { /** * Enables WebRTC encryption for the RTP channel .
* @ param remotePeerFingerprint */
public void enableWebRTC ( Text remotePeerFingerprint ) { } } | this . isWebRtc = true ; if ( this . webRtcHandler == null ) { this . webRtcHandler = new DtlsHandler ( this . dtlsServerProvider ) ; } this . webRtcHandler . setRemoteFingerprint ( "sha-256" , remotePeerFingerprint . toString ( ) ) ; |
public class ExtractorUtils { /** * Find first child node none recursive .
* @ param node start node
* @ param ruleName rule name
* @ return matched node */
public static Optional < ParserRuleContext > findFirstChildNodeNoneRecursive ( final ParserRuleContext node , final RuleName ruleName ) { } } | if ( isMatchedNode ( node , ruleName ) ) { return Optional . of ( node ) ; } for ( int i = 0 ; i < node . getChildCount ( ) ; i ++ ) { if ( node . getChild ( i ) instanceof ParserRuleContext ) { ParserRuleContext child = ( ParserRuleContext ) node . getChild ( i ) ; if ( isMatchedNode ( child , ruleName ) ) { return Op... |
public class AdminToolPropertiesService { /** * returns the spring environment properties
* @ return */
public Map < String , String > getEnvProperty ( ) { } } | Map < String , String > res = new TreeMap < String , String > ( ) ; MutablePropertySources mps = env . getPropertySources ( ) ; Iterator < PropertySource < ? > > iter = mps . iterator ( ) ; while ( iter . hasNext ( ) ) { PropertySource < ? > ps = iter . next ( ) ; if ( ps instanceof EnumerablePropertySource < ? > ) { f... |
public class DefaultGroovyMethods { /** * Power of a BigInteger to a BigInteger certain exponent . Called by the ' * * ' operator .
* @ param self a BigInteger
* @ param exponent a BigInteger exponent
* @ return a BigInteger to the power of a the exponent
* @ since 2.3.8 */
public static BigInteger power ( BigI... | if ( ( exponent . signum ( ) >= 0 ) && ( exponent . compareTo ( BI_INT_MAX ) <= 0 ) ) { return self . pow ( exponent . intValue ( ) ) ; } else { return BigDecimal . valueOf ( Math . pow ( self . doubleValue ( ) , exponent . doubleValue ( ) ) ) . toBigInteger ( ) ; } |
public class Responses { /** * Creates a response object for a successful command execution .
* @ param sessionId ID of the session that executed the command .
* @ param value the command result value .
* @ return the new response object . */
public static Response success ( SessionId sessionId , Object value ) {... | Response response = new Response ( ) ; response . setSessionId ( sessionId != null ? sessionId . toString ( ) : null ) ; response . setValue ( value ) ; response . setStatus ( ErrorCodes . SUCCESS ) ; response . setState ( ErrorCodes . SUCCESS_STRING ) ; return response ; |
public class FilterListSlowStr { /** * Determine , recursively , if an address is in the address tree .
* @ param address
* address to look for as a string array .
* The 0th index of the array is the rightmost substring of
* the string and so on . Each substring is the chars between
* two periods ( " . " ) in... | if ( cell . getWildcardCell ( ) != null ) { // a wildcard , match found
return true ; } // no wildcard so far , see if there is a still a path
FilterCellSlowStr nextCell = cell . findNextCell ( address [ index ] ) ; if ( nextCell != null ) { // see if we are at the end of a valid path
if ( index == endIndex ) { // this... |
public class NodeUtil { /** * Retrieves the nodes id .
* @ return a hopefully useful ID ( not < code > null < / code > ) */
public String getId ( Node node ) { } } | String id = null ; try { id = node . getIdentifier ( ) ; } catch ( RepositoryException e ) { id = node . toString ( ) ; // use Java ' ID '
} return id ; |
public class ExtensionForcedUser { /** * Sets the forced user for a context .
* @ param contextId the context id
* @ param user the user */
public void setForcedUser ( int contextId , User user ) { } } | if ( user != null ) this . contextForcedUsersMap . put ( contextId , user ) ; else this . contextForcedUsersMap . remove ( contextId ) ; this . updateForcedUserModeToggleButtonState ( ) ; |
public class ComponentPropertyResolver { /** * Get property .
* @ param name Property name
* @ param type Property type
* @ param < T > Parameter type
* @ return Property value or null if not set */
public @ Nullable < T > T get ( @ NotNull String name , @ NotNull Class < T > type ) { } } | @ Nullable T value = getPageProperty ( currentPage , name , type ) ; if ( value == null ) { value = getComponentProperty ( currentComponent , name , type ) ; } return value ; |
public class AnimatorSet { /** * Sets up this AnimatorSet to play each of the supplied animations when the
* previous animation ends .
* @ param items The animations that will be started one after another . */
public void playSequentially ( Animator ... items ) { } } | if ( items != null ) { mNeedsSort = true ; if ( items . length == 1 ) { play ( items [ 0 ] ) ; } else { for ( int i = 0 ; i < items . length - 1 ; ++ i ) { play ( items [ i ] ) . before ( items [ i + 1 ] ) ; } } } |
public class Parser { private void findUsefulDissectorsFromField ( final Set < String > possibleTargets , final Set < String > locatedTargets , final String subRootType , final String subRootName , final boolean thisIsTheRoot ) { } } | String subRootId = subRootType + ':' + subRootName ; // When we reach this point we have dissectors to get here .
// So we store this to later validate if we have everything .
if ( locatedTargets . contains ( subRootId ) ) { // We already found this one .
return ; // Avoid infinite recursion
} locatedTargets . add ( su... |
public class PageFlowUtils { /** * Make sure that when this page is rendered , it will set headers in the response to prevent caching .
* Because these headers are lost on server forwards , we set a request attribute to cause the headers
* to be set right before the page is rendered . This attribute can be read via... | assert request != null ; request . setAttribute ( PREVENT_CACHE_ATTR , Boolean . TRUE ) ; |
public class CassandraEntityReader { /** * Method responsible for reading back entity and relations using secondary
* indexes ( if it holds any relation ) , else retrieve row keys using lucene .
* @ param m entity meta data
* @ param client client instance
* @ param maxResults the max results
* @ return list ... | if ( log . isInfoEnabled ( ) ) { log . info ( "On populate relation via JPQL" ) ; } List < EnhanceEntity > ls = null ; List < String > relationNames = m . getRelationNames ( ) ; boolean isParent = m . isParent ( ) ; boolean isRowKeyQuery = conditions != null ? conditions . keySet ( ) . iterator ( ) . next ( ) : false ;... |
public class OpportunitiesApi { /** * Get opportunities group ( asynchronously ) Return information of an
* opportunities group - - - This route expires daily at 11:05
* @ param groupId
* ID of an opportunities group ( required )
* @ param acceptLanguage
* Language to use in the response ( optional , default ... | com . squareup . okhttp . Call call = getOpportunitiesGroupsGroupIdValidateBeforeCall ( groupId , acceptLanguage , datasource , ifNoneMatch , language , callback ) ; Type localVarReturnType = new TypeToken < OpportunitiesGroupResponse > ( ) { } . getType ( ) ; apiClient . executeAsync ( call , localVarReturnType , call... |
public class AbstractLauncher { /** * Check if remote files are newer then local files . Return true if files are updated , triggering the whatsnew option else false .
* Also return false and do not check for updates if the < code > - - offline < / code > commandline argument is set .
* @ return true if new files h... | Path cacheDir = manifest . resolveCacheDir ( getParameters ( ) . getNamed ( ) ) ; log . info ( String . format ( "Using cache dir %s" , cacheDir ) ) ; phase = "File Synchronization" ; if ( getParameters ( ) . getUnnamed ( ) . contains ( "--offline" ) ) { log . info ( "not updating files from remote, offline selected" )... |
public class ReadyBuilder { /** * Build an online constraint .
* @ param args must be 1 set of vms . The set must not be empty
* @ return a constraint */
@ Override public List < SatConstraint > buildConstraint ( BtrPlaceTree t , List < BtrpOperand > args ) { } } | if ( checkConformance ( t , args ) ) { @ SuppressWarnings ( "unchecked" ) List < VM > s = ( List < VM > ) params [ 0 ] . transform ( this , t , args . get ( 0 ) ) ; if ( s == null ) { return Collections . emptyList ( ) ; } return s . stream ( ) . map ( Ready :: new ) . collect ( Collectors . toList ( ) ) ; } return Col... |
public class PackageWriterImpl { /** * Add the package deprecation information to the documentation tree .
* @ param div the content tree to which the deprecation information will be added */
public void addDeprecationInfo ( Content div ) { } } | Tag [ ] deprs = packageDoc . tags ( "deprecated" ) ; if ( utils . isDeprecated ( packageDoc ) ) { HtmlTree deprDiv = new HtmlTree ( HtmlTag . DIV ) ; deprDiv . addStyle ( HtmlStyle . deprecatedContent ) ; Content deprPhrase = HtmlTree . SPAN ( HtmlStyle . deprecatedLabel , deprecatedPhrase ) ; deprDiv . addContent ( de... |
public class JSCompatibleMessageImpl { /** * Return the underlying encoding */
final JMFNativePart getEncodingMessage ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . entry ( this , tc , "getEncodingMessage" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . exit ( this , tc , "getEncodingMessage" , encoding ) ; return encoding ; |
public class SearchIndex { /** * Log unindexed changes into error . log
* @ param removed
* set of removed node uuids
* @ param added
* map of added node states and uuids
* @ throws IOException */
public void logErrorChanges ( ErrorLog errorLog , Set < String > removed , Set < String > added ) throws IOExcept... | // backup the remove and add iterators
if ( errorLog != null ) { errorLog . writeChanges ( removed , added ) ; } |
public class PackageWriterImpl { /** * { @ inheritDoc } */
public void addPackageTags ( Content packageContentTree ) { } } | Content htmlTree = ( configuration . allowTag ( HtmlTag . SECTION ) ) ? sectionTree : packageContentTree ; addTagsInfo ( packageDoc , htmlTree ) ; |
public class PropertiesReader { /** * Reads a long property .
* @ param property The property name .
* @ return The property value .
* @ throws ConfigurationException if the property is not present */
public long getLong ( String property ) { } } | return getProperty ( property , value -> { try { return Long . valueOf ( value ) ; } catch ( NumberFormatException e ) { throw new ConfigurationException ( "malformed property value: " + property + " must be a long" ) ; } } ) ; |
public class Stylesheet { /** * Read the stylesheet from a serialization stream .
* @ param stream Input stream to read from
* @ throws IOException
* @ throws TransformerException */
private void readObject ( ObjectInputStream stream ) throws IOException , TransformerException { } } | // System . out . println ( " Reading Stylesheet " ) ;
try { stream . defaultReadObject ( ) ; } catch ( ClassNotFoundException cnfe ) { throw new TransformerException ( cnfe ) ; } // System . out . println ( " Done reading Stylesheet " ) ; |
public class MilestonesApi { /** * Update the specified milestone .
* @ param projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance
* @ param milestoneId the milestone ID to update
* @ param title the updated title for the milestone
* @ param description the update... | if ( milestoneId == null ) { throw new RuntimeException ( "milestoneId cannot be null" ) ; } GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "title" , title , true ) . withParam ( "description" , description ) . withParam ( "due_date" , dueDate ) . withParam ( "start_date" , startDate ) . withParam ( "stat... |
public class DataUtil { /** * little - endian or intel format . */
public static void writeShortLittleEndian ( ByteBuffer io , short value ) { } } | io . put ( ( byte ) ( value & 0xFF ) ) ; io . put ( ( byte ) ( ( value >> 8 ) & 0xFF ) ) ; |
public class ServerHandshaker { /** * For Kerberos ciphers , the premaster secret is encrypted using
* the session key . See RFC 2712. */
private SecretKey clientKeyExchange ( KerberosClientKeyExchange mesg ) throws IOException { } } | if ( debug != null && Debug . isOn ( "handshake" ) ) { mesg . print ( System . out ) ; } // Record the principals involved in exchange
session . setPeerPrincipal ( mesg . getPeerPrincipal ( ) ) ; session . setLocalPrincipal ( mesg . getLocalPrincipal ( ) ) ; byte [ ] b = mesg . getUnencryptedPreMasterSecret ( ) ; retur... |
public class AuthorityKeyIdentifierExtension { /** * Delete the attribute value . */
public void delete ( String name ) throws IOException { } } | if ( name . equalsIgnoreCase ( KEY_ID ) ) { id = null ; } else if ( name . equalsIgnoreCase ( AUTH_NAME ) ) { names = null ; } else if ( name . equalsIgnoreCase ( SERIAL_NUMBER ) ) { serialNum = null ; } else { throw new IOException ( "Attribute name not recognized by " + "CertAttrSet:AuthorityKeyIdentifier." ) ; } enc... |
public class ComputerVisionImpl { /** * Optical Character Recognition ( OCR ) detects printed text in an image and extracts the recognized characters into a machine - usable character stream . Upon success , the OCR results will be returned . Upon failure , the error code together with an error message will be returned... | return recognizePrintedTextWithServiceResponseAsync ( detectOrientation , url , recognizePrintedTextOptionalParameter ) . map ( new Func1 < ServiceResponse < OcrResult > , OcrResult > ( ) { @ Override public OcrResult call ( ServiceResponse < OcrResult > response ) { return response . body ( ) ; } } ) ; |
public class LinearScanPrimitiveDistanceKNNQuery { /** * Main loop of the linear scan .
* @ param relation Data relation
* @ param iter ID iterator
* @ param obj Query object
* @ param heap Output heap
* @ return Heap */
private KNNHeap linearScan ( Relation < ? extends O > relation , DBIDIter iter , final O ... | final PrimitiveDistanceFunction < ? super O > rawdist = this . rawdist ; double max = Double . POSITIVE_INFINITY ; while ( iter . valid ( ) ) { final double dist = rawdist . distance ( obj , relation . get ( iter ) ) ; if ( dist <= max ) { max = heap . insert ( dist , iter ) ; } iter . advance ( ) ; } return heap ; |
public class HtmlDataTable { /** * < p > Set the value of the < code > frame < / code > property . < / p > */
public void setFrame ( java . lang . String frame ) { } } | getStateHelper ( ) . put ( PropertyKeys . frame , frame ) ; handleAttribute ( "frame" , frame ) ; |
public class Datastream { /** * Creates and adds a new datastream version with an automatically
* generated id that is unique within the existing versions . The id
* will start with < code > this . id ( ) + " . " < / code > and have a numeric suffix .
* @ param createdDate the created date to use for the new data... | int n = versions . size ( ) ; while ( hasVersion ( id + "." + n ) ) { n ++ ; } DatastreamVersion dsv = new DatastreamVersion ( id + "." + n , createdDate ) ; versions . add ( dsv ) ; return dsv ; |
public class EventLostEvent { /** * Returns next event type ID .
* @ return next event type ID
* @ see EntryEventType */
private static int getNextEntryEventTypeId ( ) { } } | int higherTypeId = Integer . MIN_VALUE ; int i = 0 ; EntryEventType [ ] values = EntryEventType . values ( ) ; for ( EntryEventType value : values ) { int typeId = value . getType ( ) ; if ( i == 0 ) { higherTypeId = typeId ; } else { if ( typeId > higherTypeId ) { higherTypeId = typeId ; } } i ++ ; } int eventFlagPosi... |
public class ThemeManager { /** * Clear modifier from default theme
* @ see # modifyDefaultTheme ( int )
* @ see # setDefaultTheme ( int )
* @ see # getDefaultTheme ( ) */
public static void modifyDefaultThemeClear ( int mod ) { } } | mod &= ThemeManager . _THEME_MASK ; ThemeManager . _DEFAULT_THEME |= mod ; ThemeManager . _DEFAULT_THEME ^= mod ; |
public class AbstractJsonProvider { /** * Converts given array to an { @ link Iterable }
* @ param obj an array
* @ return an Iterable that iterates over the entries of an array */
@ SuppressWarnings ( "unchecked" ) public Iterable < ? > toIterable ( Object obj ) { } } | if ( isArray ( obj ) ) return ( ( Iterable ) obj ) ; else throw new JsonPathException ( "Cannot iterate over " + obj != null ? obj . getClass ( ) . getName ( ) : "null" ) ; |
public class PointLocationParser { /** * Parses a string representation of the point location .
* @ param representation
* String representation of the point location
* @ return Point location
* @ throws ParserException
* On an exception */
public static PointLocation parsePointLocation ( final String represe... | if ( StringUtils . isBlank ( representation ) ) { throw new ParserException ( "No point location value provided" ) ; } if ( ! StringUtils . endsWith ( representation , "/" ) ) { throw new ParserException ( "Point location value must be terminated with /" ) ; } final PointLocationParser parser = new PointLocationParser ... |
public class LayerBuilder { /** * Aggregates the readers associated with { @ code futures } together with
* contributions from the transport into the response .
* @ return The built layer
* @ throws IOException */
String build ( ) throws IOException { } } | if ( built ) { // Can call build only once per instance
throw new IllegalStateException ( ) ; } built = true ; Map < String , String > moduleCacheInfo = null ; if ( request . getAttribute ( LayerImpl . LAYERCACHEINFO_PROPNAME ) != null ) { moduleCacheInfo = new HashMap < String , String > ( ) ; request . setAttribute (... |
public class DefaultApidocExcluder { /** * $ NON - NLS - 1 $ */
@ Override public boolean isExcluded ( Doc doc ) { } } | if ( Utils . isHiddenMember ( doc . name ( ) ) ) { return true ; } if ( doc . tags ( EXCLUDE_FROM_JAVADOC_TAG ) . length > 0 ) { return true ; } if ( doc instanceof ProgramElementDoc ) { final ProgramElementDoc element = ( ProgramElementDoc ) doc ; if ( element . containingPackage ( ) . tags ( EXCLUDE_FROM_JAVADOC_TAG ... |
public class TextAdapterActivity { /** * This is only used by activities , not connection pools
* @ return */
private int countTries ( ) throws ActivityException { } } | Integer [ ] statuses = { WorkStatus . STATUS_FAILED } ; // note the current activity is at in - progress status . Failed status must be counted
// It is debatable if we should include other statuses
int count ; try { count = this . getEngine ( ) . countActivityInstances ( getProcessInstanceId ( ) , this . getActivityId... |
public class SetTopBoxCreative { /** * Gets the licenseWindowStartDateTime value for this SetTopBoxCreative .
* @ return licenseWindowStartDateTime * The date and time that this creative can begin serving from
* a local cable video - on - demand
* server . This attribute is optional . */
public com . google . api... | return licenseWindowStartDateTime ; |
public class WebAppTypeImpl { /** * If not already created , a new < code > welcome - file - list < / code > element will be created and returned .
* Otherwise , the first existing < code > welcome - file - list < / code > element will be returned .
* @ return the instance defined for the element < code > welcome -... | List < Node > nodeList = childNode . get ( "welcome-file-list" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new WelcomeFileListTypeImpl < WebAppType < T > > ( this , "welcome-file-list" , childNode , nodeList . get ( 0 ) ) ; } return createWelcomeFileList ( ) ; |
public class EM { /** * Assigns the current probability values to the instances in the database and
* compute the expectation value of the current mixture of distributions .
* Computed as the sum of the logarithms of the prior probability of each
* instance .
* @ param relation the database used for assignment ... | final int k = models . size ( ) ; double emSum = 0. ; for ( DBIDIter iditer = relation . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { NumberVector vec = relation . get ( iditer ) ; double [ ] probs = new double [ k ] ; for ( int i = 0 ; i < k ; i ++ ) { double v = models . get ( i ) . estimateLogDensit... |
public class TurfJoins { /** * Takes a { @ link Point } and a { @ link Polygon } and determines if the point resides inside the
* polygon . The polygon can be convex or concave . The function accounts for holes .
* @ param point which you ' d like to check if inside the polygon
* @ param polygon which you ' d lik... | // This API needs to get better
List < List < Point > > coordinates = polygon . coordinates ( ) ; List < List < List < Point > > > multiCoordinates = new ArrayList < > ( ) ; multiCoordinates . add ( coordinates ) ; return inside ( point , MultiPolygon . fromLngLats ( multiCoordinates ) ) ; |
public class ImageManager { /** * Creates a buffered image , optimized for display on our graphics device . */
public BufferedImage createImage ( int width , int height , int transparency ) { } } | return _icreator . createImage ( width , height , transparency ) ; |
public class WorkerImpl { /** * Creates a unique name , suitable for use with Resque .
* @ return a unique name for this worker */
protected String createName ( ) { } } | final StringBuilder buf = new StringBuilder ( 128 ) ; try { buf . append ( InetAddress . getLocalHost ( ) . getHostName ( ) ) . append ( COLON ) . append ( ManagementFactory . getRuntimeMXBean ( ) . getName ( ) . split ( "@" ) [ 0 ] ) // PID
. append ( '-' ) . append ( this . workerId ) . append ( COLON ) . append ( JA... |
public class CommerceWishListItemLocalServiceBaseImpl { /** * Returns a range of all the commerce wish list items .
* 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 the r... | return commerceWishListItemPersistence . findAll ( start , end ) ; |
public class Transporter { /** * Closes transporter . */
@ Override public void stopped ( ) { } } | // Stop heartbeat timer
if ( heartBeatTimer != null ) { heartBeatTimer . cancel ( false ) ; heartBeatTimer = null ; } // Stop timeout checker ' s timer
if ( checkTimeoutTimer != null ) { checkTimeoutTimer . cancel ( false ) ; checkTimeoutTimer = null ; } // Send " disconnected " packet
sendDisconnectPacket ( ) ; // Cle... |
public class AcceptableUsagePolicyStatus { /** * Gets property or default .
* @ param name the name
* @ param defaultValue the default value
* @ return the property or default */
public Collection < Object > getPropertyOrDefault ( final String name , final Object defaultValue ) { } } | return getPropertyOrDefault ( name , CollectionUtils . wrapList ( defaultValue ) ) ; |
public class DatabasesInner { /** * Gets a database inside of a recommented elastic pool .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ param r... | if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( serverN... |
public class Allocation { /** * Returns the sum of the { @ link # size sizes } of the allocations . */
static long getTotalSize ( Collection < Allocation > allocations ) { } } | long totalSize = 0 ; for ( Allocation allocation : allocations ) { totalSize += allocation . size ; } return totalSize ; |
public class InputMedia { /** * Use this setter to send new file as stream .
* @ param mediaStream File to send
* @ return This object */
public T setMedia ( InputStream mediaStream , String fileName ) { } } | this . newMediaStream = mediaStream ; this . isNewMedia = true ; this . mediaName = fileName ; this . media = "attach://" + fileName ; return ( T ) this ; |
public class JSMessageData { /** * Locking : private method , lock will be held by the caller */
private void checkDynamic ( int accessor ) throws JMFSchemaViolationException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . entry ( this , tc , "checkDynamic" , new Object [ ] { Integer . valueOf ( accessor ) } ) ; JSField field = getFieldDef ( accessor , false ) ; if ( field instanceof JSDynamic ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEnt... |
public class AbstractCachingInterceptor { /** * Get the requested object from the cache . The key is either obtained from the pipeline context ( keyKey ) if
* possible . Alternatively , the { @ link CacheContainer } is built to determine the cache key .
* @ param keyKey key to put the cache key in the pipeline cont... | return cachingSupportService . getContainer ( keyKey , contextKey , keys , category , pipelineContext , this , containerClass ) ; |
public class ASMUtil { /** * return a array of new Label ( used for switch / case generation )
* @ param cnt
* number of label to return */
public static Label [ ] newLabels ( int cnt ) { } } | Label [ ] r = new Label [ cnt ] ; for ( int i = 0 ; i < cnt ; i ++ ) r [ i ] = new Label ( ) ; return r ; |
public class LogContext { /** * Adds the given key / value pair to this logging context . If the key cannot be repeated , and
* there is already a value for the key in the metadata , then the existing value is replaced ,
* otherwise the value is added at the end of the metadata .
* @ param key the metadata key ( ... | if ( metadata == null ) { metadata = new MutableMetadata ( ) ; } metadata . addValue ( key , value ) ; |
public class GPXPoint { /** * Set the horizontal dilution of precision of a point .
* @ param contentBuffer Contains the information to put in the table */
public final void setHdop ( StringBuilder contentBuffer ) { } } | ptValues [ GpxMetadata . PTHDOP ] = Double . parseDouble ( contentBuffer . toString ( ) ) ; |
public class ListByteMatchSetsResult { /** * An array of < a > ByteMatchSetSummary < / a > objects .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setByteMatchSets ( java . util . Collection ) } or { @ link # withByteMatchSets ( java . util . Collection ) }... | if ( this . byteMatchSets == null ) { setByteMatchSets ( new java . util . ArrayList < ByteMatchSetSummary > ( byteMatchSets . length ) ) ; } for ( ByteMatchSetSummary ele : byteMatchSets ) { this . byteMatchSets . add ( ele ) ; } return this ; |
public class TableRef { /** * Applies a filter to the table . When fetched , it will return the items lesser than the filter property value .
* < pre >
* StorageRef storage = new StorageRef ( " your _ app _ key " , " your _ token " ) ;
* TableRef tableRef = storage . table ( " your _ table " ) ;
* / / Retrieve ... | filters . add ( new Filter ( StorageFilter . LESSERTHAN , attributeName , value , null ) ) ; return this ; |
public class AppenderFile { /** * Gets rx observable that reads the log files and appends to string .
* @ return Observable that reads the log files and appends to string . */
private Observable < String > loadLogsObservable ( ) { } } | return Observable . fromCallable ( ( ) -> { StringBuilder sb = new StringBuilder ( ) ; Context context = appContextRef . get ( ) ; if ( context != null ) { synchronized ( sharedLock ) { try { File dir = context . getFilesDir ( ) ; String line ; for ( int i = 1 ; i <= maxFiles ; i ++ ) { File file = new File ( dir , nam... |
public class POContextStack { /** * ( non - Javadoc )
* @ see org . overture . pog . IPOContextStack # getName ( ) */
@ Override public String getName ( ) { } } | StringBuilder result = new StringBuilder ( ) ; String prefix = "" ; for ( IPOContext ctxt : this ) { String name = ctxt . getName ( ) ; if ( name . length ( ) > 0 ) { result . append ( prefix ) ; result . append ( name ) ; prefix = ", " ; } } return result . toString ( ) ; |
public class MBeanServerProxy { /** * { @ inheritDoc } */
public ObjectInputStream deserialize ( ObjectName name , byte [ ] data ) throws OperationsException { } } | return delegate . deserialize ( name , data ) ; |
public class AmazonEC2Client { /** * Deletes the specified EC2 Fleet .
* After you delete an EC2 Fleet , it launches no new instances . You must specify whether an EC2 Fleet should also
* terminate its instances . If you terminate the instances , the EC2 Fleet enters the
* < code > deleted _ terminating < / code ... | request = beforeClientExecution ( request ) ; return executeDeleteFleets ( request ) ; |
public class TimeUtils { /** * Convert from a TimeUnit to a influxDB timeunit String .
* @ param t time unit
* @ return the String representation . */
public static String toTimePrecision ( final TimeUnit t ) { } } | switch ( t ) { case HOURS : return "h" ; case MINUTES : return "m" ; case SECONDS : return "s" ; case MILLISECONDS : return "ms" ; case MICROSECONDS : return "u" ; case NANOSECONDS : return "n" ; default : EnumSet < TimeUnit > allowedTimeunits = EnumSet . of ( TimeUnit . HOURS , TimeUnit . MINUTES , TimeUnit . SECONDS ... |
public class JobExecutionsInner { /** * Starts an elastic job execution .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ param jobAgentName The n... | return ServiceFuture . fromResponse ( beginCreateWithServiceResponseAsync ( resourceGroupName , serverName , jobAgentName , jobName ) , serviceCallback ) ; |
public class AbstractUPCEAN { /** * Validates a UPC / EAN / GTIN / GLN message .
* @ param aChars
* the chars to validate
* @ return { @ link EValidity # VALID } if the msg is valid ,
* { @ link EValidity # INVALID } otherwise . */
@ Nonnull protected static EValidity validateMessage ( @ Nonnull final char [ ] ... | ValueEnforcer . notNull ( aChars , "Chars" ) ; for ( final char c : aChars ) if ( c < '0' || c > '9' ) return EValidity . INVALID ; return EValidity . VALID ; |
public class Iterators { /** * Combine the iterators into a single one .
* @ param iterators An iterator of iterators
* @ return a single combined iterator */
public static < T > Iterator < T > concat ( Iterator < ? extends Iterator < ? extends T > > iterators ) { } } | Preconditions . checkArgumentNotNull ( iterators , "iterators" ) ; return new CombinedIterator < T > ( iterators ) ; |
public class SqlFetcher { /** * Downloads the entire resultset object into a file . This avoids maintaining a
* persistent connection to the database . The retry is performed at the query execution layer .
* @ param object sql query for which the resultset is to be downloaded
* @ param outFile a file which the ob... | openObjectFunction . open ( object , outFile ) ; return outFile . length ( ) ; |
public class Branch { /** * Method shows play store install prompt for the full app . Use this method only if you want the full app to receive a custom { @ link BranchUniversalObject } to do deferred deep link .
* Please see { @ link # showInstallPrompt ( Activity , int ) }
* NOTE :
* This method will do a synchr... | if ( buo != null ) { String shortUrl = buo . getShortUrl ( activity , new LinkProperties ( ) ) ; String installReferrerString = Defines . Jsonkey . ReferringLink . getKey ( ) + "=" + shortUrl ; if ( ! TextUtils . isEmpty ( installReferrerString ) ) { return showInstallPrompt ( activity , requestCode , installReferrerSt... |
public class Encoding { /** * Description of the Method
* @ param input Description of the Parameter
* @ return Description of the Return Value */
public static synchronized String rot13 ( String input ) { } } | StringBuffer output = new StringBuffer ( ) ; if ( input != null ) { for ( int i = 0 ; i < input . length ( ) ; i ++ ) { char inChar = input . charAt ( i ) ; if ( ( inChar >= 'A' ) & ( inChar <= 'Z' ) ) { inChar += 13 ; if ( inChar > 'Z' ) { inChar -= 26 ; } } if ( ( inChar >= 'a' ) & ( inChar <= 'z' ) ) { inChar += 13 ... |
public class MarkupFormatter { /** * Generate HTML for preview , using markup formatter .
* Can be called from other views . */
public HttpResponse doPreviewDescription ( @ QueryParameter String text ) throws IOException { } } | StringWriter w = new StringWriter ( ) ; translate ( text , w ) ; return HttpResponses . html ( w . toString ( ) ) ; |
public class AbstractParameterizablePlugin { /** * Parses the arguments and injects values into the beans via properties . */
public int parseArgument ( Options opt , String [ ] args , int start ) throws BadCommandLineException , IOException { } } | int consumed = 0 ; final String optionPrefix = "-" + getOptionName ( ) + "-" ; final int optionPrefixLength = optionPrefix . length ( ) ; final String arg = args [ start ] ; final int equalsPosition = arg . indexOf ( '=' ) ; if ( arg . startsWith ( optionPrefix ) && equalsPosition > optionPrefixLength ) { final String ... |
public class BootstrapContextCoordinator { /** * Unregister boostrap context
* @ param bc The bootstrap context */
public void unregisterBootstrapContext ( CloneableBootstrapContext bc ) { } } | if ( bc != null ) { if ( bc . getName ( ) == null || bc . getName ( ) . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "The name of BootstrapContext is invalid: " + bc ) ; if ( bootstrapContexts . keySet ( ) . contains ( bc . getName ( ) ) ) { bootstrapContexts . remove ( bc . getName ( ) ) ; } } |
public class ListMultimap { /** * Replaces all values with the given values .
* @ param key the key
* @ param values the values with which to replace all existing values
* @ return the values that were replaced ( this list is immutable ) */
public List < V > replace ( K key , Collection < ? extends V > values ) {... | List < V > replaced = removeAll ( key ) ; putAll ( key , values ) ; return replaced ; |
public class ZkConsumerCommand { /** * 获取指定主题及分区logsize
* @ param stat */
public void getTopicPartitionLogSize ( TopicPartitionInfo stat ) { } } | BrokerEndPoint leader = findLeader ( stat . getTopic ( ) , stat . getPartition ( ) ) . leader ( ) ; SimpleConsumer consumer = getConsumerClient ( leader . host ( ) , leader . port ( ) ) ; try { long logsize = getLastOffset ( consumer , stat . getTopic ( ) , stat . getPartition ( ) , kafka . api . OffsetRequest . Latest... |
public class ConnectionManager { /** * 获取连接并执行交易
* @ param address
* @ param command
* @ return */
public < T > T executeFdfsCmd ( InetSocketAddress address , FdfsCommand < T > command ) { } } | // 获取连接
Connection conn = getConnection ( address ) ; // 执行交易
return execute ( address , conn , command ) ; |
public class ReferenceContextImpl { /** * Merge bindings and resource references .
* @ param masterCompNSConfig the output component
* @ param compNSConfigs the input components
* @ param scope the desired scope , or null for all scopes */
static void mergeResRefsAndBindings ( ComponentNameSpaceConfiguration mast... | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "mergeResRefsAndBindings" ) ; Map < String , ResourceRefConfig [ ] > resRefMap = new LinkedHashMap < String , ResourceRefConfig [ ] > ( ) ; Map < JNDIEnvironmentRefType , Map < String , Com... |
public class CommonOps_DDF4 { /** * Performs an in - place element by element scalar multiplication . < br >
* < br >
* a < sub > ij < / sub > = & alpha ; * a < sub > ij < / sub >
* @ param a The vector that is to be scaled . Modified .
* @ param alpha the amount each element is multiplied by . */
public static... | a . a1 *= alpha ; a . a2 *= alpha ; a . a3 *= alpha ; a . a4 *= alpha ; |
public class ThriftDeserialization { /** * Deserializes byte - array into thrift object .
* Supporting binary , compact and json protocols ,
* and the byte array could be or not be encoded by Base64.
* @ param bytes the byte - array to deserialize
* @ param thriftObj the output thrift object
* @ return the ou... | Preconditions . checkNotNull ( thriftObj ) ; try { final byte [ ] src = decodeB64IfNeeded ( bytes ) ; final TProtocolFactory protocolFactory = TProtocolUtil . guessProtocolFactory ( src , null ) ; Preconditions . checkNotNull ( protocolFactory ) ; if ( protocolFactory instanceof TCompactProtocol . Factory ) { DESERIALI... |
public class ConstantsSummaryWriterImpl { /** * { @ inheritDoc } */
public void addPackageName ( PackageElement pkg , Content summariesTree , boolean first ) { } } | Content pkgNameContent ; if ( ! first && configuration . allowTag ( HtmlTag . SECTION ) ) { summariesTree . addContent ( summaryTree ) ; } if ( pkg . isUnnamed ( ) ) { summariesTree . addContent ( getMarkerAnchor ( SectionName . UNNAMED_PACKAGE_ANCHOR ) ) ; pkgNameContent = contents . defaultPackageLabel ; } else { Str... |
public class JCalendar { /** * JCalendar is a PropertyChangeListener , for its day , month and year
* chooser .
* @ param evt
* the property change event */
public void propertyChange ( PropertyChangeEvent evt ) { } } | if ( calendar != null ) { Calendar c = ( Calendar ) calendar . clone ( ) ; if ( evt . getPropertyName ( ) . equals ( "day" ) ) { c . set ( Calendar . DAY_OF_MONTH , ( ( Integer ) evt . getNewValue ( ) ) . intValue ( ) ) ; setCalendar ( c , false ) ; } else if ( evt . getPropertyName ( ) . equals ( "month" ) ) { c . set... |
public class RadarChartTileSkin { /** * * * * * * Initialization * * * * * */
@ Override protected void initGraphics ( ) { } } | super . initGraphics ( ) ; radarChart = new RadarChart ( tile . getChartData ( ) ) ; radarChart . setMaxValue ( tile . getMaxValue ( ) ) ; radarChart . setUnit ( tile . getUnit ( ) ) ; radarChart . setLegendVisible ( true ) ; radarChart . setThresholdVisible ( tile . isThresholdVisible ( ) ) ; radarChart . setMode ( ti... |
public class ObjectOffsetImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . OBJECT_OFFSET__OBJ_TPE : setObjTpe ( OBJ_TPE_EDEFAULT ) ; return ; case AfplibPackage . OBJECT_OFFSET__OBJ_OSET : setObjOset ( OBJ_OSET_EDEFAULT ) ; return ; case AfplibPackage . OBJECT_OFFSET__OBJ_OST_HI : setObjOstHi ( OBJ_OST_HI_EDEFAULT ) ; return ; } super . eUnset ( fea... |
public class ScriptRuntime { /** * Prepare for calling & lt ; expression & gt ; ( . . . ) : return function corresponding to
* & lt ; expression & gt ; and make parent scope of the function available
* as ScriptRuntime . lastStoredScriptable ( ) for consumption as thisObj .
* The caller must call ScriptRuntime . ... | if ( ! ( value instanceof Callable ) ) { throw notFunctionError ( value ) ; } Callable f = ( Callable ) value ; Scriptable thisObj = null ; if ( f instanceof Scriptable ) { thisObj = ( ( Scriptable ) f ) . getParentScope ( ) ; } if ( thisObj == null ) { if ( cx . topCallScope == null ) throw new IllegalStateException (... |
public class CircularBarPager { /** * Apply a { @ link android . support . v4 . view . ViewPager # setPadding ( int , int , int , int ) } and
* { @ link android . support . v4 . view . ViewPager # setPageMargin ( int ) } in order to get a nicer animation
* on the { @ link android . support . v4 . view . ViewPager }... | super . onMeasure ( widthMeasureSpec , heightMeasureSpec ) ; if ( ! isPaddingSet && mViewPager != null ) { int paddingForViewPager = this . getMeasuredWidth ( ) / mPaddingRatio ; mViewPager . setPadding ( paddingForViewPager , mViewPager . getPaddingTop ( ) , paddingForViewPager , mViewPager . getPaddingBottom ( ) ) ; ... |
public class Injection { /** * Inject a value into an object property
* @ param object The object
* @ param propertyName The property name
* @ param propertyValue The property value
* @ param propertyType The property type as a fully quilified class name
* @ param includeFields Should fields be included for i... | if ( object == null ) throw new IllegalArgumentException ( "Object is null" ) ; if ( propertyName == null || propertyName . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "PropertyName is undefined" ) ; String methodName = "set" + propertyName . substring ( 0 , 1 ) . toUpperCase ( Locale . US ) ; if ( ... |
public class SamplingSubgraphIterator { /** * If the { @ code nextSubgraphs } queue is empty , expands the graph frontier
* of the next available vertex , if one exists , and the subgraphs reachable
* from it to the queue . */
private void advance ( ) { } } | while ( nextSubgraphs . isEmpty ( ) && vertexIter . hasNext ( ) ) { Integer nextVertex = vertexIter . next ( ) ; // Determine the set of vertices that are greater than this vertex
Set < Integer > extension = new HashSet < Integer > ( ) ; for ( Integer v : g . getNeighbors ( nextVertex ) ) if ( v > nextVertex ) extensio... |
public class TransactionRomanticSnapshotBuilder { protected void setupEntryMethodExp ( StringBuilder sb , RomanticTransaction tx ) { } } | final Method entryMethod = tx . getEntryMethod ( ) ; if ( entryMethod != null ) { final String appPkg = getApplicationPackageKeyword ( ) ; final String classExp = Srl . substringFirstRear ( entryMethod . getDeclaringClass ( ) . getName ( ) , appPkg ) ; sb . append ( ", " ) . append ( classExp ) . append ( "@" ) . appen... |
public class CheckArg { /** * Check that the argument is positive ( > 0 ) .
* @ param argument The argument
* @ param name The name of the argument
* @ throws IllegalArgumentException If argument is non - positive ( < = 0) */
public static void isPositive ( long argument , String name ) { } } | if ( argument <= 0 ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBePositive . text ( name , argument ) ) ; } |
public class A_CmsSelectWidget { /** * Adds a new select option to this widget . < p >
* @ param option the select option to add */
public void addSelectOption ( CmsSelectWidgetOption option ) { } } | if ( m_selectOptions == null ) { m_selectOptions = new ArrayList < CmsSelectWidgetOption > ( ) ; } m_selectOptions . add ( option ) ; |
public class URLResolver { /** * Parses a given specification using the algorithm depicted in < a
* href = " https : / / tools . ietf . org / html / rfc1808 # section - 2.4 " > RFC1808 - Section 2.4 < / a > :
* < blockquote >
* < h3 > Section 2.4 : Parsing a URL < / h3 >
* An accepted method for parsing URLs is... | final Url url = new Url ( ) ; int startIndex = 0 ; int endIndex = spec . length ( ) ; // Section 2.4.1 : Parsing the Fragment Identifier
// If the parse string contains a crosshatch " # " character , then the
// substring after the first ( left - most ) crosshatch " # " and up to the
// end of the parse string is the <... |
public class LeafNode { /** * Publishes multiple events to the node . Same rules apply as in { @ link # send ( Item ) } .
* In addition , if { @ link ConfigureForm # isPersistItems ( ) } = false , only the last item in the input
* list will get stored on the node , assuming it stores the last sent item .
* @ para... | PubSub packet = createPubsubPacket ( Type . set , new PublishItem < > ( getId ( ) , items ) ) ; pubSubManager . getConnection ( ) . createStanzaCollectorAndSend ( packet ) . nextResultOrThrow ( ) ; |
public class DemoFescarWebLauncher { /** * 用于页面显示数据 */
@ Ok ( "json:full" ) @ At ( "/api/info" ) public NutMap info ( ) { } } | NutMap re = new NutMap ( ) ; NutMap data = new NutMap ( ) ; data . put ( "account" , dao . fetch ( Account . class , Cnd . where ( "userId" , "=" , "U100001" ) ) ) ; data . put ( "storage" , dao . fetch ( Storage . class , Cnd . where ( "commodityCode" , "=" , "C00321" ) ) ) ; return re . setv ( "data" , data ) . setv ... |
public class ExceptionClassFilterImpl { /** * If not already created , a new < code > include < / code > element will be created and returned .
* Otherwise , the first existing < code > include < / code > element will be returned .
* @ return the instance defined for the element < code > include < / code > */
publi... | List < Node > nodeList = childNode . get ( "include" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new IncludeImpl < ExceptionClassFilter < T > > ( this , "include" , childNode , nodeList . get ( 0 ) ) ; } return createInclude ( ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.