signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AbstractClientOptionsBuilder { /** * Sets the { @ link ContentPreviewerFactory } creating a { @ link ContentPreviewer } which produces the preview
* with the maxmium { @ code length } limit for a request and a response .
* The previewer is enabled only if the content type of a request / response meets
* any of the following cases .
* < ul >
* < li > when it matches { @ code text / * } or { @ code application / x - www - form - urlencoded } < / li >
* < li > when its charset has been specified < / li >
* < li > when its subtype is { @ code " xml " } or { @ code " json " } < / li >
* < li > when its subtype ends with { @ code " + xml " } or { @ code " + json " } < / li >
* < / ul >
* @ param length the maximum length of the preview .
* @ param defaultCharset the default charset for a request / response with unspecified charset in
* { @ code " content - type " } header . */
public B contentPreview ( int length , Charset defaultCharset ) { } } | return contentPreviewerFactory ( ContentPreviewerFactory . ofText ( length , defaultCharset ) ) ; |
public class AttachToIndexRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AttachToIndexRequest attachToIndexRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( attachToIndexRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( attachToIndexRequest . getDirectoryArn ( ) , DIRECTORYARN_BINDING ) ; protocolMarshaller . marshall ( attachToIndexRequest . getIndexReference ( ) , INDEXREFERENCE_BINDING ) ; protocolMarshaller . marshall ( attachToIndexRequest . getTargetReference ( ) , TARGETREFERENCE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class LayerMap { /** * Get the container element referenced by a item / key combination .
* @ param item Plot item
* @ param task Visualization task
* @ return Container element */
public Element getContainer ( PlotItem item , VisualizationTask task ) { } } | Pair < Element , Visualization > pair = map . get ( key ( item , task ) ) ; return pair == null ? null : pair . first ; |
public class AbstractAWTDrawVisitor { /** * Obtain the exact bounding box of the { @ code text } in the provided
* graphics environment .
* @ param text the text to obtain the bounds of
* @ param g2 the graphic environment
* @ return bounds of the text
* @ see TextLayout */
protected Rectangle2D getTextBounds ( String text , Graphics2D g2 ) { } } | return new TextLayout ( text , g2 . getFont ( ) , g2 . getFontRenderContext ( ) ) . getBounds ( ) ; |
public class JSONHelpers { /** * Create a deep copy of { @ code src } in a new { @ link JSONArray } .
* Equivalent to calling { @ link # copy ( JSONArray , boolean ) copy ( src , true ) } .
* @ param src { @ code JSONArray } to copy
* @ return A new { @ code JSONArray } copied from { @ code src } */
public static JSONArray copy ( final JSONArray src ) { } } | final JSONArray dest = new JSONArray ( ) ; final int len = src . length ( ) ; for ( int i = 0 ; i < len ; ++ i ) { dest . put ( src . opt ( i ) ) ; } return dest ; |
public class Mailer { /** * Simply logs host details , credentials used and whether authentication will take place and finally the transport protocol used . */
private void logSession ( Session session , TransportStrategy transportStrategy ) { } } | final String logmsg = "starting mail session (host: %s, port: %s, username: %s, authenticate: %s, transport: %s)" ; Properties properties = session . getProperties ( ) ; logger . debug ( String . format ( logmsg , properties . get ( transportStrategy . propertyNameHost ( ) ) , properties . get ( transportStrategy . propertyNamePort ( ) ) , properties . get ( transportStrategy . propertyNameUsername ( ) ) , properties . get ( transportStrategy . propertyNameAuthenticate ( ) ) , transportStrategy ) ) ; |
public class IPSetMarshaller { /** * Marshall the given parameter object . */
public void marshall ( IPSet iPSet , ProtocolMarshaller protocolMarshaller ) { } } | if ( iPSet == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( iPSet . getIPSetId ( ) , IPSETID_BINDING ) ; protocolMarshaller . marshall ( iPSet . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( iPSet . getIPSetDescriptors ( ) , IPSETDESCRIPTORS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Exec { /** * Launches the process , returning a handle to it for IO ops , etc < br / >
* < strong > the caller must read the output streams : otherwise the buffers may fill up and the remote program will be
* suspended
* indefinitely < / strong >
* @ return
* @ throws IOException */
public BasicProcessTracker startBasic ( ) throws IOException { } } | final Process p = getProcessBuilder ( ) . start ( ) ; return new BasicProcessTracker ( cmd , p , builder . redirectErrorStream ( ) ) ; |
public class MesosTaskManagerParameters { /** * Create the Mesos TaskManager parameters .
* @ param flinkConfig the TM configuration . */
public static MesosTaskManagerParameters create ( Configuration flinkConfig ) { } } | List < ConstraintEvaluator > constraints = parseConstraints ( flinkConfig . getString ( MESOS_CONSTRAINTS_HARD_HOSTATTR ) ) ; // parse the common parameters
ContaineredTaskManagerParameters containeredParameters = ContaineredTaskManagerParameters . create ( flinkConfig , flinkConfig . getInteger ( MESOS_RM_TASKS_MEMORY_MB ) , flinkConfig . getInteger ( MESOS_RM_TASKS_SLOTS ) ) ; double cpus = flinkConfig . getDouble ( MESOS_RM_TASKS_CPUS ) ; if ( cpus <= 0.0 ) { cpus = Math . max ( containeredParameters . numSlots ( ) , 1.0 ) ; } int gpus = flinkConfig . getInteger ( MESOS_RM_TASKS_GPUS ) ; if ( gpus < 0 ) { throw new IllegalConfigurationException ( MESOS_RM_TASKS_GPUS . key ( ) + " cannot be negative" ) ; } int disk = flinkConfig . getInteger ( MESOS_RM_TASKS_DISK_MB ) ; // parse the containerization parameters
String imageName = flinkConfig . getString ( MESOS_RM_CONTAINER_IMAGE_NAME ) ; ContainerType containerType ; String containerTypeString = flinkConfig . getString ( MESOS_RM_CONTAINER_TYPE ) ; switch ( containerTypeString ) { case MESOS_RESOURCEMANAGER_TASKS_CONTAINER_TYPE_MESOS : containerType = ContainerType . MESOS ; break ; case MESOS_RESOURCEMANAGER_TASKS_CONTAINER_TYPE_DOCKER : containerType = ContainerType . DOCKER ; if ( imageName == null || imageName . length ( ) == 0 ) { throw new IllegalConfigurationException ( MESOS_RM_CONTAINER_IMAGE_NAME . key ( ) + " must be specified for docker container type" ) ; } break ; default : throw new IllegalConfigurationException ( "invalid container type: " + containerTypeString ) ; } Option < String > containerVolOpt = Option . < String > apply ( flinkConfig . getString ( MESOS_RM_CONTAINER_VOLUMES ) ) ; Option < String > dockerParamsOpt = Option . < String > apply ( flinkConfig . getString ( MESOS_RM_CONTAINER_DOCKER_PARAMETERS ) ) ; Option < String > uriParamsOpt = Option . < String > apply ( flinkConfig . getString ( MESOS_TM_URIS ) ) ; boolean dockerForcePullImage = flinkConfig . getBoolean ( MESOS_RM_CONTAINER_DOCKER_FORCE_PULL_IMAGE ) ; List < Protos . Volume > containerVolumes = buildVolumes ( containerVolOpt ) ; List < Protos . Parameter > dockerParameters = buildDockerParameters ( dockerParamsOpt ) ; List < String > uris = buildUris ( uriParamsOpt ) ; // obtain Task Manager Host Name from the configuration
Option < String > taskManagerHostname = Option . apply ( flinkConfig . getString ( MESOS_TM_HOSTNAME ) ) ; // obtain command - line from the configuration
String tmCommand = flinkConfig . getString ( MESOS_TM_CMD ) ; Option < String > tmBootstrapCommand = Option . apply ( flinkConfig . getString ( MESOS_TM_BOOTSTRAP_CMD ) ) ; return new MesosTaskManagerParameters ( cpus , gpus , disk , containerType , Option . apply ( imageName ) , containeredParameters , containerVolumes , dockerParameters , dockerForcePullImage , constraints , tmCommand , tmBootstrapCommand , taskManagerHostname , uris ) ; |
public class CoronaJobTracker { /** * Based on the resource type , get a resource report of the grant # and
* task # . Used by coronajobresources . jsp for debugging which resources are
* being used
* @ param resourceType Map or reduce type
* @ return List of the resource reports for the appropriate type sorted by id . */
public List < ResourceReport > getResourceReportList ( String resourceType ) { } } | Map < Integer , ResourceReport > resourceReportMap = new TreeMap < Integer , ResourceReport > ( ) ; synchronized ( lockObject ) { for ( Map . Entry < TaskAttemptID , Integer > entry : taskLookupTable . taskIdToGrantMap . entrySet ( ) ) { if ( ResourceTracker . isNoneGrantId ( entry . getValue ( ) ) ) { // Skip non - existing grant .
continue ; } if ( ( resourceType . equals ( "map" ) && entry . getKey ( ) . isMap ( ) ) || ( resourceType . equals ( "reduce" ) && ! entry . getKey ( ) . isMap ( ) ) ) { resourceReportMap . put ( entry . getValue ( ) , new ResourceReport ( entry . getValue ( ) , entry . getKey ( ) . toString ( ) ) ) ; } } for ( Integer grantId : resourceTracker . availableResources ) { if ( ! resourceReportMap . containsKey ( grantId ) ) { resourceReportMap . put ( grantId , new ResourceReport ( grantId , "Available (currently not in use)" ) ) ; } } } return new ArrayList < ResourceReport > ( resourceReportMap . values ( ) ) ; |
public class RelationImpl { /** * Reifys and returns the RelationReified */
private RelationReified reify ( ) { } } | if ( relationStructure . isReified ( ) ) return relationStructure . reify ( ) ; // Get the role players to transfer
Map < Role , Set < Thing > > rolePlayers = structure ( ) . allRolePlayers ( ) ; // Now Reify
relationStructure = relationStructure . reify ( ) ; // Transfer relations
rolePlayers . forEach ( ( role , things ) -> { Thing thing = Iterables . getOnlyElement ( things ) ; assign ( role , thing ) ; } ) ; return relationStructure . reify ( ) ; |
public class QueujSampleView { /** * GEN - LAST : event _ jButton5ActionPerformed */
private void jButton6ActionPerformed ( java . awt . event . ActionEvent evt ) { } } | // GEN - FIRST : event _ jButton6ActionPerformed
QueuJPerfTest test = new QueuJPerfTest ( ) ; System . out . println ( test . run ( ) ) ; |
public class TableInputFormat { /** * Maps the current HBase Result into a Record .
* This implementation simply stores the HBaseKey at position 0 , and the HBase Result object at position 1.
* @ param record
* @ param key
* @ param result */
public void mapResultToRecord ( Record record , HBaseKey key , HBaseResult result ) { } } | record . setField ( 0 , key ) ; record . setField ( 1 , result ) ; |
public class ConsoleImpl { /** * ( non - Javadoc )
* @ see org . restcomm . ss7 . management . console . Console # printNewLine ( ) */
@ Override public void printNewLine ( ) { } } | try { console . pushToConsole ( Config . getLineSeparator ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } |
public class SubordinateControlOptionsExample { /** * Build the subordinate control . */
private void buildControl ( ) { } } | buildControlPanel . reset ( ) ; buildTargetPanel . reset ( ) ; // Setup Trigger
setupTrigger ( ) ; // Create target
SubordinateTarget target = setupTarget ( ) ; // Create Actions
com . github . bordertech . wcomponents . subordinate . Action trueAction ; com . github . bordertech . wcomponents . subordinate . Action falseAction ; switch ( ( ControlActionType ) drpActionType . getSelected ( ) ) { case ENABLE_DISABLE : trueAction = new Enable ( target ) ; falseAction = new Disable ( target ) ; break ; case SHOW_HIDE : trueAction = new Show ( target ) ; falseAction = new Hide ( target ) ; break ; case MAN_OPT : trueAction = new Mandatory ( target ) ; falseAction = new Optional ( target ) ; break ; case SHOWIN_HIDEIN : trueAction = new ShowInGroup ( target , targetGroup ) ; falseAction = new HideInGroup ( target , targetGroup ) ; break ; case ENABLEIN_DISABLEIN : trueAction = new EnableInGroup ( target , targetGroup ) ; falseAction = new DisableInGroup ( target , targetGroup ) ; break ; default : throw new SystemException ( "ControlAction type not valid" ) ; } // Create Condition
Condition condition = createCondition ( ) ; if ( cbNot . isSelected ( ) ) { condition = new Not ( condition ) ; } // Create Rule
Rule rule = new Rule ( condition , trueAction , falseAction ) ; // Create Subordinate
WSubordinateControl control = new WSubordinateControl ( ) ; control . addRule ( rule ) ; buildControlPanel . add ( control ) ; if ( targetCollapsible . getDecoratedLabel ( ) != null ) { targetCollapsible . getDecoratedLabel ( ) . setTail ( new WText ( control . toString ( ) ) ) ; } control = new WSubordinateControl ( ) ; rule = new Rule ( new Equal ( cbClientDisableTrigger , true ) , new Disable ( ( SubordinateTarget ) trigger ) , new Enable ( ( SubordinateTarget ) trigger ) ) ; control . addRule ( rule ) ; buildControlPanel . add ( control ) ; |
public class MessageBirdClient { /** * Function to delete voice call by id
* @ param id Voice call ID
* @ throws UnauthorizedException if client is unauthorized
* @ throws GeneralException general exception */
public void deleteVoiceCall ( final String id ) throws NotFoundException , GeneralException , UnauthorizedException { } } | if ( id == null ) { throw new IllegalArgumentException ( "Voice Message ID must be specified." ) ; } String url = String . format ( "%s%s" , VOICE_CALLS_BASE_URL , VOICECALLSPATH ) ; messageBirdService . deleteByID ( url , id ) ; |
public class WebAuthenticatorProxy { /** * Determines if the application has a FORM login configuration in
* its web . xml
* @ param webRequest
* @ return { @ code true } if the application ' s web . xml has a valid form login configuration . */
private boolean appHasWebXMLFormLogin ( WebRequest webRequest ) { } } | return webRequest . getFormLoginConfiguration ( ) != null && webRequest . getFormLoginConfiguration ( ) . getLoginPage ( ) != null && webRequest . getFormLoginConfiguration ( ) . getErrorPage ( ) != null ; |
public class Serializer { /** * Deserialize an instance of the given class from the input stream .
* @ param input The { @ link InputStream } that contains the data to deserialize .
* @ param klass The { @ link Class } to deserialize the result into .
* @ param < T > The type to deserialize the result into .
* @ return An instance of type T deserialized from the input stream .
* @ throws IOException on general I / O error . */
public < T extends OmiseObject > T deserialize ( InputStream input , Class < T > klass ) throws IOException { } } | return objectMapper . readerFor ( klass ) . readValue ( input ) ; |
public class DeviceIdentificationVpdPage { /** * Returns the combined length of all contained IDENTIFICATION DESCRIPTORs .
* @ return the combined length of all contained IDENTIFICATION DESCRIPTORs */
private short getPageLength ( ) { } } | short pageLength = 0 ; for ( int i = 0 ; i < identificationDescriptors . length ; ++ i ) { pageLength += identificationDescriptors [ i ] . size ( ) ; } return pageLength ; |
public class SharedBaseRecordTable { /** * Set the current table target .
* @ param table The new current table . */
public void copyRecordInfo ( Record recDest , Record recSource , boolean bCopyEditMode , boolean bOnlyModifiedFields ) { } } | if ( recDest == null ) recDest = this . getCurrentRecord ( ) ; if ( recDest != recSource ) { boolean bAllowFieldChange = false ; // This will disable field behaviors on move
boolean bMoveModifiedState = true ; // This will move the modified status to the new field
Object [ ] rgobjEnabledFieldsOld = recSource . setEnableFieldListeners ( false ) ; recDest . moveFields ( recSource , null , DBConstants . DONT_DISPLAY , DBConstants . READ_MOVE , bAllowFieldChange , bOnlyModifiedFields , bMoveModifiedState , false ) ; recSource . setEnableFieldListeners ( rgobjEnabledFieldsOld ) ; if ( bCopyEditMode ) recDest . setEditMode ( recSource . getEditMode ( ) ) ; // Okay ?
} |
public class ResourceDataContainerMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ResourceDataContainer resourceDataContainer , ProtocolMarshaller protocolMarshaller ) { } } | if ( resourceDataContainer == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( resourceDataContainer . getLocalDeviceResourceData ( ) , LOCALDEVICERESOURCEDATA_BINDING ) ; protocolMarshaller . marshall ( resourceDataContainer . getLocalVolumeResourceData ( ) , LOCALVOLUMERESOURCEDATA_BINDING ) ; protocolMarshaller . marshall ( resourceDataContainer . getS3MachineLearningModelResourceData ( ) , S3MACHINELEARNINGMODELRESOURCEDATA_BINDING ) ; protocolMarshaller . marshall ( resourceDataContainer . getSageMakerMachineLearningModelResourceData ( ) , SAGEMAKERMACHINELEARNINGMODELRESOURCEDATA_BINDING ) ; protocolMarshaller . marshall ( resourceDataContainer . getSecretsManagerSecretResourceData ( ) , SECRETSMANAGERSECRETRESOURCEDATA_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ExcelFunctions { /** * Moves a date by the given number of months */
public static Temporal edate ( EvaluationContext ctx , Object date , Object months ) { } } | Temporal dateOrDateTime = Conversions . toDateOrDateTime ( date , ctx ) ; int _months = Conversions . toInteger ( months , ctx ) ; return dateOrDateTime . plus ( _months , ChronoUnit . MONTHS ) ; |
public class ST_GeometryShadow { /** * Compute the shadow for a linestring
* @ param lineString the input linestring
* @ param shadowOffset computed according the sun position and the height of
* the geometry
* @ return */
private static Geometry shadowLine ( LineString lineString , double [ ] shadowOffset , GeometryFactory factory , boolean doUnion ) { } } | Coordinate [ ] coords = lineString . getCoordinates ( ) ; Collection < Polygon > shadows = new ArrayList < Polygon > ( ) ; createShadowPolygons ( shadows , coords , shadowOffset , factory ) ; if ( ! doUnion ) { return factory . buildGeometry ( shadows ) ; } else { if ( ! shadows . isEmpty ( ) ) { CascadedPolygonUnion union = new CascadedPolygonUnion ( shadows ) ; Geometry result = union . union ( ) ; result . apply ( new UpdateZCoordinateSequenceFilter ( 0 , 1 ) ) ; return result ; } return null ; } |
public class VoiceApi { /** * Get all calls
* Get all active calls for the current agent .
* @ return ApiResponse & lt ; InlineResponse200 & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < InlineResponse200 > getCallsWithHttpInfo ( ) throws ApiException { } } | com . squareup . okhttp . Call call = getCallsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < InlineResponse200 > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class VisualizePairwiseGainMatrix { /** * Show a single visualization .
* @ param context Visualizer context
* @ param factory Visualizer factory
* @ param task Visualization task */
private void showVisualization ( VisualizerContext context , SimilarityMatrixVisualizer factory , VisualizationTask task ) { } } | VisualizationPlot plot = new VisualizationPlot ( ) ; Visualization vis = factory . makeVisualization ( context , task , plot , 1.0 , 1.0 , null ) ; plot . getRoot ( ) . appendChild ( vis . getLayer ( ) ) ; plot . getRoot ( ) . setAttribute ( SVGConstants . SVG_WIDTH_ATTRIBUTE , "20cm" ) ; plot . getRoot ( ) . setAttribute ( SVGConstants . SVG_HEIGHT_ATTRIBUTE , "20cm" ) ; plot . getRoot ( ) . setAttribute ( SVGConstants . SVG_VIEW_BOX_ATTRIBUTE , "0 0 1 1" ) ; plot . updateStyleElement ( ) ; ( new SimpleSVGViewer ( ) ) . setPlot ( plot ) ; |
public class Session { /** * Revoke a list of resources from a session
* @ param idList the list of resources to revoke
* @ return the list of resource grants that have been revoked */
public List < ResourceGrant > revokeResource ( List < Integer > idList ) { } } | if ( deleted ) { throw new RuntimeException ( "Session: " + sessionId + " has been deleted" ) ; } List < ResourceGrant > canceledGrants = new ArrayList < ResourceGrant > ( ) ; for ( Integer id : idList ) { ResourceRequestInfo req = idToRequest . get ( id ) ; ResourceGrant grant = idToGrant . remove ( id ) ; if ( grant != null ) { if ( req == null ) { throw new RuntimeException ( "Session: " + sessionId + ", requestId: " + id + " grant exists but request doesn't" ) ; } removeGrantedRequest ( req , true ) ; // we have previously granted this resource , return to caller
canceledGrants . add ( grant ) ; } } return canceledGrants ; |
public class ClassUtils { /** * Gets the unqualified , simple name of the Class type for the specified Object . Returns null if the Object reference
* is null .
* @ param obj the Object who ' s simple class name is determined .
* @ return a String value indicating the simple class name of the Object .
* @ see java . lang . Class # getSimpleName ( )
* @ see java . lang . Object # getClass ( ) */
@ NullSafe public static String getClassSimpleName ( Object obj ) { } } | return obj != null ? obj . getClass ( ) . getSimpleName ( ) : null ; |
public class BeanDefinitionLoader { /** * Set the resource loader to be used by the underlying readers and scanner .
* @ param resourceLoader the resource loader */
public void setResourceLoader ( ResourceLoader resourceLoader ) { } } | this . resourceLoader = resourceLoader ; this . xmlReader . setResourceLoader ( resourceLoader ) ; this . scanner . setResourceLoader ( resourceLoader ) ; |
public class EastAsianCS { /** * result in utc - days */
private long firstDayOfMonth ( int cycle , int yearOfCycle , EastAsianMonth month ) { } } | long newYear = this . newYear ( cycle , yearOfCycle ) ; long approxStartOfMonth = this . newMoonOnOrAfter ( newYear + ( month . getNumber ( ) - 1 ) * 29 ) ; if ( month . equals ( this . transform ( approxStartOfMonth ) . getMonth ( ) ) ) { return approxStartOfMonth ; } else { return this . newMoonOnOrAfter ( approxStartOfMonth + 1 ) ; } |
public class SourceUnit { /** * Generates an AST from the CST . You can retrieve it with getAST ( ) . */
public void convert ( ) throws CompilationFailedException { } } | if ( this . phase == Phases . PARSING && this . phaseComplete ) { gotoPhase ( Phases . CONVERSION ) ; } if ( this . phase != Phases . CONVERSION ) { throw new GroovyBugError ( "SourceUnit not ready for convert()" ) ; } // Build the AST
try { this . ast = parserPlugin . buildAST ( this , this . classLoader , this . cst ) ; this . ast . setDescription ( this . name ) ; } catch ( SyntaxException e ) { if ( this . ast == null ) { // Create a dummy ModuleNode to represent a failed parse - in case a later phase attempts to use the ast
this . ast = new ModuleNode ( this ) ; } getErrorCollector ( ) . addError ( new SyntaxErrorMessage ( e , this ) ) ; } String property = ( String ) AccessController . doPrivileged ( new PrivilegedAction ( ) { public Object run ( ) { return System . getProperty ( "groovy.ast" ) ; } } ) ; if ( "xml" . equals ( property ) ) { saveAsXML ( name , ast ) ; } |
public class JdbcConnectionSource { /** * Make a connection to the database .
* @ param logger
* This is here so we can use the right logger associated with the sub - class . */
@ SuppressWarnings ( "resource" ) protected DatabaseConnection makeConnection ( Logger logger ) throws SQLException { } } | Properties properties = new Properties ( ) ; if ( username != null ) { properties . setProperty ( "user" , username ) ; } if ( password != null ) { properties . setProperty ( "password" , password ) ; } DatabaseConnection connection = new JdbcDatabaseConnection ( DriverManager . getConnection ( url , properties ) ) ; // by default auto - commit is set to true
connection . setAutoCommit ( true ) ; if ( connectionProxyFactory != null ) { connection = connectionProxyFactory . createProxy ( connection ) ; } logger . debug ( "opened connection to {} got #{}" , url , connection . hashCode ( ) ) ; return connection ; |
public class DirectoryBuilder { /** * Adds a new partition to the { @ link Directory } on initialization .
* @ param partitionId
* the id of the partition
* @ param suffix
* the suffix of the parition so that it can be addressed using a DN
* @ return this builder */
public DirectoryBuilder withPartition ( final String partitionId , final String suffix ) { } } | this . partitions . put ( partitionId , suffix ) ; return this ; |
public class Node { /** * Provides a collection of all the nodes in the tree
* using a depth - first preorder traversal .
* @ param c the closure to run for each node ( a one or two parameter can be used ; if one parameter is given the
* closure will be passed the node , for a two param closure the second parameter will be the level ) .
* @ since 2.5.0 */
public void depthFirst ( Closure c ) { } } | Map < String , Object > options = new ListHashMap < String , Object > ( ) ; options . put ( "preorder" , true ) ; depthFirst ( options , c ) ; |
public class NmeaStreamProcessor { /** * Handles the arrival of a new NMEA line at the given arrival time .
* @ param line
* @ param arrivalTime */
synchronized void line ( String line , long arrivalTime ) { } } | if ( count . incrementAndGet ( ) % logCountFrequency == 0 ) log . info ( "count=" + count . get ( ) + ",buffer size=" + lines . size ( ) ) ; NmeaMessage nmea ; try { nmea = NmeaUtil . parseNmea ( line ) ; } catch ( NmeaMessageParseException e ) { listener . invalidNmea ( line , arrivalTime , e . getMessage ( ) ) ; return ; } // if is multi line message then don ' t report to listener till last
// message in sequence has been received .
if ( ! nmea . isSingleSentence ( ) ) { Optional < List < NmeaMessage > > messages = nmeaBuffer . add ( nmea ) ; if ( messages . isPresent ( ) ) { Optional < NmeaMessage > joined = AisNmeaBuffer . concatenateMessages ( messages . get ( ) ) ; if ( joined . isPresent ( ) ) { if ( joined . get ( ) . getUnixTimeMillis ( ) != null ) listener . message ( joined . get ( ) . toLine ( ) , joined . get ( ) . getUnixTimeMillis ( ) ) ; else listener . message ( joined . get ( ) . toLine ( ) , arrivalTime ) ; } // TODO else report error , might need to change signature of
// listener to handle problem with multi - line message
} return ; } if ( nmea . getUnixTimeMillis ( ) != null ) { listener . message ( line , nmea . getUnixTimeMillis ( ) ) ; return ; } if ( ! matchWithTimestampLine ) { listener . message ( line , arrivalTime ) ; return ; } if ( ! NmeaUtil . isValid ( line ) ) return ; addLine ( line , arrivalTime ) ; log . debug ( "buffer lines=" + lines . size ( ) ) ; Integer earliestTimestampLineIndex = getEarliestTimestampLineIndex ( lines ) ; Set < Integer > removeThese ; if ( earliestTimestampLineIndex != null ) { removeThese = matchWithClosestAisMessageIfBufferLargeEnough ( arrivalTime , earliestTimestampLineIndex ) ; } else removeThese = findExpiredIndexesBeforeIndex ( lastIndex ( ) ) ; TreeSet < Integer > orderedIndexes = Sets . newTreeSet ( removeThese ) ; for ( int index : orderedIndexes . descendingSet ( ) ) { removeLineWithIndex ( index ) ; } |
public class ScopeContext { /** * remove all scope objects */
public void clear ( ) { } } | try { Scope scope ; // Map . Entry entry , e ;
// Map context ;
// release all session scopes
Iterator < Entry < String , Map < String , Scope > > > sit = cfSessionContexts . entrySet ( ) . iterator ( ) ; Entry < String , Map < String , Scope > > sentry ; Map < String , Scope > context ; Iterator < Entry < String , Scope > > itt ; Entry < String , Scope > e ; PageContext pc = ThreadLocalPageContext . get ( ) ; while ( sit . hasNext ( ) ) { sentry = sit . next ( ) ; context = sentry . getValue ( ) ; itt = context . entrySet ( ) . iterator ( ) ; while ( itt . hasNext ( ) ) { e = itt . next ( ) ; scope = e . getValue ( ) ; scope . release ( pc ) ; } } cfSessionContexts . clear ( ) ; // release all application scopes
Iterator < Entry < String , Application > > ait = applicationContexts . entrySet ( ) . iterator ( ) ; Entry < String , Application > aentry ; while ( ait . hasNext ( ) ) { aentry = ait . next ( ) ; scope = aentry . getValue ( ) ; scope . release ( pc ) ; } applicationContexts . clear ( ) ; // release server scope
if ( server != null ) { server . release ( pc ) ; server = null ; } } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; } |
public class SchedulesInner { /** * Retrieve the schedule identified by schedule name .
* @ param resourceGroupName Name of an Azure Resource group .
* @ param automationAccountName The name of the automation account .
* @ param scheduleName The schedule name .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the ScheduleInner object if successful . */
public ScheduleInner get ( String resourceGroupName , String automationAccountName , String scheduleName ) { } } | return getWithServiceResponseAsync ( resourceGroupName , automationAccountName , scheduleName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class ApiOvhTelephony { /** * External displayed number creation for a given trunk
* REST : POST / telephony / { billingAccount } / trunk / { serviceName } / externalDisplayedNumber
* @ param number [ required ] External displayed number to create , in international format
* @ param autoValidation [ required ] External displayed number auto - validation . Only available for partner . Must be owner of the number .
* @ param billingAccount [ required ] The name of your billingAccount
* @ param serviceName [ required ] Name of the service */
public OvhTrunkExternalDisplayedNumber billingAccount_trunk_serviceName_externalDisplayedNumber_POST ( String billingAccount , String serviceName , Boolean autoValidation , String number ) throws IOException { } } | String qPath = "/telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber" ; StringBuilder sb = path ( qPath , billingAccount , serviceName ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "autoValidation" , autoValidation ) ; addBody ( o , "number" , number ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhTrunkExternalDisplayedNumber . class ) ; |
public class NodeGroupClient { /** * Lists nodes in the node group .
* < p > Sample code :
* < pre > < code >
* try ( NodeGroupClient nodeGroupClient = NodeGroupClient . create ( ) ) {
* ProjectZoneNodeGroupName nodeGroup = ProjectZoneNodeGroupName . of ( " [ PROJECT ] " , " [ ZONE ] " , " [ NODE _ GROUP ] " ) ;
* for ( NodeGroupNode element : nodeGroupClient . listNodesNodeGroups ( nodeGroup . toString ( ) ) . iterateAll ( ) ) {
* / / doThingsWith ( element ) ;
* < / code > < / pre >
* @ param nodeGroup Name of the NodeGroup resource whose nodes you want to list .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final ListNodesNodeGroupsPagedResponse listNodesNodeGroups ( String nodeGroup ) { } } | ListNodesNodeGroupsHttpRequest request = ListNodesNodeGroupsHttpRequest . newBuilder ( ) . setNodeGroup ( nodeGroup ) . build ( ) ; return listNodesNodeGroups ( request ) ; |
public class OrderedList { /** * Returns stream from key to end
* @ param key
* @ param inclusive
* @ param parallel
* @ return */
public Stream < T > tailStream ( T key , boolean inclusive , boolean parallel ) { } } | return StreamSupport . stream ( tailSpliterator ( key , inclusive ) , parallel ) ; |
public class DataSet { /** * Partitions a DataSet using the specified KeySelector .
* < p > < b > Important : < / b > This operation shuffles the whole DataSet over the network and can take significant amount of time .
* @ param keyExtractor The KeyExtractor with which the DataSet is hash - partitioned .
* @ return The partitioned DataSet .
* @ see KeySelector */
public < K extends Comparable < K > > PartitionOperator < T > partitionByHash ( KeySelector < T , K > keyExtractor ) { } } | final TypeInformation < K > keyType = TypeExtractor . getKeySelectorTypes ( keyExtractor , getType ( ) ) ; return new PartitionOperator < > ( this , PartitionMethod . HASH , new Keys . SelectorFunctionKeys < > ( clean ( keyExtractor ) , this . getType ( ) , keyType ) , Utils . getCallLocationName ( ) ) ; |
public class CompilerConfiguration { /** * Checks if the specified bytecode version string represents a JDK 1.5 + compatible
* bytecode version .
* @ param bytecodeVersion the bytecode version string ( 1.4 , 1.5 , 1.6 , 1.7 or 1.8)
* @ return true if the bytecode version is JDK 1.5 + */
public static boolean isPostJDK5 ( String bytecodeVersion ) { } } | return JDK5 . equals ( bytecodeVersion ) || JDK6 . equals ( bytecodeVersion ) || JDK7 . equals ( bytecodeVersion ) || JDK8 . equals ( bytecodeVersion ) ; |
public class JavacState { /** * Run the copy translator only . */
public void performCopying ( File binDir , Map < String , Transformer > suffixRules ) { } } | Map < String , Transformer > sr = new HashMap < String , Transformer > ( ) ; for ( Map . Entry < String , Transformer > e : suffixRules . entrySet ( ) ) { if ( e . getValue ( ) == copyFiles ) { sr . put ( e . getKey ( ) , e . getValue ( ) ) ; } } perform ( binDir , sr ) ; |
public class MappeableBitmapContainer { /** * Find the index of the previous clear bit less than or equal to i .
* @ param i starting index
* @ return index of the previous clear bit */
public int prevClearBit ( final int i ) { } } | int x = i >> 6 ; // i / 64 with sign extension
long w = ~ bitmap . get ( x ) ; w <<= 64 - i - 1 ; if ( w != 0L ) { return i - Long . numberOfLeadingZeros ( w ) ; } for ( -- x ; x >= 0 ; -- x ) { long map = ~ bitmap . get ( x ) ; if ( map != 0L ) { return x * 64 + 63 - Long . numberOfLeadingZeros ( map ) ; } } return - 1 ; |
public class ConfigServlet { /** * from interface ConfigService */
public ConfigurationResult getConfiguration ( ) throws ServiceException { } } | requireAdminUser ( ) ; final ServletWaiter < ConfigurationResult > waiter = new ServletWaiter < ConfigurationResult > ( "getConfiguration" ) ; _omgr . postRunnable ( new Runnable ( ) { public void run ( ) { Map < String , ConfigurationRecord > tabs = Maps . newHashMap ( ) ; for ( String key : _confReg . getKeys ( ) ) { ConfigurationRecord record = buildRecord ( key ) ; if ( record == null ) { waiter . requestFailed ( new ServiceException ( InvocationCodes . E_INTERNAL_ERROR ) ) ; return ; } tabs . put ( key , record ) ; } ConfigurationResult result = new ConfigurationResult ( ) ; result . records = tabs ; waiter . requestCompleted ( result ) ; } } ) ; return waiter . waitForResult ( ) ; |
public class XmlRpcDataMarshaller { /** * Transforms the Collection of Specifications into a Vector of Specification parameters .
* @ param specifications a { @ link java . util . Collection } object .
* @ return the Collection of Specifications into a Vector of Specification parameters */
public static Vector < Object > toXmlRpcSpecificationsParameters ( Collection < Specification > specifications ) { } } | Vector < Object > specificationsParams = new Vector < Object > ( ) ; for ( Specification specification : specifications ) { specificationsParams . add ( specification . marshallize ( ) ) ; } return specificationsParams ; |
public class DocumentRootImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setBinomialDistribution ( BinomialDistributionType newBinomialDistribution ) { } } | ( ( FeatureMap . Internal ) getMixed ( ) ) . set ( BpsimPackage . Literals . DOCUMENT_ROOT__BINOMIAL_DISTRIBUTION , newBinomialDistribution ) ; |
public class PersistenceApi { /** * Initialize Managed Entity & # 39 ; s relationship by attribute name
* Hydrate relationship associated to that entity .
* @ param request Initilize Relationship Request ( required )
* @ return ApiResponse & lt ; List & lt ; Object & gt ; & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < List < Object > > initializePostWithHttpInfo ( InitializeRequest request ) throws ApiException { } } | com . squareup . okhttp . Call call = initializePostValidateBeforeCall ( request , null , null ) ; Type localVarReturnType = new TypeToken < List < Object > > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class SemanticHeadFinder { /** * now overally complex so it deals with coordinations . Maybe change this class to use tregrex ? */
private boolean hasPassiveProgressiveAuxiliary ( Tree [ ] kids , HashSet < String > verbalSet ) { } } | if ( DEBUG ) { System . err . println ( "Checking for passive/progressive auxiliary" ) ; } boolean foundPassiveVP = false ; boolean foundPassiveAux = false ; for ( Tree kid : kids ) { if ( DEBUG ) { System . err . println ( " checking in " + kid ) ; } if ( kid . isPreTerminal ( ) ) { Label kidLabel = kid . label ( ) ; String tag = null ; if ( kidLabel instanceof HasTag ) { tag = ( ( HasTag ) kidLabel ) . tag ( ) ; } if ( tag == null ) { tag = kid . value ( ) ; } Label wordLabel = kid . firstChild ( ) . label ( ) ; String word = null ; if ( wordLabel instanceof HasWord ) { word = ( ( HasWord ) wordLabel ) . word ( ) ; } if ( word == null ) { word = wordLabel . value ( ) ; } if ( DEBUG ) { System . err . println ( "Checking " + kid . value ( ) + " head is " + word + '/' + tag ) ; } String lcWord = word . toLowerCase ( ) ; if ( verbalTags . contains ( tag ) && verbalSet . contains ( lcWord ) ) { if ( DEBUG ) { System . err . println ( "hasPassiveProgressiveAuxiliary found passive aux" ) ; } foundPassiveAux = true ; } } else if ( kid . isPhrasal ( ) ) { Label kidLabel = kid . label ( ) ; String cat = null ; if ( kidLabel instanceof HasCategory ) { cat = ( ( HasCategory ) kidLabel ) . category ( ) ; } if ( cat == null ) { cat = kid . value ( ) ; } if ( ! cat . startsWith ( "VP" ) ) { continue ; } if ( DEBUG ) { System . err . println ( "hasPassiveProgressiveAuxiliary found VP" ) ; } Tree [ ] kidkids = kid . children ( ) ; boolean foundParticipleInVp = false ; for ( Tree kidkid : kidkids ) { if ( DEBUG ) { System . err . println ( " hasPassiveProgressiveAuxiliary examining " + kidkid ) ; } if ( kidkid . isPreTerminal ( ) ) { Label kidkidLabel = kidkid . label ( ) ; String tag = null ; if ( kidkidLabel instanceof HasTag ) { tag = ( ( HasTag ) kidkidLabel ) . tag ( ) ; } if ( tag == null ) { tag = kidkid . value ( ) ; } // we allow in VBD because of frequent tagging mistakes
if ( "VBN" . equals ( tag ) || "VBG" . equals ( tag ) || "VBD" . equals ( tag ) ) { foundPassiveVP = true ; if ( DEBUG ) { System . err . println ( "hasPassiveAuxiliary found VBN/VBG/VBD VP" ) ; } break ; } else if ( "CC" . equals ( tag ) && foundParticipleInVp ) { foundPassiveVP = true ; if ( DEBUG ) { System . err . println ( "hasPassiveAuxiliary [coordination] found (VP (VP[VBN/VBG/VBD] CC" ) ; } break ; } } else if ( kidkid . isPhrasal ( ) ) { String catcat = null ; if ( kidLabel instanceof HasCategory ) { catcat = ( ( HasCategory ) kidLabel ) . category ( ) ; } if ( catcat == null ) { catcat = kid . value ( ) ; } if ( "VP" . equals ( catcat ) ) { if ( DEBUG ) { System . err . println ( "hasPassiveAuxiliary found (VP (VP)), recursing" ) ; } foundParticipleInVp = vpContainsParticiple ( kidkid ) ; } else if ( ( "CONJP" . equals ( catcat ) || "PRN" . equals ( catcat ) ) && foundParticipleInVp ) { // occasionally get PRN in CONJ - like structures
foundPassiveVP = true ; if ( DEBUG ) { System . err . println ( "hasPassiveAuxiliary [coordination] found (VP (VP[VBN/VBG/VBD] CONJP" ) ; } break ; } } } } if ( foundPassiveAux && foundPassiveVP ) { break ; } } // end for ( Tree kid : kids )
if ( DEBUG ) { System . err . println ( "hasPassiveProgressiveAuxiliary returns " + ( foundPassiveAux && foundPassiveVP ) ) ; } return foundPassiveAux && foundPassiveVP ; |
public class BatchItemRequestSerializer { /** * Method to get the Json string for CDCQuery object
* @ param cdcQuery
* the CDCQuery entity describing need for query
* @ return the json string
* @ throws SerializationException
* throws SerializationException */
private String getCDCQueryJson ( CDCQuery cdcQuery ) throws SerializationException { } } | ObjectMapper mapper = getObjectMapper ( ) ; String json = null ; try { json = mapper . writeValueAsString ( cdcQuery ) ; } catch ( Exception e ) { throw new SerializationException ( e ) ; } return json ; |
public class JSONValue { /** * Parse input json as a mapTo class
* mapTo can be a bean
* @ since 2.0 */
public static < T > T parse ( byte [ ] in , Class < T > mapTo ) { } } | try { JSONParser p = new JSONParser ( DEFAULT_PERMISSIVE_MODE ) ; return p . parse ( in , defaultReader . getMapper ( mapTo ) ) ; } catch ( Exception e ) { return null ; } |
public class GaussianMixture { /** * Split the most heterogeneous cluster along its main direction ( eigenvector ) . */
private void split ( List < Component > mixture ) { } } | // Find most dispersive cluster ( biggest sigma )
Component componentToSplit = null ; double maxSigma = 0.0 ; for ( Component c : mixture ) { if ( c . distribution . sd ( ) > maxSigma ) { maxSigma = c . distribution . sd ( ) ; componentToSplit = c ; } } // Splits the component
double delta = componentToSplit . distribution . sd ( ) ; double mu = componentToSplit . distribution . mean ( ) ; Component c = new Component ( ) ; c . priori = componentToSplit . priori / 2 ; c . distribution = new GaussianDistribution ( mu + delta / 2 , delta ) ; mixture . add ( c ) ; c = new Component ( ) ; c . priori = componentToSplit . priori / 2 ; c . distribution = new GaussianDistribution ( mu - delta / 2 , delta ) ; mixture . add ( c ) ; mixture . remove ( componentToSplit ) ; |
public class MacroErrorManager { /** * Generates Blocks to signify that the passed Macro Block has failed to execute .
* @ param macroToReplace the block for the macro that failed to execute and that we ' ll replace with Block
* showing to the user that macro has failed
* @ param message the message to display to the user in place of the macro result
* @ param throwable the exception for the failed macro execution to display to the user in place of the macro result */
public void generateError ( MacroBlock macroToReplace , String message , Throwable throwable ) { } } | List < Block > errorBlocks = this . errorBlockGenerator . generateErrorBlocks ( message , throwable , macroToReplace . isInline ( ) ) ; macroToReplace . getParent ( ) . replaceChild ( wrapInMacroMarker ( macroToReplace , errorBlocks ) , macroToReplace ) ; |
public class FontCodedGraphicCharacterSetGlobalIdentifierImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . FONT_CODED_GRAPHIC_CHARACTER_SET_GLOBAL_IDENTIFIER__GCSGID : return getGCSGID ( ) ; case AfplibPackage . FONT_CODED_GRAPHIC_CHARACTER_SET_GLOBAL_IDENTIFIER__CPGID : return getCPGID ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class Arith { /** * 注意 : 调用此方法的前提是 , 其中有一个对象的类型已经确定是 BigDecimal */
private BigDecimal [ ] toBigDecimals ( Number left , Number right ) { } } | BigDecimal [ ] ret = new BigDecimal [ 2 ] ; if ( left instanceof BigDecimal ) { ret [ 0 ] = ( BigDecimal ) left ; ret [ 1 ] = new BigDecimal ( right . toString ( ) ) ; } else { ret [ 0 ] = new BigDecimal ( left . toString ( ) ) ; ret [ 1 ] = ( BigDecimal ) right ; } return ret ; |
public class SpyPath { /** * Returns a new path relative to the current one .
* < p > Path only handles scheme : xxx . Subclasses of Path will specialize
* the xxx .
* @ param userPath relative or absolute path , essentially any url .
* @ param newAttributes attributes for the new path .
* @ return the new path or null if the scheme doesn ' t exist */
public PathImpl lookup ( String userPath , Map < String , Object > newAttributes ) { } } | return new SpyPath ( super . lookup ( userPath , newAttributes ) ) ; |
public class PutEventsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( PutEventsRequest putEventsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( putEventsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( putEventsRequest . getApplicationId ( ) , APPLICATIONID_BINDING ) ; protocolMarshaller . marshall ( putEventsRequest . getEventsRequest ( ) , EVENTSREQUEST_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class DataStream { /** * Windows this data stream to a { @ code AllWindowedStream } , which evaluates windows
* over a non key grouped stream . Elements are put into windows by a
* { @ link org . apache . flink . streaming . api . windowing . assigners . WindowAssigner } . The grouping of
* elements is done by window .
* < p > A { @ link org . apache . flink . streaming . api . windowing . triggers . Trigger } can be defined to specify
* when windows are evaluated . However , { @ code WindowAssigners } have a default { @ code Trigger }
* that is used if a { @ code Trigger } is not specified .
* < p > Note : This operation is inherently non - parallel since all elements have to pass through
* the same operator instance .
* @ param assigner The { @ code WindowAssigner } that assigns elements to windows .
* @ return The trigger windows data stream . */
@ PublicEvolving public < W extends Window > AllWindowedStream < T , W > windowAll ( WindowAssigner < ? super T , W > assigner ) { } } | return new AllWindowedStream < > ( this , assigner ) ; |
public class MariaDbDatabaseMetaData { /** * Retrieves a description of the given table ' s indices and statistics . They are ordered by
* NON _ UNIQUE , TYPE , INDEX _ NAME , and ORDINAL _ POSITION .
* < p > Each index column description has the following columns : < / p >
* < ol >
* < li > < B > TABLE _ CAT < / B > String { @ code = > } table catalog ( may be < code > null < / code > ) < / li >
* < li > < B > TABLE _ SCHEM < / B > String { @ code = > } table schema ( may be < code > null < / code > ) < / li >
* < li > < B > TABLE _ NAME < / B > String { @ code = > } table name < / li >
* < li > < B > NON _ UNIQUE < / B > boolean { @ code = > } Can index values be non - unique . false when TYPE is
* tableIndexStatistic < / li >
* < li > < B > INDEX _ QUALIFIER < / B > String { @ code = > } index catalog ( may be < code > null < / code > ) ;
* < code > null < / code >
* when TYPE is tableIndexStatistic < / li >
* < li > < B > INDEX _ NAME < / B > String { @ code = > } index name ; < code > null < / code > when TYPE is
* tableIndexStatistic < / li >
* < li > < B > TYPE < / B > short { @ code = > } index type :
* < ul >
* < li > tableIndexStatistic - this identifies table statistics that are returned in conjuction
* with a table ' s index descriptions
* < li > tableIndexClustered - this is a clustered index
* < li > tableIndexHashed - this is a hashed index
* < li > tableIndexOther - this is some other style of index
* < / ul >
* < / li >
* < li > < B > ORDINAL _ POSITION < / B > short { @ code = > } column sequence number within index ; zero when
* TYPE is tableIndexStatistic < / li > < li > < B > COLUMN _ NAME < / B > String { @ code = > } column name ;
* < code > null < / code > when TYPE is tableIndexStatistic < / li >
* < li > < B > ASC _ OR _ DESC < / B > String { @ code = > } column sort sequence , " A " { @ code = > } ascending , " D "
* { @ code = > } descending , may be < code > null < / code > if sort sequence is not supported ;
* < code > null < / code > when TYPE is tableIndexStatistic < / li > < li > < B > CARDINALITY < / B > long { @ code = > }
* When TYPE is tableIndexStatistic , then this is the number of rows in the table ; otherwise , it
* is the number of unique values in the index . < / li >
* < li > < B > PAGES < / B > long { @ code = > } When TYPE is tableIndexStatisic then this is the number of
* pages used for the table , otherwise it is the number of pages used for the current index . < / li >
* < li > < B > FILTER _ CONDITION < / B > String { @ code = > } Filter condition , if any . ( may be
* < code > null < / code > ) < / li >
* < / ol >
* @ param catalog a catalog name ; must match the catalog name as it is stored in this
* database ; " " retrieves those without a catalog ; < code > null < / code > means that
* the catalog name should not be used to narrow the search
* @ param schema a schema name ; must match the schema name as it is stored in this database ;
* " " retrieves those without a schema ; < code > null < / code > means that the schema
* name should not be used to narrow the search
* @ param table a table name ; must match the table name as it is stored in this database
* @ param unique when true , return only indices for unique values ; when false , return indices
* regardless of whether unique or not
* @ param approximate when true , result is allowed to reflect approximate or out of data values ;
* when false , results are requested to be accurate
* @ return < code > ResultSet < / code > - each row is an index column description
* @ throws SQLException if a database access error occurs */
public ResultSet getIndexInfo ( String catalog , String schema , String table , boolean unique , boolean approximate ) throws SQLException { } } | String sql = "SELECT TABLE_SCHEMA TABLE_CAT, NULL TABLE_SCHEM, TABLE_NAME, NON_UNIQUE, " + " TABLE_SCHEMA INDEX_QUALIFIER, INDEX_NAME, 3 TYPE," + " SEQ_IN_INDEX ORDINAL_POSITION, COLUMN_NAME, COLLATION ASC_OR_DESC," + " CARDINALITY, NULL PAGES, NULL FILTER_CONDITION" + " FROM INFORMATION_SCHEMA.STATISTICS" + " WHERE TABLE_NAME = " + escapeQuote ( table ) + " AND " + catalogCond ( "TABLE_SCHEMA" , catalog ) + ( ( unique ) ? " AND NON_UNIQUE = 0" : "" ) + " ORDER BY NON_UNIQUE, TYPE, INDEX_NAME, ORDINAL_POSITION" ; return executeQuery ( sql ) ; |
public class ServiceLocatorImpl { /** * { @ inheritDoc } */
@ Override public SLEndpoint getEndpoint ( final QName serviceName , final String endpoint ) throws ServiceLocatorException , InterruptedException { } } | if ( LOG . isLoggable ( Level . FINE ) ) { LOG . fine ( "Get endpoint information for endpoint " + endpoint + " within service " + serviceName + "..." ) ; } RootNode rootNode = getBackend ( ) . connect ( ) ; ServiceNode serviceNode = rootNode . getServiceNode ( serviceName ) ; EndpointNode endpointNode = serviceNode . getEndPoint ( endpoint ) ; if ( endpointNode . exists ( ) ) { byte [ ] content = endpointNode . getContent ( ) ; final boolean isLive = endpointNode . isLive ( ) ; return transformer . toSLEndpoint ( serviceName , content , isLive ) ; } else { return null ; } |
public class DataStream { /** * It creates a new { @ link KeyedStream } that uses the provided key with explicit type information
* for partitioning its operator states .
* @ param key The KeySelector to be used for extracting the key for partitioning .
* @ param keyType The type information describing the key type .
* @ return The { @ link DataStream } with partitioned state ( i . e . KeyedStream ) */
public < K > KeyedStream < T , K > keyBy ( KeySelector < T , K > key , TypeInformation < K > keyType ) { } } | Preconditions . checkNotNull ( key ) ; Preconditions . checkNotNull ( keyType ) ; return new KeyedStream < > ( this , clean ( key ) , keyType ) ; |
public class BosClient { /** * Gets the object metadata for the object stored in Bos under the specified bucket and key ,
* and saves the object contents to the specified file .
* Returns < code > null < / code > if the specified constraints weren ' t met .
* @ param bucketName The name of the bucket containing the desired object .
* @ param key The key under which the desired object is stored .
* @ param destinationFile Indicates the file ( which might already exist )
* where to save the object content being downloading from Bos .
* @ return All Bos object metadata for the specified object .
* Returns < code > null < / code > if constraints were specified but not met . */
public ObjectMetadata getObject ( String bucketName , String key , File destinationFile ) { } } | return this . getObject ( new GetObjectRequest ( bucketName , key ) , destinationFile ) ; |
public class RESTDocBuilder { /** * Process the tag on the Controller . */
private void processControllerClass ( ClassDoc controller , Configuration configuration ) { } } | Tag [ ] controllerTagArray = controller . tags ( WRTagTaglet . NAME ) ; for ( int i = 0 ; i < controllerTagArray . length ; i ++ ) { Set < String > controllerTags = WRTagTaglet . getTagSet ( controllerTagArray [ i ] . text ( ) ) ; for ( Iterator < String > iter = controllerTags . iterator ( ) ; iter . hasNext ( ) ; ) { String tag = iter . next ( ) ; if ( ! this . taggedOpenAPIMethods . containsKey ( tag ) ) { this . taggedOpenAPIMethods . put ( tag , new HashSet < MethodDoc > ( ) ) ; } // all action method of this controller should be processed
// later .
for ( int j = 0 ; j < controller . methods ( ) . length ; j ++ ) { if ( configuration . nodeprecated && Util . isDeprecated ( controller . methods ( ) [ j ] ) ) { continue ; } if ( isOpenAPIMethod ( controller . methods ( ) [ j ] ) ) { this . taggedOpenAPIMethods . get ( tag ) . add ( controller . methods ( ) [ j ] ) ; } } } this . wrDoc . getWRTags ( ) . addAll ( controllerTags ) ; } |
public class DacGpioProviderBase { /** * Set the current value in a percentage of the available range instead of a raw value .
* @ param pin
* @ param percent percentage value between 0 and 100. */
public void setPercentValue ( Pin pin , Number percent ) { } } | // validate range
if ( percent . doubleValue ( ) <= 0 ) { setValue ( pin , getMinSupportedValue ( ) ) ; } else if ( percent . doubleValue ( ) >= 100 ) { setValue ( pin , getMaxSupportedValue ( ) ) ; } else { double value = ( getMaxSupportedValue ( ) - getMinSupportedValue ( ) ) * ( percent . doubleValue ( ) / 100f ) ; setValue ( pin , value ) ; } |
public class DeviceImpl { /** * Write attribute ( s ) .
* Invoked when the client request the write _ attributes CORBA operation .
* This method writes new attribute value .
* @ param values
* The attribute ( s ) new set value . There is one AttributeValue
* object for each attribute to be set
* @ exception DevFailed
* Thrown if one of the attribute does not exist . Click < a
* href
* = " . . / . . / tango _ basic / idl _ html / Tango . html # DevFailed " > here
* < / a > to read < b > DevFailed < / b > exception specification */
public void write_attributes ( final AttributeValue [ ] values ) throws DevFailed { } } | Util . out4 . println ( "DeviceImpl.write_attributes arrived" ) ; // Record operation request in black box
blackbox . insert_op ( Op_Write_Attr ) ; // Return exception if the device does not have any attribute
final int nb_dev_attr = dev_attr . get_attr_nb ( ) ; if ( nb_dev_attr == 0 ) { Except . throw_exception ( "API_AttrNotFound" , "The device does not have any attribute" , "DeviceImpl.write_attributes" ) ; } // Retrieve index of wanted attributes in the device attribute list
final long nb_updated_attr = values . length ; final Vector updated_attr = new Vector ( ) ; int i ; for ( i = 0 ; i < nb_updated_attr ; i ++ ) { updated_attr . addElement ( dev_attr . get_attr_ind_by_name ( values [ i ] . name ) ) ; } // Check that these attributes are writable
for ( i = 0 ; i < nb_updated_attr ; i ++ ) { if ( dev_attr . get_attr_by_ind ( ( Integer ) updated_attr . elementAt ( i ) ) . get_writable ( ) == AttrWriteType . READ || dev_attr . get_attr_by_ind ( ( Integer ) updated_attr . elementAt ( i ) ) . get_writable ( ) == AttrWriteType . READ_WITH_WRITE ) { final StringBuffer o = new StringBuffer ( "Attribute " ) ; o . append ( dev_attr . get_attr_by_ind ( ( Integer ) updated_attr . elementAt ( i ) ) . get_name ( ) ) ; o . append ( " is not writable" ) ; Except . throw_exception ( "API_AttrNotWritable" , o . toString ( ) , "DeviceImpl.write_attributes" ) ; } } // Set attribute internal value
for ( i = 0 ; i < nb_updated_attr ; i ++ ) { try { dev_attr . get_w_attr_by_ind ( ( Integer ) updated_attr . elementAt ( i ) ) . set_write_value ( values [ i ] . value ) ; } catch ( final DevFailed ex ) { for ( int j = 0 ; j < i ; j ++ ) { dev_attr . get_w_attr_by_ind ( ( Integer ) updated_attr . elementAt ( j ) ) . rollback ( ) ; } throw ex ; } } // Write the hardware
try { // If nb connection is closed to the maximum value ,
// throw an exception to do not block devices .
Util . increaseAccessConter ( ) ; if ( Util . getAccessConter ( ) > Util . getPoaThreadPoolMax ( ) - 2 ) { Util . decreaseAccessConter ( ) ; Except . throw_exception ( "API_MemoryAllocation" , Util . instance ( ) . get_ds_real_name ( ) + ": No thread available to connect device" , "DeviceImpl.write_attributes()" ) ; } // Call the always _ executed _ hook method before
always_executed_hook ( ) ; switch ( Util . get_serial_model ( ) ) { case BY_CLASS : synchronized ( device_class ) { write_attr_hardware ( updated_attr ) ; } break ; case BY_DEVICE : synchronized ( this ) { write_attr_hardware ( updated_attr ) ; } break ; default : // NO _ SYNC
write_attr_hardware ( updated_attr ) ; } } catch ( final DevFailed exc ) { Util . decreaseAccessConter ( ) ; throw exc ; } catch ( final Exception exc ) { Util . decreaseAccessConter ( ) ; Except . throw_exception ( "API_ExceptionCatched" , exc . toString ( ) , "DeviceImpl.write_attributes" ) ; } Util . decreaseAccessConter ( ) ; // Return to caller .
Util . out4 . println ( "Leaving DeviceImpl.write_attributes" ) ; |
public class dnsnsrec { /** * Use this API to fetch dnsnsrec resource of given name . */
public static dnsnsrec get ( nitro_service service , String domain ) throws Exception { } } | dnsnsrec obj = new dnsnsrec ( ) ; obj . set_domain ( domain ) ; dnsnsrec response = ( dnsnsrec ) obj . get_resource ( service ) ; return response ; |
public class BundleUtils { /** * Checks if the bundle contains a specified key or not .
* If bundle is null , this method will return false ;
* @ param bundle a bundle .
* @ param key a key .
* @ return true if bundle is not null and the key exists in the bundle , false otherwise .
* @ see android . os . Bundle # containsKey ( String ) */
public static boolean containsKey ( @ Nullable Bundle bundle , @ Nullable String key ) { } } | return bundle != null && bundle . containsKey ( key ) ; |
public class MetadataService { /** * Generates the path of { @ link JsonPointer } of permission of the specified { @ code memberId } in the
* specified { @ code repoName } . */
private static JsonPointer perUserPermissionPointer ( String repoName , String memberId ) { } } | return JsonPointer . compile ( "/repos" + encodeSegment ( repoName ) + "/perUserPermissions" + encodeSegment ( memberId ) ) ; |
public class JavacTaskImpl { /** * wrap it here */
public Iterable < ? extends Element > analyze ( Iterable < ? extends Element > classes ) { } } | enter ( null ) ; // ensure all classes have been entered
final ListBuffer < Element > results = new ListBuffer < > ( ) ; try { if ( classes == null ) { handleFlowResults ( compiler . flow ( compiler . attribute ( compiler . todo ) ) , results ) ; } else { Filter f = new Filter ( ) { @ Override public void process ( Env < AttrContext > env ) { handleFlowResults ( compiler . flow ( compiler . attribute ( env ) ) , results ) ; } } ; f . run ( compiler . todo , classes ) ; } } finally { compiler . log . flush ( ) ; } return results ; |
public class UserManager { /** * Change the modifiable data of a user
* @ param sUserID
* The ID of the user to be modified . May be < code > null < / code > .
* @ param sNewLoginName
* The new login name . May not be < code > null < / code > .
* @ param sNewEmailAddress
* The new email address . May be < code > null < / code > .
* @ param sNewFirstName
* The new first name . May be < code > null < / code > .
* @ param sNewLastName
* The new last name . May be < code > null < / code > .
* @ param sNewDescription
* Optional new description for the user . May be < code > null < / code > .
* @ param aNewDesiredLocale
* The new desired locale . May be < code > null < / code > .
* @ param aNewCustomAttrs
* Custom attributes . May be < code > null < / code > .
* @ param bNewDisabled
* < code > true < / code > if the user is disabled
* @ return { @ link EChange } */
@ Nonnull public EChange setUserData ( @ Nullable final String sUserID , @ Nonnull @ Nonempty final String sNewLoginName , @ Nullable final String sNewEmailAddress , @ Nullable final String sNewFirstName , @ Nullable final String sNewLastName , @ Nullable final String sNewDescription , @ Nullable final Locale aNewDesiredLocale , @ Nullable final Map < String , String > aNewCustomAttrs , final boolean bNewDisabled ) { } } | // Resolve user
final User aUser = getOfID ( sUserID ) ; if ( aUser == null ) { AuditHelper . onAuditModifyFailure ( User . OT , sUserID , "no-such-user-id" ) ; return EChange . UNCHANGED ; } m_aRWLock . writeLock ( ) . lock ( ) ; try { EChange eChange = aUser . setLoginName ( sNewLoginName ) ; eChange = eChange . or ( aUser . setEmailAddress ( sNewEmailAddress ) ) ; eChange = eChange . or ( aUser . setFirstName ( sNewFirstName ) ) ; eChange = eChange . or ( aUser . setLastName ( sNewLastName ) ) ; eChange = eChange . or ( aUser . setDescription ( sNewDescription ) ) ; eChange = eChange . or ( aUser . setDesiredLocale ( aNewDesiredLocale ) ) ; eChange = eChange . or ( aUser . setDisabled ( bNewDisabled ) ) ; eChange = eChange . or ( aUser . attrs ( ) . setAll ( aNewCustomAttrs ) ) ; if ( eChange . isUnchanged ( ) ) return EChange . UNCHANGED ; BusinessObjectHelper . setLastModificationNow ( aUser ) ; internalUpdateItem ( aUser ) ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } AuditHelper . onAuditModifySuccess ( User . OT , "all" , aUser . getID ( ) , sNewLoginName , sNewEmailAddress , sNewFirstName , sNewLastName , sNewDescription , aNewDesiredLocale , aNewCustomAttrs , Boolean . valueOf ( bNewDisabled ) ) ; // Execute callback as the very last action
m_aCallbacks . forEach ( aCB -> aCB . onUserUpdated ( aUser ) ) ; return EChange . CHANGED ; |
public class MemoryStatusHealthCheck { /** * 可用内存阈值 = 5M */
@ Override protected Result check ( ) throws Exception { } } | Runtime runtime = Runtime . getRuntime ( ) ; long freeMemory = runtime . freeMemory ( ) ; long totalMemory = runtime . totalMemory ( ) ; long maxMemory = runtime . maxMemory ( ) ; boolean ok = maxMemory - ( totalMemory - freeMemory ) > avalibleMemthreshold ; // 剩余空间小于2M报警
if ( ok ) { return Result . healthy ( ) ; } else { String msg = "max:" + ( maxMemory / 1024 / 1024 ) + "M,total:" + ( totalMemory / 1024 / 1024 ) + "M,used:" + ( ( totalMemory / 1024 / 1024 ) - ( freeMemory / 1024 / 1024 ) ) + "M,free:" + ( freeMemory / 1024 / 1024 ) + "M" ; return Result . unhealthy ( msg ) ; } |
public class CmsRemoteShellServer { /** * Initializes the RMI registry and exports the remote shell provider to it . < p > */
public void initServer ( ) { } } | if ( m_initialized ) { return ; } try { m_registry = LocateRegistry . createRegistry ( m_port ) ; m_provider = new CmsRemoteShellProvider ( m_port ) ; I_CmsRemoteShellProvider providerStub = ( I_CmsRemoteShellProvider ) ( UnicastRemoteObject . exportObject ( m_provider , m_port ) ) ; m_registry . bind ( CmsRemoteShellConstants . PROVIDER , providerStub ) ; m_initialized = true ; } catch ( Exception e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } |
public class GitLabApi { /** * Enable the logging of the requests to and the responses from the GitLab server API using the
* specified logger . Logging will mask PRIVATE - TOKEN and Authorization headers .
* @ param logger the Logger instance to log to
* @ param level the logging level ( SEVERE , WARNING , INFO , CONFIG , FINE , FINER , FINEST )
* @ param maxEntitySize maximum number of entity bytes to be logged . When logging if the maxEntitySize
* is reached , the entity logging will be truncated at maxEntitySize and " . . . more . . . " will be added at
* the end of the log entry . If maxEntitySize is & lt ; = 0 , entity logging will be disabled */
public void enableRequestResponseLogging ( Logger logger , Level level , int maxEntitySize ) { } } | enableRequestResponseLogging ( logger , level , maxEntitySize , MaskingLoggingFilter . DEFAULT_MASKED_HEADER_NAMES ) ; |
public class ArmeriaHttpUtil { /** * Converts the specified Netty HTTP / 1 headers into Armeria HTTP / 2 headers . */
public static HttpHeaders toArmeria ( io . netty . handler . codec . http . HttpHeaders inHeaders ) { } } | if ( inHeaders . isEmpty ( ) ) { return HttpHeaders . EMPTY_HEADERS ; } final HttpHeaders out = new DefaultHttpHeaders ( true , inHeaders . size ( ) ) ; toArmeria ( inHeaders , out ) ; return out ; |
public class SVG { /** * Read and parse an SVG from the given resource location .
* @ param resources the set of Resources in which to locate the file .
* @ param resourceId the resource identifier of the SVG document .
* @ return an SVG instance on which you can call one of the render methods .
* @ throws SVGParseException if there is an error parsing the document .
* @ since 1.2.1 */
@ SuppressWarnings ( "WeakerAccess" ) public static SVG getFromResource ( Resources resources , int resourceId ) throws SVGParseException { } } | SVGParser parser = new SVGParser ( ) ; InputStream is = resources . openRawResource ( resourceId ) ; try { return parser . parse ( is , enableInternalEntities ) ; } finally { try { is . close ( ) ; } catch ( IOException e ) { // Do nothing
} } |
public class Controller { /** * Calls startActivityForResult ( Intent , int , Bundle ) from this Controller ' s host Activity . */
public final void startActivityForResult ( @ NonNull final Intent intent , final int requestCode , @ Nullable final Bundle options ) { } } | executeWithRouter ( new RouterRequiringFunc ( ) { @ Override public void execute ( ) { router . startActivityForResult ( instanceId , intent , requestCode , options ) ; } } ) ; |
public class UtilJdbc { /** * Returns a JDBC row data structure from a Stratio Deep Entity .
* @ param entity Stratio Deep entity .
* @ param < T > Stratio Deep entity type .
* @ return JDBC row data structure from a Stratio Deep Entity .
* @ throws IllegalAccessException
* @ throws InstantiationException
* @ throws InvocationTargetException */
public static < T > Map < String , Object > getRowFromObject ( T entity ) throws IllegalAccessException , InstantiationException , InvocationTargetException { } } | Field [ ] fields = AnnotationUtils . filterDeepFields ( entity . getClass ( ) ) ; Map < String , Object > row = new HashMap < > ( ) ; for ( Field field : fields ) { Method method = Utils . findGetter ( field . getName ( ) , entity . getClass ( ) ) ; Object object = method . invoke ( entity ) ; if ( object != null ) { row . put ( AnnotationUtils . deepFieldName ( field ) , object ) ; } } return row ; |
public class OObjectDatabaseTx { /** * Create a new POJO by its class name . Assure to have called the registerEntityClasses ( ) declaring the packages that are part of
* entity classes .
* @ see OEntityManager . registerEntityClasses ( String ) */
public < RET extends Object > RET newInstance ( final String iClassName , final Object iEnclosingClass , Object ... iArgs ) { } } | checkSecurity ( ODatabaseSecurityResources . CLASS , ORole . PERMISSION_CREATE , iClassName ) ; try { RET enhanced = ( RET ) OObjectEntityEnhancer . getInstance ( ) . getProxiedInstance ( entityManager . getEntityClass ( iClassName ) , iEnclosingClass , underlying . newInstance ( iClassName ) , iArgs ) ; return ( RET ) enhanced ; } catch ( Exception e ) { OLogManager . instance ( ) . error ( this , "Error on creating object of class " + iClassName , e , ODatabaseException . class ) ; } return null ; |
public class DataSetBuilder { /** * Set random filler using < code > int < / code > values .
* The specified column will be filled with values that
* are uniformly sampled from the interval < code > [ min , max ] < / code > .
* @ param column Column name .
* @ param min Minimum value .
* @ param max Maximum value .
* @ return The builder instance ( for chained calls ) .
* @ see # random ( String , long , long )
* @ see # random ( String , float , float )
* @ see # random ( String , double , double ) */
public DataSetBuilder random ( String column , int min , int max ) { } } | ensureValidRange ( min , max ) ; int n = max - min + 1 ; return set ( column , ( ) -> min + rng . nextInt ( n ) ) ; |
public class BitIntegrityErrorTask { /** * / * ( non - Javadoc )
* @ see org . duracloud . common . queue . task . TypedTask # readTask ( org . duracloud . common . queue . task . Task ) */
@ Override public void readTask ( Task task ) { } } | super . readTask ( task ) ; this . description = task . getProperty ( DESCRIPTION_KEY ) ; this . contentChecksum = task . getProperty ( CONTENT_CHECKSUM_KEY ) ; this . storeChecksum = task . getProperty ( STORE_CHECKSUM_KEY ) ; this . storeType = StorageProviderType . valueOf ( task . getProperty ( STORE_TYPE_KEY ) ) ; this . manifestChecksum = task . getProperty ( MANIFEST_CHECKSUM_CHECKSUM_KEY ) ; |
public class NodeManager { /** * Update metrics for alive / dead nodes . */
private void setAliveDeadMetrics ( ) { } } | clusterManager . getMetrics ( ) . setAliveNodes ( nameToNode . size ( ) ) ; int totalHosts = hostsReader . getHosts ( ) . size ( ) ; if ( totalHosts > 0 ) { clusterManager . getMetrics ( ) . setDeadNodes ( totalHosts - nameToNode . size ( ) ) ; } |
public class ViewHandler { /** * / / / / / Execute SQL command on the DDF / / / / / */
private DDF sql2ddf ( String sqlCommand , String errorMessage ) throws DDFException { } } | try { return this . getManager ( ) . sql2ddf ( String . format ( sqlCommand , "{1}" ) , new SQLDataSourceDescriptor ( sqlCommand , null , null , null , this . getDDF ( ) . getUUID ( ) . toString ( ) ) ) ; } catch ( Exception e ) { throw new DDFException ( String . format ( errorMessage , this . getDDF ( ) . getTableName ( ) ) , e ) ; } |
public class VisOdomDirectColorDepth { /** * Initialize motion related data structures */
void initMotion ( Planar < I > input ) { } } | if ( solver == null ) { solver = LinearSolverFactory_DDRM . qr ( input . width * input . height * input . getNumBands ( ) , 6 ) ; } // compute image derivative and setup interpolation functions
computeD . process ( input , derivX , derivY ) ; |
public class SystemKeyspace { /** * Return a map of store host _ ids to IP addresses */
public static Map < InetAddress , UUID > loadHostIds ( ) { } } | Map < InetAddress , UUID > hostIdMap = new HashMap < InetAddress , UUID > ( ) ; for ( UntypedResultSet . Row row : executeInternal ( "SELECT peer, host_id FROM system." + PEERS_CF ) ) { InetAddress peer = row . getInetAddress ( "peer" ) ; if ( row . has ( "host_id" ) ) { hostIdMap . put ( peer , row . getUUID ( "host_id" ) ) ; } } return hostIdMap ; |
public class JpegSegmentData { /** * Removes a specified instance of a segment ' s data from the collection . Use this method when more than one
* occurrence of segment data exists for a given type exists .
* @ param segmentType identifies the required segment
* @ param occurrence the zero - based index of the segment occurrence to remove . */
@ SuppressWarnings ( { } } | "MismatchedQueryAndUpdateOfCollection" } ) public void removeSegmentOccurrence ( @ NotNull JpegSegmentType segmentType , int occurrence ) { removeSegmentOccurrence ( segmentType . byteValue , occurrence ) ; |
public class UTF8String { /** * Find the ` str ` from left to right . */
private int find ( UTF8String str , int start ) { } } | assert ( str . numBytes > 0 ) ; while ( start <= numBytes - str . numBytes ) { if ( ByteArrayMethods . arrayEquals ( base , offset + start , str . base , str . offset , str . numBytes ) ) { return start ; } start += 1 ; } return - 1 ; |
public class ConverterTimeFormats { /** * Returns an ordered functional blend of all input parsers . The attempter will try all functions until it succeeds .
* If none succeed will re - throw the first exception
* @ param parsers ordered sequence of parsers to try to convert a CharSequence into a TemporalAccessor
* @ return ordered functional blend of all input parsers */
@ SafeVarargs public static Function < CharSequence , TemporalAccessor > orderedParseAttempter ( Function < CharSequence , TemporalAccessor > ... parsers ) { } } | return date -> { RuntimeException first = null ; for ( Function < CharSequence , TemporalAccessor > parser : parsers ) { try { return parser . apply ( date ) ; } catch ( RuntimeException ex ) { if ( first == null ) first = ex ; } } if ( first == null ) throw new IllegalStateException ( "Empty parse attempter" ) ; throw first ; } ; |
public class Config { /** * Looks up a configuration variable in the " request " scope .
* < p > The lookup of configuration variables is performed as if each scope
* had its own name space , that is , the same configuration variable name
* in one scope does not replace one stored in a different scope .
* @ param request Request object in which the configuration variable is to
* be looked up
* @ param name Configuration variable name
* @ return The < tt > java . lang . Object < / tt > associated with the configuration
* variable , or null if it is not defined . */
public static Object get ( ServletRequest request , String name ) { } } | return request . getAttribute ( name + REQUEST_SCOPE_SUFFIX ) ; |
public class MathUtils { /** * Generates a binomial distributed number using
* the given rng
* @ param rng
* @ param n
* @ param p
* @ return */
public static int binomial ( RandomGenerator rng , int n , double p ) { } } | if ( ( p < 0 ) || ( p > 1 ) ) { return 0 ; } int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( rng . nextDouble ( ) < p ) { c ++ ; } } return c ; |
public class CmsModuleAddResourceTypes { /** * Returns the next available resource type id . < p >
* @ return the resource type id */
private int findNextTypeId ( ) { } } | int result = ( int ) ( 20000 + Math . round ( Math . random ( ) * 1000 ) ) ; for ( I_CmsResourceType type : OpenCms . getResourceManager ( ) . getResourceTypes ( ) ) { if ( type . getTypeId ( ) >= result ) { result = type . getTypeId ( ) + 1 ; } } return result ; |
public class WaitHelper { /** * Wait until one of the expected values was returned or the number of wait cycles has been exceeded . Throws
* { @ link IllegalStateException } if the timeout is reached .
* @ param function
* Function to read the value from .
* @ param expectedValues
* List of values that are acceptable .
* @ return Result .
* @ throws Exception
* The function raised an exception .
* @ param < T >
* Expected return type that must be an object that support equals / hasCode that is not the { @ link Object } ' s default method . */
public < T > T waitUntilResult ( final Callable < T > function , final List < T > expectedValues ) throws Exception { } } | final List < T > actualResults = new ArrayList < > ( ) ; int tries = 0 ; while ( tries < maxTries ) { final T result = function . call ( ) ; if ( expectedValues . contains ( result ) ) { return result ; } actualResults . add ( result ) ; tries ++ ; Utils4J . sleep ( sleepMillis ) ; } throw new IllegalStateException ( "Waited too long for one of the expected results: " + expectedValues + ", Actual results: " + actualResults ) ; |
public class IssueCategoryRegistry { /** * Loads the related graph vertex for the given { @ link IssueCategory } . */
public static IssueCategoryModel loadFromGraph ( GraphContext graphContext , IssueCategory issueCategory ) { } } | return loadFromGraph ( graphContext . getFramed ( ) , issueCategory . getCategoryID ( ) ) ; |
public class AsyncDiskService { /** * Shut down all ThreadPools immediately . */
public synchronized List < Runnable > shutdownNow ( ) { } } | LOG . info ( "Shutting down all AsyncDiskService threads immediately..." ) ; List < Runnable > list = new ArrayList < Runnable > ( ) ; for ( Map . Entry < String , ThreadPoolExecutor > e : executors . entrySet ( ) ) { list . addAll ( e . getValue ( ) . shutdownNow ( ) ) ; } return list ; |
public class FrameworkBootstrap { /** * / * private void initRouter ( Router router , Injector localInjector ) {
* router . compileRoutes ( localInjector . getInstance ( ActionInvoker . class ) ) ;
* RouterImpl router = ( RouterImpl ) localInjector . getInstance ( Router . class ) ;
* ActionInvoker invoker = localInjector . getInstance ( ActionInvoker . class ) ;
* ( ( RouterImpl ) router ) . compileRoutes ( invoker ) ; */
private ModuleBootstrap [ ] readRegisteredPlugins ( ApplicationConfig config , String pluginsPackage ) { } } | try { ClassLocator locator = new ClassLocator ( pluginsPackage ) ; return locateAll ( locator , ModuleBootstrap . class , impl -> impl . bootstrap ( config ) ) ; } catch ( IllegalArgumentException e ) { logger . warn ( "Did not find any " + ModuleBootstrap . class . getSimpleName ( ) + " implementations" , e ) ; return null ; } |
public class Controller { /** * Read a configuration from the database whose name matches the the given
* configuration name */
public MigrationConfiguration getMigrationConfiguration ( String configurationName ) throws IOException , LightblueException { } } | DataFindRequest findRequest = new DataFindRequest ( "migrationConfiguration" , null ) ; findRequest . where ( Query . and ( Query . withValue ( "configurationName" , Query . eq , configurationName ) , Query . withValue ( "consistencyCheckerName" , Query . eq , cfg . getName ( ) ) ) ) ; findRequest . select ( Projection . includeFieldRecursively ( "*" ) ) ; LOGGER . debug ( "Loading configuration:{}" , findRequest . getBody ( ) ) ; return lightblueClient . data ( findRequest , MigrationConfiguration . class ) ; |
public class OEmbedRequest { /** * / * package */
HttpParameter [ ] asHttpParameterArray ( ) { } } | ArrayList < HttpParameter > params = new ArrayList < HttpParameter > ( 12 ) ; appendParameter ( "id" , statusId , params ) ; appendParameter ( "url" , url , params ) ; appendParameter ( "maxwidth" , maxWidth , params ) ; params . add ( new HttpParameter ( "hide_media" , hideMedia ) ) ; params . add ( new HttpParameter ( "hide_thread" , hideThread ) ) ; params . add ( new HttpParameter ( "omit_script" , omitScript ) ) ; params . add ( new HttpParameter ( "align" , align . name ( ) . toLowerCase ( ) ) ) ; if ( related . length > 0 ) { appendParameter ( "related" , StringUtil . join ( related ) , params ) ; } appendParameter ( "lang" , lang , params ) ; if ( widgetType != WidgetType . NONE ) { params . add ( new HttpParameter ( "widget_type" , widgetType . name ( ) . toLowerCase ( ) ) ) ; params . add ( new HttpParameter ( "hide_tweet" , hideTweet ) ) ; } HttpParameter [ ] paramArray = new HttpParameter [ params . size ( ) ] ; return params . toArray ( paramArray ) ; |
public class ExpressionDecomposer { /** * Create an expression tree for an expression .
* < p > If the result of the expression is needed , then :
* < pre >
* ASSIGN
* tempName
* expr
* < / pre >
* otherwise , simply : ` expr ` */
private static Node buildResultExpression ( Node expr , boolean needResult , String tempName ) { } } | if ( needResult ) { JSType type = expr . getJSType ( ) ; return withType ( IR . assign ( withType ( IR . name ( tempName ) , type ) , expr ) , type ) . srcrefTree ( expr ) ; } else { return expr ; } |
public class PropertySet { /** * Removes a property from this set . */
public PropertySet remove ( String property ) { } } | String candidate = StringUtils . trimToNull ( property ) ; if ( candidate != null ) { properties_ . remove ( candidate , 1 ) ; } return this ; |
public class CPSpecificationOptionPersistenceImpl { /** * Returns a range of all the cp specification options .
* 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 result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CPSpecificationOptionModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param start the lower bound of the range of cp specification options
* @ param end the upper bound of the range of cp specification options ( not inclusive )
* @ return the range of cp specification options */
@ Override public List < CPSpecificationOption > findAll ( int start , int end ) { } } | return findAll ( start , end , null ) ; |
public class User { /** * Authenticates the user , using its authentication credentials and the authentication method
* corresponding to its Context .
* @ see SessionManagementMethod
* @ see AuthenticationMethod
* @ see Context */
public void authenticate ( ) { } } | log . info ( "Authenticating user: " + this . name ) ; WebSession result = null ; try { result = getContext ( ) . getAuthenticationMethod ( ) . authenticate ( getContext ( ) . getSessionManagementMethod ( ) , this . authenticationCredentials , this ) ; } catch ( UnsupportedAuthenticationCredentialsException e ) { log . error ( "User does not have the expected type of credentials:" , e ) ; } // no issues appear if a simultaneous call to # queueAuthentication ( ) is made
synchronized ( this ) { this . lastSuccessfulAuthTime = System . currentTimeMillis ( ) ; this . authenticatedSession = result ; } |
public class ServerDnsAliasesInner { /** * Gets a list of server DNS aliases for a server .
* @ 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 that the alias is pointing to .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; ServerDnsAliasInner & gt ; object */
public Observable < Page < ServerDnsAliasInner > > listByServerAsync ( final String resourceGroupName , final String serverName ) { } } | return listByServerWithServiceResponseAsync ( resourceGroupName , serverName ) . map ( new Func1 < ServiceResponse < Page < ServerDnsAliasInner > > , Page < ServerDnsAliasInner > > ( ) { @ Override public Page < ServerDnsAliasInner > call ( ServiceResponse < Page < ServerDnsAliasInner > > response ) { return response . body ( ) ; } } ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.