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 . */ WriteableScope enterScope ( Env < AttrContext > env ) { } }
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 SecureRandom ( ) . * @ param bits The number of bits of entropy to use when generating entropy . Either 128 ( default ) , 192 or 256. */ public T random ( SecureRandom random , int bits ) { } }
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 instead */ @ Deprecated public JsonFluentAssert hasSameStructureAs ( Object expected ) { } }
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 URI of the image previously put in the cache * @ return the image matching the requested URI , or null if not available * @ throws IOException if retrieval fails */ public BufferedImage get ( URI uri ) throws IOException { } }
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 ) ; bytemapAccessQueue . addLast ( uri ) ; BufferedImage img = ImageIO . read ( new ByteArrayInputStream ( bytemap . get ( uri ) ) ) ; addToImageCache ( uri , img ) ; return img ; } } return null ;
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 file * @ param mBean MBean that needs to be associated with the Stats instance * @ param listener A StatisticActions object . This object will be called when events occur on statistics created for this instance * @ return Stats instance * @ exception StatsFactoryException if error while creating Stats instance */ public static StatsInstance createStatsInstance ( String instanceName , String statsTemplate , ObjectName mBean , StatisticActions listener ) throws StatsFactoryException { } }
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 ) ; StatsInstance instance ; try { instance = StatsInstanceImpl . createInstance ( instanceName , statsTemplate , mBean , false , listener ) ; } catch ( StatsFactoryException e ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Exception:" , e ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "createStatsInstance" ) ; throw e ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "createStatsInstance" ) ; return instance ;
public class TargetSslProxyClient { /** * Deletes the specified TargetSslProxy resource . * < p > Sample code : * < pre > < code > * try ( TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient . create ( ) ) { * ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName . of ( " [ PROJECT ] " , " [ TARGET _ SSL _ PROXY ] " ) ; * Operation response = targetSslProxyClient . deleteTargetSslProxy ( targetSslProxy . toString ( ) ) ; * < / code > < / pre > * @ param targetSslProxy Name of the TargetSslProxy resource to delete . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final Operation deleteTargetSslProxy ( String targetSslProxy ) { } }
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 RepositoryHttpException , IOException { } }
// 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 returned error code " + respCode , respCode , null ) ; } }
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 , commonTags , m . id ( ) , m . value ( ) ) ; } gen . writeEndArray ( ) ; gen . close ( ) ; return baos . toByteArray ( ) ;
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 convolve ( Kernel2D_S32 kernel , GrayS16 src , GrayI16 dst ) { } }
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 { ConvolveImageNoBorder . convolve ( kernel , src , dst , kernel . computeSum ( ) , null ) ; ConvolveNormalized_JustBorder_SB . convolve ( kernel , src , dst ) ; } }
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 IOException , TLVParserException { } }
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 ) ) ; } return element ;
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 bindAddress , int bindPort , boolean killActiveTunnels ) throws SshException { } }
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 _ uriSpec is an absolute * URI ) * @ param p _ uriSpec the URI spec string which may be an absolute or * relative URI ( can only be null / empty if p _ base * is not null ) * @ throws MalformedURIException if p _ base is null and p _ uriSpec * is not an absolute URI or if * p _ uriSpec violates syntax rules */ private void initialize ( URI p_base , String p_uriSpec ) throws MalformedURIException { } }
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 if ( p_uriSpec == null || p_uriSpec . trim ( ) . length ( ) == 0 ) { initialize ( p_base ) ; return ; } String uriSpec = p_uriSpec . trim ( ) ; int uriSpecLen = uriSpec . length ( ) ; int index = 0 ; // check for scheme int colonIndex = uriSpec . indexOf ( ':' ) ; if ( colonIndex < 0 ) { if ( p_base == null ) { throw new MalformedURIException ( Utils . messages . createMessage ( MsgKey . ER_NO_SCHEME_IN_URI , new Object [ ] { uriSpec } ) ) ; // " No scheme found in URI : " + uriSpec ) ; } } else { initializeScheme ( uriSpec ) ; uriSpec = uriSpec . substring ( colonIndex + 1 ) ; uriSpecLen = uriSpec . length ( ) ; } // two slashes means generic URI syntax , so we get the authority if ( uriSpec . startsWith ( "//" ) ) { index += 2 ; int startPos = index ; // get authority - everything up to path , query or fragment char testChar = '\0' ; while ( index < uriSpecLen ) { testChar = uriSpec . charAt ( index ) ; if ( testChar == '/' || testChar == '?' || testChar == '#' ) { break ; } index ++ ; } // if we found authority , parse it out , otherwise we set the // host to empty string if ( index > startPos ) { initializeAuthority ( uriSpec . substring ( startPos , index ) ) ; } else { m_host = "" ; } } initializePath ( uriSpec . substring ( index ) ) ; // Resolve relative URI to base URI - see RFC 2396 Section 5.2 // In some cases , it might make more sense to throw an exception // ( when scheme is specified is the string spec and the base URI // is also specified , for example ) , but we ' re just following the // RFC specifications if ( p_base != null ) { // check to see if this is the current doc - RFC 2396 5.2 # 2 // note that this is slightly different from the RFC spec in that // we don ' t include the check for query string being null // - this handles cases where the urispec is just a query // string or a fragment ( e . g . " ? y " or " # s " ) - // see < http : / / www . ics . uci . edu / ~ fielding / url / test1 . html > which // identified this as a bug in the RFC if ( m_path . length ( ) == 0 && m_scheme == null && m_host == null ) { m_scheme = p_base . getScheme ( ) ; m_userinfo = p_base . getUserinfo ( ) ; m_host = p_base . getHost ( ) ; m_port = p_base . getPort ( ) ; m_path = p_base . getPath ( ) ; if ( m_queryString == null ) { m_queryString = p_base . getQueryString ( ) ; } return ; } // check for scheme - RFC 2396 5.2 # 3 // if we found a scheme , it means absolute URI , so we ' re done if ( m_scheme == null ) { m_scheme = p_base . getScheme ( ) ; } // check for authority - RFC 2396 5.2 # 4 // if we found a host , then we ' ve got a network path , so we ' re done if ( m_host == null ) { m_userinfo = p_base . getUserinfo ( ) ; m_host = p_base . getHost ( ) ; m_port = p_base . getPort ( ) ; } else { return ; } // check for absolute path - RFC 2396 5.2 # 5 if ( m_path . length ( ) > 0 && m_path . startsWith ( "/" ) ) { return ; } // if we get to this point , we need to resolve relative path // RFC 2396 5.2 # 6 String path = new String ( ) ; String basePath = p_base . getPath ( ) ; // 6a - get all but the last segment of the base URI path if ( basePath != null ) { int lastSlash = basePath . lastIndexOf ( '/' ) ; if ( lastSlash != - 1 ) { path = basePath . substring ( 0 , lastSlash + 1 ) ; } } // 6b - append the relative URI path path = path . concat ( m_path ) ; // 6c - remove all " . / " where " . " is a complete path segment index = - 1 ; while ( ( index = path . indexOf ( "/./" ) ) != - 1 ) { path = path . substring ( 0 , index + 1 ) . concat ( path . substring ( index + 3 ) ) ; } // 6d - remove " . " if path ends with " . " as a complete path segment if ( path . endsWith ( "/." ) ) { path = path . substring ( 0 , path . length ( ) - 1 ) ; } // 6e - remove all " < segment > / . . / " where " < segment > " is a complete // path segment not equal to " . . " index = - 1 ; int segIndex = - 1 ; String tempString = null ; while ( ( index = path . indexOf ( "/../" ) ) > 0 ) { tempString = path . substring ( 0 , path . indexOf ( "/../" ) ) ; segIndex = tempString . lastIndexOf ( '/' ) ; if ( segIndex != - 1 ) { if ( ! tempString . substring ( segIndex ++ ) . equals ( ".." ) ) { path = path . substring ( 0 , segIndex ) . concat ( path . substring ( index + 4 ) ) ; } } } // 6f - remove ending " < segment > / . . " where " < segment > " is a // complete path segment if ( path . endsWith ( "/.." ) ) { tempString = path . substring ( 0 , path . length ( ) - 3 ) ; segIndex = tempString . lastIndexOf ( '/' ) ; if ( segIndex != - 1 ) { path = path . substring ( 0 , segIndex + 1 ) ; } } m_path = path ; }
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 CmsHistoryVersion ( ver , onlineStatus ) ; } return null ;
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 : xPathExpressions . entrySet ( ) ) { String pathExpression = context . replaceDynamicContentInString ( entry . getKey ( ) ) ; String variableName = entry . getValue ( ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Evaluating XPath expression: " + pathExpression ) ; } Document doc = XMLUtils . parseMessagePayload ( message . getPayload ( String . class ) ) ; if ( XPathUtils . isXPathExpression ( pathExpression ) ) { XPathExpressionResult resultType = XPathExpressionResult . fromString ( pathExpression , XPathExpressionResult . STRING ) ; pathExpression = XPathExpressionResult . cutOffPrefix ( pathExpression ) ; Object value = XPathUtils . evaluate ( doc , pathExpression , nsContext , resultType ) ; if ( value == null ) { throw new CitrusRuntimeException ( "Not able to find value for expression: " + pathExpression ) ; } if ( value instanceof List ) { value = StringUtils . arrayToCommaDelimitedString ( ( ( List ) value ) . toArray ( new String [ ( ( List ) value ) . size ( ) ] ) ) ; } context . setVariable ( variableName , value ) ; } else { Node node = XMLUtils . findNodeByName ( doc , pathExpression ) ; if ( node == null ) { throw new UnknownElementException ( "No element found for expression" + pathExpression ) ; } if ( node . getNodeType ( ) == Node . ELEMENT_NODE ) { if ( node . getFirstChild ( ) != null ) { context . setVariable ( xPathExpressions . get ( pathExpression ) , node . getFirstChild ( ) . getNodeValue ( ) ) ; } else { context . setVariable ( xPathExpressions . get ( pathExpression ) , "" ) ; } } else { context . setVariable ( xPathExpressions . get ( pathExpression ) , node . getNodeValue ( ) ) ; } } }
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 */ public PlainDate random ( ) { } }
DateInterval interval = this . toCanonical ( ) ; if ( interval . isFinite ( ) && ! interval . isEmpty ( ) ) { long randomNum = ThreadLocalRandom . current ( ) . nextLong ( interval . getStartAsCalendarDate ( ) . getDaysSinceEpochUTC ( ) , interval . getEndAsCalendarDate ( ) . getDaysSinceEpochUTC ( ) + 1 ) ; return PlainDate . of ( randomNum , EpochDays . UTC ) ; } else { throw new IllegalStateException ( "Cannot get random date in an empty or infinite interval: " + this ) ; }
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 getGenre ( int i ) { } }
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 != null ) browsedRecords ++ ; return 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 , String id ) throws IOException { } }
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 . getBinaryStream ( 1 ) ; NodeReferences refs = new NodeReferences ( targetId ) ; Serializer . deserialize ( refs , in ) ; return refs ; } catch ( Exception e ) { if ( e instanceof NoSuchItemStateException ) { throw ( NoSuchItemStateException ) e ; } String msg = "failed to read references: " + targetId ; log . error ( msg , e ) ; throw new ItemStateException ( msg , e ) ; } finally { IOUtils . closeQuietly ( in ) ; DbUtility . close ( 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 = Math . atan2 ( a . y - candidate . y , a . x - candidate . x ) ; double dirB = Math . atan2 ( b . y - candidate . y , b . x - candidate . x ) ; double dirAB = UtilAngle . boundHalf ( dirA + UtilAngle . distanceCCW ( dirA , dirB ) / 2.0 ) ; // Find the acute angle between the corner ' s orientation and the vector double acute = UtilAngle . distHalf ( dirAB , candidate . orientation ) ; return acute < Math . PI / 4.0 ;
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 * @ throws annis . gui . requesthandler . ContentRange . InvalidRangeException */ public static List < ContentRange > parseFromHeader ( String rawRange , long totalSize , int maxNum ) throws InvalidRangeException { } }
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 ( "," ) . omitEmptyStrings ( ) . trimResults ( ) . split ( rawRange ) ) { if ( result . size ( ) >= totalSize ) { throw new InvalidRangeException ( "more ranges than acceptable" ) ; } long from = 0 ; long to = totalSize - 1 ; Matcher m = partPattern . matcher ( partRange ) ; if ( ! m . find ( ) ) { throw new InvalidRangeException ( "invalid syntax for partial range" ) ; } String fromString = m . group ( 1 ) ; String toString = m . group ( 2 ) ; if ( fromString != null && ! fromString . isEmpty ( ) ) { from = Long . parseLong ( fromString ) ; } if ( toString != null && ! toString . isEmpty ( ) ) { to = Long . parseLong ( toString ) ; } if ( from > to ) { throw new InvalidRangeException ( "start is larger then end" ) ; } result . add ( new ContentRange ( from , to , totalSize ) ) ; } } return result ;
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 ( RandomIter tcaIter , RandomIter hacklengthIter ) { } }
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 ) { case E : if ( eFlow == Direction . E . getEnteringFlow ( ) ) { newCol = col + direction . col ; newRow = row + direction . row ; gotOne = true ; } break ; case N : if ( nFlow == Direction . N . getEnteringFlow ( ) ) { newCol = col + direction . col ; newRow = row + direction . row ; gotOne = true ; } break ; case W : if ( wFlow == Direction . W . getEnteringFlow ( ) ) { newCol = col + direction . col ; newRow = row + direction . row ; gotOne = true ; } break ; case S : if ( sFlow == Direction . S . getEnteringFlow ( ) ) { newCol = col + direction . col ; newRow = row + direction . row ; gotOne = true ; } break ; case EN : if ( enFlow == Direction . EN . getEnteringFlow ( ) ) { newCol = col + direction . col ; newRow = row + direction . row ; gotOne = true ; } break ; case NW : if ( nwFlow == Direction . NW . getEnteringFlow ( ) ) { newCol = col + direction . col ; newRow = row + direction . row ; gotOne = true ; } break ; case WS : if ( wsFlow == Direction . WS . getEnteringFlow ( ) ) { newCol = col + direction . col ; newRow = row + direction . row ; gotOne = true ; } break ; case SE : if ( seFlow == Direction . SE . getEnteringFlow ( ) ) { newCol = col + direction . col ; newRow = row + direction . row ; gotOne = true ; } break ; default : throw new IllegalArgumentException ( ) ; } if ( isInRaster ( newCol , newRow ) ) { int flowValue = gridIter . getSample ( newCol , newRow , 0 ) ; if ( HMConstants . isNovalue ( flowValue ) ) { continue ; } int tcaValue = tcaIter . getSample ( newCol , newRow , 0 ) ; double hacklengthValue = 0.0 ; if ( hacklengthIter != null ) hacklengthValue = tcaIter . getSampleDouble ( newCol , newRow , 0 ) ; if ( NumericsUtilities . dEq ( tcaValue , maxTca ) && hacklengthIter != null ) { /* * if there are two equal tca values around * and info about hacklength is available , * use that one to choose */ if ( hacklengthValue > maxHacklength ) { // this has larger hacklength , use this one as max tca maxTca = tcaValue ; maxCol = newCol ; maxRow = newRow ; maxHacklength = hacklengthValue ; } } else if ( tcaValue > maxTca ) { maxTca = tcaValue ; maxCol = newCol ; maxRow = newRow ; maxHacklength = hacklengthValue ; } } } if ( ! gotOne ) { return null ; } FlowNode node = new FlowNode ( gridIter , cols , rows , maxCol , maxRow ) ; return node ;
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 description is unchanged and null * is returned . Note : the trailing semicolon at the end of the special * rules is stripped . * @ param description the rbnf description with extra whitespace removed * @ param specialName the name of the special rule text to extract * @ return the special rule text , or null if the rule was not found */ private String extractSpecial ( StringBuilder description , String specialName ) { } }
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 actual special // rules ( there may be whitespace between the name and // the first token in the description ) int lpEnd = description . indexOf ( ";%" , lp ) ; if ( lpEnd == - 1 ) { lpEnd = description . length ( ) - 1 ; // later we add 1 back to get the ' % ' } int lpStart = lp + specialName . length ( ) ; while ( lpStart < lpEnd && PatternProps . isWhiteSpace ( description . charAt ( lpStart ) ) ) { ++ lpStart ; } // copy out the special rules result = description . substring ( lpStart , lpEnd ) ; // remove the special rule from the description description . delete ( lp , lpEnd + 1 ) ; // delete the semicolon but not the ' % ' } } return result ;
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 number of * characters should not be restricted */ public final void setMaxNumberOfCharacters ( final int maxNumberOfCharacters ) { } }
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 ( ++ q ) ; q += 6 ; } value = s ; } attributeMap . put ( attribute , "\"" + value + '"' ) ; } return this ;
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 > changeSet ) { } }
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 = new ModelNode ( ) ; operation . get ( OP ) . set ( COMPOSITE ) ; operation . get ( ADDRESS ) . setEmptyList ( ) ; List < ModelNode > steps = new ArrayList < > ( ) ; for ( String key : changeSet . keySet ( ) ) { Object value = changeSet . get ( key ) ; ModelNode step ; if ( value . equals ( FormItem . VALUE_SEMANTICS . UNDEFINED ) ) { step = undefine . clone ( ) ; step . get ( NAME ) . set ( key ) ; } else { step = define . clone ( ) ; step . get ( NAME ) . set ( key ) ; // set value , including type conversion ModelNode valueNode = step . get ( VALUE ) ; setValue ( valueNode , value ) ; } steps . add ( step ) ; } operation . get ( STEPS ) . set ( steps ) ; return 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 ; // gefunden } } return - 1 ;
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 service . * @ sample AmazonEC2 . DescribeTransitGatewayVpcAttachments * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / DescribeTransitGatewayVpcAttachments " * target = " _ top " > AWS API Documentation < / a > */ @ Override public DescribeTransitGatewayVpcAttachmentsResult describeTransitGatewayVpcAttachments ( DescribeTransitGatewayVpcAttachmentsRequest request ) { } }
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 fileToCompare ) { } }
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 getCsvFileAsSqlInsertScript ( final String tableName , final String [ ] headers , final String [ ] columnTypes , final List < String [ ] > lines ) { } }
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 ) ; String bin64String = CompressionService . compressAndBase64Encode ( jsonBytes ) ; fragment . setPlannodetree ( bin64String ) ; return jsonBytes ;
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 with the { @ link JobResult } once the job has completed or * with a failure if the { @ link JobResult } could not be retrieved . */ @ Override public CompletableFuture < JobResult > requestJobResult ( @ Nonnull JobID jobId ) { } }
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 * @ return < code > true < / code > iff translator and its subtype was found , * < code > false < / code > otherwise */ public static boolean hasTranslator ( int dataType ) { } }
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 KNXException e ) { } return false ;
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 ( cachedValue . getKey ( ) , cachedValue ) ) { onValueRemove ( cachedValue ) ; } } else { readValue ( cachedValue ) ; return true ; } } } return false ;
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 ) { ChallengeHandler handler = authManager . getChallengeHandler ( realm ) ; if ( handler != null ) { JSONObject challenge = jsonChallenges . optJSONObject ( realm ) ; handler . handleChallenge ( this , challenge , context ) ; } else { throw new RuntimeException ( "Challenge handler for realm is not found: " + realm ) ; } }
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 ( ) , PAGESIZE_BINDING ) ; protocolMarshaller . marshall ( listServiceActionsRequest . getPageToken ( ) , PAGETOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
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 after a * delimiter will be uncapitalized . < / p > * < p > Whitespace is defined by { @ link Character # isWhitespace ( char ) } . * A < code > null < / code > input String returns < code > null < / code > . < / p > * < pre > * WordUtils . uncapitalize ( null , * ) = null * WordUtils . uncapitalize ( " " , * ) = " " * WordUtils . uncapitalize ( * , null ) = * * WordUtils . uncapitalize ( * , new char [ 0 ] ) = * * WordUtils . uncapitalize ( " I AM . FINE " , { ' . ' } ) = " i AM . fINE " * < / pre > * @ param str the String to uncapitalize , may be null * @ param delimiters set of characters to determine uncapitalization , null means whitespace * @ return uncapitalized String , < code > null < / code > if null String input * @ see # capitalize ( String ) * @ since 2.1 */ public static String uncapitalize ( final String str , final char ... delimiters ) { } }
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 ( ch , delimiters ) ) { uncapitalizeNext = true ; } else if ( uncapitalizeNext ) { buffer [ i ] = Character . toLowerCase ( ch ) ; uncapitalizeNext = false ; } } return new String ( buffer ) ;
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 ) . byteValue ( ) ) ; else if ( o instanceof String ) return ( byte ) toDoubleValue ( o . toString ( ) , defaultValue ) ; else if ( o instanceof ObjectWrap ) { return toByteValue ( ( ( ObjectWrap ) o ) . getEmbededObject ( toByte ( defaultValue ) ) , defaultValue ) ; } return defaultValue ;
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 */ private String prettyOutputStart ( String initialString ) { } }
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 ( ) . createCreationalContext ( bean ) ; listeners . add ( ( T ) getBeanManager ( ) . getReference ( bean , clazz , context ) ) ; } } return listeners ;
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 . setContent ( idToken . getContents ( ) ) ; keywordToken . setSource ( idToken . getSource ( ) ) ; return keywordToken ; } return idToken ;
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 previously set using { @ link * # setPadding ( int , int , int , int ) } . * @ param start the start padding in pixels , or - 1 to use computed padding * @ param top the top padding in pixels , or - 1 to use computed padding * @ param end the end padding in pixels , or - 1 to use computed padding * @ param bottom the bottom padding in pixels , or - 1 to use computed padding * @ attr ref android . R . styleable # LayerDrawable _ paddingStart * @ attr ref android . R . styleable # LayerDrawable _ paddingTop * @ attr ref android . R . styleable # LayerDrawable _ paddingEnd * @ attr ref android . R . styleable # LayerDrawable _ paddingBottom * @ see # setPadding ( int , int , int , int ) */ public void setPaddingRelative ( int start , int top , int end , int bottom ) { } }
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 . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceResponseWithHeaders } object if successful . */ public Observable < Void > getPropertiesFromTaskAsync ( String jobId , String taskId , String filePath ) { } }
return getPropertiesFromTaskWithServiceResponseAsync ( jobId , taskId , filePath ) . map ( new Func1 < ServiceResponseWithHeaders < Void , FileGetPropertiesFromTaskHeaders > , Void > ( ) { @ Override public Void call ( ServiceResponseWithHeaders < Void , FileGetPropertiesFromTaskHeaders > response ) { return response . body ( ) ; } } ) ;
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 ( componentFinderStrategy . findComponents ( ) ) ; } for ( ComponentFinderStrategy componentFinderStrategy : componentFinderStrategies ) { componentFinderStrategy . afterFindComponents ( ) ; } return componentsFound ;
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 < code > null < / code > if a matching cp option value could not be found */ public static CPOptionValue fetchByCPOptionId_First ( long CPOptionId , OrderByComparator < CPOptionValue > orderByComparator ) { } }
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 are commutative . */ static boolean isCommutative ( Token type ) { } }
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 . * @ deprecated it is always safer to supply a charset . See * { @ link # write ( String , OutputStream , Charset ) } . */ @ Deprecated public static void write ( String str , final OutputStream outputStream ) throws IOException { } }
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 = getReferenceOwner ( ) ; LightweightTypeReference result = owner . toLightweightTypeReference ( type ) ; return result ; } return null ;
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 int [ ] broadcastOutputShape ( int [ ] left , int [ ] right ) { } }
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 < 0 ) { dims . add ( right [ rightIdx ] ) ; } else if ( rightIdx < 0 ) { dims . add ( left [ leftIdx ] ) ; } else if ( left [ leftIdx ] != right [ rightIdx ] && right [ rightIdx ] == 1 || left [ leftIdx ] == 1 ) { dims . add ( Math . max ( left [ leftIdx ] , right [ rightIdx ] ) ) ; } else if ( left [ leftIdx ] == right [ rightIdx ] ) { dims . add ( left [ leftIdx ] ) ; } else { throw new IllegalArgumentException ( "Unable to broadcast dimension " + i + " due to shape mismatch. Right shape must be 1." ) ; } leftIdx -- ; rightIdx -- ; } Collections . reverse ( dims ) ; return Ints . toArray ( dims ) ;
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 classfileBuffer * Byte array with the instrumented class content . */ @ SuppressWarnings ( "unused" ) private void saveClassfileBufferForDebugging ( String className , byte [ ] classfileBuffer ) { } }
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 ( ) == null // This is when SDK can compute the endByte through the object metadata && ( startByte != null && endByte != null && endByte - startByte + 1 > partialObjectMaxSize ) ;
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 , String format ) throws IOException { } }
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 = connectionThreads . get ( destination ) ; // execute asynchronously to avoid slower clients from interfering with faster clients executorService . execute ( new Runnable ( ) { @ Override public void run ( ) { try { outbound . writeBinaryMessage ( ByteBuffer . wrap ( buffer ) ) ; } catch ( final IOException e ) { LOG . warn ( "Sending data to a client failed. Closing connection to this client." ) ; try { outbound . close ( 1002 , null ) ; // CHECKSTYLE : OFF } catch ( final IOException e1 ) { // Maybe the connection is already closed . This is no exceptional state but rather the // default in // this case . So it ' s safe to ignore this exception . } // CHECKSTYLE : ON connectionCloses ( ( SynchronizeFXTomcatConnection ) destination ) ; } } } ) ;
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 > sessions , File snapShot ) throws IOException { } }
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 ) ; FileHeader header = new FileHeader ( SNAP_MAGIC , VERSION , dbId ) ; serialize ( dt , sessions , oa , header ) ; long val = crcOut . getChecksum ( ) . getValue ( ) ; oa . writeLong ( val , "val" ) ; oa . writeString ( "/" , "path" ) ; sessOS . flush ( ) ; crcOut . close ( ) ; sessOS . close ( ) ; }
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 _ PATTERN } . * @ throws UnknownHostException */ public static String obtainKerberosPrincipal ( final State state ) throws UnknownHostException { } }
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 { return state . getProp ( KEYTAB_USER ) ; }
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 > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "RectifiedGrid" , substitutionHeadNamespace = "http://www.opengis.net/gml" , substitutionHeadName = "_ImplicitGeometry" ) public JAXBElement < RectifiedGridType > createRectifiedGrid ( RectifiedGridType value ) { } }
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 . shipping . engine . fixed . service . CommerceShippingFixedOptionRelService commerceShippingFixedOptionRelService ) { } }
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 " ) . toString ( ) ;
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 * { @ link java . io . BufferedInputStream } . ) * @ param filename Name of file . To skip filename globbing , pass { @ literal " " } * @ param is InputStream that supports mark and reset . * @ return a MIME type such as { @ literal " text / plain " } * @ throws GetBytesException if marking , reading or resetting the InputStream fails . * @ see # detectMimeType ( String , Callable ) */ public String detectMimeType ( String filename , final InputStream is ) throws GetBytesException { } }
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 must be unique and sorted . Number of splitPoints + 1 = = counters . length . * @ param counters array of counters */ static void bilinearTimeIncrementHistogramCounters ( final DoublesBufferAccessor samples , final long weight , final double [ ] splitPoints , final double [ ] counters ) { } }
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 < counters . length ; counters [ j ] += weight ; }
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 . textProperty ( ) . bind ( field . userInputProperty ( ) ) ;
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 . * @ param className name of the class . * @ return the class . * @ throws ClassNotFoundException * @ throws UnableToAdaptException * @ throws MalformedURLException */ public Class < ? > loadClass ( final String className ) throws ClassNotFoundException , UnableToAdaptException , MalformedURLException { } }
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 should be issued try { if ( System . getSecurityManager ( ) == null ) { for ( Bundle bundle : componentContext . getBundleContext ( ) . getBundles ( ) ) { if ( resourceAdapterID . equals ( "wasJms" ) && ( "com.ibm.ws.messaging.jms.1.1" . equals ( bundle . getSymbolicName ( ) ) || "com.ibm.ws.messaging.jms.2.0" . equals ( bundle . getSymbolicName ( ) ) ) ) return bundle . loadClass ( className ) ; else if ( resourceAdapterID . equals ( "wmqJms" ) && "com.ibm.ws.messaging.jms.wmq" . equals ( bundle . getSymbolicName ( ) ) ) return bundle . loadClass ( className ) ; } throw new ClassNotFoundException ( className ) ; } else { try { return AccessController . doPrivileged ( new PrivilegedExceptionAction < Class < ? > > ( ) { @ Override public Class < ? > run ( ) throws ClassNotFoundException { for ( Bundle bundle : componentContext . getBundleContext ( ) . getBundles ( ) ) { if ( resourceAdapterID . equals ( "wasJms" ) && ( "com.ibm.ws.messaging.jms.1.1" . equals ( bundle . getSymbolicName ( ) ) || "com.ibm.ws.messaging.jms.2.0" . equals ( bundle . getSymbolicName ( ) ) ) ) return bundle . loadClass ( className ) ; else if ( resourceAdapterID . equals ( "wmqJms" ) && "com.ibm.ws.messaging.jms.wmq" . equals ( bundle . getSymbolicName ( ) ) ) return bundle . loadClass ( className ) ; } throw new ClassNotFoundException ( className ) ; } } ) ; } catch ( PrivilegedActionException e ) { throw ( ClassNotFoundException ) e . getCause ( ) ; } } } catch ( ClassNotFoundException cnf ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "Could not find adapter file and bundle does not have the class either. Possible cause is incorrectly specified file path." , cnf ) ; } throw cnf ; } }
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 request ) { } }
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 ( key ) ) ) ; params . append ( "&" ) ; } params . deleteCharAt ( params . length ( ) - 1 ) ; } return params . toString ( ) ;