signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class CommerceShippingFixedOptionUtil { /** * Returns a range of all the commerce shipping fixed options where commerceShippingMethodId = & # 63 ; . * Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not ...
return getPersistence ( ) . findByCommerceShippingMethodId ( commerceShippingMethodId , start , end ) ;
public class RestClient { /** * Print the base 64 string differently depending on JDK level because * on JDK 7/8 we have JAX - B , and on JDK 8 + we have java . util . Base64 */ private static String encode ( byte [ ] bytes ) { } }
try { if ( System . getProperty ( "java.version" ) . startsWith ( "1." ) ) { // return DatatypeConverter . printBase64Binary ( str ) ; Class < ? > DatatypeConverter = Class . forName ( "javax.xml.bind.DatatypeConverter" ) ; return ( String ) DatatypeConverter . getMethod ( "printBase64Binary" , byte [ ] . class ) . inv...
public class IndexedRepositoryDecorator { /** * Checks if the underlying repository can handle this query . Queries with unsupported operators , * queries that use attributes with computed values or queries with nested query rule field are * delegated to the index . */ private boolean querySupported ( Query < Entit...
return ! containsAnyOperator ( q , unsupportedOperators ) && ! containsComputedAttribute ( q , getEntityType ( ) ) && ! containsNestedQueryRuleField ( q ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link ArithType } { @ code > } } */ @ XmlElementDecl ( namespace = "http://www.w3.org/1998/Math/MathML" , name = "conjugate" ) public JAXBElement < ArithType > createConjugate ( ArithType value ) { } }
return new JAXBElement < ArithType > ( _Conjugate_QNAME , ArithType . class , null , value ) ;
public class DataModel { /** * < p > Remove an existing { @ link DataModelListener } from the set * interested in notifications from this { @ link DataModel } . < / p > * @ param listener The old { @ link DataModelListener } to be deregistered * @ throws NullPointerException if < code > listener < / code > * is...
if ( listener == null ) { throw new NullPointerException ( ) ; } if ( listeners != null ) { listeners . remove ( listener ) ; if ( listeners . isEmpty ( ) ) { listeners = null ; } }
public class LocalLog { /** * Read in our levels from our configuration file . */ static List < PatternLevel > readLevelResourceFile ( InputStream stream ) { } }
List < PatternLevel > levels = null ; if ( stream != null ) { try { levels = configureClassLevels ( stream ) ; } catch ( IOException e ) { System . err . println ( "IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + "': " + e ) ; } finally { try { stream . close ( ) ; } catch ( IOException e ...
public class URI { /** * Set the scheme for this URI . The scheme is converted to lowercase * before it is set . * @ param p _ scheme the scheme for this URI ( cannot be null ) * @ throws MalformedURIException if p _ scheme is not a conformant * scheme name */ public void setScheme ( String p_scheme ) throws Ma...
if ( p_scheme == null ) { throw new MalformedURIException ( XMLMessages . createXMLMessage ( XMLErrorResources . ER_SCHEME_FROM_NULL_STRING , null ) ) ; // " Cannot set scheme from null string ! " ) ; } if ( ! isConformantSchemeName ( p_scheme ) ) { throw new MalformedURIException ( XMLMessages . createXMLMessage ( XML...
public class DatabaseMetaData { /** * { @ inheritDoc } */ public ResultSet getProcedures ( final String catalog , final String schemaPatterns , final String procedureNamePattern ) throws SQLException { } }
return RowLists . rowList8 ( String . class , String . class , String . class , Object . class , Object . class , Object . class , String . class , Short . class ) . withLabel ( 1 , "PROCEDURE_CAT" ) . withLabel ( 2 , "PROCEDURE_SCHEM" ) . withLabel ( 3 , "PROCEDURE_NAME" ) . withLabel ( 7 , "REMARKS" ) . withLabel ( 8...
public class CircuitBreakerBuilder { /** * Sets the duration of OPEN state . * Defaults to { @ value Defaults # CIRCUIT _ OPEN _ WINDOW _ SECONDS } seconds if unspecified . */ public CircuitBreakerBuilder circuitOpenWindow ( Duration circuitOpenWindow ) { } }
requireNonNull ( circuitOpenWindow , "circuitOpenWindow" ) ; if ( circuitOpenWindow . isNegative ( ) || circuitOpenWindow . isZero ( ) ) { throw new IllegalArgumentException ( "circuitOpenWindow: " + circuitOpenWindow + " (expected: > 0)" ) ; } this . circuitOpenWindow = circuitOpenWindow ; return this ;
public class RelativeToEasterSundayParser { /** * Adds the given day to the list of holidays . * @ param aDate * The day * @ param sPropertiesKey * a { @ link java . lang . String } object . * @ param aHolidayType * a { @ link HolidayType } object . * @ param holidays * a { @ link java . util . Set } ob...
final LocalDate convertedDate = LocalDate . from ( aDate ) ; holidays . add ( convertedDate , new ResourceBundleHoliday ( aHolidayType , sPropertiesKey ) ) ;
public class Streams { /** * Writes the JSON element to the writer , recursively . */ public static void write ( JsonElement element , JsonWriter writer ) throws IOException { } }
TypeAdapters . JSON_ELEMENT . write ( writer , element ) ;
public class Classfile { /** * Compare a string in the constant pool with a given ASCII string , without constructing the constant pool * String object . * @ param cpIdx * the constant pool index * @ param asciiString * the ASCII string to compare to * @ return true , if successful * @ throws ClassfileFor...
final int strOffset = getConstantPoolStringOffset ( cpIdx , /* subFieldIdx = */ 0 ) ; if ( strOffset == 0 ) { return asciiString == null ; } else if ( asciiString == null ) { return false ; } final int strLen = inputStreamOrByteBuffer . readUnsignedShort ( strOffset ) ; final int otherLen = asciiString . length ( ) ; i...
public class SunburstChart { /** * * * * * * Resizing * * * * * */ private void resize ( ) { } }
width = getWidth ( ) - getInsets ( ) . getLeft ( ) - getInsets ( ) . getRight ( ) ; height = getHeight ( ) - getInsets ( ) . getTop ( ) - getInsets ( ) . getBottom ( ) ; size = width < height ? width : height ; if ( width > 0 && height > 0 ) { pane . setMaxSize ( size , size ) ; pane . setPrefSize ( size , size ) ; pan...
public class QRDecomposition { /** * Generate and return the ( economy - sized ) orthogonal factor * @ return Q */ @ Nonnull @ ReturnsMutableCopy public Matrix getQ ( ) { } }
final Matrix aNewMatrix = new Matrix ( m_nRows , m_nCols ) ; final double [ ] [ ] aNewArray = aNewMatrix . internalGetArray ( ) ; for ( int k = m_nCols - 1 ; k >= 0 ; k -- ) { final double [ ] aQRk = m_aQR [ k ] ; for ( int nRow = 0 ; nRow < m_nRows ; nRow ++ ) aNewArray [ nRow ] [ k ] = 0.0 ; aNewArray [ k ] [ k ] = 1...
public class AuthTokenUtil { /** * Validates an auth token . This checks the expiration time of the token against * the current system time . It also checks the validity of the signature . * @ param token the authentication token * @ throws IllegalArgumentException when the token is invalid */ public static final...
if ( token . getExpiresOn ( ) . before ( new Date ( ) ) ) { throw new IllegalArgumentException ( "Authentication token expired: " + token . getExpiresOn ( ) ) ; // $ NON - NLS - 1 $ } String validSig = generateSignature ( token ) ; if ( token . getSignature ( ) == null || ! token . getSignature ( ) . equals ( validSig ...
public class JMElasticsearchBulk { /** * Send with bulk processor and object mapper . * @ param object the object * @ param index the index * @ param type the type * @ param id the id */ public void sendWithBulkProcessorAndObjectMapper ( Object object , String index , String type , String id ) { } }
sendWithBulkProcessor ( buildIndexRequest ( index , type , id ) . source ( JMElasticsearchUtil . buildSourceByJsonMapper ( object ) ) ) ;
public class FindDeadLocalStores { /** * Is instruction at given location a store ? * @ param location * the location * @ return true if instruction at given location is a store , false if not */ private boolean isStore ( Location location ) { } }
Instruction ins = location . getHandle ( ) . getInstruction ( ) ; return ( ins instanceof StoreInstruction ) || ( ins instanceof IINC ) ;
public class BoundedSize { /** * Returns this size as pixel size . Neither requires the component list nor the specified * measures . Honors the lower and upper bound . < p > * Invoked by { @ code FormSpec } to determine the size of a column or row . * @ param container the layout container * @ param components...
int size = basis . maximumSize ( container , components , minMeasure , prefMeasure , defaultMeasure ) ; if ( lowerBound != null ) { size = Math . max ( size , lowerBound . maximumSize ( container , components , minMeasure , prefMeasure , defaultMeasure ) ) ; } if ( upperBound != null ) { size = Math . min ( size , uppe...
public class HamtPMap { /** * Internal recursive implementation of equivalent ( HamtPMap , BiPredicate ) . */ private static < K , V > boolean equivalent ( @ Nullable HamtPMap < K , V > t1 , @ Nullable HamtPMap < K , V > t2 , BiPredicate < V , V > equivalence ) { } }
if ( t1 == t2 ) { return true ; } else if ( t1 == null || t2 == null ) { return false ; } if ( t1 . hash != t2 . hash ) { // Due to our invariant , we can safely conclude that there ' s a discrepancy in the // keys without any extra work . return false ; } else if ( ! t1 . key . equals ( t2 . key ) ) { // Hash collisio...
public class AbstractPlatform { /** * Delivers { @ code error } to { @ code callback } on the next game tick ( on the PlayN thread ) . */ public void notifyFailure ( final Callback < ? > callback , final Throwable error ) { } }
invokeLater ( new Runnable ( ) { public void run ( ) { callback . onFailure ( error ) ; } } ) ;
public class AmazonWebServiceClient { /** * Fluent method for { @ link # setRegion ( Region ) } . * < pre > * Example : * AmazonDynamoDBClient client = new AmazonDynamoDBClient ( . . . ) . < AmazonDynamoDBClient > withRegion ( . . . ) ; * < / pre > * @ see # setRegion ( Region ) * @ deprecated use { @ link ...
setRegion ( region ) ; @ SuppressWarnings ( "unchecked" ) T t = ( T ) this ; return t ;
public class MockDriverRestartContext { /** * Pass these active contexts to the { @ link org . apache . reef . driver . parameters . DriverRestartContextActiveHandlers } . * These active contexts have no tasks running . * @ return */ public List < MockActiveContext > getIdleActiveContexts ( ) { } }
final List < MockActiveContext > idleActiveContexts = new ArrayList < > ( ) ; final Set < String > activeContextsWithRunningTasks = new HashSet < > ( ) ; for ( final MockRunningTask task : this . runningTasks ) { activeContextsWithRunningTasks . add ( task . getActiveContext ( ) . getEvaluatorId ( ) ) ; } for ( final M...
public class CronTriggerImpl { /** * Called when the < code > { @ link Scheduler } < / code > has decided to ' fire ' the trigger ( execute the * associated < code > Job < / code > ) , in order to give the < code > Trigger < / code > a chance to update * itself for its next triggering ( if any ) . * @ see # execu...
previousFireTime = nextFireTime ; nextFireTime = getFireTimeAfter ( nextFireTime ) ; while ( nextFireTime != null && calendar != null && ! calendar . isTimeIncluded ( nextFireTime . getTime ( ) ) ) { nextFireTime = getFireTimeAfter ( nextFireTime ) ; }
public class MPSImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . MPS__RG_LENGTH : return RG_LENGTH_EDEFAULT == null ? rgLength != null : ! RG_LENGTH_EDEFAULT . equals ( rgLength ) ; case AfplibPackage . MPS__RESERVED : return RESERVED_EDEFAULT == null ? reserved != null : ! RESERVED_EDEFAULT . equals ( reserved ) ; case AfplibPackage . MPS...
public class SkbShellFactory { /** * Returns a new shell with a given identifier and STGroup plus console activated . * @ param id new shell with identifier * @ param renderer a renderer for help messages * @ return new shell */ public static SkbShell newShell ( String id , MessageRenderer renderer ) { } }
return SkbShellFactory . newShell ( id , renderer , true ) ;
public class GetTranscriptionJobRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetTranscriptionJobRequest getTranscriptionJobRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getTranscriptionJobRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getTranscriptionJobRequest . getTranscriptionJobName ( ) , TRANSCRIPTIONJOBNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable t...
public class SpotifyApi { /** * Get the current user ’ s followed artists . * @ param type The ID type : currently only artist is supported . * @ return A { @ link GetUsersFollowedArtistsRequest . Builder } . * @ see < a href = " https : / / developer . spotify . com / web - api / user - guide / # spotify - uris ...
return new GetUsersFollowedArtistsRequest . Builder ( accessToken ) . setDefaults ( httpManager , scheme , host , port ) . type ( type ) ;
public class KeyStoreHelper { /** * Load a key store from a resource . * @ param aKeyStoreType * Type of key store . May not be < code > null < / code > . * @ param sKeyStorePath * The path pointing to the key store . May not be < code > null < / code > . * @ param aKeyStorePassword * The key store password...
ValueEnforcer . notNull ( aKeyStoreType , "KeyStoreType" ) ; ValueEnforcer . notNull ( sKeyStorePath , "KeyStorePath" ) ; // Open the resource stream final InputStream aIS = getResourceProvider ( ) . getInputStream ( sKeyStorePath ) ; if ( aIS == null ) throw new IllegalArgumentException ( "Failed to open key store '" ...
public class JdbcFragment { /** * Get the prepared statement parameter value ( s ) contained within this fragment . * @ param context A ControlBeanContext instance . * @ param method The annotated method . * @ param args The method ' s arguments . * @ return null if this fragment doesn ' t contain a parameter v...
ArrayList < Object > values = new ArrayList < Object > ( ) ; for ( SqlFragment sf : _children ) { if ( sf . hasParamValue ( ) ) { Object [ ] moreValues = sf . getParameterValues ( context , method , args ) ; for ( Object o : moreValues ) { values . add ( o ) ; } } } return values . toArray ( ) ;
public class IoUtils { /** * Copy input stream to output stream without closing streams . Flushes output stream when done . * @ param is input stream * @ param os output stream * @ param bufferSize the buffer size to use * @ throws IOException for any error */ private static void copyStream ( InputStream is , O...
Assert . checkNotNullParam ( "is" , is ) ; Assert . checkNotNullParam ( "os" , os ) ; byte [ ] buff = new byte [ bufferSize ] ; int rc ; while ( ( rc = is . read ( buff ) ) != - 1 ) os . write ( buff , 0 , rc ) ; os . flush ( ) ;
public class MainScene { /** * Register a listener for { @ link OnScaledListener # onScaled ( float ) * onScaled ( ) } notifications . * Newly registered listeners are immediately called with the current * scaling . * @ param listener An implementation of { @ link OnScaledListener } . * @ return { @ code True...
final boolean added = mOnScaledListeners . add ( listener ) ; if ( added ) { listener . onScaled ( mSceneRootObject . getTransform ( ) . getScaleX ( ) ) ; } return added ;
public class SimpleRequestManager { @ Override public HttpServletRequest getRequest ( ) { } }
final HttpServletRequest request = LaRequestUtil . getRequest ( ) ; if ( request == null ) { throw new IllegalStateException ( "Not found the request, not web environment?" ) ; } return request ;
public class ProcessorBuilder { /** * Find or create the scope . * @ param scope the scope configuration * @ return scope scope */ ProcScope createScope ( Scope scope ) { } }
ProcScope created = scopes . get ( scope ) ; if ( created == null ) { created = new ProcScope ( scope . getName ( ) ) ; scopes . put ( scope , created ) ; created . setStrong ( scope . isStrong ( ) ) ; created . setIgnoreText ( scope . isIgnoreText ( ) ) ; if ( scope . getParent ( ) != null ) { created . setParent ( cr...
public class Lists { /** * Checks whether the list has the given size . A null list is treated like a list without * entries . * @ param list The list to check * @ param size The size to check * @ return true when the list has the given size or when size = 0 and the list is null , false * otherwise */ public ...
if ( size == 0 ) { return list == null || list . isEmpty ( ) ; } else { return list != null && list . size ( ) == size ; }
public class InclusiveAnnotationIntrospector { /** * Indicates whether the given type is a " serializable " type . */ private boolean isSerializableType ( Class < ? > type ) { } }
Boolean serializable = cache . get ( type ) ; if ( serializable != null ) { return serializable ; } if ( type == Object . class ) { return true ; } if ( primitiveTypes . contains ( type ) ) { cache . put ( type , true ) ; return true ; } if ( JsonSerializable . class . isAssignableFrom ( type ) ) { cache . put ( type ,...
public class DriverFactory { /** * Registers new { @ linkplain Driver } under provided name with specified properties . * @ param name * the name of the instance * @ param props * the { @ link Properties } for the instance */ public static void configure ( String name , Properties props ) { } }
put ( name , createDriver ( name , props ) ) ;
public class JMatrix { /** * Sort eigenvalues and eigenvectors . */ protected static void sort ( double [ ] d , double [ ] e , DenseMatrix V ) { } }
int i = 0 ; int n = d . length ; double [ ] temp = new double [ n ] ; for ( int j = 1 ; j < n ; j ++ ) { double real = d [ j ] ; double img = e [ j ] ; for ( int k = 0 ; k < n ; k ++ ) { temp [ k ] = V . get ( k , j ) ; } for ( i = j - 1 ; i >= 0 ; i -- ) { if ( d [ i ] >= d [ j ] ) { break ; } d [ i + 1 ] = d [ i ] ; ...
public class SecurityUtility { /** * Drive the logic of the program . * @ param args */ SecurityUtilityReturnCodes runProgram ( String [ ] args ) { } }
if ( stdin == null ) { stderr . println ( CommandUtils . getMessage ( "error.missingIO" , "stdin" ) ) ; return SecurityUtilityReturnCodes . ERR_GENERIC ; } if ( stdout == null ) { stderr . println ( CommandUtils . getMessage ( "error.missingIO" , "stdout" ) ) ; return SecurityUtilityReturnCodes . ERR_GENERIC ; } if ( s...
public class Engine { /** * Get template by file name */ public Template getTemplate ( String fileName ) { } }
if ( fileName . charAt ( 0 ) != '/' ) { char [ ] arr = new char [ fileName . length ( ) + 1 ] ; fileName . getChars ( 0 , fileName . length ( ) , arr , 1 ) ; arr [ 0 ] = '/' ; fileName = new String ( arr ) ; } Template template = templateCache . get ( fileName ) ; if ( template == null ) { template = buildTemplateBySou...
public class AbstractContext { /** * / * ( non - Javadoc ) * @ see com . abubusoft . kripton . BinderContext # serialize ( java . lang . Object ) */ @ SuppressWarnings ( "unchecked" ) @ Override public < E > String serialize ( E object ) { } }
if ( object == null ) return null ; SegmentedStringWriter source = new SegmentedStringWriter ( buffer . get ( ) ) ; try ( SerializerWrapper serializer = createSerializer ( source ) ) { mapperFor ( ( Class < E > ) object . getClass ( ) ) . serialize ( this , serializer , object ) ; } catch ( Exception e ) { e . printSta...
public class InstanceHelpers { /** * Finds the name of an instance from its path . * @ param instancePath a non - null instance path * @ return an instance name , or the path itself if it is not valid ( e . g . no slash ) */ public static String findInstanceName ( String instancePath ) { } }
String instanceName = "" ; Matcher m = Pattern . compile ( "([^/]+)$" ) . matcher ( instancePath ) ; if ( m . find ( ) ) instanceName = m . group ( 1 ) ; return instanceName ;
public class IOGroovyMethods { /** * Allows this AutoCloseable to be used within the closure , ensuring that it * is closed once the closure has been executed and before this method returns . * As with the try - with - resources statement , if multiple exceptions are thrown * the exception from the closure will b...
Throwable thrown = null ; try { return action . call ( self ) ; } catch ( Throwable e ) { thrown = e ; throw e ; } finally { if ( thrown != null ) { Throwable suppressed = tryClose ( self , true ) ; if ( suppressed != null ) { thrown . addSuppressed ( suppressed ) ; } } else { self . close ( ) ; } }
public class LocationAttributes { /** * Returns the column number of an element ( DOM flavor ) * @ param elem * the element that holds the location information * @ return the element ' s column number or < code > - 1 < / code > if * < code > elem < / code > has no location information . */ public static int get...
Attr attr = elem . getAttributeNodeNS ( URI , COL_ATTR ) ; return attr != null ? Integer . parseInt ( attr . getValue ( ) ) : - 1 ;
public class Region { /** * Merge the supplied region into this region ( if they are adjoining ) . * @ param r region to merge */ public void merge ( Region r ) { } }
if ( this . start == r . end + 1 ) { this . start = r . start ; } else if ( this . end == r . start - 1 ) { this . end = r . end ; } else { throw new AssertionError ( "Ranges : Merge called on non contiguous values : [this]:" + this + " and " + r ) ; } updateAvailable ( ) ;
public class NewServiceDescriptorImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) @ Override public EList < String > getInputs ( ) { } }
return ( EList < String > ) eGet ( StorePackage . Literals . NEW_SERVICE_DESCRIPTOR__INPUTS , true ) ;
public class ServerConfig { /** * Set configuration parameters from the given YAML - loaded map . */ private static void setParams ( Map < String , ? > map ) { } }
for ( String name : map . keySet ( ) ) { setParam ( name , map . get ( name ) ) ; }
public class NaetherImpl { /** * / * ( non - Javadoc ) * @ see com . tobedevoured . naether . api . Naether # addDependency ( java . lang . String , java . lang . String ) */ public void addDependency ( String notation , String scope ) { } }
log . debug ( "Add dep {} {}" , notation , scope ) ; DefaultArtifact artifact = new DefaultArtifact ( notation ) ; if ( Const . TEST . equals ( artifact . getClassifier ( ) ) || Const . TEST_JAR . equals ( artifact . getClassifier ( ) ) ) { ArtifactType artifactType = new DefaultArtifactType ( Const . TEST_JAR , Const ...
public class SearchParameterMap { /** * This method creates a URL query string representation of the parameters in this * object , excluding the part before the parameters , e . g . * < code > ? name = smith & amp ; _ sort = Patient : family < / code > * This method < b > excludes < / b > the < code > _ count < /...
StringBuilder b = new StringBuilder ( ) ; ArrayList < String > keys = new ArrayList < > ( keySet ( ) ) ; Collections . sort ( keys ) ; for ( String nextKey : keys ) { List < List < IQueryParameterType > > nextValuesAndsIn = get ( nextKey ) ; List < List < IQueryParameterType > > nextValuesAndsOut = new ArrayList < > ( ...
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EEnum getIfcBooleanOperator ( ) { } }
if ( ifcBooleanOperatorEEnum == null ) { ifcBooleanOperatorEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 787 ) ; } return ifcBooleanOperatorEEnum ;
public class AvatarNode { /** * Returns the name of the http server of the local namenode */ static String getRemoteNamenodeHttpName ( Configuration conf , InstanceId instance ) throws IOException { } }
if ( instance == InstanceId . NODEZERO ) { return conf . get ( "dfs.http.address1" ) ; } else if ( instance == InstanceId . NODEONE ) { return conf . get ( "dfs.http.address0" ) ; } else { throw new IOException ( "Unknown instance " + instance ) ; }
public class Clientlib { /** * Removes invalid chars ( according to { @ link # CATEGORYNAME _ CHARS } ) from a category ; returns null if there is * nothing left / was empty , anyway . */ public static String sanitizeCategory ( String category ) { } }
String res = null ; if ( StringUtils . isNotBlank ( category ) ) { res = category . trim ( ) . replaceAll ( "[^" + CATEGORYNAME_CHARS + "]" , "" ) ; if ( ! res . equals ( category ) ) LOG . error ( "Invalid characters in category {}" , category ) ; } return res ;
public class IOUtils { /** * Locates this file either in the CLASSPATH or in the file system . The CLASSPATH takes priority * @ param fn * @ throws FileNotFoundException * if the file does not exist */ private static InputStream findStreamInClasspathOrFileSystem ( String fn ) throws FileNotFoundException { } }
// ms 10-04-2010: // - even though this may look like a regular file , it may be a path inside a jar in the CLASSPATH // - check for this first . This takes precedence over the file system . InputStream is = IOUtils . class . getClassLoader ( ) . getResourceAsStream ( fn ) ; // if not found in the CLASSPATH , load from...
public class GenericUtils { /** * Utility method to skip past data in an array until it runs out of space * or finds the target character . * @ param data * @ param start * @ param target * @ return int ( return index , equals data . length if not found ) */ static public int skipToChar ( byte [ ] data , int ...
int index = start ; while ( index < data . length && target != data [ index ] ) { index ++ ; } return index ;
public class AmazonWebServiceClient { /** * Notify request handlers that we are about to start execution . */ protected final < T extends AmazonWebServiceRequest > T beforeClientExecution ( T request ) { } }
T local = request ; for ( RequestHandler2 handler : requestHandler2s ) { local = ( T ) handler . beforeExecution ( local ) ; } return local ;
public class AppendableExpression { /** * Returns a similar { @ link AppendableExpression } but with the given ( char valued ) expression * appended to it . */ AppendableExpression appendChar ( Expression exp ) { } }
return withNewDelegate ( delegate . invoke ( APPEND_CHAR , exp ) , true ) ;
public class HijriCalendar { /** * / * [ deutsch ] * < p > Liefert die L & auml ; nge des aktuellen islamischen Jahres in Tagen . < / p > * @ return int * @ since 3.6/4.4 * @ throws ChronoException if data are not available for the whole year ( edge case ) */ public int lengthOfYear ( ) { } }
try { return this . getCalendarSystem ( ) . getLengthOfYear ( HijriEra . ANNO_HEGIRAE , this . hyear ) ; } catch ( IllegalArgumentException iae ) { throw new ChronoException ( iae . getMessage ( ) , iae ) ; }
public class ObjectAnimator { /** * Constructs and returns an ObjectAnimator that animates between float values . A single * value implies that that value is the one being animated to . Two values imply a starting * and ending values . More than two values imply a starting value , values to animate through * alon...
ObjectAnimator anim = new ObjectAnimator ( target , propertyName ) ; anim . setFloatValues ( values ) ; return anim ;
public class ZipExploder { /** * Explode source JAR files into a target directory * @ param jarNames * names of source files * @ param destDir * target directory name ( should already exist ) * @ exception IOException * error creating a target file * @ deprecated use { @ link # processJars ( File [ ] , Fi...
// Delegation to preferred method processJars ( FileUtils . pathNamesToFiles ( jarNames ) , new File ( destDir ) ) ;
public class Counters { /** * Returns the counter with keys modified according to function F . Eager * evaluation . */ public static < T1 , T2 > Counter < T2 > transform ( Counter < T1 > c , Function < T1 , T2 > f ) { } }
Counter < T2 > c2 = new ClassicCounter < T2 > ( ) ; for ( T1 key : c . keySet ( ) ) { c2 . setCount ( f . apply ( key ) , c . getCount ( key ) ) ; } return c2 ;
public class AbstractGuiceServletConfig { /** * ( non - Javadoc ) * @ see * com . google . inject . servlet . GuiceServletContextListener # contextInitialized * ( javax . servlet . ServletContextEvent ) */ @ Override public void contextInitialized ( ServletContextEvent servletContextEvent ) { } }
// The jerseyServletModule injects the servicing classes using guice , // instead of letting jersey do it natively AbstractJoynrServletModule jerseyServletModule = getJoynrServletModule ( ) ; List < Module > joynrModules = getJoynrModules ( ) ; joynrModules . add ( jerseyServletModule ) ; injector = Guice . createInjec...
public class EJSContainer { /** * LI3294-35 d496060 */ public WSEJBEndpointManager createWebServiceEndpointManager ( J2EEName j2eeName , Class < ? > provider , // d492780 , F87951 Method [ ] methods ) throws EJBException , EJBConfigurationException { } }
final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; // d532639.2 if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "createWebServiceEndpointManager : " + j2eeName , new Object [ ] { provider , methods } ) ; EJSHome home = ( EJSHome ) homeOfHomes . getHome ( j2eeName ) ; // If a WebService r...
public class SymbolManager { /** * Set the TextPitchAlignment property * Orientation of text when map is pitched . * @ param value property wrapper value around String */ public void setTextPitchAlignment ( @ Property . TEXT_PITCH_ALIGNMENT String value ) { } }
PropertyValue propertyValue = textPitchAlignment ( value ) ; constantPropertyUsageMap . put ( PROPERTY_TEXT_PITCH_ALIGNMENT , propertyValue ) ; layer . setProperties ( propertyValue ) ;
public class RetinaApiUtils { /** * Generate the base path for the retina . * @ param ip : retina server ip . * @ param port : retina service port . * @ return : the retina ' s API base path . */ public static String generateBasepath ( final String ip , Short port ) { } }
if ( isEmpty ( ip ) ) { throw new IllegalArgumentException ( NULL_SERVER_IP_MSG ) ; } if ( port == null ) { port = 80 ; } StringBuilder basePath = new StringBuilder ( ) ; basePath . append ( "http://" ) . append ( ip ) . append ( ":" ) . append ( port ) . append ( "/rest" ) ; return basePath . toString ( ) ;
public class appflowparam { /** * Use this API to unset the properties of appflowparam resource . * Properties that need to be unset are specified in args array . */ public static base_response unset ( nitro_service client , appflowparam resource , String [ ] args ) throws Exception { } }
appflowparam unsetresource = new appflowparam ( ) ; return unsetresource . unset_resource ( client , args ) ;
public class AWSBackupClient { /** * Returns a valid JSON document specifying a backup plan or an error . * @ param getBackupPlanFromJSONRequest * @ return Result of the GetBackupPlanFromJSON operation returned by the service . * @ throws LimitExceededException * A limit in the request has been exceeded ; for e...
request = beforeClientExecution ( request ) ; return executeGetBackupPlanFromJSON ( request ) ;
public class Rule { /** * The metric filter matching all metrics that have been registered by this pipeline . * Commonly used to remove the relevant metrics from the registry upon deletion of the pipeline . * @ return the filter matching this pipeline ' s metrics */ public MetricFilter metricsFilter ( ) { } }
if ( id ( ) == null ) { return ( name , metric ) -> false ; } return ( name , metric ) -> metricNames . contains ( name ) ;
public class ZonalDateTime { /** * / * [ deutsch ] * < p > Vergleicht diese Instanz mit der angegebenen Instanz auf der lokalen Zeitachse . < / p > * < p > Die UTC - Zeiten werden genau dann in Betracht gezogen , wenn die lokalen Zeitstempel gleich sind . < / p > * @ param zdt other instance to be compared with ...
int cmp = this . timestamp . compareTo ( zdt . timestamp ) ; if ( cmp == 0 ) { cmp = this . moment . compareTo ( zdt . moment ) ; } return cmp ;
public class Entity { /** * 获得rowid * @ param field rowid属性名 * @ return RowId */ public RowId getRowId ( String field ) { } }
Object obj = this . get ( field ) ; if ( null == obj ) { return null ; } if ( obj instanceof RowId ) { return ( RowId ) obj ; } throw new DbRuntimeException ( "Value of field [{}] is not a rowid!" , field ) ;
public class HttpsFileUploader { /** * Determines if there are upload items where the size is * unknown in advance . This means we cannot predict the total upload size . * @ param uploadItems * @ return */ private static boolean byteSizeIsKnown ( Collection < ? extends UploadItem > uploadItems ) { } }
for ( UploadItem uploadItem : uploadItems ) { if ( uploadItem . getSizeInBytes ( ) == - 1 ) { return false ; } } return true ;
public class PublicationManagerImpl { /** * Called every time a provider is registered to check whether there are already * subscriptionRequests waiting . * @ param providerId provider id * @ param providerContainer provider container */ private void restoreQueuedSubscription ( String providerId , ProviderContain...
Collection < PublicationInformation > queuedRequests = queuedSubscriptionRequests . get ( providerId ) ; Iterator < PublicationInformation > queuedRequestsIterator = queuedRequests . iterator ( ) ; while ( queuedRequestsIterator . hasNext ( ) ) { PublicationInformation publicationInformation = queuedRequestsIterator . ...
public class RollingUpdateOpFactory { /** * Don ' t advance to the next task - - yield and have the current task be executed again in the * next iteration . * @ return { @ link RollingUpdateOp } */ public RollingUpdateOp yield ( ) { } }
// Do nothing return new RollingUpdateOp ( ImmutableList . < ZooKeeperOperation > of ( ) , ImmutableList . < Map < String , Object > > of ( ) ) ;
public class DirtyFieldMixin { /** * Will check all components that extends to { @ link HasValue } and * registers a { @ link com . google . gwt . event . logical . shared . ValueChangeEvent } . * Once value has been changed then we mark that our content wrapping it is dirty . */ protected void detectDirtyFields ( ...
if ( parent instanceof HasWidgets ) { for ( Widget widget : ( HasWidgets ) parent ) { if ( widget instanceof HasValue ) { HasValue valueWidget = ( HasValue ) widget ; registrations . add ( valueWidget . addValueChangeHandler ( event -> { if ( valueWidget . getValue ( ) != null && ! valueWidget . getValue ( ) . equals (...
public class DependsFileParser { /** * Extracts all build - time dependency information from a dependencies . properties file * embedded in this plugin ' s JAR . * @ param anURL The non - empty URL to a dependencies . properties file . * @ return A SortedMap holding all entries in the dependencies . properties fi...
// Check sanity Validate . notNull ( anURL , "anURL" ) ; final SortedMap < String , String > toReturn = new TreeMap < String , String > ( ) ; try { final BufferedReader in = new BufferedReader ( new InputStreamReader ( anURL . openStream ( ) ) ) ; String aLine = null ; while ( ( aLine = in . readLine ( ) ) != null ) { ...
public class KeyrefModule { /** * Recursively walk map and process topics that have keyrefs . */ void walkMap ( final Element elem , final KeyScope scope , final List < ResolveTask > res ) { } }
List < KeyScope > ss = Collections . singletonList ( scope ) ; if ( elem . getAttributeNode ( ATTRIBUTE_NAME_KEYSCOPE ) != null ) { ss = new ArrayList < > ( ) ; for ( final String keyscope : elem . getAttribute ( ATTRIBUTE_NAME_KEYSCOPE ) . trim ( ) . split ( "\\s+" ) ) { final KeyScope s = scope . getChildScope ( keys...
public class ResourceReaderImpl { /** * / * ( non - Javadoc ) * @ see net . crowmagnumb . util . ResourceReader # getStringList ( java . lang . String , java . lang . String ) */ @ Override public List < String > getStringList ( final String key , final String delim ) { } }
return formatStringList ( key , getFormattedPropValue ( key ) , delim ) ;
public class ReflectUtil { /** * 获得指定类本类及其父类中的Public方法名 < br > * 去重重载的方法 * @ param clazz 类 * @ return 方法名Set */ public static Set < String > getPublicMethodNames ( Class < ? > clazz ) { } }
final HashSet < String > methodSet = new HashSet < String > ( ) ; final Method [ ] methodArray = getPublicMethods ( clazz ) ; if ( ArrayUtil . isNotEmpty ( methodArray ) ) { for ( Method method : methodArray ) { methodSet . add ( method . getName ( ) ) ; } } return methodSet ;
public class AbstractHttp2ConnectionHandlerBuilder { /** * Sets if { @ link # build ( ) } will to create a { @ link Http2Connection } in server mode ( { @ code true } ) * or client mode ( { @ code false } ) . */ protected B server ( boolean isServer ) { } }
enforceConstraint ( "server" , "connection" , connection ) ; enforceConstraint ( "server" , "codec" , decoder ) ; enforceConstraint ( "server" , "codec" , encoder ) ; this . isServer = isServer ; return self ( ) ;
public class WrappingExecutorService { /** * Wraps a { @ code Runnable } for submission to the underlying executor . The * default implementation delegates to { @ link # wrapTask ( Callable ) } . */ protected Runnable wrapTask ( Runnable command ) { } }
final Callable < Object > wrapped = wrapTask ( Executors . callable ( command , null ) ) ; return new Runnable ( ) { @ Override public void run ( ) { try { wrapped . call ( ) ; } catch ( Exception e ) { Throwables . propagate ( e ) ; } } } ;
public class ClassName { /** * Similar to { @ code ClassName # asString } but uses unqualified type names */ public String asSimpleString ( ) { } }
int dotIndex = asString . lastIndexOf ( '.' ) ; if ( dotIndex > 0 ) { return asString ( ) . substring ( dotIndex + 1 ) ; } return asString ( ) ;
public class ResourceGroupsInner { /** * Updates a resource group . * Resource groups can be updated through a simple PATCH operation to a group address . The format of the request is the same as that for creating a resource group . If a field is unspecified , the current value is retained . * @ param resourceGroup...
return patchWithServiceResponseAsync ( resourceGroupName , parameters ) . map ( new Func1 < ServiceResponse < ResourceGroupInner > , ResourceGroupInner > ( ) { @ Override public ResourceGroupInner call ( ServiceResponse < ResourceGroupInner > response ) { return response . body ( ) ; } } ) ;
public class BatchAppenderatorDriver { /** * Publish all segments . * @ param publisher segment publisher * @ return a { @ link ListenableFuture } for the publish task */ public ListenableFuture < SegmentsAndMetadata > publishAll ( final TransactionalSegmentPublisher publisher ) { } }
final Map < String , SegmentsForSequence > snapshot ; synchronized ( segments ) { snapshot = ImmutableMap . copyOf ( segments ) ; } return publishInBackground ( new SegmentsAndMetadata ( snapshot . values ( ) . stream ( ) . flatMap ( SegmentsForSequence :: allSegmentStateStream ) . map ( segmentWithState -> Preconditio...
public class IndexSelector { /** * Takes the index in the user data ( the second parameter ) and checks the component ' s type . * @ throws QTasteTestFailException if the component is not a JComboBox or a JList . */ @ Override protected void prepareActions ( ) throws QTasteTestFailException { } }
mIndex = Integer . parseInt ( mData [ 0 ] . toString ( ) ) ; if ( component instanceof JComboBox ) { JComboBox combo = ( JComboBox ) component ; if ( combo . getItemCount ( ) < mIndex ) { throw new QTasteTestFailException ( "Specified index is out of bounds" ) ; } } else if ( component instanceof JList ) { JList list =...
public class PathParser { /** * we just have something like " foo " or " foo . bar " */ private static Path speculativeFastParsePath ( String path ) { } }
String s = ConfigImplUtil . unicodeTrim ( path ) ; if ( looksUnsafeForFastParser ( s ) ) return null ; return fastPathBuild ( null , s , s . length ( ) ) ;
public class XmlPullParserFactory { /** * Creates a new instance of a XML Pull Parser * using the currently configured factory features . * @ return A new instance of a XML Pull Parser . */ public XmlPullParser newPullParser ( ) throws XmlPullParserException { } }
final XmlPullParser pp = getParserInstance ( ) ; for ( Map . Entry < String , Boolean > entry : features . entrySet ( ) ) { // NOTE : This test is needed for compatibility reasons . We guarantee // that we only set a feature on a parser if its value is true . if ( entry . getValue ( ) ) { pp . setFeature ( entry . getK...
public class ManagedClustersInner { /** * Reset Service Principal Profile of a managed cluster . * Update the service principal Profile for a managed cluster . * @ param resourceGroupName The name of the resource group . * @ param resourceName The name of the managed cluster resource . * @ param parameters Para...
return ServiceFuture . fromResponse ( beginResetServicePrincipalProfileWithServiceResponseAsync ( resourceGroupName , resourceName , parameters ) , serviceCallback ) ;
public class TypeUtil { /** * Get the generic arguments for a type . * @ param type the type to get arguments * @ return the generic arguments , empty if type is not parameterized */ public static Type [ ] getTypeArguments ( Type type ) { } }
if ( ! ( type instanceof ParameterizedType ) ) { return new Type [ 0 ] ; } return ( ( ParameterizedType ) type ) . getActualTypeArguments ( ) ;
public class CommerceTaxMethodUtil { /** * Returns the first commerce tax method in the ordered set where groupId = & # 63 ; . * @ param groupId the group ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the first matching commerce tax method , o...
return getPersistence ( ) . fetchByGroupId_First ( groupId , orderByComparator ) ;
public class LinkedConverter { /** * For binary fields , set the current state . * @ param state The state to set this field . * @ param bDisplayOption Display changed fields if true . * @ param iMoveMode The move mode . * @ return The error code ( or NORMAL _ RETURN ) . */ public int setState ( boolean state ,...
// Must be overidden if ( this . getNextConverter ( ) != null ) return this . getNextConverter ( ) . setState ( state , bDisplayOption , iMoveMode ) ; else return super . setState ( state , bDisplayOption , iMoveMode ) ;
public class SplitAmongBuilder { /** * Build a constraint . * @ param args the parameters of the constraint . Must be 2 non - empty set of virtual machines . * @ return the constraint */ @ Override public List < ? extends SatConstraint > buildConstraint ( BtrPlaceTree t , List < BtrpOperand > args ) { } }
if ( checkConformance ( t , args ) ) { @ SuppressWarnings ( "unchecked" ) Collection < Collection < VM > > vs = ( Collection < Collection < VM > > ) params [ 0 ] . transform ( this , t , args . get ( 0 ) ) ; @ SuppressWarnings ( "unchecked" ) Collection < Collection < Node > > ps = ( Collection < Collection < Node > > ...
public class FlowTypeUtils { /** * Given an array of record types , filter out those which do not contain exactly * the given set of fields . For example , consider this snippet : * < pre > * method f ( int x ) : * { int f } | { int g } xs = { f : x } * < / pre > * When type checking the expression < code >...
Type . Record [ ] result = new Type . Record [ types . length ] ; for ( int i = 0 ; i != result . length ; ++ i ) { Type . Record ith = types [ i ] ; if ( compareFields ( ith , fields ) ) { result [ i ] = ith ; } } return ArrayUtils . removeAll ( result , null ) ;
public class CollapseProperties { /** * Declares global variables to serve as aliases for the values in an object literal , optionally * removing all of the object literal ' s keys and values . * @ param alias The object literal ' s flattened name ( e . g . " a $ b $ c " ) * @ param objlit The OBJLIT node * @ p...
int arbitraryNameCounter = 0 ; boolean discardKeys = ! objlitName . shouldKeepKeys ( ) ; for ( Node key = objlit . getFirstChild ( ) , nextKey ; key != null ; key = nextKey ) { Node value = key . getFirstChild ( ) ; nextKey = key . getNext ( ) ; // A computed property , or a get or a set can not be rewritten as a VAR ....
public class ApiOvhIp { /** * Get this object properties * REST : GET / ip / { ip } / delegation / { target } * @ param ip [ required ] * @ param target [ required ] NS target for delegation */ public OvhReverseDelegation ip_delegation_target_GET ( String ip , String target ) throws IOException { } }
String qPath = "/ip/{ip}/delegation/{target}" ; StringBuilder sb = path ( qPath , ip , target ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhReverseDelegation . class ) ;
public class JournalNodeRpcServer { /** * register fast protocol */ public static void init ( ) { } }
try { FastProtocolRegister . register ( FastProtocolId . SERIAL_VERSION_ID_1 , QJournalProtocol . class . getMethod ( "journal" , JournalRequestInfo . class ) ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; }
public class AiMesh { /** * Returns the y - coordinate of a vertex position . * @ param vertex the vertex index * @ return the y coordinate */ public float getPositionY ( int vertex ) { } }
if ( ! hasPositions ( ) ) { throw new IllegalStateException ( "mesh has no positions" ) ; } checkVertexIndexBounds ( vertex ) ; return m_vertices . getFloat ( ( vertex * 3 + 1 ) * SIZEOF_FLOAT ) ;
public class JAXWSBundle { /** * Publish JAX - WS protected endpoint using Dropwizard BasicAuthentication with Dropwizard Hibernate Bundle * integration . Service is scanned for @ UnitOfWork annotations . EndpointBuilder is published relative to the CXF * servlet path . * @ param path Relative endpoint path . *...
checkArgument ( service != null , "Service is null" ) ; checkArgument ( path != null , "Path is null" ) ; checkArgument ( ( path ) . trim ( ) . length ( ) > 0 , "Path is empty" ) ; return this . publishEndpoint ( new EndpointBuilder ( path , service ) . authentication ( auth ) . sessionFactory ( sessionFactory ) ) ;
public class ClientUtils { /** * Display type string from class name string . */ public static String displayType ( String className , Object value ) { } }
if ( className == null ) { return null ; } boolean array = false ; if ( className . equals ( "[J" ) ) { array = true ; if ( value == null ) { className = "unknown" ; } else if ( value instanceof boolean [ ] ) { className = "boolean" ; } else if ( value instanceof byte [ ] ) { className = "byte" ; } else if ( value inst...
public class AbstractObjectStore { /** * Set the identifier of the Object Store , unique within this ObjectManager . * @ param identifier the assigned objectStore identifier * @ throws ObjectManagerException */ public void setIdentifier ( int identifier ) throws ObjectManagerException { } }
if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "setIdentifier" , new Object [ ] { new Integer ( identifier ) } ) ; // We can only set this once . if ( objectStoreIdentifier != IDENTIFIER_NOT_SET ) { InvalidConditionException invalidConditionException = new Invalid...
public class Renderer { /** * Render the supplied content to a file . * @ param content The content to renderDocument * @ throws Exception if IOException or SecurityException are raised */ public void render ( Map < String , Object > content ) throws Exception { } }
String docType = ( String ) content . get ( Crawler . Attributes . TYPE ) ; String outputFilename = config . getDestinationFolder ( ) . getPath ( ) + File . separatorChar + content . get ( Attributes . URI ) ; if ( outputFilename . lastIndexOf ( '.' ) > outputFilename . lastIndexOf ( File . separatorChar ) ) { outputFi...
public class Word { /** * for debug only */ public String __toString ( ) { } }
StringBuilder sb = new StringBuilder ( ) ; sb . append ( value ) ; sb . append ( '/' ) ; // append the cx if ( partspeech != null ) { for ( int j = 0 ; j < partspeech . length ; j ++ ) { if ( j == 0 ) { sb . append ( partspeech [ j ] ) ; } else { sb . append ( ',' ) ; sb . append ( partspeech [ j ] ) ; } } } else { sb ...
public class Box { /** * @ description * Generates a new random key pair for box and * returns it as an object with publicKey and secretKey members : */ public static KeyPair keyPair ( ) { } }
KeyPair kp = new KeyPair ( ) ; crypto_box_keypair ( kp . getPublicKey ( ) , kp . getSecretKey ( ) ) ; return kp ;