signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class StorePackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getCheckoutResult ( ) { } }
if ( checkoutResultEClass == null ) { checkoutResultEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( StorePackage . eNS_URI ) . getEClassifiers ( ) . get ( 18 ) ; } return checkoutResultEClass ;
public class SerializationServiceImpl { /** * Attempts to resolve a class from registered class providers . * @ param name the class name * @ return the class , or null if not found * @ throws ClassNotFoundException if a class provider claimed to provide a * class or package , but its bundle did not contain the class */ Class < ? > loadClass ( String name ) throws ClassNotFoundException { } }
// First , try to find the class by name . ServiceReference < DeserializationClassProvider > provider = classProviders . getReference ( name ) ; if ( provider != null ) { return loadClass ( provider , name ) ; } // Next , try to find the class by package . int index = name . lastIndexOf ( '.' ) ; if ( index != - 1 ) { String pkg = name . substring ( 0 , index ) ; provider = packageProviders . getReference ( pkg ) ; if ( provider != null ) { return loadClass ( provider , name ) ; } } return null ;
public class SubscriptionSchedule { /** * Retrieves the list of subscription schedule revisions for a subscription schedule . */ public SubscriptionScheduleRevisionCollection revisions ( ) throws StripeException { } }
return revisions ( ( Map < String , Object > ) null , ( RequestOptions ) null ) ;
public class Equation { /** * Parses a code block with no parentheses and no commas . After it is done there should be a single token left , * which is returned . */ protected TokenList . Token parseBlockNoParentheses ( TokenList tokens , Sequence sequence , boolean insideMatrixConstructor ) { } }
// search for matrix bracket operations if ( ! insideMatrixConstructor ) { parseBracketCreateMatrix ( tokens , sequence ) ; } // First create sequences from anything involving a colon parseSequencesWithColons ( tokens , sequence ) ; // process operators depending on their priority parseNegOp ( tokens , sequence ) ; parseOperationsL ( tokens , sequence ) ; parseOperationsLR ( new Symbol [ ] { Symbol . POWER , Symbol . ELEMENT_POWER } , tokens , sequence ) ; parseOperationsLR ( new Symbol [ ] { Symbol . TIMES , Symbol . RDIVIDE , Symbol . LDIVIDE , Symbol . ELEMENT_TIMES , Symbol . ELEMENT_DIVIDE } , tokens , sequence ) ; parseOperationsLR ( new Symbol [ ] { Symbol . PLUS , Symbol . MINUS } , tokens , sequence ) ; // Commas are used in integer sequences . Can be used to force to compiler to treat - as negative not // minus . They can now be removed since they have served their purpose stripCommas ( tokens ) ; // now construct rest of the lists and combine them together parseIntegerLists ( tokens ) ; parseCombineIntegerLists ( tokens ) ; if ( ! insideMatrixConstructor ) { if ( tokens . size ( ) > 1 ) { System . err . println ( "Remaining tokens: " + tokens . size ) ; TokenList . Token t = tokens . first ; while ( t != null ) { System . err . println ( " " + t ) ; t = t . next ; } throw new RuntimeException ( "BUG in parser. There should only be a single token left" ) ; } return tokens . first ; } else { return null ; }
public class LangProfile { /** * Add n - gram to profile * @ param gram */ public void add ( @ NotNull String gram ) { } }
if ( name == null ) throw new IllegalStateException ( ) ; int len = gram . length ( ) ; if ( len < 1 || len > NGram . N_GRAM ) { throw new IllegalArgumentException ( "ngram length must be 1-3 but was " + len + ": >>>" + gram + "<<<!" ) ; } nWords [ len - 1 ] ++ ; if ( freq . containsKey ( gram ) ) { freq . put ( gram , freq . get ( gram ) + 1 ) ; } else { freq . put ( gram , 1 ) ; }
public class PriceListEntryUrl { /** * Get Resource Url for DeletePriceListEntry * @ param currencyCode The three character ISOÂ currency code , such as USDÂ for US Dollars . * @ param priceListCode The code of the specified price list associated with the price list entry . * @ param productCode The unique , user - defined product code of a product , used throughout to reference and associate to a product . * @ param startDate The start date of the price list entry . * @ return String Resource Url */ public static MozuUrl deletePriceListEntryUrl ( String currencyCode , String priceListCode , String productCode , DateTime startDate ) { } }
UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/pricelists/{priceListCode}/entries/{productCode}/{currencyCode}?startDate={startDate}" ) ; formatter . formatUrl ( "currencyCode" , currencyCode ) ; formatter . formatUrl ( "priceListCode" , priceListCode ) ; formatter . formatUrl ( "productCode" , productCode ) ; formatter . formatUrl ( "startDate" , startDate ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ;
public class RESTRequest { /** * zero - length byte [ ] is returned . The message is * not * decompressed . */ private byte [ ] readRequestBody ( ) { } }
int bytesLeft = m_request . getContentLength ( ) ; if ( bytesLeft <= 0 ) { return new byte [ 0 ] ; } int totalBytesRead = 0 ; try { byte [ ] byteBuffer = new byte [ bytesLeft ] ; try ( InputStream inputStream = m_request . getInputStream ( ) ) { int bytesRead = - 1 ; int offset = 0 ; while ( ( bytesRead = inputStream . read ( byteBuffer , offset , bytesLeft ) ) > 0 ) { offset += bytesRead ; bytesLeft -= bytesRead ; totalBytesRead += bytesRead ; } } return byteBuffer ; } catch ( IOException e ) { String errMsg = String . format ( "Error reading from input request; expected %d bytes; only read %d bytes" , m_request . getContentLength ( ) , totalBytesRead ) ; throw new RuntimeException ( errMsg , e ) ; }
public class BaseRedisDLockFactory { /** * { @ inheritDoc } * @ since 0.1.1.2 */ @ Override public BaseRedisDLockFactory init ( ) { } }
if ( jedisConnector == null ) { jedisConnector = buildJedisConnector ( ) ; myOwnRedis = jedisConnector != null ; } return this ;
public class Matth { /** * Returns { @ code n ! } , that is , the product of the first { @ code n } positive integers , or { @ code 1} * if { @ code n = = 0 } . * < p > < b > Warning : < / b > the result takes < i > O ( n log n ) < / i > space , so use cautiously . * < p > This uses an efficient binary recursive algorithm to compute the factorial with balanced * multiplies . It also removes all the 2s from the intermediate products ( shifting them back in at * the end ) . * @ throws IllegalArgumentException if { @ code n < 0} */ public static BigInteger facttorial ( int n ) { } }
checkNonNegative ( "n" , n ) ; // If the factorial is small enough , just use LongMath to do it . if ( n < long_factorials . length ) { return BigInteger . valueOf ( long_factorials [ n ] ) ; } // Pre - allocate space for our list of intermediate BigIntegers . int approxSize = divide ( n * log2 ( n , CEILING ) , Long . SIZE , CEILING ) ; ArrayList < BigInteger > bignums = new ArrayList < > ( approxSize ) ; // Start from the pre - computed maximum long factorial . int startingNumber = long_factorials . length ; long product = long_factorials [ startingNumber - 1 ] ; // Strip off 2s from this value . int shift = Long . numberOfTrailingZeros ( product ) ; product >>= shift ; // Use floor ( log2 ( num ) ) + 1 to prevent overflow of multiplication . int productBits = log2 ( product , FLOOR ) + 1 ; int bits = log2 ( startingNumber , FLOOR ) + 1 ; // Check for the next power of two boundary , to save us a CLZ operation . int nextPowerOfTwo = 1 << ( bits - 1 ) ; // Iteratively multiply the longs as big as they can go . for ( long num = startingNumber ; num <= n ; num ++ ) { // Check to see if the floor ( log2 ( num ) ) + 1 has changed . if ( ( num & nextPowerOfTwo ) != 0 ) { nextPowerOfTwo <<= 1 ; bits ++ ; } // Get rid of the 2s in num . int tz = Long . numberOfTrailingZeros ( num ) ; long normalizedNum = num >> tz ; shift += tz ; // Adjust floor ( log2 ( num ) ) + 1. int normalizedBits = bits - tz ; // If it won ' t fit in a long , then we store off the intermediate product . if ( normalizedBits + productBits >= Long . SIZE ) { bignums . add ( BigInteger . valueOf ( product ) ) ; product = 1 ; productBits = 0 ; } product *= normalizedNum ; productBits = log2 ( product , FLOOR ) + 1 ; } // Check for leftovers . if ( product > 1 ) { bignums . add ( BigInteger . valueOf ( product ) ) ; } // Efficiently multiply all the intermediate products together . return listProduct ( bignums ) . shiftLeft ( shift ) ;
public class CmsModule { /** * Calculates the resources belonging to the module , taking excluded resources and readability of resources into account , * and returns site paths of the module resources . < p > * For more details of the returned resource , see { @ link # calculateModuleResources ( CmsObject , CmsModule ) } . * @ param cms the { @ link CmsObject } used to read the resources . * @ param module the module , for which the resources should be calculated * @ return the calculated module resources * @ throws CmsException thrown if reading resources fails . */ public static List < String > calculateModuleResourceNames ( final CmsObject cms , final CmsModule module ) throws CmsException { } }
// adjust the site root , if necessary CmsObject cmsClone = adjustSiteRootIfNecessary ( cms , module ) ; // calculate the module resources List < CmsResource > moduleResources = calculateModuleResources ( cmsClone , module ) ; // get the site paths List < String > moduleResouceNames = new ArrayList < String > ( moduleResources . size ( ) ) ; for ( CmsResource resource : moduleResources ) { moduleResouceNames . add ( cmsClone . getSitePath ( resource ) ) ; } return moduleResouceNames ;
public class HashList { /** * Replaces the element at the specified position in this list with * the specified element . * @ param index index of element to replace . * @ param element element to be stored at the specified position . * @ return the element previously at the specified position . * @ throws IndexOutOfBoundsException if index out of range * < tt > ( index & lt ; 0 | | index & gt ; = size ( ) ) < / tt > . */ @ Override public E set ( int index , E element ) { } }
if ( element != null && ! contains ( element ) ) { return super . set ( index , element ) ; } return get ( index ) ;
public class PdfContentByte { /** * Implements a link to other part of the document . The jump will * be made to a local destination with the same name , that must exist . * @ param name the name for this link * @ param llx the lower left x corner of the activation area * @ param lly the lower left y corner of the activation area * @ param urx the upper right x corner of the activation area * @ param ury the upper right y corner of the activation area */ public void localGoto ( String name , float llx , float lly , float urx , float ury ) { } }
pdf . localGoto ( name , llx , lly , urx , ury ) ;
public class AnyValueMap { /** * Converts map element into an AnyValueArray or returns default value if * conversion is not possible . * @ param key a key of element to get . * @ param defaultValue the default value * @ return AnyValueArray value of the element or default value if conversion is * not supported . * @ see AnyValueArray * @ see # getAsNullableArray ( String ) */ public AnyValueArray getAsArrayWithDefault ( String key , AnyValueArray defaultValue ) { } }
AnyValueArray result = getAsNullableArray ( key ) ; return result != null ? result : defaultValue ;
public class TextBuffer { /** * Method called to indicate that the underlying buffers should now * be recycled if they haven ' t yet been recycled . Although caller * can still use this text buffer , it is not advisable to call this * method if that is likely , since next time a buffer is needed , * buffers need to reallocated . * Note : calling this method automatically also clears contents * of the buffer . */ public void recycle ( boolean force ) { } }
if ( mConfig != null && mCurrentSegment != null ) { if ( force ) { /* If we are allowed to wipe out all existing data , it ' s * quite easy ; we ' ll just wipe out contents , and return * biggest buffer : */ resetWithEmpty ( ) ; } else { /* But if there ' s non - shared data ( ie . buffer is still * in use ) , can ' t return it yet : */ if ( mInputStart < 0 && ( mSegmentSize + mCurrentSize ) > 0 ) { return ; } // If no data ( or only shared data ) , can continue if ( mSegments != null && mSegments . size ( ) > 0 ) { // No need to use anything from list , curr segment not null mSegments . clear ( ) ; mSegmentSize = 0 ; } } char [ ] buf = mCurrentSegment ; mCurrentSegment = null ; mConfig . freeMediumCBuffer ( buf ) ; }
public class DiameterStackMultiplexer { /** * ( non - Javadoc ) * @ see org . mobicents . diameter . stack . DiameterStackMultiplexerMBean # _ LocalPeer _ setRealm ( java . lang . String ) */ @ Override public void _LocalPeer_setRealm ( String realm ) throws MBeanException { } }
getMutableConfiguration ( ) . setStringValue ( OwnRealm . ordinal ( ) , realm ) ; if ( logger . isInfoEnabled ( ) ) { logger . info ( "Local Peer Realm successfully changed to '" + realm + "'. Restart to Diameter stack is needed to apply changes." ) ; }
public class CmsModelPageHelper { /** * Sets the default model page within the given configuration file . < p > * @ param configFile the configuration file * @ param modelId the default model id * @ return the updated model configuration * @ throws CmsException in case something goes wrong */ CmsModelInfo setDefaultModelPage ( CmsResource configFile , CmsUUID modelId ) throws CmsException { } }
CmsFile file = m_cms . readFile ( configFile ) ; CmsXmlContent content = CmsXmlContentFactory . unmarshal ( m_cms , file ) ; Locale locale = getLocale ( content ) ; int defaultValueIndex = - 1 ; String defaultModelTarget = null ; for ( I_CmsXmlContentValue value : content . getValues ( CmsConfigurationReader . N_MODEL_PAGE , locale ) ) { I_CmsXmlContentValue linkValue = content . getValue ( CmsStringUtil . joinPaths ( value . getPath ( ) , CmsConfigurationReader . N_PAGE ) , locale ) ; I_CmsXmlContentValue isDefaultValue = content . getValue ( CmsStringUtil . joinPaths ( value . getPath ( ) , CmsConfigurationReader . N_IS_DEFAULT ) , locale ) ; CmsLink link = ( ( CmsXmlVfsFileValue ) linkValue ) . getLink ( m_cms ) ; if ( ( link != null ) && link . getStructureId ( ) . equals ( modelId ) ) { // store index and site path defaultValueIndex = value . getIndex ( ) ; defaultModelTarget = link . getTarget ( ) ; } else { isDefaultValue . setStringValue ( m_cms , Boolean . FALSE . toString ( ) ) ; } } if ( defaultValueIndex != - 1 ) { // remove the value from the old position and insert it a the top content . removeValue ( CmsConfigurationReader . N_MODEL_PAGE , locale , defaultValueIndex ) ; content . addValue ( m_cms , CmsConfigurationReader . N_MODEL_PAGE , locale , 0 ) ; content . getValue ( CmsConfigurationReader . N_MODEL_PAGE + "[1]/" + CmsConfigurationReader . N_PAGE , locale ) . setStringValue ( m_cms , defaultModelTarget ) ; content . getValue ( CmsConfigurationReader . N_MODEL_PAGE + "[1]/" + CmsConfigurationReader . N_DISABLED , locale ) . setStringValue ( m_cms , Boolean . FALSE . toString ( ) ) ; content . getValue ( CmsConfigurationReader . N_MODEL_PAGE + "[1]/" + CmsConfigurationReader . N_IS_DEFAULT , locale ) . setStringValue ( m_cms , Boolean . TRUE . toString ( ) ) ; } content . setAutoCorrectionEnabled ( true ) ; content . correctXmlStructure ( m_cms ) ; file . setContents ( content . marshal ( ) ) ; m_cms . writeFile ( file ) ; OpenCms . getADEManager ( ) . waitForCacheUpdate ( false ) ; m_adeConfig = OpenCms . getADEManager ( ) . lookupConfiguration ( m_cms , m_rootResource . getRootPath ( ) ) ; return getModelInfo ( ) ;
public class RESTClient { /** * Creates MultipartBody . It contains 3 parts , " book1 " , " book2 " and " image " . * These individual parts have their Content - Type set to application / xml , * application / json and application / octet - stream * MultipartBody will use the Content - Type value of the individual * part to write its data by delegating to a matching JAX - RS MessageBodyWriter * provider * @ return * @ throws Exception */ private MultipartBody createMultipartBody ( ) throws Exception { } }
List < Attachment > atts = new LinkedList < Attachment > ( ) ; atts . add ( new Attachment ( "book1" , "application/xml" , new Book ( "JAXB" , 1L ) ) ) ; atts . add ( new Attachment ( "book2" , "application/json" , new Book ( "JSON" , 2L ) ) ) ; atts . add ( new Attachment ( "image" , "application/octet-stream" , getClass ( ) . getResourceAsStream ( "/java.jpg" ) ) ) ; return new MultipartBody ( atts , true ) ;
public class JMJson { /** * Transform t 2. * @ param < T1 > the type parameter * @ param < T2 > the type parameter * @ param object the object * @ param typeReference the type reference * @ return the t 2 */ public static < T1 , T2 > T2 transform ( T1 object , TypeReference < T2 > typeReference ) { } }
try { return jsonMapper . convertValue ( object , typeReference ) ; } catch ( Exception e ) { return JMExceptionManager . handleExceptionAndReturnNull ( log , e , "transform" , object ) ; }
public class ClassChannel { /** * Returns < code > true < / code > if the < code > value < / code > * is the same class or a base class of this channel ' s class . * @ see org . jgrapes . core . Eligible # isEligibleFor ( java . lang . Object ) */ @ Override public boolean isEligibleFor ( Object value ) { } }
return Class . class . isInstance ( value ) && ( ( Class < ? > ) value ) . isAssignableFrom ( ( Class < ? > ) defaultCriterion ( ) ) ;
public class KeyChainGroup { /** * Returns whether this chain has only watching keys ( unencrypted keys with no private part ) . Mixed chains are * forbidden . * @ throws IllegalStateException if there are no keys , or if there is a mix between watching and non - watching keys . */ public boolean isWatching ( ) { } }
BasicKeyChain . State basicState = basic . isWatching ( ) ; BasicKeyChain . State activeState = BasicKeyChain . State . EMPTY ; if ( chains != null && ! chains . isEmpty ( ) ) { if ( getActiveKeyChain ( ) . isWatching ( ) ) activeState = BasicKeyChain . State . WATCHING ; else activeState = BasicKeyChain . State . REGULAR ; } if ( basicState == BasicKeyChain . State . EMPTY ) { if ( activeState == BasicKeyChain . State . EMPTY ) throw new IllegalStateException ( "Empty key chain group: cannot answer isWatching() query" ) ; return activeState == BasicKeyChain . State . WATCHING ; } else if ( activeState == BasicKeyChain . State . EMPTY ) return basicState == BasicKeyChain . State . WATCHING ; else { if ( activeState != basicState ) throw new IllegalStateException ( "Mix of watching and non-watching keys in wallet" ) ; return activeState == BasicKeyChain . State . WATCHING ; }
public class RegularPolygon { /** * Determines the properties of the underlying circle and the point coordinates . */ protected void determineCoordinates ( ) { } }
for ( int i = 0 ; i < numPoints ; i ++ ) { coordinates . set ( i , getPointCoordinate ( i ) ) ; }
public class CompletableFuture { /** * Returns raw result after waiting , or null if interruptible and interrupted . */ private Object waitingGet ( boolean interruptible ) { } }
Signaller q = null ; boolean queued = false ; Object r ; while ( ( r = result ) == null ) { if ( q == null ) { q = new Signaller ( interruptible , 0L , 0L ) ; if ( Thread . currentThread ( ) instanceof ForkJoinWorkerThread ) ForkJoinPool . helpAsyncBlocker ( defaultExecutor ( ) , q ) ; } else if ( ! queued ) queued = tryPushStack ( q ) ; else { try { ForkJoinPool . managedBlock ( q ) ; } catch ( InterruptedException ie ) { // currently cannot happen q . interrupted = true ; } if ( q . interrupted && interruptible ) break ; } } if ( q != null && queued ) { q . thread = null ; if ( ! interruptible && q . interrupted ) Thread . currentThread ( ) . interrupt ( ) ; if ( r == null ) cleanStack ( ) ; } if ( r != null || ( r = result ) != null ) postComplete ( ) ; return r ;
public class PluginGroup { /** * Returns a new { @ link PluginGroup } which holds the { @ link Plugin } s loaded from the classpath . * { @ code null } is returned if there is no { @ link Plugin } whose target equals to the specified * { @ code target } . * @ param classLoader which is used to load the { @ link Plugin } s * @ param target the { @ link PluginTarget } which would be loaded */ @ Nullable static PluginGroup loadPlugins ( ClassLoader classLoader , PluginTarget target , CentralDogmaConfig config ) { } }
requireNonNull ( classLoader , "classLoader" ) ; requireNonNull ( target , "target" ) ; requireNonNull ( config , "config" ) ; final ServiceLoader < Plugin > loader = ServiceLoader . load ( Plugin . class , classLoader ) ; final Builder < Plugin > plugins = new Builder < > ( ) ; for ( Plugin plugin : loader ) { if ( target == plugin . target ( ) && plugin . isEnabled ( config ) ) { plugins . add ( plugin ) ; } } final List < Plugin > list = plugins . build ( ) ; if ( list . isEmpty ( ) ) { return null ; } return new PluginGroup ( list , Executors . newSingleThreadExecutor ( new DefaultThreadFactory ( "plugins-for-" + target . name ( ) . toLowerCase ( ) . replace ( "_" , "-" ) , true ) ) ) ;
public class Bag { /** * Check if bag contains this element . The operator = = is used to check for equality . */ public boolean contains ( E e ) { } }
for ( int i = 0 ; size > i ; i ++ ) { if ( e == data [ i ] ) { return true ; } } return false ;
public class ChunkFrequencyManager { /** * Query values for the given region and file . Values are grouped according to the windowSize , and then a mean * value is computed . * @ param region Region target * @ param filePath File target * @ param windowSize Group size of values , the mean is computed for those values * @ return A chunk frequency region with the mean values */ public ChunkFrequency query ( Region region , Path filePath , int windowSize ) { } }
return query ( region , filePath , windowSize , mean ( ) ) ;
public class Legend { /** * 设置默认选中状态 * @ param name * @ param selected * @ return */ public Legend selected ( String name , Boolean selected ) { } }
if ( ! this . data . contains ( name ) ) { throw new RuntimeException ( "Legend中不包含name为" + name + "的图例" ) ; } if ( this . selected == null ) { this . selected = new LinkedHashMap < String , Boolean > ( ) ; } this . selected . put ( name , selected ) ; return this ;
public class ModifierUtil { /** * 多个修饰符做 “ 与 ” 操作 , 表示同时存在多个修饰符 * @ param modifierTypes 修饰符列表 , 元素不能为空 * @ return “ 与 ” 之后的修饰符 */ private static int modifiersToInt ( ModifierType ... modifierTypes ) { } }
int modifier = modifierTypes [ 0 ] . getValue ( ) ; for ( int i = 1 ; i < modifierTypes . length ; i ++ ) { modifier &= modifierTypes [ i ] . getValue ( ) ; } return modifier ;
public class TeaServletAdmin { /** * returns a socket connected to a host running the TemplateServerServlet */ private HttpClient getTemplateServerClient ( String remoteSource ) throws IOException { } }
// TODO : this was copied from the RemoteCompiler class . This needs // to be moved into a location where both can access it ! int port = 80 ; String host = remoteSource . substring ( RemoteCompilationProvider . TEMPLATE_LOAD_PROTOCOL . length ( ) ) ; int portIndex = host . indexOf ( "/" ) ; if ( portIndex >= 0 ) { host = host . substring ( 0 , portIndex ) ; } portIndex = host . indexOf ( ":" ) ; if ( portIndex >= 0 ) { try { port = Integer . parseInt ( host . substring ( portIndex + 1 ) ) ; } catch ( NumberFormatException nfe ) { System . out . println ( "Invalid port number specified" ) ; } host = host . substring ( 0 , portIndex ) ; } // TODO : remove the hardcoded 15 second timeout ! SocketFactory factory = new PooledSocketFactory ( new PlainSocketFactory ( InetAddress . getByName ( host ) , port , 15000 ) ) ; return new HttpClient ( factory ) ;
public class Result { /** * The projecting result value for the given key as a Number object * Returns null if the key doesn ' t exist . * @ param key The select result key . * @ return The Number object . */ @ Override public Number getNumber ( @ NonNull String key ) { } }
if ( key == null ) { throw new IllegalArgumentException ( "key cannot be null." ) ; } final int index = indexForColumnName ( key ) ; return index >= 0 ? getNumber ( index ) : null ;
public class ModMessageManager { /** * Registers an object to handle mod messages . * @ param mod the mod * @ param messageHandler the message handler */ public static void register ( IMalisisMod mod , Object messageHandler ) { } }
register ( mod , messageHandler . getClass ( ) , messageHandler ) ;
public class TypeRegistry { /** * For a specific classname , this method will search in the current type registry and any parent type registries * ( similar to a regular classloader delegation strategy ) . Returns null if the type is not found . It does not * attempt to load anything in . * @ param classname the type being searched for , e . g . com / foo / Bar * @ return the ReloadableType if found , otherwise null */ private ReloadableType getReloadableTypeInTypeRegistryHierarchy ( String classname ) { } }
ReloadableType rtype = getReloadableType ( classname , false ) ; if ( rtype == null ) { // search TypeRegistry tr = this ; while ( rtype == null ) { ClassLoader pcl = tr . getClassLoader ( ) . getParent ( ) ; tr = TypeRegistry . getTypeRegistryFor ( pcl ) ; if ( tr != null ) { rtype = tr . getReloadableType ( classname , false ) ; } else { break ; } } if ( rtype != null ) { return rtype ; } } return rtype ;
public class Utils { /** * Selects the appropriate interface to use Multicast . * This prevents computers with multiple interfaces to select the wrong one by default . * @ param socket the socket on which we want to bind the specific interface . * @ throws SocketException if something bad happens */ public static void selectAppropriateInterface ( MulticastSocket socket ) throws SocketException { } }
Enumeration e = NetworkInterface . getNetworkInterfaces ( ) ; while ( e . hasMoreElements ( ) ) { NetworkInterface n = ( NetworkInterface ) e . nextElement ( ) ; Enumeration ee = n . getInetAddresses ( ) ; while ( ee . hasMoreElements ( ) ) { InetAddress i = ( InetAddress ) ee . nextElement ( ) ; if ( i . isSiteLocalAddress ( ) && ! i . isAnyLocalAddress ( ) && ! i . isLinkLocalAddress ( ) && ! i . isLoopbackAddress ( ) && ! i . isMulticastAddress ( ) ) { socket . setNetworkInterface ( NetworkInterface . getByName ( n . getName ( ) ) ) ; } } }
public class DefaultProcessDiagramCanvas { /** * This method calculates shape intersection with line . * @ param shape * @ param line * @ return Intersection point */ private static Point getShapeIntersection ( Shape shape , Line2D . Double line ) { } }
PathIterator it = shape . getPathIterator ( null ) ; double [ ] coords = new double [ 6 ] ; double [ ] pos = new double [ 2 ] ; Line2D . Double l = new Line2D . Double ( ) ; while ( ! it . isDone ( ) ) { int type = it . currentSegment ( coords ) ; switch ( type ) { case PathIterator . SEG_MOVETO : pos [ 0 ] = coords [ 0 ] ; pos [ 1 ] = coords [ 1 ] ; break ; case PathIterator . SEG_LINETO : l = new Line2D . Double ( pos [ 0 ] , pos [ 1 ] , coords [ 0 ] , coords [ 1 ] ) ; if ( line . intersectsLine ( l ) ) { return getLinesIntersection ( line , l ) ; } pos [ 0 ] = coords [ 0 ] ; pos [ 1 ] = coords [ 1 ] ; break ; case PathIterator . SEG_CLOSE : break ; default : // whatever } it . next ( ) ; } return null ;
public class QueryBuilder { /** * Add the provided { @ link FeatureCode } s to the set of query constraints . * @ param code1 the first { @ link FeatureCode } to add * @ param codes the subsequent { @ link FeatureCode } s to add * @ return this */ public QueryBuilder addFeatureCodes ( final FeatureCode code1 , final FeatureCode ... codes ) { } }
featureCodes . add ( code1 ) ; featureCodes . addAll ( Arrays . asList ( codes ) ) ; return this ;
public class ValidationGroupsMetadata { /** * Finds all of the validation groups extended by an intial set of groups . * @ param baseGroups The initial set of groups to find parents of . These groups must have been * added to the inheritance map already . * @ return A unified set of groups and their parents . * @ throws IllegalArgumentException If an initial group has not been added to the map before * calling this method . */ public Set < Class < ? > > findAllExtendedGroups ( final Collection < Class < ? > > baseGroups ) throws IllegalArgumentException { } }
final Set < Class < ? > > found = new HashSet < > ( ) ; final Stack < Class < ? > > remaining = new Stack < > ( ) ; // initialize baseGroups . forEach ( group -> { if ( ! inheritanceMapping . containsKey ( group ) ) { throw new IllegalArgumentException ( "The collection of groups contains a group which" + " was not added to the map. Be sure to call addGroup() for all groups first." ) ; } remaining . push ( group ) ; } ) ; // traverse while ( ! remaining . isEmpty ( ) ) { final Class < ? > current = remaining . pop ( ) ; found . add ( current ) ; inheritanceMapping . get ( current ) . forEach ( parent -> { if ( ! found . contains ( parent ) ) { remaining . push ( parent ) ; } } ) ; } return found ;
public class SqlQueryStatement { /** * Answer the TableAlias for aPath or aUserAlias * @ param aPath * @ param aUserAlias * @ param hintClasses * @ return TableAlias , null if none */ private TableAlias getTableAliasForPath ( String aPath , String aUserAlias , List hintClasses ) { } }
if ( aUserAlias == null ) { return getTableAliasForPath ( aPath , hintClasses ) ; } else { return getTableAliasForPath ( aUserAlias + ALIAS_SEPARATOR + aPath , hintClasses ) ; }
public class MouseHandler { /** * { @ inheritDoc } */ @ Override public void handle ( final MouseEvent mouseEvent ) { } }
final EventType < ? > type = mouseEvent . getEventType ( ) ; if ( MouseEvent . DRAG_DETECTED == type ) { adapter ( ) . mouseDragDetected ( mouseEvent ) ; } else if ( MouseEvent . MOUSE_CLICKED == type ) { adapter ( ) . mouseClicked ( mouseEvent ) ; } else if ( MouseEvent . MOUSE_DRAGGED == type ) { adapter ( ) . mouseDragged ( mouseEvent ) ; } else if ( MouseEvent . MOUSE_ENTERED == type ) { adapter ( ) . mouseEntered ( mouseEvent ) ; } else if ( MouseEvent . MOUSE_ENTERED_TARGET == type ) { adapter ( ) . mouseEnteredTarget ( mouseEvent ) ; } else if ( MouseEvent . MOUSE_EXITED == type ) { adapter ( ) . mouseExited ( mouseEvent ) ; } else if ( MouseEvent . MOUSE_EXITED_TARGET == type ) { adapter ( ) . mouseExitedTarget ( mouseEvent ) ; } else if ( MouseEvent . MOUSE_MOVED == type ) { adapter ( ) . mouseMoved ( mouseEvent ) ; } else if ( MouseEvent . MOUSE_PRESSED == type ) { adapter ( ) . mousePressed ( mouseEvent ) ; } else if ( MouseEvent . MOUSE_RELEASED == type ) { adapter ( ) . mouseReleased ( mouseEvent ) ; } else { adapter ( ) . mouse ( mouseEvent ) ; }
public class gslbsite_gslbservice_binding { /** * Use this API to count the filtered set of gslbsite _ gslbservice _ binding resources . * filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */ public static long count_filtered ( nitro_service service , String sitename , String filter ) throws Exception { } }
gslbsite_gslbservice_binding obj = new gslbsite_gslbservice_binding ( ) ; obj . set_sitename ( sitename ) ; options option = new options ( ) ; option . set_count ( true ) ; option . set_filter ( filter ) ; gslbsite_gslbservice_binding [ ] response = ( gslbsite_gslbservice_binding [ ] ) obj . getfiltered ( service , option ) ; if ( response != null ) { return response [ 0 ] . __count ; } return 0 ;
public class SeaGlassLookAndFeel { /** * Set the icons to paint the title pane decorations . * @ param d the UI defaults map . */ private void defineInternalFrames ( UIDefaults d ) { } }
// Copied from nimbus // Initialize InternalFrameTitlePane d . put ( "InternalFrameTitlePane.contentMargins" , new InsetsUIResource ( 0 , 0 , 0 , 0 ) ) ; d . put ( "InternalFrameTitlePane.maxFrameIconSize" , new DimensionUIResource ( 18 , 18 ) ) ; // Initialize InternalFrame d . put ( "InternalFrame.contentMargins" , new InsetsUIResource ( 1 , 6 , 6 , 6 ) ) ; d . put ( "InternalFrame:InternalFrameTitlePane.contentMargins" , new InsetsUIResource ( 3 , 0 , 3 , 0 ) ) ; d . put ( "InternalFrame:InternalFrameTitlePane.titleAlignment" , "CENTER" ) ; d . put ( "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.menuButton\".contentMargins" , new InsetsUIResource ( 0 , 0 , 0 , 0 ) ) ; d . put ( "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.iconifyButton\".contentMargins" , new InsetsUIResource ( 9 , 9 , 9 , 9 ) ) ; d . put ( "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.maximizeButton\".contentMargins" , new InsetsUIResource ( 9 , 9 , 9 , 9 ) ) ; d . put ( "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.closeButton\".contentMargins" , new InsetsUIResource ( 9 , 9 , 9 , 9 ) ) ; // Seaglass starts below if ( PlatformUtils . isMac ( ) ) { d . put ( "frameBaseActive" , new Color ( 0xa8a8a8 ) ) ; } else { d . put ( "frameBaseActive" , new Color ( 0x96adc4 ) ) ; } d . put ( "frameBaseInactive" , new Color ( 0xe0e0e0 ) ) ; d . put ( "frameBorderBase" , new Color ( 0x545454 ) ) ; d . put ( "frameInnerHighlightInactive" , new Color ( 0x55ffffff , true ) ) ; d . put ( "frameInnerHighlightActive" , new Color ( 0x55ffffff , true ) ) ; d . put ( "seaGlassTitlePaneButtonEnabledBorder" , new Color ( 0x99000000 , true ) ) ; d . put ( "seaGlassTitlePaneButtonEnabledCorner" , new Color ( 0x26000000 , true ) ) ; d . put ( "seaGlassTitlePaneButtonEnabledInterior" , new Color ( 0x99ffffff , true ) ) ; d . put ( "seaGlassTitlePaneButtonHoverBorder" , new Color ( 0xe5101010 , true ) ) ; d . put ( "seaGlassTitlePaneButtonHoverCorner" , new Color ( 0x267a7a7a , true ) ) ; d . put ( "seaGlassTitlePaneButtonHoverInterior" , new Color ( 0xffffff ) ) ; d . put ( "seaGlassTitlePaneButtonPressedBorder" , new Color ( 0xe50e0e0e , true ) ) ; d . put ( "seaGlassTitlePaneButtonPressedCorner" , new Color ( 0x876e6e6e , true ) ) ; d . put ( "seaGlassTitlePaneButtonPressedInterior" , new Color ( 0xe6e6e6 ) ) ; String p = "InternalFrame" ; String c = PAINTER_PREFIX + "FrameAndRootPainter" ; d . put ( p + ".titleFont" , new DerivedFont ( "defaultFont" , 1.0f , true , null ) ) ; d . put ( p + ".States" , "Enabled,WindowFocused" ) ; d . put ( p + ":InternalFrameTitlePane.WindowFocused" , new TitlePaneWindowFocusedState ( ) ) ; d . put ( p + ".WindowFocused" , new InternalFrameWindowFocusedState ( ) ) ; d . put ( p + "[Enabled].backgroundPainter" , new LazyPainter ( c , FrameAndRootPainter . Which . BACKGROUND_ENABLED ) ) ; d . put ( p + "[Enabled+WindowFocused].backgroundPainter" , new LazyPainter ( c , FrameAndRootPainter . Which . BACKGROUND_ENABLED_WINDOWFOCUSED ) ) ; p = "InternalFrameTitlePane" ; d . put ( p + ".buttonSpacing" , 0 ) ; p = "InternalFrame:InternalFrameTitlePane" ; d . put ( p + "[Enabled].textForeground" , d . get ( "seaGlassDisabledText" ) ) ; d . put ( p + "[WindowFocused].textForeground" , Color . BLACK ) ;
public class BeanManager { /** * Determines if a { @ link android . bluetooth . BluetoothDevice } is a Bean based on its scan record * value . * @ param scanRecord The scanRecord provided by * { @ link android . bluetooth . BluetoothAdapter . LeScanCallback } * @ return true if device is a Bean */ private boolean isBean ( byte [ ] scanRecord ) { } }
List < UUID > uuids = parseUUIDs ( scanRecord ) ; return uuids . contains ( BEAN_UUID ) ;
public class Strman { /** * Counts the number of occurrences of each character in the string * @ param input The input string * @ return A map containing the number of occurrences of each character in the string */ public static Map < Character , Long > charsCount ( String input ) { } }
if ( isNullOrEmpty ( input ) ) { return Collections . emptyMap ( ) ; } return input . chars ( ) . mapToObj ( c -> ( char ) c ) . collect ( groupingBy ( identity ( ) , counting ( ) ) ) ;
public class ClassUtil { /** * @ param clazz a Class . * @ return the class ' s primitive equivalent , if clazz is a primitive wrapper . If clazz is * primitive , returns clazz . Otherwise , returns null . */ public static Class < ? > primitiveEquivalentOf ( Class < ? > clazz ) { } }
return clazz . isPrimitive ( ) ? clazz : _objectToPrimitiveMap . get ( clazz ) ;
public class PhoneNumberUtil { /** * format phone number in E123 format . * @ param pphoneNumber phone number as String to format * @ param pcountryCode iso code of country * @ return formated phone number as String */ public final String formatE123 ( final String pphoneNumber , final String pcountryCode ) { } }
return this . formatE123 ( this . parsePhoneNumber ( pphoneNumber ) , CreatePhoneCountryConstantsClass . create ( ) . countryMap ( ) . get ( StringUtils . defaultString ( pcountryCode ) ) ) ;
public class PathUtils { /** * This method converts a Class into a File which contains the package path . * This is used to access Jar contents or the content of source directories * to find source or class files . * @ param clazz * is the class for which the source file is to be found . * @ return A { @ link File } object is returned containing the relative path of * the file starting on package root level . */ public static File classToRelativePackagePath ( Class < ? > clazz ) { } }
if ( File . separator . equals ( "/" ) ) { return new File ( clazz . getName ( ) . replaceAll ( "\\." , File . separator ) + ".java" ) ; } else { return new File ( clazz . getName ( ) . replaceAll ( "\\." , File . separator + File . separator ) + ".java" ) ; }
public class DelimitedStringParser { /** * Creates a new DelimitedStringParser with the given Pair and KeyValue delimiters . * @ param pairDelimiter A String that will be used to delimit pairs . * @ param keyValueDelimiter A String that will be used to delimit Keys from Values ( inside a pair ) . * @ return A new instance of the DelimitedStringParser class . */ public static DelimitedStringParser parser ( String pairDelimiter , String keyValueDelimiter ) { } }
Exceptions . checkNotNullOrEmpty ( pairDelimiter , "pairDelimiter" ) ; Exceptions . checkNotNullOrEmpty ( keyValueDelimiter , "keyValueDelimiter" ) ; Preconditions . checkArgument ( ! pairDelimiter . equals ( keyValueDelimiter ) , "pairDelimiter (%s) cannot be the same as keyValueDelimiter (%s)" , pairDelimiter , keyValueDelimiter ) ; return new DelimitedStringParser ( pairDelimiter , keyValueDelimiter ) ;
public class JCacheSessionDataStorage { /** * Create a cache with name and expiry policy with idle time . * @ param name name of cache * @ param idleTime idle time in seconds * @ return the cache with name and expiry policy with idle time */ protected Cache < String , SessionData > create ( String name , long idleTime ) { } }
return Caching . getCachingProvider ( ) . getCacheManager ( ) . createCache ( name , new MutableConfiguration < String , SessionData > ( ) . setTypes ( String . class , SessionData . class ) . setExpiryPolicyFactory ( TouchedExpiryPolicy . factoryOf ( new Duration ( TimeUnit . SECONDS , idleTime ) ) ) ) ;
public class BaseFlowToJobSpecCompiler { /** * Naive implementation of generating jobSpec , which fetch the first available template , * in an exemplified single - hop FlowCompiler implementation . * @ param flowSpec * @ return */ protected JobSpec jobSpecGenerator ( FlowSpec flowSpec ) { } }
JobSpec jobSpec ; JobSpec . Builder jobSpecBuilder = JobSpec . builder ( jobSpecURIGenerator ( flowSpec ) ) . withConfig ( flowSpec . getConfig ( ) ) . withDescription ( flowSpec . getDescription ( ) ) . withVersion ( flowSpec . getVersion ( ) ) ; if ( flowSpec . getTemplateURIs ( ) . isPresent ( ) && templateCatalog . isPresent ( ) ) { // Only first template uri will be honored for Identity jobSpecBuilder = jobSpecBuilder . withTemplate ( flowSpec . getTemplateURIs ( ) . get ( ) . iterator ( ) . next ( ) ) ; try { jobSpec = new ResolvedJobSpec ( jobSpecBuilder . build ( ) , templateCatalog . get ( ) ) ; log . info ( "Resolved JobSpec properties are: " + jobSpec . getConfigAsProperties ( ) ) ; } catch ( SpecNotFoundException | JobTemplate . TemplateException e ) { throw new RuntimeException ( "Could not resolve template in JobSpec from TemplateCatalog" , e ) ; } } else { jobSpec = jobSpecBuilder . build ( ) ; log . info ( "Unresolved JobSpec properties are: " + jobSpec . getConfigAsProperties ( ) ) ; } // Remove schedule jobSpec . setConfig ( jobSpec . getConfig ( ) . withoutPath ( ConfigurationKeys . JOB_SCHEDULE_KEY ) ) ; // Add job . name and job . group if ( flowSpec . getConfig ( ) . hasPath ( ConfigurationKeys . FLOW_NAME_KEY ) ) { jobSpec . setConfig ( jobSpec . getConfig ( ) . withValue ( ConfigurationKeys . JOB_NAME_KEY , flowSpec . getConfig ( ) . getValue ( ConfigurationKeys . FLOW_NAME_KEY ) ) ) ; } if ( flowSpec . getConfig ( ) . hasPath ( ConfigurationKeys . FLOW_GROUP_KEY ) ) { jobSpec . setConfig ( jobSpec . getConfig ( ) . withValue ( ConfigurationKeys . JOB_GROUP_KEY , flowSpec . getConfig ( ) . getValue ( ConfigurationKeys . FLOW_GROUP_KEY ) ) ) ; } // Add flow execution id for this compilation long flowExecutionId = FlowUtils . getOrCreateFlowExecutionId ( flowSpec ) ; jobSpec . setConfig ( jobSpec . getConfig ( ) . withValue ( ConfigurationKeys . FLOW_EXECUTION_ID_KEY , ConfigValueFactory . fromAnyRef ( flowExecutionId ) ) ) ; // Reset properties in Spec from Config jobSpec . setConfigAsProperties ( ConfigUtils . configToProperties ( jobSpec . getConfig ( ) ) ) ; return jobSpec ;
public class StompEndpointSample { /** * Broadcast message by returning a { @ code String } . * @ param body the message body * @ return the message to send by the broadcaster associated to the path specified in frame headers * @ throws IOException if body can ' t be read */ @ StompService ( destination = "/destination-2" ) public String destination2 ( final String body ) throws IOException { } }
final String now = new SimpleDateFormat ( "HH:mm:ss" ) . format ( new Date ( ) ) ; return String . format ( "%s - value '%s' returned from method mapped to /destination-2" , now , body ) ;
public class Group { /** * For the given group name , return the module list , on which it is mapped . * Create a new list , if not found . * @ param map Map to be searched for group name . * @ param groupname Group name to search . */ SortedSet < ModuleElement > getModuleList ( Map < String , SortedSet < ModuleElement > > map , String groupname ) { } }
return map . computeIfAbsent ( groupname , g -> new TreeSet < > ( configuration . utils . makeModuleComparator ( ) ) ) ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcPipeSegmentType ( ) { } }
if ( ifcPipeSegmentTypeEClass == null ) { ifcPipeSegmentTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 356 ) ; } return ifcPipeSegmentTypeEClass ;
public class MapTileCollisionLoader { /** * Check the constraint with the specified tile . * @ param constraints The constraint groups to check . * @ param tile The tile to check with . * @ return < code > true < / code > if can be ignored , < code > false < / code > else . */ private boolean checkConstraint ( Collection < String > constraints , Tile tile ) { } }
return tile != null && constraints . contains ( mapGroup . getGroup ( tile ) ) && ! tile . getFeature ( TileCollision . class ) . getCollisionFormulas ( ) . isEmpty ( ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link MultiCurvePropertyType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link MultiCurvePropertyType } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "multiEdgeOf" ) public JAXBElement < MultiCurvePropertyType > createMultiEdgeOf ( MultiCurvePropertyType value ) { } }
return new JAXBElement < MultiCurvePropertyType > ( _MultiEdgeOf_QNAME , MultiCurvePropertyType . class , null , value ) ;
public class NaiveBayesModelV3 { /** * Version & Schema - specific filling into the impl */ @ Override public NaiveBayesModel createImpl ( ) { } }
NaiveBayesModel . NaiveBayesParameters parms = parameters . createImpl ( ) ; return new NaiveBayesModel ( model_id . key ( ) , parms , null ) ;
public class AnalyticsContext { /** * Create a new { @ link AnalyticsContext } instance filled in with information from the given { @ link * Context } . The { @ link Analytics } client can be called from anywhere , so the returned instances * is thread safe . */ static synchronized AnalyticsContext create ( Context context , Traits traits , boolean collectDeviceId ) { } }
AnalyticsContext analyticsContext = new AnalyticsContext ( new NullableConcurrentHashMap < String , Object > ( ) ) ; analyticsContext . putApp ( context ) ; analyticsContext . setTraits ( traits ) ; analyticsContext . putDevice ( context , collectDeviceId ) ; analyticsContext . putLibrary ( ) ; analyticsContext . put ( LOCALE_KEY , Locale . getDefault ( ) . getLanguage ( ) + "-" + Locale . getDefault ( ) . getCountry ( ) ) ; analyticsContext . putNetwork ( context ) ; analyticsContext . putOs ( ) ; analyticsContext . putScreen ( context ) ; putUndefinedIfNull ( analyticsContext , USER_AGENT_KEY , System . getProperty ( "http.agent" ) ) ; putUndefinedIfNull ( analyticsContext , TIMEZONE_KEY , TimeZone . getDefault ( ) . getID ( ) ) ; return analyticsContext ;
public class SortCriterionMarshaller { /** * Marshall the given parameter object . */ public void marshall ( SortCriterion sortCriterion , ProtocolMarshaller protocolMarshaller ) { } }
if ( sortCriterion == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( sortCriterion . getField ( ) , FIELD_BINDING ) ; protocolMarshaller . marshall ( sortCriterion . getSortOrder ( ) , SORTORDER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Task { /** * The Total Slack field contains the amount of time a task can be * delayed without delaying the project ' s finish date . * @ return string representing duration */ public Duration getTotalSlack ( ) { } }
Duration totalSlack = ( Duration ) getCachedValue ( TaskField . TOTAL_SLACK ) ; if ( totalSlack == null ) { Duration duration = getDuration ( ) ; if ( duration == null ) { duration = Duration . getInstance ( 0 , TimeUnit . DAYS ) ; } TimeUnit units = duration . getUnits ( ) ; Duration startSlack = getStartSlack ( ) ; if ( startSlack == null ) { startSlack = Duration . getInstance ( 0 , units ) ; } else { if ( startSlack . getUnits ( ) != units ) { startSlack = startSlack . convertUnits ( units , getParentFile ( ) . getProjectProperties ( ) ) ; } } Duration finishSlack = getFinishSlack ( ) ; if ( finishSlack == null ) { finishSlack = Duration . getInstance ( 0 , units ) ; } else { if ( finishSlack . getUnits ( ) != units ) { finishSlack = finishSlack . convertUnits ( units , getParentFile ( ) . getProjectProperties ( ) ) ; } } double startSlackDuration = startSlack . getDuration ( ) ; double finishSlackDuration = finishSlack . getDuration ( ) ; if ( startSlackDuration == 0 || finishSlackDuration == 0 ) { if ( startSlackDuration != 0 ) { totalSlack = startSlack ; } else { totalSlack = finishSlack ; } } else { if ( startSlackDuration < finishSlackDuration ) { totalSlack = startSlack ; } else { totalSlack = finishSlack ; } } set ( TaskField . TOTAL_SLACK , totalSlack ) ; } return ( totalSlack ) ;
public class AzureFirewallsInner { /** * Creates or updates the specified Azure Firewall . * @ param resourceGroupName The name of the resource group . * @ param azureFirewallName The name of the Azure Firewall . * @ param parameters Parameters supplied to the create or update Azure Firewall operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the AzureFirewallInner object */ public Observable < AzureFirewallInner > beginCreateOrUpdateAsync ( String resourceGroupName , String azureFirewallName , AzureFirewallInner parameters ) { } }
return beginCreateOrUpdateWithServiceResponseAsync ( resourceGroupName , azureFirewallName , parameters ) . map ( new Func1 < ServiceResponse < AzureFirewallInner > , AzureFirewallInner > ( ) { @ Override public AzureFirewallInner call ( ServiceResponse < AzureFirewallInner > response ) { return response . body ( ) ; } } ) ;
public class CmsConfigurationCache { /** * Reads the complete configuration ( sitemap and module configurations ) . < p > * @ return an object representing the currently active configuration */ public CmsADEConfigCacheState readCompleteConfiguration ( ) { } }
long beginTime = System . currentTimeMillis ( ) ; Map < CmsUUID , CmsADEConfigDataInternal > siteConfigurations = Maps . newHashMap ( ) ; if ( m_cms . existsResource ( "/" ) ) { try { @ SuppressWarnings ( "deprecation" ) List < CmsResource > configFileCandidates = m_cms . readResources ( "/" , CmsResourceFilter . DEFAULT . addRequireType ( m_configType . getTypeId ( ) ) ) ; CmsLog . INIT . info ( ". Reading " + configFileCandidates . size ( ) + " config resources of type: " + m_configType . getTypeName ( ) + " from the " + ( m_cms . getRequestContext ( ) . getCurrentProject ( ) . isOnlineProject ( ) ? "online" : "offline" ) + " project." ) ; if ( OpenCms . getResourceManager ( ) . hasResourceType ( TYPE_SITEMAP_MASTER_CONFIG ) ) { List < CmsResource > masterCandidates = m_cms . readResources ( "/" , CmsResourceFilter . DEFAULT . addRequireType ( OpenCms . getResourceManager ( ) . getResourceType ( TYPE_SITEMAP_MASTER_CONFIG ) ) ) ; configFileCandidates . addAll ( masterCandidates ) ; } for ( CmsResource candidate : configFileCandidates ) { if ( isSitemapConfiguration ( candidate . getRootPath ( ) , candidate . getTypeId ( ) ) ) { try { CmsConfigurationReader reader = new CmsConfigurationReader ( m_cms ) ; String basePath = getBasePath ( candidate . getRootPath ( ) ) ; CmsADEConfigDataInternal data = reader . parseSitemapConfiguration ( basePath , candidate ) ; siteConfigurations . put ( candidate . getStructureId ( ) , data ) ; } catch ( Exception e ) { LOG . error ( "Error processing sitemap configuration " + candidate . getRootPath ( ) + ": " + e . getLocalizedMessage ( ) , e ) ; } } } } catch ( Exception e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } } CmsLog . INIT . info ( ". Reading " + ( m_cms . getRequestContext ( ) . getCurrentProject ( ) . isOnlineProject ( ) ? "online" : "offline" ) + " module configurations." ) ; List < CmsADEConfigDataInternal > moduleConfigs = loadModuleConfiguration ( ) ; CmsLog . INIT . info ( ". Reading " + ( m_cms . getRequestContext ( ) . getCurrentProject ( ) . isOnlineProject ( ) ? "online" : "offline" ) + " element views." ) ; Map < CmsUUID , CmsElementView > elementViews = loadElementViews ( ) ; CmsADEConfigCacheState result = new CmsADEConfigCacheState ( m_cms , siteConfigurations , moduleConfigs , elementViews ) ; long endTime = System . currentTimeMillis ( ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "readCompleteConfiguration took " + ( endTime - beginTime ) + "ms" ) ; } return result ;
public class User { /** * Map a Token instance to its Java ' s Map representation . * @ return a Java ' s Map with the description of this object . */ public Map < String , String > toMap ( ) { } }
Map < String , String > map = new HashMap < String , String > ( ) ; map . put ( "id" , Integer . toString ( id ) ) ; map . put ( "status" , Integer . toString ( status ) ) ; map . put ( "content" , content ) ; return map ;
public class MultimapJoiner { /** * Appends the string representation of each entry in { @ code entries } , using the previously configured separator and * key - value separator , to { @ code builder } . Identical to { @ link # appendTo ( Appendable , Iterable ) } , except that it * does not throw { @ link IOException } . */ public StringBuilder appendTo ( StringBuilder builder , Iterable < ? extends Entry < ? , ? extends Collection < ? > > > entries ) { } }
try { appendTo ( ( Appendable ) builder , entries ) ; } catch ( IOException impossible ) { throw new AssertionError ( impossible ) ; } return builder ;
public class KeyDeserializer { /** * Deserializes a key into an object . * @ param key key to deserialize * @ param ctx Context for the full deserialization process * @ return the deserialized object * @ throws com . github . nmorel . gwtjackson . client . exception . JsonDeserializationException if an error occurs during the deserialization */ public T deserialize ( String key , JsonDeserializationContext ctx ) throws JsonDeserializationException { } }
if ( null == key ) { return null ; } return doDeserialize ( key , ctx ) ;
public class nssimpleacl6 { /** * Use this API to fetch filtered set of nssimpleacl6 resources . * filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */ public static nssimpleacl6 [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } }
nssimpleacl6 obj = new nssimpleacl6 ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; nssimpleacl6 [ ] response = ( nssimpleacl6 [ ] ) obj . getfiltered ( service , option ) ; return response ;
public class AbstractAWTDrawVisitor { /** * Calculates the boundaries of a text string in screen coordinates . * @ param text the text string * @ param xCoord the world x - coordinate of where the text should be placed * @ param yCoord the world y - coordinate of where the text should be placed * @ param graphics the graphics to which the text is provided as output * @ return the screen coordinates */ protected Rectangle2D getTextBounds ( String text , double xCoord , double yCoord , Graphics2D graphics ) { } }
FontMetrics fontMetrics = graphics . getFontMetrics ( ) ; Rectangle2D bounds = fontMetrics . getStringBounds ( text , graphics ) ; double widthPad = 3 ; double heightPad = 1 ; double width = bounds . getWidth ( ) + widthPad ; double height = bounds . getHeight ( ) + heightPad ; int [ ] point = this . transformPoint ( xCoord , yCoord ) ; return new Rectangle2D . Double ( point [ 0 ] - width / 2 , point [ 1 ] - height / 2 , width , height ) ;
public class GeometryRendererImpl { /** * Clear everything and completely redraw the edited geometry . */ public void redraw ( ) { } }
shapes . clear ( ) ; if ( container != null ) { container . setTranslation ( 0 , 0 ) ; container . clear ( ) ; try { tentativeMoveLine = new Path ( - 5 , - 5 ) ; tentativeMoveLine . lineTo ( - 5 , - 5 ) ; ShapeStyle style = styleProvider . getEdgeTentativeMoveStyle ( ) ; GeomajasImpl . getInstance ( ) . getGfxUtil ( ) . applyStyle ( tentativeMoveLine , style ) ; container . add ( tentativeMoveLine ) ; draw ( ) ; } catch ( GeometryIndexNotFoundException e ) { // Happens when creating new geometries . . . can ' t render points that don ' t exist yet . } }
public class Point3i { /** * { @ inheritDoc } */ @ Pure @ Override public int distanceSquared ( Point3D p1 ) { } }
double dx , dy , dz ; dx = this . x - p1 . getX ( ) ; dy = this . y - p1 . getY ( ) ; dz = this . z - p1 . getZ ( ) ; return ( int ) ( dx * dx + dy * dy + dz * dz ) ;
public class ListTaskExecutionsResult { /** * A list of executed tasks . * @ param taskExecutions * A list of executed tasks . */ public void setTaskExecutions ( java . util . Collection < TaskExecutionListEntry > taskExecutions ) { } }
if ( taskExecutions == null ) { this . taskExecutions = null ; return ; } this . taskExecutions = new java . util . ArrayList < TaskExecutionListEntry > ( taskExecutions ) ;
public class MonoscopicViewManager { /** * Called when the system is about to start resuming a previous activity . * This is typically used to commit unsaved changes to persistent data , stop * animations and other things that may be consuming CPU , etc . * Implementations of this method must be very quick because the next * activity will not be resumed until this method returns . */ @ Override void onPause ( ) { } }
super . onPause ( ) ; mRotationSensor . onPause ( ) ; if ( NativeVulkanCore . getVulkanPropValue ( ) > 0 ) { activeFlag = false ; if ( vulkanDrawThread != null ) { try { vulkanDrawThread . join ( ) ; } catch ( InterruptedException e ) { Log . e ( "vulkan: activity onPause:" , "draw thread not terminated" ) ; } } } Log . d ( TAG , "onPause" ) ;
public class CamelCatalogHelper { /** * Gets the java type of the given model * @ param modelName the model name * @ return the java type */ public static String getModelJavaType ( CamelCatalog camelCatalog , String modelName ) { } }
// use the camel catalog String json = camelCatalog . modelJSonSchema ( modelName ) ; if ( json == null ) { throw new IllegalArgumentException ( "Could not find catalog entry for model name: " + modelName ) ; } List < Map < String , String > > data = JSonSchemaHelper . parseJsonSchema ( "model" , json , false ) ; if ( data != null ) { for ( Map < String , String > propertyMap : data ) { String javaType = propertyMap . get ( "javaType" ) ; if ( javaType != null ) { return javaType ; } } } return null ;
public class DefaultSchedulingService { /** * ~ Methods * * * * * */ @ Override @ Transactional public synchronized void startAlertScheduling ( ) { } }
requireNotDisposed ( ) ; if ( _alertSchedulingThread != null && _alertSchedulingThread . isAlive ( ) ) { _logger . info ( "Request to start alert scheduling aborted as it is already running." ) ; } else { _logger . info ( "Starting alert scheduling thread." ) ; _alertSchedulingThread = new SchedulingThread ( "schedule-alerts" , LockType . ALERT_SCHEDULING ) ; _alertSchedulingThread . start ( ) ; _logger . info ( "Alert scheduling thread started." ) ; }
public class BigMoney { /** * Returns a copy of this monetary value multiplied by the specified value * using the specified rounding mode to adjust the scale of the result . * This multiplies this money by the specified value , retaining the scale of this money . * This will frequently lose precision , hence the need for a rounding mode . * For example , ' USD 1.13 ' multiplied by ' 2.5 ' and rounding down gives ' USD 2.82 ' . * The amount is converted via { @ link BigDecimal # valueOf ( double ) } which yields * the most expected answer for most programming scenarios . * Any { @ code double } literal in code will be converted to * exactly the same BigDecimal with the same scale . * For example , the literal ' 1.45d ' will be converted to ' 1.45 ' . * This instance is immutable and unaffected by this method . * @ param valueToMultiplyBy the scalar value to multiply by , not null * @ param roundingMode the rounding mode to use to bring the decimal places back in line , not null * @ return the new multiplied instance , never null * @ throws ArithmeticException if the rounding fails */ public BigMoney multiplyRetainScale ( double valueToMultiplyBy , RoundingMode roundingMode ) { } }
return multiplyRetainScale ( BigDecimal . valueOf ( valueToMultiplyBy ) , roundingMode ) ;
public class PyroSerializer { /** * loaded if serpent . jar is available */ public static PyroSerializer getFor ( Config . SerializerType type ) { } }
switch ( type ) { case pickle : return pickleSerializer ; case serpent : { synchronized ( PyroSerializer . class ) { if ( serpentSerializer == null ) { // try loading it try { serpentSerializer = new SerpentSerializer ( ) ; final String requiredSerpentVersion = "1.23" ; if ( compareLibraryVersions ( net . razorvine . serpent . LibraryVersion . VERSION , requiredSerpentVersion ) < 0 ) { throw new java . lang . RuntimeException ( "serpent version " + requiredSerpentVersion + " (or newer) is required" ) ; } return serpentSerializer ; } catch ( LinkageError x ) { throw new PyroException ( "serpent serializer unavailable" , x ) ; } } } return serpentSerializer ; } default : throw new IllegalArgumentException ( "unrecognised serializer type: " + type ) ; }
public class WonderPushUserPreferences { /** * Remove a channel . * < p > Remove a channel both from this class registry and from Android . < / p > * @ param channelId The identifier of the channel to remove . */ public static synchronized void removeChannel ( String channelId ) { } }
try { if ( _removeChannel ( channelId ) ) { save ( ) ; } } catch ( Exception ex ) { Log . e ( WonderPush . TAG , "Unexpected error while removing channel " + channelId , ex ) ; }
public class DatabaseFullPrunedBlockStore { /** * Get the SQL statements to check if the database is compatible . * @ return The SQL prepared statements . */ protected List < String > getCompatibilitySQL ( ) { } }
List < String > sqlStatements = new ArrayList < > ( ) ; sqlStatements . add ( SELECT_COMPATIBILITY_COINBASE_SQL ) ; return sqlStatements ;
public class SARLValidator { /** * Check the container for the SARL agents . * @ param agent the agent . */ @ Check public void checkContainerType ( SarlAgent agent ) { } }
final XtendTypeDeclaration declaringType = agent . getDeclaringType ( ) ; if ( declaringType != null ) { final String name = canonicalName ( declaringType ) ; assert name != null ; error ( MessageFormat . format ( Messages . SARLValidator_28 , name ) , agent , null , INVALID_NESTED_DEFINITION ) ; }
public class AppenderatorImpl { /** * Merge segment , push to deep storage . Should only be used on segments that have been fully persisted . Must only * be run in the single - threaded pushExecutor . * @ param identifier sink identifier * @ param sink sink to push * @ param useUniquePath true if the segment should be written to a path with a unique identifier * @ return segment descriptor , or null if the sink is no longer valid */ private DataSegment mergeAndPush ( final SegmentIdWithShardSpec identifier , final Sink sink , final boolean useUniquePath ) { } }
// Bail out if this sink is null or otherwise not what we expect . if ( sinks . get ( identifier ) != sink ) { log . warn ( "Sink for segment[%s] no longer valid, bailing out of mergeAndPush." , identifier ) ; return null ; } // Use a descriptor file to indicate that pushing has completed . final File persistDir = computePersistDir ( identifier ) ; final File mergedTarget = new File ( persistDir , "merged" ) ; final File descriptorFile = computeDescriptorFile ( identifier ) ; // Sanity checks for ( FireHydrant hydrant : sink ) { if ( sink . isWritable ( ) ) { throw new ISE ( "WTF?! Expected sink to be no longer writable before mergeAndPush. Segment[%s]." , identifier ) ; } synchronized ( hydrant ) { if ( ! hydrant . hasSwapped ( ) ) { throw new ISE ( "WTF?! Expected sink to be fully persisted before mergeAndPush. Segment[%s]." , identifier ) ; } } } try { if ( descriptorFile . exists ( ) ) { // Already pushed . if ( useUniquePath ) { // Don ' t reuse the descriptor , because the caller asked for a unique path . Leave the old one as - is , since // it might serve some unknown purpose . log . info ( "Pushing segment[%s] again with new unique path." , identifier ) ; } else { log . info ( "Segment[%s] already pushed." , identifier ) ; return objectMapper . readValue ( descriptorFile , DataSegment . class ) ; } } log . info ( "Pushing merged index for segment[%s]." , identifier ) ; removeDirectory ( mergedTarget ) ; if ( mergedTarget . exists ( ) ) { throw new ISE ( "Merged target[%s] exists after removing?!" , mergedTarget ) ; } final File mergedFile ; List < QueryableIndex > indexes = new ArrayList < > ( ) ; Closer closer = Closer . create ( ) ; try { for ( FireHydrant fireHydrant : sink ) { Pair < Segment , Closeable > segmentAndCloseable = fireHydrant . getAndIncrementSegment ( ) ; final QueryableIndex queryableIndex = segmentAndCloseable . lhs . asQueryableIndex ( ) ; log . info ( "Adding hydrant[%s]" , fireHydrant ) ; indexes . add ( queryableIndex ) ; closer . register ( segmentAndCloseable . rhs ) ; } mergedFile = indexMerger . mergeQueryableIndex ( indexes , schema . getGranularitySpec ( ) . isRollup ( ) , schema . getAggregators ( ) , mergedTarget , tuningConfig . getIndexSpec ( ) , tuningConfig . getSegmentWriteOutMediumFactory ( ) ) ; } catch ( Throwable t ) { throw closer . rethrow ( t ) ; } finally { closer . close ( ) ; } // Retry pushing segments because uploading to deep storage might fail especially for cloud storage types final DataSegment segment = RetryUtils . retry ( // The appenderator is currently being used for the local indexing task and the Kafka indexing task . For the // Kafka indexing task , pushers must use unique file paths in deep storage in order to maintain exactly - once // semantics . ( ) -> dataSegmentPusher . push ( mergedFile , sink . getSegment ( ) . withDimensions ( IndexMerger . getMergedDimensionsFromQueryableIndexes ( indexes ) ) , useUniquePath ) , exception -> exception instanceof Exception , 5 ) ; objectMapper . writeValue ( descriptorFile , segment ) ; log . info ( "Pushed merged index for segment[%s], descriptor is: %s" , identifier , segment ) ; return segment ; } catch ( Exception e ) { metrics . incrementFailedHandoffs ( ) ; log . warn ( e , "Failed to push merged index for segment[%s]." , identifier ) ; throw new RuntimeException ( e ) ; }
public class TangoDataReady { public void dispatch_event ( final EventData eventData ) { } }
final TangoDataReady tangoDataReady = this ; if ( EventUtil . graphicAvailable ( ) ) { // Causes doRun . run ( ) to be executed asynchronously // on the AWT event dispatching thread . Runnable do_work_later = new Runnable ( ) { public void run ( ) { fireTangoDataReadyEvent ( tangoDataReady , eventData ) ; } } ; SwingUtilities . invokeLater ( do_work_later ) ; } else fireTangoDataReadyEvent ( tangoDataReady , eventData ) ;
public class AccessPoint { /** * Set standard liveweb redirector */ public void setLiveWebPrefix ( String liveWebPrefix ) { } }
if ( liveWebPrefix == null || liveWebPrefix . isEmpty ( ) ) { this . liveWebRedirector = null ; } this . liveWebRedirector = new DefaultLiveWebRedirector ( liveWebPrefix ) ;
public class MLDouble { /** * Casts < code > Double [ ] < / code > to < code > double [ ] < / code > * @ param - source < code > Double [ ] < / code > * @ return - result < code > double [ ] < / code > */ private static Double [ ] castToDouble ( double [ ] d ) { } }
Double [ ] dest = new Double [ d . length ] ; for ( int i = 0 ; i < d . length ; i ++ ) { dest [ i ] = ( Double ) d [ i ] ; } return dest ;
public class PowerMockito { /** * Allows specifying expectations on new invocations . For example you might * want to throw an exception or return a mock . */ public static synchronized < T > WithOrWithoutExpectedArguments < T > whenNew ( Constructor < T > ctor ) { } }
return new ConstructorAwareExpectationSetup < T > ( ctor ) ;
public class MarkovGenerator { /** * Returns the given number of randomly generated paragraphs . * @ param num the number of paragraphs to generate * @ return a list of randomly generated paragraphs , of the requested size */ public List < String > nextParagraphs ( int num ) { } }
List < String > paragraphs = new ArrayList < String > ( num ) ; for ( int i = 0 ; i < num ; i ++ ) { paragraphs . add ( nextParagraph ( ) ) ; } return paragraphs ;
public class Sendinblue { /** * Get Access a specific user Information . * @ param { Object } data contains json objects as a key value pair from HashMap . * @ options data { String } email : Email address of the already existing user in the SendinBlue contacts [ Mandatory ] */ public String get_user ( Map < String , String > data ) { } }
String id = data . get ( "email" ) ; return get ( "user/" + id , EMPTY_STRING ) ;
public class TransactionImpl { /** * Sets the boundary of the LTC that was completed as a * result of this Transaction being begun . When this * transaction completes an LTC with the same boundary * is placed on the thread . */ @ Override public void setCompletedLTCBoundary ( Byte completedLTCBoundary ) { } }
if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "setCompletedLTCBoundary" , new Object [ ] { completedLTCBoundary } ) ; _completedLTCBoundary = completedLTCBoundary ;
public class History { /** * Create a history that contains a single key . */ @ NonNull public static History single ( @ NonNull Object key ) { } }
return emptyBuilder ( ) . push ( key ) . build ( ) ;
public class SecurityRulesInner { /** * Deletes the specified network security rule . * @ param resourceGroupName The name of the resource group . * @ param networkSecurityGroupName The name of the network security group . * @ param securityRuleName The name of the security rule . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void delete ( String resourceGroupName , String networkSecurityGroupName , String securityRuleName ) { } }
deleteWithServiceResponseAsync ( resourceGroupName , networkSecurityGroupName , securityRuleName ) . toBlocking ( ) . last ( ) . body ( ) ;
public class ResourceAssignment { /** * Set a start value . * @ param index start index ( 1-10) * @ param value start value */ public void setStart ( int index , Date value ) { } }
set ( selectField ( AssignmentFieldLists . CUSTOM_START , index ) , value ) ;
public class ReflectionUtils { /** * Assert that the given method returns the expected return type . * @ param method Method to assert . * @ param expectedReturnType Expected return type of the method . * @ throws IllegalArgumentException If the method ' s return type doesn ' t match the expected type . */ public static void assertReturnValue ( ReflectionMethod method , Class < ? > expectedReturnType ) { } }
final Class < ? > returnType = method . getReturnType ( ) ; if ( returnType != expectedReturnType ) { final String message = "Class='" + method . getDeclaringClass ( ) + "', method='" + method . getName ( ) + "': Must return a value of type '" + expectedReturnType + "'!" ; throw new IllegalArgumentException ( message ) ; }
public class Calculator { /** * 计算 ( ) 内的表达式 * @ param start 开始位置 * @ param formula 表达式 * @ return 长度为2的 { @ link BigDecimal } 数组 , 位置0表示计算结果 , 位置1表示结束位置 * @ throws Exception 异常 */ private static BigDecimal [ ] calculateInlineFormula ( int start , String formula ) throws Exception { } }
BigDecimal [ ] result = new BigDecimal [ 2 ] ; StringBuilder inlineFormula = new StringBuilder ( ) ; for ( ; start < formula . length ( ) ; start ++ ) { char c = formula . charAt ( start ) ; if ( c == '(' ) { BigDecimal [ ] res = calculateInlineFormula ( start + 1 , formula ) ; inlineFormula . append ( res [ 0 ] ) ; start = res [ 1 ] . intValue ( ) ; } else if ( c == ')' ) { break ; } else { inlineFormula . append ( c ) ; } } result [ 0 ] = calculate ( inlineFormula . toString ( ) ) ; result [ 1 ] = BigDecimal . valueOf ( start ) ; return result ;
public class IronJacamarWithByteman { /** * Create a ScriptText instance * @ param key The key * @ param rule The rule * @ return The ScriptText instance */ private ScriptText createScriptText ( int key , BMRule rule ) { } }
StringBuilder builder = new StringBuilder ( ) ; builder . append ( "# BMUnit autogenerated script: " ) . append ( rule . name ( ) ) ; builder . append ( "\nRULE " ) ; builder . append ( rule . name ( ) ) ; if ( rule . isInterface ( ) ) { builder . append ( "\nINTERFACE " ) ; } else { builder . append ( "\nCLASS " ) ; } builder . append ( rule . targetClass ( ) ) ; builder . append ( "\nMETHOD " ) ; builder . append ( rule . targetMethod ( ) ) ; String location = rule . targetLocation ( ) ; if ( location != null && location . length ( ) > 0 ) { builder . append ( "\nAT " ) ; builder . append ( location ) ; } String binding = rule . binding ( ) ; if ( binding != null && binding . length ( ) > 0 ) { builder . append ( "\nBIND " ) ; builder . append ( binding ) ; } String helper = rule . helper ( ) ; if ( helper != null && helper . length ( ) > 0 ) { builder . append ( "\nHELPER " ) ; builder . append ( helper ) ; } builder . append ( "\nIF " ) ; builder . append ( rule . condition ( ) ) ; builder . append ( "\nDO " ) ; builder . append ( rule . action ( ) ) ; builder . append ( "\nENDRULE\n" ) ; return new ScriptText ( "IronJacamarWithByteman" + key , builder . toString ( ) ) ;
public class Observation { /** * Returns the inserted value of a given insertion step . * @ param index Index of the desired insertion step * @ return The inserted value of a given insertion step . */ public double getValueAt ( int index ) { } }
if ( index < 0 || index >= insertSeq . size ( ) ) throw new IndexOutOfBoundsException ( ) ; return insertSeq . get ( index ) ;
public class SimpleLock { /** * Execute the provided runnable in a read lock . * @ param aRunnable * Runnable to be executed . May not be < code > null < / code > . */ public void locked ( @ Nonnull final Runnable aRunnable ) { } }
ValueEnforcer . notNull ( aRunnable , "Runnable" ) ; lock ( ) ; try { aRunnable . run ( ) ; } finally { unlock ( ) ; }
public class UniqueId { /** * Converts a hex string to a byte array * If the { @ code uid } is less than { @ code uid _ length * 2 } characters wide , it * will be padded with 0s to conform to the spec . E . g . if the tagk width is 3 * and the given { @ code uid } string is " 1 " , the string will be padded to * " 000001 " and then converted to a byte array to reach 3 bytes . * All { @ code uid } s are padded to 1 byte . If given " 1 " , and { @ code uid _ length } * is 0 , the uid will be padded to " 01 " then converted . * @ param uid The UID to convert * @ param uid _ length An optional length , in bytes , that the UID must conform * to . Set to 0 if not used . * @ return The UID as a byte array * @ throws NullPointerException if the ID was null * @ throws IllegalArgumentException if the string is not valid hex * @ since 2.0 */ public static byte [ ] stringToUid ( final String uid , final short uid_length ) { } }
if ( uid == null || uid . isEmpty ( ) ) { throw new IllegalArgumentException ( "UID was empty" ) ; } String id = uid ; if ( uid_length > 0 ) { while ( id . length ( ) < uid_length * 2 ) { id = "0" + id ; } } else { if ( id . length ( ) % 2 > 0 ) { id = "0" + id ; } } return DatatypeConverter . parseHexBinary ( id ) ;
public class CobarSqlMapClientTemplate { /** * NOTE : since it ' s a deprecated interface , so distributed data access is * not supported . */ @ Override public PaginatedList queryForPaginatedList ( String statementName , Object parameterObject , int pageSize ) throws DataAccessException { } }
return super . queryForPaginatedList ( statementName , parameterObject , pageSize ) ;
public class RetryTemplate { /** * Extension point for subclasses to decide on behaviour after catching an exception * in a { @ link RetryCallback } . Normal stateless behaviour is not to rethrow , and if * there is state we rethrow . * @ param retryPolicy the retry policy * @ param context the current context * @ param state the current retryState * @ return true if the state is not null but subclasses might choose otherwise */ protected boolean shouldRethrow ( RetryPolicy retryPolicy , RetryContext context , RetryState state ) { } }
return state != null && state . rollbackFor ( context . getLastThrowable ( ) ) ;
public class Configuration { /** * Get the comma delimited values of the < code > name < / code > property as * an array of < code > String < / code > s , trimmed of the leading and trailing whitespace . * If no such property is specified then an empty array is returned . * @ param name property name . * @ return property value as an array of trimmed < code > String < / code > s , * or empty array . */ public String [ ] getTrimmedStrings ( String name ) { } }
String valueString = get ( name ) ; return StringUtils . getTrimmedStrings ( valueString ) ;
public class ResumeUploader { private void record ( long offset ) { } }
if ( config . recorder == null || offset == 0 ) { return ; } String data = format ( Locale . ENGLISH , "{\"size\":%d,\"offset\":%d, \"modify_time\":%d, \"contexts\":[%s]}" , totalSize , offset , modifyTime , StringUtils . jsonJoin ( contexts ) ) ; config . recorder . set ( recorderKey , data . getBytes ( ) ) ;
public class CmsSecurityManager { /** * Returns a list of all template resources which must be processed during a static export . < p > * @ param context the current request context * @ param parameterResources flag for reading resources with parameters ( 1 ) or without ( 0) * @ param timestamp for reading the data from the db * @ return a list of template resources as < code > { @ link String } < / code > objects * @ throws CmsException if something goes wrong */ public List < String > readStaticExportResources ( CmsRequestContext context , int parameterResources , long timestamp ) throws CmsException { } }
CmsDbContext dbc = m_dbContextFactory . getDbContext ( context ) ; List < String > result = null ; try { result = m_driverManager . readStaticExportResources ( dbc , parameterResources , timestamp ) ; } catch ( Exception e ) { dbc . report ( null , Messages . get ( ) . container ( Messages . ERR_READ_STATEXP_RESOURCES_1 , new Date ( timestamp ) ) , e ) ; } finally { dbc . clear ( ) ; } return result ;
public class KDTree { /** * Recursively adds an instance to the tree starting from * the supplied KDTreeNode . * NOTE : This should not be called by outside classes , * outside classes should instead call update ( Instance ) * method . * @ param inst The instance to add to the tree * @ param node The node to start the recursive search * from , for the leaf node where the supplied instance * would go . * @ throws Exception If some error occurs while adding * the instance . */ protected void addInstanceToTree ( Instance inst , KDTreeNode node ) throws Exception { } }
if ( node . isALeaf ( ) ) { int instList [ ] = new int [ m_Instances . numInstances ( ) ] ; try { System . arraycopy ( m_InstList , 0 , instList , 0 , node . m_End + 1 ) ; // m _ InstList . squeezeIn ( m _ End , // index ) ; if ( node . m_End < m_InstList . length - 1 ) System . arraycopy ( m_InstList , node . m_End + 1 , instList , node . m_End + 2 , m_InstList . length - node . m_End - 1 ) ; instList [ node . m_End + 1 ] = m_Instances . numInstances ( ) - 1 ; } catch ( ArrayIndexOutOfBoundsException ex ) { System . err . println ( "m_InstList.length: " + m_InstList . length + " instList.length: " + instList . length + "node.m_End+1: " + ( node . m_End + 1 ) + "m_InstList.length-node.m_End+1: " + ( m_InstList . length - node . m_End - 1 ) ) ; throw ex ; } m_InstList = instList ; node . m_End ++ ; node . m_NodeRanges = m_EuclideanDistance . updateRanges ( inst , node . m_NodeRanges ) ; m_Splitter . setInstanceList ( m_InstList ) ; // split this leaf node if necessary double [ ] [ ] universe = m_EuclideanDistance . getRanges ( ) ; if ( node . numInstances ( ) > m_MaxInstInLeaf && getMaxRelativeNodeWidth ( node . m_NodeRanges , universe ) > m_MinBoxRelWidth ) { m_Splitter . splitNode ( node , m_NumNodes , node . m_NodeRanges , universe ) ; m_NumNodes += 2 ; } } // end if node is a leaf else { if ( m_EuclideanDistance . valueIsSmallerEqual ( inst , node . m_SplitDim , node . m_SplitValue ) ) { addInstanceToTree ( inst , node . m_Left ) ; afterAddInstance ( node . m_Right ) ; } else addInstanceToTree ( inst , node . m_Right ) ; node . m_End ++ ; node . m_NodeRanges = m_EuclideanDistance . updateRanges ( inst , node . m_NodeRanges ) ; }
public class VdmThreadEventHandler { @ Override protected void handleChange ( DebugEvent event ) { } }
// System . out . println ( " handleChange " + event . getSource ( ) ) ; IThread thread = ( IThread ) event . getSource ( ) ; if ( DEBUG ) { System . out . println ( "handleChange " + thread ) ; } if ( isRunning ( thread ) ) { IStackFrame frame = null ; try { frame = thread . getTopStackFrame ( ) ; int threadIndex = indexOf ( thread ) ; ModelDelta delta = buildRootDelta ( ) ; ModelDelta node = addPathToThread ( delta , thread ) ; int childCount = childCount ( thread ) ; if ( DEBUG ) { System . out . println ( "child: " + childCount ) ; } node = node . addNode ( thread , threadIndex , IModelDelta . CONTENT | IModelDelta . STATE | IModelDelta . SELECT , childCount ) ; if ( frame != null ) { node . addNode ( frame , indexOf ( frame ) , IModelDelta . STATE | IModelDelta . SELECT , childCount ( frame ) ) ; } if ( DEBUG ) { System . out . println ( delta ) ; } fireDelta ( delta ) ; } catch ( DebugException e ) { // TODO Auto - generated catch block e . printStackTrace ( ) ; } } else { if ( event . getDetail ( ) == DebugEvent . STATE ) { fireDeltaUpdatingThread ( ( IThread ) event . getSource ( ) , IModelDelta . STATE ) ; } else { fireDeltaUpdatingThread ( ( IThread ) event . getSource ( ) , IModelDelta . CONTENT ) ; } } // IThread thread = ( IThread ) event . getSource ( ) ; // if ( thread instanceof IVdmThread ) // if ( ( ( IVdmThread ) thread ) . getInterpreterState ( ) . getState ( ) = = InterpreterThreadStatus . RUNNING ) // System . out . println ( ( ( IVdmThread ) thread ) . getInterpreterState ( ) ) ; // / / fireDeltaUpdatingSelectedFrame2 ( thread , flags , event ) ; / / new // DebugEvent ( event . getSource ( ) , event . getKind ( ) , DebugEvent . STEP _ END ) ) ; // IStackFrame frame = null ; // try // frame = thread . getTopStackFrame ( ) ; // int threadIndex = indexOf ( thread ) ; // ModelDelta delta = buildRootDelta ( ) ; // ModelDelta node = addPathToThread ( delta , thread ) ; // int childCount = childCount ( thread ) ; // System . out . println ( " child : " + childCount ) ; // node = node . addNode ( thread , threadIndex , IModelDelta . CONTENT | IModelDelta . STATE | IModelDelta . SELECT , // childCount ) ; // if ( frame ! = null ) { // node . addNode ( frame , indexOf ( frame ) , IModelDelta . STATE | IModelDelta . SELECT , childCount ( frame ) ) ; // System . out . println ( delta ) ; // fireDelta ( delta ) ; // } catch ( DebugException e ) // / / TODO Auto - generated catch block // e . printStackTrace ( ) ;
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getGSCP ( ) { } }
if ( gscpEClass == null ) { gscpEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 473 ) ; } return gscpEClass ;
public class SentimentScoreMarshaller { /** * Marshall the given parameter object . */ public void marshall ( SentimentScore sentimentScore , ProtocolMarshaller protocolMarshaller ) { } }
if ( sentimentScore == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( sentimentScore . getPositive ( ) , POSITIVE_BINDING ) ; protocolMarshaller . marshall ( sentimentScore . getNegative ( ) , NEGATIVE_BINDING ) ; protocolMarshaller . marshall ( sentimentScore . getNeutral ( ) , NEUTRAL_BINDING ) ; protocolMarshaller . marshall ( sentimentScore . getMixed ( ) , MIXED_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }