signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CmsADEConfigCacheState { /** * Checks whether the given resource is configured as a detail page . < p >
* @ param cms the current CMS context
* @ param resource the resource to test
* @ return true if the resource is configured as a detail page */
protected boolean isDetailPage ( CmsObject cms , CmsResource resource ) { } } | CmsResource folder ; if ( resource . isFile ( ) ) { if ( ! CmsResourceTypeXmlContainerPage . isContainerPage ( resource ) ) { return false ; } try { folder = getCms ( ) . readResource ( CmsResource . getParentFolder ( resource . getRootPath ( ) ) ) ; } catch ( CmsException e ) { LOG . debug ( e . getLocalizedMessage ( ) , e ) ; return false ; } } else { folder = resource ; } List < CmsDetailPageInfo > allDetailPages = new ArrayList < CmsDetailPageInfo > ( ) ; // First collect all detail page infos
for ( CmsADEConfigDataInternal configData : m_siteConfigurationsByPath . values ( ) ) { List < CmsDetailPageInfo > detailPageInfos = wrap ( configData ) . getAllDetailPages ( ) ; allDetailPages . addAll ( detailPageInfos ) ; } // First pass : check if the structure id or path directly match one of the configured detail pages .
for ( CmsDetailPageInfo info : allDetailPages ) { if ( folder . getStructureId ( ) . equals ( info . getId ( ) ) || folder . getRootPath ( ) . equals ( info . getUri ( ) ) || resource . getStructureId ( ) . equals ( info . getId ( ) ) || resource . getRootPath ( ) . equals ( info . getUri ( ) ) ) { return true ; } } // Second pass : configured detail pages may be actual container pages rather than folders
String normalizedFolderRootPath = CmsStringUtil . joinPaths ( folder . getRootPath ( ) , "/" ) ; for ( CmsDetailPageInfo info : allDetailPages ) { String parentPath = CmsResource . getParentFolder ( info . getUri ( ) ) ; if ( parentPath != null ) { String normalizedParentPath = CmsStringUtil . joinPaths ( parentPath , "/" ) ; if ( normalizedParentPath . equals ( normalizedFolderRootPath ) ) { try { CmsResource infoResource = getCms ( ) . readResource ( info . getId ( ) ) ; if ( infoResource . isFile ( ) ) { return true ; } } catch ( CmsException e ) { LOG . warn ( e . getLocalizedMessage ( ) , e ) ; } } } } return false ; |
public class HttpServiceActivator { /** * Create the service tracker .
* @ param context
* @ param httpContext
* @ param dictionary
* @ return */
public HttpServiceTracker createServiceTracker ( BundleContext context , HttpContext httpContext , Dictionary < String , String > dictionary ) { } } | if ( httpContext == null ) httpContext = getHttpContext ( ) ; return new HttpServiceTracker ( context , httpContext , dictionary ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcFlowTreatmentDeviceType ( ) { } } | if ( ifcFlowTreatmentDeviceTypeEClass == null ) { ifcFlowTreatmentDeviceTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 255 ) ; } return ifcFlowTreatmentDeviceTypeEClass ; |
public class Range { /** * The intersection of two ranges .
* < code > < pre >
* / / ( 2 , 3)
* range ( 1 , 3 ) . intersect ( 2 , 4)
* / / none
* range ( 1 , 3 ) . intersect ( 5 , 8)
* < / pre > < / code > */
public Optional < Range < T > > intersect ( T t1 , T t2 ) { } } | return intersect ( new Range < > ( t1 , t2 ) ) ; |
public class OkHostnameVerifier { /** * Returns { @ code true } iff { @ code hostName } matches the domain name { @ code pattern } .
* @ param hostName lower - case host name .
* @ param pattern domain name pattern from certificate . May be a wildcard pattern such as
* { @ code * . android . com } . */
private boolean verifyHostName ( String hostName , String pattern ) { } } | // Basic sanity checks
// Check length = = 0 instead of . isEmpty ( ) to support Java 5.
if ( ( hostName == null ) || ( hostName . length ( ) == 0 ) || ( hostName . startsWith ( "." ) ) || ( hostName . endsWith ( ".." ) ) ) { // Invalid domain name
return false ; } if ( ( pattern == null ) || ( pattern . length ( ) == 0 ) || ( pattern . startsWith ( "." ) ) || ( pattern . endsWith ( ".." ) ) ) { // Invalid pattern / domain name
return false ; } // Normalize hostName and pattern by turning them into absolute domain names if they are not
// yet absolute . This is needed because server certificates do not normally contain absolute
// names or patterns , but they should be treated as absolute . At the same time , any hostName
// presented to this method should also be treated as absolute for the purposes of matching
// to the server certificate .
// www . android . com matches www . android . com
// www . android . com matches www . android . com .
// www . android . com . matches www . android . com .
// www . android . com . matches www . android . com
if ( ! hostName . endsWith ( "." ) ) { hostName += '.' ; } if ( ! pattern . endsWith ( "." ) ) { pattern += '.' ; } // hostName and pattern are now absolute domain names .
pattern = pattern . toLowerCase ( Locale . US ) ; // hostName and pattern are now in lower case - - domain names are case - insensitive .
if ( ! pattern . contains ( "*" ) ) { // Not a wildcard pattern - - hostName and pattern must match exactly .
return hostName . equals ( pattern ) ; } // Wildcard pattern
// WILDCARD PATTERN RULES :
// 1 . Asterisk ( * ) is only permitted in the left - most domain name label and must be the
// only character in that label ( i . e . , must match the whole left - most label ) .
// For example , * . example . com is permitted , while * a . example . com , a * . example . com ,
// a * b . example . com , a . * . example . com are not permitted .
// 2 . Asterisk ( * ) cannot match across domain name labels .
// For example , * . example . com matches test . example . com but does not match
// sub . test . example . com .
// 3 . Wildcard patterns for single - label domain names are not permitted .
if ( ( ! pattern . startsWith ( "*." ) ) || ( pattern . indexOf ( '*' , 1 ) != - 1 ) ) { // Asterisk ( * ) is only permitted in the left - most domain name label and must be the only
// character in that label
return false ; } // Optimization : check whether hostName is too short to match the pattern . hostName must be at
// least as long as the pattern because asterisk must match the whole left - most label and
// hostName starts with a non - empty label . Thus , asterisk has to match one or more characters .
if ( hostName . length ( ) < pattern . length ( ) ) { // hostName too short to match the pattern .
return false ; } if ( "*." . equals ( pattern ) ) { // Wildcard pattern for single - label domain name - - not permitted .
return false ; } // hostName must end with the region of pattern following the asterisk .
String suffix = pattern . substring ( 1 ) ; if ( ! hostName . endsWith ( suffix ) ) { // hostName does not end with the suffix
return false ; } // Check that asterisk did not match across domain name labels .
int suffixStartIndexInHostName = hostName . length ( ) - suffix . length ( ) ; if ( ( suffixStartIndexInHostName > 0 ) && ( hostName . lastIndexOf ( '.' , suffixStartIndexInHostName - 1 ) != - 1 ) ) { // Asterisk is matching across domain name labels - - not permitted .
return false ; } // hostName matches pattern
return true ; |
public class Try { /** * Construct a Try that contains a single value extracted from the supplied reactive - streams Publisher
* < pre >
* { @ code
* ReactiveSeq < Integer > stream = Spouts . of ( 1,2,3 ) ;
* Try < Integer , Throwable > recover = Try . fromPublisher ( stream ) ;
* Try [ 1]
* < / pre >
* @ param pub Publisher to extract value from
* @ return Try populated with first value from Publisher */
public static < T > Try < T , Throwable > CofromPublisher ( final Publisher < T > pub ) { } } | return new Try < > ( LazyEither . fromPublisher ( pub ) , new Class [ 0 ] ) ; |
public class AwsSecurityFindingFilters { /** * The date / time of the last observation of a threat intel indicator .
* @ param threatIntelIndicatorLastObservedAt
* The date / time of the last observation of a threat intel indicator . */
public void setThreatIntelIndicatorLastObservedAt ( java . util . Collection < DateFilter > threatIntelIndicatorLastObservedAt ) { } } | if ( threatIntelIndicatorLastObservedAt == null ) { this . threatIntelIndicatorLastObservedAt = null ; return ; } this . threatIntelIndicatorLastObservedAt = new java . util . ArrayList < DateFilter > ( threatIntelIndicatorLastObservedAt ) ; |
public class JournalNodeJournalSyncer { /** * Checks if the address is local . */
private boolean isLocalIpAddress ( InetAddress addr ) { } } | if ( addr . isAnyLocalAddress ( ) || addr . isLoopbackAddress ( ) ) return true ; try { return NetworkInterface . getByInetAddress ( addr ) != null ; } catch ( SocketException e ) { return false ; } |
public class GrpcJsonUtil { /** * Returns a { @ link MessageMarshaller } with the request / response { @ link Message } s of all the { @ code methods }
* registered . */
public static MessageMarshaller jsonMarshaller ( List < MethodDescriptor < ? , ? > > methods ) { } } | final MessageMarshaller . Builder builder = MessageMarshaller . builder ( ) . omittingInsignificantWhitespace ( true ) . ignoringUnknownFields ( true ) ; for ( MethodDescriptor < ? , ? > method : methods ) { marshallerPrototype ( method . getRequestMarshaller ( ) ) . ifPresent ( builder :: register ) ; marshallerPrototype ( method . getResponseMarshaller ( ) ) . ifPresent ( builder :: register ) ; } return builder . build ( ) ; |
public class Map { /** * syck _ map _ initialize */
@ JRubyMethod public static IRubyObject initialize ( IRubyObject self , IRubyObject type_id , IRubyObject val , IRubyObject style ) { } } | org . yecht . Node node = ( org . yecht . Node ) self . dataGetStructChecked ( ) ; Ruby runtime = self . getRuntime ( ) ; ThreadContext ctx = runtime . getCurrentContext ( ) ; Data . Map ds = ( Data . Map ) node . data ; if ( ! val . isNil ( ) ) { IRubyObject hsh = TypeConverter . convertToTypeWithCheck ( val , runtime . getHash ( ) , "to_hash" ) ; if ( hsh . isNil ( ) ) { throw runtime . newTypeError ( "wrong argument type" ) ; } IRubyObject keys = hsh . callMethod ( ctx , "keys" ) ; for ( int i = 0 ; i < ( ( RubyArray ) keys ) . getLength ( ) ; i ++ ) { IRubyObject key = ( ( RubyArray ) keys ) . entry ( i ) ; node . mapAdd ( key , ( ( RubyHash ) hsh ) . op_aref ( ctx , key ) ) ; } } ( ( RubyObject ) self ) . fastSetInstanceVariable ( "@kind" , ( ( Node ) self ) . x . seq ) ; // NOT A TYPO - Syck does the same
self . callMethod ( ctx , "type_id=" , type_id ) ; self . callMethod ( ctx , "value=" , val ) ; self . callMethod ( ctx , "style=" , style ) ; return self ; |
public class Dashboard { /** * Sets the name for this Dashboard .
* @ param name The new name for the Dashboard . Cannot be null or empty . */
public void setName ( String name ) { } } | SystemAssert . requireArgument ( name != null && ! name . isEmpty ( ) , "Dashboard Name cannot be null or empty" ) ; this . name = name ; |
public class ViewHandler { /** * Encodes the " keys " JSON array into an URL - encoded form suitable for a GET on query service . */
private String encodeKeysGet ( String keys ) { } } | try { return URLEncoder . encode ( keys , "UTF-8" ) ; } catch ( Exception ex ) { throw new RuntimeException ( "Could not prepare view argument: " + ex ) ; } |
public class Base64Coder { /** * Encodes a byte array into Base64 format .
* No blanks or line breaks are inserted .
* @ param in is an array containing the data bytes to be encoded .
* @ return a character array with the Base64 encoded data . */
@ Pure @ Inline ( value = "Base64Coder.encode($1, ($1).length)" , imported = { } } | Base64Coder . class } ) public static char [ ] encode ( byte [ ] in ) { return encode ( in , in . length ) ; |
public class Queue { /** * Gets the Queues default Visibility . Will ask the parent Queue
* to get its default Visibility if this Queue doesn ' t have one . */
Visibility getDefaultVisibility ( ) { } } | if ( default_visibility != null ) return default_visibility ; if ( parent_queue != null ) return parent_queue . getDefaultVisibility ( ) ; return null ; |
public class ReflectKit { /** * Converts a string type to a target type
* @ param type target type
* @ param value string value
* @ return return target value */
public static Object convert ( Type type , String value ) { } } | if ( null == value ) { return value ; } if ( "" . equals ( value ) ) { if ( type . equals ( String . class ) ) { return value ; } if ( type . equals ( int . class ) || type . equals ( double . class ) || type . equals ( short . class ) || type . equals ( long . class ) || type . equals ( byte . class ) || type . equals ( float . class ) ) { return 0 ; } if ( type . equals ( boolean . class ) ) { return false ; } return null ; } if ( type . equals ( int . class ) || type . equals ( Integer . class ) ) { return Integer . parseInt ( value ) ; } else if ( type . equals ( String . class ) ) { return value ; } else if ( type . equals ( Double . class ) || type . equals ( double . class ) ) { return Double . parseDouble ( value ) ; } else if ( type . equals ( Float . class ) || type . equals ( float . class ) ) { return Float . parseFloat ( value ) ; } else if ( type . equals ( Long . class ) || type . equals ( long . class ) ) { return Long . parseLong ( value ) ; } else if ( type . equals ( Boolean . class ) || type . equals ( boolean . class ) ) { return Boolean . parseBoolean ( value ) ; } else if ( type . equals ( Short . class ) || type . equals ( short . class ) ) { return Short . parseShort ( value ) ; } else if ( type . equals ( Byte . class ) || type . equals ( byte . class ) ) { return Byte . parseByte ( value ) ; } else if ( type . equals ( BigDecimal . class ) ) { return new BigDecimal ( value ) ; } else if ( type . equals ( Date . class ) ) { if ( value . length ( ) == 10 ) return DateKit . toDate ( value , "yyyy-MM-dd" ) ; return DateKit . toDateTime ( value , "yyyy-MM-dd HH:mm:ss" ) ; } else if ( type . equals ( LocalDate . class ) ) { return DateKit . toLocalDate ( value , "yyyy-MM-dd" ) ; } else if ( type . equals ( LocalDateTime . class ) ) { return DateKit . toLocalDateTime ( value , "yyyy-MM-dd HH:mm:ss" ) ; } return value ; |
public class CliUtils { /** * Invokces the reflected { @ code UnqieuiId . fromBytes ( ) } method with the given
* byte array using the UniqueId character set .
* @ param b The byte array to convert to a string
* @ return The string
* @ throws RuntimeException if reflection failed */
static String fromBytes ( final byte [ ] b ) { } } | try { return ( String ) fromBytes . invoke ( null , b ) ; } catch ( Exception e ) { throw new RuntimeException ( "fromBytes=" + fromBytes , e ) ; } |
public class JingleProvider { /** * Parse a iq / jingle element .
* @ throws XmlPullParserException
* @ throws IOException
* @ throws SmackParsingException */
@ Override public Jingle parse ( XmlPullParser parser , int intialDepth , XmlEnvironment xmlEnvironment ) throws IOException , XmlPullParserException , SmackParsingException { } } | Jingle jingle = new Jingle ( ) ; String sid = "" ; JingleActionEnum action ; Jid initiator , responder ; boolean done = false ; JingleContent currentContent = null ; // Sub - elements providers
JingleContentProvider jcp = new JingleContentProvider ( ) ; JingleDescriptionProvider jdpAudio = new JingleDescriptionProvider . Audio ( ) ; JingleTransportProvider jtpRawUdp = new JingleTransportProvider . RawUdp ( ) ; JingleTransportProvider jtpIce = new JingleTransportProvider . Ice ( ) ; ExtensionElementProvider < ? > jmipAudio = new JingleContentInfoProvider . Audio ( ) ; int eventType ; String elementName ; String namespace ; // Get some attributes for the < jingle > element
sid = parser . getAttributeValue ( "" , "sid" ) ; action = JingleActionEnum . getAction ( parser . getAttributeValue ( "" , "action" ) ) ; initiator = ParserUtils . getJidAttribute ( parser , "initiator" ) ; responder = ParserUtils . getJidAttribute ( parser , "responder" ) ; jingle . setSid ( sid ) ; jingle . setAction ( action ) ; jingle . setInitiator ( initiator ) ; jingle . setResponder ( responder ) ; // Start processing sub - elements
while ( ! done ) { eventType = parser . next ( ) ; elementName = parser . getName ( ) ; namespace = parser . getNamespace ( ) ; if ( eventType == XmlPullParser . START_TAG ) { // Parse some well know subelements , depending on the namespaces
// and element names . . .
if ( elementName . equals ( JingleContent . NODENAME ) ) { // Add a new < content > element to the jingle
currentContent = jcp . parse ( parser ) ; jingle . addContent ( currentContent ) ; } else if ( elementName . equals ( JingleDescription . NODENAME ) && namespace . equals ( JingleDescription . Audio . NAMESPACE ) ) { // Set the < description > element of the < content >
currentContent . setDescription ( jdpAudio . parse ( parser ) ) ; } else if ( elementName . equals ( JingleTransport . NODENAME ) ) { // Add all of the < transport > elements to the < content > of the jingle
// Parse the possible transport namespaces
if ( namespace . equals ( JingleTransport . RawUdp . NAMESPACE ) ) { currentContent . addJingleTransport ( jtpRawUdp . parse ( parser ) ) ; } else if ( namespace . equals ( JingleTransport . Ice . NAMESPACE ) ) { currentContent . addJingleTransport ( jtpIce . parse ( parser ) ) ; } else { // TODO : Should be SmackParseException .
throw new IOException ( "Unknown transport namespace \"" + namespace + "\" in Jingle packet." ) ; } } else if ( namespace . equals ( JingleContentInfo . Audio . NAMESPACE ) ) { jingle . setContentInfo ( ( JingleContentInfo ) jmipAudio . parse ( parser ) ) ; } else { // TODO : Should be SmackParseException .
throw new IOException ( "Unknown combination of namespace \"" + namespace + "\" and element name \"" + elementName + "\" in Jingle packet." ) ; } } else if ( eventType == XmlPullParser . END_TAG ) { if ( parser . getName ( ) . equals ( Jingle . getElementName ( ) ) ) { done = true ; } } } return jingle ; |
public class techsupport { /** * < pre >
* Use this operation to get technical support file .
* < / pre > */
public static techsupport [ ] get ( nitro_service client ) throws Exception { } } | techsupport resource = new techsupport ( ) ; resource . validate ( "get" ) ; return ( techsupport [ ] ) resource . get_resources ( client ) ; |
public class BigFileSearcher { /** * Optimize threading and memory
* @ param fileLength */
private void optimize ( long fileLength ) { } } | final int availableProcessors = Runtime . getRuntime ( ) . availableProcessors ( ) ; final long free = Runtime . getRuntime ( ) . freeMemory ( ) / 2 ; int workerSize = availableProcessors / 2 ; if ( workerSize < 2 ) { workerSize = 2 ; } long bufferSize = free / workerSize ; if ( bufferSize > 1 * 1024 * 1024 ) { bufferSize = 1 * 1024 * 1024 ; } long blockSize = fileLength / workerSize ; if ( blockSize > 1 * 1024 * 1024 ) { blockSize = 1 * 1024 * 1024 ; } int iBlockSize = ( int ) blockSize ; if ( bufferSize > blockSize ) { bufferSize = blockSize ; } int iBufferSize = ( int ) bufferSize ; this . setBlockSize ( iBlockSize ) ; this . setMaxNumOfThreads ( workerSize ) ; this . setBufferSizePerWorker ( iBufferSize ) ; this . setSubBufferSize ( 256 ) ; |
public class ModuleRenaming { /** * Returns the global name of a variable declared in an ES module . */
static String getGlobalNameOfEsModuleLocalVariable ( ModuleMetadata moduleMetadata , String variableName ) { } } | return variableName + "$$" + getGlobalName ( moduleMetadata , /* googNamespace = */
null ) ; |
public class DescribeCapacityReservationsResult { /** * Information about the Capacity Reservations .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setCapacityReservations ( java . util . Collection ) } or { @ link # withCapacityReservations ( java . util . Collection ) }
* if you want to override the existing values .
* @ param capacityReservations
* Information about the Capacity Reservations .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeCapacityReservationsResult withCapacityReservations ( CapacityReservation ... capacityReservations ) { } } | if ( this . capacityReservations == null ) { setCapacityReservations ( new com . amazonaws . internal . SdkInternalList < CapacityReservation > ( capacityReservations . length ) ) ; } for ( CapacityReservation ele : capacityReservations ) { this . capacityReservations . add ( ele ) ; } return this ; |
public class DurationHelper { /** * Converts a Duration into a formatted String
* @ param duration
* duration , which will be converted into a formatted String
* @ return String in the duration format , specified at
* { @ link # DURATION _ FORMAT } */
public static String durationToFormattedString ( final Duration duration ) { } } | if ( duration == null ) { return null ; } return LocalTime . ofNanoOfDay ( duration . toNanos ( ) ) . format ( DateTimeFormatter . ofPattern ( DURATION_FORMAT ) ) ; |
public class AbstractDirectoryWatchService { /** * Instantiates a new DirectoryWatcher for the path given .
* @ param dir the path to watch for events .
* @ param separator the file path separator for this watcher
* @ return a DirectoryWatcher for this path ( and all child paths )
* @ throws IOException */
public DirectoryWatcher newWatcher ( String dir , String separator ) throws IOException { } } | return newWatcher ( Paths . get ( dir ) , separator ) ; |
public class TextMapper { /** * { @ inheritDoc } */
@ Override public Optional < Field > indexedField ( String name , String value ) { } } | return Optional . of ( new TextField ( name , value , STORE ) ) ; |
public class Record { /** * Get the SQL field string for this table .
* < p > ( ie . , ( SELECT ) ' EmployeeID , EmpName , " Emp Last " , Salary ' )
* ( ie . , ( UPDATE ) ' EmployeeID = 5 , EmpName = ' Fred ' , " Emp Last " = ' Flintstone ' , Salary = null ) .
* @ param iType The sql query type .
* @ param bUseCurrentValues If true , use the current field value , otherwise , use ' ? ' .
* @ return The SQL field list . */
public String getSQLFields ( int iType , boolean bUseCurrentValues ) { } } | String strFields = DBConstants . BLANK ; boolean bAllSelected = this . isAllSelected ( ) ; boolean bIsQueryRecord = this . isQueryRecord ( ) ; if ( iType != DBConstants . SQL_SELECT_TYPE ) bAllSelected = false ; if ( bAllSelected == true ) strFields = " *" ; else { for ( int iFieldSeq = DBConstants . MAIN_FIELD ; iFieldSeq <= this . getFieldCount ( ) + DBConstants . MAIN_FIELD - 1 ; iFieldSeq ++ ) { BaseField field = this . getField ( iFieldSeq ) ; if ( field . getSkipSQLParam ( iType ) ) continue ; // Skip this param
if ( strFields . length ( ) > 0 ) strFields += "," ; String strCompare = null ; if ( bUseCurrentValues == false ) strCompare = "?" ; if ( iType != DBConstants . SQL_INSERT_VALUE_TYPE ) strFields += " " + field . getFieldName ( true , bIsQueryRecord ) ; // Full name if QueryRecord
else // kInsertValueType
strFields += field . getSQLFilter ( "" , strCompare , false ) ; // Full name if QueryRecord
if ( iType == DBConstants . SQL_UPDATE_TYPE ) strFields += field . getSQLFilter ( "=" , strCompare , false ) ; // Full name if QueryRecord
} } return strFields ; |
public class TiffEPProfile { /** * Check a forbidden tag is not present .
* @ param metadata the metadata
* @ param tagName the tag name
* @ param ext string extension */
private void checkForbiddenTag ( IfdTags metadata , String tagName , String ext ) { } } | int tagid = TiffTags . getTagId ( tagName ) ; if ( metadata . containsTagId ( tagid ) ) { validation . addErrorLoc ( "Forbidden tag for TiffEP found " + tagName , ext ) ; } |
public class AbstractJcrNode { /** * Create a new JCR Property instance given the supplied information . Note that this does not alter the node in any way , since
* it does not store a reference to this property ( the caller must do that if needed ) .
* @ param property the cached node property ; may not be null
* @ param primaryTypeName the name of the node ' s primary type ; may not be null
* @ param mixinTypeNames the names of the node ' s mixin types ; may be null or empty
* @ return the JCR Property instance , or null if the property could not be represented with a valid property definition given
* the primary type and mixin types
* @ throws ConstraintViolationException if the property has no valid property definition */
private final AbstractJcrProperty createJcrProperty ( Property property , Name primaryTypeName , Set < Name > mixinTypeNames ) throws ConstraintViolationException { } } | NodeTypes nodeTypes = session . nodeTypes ( ) ; JcrPropertyDefinition defn = propertyDefinitionFor ( property , primaryTypeName , mixinTypeNames , nodeTypes ) ; int jcrPropertyType = defn . getRequiredType ( ) ; jcrPropertyType = determineBestPropertyTypeIfUndefined ( jcrPropertyType , property ) ; AbstractJcrProperty prop = null ; if ( defn . isMultiple ( ) ) { prop = new JcrMultiValueProperty ( this , property . getName ( ) , jcrPropertyType ) ; } else { prop = new JcrSingleValueProperty ( this , property . getName ( ) , jcrPropertyType ) ; } prop . setPropertyDefinitionId ( defn . getId ( ) , nodeTypes . getVersion ( ) ) ; return prop ; |
public class Monitor { /** * Check whether the PID file created by the ES process exists or not .
* @ param baseDir the ES base directory
* @ return true if the process is running , false otherwise */
public static boolean isProcessRunning ( String baseDir ) { } } | File pidFile = new File ( baseDir , "pid" ) ; boolean exists = pidFile . isFile ( ) ; return exists ; |
public class UIStateRegistry { /** * Get the state with the passed ID for the current session . In case the state
* is a { @ link UIStateWrapper } instance , it is returned as is .
* @ param aOT
* Object type
* @ param sStateID
* The state ID to be searched
* @ return the { @ link IHasUIState } for the specified control ID , if already
* registered or < code > null < / code > */
@ Nullable public IHasUIState getState ( @ Nullable final ObjectType aOT , @ Nullable final String sStateID ) { } } | if ( aOT == null ) return null ; if ( StringHelper . hasNoText ( sStateID ) ) return null ; return m_aRWLock . readLocked ( ( ) -> { IHasUIState ret = null ; // Get mapping for requested ObjectType
final Map < String , IHasUIState > aMap = m_aMap . get ( aOT ) ; if ( aMap != null ) { // Lookup control ID for this object type
ret = aMap . get ( sStateID ) ; if ( ret == null ) { // Try regular expressions ( required for auto suggests in ebiz )
for ( final Map . Entry < String , IHasUIState > aEntry : aMap . entrySet ( ) ) if ( RegExHelper . stringMatchesPattern ( aEntry . getKey ( ) , sStateID ) ) { ret = aEntry . getValue ( ) ; break ; } } } return ret ; } ) ; |
public class VirtualMachineScaleSetsInner { /** * Deletes virtual machines in a VM scale set .
* @ param resourceGroupName The name of the resource group .
* @ param vmScaleSetName The name of the VM scale set .
* @ param instanceIds The virtual machine scale set instance ids .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < OperationStatusResponseInner > deleteInstancesAsync ( String resourceGroupName , String vmScaleSetName , List < String > instanceIds , final ServiceCallback < OperationStatusResponseInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( deleteInstancesWithServiceResponseAsync ( resourceGroupName , vmScaleSetName , instanceIds ) , serviceCallback ) ; |
public class StandardKMeans_F64 { /** * Finds the cluster which is the closest to each point . The point is the added to the sum for the cluster
* and its member count incremented */
protected void matchPointsToClusters ( List < double [ ] > points ) { } } | sumDistance = 0 ; for ( int i = 0 ; i < points . size ( ) ; i ++ ) { double [ ] p = points . get ( i ) ; // find the cluster which is closest to the point
int bestCluster = findBestMatch ( p ) ; // sum up all the points which are members of this cluster
double [ ] c = workClusters . get ( bestCluster ) ; for ( int j = 0 ; j < c . length ; j ++ ) { c [ j ] += p [ j ] ; } memberCount . data [ bestCluster ] ++ ; labels . data [ i ] = bestCluster ; sumDistance += bestDistance ; } |
public class WebFragmentDescriptorImpl { /** * Returns all < code > login - config < / code > elements
* @ return list of < code > login - config < / code > */
public List < LoginConfigType < WebFragmentDescriptor > > getAllLoginConfig ( ) { } } | List < LoginConfigType < WebFragmentDescriptor > > list = new ArrayList < LoginConfigType < WebFragmentDescriptor > > ( ) ; List < Node > nodeList = model . get ( "login-config" ) ; for ( Node node : nodeList ) { LoginConfigType < WebFragmentDescriptor > type = new LoginConfigTypeImpl < WebFragmentDescriptor > ( this , "login-config" , model , node ) ; list . add ( type ) ; } return list ; |
public class StubClass { /** * public JournalAmp getJournal ( )
* return _ journal ; */
public void onSave ( StubAmp stub , Result < Void > result ) { } } | try { MethodAmp onDelete = _onDelete ; MethodAmp onSave = _onSave ; if ( stub . state ( ) . isDelete ( ) && onDelete != null ) { onDelete . query ( HeadersNull . NULL , result , stub ) ; } else if ( onSave != null ) { // QueryRefAmp queryRef = new QueryRefChainAmpCompletion ( result ) ;
onSave . query ( HeadersNull . NULL , result , stub ) ; } else { result . ok ( null ) ; } stub . state ( ) . onSaveComplete ( stub ) ; // stub . onSaveEnd ( true ) ;
} catch ( Throwable e ) { e . printStackTrace ( ) ; result . fail ( e ) ; } |
public class DefaultGroovyMethods { /** * A convenience method for creating a synchronized Map .
* @ param self a Map
* @ return a synchronized Map
* @ see java . util . Collections # synchronizedMap ( java . util . Map )
* @ since 1.0 */
public static < K , V > Map < K , V > asSynchronized ( Map < K , V > self ) { } } | return Collections . synchronizedMap ( self ) ; |
public class FbBotMillNetworkController { /** * Method used to retrieve a { @ link FacebookUserProfile } from an ID using
* the GET method .
* @ param userId
* the ID of the user to retrieve .
* @ return the user profile info . */
public static FacebookUserProfile getUserProfile ( String userId ) { } } | String pageToken = FbBotMillContext . getInstance ( ) . getPageToken ( ) ; BotMillNetworkResponse response = NetworkUtils . get ( FbBotMillNetworkConstants . FACEBOOK_BASE_URL + userId + FbBotMillNetworkConstants . USER_PROFILE_FIELDS + pageToken ) ; FacebookUserProfile user = FbBotMillJsonUtils . fromJson ( response . getResponse ( ) , FacebookUserProfile . class ) ; return user ; |
public class MtasSolrComponentCollection { /** * ( non - Javadoc )
* @ see
* mtas . solr . handler . component . util . MtasSolrComponent # modifyRequest ( org . apache
* . solr . handler . component . ResponseBuilder ,
* org . apache . solr . handler . component . SearchComponent ,
* org . apache . solr . handler . component . ShardRequest ) */
public void modifyRequest ( ResponseBuilder rb , SearchComponent who , ShardRequest sreq ) { } } | // System . out . println (
// " collection : " + System . nanoTime ( ) + " - " +
// Thread . currentThread ( ) . getId ( )
// + " - " + rb . req . getParams ( ) . getBool ( " isShard " , false )
// + " MODIFYREQUEST " + rb . stage + " " + rb . req . getParamString ( ) ) ;
if ( sreq . params . getBool ( MtasSolrSearchComponent . PARAM_MTAS , false ) && sreq . params . getBool ( PARAM_MTAS_COLLECTION , false ) ) { if ( ( sreq . purpose & ShardRequest . PURPOSE_GET_TOP_IDS ) != 0 ) { // do nothing
} else { // remove for other requests
Set < String > keys = MtasSolrResultUtil . getIdsFromParameters ( rb . req . getParams ( ) , PARAM_MTAS_COLLECTION ) ; sreq . params . remove ( PARAM_MTAS_COLLECTION ) ; for ( String key : keys ) { sreq . params . remove ( PARAM_MTAS_COLLECTION + "." + key + "." + NAME_MTAS_COLLECTION_ACTION ) ; sreq . params . remove ( PARAM_MTAS_COLLECTION + "." + key + "." + NAME_MTAS_COLLECTION_ID ) ; sreq . params . remove ( PARAM_MTAS_COLLECTION + "." + key + "." + NAME_MTAS_COLLECTION_FIELD ) ; sreq . params . remove ( PARAM_MTAS_COLLECTION + "." + key + "." + NAME_MTAS_COLLECTION_POST ) ; sreq . params . remove ( PARAM_MTAS_COLLECTION + "." + key + "." + NAME_MTAS_COLLECTION_KEY ) ; sreq . params . remove ( PARAM_MTAS_COLLECTION + "." + key + "." + NAME_MTAS_COLLECTION_URL ) ; sreq . params . remove ( PARAM_MTAS_COLLECTION + "." + key + "." + NAME_MTAS_COLLECTION_COLLECTION ) ; } } } |
public class MutatorImpl { /** * Schedule an insertion of a supercolumn to be inserted in batch mode by { @ link # execute ( ) } */
@ Override public < SN , N , V > Mutator < K > addInsertion ( K key , String cf , HSuperColumn < SN , N , V > sc ) { } } | getPendingMutations ( ) . addSuperInsertion ( key , Arrays . asList ( cf ) , ( ( HSuperColumnImpl < SN , N , V > ) sc ) . toThrift ( ) ) ; return this ; |
public class NumberPath { /** * Method to construct the between expression for short
* @ param startValue the start value
* @ param endValue the end value
* @ return Expression */
public Expression < Short > between ( Short startValue , Short endValue ) { } } | String valueString = "'" + startValue + "' AND '" + endValue + "'" ; return new Expression < Short > ( this , Operation . between , valueString ) ; |
public class Parser { /** * mul : = unary ( & lt ; MUL & gt ; unary | & lt ; DIV & gt ; unary | & lt ; MOD & gt ; unary ) * */
protected AstNode mul ( boolean required ) throws ScanException , ParseException { } } | AstNode v = unary ( required ) ; if ( v == null ) { return null ; } while ( true ) { switch ( token . getSymbol ( ) ) { case MUL : consumeToken ( ) ; v = createAstBinary ( v , unary ( true ) , AstBinary . MUL ) ; break ; case DIV : consumeToken ( ) ; v = createAstBinary ( v , unary ( true ) , AstBinary . DIV ) ; break ; case MOD : consumeToken ( ) ; v = createAstBinary ( v , unary ( true ) , AstBinary . MOD ) ; break ; case EXTENSION : if ( getExtensionHandler ( token ) . getExtensionPoint ( ) == ExtensionPoint . MUL ) { v = getExtensionHandler ( consumeToken ( ) ) . createAstNode ( v , unary ( true ) ) ; break ; } default : return v ; } } |
public class CompletableFuture { /** * Recursively constructs a tree of completions . */
static CompletableFuture < Object > orTree ( CompletableFuture < ? > [ ] cfs , int lo , int hi ) { } } | CompletableFuture < Object > d = new CompletableFuture < Object > ( ) ; if ( lo <= hi ) { CompletableFuture < ? > a , b ; int mid = ( lo + hi ) >>> 1 ; if ( ( a = ( lo == mid ? cfs [ lo ] : orTree ( cfs , lo , mid ) ) ) == null || ( b = ( lo == hi ? a : ( hi == mid + 1 ) ? cfs [ hi ] : orTree ( cfs , mid + 1 , hi ) ) ) == null ) throw new NullPointerException ( ) ; if ( ! d . orRelay ( a , b ) ) { OrRelay < ? , ? > c = new OrRelay < > ( d , a , b ) ; a . orpush ( b , c ) ; c . tryFire ( SYNC ) ; } } return d ; |
public class TwitterObjectFactory { /** * Constructs a SavedSearch object from rawJSON string .
* @ param rawJSON raw JSON form as String
* @ return SavedSearch
* @ throws TwitterException when provided string is not a valid JSON string .
* @ since Twitter4J 2.1.7 */
public static SavedSearch createSavedSearch ( String rawJSON ) throws TwitterException { } } | try { return new SavedSearchJSONImpl ( new JSONObject ( rawJSON ) ) ; } catch ( JSONException e ) { throw new TwitterException ( e ) ; } |
public class H2O { /** * Get the number of milliseconds the H2O cluster has been idle .
* @ return milliseconds since the last interesting thing happened . */
public static long getIdleTimeMillis ( ) { } } | long latestEndTimeMillis = - 1 ; // If there are any running rapids queries , consider that not idle .
if ( activeRapidsExecs . get ( ) > 0 ) { updateNotIdle ( ) ; } else { // If there are any running jobs , consider that not idle .
// Remember the latest job ending time as well .
Job [ ] jobs = Job . jobs ( ) ; for ( int i = jobs . length - 1 ; i >= 0 ; i -- ) { Job j = jobs [ i ] ; if ( j . isRunning ( ) ) { updateNotIdle ( ) ; break ; } if ( j . end_time ( ) > latestEndTimeMillis ) { latestEndTimeMillis = j . end_time ( ) ; } } } long latestTimeMillis = Math . max ( latestEndTimeMillis , lastTimeSomethingHappenedMillis ) ; // Calculate milliseconds and clamp at zero .
long now = System . currentTimeMillis ( ) ; long deltaMillis = now - latestTimeMillis ; if ( deltaMillis < 0 ) { deltaMillis = 0 ; } return deltaMillis ; |
public class GVRConsole { /** * Sets the width and height of the canvas the text is drawn to .
* @ param width
* width of the new canvas .
* @ param height
* hegiht of the new canvas . */
public void setCanvasWidthHeight ( int width , int height ) { } } | hudWidth = width ; hudHeight = height ; HUD = Bitmap . createBitmap ( width , height , Config . ARGB_8888 ) ; canvas = new Canvas ( HUD ) ; texture = null ; |
public class WebSocketClient { /** * Close down the socket . Will trigger the onClose handler if the socket has not been previously closed . */
public synchronized void close ( ) { } } | switch ( state ) { case NONE : state = State . DISCONNECTED ; return ; case CONNECTING : // don ' t wait for an established connection , just close the tcp socket
closeSocket ( ) ; return ; case CONNECTED : // This method also shuts down the writer
// the socket will be closed once the ack for the close was received
sendCloseHandshake ( true ) ; return ; case DISCONNECTING : return ; // no - op ;
case DISCONNECTED : return ; // No - op
} |
public class FormatImplBase { /** * Returns whether { @ code flags } contains { @ code flag } .
* @ param flag
* @ param flags
* @ return whether { @ code flags } contains { @ code flag } . */
protected boolean containsFlag ( final char flag , final String flags ) { } } | if ( flags == null ) return false ; return flags . indexOf ( flag ) >= 0 ; |
public class DescribeAffectedEntitiesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeAffectedEntitiesRequest describeAffectedEntitiesRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeAffectedEntitiesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeAffectedEntitiesRequest . getFilter ( ) , FILTER_BINDING ) ; protocolMarshaller . marshall ( describeAffectedEntitiesRequest . getLocale ( ) , LOCALE_BINDING ) ; protocolMarshaller . marshall ( describeAffectedEntitiesRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( describeAffectedEntitiesRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ModuleDeps { /** * Adds the specified pair to the map . If an entry for the key exists , then
* the specified module dep info is added to the existing module dep info .
* @ param key
* The module name to associate with the dep info object
* @ param info
* the ModuleDepInfo object
* @ return true if the map was modified */
public boolean add ( String key , ModuleDepInfo info ) { } } | if ( info == null ) { throw new NullPointerException ( ) ; } boolean modified = false ; ModuleDepInfo existing = get ( key ) ; if ( ! containsKey ( key ) || existing != info ) { if ( existing != null ) { modified = existing . add ( info ) ; } else { super . put ( key , info ) ; modified = true ; } } return modified ; |
public class DomImplIE { /** * Only very limited support for transformations , so { @ link # supportsTransformations ( ) } still returns false .
* @ param element
* @ param transform */
public void setTransform ( Element element , String transform ) { } } | if ( transform . contains ( "scale" ) ) { try { String scaleValue = transform . substring ( transform . indexOf ( "scale(" ) + 6 ) ; scaleValue = scaleValue . substring ( 0 , scaleValue . indexOf ( ")" ) ) ; Dom . setStyleAttribute ( element , "zoom" , scaleValue ) ; } catch ( Exception e ) { } } |
public class StringUtility { /** * @ deprecated Please use SQLUtility . getDateTime ( long )
* @ see SQLUtility # getDateTime ( long ) */
@ Deprecated public static String getDateStringSecond ( long time ) { } } | Date date = new Date ( time ) ; Calendar C = Calendar . getInstance ( ) ; C . setTime ( date ) ; int day = C . get ( Calendar . DATE ) ; int hour = C . get ( Calendar . HOUR_OF_DAY ) ; int minute = C . get ( Calendar . MINUTE ) ; int second = C . get ( Calendar . SECOND ) ; return ( day >= 0 && day <= 9 ? "0" : "" ) + day + MONTHS [ C . get ( Calendar . MONTH ) ] + C . get ( Calendar . YEAR ) + ' ' + ( hour >= 0 && hour <= 9 ? "0" : "" ) + hour + ':' + ( minute >= 0 && minute <= 9 ? "0" : "" ) + minute + ':' + ( second >= 0 && second <= 9 ? "0" : "" ) + second ; |
public class ButtonUtil { /** * Binds the supplied button to the named boolean property in the supplied config repository .
* When the button is pressed , it will update the config property and when the config property
* is changed ( by the button or by other means ) it will update the selected state of the
* button . When the button is made non - visible , it will be unbound to the config ' s property and
* rebound again if it is once again visible . */
public static void bindToProperty ( String property , PrefsConfig config , AbstractButton button , boolean defval ) { } } | // create a config binding which will take care of everything
new ButtonConfigBinding ( property , config , button , defval ) ; |
public class DatastoreXmlExternalizer { /** * Externalizes the given datastore
* @ param datastore
* @ return
* @ throws UnsupportedOperationException */
public Element externalize ( Datastore datastore ) throws UnsupportedOperationException { } } | if ( datastore == null ) { throw new IllegalArgumentException ( "Datastore cannot be null" ) ; } final Element elem ; if ( datastore instanceof CsvDatastore ) { final Resource resource = ( ( CsvDatastore ) datastore ) . getResource ( ) ; final String filename = toFilename ( resource ) ; elem = toElement ( ( CsvDatastore ) datastore , filename ) ; } else if ( datastore instanceof ExcelDatastore ) { final Resource resource = ( ( ExcelDatastore ) datastore ) . getResource ( ) ; final String filename = toFilename ( resource ) ; elem = toElement ( ( ExcelDatastore ) datastore , filename ) ; } else if ( datastore instanceof JdbcDatastore ) { elem = toElement ( ( JdbcDatastore ) datastore ) ; } else { throw new UnsupportedOperationException ( "Non-supported datastore: " + datastore ) ; } final Element datastoreCatalogElement = getDatastoreCatalogElement ( ) ; datastoreCatalogElement . appendChild ( elem ) ; onDocumentChanged ( getDocument ( ) ) ; return elem ; |
public class LogBuffer { /** * Return 48 - bit unsigned long from buffer . ( big - endian )
* @ see mysql - 5.6.10 / include / myisampack . h - mi _ uint6korr */
public final long getBeUlong48 ( final int pos ) { } } | final int position = origin + pos ; if ( pos + 5 >= limit || pos < 0 ) throw new IllegalArgumentException ( "limit excceed: " + ( pos < 0 ? pos : ( pos + 5 ) ) ) ; byte [ ] buf = buffer ; return ( ( long ) ( 0xff & buf [ position + 5 ] ) ) | ( ( long ) ( 0xff & buf [ position + 4 ] ) << 8 ) | ( ( long ) ( 0xff & buf [ position + 3 ] ) << 16 ) | ( ( long ) ( 0xff & buf [ position + 2 ] ) << 24 ) | ( ( long ) ( 0xff & buf [ position + 1 ] ) << 32 ) | ( ( long ) ( 0xff & buf [ position ] ) << 40 ) ; |
public class CasResolveAttributesReportEndpoint { /** * Resolve principal attributes map .
* @ param uid the uid
* @ return the map */
@ ReadOperation public Map < String , Object > resolvePrincipalAttributes ( @ Selector final String uid ) { } } | val p = defaultPrincipalResolver . resolve ( new BasicIdentifiableCredential ( uid ) ) ; val map = new HashMap < String , Object > ( ) ; map . put ( "uid" , p . getId ( ) ) ; map . put ( "attributes" , p . getAttributes ( ) ) ; return map ; |
public class KafkaTransporter { /** * - - - CONNECT - - - */
@ Override public void connect ( ) { } } | try { // Create Kafka clients
disconnect ( ) ; StringBuilder urlList = new StringBuilder ( 128 ) ; for ( String url : urls ) { if ( urlList . length ( ) > 0 ) { urlList . append ( ',' ) ; } // Add default port
if ( url . indexOf ( ':' ) == - 1 ) { url = url + ":9092" ; } // Remove protocol prefix ( " tcp : / / 127.0.0.0 " )
int i = url . indexOf ( "://" ) ; if ( i > - 1 && i < url . length ( ) - 4 ) { url = url . substring ( i + 3 ) ; } urlList . append ( url ) ; } producerProperties . put ( "bootstrap.servers" , urlList . toString ( ) ) ; consumerProperties . put ( "bootstrap.servers" , urlList . toString ( ) ) ; // Set unique " node ID " as Kafka " group ID "
consumerProperties . setProperty ( "group.id" , nodeID ) ; // Create producer
ByteArraySerializer byteArraySerializer = new ByteArraySerializer ( ) ; producer = new KafkaProducer < > ( producerProperties , byteArraySerializer , byteArraySerializer ) ; // Start reader loop
poller = new KafkaPoller ( this ) ; executor = Executors . newSingleThreadExecutor ( ) ; executor . execute ( poller ) ; // Start subscribing channels . . .
connected ( ) ; } catch ( Exception cause ) { reconnect ( cause ) ; } |
public class WorkbenchPanel { /** * This method initializes paneSelect
* @ return JPanel */
private JPanel getPaneSelect ( ) { } } | if ( paneSelect == null ) { paneSelect = new JPanel ( ) ; paneSelect . setLayout ( new BorderLayout ( 0 , 0 ) ) ; paneSelect . setBorder ( BorderFactory . createEmptyBorder ( 0 , 0 , 0 , 0 ) ) ; paneSelect . add ( getTabbedSelect ( ) ) ; } return paneSelect ; |
public class SpaceUtil { /** * Convert a size back to a representative int . For testing only during conversion of int spaces to Size spaces .
* @ param size the Size to convert
* @ return an int representative of the Size */
@ Deprecated public static int sizeToInt ( final Size size ) { } } | if ( size == null ) { return - 1 ; } switch ( size ) { case ZERO : return 0 ; case SMALL : return MAX_SMALL ; case MEDIUM : return MAX_MED ; case LARGE : return MAX_LARGE ; default : return COMMON_XL ; } |
public class BitmapCounter { /** * Excludes given bitmap from the count .
* @ param bitmap to be excluded from the count */
public synchronized void decrease ( Bitmap bitmap ) { } } | final int bitmapSize = BitmapUtil . getSizeInBytes ( bitmap ) ; Preconditions . checkArgument ( mCount > 0 , "No bitmaps registered." ) ; Preconditions . checkArgument ( bitmapSize <= mSize , "Bitmap size bigger than the total registered size: %d, %d" , bitmapSize , mSize ) ; mSize -= bitmapSize ; mCount -- ; |
public class JsiiClient { /** * Loads a JavaScript module into the remote sandbox .
* @ param module The module to load */
public void loadModule ( final JsiiModule module ) { } } | try { String tarball = extractResource ( module . getModuleClass ( ) , module . getBundleResourceName ( ) , null ) ; ObjectNode req = makeRequest ( "load" ) ; req . put ( "tarball" , tarball ) ; req . put ( "name" , module . getModuleName ( ) ) ; req . put ( "version" , module . getModuleVersion ( ) ) ; this . runtime . requestResponse ( req ) ; } catch ( IOException e ) { throw new JsiiException ( "Unable to extract resource " + module . getBundleResourceName ( ) , e ) ; } |
public class CharSequenceScanner { /** * This method peeks the number of { @ link # peek ( ) next characters } given by { @ code count } and returns them
* as string . If there are less characters { @ link # hasNext ( ) available } the returned string will be shorter
* than { @ code count } and only contain the available characters . Unlike { @ link # read ( int ) } this method does
* NOT consume the characters and will therefore NOT change the state of this scanner .
* @ param count is the number of characters to peek . You may use { @ link Integer # MAX _ VALUE } to peek until the
* end of text ( EOT ) if the data - size is suitable .
* @ return a string with the given number of characters or all available characters if less than
* { @ code count } . Will be the empty string if no character is { @ link # hasNext ( ) available } at all .
* @ since 3.0.0 */
public String peek ( int count ) { } } | int len = this . limit - this . offset ; if ( len > count ) { len = count ; } String result = new String ( this . buffer , this . offset , len ) ; return result ; |
public class SuspiciousLoopSearch { /** * implements the visitor to find continuations after finding a search result in a loop .
* @ param seen
* the currently visitor opcode */
@ Override public void sawOpcode ( int seen ) { } } | try { switch ( state ) { case SAW_NOTHING : sawOpcodeAfterNothing ( seen ) ; break ; case SAW_EQUALS : sawOpcodeAfterEquals ( seen ) ; break ; case SAW_IFEQ : sawOpcodeAfterBranch ( seen ) ; break ; } processLoad ( seen ) ; processLoop ( seen ) ; } finally { stack . sawOpcode ( this , seen ) ; } |
public class TransformerHandlerImpl { /** * Report an XML comment anywhere in the document .
* < p > This callback will be used for comments inside or outside the
* document element , including comments in the external DTD
* subset ( if read ) . < / p >
* @ param ch An array holding the characters in the comment .
* @ param start The starting position in the array .
* @ param length The number of characters to use from the array .
* @ throws SAXException The application may raise an exception . */
public void comment ( char ch [ ] , int start , int length ) throws SAXException { } } | if ( DEBUG ) System . out . println ( "TransformerHandlerImpl#comment: " + start + ", " + length ) ; if ( null != m_lexicalHandler ) { m_lexicalHandler . comment ( ch , start , length ) ; } |
public class JDBCMBeanRuntime { /** * DS method to activate this component .
* Best practice : this should be a protected method , not public or private
* @ param properties : Map containing service & config properties
* populated / provided by config admin */
@ Activate protected void activate ( Map < String , Object > properties ) { } } | final String methodName = "activate" ; final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( tc , methodName , "Entry Count: " + ++ JDBCMBeanRuntime . counterActivate ) ; if ( trace && tc . isEventEnabled ( ) ) Tr . event ( tc , className + methodName , properties ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( tc , methodName , "Normal Exit" ) ; |
public class Collections { /** * Rotates the elements in the specified list by the specified distance .
* After calling this method , the element at index < tt > i < / tt > will be
* the element previously at index < tt > ( i - distance ) < / tt > mod
* < tt > list . size ( ) < / tt > , for all values of < tt > i < / tt > between < tt > 0 < / tt >
* and < tt > list . size ( ) - 1 < / tt > , inclusive . ( This method has no effect on
* the size of the list . )
* < p > For example , suppose < tt > list < / tt > comprises < tt > [ t , a , n , k , s ] < / tt > .
* After invoking < tt > Collections . rotate ( list , 1 ) < / tt > ( or
* < tt > Collections . rotate ( list , - 4 ) < / tt > ) , < tt > list < / tt > will comprise
* < tt > [ s , t , a , n , k ] < / tt > .
* < p > Note that this method can usefully be applied to sublists to
* move one or more elements within a list while preserving the
* order of the remaining elements . For example , the following idiom
* moves the element at index < tt > j < / tt > forward to position
* < tt > k < / tt > ( which must be greater than or equal to < tt > j < / tt > ) :
* < pre >
* Collections . rotate ( list . subList ( j , k + 1 ) , - 1 ) ;
* < / pre >
* To make this concrete , suppose < tt > list < / tt > comprises
* < tt > [ a , b , c , d , e ] < / tt > . To move the element at index < tt > 1 < / tt >
* ( < tt > b < / tt > ) forward two positions , perform the following invocation :
* < pre >
* Collections . rotate ( l . subList ( 1 , 4 ) , - 1 ) ;
* < / pre >
* The resulting list is < tt > [ a , c , d , b , e ] < / tt > .
* < p > To move more than one element forward , increase the absolute value
* of the rotation distance . To move elements backward , use a positive
* shift distance .
* < p > If the specified list is small or implements the { @ link
* RandomAccess } interface , this implementation exchanges the first
* element into the location it should go , and then repeatedly exchanges
* the displaced element into the location it should go until a displaced
* element is swapped into the first element . If necessary , the process
* is repeated on the second and successive elements , until the rotation
* is complete . If the specified list is large and doesn ' t implement the
* < tt > RandomAccess < / tt > interface , this implementation breaks the
* list into two sublist views around index < tt > - distance mod size < / tt > .
* Then the { @ link # reverse ( List ) } method is invoked on each sublist view ,
* and finally it is invoked on the entire list . For a more complete
* description of both algorithms , see Section 2.3 of Jon Bentley ' s
* < i > Programming Pearls < / i > ( Addison - Wesley , 1986 ) .
* @ param list the list to be rotated .
* @ param distance the distance to rotate the list . There are no
* constraints on this value ; it may be zero , negative , or
* greater than < tt > list . size ( ) < / tt > .
* @ throws UnsupportedOperationException if the specified list or
* its list - iterator does not support the < tt > set < / tt > operation .
* @ since 1.4 */
public static void rotate ( List < ? > list , int distance ) { } } | if ( list instanceof RandomAccess || list . size ( ) < ROTATE_THRESHOLD ) rotate1 ( list , distance ) ; else rotate2 ( list , distance ) ; |
public class TmpfsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Tmpfs tmpfs , ProtocolMarshaller protocolMarshaller ) { } } | if ( tmpfs == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( tmpfs . getContainerPath ( ) , CONTAINERPATH_BINDING ) ; protocolMarshaller . marshall ( tmpfs . getSize ( ) , SIZE_BINDING ) ; protocolMarshaller . marshall ( tmpfs . getMountOptions ( ) , MOUNTOPTIONS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class LineOptions { /** * Get a list of LatLng for the line , which represents the locations of the line on the map
* @ return a list of the locations of the line in a longitude and latitude pairs */
public List < LatLng > getLatLngs ( ) { } } | List < LatLng > latLngs = new ArrayList < > ( ) ; if ( geometry != null ) { for ( Point coordinate : geometry . coordinates ( ) ) { latLngs . add ( new LatLng ( coordinate . latitude ( ) , coordinate . longitude ( ) ) ) ; } } return latLngs ; |
public class AbstractFileServlet { /** * Returns the mime - type associated with given URI or path */
static String _getMimeType ( String uriOrPath ) { } } | String mime = MIME_MAP . get ( __getExtension ( uriOrPath ) ) ; if ( mime == null ) { mime = DEFAULT_MIME ; } return mime ; |
public class FaunusPipeline { /** * Emit the current element it has a property value equal within the provided range .
* @ param key the property key of the element
* @ param startValue the start of the range ( inclusive )
* @ param endValue the end of the range ( exclusive )
* @ return the extended FaunusPipeline */
public FaunusPipeline interval ( final String key , final Object startValue , final Object endValue ) { } } | this . state . assertNotLocked ( ) ; this . state . assertNoProperty ( ) ; this . compiler . addMap ( IntervalFilterMap . Map . class , NullWritable . class , FaunusVertex . class , IntervalFilterMap . createConfiguration ( this . state . getElementType ( ) , key , startValue , endValue ) ) ; makeMapReduceString ( IntervalFilterMap . class , key , startValue , endValue ) ; return this ; |
public class FunctionToConverterAdapter { /** * Factory method used to construct an instance of the { @ link FunctionToConverterAdapter } initialized
* with the required { @ link Function } to adapt into an instance of the { @ link Converter } interface
* to be used on data conversions .
* @ param < T > { @ link Class type } of the { @ link Object value } to convert from .
* @ param < R > { @ link Class type } of the { @ link Object value } to convert to .
* @ param function { @ link Function } to adapt into an instance of { @ link Converter } ; must not be { @ literal null } .
* @ return an instance of { @ link FunctionToConverterAdapter } adapting the given { @ link Function } .
* @ throws IllegalArgumentException if { @ link Function } is { @ literal null } .
* @ see # FunctionToConverterAdapter ( Function )
* @ see java . util . function . Function */
public static < T , R > FunctionToConverterAdapter < T , R > of ( Function < T , R > function ) { } } | return new FunctionToConverterAdapter < > ( function ) ; |
public class ScanParams { /** * @ see < a href = " https : / / redis . io / commands / scan # the - match - option " > MATCH option in Redis documentation < / a >
* @ param pattern
* @ return */
public ScanParams match ( final String pattern ) { } } | params . put ( MATCH , ByteBuffer . wrap ( SafeEncoder . encode ( pattern ) ) ) ; return this ; |
public class JspCompilationContext { /** * Just the class name ( does not include package name ) of the
* generated class .
* @ return the class name */
public String getServletClassName ( ) { } } | if ( className != null ) { return className ; } if ( isTagFile ) { className = tagInfo . getTagClassName ( ) ; int lastIndex = className . lastIndexOf ( '.' ) ; if ( lastIndex != - 1 ) { className = className . substring ( lastIndex + 1 ) ; } } else { int iSep = jspUri . lastIndexOf ( '/' ) + 1 ; className = JspUtil . makeJavaIdentifier ( jspUri . substring ( iSep ) ) ; } return className ; |
public class Table { /** * Moves contents of matrix num _ rows down . Avoids a System . arraycopy ( ) . Caller must hold the lock . */
@ GuardedBy ( "lock" ) protected void move ( int num_rows ) { } } | if ( num_rows <= 0 || num_rows > matrix . length ) return ; int target_index = 0 ; for ( int i = num_rows ; i < matrix . length ; i ++ ) matrix [ target_index ++ ] = matrix [ i ] ; for ( int i = matrix . length - num_rows ; i < matrix . length ; i ++ ) matrix [ i ] = null ; num_moves ++ ; |
public class DescribeVolumeStatusRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < DescribeVolumeStatusRequest > getDryRunRequest ( ) { } } | Request < DescribeVolumeStatusRequest > request = new DescribeVolumeStatusRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class ScriptRuntime { /** * Perform function call in reference context . Should always
* return value that can be passed to
* { @ link # refGet ( Ref , Context ) } or { @ link # refSet ( Ref , Object , Context ) }
* arbitrary number of times .
* The args array reference should not be stored in any object that is
* can be GC - reachable after this method returns . If this is necessary ,
* store args . clone ( ) , not args array itself . */
public static Ref callRef ( Callable function , Scriptable thisObj , Object [ ] args , Context cx ) { } } | if ( function instanceof RefCallable ) { RefCallable rfunction = ( RefCallable ) function ; Ref ref = rfunction . refCall ( cx , thisObj , args ) ; if ( ref == null ) { throw new IllegalStateException ( rfunction . getClass ( ) . getName ( ) + ".refCall() returned null" ) ; } return ref ; } // No runtime support for now
String msg = getMessage1 ( "msg.no.ref.from.function" , toString ( function ) ) ; throw constructError ( "ReferenceError" , msg ) ; |
public class XmlBeanAssert { /** * Asserts that two XmlBeans are equivalent based on a deep compare ( ignoring
* whitespace and ordering of element attributes ) . If the two XmlBeans are
* not equivalent , an AssertionFailedError is thrown , failing the test case .
* Note : we can ' t provide line numbers since XmlBeans only makes these available
* if we ' re using the Picollo parser . We ' ll get line numbers when we upgrade to
* XmlBeans 2.0.
* @ param message to display on test failure ( may be null )
* @ param expected
* @ param actual */
public static void assertEquals ( String message , XmlObject expected , XmlObject actual ) { } } | assertEquals ( message , expected . newCursor ( ) , actual . newCursor ( ) ) ; |
public class SetupNewUserHandler { /** * Called when a change is the record status is about to happen / has happened .
* @ param field If this file change is due to a field , this is the field .
* @ param iChangeType The type of change that occurred .
* @ param bDisplayOption If true , display any changes .
* @ return an error code .
* ADD _ TYPE - Before a write .
* UPDATE _ TYPE - Before an update .
* DELETE _ TYPE - Before a delete .
* AFTER _ UPDATE _ TYPE - After a write or update .
* LOCK _ TYPE - Before a lock .
* SELECT _ TYPE - After a select .
* DESELECT _ TYPE - After a deselect .
* MOVE _ NEXT _ TYPE - After a move .
* AFTER _ REQUERY _ TYPE - Record opened .
* SELECT _ EOF _ TYPE - EOF Hit . */
public int doRecordChange ( FieldInfo field , int iChangeType , boolean bDisplayOption ) { } } | if ( iChangeType == DBConstants . AFTER_ADD_TYPE ) { UserInfo userTemplate = this . getUserTemplate ( ) ; if ( userTemplate != null ) { Record userInfo = this . getOwner ( ) ; Object bookmark = userInfo . getLastModified ( DBConstants . BOOKMARK_HANDLE ) ; RecordOwner recordOwner = this . getOwner ( ) . findRecordOwner ( ) ; UserRegistration userRegistration = new UserRegistration ( recordOwner ) ; UserRegistration newUserRegistration = new UserRegistration ( recordOwner ) ; userRegistration . addListener ( new SubFileFilter ( userTemplate ) ) ; try { while ( userRegistration . hasNext ( ) ) { userRegistration . next ( ) ; newUserRegistration . addNew ( ) ; newUserRegistration . moveFields ( userRegistration , null , bDisplayOption , DBConstants . INIT_MOVE , true , false , false , false ) ; newUserRegistration . getField ( UserRegistration . ID ) . initField ( bDisplayOption ) ; newUserRegistration . getField ( UserRegistration . USER_ID ) . setData ( bookmark ) ; newUserRegistration . add ( ) ; } } catch ( DBException e ) { e . printStackTrace ( ) ; } } } return super . doRecordChange ( field , iChangeType , bDisplayOption ) ; |
public class BundleList { /** * ignore the NumberFormatException as we deal with it . */
@ FFDCIgnore ( NumberFormatException . class ) private void readWriteTimeAndJavaSpecVersion ( WsResource res , String line ) { } } | int timeIndex = line . indexOf ( '=' ) ; int javaSpecVersionIndex = timeIndex >= 0 ? line . indexOf ( ';' , timeIndex ) : - 1 ; if ( timeIndex != - 1 ) { try { String sTime = javaSpecVersionIndex > timeIndex ? line . substring ( timeIndex + 1 , javaSpecVersionIndex ) : line . substring ( timeIndex + 1 ) ; writeTime = Long . parseLong ( sTime ) ; if ( javaSpecVersionIndex != - 1 ) { javaSpecVersion = Integer . valueOf ( line . substring ( javaSpecVersionIndex + 1 ) ) ; } } catch ( NumberFormatException nfe ) { } } if ( writeTime <= 0 ) { writeTime = res . getLastModified ( ) ; } |
public class TimerNpImpl { /** * Get a serializable handle to the timer . This handle can be used at
* a later time to re - obtain the timer reference . < p >
* This method is intended for use by the Stateful passivation code , when
* a Stateful EJB is being passivated , and contains a Timer ( not a
* TimerHanle ) . < p >
* This method differs from { @ link # getHandle } in that it performs none
* of the checking required by the EJB Specification , such as if the Timer
* is still valid . When passivating a Stateful EJB , none of this checking
* should be performed . < p >
* Also , this method ' marks ' the returned TimerHandle , so that it will
* be replaced by the represented Timer when read from a stream .
* See { @ link com . ibm . ejs . container . passivator . StatefulPassivator } < p >
* @ return A serializable handle to the timer . */
@ Override public PassivatorSerializableHandle getSerializableObject ( ) { } } | TimerNpHandleImpl timerHandle ; timerHandle = new TimerNpHandleImpl ( ivBeanId , ivTaskId ) ; // F743-425 . CodRev
return timerHandle ; |
public class HeaderPacket { /** * little - endian byte order */
public byte [ ] toBytes ( ) { } } | byte [ ] data = new byte [ 4 ] ; data [ 0 ] = ( byte ) ( packetBodyLength & 0xFF ) ; data [ 1 ] = ( byte ) ( packetBodyLength >>> 8 ) ; data [ 2 ] = ( byte ) ( packetBodyLength >>> 16 ) ; data [ 3 ] = getPacketSequenceNumber ( ) ; return data ; |
public class DB { /** * Creates a term .
* @ param name The term name .
* @ param slug The term slug .
* @ return The created term .
* @ throws SQLException on database error . */
public Term createTerm ( final String name , final String slug ) throws SQLException { } } | Connection conn = null ; PreparedStatement stmt = null ; ResultSet rs = null ; Timer . Context ctx = metrics . createTermTimer . time ( ) ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( insertTermSQL , Statement . RETURN_GENERATED_KEYS ) ; stmt . setString ( 1 , name ) ; stmt . setString ( 2 , slug ) ; stmt . executeUpdate ( ) ; rs = stmt . getGeneratedKeys ( ) ; if ( rs . next ( ) ) { return new Term ( rs . getLong ( 1 ) , name , slug ) ; } else { throw new SQLException ( "Problem creating term (no generated id)" ) ; } } finally { ctx . stop ( ) ; closeQuietly ( conn , stmt , rs ) ; } |
public class StringConcatenation { /** * Append the contents of a given StringConcatenationClient to this sequence . Does nothing
* if the argument is < code > null < / code > .
* @ param client
* the to - be - appended StringConcatenationClient .
* @ since 2.11 */
public void append ( StringConcatenationClient client ) { } } | if ( client != null ) client . appendTo ( new SimpleTarget ( this , segments . size ( ) ) ) ; |
public class CapabilityUtils { /** * CHECKSTYLE IGNORE ParameterNumber FOR NEXT 1 LINES */
public static GlobalDiscoveryEntry newGlobalDiscoveryEntry ( Version providerVesion , String domain , String interfaceName , String participantId , ProviderQos qos , Long lastSeenDateMs , Long expiryDateMs , String publicKeyId , Address address ) { } } | // CHECKSTYLE ON
return new GlobalDiscoveryEntry ( providerVesion , domain , interfaceName , participantId , qos , lastSeenDateMs , expiryDateMs , publicKeyId , serializeAddress ( address ) ) ; |
public class BooleanField { /** * Convert this field ' s binary data to a string .
* @ param tempBinary The physical data convert to a string ( must be the raw data class ) .
* @ return A display string representing this binary data . */
public Object stringToBinary ( String tempString ) throws Exception { } } | Boolean bFlag = Boolean . FALSE ; if ( ( tempString == null ) || ( tempString . length ( ) == 0 ) ) return null ; if ( ( tempString . charAt ( 0 ) == 'Y' ) || ( tempString . charAt ( 0 ) == 'y' ) || ( tempString . charAt ( 0 ) == '1' ) ) bFlag = Boolean . TRUE ; return bFlag ; |
public class AmqpClient { /** * Closes the Amqp Server connection .
* @ param replyCode
* @ param replyText
* @ param classId
* @ param methodId1
* @ return AmqpClient */
AmqpClient closeConnection ( int replyCode , String replyText , int classId , int methodId1 ) { } } | this . closeConnection ( replyCode , replyText , classId , methodId1 , null , null ) ; return this ; |
public class Router { /** * DOCUMENT REQUESTS : * */
private String getRevIDFromIfMatchHeader ( ) { } } | String ifMatch = getRequestHeaderValue ( "If-Match" ) ; if ( ifMatch == null ) { return null ; } // Value of If - Match is an ETag , so have to trim the quotes around it :
if ( ifMatch . length ( ) > 2 && ifMatch . startsWith ( "\"" ) && ifMatch . endsWith ( "\"" ) ) { return ifMatch . substring ( 1 , ifMatch . length ( ) - 2 ) ; } else { return null ; } |
public class TSMeta { /** * Syncs the local object with the stored object for atomic writes ,
* overwriting the stored data if the user issued a PUT request
* < b > Note : < / b > This method also resets the { @ code changed } map to false
* for every field
* @ param meta The stored object to sync from
* @ param overwrite Whether or not all user mutable data in storage should be
* replaced by the local object */
private void syncMeta ( final TSMeta meta , final boolean overwrite ) { } } | // storage * could * have a missing TSUID if something went pear shaped so
// only use the one that ' s configured . If the local is missing , we ' re foobar
if ( meta . tsuid != null && ! meta . tsuid . isEmpty ( ) ) { tsuid = meta . tsuid ; } if ( tsuid == null || tsuid . isEmpty ( ) ) { throw new IllegalArgumentException ( "TSUID is empty" ) ; } if ( meta . created > 0 && ( meta . created < created || created == 0 ) ) { created = meta . created ; } // handle user - accessible stuff
if ( ! overwrite && ! changed . get ( "display_name" ) ) { display_name = meta . display_name ; } if ( ! overwrite && ! changed . get ( "description" ) ) { description = meta . description ; } if ( ! overwrite && ! changed . get ( "notes" ) ) { notes = meta . notes ; } if ( ! overwrite && ! changed . get ( "custom" ) ) { custom = meta . custom ; } if ( ! overwrite && ! changed . get ( "units" ) ) { units = meta . units ; } if ( ! overwrite && ! changed . get ( "data_type" ) ) { data_type = meta . data_type ; } if ( ! overwrite && ! changed . get ( "retention" ) ) { retention = meta . retention ; } if ( ! overwrite && ! changed . get ( "max" ) ) { max = meta . max ; } if ( ! overwrite && ! changed . get ( "min" ) ) { min = meta . min ; } last_received = meta . last_received ; total_dps = meta . total_dps ; // reset changed flags
initializeChangedMap ( ) ; |
public class MapTileFileArchiveProvider { private void findArchiveFiles ( ) { } } | clearArcives ( ) ; // path should be optionally configurable
File cachePaths = Configuration . getInstance ( ) . getOsmdroidBasePath ( ) ; final File [ ] files = cachePaths . listFiles ( ) ; if ( files != null ) { for ( final File file : files ) { final IArchiveFile archiveFile = ArchiveFileFactory . getArchiveFile ( file ) ; if ( archiveFile != null ) { archiveFile . setIgnoreTileSource ( ignoreTileSource ) ; mArchiveFiles . add ( archiveFile ) ; } } } |
public class DeploymentService { /** * Returns the deployment with the given id .
* This is needed because the API does not contain an operation to get a deployment using the id directly .
* @ param applicationId The application id for the deployments
* @ param deploymentId The id of the deployment to return
* @ return The deployment */
public Optional < Deployment > show ( long applicationId , long deploymentId ) { } } | Optional < Deployment > ret = Optional . absent ( ) ; Collection < Deployment > deployments = list ( applicationId ) ; for ( Deployment deployment : deployments ) { if ( deployment . getId ( ) == deploymentId ) ret = Optional . of ( deployment ) ; } return ret ; |
public class ReusableFutureLatch { /** * Complete all waiting futures , and all future calls to register be notified immediately . If release is
* called twice consecutively the second value will be the one passed to future callers of
* { @ link # register ( CompletableFuture ) }
* @ param result The result to pass to waiting futures . */
public void release ( T result ) { } } | ArrayList < CompletableFuture < T > > toComplete = null ; synchronized ( lock ) { if ( ! waitingFutures . isEmpty ( ) ) { toComplete = new ArrayList < > ( waitingFutures ) ; waitingFutures . clear ( ) ; } e = null ; this . result = result ; released = true ; } if ( toComplete != null ) { for ( CompletableFuture < T > f : toComplete ) { f . complete ( result ) ; } } |
public class UnaryMinusOperator { /** * Applies the operator to the given value */
public Object apply ( Object pValue , Object pContext , Logger pLogger ) throws ELException { } } | if ( pValue == null ) { /* if ( pLogger . isLoggingWarning ( ) ) {
pLogger . logWarning
( Constants . ARITH _ OP _ NULL ,
getOperatorSymbol ( ) ) ; */
return PrimitiveObjects . getInteger ( 0 ) ; } else if ( pValue instanceof String ) { if ( Coercions . isFloatingPointString ( pValue ) ) { double dval = ( ( Number ) ( Coercions . coerceToPrimitiveNumber ( pValue , Double . class , pLogger ) ) ) . doubleValue ( ) ; return PrimitiveObjects . getDouble ( - dval ) ; } else { long lval = ( ( Number ) ( Coercions . coerceToPrimitiveNumber ( pValue , Long . class , pLogger ) ) ) . longValue ( ) ; return PrimitiveObjects . getLong ( - lval ) ; } } else if ( pValue instanceof Byte ) { return PrimitiveObjects . getByte ( ( byte ) - ( ( ( Byte ) pValue ) . byteValue ( ) ) ) ; } else if ( pValue instanceof Short ) { return PrimitiveObjects . getShort ( ( short ) - ( ( ( Short ) pValue ) . shortValue ( ) ) ) ; } else if ( pValue instanceof Integer ) { return PrimitiveObjects . getInteger ( ( int ) - ( ( ( Integer ) pValue ) . intValue ( ) ) ) ; } else if ( pValue instanceof Long ) { return PrimitiveObjects . getLong ( ( long ) - ( ( ( Long ) pValue ) . longValue ( ) ) ) ; } else if ( pValue instanceof Float ) { return PrimitiveObjects . getFloat ( ( float ) - ( ( ( Float ) pValue ) . floatValue ( ) ) ) ; } else if ( pValue instanceof Double ) { return PrimitiveObjects . getDouble ( ( double ) - ( ( ( Double ) pValue ) . doubleValue ( ) ) ) ; } else { if ( pLogger . isLoggingError ( ) ) { pLogger . logError ( Constants . UNARY_OP_BAD_TYPE , getOperatorSymbol ( ) , pValue . getClass ( ) . getName ( ) ) ; } return PrimitiveObjects . getInteger ( 0 ) ; } |
public class InterceptorChain { /** * Replaces an existing interceptor of the given type in the interceptor chain with a new interceptor instance passed as parameter .
* @ param replacingInterceptor the interceptor to add to the interceptor chain
* @ param toBeReplacedInterceptorType the type of interceptor that should be swapped with the new one
* @ return true if the interceptor was replaced */
public boolean replaceInterceptor ( CommandInterceptor replacingInterceptor , Class < ? extends CommandInterceptor > toBeReplacedInterceptorType ) { } } | return asyncInterceptorChain . replaceInterceptor ( replacingInterceptor , toBeReplacedInterceptorType ) ; |
public class ServiceApiWrapper { /** * Updates profile for an active session .
* @ param token Comapi access token .
* @ param profileDetails Profile details .
* @ return Observable with to perform update profile for current session . */
Observable < ComapiResult < Map < String , Object > > > doUpdateProfile ( @ NonNull final String token , @ NonNull final String profileId , @ NonNull final Map < String , Object > profileDetails , final String eTag ) { } } | return wrapObservable ( ! TextUtils . isEmpty ( eTag ) ? service . updateProfile ( AuthManager . addAuthPrefix ( token ) , eTag , apiSpaceId , profileId , profileDetails ) . map ( mapToComapiResult ( ) ) : service . updateProfile ( AuthManager . addAuthPrefix ( token ) , apiSpaceId , profileId , profileDetails ) . map ( mapToComapiResult ( ) ) , log , "Updating profiles " + profileId ) ; |
public class CallableUtils { /** * Returns a composed function that first applies the Callable and then applies
* either the resultHandler or exceptionHandler .
* @ param < T > return type of callable
* @ param < R > return type of resultHandler and exceptionHandler
* @ param resultHandler the function applied after callable was successful
* @ param exceptionHandler the function applied after callable has failed
* @ return a function composed of supplier and handler */
public static < T , R > Callable < R > andThen ( Callable < T > callable , Function < T , R > resultHandler , Function < Exception , R > exceptionHandler ) { } } | return ( ) -> { try { T result = callable . call ( ) ; return resultHandler . apply ( result ) ; } catch ( Exception exception ) { return exceptionHandler . apply ( exception ) ; } } ; |
public class ValidateBrackets { /** * Returns True if all opened brackets in the string are closed properly .
* Brackets in the string are " ( " and " ) " .
* Arguments :
* inputString ( str ) : String of brackets
* Return :
* boolean : True if brackets are correctly balanced , false otherwise .
* Examples :
* > > > validateBrackets ( " ( " )
* False
* > > > validateBrackets ( " ( ) " )
* True
* > > > validateBrackets ( " ( ( ) ( ) ) " )
* True
* > > > validateBrackets ( " ) ( ( ) " )
* False */
public static boolean validateBrackets ( String inputString ) { } } | int balanceLevel = 0 ; for ( char bracket : inputString . toCharArray ( ) ) { if ( bracket == '(' ) { balanceLevel += 1 ; } else { balanceLevel -= 1 ; } if ( balanceLevel < 0 ) { return false ; } } return balanceLevel == 0 ; |
public class MtasFieldsProducer { /** * ( non - Javadoc )
* @ see org . apache . lucene . codecs . FieldsProducer # close ( ) */
@ Override public void close ( ) throws IOException { } } | delegateFieldsProducer . close ( ) ; for ( Entry < String , IndexInput > entry : indexInputList . entrySet ( ) ) { entry . getValue ( ) . close ( ) ; } |
public class Wills { /** * Creates chain from provided Wills
* @ param wills Wills to be chained
* @ param < A > Type of Wills
* @ return Chained Will */
public static < A > Will < List < A > > when ( Iterable < ? extends Will < ? extends A > > wills ) { } } | return forListenableFuture ( Futures . < A > allAsList ( wills ) ) ; |
public class DescriptionAutoListPage { /** * Prints the content that will be put before the auto - generated list . */
@ Override public void printContentStart ( ChainWriter out , WebSiteRequest req , HttpServletResponse resp ) throws IOException , SQLException { } } | out . print ( getDescription ( ) ) ; |
public class ElementMatchers { /** * Matches any annotations by their type on a type that declared these annotations or inherited them from its
* super classes .
* @ param type The annotation type to be matched .
* @ param < T > The type of the matched object .
* @ return A matcher that matches any inherited annotation by their type . */
public static < T extends TypeDescription > ElementMatcher . Junction < T > inheritsAnnotation ( TypeDescription type ) { } } | return inheritsAnnotation ( is ( type ) ) ; |
public class DescribeComplianceByResourceRequest { /** * Filters the results by compliance .
* The allowed values are < code > COMPLIANT < / code > , < code > NON _ COMPLIANT < / code > , and < code > INSUFFICIENT _ DATA < / code > .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setComplianceTypes ( java . util . Collection ) } or { @ link # withComplianceTypes ( java . util . Collection ) } if you
* want to override the existing values .
* @ param complianceTypes
* Filters the results by compliance . < / p >
* The allowed values are < code > COMPLIANT < / code > , < code > NON _ COMPLIANT < / code > , and
* < code > INSUFFICIENT _ DATA < / code > .
* @ return Returns a reference to this object so that method calls can be chained together .
* @ see ComplianceType */
public DescribeComplianceByResourceRequest withComplianceTypes ( String ... complianceTypes ) { } } | if ( this . complianceTypes == null ) { setComplianceTypes ( new com . amazonaws . internal . SdkInternalList < String > ( complianceTypes . length ) ) ; } for ( String ele : complianceTypes ) { this . complianceTypes . add ( ele ) ; } return this ; |
public class LongArray { /** * Returns the value at position { @ code index } . */
public long get ( int index ) { } } | assert index >= 0 : "index (" + index + ") should >= 0" ; assert index < length : "index (" + index + ") should < length (" + length + ")" ; return Platform . getLong ( baseObj , baseOffset + index * WIDTH ) ; |
public class DiscreteDistributions { /** * Returns the cumulative probability of poisson
* @ param k
* @ param lamda
* @ return */
public static double poissonCdf ( int k , double lamda ) { } } | if ( k < 0 || lamda < 0 ) { throw new IllegalArgumentException ( "All the parameters must be positive." ) ; } /* / / Slow !
$ probabilitySum = 0;
for ( $ i = 0 ; $ i < = $ k ; + + $ i ) {
$ probabilitySum + = self : : poisson ( $ i , $ lamda ) ; */
// Faster solution as described at : http : / / www . math . ucla . edu / ~ tom / distributions / poisson . html ?
double probabilitySum = 1.0 - ContinuousDistributions . gammaCdf ( lamda , k + 1 ) ; return probabilitySum ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.