signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class HttpClientBuilder { /** * Sets a list of enabled SSL protocols . No other protocol * will not be used . * @ param protocols protocols * @ return this */ public HttpClientBuilder sslEnabledProtocols ( String [ ] protocols ) { } }
if ( protocols == null ) { sslEnabledProtocols = null ; } else { sslEnabledProtocols = new String [ protocols . length ] ; System . arraycopy ( protocols , 0 , sslEnabledProtocols , 0 , protocols . length ) ; } return this ;
public class PageFlowUtils { /** * Destroy the current { @ link SharedFlowController } of the given class name . * @ param sharedFlowClassName the class name of the current SharedFlowController to destroy . * @ param request the current HttpServletRequest . */ public static void removeSharedFlow ( String sharedFlowClassName , HttpServletRequest request , ServletContext servletContext ) { } }
StorageHandler sh = Handlers . get ( servletContext ) . getStorageHandler ( ) ; HttpServletRequest unwrappedRequest = unwrapMultipart ( request ) ; RequestContext rc = new RequestContext ( unwrappedRequest , null ) ; String attrName = ScopedServletUtils . getScopedSessionAttrName ( InternalConstants . SHARED_FLOW_ATTR_PREFIX + sharedFlowClassName , request ) ; sh . removeAttribute ( rc , attrName ) ;
public class JSONConverter { /** * Decode a JSON document to retrieve a JMX instance . * @ param in The stream to read JSON from * @ return The decoded JMX instance * @ throws ConversionException If JSON uses unexpected structure / format * @ throws IOException If an I / O error occurs or if JSON is ill - formed . * @ see # writeJMX ( OutputStream , JMXServerInfo ) */ public JMXServerInfo readJMX ( InputStream in ) throws ConversionException , IOException { } }
JSONObject json = parseObject ( in ) ; JMXServerInfo ret = new JMXServerInfo ( ) ; ret . version = readIntInternal ( json . get ( N_VERSION ) ) ; ret . mbeansURL = readStringInternal ( json . get ( N_MBEANS ) ) ; ret . createMBeanURL = readStringInternal ( json . get ( N_CREATEMBEAN ) ) ; ret . mbeanCountURL = readStringInternal ( json . get ( N_MBEANCOUNT ) ) ; ret . defaultDomainURL = readStringInternal ( json . get ( N_DEFAULTDOMAIN ) ) ; ret . domainsURL = readStringInternal ( json . get ( N_DOMAINS ) ) ; ret . notificationsURL = readStringInternal ( json . get ( N_NOTIFICATIONS ) ) ; ret . instanceOfURL = readStringInternal ( json . get ( N_INSTANCEOF ) ) ; ret . fileTransferURL = readStringInternal ( json . get ( N_FILE_TRANSFER ) ) ; ret . apiURL = readStringInternal ( json . get ( N_API ) ) ; ret . graphURL = readStringInternal ( json . get ( N_GRAPH ) ) ; return ret ;
public class MutateInBuilder { /** * Insert a value in an existing array only if the value * isn ' t already contained in the array ( by way of string comparison ) . * @ param path the path to mutate in the JSON . * @ param value the value to insert . */ public < T > MutateInBuilder arrayAddUnique ( String path , T value ) { } }
asyncBuilder . arrayAddUnique ( path , value ) ; return this ;
public class SqlHelper { /** * update set列 , 不考虑乐观锁注解 @ Version * @ param entityClass * @ param entityName 实体映射名 * @ param notNull 是否判断 ! = null * @ param notEmpty 是否判断String类型 ! = ' ' * @ return */ public static String updateSetColumnsIgnoreVersion ( Class < ? > entityClass , String entityName , boolean notNull , boolean notEmpty ) { } }
StringBuilder sql = new StringBuilder ( ) ; sql . append ( "<set>" ) ; // 获取全部列 Set < EntityColumn > columnSet = EntityHelper . getColumns ( entityClass ) ; // 逻辑删除列 EntityColumn logicDeleteColumn = null ; // 当某个列有主键策略时 , 不需要考虑他的属性是否为空 , 因为如果为空 , 一定会根据主键策略给他生成一个值 for ( EntityColumn column : columnSet ) { if ( column . getEntityField ( ) . isAnnotationPresent ( LogicDelete . class ) ) { if ( logicDeleteColumn != null ) { throw new LogicDeleteException ( entityClass . getCanonicalName ( ) + " 中包含多个带有 @LogicDelete 注解的字段,一个类中只能存在一个带有 @LogicDelete 注解的字段!" ) ; } logicDeleteColumn = column ; } if ( ! column . isId ( ) && column . isUpdatable ( ) ) { if ( column . getEntityField ( ) . isAnnotationPresent ( Version . class ) ) { // ignore } else if ( column == logicDeleteColumn ) { sql . append ( logicDeleteColumnEqualsValue ( column , false ) ) . append ( "," ) ; } else if ( notNull ) { sql . append ( SqlHelper . getIfNotNull ( entityName , column , column . getColumnEqualsHolder ( entityName ) + "," , notEmpty ) ) ; } else { sql . append ( column . getColumnEqualsHolder ( entityName ) + "," ) ; } } } sql . append ( "</set>" ) ; return sql . toString ( ) ;
public class NewRelicManager { /** * Synchronise the alerts configuration with the cache . * @ param cache The provider cache * @ return < CODE > true < / CODE > if the operation was successful */ public boolean syncAlerts ( NewRelicCache cache ) { } }
boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; // Get the alert configuration using the REST API if ( cache . isAlertsEnabled ( ) ) { ret = false ; // Get the alert policies logger . info ( "Getting the alert policies" ) ; Collection < AlertPolicy > policies = apiClient . alertPolicies ( ) . list ( ) ; for ( AlertPolicy policy : policies ) { cache . alertPolicies ( ) . add ( policy ) ; // Add the alert conditions if ( cache . isApmEnabled ( ) || cache . isServersEnabled ( ) || cache . isBrowserEnabled ( ) || cache . isMobileEnabled ( ) ) cache . alertPolicies ( ) . alertConditions ( policy . getId ( ) ) . add ( apiClient . alertConditions ( ) . list ( policy . getId ( ) ) ) ; cache . alertPolicies ( ) . nrqlAlertConditions ( policy . getId ( ) ) . add ( apiClient . nrqlAlertConditions ( ) . list ( policy . getId ( ) ) ) ; if ( cache . isApmEnabled ( ) || cache . isMobileEnabled ( ) ) cache . alertPolicies ( ) . externalServiceAlertConditions ( policy . getId ( ) ) . add ( apiClient . externalServiceAlertConditions ( ) . list ( policy . getId ( ) ) ) ; if ( cache . isSyntheticsEnabled ( ) ) cache . alertPolicies ( ) . syntheticsAlertConditions ( policy . getId ( ) ) . add ( apiClient . syntheticsAlertConditions ( ) . list ( policy . getId ( ) ) ) ; if ( cache . isPluginsEnabled ( ) ) cache . alertPolicies ( ) . pluginsAlertConditions ( policy . getId ( ) ) . add ( apiClient . pluginsAlertConditions ( ) . list ( policy . getId ( ) ) ) ; if ( cache . isInfrastructureEnabled ( ) ) cache . alertPolicies ( ) . infraAlertConditions ( policy . getId ( ) ) . add ( infraApiClient . infraAlertConditions ( ) . list ( policy . getId ( ) ) ) ; } // Get the alert channels logger . info ( "Getting the alert channels" ) ; Collection < AlertChannel > channels = apiClient . alertChannels ( ) . list ( ) ; cache . alertChannels ( ) . set ( channels ) ; cache . alertPolicies ( ) . setAlertChannels ( channels ) ; cache . setUpdatedAt ( ) ; ret = true ; } return ret ;
public class Handler { /** * Renderable */ @ Override public void render ( Graphic g ) { } }
for ( final ComponentRenderer component : renderers ) { component . render ( g , featurables ) ; }
public class GoogleAdapter { /** * Set a value on the connection . */ public void setConnectionValues ( final Google google , final ConnectionValues values ) { } }
final UserInfo userInfo = google . oauth2Operations ( ) . getUserinfo ( ) ; values . setProviderUserId ( userInfo . getId ( ) ) ; values . setDisplayName ( userInfo . getName ( ) ) ; values . setProfileUrl ( userInfo . getLink ( ) ) ; values . setImageUrl ( userInfo . getPicture ( ) ) ;
public class URL { /** * Constructs a string representation of this < code > URL < / code > . The string is created by calling * the < code > toExternalForm < / code > method of the stream protocol handler for this object . * @ return a string representation of this object . * @ see java . net . URL # URL ( java . lang . String , java . lang . String , int , java . lang . String ) * @ see java . net . URLStreamHandler # toExternalForm ( java . net . URL ) */ public String toExternalForm ( ) { } }
// pre - compute length of StringBuffer int len = this . getProtocol ( ) . length ( ) + 1 ; if ( this . getAuthority ( ) != null && this . getAuthority ( ) . length ( ) > 0 ) { len += 2 + this . getAuthority ( ) . length ( ) ; } if ( this . getPath ( ) != null ) { len += this . getPath ( ) . length ( ) ; } if ( this . getQuery ( ) != null ) { len += 1 + this . getQuery ( ) . length ( ) ; } if ( this . getRef ( ) != null ) { len += 1 + this . getRef ( ) . length ( ) ; } final StringBuffer result = new StringBuffer ( len ) ; result . append ( this . getProtocol ( ) ) ; result . append ( ':' ) ; if ( this . getAuthority ( ) != null && this . getAuthority ( ) . length ( ) > 0 ) { result . append ( "//" ) ; result . append ( this . getAuthority ( ) ) ; } if ( this . getPath ( ) != null ) { result . append ( this . getPath ( ) ) ; } if ( this . getQuery ( ) != null ) { result . append ( '?' ) ; result . append ( this . getQuery ( ) ) ; } if ( this . getRef ( ) != null ) { result . append ( '#' ) ; result . append ( this . getRef ( ) ) ; } return result . toString ( ) ;
public class IdentityPatchContext { /** * Write the patch . xml * @ param rollbackPatch the patch * @ param file the target file * @ throws IOException */ static void writePatch ( final Patch rollbackPatch , final File file ) throws IOException { } }
final File parent = file . getParentFile ( ) ; if ( ! parent . isDirectory ( ) ) { if ( ! parent . mkdirs ( ) && ! parent . exists ( ) ) { throw PatchLogger . ROOT_LOGGER . cannotCreateDirectory ( file . getAbsolutePath ( ) ) ; } } try { try ( final OutputStream os = new FileOutputStream ( file ) ) { PatchXml . marshal ( os , rollbackPatch ) ; } } catch ( XMLStreamException e ) { throw new IOException ( e ) ; }
public class CmsShellCommands { /** * Exports the module with the given name to the default location . < p > * @ param moduleName the name of the module to export * @ throws Exception if something goes wrong */ public void exportModule ( String moduleName ) throws Exception { } }
CmsModule module = OpenCms . getModuleManager ( ) . getModule ( moduleName ) ; if ( module == null ) { throw new CmsDbEntryNotFoundException ( Messages . get ( ) . container ( Messages . ERR_UNKNOWN_MODULE_1 , moduleName ) ) ; } String filename = OpenCms . getSystemInfo ( ) . getAbsoluteRfsPathRelativeToWebInf ( OpenCms . getSystemInfo ( ) . getPackagesRfsPath ( ) + CmsSystemInfo . FOLDER_MODULES + moduleName + "_" + OpenCms . getModuleManager ( ) . getModule ( moduleName ) . getVersion ( ) . toString ( ) ) ; List < String > moduleResources = CmsModule . calculateModuleResourceNames ( m_cms , module ) ; String [ ] resources = new String [ moduleResources . size ( ) ] ; System . arraycopy ( moduleResources . toArray ( ) , 0 , resources , 0 , resources . length ) ; // generate a module export handler CmsModuleImportExportHandler moduleExportHandler = new CmsModuleImportExportHandler ( ) ; moduleExportHandler . setFileName ( filename ) ; moduleExportHandler . setAdditionalResources ( resources ) ; moduleExportHandler . setModuleName ( module . getName ( ) . replace ( '\\' , '/' ) ) ; moduleExportHandler . setDescription ( getMessages ( ) . key ( Messages . GUI_SHELL_IMPORTEXPORT_MODULE_HANDLER_NAME_1 , new Object [ ] { moduleExportHandler . getModuleName ( ) } ) ) ; // export the module OpenCms . getImportExportManager ( ) . exportData ( m_cms , moduleExportHandler , new CmsShellReport ( m_cms . getRequestContext ( ) . getLocale ( ) ) ) ;
public class RouteFiltersInner { /** * Updates a route filter in a specified resource group . * @ param resourceGroupName The name of the resource group . * @ param routeFilterName The name of the route filter . * @ param routeFilterParameters Parameters supplied to the update route filter operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the RouteFilterInner object if successful . */ public RouteFilterInner beginUpdate ( String resourceGroupName , String routeFilterName , PatchRouteFilter routeFilterParameters ) { } }
return beginUpdateWithServiceResponseAsync ( resourceGroupName , routeFilterName , routeFilterParameters ) . toBlocking ( ) . single ( ) . body ( ) ;
public class VastRedirectCreative { /** * Gets the vastRedirectType value for this VastRedirectCreative . * @ return vastRedirectType * The type of VAST ad that this redirects to . This attribute * is required . */ public com . google . api . ads . admanager . axis . v201808 . VastRedirectType getVastRedirectType ( ) { } }
return vastRedirectType ;
public class AdWordsConversionTracker { /** * Gets the trackingCodeType value for this AdWordsConversionTracker . * @ return trackingCodeType * Tracking code to use for the conversion type . * < span class = " constraint Selectable " > This field * can be selected using the value " TrackingCodeType " . < / span > < span class = " constraint * Filterable " > This field can be filtered on . < / span > */ public com . google . api . ads . adwords . axis . v201809 . cm . AdWordsConversionTrackerTrackingCodeType getTrackingCodeType ( ) { } }
return trackingCodeType ;
public class TaskProxy { /** * Create a new remote receive queue . * @ param strQueueName The queue name . * @ param strQueueType The queue type ( see MessageConstants ) . */ public RemoteReceiveQueue createRemoteReceiveQueue ( String strQueueName , String strQueueType ) throws RemoteException { } }
BaseTransport transport = this . createProxyTransport ( CREATE_REMOTE_RECEIVE_QUEUE ) ; transport . addParam ( MessageConstants . QUEUE_NAME , strQueueName ) ; transport . addParam ( MessageConstants . QUEUE_TYPE , strQueueType ) ; String strID = ( String ) transport . sendMessageAndGetReply ( ) ; return new ReceiveQueueProxy ( this , strID ) ;
public class QueryEntry { /** * It may be useful to use this { @ code init } method in some cases that same instance of this class can be used * instead of creating a new one for every iteration when scanning large data sets , for example : * < pre > * < code > Predicate predicate = . . . * QueryEntry entry = new QueryEntry ( ) * for ( i = = 0 ; i < HUGE _ NUMBER ; i + + ) { * entry . init ( . . . ) * boolean valid = predicate . apply ( queryEntry ) ; * if ( valid ) { * < / code > * < / pre > */ public void init ( InternalSerializationService serializationService , Data key , Object value , Extractors extractors ) { } }
if ( key == null ) { throw new IllegalArgumentException ( "keyData cannot be null" ) ; } this . serializationService = serializationService ; this . key = key ; this . value = value ; this . extractors = extractors ;
public class RoleAssignmentsInner { /** * Creates a role assignment . * @ param scope The scope of the role assignment to create . The scope can be any REST resource instance . For example , use ' / subscriptions / { subscription - id } / ' for a subscription , ' / subscriptions / { subscription - id } / resourceGroups / { resource - group - name } ' for a resource group , and ' / subscriptions / { subscription - id } / resourceGroups / { resource - group - name } / providers / { resource - provider } / { resource - type } / { resource - name } ' for a resource . * @ param roleAssignmentName The name of the role assignment to create . It can be any valid GUID . * @ param properties Role assignment properties . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the RoleAssignmentInner object */ public Observable < RoleAssignmentInner > createAsync ( String scope , String roleAssignmentName , RoleAssignmentProperties properties ) { } }
return createWithServiceResponseAsync ( scope , roleAssignmentName , properties ) . map ( new Func1 < ServiceResponse < RoleAssignmentInner > , RoleAssignmentInner > ( ) { @ Override public RoleAssignmentInner call ( ServiceResponse < RoleAssignmentInner > response ) { return response . body ( ) ; } } ) ;
public class PageFlowUtils { /** * Set a named action output , which corresponds to an input declared by the < code > pageInput < / code > JSP tag . * The actual value can be read from within a JSP using the < code > " pageInput " < / code > databinding context . * @ param name the name of the action output . * @ param value the value of the action output . * @ param request the current ServletRequest . */ public static void addActionOutput ( String name , Object value , ServletRequest request ) { } }
Map map = InternalUtils . getActionOutputMap ( request , true ) ; if ( map . containsKey ( name ) ) { if ( _log . isWarnEnabled ( ) ) { _log . warn ( "Overwriting action output\"" + name + "\"." ) ; } } map . put ( name , value ) ;
public class Types { /** * where */ List < Type > erasedSupertypes ( Type t ) { } }
ListBuffer < Type > buf = new ListBuffer < > ( ) ; for ( Type sup : closure ( t ) ) { if ( sup . hasTag ( TYPEVAR ) ) { buf . append ( sup ) ; } else { buf . append ( erasure ( sup ) ) ; } } return buf . toList ( ) ;
public class InternalXbaseParser { /** * InternalXbase . g : 1117:1 : ruleXVariableDeclaration : ( ( rule _ _ XVariableDeclaration _ _ Group _ _ 0 ) ) ; */ public final void ruleXVariableDeclaration ( ) throws RecognitionException { } }
int stackSize = keepStackSize ( ) ; try { // InternalXbase . g : 1121:2 : ( ( ( rule _ _ XVariableDeclaration _ _ Group _ _ 0 ) ) ) // InternalXbase . g : 1122:2 : ( ( rule _ _ XVariableDeclaration _ _ Group _ _ 0 ) ) { // InternalXbase . g : 1122:2 : ( ( rule _ _ XVariableDeclaration _ _ Group _ _ 0 ) ) // InternalXbase . g : 1123:3 : ( rule _ _ XVariableDeclaration _ _ Group _ _ 0 ) { if ( state . backtracking == 0 ) { before ( grammarAccess . getXVariableDeclarationAccess ( ) . getGroup ( ) ) ; } // InternalXbase . g : 1124:3 : ( rule _ _ XVariableDeclaration _ _ Group _ _ 0 ) // InternalXbase . g : 1124:4 : rule _ _ XVariableDeclaration _ _ Group _ _ 0 { pushFollow ( FOLLOW_2 ) ; rule__XVariableDeclaration__Group__0 ( ) ; state . _fsp -- ; if ( state . failed ) return ; } if ( state . backtracking == 0 ) { after ( grammarAccess . getXVariableDeclarationAccess ( ) . getGroup ( ) ) ; } } } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { restoreStackSize ( stackSize ) ; } return ;
public class FileSystem { /** * Get the default filesystem URI from a configuration . * @ param conf the configuration to access * @ return the uri of the default filesystem */ public static URI getDefaultUri ( Configuration conf ) { } }
return URI . create ( fixName ( conf . get ( FS_DEFAULT_NAME_KEY , "file:///" ) ) ) ;
public class InstanceResource { /** * Get requests returns the information about the instance ' s * { @ link InstanceInfo } . * @ return response containing information about the the instance ' s * { @ link InstanceInfo } . */ @ GET public Response getInstanceInfo ( ) { } }
InstanceInfo appInfo = registry . getInstanceByAppAndId ( app . getName ( ) , id ) ; if ( appInfo != null ) { logger . debug ( "Found: {} - {}" , app . getName ( ) , id ) ; return Response . ok ( appInfo ) . build ( ) ; } else { logger . debug ( "Not Found: {} - {}" , app . getName ( ) , id ) ; return Response . status ( Status . NOT_FOUND ) . build ( ) ; }
public class RecastFilter { /** * / @ see rcHeightfield , rcConfig */ public static void filterLowHangingWalkableObstacles ( Context ctx , int walkableClimb , Heightfield solid ) { } }
ctx . startTimer ( "FILTER_LOW_OBSTACLES" ) ; int w = solid . width ; int h = solid . height ; for ( int y = 0 ; y < h ; ++ y ) { for ( int x = 0 ; x < w ; ++ x ) { Span ps = null ; boolean previousWalkable = false ; int previousArea = RecastConstants . RC_NULL_AREA ; for ( Span s = solid . spans [ x + y * w ] ; s != null ; ps = s , s = s . next ) { boolean walkable = s . area != RecastConstants . RC_NULL_AREA ; // If current span is not walkable , but there is walkable // span just below it , mark the span above it walkable too . if ( ! walkable && previousWalkable ) { if ( Math . abs ( s . smax - ps . smax ) <= walkableClimb ) s . area = previousArea ; } // Copy walkable flag so that it cannot propagate // past multiple non - walkable objects . previousWalkable = walkable ; previousArea = s . area ; } } } ctx . stopTimer ( "FILTER_LOW_OBSTACLES" ) ;
public class PCA { /** * Take the data that has been transformed to the principal components about the mean and * transform it back into the original feature set . Make sure to fill in zeroes in columns * where components were dropped ! * @ param data Data of the same features used to construct the PCA object but as the components * @ return The records in terms of the original features */ public INDArray convertBackToFeatures ( INDArray data ) { } }
return Nd4j . tensorMmul ( eigenvectors , data , new int [ ] [ ] { { 1 } , { 1 } } ) . transposei ( ) . addiRowVector ( mean ) ;
public class RandomSplit { /** * Selects two objects of the specified node to be promoted and stored into * the parent node . The m - RAD strategy considers all possible pairs of objects * and , after partitioning the set of entries , promotes the pair of objects * for which the sum of covering radiuses is minimum . * @ param tree Tree to use * @ param node the node to be split */ @ Override public Assignments < E > split ( AbstractMTree < ? , N , E , ? > tree , N node ) { } }
final int n = node . getNumEntries ( ) ; int pos1 = random . nextInt ( n ) , pos2 = random . nextInt ( n - 1 ) ; pos2 = pos2 >= pos1 ? pos2 + 1 : pos2 ; // Build distance arrays : double [ ] dis1 = new double [ n ] , dis2 = new double [ n ] ; E e1 = node . getEntry ( pos1 ) , e2 = node . getEntry ( pos2 ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i == pos1 || i == pos2 ) { continue ; } final E ej = node . getEntry ( i ) ; dis1 [ i ] = tree . distance ( e1 , ej ) ; dis2 [ i ] = tree . distance ( e2 , ej ) ; } return distributor . distribute ( node , pos1 , dis1 , pos2 , dis2 ) ;
public class A_CmsPropertyEditor { /** * Lazily creates the model object for the URL name field . < p > * @ param urlName the initial value for the URL name * @ return the model object for the URL name field */ protected CmsDefaultStringModel getUrlNameModel ( String urlName ) { } }
if ( m_urlNameModel == null ) { m_urlNameModel = new CmsDefaultStringModel ( "urlname" ) ; m_urlNameModel . setValue ( urlName , false ) ; } return m_urlNameModel ;
public class CmsGalleryService { /** * Checks if the current user has write permissions on the given resource . < p > * @ param cms the current cms context * @ param resource the resource to check * @ return < code > true < / code > if the current user has write permissions on the given resource */ boolean isEditable ( CmsObject cms , CmsResource resource ) { } }
try { return cms . hasPermissions ( resource , CmsPermissionSet . ACCESS_WRITE , false , CmsResourceFilter . ALL ) ; } catch ( CmsException e ) { return false ; }
public class VirtualMachineScaleSetRollingUpgradesInner { /** * Cancels the current virtual machine scale set rolling upgrade . * @ param resourceGroupName The name of the resource group . * @ param vmScaleSetName The name of the VM scale set . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the OperationStatusResponseInner object */ public Observable < OperationStatusResponseInner > beginCancelAsync ( String resourceGroupName , String vmScaleSetName ) { } }
return beginCancelWithServiceResponseAsync ( resourceGroupName , vmScaleSetName ) . map ( new Func1 < ServiceResponse < OperationStatusResponseInner > , OperationStatusResponseInner > ( ) { @ Override public OperationStatusResponseInner call ( ServiceResponse < OperationStatusResponseInner > response ) { return response . body ( ) ; } } ) ;
public class ActivityMgr { /** * 注册activity onDestroyed 事件回调 | Registering an Activity ondestroyed event Callback * @ param callback activity onDestroyed 事件回调 | Activity Ondestroyed Event Callback */ public void registerActivitDestroyedEvent ( IActivityDestroyedCallback callback ) { } }
HMSAgentLog . d ( "registerOnDestroyed:" + StrUtils . objDesc ( callback ) ) ; destroyedCallbacks . add ( callback ) ;
public class SourceInformation { /** * If the pattern is not null , it will attempt to match against the supplied name to pull out the source . */ public static SourceInformation from ( Pattern sourceRegex , String name ) { } }
if ( sourceRegex == null ) { return new SourceInformation ( null , name ) ; } Matcher matcher = sourceRegex . matcher ( name ) ; if ( matcher . groupCount ( ) != 1 ) { log . error ( "Source regex matcher must define a group" ) ; return new SourceInformation ( null , name ) ; } if ( ! matcher . find ( ) ) { return new SourceInformation ( null , name ) ; } String source = matcher . group ( 1 ) ; int endPos = matcher . toMatchResult ( ) . end ( ) ; if ( endPos >= name . length ( ) ) { // the source matched the whole metric name , probably in error . log . error ( "Source '{}' matched the whole metric name. Metric name cannot be empty" ) ; return new SourceInformation ( null , name ) ; } String newName = name . substring ( endPos ) ; return new SourceInformation ( source , newName ) ;
public class ClassPathUtils { /** * Scan the classpath string provided , and collect a set of package paths found in jars and classes on the path , * including only those that match a set of include prefixes . * @ param classPath the classpath string * @ param excludeJarSet a set of jars to exclude from scanning * @ param includePrefixes a set of path prefixes that determine what is included * @ return the results of the scan , as a set of package paths ( separated by ' / ' ) . */ public static Set < String > scanClassPathWithIncludes ( final String classPath , final Set < String > excludeJarSet , final Set < String > includePrefixes ) { } }
final Set < String > pathSet = new HashSet < String > ( ) ; // Defer to JDKPaths to do the actual classpath scanning . __JDKPaths . processClassPathItem ( classPath , excludeJarSet , pathSet ) ; return filterPathSet ( pathSet , Collections . < String > emptySet ( ) , includePrefixes ) ;
public class DefaultPassConfig { /** * Verify that all the passes are multi - run passes . */ private static void assertAllLoopablePasses ( List < PassFactory > passes ) { } }
for ( PassFactory pass : passes ) { checkState ( ! pass . isOneTimePass ( ) ) ; }
public class TransformerImpl { /** * Look up the value of a feature . * < p > The feature name is any fully - qualified URI . It is * possible for an TransformerFactory to recognize a feature name but * to be unable to return its value ; this is especially true * in the case of an adapter for a SAX1 Parser , which has * no way of knowing whether the underlying parser is * validating , for example . < / p > * < h3 > Open issues : < / h3 > * < dl > * < dt > < h4 > Should getFeature be changed to hasFeature ? < / h4 > < / dt > * < dd > Keith Visco writes : Should getFeature be changed to hasFeature ? * It returns a boolean which indicated whether the " state " * of feature is " true or false " . I assume this means whether * or not a feature is supported ? I know SAX is using " getFeature " , * but to me " hasFeature " is cleaner . < / dd > * < / dl > * @ param name The feature name , which is a fully - qualified * URI . * @ return The current state of the feature ( true or false ) . * @ throws org . xml . sax . SAXNotRecognizedException When the * TransformerFactory does not recognize the feature name . * @ throws org . xml . sax . SAXNotSupportedException When the * TransformerFactory recognizes the feature name but * cannot determine its value at this time . * @ throws SAXNotRecognizedException * @ throws SAXNotSupportedException */ public boolean getFeature ( String name ) throws SAXNotRecognizedException , SAXNotSupportedException { } }
if ( "http://xml.org/trax/features/sax/input" . equals ( name ) ) return true ; else if ( "http://xml.org/trax/features/dom/input" . equals ( name ) ) return true ; throw new SAXNotRecognizedException ( name ) ;
public class ApplicationSession { /** * Get a value from the user OR session attributes map . * @ param key * name of the attribute * @ param defaultValue * a default value to return if no value is found . * @ return the attribute value */ public Object getAttribute ( String key , Object defaultValue ) { } }
Object attributeValue = getUserAttribute ( key , null ) ; if ( attributeValue != null ) return attributeValue ; attributeValue = getSessionAttribute ( key , null ) ; if ( attributeValue != null ) return attributeValue ; return defaultValue ;
public class appfwprofile { /** * Use this API to fetch appfwprofile resource of given name . */ public static appfwprofile get ( nitro_service service , String name ) throws Exception { } }
appfwprofile obj = new appfwprofile ( ) ; obj . set_name ( name ) ; appfwprofile response = ( appfwprofile ) obj . get_resource ( service ) ; return response ;
public class Utils { /** * Decode the given base64 value to binary , then decode the result as a UTF - 8 sequence * and return the resulting String . * @ param base64Value Base64 - encoded value of a UTF - 8 encoded string . * @ return Decoded string value . */ public static String base64ToString ( String base64Value ) { } }
Utils . require ( base64Value . length ( ) % 4 == 0 , "Invalid base64 value (must be a multiple of 4 chars): " + base64Value ) ; byte [ ] utf8String = DatatypeConverter . parseBase64Binary ( base64Value ) ; return toString ( utf8String ) ;
public class HttpUtils { /** * Invoke REST Service using POST method . * @ param urlStr * the REST service URL String * @ param body * the Http Body String . * @ return the HttpResponse . * @ throws IOException * @ throws ServiceException */ public static HttpResponse postJson ( String urlStr , String body ) throws IOException , ServiceException { } }
URL url = new URL ( urlStr ) ; HttpURLConnection urlConnection = ( HttpURLConnection ) url . openConnection ( ) ; if ( urlConnection instanceof HttpsURLConnection ) { setTLSConnection ( ( HttpsURLConnection ) urlConnection ) ; } urlConnection . addRequestProperty ( "Accept" , "application/json" ) ; urlConnection . setRequestMethod ( "POST" ) ; urlConnection . addRequestProperty ( "Content-Type" , "application/json" ) ; urlConnection . addRequestProperty ( "Content-Length" , Integer . toString ( body . length ( ) ) ) ; urlConnection . setDoOutput ( true ) ; urlConnection . setDoInput ( true ) ; urlConnection . setUseCaches ( false ) ; OutputStream out = urlConnection . getOutputStream ( ) ; out . write ( body . getBytes ( ) ) ; ByteStreams . copy ( new ByteArrayInputStream ( body . getBytes ( ) ) , out ) ; return getHttpResponse ( urlConnection ) ;
public class PrepareRequestInterceptor { /** * Method to construct the OLB QBO URI * @ param entityName * the entity name * @ param context * the context * @ param requestParameters * the request params * @ return the QBO URI * @ throws FMSException * the FMSException */ private < T extends IEntity > String prepareQBOPremierUri ( String entityName , Context context , Map < String , String > requestParameters ) throws FMSException { } }
StringBuilder uri = new StringBuilder ( ) ; // constructs request URI uri . append ( Config . getProperty ( "BASE_URL_QBO_OLB" ) ) . append ( "/" ) . append ( context . getRealmID ( ) ) . append ( "/" ) . append ( entityName ) ; // adding the entity id in the URI , which is required for READ operation addEntityID ( requestParameters , uri ) ; addEntitySelector ( requestParameters , uri ) ; // adds the built request param uri . append ( "?" ) . append ( buildRequestParams ( requestParameters ) ) ; // adds the generated request id as a parameter uri . append ( "requestid" ) . append ( "=" ) . append ( context . getRequestID ( ) ) . append ( "&" ) ; // set RequestId to null once appended , so the next random num can be generated context . setRequestID ( null ) ; if ( context . getMinorVersion ( ) != null ) { uri . append ( "minorversion" ) . append ( "=" ) . append ( context . getMinorVersion ( ) ) . append ( "&" ) ; } return uri . toString ( ) ;
public class PICTImageReader { /** * Parse PICT opcodes in a PICT file . The input stream must be * positioned at the beginning of the opcodes , after picframe . * If we have a non - null graphics , we try to draw the elements . * @ param pStream the stream to read from * @ throws IIOException if the data can not be read . * @ throws IOException if an I / O error occurs while reading the image . */ private void readPICTopcodes ( ImageInputStream pStream ) throws IOException { } }
pStream . seek ( imageStartStreamPos ) ; int opCode , dh , dv , dataLength ; byte [ ] colorBuffer = new byte [ 3 * PICT . COLOR_COMP_SIZE ] ; Pattern fill = QuickDraw . BLACK ; Pattern bg ; Pattern pen ; Color hilight = Color . RED ; Point origin , dh_dv ; Point ovSize = new Point ( ) ; Point arcAngles = new Point ( ) ; String text ; Rectangle bounds = new Rectangle ( ) ; Polygon polygon = new Polygon ( ) ; Area region = new Area ( ) ; int pixmapCount = 0 ; try { // Read from file until we read the end of picture opcode do { // Read opcode , version 1 : byte , version 2 : short if ( version == 1 ) { opCode = pStream . readUnsignedByte ( ) ; } else { // Always word - aligned for version 2 if ( ( pStream . getStreamPosition ( ) & 1 ) > 0 ) { pStream . readByte ( ) ; } opCode = pStream . readUnsignedShort ( ) ; } // See what we got and react in consequence switch ( opCode ) { case PICT . NOP : // Just go on if ( DEBUG ) { System . out . println ( "NOP" ) ; } break ; case PICT . OP_CLIP_RGN : // OK for RECTS , not for regions yet // Read the region if ( ( region = readRegion ( pStream , bounds ) ) == null ) { throw new IIOException ( "Could not read region" ) ; } // Set clip rect or clip region // if ( mGraphics ! = null ) { // if ( region . npoints = = 0 ) { // / / TODO : Read what the specs says about this . . . // if ( bounds . width > 0 & & bounds . height > 0 ) { // mGraphics . setClip ( bounds . x , bounds . y , bounds . width , bounds . height ) ; // else { // mGraphics . setClip ( region ) ; if ( DEBUG ) { verboseRegionCmd ( "clipRgn" , bounds , region ) ; } break ; case PICT . OP_BK_PAT : // Get the data context . setBackgroundPattern ( PICTUtil . readPattern ( pStream ) ) ; if ( DEBUG ) { System . out . println ( "bkPat" ) ; } break ; case PICT . OP_TX_FONT : // Get the data byte [ ] fontData = new byte [ 2 ] ; pStream . readFully ( fontData , 0 , 2 ) ; // TODO : Font family id , 0 - System font , 1 - Application font . // But how can we get these mappings ? if ( DEBUG ) { System . out . println ( "txFont: " + Arrays . toString ( fontData ) ) ; } break ; case PICT . OP_TX_FACE : // Get the data int txFace = pStream . readUnsignedByte ( ) ; context . setTextFace ( txFace ) ; if ( DEBUG ) { System . out . println ( "txFace: " + txFace ) ; } break ; case PICT . OP_TX_MODE : // Get the data byte [ ] mode_buf = new byte [ 2 ] ; pStream . readFully ( mode_buf , 0 , mode_buf . length ) ; if ( DEBUG ) { System . out . println ( "txMode: " + mode_buf [ 0 ] + ", " + mode_buf [ 1 ] ) ; } break ; case PICT . OP_SP_EXTRA : // WONDER WHAT IT IS ? // Get the data pStream . readFully ( new byte [ 4 ] , 0 , 4 ) ; if ( DEBUG ) { System . out . println ( "spExtra" ) ; } break ; case PICT . OP_PN_SIZE : // Get the two words // NOTE : This is out of order , compared to other Points Dimension pnsize = new Dimension ( pStream . readUnsignedShort ( ) , pStream . readUnsignedShort ( ) ) ; if ( DEBUG ) { System . out . println ( "pnsize: " + pnsize ) ; } context . setPenSize ( pnsize ) ; break ; case PICT . OP_PN_MODE : // Get the data int mode = pStream . readUnsignedShort ( ) ; if ( DEBUG ) { System . out . println ( "pnMode: " + mode ) ; } context . setPenMode ( mode ) ; break ; case PICT . OP_PN_PAT : context . setPenPattern ( PICTUtil . readPattern ( pStream , context . getForeground ( ) , context . getBackground ( ) ) ) ; if ( DEBUG ) { System . out . println ( "pnPat" ) ; } break ; case PICT . OP_FILL_PAT : fill = PICTUtil . readPattern ( pStream ) ; if ( DEBUG ) { System . out . println ( "fillPat" ) ; } break ; case PICT . OP_OV_SIZE : // OK , we use this for rounded rectangle corners // Get the two words int y = getYPtCoord ( pStream . readUnsignedShort ( ) ) ; int x = getXPtCoord ( pStream . readUnsignedShort ( ) ) ; ovSize . setLocation ( x , y ) ; /* ovSize . x * = 2 ; / / Don ' t know why , but has to be multiplied by 2 ovSize . y * = 2; */ if ( DEBUG ) { System . out . println ( "ovSize: " + ovSize ) ; } break ; case PICT . OP_ORIGIN : // PROBABLY OK // Get the two words y = getYPtCoord ( pStream . readUnsignedShort ( ) ) ; x = getXPtCoord ( pStream . readUnsignedShort ( ) ) ; origin = new Point ( x , y ) ; if ( DEBUG ) { System . out . println ( "Origin: " + origin ) ; } break ; case PICT . OP_TX_SIZE : // OK // Get the text size int tx_size = getYPtCoord ( pStream . readUnsignedShort ( ) ) ; context . setTextSize ( tx_size ) ; if ( DEBUG ) { System . out . println ( "txSize: " + tx_size ) ; } break ; case PICT . OP_FG_COLOR : // TO BE DONE IF POSSIBLE // TODO ! // Get the data pStream . readInt ( ) ; if ( DEBUG ) { System . out . println ( "fgColor" ) ; } break ; case PICT . OP_BK_COLOR : // TO BE DONE IF POSSIBLE // TODO ! // Get the data pStream . readInt ( ) ; if ( DEBUG ) { System . out . println ( "bgColor" ) ; } break ; case PICT . OP_TX_RATIO : // SEE IF WE HAVE THIS ? ? ? // Get the data pStream . readFully ( new byte [ 8 ] , 0 , 8 ) ; if ( DEBUG ) { System . out . println ( "txRatio" ) ; } break ; case PICT . OP_VERSION : // OK , ignored since we should already have it // Get the data pStream . readFully ( new byte [ 1 ] , 0 , 1 ) ; if ( DEBUG ) { System . out . println ( "opVersion" ) ; } break ; case 0x0012 : // BkPixPat bg = PICTUtil . readColorPattern ( pStream ) ; context . setBackgroundPattern ( bg ) ; if ( DEBUG ) { System . out . println ( "BkPixPat" ) ; } break ; case 0x0013 : // PnPixPat pen = PICTUtil . readColorPattern ( pStream ) ; context . setPenPattern ( pen ) ; if ( DEBUG ) { System . out . println ( "PnPixPat" ) ; } break ; case 0x0014 : // FillPixPat fill = PICTUtil . readColorPattern ( pStream ) ; context . setFillPattern ( fill ) ; if ( DEBUG ) { System . out . println ( "FillPixPat" ) ; } break ; case PICT . OP_PN_LOC_H_FRAC : // TO BE DONE ? ? ? // Get the data pStream . readFully ( new byte [ 2 ] , 0 , 2 ) ; if ( DEBUG ) { System . out . println ( "opPnLocHFrac" ) ; } break ; case PICT . OP_CH_EXTRA : // TO BE DONE ? ? ? // Get the data pStream . readFully ( new byte [ 2 ] , 0 , 2 ) ; if ( DEBUG ) { System . out . println ( "opChExtra" ) ; } break ; case PICT . OP_RGB_FG_COL : // OK // Get the color pStream . readFully ( colorBuffer , 0 , colorBuffer . length ) ; Color foreground = new Color ( ( colorBuffer [ 0 ] & 0xFF ) , ( colorBuffer [ 2 ] & 0xFF ) , ( colorBuffer [ 4 ] & 0xFF ) ) ; if ( DEBUG ) { System . out . println ( "rgbFgColor: " + foreground ) ; } context . setForeground ( foreground ) ; break ; case PICT . OP_RGB_BK_COL : // OK // Get the color pStream . readFully ( colorBuffer , 0 , colorBuffer . length ) ; // The color might be 16 bit per component . . Color background = new Color ( colorBuffer [ 0 ] & 0xFF , colorBuffer [ 2 ] & 0xFF , colorBuffer [ 4 ] & 0xFF ) ; if ( DEBUG ) { System . out . println ( "rgbBgColor: " + background ) ; } context . setBackground ( background ) ; break ; case PICT . OP_HILITE_MODE : // Change color to hilite color context . setPenPattern ( new BitMapPattern ( hilight ) ) ; if ( DEBUG ) { System . out . println ( "opHiliteMode" ) ; } break ; case PICT . OP_HILITE_COLOR : // OK // Get the color pStream . readFully ( colorBuffer , 0 , colorBuffer . length ) ; // TODO : The color might be 16 bit per component . . hilight = new Color ( ( colorBuffer [ 0 ] & 0xFF ) , ( colorBuffer [ 2 ] & 0xFF ) , ( colorBuffer [ 4 ] & 0xFF ) ) ; if ( DEBUG ) { System . out . println ( "opHiliteColor: " + hilight ) ; } break ; case PICT . OP_DEF_HILITE : // Macintosh internal , ignored ? // Nothing to do hilight = Color . red ; // TODO : My guess it ' s a reset , verify ! if ( DEBUG ) { System . out . println ( "opDefHilite" ) ; } break ; case PICT . OP_OP_COLOR : // To be done once I know what it means // TODO : Is this the mask ? Scale value for RGB colors ? // Get the color pStream . readFully ( colorBuffer , 0 , colorBuffer . length ) ; if ( DEBUG ) { System . out . println ( "opOpColor" ) ; } break ; case PICT . OP_LINE : // OK , not tested // Get the data ( two points ) y = getYPtCoord ( pStream . readUnsignedShort ( ) ) ; x = getXPtCoord ( pStream . readUnsignedShort ( ) ) ; origin = new Point ( x , y ) ; y = getYPtCoord ( pStream . readUnsignedShort ( ) ) ; x = getXPtCoord ( pStream . readUnsignedShort ( ) ) ; penPosition . setLocation ( x , y ) ; // Move pen to new position , draw line context . moveTo ( origin ) ; context . lineTo ( penPosition ) ; if ( DEBUG ) { System . out . println ( "line from: " + origin + " to: " + penPosition ) ; } break ; case PICT . OP_LINE_FROM : // OK , not tested // Get the point y = getYPtCoord ( pStream . readUnsignedShort ( ) ) ; x = getXPtCoord ( pStream . readUnsignedShort ( ) ) ; // Draw line context . line ( x , y ) ; if ( DEBUG ) { System . out . println ( "lineFrom to: " + penPosition ) ; } break ; case PICT . OP_SHORT_LINE : // OK // Get origin and dh , dv y = getYPtCoord ( pStream . readUnsignedShort ( ) ) ; x = getXPtCoord ( pStream . readUnsignedShort ( ) ) ; origin = new Point ( x , y ) ; x = getXPtCoord ( pStream . readByte ( ) ) ; y = getYPtCoord ( pStream . readByte ( ) ) ; dh_dv = new Point ( x , y ) ; // Move pen to new position , draw line if we have a graphics context . moveTo ( origin ) ; penPosition . setLocation ( origin . x + dh_dv . x , origin . y + dh_dv . y ) ; context . lineTo ( penPosition ) ; if ( DEBUG ) { System . out . println ( "Short line origin: " + origin + ", dh,dv: " + dh_dv ) ; } break ; case PICT . OP_SHORT_LINE_FROM : // OK // Get dh , dv x = getXPtCoord ( pStream . readByte ( ) ) ; y = getYPtCoord ( pStream . readByte ( ) ) ; // Draw line context . line ( x , y ) ; if ( DEBUG ) { System . out . println ( "Short line from dh,dv: " + x + "," + y ) ; } break ; case 0x24 : case 0x25 : case 0x26 : case 0x27 : // Apple reserved dataLength = pStream . readUnsignedShort ( ) ; pStream . readFully ( new byte [ dataLength ] , 0 , dataLength ) ; if ( DEBUG ) { System . out . println ( String . format ( "%s: 0x%04x" , PICT . APPLE_USE_RESERVED_FIELD , opCode ) ) ; } break ; case PICT . OP_LONG_TEXT : // OK // Get the data y = getYPtCoord ( pStream . readUnsignedShort ( ) ) ; x = getXPtCoord ( pStream . readUnsignedShort ( ) ) ; origin = new Point ( x , y ) ; penPosition = origin ; context . moveTo ( penPosition ) ; text = PICTUtil . readPascalString ( pStream ) ; context . drawString ( text ) ; if ( DEBUG ) { System . out . println ( "longText origin: " + penPosition + ", text:" + text ) ; } break ; case PICT . OP_DH_TEXT : // OK , not tested // Get dh dh = getXPtCoord ( pStream . readByte ( ) ) ; penPosition . translate ( dh , 0 ) ; context . moveTo ( penPosition ) ; text = PICTUtil . readPascalString ( pStream ) ; context . drawString ( text ) ; if ( DEBUG ) { System . out . println ( "DHText dh: " + dh + ", text:" + text ) ; } break ; case PICT . OP_DV_TEXT : // OK , not tested // Get dh dv = getYPtCoord ( pStream . readByte ( ) ) ; penPosition . translate ( 0 , dv ) ; context . moveTo ( penPosition ) ; text = PICTUtil . readPascalString ( pStream ) ; context . drawString ( text ) ; if ( DEBUG ) { System . out . println ( "DVText dv: " + dv + ", text:" + text ) ; } break ; case PICT . OP_DHDV_TEXT : // OK , not tested // Get dh , dv y = getYPtCoord ( pStream . readByte ( ) ) ; x = getXPtCoord ( pStream . readByte ( ) ) ; penPosition . translate ( x , y ) ; context . moveTo ( penPosition ) ; text = PICTUtil . readPascalString ( pStream ) ; context . drawString ( text ) ; if ( DEBUG ) { System . out . println ( "DHDVText penPosition: " + penPosition + ", text:" + text ) ; } break ; case PICT . OP_FONT_NAME : // OK , not tested // Get data length /* data _ len = */ pStream . readShort ( ) ; // Get old font ID , ignored pStream . readUnsignedShort ( ) ; // Get font name and set the new font if we have one String fontName = PICTUtil . readPascalString ( pStream ) ; context . setTextFont ( fontName ) ; if ( DEBUG ) { System . out . println ( "fontName: \"" + fontName + "\"" ) ; } break ; case PICT . OP_LINE_JUSTIFY : // TODO // Get data byte [ ] lineJustifyData = new byte [ 10 ] ; pStream . readFully ( lineJustifyData , 0 , lineJustifyData . length ) ; if ( DEBUG ) { System . out . println ( "opLineJustify" ) ; } break ; case PICT . OP_GLYPH_STATE : // TODO : NOT SUPPORTED IN AWT GRAPHICS YET ? // Get data byte [ ] glyphState = new byte [ 6 ] ; pStream . readFully ( glyphState , 0 , glyphState . length ) ; if ( DEBUG ) { System . out . println ( "glyphState: " + Arrays . toString ( glyphState ) ) ; } break ; case 0x2F : dataLength = pStream . readUnsignedShort ( ) ; pStream . readFully ( new byte [ dataLength ] , 0 , dataLength ) ; if ( DEBUG ) { System . out . println ( String . format ( "%s: 0x%04x" , PICT . APPLE_USE_RESERVED_FIELD , opCode ) ) ; } break ; // Rect treatments case PICT . OP_FRAME_RECT : // OK case PICT . OP_PAINT_RECT : // OK case PICT . OP_ERASE_RECT : // OK , not tested case PICT . OP_INVERT_RECT : // OK , not tested case PICT . OP_FILL_RECT : // OK , not tested // Get the frame rectangle readRectangle ( pStream , lastRectangle ) ; case PICT . OP_FRAME_SAME_RECT : // OK , not tested case PICT . OP_PAINT_SAME_RECT : // OK , not tested case PICT . OP_ERASE_SAME_RECT : // OK , not tested case PICT . OP_INVERT_SAME_RECT : // OK , not tested case PICT . OP_FILL_SAME_RECT : // OK , not tested // Draw switch ( opCode ) { case PICT . OP_FRAME_RECT : case PICT . OP_FRAME_SAME_RECT : context . frameRect ( lastRectangle ) ; break ; case PICT . OP_PAINT_RECT : case PICT . OP_PAINT_SAME_RECT : context . paintRect ( lastRectangle ) ; break ; case PICT . OP_ERASE_RECT : case PICT . OP_ERASE_SAME_RECT : context . eraseRect ( lastRectangle ) ; break ; case PICT . OP_INVERT_RECT : case PICT . OP_INVERT_SAME_RECT : context . invertRect ( lastRectangle ) ; break ; case PICT . OP_FILL_RECT : case PICT . OP_FILL_SAME_RECT : context . fillRect ( lastRectangle , fill ) ; break ; } // Do verbose mode output if ( DEBUG ) { switch ( opCode ) { case PICT . OP_FRAME_RECT : System . out . println ( "frameRect: " + lastRectangle ) ; break ; case PICT . OP_PAINT_RECT : System . out . println ( "paintRect: " + lastRectangle ) ; break ; case PICT . OP_ERASE_RECT : System . out . println ( "eraseRect: " + lastRectangle ) ; break ; case PICT . OP_INVERT_RECT : System . out . println ( "invertRect: " + lastRectangle ) ; break ; case PICT . OP_FILL_RECT : System . out . println ( "fillRect: " + lastRectangle ) ; break ; case PICT . OP_FRAME_SAME_RECT : System . out . println ( "frameSameRect: " + lastRectangle ) ; break ; case PICT . OP_PAINT_SAME_RECT : System . out . println ( "paintSameRect: " + lastRectangle ) ; break ; case PICT . OP_ERASE_SAME_RECT : System . out . println ( "eraseSameRect: " + lastRectangle ) ; break ; case PICT . OP_INVERT_SAME_RECT : System . out . println ( "invertSameRect: " + lastRectangle ) ; break ; case PICT . OP_FILL_SAME_RECT : System . out . println ( "fillSameRect: " + lastRectangle ) ; break ; } } // Rect treatments finished break ; case 0x003d : case 0x003e : case 0x003f : if ( DEBUG ) { System . out . println ( String . format ( "%s: 0x%04x" , PICT . APPLE_USE_RESERVED_FIELD , opCode ) ) ; } break ; // Round Rect treatments case PICT . OP_FRAME_R_RECT : // OK case PICT . OP_PAINT_R_RECT : // OK , not tested case PICT . OP_ERASE_R_RECT : // OK , not tested case PICT . OP_INVERT_R_RECT : // OK , not tested case PICT . OP_FILL_R_RECT : // OK , not tested // Get the frame rectangle readRectangle ( pStream , lastRectangle ) ; case PICT . OP_FRAME_SAME_R_RECT : // OK , not tested case PICT . OP_PAINT_SAME_R_RECT : // OK , not tested case PICT . OP_ERASE_SAME_R_RECT : // OK , not tested case PICT . OP_INVERT_SAME_R_RECT : // OK , not tested case PICT . OP_FILL_SAME_R_RECT : // OK , not tested // Draw switch ( opCode ) { case PICT . OP_FRAME_R_RECT : case PICT . OP_FRAME_SAME_R_RECT : context . frameRoundRect ( lastRectangle , ovSize . x , ovSize . y ) ; break ; case PICT . OP_PAINT_R_RECT : case PICT . OP_PAINT_SAME_R_RECT : context . paintRoundRect ( lastRectangle , ovSize . x , ovSize . y ) ; break ; case PICT . OP_ERASE_R_RECT : case PICT . OP_ERASE_SAME_R_RECT : context . eraseRoundRect ( lastRectangle , ovSize . x , ovSize . y ) ; break ; case PICT . OP_INVERT_R_RECT : case PICT . OP_INVERT_SAME_R_RECT : context . invertRoundRect ( lastRectangle , ovSize . x , ovSize . y ) ; break ; case PICT . OP_FILL_R_RECT : case PICT . OP_FILL_SAME_R_RECT : context . fillRoundRect ( lastRectangle , ovSize . x , ovSize . y , fill ) ; break ; } // Do verbose mode output if ( DEBUG ) { switch ( opCode ) { case PICT . OP_FRAME_R_RECT : System . out . println ( "frameRRect: " + lastRectangle ) ; break ; case PICT . OP_PAINT_R_RECT : System . out . println ( "paintRRect: " + lastRectangle ) ; break ; case PICT . OP_ERASE_R_RECT : System . out . println ( "eraseRRect: " + lastRectangle ) ; break ; case PICT . OP_INVERT_R_RECT : System . out . println ( "invertRRect: " + lastRectangle ) ; break ; case PICT . OP_FILL_R_RECT : System . out . println ( "fillRRect: " + lastRectangle ) ; break ; case PICT . OP_FRAME_SAME_R_RECT : System . out . println ( "frameSameRRect: " + lastRectangle ) ; break ; case PICT . OP_PAINT_SAME_R_RECT : System . out . println ( "paintSameRRect: " + lastRectangle ) ; break ; case PICT . OP_ERASE_SAME_R_RECT : System . out . println ( "eraseSameRRect: " + lastRectangle ) ; break ; case PICT . OP_INVERT_SAME_R_RECT : System . out . println ( "invertSameRRect: " + lastRectangle ) ; break ; case PICT . OP_FILL_SAME_R_RECT : System . out . println ( "fillSameRRect: " + lastRectangle ) ; break ; } } // RoundRect treatments finished break ; // Oval treatments case PICT . OP_FRAME_OVAL : // OK case PICT . OP_PAINT_OVAL : // OK , not tested case PICT . OP_ERASE_OVAL : // OK , not tested case PICT . OP_INVERT_OVAL : // OK , not tested case PICT . OP_FILL_OVAL : // OK , not tested // Get the frame rectangle readRectangle ( pStream , lastRectangle ) ; case PICT . OP_FRAME_SAME_OVAL : // OK , not tested case PICT . OP_PAINT_SAME_OVAL : // OK , not tested case PICT . OP_ERASE_SAME_OVAL : // OK , not tested case PICT . OP_INVERT_SAME_OVAL : // OK , not tested case PICT . OP_FILL_SAME_OVAL : // OK , not tested // Draw switch ( opCode ) { case PICT . OP_FRAME_OVAL : case PICT . OP_FRAME_SAME_OVAL : context . frameOval ( lastRectangle ) ; break ; case PICT . OP_PAINT_OVAL : case PICT . OP_PAINT_SAME_OVAL : context . paintOval ( lastRectangle ) ; break ; case PICT . OP_ERASE_OVAL : case PICT . OP_ERASE_SAME_OVAL : context . eraseOval ( lastRectangle ) ; break ; case PICT . OP_INVERT_OVAL : case PICT . OP_INVERT_SAME_OVAL : context . invertOval ( lastRectangle ) ; break ; case PICT . OP_FILL_OVAL : case PICT . OP_FILL_SAME_OVAL : context . fillOval ( lastRectangle , fill ) ; break ; } // Do verbose mode output if ( DEBUG ) { switch ( opCode ) { case PICT . OP_FRAME_OVAL : System . out . println ( "frameOval: " + lastRectangle ) ; break ; case PICT . OP_PAINT_OVAL : System . out . println ( "paintOval: " + lastRectangle ) ; break ; case PICT . OP_ERASE_OVAL : System . out . println ( "eraseOval: " + lastRectangle ) ; break ; case PICT . OP_INVERT_OVAL : System . out . println ( "invertOval: " + lastRectangle ) ; break ; case PICT . OP_FILL_OVAL : System . out . println ( "fillOval: " + lastRectangle ) ; break ; case PICT . OP_FRAME_SAME_OVAL : System . out . println ( "frameSameOval: " + lastRectangle ) ; break ; case PICT . OP_PAINT_SAME_OVAL : System . out . println ( "paintSameOval: " + lastRectangle ) ; break ; case PICT . OP_ERASE_SAME_OVAL : System . out . println ( "eraseSameOval: " + lastRectangle ) ; break ; case PICT . OP_INVERT_SAME_OVAL : System . out . println ( "invertSameOval: " + lastRectangle ) ; break ; case PICT . OP_FILL_SAME_OVAL : System . out . println ( "fillSameOval: " + lastRectangle ) ; break ; } } // Oval treatments finished break ; case 0x35 : case 0x36 : case 0x37 : case 0x45 : case 0x46 : case 0x47 : case 0x55 : case 0x56 : case 0x57 : pStream . readFully ( new byte [ 8 ] , 0 , 8 ) ; if ( DEBUG ) { System . out . println ( String . format ( "%s: 0x%04x" , PICT . APPLE_USE_RESERVED_FIELD , opCode ) ) ; } break ; // Arc treatments case PICT . OP_FRAME_ARC : // OK , not tested case PICT . OP_PAINT_ARC : // OK , not tested case PICT . OP_ERASE_ARC : // OK , not tested case PICT . OP_INVERT_ARC : // OK , not tested case PICT . OP_FILL_ARC : // OK , not tested // Get the frame rectangle readRectangle ( pStream , lastRectangle ) ; case PICT . OP_FRAME_SAME_ARC : // OK , not tested case PICT . OP_PAINT_SAME_ARC : // OK , not tested case PICT . OP_ERASE_SAME_ARC : // OK , not tested case PICT . OP_INVERT_SAME_ARC : // OK , not tested case PICT . OP_FILL_SAME_ARC : // OK , not tested // NOTE : These are inlcuded even if SAME // Get start and end angles // x = getXPtCoord ( pStream . readUnsignedShort ( ) ) ; // y = getYPtCoord ( pStream . readUnsignedShort ( ) ) ; x = pStream . readUnsignedShort ( ) ; y = pStream . readUnsignedShort ( ) ; arcAngles . setLocation ( x , y ) ; // Draw switch ( opCode ) { case PICT . OP_FRAME_ARC : case PICT . OP_FRAME_SAME_ARC : context . frameArc ( lastRectangle , arcAngles . x , arcAngles . y ) ; break ; case PICT . OP_PAINT_ARC : case PICT . OP_PAINT_SAME_ARC : context . paintArc ( lastRectangle , arcAngles . x , arcAngles . y ) ; break ; case PICT . OP_ERASE_ARC : case PICT . OP_ERASE_SAME_ARC : context . eraseArc ( lastRectangle , arcAngles . x , arcAngles . y ) ; break ; case PICT . OP_INVERT_ARC : case PICT . OP_INVERT_SAME_ARC : context . invertArc ( lastRectangle , arcAngles . x , arcAngles . y ) ; break ; case PICT . OP_FILL_ARC : case PICT . OP_FILL_SAME_ARC : context . fillArc ( lastRectangle , arcAngles . x , arcAngles . y , fill ) ; break ; } // Do verbose mode output if ( DEBUG ) { switch ( opCode ) { case PICT . OP_FRAME_ARC : System . out . println ( "frameArc: " + lastRectangle + ", angles:" + arcAngles ) ; break ; case PICT . OP_PAINT_ARC : System . out . println ( "paintArc: " + lastRectangle + ", angles:" + arcAngles ) ; break ; case PICT . OP_ERASE_ARC : System . out . println ( "eraseArc: " + lastRectangle + ", angles:" + arcAngles ) ; break ; case PICT . OP_INVERT_ARC : System . out . println ( "invertArc: " + lastRectangle + ", angles:" + arcAngles ) ; break ; case PICT . OP_FILL_ARC : System . out . println ( "fillArc: " + lastRectangle + ", angles:" + arcAngles ) ; break ; case PICT . OP_FRAME_SAME_ARC : System . out . println ( "frameSameArc: " + lastRectangle + ", angles:" + arcAngles ) ; break ; case PICT . OP_PAINT_SAME_ARC : System . out . println ( "paintSameArc: " + lastRectangle + ", angles:" + arcAngles ) ; break ; case PICT . OP_ERASE_SAME_ARC : System . out . println ( "eraseSameArc: " + lastRectangle + ", angles:" + arcAngles ) ; break ; case PICT . OP_INVERT_SAME_ARC : System . out . println ( "invertSameArc: " + lastRectangle + ", angles:" + arcAngles ) ; break ; case PICT . OP_FILL_SAME_ARC : System . out . println ( "fillSameArc: " + lastRectangle + ", angles:" + arcAngles ) ; break ; } } // Arc treatments finished break ; case 0x65 : case 0x66 : case 0x67 : pStream . readFully ( new byte [ 12 ] , 0 , 12 ) ; if ( DEBUG ) { System . out . println ( String . format ( "%s: 0x%04x" , PICT . APPLE_USE_RESERVED_FIELD , opCode ) ) ; } break ; case 0x6d : case 0x6e : case 0x6f : pStream . readFully ( new byte [ 4 ] , 0 , 4 ) ; if ( DEBUG ) { System . out . println ( String . format ( "%s: 0x%04x" , PICT . APPLE_USE_RESERVED_FIELD , opCode ) ) ; } break ; // Polygon treatments case PICT . OP_FRAME_POLY : // OK case PICT . OP_PAINT_POLY : // OK case PICT . OP_ERASE_POLY : // OK , not tested case PICT . OP_INVERT_POLY : // OK , not tested case PICT . OP_FILL_POLY : // OK , not tested // Read the polygon polygon = readPoly ( pStream , bounds ) ; case PICT . OP_FRAME_SAME_POLY : // OK , not tested case PICT . OP_PAINT_SAME_POLY : // OK , not tested case PICT . OP_ERASE_SAME_POLY : // OK , not tested case PICT . OP_INVERT_SAME_POLY : // OK , not tested case PICT . OP_FILL_SAME_POLY : // OK , not tested // Draw switch ( opCode ) { case PICT . OP_FRAME_POLY : case PICT . OP_FRAME_SAME_POLY : context . framePoly ( polygon ) ; break ; case PICT . OP_PAINT_POLY : case PICT . OP_PAINT_SAME_POLY : context . paintPoly ( polygon ) ; break ; case PICT . OP_ERASE_POLY : case PICT . OP_ERASE_SAME_POLY : context . erasePoly ( polygon ) ; break ; case PICT . OP_INVERT_POLY : case PICT . OP_INVERT_SAME_POLY : context . invertPoly ( polygon ) ; break ; case PICT . OP_FILL_POLY : case PICT . OP_FILL_SAME_POLY : context . fillPoly ( polygon , fill ) ; break ; } // Do verbose mode output if ( DEBUG ) { switch ( opCode ) { case PICT . OP_FRAME_POLY : verbosePolyCmd ( "framePoly" , bounds , polygon ) ; break ; case PICT . OP_PAINT_POLY : verbosePolyCmd ( "paintPoly" , bounds , polygon ) ; break ; case PICT . OP_ERASE_POLY : verbosePolyCmd ( "erasePoly" , bounds , polygon ) ; break ; case PICT . OP_INVERT_POLY : verbosePolyCmd ( "invertPoly" , bounds , polygon ) ; break ; case PICT . OP_FILL_POLY : verbosePolyCmd ( "fillPoly" , bounds , polygon ) ; break ; case PICT . OP_FRAME_SAME_POLY : verbosePolyCmd ( "frameSamePoly" , bounds , polygon ) ; break ; case PICT . OP_PAINT_SAME_POLY : verbosePolyCmd ( "paintSamePoly" , bounds , polygon ) ; break ; case PICT . OP_ERASE_SAME_POLY : verbosePolyCmd ( "eraseSamePoly" , bounds , polygon ) ; break ; case PICT . OP_INVERT_SAME_POLY : verbosePolyCmd ( "invertSamePoly" , bounds , polygon ) ; break ; case PICT . OP_FILL_SAME_POLY : verbosePolyCmd ( "fillSamePoly" , bounds , polygon ) ; break ; } } // Polygon treatments finished break ; case 0x7d : case 0x7e : case 0x7f : if ( DEBUG ) { System . out . println ( String . format ( "%s: 0x%04x" , PICT . APPLE_USE_RESERVED_FIELD , opCode ) ) ; } break ; case 0x75 : case 0x76 : case 0x77 : // Read the polygon polygon = readPoly ( pStream , bounds ) ; if ( DEBUG ) { System . out . println ( String . format ( "%s: 0x%04x" , PICT . APPLE_USE_RESERVED_FIELD , opCode ) ) ; } break ; // Region treatments case PICT . OP_FRAME_RGN : // OK , not tested case PICT . OP_PAINT_RGN : // OK , not tested case PICT . OP_ERASE_RGN : // OK , not tested case PICT . OP_INVERT_RGN : // OK , not tested case PICT . OP_FILL_RGN : // OK , not tested // Read the region region = readRegion ( pStream , bounds ) ; case PICT . OP_FRAME_SAME_RGN : // OK , not tested case PICT . OP_PAINT_SAME_RGN : // OK , not tested case PICT . OP_ERASE_SAME_RGN : // OK , not tested case PICT . OP_INVERT_SAME_RGN : // OK , not tested case PICT . OP_FILL_SAME_RGN : // OK , not tested // Draw if ( region != null && ! region . getBounds ( ) . isEmpty ( ) ) { switch ( opCode ) { case PICT . OP_FRAME_RGN : case PICT . OP_FRAME_SAME_RGN : context . frameRegion ( region ) ; break ; case PICT . OP_PAINT_RGN : case PICT . OP_PAINT_SAME_RGN : context . paintRegion ( region ) ; break ; case PICT . OP_ERASE_RGN : case PICT . OP_ERASE_SAME_RGN : context . eraseRegion ( region ) ; break ; case PICT . OP_INVERT_RGN : case PICT . OP_INVERT_SAME_RGN : context . invertRegion ( region ) ; break ; case PICT . OP_FILL_RGN : case PICT . OP_FILL_SAME_RGN : context . fillRegion ( region , fill ) ; break ; } } // Do verbose mode output if ( DEBUG ) { switch ( opCode ) { case PICT . OP_FRAME_RGN : verboseRegionCmd ( "frameRgn" , bounds , region ) ; break ; case PICT . OP_PAINT_RGN : verboseRegionCmd ( "paintRgn" , bounds , region ) ; break ; case PICT . OP_ERASE_RGN : verboseRegionCmd ( "eraseRgn" , bounds , region ) ; break ; case PICT . OP_INVERT_RGN : verboseRegionCmd ( "invertRgn" , bounds , region ) ; break ; case PICT . OP_FILL_RGN : verboseRegionCmd ( "fillRgn" , bounds , region ) ; break ; case PICT . OP_FRAME_SAME_RGN : verboseRegionCmd ( "frameSameRgn" , bounds , region ) ; break ; case PICT . OP_PAINT_SAME_RGN : verboseRegionCmd ( "paintSameRgn" , bounds , region ) ; break ; case PICT . OP_ERASE_SAME_RGN : verboseRegionCmd ( "eraseSameRgn" , bounds , region ) ; break ; case PICT . OP_INVERT_SAME_RGN : verboseRegionCmd ( "invertSameRgn" , bounds , region ) ; break ; case PICT . OP_FILL_SAME_RGN : verboseRegionCmd ( "fillSameRgn" , bounds , region ) ; break ; } } // Region treatments finished break ; case 0x85 : case 0x86 : case 0x87 : // Read the region region = readRegion ( pStream , bounds ) ; if ( DEBUG ) { System . out . println ( String . format ( "%s: 0x%04x" , PICT . APPLE_USE_RESERVED_FIELD , opCode ) ) ; } break ; case PICT . OP_BITS_RECT : // [4 ] Four opcodes ( $ 0090 , $ 0091 , $ 0098 , $ 0099 ) are modifications of version 1 opcodes . // The first word following the opcode is rowBytes . If the high bit of rowBytes is set , // then it is a pixel map containing multiple bits per pixel ; if it is not set , it is a // bitmap containing 1 bit per pixel . // In general , the difference between version 2 and version 1 formats is that the pixel // map replaces the bitmap , a color table has been added , and pixData replaces bitData . // [5 ] For opcodes $ 0090 ( BitsRect ) and $ 0091 ( BitsRgn ) , the data is unpacked . These // opcodes can be used only when rowBytes is less than 8. readOpBits ( pStream , false ) ; break ; case PICT . OP_BITS_RGN : readOpBits ( pStream , true ) ; break ; case 0x92 : case 0x93 : case 0x94 : case 0x95 : case 0x96 : case 0x97 : dataLength = pStream . readUnsignedShort ( ) ; pStream . readFully ( new byte [ dataLength ] , 0 , dataLength ) ; if ( DEBUG ) { System . out . println ( String . format ( "%s: 0x%04x - length: %d" , PICT . APPLE_USE_RESERVED_FIELD , opCode , dataLength ) ) ; } break ; case PICT . OP_PACK_BITS_RECT : readOpPackBits ( pStream , false , pixmapCount ++ ) ; break ; case PICT . OP_PACK_BITS_RGN : readOpPackBits ( pStream , true , pixmapCount ++ ) ; break ; case PICT . OP_DIRECT_BITS_RECT : readOpDirectBits ( pStream , false , pixmapCount ++ ) ; break ; case PICT . OP_DIRECT_BITS_RGN : readOpDirectBits ( pStream , true , pixmapCount ++ ) ; break ; case 0x9C : case 0x9D : case 0x9E : case 0x9F : // TODO : Move to special Apple Reserved handling ? dataLength = pStream . readUnsignedShort ( ) ; pStream . readFully ( new byte [ dataLength ] , 0 , dataLength ) ; if ( DEBUG ) { System . out . println ( String . format ( "%s: 0x%04x" , PICT . APPLE_USE_RESERVED_FIELD , opCode ) ) ; } break ; case PICT . OP_SHORT_COMMENT : // NOTHING TO DO , JUST JUMP OVER byte [ ] shortComment = new byte [ 2 ] ; pStream . readFully ( shortComment , 0 , 2 ) ; if ( DEBUG ) { System . out . println ( "Short comment: " + Arrays . toString ( shortComment ) ) ; } break ; case PICT . OP_LONG_COMMENT : // NOTHING TO DO , JUST JUMP OVER /* byte [ ] longComment = */ readLongComment ( pStream ) ; // TODO : Don ' t just skip . . . // https : / / developer . apple . com / legacy / library / documentation / mac / pdf / Imaging _ With _ QuickDraw / Appendix _ B . pdf // Long comments can be used for PhotoShop IRBs ( kind 498 ) or ICC profiles ( 224 ) and other meta data . . . // if ( DEBUG ) { // System . out . println ( " Long comment : " + Arrays . toString ( longComment ) ) ; break ; case PICT . OP_END_OF_PICTURE : // OK break ; case PICT . OP_COMPRESSED_QUICKTIME : // $ 8200 : CompressedQuickTime Data length ( Long ) , data ( private to QuickTime ) 4 + data length readCompressedQT ( pStream ) ; break ; case PICT . OP_UNCOMPRESSED_QUICKTIME : // JUST JUMP OVER // $ 8201 : UncompressedQuickTime Data length ( Long ) , data ( private to QuickTime ) 4 + data length // TODO : Read this as well , need test data dataLength = pStream . readInt ( ) ; if ( DEBUG ) { System . out . println ( String . format ( "unCompressedQuickTime, length %d" , dataLength ) ) ; } pStream . readFully ( new byte [ dataLength ] , 0 , dataLength ) ; break ; default : // See : http : / / developer . apple . com / DOCUMENTATION / mac / QuickDraw / QuickDraw - 461 . html if ( opCode >= 0x00a2 && opCode <= 0x00af ) { dataLength = pStream . readUnsignedShort ( ) ; } else if ( opCode >= 0x00b0 && opCode <= 0x00cf ) { // Zero - length dataLength = 0 ; } else if ( opCode >= 0x00d0 && opCode <= 0x00fe ) { dataLength = pStream . readInt ( ) ; } else if ( opCode >= 0x0100 && opCode <= 0x7fff ) { // For opcodes $ 0100 - $ 7FFF , the amount of data for // opcode $ nnXX = 2 times nn bytes . dataLength = ( opCode & 0xff00 ) >> 7 ; } else if ( opCode >= 0x8000 && opCode <= 0x80ff ) { // Zero - length dataLength = 0 ; } else if ( opCode >= 0x8100 && opCode <= 0x81ff ) { dataLength = pStream . readInt ( ) ; } else if ( opCode == 0xffff ) { dataLength = pStream . readInt ( ) ; } else { throw new IIOException ( String . format ( "Found unknown opcode: 0x%04x" , opCode ) ) ; } if ( DEBUG ) { System . out . println ( String . format ( "%s: 0x%04x - length: %s" , PICT . APPLE_USE_RESERVED_FIELD , opCode , dataLength ) ) ; } if ( dataLength != 0 ) { pStream . readFully ( new byte [ dataLength ] , 0 , dataLength ) ; } } } while ( opCode != PICT . OP_END_OF_PICTURE ) ; } catch ( IIOException e ) { throw e ; } catch ( EOFException e ) { String pos ; try { pos = String . format ( "position %d" , imageInput . getStreamPosition ( ) ) ; } catch ( IOException ignore ) { pos = "unknown position" ; } throw new IIOException ( String . format ( "Error in PICT format: Unexpected end of File at %s" , pos ) , e ) ; } catch ( IOException e ) { throw new IIOException ( String . format ( "Error in PICT format: %s" , e . getMessage ( ) ) , e ) ; }
public class ECKey { /** * Returns public key bytes from the given private key . To convert a byte array * into a BigInteger , use < tt > * new BigInteger ( 1 , bytes ) ; < / tt > * @ param privKey * @ param compressed * @ return - */ public static byte [ ] publicKeyFromPrivate ( BigInteger privKey , boolean compressed ) { } }
ECPoint point = CURVE . getG ( ) . multiply ( privKey ) ; return point . getEncoded ( compressed ) ;
public class AbstractDistributedProgramRunner { /** * Adds a listener to the given TwillController to delete local temp files when the program has started / terminated . * The local temp files could be removed once the program is started , since Twill would keep the files in * HDFS and no long needs the local temp files once program is started . * @ return The same TwillController instance . */ private TwillController addCleanupListener ( TwillController controller , final File hConfFile , final File cConfFile , final Program program , final File programDir ) { } }
final AtomicBoolean deleted = new AtomicBoolean ( false ) ; controller . addListener ( new ServiceListenerAdapter ( ) { @ Override public void running ( ) { cleanup ( ) ; } @ Override public void terminated ( Service . State from ) { cleanup ( ) ; } @ Override public void failed ( Service . State from , Throwable failure ) { cleanup ( ) ; } private void cleanup ( ) { if ( deleted . compareAndSet ( false , true ) ) { LOG . debug ( "Cleanup tmp files for {}: {} {} {}" , program . getName ( ) , hConfFile , cConfFile , program . getJarLocation ( ) . toURI ( ) ) ; hConfFile . delete ( ) ; cConfFile . delete ( ) ; try { program . getJarLocation ( ) . delete ( ) ; } catch ( IOException e ) { LOG . warn ( "Failed to delete program jar {}" , program . getJarLocation ( ) . toURI ( ) , e ) ; } try { FileUtils . deleteDirectory ( programDir ) ; } catch ( IOException e ) { LOG . warn ( "Failed to delete program directory {}" , programDir , e ) ; } } } } , Threads . SAME_THREAD_EXECUTOR ) ; return controller ;
public class NfsFileOutputStream { /** * ( non - Javadoc ) * @ see java . io . OutputStream # close ( ) */ public void close ( ) throws IOException { } }
if ( ! _closed ) { try { flush ( ) ; } catch ( Throwable t ) { LOG . debug ( t . getMessage ( ) , t ) ; } _closed = true ; super . close ( ) ; }
public class CmsToolBar { /** * Creates a drop down menu . < p > * @ param icon the button icon * @ param content the drop down content * @ param title the drop down title * @ return the component */ public static Component createDropDown ( FontIcon icon , Component content , String title ) { } }
return createDropDown ( getDropDownButtonHtml ( icon ) , content , title ) ;
public class Iterators { /** * Takes one of the first n items of the iterator , returning that item an a new Iterator which excludes that item . * Remove operation is not supported on the first n items of the returned iterator . For the remaining items , * remove delegates to the original Iterator . * Useful to obtain somewhat random selection with bounded performance risk when iterator may contain a large number of items . * @ param iterator the underlying iterator * @ param n the number of items . * @ return Pair of selected item ( or null if iterator was empty or n & lt ; = 0 ) and new Iterator over the remaining items . */ public static < T > Pair < T , IterableIterator < T > > takeOneFromTopN ( Iterator < T > iterator , int n ) { } }
if ( ! iterator . hasNext ( ) || n < 1 ) { return new Pair < T , IterableIterator < T > > ( null , iterable ( iterator ) ) ; } List < T > firstN = new ArrayList < > ( n ) ; int i = 0 ; while ( i < n && iterator . hasNext ( ) ) { firstN . add ( iterator . next ( ) ) ; i ++ ; } return new Pair < > ( firstN . remove ( ThreadLocalRandom . current ( ) . nextInt ( 0 , firstN . size ( ) ) ) , iterable ( com . google . common . collect . Iterators . concat ( com . google . common . collect . Iterators . unmodifiableIterator ( firstN . iterator ( ) ) , iterator ) ) ) ;
public class POICellFormatter { /** * セルの値をフォーマットする 。 * @ param cell フォーマット対象のセル * @ param locale ロケール * @ return フォーマットした結果 */ private CellFormatResult getCellValue ( final Cell cell , final Locale locale ) { } }
return getCellValue ( new POICell ( cell ) , locale ) ;
public class FileExecutor { /** * 解析JSON * @ param url { @ link URL } * @ return { @ link JSONArray } * @ throws IOException 异常 * @ since 1.1.0 */ public static JSONArray parseJsonArray ( URL url ) throws IOException { } }
String path = url . toString ( ) ; if ( path . startsWith ( ValueConsts . LOCAL_FILE_URL ) ) { return parseJsonArray ( NetUtils . urlToString ( url ) ) ; } else { return JSONArray . parseArray ( read ( url ) ) ; }
public class ApiOvhIpLoadbalancing { /** * Get this object properties * REST : GET / ipLoadbalancing / { serviceName } / http / farm / { farmId } * @ param serviceName [ required ] The internal name of your IP load balancing * @ param farmId [ required ] Id of your farm */ public OvhBackendHttp serviceName_http_farm_farmId_GET ( String serviceName , Long farmId ) throws IOException { } }
String qPath = "/ipLoadbalancing/{serviceName}/http/farm/{farmId}" ; StringBuilder sb = path ( qPath , serviceName , farmId ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhBackendHttp . class ) ;
public class BigtableInstanceAdminClient { /** * Asynchronously get the app profile by id . * < p > Sample code : * < pre > { @ code * ApiFuture < AppProfile > appProfileFuture = client . getAppProfileAsync ( " my - instance " , " my - app - profile " ) ; * AppProfile appProfile = appProfileFuture . get ( ) ; * } < / pre > * @ see AppProfile */ @ SuppressWarnings ( "WeakerAccess" ) public ApiFuture < AppProfile > getAppProfileAsync ( String instanceId , String appProfileId ) { } }
String name = NameUtil . formatAppProfileName ( projectId , instanceId , appProfileId ) ; GetAppProfileRequest request = GetAppProfileRequest . newBuilder ( ) . setName ( name . toString ( ) ) . build ( ) ; return ApiFutures . transform ( stub . getAppProfileCallable ( ) . futureCall ( request ) , new ApiFunction < com . google . bigtable . admin . v2 . AppProfile , AppProfile > ( ) { @ Override public AppProfile apply ( com . google . bigtable . admin . v2 . AppProfile proto ) { return AppProfile . fromProto ( proto ) ; } } , MoreExecutors . directExecutor ( ) ) ;
public class NetworkUtils { /** * Returns all global scope addresses for interfaces that are up . */ static InetAddress [ ] getGlobalInterfaces ( ) throws SocketException { } }
List < InetAddress > list = new ArrayList < InetAddress > ( ) ; for ( NetworkInterface intf : getInterfaces ( ) ) { if ( intf . isUp ( ) ) { for ( InetAddress address : Collections . list ( intf . getInetAddresses ( ) ) ) { if ( address . isLoopbackAddress ( ) == false && address . isSiteLocalAddress ( ) == false && address . isLinkLocalAddress ( ) == false ) { list . add ( address ) ; } } } } return list . toArray ( new InetAddress [ list . size ( ) ] ) ;
public class RegexpParser { /** * Detects the package name for the specified warning . * @ param warning the warning */ private void detectPackageName ( final Warning warning ) { } }
if ( ! warning . hasPackageName ( ) ) { warning . setPackageName ( PackageDetectors . detectPackageName ( warning . getFileName ( ) ) ) ; }
public class VariantUtils { /** * Returns the variant keys * @ param variantKeyPrefix * the variant key prefix * @ param variants * The variants */ private static List < String > getVariantKeys ( String variantKeyPrefix , Collection < String > variants ) { } }
List < String > variantKeys = new ArrayList < > ( ) ; for ( String variant : variants ) { if ( variant == null ) { variant = "" ; } if ( variantKeyPrefix == null ) { variantKeys . add ( variant ) ; } else { variantKeys . add ( variantKeyPrefix + variant ) ; } } return variantKeys ;
public class Rule { /** * If this rule is a CSS rule ( not a mixin declaration ) and if an guard exists if it true . * @ param formatter the CCS target * @ return true , if a CSS rule */ private boolean isValidCSS ( CssFormatter formatter ) { } }
if ( params == null ) { if ( guard != null ) { // CSS Guards // guard = ValueExpression . eval ( formatter , guard ) ; return guard . booleanValue ( formatter ) ; } return true ; } return false ;
public class MfpDiagnostics { /** * Also write out what sort of message we think we have ( first ) . */ private void dumpJmfMessage ( IncidentStream is , JMFMessage jmfMsg , Object msg ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "dumpJmfMessage" ) ; if ( msg != null ) { is . writeLine ( "Message is of class: " , msg . getClass ( ) . getName ( ) ) ; } if ( jmfMsg != null ) { try { String buffer = JSFormatter . format ( jmfMsg ) ; is . writeLine ( "JMF message" , buffer ) ; } catch ( Exception e ) { // No FFDC code needed - we are FFDCing ! if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "dumpJmfMessage failed: " + e ) ; } } else is . writeLine ( "No JMF message available" , "" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "dumpJmfMessage" ) ;
public class SelectAlgorithmAndInputPanel { /** * Adds a new component into the toolbar . * @ param comp The component being added */ public void addToToolbar ( JComponent comp ) { } }
toolbar . add ( comp , 1 + algBoxes . length ) ; toolbar . revalidate ( ) ; addedComponents . add ( comp ) ;
public class CopySnapshotRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CopySnapshotRequest copySnapshotRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( copySnapshotRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( copySnapshotRequest . getSourceSnapshotName ( ) , SOURCESNAPSHOTNAME_BINDING ) ; protocolMarshaller . marshall ( copySnapshotRequest . getTargetSnapshotName ( ) , TARGETSNAPSHOTNAME_BINDING ) ; protocolMarshaller . marshall ( copySnapshotRequest . getSourceRegion ( ) , SOURCEREGION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CmsResourceFilter { /** * Returns an extended filter to guarantee a distinct resource state of the filtered resources . < p > * @ param state the required resource state * @ return a filter requiring the given resource state */ public CmsResourceFilter addRequireState ( CmsResourceState state ) { } }
CmsResourceFilter extendedFilter = ( CmsResourceFilter ) clone ( ) ; extendedFilter . m_state = state ; extendedFilter . m_filterState = REQUIRED ; extendedFilter . updateCacheId ( ) ; return extendedFilter ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link ImageCRSType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link ImageCRSType } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "ImageCRS" , substitutionHeadNamespace = "http://www.opengis.net/gml" , substitutionHeadName = "_CoordinateReferenceSystem" ) public JAXBElement < ImageCRSType > createImageCRS ( ImageCRSType value ) { } }
return new JAXBElement < ImageCRSType > ( _ImageCRS_QNAME , ImageCRSType . class , null , value ) ;
public class WTable { /** * Handles a request containing sort instruction data . * @ param request the request containing sort instruction data . */ private void handleSortRequest ( final Request request ) { } }
String sortColStr = request . getParameter ( getId ( ) + ".sort" ) ; String sortDescStr = request . getParameter ( getId ( ) + ".sortDesc" ) ; if ( sortColStr != null ) { if ( "" . equals ( sortColStr ) ) { // Reset sort setSort ( - 1 , false ) ; getOrCreateComponentModel ( ) . rowIndexMapping = null ; } else { try { int sortCol = Integer . parseInt ( sortColStr ) ; // Allow for column order int [ ] cols = getColumnOrder ( ) ; if ( cols != null ) { sortCol = cols [ sortCol ] ; } boolean sortAsc = ! "true" . equalsIgnoreCase ( sortDescStr ) ; // Only process the sort request if it differs from the current sort order if ( sortCol != getSortColumnIndex ( ) || sortAsc != isSortAscending ( ) ) { sort ( sortCol , sortAsc ) ; setFocussed ( ) ; } } catch ( NumberFormatException e ) { LOG . warn ( "Invalid sort column: " + sortColStr ) ; } } }
public class ActionButton { /** * Sets the measured dimension for the entire view * @ param widthMeasureSpec horizontal space requirements as imposed by the parent . * The requirements are encoded with * { @ link android . view . View . MeasureSpec } * @ param heightMeasureSpec vertical space requirements as imposed by the parent . * The requirements are encoded with * { @ link android . view . View . MeasureSpec } */ @ Override protected void onMeasure ( int widthMeasureSpec , int heightMeasureSpec ) { } }
super . onMeasure ( widthMeasureSpec , heightMeasureSpec ) ; LOGGER . trace ( "Called Action Button onMeasure" ) ; setMeasuredDimension ( calculateMeasuredWidth ( ) , calculateMeasuredHeight ( ) ) ; LOGGER . trace ( "Measured the Action Button size: height = {}, width = {}" , getHeight ( ) , getWidth ( ) ) ;
public class UpdateAssessmentTargetRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateAssessmentTargetRequest updateAssessmentTargetRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateAssessmentTargetRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateAssessmentTargetRequest . getAssessmentTargetArn ( ) , ASSESSMENTTARGETARN_BINDING ) ; protocolMarshaller . marshall ( updateAssessmentTargetRequest . getAssessmentTargetName ( ) , ASSESSMENTTARGETNAME_BINDING ) ; protocolMarshaller . marshall ( updateAssessmentTargetRequest . getResourceGroupArn ( ) , RESOURCEGROUPARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DefaultConfigMethod { /** * Matches a test method name against this configuration method . * @ param method test method name ( cannot be null or empty ) * @ return true if the test method name matches the configuration method , false otherwise * @ throws IllegalArgumentException - If method name is null or empty */ public boolean matches ( final Method method ) { } }
validateNotNull ( method , "Method" ) ; final RequiresConfiguration requiresConfigAnnotation = method . getAnnotation ( RequiresConfiguration . class ) ; final String [ ] requiredConfigs ; if ( requiresConfigAnnotation != null ) { requiredConfigs = requiresConfigAnnotation . value ( ) ; } else { requiredConfigs = new String [ ] { ".*" } ; } for ( String requiredConfig : requiredConfigs ) { if ( m_method . getName ( ) . matches ( requiredConfig ) ) { return true ; } } return false ;
public class SQLUtils { /** * Query for values up to the limit * @ param connection * connection * @ param sql * sql statement * @ param args * arguments * @ param dataTypes * column data types * @ param limit * result row limit * @ return results * @ since 3.1.0 */ public static List < List < Object > > queryResults ( Connection connection , String sql , String [ ] args , GeoPackageDataType [ ] dataTypes , Integer limit ) { } }
ResultSetResult result = wrapQuery ( connection , sql , args ) ; List < List < Object > > results = ResultUtils . buildResults ( result , dataTypes , limit ) ; return results ;
public class PEP { /** * Outputs an access denied message . * @ param out * the output stream to send the message to * @ param message * the message to send */ private void denyAccess ( HttpServletResponse response , String message ) throws IOException { } }
StringBuilder sb = new StringBuilder ( ) ; sb . append ( "Fedora: 403 " ) . append ( message . toUpperCase ( ) ) ; response . reset ( ) ; response . setStatus ( HttpServletResponse . SC_FORBIDDEN ) ; response . setContentType ( "text/plain" ) ; response . setContentLength ( sb . length ( ) ) ; ServletOutputStream out = response . getOutputStream ( ) ; out . write ( sb . toString ( ) . getBytes ( ) ) ; out . flush ( ) ; out . close ( ) ;
public class JSONImplFactory { /** * / * package */ static GeoLocation createGeoLocation ( JSONObject json ) throws TwitterException { } }
try { if ( ! json . isNull ( "coordinates" ) ) { String coordinates = json . getJSONObject ( "coordinates" ) . getString ( "coordinates" ) ; coordinates = coordinates . substring ( 1 , coordinates . length ( ) - 1 ) ; String [ ] point = coordinates . split ( "," ) ; return new GeoLocation ( Double . parseDouble ( point [ 1 ] ) , Double . parseDouble ( point [ 0 ] ) ) ; } } catch ( JSONException jsone ) { throw new TwitterException ( jsone ) ; } return null ;
public class AgiOperations { /** * Returns the channel to operate on . * @ return the channel to operate on . * @ throws IllegalStateException if no { @ link AgiChannel } is bound to the * current channel and no channel has been passed to the * constructor . */ protected AgiChannel getChannel ( ) { } }
AgiChannel threadBoundChannel ; if ( channel != null ) { return channel ; } threadBoundChannel = AgiConnectionHandler . getChannel ( ) ; if ( threadBoundChannel == null ) { throw new IllegalStateException ( "Trying to send command from an invalid thread" ) ; } return threadBoundChannel ;
public class CommerceWarehouseItemUtil { /** * Returns a range of all the commerce warehouse items where CProductId = & # 63 ; and CPInstanceUuid = & # 63 ; . * Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CommerceWarehouseItemModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order . * @ param CProductId the c product ID * @ param CPInstanceUuid the cp instance uuid * @ param start the lower bound of the range of commerce warehouse items * @ param end the upper bound of the range of commerce warehouse items ( not inclusive ) * @ return the range of matching commerce warehouse items */ public static List < CommerceWarehouseItem > findByCPI_CPIU ( long CProductId , String CPInstanceUuid , int start , int end ) { } }
return getPersistence ( ) . findByCPI_CPIU ( CProductId , CPInstanceUuid , start , end ) ;
public class JobSummaryMarshaller { /** * Marshall the given parameter object . */ public void marshall ( JobSummary jobSummary , ProtocolMarshaller protocolMarshaller ) { } }
if ( jobSummary == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( jobSummary . getJobId ( ) , JOBID_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getJobName ( ) , JOBNAME_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getCreatedAt ( ) , CREATEDAT_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getStatusReason ( ) , STATUSREASON_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getStartedAt ( ) , STARTEDAT_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getStoppedAt ( ) , STOPPEDAT_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getContainer ( ) , CONTAINER_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getArrayProperties ( ) , ARRAYPROPERTIES_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getNodeProperties ( ) , NODEPROPERTIES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class WonderPushRestClient { /** * A POST request * @ param resource * The resource path , starting with / * @ param params * AsyncHttpClient request parameters * @ param responseHandler * An AsyncHttpClient response handler */ protected static void post ( String resource , RequestParams params , ResponseHandler responseHandler ) { } }
requestAuthenticated ( new Request ( WonderPushConfiguration . getUserId ( ) , HttpMethod . POST , resource , params , responseHandler ) ) ;
public class Db { /** * Execute sql update */ static int update ( Config config , Connection conn , String sql , Object ... paras ) throws SQLException { } }
return MAIN . update ( config , conn , sql , paras ) ;
public class Model { /** * Sets the track start value of the gauge to the given value * @ param TRACK _ START */ public void setTrackStart ( final double TRACK_START ) { } }
// check values if ( Double . compare ( TRACK_START , trackStop ) == 0 ) { throw new IllegalArgumentException ( "Track start value cannot equal track stop value" ) ; } trackStart = TRACK_START ; validate ( ) ; fireStateChanged ( ) ;
public class Ginv { /** * Divide the row from this column position by this value * @ param matrix * the matrix to modify * @ param aRow * the row to process * @ param fromCol * starting from column * @ param value * the value to divide */ public static void divideRowBy ( double [ ] [ ] matrix , int aRow , int fromCol , double value ) { } }
int cols = matrix [ 0 ] . length ; double [ ] r = matrix [ aRow ] ; for ( int col = fromCol ; col < cols ; col ++ ) { r [ col ] /= value ; }
public class BaseCellConverter { /** * セルの値をパースしセルの値をJavaオブジェクトに型変換するとに失敗したときの例外 { @ link TypeBindException } を作成します 。 * @ since 2.0 * @ param cell パースに失敗したセル * @ param cellValue パースに失敗した値 * @ return マッピングに失敗したときの例外のインスタンス */ public TypeBindException newTypeBindExceptionOnParse ( final Cell cell , final Object cellValue ) { } }
final String message = MessageBuilder . create ( "cell.typeBind.failParse" ) . var ( "property" , field . getNameWithClass ( ) ) . var ( "cellAddress" , POIUtils . formatCellAddress ( cell ) ) . var ( "cellValue" , cellValue . toString ( ) ) . varWithClass ( "type" , field . getType ( ) ) . format ( ) ; final TypeBindException bindException = new TypeBindException ( message , field . getType ( ) , cellValue ) ; return bindException ;
public class IfcPropertySetDefinitionImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) public EList < IfcRelDefinesByProperties > getPropertyDefinitionOf ( ) { } }
return ( EList < IfcRelDefinesByProperties > ) eGet ( Ifc2x3tc1Package . Literals . IFC_PROPERTY_SET_DEFINITION__PROPERTY_DEFINITION_OF , true ) ;
public class CmsUndeleteDialog { /** * Undeletes the selected files * @ return the ids of the modified resources * @ throws CmsException if something goes wrong */ protected List < CmsUUID > undelete ( ) throws CmsException { } }
List < CmsUUID > modifiedResources = new ArrayList < CmsUUID > ( ) ; CmsObject cms = m_context . getCms ( ) ; for ( CmsResource resource : m_context . getResources ( ) ) { CmsLockActionRecord actionRecord = null ; try { actionRecord = CmsLockUtil . ensureLock ( m_context . getCms ( ) , resource ) ; cms . undeleteResource ( cms . getSitePath ( resource ) , true ) ; modifiedResources . add ( resource . getStructureId ( ) ) ; } finally { if ( ( actionRecord != null ) && ( actionRecord . getChange ( ) == LockChange . locked ) ) { try { cms . unlockResource ( resource ) ; } catch ( CmsLockException e ) { LOG . warn ( e . getLocalizedMessage ( ) , e ) ; } } } } return modifiedResources ;
public class Engagement { /** * Assign engagements to the list of activities * @ param engagement _ ref Engagement reference * @ param params Parameters * @ throwsJSONException If error occurred * @ return { @ link JSONObject } */ public JSONObject assignToEngagement ( String engagement_ref , HashMap < String , String > params ) throws JSONException { } }
return oClient . put ( "/tasks/v2/tasks/contracts/" + engagement_ref , params ) ;
public class Fraction { /** * Divide the value of this fraction by another . * @ param fraction * the fraction to divide by , must not be < code > null < / code > * @ return a < code > Fraction < / code > instance with the resulting values * @ throws IllegalArgumentException * if the fraction is < code > null < / code > * @ throws ArithmeticException * if the fraction to divide by is zero * @ throws ArithmeticException * if the resulting numerator or denominator exceeds < code > Integer . MAX _ VALUE < / code > */ public Fraction dividedBy ( final Fraction fraction ) { } }
if ( fraction == null ) { throw new IllegalArgumentException ( "The fraction must not be null" ) ; } if ( fraction . numerator == 0 ) { throw new ArithmeticException ( "The fraction to divide by must not be zero" ) ; } return multipliedBy ( fraction . invert ( ) ) ;
public class ObservableImpl { /** * { @ inheritDoc } * @ param value { @ inheritDoc } */ @ Override protected void applyValueUpdate ( final T value ) throws NotAvailableException { } }
if ( value == null ) { throw new NotAvailableException ( "Value" ) ; } synchronized ( VALUE_LOCK ) { this . value = value ; this . valueFuture . complete ( value ) ; VALUE_LOCK . notifyAll ( ) ; }
public class Bootstrap { /** * Return the WebSocket ServerContainer from the servletContext . */ protected ServerContainer getServerContainer ( ServletContextEvent servletContextEvent ) { } }
ServletContext context = servletContextEvent . getServletContext ( ) ; return ( ServerContainer ) context . getAttribute ( "javax.websocket.server.ServerContainer" ) ;
public class FontData { /** * Get the italic version of the font * @ param familyName The name of the font family * @ return The italic version of the font or null if no italic version exists */ public static FontData getItalic ( String familyName ) { } }
FontData data = ( FontData ) italic . get ( familyName ) ; return data ;
public class DefaultPromise { /** * { @ inheritDoc } * @ param mayInterruptIfRunning this value has no effect in this implementation . */ @ Override public boolean cancel ( boolean mayInterruptIfRunning ) { } }
if ( RESULT_UPDATER . compareAndSet ( this , null , CANCELLATION_CAUSE_HOLDER ) ) { if ( checkNotifyWaiters ( ) ) { notifyListeners ( ) ; } return true ; } return false ;
public class Strings { /** * Joins the given set of strings using the provided separator . * @ param separator * a character sequence used to separate strings . * @ param strings * the set of strings to be joined . * @ return * a string containing the list of input strings , or null if no valid input * was provided . */ public static String join ( String separator , Collection < String > strings ) { } }
if ( strings != null ) { String [ ] array = new String [ strings . size ( ) ] ; return join ( separator , strings . toArray ( array ) ) ; } return null ;
public class Properties { /** * Returns the property assuming its an int . If it isn ' t or if its not * defined , returns default value * @ param name Property name * @ param def Default value * @ return Property value or def */ public Integer getInt ( String name , Integer def ) { } }
final String s = getProperty ( name ) ; try { return Integer . parseInt ( s ) ; } catch ( Exception e ) { return def ; }
public class ProcessCommunicatorImpl { /** * / * ( non - Javadoc ) * @ see tuwien . auto . calimero . process . ProcessCommunicator # readControl * ( tuwien . auto . calimero . GroupAddress ) */ public byte readControl ( GroupAddress dst ) throws KNXTimeoutException , KNXRemoteException , KNXLinkClosedException , KNXFormatException { } }
final byte [ ] apdu = readFromGroup ( dst , priority , 0 , 0 ) ; final DPTXlator3BitControlled t = new DPTXlator3BitControlled ( DPTXlator3BitControlled . DPT_CONTROL_DIMMING ) ; extractGroupASDU ( apdu , t ) ; return t . getValueSigned ( ) ;
public class APIKeysInner { /** * Delete an API Key of an Application Insights component . * @ param resourceGroupName The name of the resource group . * @ param resourceName The name of the Application Insights component resource . * @ param keyId The API Key ID . This is unique within a Application Insights component . * @ 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 < ApplicationInsightsComponentAPIKeyInner > deleteAsync ( String resourceGroupName , String resourceName , String keyId , final ServiceCallback < ApplicationInsightsComponentAPIKeyInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( deleteWithServiceResponseAsync ( resourceGroupName , resourceName , keyId ) , serviceCallback ) ;
public class L3ToSBGNPDConverter { /** * Gets the representing glyph of the PhysicalEntity or Gene . * @ param e PhysicalEntity or Gene to get its glyph * @ param linkID Edge id , used if the Entity is ubique * @ return Representing glyph */ private Glyph getGlyphToLink ( Entity e , String linkID ) { } }
if ( ubiqueDet == null || ! ubiqueDet . isUbique ( e ) ) { return glyphMap . get ( convertID ( e . getUri ( ) ) ) ; } else { // Create a new glyph for each use of ubique Glyph g = createGlyphBasics ( e , false ) ; g . setId ( convertID ( e . getUri ( ) ) + "_" + ModelUtils . md5hex ( linkID ) ) ; Set < String > uris = new HashSet < String > ( ) ; uris . add ( e . getUri ( ) ) ; sbgn2BPMap . put ( g . getId ( ) , uris ) ; if ( e instanceof PhysicalEntity && ( ( PhysicalEntity ) e ) . getCellularLocation ( ) != null ) { assignLocation ( ( PhysicalEntity ) e , g ) ; } ubiqueSet . add ( g ) ; return g ; }
public class AbstractWriteHandler { /** * Handles write request . * @ param writeRequest the request from the client */ public void write ( WriteRequest writeRequest ) { } }
if ( ! tryAcquireSemaphore ( ) ) { return ; } mSerializingExecutor . execute ( ( ) -> { try { if ( mContext == null ) { LOG . debug ( "Received write request {}." , writeRequest ) ; mContext = createRequestContext ( writeRequest ) ; } else { Preconditions . checkState ( ! mContext . isDoneUnsafe ( ) , "invalid request after write request is completed." ) ; } if ( mContext . isDoneUnsafe ( ) || mContext . getError ( ) != null ) { return ; } validateWriteRequest ( writeRequest ) ; if ( writeRequest . hasCommand ( ) ) { WriteRequestCommand command = writeRequest . getCommand ( ) ; if ( command . getFlush ( ) ) { flush ( ) ; } else { handleCommand ( command , mContext ) ; } } else { Preconditions . checkState ( writeRequest . hasChunk ( ) , "write request is missing data chunk in non-command message" ) ; ByteString data = writeRequest . getChunk ( ) . getData ( ) ; Preconditions . checkState ( data != null && data . size ( ) > 0 , "invalid data size from write request message" ) ; writeData ( new NioDataBuffer ( data . asReadOnlyByteBuffer ( ) , data . size ( ) ) ) ; } } catch ( Exception e ) { LogUtils . warnWithException ( LOG , "Exception occurred while processing write request {}." , writeRequest , e ) ; abort ( new Error ( AlluxioStatusException . fromThrowable ( e ) , true ) ) ; } finally { mSemaphore . release ( ) ; } } ) ;
public class Optional { /** * Returns current { @ code Optional } if value is present , otherwise * returns an { @ code Optional } produced by supplier function . * @ param supplier supplier function that produces an { @ code Optional } to be returned * @ return this { @ code Optional } if value is present , otherwise * an { @ code Optional } produced by supplier function * @ throws NullPointerException if value is not present and * { @ code supplier } or value produced by it is { @ code null } */ @ NotNull public Optional < T > or ( @ NotNull Supplier < Optional < T > > supplier ) { } }
if ( isPresent ( ) ) return this ; Objects . requireNonNull ( supplier ) ; return Objects . requireNonNull ( supplier . get ( ) ) ;
public class BaseMessagingEngineImpl { /** * This will return true for liberty * @ see com . ibm . ws . sib . admin . JsMessagingEngine # filestoreExists ( ) */ public final boolean filestoreExists ( ) { } }
String thisMethodName = "filestoreExists" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , this ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName , new Boolean ( false ) ) ; } return true ;
public class AIMessageItem { /** * / * ( non - Javadoc ) * @ see com . ibm . ws . sib . store . AbstractItem # eventUnlocked ( ) */ public void eventUnlocked ( ) throws SevereMessageStoreException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "eventUnlocked" ) ; // modify prefetching info synchronized ( this ) { RemoteDispatchableKey dkey = key . getRemoteDispatchableKey ( ) ; RemoteQPConsumerKey ck = null ; if ( dkey instanceof RemoteQPConsumerKey ) ck = ( RemoteQPConsumerKey ) dkey ; if ( ck != null ) { ck . messageUnlocked ( key ) ; informedConsumerKeyThatLocked = false ; } } isReserved = false ; // msg is no longer reserved for a particular consumer // Set the RMEUnlockCount for this msg ' s valueTick if ( incLockCount ) aih . incrementUnlockCount ( getMessage ( ) . getGuaranteedRemoteGetValueTick ( ) ) ; incLockCount = false ; // call superclass super . eventUnlocked ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "eventUnlocked" ) ;
public class MessageProcessorControl { /** * / * ( non - Javadoc ) * @ see com . ibm . ws . sib . processor . runtime . SIMPMessageProcessorControllable # getAliasIterator ( ) */ public SIMPIterator getAliasIterator ( ) { } }
DestinationTypeFilter filter = new DestinationTypeFilter ( ) ; filter . ALIAS = Boolean . TRUE ; SIMPIterator aliasItr = destinationIndex . iterator ( filter ) ; return new ControllableIterator ( aliasItr ) ;
public class Spider { /** * Notifies all the listeners regarding the spider progress . * @ param percentageComplete the percentage complete * @ param numberCrawled the number of pages crawled * @ param numberToCrawl the number of pages left to crawl */ protected synchronized void notifyListenersSpiderProgress ( int percentageComplete , int numberCrawled , int numberToCrawl ) { } }
for ( SpiderListener l : listeners ) { l . spiderProgress ( percentageComplete , numberCrawled , numberToCrawl ) ; }
public class OLAPService { /** * Same as { @ link # addBatch ( ApplicationDefinition , String , OlapBatch ) } but allows * batch options to be passed . Currently , the only option supported is " overwrite " , * which must be true or false . The default is true , which means field values for * existing objects are replaced . When overwrite is set to false , existing field * values are not overwritten with the values in this batch . * @ param appDef { @ link ApplicationDefinition } of application to update . * @ param shardName Shard to add batch to . * @ param batch { @ link OlapBatch } containing object updates . * @ param options Map of option key / value pairs . Currently , only " overwrite " is * supported and must be true / false . * @ return { @ link BatchResult } indicating results of update . */ public BatchResult addBatch ( ApplicationDefinition appDef , String shardName , OlapBatch batch , Map < String , String > options ) { } }
checkServiceState ( ) ; String guid = m_olap . addSegment ( appDef , shardName , batch , getOverwriteOption ( options ) ) ; BatchResult result = new BatchResult ( ) ; result . setStatus ( Status . OK ) ; result . setComment ( "GUID=" + guid ) ; return result ;
public class FedoraClient { /** * Get the version reported by the remote Fedora server . */ public String getServerVersion ( ) throws IOException { } }
// only do this once - - future invocations will use the known value if ( m_serverVersion == null ) { // Make the APIA call for describe repository // and make sure that HTTP 302 status is handled . String desc = getResponseAsString ( "/describe?xml=true" , true , true ) ; logger . debug ( "describeRepository response:\n" + desc ) ; String [ ] parts = desc . split ( "<repositoryVersion>" ) ; if ( parts . length < 2 ) { throw new IOException ( "Could not find repositoryVersion element in content of /describe?xml=true" ) ; } int i = parts [ 1 ] . indexOf ( "<" ) ; if ( i == - 1 ) { throw new IOException ( "Could not find end of repositoryVersion element in content of /describe?xml=true" ) ; } m_serverVersion = parts [ 1 ] . substring ( 0 , i ) . trim ( ) ; logger . debug ( "Server version is " + m_serverVersion ) ; } return m_serverVersion ;
public class HttpRequestMessageImpl { /** * Parse the authority information out that followed a " / / " marker . Once * that data is saved , then it starts the parse for the remaining info in * the URL . If any format errors are encountered , then an exception is thrown . * @ param data * @ param start * @ throws IllegalArgumentException */ private void parseAuthority ( byte [ ] data , int start ) { } }
// authority is [ userinfo @ ] host [ : port ] " / URI " if ( start >= data . length ) { // nothing after the " / / " which is invalid throw new IllegalArgumentException ( "Invalid authority: " + GenericUtils . getEnglishString ( data ) ) ; } int i = start ; int host_start = start ; int slash_start = data . length ; for ( ; i < data . length ; i ++ ) { // find either a " @ " or " / " if ( '@' == data [ i ] ) { // Note : we ' re just cutting off the userinfo section for now host_start = i + 1 ; } else if ( '/' == data [ i ] ) { slash_start = i ; break ; } } parseURLHost ( data , host_start , slash_start ) ; parseURI ( data , slash_start ) ;
public class BaseProgressLayerDrawable { /** * { @ inheritDoc } */ @ Override public void setUseIntrinsicPadding ( boolean useIntrinsicPadding ) { } }
mBackgroundDrawable . setUseIntrinsicPadding ( useIntrinsicPadding ) ; mSecondaryProgressDrawable . setUseIntrinsicPadding ( useIntrinsicPadding ) ; mProgressDrawable . setUseIntrinsicPadding ( useIntrinsicPadding ) ;
public class MasterSlaveConnectionProvider { /** * Retrieve a { @ link StatefulRedisConnection } by the intent . * { @ link io . lettuce . core . masterslave . MasterSlaveConnectionProvider . Intent # WRITE } intentions use the master connection , * { @ link io . lettuce . core . masterslave . MasterSlaveConnectionProvider . Intent # READ } intentions lookup one or more read * candidates using the { @ link ReadFrom } setting . * @ param intent command intent * @ return the connection . * @ throws RedisException if the host is not part of the cluster */ public CompletableFuture < StatefulRedisConnection < K , V > > getConnectionAsync ( Intent intent ) { } }
if ( debugEnabled ) { logger . debug ( "getConnectionAsync(" + intent + ")" ) ; } if ( readFrom != null && intent == Intent . READ ) { List < RedisNodeDescription > selection = readFrom . select ( new ReadFrom . Nodes ( ) { @ Override public List < RedisNodeDescription > getNodes ( ) { return knownNodes ; } @ Override public Iterator < RedisNodeDescription > iterator ( ) { return knownNodes . iterator ( ) ; } } ) ; if ( selection . isEmpty ( ) ) { throw new RedisException ( String . format ( "Cannot determine a node to read (Known nodes: %s) with setting %s" , knownNodes , readFrom ) ) ; } try { Flux < StatefulRedisConnection < K , V > > connections = Flux . empty ( ) ; for ( RedisNodeDescription node : selection ) { connections = connections . concatWith ( Mono . fromFuture ( getConnection ( node ) ) ) ; } if ( OrderingReadFromAccessor . isOrderSensitive ( readFrom ) || selection . size ( ) == 1 ) { return connections . filter ( StatefulConnection :: isOpen ) . next ( ) . switchIfEmpty ( connections . next ( ) ) . toFuture ( ) ; } return connections . filter ( StatefulConnection :: isOpen ) . collectList ( ) . map ( it -> { int index = ThreadLocalRandom . current ( ) . nextInt ( it . size ( ) ) ; return it . get ( index ) ; } ) . switchIfEmpty ( connections . next ( ) ) . toFuture ( ) ; } catch ( RuntimeException e ) { throw Exceptions . bubble ( e ) ; } } return getConnection ( getMaster ( ) ) ;
public class DatabaseTaskStore { /** * { @ inheritDoc } */ @ Override public int persist ( PartitionRecord updates , PartitionRecord expected ) throws Exception { } }
StringBuilder update = new StringBuilder ( 160 ) . append ( "UPDATE Partition SET " ) ; if ( updates . hasExecutor ( ) ) update . append ( "EXECUTOR=:x2," ) ; if ( updates . hasHostName ( ) ) update . append ( "HOSTNAME=:h2," ) ; if ( updates . hasId ( ) ) update . append ( "ID=:i2," ) ; if ( updates . hasLibertyServer ( ) ) update . append ( "LSERVER=:l2," ) ; if ( updates . hasUserDir ( ) ) update . append ( "USERDIR=:u2," ) ; update . setCharAt ( update . length ( ) - 1 , ' ' ) ; update . append ( "WHERE" ) ; if ( expected . hasExecutor ( ) ) update . append ( " EXECUTOR=:x1 AND" ) ; if ( expected . hasHostName ( ) ) update . append ( " HOSTNAME=:h1 AND" ) ; if ( expected . hasId ( ) ) update . append ( " ID=:i1 AND" ) ; if ( expected . hasLibertyServer ( ) ) update . append ( " LSERVER=:l1 AND" ) ; if ( expected . hasUserDir ( ) ) update . append ( " USERDIR=:u1 AND" ) ; int length = update . length ( ) ; update . delete ( length - ( update . charAt ( length - 1 ) == 'E' ? 6 : 4 ) , length ) ; final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "persist" , updates , expected , update ) ; EntityManager em = getPersistenceServiceUnit ( ) . createEntityManager ( ) ; try { Query query = em . createQuery ( update . toString ( ) ) ; if ( updates . hasExecutor ( ) ) query . setParameter ( "x2" , updates . getExecutor ( ) ) ; if ( updates . hasHostName ( ) ) query . setParameter ( "h2" , updates . getHostName ( ) ) ; if ( updates . hasId ( ) ) query . setParameter ( "i2" , updates . getId ( ) ) ; if ( updates . hasLibertyServer ( ) ) query . setParameter ( "l2" , updates . getLibertyServer ( ) ) ; if ( updates . hasUserDir ( ) ) query . setParameter ( "u2" , updates . getUserDir ( ) ) ; if ( expected . hasExecutor ( ) ) query . setParameter ( "x1" , expected . getExecutor ( ) ) ; if ( expected . hasHostName ( ) ) query . setParameter ( "h1" , expected . getHostName ( ) ) ; if ( expected . hasId ( ) ) query . setParameter ( "i1" , expected . getId ( ) ) ; if ( expected . hasLibertyServer ( ) ) query . setParameter ( "l1" , expected . getLibertyServer ( ) ) ; if ( expected . hasUserDir ( ) ) query . setParameter ( "u1" , expected . getUserDir ( ) ) ; int count = query . executeUpdate ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "persist" , count ) ; return count ; } finally { em . close ( ) ; }
public class DestinationManager { /** * < p > This method is used to alter a link that is localised on this ME . < / p > * @ param vld * @ param linkUuid * @ throws SINotPossibleInCurrentConfigurationException * @ throws SIResourceException * @ throws SIConnectionLostException * @ throws SIException * @ throws SIBExceptionBase */ public void alterLinkLocalization ( VirtualLinkDefinition vld , SIBUuid12 linkUuid ) throws SINotPossibleInCurrentConfigurationException , SIResourceException , SIConnectionLostException , SIException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "alterLinkLocalization" , new Object [ ] { vld , linkUuid } ) ; // Get the destination LinkTypeFilter filter = new LinkTypeFilter ( ) ; filter . MQLINK = Boolean . FALSE ; // includeInvisible ? // filter . VISIBLE = Boolean . TRUE ; LinkHandler linkHandler = ( LinkHandler ) linkIndex . findByUuid ( linkUuid , filter ) ; // Check that we have a handler for this link . checkLinkExists ( linkHandler != null , vld . getName ( ) ) ; // Synchronize on the linkHandler object synchronized ( linkHandler ) { // We ' ll do this under a tranaction , in the spirit of the code that // alters destination information . This work is not coordinated with // the Admin component . // Create a local UOW LocalTransaction transaction = txManager . createLocalTransaction ( true ) ; // Try to alter the local link . try { // Update the virtual linkdefinition linkHandler . updateLinkDefinition ( vld , transaction ) ; // Alert the lookups object to handle the re - definition linkIndex . create ( linkHandler ) ; // If the update was successful then commit the unit of work transaction . commit ( ) ; } catch ( SIResourceException e ) { // No FFDC code needed if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "alterLinkLocalization" , e ) ; handleRollback ( transaction ) ; throw e ; } catch ( RuntimeException e ) { // FFDC FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.DestinationManager.alterLinkLocalization" , "1:3407:1.508.1.7" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exception ( tc , e ) ; SibTr . exit ( tc , "alterLinkLocalization" , e ) ; } handleRollback ( transaction ) ; throw e ; } } // eof synchronized on linkHandler if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "alterLinkLocalization" ) ;
public class DirectoryUpdateMonitor { /** * Starts the monitor watching for updates . */ public void startMonitor ( ) { } }
logger . info ( "Starting Directory Update Monitor" ) ; try { monitor . start ( ) ; } catch ( IllegalStateException e ) { logger . info ( "File alteration monitor is already started: " + e . getMessage ( ) ) ; } catch ( Exception e ) { throw new RuntimeException ( e . getMessage ( ) , e ) ; }
public class MovedClassMap { /** * Get a short class name ( no package part ) . * @ param className * a class name * @ return short class name */ private String getShortClassName ( String className ) { } }
int lastDot = className . lastIndexOf ( '.' ) ; if ( lastDot >= 0 ) { className = className . substring ( lastDot + 1 ) ; } return className . toLowerCase ( Locale . US ) . replace ( '+' , '$' ) ;