signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class JodaAuditListener { /** * set audit informations , doesn ' t modify createdDate and createdBy once * set . Only works with DomainObjects that implement the JodaAuditable * interface . In other cases a IllegalArgumentException is thrown . * @ param entity * @ return */ @ PreUpdate @ PrePersist priva...
DateTime lastUpdated = new DateTime ( ) ; auditableEntity . setLastUpdated ( lastUpdated ) ; String lastUpdatedBy = ServiceContextStore . getCurrentUser ( ) ; auditableEntity . setLastUpdatedBy ( lastUpdatedBy ) ; if ( auditableEntity . getCreatedDate ( ) == null ) auditableEntity . setCreatedDate ( lastUpdated ) ; if ...
public class KafkaWorkUnitPacker { /** * Pack a list of { @ link WorkUnit } s into a smaller number of { @ link MultiWorkUnit } s , * using the worst - fit - decreasing algorithm . * Each { @ link WorkUnit } is assigned to the { @ link MultiWorkUnit } with the smallest load . */ protected List < WorkUnit > worstFit...
// Sort workunit groups by data size desc Collections . sort ( groups , LOAD_DESC_COMPARATOR ) ; MinMaxPriorityQueue < MultiWorkUnit > pQueue = MinMaxPriorityQueue . orderedBy ( LOAD_ASC_COMPARATOR ) . expectedSize ( numOfMultiWorkUnits ) . create ( ) ; for ( int i = 0 ; i < numOfMultiWorkUnits ; i ++ ) { MultiWorkUnit...
public class JSONHelpers { /** * Returns { @ link String } value mapped to { @ code e } , or the empty string if the mapping doesn ' t * exist . * @ param json * @ param e * @ return */ public static < P extends Enum < P > > String optString ( final JSONObject json , P e ) { } }
return json . optString ( e . name ( ) ) ;
public class ImageTileSkin { /** * * * * * * Initialization * * * * * */ @ Override protected void initGraphics ( ) { } }
super . initGraphics ( ) ; imageListener = ( o , ov , nv ) -> { if ( nv != null ) { imgView . setImage ( tile . getImage ( ) ) ; } } ; titleText = new Text ( ) ; titleText . setFill ( tile . getTitleColor ( ) ) ; Helper . enableNode ( titleText , ! tile . getTitle ( ) . isEmpty ( ) ) ; text = new Text ( tile . getText ...
public class UserService { /** * Retrieves the user corresponding to the given AuthenticatedUser from the * database . * @ param authenticationProvider * The AuthenticationProvider on behalf of which the user is being * retrieved . * @ param authenticatedUser * The AuthenticatedUser to retrieve the correspo...
// If we already queried this user , return that rather than querying again if ( authenticatedUser instanceof ModeledAuthenticatedUser ) return ( ( ModeledAuthenticatedUser ) authenticatedUser ) . getUser ( ) ; // Get username String username = authenticatedUser . getIdentifier ( ) ; // Retrieve corresponding user mode...
public class SSLConfiguration { /** * Creates the trust managers required to initiate the { @ link SSLContext } , using a JKS keystore as an input . * @ param filepath - the path to the JKS keystore . * @ param keystorePassword - the keystore ' s password . * @ return { @ link TrustManager } array , that will be ...
KeyStore trustStore = KeyStore . getInstance ( "JKS" ) ; try ( InputStream trustStoreIS = new FileInputStream ( filepath ) ) { trustStore . load ( trustStoreIS , keystorePassword . toCharArray ( ) ) ; } TrustManagerFactory trustFactory = TrustManagerFactory . getInstance ( TrustManagerFactory . getDefaultAlgorithm ( ) ...
public class NetworkConfig { /** * Returns the specified JsonValue as a String , or null if it ' s not a string */ private static String getJsonValueAsString ( JsonValue value ) { } }
return ( value != null && value . getValueType ( ) == ValueType . STRING ) ? ( ( JsonString ) value ) . getString ( ) : null ;
public class XmpDirectory { /** * Gets a map of all XMP properties in this directory . * This is required because XMP properties are represented as strings , whereas the rest of this library * uses integers for keys . */ @ NotNull public Map < String , String > getXmpProperties ( ) { } }
Map < String , String > propertyValueByPath = new HashMap < String , String > ( ) ; if ( _xmpMeta != null ) { try { IteratorOptions options = new IteratorOptions ( ) . setJustLeafnodes ( true ) ; for ( Iterator i = _xmpMeta . iterator ( options ) ; i . hasNext ( ) ; ) { XMPPropertyInfo prop = ( XMPPropertyInfo ) i . ne...
public class ModuleWebhooks { /** * Change the content of a webhook . * This will take the webhooks id and update it on the backend . * @ param webhook The webhook retrieved beforehand to be changed . * @ return The from the backend returned , changed webhook . * @ throws IllegalArgumentException if webhook is ...
assertNotNull ( webhook , "webhook" ) ; final String webhookId = getResourceIdOrThrow ( webhook , "webhook" ) ; final String spaceId = getSpaceIdOrThrow ( webhook , "webhook" ) ; final Integer version = getVersionOrThrow ( webhook , "webhook" ) ; return service . update ( version , spaceId , webhookId , webhook ) . blo...
public class ObjectUtil { /** * 判断指定对象是否为空 , 支持 : * < pre > * 1 . CharSequence * 2 . Map * 3 . Iterable * 4 . Iterator * 5 . Array * < / pre > * @ param obj 被判断的对象 * @ return 是否为空 , 如果类型不支持 , 返回false * @ since 4.5.7 */ @ SuppressWarnings ( "rawtypes" ) public static boolean isEmpty ( Object obj ) { ...
if ( null == obj ) { return true ; } if ( obj instanceof CharSequence ) { return StrUtil . isEmpty ( ( CharSequence ) obj ) ; } else if ( obj instanceof Map ) { return MapUtil . isEmpty ( ( Map ) obj ) ; } else if ( obj instanceof Iterable ) { return IterUtil . isEmpty ( ( Iterable ) obj ) ; } else if ( obj instanceof ...
public class BackchannelAuthenticationRequest { /** * Set the value of { @ code parameters } which are the request parameters * that the backchannel authentication endpoint of the OpenID provider * implementation received from the client application . * This method converts the given map into a string in * { @ ...
return setParameters ( URLCoder . formUrlEncode ( parameters ) ) ;
public class TSSConfigHelper { /** * Returns a TSSConfig object initialized with the input object * as an XML string . * @ param addrMap TODO * @ return a TSSConfig object * @ throws org . apache . geronimo . common . propertyeditor . PropertyEditorException * An IOException occured . */ public static TSSConf...
TSSConfig tssConfig = new TSSConfig ( ) ; List < Map < String , Object > > tssConfigs = Nester . nest ( CSIV2_CONFIGURATION , props ) ; if ( ! tssConfigs . isEmpty ( ) ) { Map < String , Object > properties = tssConfigs . get ( 0 ) ; // tssConfig . setInherit ( ( Boolean ) properties . get ( INHERIT ) ) ; List < Map < ...
public class RedisClient { /** * On release connection . * @ param connection * redis connection instance . */ private void onCleanup ( Object connection ) { } }
// if not running within transaction boundary if ( this . connection != null ) { if ( settings != null ) { ( ( Jedis ) connection ) . configResetStat ( ) ; } factory . releaseConnection ( ( Jedis ) this . connection ) ; } this . connection = null ;
public class MathBindings { /** * Binding for { @ link java . lang . Math # log ( double ) } * @ param a a value * @ return the value ln & nbsp ; { @ code a } , the natural logarithm of * { @ code a } . */ public static DoubleBinding log ( final ObservableDoubleValue a ) { } }
return createDoubleBinding ( ( ) -> Math . log ( a . get ( ) ) , a ) ;
public class SinglePerturbationNeighbourhood { /** * Check if it is possible to swap a selected and unselected item . * @ param solution solution for which moves are generated * @ param addCandidates set of candidate IDs to be added * @ param deleteCandidates set of candidate IDs to be deleted * @ return < code...
return ! addCandidates . isEmpty ( ) && ! deleteCandidates . isEmpty ( ) && isValidSubsetSize ( solution . getNumSelectedIDs ( ) ) ;
public class SnapshotTaskClientImpl { /** * { @ inheritDoc } */ @ Override public CleanupSnapshotTaskResult cleanupSnapshot ( String spaceId ) throws ContentStoreException { } }
CleanupSnapshotTaskParameters taskParams = new CleanupSnapshotTaskParameters ( ) ; taskParams . setSpaceId ( spaceId ) ; String taskResult = contentStore . performTask ( SnapshotConstants . CLEANUP_SNAPSHOT_TASK_NAME , taskParams . serialize ( ) ) ; return CleanupSnapshotTaskResult . deserialize ( taskResult ) ;
public class InternationalizationServiceSingleton { /** * A bundle is being added to the { @ code BundleTracker } . * This method is called before a bundle which matched the search parameters * of the { @ code BundleTracker } is added to the * { @ code BundleTracker } . This method should return the object to be ...
List < I18nExtension > list = ExtenderUtils . analyze ( "/i18n/" , bundle ) ; if ( list . isEmpty ( ) ) { return null ; } String current = Long . toString ( System . currentTimeMillis ( ) ) ; LOGGER . info ( list . size ( ) + " resource bundle(s) loaded from {} ({})" , bundle . getSymbolicName ( ) , bundle . getBundleI...
public class AgentsAlreadyRunningAssessmentException { /** * @ return */ @ com . fasterxml . jackson . annotation . JsonProperty ( "agents" ) public java . util . List < AgentAlreadyRunningAssessment > getAgents ( ) { } }
return agents ;
public class StringHelper { /** * Get a concatenated String from all elements of the passed map , separated by * the specified separator strings . * @ param sSepOuter * The separator to use for separating the map entries . May not be * < code > null < / code > . * @ param sSepInner * The separator to use fo...
return getImplodedMapped ( sSepOuter , sSepInner , aElements , String :: valueOf , String :: valueOf ) ;
public class Force { /** * Increase direction with input value . * @ param extrp The extrapolation value . * @ param direction The direction to add . */ public void addDirection ( double extrp , Direction direction ) { } }
addDirection ( extrp , direction . getDirectionHorizontal ( ) , direction . getDirectionVertical ( ) ) ;
public class FFDCLogger { /** * Appends a single line of FFDC information . * @ param info the information to add . * @ return this FFDC logger . */ public final FFDCLogger append ( String info ) { } }
lines . add ( new StringBuffer ( ) . append ( info ) . append ( AdapterUtil . EOLN ) . toString ( ) ) ; return this ;
public class Tags { /** * Return a new { @ code Tags } instance by concatenating the specified tags and key / value pairs . * @ param tags the first set of tags * @ param keyValues the additional key / value pairs to add * @ return the merged tags */ public static Tags concat ( @ Nullable Iterable < ? extends Tag...
return Tags . of ( tags ) . and ( keyValues ) ;
public class LToDblFunctionBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */ @ Nonnull public static < T > LToDblFunction < T > toDblFunctionFrom ( Consumer < LToDblFunctionBuilder < T > > buildingFunction ) { } }
LToDblFunctionBuilder builder = new LToDblFunctionBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ;
public class OMVRBTree { /** * Returns the key corresponding to the specified Entry . * @ throws NoSuchElementException * if the Entry is null */ static < K > K key ( OMVRBTreeEntry < K , ? > e ) { } }
if ( e == null ) throw new NoSuchElementException ( ) ; return e . getKey ( ) ;
public class L1Regularizer { /** * Estimates the penalty by adding the L1 regularization . * @ param l1 * @ param weights * @ param < K > * @ return */ public static < K > double estimatePenalty ( double l1 , Map < K , Double > weights ) { } }
double penalty = 0.0 ; if ( l1 > 0.0 ) { double sumAbsWeights = 0.0 ; for ( double w : weights . values ( ) ) { sumAbsWeights += Math . abs ( w ) ; } penalty = l1 * sumAbsWeights ; } return penalty ;
public class CommerceOrderItemUtil { /** * Returns the first commerce order item in the ordered set where commerceOrderId = & # 63 ; and subscription = & # 63 ; . * @ param commerceOrderId the commerce order ID * @ param subscription the subscription * @ param orderByComparator the comparator to order the set by ...
return getPersistence ( ) . findByC_S_First ( commerceOrderId , subscription , orderByComparator ) ;
public class NetworkInterfacesInner { /** * Gets information about the specified network interface . * @ param resourceGroupName The name of the resource group . * @ param networkInterfaceName The name of the network interface . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ th...
return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , networkInterfaceName ) . toBlocking ( ) . single ( ) . body ( ) ;
public class OCDImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . OCD__OBJ_CDAT : setObjCdat ( OBJ_CDAT_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ;
public class JsonReader { /** * Check if the passed reader can be resembled to valid Json content . This is * accomplished by fully parsing the Json each time the method is called . This * consumes < b > less memory < / b > than calling any of the < code > read . . . < / code > * methods and checking for a non - ...
ValueEnforcer . notNull ( aReader , "Reader" ) ; return _validateJson ( StreamHelper . getBuffered ( aReader ) ) . isValid ( ) ;
public class TypeAnnotationPosition { /** * Create a { @ code TypeAnnotationPosition } for a method receiver parameter . * @ param location The type path . * @ param onLambda The lambda for this parameter . * @ param pos The position from the associated tree node . */ public static TypeAnnotationPosition methodRe...
return new TypeAnnotationPosition ( TargetType . METHOD_RECEIVER , pos , Integer . MIN_VALUE , onLambda , Integer . MIN_VALUE , Integer . MIN_VALUE , location ) ;
public class UndecidedNode { /** * Compress this tree into the AutoBuffer */ @ Override public AutoBuffer compress ( AutoBuffer ab , AutoBuffer abAux ) { } }
int pos = ab . position ( ) ; if ( _nodeType == 0 ) size ( ) ; // Sets _ nodeType & _ size both ab . put1 ( _nodeType ) ; // Includes left - child skip - size bits assert _split != null ; // Not a broken root non - decision ? assert _split . _col >= 0 ; ab . put2 ( ( short ) _split . _col ) ; ab . put1 ( ( byte ) _spli...
public class FacesImpl { /** * Divide candidate faces into groups based on face similarity . * @ param faceIds Array of candidate faceId created by Face - Detect . The maximum is 1000 faces * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws APIErrorException thrown if the requ...
return groupWithServiceResponseAsync ( faceIds ) . toBlocking ( ) . single ( ) . body ( ) ;
public class ProteinModificationRegistry { /** * Lazy Initialization the static variables and register common modifications . * just opens the stream to ptm _ list . xml and delegates to lazyInit ( InputStream ) for parsing . */ private static synchronized void lazyInit ( ) { } }
if ( registry == null ) { InputStream isXml = ProteinModification . class . getResourceAsStream ( DIR_XML_PTM_LIST ) ; lazyInit ( isXml ) ; }
public class AgentPreviewMarshaller { /** * Marshall the given parameter object . */ public void marshall ( AgentPreview agentPreview , ProtocolMarshaller protocolMarshaller ) { } }
if ( agentPreview == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( agentPreview . getHostname ( ) , HOSTNAME_BINDING ) ; protocolMarshaller . marshall ( agentPreview . getAgentId ( ) , AGENTID_BINDING ) ; protocolMarshaller . marshall ( ag...
public class AVIMImageMessage { /** * 获取图片的宽度 * @ return */ public int getWidth ( ) { } }
Map < String , Object > metaData = getFileMetaData ( ) ; if ( metaData != null && metaData . containsKey ( IMAGE_WIDTH ) ) { return parseIntValue ( metaData . get ( IMAGE_WIDTH ) ) ; } return 0 ;
public class QueryExecuter { /** * Gets the elements in the common upstream or downstream of the seed * @ param sourceSet Seed to the query * @ param model BioPAX model * @ param direction UPSTREAM or DOWNSTREAM * @ param limit Length limit for the search * @ param filters for filtering graph elements * @ r...
Graph graph ; if ( model . getLevel ( ) == BioPAXLevel . L3 ) { graph = new GraphL3 ( model , filters ) ; } else return Collections . emptySet ( ) ; Collection < Set < Node > > source = prepareNodeSets ( sourceSet , graph ) ; if ( sourceSet . size ( ) < 2 ) return Collections . emptySet ( ) ; CommonStreamQuery query = ...
public class StringUtils { /** * < p > Splits the provided text into an array , separator specified . * This is an alternative to using StringTokenizer . < / p > * < p > The separator is not included in the returned String array . * Adjacent separators are treated as one separator . * For more control over the ...
List < String > list = new ArrayList < String > ( ) ; if ( str == null || str . length ( ) == 0 ) { return list ; } if ( str . indexOf ( separatorChar ) == - 1 ) { list . add ( str ) ; return list ; } int start = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == separatorChar ) { String t...
public class HtmlBuilder { /** * Build a HTML Table with given CSS class for a string . * Use this method if given content contains HTML snippets , prepared with { @ link HtmlBuilder # htmlEncode ( String ) } . * @ param clazz class for table element * @ param content content string * @ return HTML table elemen...
return tagClassHtmlContent ( Html . Tag . TABLE , clazz , content ) ;
public class DrawerItem { /** * Sets an image mode to the drawer item * @ param imageMode Image mode to set */ public DrawerItem setImageMode ( int imageMode ) { } }
if ( imageMode != ICON && imageMode != AVATAR && imageMode != SMALL_AVATAR ) { throw new IllegalArgumentException ( "Image mode must be either ICON or AVATAR." ) ; } mImageMode = imageMode ; notifyDataChanged ( ) ; return this ;
public class CollectionUtilsImpl { /** * { @ inheritDoc } */ public < T > void forAllDoSynchronized ( final Collection < ? extends T > collection , final Closure < T > closure ) { } }
synchronized ( collection ) { forAllDo ( collection , closure ) ; }
public class CmsPublishEngine { /** * Returns a publish job based on its publish history id . < p > * The returned publish job may be an enqueued , running or finished publish job . < p > * @ param publishHistoryId the publish history id to search for * @ return the publish job with the given publish history id ,...
// try current running job if ( ( m_currentPublishThread != null ) && m_currentPublishThread . getPublishJob ( ) . getPublishHistoryId ( ) . equals ( publishHistoryId ) ) { return new CmsPublishJobRunning ( m_currentPublishThread . getPublishJob ( ) ) ; } // try enqueued jobs Iterator < CmsPublishJobEnqueued > itEnqueu...
public class SpectatorExecutionInterceptor { /** * For network errors there will not be a response so the status will not have been set . This * method looks for a flag in the attributes to see if we need to close off the log entry for * the attempt . */ private boolean isStatusSet ( ExecutionAttributes attrs ) { }...
Boolean s = attrs . getAttribute ( STATUS_IS_SET ) ; return s != null && s ;
public class ProcfsBasedProcessTree { /** * Make sure that the given pid is a process group leader and then * destroy the process group . * @ param pgrpId Process group id of to - be - killed - processes * @ param interval The time to wait before sending SIGKILL * after sending SIGTERM * @ param inBackground ...
// Make sure that the pid given is a process group leader if ( ! checkPidPgrpidForMatch ( pgrpId , PROCFS ) ) { throw new IOException ( "Process with PID " + pgrpId + " is not a process group leader." ) ; } destroyProcessGroup ( pgrpId , interval , inBackground ) ;
public class NamingLookupResponseCodec { /** * Decodes bytes to an iterable of name assignments . * @ param buf the byte array * @ return a naming lookup response * @ throws org . apache . reef . io . network . naming . exception . NamingRuntimeException */ @ Override public NamingLookupResponse decode ( final by...
final AvroNamingLookupResponse avroResponse = AvroUtils . fromBytes ( buf , AvroNamingLookupResponse . class ) ; final List < NameAssignment > nas = new ArrayList < > ( avroResponse . getTuples ( ) . size ( ) ) ; for ( final AvroNamingAssignment tuple : avroResponse . getTuples ( ) ) { nas . add ( new NameAssignmentTup...
public class QueryDSL { /** * < p > parse . < / p > * @ param expression a { @ link java . lang . String } object . * @ return a { @ link java . util . List } object . */ public static List < QueryExprMeta > parse ( String expression ) { } }
QueryParser parser = parser ( tokens ( expression ) ) ; try { return parse ( parser ) ; } catch ( ParseCancellationException | RecognitionException e ) { RecognitionException err ; if ( e instanceof ParseCancellationException ) { err = ( RecognitionException ) e . getCause ( ) ; } else { err = ( RecognitionException ) ...
public class PactDslJsonArray { /** * Element that must be a boolean * @ param example example boolean to use for generated bodies */ public PactDslJsonArray booleanType ( Boolean example ) { } }
body . put ( example ) ; matchers . addRule ( rootPath + appendArrayIndex ( 0 ) , TypeMatcher . INSTANCE ) ; return this ;
public class AsyncFile { /** * Checks the file size . For non - regular or non - existing files returns < code > null < / code > . * @ param executor executor for running tasks in another thread * @ param path the path of the file to check * @ return file size if given path is a regular file and < code > null < /...
return Promise . ofBlockingCallable ( executor , ( ) -> Files . isRegularFile ( path ) ? Files . size ( path ) : null ) ;
public class AddJobFlowStepsRequest { /** * A list of < a > StepConfig < / a > to be executed by the job flow . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setSteps ( java . util . Collection ) } or { @ link # withSteps ( java . util . Collection ) } if y...
if ( this . steps == null ) { setSteps ( new com . amazonaws . internal . SdkInternalList < StepConfig > ( steps . length ) ) ; } for ( StepConfig ele : steps ) { this . steps . add ( ele ) ; } return this ;
public class SparkDl4jMultiLayer { /** * Score the examples individually , using a specified batch size . Unlike { @ link # calculateScore ( JavaRDD , boolean ) } , * this method returns a score for each example separately < br > * Note : The provided JavaPairRDD has a key that is associated with each example and r...
return data . mapPartitionsToPair ( new ScoreExamplesWithKeyFunction < K > ( sc . broadcast ( network . params ( ) ) , sc . broadcast ( conf . toJson ( ) ) , includeRegularizationTerms , batchSize ) ) ;
public class BeanWrapperUtils { /** * Check if the bean type can be wrapped or not . * @ param bean * the bean instance * @ return false if null or valid type , true if primitive type or string */ public static boolean isInvalid ( Object bean ) { } }
if ( bean == null ) { return false ; } return isPrimitiveOrWrapper ( bean . getClass ( ) ) || INVALID_TYPES . contains ( bean . getClass ( ) ) || isInstanceOfInvalid ( bean . getClass ( ) ) ;
public class ClassHelper { /** * Get the class name of the passed object . If the object itself is of type * { @ link Class } , its name is retrieved , other { @ link # getClass ( ) } is called . * @ param aObject * The object who ' s class name is to be retrieved . * @ return < code > & quot ; null & quot ; < ...
if ( aObject instanceof Class < ? > ) return ( ( Class < ? > ) aObject ) . getName ( ) ; if ( aObject != null ) return aObject . getClass ( ) . getName ( ) ; return "null" ;
public class PoliciesCache { /** * Create a cache from a directory source * @ param rootDir base director * @ return cache */ public static PoliciesCache fromDir ( File rootDir , final Set < Attribute > forcedContext ) { } }
return fromSourceProvider ( YamlProvider . getDirProvider ( rootDir ) , forcedContext ) ;
public class ConfigTreeBuilder { /** * Looks for all pojo objects on all configuration paths and select unique pojos . This may be used later * to bind configuration part by type ( as its uniquely identify location ) . * @ param items all parsed configuration paths * @ return list of unique custom configuration o...
final Map < Class , ConfigPath > index = new HashMap < > ( ) ; final List < Class > duplicates = new ArrayList < > ( ) ; for ( ConfigPath item : items ) { final Class type = item . getDeclaredType ( ) ; if ( ! item . isCustomType ( ) || duplicates . contains ( type ) ) { continue ; } if ( index . containsKey ( type ) )...
public class CommsByteBuffer { /** * This method will work out what JFap exception Id we should flow across the wire when sending * an exception back . For all defined SI exceptions we will resolve them into their JFap constant * value . For any other exception we will return EXCEPTION _ INTERNAL _ ERROR . * Care...
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getExceptionId" ) ; short exceptionId = CommsConstants . EXCEPTION_INTERNAL_ERROR ; // * * * * * Do the SIIncorrectExcecption branch and all its subclasses if ( exception instanceof SIInvalidDestinationPrefixException ) exc...
public class BaasBox { /** * Asynchronously sends a raw rest request to the server that is specified by * the parameters passed in . * @ param method the method to use * @ param endpoint the resource * @ param body an optional jsono bject * @ param authenticate true if the client should try to refresh authent...
return rest ( method , endpoint , body , 0 , authenticate , handler ) ;
public class BaseBundleActivator { /** * Setup the application properties . * Override this to set the properties . * @ param bundleContext BundleContext */ public void init ( ) { } }
Dictionary < String , String > properties = getConfigurationProperties ( this . getProperties ( ) , false ) ; this . setProperties ( properties ) ; this . setProperty ( BundleConstants . SERVICE_PID , getServicePid ( ) ) ; this . setProperty ( BundleConstants . SERVICE_CLASS , getServiceClassName ( ) ) ;
public class WordDataReader { /** * / * ( non - Javadoc ) * @ see jvntextpro . data . DataReader # readFile ( java . lang . String ) */ @ Override public List < Sentence > readFile ( String datafile ) { } }
try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( datafile ) , "UTF-8" ) ) ; String line = null ; List < Sentence > data = new ArrayList < Sentence > ( ) ; while ( ( line = reader . readLine ( ) ) != null ) { Sentence sentence = new Sentence ( ) ; if ( line . startsWith ( ...
public class VoltDecimalHelper { /** * Serialize the { @ link java . math . BigDecimal BigDecimal } to Volt ' s fixed precision and scale 16 - byte format . * @ param bd { @ link java . math . BigDecimal BigDecimal } to serialize * @ param buf { @ link java . nio . ByteBuffer ByteBuffer } to serialize the < code > ...
if ( bd == null ) { serializeNull ( buf ) ; return ; } int decimalScale = bd . scale ( ) ; if ( decimalScale > kDefaultScale ) { bd = roundToScale ( bd , kDefaultScale , getRoundingMode ( ) ) ; decimalScale = bd . scale ( ) ; } int overallPrecision = bd . precision ( ) ; final int wholeNumberPrecision = overallPrecisio...
public class CheckpointListener { /** * Load a MultiLayerNetwork for the given checkpoint that resides in the specified root directory * @ param rootDir Root directory for the checkpoint * @ param checkpoint Checkpoint model to load * @ return The loaded model */ public static MultiLayerNetwork loadCheckpointMLN ...
return loadCheckpointMLN ( rootDir , checkpoint . getCheckpointNum ( ) ) ;
public class OkHostnameVerifier { /** * Returns true if { @ code certificate } matches { @ code ipAddress } . */ private boolean verifyIpAddress ( String ipAddress , X509Certificate certificate ) { } }
List < String > altNames = getSubjectAltNames ( certificate , ALT_IPA_NAME ) ; for ( int i = 0 , size = altNames . size ( ) ; i < size ; i ++ ) { if ( ipAddress . equalsIgnoreCase ( altNames . get ( i ) ) ) { return true ; } } return false ;
public class SQLiteExecutor { /** * The properties will be ignored by update / updateAll / batchUpdate operations if the input is an entity . * @ param targetClass * @ param writeOnlyPropNames */ public static void registerWriteOnlyProps ( Class < ? > targetClass , Collection < String > writeOnlyPropNames ) { } }
N . checkArgument ( N . isEntity ( targetClass ) , ClassUtil . getCanonicalClassName ( targetClass ) + " is not an entity class with getter/setter methods" ) ; N . checkArgNotNullOrEmpty ( writeOnlyPropNames , "'writeOnlyPropNames'" ) ; final Set < String > set = new HashSet < String > ( ) ; for ( String propName : wri...
public class DumpFileCreator { /** * Computes the best file to save the response to the current page . */ public File createDumpFile ( final File dir , final String extension , final String urlString , final String additionalInfo ) { } }
URI uri = URI . create ( urlString ) ; String path = uri . getPath ( ) ; if ( path == null ) { log . warn ( "Cannot create dump file for URI: " + uri ) ; return null ; } String name = PATTERN_FIRST_LAST_SLASH . matcher ( path ) . replaceAll ( "$1" ) ; name = PATTERN_ILLEGAL_CHARS . matcher ( name ) . replaceAll ( "_" )...
public class CSSColorHelper { /** * Get the passed values as CSS HSLA color value * @ param fHue * Hue - is scaled to 0-359 * @ param fSaturation * Saturation - is scaled to 0-100 * @ param fLightness * Lightness - is scaled to 0-100 * @ param fOpacity * Opacity - is scaled to 0-1 * @ return The CSS s...
return new StringBuilder ( 32 ) . append ( CCSSValue . PREFIX_HSLA_OPEN ) . append ( getHSLHueValue ( fHue ) ) . append ( ',' ) . append ( getHSLPercentageValue ( fSaturation ) ) . append ( "%," ) . append ( getHSLPercentageValue ( fLightness ) ) . append ( "%," ) . append ( getOpacityToUse ( fOpacity ) ) . append ( CC...
public class AsciiSet { /** * Create a set containing ascii characters using a simple pattern . The pattern is similar * to a character set in regex . For example , { @ code ABC } would contain the characters * { @ code A } , { @ code B } , and { @ code C } . Ranges are supported so all uppercase letters could * ...
final boolean [ ] members = new boolean [ 128 ] ; final int n = pattern . length ( ) ; for ( int i = 0 ; i < n ; ++ i ) { final char c = pattern . charAt ( i ) ; if ( c >= members . length ) { throw new IllegalArgumentException ( "invalid pattern, '" + c + "' is not ascii" ) ; } final boolean isStartOrEnd = i == 0 || i...
public class AbstractShape3i { /** * Add listener on geometry changes . * @ param listener the listener . */ protected synchronized void addShapeGeometryChangeListener ( ShapeGeometryChangeListener listener ) { } }
assert listener != null : AssertMessages . notNullParameter ( ) ; if ( this . geometryListeners == null ) { this . geometryListeners = new WeakArrayList < > ( ) ; } this . geometryListeners . add ( listener ) ;
public class CmsSerialDateView { /** * Handle a " current till end " change event . * @ param event the change event . */ @ UiHandler ( "m_currentTillEndCheckBox" ) void onCurrentTillEndChange ( ValueChangeEvent < Boolean > event ) { } }
if ( handleChange ( ) ) { m_controller . setCurrentTillEnd ( event . getValue ( ) ) ; }
public class TaskLogsMonitor { /** * Get the logFileDetails of all the list of attempts passed . * @ param lInfo * @ return a map of task to the log - file detail * @ throws IOException */ private Map < Task , Map < LogName , LogFileDetail > > getAllLogsFileDetails ( final List < Task > allAttempts ) throws IOExc...
Map < Task , Map < LogName , LogFileDetail > > taskLogFileDetails = new HashMap < Task , Map < LogName , LogFileDetail > > ( ) ; for ( Task task : allAttempts ) { Map < LogName , LogFileDetail > allLogsFileDetails ; allLogsFileDetails = TaskLog . getAllLogsFileDetails ( task . getTaskID ( ) , task . isTaskCleanupTask (...
public class InterpretedContainerImpl { /** * { @ inheritDoc } */ @ Override public Iterator < Entry > iterator ( ) { } }
Iterator < ArtifactEntry > iter = delegate . iterator ( ) ; if ( structureHelperSaysWeAreRoot != null ) { return new WrapperedIterator ( iter , root , rootOverlay , factoryHolder , structureHelper , structureHelperLocalRootDelegate ) ; } else { return new WrapperedIterator ( iter , root , rootOverlay , factoryHolder , ...
public class Partition { /** * Returns all objects from leftCollection whole images are a disjoin from rightCollection , * none of the resulting objects has an image in rightCollection . Compares objects using = = . * Note that lefts with no image show up in the result . */ public static List getDisconnected ( Coll...
List disconnected ; Iterator iter ; Object left ; EdgeIterator relationIter ; disconnected = new ArrayList ( ) ; iter = leftCollection . iterator ( ) ; while ( iter . hasNext ( ) ) { left = iter . next ( ) ; relationIter = relation . edges ( ) ; while ( relationIter . step ( ) ) { if ( relationIter . left ( ) == left )...
public class XTraceBufferedImpl { /** * ( non - Javadoc ) * @ see java . util . List # add ( int , java . lang . Object ) */ public void add ( int index , XEvent event ) { } }
try { events . insert ( event , index ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; }
public class AjaxAddableTabbedPanel { /** * On remove tab removes the given tab if it does exists . * @ param target * the target * @ param tab * the tab */ public void onRemoveTab ( final AjaxRequestTarget target , final T tab ) { } }
final int index = getTabs ( ) . indexOf ( tab ) ; if ( 0 <= index ) { onRemoveTab ( target , index ) ; }
public class RdfUtils { /** * Convert quads from an external form to a skolemized form * @ param svc the resource service * @ param baseUrl the base URL * @ return a mapping function */ public static Function < Quad , Quad > skolemizeQuads ( final ResourceService svc , final String baseUrl ) { } }
return quad -> rdf . createQuad ( quad . getGraphName ( ) . orElse ( PreferUserManaged ) , ( BlankNodeOrIRI ) svc . toInternal ( svc . skolemize ( quad . getSubject ( ) ) , baseUrl ) , quad . getPredicate ( ) , svc . toInternal ( svc . skolemize ( quad . getObject ( ) ) , baseUrl ) ) ;
public class IOUtils { /** * Ensures that the given directory exists ( if not , it ' s created , including all the parent directories . ) * @ return * This method returns the ' dir ' parameter so that the method call flows better . */ public static File mkdirs ( File dir ) throws IOException { } }
try { return Files . createDirectories ( fileToPath ( dir ) ) . toFile ( ) ; } catch ( UnsupportedOperationException e ) { throw new IOException ( e ) ; }
public class FirestoreException { /** * Creates a FirestoreException with the provided GRPC Status code and message in a nested * exception . * @ return The FirestoreException */ static FirestoreException serverRejected ( Status status , String message , Object ... params ) { } }
return new FirestoreException ( String . format ( message , params ) , status ) ;
public class XmlInputStream { /** * Might not actually push back anything but usually will . * @ return true if at end - of - file * @ throws IOException thrown if there is an IO exception in the underlying * steam */ private boolean readIntoPushBack ( ) throws IOException { } }
// File finished ? boolean eof = false ; // Next char . final int ch = in . read ( ) ; if ( ch >= 0 ) { // Discard whitespace at start ? if ( ! ( pulled == 0 && isWhiteSpace ( ch ) ) ) { // Good code . pulled += 1 ; // Parse out the & stuff ; if ( ch == '&' ) { // Process the & readAmpersand ( ) ; } else { // Not an ' ...
public class PropertyChangeListeners { /** * Recursively add the given property change listener to the given * object and all its sub - objects * @ param object The object * @ param propertyChangeListener The property change listener * @ param processedObjects The set of objects that have already been * proce...
Objects . requireNonNull ( processedObjects , "The processedObjects may not be null" ) ; if ( object == null ) { return ; } if ( processedObjects . contains ( object ) ) { return ; } processedObjects . add ( object ) ; if ( object . getClass ( ) . isArray ( ) ) { int length = Array . getLength ( object ) ; for ( int i ...
public class ReaderInputStream { /** * an IOException thrown by overrides of the read ( ) method . */ @ Override public int read ( byte [ ] b , int off , int len ) throws IOException { } }
if ( b == null ) { throw new NullPointerException ( ) ; } else if ( off < 0 || len < 0 || len > b . length - off ) { throw new IndexOutOfBoundsException ( ) ; } else if ( len == 0 ) { return 0 ; } if ( endOfInput && ! bbuf . hasRemaining ( ) ) { return - 1 ; } int totalRead = 0 ; while ( len > 0 && ! endOfInput ) { if ...
public class InstrumentedInvokerFactory { /** * Factory method for MeteredInvoker . */ private Invoker metered ( Invoker invoker , List < Method > meteredMethods ) { } }
ImmutableMap . Builder < String , Meter > meters = new ImmutableMap . Builder < > ( ) ; for ( Method m : meteredMethods ) { Metered annotation = m . getAnnotation ( Metered . class ) ; final String name = chooseName ( annotation . name ( ) , annotation . absolute ( ) , m ) ; Meter meter = metricRegistry . meter ( name ...
public class UCharacterNameReader { /** * Reads an individual record of AlgorithmNames * @ return an instance of AlgorithNames if read is successful otherwise null * @ exception IOException thrown when file read error occurs or data is corrupted */ private UCharacterName . AlgorithmName readAlg ( ) throws IOExcepti...
UCharacterName . AlgorithmName result = new UCharacterName . AlgorithmName ( ) ; int rangestart = m_byteBuffer_ . getInt ( ) ; int rangeend = m_byteBuffer_ . getInt ( ) ; byte type = m_byteBuffer_ . get ( ) ; byte variant = m_byteBuffer_ . get ( ) ; if ( ! result . setInfo ( rangestart , rangeend , type , variant ) ) {...
public class Lexer { private Token text ( ) { } }
String val = scan1 ( "^(?:\\| ?| )([^\\n]+)" ) ; if ( StringUtils . isEmpty ( val ) ) { val = scan1 ( "^\\|?( )" ) ; if ( StringUtils . isEmpty ( val ) ) { val = scan1 ( "^(<[^\\n]*)" ) ; } } if ( StringUtils . isNotEmpty ( val ) ) { return new Text ( val , lineno ) ; } return null ;
public class NodeTypes { /** * Determine if the named property on the node type is a reference property . * @ param nodeTypeName the name of the node type ; may not be null * @ param propertyName the name of the property definition ; may not be null * @ return true if the property is a { @ link PropertyType # REF...
JcrNodeType type = getNodeType ( nodeTypeName ) ; if ( type != null ) { for ( JcrPropertyDefinition propDefn : type . allPropertyDefinitions ( propertyName ) ) { int requiredType = propDefn . getRequiredType ( ) ; if ( requiredType == PropertyType . REFERENCE || requiredType == PropertyType . WEAKREFERENCE || requiredT...
public class Interpolate1D_F32 { /** * Searches the x array by bisecting it . This takes advantage of the data being * monotonic . This finds a center index which has the following property : * x [ center ] & le ; val & lt ; x [ center + 1] * From that it selects index0 which is center - M / 2. * @ param valThe...
while ( upperLimit - lowerLimit > 1 ) { int middle = ( upperLimit + lowerLimit ) / 2 ; if ( val >= x [ middle ] && ascend ) { lowerLimit = middle ; } else { upperLimit = middle ; } } // decide if it should hunt or locate next time doHunt = Math . abs ( lowerLimit - center ) > dj ; // make sure the points sampled for th...
public class Cnf { /** * Returns true if the given disjunction is universally true . */ public static boolean isTautology ( IDisjunct disjunct ) { } }
boolean tautology = false ; if ( disjunct != null ) { IAssertion [ ] assertions = IteratorUtils . toArray ( disjunct . getAssertions ( ) , IAssertion . class ) ; int max = assertions . length ; int maxCompared = max - 1 ; for ( int compared = 0 ; ! tautology && compared < maxCompared ; compared ++ ) { IAssertion assert...
public class StatusBar { /** * { @ inheritDoc } */ public void islandPopulationUpdate ( int islandIndex , final PopulationData < ? extends Object > populationData ) { } }
islandPopulationSize . compareAndSet ( - 1 , populationData . getPopulationSize ( ) ) ; SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { // Only update the label if the time has advanced . Sometimes , due to threading // variations , later updates have shorter elapsed times . if ( populationData ...
public class ContentKeyPoliciesInner { /** * Create or update an Content Key Policy . * Create or update a Content Key Policy in the Media Services account . * @ param resourceGroupName The name of the resource group within the Azure subscription . * @ param accountName The Media Services account name . * @ par...
return createOrUpdateWithServiceResponseAsync ( resourceGroupName , accountName , contentKeyPolicyName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ;
public class GetExportSnapshotRecordsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetExportSnapshotRecordsRequest getExportSnapshotRecordsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getExportSnapshotRecordsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getExportSnapshotRecordsRequest . getPageToken ( ) , PAGETOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall r...
public class NioGroovyMethods { /** * This method is used to throw useful exceptions when the eachFile * and eachDir closure methods * are used incorrectly . * @ param self The directory to check * @ throws java . io . FileNotFoundException if the given directory does not exist * @ throws IllegalArgumentExcepti...
if ( ! Files . exists ( self ) ) throw new FileNotFoundException ( self . toAbsolutePath ( ) . toString ( ) ) ; if ( ! Files . isDirectory ( self ) ) throw new IllegalArgumentException ( "The provided Path object is not a directory: " + self . toAbsolutePath ( ) ) ;
public class EvaluationBinary { /** * Calculate the G - measure for the given output * @ param output The specified output * @ return The G - measure for the specified output */ public double gMeasure ( int output ) { } }
double precision = precision ( output ) ; double recall = recall ( output ) ; return EvaluationUtils . gMeasure ( precision , recall ) ;
public class MembershipHandlerImpl { /** * Use this method to find all the memberships of an user in any group . */ private MembershipsByUserWrapper findMembershipsByUser ( Session session , String userName ) throws Exception { } }
Node userNode ; try { userNode = utils . getUserNode ( session , userName ) ; } catch ( PathNotFoundException e ) { return new MembershipsByUserWrapper ( new ArrayList < Membership > ( ) , new ArrayList < Node > ( ) ) ; } List < Membership > memberships = new ArrayList < Membership > ( ) ; List < Node > refUserNodes = ...
public class WSuggestions { /** * { @ inheritDoc } */ @ Override public void handleRequest ( final Request request ) { } }
// Check if this suggestion list is the current AJAX trigger if ( AjaxHelper . isCurrentAjaxTrigger ( this ) ) { String filter = request . getParameter ( getId ( ) ) ; setAjaxFilter ( filter ) ; doHandleAjaxRefresh ( ) ; }
public class FnDouble { /** * Determines whether the target object and the specified object are NOT equal * by calling the < tt > equals < / tt > method on the target object . * @ param object the { @ link Double } to compare to the target * @ return false if both objects are equal , true if not . */ public stati...
return ( Function < Double , Boolean > ) ( ( Function ) FnObject . notEq ( object ) ) ;
public class Bootstrap { /** * Use this factory method to create your own dataset overriding bundled one * @ param locale will be used to assess langCode for data file * @ param dataFilePrefix prefix of the data file - final pattern will be jfairy . yml and dataFilePrefix _ { langCode } . yml * @ return Fairy ins...
return builder ( ) . withLocale ( locale ) . withFilePrefix ( dataFilePrefix ) . build ( ) ;
public class SqlUtil { /** * 获取拼接参数后的sql . * @ param sql sql * @ param param 参数列表 * @ return 拼接后的sql */ public static String getSQL ( String sql , StatementParameter param ) { } }
int i = 0 ; while ( sql . indexOf ( '?' ) > - 1 ) { if ( param == null ) { throw new InvalidParamDataAccessException ( "没有设置参数." ) ; } if ( i >= param . size ( ) ) { return sql ; } Class < ? > type = param . getType ( i ) ; Object obj = param . getObject ( i ) ; String value = getValue ( type , obj ) ; sql = sql . subs...
public class LdeSessionUtil { /** * Serializes the session attributes of the given session . * @ param session the session to persist . */ public static synchronized void serializeSessionAttributes ( final HttpSession session ) { } }
if ( session != null ) { File file = new File ( SERIALIZE_SESSION_NAME ) ; if ( ! file . exists ( ) || file . canWrite ( ) ) { // Retrieve the session attributes List data = new ArrayList ( ) ; for ( Enumeration keyEnum = session . getAttributeNames ( ) ; keyEnum . hasMoreElements ( ) ; ) { String attributeName = ( Str...
public class ByteArrayDiskQueue { /** * Enqueues a byte array to this queue . * @ param array the array to be enqueued . */ public synchronized void enqueue ( final byte [ ] array ) throws IOException { } }
assert array != null ; byteDiskQueue . enqueueInt ( array . length ) ; byteDiskQueue . enqueue ( array ) ; size ++ ;
public class RequestUtils { /** * < p > Finds all < b > < i > constant < / i > form parameters < / b > in the given { @ link InvocationContext } . < / p > * < p > Constant form parameters are introduced with @ { @ link Param } at < b > request level < / b > using * the @ { @ link FormParams } annotation . < / p > ...
Method request = assertNotNull ( context ) . getRequest ( ) ; FormParams formParams = request . getAnnotation ( FormParams . class ) ; return Collections . unmodifiableList ( formParams != null ? Arrays . asList ( formParams . value ( ) ) : new ArrayList < Param > ( ) ) ;
public class DataFileWriter { /** * Creates a new output file and writes the header information . * @ throws ConfigurationException * if an error occurred while accessing the configuration * @ throws IOException * if an error occurred while writing a file */ protected void writeHeader ( ) throws ConfigurationEx...
if ( writer != null ) { writer . close ( ) ; } this . fileCounter ++ ; String filePath = PATH_OUTPUT_DATA_FILES + this . outputName + "_" + fileCounter + ".csv" ; this . dataFile = new File ( filePath ) ; this . writer = new BufferedWriter ( new OutputStreamWriter ( new BufferedOutputStream ( new FileOutputStream ( fil...
public class DefaultLogger { /** * Prints a message to a PrintStream . * @ param message The message to print . Should not be < code > null < / code > . * @ param stream A PrintStream to print the message to . Must not be * < code > null < / code > . * @ param priority The priority of the message . ( Ignored in...
if ( useColor && priority == Project . MSG_ERR ) { stream . print ( ANSI_RED ) ; stream . print ( message ) ; stream . println ( ANSI_RESET ) ; } else { stream . println ( message ) ; }
public class BaseResourceIndexedSearchParam { /** * Applies a fast and consistent hashing algorithm to a set of strings */ static long hash ( String ... theValues ) { } }
Hasher hasher = HASH_FUNCTION . newHasher ( ) ; for ( String next : theValues ) { if ( next == null ) { hasher . putByte ( ( byte ) 0 ) ; } else { next = UrlUtil . escapeUrlParam ( next ) ; byte [ ] bytes = next . getBytes ( Charsets . UTF_8 ) ; hasher . putBytes ( bytes ) ; } hasher . putBytes ( DELIMITER_BYTES ) ; } ...
public class ChunkOutputStream { /** * Write the data to column if the configured chunk size is reached or if the * stream should be closed * @ param close * @ throws IOException */ private void writeData ( boolean close ) throws IOException { } }
if ( pos != 0 && ( close || pos == chunk . length - 1 ) ) { byte [ ] data ; if ( pos != chunk . length - 1 ) { data = new byte [ ( int ) pos + 1 ] ; // we need to adjust the array System . arraycopy ( chunk , 0 , data , 0 , data . length ) ; } else { data = chunk ; } try { mutator . insert ( key , cf , HFactory . creat...