signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AsyncCompressedCubemapTexture { /** * The API */
static void loadTexture ( GVRContext gvrContext , CancelableCallback < GVRCompressedCubemapImage > callback , GVRAndroidResource resource , int priority , Map < String , Integer > map ) { } } | faceIndexMap = map ; AsyncManager . get ( ) . getScheduler ( ) . registerCallback ( gvrContext , TEXTURE_CLASS , callback , resource , priority ) ; |
public class Assignment { /** * Creates an { @ code Assignment } mapping each variable in { @ code vars } to
* the value at the corresponding index of { @ code values } . { @ code vars }
* must be sorted in ascending order . This method does not copy either
* { @ code vars } or { @ code values } ; the caller should not read or modify
* either of these arrays after invoking this method .
* @ param vars
* @ param values
* @ return */
public static final Assignment fromSortedArrays ( int [ ] vars , Object [ ] values ) { } } | // Verify that the assignment is sorted and contains no duplicate values .
for ( int i = 1 ; i < vars . length ; i ++ ) { Preconditions . checkArgument ( vars [ i - 1 ] < vars [ i ] , "Illegal assignment variable nums: %s %s" , vars [ i - 1 ] , vars [ i ] ) ; } return new Assignment ( vars , values ) ; |
public class ST_Graph { /** * Create the nodes and edges tables from the input table containing
* LINESTRINGs in the given column and using the given
* tolerance , and potentially orienting edges by slope .
* The tolerance value is used specify the side length of a square Envelope
* around each node used to snap together other nodes within the same
* Envelope . Note , however , that edge geometries are left untouched .
* Note also that coordinates within a given tolerance of each
* other are not necessarily snapped together . Only the first and last
* coordinates of a geometry are considered to be potential nodes , and
* only nodes within a given tolerance of each other are snapped
* together . The tolerance works only in metric units .
* The boolean orientBySlope is set to true if edges should be oriented by
* the z - value of their first and last coordinates ( decreasing ) .
* If the input table has name ' input ' , then the output tables are named
* ' input _ nodes ' and ' input _ edges ' .
* @ param connection Connection
* @ param inputTable Input table
* @ param spatialFieldName Name of column containing LINESTRINGs
* @ param tolerance Tolerance
* @ param orientBySlope True if edges should be oriented by the z - value of
* their first and last coordinates ( decreasing )
* @ param deleteTables True delete the existing tables
* @ return true if both output tables were created
* @ throws SQLException */
public static boolean createGraph ( Connection connection , String inputTable , String spatialFieldName , double tolerance , boolean orientBySlope , boolean deleteTables ) throws SQLException { } } | if ( tolerance < 0 ) { throw new IllegalArgumentException ( "Only positive tolerances are allowed." ) ; } final TableLocation tableName = TableUtilities . parseInputTable ( connection , inputTable ) ; final TableLocation nodesName = TableUtilities . suffixTableLocation ( tableName , NODES_SUFFIX ) ; final TableLocation edgesName = TableUtilities . suffixTableLocation ( tableName , EDGES_SUFFIX ) ; boolean isH2 = JDBCUtilities . isH2DataBase ( connection . getMetaData ( ) ) ; if ( deleteTables ) { try ( Statement stmt = connection . createStatement ( ) ) { StringBuilder sb = new StringBuilder ( "drop table if exists " ) ; sb . append ( nodesName . toString ( isH2 ) ) . append ( "," ) . append ( edgesName . toString ( isH2 ) ) ; stmt . execute ( sb . toString ( ) ) ; } } // Check if ST _ Graph has already been run on this table .
else if ( JDBCUtilities . tableExists ( connection , nodesName . getTable ( ) ) || JDBCUtilities . tableExists ( connection , edgesName . getTable ( ) ) ) { throw new IllegalArgumentException ( ALREADY_RUN_ERROR + tableName . getTable ( ) ) ; } // Tables used to store intermediate data
PTS_TABLE = TableLocation . parse ( System . currentTimeMillis ( ) + "_PTS" , isH2 ) . toString ( ) ; COORDS_TABLE = TableLocation . parse ( System . currentTimeMillis ( ) + "_COORDS" , isH2 ) . toString ( ) ; // Check for a primary key
final int pkIndex = JDBCUtilities . getIntegerPrimaryKey ( connection , tableName . getTable ( ) ) ; if ( pkIndex == 0 ) { throw new IllegalStateException ( "Table " + tableName . getTable ( ) + " must contain a single integer primary key." ) ; } final DatabaseMetaData md = connection . getMetaData ( ) ; final String pkColName = JDBCUtilities . getFieldName ( md , tableName . getTable ( ) , pkIndex ) ; // Check the geometry column type ;
final Object [ ] spatialFieldIndexAndName = getSpatialFieldIndexAndName ( connection , tableName , spatialFieldName ) ; int spatialFieldIndex = ( int ) spatialFieldIndexAndName [ 1 ] ; spatialFieldName = ( String ) spatialFieldIndexAndName [ 0 ] ; checkGeometryType ( connection , tableName , spatialFieldIndex ) ; final String geomCol = JDBCUtilities . getFieldName ( md , tableName . getTable ( ) , spatialFieldIndex ) ; final Statement st = connection . createStatement ( ) ; try { firstFirstLastLast ( st , tableName , pkColName , geomCol , tolerance ) ; int srid = SFSUtilities . getSRID ( connection , tableName , spatialFieldName ) ; makeEnvelopes ( st , tolerance , isH2 , srid ) ; nodesTable ( st , nodesName , tolerance , isH2 , srid ) ; edgesTable ( st , nodesName , edgesName , tolerance , isH2 ) ; checkForNullEdgeEndpoints ( st , edgesName ) ; if ( orientBySlope ) { orientBySlope ( st , nodesName , edgesName ) ; } } finally { st . execute ( "DROP TABLE IF EXISTS " + PTS_TABLE + "," + COORDS_TABLE ) ; st . close ( ) ; } return true ; |
public class ExclusiveGatewayActivityBehavior { /** * The default behaviour of BPMN , taking every outgoing sequence flow
* ( where the condition evaluates to true ) , is not valid for an exclusive
* gateway .
* Hence , this behaviour is overriden and replaced by the correct behavior :
* selecting the first sequence flow which condition evaluates to true
* ( or which hasn ' t got a condition ) and leaving the activity through that
* sequence flow .
* If no sequence flow is selected ( ie all conditions evaluate to false ) ,
* then the default sequence flow is taken ( if defined ) . */
@ Override public void doLeave ( ActivityExecution execution ) { } } | LOG . leavingActivity ( execution . getActivity ( ) . getId ( ) ) ; PvmTransition outgoingSeqFlow = null ; String defaultSequenceFlow = ( String ) execution . getActivity ( ) . getProperty ( "default" ) ; Iterator < PvmTransition > transitionIterator = execution . getActivity ( ) . getOutgoingTransitions ( ) . iterator ( ) ; while ( outgoingSeqFlow == null && transitionIterator . hasNext ( ) ) { PvmTransition seqFlow = transitionIterator . next ( ) ; Condition condition = ( Condition ) seqFlow . getProperty ( BpmnParse . PROPERTYNAME_CONDITION ) ; if ( ( condition == null && ( defaultSequenceFlow == null || ! defaultSequenceFlow . equals ( seqFlow . getId ( ) ) ) ) || ( condition != null && condition . evaluate ( execution ) ) ) { LOG . outgoingSequenceFlowSelected ( seqFlow . getId ( ) ) ; outgoingSeqFlow = seqFlow ; } } if ( outgoingSeqFlow != null ) { execution . leaveActivityViaTransition ( outgoingSeqFlow ) ; } else { if ( defaultSequenceFlow != null ) { PvmTransition defaultTransition = execution . getActivity ( ) . findOutgoingTransition ( defaultSequenceFlow ) ; if ( defaultTransition != null ) { execution . leaveActivityViaTransition ( defaultTransition ) ; } else { throw LOG . missingDefaultFlowException ( execution . getActivity ( ) . getId ( ) , defaultSequenceFlow ) ; } } else { // No sequence flow could be found , not even a default one
throw LOG . stuckExecutionException ( execution . getActivity ( ) . getId ( ) ) ; } } |
public class JsonConfig { /** * Registers exclusions for a target class . < br >
* [ Java - & gt ; JSON ]
* @ param target the class to use as key
* @ param properties the properties to be excluded */
public void registerPropertyExclusions ( Class target , String [ ] properties ) { } } | if ( target != null && properties != null && properties . length > 0 ) { Set set = ( Set ) exclusionMap . get ( target ) ; if ( set == null ) { set = new HashSet ( ) ; exclusionMap . put ( target , set ) ; } for ( int i = 0 ; i < properties . length ; i ++ ) { if ( ! set . contains ( properties [ i ] ) ) { set . add ( properties [ i ] ) ; } } } |
public class ForeignDestinationHandler { /** * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . impl . interfaces . DestinationHandler # getDefinition ( ) */
@ Override public BaseDestinationDefinition getDefinition ( ) { } } | if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getDefinition" ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getDefinition" , _definition ) ; return _definition ; |
public class IoTDiscoveryManager { /** * Try to find an XMPP IoT registry .
* @ return the JID of a Thing Registry if one could be found , < code > null < / code > otherwise .
* @ throws InterruptedException
* @ throws NotConnectedException
* @ throws XMPPErrorException
* @ throws NoResponseException
* @ see < a href = " http : / / xmpp . org / extensions / xep - 0347 . html # findingregistry " > XEP - 0347 § 3.5 Finding Thing Registry < / a > */
public Jid findRegistry ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } } | if ( preconfiguredRegistry != null ) { return preconfiguredRegistry ; } final XMPPConnection connection = connection ( ) ; ServiceDiscoveryManager sdm = ServiceDiscoveryManager . getInstanceFor ( connection ) ; List < DiscoverInfo > discoverInfos = sdm . findServicesDiscoverInfo ( Constants . IOT_DISCOVERY_NAMESPACE , true , true ) ; if ( ! discoverInfos . isEmpty ( ) ) { return discoverInfos . get ( 0 ) . getFrom ( ) ; } return null ; |
public class ByteBufUtil { /** * Writes the { @ link Xid } to the { @ link ByteBuf } .
* @ param buf the buffer to write to .
* @ param xid the { @ link Xid } to encode */
public static void writeXid ( ByteBuf buf , Xid xid ) { } } | if ( xid instanceof RemoteXid ) { ( ( RemoteXid ) xid ) . writeTo ( buf ) ; } else { ByteBufUtil . writeSignedVInt ( buf , xid . getFormatId ( ) ) ; writeArray ( buf , xid . getGlobalTransactionId ( ) ) ; writeArray ( buf , xid . getBranchQualifier ( ) ) ; } |
public class DecoratingDynamicTypeBuilder { /** * { @ inheritDoc } */
public DynamicType . Builder < T > require ( Collection < DynamicType > auxiliaryTypes ) { } } | return new DecoratingDynamicTypeBuilder < T > ( instrumentedType , typeAttributeAppender , asmVisitorWrapper , classFileVersion , auxiliaryTypeNamingStrategy , annotationValueFilterFactory , annotationRetention , implementationContextFactory , methodGraphCompiler , typeValidation , classWriterStrategy , ignoredMethods , CompoundList . of ( this . auxiliaryTypes , new ArrayList < DynamicType > ( auxiliaryTypes ) ) , classFileLocator ) ; |
public class JarURLConnectionImpl { /** * Returns the Jar file referred by this { @ code URLConnection }
* @ throws IOException
* if an IO error occurs while connecting to the resource . */
private void findJarFile ( ) throws IOException { } } | if ( getUseCaches ( ) ) { synchronized ( jarCache ) { jarFile = jarCache . get ( jarFileURL ) ; } if ( jarFile == null ) { JarFile jar = openJarFile ( ) ; synchronized ( jarCache ) { jarFile = jarCache . get ( jarFileURL ) ; if ( jarFile == null ) { jarCache . put ( jarFileURL , jar ) ; jarFile = jar ; } else { jar . close ( ) ; } } } } else { jarFile = openJarFile ( ) ; } if ( jarFile == null ) { throw new IOException ( ) ; } |
public class ProductSegmentation { /** * Gets the operatingSystemVersionSegment value for this ProductSegmentation .
* @ return operatingSystemVersionSegment * The operating system version segmentation . { @ link OperatingSystemVersionTargeting # isTargeted }
* must be { @ code true } .
* < p > This attribute is optional . */
public com . google . api . ads . admanager . axis . v201811 . OperatingSystemVersionTargeting getOperatingSystemVersionSegment ( ) { } } | return operatingSystemVersionSegment ; |
public class StatusNotificationRequestHandler { /** * Gets the { @ code ComponentStatus } from a given { @ code ChargePointStatus } .
* @ param status the { @ code ChargePointStatus } .
* @ return the { @ code ComponentStatus } . */
private ComponentStatus getComponentStatusFromChargePointStatus ( Statusnotification . Status status ) { } } | String value = status . toString ( ) ; if ( Statusnotification . Status . UNAVAILABLE . toString ( ) . equalsIgnoreCase ( value ) ) { value = ComponentStatus . INOPERATIVE . value ( ) ; } return ComponentStatus . fromValue ( value ) ; |
public class GeoLocation { /** * Returns true if field corresponding to fieldID is set ( has been assigned a value ) and false otherwise */
public boolean isSet ( _Fields field ) { } } | if ( field == null ) { throw new IllegalArgumentException ( ) ; } switch ( field ) { case ID : return isSetId ( ) ; case LATITUDE : return isSetLatitude ( ) ; case LONGITUDE : return isSetLongitude ( ) ; } throw new IllegalStateException ( ) ; |
public class JSCSSMergeServlet { /** * / * ( non - Javadoc )
* @ see javax . servlet . http . HttpServlet # doGet ( javax . servlet . http . HttpServletRequest , javax . servlet . http . HttpServletResponse ) */
@ Override protected void doGet ( HttpServletRequest req , HttpServletResponse resp ) throws ServletException , IOException { } } | String url = this . getURL ( req ) ; LOGGER . debug ( "Started processing request : {}" , url ) ; List < String > resourcesToMerge = findResourcesToMerge ( req . getContextPath ( ) , url ) ; String extensionOrPath = detectExtension ( url ) ; // in case of non js / css files it null
if ( extensionOrPath . isEmpty ( ) ) { extensionOrPath = resourcesToMerge . get ( 0 ) ; // non grouped i . e . non css / js file , we refer it ' s path in that case
} // If not modified , return 304 and stop
ResourceStatus status = JSCSSMergeServlet . isNotModified ( this . getServletContext ( ) , req , resourcesToMerge , this . turnOffETag ) ; if ( status . isNotModified ( ) ) { LOGGER . trace ( "Resources Not Modified. Sending 304." ) ; String ETag = ! this . turnOffETag ? status . getActualETag ( ) : null ; JSCSSMergeServlet . sendNotModified ( resp , extensionOrPath , ETag , this . expiresMinutes , this . cacheControl , this . overrideExistingHeaders ) ; return ; } // Add appropriate headers
this . addAppropriateResponseHeaders ( extensionOrPath , resourcesToMerge , status . getActualETag ( ) , resp ) ; OutputStream outputStream = resp . getOutputStream ( ) ; String contextPathForCss = customContextPathForCSSUrls != null ? customContextPathForCSSUrls : req . getContextPath ( ) ; ProcessedResult processedResult = this . processResources ( contextPathForCss , outputStream , resourcesToMerge ) ; int resourcesNotFound = processedResult . getNumberOfMissingResources ( ) ; if ( resourcesNotFound > 0 && resourcesNotFound == resourcesToMerge . size ( ) ) { // all resources not found
resp . sendError ( HttpServletResponse . SC_NOT_FOUND ) ; LOGGER . warn ( "All resources are not found. Sending 404." ) ; return ; } if ( outputStream != null ) { try { resp . setStatus ( HttpServletResponse . SC_OK ) ; outputStream . close ( ) ; } catch ( Exception e ) { // ignore
} } resp . setHeader ( "Content-Length" , String . valueOf ( processedResult . contentLength ) ) ; LOGGER . debug ( "Finished processing Request : {}" , url ) ; |
public class AbstractComponentDependencyFactory { /** * Extract generic type from the list field .
* @ param field the list field to inject
* @ return the role of the components in the list
* @ since 4.0M1 it ' s useless */
@ Deprecated protected Class < ? > getGenericRole ( Field field ) { } } | Type type = field . getGenericType ( ) ; if ( type instanceof ParameterizedType ) { ParameterizedType pType = ( ParameterizedType ) type ; Type [ ] types = pType . getActualTypeArguments ( ) ; if ( types . length > 0 && types [ types . length - 1 ] instanceof Class ) { return ( Class ) types [ types . length - 1 ] ; } } return null ; |
public class ComponentAPI { /** * 第三方平台对其所有API调用次数清零
* @ param component _ access _ token 调用接口凭据
* @ param component _ appid 第三方平台APPID
* @ return result
* @ since 2.8.2 */
public static BaseResult clear_quota ( String component_access_token , String component_appid ) { } } | String json = String . format ( "{\"component_appid\":\"%s\"}" , component_appid ) ; HttpUriRequest httpUriRequest = RequestBuilder . post ( ) . setHeader ( jsonHeader ) . setUri ( BASE_URI + "/cgi-bin/component/clear_quota" ) . addParameter ( "component_access_token" , API . componentAccessToken ( component_access_token ) ) . setEntity ( new StringEntity ( json , Charset . forName ( "utf-8" ) ) ) . build ( ) ; return LocalHttpClient . executeJsonResult ( httpUriRequest , BaseResult . class ) ; |
public class Futures { /** * Creates a new CompletableFuture that will timeout after the given amount of time .
* @ param timeout The timeout for the future .
* @ param executorService An ExecutorService that will be used to invoke the timeout on .
* @ param < T > The Type argument for the CompletableFuture to create .
* @ return A CompletableFuture with a timeout . */
public static < T > CompletableFuture < T > futureWithTimeout ( Duration timeout , ScheduledExecutorService executorService ) { } } | return futureWithTimeout ( timeout , null , executorService ) ; |
public class CmsAttributeHandler { /** * Adds a new choice option . < p >
* @ param reference the reference view
* @ param choicePath the choice attribute path */
private void addChoiceOption ( CmsAttributeValueView reference , List < String > choicePath ) { } } | String attributeChoice = choicePath . get ( 0 ) ; CmsType optionType = getAttributeType ( ) . getAttributeType ( attributeChoice ) ; int valueIndex = reference . getValueIndex ( ) + 1 ; CmsEntity choiceEntity = m_entityBackEnd . createEntity ( null , getAttributeType ( ) . getId ( ) ) ; CmsAttributeValueView valueWidget = reference ; if ( reference . hasValue ( ) ) { valueWidget = new CmsAttributeValueView ( this , m_widgetService . getAttributeLabel ( attributeChoice ) , m_widgetService . getAttributeHelp ( attributeChoice ) ) ; if ( optionType . isSimpleType ( ) && m_widgetService . isDisplaySingleLine ( attributeChoice ) ) { valueWidget . setCompactMode ( CmsAttributeValueView . COMPACT_MODE_SINGLE_LINE ) ; } } List < CmsChoiceMenuEntryBean > menuEntries = CmsRenderer . getChoiceEntries ( getAttributeType ( ) , true ) ; for ( CmsChoiceMenuEntryBean menuEntry : menuEntries ) { valueWidget . addChoice ( m_widgetService , menuEntry ) ; } m_entity . insertAttributeValue ( m_attributeName , choiceEntity , valueIndex ) ; ( ( FlowPanel ) reference . getParent ( ) ) . insert ( valueWidget , valueIndex ) ; insertHandlers ( valueWidget . getValueIndex ( ) ) ; if ( optionType . isSimpleType ( ) ) { String defaultValue = m_widgetService . getDefaultAttributeValue ( attributeChoice , getSimplePath ( valueIndex ) ) ; I_CmsFormEditWidget widget = m_widgetService . getAttributeFormWidget ( attributeChoice ) ; choiceEntity . addAttributeValue ( attributeChoice , defaultValue ) ; valueWidget . setValueWidget ( widget , defaultValue , defaultValue , true ) ; } else { CmsEntity value = m_entityBackEnd . createEntity ( null , optionType . getId ( ) ) ; choiceEntity . addAttributeValue ( attributeChoice , value ) ; List < String > remainingAttributeNames = tail ( choicePath ) ; createNestedEntitiesForChoicePath ( value , remainingAttributeNames ) ; I_CmsEntityRenderer renderer = m_widgetService . getRendererForAttribute ( attributeChoice , optionType ) ; valueWidget . setValueEntity ( renderer , value ) ; } updateButtonVisisbility ( ) ; |
public class AddonManagerImpl { /** * Calculate the necessary request based in the list of installed addons for a given { @ link MutableAddonRepository }
* @ param addonInfo
* @ param repository
* @ param installedAddons
* @ return */
private AddonActionRequest createRequest ( final AddonInfo requestedAddonInfo , final AddonInfo addonInfo , final MutableAddonRepository repository , final Map < AddonId , AddonRepository > installedAddons ) { } } | final AddonActionRequest request ; AddonId addon = addonInfo . getAddon ( ) ; if ( installedAddons . containsKey ( addon ) ) { // Already contains the installed addon . Update ONLY if the version is SNAPSHOT and if it is the requested
// addon
if ( Versions . isSnapshot ( addon . getVersion ( ) ) && addonInfo . equals ( requestedAddonInfo ) ) { AddonRepository addonRepository = installedAddons . get ( addon ) ; if ( repository . equals ( addonRepository ) ) { request = createUpdateRequest ( addonInfo , addonInfo , repository , furnace ) ; } else { request = createDeployRequest ( addonInfo , repository , furnace ) ; } } else { request = null ; } } else { // Addon is not installed or has a different version
Entry < AddonId , AddonRepository > differentVersionEntry = null ; for ( Entry < AddonId , AddonRepository > addonEntry : installedAddons . entrySet ( ) ) { AddonId addonId = addonEntry . getKey ( ) ; if ( addonId . getName ( ) . equals ( addon . getName ( ) ) ) { differentVersionEntry = addonEntry ; break ; } } if ( differentVersionEntry != null ) { // Avoiding ClassCastExceptions
Version differentVersion = SingleVersion . valueOf ( differentVersionEntry . getKey ( ) . getVersion ( ) . toString ( ) ) ; Version addonVersion = SingleVersion . valueOf ( addon . getVersion ( ) . toString ( ) ) ; // TODO : Review condition below
// Update ONLY if it is the requested addon
if ( differentVersion . compareTo ( addonVersion ) < 0 && addonInfo . equals ( requestedAddonInfo ) ) { if ( repository . equals ( differentVersionEntry . getValue ( ) ) ) { request = createUpdateRequest ( info ( differentVersionEntry . getKey ( ) ) , addonInfo , repository , furnace ) ; } else { request = createDeployRequest ( addonInfo , repository , furnace ) ; } } else { // No update needed . Don ' t do anything with it
request = null ; } } else { request = createDeployRequest ( addonInfo , repository , furnace ) ; } } return request ; |
public class StringHelper { /** * Get the last index of sSearch within sText .
* @ param sText
* The text to search in . May be < code > null < / code > .
* @ param sSearch
* The text to search for . May be < code > null < / code > .
* @ return The last index of sSearch within sText or { @ value # STRING _ NOT _ FOUND }
* if sSearch was not found or if any parameter was < code > null < / code > .
* @ see String # lastIndexOf ( String ) */
public static int getLastIndexOf ( @ Nullable final String sText , @ Nullable final String sSearch ) { } } | return sText != null && sSearch != null && sText . length ( ) >= sSearch . length ( ) ? sText . lastIndexOf ( sSearch ) : STRING_NOT_FOUND ; |
public class CmsNewResourceTypeDialog { /** * Sets the module name . < p >
* @ param moduleName to be set
* @ param dialog dialog */
protected void setModule ( String moduleName , CmsBasicDialog dialog ) { } } | Window window = CmsVaadinUtils . getWindow ( dialog ) ; window . setContent ( this ) ; m_module = OpenCms . getModuleManager ( ) . getModule ( moduleName ) . clone ( ) ; CmsResourceInfo resInfo = new CmsResourceInfo ( m_module . getName ( ) , m_module . getNiceName ( ) , CmsModuleApp . Icons . RESINFO_ICON ) ; displayResourceInfoDirectly ( Arrays . asList ( resInfo ) ) ; fillFields ( ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcPhysicalComplexQuantity ( ) { } } | if ( ifcPhysicalComplexQuantityEClass == null ) { ifcPhysicalComplexQuantityEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 351 ) ; } return ifcPhysicalComplexQuantityEClass ; |
public class HttpSupport { /** * Use to send raw data to HTTP client .
* @ param contentType content type
* @ param headers set of headers .
* @ param status status .
* @ return instance of output stream to send raw data directly to HTTP client . */
protected OutputStream outputStream ( String contentType , Map headers , int status ) { } } | try { RequestContext . setControllerResponse ( new NopResponse ( contentType , status ) ) ; if ( headers != null ) { for ( Object key : headers . keySet ( ) ) { if ( headers . get ( key ) != null ) RequestContext . getHttpResponse ( ) . addHeader ( key . toString ( ) , headers . get ( key ) . toString ( ) ) ; } } return RequestContext . getHttpResponse ( ) . getOutputStream ( ) ; } catch ( Exception e ) { throw new ControllerException ( e ) ; } |
public class ConcurrentBackgroundThetaPropagation { /** * Propagation protocol :
* 1 ) validate propagation is executed at the context of the right epoch , otherwise abort
* 2 ) handle propagation : either of a single hash or of a sketch
* 3 ) complete propagation : ping local buffer */
@ Override public void run ( ) { } } | // 1 ) validate propagation is executed at the context of the right epoch , otherwise abort
if ( ! sharedThetaSketch . validateEpoch ( epoch ) ) { // invalid epoch - should not propagate
sharedThetaSketch . endPropagation ( null , false ) ; return ; } // 2 ) handle propagation : either of a single hash or of a sketch
if ( singleHash != ConcurrentSharedThetaSketch . NOT_SINGLE_HASH ) { sharedThetaSketch . propagate ( singleHash ) ; } else if ( sketchIn != null ) { final long volTheta = sharedThetaSketch . getVolatileTheta ( ) ; assert volTheta <= sketchIn . getThetaLong ( ) : "volTheta = " + volTheta + ", bufTheta = " + sketchIn . getThetaLong ( ) ; // propagate values from input sketch one by one
final long [ ] cacheIn = sketchIn . getCache ( ) ; if ( sketchIn . isOrdered ( ) ) { // Ordered compact , Use early stop
for ( final long hashIn : cacheIn ) { if ( hashIn >= volTheta ) { break ; // early stop
} sharedThetaSketch . propagate ( hashIn ) ; } } else { // not ordered , also may have zeros ( gaps ) in the array .
for ( final long hashIn : cacheIn ) { if ( hashIn > 0 ) { sharedThetaSketch . propagate ( hashIn ) ; } } } } // 3 ) complete propagation : ping local buffer
sharedThetaSketch . endPropagation ( localPropagationInProgress , false ) ; |
public class Filter { /** * Running time - O ( N * 2 * C ) , where N - number of clones , which was found earlier and C - time of { @ link # containsIn ( CloneGroup , CloneGroup ) } . */
public void add ( CloneGroup current ) { } } | Iterator < CloneGroup > i = filtered . iterator ( ) ; while ( i . hasNext ( ) ) { CloneGroup earlier = i . next ( ) ; // Note that following two conditions cannot be true together - proof by contradiction :
// let C be the current clone and A and B were found earlier
// then since relation is transitive - ( A in C ) and ( C in B ) = > ( A in B )
// so A should be filtered earlier
if ( Filter . containsIn ( current , earlier ) ) { // current clone fully covered by clone , which was found earlier
return ; } if ( Filter . containsIn ( earlier , current ) ) { // current clone fully covers clone , which was found earlier
i . remove ( ) ; } } filtered . add ( current ) ; |
public class CmsSecurityManager { /** * Destroys this security manager . < p >
* @ throws Throwable if something goes wrong */
public synchronized void destroy ( ) throws Throwable { } } | try { if ( m_driverManager != null ) { if ( m_driverManager . getLockManager ( ) != null ) { try { writeLocks ( ) ; } catch ( Throwable t ) { if ( LOG . isErrorEnabled ( ) ) { LOG . error ( org . opencms . lock . Messages . get ( ) . getBundle ( ) . key ( org . opencms . lock . Messages . ERR_WRITE_LOCKS_FINAL_0 ) , t ) ; } } } m_driverManager . destroy ( ) ; } } catch ( Throwable t ) { if ( LOG . isErrorEnabled ( ) ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ERR_DRIVER_MANAGER_CLOSE_0 ) , t ) ; } } m_driverManager = null ; m_dbContextFactory = null ; if ( CmsLog . INIT . isInfoEnabled ( ) ) { CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_SECURITY_MANAGER_SHUTDOWN_1 , this . getClass ( ) . getName ( ) ) ) ; } |
public class CmsSessionManager { /** * Sends a broadcast to the specified user session . < p >
* @ param cms the OpenCms user context of the user sending the broadcast
* @ param message the message to broadcast
* @ param sessionId the OpenCms session uuid target ( receiver ) of the broadcast
* @ param repeat repeat this message */
public void sendBroadcast ( CmsObject cms , String message , String sessionId , boolean repeat ) { } } | if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( message ) ) { // don ' t broadcast empty messages
return ; } // send the broadcast only to the selected session
CmsSessionInfo sessionInfo = m_sessionStorageProvider . get ( new CmsUUID ( sessionId ) ) ; if ( sessionInfo != null ) { // double check for concurrent modification
sessionInfo . getBroadcastQueue ( ) . add ( new CmsBroadcast ( cms . getRequestContext ( ) . getCurrentUser ( ) , message , repeat ) ) ; } |
public class Notifier { /** * Asynchronously reports an exception to Airbrake . */
public Future < Notice > report ( Throwable e ) { } } | Notice notice = this . buildNotice ( e ) ; return this . send ( notice ) ; |
public class MonitorCenter { /** * Authenticates the user .
* @ param username the username
* @ param password the password
* @ return the default page if the authentication succeed , the login page otherwise . */
@ Route ( method = HttpMethod . POST , uri = "/monitor/login" ) public Result authenticate ( @ FormParameter ( "username" ) String username , @ FormParameter ( "password" ) String password ) { } } | if ( ! configuration . getBooleanWithDefault ( "monitor.auth.enabled" , true ) ) { // If the authentication is disabled , just jump to the dashboard page .
return dashboard ( ) ; } final String name = configuration . getOrDie ( "monitor.auth.username" ) ; final String pwd = configuration . getOrDie ( "monitor.auth.password" ) ; if ( name . equals ( username ) && pwd . equals ( password ) ) { session ( ) . put ( "wisdom.monitor.username" , username ) ; logger ( ) . info ( "Authentication successful - {}" , username ) ; return dashboard ( ) ; } else { logger ( ) . info ( "Authentication failed - {}" , username ) ; context ( ) . flash ( ) . error ( "Authentication failed - check your credentials" ) ; return login ( ) ; } |
public class Normalize { /** * Remove duplicate VAR declarations . */
private void removeDuplicateDeclarations ( Node externs , Node root ) { } } | Callback tickler = new ScopeTicklingCallback ( ) ; ScopeCreator scopeCreator = new Es6SyntacticScopeCreator ( compiler , new DuplicateDeclarationHandler ( ) ) ; NodeTraversal t = new NodeTraversal ( compiler , tickler , scopeCreator ) ; t . traverseRoots ( externs , root ) ; |
public class UrlStartWithMatcher { /** * Normalize matching definitions according to requirements of { @ link StartWithMatcher } . < br >
* 根据 { @ link StartWithMatcher } 的需要来规范化匹配条件定义 。
* @ param matchingDefinitionsKey是匹配字符串 , Value是附件对象 。
* 当进行匹配检查的时候 , 返回附件对象来标识哪一个匹配字符串被匹配上了 。
* Key is the matching string , Value is its associated attachment object .
* When the matching string is matched , the attachment object will be returned
* as identifier .
* @ return { @ link StartWithMatcher } 所需的匹配条件定义 。
* < br > Matching definitions for usage of { @ link StartWithMatcher } .
* @ param moreSpaceForSpeed 是否占用更多内存 , 而换取速度上的提升 。
* < br > Whether or not to consume
* more memory for better matching speed .
* @ returnNormalized matching definitions < br > 规范化了的匹配条件定义 */
static protected List < MatchingDefinition > normalizeMatchingDefinitions ( Map < String , ? extends Object > matchingDefinitions , boolean moreSpaceForSpeed ) { } } | // 先分成两个匹配步骤
Map < String , UrlStartWithMatcherStep2 > step1 = new HashMap < String , UrlStartWithMatcherStep2 > ( ) ; for ( Map . Entry < String , ? extends Object > e : matchingDefinitions . entrySet ( ) ) { String [ ] splited = splitURL ( e . getKey ( ) ) ; String reversedBeforePart = splited [ 0 ] ; String afterPart = splited [ 1 ] ; Object attachment = e . getValue ( ) ; String step1Pattern ; String step1PatternUnescaped ; String step1Example ; int k = reversedBeforePart . length ( ) ; char c1 = k >= 1 ? reversedBeforePart . charAt ( k - 1 ) : 0 ; char c2 = k >= 2 ? reversedBeforePart . charAt ( k - 2 ) : 0 ; if ( c1 == '*' && c2 == '.' ) { step1Example = reversedBeforePart . substring ( 0 , k - 1 ) ; // 点号要留下
step1Pattern = escapeForRegExp ( step1Example ) ; step1PatternUnescaped = step1Example ; } else { step1Example = reversedBeforePart + "$" ; step1Pattern = escapeForRegExp ( reversedBeforePart ) + "$" ; // 加一个终结符 , 实现精确匹配
step1PatternUnescaped = step1Example ; } UrlStartWithMatcherStep2 step2 ; step2 = step1 . get ( step1Pattern ) ; if ( step2 == null ) { step2 = new UrlStartWithMatcherStep2 ( moreSpaceForSpeed ) ; step1 . put ( step1Pattern , step2 ) ; step2 . step1Example = step1Example ; step2 . step1PatternUnescapged = step1PatternUnescaped ; } if ( afterPart == null || afterPart . length ( ) == 0 ) { step2 . noStep2 = true ; step2 . step1Attachment = attachment ; } else { if ( ! step2 . patterns . containsKey ( afterPart ) ) { step2 . patterns . put ( afterPart , attachment ) ; } } } // 如果本pattern能被其他pattern所匹配 , 则要额外设置
for ( UrlStartWithMatcherStep2 step2 : step1 . values ( ) ) { String example = step2 . step1Example ; for ( UrlStartWithMatcherStep2 otherStep2 : step1 . values ( ) ) { // UrlStartWithMatcherStep2 otherStep2 = step1 . get ( otherStep2Pattern ) ;
if ( step2 != otherStep2 ) { String otherExample = otherStep2 . step1Example ; boolean matched = false ; // 这里无需考虑性能
if ( example . endsWith ( "." ) ) { // 比如moc . anis . swen .
if ( otherExample . endsWith ( "." ) ) { // 比如moc . anis .
if ( example . startsWith ( otherExample ) ) { matched = true ; } } } else { // 比如 moc . anis . swen $
if ( example . startsWith ( otherExample ) ) { // 比如moc . anis .
matched = true ; } } if ( matched ) { if ( step2 . step1Attachment != null ) { step2 . patterns . putAll ( otherStep2 . patterns ) ; } else { step2 . additionalStep1Patterns . put ( otherStep2 . step1PatternUnescapged , otherStep2 . step1Attachment ) ; } } } } } List < MatchingDefinition > l = new ArrayList < MatchingDefinition > ( matchingDefinitions . size ( ) ) ; for ( Map . Entry < String , UrlStartWithMatcherStep2 > e : step1 . entrySet ( ) ) { UrlStartWithMatcherStep2 step2 = e . getValue ( ) ; step2 . buildMatcher ( ) ; MatchingDefinition c = new MatchingDefinition ( ) ; c . setRegularExpression ( e . getKey ( ) ) ; c . setAttachment ( e . getValue ( ) ) ; List < String > examples = new ArrayList < String > ( 1 ) ; examples . add ( e . getValue ( ) . step1Example ) ; c . setExactMatchExamples ( examples ) ; l . add ( c ) ; // System . out . println ( p + " < = = = > " + step1 . get ( p ) ) ;
} return l ; |
public class NumberUtil { /** * Return the specified value from the string .
* @ param str string to parse ; assume it is either a single value or a range ( delimited by " - " )
* @ param getMaximumValue if true return the maximum value
* @ return specified value from the string */
private static int getValue ( String str , boolean getMaximumValue ) { } } | int multiplier = 1 ; String upperOrLowerValue = null ; final String [ ] rangeUnit = splitRangeUnit ( str ) ; if ( rangeUnit . length == 2 ) { multiplier = getMultiplier ( rangeUnit [ 1 ] ) ; } String [ ] range = splitRange ( rangeUnit [ 0 ] ) ; upperOrLowerValue = range [ 0 ] ; if ( range . length == 2 ) { if ( getMaximumValue ) { upperOrLowerValue = range [ 1 ] ; } } return ( int ) ( convertStringToDouble ( upperOrLowerValue ) * multiplier ) ; |
public class LogHandle { /** * Package access method to return the current service data .
* @ return The current service data .
* @ exception InternalLogException An unexpected error has occured . */
byte [ ] getServiceData ( ) throws InternalLogException { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getServiceData" , this ) ; // Check that the file is actually open
if ( _activeFile == null ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getServiceData" , "InternalLogException" ) ; throw new InternalLogException ( null ) ; } final byte [ ] serviceData = _activeFile . getServiceData ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getServiceData" , RLSUtils . toHexString ( serviceData , RLSUtils . MAX_DISPLAY_BYTES ) ) ; return serviceData ; |
public class XmlEntities { /** * Escapes the characters in the < code > String < / code > passed and writes the result to the < code > StringBuilder < / code >
* passed .
* @ param sb
* The < code > StringBuilder < / code > to write the results of the escaping to . Assumed to be a non - null value .
* @ param str
* The < code > String < / code > to escape . Assumed to be a non - null value .
* @ see # escape ( String )
* @ see java . lang . StringBuilder */
public void escape ( StringBuilder sb , String str ) { } } | int len = str . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = str . charAt ( i ) ; String entityName = this . entityName ( c ) ; if ( entityName == null ) { if ( c > 0x7F ) { sb . append ( "&#" ) ; sb . append ( Integer . toString ( c , 10 ) ) ; sb . append ( ';' ) ; } else { sb . append ( c ) ; } } else { sb . append ( '&' ) ; sb . append ( entityName ) ; sb . append ( ';' ) ; } } |
public class SVMLightClassifierFactory { /** * This method will cross validate on the given data and number of folds
* to find the optimal C . The scorer is how you determine what to
* optimize for ( F - score , accuracy , etc ) . The C is then saved , so that
* if you train a classifier after calling this method , that C will be used . */
public void crossValidateSetC ( GeneralDataset < L , F > dataset , int numFolds , final Scorer < L > scorer , LineSearcher minimizer ) { } } | System . out . println ( "in Cross Validate" ) ; useAlphaFile = true ; boolean oldUseSigmoid = useSigmoid ; useSigmoid = false ; final CrossValidator < L , F > crossValidator = new CrossValidator < L , F > ( dataset , numFolds ) ; final Function < Triple < GeneralDataset < L , F > , GeneralDataset < L , F > , CrossValidator . SavedState > , Double > score = new Function < Triple < GeneralDataset < L , F > , GeneralDataset < L , F > , CrossValidator . SavedState > , Double > ( ) { public Double apply ( Triple < GeneralDataset < L , F > , GeneralDataset < L , F > , CrossValidator . SavedState > fold ) { GeneralDataset < L , F > trainSet = fold . first ( ) ; GeneralDataset < L , F > devSet = fold . second ( ) ; alphaFile = ( File ) fold . third ( ) . state ; // train ( trainSet , true , true ) ;
SVMLightClassifier < L , F > classifier = trainClassifierBasic ( trainSet ) ; fold . third ( ) . state = alphaFile ; return scorer . score ( classifier , devSet ) ; } } ; Function < Double , Double > negativeScorer = new Function < Double , Double > ( ) { public Double apply ( Double cToTry ) { C = cToTry ; if ( verbose ) { System . out . print ( "C = " + cToTry + " " ) ; } Double averageScore = crossValidator . computeAverage ( score ) ; if ( verbose ) { System . out . println ( " -> average Score: " + averageScore ) ; } return - averageScore ; } } ; C = minimizer . minimize ( negativeScorer ) ; useAlphaFile = false ; useSigmoid = oldUseSigmoid ; |
public class DerInputStream { /** * Private helper routine to read an encoded string from the input
* stream .
* @ param stringTag the tag for the type of string to read
* @ param stringName a name to display in error messages
* @ param enc the encoder to use to interpret the data . Should
* correspond to the stringTag above . */
private String readString ( byte stringTag , String stringName , String enc ) throws IOException { } } | if ( buffer . read ( ) != stringTag ) throw new IOException ( "DER input not a " + stringName + " string" ) ; int length = getLength ( buffer ) ; byte [ ] retval = new byte [ length ] ; if ( ( length != 0 ) && ( buffer . read ( retval ) != length ) ) throw new IOException ( "short read of DER " + stringName + " string" ) ; return new String ( retval , enc ) ; |
public class AmazonRoute53Client { /** * Retrieves a list of the public and private hosted zones that are associated with the current AWS account . The
* response includes a < code > HostedZones < / code > child element for each hosted zone .
* Amazon Route 53 returns a maximum of 100 items in each response . If you have a lot of hosted zones , you can use
* the < code > maxitems < / code > parameter to list them in groups of up to 100.
* @ param listHostedZonesRequest
* A request to retrieve a list of the public and private hosted zones that are associated with the current
* AWS account .
* @ return Result of the ListHostedZones operation returned by the service .
* @ throws InvalidInputException
* The input is not valid .
* @ throws NoSuchDelegationSetException
* A reusable delegation set with the specified ID does not exist .
* @ throws DelegationSetNotReusableException
* A reusable delegation set with the specified ID does not exist .
* @ sample AmazonRoute53 . ListHostedZones
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / route53-2013-04-01 / ListHostedZones " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public ListHostedZonesResult listHostedZones ( ListHostedZonesRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListHostedZones ( request ) ; |
public class SnorocketReasoner { /** * Identifies any equivalent concepts and retains only one of them .
* @ param concepts
* @ return */
private IConceptSet filterEquivalents ( final IConceptSet concepts ) { } } | int [ ] cArray = concepts . toArray ( ) ; boolean [ ] toExclude = new boolean [ cArray . length ] ; for ( int i = 0 ; i < cArray . length ; i ++ ) { if ( toExclude [ i ] ) continue ; final IConceptSet iAncestors = IConceptSet . FACTORY . createConceptSet ( getAncestors ( no , cArray [ i ] ) ) ; for ( int j = i + 1 ; j < cArray . length ; j ++ ) { if ( iAncestors . contains ( cArray [ j ] ) ) { final IConceptSet jAncestors = IConceptSet . FACTORY . createConceptSet ( getAncestors ( no , cArray [ j ] ) ) ; if ( jAncestors . contains ( cArray [ i ] ) ) { // These concepts are equivalent to mark the second concept as excluded
toExclude [ j ] = true ; } } } } IConceptSet res = IConceptSet . FACTORY . createConceptSet ( ) ; for ( int i = 0 ; i < cArray . length ; i ++ ) { if ( ! toExclude [ i ] ) { res . add ( cArray [ i ] ) ; } } return res ; |
public class Record { /** * Get the current status ( enabled / disabled ) for all the listeners .
* @ return a array of all the listener statuses .
* @ see setEnableListener . */
public boolean [ ] setEnableListeners ( boolean flag ) { } } | int iPosition = 0 ; boolean rgbEnabled [ ] = ALL_TRUE ; FileListener fileBehavior = this . getListener ( ) ; while ( fileBehavior != null ) { if ( ! fileBehavior . isEnabledListener ( ) ) { // This one was disabled , set it .
if ( iPosition >= rgbEnabled . length ) { // Increase the size
boolean [ ] rgbEnabledNew = new boolean [ iPosition + 8 ] ; for ( int i = 0 ; i < rgbEnabledNew . length ; i ++ ) { if ( i < rgbEnabled . length ) rgbEnabledNew [ i ] = rgbEnabled [ i ] ; else rgbEnabledNew [ i ] = true ; } rgbEnabled = rgbEnabledNew ; } rgbEnabled [ iPosition ] = false ; // This listener was disabled
} iPosition ++ ; fileBehavior . setEnabledListener ( flag ) ; fileBehavior = ( FileListener ) fileBehavior . getNextListener ( ) ; } return rgbEnabled ; |
public class XMLOutputter { /** * Writes the XML declaration . This method always prints the name of the
* encoding . The case of the encoding is as it was specified during
* initialization ( or re - initialization ) .
* If the encoding is set to < code > " ISO - 8859-1 " < / code > , then this method will produce the
* following output : < blockquote > < code > & lt ; ? xml version = " 1.0 " encoding = " ISO - 8859-1 " ? & gt ; < / code >
* < / blockquote >
* @ throws IllegalStateException if < code > getState ( ) ! = { @ link # BEFORE _ XML _ DECLARATION } < / code > .
* @ throws IOException if an I / O error occurs ; this will set the state to { @ link # ERROR _ STATE } . */
@ Override public final void declaration ( ) throws IllegalStateException , IOException { } } | // Check state
if ( _state != XMLEventListenerStates . BEFORE_XML_DECLARATION ) { throw new IllegalStateException ( "getState() == " + _state ) ; } // Temporarily set the state to ERROR _ STATE . Unless an exception is
// thrown in the write methods , it will be reset to a valid state .
_state = XMLEventListenerStates . ERROR_STATE ; // Write the output
_encoder . declaration ( _out , _quotationMark ) ; // Change the state
_state = XMLEventListenerStates . BEFORE_DTD_DECLARATION ; // State has changed , check
checkInvariants ( ) ; |
public class CmsWorkplaceManager { /** * Sets the gallery default scope . < p >
* @ param galleryDefaultScope the gallery default scope */
public void setGalleryDefaultScope ( String galleryDefaultScope ) { } } | m_galleryDefaultScope = galleryDefaultScope ; try { CmsGallerySearchScope . valueOf ( galleryDefaultScope ) ; } catch ( Throwable t ) { LOG . warn ( t . getLocalizedMessage ( ) , t ) ; } |
public class AbstractSelection { /** * Utility method to add an { @ link IChemObject } to an { @ link IAtomContainer } .
* @ param ac the { @ link IAtomContainer } to add to
* @ param item the { @ link IChemObject } to add */
protected void addToAtomContainer ( IAtomContainer ac , IChemObject item ) { } } | if ( item instanceof IAtomContainer ) { ac . add ( ( IAtomContainer ) item ) ; } else if ( item instanceof IAtom ) { ac . addAtom ( ( IAtom ) item ) ; } else if ( item instanceof IBond ) { ac . addBond ( ( IBond ) item ) ; } |
public class SingleListBox { /** * Utility function to get the current value . */
public static final String getSelectedValue ( ListBox list ) { } } | int index = list . getSelectedIndex ( ) ; return ( index >= 0 ) ? list . getValue ( index ) : null ; |
public class Version { /** * parses version string in the form version [ . revision [ . subrevision [ extension ] ] ]
* into this instance . */
public void parse ( String version_string ) { } } | _version = 0 ; _revision = 0 ; _subrevision = 0 ; _suffix = "" ; int pos = 0 ; int startpos = 0 ; int endpos = version_string . length ( ) ; while ( ( pos < endpos ) && Character . isDigit ( version_string . charAt ( pos ) ) ) { pos ++ ; } _version = Integer . parseInt ( version_string . substring ( startpos , pos ) ) ; if ( ( pos < endpos ) && version_string . charAt ( pos ) == '.' ) { startpos = ++ pos ; while ( ( pos < endpos ) && Character . isDigit ( version_string . charAt ( pos ) ) ) { pos ++ ; } _revision = Integer . parseInt ( version_string . substring ( startpos , pos ) ) ; } if ( ( pos < endpos ) && version_string . charAt ( pos ) == '.' ) { startpos = ++ pos ; while ( ( pos < endpos ) && Character . isDigit ( version_string . charAt ( pos ) ) ) { pos ++ ; } _subrevision = Integer . parseInt ( version_string . substring ( startpos , pos ) ) ; } if ( pos < endpos ) { _suffix = version_string . substring ( pos ) ; } |
public class ContainerInfo { /** * < pre >
* URI to the hosted container image in a Docker repository . The URI must be
* fully qualified and include a tag or digest .
* Examples : " gcr . io / my - project / image : tag " or " gcr . io / my - project / image & # 64 ; digest "
* < / pre >
* < code > string image = 1 ; < / code > */
public com . google . protobuf . ByteString getImageBytes ( ) { } } | java . lang . Object ref = image_ ; if ( ref instanceof java . lang . String ) { com . google . protobuf . ByteString b = com . google . protobuf . ByteString . copyFromUtf8 ( ( java . lang . String ) ref ) ; image_ = b ; return b ; } else { return ( com . google . protobuf . ByteString ) ref ; } |
public class FeatureList { /** * Create a list of all features that include the specified key in their userMap ( ) .
* @ param key The key to consider .
* @ return A list of features that include the key . */
public FeatureList selectByUserData ( String key ) { } } | FeatureList list = new FeatureList ( ) ; for ( FeatureI f : this ) { if ( f . userData ( ) . containsKey ( key ) ) { list . add ( f ) ; } } return list ; |
public class Utils { /** * - - - - - java . lang . reflect */
static Field field ( final Class < ? > klass , final String name ) throws NoSuchFieldException { } } | try { return klass . getDeclaredField ( name ) ; } catch ( final NoSuchFieldException nsfe ) { final Class < ? > superclass = klass . getSuperclass ( ) ; if ( superclass == null ) { throw nsfe ; } return field ( superclass , name ) ; } |
public class GeneratingExpression { /** * Returns a string whose length is always exactly in the middle of the allowed range
* @ param bad
* if 0 , only allowed characters are generated , if 1 , 1 - ( all - 1 ) characters are
* generated false , if 2 all characters are generated false .
* @ return a string */
public String generate ( final int bad ) { } } | int [ ] sizes = new int [ nodes . size ( ) ] ; for ( int i = 0 ; i < sizes . length ; i ++ ) { Range r = nodes . get ( i ) . getRange ( ) ; sizes [ i ] = r . getMin ( ) + r . getRange ( ) / 2 ; } return generate ( sizes , bad ) ; |
public class A_CmsResourceCategoriesList { /** * Returns a list of a categories related to the current request resource . < p >
* @ return a list of a categories related to the current request resource
* @ throws CmsException if something goes wrong */
protected List < CmsCategory > getResourceCategories ( ) throws CmsException { } } | if ( m_resCats == null ) { m_resCats = m_categoryService . readResourceCategories ( getJsp ( ) . getCmsObject ( ) , getParamResource ( ) ) ; } return m_resCats ; |
public class AbstractJaxRsBundleProvider { /** * Create all resources in one transaction
* @ param resource the body of the post method containing the bundle of the resources being created in a xml / json form
* @ return the response
* @ see < a href = " https : / / www . hl7 . org / fhir / http . html # create " > https : / / www . hl7 . org / fhir / http . html # create < / a > */
@ POST public Response create ( final String resource ) throws IOException { } } | return execute ( getRequest ( RequestTypeEnum . POST , RestOperationTypeEnum . TRANSACTION ) . resource ( resource ) ) ; |
public class DirContextAdapter { /** * { @ inheritDoc } */
@ Override public void modifyAttributes ( Name name , int modOp , Attributes attrs ) throws NamingException { } } | throw new UnsupportedOperationException ( NOT_IMPLEMENTED ) ; |
public class ConverterInitializerFactory { /** * Provides WriterInitializer based on the writer . Mostly writer is decided by the Writer builder ( and destination ) that user passes .
* If there ' s more than one branch , it will instantiate same number of WriterInitializer instance as number of branches and combine it into MultiWriterInitializer .
* @ param state
* @ return WriterInitializer */
public static ConverterInitializer newInstance ( State state , WorkUnitStream workUnits ) { } } | int branches = state . getPropAsInt ( ConfigurationKeys . FORK_BRANCHES_KEY , 1 ) ; if ( branches == 1 ) { return newInstance ( state , workUnits , branches , 0 ) ; } List < ConverterInitializer > cis = Lists . newArrayList ( ) ; for ( int branchId = 0 ; branchId < branches ; branchId ++ ) { cis . add ( newInstance ( state , workUnits , branches , branchId ) ) ; } return new MultiConverterInitializer ( cis ) ; |
public class JcrNodeTypeManager { /** * Determine if the child node definitions of the supplied primary type and mixin types of a parent node allow all of the
* children with the supplied name to be removed .
* @ param primaryTypeNameOfParent the name of the primary type for the parent node ; may not be null
* @ param mixinTypeNamesOfParent the names of the mixin types for the parent node ; may be null or empty if there are no mixins
* to include in the search
* @ param childName the name of the child to be added to the parent ; may not be null
* @ param skipProtected true if this operation is being done from within the public JCR node and property API , or false if
* this operation is being done from within internal implementations
* @ return true if at least one child node definition does not require children with the supplied name to exist , or false
* otherwise */
final boolean canRemoveAllChildren ( Name primaryTypeNameOfParent , Collection < Name > mixinTypeNamesOfParent , Name childName , boolean skipProtected ) { } } | return nodeTypes ( ) . canRemoveAllChildren ( primaryTypeNameOfParent , mixinTypeNamesOfParent , childName , skipProtected ) ; |
public class CommercePriceListModelImpl { /** * Converts the soap model instances into normal model instances .
* @ param soapModels the soap model instances to convert
* @ return the normal model instances */
public static List < CommercePriceList > toModels ( CommercePriceListSoap [ ] soapModels ) { } } | if ( soapModels == null ) { return null ; } List < CommercePriceList > models = new ArrayList < CommercePriceList > ( soapModels . length ) ; for ( CommercePriceListSoap soapModel : soapModels ) { models . add ( toModel ( soapModel ) ) ; } return models ; |
public class Hud { /** * Get all actions in common .
* @ param actioner The current selectable .
* @ param actions The collected actions in common . */
private static void checkActionsInCommon ( Actioner actioner , Collection < ActionRef > actions ) { } } | if ( actions . isEmpty ( ) ) { actions . addAll ( actioner . getActions ( ) ) ; } else { actions . retainAll ( actioner . getActions ( ) ) ; } |
public class NodeWrapper { /** * Filter text nodes .
* @ return concatenated String of text treeData values . */
private String expandString ( ) { } } | final FastStringBuffer fsb = new FastStringBuffer ( FastStringBuffer . SMALL ) ; try { final INodeReadTrx rtx = createRtxAndMove ( ) ; final FilterAxis axis = new FilterAxis ( new DescendantAxis ( rtx ) , rtx , new TextFilter ( rtx ) ) ; while ( axis . hasNext ( ) ) { if ( rtx . getNode ( ) . getKind ( ) == TEXT ) { fsb . append ( rtx . getValueOfCurrentNode ( ) ) ; } axis . next ( ) ; } rtx . close ( ) ; } catch ( final TTException exc ) { LOGGER . error ( exc . toString ( ) ) ; } return fsb . condense ( ) . toString ( ) ; |
public class ByteBuffer { /** * Adds one byte to the buffer and throws an exception if the buffer is
* full .
* @ param b Byte to add to the buffer .
* @ throws BufferIsFullException If the buffer is full and the byte cannot
* be stored . */
public void add ( byte b ) throws BufferIsFullException { } } | if ( isFull ( ) ) { throw new BufferIsFullException ( "Buffer is full and has reached maximum capacity (" + capacity ( ) + ")" ) ; } // buffer is not full
this . buffer [ this . currentWritePosition ] = b ; this . currentWritePosition = ( this . currentWritePosition + 1 ) % this . buffer . length ; this . currentBufferSize += 1 ; |
public class JDefaultNumber { /** * generate a random number between 2 numbers - inclusive
* @ param min lowest number to generate
* @ param max max number to generate
* @ return random number string */
public static int randomIntBetweenTwoNumbers ( int min , int max ) { } } | int number = RandomUtils . nextInt ( max - min ) ; return number + min ; |
public class Stages { /** * Schedules a stage for hiding
* @ param stage The stage to shcedule hiding of .
* @ return A { @ link CompletionStage } to have monitoring over the state of the asynchronous operation */
public static CompletionStage < Stage > scheduleHiding ( final Stage stage ) { } } | LOG . debug ( "Requested hiding of stage {} with title : \"{}\"" , stage , stage . getTitle ( ) ) ; return FxAsync . doOnFxThread ( stage , Stage :: hide ) ; |
public class CoreJBossASClient { /** * This returns the system properties that are set in the AS JVM . This is not the system properties
* in the JVM of this client object - it is actually the system properties in the remote
* JVM of the AS instance that the client is talking to .
* @ return the AS JVM ' s system properties
* @ throws Exception any error */
public Properties getSystemProperties ( ) throws Exception { } } | final String [ ] address = { CORE_SERVICE , PLATFORM_MBEAN , "type" , "runtime" } ; final ModelNode op = createReadAttributeRequest ( true , "system-properties" , Address . root ( ) . add ( address ) ) ; final ModelNode results = execute ( op ) ; if ( isSuccess ( results ) ) { // extract the DMR representation into a java Properties object
final Properties sysprops = new Properties ( ) ; final ModelNode node = getResults ( results ) ; final List < Property > propertyList = node . asPropertyList ( ) ; for ( Property property : propertyList ) { final String name = property . getName ( ) ; final ModelNode value = property . getValue ( ) ; if ( name != null ) { sysprops . put ( name , value != null ? value . asString ( ) : "" ) ; } } return sysprops ; } else { throw new FailureException ( results , "Failed to get system properties" ) ; } |
public class AsynchronousRequest { /** * For more info on titles API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 2 / titles " > here < / a > < br / >
* Give user the access to { @ link Callback # onResponse ( Call , Response ) } and { @ link Callback # onFailure ( Call , Throwable ) } methods for custom interactions
* @ param callback callback that is going to be used for { @ link Call # enqueue ( Callback ) }
* @ throws NullPointerException if given { @ link Callback } is empty
* @ see Title title info */
public void getAllTitleID ( Callback < List < Integer > > callback ) throws NullPointerException { } } | gw2API . getAllTitleIDs ( ) . enqueue ( callback ) ; |
public class StringGroovyMethods { /** * This method is called by the - - operator for the class CharSequence .
* It decrements the last character in the given CharSequence . If the
* last character in the CharSequence is Character . MIN _ VALUE it will be deleted .
* The empty CharSequence can ' t be decremented .
* @ param self a CharSequence
* @ return a String with a decremented character at the end
* @ see # previous ( String )
* @ since 1.8.2 */
public static String previous ( CharSequence self ) { } } | StringBuilder buffer = new StringBuilder ( self ) ; if ( buffer . length ( ) == 0 ) throw new IllegalArgumentException ( "the string is empty" ) ; char last = buffer . charAt ( buffer . length ( ) - 1 ) ; if ( last == Character . MIN_VALUE ) { buffer . deleteCharAt ( buffer . length ( ) - 1 ) ; } else { char next = last ; next -- ; buffer . setCharAt ( buffer . length ( ) - 1 , next ) ; } return buffer . toString ( ) ; |
public class Router { /** * Returns the hosted Controller with the given instance id or { @ code null } if no such
* Controller exists in this Router .
* @ param instanceId The instance ID being searched for */
@ Nullable public Controller getControllerWithInstanceId ( @ NonNull String instanceId ) { } } | for ( RouterTransaction transaction : backstack ) { Controller controllerWithId = transaction . controller . findController ( instanceId ) ; if ( controllerWithId != null ) { return controllerWithId ; } } return null ; |
public class Log { /** * Send an INFO log message with { @ link SUBSYSTEM # MAIN } as default one and log the exception .
* @ param tag Used to identify the source of a log message . It usually identifies the class or
* activity where the log call occurs .
* @ param msg The message you would like logged .
* @ param tr An exception to log .
* @ return */
public static int i ( String tag , String msg , Throwable tr ) { } } | return i ( SUBSYSTEM . MAIN , tag , msg , tr ) ; |
public class Humanize { /** * For decimal digits [ 0-9 ] , returns the number spelled out . Otherwise ,
* returns the number as string .
* < table border = " 0 " cellspacing = " 0 " cellpadding = " 3 " width = " 100 % " >
* < tr >
* < th class = " colFirst " > Input < / th >
* < th class = " colLast " > Output < / th >
* < / tr >
* < tr >
* < td > 1 < / td >
* < td > " one " < / td >
* < / tr >
* < tr >
* < td > 2 < / td >
* < td > " two " < / td >
* < / tr >
* < tr >
* < td > 10 < / td >
* < td > " 10 " < / td >
* < / tr >
* < / table >
* @ param value
* Decimal digit
* @ return String representing the number spelled out */
public static String spellDigit ( final Number value ) { } } | int v = value . intValue ( ) ; if ( v < 0 || v > 9 ) return value . toString ( ) ; return context . get ( ) . digitStrings ( v ) ; |
public class BookKeeperLog { /** * Write Processor main loop . This method is not thread safe and should only be invoked as part of the Write Processor . */
private void processWritesSync ( ) { } } | if ( this . closed . get ( ) ) { // BookKeeperLog is closed . No point in trying anything else .
return ; } if ( getWriteLedger ( ) . ledger . isClosed ( ) ) { // Current ledger is closed . Execute the rollover processor to safely create a new ledger . This will reinvoke
// the write processor upon finish , so the writes can be reattempted .
this . rolloverProcessor . runAsync ( ) ; } else if ( ! processPendingWrites ( ) && ! this . closed . get ( ) ) { // We were not able to complete execution of all writes . Try again .
this . writeProcessor . runAsync ( ) ; } |
public class TreeTranslator { /** * Visitor method : translate a list of nodes . */
public < T extends JCTree > List < T > translate ( List < T > trees ) { } } | if ( trees == null ) return null ; for ( List < T > l = trees ; l . nonEmpty ( ) ; l = l . tail ) l . head = translate ( l . head ) ; return trees ; |
public class BaseMessagingEngineImpl { /** * ( non - Javadoc )
* @ see com . ibm . ws . sib . admin . JsMessagingEngine # getSIBDestination ( java . lang . String ,
* java . lang . String , com . ibm . ws . sib . admin . DestinationDefinition ) */
public void getSIBDestination ( String busName , String name , DestinationDefinition dd ) throws SIBExceptionBase , SIBExceptionDestinationNotFound { } } | String thisMethodName = "getSIBDestination" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , new Object [ ] { busName , name , dd . getName ( ) } ) ; } if ( oldDestCache == null ) { _bus . getDestinationCache ( ) . getSIBDestination ( busName , name , dd ) ; } else { oldDestCache . getSIBDestination ( busName , name , dd ) ; } // Resolve Exception Destination if necessary
resolveExceptionDestination ( dd ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName ) ; } |
public class GrayImageOps { /** * Brightens the image ' s intensity : < br >
* O < sub > x , y < / sub > = I < sub > x , y < / sub > + beta < br >
* The image ' s intensity is clamped at 0 and max ;
* @ param input Input image . Not modified .
* @ param beta How much the image is brightened by .
* @ param output If not null , the output image . If null a new image is declared and returned . Modified .
* @ return Output image . */
public static GrayU8 brighten ( GrayU8 input , int beta , int max , GrayU8 output ) { } } | output = InputSanityCheck . checkDeclare ( input , output ) ; ImplGrayImageOps . brighten ( input , beta , max , output ) ; return output ; |
public class CmsPreferences { /** * Sets the " explorer number of entries per page " setting . < p >
* @ param value a String representation of an int value to set the " number of entries per page " setting */
public void setParamTabExFileEntries ( String value ) { } } | try { m_userSettings . setExplorerFileEntries ( Integer . parseInt ( value ) ) ; } catch ( Throwable t ) { // should usually never happen
} |
public class ArrayFile { /** * Loads this ArrayFile into a memory - based short array .
* @ throws IOException */
public void load ( MemoryShortArray shortArray ) throws IOException { } } | if ( ! _file . exists ( ) || _file . length ( ) == 0 ) { return ; } Chronos c = new Chronos ( ) ; DataReader r = IOFactory . createDataReader ( _file , _type ) ; try { r . open ( ) ; r . position ( DATA_START_POSITION ) ; for ( int i = 0 ; i < _arrayLength ; i ++ ) { shortArray . set ( i , r . readShort ( ) ) ; } _log . info ( _file . getName ( ) + " loaded in " + c . getElapsedTime ( ) ) ; } finally { r . close ( ) ; } |
public class WebSiteManagementClientImpl { /** * List all SKUs .
* List all SKUs .
* @ 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 < SkuInfosInner > listSkusAsync ( final ServiceCallback < SkuInfosInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( listSkusWithServiceResponseAsync ( ) , serviceCallback ) ; |
public class DomainsInner { /** * Delete ownership identifier for domain .
* Delete ownership identifier for domain .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param domainName Name of domain .
* @ param name Name of identifier .
* @ 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 < Void > deleteOwnershipIdentifierAsync ( String resourceGroupName , String domainName , String name , final ServiceCallback < Void > serviceCallback ) { } } | return ServiceFuture . fromResponse ( deleteOwnershipIdentifierWithServiceResponseAsync ( resourceGroupName , domainName , name ) , serviceCallback ) ; |
public class Parser { /** * vsch : # 186 add isSetext flag to header node to distinguish header types */
public Rule SetextHeading1 ( ) { } } | return Sequence ( SetextInline ( ) , push ( new HeaderNode ( 1 , popAsNode ( ) , true ) ) , ZeroOrMore ( SetextInline ( ) , addAsChild ( ) ) , wrapInAnchor ( ) , Sp ( ) , Newline ( ) , NOrMore ( '=' , 3 ) , Sp ( ) , Newline ( ) ) ; |
public class Main { /** * Create a new Dropbox client using the given authentication
* information and HTTP client config .
* @ param auth Authentication information
* @ param config HTTP request configuration
* @ return new Dropbox V2 client */
private static DbxClientV2 createClient ( DbxAuthInfo auth , StandardHttpRequestor . Config config ) { } } | String clientUserAgentId = "examples-longpoll" ; StandardHttpRequestor requestor = new StandardHttpRequestor ( config ) ; DbxRequestConfig requestConfig = DbxRequestConfig . newBuilder ( clientUserAgentId ) . withHttpRequestor ( requestor ) . build ( ) ; return new DbxClientV2 ( requestConfig , auth . getAccessToken ( ) , auth . getHost ( ) ) ; |
public class XmlIO { /** * XMLを読み込み 、 { @ link AnnotationMappingInfo } として取得する 。
* @ param in
* @ return
* @ throws XmlOperateException XMLの読み込みに失敗した場合 。
* @ throws IllegalArgumentException in is null . */
public static AnnotationMappingInfo load ( final InputStream in ) throws XmlOperateException { } } | ArgUtils . notNull ( in , "in" ) ; final AnnotationMappingInfo xmlInfo ; try { xmlInfo = JAXB . unmarshal ( in , AnnotationMappingInfo . class ) ; } catch ( DataBindingException e ) { throw new XmlOperateException ( "fail load xml with JAXB." , e ) ; } return xmlInfo ; |
public class ConcurrentHeapThetaBuffer { /** * Updates buffer with given hash value .
* Triggers propagation to shared sketch if buffer is full .
* @ param hash the given input hash value . A hash of zero or Long . MAX _ VALUE is ignored .
* A negative hash value will throw an exception .
* @ return
* < a href = " { @ docRoot } / resources / dictionary . html # updateReturnState " > See Update Return State < / a > */
@ Override UpdateReturnState hashUpdate ( final long hash ) { } } | if ( isExactMode ) { isExactMode = ! shared . isEstimationMode ( ) ; } HashOperations . checkHashCorruption ( hash ) ; if ( ( getHashTableThreshold ( ) == 0 ) || isExactMode ) { // The over - theta and zero test
if ( HashOperations . continueCondition ( getThetaLong ( ) , hash ) ) { return RejectedOverTheta ; // signal that hash was rejected due to theta or zero .
} if ( propagateToSharedSketch ( hash ) ) { return ConcurrentPropagated ; } } final UpdateReturnState state = super . hashUpdate ( hash ) ; if ( isOutOfSpace ( getRetainedEntries ( ) + 1 ) ) { propagateToSharedSketch ( ) ; return ConcurrentPropagated ; } if ( state == UpdateReturnState . InsertedCountIncremented ) { return ConcurrentBufferInserted ; } return state ; |
public class CycleAnalyzer { /** * This method searches a given { @ link Graph } for cycles . This method is
* different to { @ link # hasCycles ( Graph , boolean ) } , because here it is
* started at a dedicated vertex and only vertices are checked for cycles
* which are connected to this start vertex . If disconnected subgraphs
* exist , these are not checked .
* @ param < V >
* is the actual vertex implementation .
* @ param < E >
* is the actual edge implementation .
* @ param graph
* is the { @ link Graph } to be searched for cycles .
* @ param startVertex
* is the { @ link Vertex } to start from . This vertex has to be
* part of the given graph .
* @ param directed
* is to be set to < code > true < / code > is the graph is to be
* handled as an directed graph ( The { @ link Pair } result in
* { @ link Edge # getVertices ( ) is interpreted as startVertex and
* targetVertex } . ) . < code > false < / code > is to be set otherwise .
* @ return < code > true < / code > is returned if a cycle was found .
* < code > false < / code > is returned otherwise .
* @ throws IllegalArgumentException
* is thrown in case the startVertex is not part of the graph or
* the graph of vertex are < code > null < / code > . */
public static < V extends Vertex < V , E > , E extends Edge < V , E > > boolean hasCycles ( Graph < V , E > graph , V startVertex , boolean directed ) throws IllegalArgumentException { } } | requireNonNull ( graph , "The given start vertex is null" ) ; requireNonNull ( startVertex , "The given start vertex is null" ) ; if ( ! graph . getVertices ( ) . contains ( startVertex ) ) { throw new IllegalArgumentException ( "The given start vertex '" + startVertex + "' is not part of the given graph '" + graph + "'." ) ; } return hasCycle ( startVertex , new Stack < > ( ) , new Stack < > ( ) , new HashSet < V > ( graph . getVertices ( ) ) , directed ) ; |
public class AcceptMatchRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AcceptMatchRequest acceptMatchRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( acceptMatchRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( acceptMatchRequest . getTicketId ( ) , TICKETID_BINDING ) ; protocolMarshaller . marshall ( acceptMatchRequest . getPlayerIds ( ) , PLAYERIDS_BINDING ) ; protocolMarshaller . marshall ( acceptMatchRequest . getAcceptanceType ( ) , ACCEPTANCETYPE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class AmazonComprehendClient { /** * Inspects the text of a batch of documents for the syntax and part of speech of the words in the document and
* returns information about them . For more information , see < a > how - syntax < / a > .
* @ param batchDetectSyntaxRequest
* @ return Result of the BatchDetectSyntax operation returned by the service .
* @ throws InvalidRequestException
* The request is invalid .
* @ throws TextSizeLimitExceededException
* The size of the input text exceeds the limit . Use a smaller document .
* @ throws UnsupportedLanguageException
* Amazon Comprehend can ' t process the language of the input text . For all custom entity recognition APIs
* ( such as < code > CreateEntityRecognizer < / code > ) , only English is accepted . For most other APIs , Amazon
* Comprehend accepts only English or Spanish text .
* @ throws BatchSizeLimitExceededException
* The number of documents in the request exceeds the limit of 25 . Try your request again with fewer
* documents .
* @ throws InternalServerException
* An internal server error occurred . Retry your request .
* @ sample AmazonComprehend . BatchDetectSyntax
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / comprehend - 2017-11-27 / BatchDetectSyntax " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public BatchDetectSyntaxResult batchDetectSyntax ( BatchDetectSyntaxRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeBatchDetectSyntax ( request ) ; |
public class MaterializeKNNPreprocessor { /** * The actual preprocessing step . */
@ Override protected void preprocess ( ) { } } | final Logging log = getLogger ( ) ; // Could be subclass
createStorage ( ) ; ArrayDBIDs ids = DBIDUtil . ensureArray ( relation . getDBIDs ( ) ) ; if ( log . isStatistics ( ) ) { log . statistics ( new LongStatistic ( this . getClass ( ) . getName ( ) + ".k" , k ) ) ; } Duration duration = log . isStatistics ( ) ? log . newDuration ( this . getClass ( ) . getName ( ) + ".precomputation-time" ) . begin ( ) : null ; FiniteProgress progress = getLogger ( ) . isVerbose ( ) ? new FiniteProgress ( "Materializing k nearest neighbors (k=" + k + ")" , ids . size ( ) , getLogger ( ) ) : null ; // Try bulk
List < ? extends KNNList > kNNList = null ; if ( usebulk ) { kNNList = knnQuery . getKNNForBulkDBIDs ( ids , k ) ; if ( kNNList != null ) { int i = 0 ; for ( DBIDIter id = ids . iter ( ) ; id . valid ( ) ; id . advance ( ) , i ++ ) { storage . put ( id , kNNList . get ( i ) ) ; log . incrementProcessed ( progress ) ; } } } else { final boolean ismetric = getDistanceQuery ( ) . getDistanceFunction ( ) . isMetric ( ) ; for ( DBIDIter iter = ids . iter ( ) ; iter . valid ( ) ; iter . advance ( ) ) { if ( ismetric && storage . get ( iter ) != null ) { log . incrementProcessed ( progress ) ; continue ; // Previously computed ( duplicate point ? )
} KNNList knn = knnQuery . getKNNForDBID ( iter , k ) ; storage . put ( iter , knn ) ; if ( ismetric ) { for ( DoubleDBIDListIter it = knn . iter ( ) ; it . valid ( ) && it . doubleValue ( ) == 0. ; it . advance ( ) ) { storage . put ( it , knn ) ; // Reuse
} } log . incrementProcessed ( progress ) ; } } log . ensureCompleted ( progress ) ; if ( duration != null ) { log . statistics ( duration . end ( ) ) ; } |
public class CommerceShipmentItemPersistenceImpl { /** * Returns the last commerce shipment item in the ordered set where groupId = & # 63 ; .
* @ param groupId the group ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commerce shipment item
* @ throws NoSuchShipmentItemException if a matching commerce shipment item could not be found */
@ Override public CommerceShipmentItem findByGroupId_Last ( long groupId , OrderByComparator < CommerceShipmentItem > orderByComparator ) throws NoSuchShipmentItemException { } } | CommerceShipmentItem commerceShipmentItem = fetchByGroupId_Last ( groupId , orderByComparator ) ; if ( commerceShipmentItem != null ) { return commerceShipmentItem ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "groupId=" ) ; msg . append ( groupId ) ; msg . append ( "}" ) ; throw new NoSuchShipmentItemException ( msg . toString ( ) ) ; |
public class ToSAXHandler { /** * This method flushes any pending events , which can be startDocument ( )
* closing the opening tag of an element , or closing an open CDATA section . */
public void flushPending ( ) throws SAXException { } } | if ( m_needToCallStartDocument ) { startDocumentInternal ( ) ; m_needToCallStartDocument = false ; } if ( m_elemContext . m_startTagOpen ) { closeStartTag ( ) ; m_elemContext . m_startTagOpen = false ; } if ( m_cdataTagOpen ) { closeCDATA ( ) ; m_cdataTagOpen = false ; } |
public class SourceMapConsumerV3 { /** * Returns the mapping entry that proceeds the supplied line or null if no
* such entry exists . */
private OriginalMapping getPreviousMapping ( int lineNumber ) { } } | do { if ( lineNumber == 0 ) { return null ; } lineNumber -- ; } while ( lines . get ( lineNumber ) == null ) ; ArrayList < Entry > entries = lines . get ( lineNumber ) ; return getOriginalMappingForEntry ( Iterables . getLast ( entries ) ) ; |
public class Client { /** * Returns true if there is RoboRemoteServer currently listening
* @ return
* @ throws Exception */
public boolean isListening ( ) throws Exception { } } | try { JSONObject resp = new JSONObject ( Get . get ( API_BASE_URL + ":" + API_PORT , Constants . REQUEST_HEARTBEAT , "" ) ) ; return true ; } catch ( Exception e ) { return false ; } |
public class LasCellsTable { /** * Query the las cell table .
* @ param db the db to use .
* @ param envelope an optional { @ link Envelope } to query spatially .
* @ param exactGeometry an optional exact geometry . If available it is used instead of the envelope .
* @ param doPosition if < code > true < / code > position info is extracted .
* @ param doIntensity if < code > true < / code > intensity and classification info is extracted .
* @ param doReturns if < code > true < / code > return info is extracted .
* @ param doTime if < code > true < / code > time info is extracted .
* @ param doColor if < code > true < / code > color info is extracted .
* @ param limitTo limit the cells to a value if ! = - 1
* @ return the list of extracted points
* @ throws Exception */
public static List < LasCell > getLasCells ( ASpatialDb db , Envelope envelope , Geometry exactGeometry , boolean doPosition , boolean doIntensity , boolean doReturns , boolean doTime , boolean doColor , int limitTo ) throws Exception { } } | List < LasCell > lasCells = new ArrayList < > ( ) ; String sql = "SELECT " + COLUMN_GEOM + "," + COLUMN_ID + "," + COLUMN_SOURCE_ID + "," + COLUMN_POINTS_COUNT ; if ( doPosition ) sql += "," + COLUMN_AVG_ELEV + "," + COLUMN_MIN_ELEV + "," + COLUMN_MAX_ELEV + "," + COLUMN_POSITION_BLOB ; if ( doIntensity ) sql += "," + COLUMN_AVG_INTENSITY + "," + COLUMN_MIN_INTENSITY + "," + COLUMN_MAX_INTENSITY + "," + COLUMN_INTENS_CLASS_BLOB ; if ( doReturns ) sql += "," + COLUMN_RETURNS_BLOB ; if ( doTime ) sql += "," + COLUMN_MIN_GPSTIME + "," + COLUMN_MAX_GPSTIME + "," + COLUMN_GPSTIME_BLOB ; if ( doColor ) sql += "," + COLUMN_COLORS_BLOB ; sql += " FROM " + TABLENAME ; if ( exactGeometry != null ) { sql += " WHERE " + db . getSpatialindexGeometryWherePiece ( TABLENAME , null , exactGeometry ) ; } else if ( envelope != null ) { double x1 = envelope . getMinX ( ) ; double y1 = envelope . getMinY ( ) ; double x2 = envelope . getMaxX ( ) ; double y2 = envelope . getMaxY ( ) ; sql += " WHERE " + db . getSpatialindexBBoxWherePiece ( TABLENAME , null , x1 , y1 , x2 , y2 ) ; } if ( limitTo > 0 ) { sql += " LIMIT " + limitTo ; } String _sql = sql ; IGeometryParser gp = db . getType ( ) . getGeometryParser ( ) ; return db . execOnConnection ( conn -> { try ( IHMStatement stmt = conn . createStatement ( ) ; IHMResultSet rs = stmt . executeQuery ( _sql ) ) { while ( rs . next ( ) ) { LasCell lasCell = resultSetToCell ( db , gp , doPosition , doIntensity , doReturns , doTime , doColor , rs ) ; lasCells . add ( lasCell ) ; } return lasCells ; } } ) ; |
public class KeyspaceCache { /** * Reads the SchemaConcept labels currently in the transaction cache
* into the keyspace cache . This happens when a commit occurs and allows us to track schema
* mutations without having to read the graph .
* @ param transactionCache The transaction cache */
void readTxCache ( TransactionCache transactionCache ) { } } | // Check if the schema has been changed and should be flushed into this cache
if ( ! cachedLabels . equals ( transactionCache . getLabelCache ( ) ) ) { try { lock . writeLock ( ) . lock ( ) ; cachedLabels . clear ( ) ; cachedLabels . putAll ( transactionCache . getLabelCache ( ) ) ; } finally { lock . writeLock ( ) . unlock ( ) ; } } |
public class Base64 { /** * base64解码
* @ param source 被解码的base64字符串
* @ param charset 字符集
* @ return 被加密后的字符串 */
public static String decodeStr ( String source , String charset ) { } } | return Base64Decoder . decodeStr ( source , charset ) ; |
public class UriTemplate { /** * Given the Map of variables , expands this template into a URI . The Map keys represent variable names ,
* the Map values variable values . The order of variables is not significant .
* < p > Example :
* < pre class = " code " >
* UriTemplate template = new UriTemplate ( " https : / / example . com / hotels / { hotel } / bookings / { booking } " ) ;
* Map & lt ; String , String & gt ; uriVariables = new HashMap & lt ; String , String & gt ; ( ) ;
* uriVariables . put ( " booking " , " 42 " ) ;
* uriVariables . put ( " hotel " , " Rest & Relax " ) ;
* System . out . println ( template . expand ( uriVariables ) ) ;
* < / pre >
* will print : < blockquote > { @ code https : / / example . com / hotels / Rest % 20%26%20Relax / bookings / 42 } < / blockquote >
* @ param uriVariables the map of URI variables
* @ return the expanded URI
* @ throws IllegalArgumentException if { @ code uriVariables } is { @ code null } ;
* or if it does not contain values for all the variable names */
public URI expand ( Map < String , ? > uriVariables ) { } } | UriComponents expandedComponents = this . uriComponents . expand ( uriVariables ) ; UriComponents encodedComponents = expandedComponents . encode ( ) ; return encodedComponents . toUri ( ) ; |
public class ListInstanceProfilesResult { /** * A list of instance profiles .
* @ param instanceProfiles
* A list of instance profiles . */
public void setInstanceProfiles ( java . util . Collection < InstanceProfile > instanceProfiles ) { } } | if ( instanceProfiles == null ) { this . instanceProfiles = null ; return ; } this . instanceProfiles = new com . amazonaws . internal . SdkInternalList < InstanceProfile > ( instanceProfiles ) ; |
public class TransformationDescription { /** * Adds a split transformation step to the transformation description . The value of the source field is split based
* on the split string into parts . Based on the given index , the result will be set to the target field . The index
* needs to be an integer value . All fields need to be of the type String . */
public void splitField ( String sourceField , String targetField , String splitString , String index ) { } } | TransformationStep step = new TransformationStep ( ) ; step . setTargetField ( targetField ) ; step . setSourceFields ( sourceField ) ; step . setOperationParameter ( TransformationConstants . SPLIT_PARAM , splitString ) ; step . setOperationParameter ( TransformationConstants . INDEX_PARAM , index ) ; step . setOperationName ( "split" ) ; steps . add ( step ) ; |
public class DiagnosticsInner { /** * Get Detector .
* Get Detector .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; DetectorDefinitionInner & gt ; object */
public Observable < Page < DetectorDefinitionInner > > getSiteDetectorNextAsync ( final String nextPageLink ) { } } | return getSiteDetectorNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < DetectorDefinitionInner > > , Page < DetectorDefinitionInner > > ( ) { @ Override public Page < DetectorDefinitionInner > call ( ServiceResponse < Page < DetectorDefinitionInner > > response ) { return response . body ( ) ; } } ) ; |
public class RequestHttpBase { /** * Returns true if some data has been sent to the browser . */
public final boolean isOutCommitted ( ) { } } | OutHttpApp stream = out ( ) ; if ( stream . isCommitted ( ) ) { return true ; } // server / 05a7
if ( _contentLengthOut > 0 && _contentLengthOut <= stream . contentLength ( ) ) { return true ; } return false ; |
public class UriTemplateParser { /** * Called when the end of an expression has been encountered . */
private void endExpression ( int position ) throws MalformedUriTemplateException { } } | // an expression close brace is found without a start
if ( startedTemplate ) { if ( ! expressionCaptureOn ) { throw new MalformedUriTemplateException ( "Expression close brace was found at position " + position + " yet there was no start brace." , position ) ; } expressionCaptureOn = false ; components . add ( new Expression ( buffer . toString ( ) , this . startPosition ) ) ; buffer = null ; } else { throw new IllegalStateException ( "Cannot end an expression without beginning the template" ) ; } |
public class Assert { /** * 取得带参数的消息 。 */
private static String getMessage ( String message , Object [ ] args , String defaultMessage ) { } } | if ( message == null ) { message = defaultMessage ; } if ( args == null || args . length == 0 ) { return message ; } return String . format ( message , args ) ; |
public class PlannerReader { /** * This method extracts assignment data from a Planner file .
* @ param plannerProject Root node of the Planner file */
private void readAssignments ( Project plannerProject ) { } } | Allocations allocations = plannerProject . getAllocations ( ) ; List < Allocation > allocationList = allocations . getAllocation ( ) ; Set < Task > tasksWithAssignments = new HashSet < Task > ( ) ; for ( Allocation allocation : allocationList ) { Integer taskID = getInteger ( allocation . getTaskId ( ) ) ; Integer resourceID = getInteger ( allocation . getResourceId ( ) ) ; Integer units = getInteger ( allocation . getUnits ( ) ) ; Task task = m_projectFile . getTaskByUniqueID ( taskID ) ; Resource resource = m_projectFile . getResourceByUniqueID ( resourceID ) ; if ( task != null && resource != null ) { Duration work = task . getWork ( ) ; int percentComplete = NumberHelper . getInt ( task . getPercentageComplete ( ) ) ; ResourceAssignment assignment = task . addResourceAssignment ( resource ) ; assignment . setUnits ( units ) ; assignment . setWork ( work ) ; if ( percentComplete != 0 ) { Duration actualWork = Duration . getInstance ( ( work . getDuration ( ) * percentComplete ) / 100 , work . getUnits ( ) ) ; assignment . setActualWork ( actualWork ) ; assignment . setRemainingWork ( Duration . getInstance ( work . getDuration ( ) - actualWork . getDuration ( ) , work . getUnits ( ) ) ) ; } else { assignment . setRemainingWork ( work ) ; } assignment . setStart ( task . getStart ( ) ) ; assignment . setFinish ( task . getFinish ( ) ) ; tasksWithAssignments . add ( task ) ; m_eventManager . fireAssignmentReadEvent ( assignment ) ; } } // Adjust work per assignment for tasks with multiple assignments
for ( Task task : tasksWithAssignments ) { List < ResourceAssignment > assignments = task . getResourceAssignments ( ) ; if ( assignments . size ( ) > 1 ) { double maxUnits = 0 ; for ( ResourceAssignment assignment : assignments ) { maxUnits += assignment . getUnits ( ) . doubleValue ( ) ; } for ( ResourceAssignment assignment : assignments ) { Duration work = assignment . getWork ( ) ; double factor = assignment . getUnits ( ) . doubleValue ( ) / maxUnits ; work = Duration . getInstance ( work . getDuration ( ) * factor , work . getUnits ( ) ) ; assignment . setWork ( work ) ; Duration actualWork = assignment . getActualWork ( ) ; if ( actualWork != null ) { actualWork = Duration . getInstance ( actualWork . getDuration ( ) * factor , actualWork . getUnits ( ) ) ; assignment . setActualWork ( actualWork ) ; } Duration remainingWork = assignment . getRemainingWork ( ) ; if ( remainingWork != null ) { remainingWork = Duration . getInstance ( remainingWork . getDuration ( ) * factor , remainingWork . getUnits ( ) ) ; assignment . setRemainingWork ( remainingWork ) ; } } } } |
public class SelendroidCapabilities { /** * the latest version of the app . */
private String getDefaultVersion ( Set < String > keys , String appName ) { } } | SortedSet < String > listOfApps = new TreeSet < String > ( ) ; for ( String key : keys ) { if ( key . split ( ":" ) [ 0 ] . contentEquals ( appName ) ) { listOfApps . add ( key ) ; } } return listOfApps . size ( ) > 0 ? listOfApps . last ( ) : null ; |
public class DOMHelper { /** * Obtain the XPath - model parent of a DOM node - - ownerElement for Attrs ,
* parent for other nodes .
* Background : The DOM believes that you must be your Parent ' s
* Child , and thus Attrs don ' t have parents . XPath said that Attrs
* do have their owning Element as their parent . This function
* bridges the difference , either by using the DOM Level 2 ownerElement
* function or by using a " silly and expensive function " in Level 1
* DOMs .
* ( There ' s some discussion of future DOMs generalizing ownerElement
* into ownerNode and making it work on all types of nodes . This
* still wouldn ' t help the users of Level 1 or Level 2 DOMs )
* @ param node Node whose XPath parent we want to obtain
* @ return the parent of the node , or the ownerElement if it ' s an
* Attr node , or null if the node is an orphan .
* @ throws RuntimeException if the Document has no root element .
* This can ' t arise if the Document was created
* via the DOM Level 2 factory methods , but is possible if other
* mechanisms were used to obtain it */
public static Node getParentOfNode ( Node node ) throws RuntimeException { } } | Node parent ; short nodeType = node . getNodeType ( ) ; if ( Node . ATTRIBUTE_NODE == nodeType ) { Document doc = node . getOwnerDocument ( ) ; /* TBD :
if ( null = = doc )
throw new RuntimeException ( XSLMessages . createXPATHMessage ( XPATHErrorResources . ER _ CHILD _ HAS _ NO _ OWNER _ DOCUMENT , null ) ) ; / / " Attribute child does not have an owner document ! " ) ; */
// Given how expensive the tree walk may be , we should first ask
// whether this DOM can answer the question for us . The additional
// test does slow down Level 1 DOMs slightly . DOMHelper2 , which
// is currently specialized for Xerces , assumes it can use the
// Level 2 solution . We might want to have an intermediate stage ,
// which would assume DOM Level 2 but not assume Xerces .
// ( Shouldn ' t have to check whether impl is null in a compliant DOM ,
// but let ' s be paranoid for a moment . . . )
DOMImplementation impl = doc . getImplementation ( ) ; if ( impl != null && impl . hasFeature ( "Core" , "2.0" ) ) { parent = ( ( Attr ) node ) . getOwnerElement ( ) ; return parent ; } // DOM Level 1 solution , as fallback . Hugely expensive .
Element rootElem = doc . getDocumentElement ( ) ; if ( null == rootElem ) { throw new RuntimeException ( XMLMessages . createXMLMessage ( XMLErrorResources . ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT , null ) ) ; // " Attribute child does not have an owner document element ! " ) ;
} parent = locateAttrParent ( rootElem , node ) ; } else { parent = node . getParentNode ( ) ; // if ( ( Node . DOCUMENT _ NODE ! = nodeType ) & & ( null = = parent ) )
// throw new RuntimeException ( " Child does not have parent ! " ) ;
} return parent ; |
public class Viewport { /** * Change the viewport ' s transform so that the specified area ( in local or world coordinates )
* is visible .
* @ param x
* @ param y
* @ param width
* @ param height */
public final void viewLocalArea ( final double x , final double y , final double width , final double height ) { } } | final Transform t = Transform . createViewportTransform ( x , y , width , height , m_wide , m_high ) ; if ( t != null ) { setTransform ( t ) ; } |
public class SkipWaitTimeForInstanceTerminationRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( SkipWaitTimeForInstanceTerminationRequest skipWaitTimeForInstanceTerminationRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( skipWaitTimeForInstanceTerminationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( skipWaitTimeForInstanceTerminationRequest . getDeploymentId ( ) , DEPLOYMENTID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.