signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Randoms { /** * Pick a random element from the specified iterator , or return
* < code > ifEmpty < / code > if no element has a weight greater than < code > 0 < / code > .
* < p > < b > Implementation note : < / b > a random number is generated for every entry with a
* non - zero weight after the first such entry .
* @ throws NullPointerException if values is null .
* @ throws IllegalArgumentException if any weight is less than 0. */
public < T > T pick ( Iterator < ? extends T > values , T ifEmpty , Weigher < ? super T > weigher ) { } } | T pick = ifEmpty ; double total = 0.0 ; while ( values . hasNext ( ) ) { T val = values . next ( ) ; double weight = weigher . getWeight ( val ) ; if ( weight > 0.0 ) { total += weight ; if ( ( total == weight ) || ( ( _r . nextDouble ( ) * total ) < weight ) ) { pick = val ; } } else if ( weight < 0.0 ) { throw new IllegalArgumentException ( "Weight less than 0: " + val ) ; } // else : weight = = 0.0 is OK
} return pick ; |
public class ApiOvhEmailexchange { /** * Create public folder permission
* REST : POST / email / exchange / { organizationName } / service / { exchangeService } / publicFolder / { path } / permission
* @ param allowedAccountId [ required ] Account id to have access to public folder
* @ param accessRights [ required ] Access rights to be set for the account
* @ param organizationName [ required ] The internal name of your exchange organization
* @ param exchangeService [ required ] The internal name of your exchange service
* @ param path [ required ] Path for public folder */
public OvhTask organizationName_service_exchangeService_publicFolder_path_permission_POST ( String organizationName , String exchangeService , String path , OvhPublicFolderRightTypeEnum accessRights , Long allowedAccountId ) throws IOException { } } | String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path}/permission" ; StringBuilder sb = path ( qPath , organizationName , exchangeService , path ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "accessRights" , accessRights ) ; addBody ( o , "allowedAccountId" , allowedAccountId ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhTask . class ) ; |
public class EJBMDOrchestrator { /** * F743-25855 */
private Method getSessionSynchMethod ( BeanMetaData bmd , NamedMethod namedMethod , Class < ? > [ ] expectedParams , String xmlType ) throws EJBConfigurationException { } } | if ( namedMethod == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , xmlType + " not specified in XML" ) ; return null ; } String methodName = namedMethod . getMethodName ( ) . trim ( ) ; List < String > paramTypes = namedMethod . getMethodParamList ( ) ; if ( paramTypes != null ) { if ( expectedParams == null || expectedParams . length == 0 ) { if ( paramTypes . size ( ) > 0 ) { J2EEName j2eeName = bmd . j2eeName ; Tr . error ( tc , "INVALID_SESSION_SYNCH_PARAM_CNTR0324E" , new Object [ ] { methodName , xmlType , j2eeName . getComponent ( ) , j2eeName . getModule ( ) , j2eeName . getApplication ( ) } ) ; throw new EJBConfigurationException ( "CNTR0324E: The " + methodName + " method configured in the ejb-jar.xml" + " file does not have the required method signature for a " + xmlType + " session synchronization method for the " + j2eeName . getComponent ( ) + " bean in the " + j2eeName . getModule ( ) + " module of the " + j2eeName . getApplication ( ) + " application. The number of parameters" + " configured is " + paramTypes . size ( ) + " but must be 0." ) ; } } else { if ( paramTypes . size ( ) != expectedParams . length ) { J2EEName j2eeName = bmd . j2eeName ; Tr . error ( tc , "INVALID_SESSION_SYNCH_PARAM_CNTR0324E" , new Object [ ] { methodName , xmlType , j2eeName . getComponent ( ) , j2eeName . getModule ( ) , j2eeName . getApplication ( ) } ) ; int configuredSize = paramTypes . size ( ) ; throw new EJBConfigurationException ( "CNTR0324E: The " + methodName + " method configured in the ejb-jar.xml" + " file does not have the required method signature for a " + xmlType + " session synchronization method for the " + j2eeName . getComponent ( ) + " bean in the " + j2eeName . getModule ( ) + " module of the " + j2eeName . getApplication ( ) + " application. The number of parameters" + " configured is " + configuredSize + " but must be " + expectedParams . length + "." ) ; } for ( int i = 0 ; i < expectedParams . length ; i ++ ) { if ( ! paramTypes . get ( i ) . equals ( expectedParams [ i ] . getName ( ) ) ) { J2EEName j2eeName = bmd . j2eeName ; Tr . error ( tc , "INVALID_SESSION_SYNCH_PARAM_CNTR0324E" , new Object [ ] { methodName , xmlType , j2eeName . getComponent ( ) , j2eeName . getModule ( ) , j2eeName . getApplication ( ) } ) ; throw new EJBConfigurationException ( "CNTR0324E: The " + methodName + " method configured in the ejb-jar.xml" + " file does not have the required method signature for a " + xmlType + " session synchronization method for the " + j2eeName . getComponent ( ) + " bean in the " + j2eeName . getModule ( ) + " module of the " + j2eeName . getApplication ( ) + " application. The configured parameter" + " type is " + paramTypes . get ( i ) + " but must be " + expectedParams [ i ] . getName ( ) + "." ) ; } } } } Method method = null ; Exception firstException = null ; Class < ? > clazz = bmd . enterpriseBeanClass ; while ( clazz != Object . class && method == null ) { try { method = clazz . getDeclaredMethod ( methodName , expectedParams ) ; method . setAccessible ( true ) ; } catch ( NoSuchMethodException ex ) { // FFDC not required . . . this may be normal
if ( firstException == null ) { firstException = ex ; } clazz = clazz . getSuperclass ( ) ; } } if ( method == null ) { J2EEName j2eeName = bmd . j2eeName ; Tr . error ( tc , "SESSION_SYNCH_METHOD_NOT_FOUND_CNTR0325E" , new Object [ ] { xmlType , methodName , j2eeName . getComponent ( ) , j2eeName . getModule ( ) , j2eeName . getApplication ( ) } ) ; throw new EJBConfigurationException ( "CNTR0325E: The configured " + xmlType + " session synchronization method " + methodName + " is not implemented by the " + j2eeName . getComponent ( ) + " bean in the " + j2eeName . getModule ( ) + " module of the " + j2eeName . getApplication ( ) + " application." , firstException ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , xmlType + " = " + method ) ; return method ; |
public class ConversationHistory { /** * Gets message sent at specified prompt
* @ param prompt Prompt identifier
* @ param conversation Conversation prompt is used in
* @ return message sent at specified prompt
* @ throws IndexOutOfBoundsException if there are no messages from that prompt */
public Message messageAt ( ConversationPrompt prompt , Conversation conversation ) { } } | return messageAt ( conversation . getPrompts ( ) . indexOf ( prompt ) ) ; |
public class GregorianCalendar { /** * Sets the < code > GregorianCalendar < / code > change date . This is the point when the switch
* from Julian dates to Gregorian dates occurred . Default is October 15,
* 1582 ( Gregorian ) . Previous to this , dates will be in the Julian calendar .
* To obtain a pure Julian calendar , set the change date to
* < code > Date ( Long . MAX _ VALUE ) < / code > . To obtain a pure Gregorian calendar ,
* set the change date to < code > Date ( Long . MIN _ VALUE ) < / code > .
* @ param date the given Gregorian cutover date . */
public void setGregorianChange ( Date date ) { } } | long cutoverTime = date . getTime ( ) ; if ( cutoverTime == gregorianCutover ) { return ; } // Before changing the cutover date , make sure to have the
// time of this calendar .
complete ( ) ; setGregorianChange ( cutoverTime ) ; |
public class LowLevelAbstractionFinder { /** * Return the first segment of the given sequence to be searched by the
* given < code > PatternFinderUser < / code > . If the minimum and maximum
* pattern lengths of the < code > PatternFinderUser < / code > are unset , the
* first segment will be the entire sequence .
* @ param def
* a < code > PatternFinderUser < / code > object .
* @ param sequence
* a < code > Sequence < / code > of < code > PrimitiveParameter < / code >
* objects .
* @ return a < code > Segment < / code > of < code > PrimitiveParameter < / code >
* objects . */
private static Segment < PrimitiveParameter > firstSegment ( PatternFinderUser def , Sequence < PrimitiveParameter > sequence , Algorithm algorithm , int maxPatternLength ) { } } | int size = sequence . size ( ) ; int minPatternLength = minPatternLength ( algorithm , def ) ; if ( size > 0 && size >= minPatternLength ) { int x = 0 ; int y = minPatternLength < 1 ? size - 1 : minPatternLength - 1 ; if ( x <= y ) { return resetSegmentHelper ( def , sequence , x , y , new Segment < > ( sequence , x , y ) , algorithm , maxPatternLength ) ; } } return null ; |
public class Criteria { /** * The < code > matches < / code > operator checks that an object matches the given predicate .
* @ param p
* @ return the criteria */
public Criteria matches ( Predicate p ) { } } | this . criteriaType = RelationalOperator . MATCHES ; this . right = new PredicateNode ( p ) ; return this ; |
public class ResourceAddress { /** * For now , assume this type of location header structure .
* Generalize later : http : / / hl7connect . healthintersections . com . au / svc / fhir / 318 / _ history / 1
* @ param serviceBase
* @ param locationHeader */
public static ResourceAddress . ResourceVersionedIdentifier parseCreateLocation ( String locationResponseHeader ) { } } | Pattern pattern = Pattern . compile ( REGEX_ID_WITH_HISTORY ) ; Matcher matcher = pattern . matcher ( locationResponseHeader ) ; ResourceVersionedIdentifier parsedHeader = null ; if ( matcher . matches ( ) ) { String serviceRoot = matcher . group ( 1 ) ; String resourceType = matcher . group ( 3 ) ; String id = matcher . group ( 5 ) ; String version = matcher . group ( 7 ) ; parsedHeader = new ResourceVersionedIdentifier ( serviceRoot , resourceType , id , version ) ; } return parsedHeader ; |
public class ViewInstruction { /** * 优先获取大小写敏感的路径 , 如若找不到 , 则获取忽略大小写后的路径
* @ param tempHome
* @ param subDirPath */
private File searchDirectory ( File tempHome , String subDirPath ) { } } | String [ ] subDirs = StringUtils . split ( subDirPath , "/" ) ; for ( final String subDir : subDirs ) { File file = new File ( tempHome , subDir ) ; if ( ! file . exists ( ) ) { String [ ] candidates = tempHome . list ( new FilenameFilter ( ) { @ Override public boolean accept ( File dir , String name ) { if ( name . equalsIgnoreCase ( subDir ) ) { return true ; } return false ; } } ) ; if ( candidates . length == 0 ) { tempHome = null ; break ; } else { tempHome = new File ( tempHome , candidates [ 0 ] ) ; } } else { tempHome = file ; } } return tempHome ; |
public class MarketplaceService { /** * Handle the portal LoginEvent . If marketplace caching is enabled , will preload marketplace
* entries for the currently logged in user .
* @ param loginEvent the login event . */
@ Override public void onApplicationEvent ( LoginEvent loginEvent ) { } } | if ( enableMarketplacePreloading ) { final IPerson person = loginEvent . getPerson ( ) ; /* * Passing an empty collection pre - loads an unfiltered collection ;
* instances of PortletMarketplace that specify filtering will
* trigger a new collection to be loaded . */
final Set < PortletCategory > empty = Collections . emptySet ( ) ; loadMarketplaceEntriesFor ( person , empty ) ; } |
public class DelegateView { /** * Determines the maximum span for this view along an axis .
* @ param axis
* may be either X _ AXIS or Y _ AXIS
* @ return the span the view would like to be rendered into . Typically the
* view is told to render into the span that is returned , although
* there is no guarantee . The parent may choose to resize or break
* the view . */
@ Override public float getMaximumSpan ( int axis ) { } } | if ( view != null ) { return view . getMaximumSpan ( axis ) ; } return Integer . MAX_VALUE ; |
public class Transform1D { /** * Replies if the transformation is the identity transformation .
* @ return { @ code true } if the transformation is identity . */
@ Pure public boolean isIdentity ( ) { } } | if ( this . isIdentity == null ) { this . isIdentity = MathUtil . isEpsilonZero ( this . curvilineTranslation ) && MathUtil . isEpsilonZero ( this . curvilineTranslation ) ; } return this . isIdentity . booleanValue ( ) ; |
public class ActivityChooserModel { /** * Prunes older excessive records to guarantee { @ link # mHistoryMaxSize } . */
private void pruneExcessiveHistoricalRecordsLocked ( ) { } } | List < HistoricalRecord > choiceRecords = mHistoricalRecords ; final int pruneCount = choiceRecords . size ( ) - mHistoryMaxSize ; if ( pruneCount <= 0 ) { return ; } mHistoricalRecordsChanged = true ; for ( int i = 0 ; i < pruneCount ; i ++ ) { HistoricalRecord prunedRecord = choiceRecords . remove ( 0 ) ; if ( DEBUG ) { Log . i ( LOG_TAG , "Pruned: " + prunedRecord ) ; } } |
public class ParameterUtil { /** * Init parameter values map with the default values ( static or dynamic ) of a parameter
* @ param conn database connection
* @ param param parameter
* @ param parameterValues map of parameter values
* @ throws QueryException if could not get default parameter values */
public static void initDefaultParameterValues ( Connection conn , QueryParameter param , Map < String , Object > parameterValues ) throws QueryException { } } | List < Serializable > defValues ; if ( ( param . getDefaultValues ( ) != null ) && ( param . getDefaultValues ( ) . size ( ) > 0 ) ) { defValues = param . getDefaultValues ( ) ; } else { try { defValues = ParameterUtil . getDefaultSourceValues ( conn , param ) ; } catch ( Exception e ) { throw new QueryException ( e ) ; } } initDefaultParameterValues ( param , defValues , parameterValues ) ; |
public class Restrictors { /** * 按照值匹配某个属性
* @ param property 属性名
* @ param value 熟悉值
* @ return Restrictor */
public static Restrictor eq ( String property , Object value ) { } } | return new SimpleRestrictor ( property , value , RestrictType . eq ) ; |
public class SqlParserImpl { /** * Parse the SQL . */
protected void parseSql ( ) { } } | String sql = tokenizer . getToken ( ) ; if ( isElseMode ( ) ) { sql = StringUtil . replace ( sql , "--" , "" ) ; } Node node = peek ( ) ; if ( ( node instanceof IfNode || node instanceof ElseNode ) && node . getChildSize ( ) == 0 ) { SqlTokenizer st = new SqlTokenizerImpl ( sql ) ; st . skipWhitespace ( ) ; String token = st . skipToken ( ) ; st . skipWhitespace ( ) ; if ( sql . startsWith ( "," ) ) { if ( sql . startsWith ( ", " ) ) { node . addChild ( new PrefixSqlNode ( ", " , sql . substring ( 2 ) ) ) ; } else { node . addChild ( new PrefixSqlNode ( "," , sql . substring ( 1 ) ) ) ; } } else if ( "AND" . equalsIgnoreCase ( token ) || "OR" . equalsIgnoreCase ( token ) ) { node . addChild ( new PrefixSqlNode ( st . getBefore ( ) , st . getAfter ( ) ) ) ; } else { node . addChild ( new SqlNode ( sql ) ) ; } } else { node . addChild ( new SqlNode ( sql ) ) ; } |
public class PDTXMLConverter { /** * Get the passed object as { @ link XMLGregorianCalendar } time ( without a
* date ) .
* @ param aBase
* The source object . May be < code > null < / code > .
* @ return < code > null < / code > if the parameter is < code > null < / code > . */
@ Nullable public static XMLGregorianCalendar getXMLCalendarTime ( @ Nullable final LocalTime aBase ) { } } | if ( aBase == null ) return null ; return s_aDTFactory . newXMLGregorianCalendarTime ( aBase . getHour ( ) , aBase . getMinute ( ) , aBase . getSecond ( ) , aBase . get ( ChronoField . MILLI_OF_SECOND ) , DatatypeConstants . FIELD_UNDEFINED ) ; |
public class ExcelFunctions { /** * Calculates the number of days , months , or years between two dates . */
public static int datedif ( EvaluationContext ctx , Object startDate , Object endDate , Object unit ) { } } | LocalDate _startDate = Conversions . toDate ( startDate , ctx ) ; LocalDate _endDate = Conversions . toDate ( endDate , ctx ) ; String _unit = Conversions . toString ( unit , ctx ) . toLowerCase ( ) ; if ( _startDate . isAfter ( _endDate ) ) { throw new RuntimeException ( "Start date cannot be after end date" ) ; } switch ( _unit ) { case "y" : return ( int ) ChronoUnit . YEARS . between ( _startDate , _endDate ) ; case "m" : return ( int ) ChronoUnit . MONTHS . between ( _startDate , _endDate ) ; case "d" : return ( int ) ChronoUnit . DAYS . between ( _startDate , _endDate ) ; case "md" : return Period . between ( _startDate , _endDate ) . getDays ( ) ; case "ym" : return Period . between ( _startDate , _endDate ) . getMonths ( ) ; case "yd" : return ( int ) ChronoUnit . DAYS . between ( _startDate . withYear ( _endDate . getYear ( ) ) , _endDate ) ; } throw new RuntimeException ( "Invalid unit value: " + _unit ) ; |
public class RuleImpl { /** * Retrieve a parameter < code > Declaration < / code > by identifier .
* @ param identifier
* The identifier .
* @ return The declaration or < code > null < / code > if no declaration matches
* the < code > identifier < / code > . */
@ SuppressWarnings ( "unchecked" ) public Declaration getDeclaration ( final String identifier ) { } } | if ( this . dirty || ( this . declarations == null ) ) { this . declarations = this . getExtendedLhs ( this , null ) . getOuterDeclarations ( ) ; this . dirty = false ; } return this . declarations . get ( identifier ) ; |
public class Http { /** * Sends a GET request and returns the response .
* @ param endpoint The endpoint to send the request to .
* @ param headers Any additional headers to send with this request . You can use { @ link org . apache . http . HttpHeaders } constants for header names .
* @ return A { @ link Path } to the downloaded content , if any .
* @ throws IOException If an error occurs .
* @ see java . nio . file . Files # probeContentType ( Path ) */
public Response < Path > getFile ( Endpoint endpoint , NameValuePair ... headers ) throws IOException { } } | // Create the request
HttpGet get = new HttpGet ( endpoint . url ( ) ) ; get . setHeaders ( combineHeaders ( headers ) ) ; Path tempFile = null ; // Send the request and process the response
try ( CloseableHttpResponse response = httpClient ( ) . execute ( get ) ) { // Request the content
HttpEntity entity = response . getEntity ( ) ; // Download the content to a temporary file
if ( entity != null ) { tempFile = Files . createTempFile ( "download" , "file" ) ; try ( InputStream input = entity . getContent ( ) ; OutputStream output = Files . newOutputStream ( tempFile ) ) { IOUtils . copy ( input , output ) ; } } return new Response < > ( response . getStatusLine ( ) , tempFile ) ; } |
public class AnnotationsClassLoader { /** * Validate a classname . As per SRV . 9.7.2 , we must restict loading of
* classes from J2SE ( java . * ) and classes of the servlet API
* ( javax . servlet . * ) . That should enhance robustness and prevent a number
* of user error ( where an older version of servlet . jar would be present
* in / WEB - INF / lib ) .
* @ param name class name
* @ return true if the name is valid */
protected boolean validate ( String name ) { } } | if ( name == null ) return false ; if ( name . startsWith ( "java." ) ) return false ; return true ; |
public class ObjectUtils { /** * Check whether the given exception is compatible with the specified exception types , as declared
* in a throws clause .
* @ param ex the exception to check
* @ param declaredExceptions the exception types declared in the throws clause
* @ return whether the given exception is compatible */
@ GwtIncompatible ( "incompatible method" ) public static boolean isCompatibleWithThrowsClause ( final Throwable ex , @ Nullable final Class < ? > ... declaredExceptions ) { } } | if ( ! ObjectUtils . isCheckedException ( ex ) ) { return true ; } if ( declaredExceptions != null ) { for ( final Class < ? > declaredException : declaredExceptions ) { if ( declaredException . isInstance ( ex ) ) { return true ; } } } return false ; |
public class CouchDBClient { /** * ( non - Javadoc )
* @ see com . impetus . kundera . client . Client # deleteByColumn ( java . lang . String ,
* java . lang . String , java . lang . String , java . lang . Object ) */
@ Override public void deleteByColumn ( String schemaName , String tableName , String columnName , Object columnValue ) { } } | URI uri = null ; HttpResponse response = null ; try { String q = "key=" + CouchDBUtils . appendQuotes ( columnValue ) ; uri = new URI ( CouchDBConstants . PROTOCOL , null , httpHost . getHostName ( ) , httpHost . getPort ( ) , CouchDBConstants . URL_SEPARATOR + schemaName . toLowerCase ( ) + CouchDBConstants . URL_SEPARATOR + CouchDBConstants . DESIGN + tableName + CouchDBConstants . VIEW + columnName , q , null ) ; HttpGet get = new HttpGet ( uri ) ; get . addHeader ( "Accept" , "application/json" ) ; response = httpClient . execute ( get ) ; InputStream content = response . getEntity ( ) . getContent ( ) ; Reader reader = new InputStreamReader ( content ) ; JsonObject json = gson . fromJson ( reader , JsonObject . class ) ; JsonElement jsonElement = json . get ( "rows" ) ; closeContent ( response ) ; JsonArray array = jsonElement . getAsJsonArray ( ) ; for ( JsonElement element : array ) { JsonObject jsonObject = element . getAsJsonObject ( ) . get ( "value" ) . getAsJsonObject ( ) ; JsonElement pkey = jsonObject . get ( "_id" ) ; onDelete ( schemaName , pkey . getAsString ( ) , response , jsonObject ) ; } } catch ( Exception e ) { log . error ( "Error while deleting row by column where column name is " + columnName + " and column value is {}, Caused by {}." , columnValue , e ) ; throw new KunderaException ( e ) ; } finally { closeContent ( response ) ; } |
public class ApiOvhIpLoadbalancing { /** * Get this object properties
* REST : GET / ipLoadbalancing / { serviceName } / http / route / { routeId }
* @ param serviceName [ required ] The internal name of your IP load balancing
* @ param routeId [ required ] Id of your route */
public OvhRouteHttp serviceName_http_route_routeId_GET ( String serviceName , Long routeId ) throws IOException { } } | String qPath = "/ipLoadbalancing/{serviceName}/http/route/{routeId}" ; StringBuilder sb = path ( qPath , serviceName , routeId ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhRouteHttp . class ) ; |
public class Coercions { /** * Returns true if the given class is of an integer type */
public static boolean isIntegerType ( Class pClass ) { } } | return pClass == Byte . class || pClass == Byte . TYPE || pClass == Short . class || pClass == Short . TYPE || pClass == Character . class || pClass == Character . TYPE || pClass == Integer . class || pClass == Integer . TYPE || pClass == Long . class || pClass == Long . TYPE ; |
public class FctConvertersToFromString { /** * < p > Get CnvTfsDouble ( create and put into map ) . < / p >
* @ return requested CnvTfsDouble
* @ throws Exception - an exception */
protected final CnvTfsDouble createPutCnvTfsDouble ( ) throws Exception { } } | CnvTfsDouble convrt = new CnvTfsDouble ( ) ; this . convertersMap . put ( CnvTfsDouble . class . getSimpleName ( ) , convrt ) ; return convrt ; |
public class SubtitleChatOverlay { /** * Helper function for informing glyphs of the scrolled view . */
protected void viewDidScroll ( List < ? extends ChatGlyph > glyphs , int dx , int dy ) { } } | for ( ChatGlyph glyph : glyphs ) { glyph . viewDidScroll ( dx , dy ) ; } |
public class Workflow { /** * Causes the engine to stop processing of this workflow instance and to enqueue it again .
* May be used in case of processor pool change or to create a ' savepoint ' .
* @ throws Interrupt
* for internal use of COPPER . After resubmit is called , an Interrupt is thrown , caught by COPPER itself for
* taking back control over the executed workflow . */
protected final void resubmit ( ) throws Interrupt { } } | final String cid = engine . createUUID ( ) ; engine . registerCallbacks ( this , WaitMode . ALL , 0 , cid ) ; Acknowledge ack = createCheckpointAcknowledge ( ) ; engine . notify ( new Response < Object > ( cid , null , null ) , ack ) ; registerCheckpointAcknowledge ( ack ) ; updateLastWaitStackTrace ( ) ; |
public class RSAUtils { /** * Sign a message with RSA private key .
* @ param key
* @ param message
* the message to sign
* @ param signAlgo
* signature algorithm to use . If empty , { @ link # DEFAULT _ SIGNATURE _ ALGORITHM } will be
* used .
* @ return the signature
* @ throws NoSuchAlgorithmException
* @ throws InvalidKeyException
* @ throws SignatureException */
public static byte [ ] signMessage ( RSAPrivateKey key , byte [ ] message , String signAlgo ) throws NoSuchAlgorithmException , InvalidKeyException , SignatureException { } } | if ( StringUtils . isBlank ( signAlgo ) ) { signAlgo = DEFAULT_SIGNATURE_ALGORITHM ; } Signature sign = Signature . getInstance ( signAlgo ) ; sign . initSign ( key , SECURE_RNG ) ; sign . update ( message ) ; return sign . sign ( ) ; |
public class MMCIFFileTools { /** * Produces a mmCIF loop header string for the given categoryName and className .
* className must be one of the beans in the { @ link org . biojava . nbio . structure . io . mmcif . model } package
* @ param categoryName
* @ param className
* @ return
* @ throws ClassNotFoundException if the given className can not be found */
public static String toLoopMmCifHeaderString ( String categoryName , String className ) throws ClassNotFoundException { } } | StringBuilder str = new StringBuilder ( ) ; str . append ( SimpleMMcifParser . LOOP_START + newline ) ; Class < ? > c = Class . forName ( className ) ; for ( Field f : getFields ( c ) ) { str . append ( categoryName + "." + f . getName ( ) + newline ) ; } return str . toString ( ) ; |
public class Parser { /** * Parses { @ code source } and returns a { @ link ParseTree } corresponding to the syntactical
* structure of the input . Only { @ link # label labeled } parser nodes are represented in the parse
* tree .
* < p > If parsing failed , { @ link ParserException # getParseTree ( ) } can be inspected for the parse
* tree at error location .
* @ since 2.3 */
public final ParseTree parseTree ( CharSequence source ) { } } | ScannerState state = new ScannerState ( source ) ; state . enableTrace ( "root" ) ; state . run ( this . followedBy ( Parsers . EOF ) ) ; return state . buildParseTree ( ) ; |
public class StartDataCollectionByAgentIdsRequest { /** * The IDs of the agents or connectors from which to start collecting data . If you send a request to an
* agent / connector ID that you do not have permission to contact , according to your AWS account , the service does
* not throw an exception . Instead , it returns the error in the < i > Description < / i > field . If you send a request to
* multiple agents / connectors and you do not have permission to contact some of those agents / connectors , the system
* does not throw an exception . Instead , the system shows < code > Failed < / code > in the < i > Description < / i > field .
* @ param agentIds
* The IDs of the agents or connectors from which to start collecting data . If you send a request to an
* agent / connector ID that you do not have permission to contact , according to your AWS account , the service
* does not throw an exception . Instead , it returns the error in the < i > Description < / i > field . If you send a
* request to multiple agents / connectors and you do not have permission to contact some of those
* agents / connectors , the system does not throw an exception . Instead , the system shows < code > Failed < / code >
* in the < i > Description < / i > field . */
public void setAgentIds ( java . util . Collection < String > agentIds ) { } } | if ( agentIds == null ) { this . agentIds = null ; return ; } this . agentIds = new java . util . ArrayList < String > ( agentIds ) ; |
public class UriMatchTemplate { /** * Match the given URI string .
* @ param uri The uRI
* @ return True if it matches */
@ Override public Optional < UriMatchInfo > match ( String uri ) { } } | if ( uri == null ) { throw new IllegalArgumentException ( "Argument 'uri' cannot be null" ) ; } if ( uri . length ( ) > 1 && uri . charAt ( uri . length ( ) - 1 ) == '/' ) { uri = uri . substring ( 0 , uri . length ( ) - 1 ) ; } int len = uri . length ( ) ; if ( isRoot && ( len == 0 || ( len == 1 && uri . charAt ( 0 ) == '/' ) ) ) { return Optional . of ( new DefaultUriMatchInfo ( uri , Collections . emptyMap ( ) , variables ) ) ; } // Remove any url parameters before matching
int parameterIndex = uri . indexOf ( '?' ) ; if ( parameterIndex > - 1 ) { uri = uri . substring ( 0 , parameterIndex ) ; } Matcher matcher = matchPattern . matcher ( uri ) ; if ( matcher . matches ( ) ) { if ( variables . isEmpty ( ) ) { return Optional . of ( new DefaultUriMatchInfo ( uri , Collections . emptyMap ( ) , variables ) ) ; } else { Map < String , Object > variableMap = new LinkedHashMap < > ( ) ; int count = matcher . groupCount ( ) ; for ( int j = 0 ; j < variables . size ( ) ; j ++ ) { int index = ( j * 2 ) + 2 ; if ( index > count ) { break ; } UriMatchVariable variable = variables . get ( j ) ; String value = matcher . group ( index ) ; variableMap . put ( variable . getName ( ) , value ) ; } return Optional . of ( new DefaultUriMatchInfo ( uri , variableMap , variables ) ) ; } } return Optional . empty ( ) ; |
public class AbstractUsernamePasswordAuthenticationHandler { /** * Transform username .
* @ param userPass the user pass
* @ throws AccountNotFoundException the account not found exception */
protected void transformUsername ( final UsernamePasswordCredential userPass ) throws AccountNotFoundException { } } | if ( StringUtils . isBlank ( userPass . getUsername ( ) ) ) { throw new AccountNotFoundException ( "Username is null." ) ; } LOGGER . debug ( "Transforming credential username via [{}]" , this . principalNameTransformer . getClass ( ) . getName ( ) ) ; val transformedUsername = this . principalNameTransformer . transform ( userPass . getUsername ( ) ) ; if ( StringUtils . isBlank ( transformedUsername ) ) { throw new AccountNotFoundException ( "Transformed username is null." ) ; } userPass . setUsername ( transformedUsername ) ; |
public class AbstractIndex { /** * Finalizes the query in the currently used buffer and creates a new one .
* The finalized query will be added to the list of queries . */
protected void storeBuffer ( ) { } } | if ( buffer != null && buffer . length ( ) > insertStatement . length ( ) ) { if ( ! insertStatement . isEmpty ( ) ) { // only do this in SQL / DATABASE MODE
this . buffer . append ( ";" ) ; } bufferList . add ( buffer ) ; } this . buffer = new StringBuilder ( ) ; this . buffer . append ( insertStatement ) ; |
public class GosuPathEntry { /** * Returns a String representation of this path entry suitable for use in debugging .
* @ return a debug String representation of this object */
public String toDebugString ( ) { } } | StringBuilder sb = new StringBuilder ( ) ; sb . append ( "GosuPathEntry:\n" ) ; sb . append ( " root: " ) . append ( _root . toJavaFile ( ) . getAbsolutePath ( ) ) . append ( "\n" ) ; for ( IDirectory src : _srcs ) { sb . append ( " src: " ) . append ( src . toJavaFile ( ) . getAbsolutePath ( ) ) . append ( "\n" ) ; } return sb . toString ( ) ; |
public class OptionsMethodProcessor { /** * { @ inheritDoc } */
@ Override public ResourceModel processSubResource ( ResourceModel subResourceModel , Configuration configuration ) { } } | return ModelProcessorUtil . enhanceResourceModel ( subResourceModel , true , methodList , true ) . build ( ) ; |
public class QueuePlugin { /** * Show the number of functions to be executed on the first matched element
* in the named queue . */
public int queue ( String name ) { } } | Queue < ? > q = isEmpty ( ) ? null : queue ( get ( 0 ) , name , null ) ; return q == null ? 0 : q . size ( ) ; |
public class DataFormatHelper { /** * Return the given time formatted , based on the provided format structure
* @ param timestamp
* A timestamp as a long , e . g . what would be returned from
* < code > System . currentTimeMillis ( ) < / code >
* @ param useIsoDateFormat
* A boolean , if true , the given date and time will be formatted in ISO - 8601,
* e . g . yyyy - MM - dd ' T ' HH : mm : ss . SSSZ
* if false , the date and time will be formatted as the current locale ,
* @ return formated date string */
public static final String formatTime ( long timestamp , boolean useIsoDateFormat ) { } } | DateFormat df = dateformats . get ( ) ; if ( df == null ) { df = getDateFormat ( ) ; dateformats . set ( df ) ; } try { // Get and store the locale Date pattern that was retrieved from getDateTimeInstance , to be used later .
// This is to prevent creating multiple new instances of SimpleDateFormat , which is expensive .
String ddp = localeDatePattern . get ( ) ; if ( ddp == null ) { ddp = ( ( SimpleDateFormat ) df ) . toPattern ( ) ; localeDatePattern . set ( ddp ) ; } if ( useIsoDateFormat ) { ( ( SimpleDateFormat ) df ) . applyPattern ( "yyyy-MM-dd'T'HH:mm:ss.SSSZ" ) ; } else { ( ( SimpleDateFormat ) df ) . applyPattern ( ddp ) ; } } catch ( Exception e ) { // Use the default pattern , instead .
} return df . format ( timestamp ) ; |
public class CPAttachmentFileEntryUtil { /** * Returns the cp attachment file entry where uuid = & # 63 ; and groupId = & # 63 ; or returns < code > null < / code > if it could not be found , optionally using the finder cache .
* @ param uuid the uuid
* @ param groupId the group ID
* @ param retrieveFromCache whether to retrieve from the finder cache
* @ return the matching cp attachment file entry , or < code > null < / code > if a matching cp attachment file entry could not be found */
public static CPAttachmentFileEntry fetchByUUID_G ( String uuid , long groupId , boolean retrieveFromCache ) { } } | return getPersistence ( ) . fetchByUUID_G ( uuid , groupId , retrieveFromCache ) ; |
public class PreferenceActivity { /** * Handles the intent extra , which specifies the text of the next button .
* @ param extras
* The extras of the intent , which has been used to start the activity , as an instance
* of the class { @ link Bundle } . The bundle may not be null */
private void handleNextButtonTextIntent ( @ NonNull final Bundle extras ) { } } | CharSequence text = extras . getString ( EXTRA_NEXT_BUTTON_TEXT ) ; if ( ! TextUtils . isEmpty ( text ) ) { setNextButtonText ( text ) ; } |
public class NativeLoader { /** * Loads a native library .
* @ param pLibrary name of the library
* @ param pResource name of the resource
* @ param pLoader the class loader to use
* @ throws UnsatisfiedLinkError */
static void loadLibrary0 ( String pLibrary , String pResource , ClassLoader pLoader ) { } } | if ( pLibrary == null ) { throw new IllegalArgumentException ( "library == null" ) ; } // Try loading normal way
UnsatisfiedLinkError unsatisfied ; try { System . loadLibrary ( pLibrary ) ; return ; } catch ( UnsatisfiedLinkError err ) { // Ignore
unsatisfied = err ; } final ClassLoader loader = pLoader != null ? pLoader : Thread . currentThread ( ) . getContextClassLoader ( ) ; final String resource = pResource != null ? pResource : getResourceFor ( pLibrary ) ; // TODO : resource may be null , and that MIGHT be okay , IFF the resource
// is allready unpacked to the user dir . . . However , we then need another
// way to resolve the library extension . . .
// Right now we just fail in a predictable way ( no NPE ) !
if ( resource == null ) { throw unsatisfied ; } // Default to load / store from user . home
File dir = new File ( System . getProperty ( "user.home" ) + "/.twelvemonkeys/lib" ) ; dir . mkdirs ( ) ; // File libraryFile = new File ( dir . getAbsolutePath ( ) , pLibrary + LIBRARY _ EXTENSION ) ;
File libraryFile = new File ( dir . getAbsolutePath ( ) , pLibrary + "." + FileUtil . getExtension ( resource ) ) ; if ( ! libraryFile . exists ( ) ) { try { extractToUserDir ( resource , libraryFile , loader ) ; } catch ( IOException ioe ) { UnsatisfiedLinkError err = new UnsatisfiedLinkError ( "Unable to extract resource to dir: " + libraryFile . getAbsolutePath ( ) ) ; err . initCause ( ioe ) ; throw err ; } } // Try to load the library from the file we just wrote
System . load ( libraryFile . getAbsolutePath ( ) ) ; |
public class CurrencyUnit { /** * Registers a currency and associated countries allowing it to be used , allowing replacement .
* This class only permits known currencies to be returned .
* To achieve this , all currencies have to be registered in advance .
* Since this method is public , it is possible to add currencies in
* application code . It is recommended to do this only at startup , however
* it is safe to do so later as the internal implementation is thread - safe .
* This method uses a flag to determine whether the registered currency
* must be new , or can replace an existing currency .
* The currency code must be three upper - case ASCII letters , based on ISO - 4217.
* The numeric code must be from 0 to 999 , or - 1 if not applicable .
* @ param currencyCode the three - letter upper - case currency code , not null
* @ param numericCurrencyCode the numeric currency code , from 0 to 999 , - 1 if none
* @ param decimalPlaces the number of decimal places that the currency
* normally has , from 0 to 30 ( normally 0 , 2 or 3 ) , or - 1 for a pseudo - currency
* @ param countryCodes the country codes to register the currency under ,
* use of ISO - 3166 is recommended , not null
* @ param force true to register forcefully , replacing any existing matching currency ,
* false to validate that there is no existing matching currency
* @ return the new instance , never null
* @ throws IllegalArgumentException if the code is already registered and { @ code force } is false ;
* or if the specified data is invalid */
public static synchronized CurrencyUnit registerCurrency ( String currencyCode , int numericCurrencyCode , int decimalPlaces , List < String > countryCodes , boolean force ) { } } | MoneyUtils . checkNotNull ( currencyCode , "Currency code must not be null" ) ; if ( currencyCode . length ( ) != 3 ) { throw new IllegalArgumentException ( "Invalid string code, must be length 3" ) ; } if ( CODE . matcher ( currencyCode ) . matches ( ) == false ) { throw new IllegalArgumentException ( "Invalid string code, must be ASCII upper-case letters" ) ; } if ( numericCurrencyCode < - 1 || numericCurrencyCode > 999 ) { throw new IllegalArgumentException ( "Invalid numeric code" ) ; } if ( decimalPlaces < - 1 || decimalPlaces > 30 ) { throw new IllegalArgumentException ( "Invalid number of decimal places" ) ; } MoneyUtils . checkNotNull ( countryCodes , "Country codes must not be null" ) ; CurrencyUnit currency = new CurrencyUnit ( currencyCode , ( short ) numericCurrencyCode , ( short ) decimalPlaces ) ; if ( force ) { currenciesByCode . remove ( currencyCode ) ; currenciesByNumericCode . remove ( numericCurrencyCode ) ; for ( String countryCode : countryCodes ) { currenciesByCountry . remove ( countryCode ) ; } } else { if ( currenciesByCode . containsKey ( currencyCode ) || currenciesByNumericCode . containsKey ( numericCurrencyCode ) ) { throw new IllegalArgumentException ( "Currency already registered: " + currencyCode ) ; } for ( String countryCode : countryCodes ) { if ( currenciesByCountry . containsKey ( countryCode ) ) { throw new IllegalArgumentException ( "Currency already registered for country: " + countryCode ) ; } } } currenciesByCode . putIfAbsent ( currencyCode , currency ) ; if ( numericCurrencyCode >= 0 ) { currenciesByNumericCode . putIfAbsent ( numericCurrencyCode , currency ) ; } for ( String countryCode : countryCodes ) { registerCountry ( countryCode , currency ) ; } return currenciesByCode . get ( currencyCode ) ; |
public class SVGParser { /** * < image > element */
private void image ( Attributes attributes ) throws SVGParseException { } } | debug ( "<image>" ) ; if ( currentElement == null ) throw new SVGParseException ( "Invalid document. Root element must be <svg>" ) ; SVG . Image obj = new SVG . Image ( ) ; obj . document = svgDocument ; obj . parent = currentElement ; parseAttributesCore ( obj , attributes ) ; parseAttributesStyle ( obj , attributes ) ; parseAttributesTransform ( obj , attributes ) ; parseAttributesConditional ( obj , attributes ) ; parseAttributesImage ( obj , attributes ) ; currentElement . addChild ( obj ) ; currentElement = obj ; |
public class StringConvert { /** * Finds the conversion method .
* @ param cls the class to find a method for , not null
* @ param methodName the name of the method to find , not null
* @ return the method to call , null means use { @ code toString } */
private Method findToStringMethod ( Class < ? > cls , String methodName ) { } } | Method m ; try { m = cls . getMethod ( methodName ) ; } catch ( NoSuchMethodException ex ) { throw new IllegalArgumentException ( ex ) ; } if ( Modifier . isStatic ( m . getModifiers ( ) ) ) { throw new IllegalArgumentException ( "Method must not be static: " + methodName ) ; } return m ; |
public class JobUtils { /** * Returns whichever specified worker stores the most blocks from the block info list .
* @ param workers a list of workers to consider
* @ param fileBlockInfos a list of file block information
* @ return a worker address storing the most blocks from the list */
public static BlockWorkerInfo getWorkerWithMostBlocks ( List < BlockWorkerInfo > workers , List < FileBlockInfo > fileBlockInfos ) { } } | // Index workers by their addresses .
IndexedSet < BlockWorkerInfo > addressIndexedWorkers = new IndexedSet < > ( WORKER_ADDRESS_INDEX ) ; addressIndexedWorkers . addAll ( workers ) ; // Use ConcurrentMap for putIfAbsent . A regular Map works in Java 8.
ConcurrentMap < BlockWorkerInfo , Integer > blocksPerWorker = Maps . newConcurrentMap ( ) ; int maxBlocks = 0 ; BlockWorkerInfo mostBlocksWorker = null ; for ( FileBlockInfo fileBlockInfo : fileBlockInfos ) { for ( BlockLocation location : fileBlockInfo . getBlockInfo ( ) . getLocations ( ) ) { BlockWorkerInfo worker = addressIndexedWorkers . getFirstByField ( WORKER_ADDRESS_INDEX , location . getWorkerAddress ( ) ) ; if ( worker == null ) { // We can only choose workers in the workers list .
continue ; } blocksPerWorker . putIfAbsent ( worker , 0 ) ; int newBlockCount = blocksPerWorker . get ( worker ) + 1 ; blocksPerWorker . put ( worker , newBlockCount ) ; if ( newBlockCount > maxBlocks ) { maxBlocks = newBlockCount ; mostBlocksWorker = worker ; } } } return mostBlocksWorker ; |
public class FontData { /** * Get the bold italic version of the font
* @ param familyName The name of the font family
* @ return The bold italic version of the font or null if no bold italic version exists */
public static FontData getBoldItalic ( String familyName ) { } } | FontData data = ( FontData ) bolditalic . get ( familyName ) ; return data ; |
public class ValidationStampController { /** * Validation stamps */
@ RequestMapping ( value = "branches/{branchId}/validationStamps" , method = RequestMethod . GET ) public Resources < ValidationStamp > getValidationStampListForBranch ( @ PathVariable ID branchId ) { } } | Branch branch = structureService . getBranch ( branchId ) ; return Resources . of ( structureService . getValidationStampListForBranch ( branchId ) , uri ( on ( ValidationStampController . class ) . getValidationStampListForBranch ( branchId ) ) ) // Create
. with ( Link . CREATE , uri ( on ( ValidationStampController . class ) . newValidationStampForm ( branchId ) ) , securityService . isProjectFunctionGranted ( branch . getProject ( ) . id ( ) , ValidationStampCreate . class ) ) ; |
public class Tuple { /** * Takes a slice of the tuple from an inclusive start to an exclusive end index .
* @ param start Where to start the slice from ( inclusive )
* @ param end Where to end the slice at ( exclusive )
* @ return A new tuple of degree ( end - start ) with the elements of this tuple from start to end */
public Tuple slice ( int start , int end ) { } } | Preconditions . checkArgument ( start >= 0 , "Start index must be >= 0" ) ; Preconditions . checkArgument ( start < end , "Start index must be < end index" ) ; if ( start >= degree ( ) ) { return Tuple0 . INSTANCE ; } return new NTuple ( Arrays . copyOfRange ( array ( ) , start , Math . min ( end , degree ( ) ) ) ) ; |
public class DateFunctions { /** * Returned expression results in statement time stamp as a string in a supported format ;
* does not vary during a query . */
public static Expression nowStr ( String format ) { } } | if ( format == null || format . isEmpty ( ) ) { return x ( "NOW_STR()" ) ; } return x ( "NOW_STR(\"" + format + "\")" ) ; |
public class Debug { /** * Print stack trace if not true . */
public static void print ( Exception ex , String strDebugType ) { } } | Debug . print ( ex , strDebugType , DBConstants . DEBUG_INFO ) ; |
public class XCPDInitiatingGatewayAuditor { /** * Get an instance of the XCPD Initiating Gateway Auditor from the
* global context
* @ return XCPD Initiating Gateway Auditor instance */
public static XCPDInitiatingGatewayAuditor getAuditor ( ) { } } | AuditorModuleContext ctx = AuditorModuleContext . getContext ( ) ; return ( XCPDInitiatingGatewayAuditor ) ctx . getAuditor ( XCPDInitiatingGatewayAuditor . class ) ; |
public class N { /** * Removes the element at the specified position from the specified array .
* All subsequent elements are shifted to the left ( subtracts one from their
* indices ) .
* This method returns a new array with the same elements of the input array
* except the element on the specified position . The component type of the
* returned array is always the same as that of the input array .
* @ param < T >
* the component type of the array
* @ param a
* @ param index
* the position of the element to be removed
* @ return A new array containing the existing elements except the element
* at the specified position . */
public static boolean [ ] delete ( final boolean [ ] a , final int index ) { } } | final boolean [ ] result = new boolean [ a . length - 1 ] ; if ( index > 0 ) { copy ( a , 0 , result , 0 , index ) ; } if ( index + 1 < a . length ) { copy ( a , index + 1 , result , index , a . length - index - 1 ) ; } return result ; |
public class CallCenterApp { /** * Main routine creates an instance of this app and kicks off the run method .
* @ param args Command line arguments .
* @ throws Exception if anything goes wrong .
* @ see { @ link WindowingConfig } */
public static void main ( String [ ] args ) throws Exception { } } | // create a configuration from the arguments
CallCenterConfig config = new CallCenterConfig ( ) ; config . parse ( CallCenterApp . class . getName ( ) , args ) ; CallCenterApp app = new CallCenterApp ( config ) ; app . run ( ) ; |
public class MainActivity { /** * User clicked the " Upgrade to Premium " button . */
public void onUpgradeAppButtonClicked ( View arg0 ) { } } | Log . d ( TAG , "Upgrade button clicked; launching purchase flow for upgrade." ) ; if ( setupDone == null ) { complain ( "Billing Setup is not completed yet" ) ; return ; } if ( ! setupDone ) { complain ( "Billing Setup failed" ) ; return ; } setWaitScreen ( true ) ; /* TODO : for security , generate your payload here for verification . See the comments on
* verifyDeveloperPayload ( ) for more info . Since this is a SAMPLE , we just use
* an empty string , but on a production app you should carefully generate this . */
String payload = "" ; mHelper . launchPurchaseFlow ( this , InAppConfig . SKU_PREMIUM , RC_REQUEST , mPurchaseFinishedListener , payload ) ; |
public class FTPClient { /** * implement GridFTP v2 CKSM command from
* < a href = " http : / / www . ogf . org / documents / GFD . 47 . pdf " > GridFTP v2 Protocol Description < / a >
* < pre >
* 5.1 CKSM
* This command is used by the client to request checksum calculation over a portion or
* whole file existing on the server . The syntax is :
* CKSM & lt ; algorithm & gt ; & lt ; offset & gt ; & lt ; length & gt ; & lt ; path & gt ; CRLF
* Server executes this command by calculating specified type of checksum over
* portion of the file starting at the offset and of the specified length . If length is – 1,
* the checksum will be calculated through the end of the file . On success , the server
* replies with
* 2xx & lt ; checksum value & gt ;
* Actual format of checksum value depends on the algorithm used , but generally ,
* hexadecimal representation should be used .
* < / pre >
* @ param algorithm ckeckum alorithm
* @ param offset
* @ param length
* @ param path
* @ return ckecksum value returned by the server
* @ throws org . globus . ftp . exception . ClientException
* @ throws org . globus . ftp . exception . ServerException
* @ throws java . io . IOException */
public String getChecksum ( String algorithm , long offset , long length , String path ) throws ClientException , ServerException , IOException { } } | // check if we the cksum commands and specific algorithm are supported
checkCksumSupport ( algorithm ) ; // form CKSM command
String parameters = String . format ( "%s %d %d %s" , algorithm , offset , length , path ) ; Command cmd = new Command ( "CKSM" , parameters ) ; // transfer command , obtain reply
Reply cksumReply = doCommand ( cmd ) ; // check for error
if ( ! Reply . isPositiveCompletion ( cksumReply ) ) { throw new ServerException ( ServerException . SERVER_REFUSED , cksumReply . getMessage ( ) ) ; } return cksumReply . getMessage ( ) ; |
public class InternalXbaseParser { /** * InternalXbase . g : 1392:1 : ruleXTypeLiteral : ( ( rule _ _ XTypeLiteral _ _ Group _ _ 0 ) ) ; */
public final void ruleXTypeLiteral ( ) throws RecognitionException { } } | int stackSize = keepStackSize ( ) ; try { // InternalXbase . g : 1396:2 : ( ( ( rule _ _ XTypeLiteral _ _ Group _ _ 0 ) ) )
// InternalXbase . g : 1397:2 : ( ( rule _ _ XTypeLiteral _ _ Group _ _ 0 ) )
{ // InternalXbase . g : 1397:2 : ( ( rule _ _ XTypeLiteral _ _ Group _ _ 0 ) )
// InternalXbase . g : 1398:3 : ( rule _ _ XTypeLiteral _ _ Group _ _ 0 )
{ if ( state . backtracking == 0 ) { before ( grammarAccess . getXTypeLiteralAccess ( ) . getGroup ( ) ) ; } // InternalXbase . g : 1399:3 : ( rule _ _ XTypeLiteral _ _ Group _ _ 0 )
// InternalXbase . g : 1399:4 : rule _ _ XTypeLiteral _ _ Group _ _ 0
{ pushFollow ( FOLLOW_2 ) ; rule__XTypeLiteral__Group__0 ( ) ; state . _fsp -- ; if ( state . failed ) return ; } if ( state . backtracking == 0 ) { after ( grammarAccess . getXTypeLiteralAccess ( ) . getGroup ( ) ) ; } } } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { restoreStackSize ( stackSize ) ; } return ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcDraughtingCalloutElement ( ) { } } | if ( ifcDraughtingCalloutElementEClass == null ) { ifcDraughtingCalloutElementEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 953 ) ; } return ifcDraughtingCalloutElementEClass ; |
public class Matrix { /** * Parses { @ link Matrix } from the given CSV string .
* @ param csv the string in CSV format
* @ return a parsed matrix */
public static Matrix fromCSV ( String csv ) { } } | StringTokenizer lines = new StringTokenizer ( csv , "\n" ) ; Matrix result = DenseMatrix . zero ( 10 , 10 ) ; int rows = 0 ; int columns = 0 ; while ( lines . hasMoreTokens ( ) ) { if ( result . rows ( ) == rows ) { result = result . copyOfRows ( ( rows * 3 ) / 2 + 1 ) ; } StringTokenizer elements = new StringTokenizer ( lines . nextToken ( ) , ", " ) ; int j = 0 ; while ( elements . hasMoreElements ( ) ) { if ( j == result . columns ( ) ) { result = result . copyOfColumns ( ( j * 3 ) / 2 + 1 ) ; } double x = Double . parseDouble ( elements . nextToken ( ) ) ; result . set ( rows , j ++ , x ) ; } rows ++ ; columns = j > columns ? j : columns ; } return result . copyOfShape ( rows , columns ) ; |
public class ActionType { /** * The configuration properties for the action type .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setActionConfigurationProperties ( java . util . Collection ) } or
* { @ link # withActionConfigurationProperties ( java . util . Collection ) } if you want to override the existing values .
* @ param actionConfigurationProperties
* The configuration properties for the action type .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ActionType withActionConfigurationProperties ( ActionConfigurationProperty ... actionConfigurationProperties ) { } } | if ( this . actionConfigurationProperties == null ) { setActionConfigurationProperties ( new java . util . ArrayList < ActionConfigurationProperty > ( actionConfigurationProperties . length ) ) ; } for ( ActionConfigurationProperty ele : actionConfigurationProperties ) { this . actionConfigurationProperties . add ( ele ) ; } return this ; |
public class WwwFormTokenMaker { /** * Resumes scanning until the next regular expression is matched ,
* the end of input is encountered or an I / O - Error occurs .
* @ return the next token */
public org . fife . ui . rsyntaxtextarea . Token yylex ( ) { } } | int zzInput ; int zzAction ; // cached fields :
int zzCurrentPosL ; int zzMarkedPosL ; int zzEndReadL = zzEndRead ; char [ ] zzBufferL = zzBuffer ; char [ ] zzCMapL = ZZ_CMAP ; int [ ] zzTransL = ZZ_TRANS ; int [ ] zzRowMapL = ZZ_ROWMAP ; int [ ] zzAttrL = ZZ_ATTRIBUTE ; while ( true ) { zzMarkedPosL = zzMarkedPos ; zzAction = - 1 ; zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL ; zzState = ZZ_LEXSTATE [ zzLexicalState ] ; zzForAction : { while ( true ) { if ( zzCurrentPosL < zzEndReadL ) zzInput = zzBufferL [ zzCurrentPosL ++ ] ; else if ( zzAtEOF ) { zzInput = YYEOF ; break zzForAction ; } else { // store back cached positions
zzCurrentPos = zzCurrentPosL ; zzMarkedPos = zzMarkedPosL ; boolean eof = zzRefill ( ) ; // get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos ; zzMarkedPosL = zzMarkedPos ; zzBufferL = zzBuffer ; zzEndReadL = zzEndRead ; if ( eof ) { zzInput = YYEOF ; break zzForAction ; } zzInput = zzBufferL [ zzCurrentPosL ++ ] ; } int zzNext = zzTransL [ zzRowMapL [ zzState ] + zzCMapL [ zzInput ] ] ; if ( zzNext == - 1 ) break zzForAction ; zzState = zzNext ; int zzAttributes = zzAttrL [ zzState ] ; if ( ( zzAttributes & 1 ) == 1 ) { zzAction = zzState ; zzMarkedPosL = zzCurrentPosL ; if ( ( zzAttributes & 8 ) == 8 ) break zzForAction ; } } } // store back cached position
zzMarkedPos = zzMarkedPosL ; switch ( zzAction < 0 ? zzAction : ZZ_ACTION [ zzAction ] ) { case 1 : { addToken ( Token . IDENTIFIER ) ; yybegin ( ERROR ) ; } break ; case 2 : { addToken ( Token . RESERVED_WORD ) ; yybegin ( SEPARATOR ) ; } break ; case 3 : { addToken ( Token . IDENTIFIER ) ; } break ; case 4 : { addToken ( Token . SEPARATOR ) ; yybegin ( VALUE ) ; } break ; case 5 : { addToken ( Token . VARIABLE ) ; yybegin ( NAME ) ; } break ; case 6 : { addToken ( Token . COMMENT_DOCUMENTATION ) ; } break ; case 7 : { addToken ( Token . DATA_TYPE ) ; } break ; case 8 : case 9 : case 10 : case 11 : case 12 : case 13 : case 14 : break ; default : if ( zzInput == YYEOF && zzStartRead == zzCurrentPos ) { zzAtEOF = true ; switch ( zzLexicalState ) { case YYINITIAL : case ERROR : case NAME : case SEPARATOR : case VALUE : addNullToken ( ) ; return firstToken ; case 18 : case 19 : case 20 : case 21 : case 22 : break ; default : return null ; } } else { zzScanError ( ZZ_NO_MATCH ) ; } } } |
public class ImmutableRoaringBitmap { /** * Computes XOR between input bitmaps in the given range , from rangeStart ( inclusive ) to rangeEnd
* ( exclusive )
* @ param bitmaps input bitmaps , these are not modified
* @ param rangeStart inclusive beginning of range
* @ param rangeEnd exclusive ending of range
* @ return new result bitmap
* @ deprecated use the version where longs specify the range .
* Negative values not allowed for rangeStart and rangeEnd */
@ Deprecated public static MutableRoaringBitmap xor ( final Iterator < ? extends ImmutableRoaringBitmap > bitmaps , final int rangeStart , final int rangeEnd ) { } } | return xor ( bitmaps , ( long ) rangeStart , ( long ) rangeEnd ) ; |
public class NotQuery { /** * { @ inheritDoc } */
@ Override public Query rewrite ( IndexReader reader ) throws IOException { } } | Query cQuery = context . rewrite ( reader ) ; if ( cQuery == context ) // NOSONAR
{ return this ; } else { return new NotQuery ( cQuery ) ; } |
public class ApiErrorExtractor { /** * Get the first ErrorInfo from a GoogleJsonError , or null if
* there is not one . */
protected ErrorInfo getErrorInfo ( GoogleJsonError details ) { } } | if ( details == null ) { return null ; } List < ErrorInfo > errors = details . getErrors ( ) ; return errors . isEmpty ( ) ? null : errors . get ( 0 ) ; |
public class TypedProperties { /** * Equivalent to { @ link # getFloat ( String , float )
* getFloat } { @ code ( key . name ( ) , defaultValue ) } .
* If { @ code key } is null , { @ code defaultValue } is returned . */
public float getFloat ( Enum < ? > key , float defaultValue ) { } } | if ( key == null ) { return defaultValue ; } return getFloat ( key . name ( ) , defaultValue ) ; |
public class LabelPropertySource { /** * Label names must be prefixed with " @ msg . " to be recognized as such . */
@ Override public String getProperty ( String name ) { } } | return name . startsWith ( LABEL_PREFIX ) ? StrUtil . getLabel ( name . substring ( LABEL_PREFIX . length ( ) ) ) : null ; |
public class BELScriptWalker { /** * BELScriptWalker . g : 431:1 : argument returns [ String r ] : ( p = param | t = term ) ; */
public final BELScriptWalker . argument_return argument ( ) throws RecognitionException { } } | BELScriptWalker . argument_return retval = new BELScriptWalker . argument_return ( ) ; retval . start = input . LT ( 1 ) ; CommonTree root_0 = null ; CommonTree _first_0 = null ; CommonTree _last = null ; BELScriptWalker . param_return p = null ; BELScriptWalker . term_return t = null ; try { // BELScriptWalker . g : 431:28 : ( p = param | t = term )
int alt16 = 2 ; int LA16_0 = input . LA ( 1 ) ; if ( ( LA16_0 == OBJECT_IDENT || LA16_0 == QUOTED_VALUE || LA16_0 == NS_PREFIX ) ) { alt16 = 1 ; } else if ( ( ( LA16_0 >= 44 && LA16_0 <= 102 ) ) ) { alt16 = 2 ; } else { NoViableAltException nvae = new NoViableAltException ( "" , 16 , 0 , input ) ; throw nvae ; } switch ( alt16 ) { case 1 : // BELScriptWalker . g : 432:5 : p = param
{ root_0 = ( CommonTree ) adaptor . nil ( ) ; _last = ( CommonTree ) input . LT ( 1 ) ; pushFollow ( FOLLOW_param_in_argument665 ) ; p = param ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , p . getTree ( ) ) ; retval . r = p . r ; } break ; case 2 : // BELScriptWalker . g : 435:5 : t = term
{ root_0 = ( CommonTree ) adaptor . nil ( ) ; _last = ( CommonTree ) input . LT ( 1 ) ; pushFollow ( FOLLOW_term_in_argument677 ) ; t = term ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , t . getTree ( ) ) ; retval . r = t . r ; } break ; } retval . tree = ( CommonTree ) adaptor . rulePostProcessing ( root_0 ) ; } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { } return retval ; |
public class AXUTagSupport { /** * override doTag method */
@ Override public void doTag ( ) throws JspException , IOException { } } | try { JspContext context = getJspContext ( ) ; JspFragment fragment = getJspBody ( ) ; PageContext pageContext = ( PageContext ) context ; // invoke before event
beforeDoTag ( context , fragment ) ; // 내장객체 추가
innerInstance . put ( "param" , TagUtils . getRequestParameterMap ( pageContext ) ) ; innerInstance . put ( "request" , TagUtils . getRequestAttributeMap ( pageContext ) ) ; innerInstance . put ( "session" , TagUtils . getSessionAttributeMap ( pageContext ) ) ; innerInstance . put ( "cookie" , TagUtils . getCookieMap ( pageContext ) ) ; innerInstance . putAll ( dynamicAttrMap ) ; Object [ ] params = new Object [ ] { this , innerInstance } ; String mustacheKey = getClass ( ) . getCanonicalName ( ) ; AXUConfig config = ConfigReader . getConfig ( ) ; if ( this instanceof CustomTag ) { CustomTag customTag = ( CustomTag ) this ; mustacheKey = mustacheKey + "#" + customTag . getCustomid ( ) ; } mustacheHtml = mustacheCacheMap . get ( mustacheKey ) ; if ( mustacheHtml == null ) { if ( tagBody == null ) { throw new RuntimeException ( "tag body is empty. please check your aux4j.xml" ) ; } mustacheHtml = mustacheFactory . compile ( new StringReader ( tagBody ) , mustacheKey ) ; if ( ! StringUtils . equalsIgnoreCase ( "DEV" , config . getMode ( ) ) ) { mustacheCacheMap . put ( mustacheKey , mustacheHtml ) ; } } mustacheHtml . execute ( context . getOut ( ) , params ) ; // invoke after event
afterDoTag ( context , fragment ) ; } catch ( Exception e ) { logger . error ( String . format ( "doTag is fail.\ntagBody: %s\nmustacheHtml: %s" , tagBody , ( mustacheHtml == null ? "null" : mustacheHtml . toString ( ) ) ) , e ) ; } |
public class JMSConnectionFactoryDefinitionProcessor { /** * ( non - Javadoc )
* @ see com . ibm . wsspi . injectionengine . InjectionProcessor # processXML ( ) */
@ Override public void processXML ( ) throws InjectionException { } } | List < ? extends JMSConnectionFactory > jmsConnectionFactoryDefinitions = ivNameSpaceConfig . getJNDIEnvironmentRefs ( JMSConnectionFactory . class ) ; if ( jmsConnectionFactoryDefinitions != null ) { for ( JMSConnectionFactory jmsConnectionFactory : jmsConnectionFactoryDefinitions ) { String jndiName = jmsConnectionFactory . getName ( ) ; InjectionBinding < JMSConnectionFactoryDefinition > injectionBinding = ivAllAnnotationsCollection . get ( jndiName ) ; JMSConnectionFactoryDefinitionInjectionBinding binding ; if ( injectionBinding != null ) { binding = ( JMSConnectionFactoryDefinitionInjectionBinding ) injectionBinding ; } else { binding = new JMSConnectionFactoryDefinitionInjectionBinding ( jndiName , ivNameSpaceConfig ) ; addInjectionBinding ( binding ) ; } binding . mergeXML ( jmsConnectionFactory ) ; } } |
public class WireFeedInput { /** * Creates and sets up a org . jdom2 . input . SAXBuilder for parsing .
* @ return a new org . jdom2 . input . SAXBuilder object */
protected SAXBuilder createSAXBuilder ( ) { } } | SAXBuilder saxBuilder ; if ( validate ) { saxBuilder = new SAXBuilder ( XMLReaders . DTDVALIDATING ) ; } else { saxBuilder = new SAXBuilder ( XMLReaders . NONVALIDATING ) ; } saxBuilder . setEntityResolver ( RESOLVER ) ; // This code is needed to fix the security problem outlined in
// http : / / www . securityfocus . com / archive / 1/297714
// Unfortunately there isn ' t an easy way to check if an XML parser
// supports a particular feature , so
// we need to set it and catch the exception if it fails . We also need
// to subclass the JDom SAXBuilder
// class in order to get access to the underlying SAX parser - otherwise
// the features don ' t get set until
// we are already building the document , by which time it ' s too late to
// fix the problem .
// Crimson is one parser which is known not to support these features .
try { final XMLReader parser = saxBuilder . createParser ( ) ; setFeature ( saxBuilder , parser , "http://xml.org/sax/features/external-general-entities" , false ) ; setFeature ( saxBuilder , parser , "http://xml.org/sax/features/external-parameter-entities" , false ) ; setFeature ( saxBuilder , parser , "http://apache.org/xml/features/nonvalidating/load-external-dtd" , false ) ; if ( ! allowDoctypes ) { setFeature ( saxBuilder , parser , "http://apache.org/xml/features/disallow-doctype-decl" , true ) ; } } catch ( final JDOMException e ) { throw new IllegalStateException ( "JDOM could not create a SAX parser" , e ) ; } saxBuilder . setExpandEntities ( false ) ; return saxBuilder ; |
public class UBLTRValidatorBuilder { /** * Create a new validation builder .
* @ param aClass
* The UBL class to be validated . May not be < code > null < / code > .
* @ return The new validation builder . Never < code > null < / code > .
* @ param < T >
* The UBLTR document implementation type */
@ Nonnull public static < T > UBLTRValidatorBuilder < T > create ( @ Nonnull final Class < T > aClass ) { } } | return new UBLTRValidatorBuilder < > ( aClass ) ; |
public class SnappyCodec { /** * Create a new { @ link Decompressor } for use by this
* { @ link CompressionCodec } .
* @ return a new decompressor for use by this codec */
@ Override public Decompressor createDecompressor ( ) { } } | if ( ! isNativeSnappyLoaded ( conf ) ) { throw new RuntimeException ( "native snappy library not available" ) ; } int bufferSize = conf . getInt ( IO_COMPRESSION_CODEC_SNAPPY_BUFFERSIZE_KEY , IO_COMPRESSION_CODEC_SNAPPY_BUFFERSIZE_DEFAULT ) ; return new SnappyDecompressor ( bufferSize ) ; |
public class CommandExecutor { /** * Submit a command to the server .
* @ param command The CLI command
* @ return The DMR response as a ModelNode
* @ throws CommandFormatException
* @ throws IOException */
public synchronized ModelNode doCommand ( String command ) throws CommandFormatException , IOException { } } | ModelNode request = cmdCtx . buildRequest ( command ) ; return execute ( request , isSlowCommand ( command ) ) . getResponseNode ( ) ; |
public class XPathContext { /** * Gets DTMXRTreeFrag object if one has already been created .
* Creates new DTMXRTreeFrag object and adds to m _ DTMXRTreeFrags HashMap ,
* otherwise .
* @ param dtmIdentity
* @ return DTMXRTreeFrag */
public DTMXRTreeFrag getDTMXRTreeFrag ( int dtmIdentity ) { } } | if ( m_DTMXRTreeFrags == null ) { m_DTMXRTreeFrags = new HashMap ( ) ; } if ( m_DTMXRTreeFrags . containsKey ( new Integer ( dtmIdentity ) ) ) { return ( DTMXRTreeFrag ) m_DTMXRTreeFrags . get ( new Integer ( dtmIdentity ) ) ; } else { final DTMXRTreeFrag frag = new DTMXRTreeFrag ( dtmIdentity , this ) ; m_DTMXRTreeFrags . put ( new Integer ( dtmIdentity ) , frag ) ; return frag ; } |
public class ZoneInfoCompiler { /** * Launches the ZoneInfoCompiler tool .
* < pre >
* Usage : java org . joda . time . tz . ZoneInfoCompiler & lt ; options & gt ; & lt ; source files & gt ;
* where possible options include :
* - src & lt ; directory & gt ; Specify where to read source files
* - dst & lt ; directory & gt ; Specify where to write generated files
* - verbose Output verbosely ( default false )
* < / pre > */
public static void main ( String [ ] args ) throws Exception { } } | if ( args . length == 0 ) { printUsage ( ) ; return ; } File inputDir = null ; File outputDir = null ; boolean verbose = false ; int i ; for ( i = 0 ; i < args . length ; i ++ ) { try { if ( "-src" . equals ( args [ i ] ) ) { inputDir = new File ( args [ ++ i ] ) ; } else if ( "-dst" . equals ( args [ i ] ) ) { outputDir = new File ( args [ ++ i ] ) ; } else if ( "-verbose" . equals ( args [ i ] ) ) { verbose = true ; } else if ( "-?" . equals ( args [ i ] ) ) { printUsage ( ) ; return ; } else { break ; } } catch ( IndexOutOfBoundsException e ) { printUsage ( ) ; return ; } } if ( i >= args . length ) { printUsage ( ) ; return ; } File [ ] sources = new File [ args . length - i ] ; for ( int j = 0 ; i < args . length ; i ++ , j ++ ) { sources [ j ] = inputDir == null ? new File ( args [ i ] ) : new File ( inputDir , args [ i ] ) ; } ZoneInfoLogger . set ( verbose ) ; ZoneInfoCompiler zic = new ZoneInfoCompiler ( ) ; zic . compile ( outputDir , sources ) ; |
public class LineSearchMore94 { /** * stp has a higher value than stx . The minimum must be between these two values .
* Pick a point which is close to stx since it has a lower value .
* @ return The new step . */
private double handleCase1 ( ) { } } | double stpc = SearchInterpolate . cubic2 ( fx , gx , stx , fp , gp , stp ) ; double stpq = SearchInterpolate . quadratic ( fx , gx , stx , fp , stp ) ; // If the cubic step is closer to stx than the quadratic step take that
bracket = true ; if ( Math . abs ( stpc - stx ) < Math . abs ( stpq - stx ) ) { return stpc ; } else { // otherwise go with the average of the twp
return stpc + ( stpq - stpc ) / 2.0 ; } |
public class TaskInstanceNotifierFactory { /** * Returns a list of notifier class name and template name pairs , delimited by colon
* @ param taskId
* @ param outcome
* @ return the registered notifier or null if not found */
public List < String > getNotifierSpecs ( Long taskId , String outcome ) throws ObserverException { } } | TaskTemplate taskVO = TaskTemplateCache . getTaskTemplate ( taskId ) ; if ( taskVO != null ) { String noticesAttr = taskVO . getAttribute ( TaskAttributeConstant . NOTICES ) ; if ( ! StringHelper . isEmpty ( noticesAttr ) && ! "$DefaultNotices" . equals ( noticesAttr ) ) { return parseNoticiesAttr ( noticesAttr , outcome ) ; } } return null ; |
public class RequestContext { /** * Returns the component corresponding to the specified { @ link Descriptor }
* from the current { @ code HttpServletRequest } .
* If the application is not running in Web environment , the component is
* got from { @ code ThreadContext } ' s component store .
* @ param < T > The component type .
* @ param descriptor The descriptor corresponding to the component .
* @ return The component corresponding to the specified { @ link Descriptor } . */
@ SuppressWarnings ( "unchecked" ) public < T > T get ( Descriptor < T > descriptor ) { } } | HttpServletRequest request = WebFilter . request ( ) ; if ( request == null ) { return super . get ( descriptor ) ; } Map < Descriptor < ? > , Object > components = ( Map < Descriptor < ? > , Object > ) request . getAttribute ( COMPONENTS ) ; return ( T ) components . get ( descriptor ) ; |
public class QuerySources { /** * Return an iterator over all nodes at or below the specified path in the named workspace , using the supplied filter .
* @ param workspaceName the name of the workspace
* @ param path the path of the root node of the subgraph , or null if all nodes in the workspace are to be included
* @ return the iterator , or null if this workspace will return no nodes */
protected NodeCacheIterator nodes ( String workspaceName , Path path ) { } } | // Determine which filter we should use based upon the workspace name . For the system workspace ,
// all queryable nodes are included . For all other workspaces , all queryable nodes are included except
// for those that are actually stored in the system workspace ( e . g . , the " / jcr : system " nodes ) .
NodeFilter nodeFilterForWorkspace = nodeFilterForWorkspace ( workspaceName ) ; if ( nodeFilterForWorkspace == null ) return null ; // always append a shared nodes filter to the end of the workspace filter ,
// JCR # 14.16 - If a query matches a descendant node of a shared set , it appears in query results only once .
NodeFilter compositeFilter = new CompositeNodeFilter ( nodeFilterForWorkspace , sharedNodesFilter ( ) ) ; // Then create an iterator over that workspace . . .
NodeCache cache = repo . getWorkspaceCache ( workspaceName ) ; NodeKey startingNode = null ; if ( path != null ) { CachedNode node = getNodeAtPath ( path , cache ) ; if ( node != null ) startingNode = node . getKey ( ) ; } else { startingNode = cache . getRootKey ( ) ; } if ( startingNode != null ) { return new NodeCacheIterator ( cache , startingNode , compositeFilter ) ; } return null ; |
public class JMFiles { /** * Create empty file boolean .
* @ param file the file
* @ return the boolean */
public static boolean createEmptyFile ( File file ) { } } | try { file . getParentFile ( ) . mkdirs ( ) ; return file . createNewFile ( ) ; } catch ( Exception e ) { return JMExceptionManager . handleExceptionAndReturnFalse ( log , e , "createEmptyFile" , file ) ; } |
public class LambdaFactoryConfiguration { /** * Adds imports that will be visible in the lambda code . To add an import with * wildcard
* please use { @ link # withImports ( String . . . ) } . */
public LambdaFactoryConfiguration withImports ( Class < ? > ... newImports ) { } } | String [ ] stringImports = Arrays . stream ( newImports ) . map ( Class :: getCanonicalName ) . toArray ( String [ ] :: new ) ; return withImports ( stringImports ) ; |
public class TextBuffer { /** * Method that needs to be called to configure given base64 decoder
* with textual contents collected by this buffer .
* @ param dec Decoder that will need data
* @ param firstChunk Whether this is the first segment fed or not ;
* if it is , state needs to be fullt reset ; if not , only partially . */
public void initBinaryChunks ( Base64Variant v , CharArrayBase64Decoder dec , boolean firstChunk ) { } } | if ( mInputStart < 0 ) { // non - shared
dec . init ( v , firstChunk , mCurrentSegment , 0 , mCurrentSize , mSegments ) ; } else { // shared
dec . init ( v , firstChunk , mInputBuffer , mInputStart , mInputLen , null ) ; } |
public class JesqueUtils { /** * Creates a Map . Entry out of the given key and value . Commonly used in
* conjunction with map ( Entry . . . )
* @ param < K > the key type
* @ param < V > the value type
* @ param key
* the key
* @ param value
* the value
* @ return a Map . Entry object with the given key and value */
public static < K , V > Entry < K , V > entry ( final K key , final V value ) { } } | return new SimpleImmutableEntry < K , V > ( key , value ) ; |
public class NumberFormatContext { /** * Convert the given value to a { @ link Double } . If the value is not in a
* valid numeric format , then a default value is returned .
* @ param value The value to convert
* @ return The converted numeric value
* @ see # isDouble ( String )
* @ see Double # valueOf ( String ) */
public Double convertStringToDouble ( String value ) { } } | Double result ; try { result = Double . valueOf ( value ) ; } catch ( NumberFormatException e ) { result = DEFAULT_DOUBLE_VALUE ; } return result ; |
public class TypeDesc { /** * Acquire a TypeDesc from any class , including primitives and arrays . */
public synchronized static TypeDesc forClass ( Class < ? > clazz ) { } } | if ( clazz == null ) { return null ; } TypeDesc type = cClassesToInstances . get ( clazz ) ; if ( type != null ) { return type ; } if ( clazz . isArray ( ) ) { type = forClass ( clazz . getComponentType ( ) ) . toArrayType ( ) ; } else if ( clazz . isPrimitive ( ) ) { if ( clazz == int . class ) { type = INT ; } if ( clazz == boolean . class ) { type = BOOLEAN ; } if ( clazz == char . class ) { type = CHAR ; } if ( clazz == byte . class ) { type = BYTE ; } if ( clazz == long . class ) { type = LONG ; } if ( clazz == float . class ) { type = FLOAT ; } if ( clazz == double . class ) { type = DOUBLE ; } if ( clazz == short . class ) { type = SHORT ; } if ( clazz == void . class ) { type = VOID ; } } else { String name = clazz . getName ( ) ; type = intern ( new ObjectType ( generateDescriptor ( name ) , name ) ) ; } cClassesToInstances . put ( clazz , type ) ; return type ; |
public class Vectors { /** * Creates a mod function that calculates the modulus of it ' s argument and given { @ code value } .
* @ param arg a divisor value
* @ return a closure that does { @ code _ % _ } */
public static VectorFunction asModFunction ( final double arg ) { } } | return new VectorFunction ( ) { @ Override public double evaluate ( int i , double value ) { return value % arg ; } } ; |
public class Weighted { /** * High weights first , use val . hashCode to break ties */
public int compareTo ( Weighted < DirectedEdge > other ) { } } | return ComparisonChain . start ( ) . compare ( other . weight , weight ) . compare ( Objects . hashCode ( other . val ) , Objects . hashCode ( val ) ) . result ( ) ; |
public class MemoryLimiter { /** * This method attempts to claim ram to the provided request . This may block waiting for some to
* be available . Ultimately it is either granted memory or an exception is thrown .
* @ param toClaimMb The amount of memory the request wishes to claim . ( In Megabytes )
* @ return The amount of memory which was claimed . ( This may be different from the amount
* requested . ) This value needs to be passed to { @ link # release } when the request exits .
* @ throws RejectRequestException If the request should be rejected because it could not be given
* the resources requested . */
public long claim ( long toClaimMb ) throws RejectRequestException { } } | Preconditions . checkArgument ( toClaimMb >= 0 ) ; if ( toClaimMb == 0 ) { return 0 ; } int neededForRequest = capRequestedSize ( toClaimMb ) ; boolean acquired = false ; try { acquired = amountRemaining . tryAcquire ( neededForRequest , TIME_TO_WAIT , TimeUnit . MILLISECONDS ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; throw new RejectRequestException ( "Was interupted" , e ) ; } int remaining = amountRemaining . availablePermits ( ) ; if ( acquired ) { log . info ( "Target available memory was " + ( neededForRequest + remaining ) + "mb is now " + remaining + "mb" ) ; return neededForRequest ; } else { throw new RejectRequestException ( "Not enough estimated memory for request: " + ( neededForRequest ) + "mb only have " + remaining + "mb remaining out of " + TOTAL_CLAIMABLE_MEMORY_SIZE_MB + "mb" ) ; } |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcCartesianPointList ( ) { } } | if ( ifcCartesianPointListEClass == null ) { ifcCartesianPointListEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 78 ) ; } return ifcCartesianPointListEClass ; |
public class GetConfKey { /** * Prints the help message .
* @ param message message before standard usage information */
public static void printHelp ( String message ) { } } | System . err . println ( message ) ; System . out . println ( USAGE ) ; |
public class FavoriteDatabase { /** * Inserts an Article object to this database .
* @ param article Object to save into database . */
public void add ( Article article ) { } } | // Get Write Access
SQLiteDatabase db = this . getWritableDatabase ( ) ; // Build Content Values
ContentValues values = new ContentValues ( ) ; values . put ( KEY_TAGS , TextUtils . join ( "_PCX_" , article . getTags ( ) ) ) ; values . put ( KEY_MEDIA_CONTENT , Article . MediaContent . toByteArray ( article . getMediaContent ( ) ) ) ; values . put ( KEY_SOURCE , article . getSource ( ) . toString ( ) ) ; values . put ( KEY_IMAGE , article . getImage ( ) . toString ( ) ) ; values . put ( KEY_TITLE , article . getTitle ( ) ) ; values . put ( KEY_DESCRIPTION , article . getDescription ( ) ) ; values . put ( KEY_CONTENT , article . getContent ( ) ) ; values . put ( KEY_COMMENTS , article . getComments ( ) ) ; values . put ( KEY_AUTHOR , article . getAuthor ( ) ) ; values . put ( KEY_DATE , article . getDate ( ) ) ; values . put ( KEY_ID , article . getId ( ) ) ; // Insert & Close
db . insert ( TABLE_ARTICLES , null , values ) ; db . close ( ) ; |
public class ObjectsApi { /** * Get permissions for a list of objects .
* Get permissions from Configuration Server for objects identified by their type and DBIDs .
* @ param objectType The type of object . Any type supported by the Config server ( folders , business - attributes etc ) . ( required )
* @ param dbids Comma - separated list of object DBIDs to query permissions . ( required )
* @ param dnType If the object _ type is & # 39 ; dns & # 39 ; , then you may specify the DN type ( for example , CFGRoutingPoint ) . This parameter does not affect request results but may increase performance For possible values , see [ CfgDNType ] ( https : / / docs . genesys . com / Documentation / PSDK / 9.0 . x / ConfigLayerRef / CfgDNType ) in the Platform SDK documentation . ( optional )
* @ param folderType If the object _ type is & # 39 ; folders & # 39 ; , then you may specify the object type of the folders ( for example , CFGPerson ) . This parameter does not affect request results but may increase performance For possible values , see [ CfgObjectType ] ( https : / / docs . genesys . com / Documentation / PSDK / 9.0 . x / ConfigLayerRef / CfgObjectType ) in the Platform SDK documentation . ( optional )
* @ return ApiResponse & lt ; GetPermissionsSuccessResponse & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < GetPermissionsSuccessResponse > getPermissionsWithHttpInfo ( String objectType , String dbids , String dnType , String folderType ) throws ApiException { } } | com . squareup . okhttp . Call call = getPermissionsValidateBeforeCall ( objectType , dbids , dnType , folderType , null , null ) ; Type localVarReturnType = new TypeToken < GetPermissionsSuccessResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class BindDataSourceBuilder { /** * Generate inner code for instance and build methods . Inspired by < a href =
* " https : / / www . journaldev . com / 171 / thread - safety - in - java - singleton - classes - with - example - code " > this
* link < < / a >
* @ param schema
* the schema
* @ param schemaName
* the schema name
* @ param instance
* the instance */
private void generateInstanceOrBuild ( SQLiteDatabaseSchema schema , String schemaName , boolean instance ) { } } | // instance
MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( instance ? "getInstance" : "build" ) . addModifiers ( Modifier . PUBLIC , Modifier . STATIC ) . returns ( className ( schemaName ) ) ; if ( ! instance ) { methodBuilder . addParameter ( DataSourceOptions . class , "options" ) ; methodBuilder . addJavadoc ( "<p>Build instance. This method can be used only one time, on the application start.</p>\n" ) ; } else { methodBuilder . addJavadoc ( "<p>Retrieve instance.</p>\n" ) ; } methodBuilder . addStatement ( "$T result=instance" , className ( schemaName ) ) ; methodBuilder . beginControlFlow ( "if (result==null)" ) ; methodBuilder . beginControlFlow ( "synchronized(mutex)" ) ; methodBuilder . addStatement ( "result=instance" ) ; methodBuilder . beginControlFlow ( "if (result==null)" ) ; if ( instance ) { methodBuilder . addCode ( "$T options=$T.builder()" , DataSourceOptions . class , DataSourceOptions . class ) ; if ( schema . configCursorFactoryClazz != null ) { methodBuilder . addCode ( "\n\t.cursorFactory(new $T())" , TypeUtility . className ( schema . configCursorFactoryClazz ) ) ; } if ( schema . configDatabaseErrorHandlerClazz != null ) { methodBuilder . addCode ( "\n\t.errorHandler(new $T())" , TypeUtility . className ( schema . configDatabaseErrorHandlerClazz ) ) ; } if ( schema . configDatabaseLifecycleHandlerClazz != null ) { methodBuilder . addCode ( "\n\t.databaseLifecycleHandler(new $T())" , TypeUtility . className ( schema . configDatabaseLifecycleHandlerClazz ) ) ; } if ( schema . configPopulatorClazz != null ) { methodBuilder . addCode ( "\n\t.populator(new $T())" , TypeUtility . className ( schema . configPopulatorClazz ) ) ; } methodBuilder . addCode ( "\n\t.inMemory($L)" , schema . configInMemory ) ; methodBuilder . addCode ( "\n\t.log($L)" , schema . configLogEnabled ) ; if ( schema . configUpdateTasks != null && schema . configUpdateTasks . size ( ) > 0 ) { for ( Pair < Integer , String > task : schema . configUpdateTasks ) { methodBuilder . addCode ( "\n\t.addUpdateTask($L, new $T())" , task . value0 , TypeUtility . className ( task . value1 ) ) ; } } methodBuilder . addCode ( "\n\t.build();\n" , DataSourceOptions . class , DataSourceOptions . class ) ; } methodBuilder . addStatement ( "instance=result=new $L(options)" , schemaName ) ; generatePopulate ( schema , methodBuilder , instance ) ; if ( ! instance ) { methodBuilder . nextControlFlow ( "else" ) ; methodBuilder . addStatement ( "throw new $T($S)" , KriptonRuntimeException . class , "Datasource " + schemaName + " is already builded" ) ; } methodBuilder . endControlFlow ( ) ; methodBuilder . endControlFlow ( ) ; if ( ! instance ) { methodBuilder . nextControlFlow ( "else" ) ; methodBuilder . addStatement ( "throw new $T($S)" , KriptonRuntimeException . class , "Datasource " + schemaName + " is already builded" ) ; } methodBuilder . endControlFlow ( ) ; methodBuilder . addCode ( "return result;\n" ) ; classBuilder . addMethod ( methodBuilder . build ( ) ) ; |
public class ProposalLineItem { /** * Gets the linkStatus value for this ProposalLineItem .
* @ return linkStatus * The status of the link between this { @ code ProposalLineItem }
* and its { link Product } .
* < span class = " constraint Applicable " > This attribute
* is applicable when : < ul > < li > using programmatic guaranteed , using sales
* management . < / li > < li > not using programmatic , using sales management . < / li > < / ul > < / span >
* < span class = " constraint ReadOnly " > This attribute is read - only when : < ul > < li > using
* programmatic guaranteed , using sales management . < / li > < li > not using
* programmatic , using sales management . < / li > < / ul > < / span > */
public com . google . api . ads . admanager . axis . v201805 . LinkStatus getLinkStatus ( ) { } } | return linkStatus ; |
public class EncryptedPrivateKeyWriter { /** * Encrypt the given { @ link PrivateKey } with the given password and return the resulted byte
* array .
* @ param privateKey
* the private key to encrypt
* @ param password
* the password
* @ return the byte [ ]
* @ throws NoSuchAlgorithmException
* is thrown if instantiation of the SecretKeyFactory object fails .
* @ throws InvalidKeySpecException
* is thrown if generation of the SecretKey object fails .
* @ throws NoSuchPaddingException
* the no such padding exception
* @ throws InvalidKeyException
* is thrown if initialization of the cipher object fails
* @ throws InvalidAlgorithmParameterException
* is thrown if initialization of the cypher object fails .
* @ throws IllegalBlockSizeException
* the illegal block size exception
* @ throws BadPaddingException
* the bad padding exception
* @ throws InvalidParameterSpecException
* the invalid parameter spec exception
* @ throws IOException
* Signals that an I / O exception has occurred . */
public static byte [ ] encryptPrivateKeyWithPassword ( final PrivateKey privateKey , final String password ) throws NoSuchAlgorithmException , InvalidKeySpecException , NoSuchPaddingException , InvalidKeyException , InvalidAlgorithmParameterException , IllegalBlockSizeException , BadPaddingException , InvalidParameterSpecException , IOException { } } | final byte [ ] privateKeyEncoded = privateKey . getEncoded ( ) ; final SecureRandom random = new SecureRandom ( ) ; final byte [ ] salt = new byte [ 8 ] ; random . nextBytes ( salt ) ; final AlgorithmParameterSpec algorithmParameterSpec = AlgorithmParameterSpecFactory . newPBEParameterSpec ( salt , 20 ) ; final SecretKey secretKey = SecretKeyFactoryExtensions . newSecretKey ( password . toCharArray ( ) , CompoundAlgorithm . PBE_WITH_SHA1_AND_DES_EDE . getAlgorithm ( ) ) ; final Cipher pbeCipher = Cipher . getInstance ( CompoundAlgorithm . PBE_WITH_SHA1_AND_DES_EDE . getAlgorithm ( ) ) ; pbeCipher . init ( Cipher . ENCRYPT_MODE , secretKey , algorithmParameterSpec ) ; final byte [ ] ciphertext = pbeCipher . doFinal ( privateKeyEncoded ) ; final AlgorithmParameters algparms = AlgorithmParameters . getInstance ( CompoundAlgorithm . PBE_WITH_SHA1_AND_DES_EDE . getAlgorithm ( ) ) ; algparms . init ( algorithmParameterSpec ) ; final EncryptedPrivateKeyInfo encinfo = new EncryptedPrivateKeyInfo ( algparms , ciphertext ) ; return encinfo . getEncoded ( ) ; |
public class DefaultJobSpecScheduleImpl { /** * Creates a schedule denoting that the job is not to be executed */
public static DefaultJobSpecScheduleImpl createNoSchedule ( JobSpec jobSpec , Runnable jobRunnable ) { } } | return new DefaultJobSpecScheduleImpl ( jobSpec , jobRunnable , Optional . < Long > absent ( ) ) ; |
public class MultiUserChatManager { /** * Check if the provided domain bare JID provides a MUC service .
* @ param domainBareJid the domain bare JID to check .
* @ return < code > true < / code > if the provided JID provides a MUC service , < code > false < / code > otherwise .
* @ throws NoResponseException
* @ throws XMPPErrorException
* @ throws NotConnectedException
* @ throws InterruptedException
* @ see < a href = " http : / / xmpp . org / extensions / xep - 0045 . html # disco - service - features " > XEP - 45 § 6.2 Discovering the Features Supported by a MUC Service < / a >
* @ since 4.2 */
public boolean providesMucService ( DomainBareJid domainBareJid ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } } | return serviceDiscoveryManager . supportsFeature ( domainBareJid , MUCInitialPresence . NAMESPACE ) ; |
public class CmsDriverManager { /** * Deletes a resource . < p >
* The < code > siblingMode < / code > parameter controls how to handle siblings
* during the delete operation .
* Possible values for this parameter are :
* < ul >
* < li > < code > { @ link CmsResource # DELETE _ REMOVE _ SIBLINGS } < / code > < / li >
* < li > < code > { @ link CmsResource # DELETE _ PRESERVE _ SIBLINGS } < / code > < / li >
* < / ul > < p >
* @ param dbc the current database context
* @ param resource the name of the resource to delete ( full path )
* @ param siblingMode indicates how to handle siblings of the deleted resource
* @ throws CmsException if something goes wrong
* @ see CmsObject # deleteResource ( String , CmsResource . CmsResourceDeleteMode )
* @ see I _ CmsResourceType # deleteResource ( CmsObject , CmsSecurityManager , CmsResource , CmsResource . CmsResourceDeleteMode ) */
public void deleteResource ( CmsDbContext dbc , CmsResource resource , CmsResource . CmsResourceDeleteMode siblingMode ) throws CmsException { } } | // upgrade a potential inherited , non - shared lock into a common lock
CmsLock currentLock = getLock ( dbc , resource ) ; if ( currentLock . getEditionLock ( ) . isDirectlyInherited ( ) ) { // upgrade the lock status if required
lockResource ( dbc , resource , CmsLockType . EXCLUSIVE ) ; } // check if siblings of the resource exist and must be deleted as well
if ( resource . isFolder ( ) ) { // folder can have no siblings
siblingMode = CmsResource . DELETE_PRESERVE_SIBLINGS ; } // if selected , add all siblings of this resource to the list of resources to be deleted
boolean allSiblingsRemoved ; List < CmsResource > resources ; if ( siblingMode == CmsResource . DELETE_REMOVE_SIBLINGS ) { resources = new ArrayList < CmsResource > ( readSiblings ( dbc , resource , CmsResourceFilter . ALL ) ) ; allSiblingsRemoved = true ; // ensure that the resource requested to be deleted is the last resource that gets actually deleted
// to keep the shared locks of the siblings while those get deleted .
resources . remove ( resource ) ; resources . add ( resource ) ; } else { // only delete the resource , no siblings
resources = Collections . singletonList ( resource ) ; allSiblingsRemoved = false ; } int size = resources . size ( ) ; // if we have only one resource no further check is required
if ( size > 1 ) { CmsMultiException me = new CmsMultiException ( ) ; // ensure that each sibling is unlocked or locked by the current user
for ( int i = 0 ; i < size ; i ++ ) { CmsResource currentResource = resources . get ( i ) ; currentLock = getLock ( dbc , currentResource ) ; if ( ! currentLock . getEditionLock ( ) . isUnlocked ( ) && ! currentLock . isOwnedBy ( dbc . currentUser ( ) ) ) { // the resource is locked by a user different from the current user
CmsRequestContext context = dbc . getRequestContext ( ) ; me . addException ( new CmsLockException ( org . opencms . lock . Messages . get ( ) . container ( org . opencms . lock . Messages . ERR_SIBLING_LOCKED_2 , context . getSitePath ( currentResource ) , context . getSitePath ( resource ) ) ) ) ; } } if ( ! me . getExceptions ( ) . isEmpty ( ) ) { throw me ; } } boolean removeAce = true ; if ( resource . isFolder ( ) ) { // check if the folder has any resources in it
Iterator < CmsResource > childResources = getVfsDriver ( dbc ) . readChildResources ( dbc , dbc . currentProject ( ) , resource , true , true ) . iterator ( ) ; CmsUUID projectId = CmsProject . ONLINE_PROJECT_ID ; if ( dbc . currentProject ( ) . isOnlineProject ( ) ) { projectId = CmsUUID . getOpenCmsUUID ( ) ; // HACK : to get an offline project id
} // collect the names of the resources inside the folder , excluding the moved resources
StringBuffer errorResNames = new StringBuffer ( 128 ) ; while ( childResources . hasNext ( ) ) { CmsResource errorRes = childResources . next ( ) ; if ( errorRes . getState ( ) . isDeleted ( ) ) { continue ; } // if deleting offline , or not moved , or just renamed inside the deleted folder
// so , it may remain some orphan online entries for moved resources
// which will be fixed during the publishing of the moved resources
boolean error = ! dbc . currentProject ( ) . isOnlineProject ( ) ; if ( ! error ) { try { String originalPath = getVfsDriver ( dbc ) . readResource ( dbc , projectId , errorRes . getRootPath ( ) , true ) . getRootPath ( ) ; error = originalPath . equals ( errorRes . getRootPath ( ) ) || originalPath . startsWith ( resource . getRootPath ( ) ) ; } catch ( CmsVfsResourceNotFoundException e ) { // ignore
} } if ( error ) { if ( errorResNames . length ( ) != 0 ) { errorResNames . append ( ", " ) ; } errorResNames . append ( "[" + dbc . removeSiteRoot ( errorRes . getRootPath ( ) ) + "]" ) ; } } // the current implementation only deletes empty folders
if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( errorResNames . toString ( ) ) ) { throw new CmsVfsException ( org . opencms . db . generic . Messages . get ( ) . container ( org . opencms . db . generic . Messages . ERR_DELETE_NONEMTY_FOLDER_2 , dbc . removeSiteRoot ( resource . getRootPath ( ) ) , errorResNames . toString ( ) ) ) ; } } // delete all collected resources
for ( int i = 0 ; i < size ; i ++ ) { CmsResource currentResource = resources . get ( i ) ; // try to delete / remove the resource only if the user has write access to the resource
// check permissions only for the sibling , the resource it self was already checked or
// is to be removed without write permissions , ie . while deleting a folder
if ( ! currentResource . equals ( resource ) && ( I_CmsPermissionHandler . PERM_ALLOWED != m_securityManager . hasPermissions ( dbc , currentResource , CmsPermissionSet . ACCESS_WRITE , true , CmsResourceFilter . ALL ) ) ) { // no write access to sibling - must keep ACE ( see below )
allSiblingsRemoved = false ; } else { // write access to sibling granted
boolean existsOnline = ( getVfsDriver ( dbc ) . validateStructureIdExists ( dbc , CmsProject . ONLINE_PROJECT_ID , currentResource . getStructureId ( ) ) || ! ( currentResource . getState ( ) . equals ( CmsResource . STATE_NEW ) ) ) ; if ( ! existsOnline ) { // the resource does not exist online = > remove the resource
// this means the resource is " new " ( blue ) in the offline project
// delete all properties of this resource
deleteAllProperties ( dbc , currentResource . getRootPath ( ) ) ; if ( currentResource . isFolder ( ) ) { getVfsDriver ( dbc ) . removeFolder ( dbc , dbc . currentProject ( ) , currentResource ) ; } else { // check labels
if ( currentResource . isLabeled ( ) && ! labelResource ( dbc , currentResource , null , 2 ) ) { // update the resource flags to " un label " the other siblings
int flags = currentResource . getFlags ( ) ; flags &= ~ CmsResource . FLAG_LABELED ; currentResource . setFlags ( flags ) ; } getVfsDriver ( dbc ) . removeFile ( dbc , dbc . currentProject ( ) . getUuid ( ) , currentResource ) ; } // ensure an exclusive lock is removed in the lock manager for a deleted new resource ,
// otherwise it would " stick " in the lock manager , preventing other users from creating
// a file with the same name ( issue with temp files in editor )
m_lockManager . removeDeletedResource ( dbc , currentResource . getRootPath ( ) ) ; // delete relations
getVfsDriver ( dbc ) . deleteRelations ( dbc , dbc . currentProject ( ) . getUuid ( ) , currentResource , CmsRelationFilter . TARGETS ) ; getVfsDriver ( dbc ) . deleteUrlNameMappingEntries ( dbc , false , CmsUrlNameMappingFilter . ALL . filterStructureId ( currentResource . getStructureId ( ) ) ) ; getVfsDriver ( dbc ) . deleteAliases ( dbc , dbc . currentProject ( ) , new CmsAliasFilter ( null , null , currentResource . getStructureId ( ) ) ) ; } else { // the resource exists online = > mark the resource as deleted
// structure record is removed during next publish
// if one ( or more ) siblings are not removed , the ACE can not be removed
removeAce = false ; // set resource state to deleted
currentResource . setState ( CmsResource . STATE_DELETED ) ; getVfsDriver ( dbc ) . writeResourceState ( dbc , dbc . currentProject ( ) , currentResource , UPDATE_STRUCTURE , false ) ; // update the project ID
getVfsDriver ( dbc ) . writeLastModifiedProjectId ( dbc , dbc . currentProject ( ) , dbc . currentProject ( ) . getUuid ( ) , currentResource ) ; // log it
log ( dbc , new CmsLogEntry ( dbc , currentResource . getStructureId ( ) , CmsLogEntryType . RESOURCE_DELETED , new String [ ] { currentResource . getRootPath ( ) } ) , true ) ; } } } if ( ( resource . getSiblingCount ( ) <= 1 ) || allSiblingsRemoved ) { if ( removeAce ) { // remove the access control entries
getUserDriver ( dbc ) . removeAccessControlEntries ( dbc , dbc . currentProject ( ) , resource . getResourceId ( ) ) ; } } // flush all caches
m_monitor . clearAccessControlListCache ( ) ; m_monitor . flushCache ( CmsMemoryMonitor . CacheType . PROPERTY , CmsMemoryMonitor . CacheType . PROPERTY_LIST , CmsMemoryMonitor . CacheType . PROJECT_RESOURCES ) ; Map < String , Object > eventData = new HashMap < String , Object > ( ) ; eventData . put ( I_CmsEventListener . KEY_RESOURCES , resources ) ; eventData . put ( I_CmsEventListener . KEY_DBCONTEXT , dbc ) ; OpenCms . fireCmsEvent ( new CmsEvent ( I_CmsEventListener . EVENT_RESOURCE_DELETED , eventData ) ) ; |
public class hqlParser { /** * hql . g : 262:1 : newExpression : ( NEW path ) op = OPEN selectedPropertiesList CLOSE - > ^ ( CONSTRUCTOR [ $ op ] path selectedPropertiesList ) ; */
public final hqlParser . newExpression_return newExpression ( ) throws RecognitionException { } } | hqlParser . newExpression_return retval = new hqlParser . newExpression_return ( ) ; retval . start = input . LT ( 1 ) ; CommonTree root_0 = null ; Token op = null ; Token NEW50 = null ; Token CLOSE53 = null ; ParserRuleReturnScope path51 = null ; ParserRuleReturnScope selectedPropertiesList52 = null ; CommonTree op_tree = null ; CommonTree NEW50_tree = null ; CommonTree CLOSE53_tree = null ; RewriteRuleTokenStream stream_NEW = new RewriteRuleTokenStream ( adaptor , "token NEW" ) ; RewriteRuleTokenStream stream_OPEN = new RewriteRuleTokenStream ( adaptor , "token OPEN" ) ; RewriteRuleTokenStream stream_CLOSE = new RewriteRuleTokenStream ( adaptor , "token CLOSE" ) ; RewriteRuleSubtreeStream stream_path = new RewriteRuleSubtreeStream ( adaptor , "rule path" ) ; RewriteRuleSubtreeStream stream_selectedPropertiesList = new RewriteRuleSubtreeStream ( adaptor , "rule selectedPropertiesList" ) ; try { // hql . g : 263:2 : ( ( NEW path ) op = OPEN selectedPropertiesList CLOSE - > ^ ( CONSTRUCTOR [ $ op ] path selectedPropertiesList ) )
// hql . g : 263:4 : ( NEW path ) op = OPEN selectedPropertiesList CLOSE
{ // hql . g : 263:4 : ( NEW path )
// hql . g : 263:5 : NEW path
{ NEW50 = ( Token ) match ( input , NEW , FOLLOW_NEW_in_newExpression1058 ) ; stream_NEW . add ( NEW50 ) ; pushFollow ( FOLLOW_path_in_newExpression1060 ) ; path51 = path ( ) ; state . _fsp -- ; stream_path . add ( path51 . getTree ( ) ) ; } op = ( Token ) match ( input , OPEN , FOLLOW_OPEN_in_newExpression1065 ) ; stream_OPEN . add ( op ) ; pushFollow ( FOLLOW_selectedPropertiesList_in_newExpression1067 ) ; selectedPropertiesList52 = selectedPropertiesList ( ) ; state . _fsp -- ; stream_selectedPropertiesList . add ( selectedPropertiesList52 . getTree ( ) ) ; CLOSE53 = ( Token ) match ( input , CLOSE , FOLLOW_CLOSE_in_newExpression1069 ) ; stream_CLOSE . add ( CLOSE53 ) ; // AST REWRITE
// elements : selectedPropertiesList , path
// token labels :
// rule labels : retval
// token list labels :
// rule list labels :
// wildcard labels :
retval . tree = root_0 ; RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream ( adaptor , "rule retval" , retval != null ? retval . getTree ( ) : null ) ; root_0 = ( CommonTree ) adaptor . nil ( ) ; // 264:3 : - > ^ ( CONSTRUCTOR [ $ op ] path selectedPropertiesList )
{ // hql . g : 264:6 : ^ ( CONSTRUCTOR [ $ op ] path selectedPropertiesList )
{ CommonTree root_1 = ( CommonTree ) adaptor . nil ( ) ; root_1 = ( CommonTree ) adaptor . becomeRoot ( adaptor . create ( CONSTRUCTOR , op ) , root_1 ) ; adaptor . addChild ( root_1 , stream_path . nextTree ( ) ) ; adaptor . addChild ( root_1 , stream_selectedPropertiesList . nextTree ( ) ) ; adaptor . addChild ( root_0 , root_1 ) ; } } retval . tree = root_0 ; } retval . stop = input . LT ( - 1 ) ; retval . tree = ( CommonTree ) adaptor . rulePostProcessing ( root_0 ) ; adaptor . setTokenBoundaries ( retval . tree , retval . start , retval . stop ) ; } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; retval . tree = ( CommonTree ) adaptor . errorNode ( input , retval . start , input . LT ( - 1 ) , re ) ; } finally { // do for sure before leaving
} return retval ; |
public class DataStore { /** * Add a data row , consisting of one column , to the store at the current time .
* See { @ link # add ( long , Map ) } for more information .
* @ param column The column for a field to value mapping
* @ param value The value for a field to value mapping */
public void add ( String column , Object value ) { } } | add ( System . currentTimeMillis ( ) , column , value ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.