signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class ApiOvhTelephony { /** * Get this object properties * REST : GET / telephony / { billingAccount } / line / { serviceName } / automaticCall / { identifier } * @ param billingAccount [ required ] The name of your billingAccount * @ param serviceName [ required ] * @ param identifier [ required ] Gener...
String qPath = "/telephony/{billingAccount}/line/{serviceName}/automaticCall/{identifier}" ; StringBuilder sb = path ( qPath , billingAccount , serviceName , identifier ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhCallsGenerated . class ) ;
public class CmsLogFileApp { /** * Returns the file name or < code > null < / code > associated with the given appender . < p > * @ param app the appender * @ return the file name */ protected static String getFileName ( Appender app ) { } }
String result = null ; Method getFileName ; try { getFileName = app . getClass ( ) . getDeclaredMethod ( "getFileName" , ( Class < ? > [ ] ) null ) ; result = ( String ) getFileName . invoke ( app , ( Object [ ] ) null ) ; } catch ( Exception e ) { LOG . warn ( e . getLocalizedMessage ( ) , e ) ; } return result ;
public class WebService { /** * method to generate a SMILES representation for a whole HELM2 input * @ param notation * given helm notation * @ return generated canonical smiles for the given notation * @ throws BuilderMoleculeException * if the molecule can ' t be built * @ throws CTKException * general ...
String result = SMILES . getCanonicalSMILESForAll ( ( validate ( notation ) ) ) ; setMonomerFactoryToDefault ( notation ) ; return result ;
public class SigningImageFormat { /** * The supported formats of an AWS Signer signing image . * @ param supportedFormats * The supported formats of an AWS Signer signing image . * @ return Returns a reference to this object so that method calls can be chained together . * @ see ImageFormat */ public SigningIma...
java . util . ArrayList < String > supportedFormatsCopy = new java . util . ArrayList < String > ( supportedFormats . length ) ; for ( ImageFormat value : supportedFormats ) { supportedFormatsCopy . add ( value . toString ( ) ) ; } if ( getSupportedFormats ( ) == null ) { setSupportedFormats ( supportedFormatsCopy ) ; ...
public class Transport { /** * Use this method if you need direct access to Json results . * < pre > * Params params = new Params ( ) * . add ( . . . ) * getJsonResponseFromGet ( Issue . class , params ) ; * < / pre > */ public < T > JSONObject getJsonResponseFromGet ( Class < T > objectClass , Collection < ?...
final List < NameValuePair > newParams = new ArrayList < > ( params ) ; List < NameValuePair > paramsList = new ArrayList < > ( newParams ) ; final URI uri = getURIConfigurator ( ) . getObjectsURI ( objectClass , paramsList ) ; final HttpGet http = new HttpGet ( uri ) ; final String response = send ( http ) ; final JSO...
public class LeaderCache { /** * Create or update a new rootNode child */ @ Override public void put ( int partitionId , String HSIdStr ) throws KeeperException , InterruptedException { } }
try { m_zk . create ( ZKUtil . joinZKPath ( m_rootNode , Integer . toString ( partitionId ) ) , HSIdStr . getBytes ( Charsets . UTF_8 ) , Ids . OPEN_ACL_UNSAFE , CreateMode . PERSISTENT ) ; } catch ( KeeperException . NodeExistsException e ) { m_zk . setData ( ZKUtil . joinZKPath ( m_rootNode , Integer . toString ( par...
public class Model { /** * Generate implementation for super class . */ protected SB toJavaSuper ( SB sb ) { } }
sb . nl ( ) ; sb . ii ( 1 ) ; sb . i ( ) . p ( "public String[] getNames() { return NAMES; } " ) . nl ( ) ; sb . i ( ) . p ( "public String[][] getDomainValues() { return DOMAINS; }" ) . nl ( ) ; String uuid = this . uniqueId != null ? this . uniqueId . getId ( ) : this . _key . toString ( ) ; sb . i ( ) . p ( "publi...
public class KerasModelUtils { /** * Helper function to import weights from nested Map into existing model . Depends critically * on matched layer and parameter names . In general this seems to be straightforward for most * Keras models and layersOrdered , but there may be edge cases . * @ param model DL4J Model ...
/* Get list if layers from model . */ Layer [ ] layersFromModel ; if ( model instanceof MultiLayerNetwork ) layersFromModel = ( ( MultiLayerNetwork ) model ) . getLayers ( ) ; else layersFromModel = ( ( ComputationGraph ) model ) . getLayers ( ) ; /* Iterate over layers in model , setting weights when relevant . */ Set...
public class DistCp { /** * Check whether the contents of src and dst are the same . * Return false if dstpath does not exist * If the files have different sizes , return false . * If the files have the same sizes , the file checksums will be compared . * When file checksum is not supported in any of file syste...
FileStatus dststatus ; try { dststatus = dstfs . getFileStatus ( dstpath ) ; } catch ( FileNotFoundException fnfe ) { return false ; } // same length ? if ( srcstatus . getLen ( ) != dststatus . getLen ( ) ) { return false ; } if ( skipCRCCheck ) { LOG . debug ( "Skipping CRC Check" ) ; return true ; } // get src check...
public class StatusTransition { /** * Changing status * @ param args - - will be used in the status changing callback */ public < T > void transitionLock ( String topologyId , boolean errorOnNoTransition , StatusType changeStatus , T ... args ) throws Exception { } }
// get ZK ' s topology node ' s data , which is StormBase StormBase stormbase = data . getStormClusterState ( ) . storm_base ( topologyId , null ) ; if ( stormbase == null ) { LOG . error ( "Cannot apply event: changing status " + topologyId + " -> " + changeStatus . getStatus ( ) + ", cause: failed to get StormBase fr...
public class AbstractCompact { /** * Return a copy of the provided array with updated memory layout . * @ param oldStorage * the current array * @ param defaultValue * default value for newly allocated array positions * @ param payload * the payload object * @ return a copy of the provided array with upda...
return payload . type . updateStorage ( oldStorage , payload , arrayConstructor , ( arr , idx ) -> arr [ idx ] = defaultValue ) ;
public class KinesisConfigUtil { /** * Validate configuration properties related to Amazon AWS service . */ public static void validateAwsConfiguration ( Properties config ) { } }
if ( config . containsKey ( AWSConfigConstants . AWS_CREDENTIALS_PROVIDER ) ) { String credentialsProviderType = config . getProperty ( AWSConfigConstants . AWS_CREDENTIALS_PROVIDER ) ; // value specified for AWSConfigConstants . AWS _ CREDENTIALS _ PROVIDER needs to be recognizable CredentialProvider providerType ; tr...
public class NearCachePreloaderLock { /** * package private for testing */ void releaseInternal ( FileLock lock , FileChannel channel ) { } }
try { lock . release ( ) ; channel . close ( ) ; } catch ( IOException e ) { logger . severe ( "Problem while releasing the lock and closing channel on " + lockFile , e ) ; } finally { lockFile . deleteOnExit ( ) ; }
public class StringUtils { /** * Appends the suffix to the end of the string if the string does not * already end with any of the suffixes . * < pre > * StringUtils . appendIfMissing ( null , null ) = null * StringUtils . appendIfMissing ( " abc " , null ) = " abc " * StringUtils . appendIfMissing ( " " , " x...
return appendIfMissing ( str , suffix , false , suffixes ) ;
public class AbstractGrid { @ Override public boolean exists ( int row , int column ) { } }
return row >= 0 && row < rowCount ( ) && column >= 0 && column < columnCount ( ) ;
public class Config { /** * Users should use the version of this method at uses ByteAmount * @ deprecated use * setComponentRam ( Map & lt ; String , Object & gt ; conf , String component , ByteAmount ramInBytes ) */ @ Deprecated public static void setComponentRam ( Map < String , Object > conf , String component ,...
setComponentRam ( conf , component , ByteAmount . fromBytes ( ramInBytes ) ) ;
public class DTMManagerDefault { /** * Get the first free DTM ID available . % OPT % Linear search is inefficient ! */ synchronized public int getFirstFreeDTMID ( ) { } }
int n = m_dtms . length ; for ( int i = 1 ; i < n ; i ++ ) { if ( null == m_dtms [ i ] ) { return i ; } } return n ; // count on addDTM ( ) to throw exception if out of range
public class ObjectParser { /** * 将对象解析为 < code > NodeConfig < / code > 格式 * @ param nodeName 节点名称 * @ param rootObject 需要解析的对象 * @ return 解析后的 < code > NodeConfig < / code > 格式 * @ throws MarshalException 解析异常 */ @ SuppressWarnings ( { } }
"rawtypes" , "unchecked" } ) public NodeConfig parse ( String nodeName , Object rootObject ) throws MarshalException { Class rootClass = rootObject . getClass ( ) ; if ( TypeConver . isBesicType ( rootClass ) ) { return new NodeConfig ( nodeName , rootObject . toString ( ) ) ; } else if ( rootObject instanceof List ) {...
public class PeriodType { /** * Gets the indexed field part of the period . * @ param period the period to query * @ param index the index to use * @ return the value of the field , zero if unsupported */ int getIndexedField ( ReadablePeriod period , int index ) { } }
int realIndex = iIndices [ index ] ; return ( realIndex == - 1 ? 0 : period . getValue ( realIndex ) ) ;
public class JacksonUtils { /** * < p > setObjectWriterInjector . < / p > * @ param provider a { @ link javax . inject . Provider } object . * @ param genericType a { @ link java . lang . reflect . Type } object . * @ param annotations an array of { @ link java . lang . annotation . Annotation } objects . * @ t...
final FilterProvider filterProvider = provider . get ( ) . getFilteringObject ( genericType , true , annotations ) ; if ( filterProvider != null ) { ObjectWriterInjector . set ( new FilteringObjectWriterModifier ( filterProvider , ObjectWriterInjector . getAndClear ( ) ) ) ; }
public class Utils { /** * Compares two QNames for equality . Either or both of the values may be null . * @ param qn1 * @ param qn2 * @ return */ public static boolean compareQNames ( QName qn1 , QName qn2 ) { } }
if ( qn1 == qn2 ) return true ; if ( qn1 == null || qn2 == null ) return false ; return qn1 . equals ( qn2 ) ;
public class CmsGalleryService { /** * Convenience method for reading the saved VFS tree state from the session . < p > * @ param request the current request * @ param treeToken the tree token ( may be null ) * @ return the saved tree open state ( may be null ) */ public static CmsTreeOpenState getVfsTreeState ( ...
return ( CmsTreeOpenState ) request . getSession ( ) . getAttribute ( getTreeOpenStateAttributeName ( I_CmsGalleryProviderConstants . TREE_VFS , treeToken ) ) ;
public class Status { public void copy ( Copier aFrom ) { } }
if ( aFrom == null ) return ; primaryKey = ( ( PrimaryKey ) aFrom ) . getPrimaryKey ( ) ; name = ( ( Nameable ) aFrom ) . getName ( ) ;
public class DescriptorValue { /** * Returns an array of names for each descriptor value calculated . * Many descriptors return multiple values . In general it is useful for the * descriptor to indicate the names for each value . When a descriptor creates * a < code > DescriptorValue < / code > object , it should...
if ( descriptorNames == null || descriptorNames . length == 0 ) { String title = specification . getImplementationTitle ( ) ; if ( value instanceof BooleanResult || value instanceof DoubleResult || value instanceof IntegerResult ) { descriptorNames = new String [ 1 ] ; descriptorNames [ 0 ] = title ; } else { int ndesc...
public class DetectorFactoryCollection { /** * Set the metadata for a bug category . If the category ' s metadata has * already been set , this does nothing . * @ param bc * the BugCategory object holding the metadata for the category * @ return false if the category ' s metadata has already been set , true *...
String category = bc . getCategory ( ) ; if ( categoryDescriptionMap . get ( category ) != null ) { return false ; } categoryDescriptionMap . put ( category , bc ) ; return true ;
public class PeepholeRemoveDeadCode { /** * The function assumes that when checking a CASE node there is no DEFAULT _ CASE node in the * SWITCH , or the DEFAULT _ CASE is the last case in the SWITCH . * @ return Whether the CASE or DEFAULT _ CASE block does anything useful . */ private boolean isUselessCase ( Node ...
checkState ( previousCase == null || previousCase . getNext ( ) == caseNode ) ; // A case isn ' t useless if a previous case falls through to it unless it happens to be the last // case in the switch . Node switchNode = caseNode . getParent ( ) ; if ( switchNode . getLastChild ( ) != caseNode && previousCase != null ) ...
public class UnitOfWorkAwareProxyFactory { /** * Creates a new < b > @ UnitOfWork < / b > aware proxy of a class with a complex constructor . * @ param clazz the specified class definition * @ param constructorParamTypes the types of the constructor parameters * @ param constructorArguments the arguments passed t...
final ProxyFactory factory = new ProxyFactory ( ) ; factory . setSuperclass ( clazz ) ; try { final Proxy proxy = ( Proxy ) ( constructorParamTypes . length == 0 ? factory . createClass ( ) . newInstance ( ) : factory . create ( constructorParamTypes , constructorArguments ) ) ; proxy . setHandler ( ( self , overridden...
public class RequestCancelExternalWorkflowExecutionDecisionAttributesMarshaller { /** * Marshall the given parameter object . */ public void marshall ( RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes , ProtocolMarshaller protocolMarshaller ) { } }
if ( requestCancelExternalWorkflowExecutionDecisionAttributes == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( requestCancelExternalWorkflowExecutionDecisionAttributes . getWorkflowId ( ) , WORKFLOWID_BINDING ) ; protocolMarshaller . marsh...
public class StringUtil { /** * Checks if given string in _ str starts with any of the given strings in _ args . * @ param _ ignoreCase true to ignore case , false to be case sensitive * @ param _ str string to check * @ param _ args patterns to find * @ return true if given string in _ str starts with any of t...
if ( _str == null || _args == null || _args . length == 0 ) { return false ; } String heystack = _str ; if ( _ignoreCase ) { heystack = _str . toLowerCase ( ) ; } for ( String s : _args ) { String needle = _ignoreCase ? s . toLowerCase ( ) : s ; if ( heystack . startsWith ( needle ) ) { return true ; } } return false ;
public class IntegerExtensions { /** * The < code > . . & lt ; < / code > operator yields an { @ link ExclusiveRange } that increments from * a to b ( exclusive ) . * @ param a the start of the range . * @ param b the end of the range ( exclusive ) . * @ return an incrementing { @ link ExclusiveRange } . Never ...
return new ExclusiveRange ( a , b , true ) ;
public class SyntheticStorableReferenceBuilder { /** * Look for conflicting method names */ private boolean methodExists ( Class clazz , String name ) { } }
Method [ ] methods = clazz . getDeclaredMethods ( ) ; for ( int i = 0 ; i < methods . length ; i ++ ) { if ( methods [ i ] . getName ( ) . equals ( name ) ) { return true ; } } if ( clazz . getSuperclass ( ) != null && methodExists ( clazz . getSuperclass ( ) , name ) ) { return true ; } Class [ ] interfaces = clazz . ...
public class V1KnowledgeMarshaller { /** * Reads in the Configuration , looking for various knowledge models . * If not found , it falls back to the super class ( V1CompositeMarshaller ) . * @ param config the Configuration * @ return the Model */ @ Override public Model read ( Configuration config ) { } }
String name = config . getName ( ) ; Descriptor desc = getDescriptor ( ) ; if ( CHANNELS . equals ( name ) ) { return new V1ChannelsModel ( config , desc ) ; } else if ( CHANNEL . equals ( name ) ) { return new V1ChannelModel ( config , desc ) ; } else if ( LISTENERS . equals ( name ) ) { return new V1ListenersModel ( ...
public class WEmailField { /** * Performs validation of the email address . This only performs very basic validation - an email address must * contain some text , followed by an ' @ ' , and then something which resembles a domain / host name . * Subclasses can override this method to perform more specific validatio...
if ( ! isEmpty ( ) ) { String value = getValueAsString ( ) ; String errorMessage = getComponentModel ( ) . errorMessage ; // Email Pattern if ( ! Pattern . matches ( "^(?:\".+\"|[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+)@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)+$" , value ) ) { diags . add ( createErrorDiagnostic ( errorMessage , this...
public class CommerceDiscountLocalServiceBaseImpl { /** * Returns the commerce discount matching the UUID and group . * @ param uuid the commerce discount ' s UUID * @ param groupId the primary key of the group * @ return the matching commerce discount * @ throws PortalException if a matching commerce discount ...
return commerceDiscountPersistence . findByUUID_G ( uuid , groupId ) ;
public class AsyncConverter1to1 { /** * Return a { @ link RecordStreamWithMetadata } with the appropriate modifications . * @ param inputStream * @ param workUnitState * @ return * @ throws SchemaConversionException * @ implNote this processStream does not handle { @ link org . apache . gobblin . stream . Met...
int maxConcurrentAsyncConversions = workUnitState . getPropAsInt ( MAX_CONCURRENT_ASYNC_CONVERSIONS_KEY , DEFAULT_MAX_CONCURRENT_ASYNC_CONVERSIONS ) ; SO outputSchema = convertSchema ( inputStream . getGlobalMetadata ( ) . getSchema ( ) , workUnitState ) ; Flowable < StreamEntity < DO > > outputStream = inputStream . g...
public class StringUtil { /** * Returns true if the char is considered a " safe " char . Please see * documentation for isSafeString ( ) . * @ see # isSafeString ( java . lang . String ) */ public static boolean isSafeChar ( char ch ) { } }
if ( ch >= 'a' && ch <= 'z' ) return true ; if ( ch >= 'A' && ch <= 'Z' ) return true ; if ( ch >= '0' && ch <= '9' ) return true ; // loop thru our PRINTABLE string for ( int i = 0 ; i < SAFE . length ( ) ; i ++ ) { if ( ch == SAFE . charAt ( i ) ) return true ; } return false ;
public class OperatorFromFunctionals { /** * Subscriber function that invokes the callable and returns its value or * propagates its checked exception . */ public static < R > OnSubscribe < R > fromCallable ( Callable < ? extends R > callable ) { } }
return new InvokeAsync < R > ( callable ) ;
public class WeakHashMapPro { /** * Returns the entry associated with the specified key in this map . Returns null if the map contains * no mapping for this key . */ Entry < K , V > getEntry ( Object key ) { } }
Object k = maskNull ( key ) ; int h = hash ( k ) ; Entry < K , V > [ ] tab = getTable ( ) ; int index = indexFor ( h , tab . length ) ; Entry < K , V > e = tab [ index ] ; while ( e != null && ! ( e . hash == h && eq ( k , e . get ( ) ) ) ) e = e . next ; return e ;
public class HttpConnection { public void sendRequest ( String method , String uri , HeaderList headerList , Body body ) throws IOException { } }
String value ; output . writeRequestLine ( method , uri ) ; for ( Header header : headerList ) { output . writeAscii ( header . name ) ; output . writeAscii ( ": " ) ; value = header . value ; if ( value != null ) { output . writeAscii ( value ) ; } output . writeAsciiLn ( ) ; } output . writeAsciiLn ( ) ; if ( body !=...
public class NodeImpl { /** * Helper method for nodes that have multiple default incoming connections */ public List < Connection > getDefaultIncomingConnections ( ) { } }
return getIncomingConnections ( org . jbpm . workflow . core . Node . CONNECTION_DEFAULT_TYPE ) ;
public class TwiML { /** * Get transformed attribute name for this Twiml element . */ private String getTransformedAttrName ( final String attrName ) { } }
return attrNameMapper . containsKey ( attrName ) ? attrNameMapper . get ( attrName ) : attrName ;
public class TerminalSyntax { /** * Validates terminal color code For reference check website : * http : / / misc . flogisoft . com / bash / tip _ colors _ and _ formatting * @ param code numeric value as a String */ @ Override public void validateColorCode ( String code ) { } }
Preconditions . checkNotEmpty ( code , "color code is empty" ) ; Integer numericColorCode = Integer . valueOf ( code ) ; boolean isColorCodeValid = numericColorCode > 0 && numericColorCode < 257 ; if ( ! isColorCodeValid ) { throw new IllegalArgumentException ( "color code should be a number between 1 and 256" ) ; }
public class Indexes { /** * Marks the given partition as unindexed by the given indexes . * @ param partitionId the ID of the partition to mark as unindexed . * @ param indexes the indexes by which the given partition is unindexed . */ public static void markPartitionAsUnindexed ( int partitionId , InternalIndex [...
for ( InternalIndex index : indexes ) { index . markPartitionAsUnindexed ( partitionId ) ; }
public class StoredResponse { /** * Retrieve a response header as an int . */ public int getIntHeader ( String name ) { } }
if ( _header != null ) { int headerVal = _header . getIntHeader ( name ) ; if ( headerVal != - 1 ) return headerVal ; } if ( this . headerTable != null ) { int i = 0 ; for ( Object obj : headerTable [ 0 ] ) { String strVal = ( String ) obj ; if ( name . equals ( strVal ) ) { return Integer . valueOf ( ( String ) header...
public class CmsSiteManagerImpl { /** * Returns the configured site if the given root path matches site in the " / sites / " folder , * or < code > null < / code > otherwise . < p > * @ param rootPath the root path to check * @ return the configured site if the given root path matches site in the " / sites / " fo...
int pos = rootPath . indexOf ( '/' , SITES_FOLDER_POS ) ; if ( pos > 0 ) { // this assumes that the root path may likely start with something like " / sites / default / " // just cut the first 2 directories from the root path and do a direct lookup in the internal map return m_siteRootSites . get ( rootPath . substring...
public class ExpressionBuilder { /** * Appends a greater than or equals test to the condition . * @ param trigger the trigger field . * @ param compare the value to use in the compare . * @ return this ExpressionBuilder . */ public ExpressionBuilder greaterThanOrEquals ( final SubordinateTrigger trigger , final O...
BooleanExpression exp = new CompareExpression ( CompareType . GREATER_THAN_OR_EQUAL , trigger , compare ) ; appendExpression ( exp ) ; return this ;
public class PTSaxton2006 { /** * Equation 16 for calculating Saturated conductivity ( matric soil ) , mm / h * @ param slsnd Sand weight percentage by layer ( [ 0,100 ] % ) * @ param slcly Clay weight percentage by layer ( [ 0,100 ] % ) * @ param omPct Organic matter weight percentage by layer ( [ 0,100 ] % ) , ...
String satMt = divide ( calcSaturatedMoisture ( slsnd , slcly , omPct ) , "100" ) ; String mt33 = divide ( calcMoisture33Kpa ( slsnd , slcly , omPct ) , "100" ) ; String lamda = calcLamda ( slsnd , slcly , omPct ) ; String ret = product ( "1930" , pow ( substract ( satMt , mt33 ) , substract ( "3" , lamda ) ) ) ; LOG ....
public class JsonArray { /** * Returns the { @ link java . lang . Boolean } at index or null if not found . * @ param index * @ return the value at index or null if not found * @ throws java . lang . IndexOutOfBoundsException if the index is out of the array bounds */ public Boolean getBoolean ( int index ) { } }
Object bool = list . get ( index ) ; if ( bool == null ) return null ; if ( bool instanceof Boolean ) return ( Boolean ) bool ; throw new JsonException ( "not a boolean" ) ;
public class CmsWebdavServlet { /** * Reads the information about a destination path out of the header of the * request . < p > * @ param req the servlet request we are processing * @ return the destination path */ private String parseDestinationHeader ( HttpServletRequest req ) { } }
// Parsing destination header String destinationPath = req . getHeader ( HEADER_DESTINATION ) ; if ( destinationPath == null ) { return null ; } // Remove url encoding from destination destinationPath = CmsEncoder . decode ( destinationPath , "UTF8" ) ; int protocolIndex = destinationPath . indexOf ( "://" ) ; if ( pro...
public class ReflectionHelper { /** * Returns true if the given type has a method with the given annotation */ public static boolean hasMethodWithAnnotation ( Class < ? > type , Class < ? extends Annotation > annotationType , boolean checkMetaAnnotations ) { } }
try { do { Method [ ] methods = type . getDeclaredMethods ( ) ; for ( Method method : methods ) { if ( hasAnnotation ( method , annotationType , checkMetaAnnotations ) ) { return true ; } } type = type . getSuperclass ( ) ; } while ( type != null ) ; } catch ( Throwable e ) { // ignore a class loading issue } return fa...
public class CacheProxy { /** * Attempts to close the resource . If an error occurs and an outermost exception is set , then adds * the error to the suppression list . * @ param o the resource to close if Closeable * @ param outer the outermost error , or null if unset * @ return the outermost error , or null i...
if ( o instanceof Closeable ) { try { ( ( Closeable ) o ) . close ( ) ; } catch ( Throwable t ) { if ( outer == null ) { return t ; } outer . addSuppressed ( t ) ; return outer ; } } return null ;
public class ExampleUtils { /** * Method that lasts randomly from ~ 0 to the square of the specified amount of maxMsRoot . * This is just to avoid linear randomness . * @ param maxMsRoot square root of the maximal waiting time */ public static void waitRandomlySquared ( long maxMsRoot ) { } }
long random = ( long ) ( Math . random ( ) * maxMsRoot ) ; try { Thread . sleep ( random * random ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; }
public class LValue { /** * Convert ` value ` to a boolean . Note that only ` nil ` and ` false ` * are ` false ` , all other values are ` true ` . * @ param value * the value to convert . * @ return ` value ` as a boolean . */ public boolean asBoolean ( Object value ) { } }
if ( value == null ) { return false ; } if ( value instanceof Boolean ) { return ( Boolean ) value ; } return true ;
public class XSplitter { /** * Computes and returns the mbr of the specified nodes , only the nodes between * from and to index are considered . * @ param entries the array of node indices * @ param from the start index * @ param to the end index * @ return the mbr of the specified nodes */ private HyperBound...
SpatialEntry first = this . node . getEntry ( entries [ from ] ) ; ModifiableHyperBoundingBox mbr = new ModifiableHyperBoundingBox ( first ) ; for ( int i = from + 1 ; i < to ; i ++ ) { mbr . extend ( this . node . getEntry ( entries [ i ] ) ) ; } return mbr ;
public class SARLJvmModelInferrer { /** * Generate the extended types for the given SARL statement . * @ param context the context of the generation . * @ param owner the JVM element to change . * @ param defaultJvmType the default JVM type . * @ param defaultSarlType the default SARL type . * @ param superty...
final List < ? extends JvmParameterizedTypeReference > supertypes ; if ( supertype == null ) { supertypes = Collections . emptyList ( ) ; } else { supertypes = Collections . singletonList ( supertype ) ; } appendConstrainedExtends ( context , owner , defaultJvmType , defaultSarlType , supertypes ) ;
public class S1ScriptEngine { /** * Run template * @ param template template text * @ param data context * @ return evaluated template * @ throws ScriptException * @ throws ScriptLimitException * @ throws SyntaxException */ public String template ( String template , Map < String , Object > data ) throws Scr...
return template ( null , template , data ) ;
public class HtmlGroupBaseTag { /** * This will create a new option in the HTML . */ protected void addOption ( AbstractRenderAppender buffer , String type , String optionValue , String optionDisplay , int idx , String altText , char accessKey , boolean disabled ) throws JspException { } }
ServletRequest req = pageContext . getRequest ( ) ; if ( _cr == null ) _cr = TagRenderingBase . Factory . getConstantRendering ( req ) ; assert ( buffer != null ) ; assert ( optionValue != null ) ; assert ( optionDisplay != null ) ; assert ( type != null ) ; if ( _orientation != null && isVertical ( ) ) { _cr . TR_TD (...
public class CubeConfigurator { /** * Add precedence - 10 because we need that ContainerRegistry is available in the Arquillian scope . */ public void configure ( @ Observes ( precedence = - 10 ) ArquillianDescriptor arquillianDescriptor ) { } }
Map < String , String > config = arquillianDescriptor . extension ( EXTENSION_NAME ) . getExtensionProperties ( ) ; CubeConfiguration cubeConfiguration = CubeConfiguration . fromMap ( config ) ; configurationProducer . set ( cubeConfiguration ) ;
public class ChargingStationEventListener { /** * Handles the { @ link AuthorizationListChangedEvent } . * @ param event the event to handle . */ @ EventHandler public void handle ( AuthorizationListChangedEvent event ) { } }
ChargingStation chargingStation = repository . findOne ( event . getChargingStationId ( ) . getId ( ) ) ; if ( chargingStation != null ) { Set < LocalAuthorization > updatedLocalAuthorizations = toLocalAuthorizationSet ( event . getIdentifyingTokens ( ) ) ; if ( AuthorizationListUpdateType . FULL . equals ( event . get...
public class ParticlesDrawable { /** * { @ inheritDoc } */ @ Override public void setParticleRadiusRange ( @ FloatRange ( from = 0.5f ) final float minRadius , @ FloatRange ( from = 0.5f ) final float maxRadius ) { } }
scene . setParticleRadiusRange ( minRadius , maxRadius ) ;
public class CellPositioner { /** * Properly resizes the cell ' s node , and sets its " layoutY " value , so that is the last visible * node in the viewport , and further offsets this value by { @ code endOffStart } , so that * the node ' s < em > bottom < / em > edge appears ( if negative ) " above , " ( if 0 ) " ...
C cell = getSizedCell ( itemIndex ) ; double y = sizeTracker . getViewportLength ( ) + startOffEnd ; relocate ( cell , 0 , y ) ; cell . getNode ( ) . setVisible ( true ) ; return cell ;
public class RuleSessionImpl { /** * / * ( non - Javadoc ) * @ see nz . co . senanque . rules . RuleSession # assign ( nz . co . senanque . validationengine . ProxyField , java . lang . Object , nz . co . senanque . rules . RuleContext , boolean ) */ @ SuppressWarnings ( { } }
"rawtypes" , "unchecked" } ) public void assign ( RuleProxyField target , Object value , RuleContext ruleContext , boolean dummy ) { ProxyField target1 = target . getProxyField ( ) ; Class < ? > clazz = target1 . getPropertyMetadata ( ) . getSetMethod ( ) . getParameterTypes ( ) [ 0 ] ; if ( value instanceof List < ? >...
public class MoreGraphs { /** * Sorts a directed acyclic graph into a list . * < p > The particular order of elements without prerequisites is determined by the comparator . < / p > * @ param graph the graph to be sorted * @ param comparator the comparator * @ param < T > the node type * @ return the sorted l...
return topologicalSort ( graph , new ComparatorSortType < > ( comparator ) ) ;
public class TaskQueue { /** * Submits a non value - returning task for synchronous execution . It waits for all synchronous tasks to be * completed . * @ param task A task to be executed synchronously . */ public void submitSynchronous ( Runnable task ) { } }
lock . writeLock ( ) . lock ( ) ; try { awaitInner ( ) ; task . run ( ) ; } catch ( InterruptedException e ) { Log . error ( e , "Task queue isolated submission interrupted" ) ; throw new RuntimeException ( e ) ; } catch ( Exception e ) { Log . error ( e , "Task queue isolated submission failed" ) ; throw new RuntimeEx...
public class BasicBlock { /** * Return whether or not the basic block contains the instruction with the * given bytecode offset . * @ param offset * the bytecode offset * @ return true if the block contains an instruction with the given offset , * false if it does not */ public boolean containsInstructionWith...
Iterator < InstructionHandle > i = instructionIterator ( ) ; while ( i . hasNext ( ) ) { if ( i . next ( ) . getPosition ( ) == offset ) { return true ; } } return false ;
public class JdbcRepository { /** * setUpdateProperties . * @ param id id * @ param needUpdateJsonObject needUpdateJsonObject * @ param paramList paramList * @ param sql sql * @ throws JSONException JSONException */ private void setUpdateProperties ( final String id , final JSONObject needUpdateJsonObject , f...
final Iterator < String > keys = needUpdateJsonObject . keys ( ) ; String key ; boolean isFirst = true ; final StringBuilder wildcardString = new StringBuilder ( ) ; while ( keys . hasNext ( ) ) { key = keys . next ( ) ; if ( isFirst ) { wildcardString . append ( " SET " ) . append ( key ) . append ( " = ?" ) ; isFirst...
public class HourGlass { /** * Update the task share of the clusters * @ param clusters Two clusters with tasktrackers shares same nodes */ static private void updateShares ( Cluster clusters [ ] ) { } }
assert ( clusters . length == 2 ) ; if ( clusters [ 0 ] . runnableMaps == 0 && clusters [ 0 ] . runnableMaps == 0 && clusters [ 1 ] . runnableReduces == 0 && clusters [ 1 ] . runnableReduces == 0 ) { // Do nothing if both clusters are empty return ; } // Update target task shares using runnable tasks and weight if ( ! ...
public class JsonUtils { /** * Converts a given object to a Json string * @ param object The object to convert * @ return json string or null if conversion fails */ public static String toJson ( Object object ) { } }
Objects . requireNonNull ( object , Required . OBJECT . toString ( ) ) ; String json = null ; try { json = mapper . writeValueAsString ( object ) ; } catch ( JsonProcessingException e ) { LOG . error ( "Failed to convert object to json" , e ) ; } return json ;
public class UserFinderUtil { /** * Retrieves the users associated with the account * @ param account for which users should be gathered * @ return the set of users associated with an account */ public Set < DuracloudUser > getAccountUsers ( AccountInfo account ) { } }
DuracloudRightsRepo rightsRepo = repoMgr . getRightsRepo ( ) ; List < AccountRights > acctRights = rightsRepo . findByAccountId ( account . getId ( ) ) ; Set < DuracloudUser > users = new HashSet < > ( ) ; for ( AccountRights rights : acctRights ) { DuracloudUser user = rights . getUser ( ) ; // ensure account is loade...
public class Levenshtein { /** * Returns a new Q - Gram ( Ukkonen ) instance with compare target string and k - shingling * @ see QGram * @ param baseTarget * @ param compareTarget * @ param k * @ return */ @ SuppressWarnings ( "unchecked" ) public static < T extends Levenshtein > T QGram ( String baseTarget ...
return ( T ) new QGram ( baseTarget , k ) . update ( compareTarget ) ;
public class TangoCommand { /** * Execute a command with argin which is an array * @ param < T > * @ param clazz * @ param value * @ return * @ throws DevFailed */ public < T > List < T > executeExtractList ( final Class < T > clazz , final Object ... value ) throws DevFailed { } }
final Object result = command . executeExtract ( value ) ; return extractList ( TypeConversionUtil . castToArray ( clazz , result ) ) ;
public class SampleWithTilesOverlay { /** * Called when the activity is first created . */ @ Override public void onCreate ( final Bundle savedInstanceState ) { } }
super . onCreate ( savedInstanceState ) ; // Setup base map rl = new RelativeLayout ( this ) ; this . mMapView = new MapView ( this ) ; this . mMapView . setTilesScaledToDpi ( true ) ; rl . addView ( this . mMapView , new RelativeLayout . LayoutParams ( LayoutParams . FILL_PARENT , LayoutParams . FILL_PARENT ) ) ; this...
public class BenchUtils { /** * Generating one single { @ link DumbData } with random values . * @ return one { @ link DumbData } with random values . */ public static final DumbData generateOne ( ) { } }
byte [ ] data = new byte [ 1024 ] ; random . nextBytes ( data ) ; return new DumbData ( random . nextLong ( ) , data ) ;
public class IntegratorHandlerImpl { /** * Read integrator protocol from content container . Default to AUTO . * @ param properties Content container * @ return Integrator protocol */ @ SuppressWarnings ( "null" ) private IntegratorProtocol getIntegratorProtocol ( ValueMap properties ) { } }
IntegratorProtocol protocol = IntegratorProtocol . AUTO ; try { String protocolString = properties . get ( IntegratorNameConstants . PN_INTEGRATOR_PROTOCOL , String . class ) ; if ( StringUtils . isNotEmpty ( protocolString ) ) { protocol = IntegratorProtocol . valueOf ( protocolString . toUpperCase ( ) ) ; } } catch (...
public class KernelCore { /** * This methods will create both Global ModuleProviders : nominal and overriding . */ private void createMainModule ( ) { } }
for ( Plugin plugin : orderedPlugins ) { moduleHandler . handleUnitModule ( requestHandler , plugin ) ; moduleHandler . handleOverridingUnitModule ( requestHandler , plugin ) ; } KernelGuiceModuleInternal kernelGuiceModuleInternal = new KernelGuiceModuleInternal ( requestHandler ) ; KernelGuiceModuleInternal internalKe...
public class Descriptor { /** * Add the given topic calls to this service . * @ param topicCalls The topic calls to add . * @ return A copy of this descriptor with the new calls added . */ public Descriptor withTopics ( TopicCall < ? > ... topicCalls ) { } }
return new Descriptor ( name , calls , pathParamSerializers , messageSerializers , serializerFactory , exceptionSerializer , autoAcl , acls , headerFilter , locatableService , circuitBreaker , this . topicCalls . plusAll ( Arrays . asList ( topicCalls ) ) ) ;
public class GroupBasicAdapter { /** * remove a group * @ param group the group to be removed */ public void removeGroup ( @ Nullable L group ) { } }
if ( group == null ) { return ; } List < L > cards = getGroups ( ) ; boolean changed = cards . remove ( group ) ; if ( changed ) { setData ( cards ) ; }
public class HtmlMessages { /** * < p > Set the value of the < code > fatalClass < / code > property . < / p > */ public void setFatalClass ( java . lang . String fatalClass ) { } }
getStateHelper ( ) . put ( PropertyKeys . fatalClass , fatalClass ) ;
public class GoogleCalendarService { /** * Gets a list of entries belonging to the given calendar defined between the given range of time . Recurring events * are not expanded , always recurrence is handled manually within the framework . * @ param calendar The calendar owner of the entries . * @ param startDate ...
if ( ! calendar . existsInGoogle ( ) ) { return new ArrayList < > ( 0 ) ; } ZonedDateTime st = ZonedDateTime . of ( startDate , LocalTime . MIN , zoneId ) ; ZonedDateTime et = ZonedDateTime . of ( endDate , LocalTime . MAX , zoneId ) ; String calendarId = URLDecoder . decode ( calendar . getId ( ) , "UTF-8" ) ; List < ...
public class BinderExtension { /** * / * @ Override */ public < S , T > Converter < S , T > findConverter ( Class < S > source , Class < T > target , Class < ? extends Annotation > qualifier ) { } }
return BINDING . findConverter ( source , target , qualifier ) ;
public class CmsRelationType { /** * Returns all weak relation types in the given list . < p > * @ param relationTypes the collection of relation types to filter * @ return a list of { @ link CmsRelationType } objects */ public static List < CmsRelationType > filterWeak ( Collection < CmsRelationType > relationType...
List < CmsRelationType > result = new ArrayList < CmsRelationType > ( relationTypes ) ; Iterator < CmsRelationType > it = result . iterator ( ) ; while ( it . hasNext ( ) ) { CmsRelationType type = it . next ( ) ; if ( type . isStrong ( ) ) { it . remove ( ) ; } } return result ;
public class AbstractJMSMessageProducer { /** * Sends message to the destination in non - transactional manner . * @ param destination where to send * @ param message what to send * Since non - transacted session is used , the message is send immediately without requiring to commit enclosing transaction . */ prot...
send ( destination , message , null , null , false ) ;
public class PollCachingESRegistry { /** * Stores a " dataversion " record in the ES store . There is only a single one of these . The * return value of the add will include the version number of the entity . This version * number is what we use to determine whether our cache is stale . */ protected void updateData...
DataVersionBean dv = new DataVersionBean ( ) ; dv . setUpdatedOn ( System . currentTimeMillis ( ) ) ; Index index = new Index . Builder ( dv ) . refresh ( false ) . index ( getDefaultIndexName ( ) ) . type ( "dataVersion" ) . id ( "instance" ) . build ( ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $ getClient ( ) . exe...
public class ContentValues { /** * Gets a value and converts it to a Byte . * @ param key the value to get * @ return the Byte value , or null if the value is missing or cannot be converted */ public Byte getAsByte ( String key ) { } }
Object value = mValues . get ( key ) ; try { return value != null ? ( ( Number ) value ) . byteValue ( ) : null ; } catch ( ClassCastException e ) { if ( value instanceof CharSequence ) { try { return Byte . valueOf ( value . toString ( ) ) ; } catch ( NumberFormatException e2 ) { logger . severe ( "Cannot parse Byte v...
public class CollationRootElements { /** * Finds the largest index i where elements [ i ] < = p . * Requires first primary < = p < 0xfffff00 ( PRIMARY _ SENTINEL ) . * Does not require that p is a root collator primary . */ private int findP ( long p ) { } }
// p need not occur as a root primary . // For example , it might be a reordering group boundary . assert ( ( p >> 24 ) != Collation . UNASSIGNED_IMPLICIT_BYTE ) ; // modified binary search int start = ( int ) elements [ IX_FIRST_PRIMARY_INDEX ] ; assert ( p >= elements [ start ] ) ; int limit = elements . length - 1 ;...
public class AABBf { /** * Set the maximum corner coordinates . * @ param max * the maximum coordinates * @ return this */ public AABBf setMax ( Vector3fc max ) { } }
return this . setMax ( max . x ( ) , max . y ( ) , max . z ( ) ) ;
public class SessionEntityTypesClient { /** * Deletes the specified session entity type . * < p > Sample code : * < pre > < code > * try ( SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient . create ( ) ) { * SessionEntityTypeName name = SessionEntityTypeName . of ( " [ PROJECT ] " , "...
DeleteSessionEntityTypeRequest request = DeleteSessionEntityTypeRequest . newBuilder ( ) . setName ( name == null ? null : name . toString ( ) ) . build ( ) ; deleteSessionEntityType ( request ) ;
public class WorkManagerImpl { /** * Fire complete for HintsContext * @ param work The work instance */ private void fireHintsComplete ( Work work ) { } }
if ( work != null && work instanceof WorkContextProvider ) { WorkContextProvider wcProvider = ( WorkContextProvider ) work ; List < WorkContext > contexts = wcProvider . getWorkContexts ( ) ; if ( contexts != null && ! contexts . isEmpty ( ) ) { Iterator < WorkContext > it = contexts . iterator ( ) ; while ( it . hasNe...
public class Request { /** * Makes http POST request * @ param url url to makes request to * @ param params data to add to params field * @ param extraData data to send along with request body , outside of params field . * @ param files files to be uploaded along with the request . * @ return { @ link okhttp3...
Map < String , String > payload = toPayload ( params ) ; if ( extraData != null ) { payload . putAll ( extraData ) ; } okhttp3 . Request request = new okhttp3 . Request . Builder ( ) . url ( getFullUrl ( url ) ) . post ( getBody ( payload , files , fileStreams ) ) . addHeader ( "Transloadit-Client" , version ) . build ...
public class JavassistTransformerExecutor { /** * Evaluates and returns the output directory . * If the passed { @ code outputDir } is { @ code null } or empty , the passed { @ code inputDir } otherwise * the { @ code outputDir } will returned . * @ param outputDir could be { @ code null } or empty * @ param in...
return outputDir != null && ! outputDir . trim ( ) . isEmpty ( ) ? outputDir : inputDir . trim ( ) ;
public class SimpleInjectionPoint { /** * Factory method to produce an { @ link InjectionPoint } that describes the * specified class . * @ param cls * @ return */ public static final < E > InjectionPoint < E > of ( Class < E > cls ) { } }
return new SimpleInjectionPoint < E > ( cls ) ;
public class ExecutionEnvironment { /** * Creates a DataSet from the given non - empty collection . The type of the data set is that * of the elements in the collection . * < p > The framework will try and determine the exact type from the collection elements . * In case of generic elements , it may be necessary ...
if ( data == null ) { throw new IllegalArgumentException ( "The data must not be null." ) ; } if ( data . size ( ) == 0 ) { throw new IllegalArgumentException ( "The size of the collection must not be empty." ) ; } X firstValue = data . iterator ( ) . next ( ) ; TypeInformation < X > type = TypeExtractor . getForObject...
public class ObjectCacheFactory { /** * Creates a new { @ link ObjectCacheInternal } instance . Each < tt > ObjectCache < / tt > * implementation was wrapped by a { @ link CacheDistributor } and the distributor * was wrapped by { @ link MaterializationCache } . * @ param broker The PB instance to associate with t...
CacheDistributor cache = null ; try { log . info ( "Start creating new ObjectCache instance" ) ; /* if default cache was not found , create an new instance of the default cache specified in the configuration . Then instantiate AllocatorObjectCache to handle per connection / per class caching instances . To su...
public class SingleRxXian { /** * call the specified unit without parameters */ public static Single < UnitResponse > call ( String group , String unit ) { } }
return SingleRxXian . call ( group , unit , new HashMap < > ( ) ) ;
public class BroadcastConnectedStream { /** * Assumes as inputs a { @ link BroadcastStream } and a non - keyed { @ link DataStream } and applies the given * { @ link BroadcastProcessFunction } on them , thereby creating a transformed output stream . * @ param function The { @ link BroadcastProcessFunction } that is...
Preconditions . checkNotNull ( function ) ; Preconditions . checkArgument ( ! ( inputStream1 instanceof KeyedStream ) , "A BroadcastProcessFunction can only be used on a non-keyed stream." ) ; TwoInputStreamOperator < IN1 , IN2 , OUT > operator = new CoBroadcastWithNonKeyedOperator < > ( clean ( function ) , broadcastS...
public class PassConfig { /** * Create a type inference pass . */ final TypeInferencePass makeTypeInference ( AbstractCompiler compiler ) { } }
return new TypeInferencePass ( compiler , compiler . getReverseAbstractInterpreter ( ) , topScope , typedScopeCreator ) ;
public class NonVoltDBBackend { /** * Potentially returns the specified String , after replacing certain * " variables " , such as { table } or { column : pk } , in a QueryTransformer ' s * prefix , suffix or ( group ) replacement text , for which a corresponding * group value will be substituted . However , this...
return str ;
public class LocalDateTime { /** * Returns a copy of this { @ code LocalDateTime } with the second - of - minute altered . * This instance is immutable and unaffected by this method call . * @ param second the second - of - minute to set in the result , from 0 to 59 * @ return a { @ code LocalDateTime } based on ...
LocalTime newTime = time . withSecond ( second ) ; return with ( date , newTime ) ;
public class CIType { /** * Tests , if this type the type in the parameter . * @ param _ type type to test * @ return true if this type otherwise false */ public boolean isType ( final org . efaps . admin . datamodel . Type _type ) { } }
return getType ( ) . equals ( _type ) ;
public class CommerceNotificationTemplateUserSegmentRelUtil { /** * Returns an ordered range of all the commerce notification template user segment rels where commerceUserSegmentEntryId = & # 63 ; . * Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / ...
return getPersistence ( ) . findByCommerceUserSegmentEntryId ( commerceUserSegmentEntryId , start , end , orderByComparator ) ;