signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class JolokiaMBeanServer { /** * Extract convert options from annotation */ private JsonConvertOptions getJsonConverterOptions ( JsonMBean pAnno ) { } }
// Extract conversion options from the annotation if ( pAnno == null ) { return JsonConvertOptions . DEFAULT ; } else { ValueFaultHandler faultHandler = pAnno . faultHandling ( ) == JsonMBean . FaultHandler . IGNORE_ERRORS ? ValueFaultHandler . IGNORING_VALUE_FAULT_HANDLER : ValueFaultHandler . THROWING_VALUE_FAULT_HAN...
public class Cluster { /** * Starts up a work unit that this node has claimed . * If " smart rebalancing " is enabled , hand the listener a meter to mark load . * Otherwise , just call " startWork " on the listener and let the client have at it . * TODO : Refactor to remove check and cast . */ public void startWo...
if ( waitInProgress . get ( ) ) LOG . warn ( "Claiming work during wait!" ) ; LOG . info ( "Successfully claimed {}: {}. Starting..." , config . workUnitName , workUnit ) ; final boolean added = myWorkUnits . add ( workUnit ) ; if ( added ) { if ( balancingPolicy instanceof MeteredBalancingPolicy ) { MeteredBalancingPo...
public class LexTokenReader { /** * Check the next character is as expected . If the character is not as expected , throw the message as a * { @ link LexException } . * @ param c * The expected next character . * @ param number * The number of the error message . * @ param message * The error message . ...
if ( ch == c ) { rdCh ( ) ; } else { throwMessage ( number , message ) ; }
public class FileLocator { /** * Get a list of Files from the given path that match the provided filter ; * not recursive . * @ param root * base directory to look for files * @ param filterExpr * the regular expression to match , may be null * @ return List of File objects ; List will be empty if root is n...
if ( root == null ) return Collections . emptyList ( ) ; File fileList [ ] ; FileFilter filter ; if ( filterExpr == null ) filter = new FilesOnly ( ) ; else filter = new FilesOnlyFilter ( filterExpr ) ; fileList = root . listFiles ( filter ) ; if ( fileList == null ) return Collections . emptyList ( ) ; else { if ( fil...
public class LayersFactory { /** * Load the available layers . * @ param image the installed image * @ param productConfig the product config to establish the identity * @ param moduleRoots the module roots * @ param bundleRoots the bundle roots * @ return the layers * @ throws IOException */ static Install...
// build the identity information final String productVersion = productConfig . resolveVersion ( ) ; final String productName = productConfig . resolveName ( ) ; final Identity identity = new AbstractLazyIdentity ( ) { @ Override public String getName ( ) { return productName ; } @ Override public String getVersion ( )...
public class RpcProtocol { /** * Url - encodes a string . */ static String urlencode ( final String s ) { } }
try { return URLEncoder . encode ( s , CHARSET_NAME ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; }
import java . util . * ; class Main { /** * Extract the index at which the minimum value is found from a list of tuples . * @ param inputList A list of tuples , each containing a string and an integer . * @ return The string from the tuple in the input list which has the minimum integer value . */ public static Str...
Tuple minTuple = Collections . min ( inputList , new Comparator < Tuple > ( ) { @ Override public int compare ( Tuple o1 , Tuple o2 ) { return o1 . getY ( ) - o2 . getY ( ) ; } } ) ; return minTuple . getX ( ) ;
public class RegexParser { /** * regex : : = term ( ` | ` term ) * * term : : = factor + * factor : : = ( ' ^ ' | ' $ ' | ' \ A ' | ' \ Z ' | ' \ z ' | ' \ b ' | ' \ B ' | ' \ < ' | ' \ > ' * | atom ( ( ' * ' | ' + ' | ' ? ' | minmax ) ' ? ' ? ) ? ) * | ' ( ? = ' regex ' ) ' | ' ( ? ! ' regex ' ) ' | ' ( ? & lt...
Token tok = this . parseTerm ( ) ; Token parent = null ; while ( this . read ( ) == T_OR ) { this . next ( ) ; if ( parent == null ) { parent = Token . createUnion ( ) ; parent . addChild ( tok ) ; tok = parent ; } tok . addChild ( this . parseTerm ( ) ) ; } return tok ;
public class ModeledObjectPermissionService { /** * Determines whether the current user has permission to update the given * target entity , adding or removing the given permissions . Such permission * depends on whether the current user is a system administrator , whether * they have explicit UPDATE permission o...
// A system adminstrator can do anything if ( user . getUser ( ) . isAdministrator ( ) ) return true ; // Verify user has update permission on the target entity ObjectPermissionSet permissionSet = getRelevantPermissionSet ( user . getUser ( ) , targetEntity ) ; if ( ! permissionSet . hasPermission ( ObjectPermission . ...
public class XSLTAttributeDef { /** * Process an attribute string of type T _ AVT into * a AVT value . * @ param handler non - null reference to current StylesheetHandler that is constructing the Templates . * @ param uri The Namespace URI , or an empty string . * @ param name The local name ( without prefix ) ...
try { AVT avt = new AVT ( handler , uri , name , rawName , value , owner ) ; return avt ; } catch ( TransformerException te ) { throw new org . xml . sax . SAXException ( te ) ; }
public class ProductUrl { /** * Get Resource Url for GetProduct * @ param acceptVariantProductCode Specifies whether to accept a product variant ' s code as the . When you set this parameter to , you can pass in a product variant ' s code in the GetProduct call to retrieve the product variant details that are associa...
UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/storefront/products/{productCode}?variationProductCode={variationProductCode}&allowInactive={allowInactive}&skipInventoryCheck={skipInventoryCheck}&supressOutOfStock404={supressOutOfStock404}&quantity={quantity}&acceptVariantProductCode={acceptVariantPr...
public class TapeRecoveryPointInfoMarshaller { /** * Marshall the given parameter object . */ public void marshall ( TapeRecoveryPointInfo tapeRecoveryPointInfo , ProtocolMarshaller protocolMarshaller ) { } }
if ( tapeRecoveryPointInfo == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( tapeRecoveryPointInfo . getTapeARN ( ) , TAPEARN_BINDING ) ; protocolMarshaller . marshall ( tapeRecoveryPointInfo . getTapeRecoveryPointTime ( ) , TAPERECOVERYPOI...
public class CSSHTMLBundleLinkRenderer { /** * Returns true if the renderer must render a CSS bundle link even in debug * mode * @ param ctx * the context * @ param debugOn * the debug flag * @ return true if the renderer must render a CSS bundle link even in debug * mode */ private boolean isForcedToRend...
return debugOn && getResourceType ( ) . equals ( JawrConstant . CSS_TYPE ) && bundler . getConfig ( ) . isForceCssBundleInDebugForIEOn ( ) && RendererRequestUtils . isIE ( ctx . getRequest ( ) ) ;
public class SeGoodsSpecifics { /** * < p > Setter for specifics . < / p > * @ param pSpecifics reference */ @ Override public final void setSpecifics ( final SpecificsOfItem pSpecifics ) { } }
this . specifics = pSpecifics ; if ( this . itsId == null ) { this . itsId = new SeGoodsSpecificsId ( ) ; } this . itsId . setSpecifics ( this . specifics ) ;
public class TarArchive { /** * Set the debugging flag . * @ param debugF * The new debug setting . */ public void setDebug ( boolean debugF ) { } }
this . debug = debugF ; if ( this . tarIn != null ) { this . tarIn . setDebug ( debugF ) ; } else if ( this . tarOut != null ) { this . tarOut . setDebug ( debugF ) ; }
public class WsLogger { /** * @ see java . util . logging . Logger # fine ( java . lang . String ) */ @ Override public void fine ( String msg ) { } }
if ( isLoggable ( Level . FINE ) ) { log ( Level . FINE , msg ) ; }
public class RegistriesInner { /** * Updates a container registry with the specified parameters . * @ param resourceGroupName The name of the resource group to which the container registry belongs . * @ param registryName The name of the container registry . * @ param registryUpdateParameters The parameters for u...
return beginUpdateWithServiceResponseAsync ( resourceGroupName , registryName , registryUpdateParameters ) . toBlocking ( ) . single ( ) . body ( ) ;
public class Util { /** * Create a HttpCarbonMessage using the netty inbound http request . * @ param httpRequestHeaders of inbound request * @ param ctx of the inbound request * @ param sourceHandler instance which handled the particular request * @ return HttpCarbon message */ public static HttpCarbonMessage ...
HttpCarbonMessage inboundRequestMsg = new HttpCarbonRequest ( httpRequestHeaders , new DefaultListener ( ctx ) ) ; inboundRequestMsg . setProperty ( Constants . POOLED_BYTE_BUFFER_FACTORY , new PooledDataStreamerFactory ( ctx . alloc ( ) ) ) ; inboundRequestMsg . setProperty ( Constants . CHNL_HNDLR_CTX , ctx ) ; inbou...
public class WaitSet { /** * executed with an unpark for the same key . */ public void unpark ( Notifier notifier , WaitNotifyKey key ) { } }
WaitSetEntry entry = queue . peek ( ) ; while ( entry != null ) { Operation op = entry . getOperation ( ) ; if ( notifier == op ) { throw new IllegalStateException ( "Found cyclic wait-notify! -> " + notifier ) ; } if ( entry . isValid ( ) ) { if ( entry . isExpired ( ) ) { // expired entry . onExpire ( ) ; } else if (...
public class InstanceCheck { /** * Creates a new instance check . * @ param typeDescription The type to apply the instance check against . * @ return An appropriate stack manipulation . */ public static StackManipulation of ( TypeDescription typeDescription ) { } }
if ( typeDescription . isPrimitive ( ) ) { throw new IllegalArgumentException ( "Cannot check an instance against a primitive type: " + typeDescription ) ; } return new InstanceCheck ( typeDescription ) ;
public class InvocationProxyFactory { /** * Add a interface type that should be implemented by the resulting invocation proxy . * @ param ifc must not be { @ literal null } and must be an interface type . */ public void addInterface ( Class < ? > ifc ) { } }
LettuceAssert . notNull ( ifc , "Interface type must not be null" ) ; LettuceAssert . isTrue ( ifc . isInterface ( ) , "Type must be an interface" ) ; this . interfaces . add ( ifc ) ;
public class MultiPolygon { /** * Creates a MultiPolygon from the given { @ link Polygon } sequence . * @ param polygons The { @ link Polygon } Iterable . * @ return MultiPolygon */ public static MultiPolygon of ( Iterable < Polygon > polygons ) { } }
MultiDimensionalPositions . Builder positionsBuilder = MultiDimensionalPositions . builder ( ) ; for ( Polygon polygon : polygons ) { positionsBuilder . addAreaPosition ( polygon . positions ( ) ) ; } return new MultiPolygon ( positionsBuilder . build ( ) ) ;
public class SparseHashMatrix { /** * Checks that the indices are within the bounds of this matrix or throws an * { @ link IndexOutOfBoundsException } if not . */ private void checkIndices ( int row , int col ) { } }
if ( row < 0 || col < 0 || row >= rows || col >= columns ) { throw new IndexOutOfBoundsException ( ) ; }
public class Camera { /** * Sets the eye position , the center of the scene and which axis is facing upward . * @ param eyeX * The x - coordinate for the eye . * @ param eyeY * The y - coordinate for the eye . * @ param eyeZ * The z - coordinate for the eye . * @ param centerX * The x - coordinate for t...
this . eyeX = eyeX ; this . eyeY = eyeY ; this . eyeZ = eyeZ ; this . centerX = centerX ; this . centerY = centerY ; this . centerZ = centerZ ; this . upX = upX ; this . upY = upY ; this . upZ = upZ ;
public class AjaxBehavior { /** * < p class = " changed _ added _ 2_2 " > * Return the resetValues status of this behavior . < / p > * @ since 2.2 */ public boolean isResetValues ( ) { } }
Boolean result = ( Boolean ) eval ( RESET_VALUES , resetValues ) ; return ( ( result != null ) ? result : false ) ;
public class MapConstraints { /** * Returns a constrained view of the specified bimap , using the specified * constraint . Any operations that modify the bimap will have the associated * keys and values verified with the constraint . * < p > The returned bimap is not serializable . * @ param map the bimap to co...
return new ConstrainedBiMap < K , V > ( map , null , constraint ) ;
public class SparkSaslClient { /** * Disposes of any system resources or security - sensitive information the * SaslClient might be using . */ @ Override public synchronized void dispose ( ) { } }
if ( saslClient != null ) { try { saslClient . dispose ( ) ; } catch ( SaslException e ) { // ignore } finally { saslClient = null ; } }
public class AmazonRoute53DomainsClient { /** * This operation removes the transfer lock on the domain ( specifically the < code > clientTransferProhibited < / code > * status ) to allow domain transfers . We recommend you refrain from performing this action unless you intend to * transfer the domain to a different...
request = beforeClientExecution ( request ) ; return executeDisableDomainTransferLock ( request ) ;
public class CmsPermissionView { /** * Returns a String array with the possible entry types . < p > * @ param all to include all types , or just user , groups and roles * @ return the possible types */ protected String [ ] getTypes ( boolean all ) { } }
if ( ! all ) { String [ ] array = new String [ 3 ] ; return Arrays . asList ( CmsPermissionDialog . PRINCIPAL_TYPES ) . subList ( 0 , 3 ) . toArray ( array ) ; } return CmsPermissionDialog . PRINCIPAL_TYPES ;
public class SceneStructureMetric { /** * Counts the total number of unknown camera parameters that will be optimized / * @ return Number of parameters */ public int getUnknownCameraParameterCount ( ) { } }
int total = 0 ; for ( int i = 0 ; i < cameras . length ; i ++ ) { if ( ! cameras [ i ] . known ) { total += cameras [ i ] . model . getIntrinsicCount ( ) ; } } return total ;
public class VirtualNetworkGatewayConnectionsInner { /** * Gets the specified virtual network gateway connection by resource group . * @ param resourceGroupName The name of the resource group . * @ param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection . * @ throws IllegalArg...
return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayConnectionName ) . toBlocking ( ) . single ( ) . body ( ) ;
public class VarTupleSet { /** * Returns a measure of the " used - ness " of the given binding . If < CODE > onceOnly < / CODE > is true , consider only once - only tuples . * Returns a value between 0 and 1 ( exclusive ) - - a higher value means a binding is more used . */ private double getUsedScore ( VarBindingDef...
// Since used tuples are in least - recently - used - first order , start from the end of the list and look // for the first tuple that includes this binding . This is the most recent use of this binding . // Return the distance of this tuple from the start of the list , as percentage of the size of the list . int inde...
public class PrcSalRetLnCreate { /** * < p > Process entity request . < / p > * @ param pReqVars additional param , e . g . return this line ' s * document in " nextEntity " for farther process * @ param pRequestData Request Data * @ param pEntity Entity to process * @ return Entity processed for farther proc...
SalesReturnLine entity = this . prcEntityCreate . process ( pReqVars , pEntityPb , pRequestData ) ; pReqVars . put ( "DebtorCreditortaxDestinationdeepLevel" , 2 ) ; Set < String > ndFlDc = new HashSet < String > ( ) ; ndFlDc . add ( "itsId" ) ; ndFlDc . add ( "isForeigner" ) ; ndFlDc . add ( "taxDestination" ) ; pReqVa...
public class Benchmark { /** * Closes this benchmark and calculates totals and times . */ public final void close ( ) { } }
while ( subChannel . size ( ) > 0 ) { subs . addSample ( subChannel . poll ( ) ) ; } while ( pubChannel . size ( ) > 0 ) { pubs . addSample ( pubChannel . poll ( ) ) ; } if ( subs . hasSamples ( ) ) { start = subs . getStart ( ) ; end = subs . getEnd ( ) ; if ( pubs . hasSamples ( ) ) { end = Math . min ( end , pubs . ...
public class AttributeTypeServiceImpl { /** * Returns an enriched AttributeType for when the value meets certain criteria i . e . if a string * value is longer dan 255 characters , the type should be TEXT */ private AttributeType getEnrichedType ( AttributeType guess , Object value ) { } }
if ( guess == null || value == null ) { return guess ; } if ( guess . equals ( STRING ) ) { String stringValue = value . toString ( ) ; if ( stringValue . length ( ) > MAX_STRING_LENGTH ) { return TEXT ; } if ( canValueBeUsedAsDate ( value ) ) { return DATE ; } } else if ( guess . equals ( DECIMAL ) ) { if ( value inst...
public class SynchronizeFXWebsocketChannel { /** * Informs this { @ link CommandTransferServer } that a client connection got closed . * @ param connection The connection that was closed */ void connectionCloses ( final Session connection ) { } }
synchronized ( connections ) { final ExecutorService executorService = connectionThreads . get ( connection ) ; if ( executorService != null ) { executorService . shutdownNow ( ) ; } connectionThreads . remove ( connection ) ; connections . remove ( connection ) ; }
public class BodyParserXML { /** * Invoke the parser and get back a Java object populated * with the content of this request . * MUST BE THREAD SAFE TO CALL ! * @ param context The context * @ param classOfT The class we expect * @ param genericType the generic type * @ return The object instance populated ...
T t = null ; try { final String content = context . body ( ) ; if ( content == null || content . length ( ) == 0 ) { return null ; } if ( classOfT . equals ( Document . class ) ) { return ( T ) parseXMLDocument ( content . getBytes ( Charsets . UTF_8 ) ) ; } if ( genericType != null ) { t = xml . xmlMapper ( ) . readVa...
public class CmsModule { /** * Removes the resources not accessible with the provided { @ link CmsObject } . * @ param cms the { @ link CmsObject } used to read the resources . * @ param sitePaths site relative paths of the resources that should be checked for accessibility . * @ return site paths of the accessib...
List < String > result = new ArrayList < String > ( sitePaths . size ( ) ) ; for ( String sitePath : sitePaths ) { if ( cms . existsResource ( sitePath , CmsResourceFilter . IGNORE_EXPIRATION ) ) { result . add ( sitePath ) ; } } return result ;
public class ExtraLanguageFeatureNameConverter { /** * Replies the type of conversion for the given feature call . * @ param featureCall the feature call . * @ return the type of conversion . */ public ConversionType getConversionTypeFor ( XAbstractFeatureCall featureCall ) { } }
if ( this . conversions == null ) { this . conversions = initMapping ( ) ; } final List < Object > receiver = new ArrayList < > ( ) ; AbstractExpressionGenerator . buildCallReceiver ( featureCall , this . keywords . getThisKeywordLambda ( ) , this . referenceNameLambda , receiver ) ; final String simpleName = AbstractE...
public class StyleWrapper { /** * Swap two elements of the list . * @ param src the position first element . * @ param dest the position second element . */ public void swap ( int src , int dest ) { } }
List < FeatureTypeStyle > ftss = style . featureTypeStyles ( ) ; if ( src >= 0 && src < ftss . size ( ) && dest >= 0 && dest < ftss . size ( ) ) { Collections . swap ( ftss , src , dest ) ; Collections . swap ( featureTypeStylesWrapperList , src , dest ) ; }
public class MonetaryFunctions { /** * Creates a the summary of MonetaryAmounts . * @ param currencyUnit the target { @ link javax . money . CurrencyUnit } * @ return the MonetarySummaryStatistics */ public static Collector < MonetaryAmount , MonetarySummaryStatistics , MonetarySummaryStatistics > summarizingMoneta...
Supplier < MonetarySummaryStatistics > supplier = ( ) -> new DefaultMonetarySummaryStatistics ( currencyUnit ) ; return Collector . of ( supplier , MonetarySummaryStatistics :: accept , MonetarySummaryStatistics :: combine ) ;
public class VisitorPlugin { /** * The classes are sorted for test purposes only . This gives us a predictable order for our * assertions on the generated code . * @ param outline */ private Set < ClassOutline > sortClasses ( Outline outline ) { } }
Set < ClassOutline > sorted = new TreeSet < > ( ( aOne , aTwo ) -> { String one = aOne . implClass . fullName ( ) ; String two = aTwo . implClass . fullName ( ) ; return one . compareTo ( two ) ; } ) ; sorted . addAll ( outline . getClasses ( ) ) ; return sorted ;
public class OrganizationService { /** * Attach a { @ link OrganizationModel } with the given organization to the provided { @ link ArchiveModel } . If an existing Model * exists with the provided organization , that one will be used instead . */ public OrganizationModel attachOrganization ( ArchiveModel archiveModel...
OrganizationModel model = getUnique ( getQuery ( ) . traverse ( g -> g . has ( OrganizationModel . NAME , organizationName ) ) . getRawTraversal ( ) ) ; if ( model == null ) { model = create ( ) ; model . setName ( organizationName ) ; model . addArchiveModel ( archiveModel ) ; } else { return attachOrganization ( mode...
public class CmsDisableMenuEntry { /** * Checks if the entry is disabled . < p > * @ return < code > true < / code > if the entry is disabled */ private boolean isEntryDisabled ( ) { } }
CmsClientSitemapEntry entry = getHoverbar ( ) . getEntry ( ) ; final CmsUUID id = entry . getId ( ) ; return getHoverbar ( ) . getController ( ) . isEditable ( ) && CmsSitemapView . getInstance ( ) . isDisabledModelPageEntry ( id ) ;
public class WizardDialogDecorator { /** * Adapts the visibility of the dialog ' s buttons . */ private void adaptButtonBarVisibility ( ) { } }
if ( buttonBarContainer != null ) { buttonBarContainer . setVisibility ( buttonBarShown ? View . VISIBLE : View . GONE ) ; }
public class Functions { /** * Runs create digest auth header function with arguments . * @ return */ public static String digestAuthHeader ( String username , String password , String realm , String noncekey , String method , String uri , String opaque , String algorithm , TestContext context ) { } }
return new DigestAuthHeaderFunction ( ) . execute ( Arrays . asList ( username , password , realm , noncekey , method , uri , opaque , algorithm ) , context ) ;
public class FlinkKafkaConsumerBase { /** * Specifies the consumer to start reading partitions from specific offsets , set independently for each partition . * The specified offset should be the offset of the next record that will be read from partitions . * This lets the consumer ignore any committed group offsets...
this . startupMode = StartupMode . SPECIFIC_OFFSETS ; this . startupOffsetsTimestamp = null ; this . specificStartupOffsets = checkNotNull ( specificStartupOffsets ) ; return this ;
public class HttpStatusCodeException { /** * Return the response body converted to the given class * @ since 3.0.5 */ public < T > T getResponseBody ( Class < T > clazz ) { } }
final ByteBuf byteBuf = httpInputMessage . getBody ( ) ; if ( byteBuf . readableBytes ( ) == 0 || Void . class . isAssignableFrom ( clazz ) ) return null ; final MediaType mediaType = MediaType . parseMediaType ( httpInputMessage . getHeaders ( ) . get ( HttpHeaders . CONTENT_TYPE ) ) ; for ( HttpMessageConverter httpM...
public class Annotate { /** * TODO move to ixa - pipe - ml */ private static List < String > buildSegmentedSentences ( final BufferedReader breader ) { } }
String line ; List < String > sentences = new ArrayList < > ( ) ; try { while ( ( line = breader . readLine ( ) ) != null ) { sentences . add ( line ) ; } } catch ( final IOException e ) { LOG . error ( "IOException" , e ) ; } return sentences ;
public class NextClient { /** * put params into url queries */ public NextResponse delete ( final String url , final Map < String , String > queries , final Map < String , String > headers ) throws IOException { } }
return request ( HttpMethod . DELETE , url , queries , null , headers ) ;
public class MapBuilder { /** * Adds an entry to the map for this builder if the given value is present . */ public MapBuilder < K , V > putIf ( K key , Optional < V > value ) { } }
value . ifPresent ( v -> map_ . put ( key , v ) ) ; return this ;
public class DomImplFF { /** * { @ inheritDoc } */ public void setTransformOrigin ( Element element , String origin ) { } }
DOM . setStyleAttribute ( element , "MozTransformOrigin" , origin ) ; // added for IE11 DOM . setStyleAttribute ( element , "transformOrigin" , origin ) ;
public class NumberFeaturesTile { /** * { @ inheritDoc } */ @ Override public BufferedImage drawTile ( int tileWidth , int tileHeight , long tileFeatureCount , CloseableIterator < GeometryIndex > geometryIndexResults ) { } }
String featureText = String . valueOf ( tileFeatureCount ) ; BufferedImage image = drawTile ( tileWidth , tileHeight , featureText ) ; return image ;
public class JSONUtils { /** * Finds out if n represents a Double . * @ return true if n is instanceOf Double or the literal value can be * evaluated as a Double . */ private static boolean isDouble ( Number n ) { } }
if ( n instanceof Double ) { return true ; } try { double d = Double . parseDouble ( String . valueOf ( n ) ) ; return ! Double . isInfinite ( d ) ; } catch ( NumberFormatException e ) { return false ; }
public class QstatQueuesParser { /** * ( non - Javadoc ) * @ see com . tupilabs . pbs . parser . Parser # parse ( java . lang . Object ) */ @ Override public List < Queue > parse ( String text ) throws ParseException { } }
final List < Queue > queues ; if ( StringUtils . isNotBlank ( text ) ) { queues = new LinkedList < Queue > ( ) ; String separator = "\n" ; if ( text . indexOf ( "\r\n" ) > 0 ) { separator = "\r\n" ; } final String [ ] lines = text . split ( separator ) ; Queue queue = null ; for ( final String line : lines ) { Matcher ...
public class AVFirebaseMessagingService { /** * FCM 有两种消息 : 通知消息与数据消息 。 * 通知消息 - - 就是普通的通知栏消息 , 应用在后台的时候 , 通知消息会直接显示在通知栏 , 默认情况下 , * 用户点按通知即可打开应用启动器 ( 通知消息附带的参数在 Bundle 内 ) , 我们无法处理 。 * 数据消息 - - 类似于其他厂商的 「 透传消息 」 。 应用在前台的时候 , 数据消息直接发送到应用内 , 应用层通过这一接口进行响应 。 * @ param remoteMessage */ @ Override public void onMes...
Map < String , String > data = remoteMessage . getData ( ) ; if ( null == data ) { return ; } LOGGER . d ( "received message from: " + remoteMessage . getFrom ( ) + ", payload: " + data . toString ( ) ) ; try { JSONObject jsonObject = JSON . parseObject ( data . get ( "payload" ) ) ; if ( null != jsonObject ) { String ...
public class ChartRunner { /** * Set next chart object * @ param chart next chart object */ public void setChart ( Chart chart ) { } }
this . chart = chart ; if ( this . chart . getReport ( ) . getQuery ( ) != null ) { this . chart . getReport ( ) . getQuery ( ) . setDialect ( dialect ) ; }
public class GrailsParameterMap { /** * Builds up a multi dimensional hash structure from the parameters so that nested keys such as * " book . author . name " can be addressed like params [ ' author ' ] . name * This also allows data binding to occur for only a subset of the properties in the parameter map . */ pr...
final int nestedIndex = nestedKey . indexOf ( '.' ) ; if ( nestedIndex == - 1 ) { return ; } // We have at least one sub - key , so extract the first element // of the nested key as the prfix . In other words , if we have // ' nestedKey ' = = " a . b . c " , the prefix is " a " . String nestedPrefix = nestedKey . subst...
public class JwwfServer { /** * < p > Binds ServletHolder to URL , this allows creation of REST APIs , etc < / p > * < p > PLUGINS : Plugin servlets should have url ' s like / _ _ jwwf / myplugin / stuff < / p > * @ param servlet Servlet holder * @ param url URL to bind servlet to * @ return This JwwfServer */ ...
context . addServlet ( new ServletHolder ( servlet ) , url ) ; return this ;
public class PowerShell { /** * Initializes PowerShell console in which we will enter the commands */ private PowerShell initalize ( String powerShellExecutablePath ) throws PowerShellNotAvailableException { } }
String codePage = PowerShellCodepage . getIdentifierByCodePageName ( Charset . defaultCharset ( ) . name ( ) ) ; ProcessBuilder pb ; // Start powershell executable in process if ( OSDetector . isWindows ( ) ) { pb = new ProcessBuilder ( "cmd.exe" , "/c" , "chcp" , codePage , ">" , "NUL" , "&" , powerShellExecutablePath...
public class AbstractSourceImporter { /** * Method to search the Instance which is imported . * @ return Instance of the imported program * @ throws InstallationException if search failed */ public Instance searchInstance ( ) throws InstallationException { } }
Instance instance = null ; try { // check if type exists . Necessary for first time installations if ( getCiType ( ) . getType ( ) != null ) { final QueryBuilder queryBldr = new QueryBuilder ( getCiType ( ) ) ; queryBldr . addWhereAttrEqValue ( CIAdminProgram . Abstract . Name , this . programName ) ; final InstanceQue...
public class UriCodec { /** * Throws if { @ code s } contains characters that are not letters , digits or * in { @ code legal } . */ public static void validateSimple ( String s , String legal ) throws URISyntaxException { } }
for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char ch = s . charAt ( i ) ; if ( ! ( ( ch >= 'a' && ch <= 'z' ) || ( ch >= 'A' && ch <= 'Z' ) || ( ch >= '0' && ch <= '9' ) || legal . indexOf ( ch ) > - 1 ) ) { throw new URISyntaxException ( s , "Illegal character" , i ) ; } }
public class ImageLoader { /** * Convert an input stream to an bgr spectrum image * @ param file the file to convert * @ return the input stream to convert */ public INDArray toBgr ( File file ) { } }
try { BufferedInputStream bis = new BufferedInputStream ( new FileInputStream ( file ) ) ; INDArray ret = toBgr ( bis ) ; bis . close ( ) ; return ret ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; }
public class PipeInMessage { /** * private InboxAmp getCallerInbox ( ) * return _ callerInbox ; */ @ Override public final void invokeQuery ( InboxAmp inbox , StubAmp actorDeliver ) { } }
try { MethodAmp method = method ( ) ; StubAmp actorMessage = serviceRef ( ) . stub ( ) ; StubStateAmp load = actorDeliver . load ( actorMessage , this ) ; load . inPipe ( actorDeliver , actorMessage , method , getHeaders ( ) , this , _args ) ; } catch ( Throwable e ) { fail ( e ) ; }
public class Groups { /** * Indexes elements from the iterator using passed function . E . g : * < code > indexBy ( [ 1,2,3,4 ] , id ) - > { 1:1 , 2:2 , 3:3 , 4:4 } < / code > * @ param < K > the key type * @ param < V > the value type * @ param < M > the map type * @ param groupies elements to be indexed *...
return new IndexBy < > ( indexer , mapProvider ) . apply ( groupies ) ;
public class JavaUtils { /** * Determines the type which is least " specific " ( i . e . parametrized types are more " specific " than generic types , * types which are not { @ link Object } are less specific ) . If no exact statement can be made , the second type is chosen . * @ param types The types * @ return ...
switch ( types . length ) { case 0 : throw new IllegalArgumentException ( "At least one type has to be provided" ) ; case 1 : return types [ 0 ] ; case 2 : return determineLeastSpecific ( types [ 0 ] , types [ 1 ] ) ; default : String currentLeastSpecific = determineLeastSpecific ( types [ 0 ] , types [ 1 ] ) ; for ( i...
public class SOAPHelper { /** * Create message from stream with headers * @ param headers * @ param is * @ return */ public static SOAPMessage createSoapFromStream ( Map < String , String > headers , InputStream is ) { } }
return createSoapFromStream ( null , headers , is ) ;
public class Matrix4d { /** * / * ( non - Javadoc ) * @ see org . joml . Matrix4dc # rotateTowardsXY ( double , double , org . joml . Matrix4d ) */ public Matrix4d rotateTowardsXY ( double dirX , double dirY , Matrix4d dest ) { } }
if ( ( properties & PROPERTY_IDENTITY ) != 0 ) return dest . rotationTowardsXY ( dirX , dirY ) ; double rm00 = dirY ; double rm01 = dirX ; double rm10 = - dirX ; double rm11 = dirY ; double nm00 = m00 * rm00 + m10 * rm01 ; double nm01 = m01 * rm00 + m11 * rm01 ; double nm02 = m02 * rm00 + m12 * rm01 ; double nm03 = m03...
public class tmtrafficpolicy { /** * Use this API to fetch filtered set of tmtrafficpolicy resources . * filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */ public static tmtrafficpolicy [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } }
tmtrafficpolicy obj = new tmtrafficpolicy ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; tmtrafficpolicy [ ] response = ( tmtrafficpolicy [ ] ) obj . getfiltered ( service , option ) ; return response ;
public class UnsafeExternalSorter { /** * Allocates more memory in order to insert an additional record . This will request additional * memory from the memory manager and spill if the requested memory can not be obtained . * @ param required the required space in the data page , in bytes , including space for stor...
if ( currentPage == null || pageCursor + required > currentPage . getBaseOffset ( ) + currentPage . size ( ) ) { // TODO : try to find space on previous pages currentPage = allocatePage ( required ) ; pageCursor = currentPage . getBaseOffset ( ) ; allocatedPages . add ( currentPage ) ; }
public class CollectionUtil { /** * Creates a thin { @ link Iterator } wrapper around an array . * @ param pArray the array to iterate * @ param pStart the offset into the array * @ param pLength the number of elements to include in the iterator * @ return a new { @ link ListIterator } * @ throws IllegalArgum...
return new ArrayIterator < E > ( pArray , pStart , pLength ) ;
public class AbstractVegetationObjectType { /** * Gets the value of the genericApplicationPropertyOfVegetationObject property . * This accessor method returns a reference to the live list , * not a snapshot . Therefore any modification you make to the * returned list will be present inside the JAXB object . * T...
if ( _GenericApplicationPropertyOfVegetationObject == null ) { _GenericApplicationPropertyOfVegetationObject = new ArrayList < JAXBElement < Object > > ( ) ; } return this . _GenericApplicationPropertyOfVegetationObject ;
public class StructureSequenceMatcher { /** * Get a substructure of { @ code wholeStructure } containing only the { @ link Group Groups } that are included in * { @ code sequence } . The resulting structure will contain only { @ code ATOM } residues ; the SEQ - RES will be empty . * The { @ link Chain Chains } of t...
ResidueNumber [ ] rns = matchSequenceToStructure ( sequence , wholeStructure ) ; Structure structure = wholeStructure . clone ( ) ; structure . setChains ( new ArrayList < > ( ) ) ; // structure . getHetGroups ( ) . clear ( ) ; Chain currentChain = null ; for ( ResidueNumber rn : rns ) { if ( rn == null ) continue ; Gr...
public class AllConnectConnectionHolder { /** * Add alive . * @ param providerInfo the provider * @ param transport the transport */ protected void addAlive ( ProviderInfo providerInfo , ClientTransport transport ) { } }
if ( checkState ( providerInfo , transport ) ) { aliveConnections . put ( providerInfo , transport ) ; }
public class TimePickerDialog { /** * Update the hours , minutes , seconds and AM / PM displays with the typed times . If the typedTimes * is empty , either show an empty display ( filled with the placeholder text ) , or update from the * timepicker ' s values . * @ param allowEmptyDisplay if true , then if the t...
if ( ! allowEmptyDisplay && mTypedTimes . isEmpty ( ) ) { int hour = mTimePicker . getHours ( ) ; int minute = mTimePicker . getMinutes ( ) ; int second = mTimePicker . getSeconds ( ) ; setHour ( hour , true ) ; setMinute ( minute ) ; setSecond ( second ) ; if ( ! mIs24HourMode ) { updateAmPmDisplay ( hour < 12 ? AM : ...
public class UrlStartWithMatcher { /** * 将URL拆成两块 : 反序后的斜线前面的主机 、 端口和帐号 ; 斜线后面的路径和参数 。 * 比如对于http : / / www . news . com / read / daily / headline . html , 返回的是 : * moc . swen . www和read / daily / headline . html两项 。 * @ param urlURL , 可以带http : / / , 也可不带 * @ return第一项是反序后的斜线前面的 , 第二项是斜线后面的 。 而且已经被转为小写 。 */ st...
String beforePart ; String afterPart ; String [ ] l = new String [ 2 ] ; int protocolEnd = url . indexOf ( "://" ) ; if ( protocolEnd == - 1 ) { // 如果没有协议信息 protocolEnd = - 3 ; } int pathStart = url . indexOf ( "/" , protocolEnd + 3 ) ; if ( pathStart == - 1 ) { // 没路径信息 pathStart = url . length ( ) ; afterPart = "" ; ...
public class DescribeAnalysisSchemesRequest { /** * The analysis schemes you want to describe . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setAnalysisSchemeNames ( java . util . Collection ) } or { @ link # withAnalysisSchemeNames ( java . util . Collect...
if ( this . analysisSchemeNames == null ) { setAnalysisSchemeNames ( new com . amazonaws . internal . SdkInternalList < String > ( analysisSchemeNames . length ) ) ; } for ( String ele : analysisSchemeNames ) { this . analysisSchemeNames . add ( ele ) ; } return this ;
public class GoogleImageDAO { /** * Updates GoogleImage name . This method does not update lastModifier and lastModified fields and thus should * be called only by system operations ( e . g . scheduler ) * @ param googleImage GoogleImage entity * @ param name new resource name * @ param urlName new resource url...
googleImage . setName ( name ) ; googleImage . setUrlName ( urlName ) ; getEntityManager ( ) . persist ( googleImage ) ; return googleImage ;
public class CEMILDataEx { /** * Returns additional information data corresponding to the supplied type ID , if it is * contained in the message . * @ param infoType type ID of the request additional information * @ return additional information data or < code > null < / code > if no such information * is avail...
if ( infoType < addInfo . length && addInfo [ infoType ] != null ) return ( byte [ ] ) addInfo [ infoType ] . clone ( ) ; return null ;
public class RedisIndexer { /** * ( non - Javadoc ) * @ see com . impetus . kundera . index . Indexer # search ( java . lang . Class , * java . lang . String , int , int ) */ @ Override public Map < String , Object > search ( Class < ? > clazz , EntityMetadata m , String queryString , int start , int count ) { } }
// TODO Auto - generated method stub return null ;
public class ShowcaseAd { /** * Gets the collapsedImage value for this ShowcaseAd . * @ return collapsedImage * Image displayed in the collapsed view of the Showcase shopping * ad . * < p > The format of the image must be either JPEG * or PNG and the size of the image must be * 270x270 px . */ public com . go...
return collapsedImage ;
public class FunctionWriter { /** * @ param writer * @ throws IOException */ public void writeCloseFunction ( Writer writer ) throws IOException { } }
writer . append ( TAB ) . append ( CLOSEBRACE ) . append ( CR ) ;
public class Parser { /** * Pattern : : = " { " ( Field ( " , " Field ) * " , " ? ) ? " } " | . . . */ private ParseTree parseObjectPattern ( PatternKind kind ) { } }
SourcePosition start = getTreeStartLocation ( ) ; ImmutableList . Builder < ParseTree > fields = ImmutableList . builder ( ) ; eat ( TokenType . OPEN_CURLY ) ; while ( peekObjectPatternField ( ) ) { fields . add ( parseObjectPatternField ( kind ) ) ; if ( peek ( TokenType . COMMA ) ) { // Consume the comma separator ea...
public class EurekaClinicalClient { /** * Submits a multi - part form . * @ param path the API to call . * @ param formDataMultiPart the multi - part form content . * @ param headers any headers to add . If no Content Type header is provided , * this method adds a Content Type header for multi - part forms data...
this . readLock . lock ( ) ; try { WebResource . Builder requestBuilder = getResourceWrapper ( ) . rewritten ( path , HttpMethod . POST ) . getRequestBuilder ( ) ; requestBuilder = ensurePostMultipartHeaders ( headers , requestBuilder ) ; ClientResponse response = requestBuilder . post ( ClientResponse . class , formDa...
public class ClassLoaderUtil { /** * This method returns a method ( public , protected or private ) which appears * in the selected class or any of its parent ( interface or superclass ) or * container classes ( when the selected class is an inner class ) which * matches with the name and whose parameters are com...
int numParams = typeArgs == null ? 0 : typeArgs . length ; Method [ ] classMethods = clazz . getMethods ( ) ; for ( Method method : classMethods ) { if ( method . getName ( ) . equals ( methodName ) ) { if ( method . getParameterTypes ( ) . length == numParams ) { boolean isCompatible = true ; Class < ? > [ ] methodPar...
public class BatchPutScheduledUpdateGroupActionRequest { /** * One or more scheduled actions . The maximum number allowed is 50. * @ param scheduledUpdateGroupActions * One or more scheduled actions . The maximum number allowed is 50. */ public void setScheduledUpdateGroupActions ( java . util . Collection < Schedu...
if ( scheduledUpdateGroupActions == null ) { this . scheduledUpdateGroupActions = null ; return ; } this . scheduledUpdateGroupActions = new com . amazonaws . internal . SdkInternalList < ScheduledUpdateGroupActionRequest > ( scheduledUpdateGroupActions ) ;
public class BufferedIterator { /** * Advances the specified number of tokens in the stream and places them in * the buffer . * @ param tokens the number of tokens to advance * @ return { @ true } if the stream contained at least that many tokens , { @ code * false } if the stream contained fewer */ private boo...
while ( buffer . size ( ) < tokens && tokenizer . hasNext ( ) ) buffer . add ( tokenizer . next ( ) ) ; return buffer . size ( ) >= tokens ;
public class ApiClient { /** * Encode the given form parameters as request body . */ private String getXWWWFormUrlencodedParams ( Map < String , Object > formParams ) { } }
StringBuilder formParamBuilder = new StringBuilder ( ) ; for ( Entry < String , Object > param : formParams . entrySet ( ) ) { String valueStr = parameterToString ( param . getValue ( ) ) ; try { formParamBuilder . append ( URLEncoder . encode ( param . getKey ( ) , "utf8" ) ) . append ( "=" ) . append ( URLEncoder . e...
public class GraphIOUtil { /** * Merges the { @ code message } from the { @ link InputStream } using the given { @ code schema } . * The { @ code buffer } ' s internal byte array will be used for reading the message . */ public static < T > void mergeFrom ( InputStream in , T message , Schema < T > schema , LinkedBuf...
final CodedInput input = new CodedInput ( in , buffer . buffer , true ) ; final GraphCodedInput graphInput = new GraphCodedInput ( input ) ; schema . mergeFrom ( graphInput , message ) ; input . checkLastTagWas ( 0 ) ;
public class Dklu_kernel { /** * Computes the numerical values of x , for the solution of Lx = b . Note that x * may include explicit zeros if numerical cancelation occurs . L is assumed * to be unit - diagonal , with possibly unsorted columns ( but the first entry in * the column must always be the diagonal entr...
double xj ; double [ ] Lx ; /* int [ ] */ double [ ] Li ; int p , s , j , jnew ; int [ ] len = new int [ 1 ] ; int [ ] Li_offset = new int [ 1 ] ; int [ ] Lx_offset = new int [ 1 ] ; /* solve Lx = b */ for ( s = top ; s < n ; s ++ ) { /* forward solve with column j of L */ j = Stack [ s ] ; jnew = Pinv [ j ] ; ASSERT (...
public class EmbeddedJmxTransFactory { /** * Computes the last modified date of all configuration files . * @ param configurations the list of available configurations as Spring resources * @ return */ private long computeConfigurationLastModified ( List < Resource > configurations ) { } }
long result = 0 ; for ( Resource configuration : configurations ) { try { long currentConfigurationLastModified = configuration . lastModified ( ) ; if ( currentConfigurationLastModified > result ) { result = currentConfigurationLastModified ; } } catch ( IOException ioex ) { logger . warn ( "Error while reading last c...
public class Table { /** * Add cell nesting factory . * Set the CompositeFactory for this thread . Each new cell in the * table added by this thread will have a new Composite from this * factory nested in the Cell . * @ param factory The factory for this Thread . If null clear this * threads factory . * @ d...
if ( threadNestingMap == null ) threadNestingMap = new Hashtable ( ) ; if ( factory == null ) threadNestingMap . remove ( Thread . currentThread ( ) ) ; else threadNestingMap . put ( Thread . currentThread ( ) , factory ) ;
public class ParameterUtil { /** * Get values for a dependent parameter sql * All parent parameters must have the values in the map . * @ param con database connection * @ param qp parameter * @ param map report map of parameters * @ param vals map of parameter values * @ return values for parameter with sq...
Map < String , Object > objVals = new HashMap < String , Object > ( ) ; for ( String key : vals . keySet ( ) ) { Serializable s = vals . get ( key ) ; if ( s instanceof Serializable [ ] ) { Serializable [ ] array = ( Serializable [ ] ) s ; Object [ ] objArray = new Object [ array . length ] ; for ( int i = 0 , size = a...
public class ClientManager { /** * Renames a currently connected client from < code > oldname < / code > to < code > newname < / code > . * @ return true if the client was found and renamed . */ protected boolean renameClientObject ( Name oldname , Name newname ) { } }
ClientObject clobj = _objmap . remove ( oldname ) ; if ( clobj == null ) { log . warning ( "Requested to rename unmapped client object" , "username" , oldname , new Exception ( ) ) ; return false ; } _objmap . put ( newname , clobj ) ; return true ;
public class SQLUtils { /** * 拼凑select的field的语句 * @ param fields * @ param sep * @ param fieldPrefix * @ return */ private static String join ( List < Field > fields , String sep , String fieldPrefix ) { } }
return joinAndGetValueForSelect ( fields , sep , fieldPrefix ) ;
public class PageContextImpl { /** * called by generated bytecode */ public Tag use ( String tagClassName , String fullname , int attrType ) throws PageException { } }
return use ( tagClassName , null , null , fullname , attrType , null ) ;
public class CharOperation { /** * Answers the first index in the array for which the corresponding character is equal to toBeFound starting the * search at index start . Answers - 1 if no occurrence of this character is found . < br > * < br > * For example : * < ol > * < li > * < pre > * toBeFound = ' c...
for ( int i = start ; i < array . length ; i ++ ) { if ( toBeFound == array [ i ] ) { return i ; } } return - 1 ;
public class ArtifactResource { /** * Add a license to an artifact * @ param credential DbCredential * @ param gavc String * @ param licenseId String * @ return Response */ @ POST @ Path ( "/{gavc}" + ServerAPI . GET_LICENSES ) public Response addLicense ( @ Auth final DbCredential credential , @ PathParam ( "g...
if ( ! credential . getRoles ( ) . contains ( AvailableRoles . DATA_UPDATER ) && ! credential . getRoles ( ) . contains ( AvailableRoles . LICENSE_SETTER ) ) { throw new WebApplicationException ( Response . status ( Response . Status . UNAUTHORIZED ) . build ( ) ) ; } if ( LOG . isInfoEnabled ( ) ) { LOG . info ( Strin...
public class QueryBuilder { /** * The product of two terms , as in { @ code WHERE k = left * right } . */ @ NonNull public static Term multiply ( @ NonNull Term left , @ NonNull Term right ) { } }
return new BinaryArithmeticTerm ( ArithmeticOperator . PRODUCT , left , right ) ;
public class YokeSecurity { /** * Returns the original value is the signature is correct . Null otherwise . */ public static String unsign ( @ NotNull String val , @ NotNull Mac mac ) { } }
int idx = val . lastIndexOf ( '.' ) ; if ( idx == - 1 ) { return null ; } String str = val . substring ( 0 , idx ) ; if ( val . equals ( sign ( str , mac ) ) ) { return str ; } return null ;