signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class Enter { /** * The scope in which a member definition in environment env is to be entered * This is usually the environment ' s scope , except for class environments , * where the local scope is for type variables , and the this and super symbol * only , and members go into the class member scope . */...
return ( env . tree . hasTag ( JCTree . Tag . CLASSDEF ) ) ? ( ( JCClassDecl ) env . tree ) . sym . members_field : env . info . scope ;
public class HttpParser { private boolean handleHeaderContentMessage ( ) { } }
boolean handle_header = _handler . headerComplete ( ) ; _headerComplete = true ; boolean handle_content = _handler . contentComplete ( ) ; boolean handle_message = _handler . messageComplete ( ) ; return handle_header || handle_content || handle_message ;
public class Builder { /** * Generates a new key chain with entropy selected randomly from the given { @ link SecureRandom } * object and of the requested size in bits . The derived seed is further protected with a user selected passphrase * ( see BIP 39 ) . * @ param random the random number generator - use new ...
this . random = random ; this . bits = bits ; return self ( ) ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcProjectedCRS ( ) { } }
if ( ifcProjectedCRSEClass == null ) { ifcProjectedCRSEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 462 ) ; } return ifcProjectedCRSEClass ;
public class JsonFluentAssert { /** * Compares JSON structure . Ignores values , only compares shape of the document and key names . * Is too lenient , ignores types , prefer IGNORING _ VALUES option instead . * @ param expected * @ return { @ code this } object . * @ deprecated Use IGNORING _ VALUES option ins...
Diff diff = createDiff ( expected , configuration . withOptions ( COMPARING_ONLY_STRUCTURE ) ) ; diff . failIfDifferent ( ) ; return this ;
public class TileCache { /** * Returns a buffered image for the requested URI from the cache . This method must return null if the image is not * in the cache . If the image is unavailable but it ' s compressed version * is * available , then the compressed version * will be expanded and returned . * @ param uri ...
synchronized ( imgmap ) { if ( imgmap . containsKey ( uri ) ) { imgmapAccessQueue . remove ( uri ) ; imgmapAccessQueue . addLast ( uri ) ; return imgmap . get ( uri ) ; } } synchronized ( bytemap ) { if ( bytemap . containsKey ( uri ) ) { log ( "retrieving from bytes" ) ; bytemapAccessQueue . remove ( uri ) ; bytemapAc...
public class StatsFactory { /** * Create a StatsInstance using the Stats template and add to the PMI tree at the root level . * This method will associate the MBean provided by the caller to the Stats instance . * @ param instanceName name of the instance * @ param statsTemplate location of the Stats template XML...
if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , new StringBuffer ( "createStatsInstance:name=" ) . append ( instanceName ) . append ( ";template=" ) . append ( statsTemplate ) . append ( ";mBean=" ) . append ( ( mBean == null ) ? null : mBean . toString ( ) ) . toString ( ) ) ; checkPMIService ( instanceName ) ; Stats...
public class TargetSslProxyClient { /** * Deletes the specified TargetSslProxy resource . * < p > Sample code : * < pre > < code > * try ( TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient . create ( ) ) { * ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName . of ( "...
DeleteTargetSslProxyHttpRequest request = DeleteTargetSslProxyHttpRequest . newBuilder ( ) . setTargetSslProxy ( targetSslProxy ) . build ( ) ; return deleteTargetSslProxy ( request ) ;
public class MainRepository { /** * Checks for a valid response code and throws and exception with the response code if an error * @ param connection * @ throws RepositoryHttpException * @ throws IOException */ private static void checkHttpResponseCodeValid ( URLConnection connection ) throws RepositoryHttpExcept...
// if HTTP URL not File URL if ( connection instanceof HttpURLConnection ) { HttpURLConnection conn = ( HttpURLConnection ) connection ; conn . setRequestMethod ( "GET" ) ; int respCode = conn . getResponseCode ( ) ; if ( respCode < 200 || respCode >= 300 ) { throw new RepositoryHttpException ( "HTTP connection returne...
public class JsonUtils { /** * Encode the measurements to a JSON payload that can be sent to the aggregator . */ static byte [ ] encode ( Map < String , String > commonTags , List < Measurement > measurements ) throws IOException { } }
ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; JsonGenerator gen = FACTORY . createGenerator ( baos ) ; gen . writeStartArray ( ) ; Map < String , Integer > strings = buildStringTable ( gen , commonTags , measurements ) ; for ( Measurement m : measurements ) { appendMeasurement ( gen , strings , commonTag...
public class ConvolveImageNormalized { /** * Performs a 2D normalized convolution across the image . * @ param src The original image . Not modified . * @ param dst Where the resulting image is written to . Modified . * @ param kernel The kernel that is being convolved . Not modified . */ public static void convo...
InputSanityCheck . checkSameShape ( src , dst ) ; boolean processed = BOverrideConvolveImageNormalized . invokeNativeConvolve ( kernel , src , dst ) ; if ( ! processed ) { if ( kernel . width >= src . width || kernel . width >= src . height ) { ConvolveNormalizedNaive_SB . convolve ( kernel , src , dst ) ; } else { Con...
public class TLVInputStream { /** * Reads the next TLV element from the stream . * @ return Instance of { @ link TLVElement } . * @ throws IOException * when reading from underlying stream fails . * @ throws TLVParserException * when input stream is null . */ public TLVElement readElement ( ) throws IOExcepti...
TlvHeader header = readHeader ( ) ; TLVElement element = new TLVElement ( header . tlv16 , header . nonCritical , header . forwarded , header . type ) ; int count = countNestedTlvElements ( header ) ; if ( count > 0 ) { readNestedElements ( element , count ) ; } else { element . setContent ( readTlvContent ( header ) )...
public class ForwardingClient { /** * Stops a local listening socket from accepting connections . * @ param bindAddress * the listening address * @ param bindPort * the listening port * @ param killActiveTunnels * should any active tunnels be closed . */ public synchronized void stopLocalForwarding ( String...
String key = generateKey ( bindAddress , bindPort ) ; stopLocalForwarding ( key , killActiveTunnels ) ;
public class URI { /** * Initializes this URI from a base URI and a URI specification string . * See RFC 2396 Section 4 and Appendix B for specifications on parsing * the URI and Section 5 for specifications on resolving relative URIs * and relative paths . * @ param p _ base the base URI ( may be null if p _ u...
if ( p_base == null && ( p_uriSpec == null || p_uriSpec . trim ( ) . length ( ) == 0 ) ) { throw new MalformedURIException ( Utils . messages . createMessage ( MsgKey . ER_CANNOT_INIT_URI_EMPTY_PARMS , null ) ) ; // " Cannot initialize URI with empty parameters . " ) ; } // just make a copy of the base if spec is empty...
public class ServiceAdapters { /** * Returns factory which transforms blocking Service to asynchronous non - blocking ConcurrentService . It runs blocking operations from other thread from * executor . */ public static ServiceAdapter < BlockingService > forBlockingService ( ) { } }
return new SimpleServiceAdapter < BlockingService > ( ) { @ Override protected void start ( BlockingService instance ) throws Exception { instance . start ( ) ; } @ Override protected void stop ( BlockingService instance ) throws Exception { instance . stop ( ) ; } } ;
public class CmsHistoryVersion { /** * Converts a string to a CmsHistoryVersion . < p > * This is the inverse of toString ( ) . * @ param s the string from which to read the history version * @ return the history version */ public static CmsHistoryVersion fromString ( String s ) { } }
List < String > l = CmsStringUtil . splitAsList ( s , ":" ) ; if ( l . size ( ) == 2 ) { Integer ver = null ; try { ver = Integer . valueOf ( l . get ( 0 ) ) ; } catch ( Exception e ) { } OfflineOnline onlineStatus = "null" . equals ( "" + l . get ( 1 ) ) ? null : OfflineOnline . valueOf ( l . get ( 1 ) ) ; return new ...
public class Utils { /** * returns a vector i . e sequence of feature : value needs to have a pointer to * the Lexicon used during the creation of the document here we generate the * scores , taking into account the data in the lexicon */ private static String getVectorString ( Vector vector ) { } }
StringBuffer buffer = new StringBuffer ( ) ; int [ ] indices = vector . getIndices ( ) ; double [ ] values = vector . getValues ( ) ; for ( int i = 0 ; i < indices . length ; i ++ ) { buffer . append ( " " ) . append ( indices [ i ] ) . append ( ":" ) . append ( values [ i ] ) ; } return buffer . toString ( ) ;
public class XpathPayloadVariableExtractor { /** * Extract variables using Xpath expressions . */ public void extractVariables ( Message message , TestContext context ) { } }
if ( CollectionUtils . isEmpty ( xPathExpressions ) ) { return ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "Reading XML elements with XPath" ) ; } NamespaceContext nsContext = context . getNamespaceContextBuilder ( ) . buildContext ( message , namespaces ) ; for ( Entry < String , String > entry : xPathExpressi...
public class DateInterval { /** * / * [ deutsch ] * Liefert ein Zufallsdatum innerhalb dieses Intervalls . < / p > * @ return random date within this interval * @ throws IllegalStateException if this interval is infinite or empty or if there is no canonical form * @ see # toCanonical ( ) * @ since 5.0 */ publ...
DateInterval interval = this . toCanonical ( ) ; if ( interval . isFinite ( ) && ! interval . isEmpty ( ) ) { long randomNum = ThreadLocalRandom . current ( ) . nextLong ( interval . getStartAsCalendarDate ( ) . getDaysSinceEpochUTC ( ) , interval . getEndAsCalendarDate ( ) . getDaysSinceEpochUTC ( ) + 1 ) ; return Pla...
public class NullsoftID3GenreTable { /** * Return the corresponding String for the integer coded provided . Returns * null if the code returned is invalid ( less than 0 or greater than 125 ) . * @ param i the genre code * @ return the genre String or null if the genre code is invalid */ public static String getGe...
if ( ( i < GENRES . length ) && ( i >= 0 ) ) return GENRES [ i ] ; else return null ;
public class OIdentifiableIterator { /** * Read the current record and increment the counter if the record was found . * @ param iRecord * @ return */ protected ORecordInternal < ? > readCurrentRecord ( ORecordInternal < ? > iRecord , final int iMovement ) { } }
if ( limit > - 1 && browsedRecords >= limit ) // LIMIT REACHED return null ; current . clusterPosition += iMovement ; if ( iRecord != null ) { iRecord . setIdentity ( current ) ; iRecord = lowLevelDatabase . load ( iRecord , fetchPlan ) ; } else iRecord = lowLevelDatabase . load ( current , fetchPlan ) ; if ( iRecord !...
public class VerificationConditionGenerator { /** * Determine the set of used variables in a given set of expressions . A used * variable is one referred to by a VariableAccess expression . * @ param expression * @ return */ public Tuple < Decl . Variable > determineUsedVariables ( Tuple < WyilFile . Expr > exprs...
HashSet < Decl . Variable > used = new HashSet < > ( ) ; usedVariableExtractor . visitExpressions ( exprs , used ) ; return new Tuple < > ( used ) ;
public class RXTXCommPortAdapter { /** * This function returns the input stream to the COMM port . * @ return The input stream */ public InputStream getInputStream ( ) { } }
InputStream stream = null ; try { stream = this . commPort . getInputStream ( ) ; } catch ( IOException exception ) { throw new FaxException ( "Unable to extract input stream." , exception ) ; } return stream ;
public class StringFixture { /** * Converts the value to upper case . * @ param value value to put in upper case . * @ return value in capital letters . */ public String convertToUpperCase ( String value ) { } }
String result = null ; if ( value != null ) { result = value . toUpperCase ( ) ; } return result ;
public class ApiOvhEmaildomain { /** * Delete an existing redirection in server * REST : DELETE / email / domain / { domain } / redirection / { id } * @ param domain [ required ] Name of your domain name * @ param id [ required ] */ public OvhTaskSpecialAccount domain_redirection_id_DELETE ( String domain , Strin...
String qPath = "/email/domain/{domain}/redirection/{id}" ; StringBuilder sb = path ( qPath , domain , id ) ; String resp = exec ( qPath , "DELETE" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhTaskSpecialAccount . class ) ;
public class DbPersistenceManager { /** * { @ inheritDoc } */ public synchronized NodeReferences loadReferencesTo ( NodeId targetId ) throws NoSuchItemStateException , ItemStateException { } }
if ( ! initialized ) { throw new IllegalStateException ( "not initialized" ) ; } ResultSet rs = null ; InputStream in = null ; try { rs = conHelper . exec ( nodeReferenceSelectSQL , getKey ( targetId ) , false , 0 ) ; if ( ! rs . next ( ) ) { throw new NoSuchItemStateException ( targetId . toString ( ) ) ; } in = rs . ...
public class BaseWorkerContext { /** * - - - validate code - - - - - */ @ Override public ValidationResult validateCode ( String system , String code , String display ) { } }
Coding c = new Coding ( system , code , display ) ; return validateCode ( c , null ) ;
public class ChessboardCornerClusterToGrid { /** * A corner can be an origin if the corner ' s orientation ( a line between the two adjacent black squares ) and * the line splitting the direction to the two connecting nodes are the same . */ boolean isCornerValidOrigin ( Node candidate ) { } }
candidate . putEdgesIntoList ( edgeList ) ; if ( edgeList . size ( ) != 2 ) { throw new RuntimeException ( "BUG! Should be a corner and have two edges" ) ; } Node a = edgeList . get ( 0 ) ; Node b = edgeList . get ( 1 ) ; // Find the average angle from the two vectors defined by the two connected nodes double dirA = Ma...
public class Sentence { /** * Assumes that each token is tagged either 0 or 1 times */ private Mention getMention ( int tokenIndex ) { } }
Mention mention = null ; for ( Mention mention2 : mentions ) { if ( mention2 . contains ( tokenIndex ) ) if ( mention == null ) mention = mention2 ; else throw new IllegalArgumentException ( ) ; } return mention ;
public class PrcWebstorePage { /** * < p > Sort recursively catalogs in tree . < / p > * @ param pCurrentList Catalog List current */ public final void sortCatalogs ( final List < TradingCatalog > pCurrentList ) { } }
Collections . sort ( pCurrentList , this . cmprCatalogs ) ; for ( TradingCatalog tc : pCurrentList ) { if ( tc . getSubcatalogs ( ) . size ( ) > 0 ) { sortCatalogs ( tc . getSubcatalogs ( ) ) ; } }
public class ContentRange { /** * Parses the header value of a HTTP Range request * @ param rawRange raw range value as given by the header * @ param totalSize total size of the content * @ param maxNum maximal number of allowed ranges . Will throw exception if client requests more ranges . * @ return * @ thr...
List < ContentRange > result = new ArrayList < > ( ) ; if ( rawRange != null ) { if ( ! fullPattern . matcher ( rawRange ) . matches ( ) ) { throw new InvalidRangeException ( "invalid syntax" ) ; } rawRange = rawRange . substring ( "bytes=" . length ( ) , rawRange . length ( ) ) ; for ( String partRange : Splitter . on...
public class FlowNode { /** * Get the upstream node based on the max tca value . * @ param tcaIter the tca map . * @ param hacklengthIter the optional hacklength map , if available * it is used in cases with multiple equal in coming tcas . * @ return the upstream node . */ public FlowNode getUpstreamTcaBased ( ...
Direction [ ] orderedDirs = Direction . getOrderedDirs ( ) ; double maxTca = Double . NEGATIVE_INFINITY ; double maxHacklength = Double . NEGATIVE_INFINITY ; int maxCol = 0 ; int maxRow = 0 ; boolean gotOne = false ; for ( Direction direction : orderedDirs ) { int newCol = 0 ; int newRow = 0 ; switch ( direction ) { ca...
public class RuleBasedNumberFormat { /** * This extracts the special information from the rule sets before the * main parsing starts . Extra whitespace must have already been removed * from the description . If found , the special information is removed from the * description and returned , otherwise the descript...
String result = null ; int lp = description . indexOf ( specialName ) ; if ( lp != - 1 ) { // we ' ve got to make sure we ' re not in the middle of a rule // ( where specialName would actually get treated as // rule text ) if ( lp == 0 || description . charAt ( lp - 1 ) == ';' ) { // locate the beginning and end of the...
public class EditText { /** * Sets the maximum number of characters , the edit text should be allowed to contain . * @ param maxNumberOfCharacters * The maximum number of characters , which should be set , as an { @ link Integer } value . * The maximum number of characters must be at least 1 or - 1 , if the numbe...
if ( maxNumberOfCharacters != - 1 ) { Condition . INSTANCE . ensureAtLeast ( maxNumberOfCharacters , 1 , "The maximum number of characters must be at least 1" ) ; } this . maxNumberOfCharacters = maxNumberOfCharacters ; adaptMaxNumberOfCharactersMessage ( ) ;
public class DescribeOriginEndpointResult { /** * A list of source IP CIDR blocks that will be allowed to access the OriginEndpoint . * @ param whitelist * A list of source IP CIDR blocks that will be allowed to access the OriginEndpoint . */ public void setWhitelist ( java . util . Collection < String > whitelist ...
if ( whitelist == null ) { this . whitelist = null ; return ; } this . whitelist = new java . util . ArrayList < String > ( whitelist ) ;
public class Element { /** * Add quoted element Attributes and value . * @ param attribute String of HTML attribute tag * @ param value String value of the attribute to be quoted * @ return This Element so calls can be chained . */ public Element attribute ( String attribute , Object value ) { } }
if ( attributeMap == null ) attributeMap = new Hashtable ( 10 ) ; if ( value != null ) { if ( value instanceof String && ( ( String ) value ) . indexOf ( '"' ) != - 1 ) { String s = ( String ) value ; int q = 0 ; while ( ( q = s . indexOf ( '"' , q ) ) >= 0 ) { s = s . substring ( 0 , q ) + "&quot;" + s . substring ( +...
public class ModelNodeAdapter { /** * Turns a change set into a composite write attribute operation . * @ param resourceAddress the address * @ param changeSet the changed attributes * @ return composite operation */ public ModelNode fromChangeSet ( ResourceAddress resourceAddress , Map < String , Object > change...
ModelNode define = new ModelNode ( ) ; define . get ( ADDRESS ) . set ( resourceAddress ) ; define . get ( OP ) . set ( WRITE_ATTRIBUTE_OPERATION ) ; ModelNode undefine = new ModelNode ( ) ; undefine . get ( ADDRESS ) . set ( resourceAddress ) ; undefine . get ( OP ) . set ( UNDEFINE_ATTRIBUTE ) ; ModelNode operation =...
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link ArithType } { @ code > } } */ @ XmlElementDecl ( namespace = "http://www.w3.org/1998/Math/MathML" , name = "power" ) public JAXBElement < ArithType > createPower ( ArithType value ) { } }
return new JAXBElement < ArithType > ( _Power_QNAME , ArithType . class , null , value ) ;
public class Duration { /** * binäre Suche */ private static < U extends ChronoUnit > int getIndex ( ChronoUnit unit , List < Item < U > > list ) { } }
int low = 0 ; int high = list . size ( ) - 1 ; while ( low <= high ) { int mid = ( low + high ) >>> 1 ; ChronoUnit midUnit = list . get ( mid ) . getUnit ( ) ; int cmp = StdNormalizer . compare ( midUnit , unit ) ; if ( cmp < 0 ) { low = mid + 1 ; } else if ( cmp > 0 ) { high = mid - 1 ; } else { return mid ; // gefund...
public class ScopeContext { /** * return the session Scope for this context ( cfid , cftoken , contextname ) * @ param pc PageContext * @ return session matching the context * @ throws PageException */ public Session getSessionScope ( PageContext pc , RefBoolean isNew ) throws PageException { } }
if ( pc . getSessionType ( ) == Config . SESSION_TYPE_APPLICATION ) return getCFSessionScope ( pc , isNew ) ; return getJSessionScope ( pc , isNew ) ;
public class AmazonEC2Client { /** * Describes one or more VPC attachments . By default , all VPC attachments are described . Alternatively , you can * filter the results . * @ param describeTransitGatewayVpcAttachmentsRequest * @ return Result of the DescribeTransitGatewayVpcAttachments operation returned by the...
request = beforeClientExecution ( request ) ; return executeDescribeTransitGatewayVpcAttachments ( request ) ;
public class FileExecutor { /** * 批量复制文件夹 * @ param directories 文件夹路径数组 * @ param storageFolder 存储目录 * @ throws IOException 异常 */ public static void copyDirectories ( String [ ] directories , String storageFolder ) throws IOException { } }
copyDirectories ( getFiles ( directories ) , storageFolder ) ;
public class SMailPostingMessage { public void acceptSentTransport ( Transport transport ) { } }
if ( transport instanceof com . sun . mail . smtp . SMTPTransport ) { final com . sun . mail . smtp . SMTPTransport smtp = ( com . sun . mail . smtp . SMTPTransport ) transport ; lastReturnCode = smtp . getLastReturnCode ( ) ; lastServerResponse = smtp . getLastServerResponse ( ) ; }
public class SimpleCompareFileExtensions { /** * Compare files by length . * @ param sourceFile * the source file * @ param fileToCompare * the file to compare * @ return true if the length are equal , otherwise false . */ public static boolean compareFilesByLength ( final File sourceFile , final File fileToC...
return CompareFileExtensions . compareFiles ( sourceFile , fileToCompare , true , true , false , true , true , true ) . getLengthEquality ( ) ;
public class CsvToSqlExtensions { /** * Gets the csv file as sql insert script . * @ param tableName * the table name * @ param headers * the headers * @ param columnTypes * the column types * @ param lines * the lines * @ return the csv file as sql insert script */ public static String getCsvFileAsSq...
return getCsvFileAsSqlInsertScript ( tableName , new CsvBean ( headers , columnTypes , lines ) ) ;
public class MtasDataDoubleOperations { /** * ( non - Javadoc ) * @ see * mtas . codec . util . DataCollector . MtasDataOperations # add22 ( java . lang . Number , * java . lang . Number ) */ @ Override public Double add22 ( Double arg1 , Double arg2 ) { } }
if ( arg1 == null || arg2 == null ) { return Double . NaN ; } else { return arg1 + arg2 ; }
public class StatementCompiler { /** * Update the plan fragment and return the bytes of the plan */ static byte [ ] writePlanBytes ( VoltCompiler compiler , PlanFragment fragment , AbstractPlanNode planGraph ) throws VoltCompilerException { } }
String json = null ; // get the plan bytes PlanNodeList node_list = new PlanNodeList ( planGraph , false ) ; json = node_list . toJSONString ( ) ; compiler . captureDiagnosticJsonFragment ( json ) ; // Place serialized version of PlanNodeTree into a PlanFragment byte [ ] jsonBytes = json . getBytes ( Charsets . UTF_8 )...
public class RestClusterClient { /** * Requests the { @ link JobResult } for the given { @ link JobID } . The method retries multiple * times to poll the { @ link JobResult } before giving up . * @ param jobId specifying the job for which to retrieve the { @ link JobResult } * @ return Future which is completed w...
return pollResourceAsync ( ( ) -> { final JobMessageParameters messageParameters = new JobMessageParameters ( ) ; messageParameters . jobPathParameter . resolve ( jobId ) ; return sendRequest ( JobExecutionResultHeaders . getInstance ( ) , messageParameters ) ; } ) ;
public class SerialMessage { /** * Calculates a checksum for the specified buffer . * @ param buffer the buffer to calculate . * @ return the checksum value . */ private static byte calculateChecksum ( byte [ ] buffer ) { } }
byte checkSum = ( byte ) 0xFF ; for ( int i = 1 ; i < buffer . length - 1 ; i ++ ) { checkSum = ( byte ) ( checkSum ^ buffer [ i ] ) ; } logger . trace ( String . format ( "Calculated checksum = 0x%02X" , checkSum ) ) ; return checkSum ;
public class PropertyTypes { /** * Does a lookup if the given property data type has an associated translator * available . * The translator looked for is specified in the property map . An available translator * is implemented and can be used for translation . * @ param dataType property data type to lookup ...
final DPTID dpt = ( DPTID ) pt . get ( new Integer ( dataType ) ) ; if ( dpt != null ) try { final MainType t = TranslatorTypes . getMainType ( dpt . getMainNumber ( ) ) ; if ( t != null ) return t . getSubTypes ( ) . get ( dpt . getDPT ( ) ) != null ; } catch ( final NumberFormatException e ) { } catch ( final KNXExce...
public class AbstractCacheMap { /** * ( non - Javadoc ) * @ see java . util . Map # containsValue ( java . lang . Object ) */ @ Override public boolean containsValue ( Object value ) { } }
if ( value == null ) { throw new NullPointerException ( ) ; } for ( Map . Entry < K , CachedValue < K , V > > entry : map . entrySet ( ) ) { CachedValue < K , V > cachedValue = entry . getValue ( ) ; if ( cachedValue . getValue ( ) . equals ( value ) ) { if ( isValueExpired ( cachedValue ) ) { if ( map . remove ( cache...
public class SortedIntArrayList { /** * Adds all of the elements in the specified Collection and sorts during * the add . This may operate slowly as it is the same as individual * calls to the add method . */ @ Override public boolean addAll ( Collection < ? extends Integer > c ) { } }
Iterator < ? extends Integer > iter = c . iterator ( ) ; boolean didOne = false ; while ( iter . hasNext ( ) ) { add ( iter . next ( ) . intValue ( ) ) ; didOne = true ; } return didOne ;
public class DateUtils { /** * # func 获取当前时间当月的最后一天 < br > * @ author dulin */ public static Date getLastDayOfMonth ( Date date ) { } }
Calendar calendar = Calendar . getInstance ( ) ; calendar . setTime ( date ) ; int firstDay = calendar . getActualMaximum ( Calendar . DAY_OF_MONTH ) ; return org . apache . commons . lang . time . DateUtils . setDays ( date , firstDay ) ;
public class AuthorizationRequestManager { /** * Handles authentication challenges . * @ param jsonChallenges Collection of challenges . * @ param response Server response . */ private void startHandleChallenges ( JSONObject jsonChallenges , Response response ) { } }
ArrayList < String > challenges = getRealmsFromJson ( jsonChallenges ) ; MCAAuthorizationManager authManager = ( MCAAuthorizationManager ) BMSClient . getInstance ( ) . getAuthorizationManager ( ) ; if ( isAuthorizationRequired ( response ) ) { setExpectedAnswers ( challenges ) ; } for ( String realm : challenges ) { C...
public class CLRBufferedLogHandler { /** * Starts a thread to flush the log buffer on an interval . * This will ensure that logs get flushed periodically , even * if the log buffer is not full . */ private void startLogScheduler ( ) { } }
this . logScheduler . scheduleAtFixedRate ( new Runnable ( ) { @ Override public void run ( ) { CLRBufferedLogHandler . this . logAll ( ) ; } } , 0 , LOG_SCHEDULE_PERIOD , TimeUnit . SECONDS ) ;
public class ShanksSimulation { /** * ( non - Javadoc ) * @ see sim . engine . SimState # start ( ) */ @ Override public void start ( ) { } }
super . start ( ) ; logger . finer ( "-> start method" ) ; try { startSimulation ( ) ; } catch ( ShanksException e ) { logger . severe ( "ShanksException: " + e . getMessage ( ) ) ; e . printStackTrace ( ) ; }
public class ListServiceActionsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ListServiceActionsRequest listServiceActionsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( listServiceActionsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listServiceActionsRequest . getAcceptLanguage ( ) , ACCEPTLANGUAGE_BINDING ) ; protocolMarshaller . marshall ( listServiceActionsRequest . getPageSize ( ) , PA...
public class OptionsImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EList < OptionValue > getOptionValues ( ) { } }
if ( optionValues == null ) { optionValues = new EObjectContainmentEList < OptionValue > ( OptionValue . class , this , SimpleAntlrPackage . OPTIONS__OPTION_VALUES ) ; } return optionValues ;
public class WordUtils { /** * < p > Uncapitalizes all the whitespace separated words in a String . * Only the first character of each word is changed . < / p > * < p > The delimiters represent a set of characters understood to separate words . * The first string character and the first non - delimiter character ...
final int delimLen = delimiters == null ? - 1 : delimiters . length ; if ( StringUtils . isEmpty ( str ) || delimLen == 0 ) { return str ; } final char [ ] buffer = str . toCharArray ( ) ; boolean uncapitalizeNext = true ; for ( int i = 0 ; i < buffer . length ; i ++ ) { final char ch = buffer [ i ] ; if ( isDelimiter ...
public class IntIntHashMultiMap { /** * { @ inheritDoc } */ public boolean containsValue ( Object value ) { } }
if ( ! ( value instanceof Integer ) ) return false ; Integer v = ( Integer ) value ; return containsValue ( v . intValue ( ) ) ;
public class Caster { /** * cast a Object to a byte value ( primitive value type ) * @ param o Object to cast * @ param defaultValue * @ return casted byte value */ public static byte toByteValue ( Object o , byte defaultValue ) { } }
if ( o instanceof Byte ) return ( ( Byte ) o ) . byteValue ( ) ; if ( o instanceof Character ) return ( byte ) ( ( ( Character ) o ) . charValue ( ) ) ; else if ( o instanceof Boolean ) return ( byte ) ( ( ( ( Boolean ) o ) . booleanValue ( ) ) ? 1 : 0 ) ; else if ( o instanceof Number ) return ( ( ( Number ) o ) . byt...
public class JCommander { /** * Parse and validate the command line parameters . */ public void parse ( String ... args ) { } }
try { parse ( true /* validate */ , args ) ; } catch ( ParameterException ex ) { ex . setJCommander ( this ) ; throw ex ; }
public class Element { /** * Builds the nicely HTML formatted output of the element by retrieving parent * element information * @ param initialString - the starting string , typically describing the element , * or initial parent element * @ return String : text identifying how the element was located */ privat...
initialString += Reporter . ordinal ( match + 1 ) + " element with <i>" + type . toString ( ) + "</i> of <i>" + locator + "</i>" ; if ( parent != null ) { initialString = parent . prettyOutputStart ( initialString + " and parent of " ) ; } return initialString ;
public class AbstractListener { /** * Create contextual instances for the specified listener classes , excluding any listeners that do not correspond to an * enabled bean . */ @ SuppressWarnings ( "unchecked" ) protected List < T > getEnabledListeners ( Class < ? extends T > ... classes ) { } }
List < T > listeners = new ArrayList < T > ( ) ; for ( Class < ? extends T > clazz : classes ) { Set < Bean < ? > > beans = getBeanManager ( ) . getBeans ( clazz ) ; if ( ! beans . isEmpty ( ) ) { Bean < T > bean = ( Bean < T > ) getBeanManager ( ) . resolve ( beans ) ; CreationalContext < T > context = getBeanManager ...
public class Tokenizer { /** * Checks if the given identifier is a keyword and returns an appropriate Token * @ param idToken the identifier to check * @ return a keyword Token if the given identifier was a keyword , the original Token otherwise */ protected Token handleKeywords ( Token idToken ) { } }
String keyword = keywords . get ( keywordsCaseSensitive ? idToken . getContents ( ) . intern ( ) : idToken . getContents ( ) . toLowerCase ( ) . intern ( ) ) ; if ( keyword != null ) { Token keywordToken = Token . create ( Token . TokenType . KEYWORD , idToken ) ; keywordToken . setTrigger ( keyword ) ; keywordToken . ...
public class BoxRequestList { /** * Sets the limit of items that should be returned * @ param limit limit of items to return * @ return the get folder items request */ public R setLimit ( int limit ) { } }
mQueryMap . put ( LIMIT , String . valueOf ( limit ) ) ; return ( R ) this ;
public class LayerDrawable { /** * Sets the relative padding . * If padding in a dimension is specified as { @ code - 1 } , the resolved padding will use the value * computed according to the padding mode ( see { @ link # setPaddingMode ( int ) } ) . * Calling this method clears any absolute padding values previo...
final LayerState layerState = mLayerState ; layerState . mPaddingStart = start ; layerState . mPaddingTop = top ; layerState . mPaddingEnd = end ; layerState . mPaddingBottom = bottom ; // Clear absolute padding values . layerState . mPaddingLeft = - 1 ; layerState . mPaddingRight = - 1 ;
public class FileUtil { /** * CopiedFromAnt */ public static boolean isAbsolutePath ( String filename ) { } }
File file = new File ( filename ) ; boolean absolute = file . isAbsolute ( ) ; if ( absolute && OperatingSystem . isFamily ( OperatingSystem . WINDOWS ) ) { if ( filename . startsWith ( "\\\\" ) && ! filename . matches ( "\\\\\\\\.*\\\\.+" ) ) { absolute = false ; } } return absolute ;
public class FilesImpl { /** * Gets the properties of the specified task file . * @ param jobId The ID of the job that contains the task . * @ param taskId The ID of the task whose file you want to get the properties of . * @ param filePath The path to the task file that you want to get the properties of . * @ ...
return getPropertiesFromTaskWithServiceResponseAsync ( jobId , taskId , filePath ) . map ( new Func1 < ServiceResponseWithHeaders < Void , FileGetPropertiesFromTaskHeaders > , Void > ( ) { @ Override public Void call ( ServiceResponseWithHeaders < Void , FileGetPropertiesFromTaskHeaders > response ) { return response ....
public class CmsDefaultAppButtonProvider { /** * Creates an icon button . < p > * @ param name the name * @ param description the description * @ param icon the icon * @ return the created button */ public static Button createIconButton ( String name , String description , Resource icon ) { } }
return createIconButton ( name , description , icon , I_CmsAppButtonProvider . BUTTON_STYLE_TRANSPARENT ) ;
public class ComponentFinder { /** * Find components , using all of the configured component finder strategies * in the order they were added . * @ return the set of Components that were found * @ throws Exception if something goes wrong */ public Set < Component > findComponents ( ) throws Exception { } }
Set < Component > componentsFound = new HashSet < > ( ) ; for ( ComponentFinderStrategy componentFinderStrategy : componentFinderStrategies ) { componentFinderStrategy . beforeFindComponents ( ) ; } for ( ComponentFinderStrategy componentFinderStrategy : componentFinderStrategies ) { componentsFound . addAll ( componen...
public class CPOptionValueUtil { /** * Returns the first cp option value in the ordered set where CPOptionId = & # 63 ; . * @ param CPOptionId the cp option ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the first matching cp option value , or ...
return getPersistence ( ) . fetchByCPOptionId_First ( CPOptionId , orderByComparator ) ;
public class NodeUtil { /** * Returns true if the operator is commutative . * e . g . ( a * b ) * c = c * ( b * a ) * Note 1 : " + " is not commutative because it is also the concatenation * for strings . e . g . " a " + ( 1 + 2 ) is not " a " + 1 + 2 * Note 2 : only operations on literals and pure functions ar...
switch ( type ) { case MUL : case BITOR : case BITXOR : case BITAND : return true ; default : return false ; }
public class ProtoWalker { /** * Start walking . */ public void walk ( ) { } }
for ( Processor < Proto > protoProcessor : protoProcessors ) { protoProcessor . run ( context , proto ) ; } walk ( proto ) ;
public class Streams { /** * Writes the specified string to stream with buffering and closes the stream . * Writes in the default charset : Charset . defaultCharset ( ) . * @ param str String to write . * @ param outputStream Stream to write to . * @ throws IOException If there is an exception while writing . ...
write ( str , outputStream , Charset . defaultCharset ( ) ) ;
public class PBaseValueEqual { /** * Is NOT in a list of values . * @ param values the list of values for the predicate * @ return the root query bean instance */ public final R notIn ( Collection < T > values ) { } }
expr ( ) . notIn ( _name , values ) ; return _root ;
public class ResolvedTypes { /** * / * @ Nullable */ protected LightweightTypeReference doGetDeclaredType ( JvmIdentifiableElement identifiable ) { } }
if ( identifiable instanceof JvmType ) { ITypeReferenceOwner owner = getReferenceOwner ( ) ; LightweightTypeReference result = owner . toLightweightTypeReference ( ( JvmType ) identifiable ) ; return result ; } JvmTypeReference type = getDeclaredType ( identifiable ) ; if ( type != null ) { ITypeReferenceOwner owner = ...
public class Shape { /** * Get the broadcast output shape * based on the 2 input shapes * Result output shape based on : * https : / / docs . scipy . org / doc / numpy - 1.10.1 / user / basics . broadcasting . html * @ param left the left shape * @ param right the right second * @ return */ public static in...
assertBroadcastable ( left , right ) ; if ( Arrays . equals ( left , right ) ) return left ; int n = Math . max ( left . length , right . length ) ; List < Integer > dims = new ArrayList < > ( ) ; int leftIdx = left . length - 1 ; int rightIdx = right . length - 1 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( leftIdx ...
public class EkstaziCFT { /** * This method is for debugging purposes . So far one of the best way to * debug instrumentation was to actually look at the instrumented code . This * method let us choose which class to print . * @ param className * Name of the class being instrumented . * @ param classfileBuffe...
try { if ( className . contains ( "CX" ) ) { java . io . DataOutputStream tmpout = new java . io . DataOutputStream ( new java . io . FileOutputStream ( "out" ) ) ; tmpout . write ( classfileBuffer , 0 , classfileBuffer . length ) ; tmpout . close ( ) ; } } catch ( Exception ex ) { ex . printStackTrace ( ) ; }
public class ClientConfig { /** * The amount of time to keep an idle client thread alive * @ param threadIdleTime */ @ Deprecated public ClientConfig setThreadIdleTime ( long threadIdleTime , TimeUnit unit ) { } }
this . threadIdleMs = unit . toMillis ( threadIdleTime ) ; return this ;
public class TransferManager { /** * Returns a boolean value indicating if object can be downloaded in parallel * when using presigned url . */ private boolean isDownloadParallel ( PresignedUrlDownloadRequest request , Long startByte , Long endByte , long partialObjectMaxSize ) { } }
return ! configuration . isDisableParallelDownloads ( ) && ! ( s3 instanceof AmazonS3Encryption ) // Can ' t rely on set range as endbyte can be set to random number longer than actual size . This results in // making large number of partial requests even after the entire file is read from S3 && request . getRange ( ) ...
public class DOT { /** * Renders a GraphVIZ description from a file , using an external program for displaying . Convenience method , see * { @ link # renderDOTExternal ( Reader , String ) } . * @ throws IOException * if opening the file resulted in errors . */ public static void renderDOTExternal ( File dotFile ...
renderDOTExternal ( IOUtil . asBufferedUTF8Reader ( dotFile ) , format ) ;
public class CountedCompleter { /** * Adds ( atomically ) the given value to the pending count . * @ param delta the value to add */ public final void addToPendingCount ( int delta ) { } }
int c ; // note : can replace with intrinsic in jdk8 do { } while ( ! U . compareAndSwapInt ( this , PENDING , c = pending , c + delta ) ) ;
public class Timing { /** * Print elapsed time and restart ( static ) timer . * @ param str Additional prefix string to be printed * @ param stream PrintStream on which to write output * @ return Number of milliseconds elapsed */ public static long tick ( String str , PrintStream stream ) { } }
long elapsed = tick ( ) ; stream . println ( str + " Time elapsed: " + ( elapsed ) + " ms" ) ; return elapsed ;
public class MicronautConsole { /** * Logs a message below the current status message . * @ param msg The message to log */ @ Override public void log ( String msg ) { } }
verifySystemOut ( ) ; PrintStream printStream = out ; try { if ( userInputActive ) { erasePrompt ( printStream ) ; } if ( msg . endsWith ( LINE_SEPARATOR ) ) { printStream . print ( msg ) ; } else { printStream . println ( msg ) ; } cursorMove = 0 ; } finally { printStream . flush ( ) ; postPrintMessage ( ) ; }
public class SynchronizeFXTomcatChannel { /** * Sends send the result of { @ link Serializer # serialize ( List ) } to a destination . * @ param buffer the bytes to send . * @ param destination The peer to send to . */ private void send ( final byte [ ] buffer , final Object destination ) { } }
if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "Sending from thread: id: " + Thread . currentThread ( ) . getName ( ) + ", name: " + Thread . currentThread ( ) . getName ( ) ) ; } final WsOutbound outbound = ( ( MessageInbound ) destination ) . getWsOutbound ( ) ; final ExecutorService executorService = connectionThre...
public class FileSnap { /** * serialize the datatree and session into the file snapshot * @ param dt the datatree to be serialized * @ param sessions the sessions to be serialized * @ param snapShot the file to store snapshot into */ @ Override public synchronized void serialize ( DataTree dt , Map < Long , Long ...
if ( ! close ) { OutputStream sessOS = new BufferedOutputStream ( new FileOutputStream ( snapShot ) ) ; CheckedOutputStream crcOut = new CheckedOutputStream ( sessOS , new Adler32 ( ) ) ; // CheckedOutputStream cout = new CheckedOutputStream ( ) OutputArchive oa = BinaryOutputArchive . getArchive ( crcOut ) ; FileHeade...
public class IoUtil { /** * 从流中读取内容 , 读取完毕后并不关闭流 * @ param channel 可读通道 , 读取完毕后并不关闭通道 * @ param charset 字符集 * @ return 内容 * @ throws IORuntimeException IO异常 * @ since 4.5.0 */ public static String read ( ReadableByteChannel channel , Charset charset ) throws IORuntimeException { } }
FastByteArrayOutputStream out = read ( channel ) ; return null == charset ? out . toString ( ) : out . toString ( charset ) ;
public class V1InstanceCreator { /** * Create a new Issue with a name . * @ param name The initial name of the entity . * @ param project The Project this Issue will be in . * @ return A newly minted Issue that exists in the VersionOne system . */ public Issue issue ( String name , Project project ) { } }
return issue ( name , project , null ) ;
public class TokenUtils { /** * Obtain kerberos principal in a dynamic way , where the instance ' s value is determined by the hostname of the machine * that the job is currently running on . * It will be invoked when { @ link # KEYTAB _ USER } is not following pattern specified in { @ link # KEYTAB _ USER _ PATTER...
if ( ! state . getProp ( KEYTAB_USER ) . matches ( KEYTAB_USER_PATTERN . pattern ( ) ) ) { Preconditions . checkArgument ( state . contains ( KERBEROS_REALM ) ) ; return state . getProp ( KEYTAB_USER ) + "/" + InetAddress . getLocalHost ( ) . getCanonicalHostName ( ) + "@" + state . getProp ( KERBEROS_REALM ) ; } else ...
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link RectifiedGridType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link RectifiedGridType } { @ code >...
return new JAXBElement < RectifiedGridType > ( _RectifiedGrid_QNAME , RectifiedGridType . class , null , value ) ;
public class CommerceShippingFixedOptionServiceBaseImpl { /** * Sets the commerce shipping fixed option rel remote service . * @ param commerceShippingFixedOptionRelService the commerce shipping fixed option rel remote service */ public void setCommerceShippingFixedOptionRelService ( com . liferay . commerce . shippi...
this . commerceShippingFixedOptionRelService = commerceShippingFixedOptionRelService ;
public class Stopwatch { /** * Express the " reading " on the stopwatch in seconds . * @ return Time elapsed in stopwatch in seconds * @ throws IllegalStateException if the Stopwatch has never been used , or if the stopwatch is still running . */ public String getSeconds ( ) { } }
if ( myTimerIsRunning ) { throw new IllegalStateException ( LOGGER . getI18n ( MessageCodes . UTIL_042 ) ) ; } final StringBuilder result = new StringBuilder ( ) ; final long timeGap = myStop - myStart ; return result . append ( timeGap / 1000 ) . append ( " secs, " ) . append ( timeGap % 1000 ) . append ( " msecs " ) ...
public class MimeTypeDetector { /** * Determines the MIME type of a file with a given input stream . * The InputStream must exist . It must point to the beginning of the file * contents . And { @ link java . io . InputStream # markSupported ( ) } must return * { @ literal true } . ( When in doubt , pass a * { @...
Callable < byte [ ] > getBytes = new Callable < byte [ ] > ( ) { public byte [ ] call ( ) throws IOException { return inputStreamToFirstBytes ( is ) ; } } ; return detectMimeType ( filename , getBytes ) ;
public class DoublesPmfCdfImpl { /** * Because of the nested loop , cost is O ( numSamples * numSplitPoints ) , which is bilinear . * This method does NOT require the samples to be sorted . * @ param samples DoublesBufferAccessor holding an array of samples * @ param weight of the samples * @ param splitPoints ...
assert ( splitPoints . length + 1 == counters . length ) ; for ( int i = 0 ; i < samples . numItems ( ) ; i ++ ) { final double sample = samples . get ( i ) ; int j ; for ( j = 0 ; j < splitPoints . length ; j ++ ) { final double splitpoint = splitPoints [ j ] ; if ( sample < splitpoint ) { break ; } } assert j < count...
public class SimpleNumberControl { /** * { @ inheritDoc } */ @ Override public void setupBindings ( ) { } }
super . setupBindings ( ) ; editableSpinner . visibleProperty ( ) . bind ( field . editableProperty ( ) ) ; readOnlyLabel . visibleProperty ( ) . bind ( field . editableProperty ( ) . not ( ) ) ; editableSpinner . getEditor ( ) . textProperty ( ) . bindBidirectional ( field . userInputProperty ( ) ) ; readOnlyLabel . t...
public class BootstrapContextImpl { /** * Load a resource adapter class . * If the resource adapter file that is specified in < resourceAdapter > exists , * then classes will be loaded from the file . * If the file does not exist , then classes will be loaded from the * bundle of the component context . * @ p...
ClassLoader raClassLoader = resourceAdapterSvc . getClassLoader ( ) ; if ( raClassLoader != null ) { return Utils . priv . loadClass ( raClassLoader , className ) ; } else { // TODO when SIB has converted from bundle to real rar file , then this can be removed // and if the rar file does not exist , then a Tr . error s...
public class FormatUtilities { /** * Returns the given date parsed using " dd - MM - yyyy " . * @ param dt The date to be parsed * @ return The given date parsed using " dd - MM - yyyy " */ static public String getFormattedDate ( long dt ) { } }
String ret = "" ; SimpleDateFormat df = null ; try { if ( dt > 0 ) { df = formatPool . getFormat ( DATE_FORMAT ) ; df . setTimeZone ( DateUtilities . getCurrentTimeZone ( ) ) ; ret = df . format ( new Date ( dt ) ) ; } } catch ( Exception e ) { } if ( df != null ) formatPool . release ( df ) ; return ret ;
public class ThreadIdentityManager { /** * Remove a ThreadIdentityService reference . This method is called by * ThreadIdentityManagerConfigurator when a ThreadIdentityService leaves * the OSGI framework . * @ param tis */ public static void removeThreadIdentityService ( ThreadIdentityService tis ) { } }
if ( tis != null ) { threadIdentityServices . remove ( tis ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "A ThreadIdentityService implementation was removed." , tis . getClass ( ) . getName ( ) ) ; } }
public class HTTP { /** * Returns a string representation of the parameters , able to be appended to the url * @ param request - the parameters to be passed to the endpoint for the service * call * @ return String : the string friendly url parameter representation */ public String getRequestParams ( Request reque...
StringBuilder params = new StringBuilder ( ) ; if ( request != null && request . getUrlParams ( ) != null ) { params . append ( "?" ) ; for ( String key : request . getUrlParams ( ) . keySet ( ) ) { params . append ( key ) ; params . append ( "=" ) ; params . append ( String . valueOf ( request . getUrlParams ( ) . get...