signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class SyntaxException { /** * < p > Getter for the field < code > message < / code > . < / p > * @ return a { @ link java . lang . String } object . */ public String getMessage ( ) { } }
String . format ( "Wrong Syntax for [%s]: %s" , name , message ) ; return String . format ( "Wrong Syntax for [%s]: %s" , name , message ) ;
public class NodeInputStream { /** * InputStream method * @ return byte as read * @ throws IOException */ public int read ( ) throws IOException { } }
ensureContentAvailable ( ) ; if ( reallyAvailable ( ) == 0 ) { return - 1 ; } int contentByte = nodeContentBytes . toByteArray ( ) [ atPos ] ; atPos ++ ; return contentByte ;
public class MemcacheClient { /** * from spy documentation : * The actual ( exp ) value sent may either be Unix time ( number of seconds since * January 1 , 1970 , as a 32 - bit value ) , or a number of seconds starting from * current time . In the latter case , this number of seconds may not exceed * 60*60*24*30 ( number of seconds in 30 days ) ; if the number sent by a client * is larger than that , the server will consider it to be real Unix time value * rather than an offset from current time . * @ param exp expiration in unit units . * @ param unit the time unit . * @ return the expiration in secs according to memcached format . */ private static int expirationInSpyUnits ( final long exp , final TimeUnit unit ) { } }
final long intervalSec = unit . toSeconds ( exp ) ; return ( int ) ( intervalSec <= MAX_EXPIRATION_SEC ? intervalSec : ( System . currentTimeMillis ( ) / 1000 ) + intervalSec ) ;
public class RepositoryChainLogPathHelper { /** * Will be returned absolute path . * @ param relativePath * String , relative path . * @ param backupDirCanonicalPath * String , path to backup dir * @ return String * Will be returned absolute path . * @ throws MalformedURLException */ public static String getPath ( String relativePath , String backupDirCanonicalPath ) throws MalformedURLException { } }
String path = "file:" + backupDirCanonicalPath + "/" + relativePath ; URL urlPath = new URL ( resolveFileURL ( path ) ) ; return urlPath . getFile ( ) ;
public class ImageParser { /** * Return a json object from the provided array . Return an empty object if * there is any problems fetching the concept data . * @ param imageKeywords array of image keyword data * @ param index of the object to fetch * @ return json object from the provided array */ private JSONObject getImageKeyword ( final JSONArray imageKeywords , final int index ) { } }
JSONObject object = new JSONObject ( ) ; try { object = ( JSONObject ) imageKeywords . get ( index ) ; } catch ( JSONException e ) { e . printStackTrace ( ) ; } return object ;
public class Solo { /** * Scrolls to the bottom of the specified AbsListView . * @ param list the { @ link AbsListView } to scroll * @ return { @ code true } if more scrolling can be performed */ public boolean scrollListToBottom ( AbsListView list ) { } }
if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "scrollListToBottom(" + list + ")" ) ; } return scroller . scrollList ( list , Scroller . DOWN , true ) ;
public class SSLEngineImpl { /** * Emit alerts . Caller must have synchronized with " this " . */ private void sendAlert ( byte level , byte description ) { } }
// the connectionState cannot be cs _ START if ( connectionState >= cs_CLOSED ) { return ; } // For initial handshaking , don ' t send alert message to peer if // handshaker has not started . if ( connectionState == cs_HANDSHAKE && ( handshaker == null || ! handshaker . started ( ) ) ) { return ; } EngineOutputRecord r = new EngineOutputRecord ( Record . ct_alert , this ) ; r . setVersion ( protocolVersion ) ; boolean useDebug = debug != null && Debug . isOn ( "ssl" ) ; if ( useDebug ) { synchronized ( System . out ) { System . out . print ( threadName ( ) ) ; System . out . print ( ", SEND " + protocolVersion + " ALERT: " ) ; if ( level == Alerts . alert_fatal ) { System . out . print ( "fatal, " ) ; } else if ( level == Alerts . alert_warning ) { System . out . print ( "warning, " ) ; } else { System . out . print ( "<level = " + ( 0x0ff & level ) + ">, " ) ; } System . out . println ( "description = " + Alerts . alertDescription ( description ) ) ; } } r . write ( level ) ; r . write ( description ) ; try { writeRecord ( r ) ; } catch ( IOException e ) { if ( useDebug ) { System . out . println ( threadName ( ) + ", Exception sending alert: " + e ) ; } }
public class PageViewExternalHTMLCleanser { /** * Protected method to determine if a link ( e . g . from an ' a ' or ' img ' * elements ) needs a context path prefix * @ param sHref * The link HREF to check * @ return < code > true < / code > if the link needs a context path , * < code > false < / code > if not . */ @ OverrideOnDemand protected boolean linkNeedsContextPath ( @ Nullable final String sHref ) { } }
if ( sHref == null ) return false ; // If prefix is defined and already present no need to change something // Or if the server prefix path is just " / " and the links starts with " / " // it ' s also fine if ( sHref . startsWith ( m_sServerPrefixPath ) ) return false ; // javascript : and mailto : are handled by URLProtocolRegistry if ( URLProtocolRegistry . getInstance ( ) . hasKnownProtocol ( sHref ) || sHref . startsWith ( "#" ) ) return false ; // Prefix is needed return true ;
public class SystemInfo { /** * 解析物理机地址 * @ return 物理机地址 */ @ VisibleForTesting static String parseHostMachine ( ) { } }
String hostMachine = System . getProperty ( "host_machine" ) ; return StringUtils . isNotEmpty ( hostMachine ) ? hostMachine : null ;
public class NKey { /** * Create an NKey object from the encoded public key . This NKey can be used for verification but not for signing . * @ param publicKey the string encoded public key * @ return the new Nkey */ public static NKey fromPublicKey ( char [ ] publicKey ) { } }
byte [ ] raw = decode ( publicKey ) ; int prefix = raw [ 0 ] & 0xFF ; if ( ! checkValidPublicPrefixByte ( prefix ) ) { throw new IllegalArgumentException ( "Not a valid public NKey" ) ; } Type type = NKey . Type . fromPrefix ( prefix ) ; return new NKey ( type , publicKey , null ) ;
public class AbstractInterfaceConfig { /** * 查询属性值 * @ param property 属性 * @ return oldValue 属性值 */ public String queryAttribute ( String property ) { } }
try { Object oldValue = null ; if ( property . charAt ( 0 ) == RpcConstants . HIDE_KEY_PREFIX ) { // 方法级配置 例如 . echoStr . timeout String methodAndP = property . substring ( 1 ) ; int index = methodAndP . indexOf ( RpcConstants . HIDE_KEY_PREFIX ) ; if ( index <= 0 ) { throw ExceptionUtils . buildRuntime ( property , "" , "Unknown query attribute key!" ) ; } String methodName = methodAndP . substring ( 0 , index ) ; String methodProperty = methodAndP . substring ( index + 1 ) ; MethodConfig methodConfig = getMethodConfig ( methodName ) ; if ( methodConfig != null ) { Method getMethod = ReflectUtils . getPropertyGetterMethod ( MethodConfig . class , methodProperty ) ; Class propertyClazz = getMethod . getReturnType ( ) ; // 旧值的类型 oldValue = BeanUtils . getProperty ( methodConfig , methodProperty , propertyClazz ) ; } } else { // 接口级配置 例如timeout // 先通过get方法找到类型 Method getMethod = ReflectUtils . getPropertyGetterMethod ( getClass ( ) , property ) ; Class propertyClazz = getMethod . getReturnType ( ) ; // 旧值的类型 // 拿到旧的值 oldValue = BeanUtils . getProperty ( this , property , propertyClazz ) ; } return oldValue == null ? null : oldValue . toString ( ) ; } catch ( Exception e ) { throw new SofaRpcRuntimeException ( "Exception when query attribute, The key is " + property , e ) ; }
public class ClusterOrder { /** * Add an object to the cluster order . * @ param id Object id * @ param reach Reachability * @ param pre Predecessor */ public void add ( DBIDRef id , double reach , DBIDRef pre ) { } }
ids . add ( id ) ; reachability . putDouble ( id , reach ) ; if ( pre == null || pre instanceof DBIDVar && ! ( ( DBIDVar ) pre ) . isSet ( ) ) { return ; } predecessor . putDBID ( id , pre ) ;
public class BiInt2ObjectMap { /** * Iterate over the contents of the map * @ param consumer to apply to each value in the map */ @ SuppressWarnings ( "unchecked" ) public void forEach ( final Consumer < V > consumer ) { } }
for ( final Object value : values ) { if ( null != value ) { consumer . accept ( ( V ) value ) ; } }
public class DecimalFormat { /** * Sets the maximum number of digits allowed in the integer portion of a * number . * For formatting numbers other than < code > BigInteger < / code > and * < code > BigDecimal < / code > objects , the lower of < code > newValue < / code > and * 309 is used . Negative input values are replaced with 0. * @ see NumberFormat # setMaximumIntegerDigits */ @ Override public void setMaximumIntegerDigits ( int newValue ) { } }
maximumIntegerDigits = Math . min ( Math . max ( 0 , newValue ) , MAXIMUM_INTEGER_DIGITS ) ; super . setMaximumIntegerDigits ( ( maximumIntegerDigits > DOUBLE_INTEGER_DIGITS ) ? DOUBLE_INTEGER_DIGITS : maximumIntegerDigits ) ; if ( minimumIntegerDigits > maximumIntegerDigits ) { minimumIntegerDigits = maximumIntegerDigits ; super . setMinimumIntegerDigits ( ( minimumIntegerDigits > DOUBLE_INTEGER_DIGITS ) ? DOUBLE_INTEGER_DIGITS : minimumIntegerDigits ) ; } fastPathCheckNeeded = true ;
public class DefaultPDUSender { /** * ( non - Javadoc ) * @ see org . jsmpp . PDUSender # sendHeader ( java . io . OutputStream , int , int , int ) */ public byte [ ] sendHeader ( OutputStream os , int commandId , int commandStatus , int sequenceNumber ) throws IOException { } }
byte [ ] b = pduComposer . composeHeader ( commandId , commandStatus , sequenceNumber ) ; writeAndFlush ( os , b ) ; return b ;
public class Determinize { /** * Determinizes an FSA or FST . For this algorithm , epsilon transitions are treated as regular symbols . * @ param fst the fst to determinize * @ return the determinized fst */ public MutableFst compute ( final Fst fst ) { } }
fst . throwIfInvalid ( ) ; // init for this run of compute this . semiring = fst . getSemiring ( ) ; this . gallicSemiring = new GallicSemiring ( this . semiring , this . gallicMode ) ; this . unionSemiring = makeUnionRing ( semiring , gallicSemiring , mode ) ; this . inputFst = fst ; this . outputFst = MutableFst . emptyWithCopyOfSymbols ( fst ) ; this . outputStateIdToTuple = HashBiMap . create ( ) ; // workQueue holds the pending work of determinizing the input fst Deque < DetStateTuple > workQueue = new LinkedList < > ( ) ; // finalQueue holds the pending work of expanding out the final paths ( handled by the FactorFst in the // open fst implementation ) Deque < DetElement > finalQueue = new LinkedList < > ( ) ; // start the algorithm by starting with the input start state MutableState initialOutState = outputFst . newStartState ( ) ; DetElement initialElement = new DetElement ( fst . getStartState ( ) . getId ( ) , GallicWeight . createEmptyLabels ( semiring . one ( ) ) ) ; DetStateTuple initialTuple = new DetStateTuple ( initialElement ) ; workQueue . addLast ( initialTuple ) ; this . outputStateIdToTuple . put ( initialOutState . getId ( ) , initialTuple ) ; // process all of the input states via the work queue while ( ! workQueue . isEmpty ( ) ) { DetStateTuple entry = workQueue . removeFirst ( ) ; MutableState outStateForTuple = getOutputStateForStateTuple ( entry ) ; Collection < DetArcWork > arcWorks = groupByInputLabel ( entry ) ; arcWorks . forEach ( this :: normalizeArcWork ) ; for ( DetArcWork arcWork : arcWorks ) { DetStateTuple targetTuple = new DetStateTuple ( arcWork . pendingElements ) ; if ( ! this . outputStateIdToTuple . inverse ( ) . containsKey ( targetTuple ) ) { // we ' ve never seen this tuple before so new state + enqueue the work MutableState newOutState = outputFst . newState ( ) ; this . outputStateIdToTuple . put ( newOutState . getId ( ) , targetTuple ) ; newOutState . setFinalWeight ( computeFinalWeight ( newOutState . getId ( ) , targetTuple , finalQueue ) ) ; workQueue . addLast ( targetTuple ) ; } MutableState targetOutState = getOutputStateForStateTuple ( targetTuple ) ; // the computed divisor is a ' legal ' arc meaning that it only has zero or one substring ; though there // might be multiple entries if we ' re in non _ functional mode UnionWeight < GallicWeight > unionWeight = arcWork . computedDivisor ; for ( GallicWeight gallicWeight : unionWeight . getWeights ( ) ) { Preconditions . checkState ( gallicSemiring . isNotZero ( gallicWeight ) , "gallic weight zero computed from group by" , gallicWeight ) ; int oLabel = this . outputEps ; if ( ! gallicWeight . getLabels ( ) . isEmpty ( ) ) { Preconditions . checkState ( gallicWeight . getLabels ( ) . size ( ) == 1 , "cant gave gallic arc weight with more than a single symbol" , gallicWeight ) ; oLabel = gallicWeight . getLabels ( ) . get ( 0 ) ; } outputFst . addArc ( outStateForTuple , arcWork . inputLabel , oLabel , targetOutState , gallicWeight . getWeight ( ) ) ; } } } // we might ' ve deferred some final state work that needs to be expanded expandDeferredFinalStates ( finalQueue ) ; return outputFst ;
public class DateFunctions { /** * Returned expression results in the string in the supported format to which * the UNIX milliseconds has been converted . */ public static Expression millisToStr ( Expression expression , String format ) { } }
if ( format == null || format . isEmpty ( ) ) { return x ( "MILLIS_TO_STR(" + expression . toString ( ) + ")" ) ; } return x ( "MILLIS_TO_STR(" + expression . toString ( ) + ", \"" + format + "\")" ) ;
public class MoreCollectors { /** * Adapts a { @ code Collector } accepting elements of type { @ code U } to one * accepting elements of type { @ code T } by applying a mapping function to * each input element before accumulation . * Unlike { @ link Collectors # mapping ( Function , Collector ) } this method * returns a * < a href = " package - summary . html # ShortCircuitReduction " > short - circuiting * collector < / a > if the downstream collector is short - circuiting . * @ param < T > the type of the input elements * @ param < U > type of elements accepted by downstream collector * @ param < A > intermediate accumulation type of the downstream collector * @ param < R > result type of collector * @ param mapper a function to be applied to the input elements * @ param downstream a collector which will accept mapped values * @ return a collector which applies the mapping function to the input * elements and provides the mapped results to the downstream * collector * @ see Collectors # mapping ( Function , Collector ) * @ since 0.4.0 */ public static < T , U , A , R > Collector < T , ? , R > mapping ( Function < ? super T , ? extends U > mapper , Collector < ? super U , A , R > downstream ) { } }
Predicate < A > finished = finished ( downstream ) ; if ( finished != null ) { BiConsumer < A , ? super U > downstreamAccumulator = downstream . accumulator ( ) ; return new CancellableCollectorImpl < > ( downstream . supplier ( ) , ( acc , t ) -> { if ( ! finished . test ( acc ) ) downstreamAccumulator . accept ( acc , mapper . apply ( t ) ) ; } , downstream . combiner ( ) , downstream . finisher ( ) , finished , downstream . characteristics ( ) ) ; } return Collectors . mapping ( mapper , downstream ) ;
public class Reflector { /** * gets the MethodInstance matching given Parameter * @ param clazz Class Of the Method to get * @ param methodName Name of the Method to get * @ param args Arguments of the Method to get * @ return return Matching Method * @ throws NoSuchMethodException * @ throws PageException */ public static MethodInstance getMethodInstance ( Object obj , Class clazz , String methodName , Object [ ] args ) throws NoSuchMethodException { } }
MethodInstance mi = getMethodInstanceEL ( obj , clazz , KeyImpl . getInstance ( methodName ) , args ) ; if ( mi != null ) return mi ; Class [ ] classes = getClasses ( args ) ; // StringBuilder sb = null ; JavaObject jo ; Class c ; ConstructorInstance ci ; for ( int i = 0 ; i < classes . length ; i ++ ) { if ( args [ i ] instanceof JavaObject ) { jo = ( JavaObject ) args [ i ] ; c = jo . getClazz ( ) ; ci = Reflector . getConstructorInstance ( c , new Object [ 0 ] , null ) ; if ( ci == null ) { throw new NoSuchMethodException ( "The " + pos ( i + 1 ) + " parameter of " + methodName + "(" + getDspMethods ( classes ) + ") ia a object created " + "by the createObject function (JavaObject/JavaProxy). This object has not been instantiated because it does not have a constructor " + "that takes zero arguments. " + Constants . NAME + " cannot instantiate it for you, please use the .init(...) method to instantiate it with the correct parameters first" ) ; } } } /* * the argument list contains objects created by createObject , that are no instantiated * ( first , third , 10th ) and because this object have no constructor taking no arguments , Lucee cannot * instantiate them . you need first to instantiate this objects . */ throw new NoSuchMethodException ( "No matching Method for " + methodName + "(" + getDspMethods ( classes ) + ") found for " + Caster . toTypeName ( clazz ) ) ;
public class IoUtils { /** * Returns a free port number on localhost . * Heavily inspired from org . eclipse . jdt . launching . SocketUtil ( to avoid a dependency to JDT just because of this ) . * Slightly improved with close ( ) missing in JDT . And throws exception instead of returning - 1. * https : / / gist . github . com / vorburger / 3429822 * @ return a free port number on localhost * @ throws IllegalStateException if unable to find a free port */ public static int findFreePort ( ) { } }
ServerSocket socket = null ; try { socket = new ServerSocket ( 0 ) ; socket . setReuseAddress ( true ) ; int port = socket . getLocalPort ( ) ; try { socket . close ( ) ; } catch ( IOException e ) { // Ignore IOException on close ( ) } return port ; } catch ( IOException e ) { } finally { if ( socket != null ) { try { socket . close ( ) ; } catch ( IOException e ) { } } } throw new IllegalStateException ( "Could not find a free TCP/IP port to start Galaxy on" ) ;
public class StructuredForm { /** * Retrieves the property of the given object and returns it as a list of { @ link JSONObject } . * If the value doesn ' t exist , this method returns an empty list . If the value is * a { @ link JSONObject } , this method will return a singleton list . If it ' s a { @ link JSONArray } , * the contents will be returned as a list . * Because of the way structured form submission work , this is convenient way of * handling repeated multi - value entries . * @ since 1.233 */ public static List < JSONObject > toList ( JSONObject parent , String propertyName ) { } }
Object v = parent . get ( propertyName ) ; if ( v == null ) return Collections . emptyList ( ) ; if ( v instanceof JSONObject ) return Collections . singletonList ( ( JSONObject ) v ) ; if ( v instanceof JSONArray ) return ( List ) ( JSONArray ) v ; throw new IllegalArgumentException ( ) ;
public class ArrayUtils { /** * 去重 * @ param arrays 数组 * @ param min 最小值 ( 小于该值的将被忽略 ) * @ param max 最大值 ( 大于该值的将被忽略 ) * @ return 去重后的数组 */ public static int [ ] unique ( int [ ] arrays , int min , int max ) { } }
List < Integer > list = new ArrayList < > ( arrays . length ) ; for ( int arr : arrays ) { if ( ! list . contains ( arr ) && arr >= min && arr <= max ) { list . add ( arr ) ; } } int [ ] res = new int [ list . size ( ) ] ; int i = 0 ; for ( int arr : list ) { res [ i ++ ] = arr ; } return res ;
public class Wills { /** * Creates Will object from Guava ' s { @ link com . google . common . util . concurrent . ListenableFuture } * @ param future Guava ' s ListenableFuture * @ param < A > Type of ListenableFuture and will be created * @ return Created Will */ public static < A > Will < A > forListenableFuture ( ListenableFuture < A > future ) { } }
return new Of < A > ( future ) ;
public class HashingInputStream { /** * Reads the specified bytes of data from the underlying input stream and updates the hasher with * the bytes read . */ @ Override public int read ( byte [ ] bytes , int off , int len ) throws IOException { } }
int numOfBytesRead = in . read ( bytes , off , len ) ; if ( numOfBytesRead != - 1 ) { hasher . put ( bytes , off , numOfBytesRead ) ; } return numOfBytesRead ;
public class Start { /** * Set one arg option . * Error and exit if one argument is not provided . */ private void oneArg ( String [ ] args , int index ) { } }
if ( ( index + 1 ) < args . length ) { setOption ( args [ index ] , args [ index + 1 ] ) ; } else { usageError ( "main.requires_argument" , args [ index ] ) ; }
public class Schema { /** * Infers a schema based on the record . * The column names are based on indexing . * @ param record the record to infer from * @ return the infered schema */ public static Schema infer ( List < Writable > record ) { } }
Schema . Builder builder = new Schema . Builder ( ) ; for ( int i = 0 ; i < record . size ( ) ; i ++ ) { if ( record . get ( i ) instanceof DoubleWritable ) builder . addColumnDouble ( String . valueOf ( i ) ) ; else if ( record . get ( i ) instanceof IntWritable ) builder . addColumnInteger ( String . valueOf ( i ) ) ; else if ( record . get ( i ) instanceof LongWritable ) builder . addColumnLong ( String . valueOf ( i ) ) ; else if ( record . get ( i ) instanceof FloatWritable ) builder . addColumnFloat ( String . valueOf ( i ) ) ; else if ( record . get ( i ) instanceof Text ) { builder . addColumnString ( String . valueOf ( i ) ) ; } else throw new IllegalStateException ( "Illegal writable for infering schema of type " + record . get ( i ) . getClass ( ) . toString ( ) + " with record " + record ) ; } return builder . build ( ) ;
public class MessageMap { /** * Compute the multiChoice code or contribution for an individual variant */ private static BigInteger getMultiChoice ( int [ ] choices , JSchema schema , JSVariant var ) throws JMFUninitializedAccessException { } }
int choice = choices [ var . getIndex ( ) ] ; if ( choice == - 1 ) throw new JMFUninitializedAccessException ( schema . getPathName ( var ) ) ; BigInteger ans = BigInteger . ZERO ; // First , add the contribution of the cases less than the present one . for ( int i = 0 ; i < choice ; i ++ ) ans = ans . add ( ( ( JSType ) var . getCase ( i ) ) . getMultiChoiceCount ( ) ) ; // Now compute the contribution of the actual case . Get the subvariants dominated by // this variant ' s present case . JSVariant [ ] subVars = var . getDominatedVariants ( choice ) ; if ( subVars == null ) // There are none : we already have the answer return ans ; return ans . add ( getMultiChoice ( choices , schema , subVars ) ) ;
public class Stream { /** * Lazy evaluation . * @ param supplier * @ return */ public static < T > Stream < T > of ( final Supplier < Collection < ? extends T > > supplier ) { } }
final Iterator < T > iter = new ObjIteratorEx < T > ( ) { private Iterator < ? extends T > iterator = null ; @ Override public boolean hasNext ( ) { if ( iterator == null ) { init ( ) ; } return iterator . hasNext ( ) ; } @ Override public T next ( ) { if ( iterator == null ) { init ( ) ; } return iterator . next ( ) ; } private void init ( ) { final Collection < ? extends T > c = supplier . get ( ) ; if ( N . isNullOrEmpty ( c ) ) { iterator = ObjIterator . empty ( ) ; } else { iterator = c . iterator ( ) ; } } } ; return of ( iter ) ;
public class GenPyExprsVisitor { /** * Executes this visitor on the children of the given node , without visiting the given node * itself . */ List < PyExpr > execOnChildren ( ParentSoyNode < ? > node ) { } }
Preconditions . checkArgument ( isComputableAsPyExprVisitor . execOnChildren ( node ) ) ; pyExprs = new ArrayList < > ( ) ; visitChildren ( node ) ; return pyExprs ;
public class HttpClientPipelineConfigurator { /** * Configures the specified { @ link SslHandler } with common settings . */ private static SslHandler configureSslHandler ( SslHandler sslHandler ) { } }
// Set endpoint identification algorithm so that JDK ' s default X509TrustManager implementation // performs host name checks . Without this , the X509TrustManager implementation will never raise // a CertificateException even if the domain name or IP address mismatches . final SSLEngine engine = sslHandler . engine ( ) ; final SSLParameters params = engine . getSSLParameters ( ) ; params . setEndpointIdentificationAlgorithm ( "HTTPS" ) ; engine . setSSLParameters ( params ) ; return sslHandler ;
public class SipStandardContext { /** * Add a new Listener class name to the set of Listeners * configured for this application . * @ param listener Java class name of a listener class */ public void addSipApplicationListener ( String listener ) { } }
if ( logger . isDebugEnabled ( ) ) { logger . debug ( "addSipApplicationListener " + getName ( ) ) ; } sipApplicationListeners . add ( listener ) ; fireContainerEvent ( "addSipApplicationListener" , listener ) ; // FIXME - add instance if already started ?
public class CommerceUserSegmentEntryLocalServiceBaseImpl { /** * Returns the number of rows matching the dynamic query . * @ param dynamicQuery the dynamic query * @ param projection the projection to apply to the query * @ return the number of rows matching the dynamic query */ @ Override public long dynamicQueryCount ( DynamicQuery dynamicQuery , Projection projection ) { } }
return commerceUserSegmentEntryPersistence . countWithDynamicQuery ( dynamicQuery , projection ) ;
public class RBACRegistry { /** * This method duplicates what Jolokia does in List Handler in order to convert { @ link MBeanInfo } to JSON . * @ param mBeanInfo * @ return */ @ SuppressWarnings ( "unchecked" ) private Map < String , Object > jsonifyMBeanInfo ( MBeanInfo mBeanInfo ) { } }
Map < String , Object > result = new LinkedHashMap < > ( ) ; // desc result . put ( "desc" , mBeanInfo . getDescription ( ) ) ; // attr Map < String , Object > attrMap = new LinkedHashMap < > ( ) ; result . put ( "attr" , attrMap ) ; for ( MBeanAttributeInfo attrInfo : mBeanInfo . getAttributes ( ) ) { if ( attrInfo == null ) { continue ; } Map < String , Object > attr = new HashMap < > ( ) ; attr . put ( "type" , attrInfo . getType ( ) ) ; attr . put ( "desc" , attrInfo . getDescription ( ) ) ; attr . put ( "rw" , attrInfo . isWritable ( ) && attrInfo . isReadable ( ) ) ; attrMap . put ( attrInfo . getName ( ) , attr ) ; } // op Map < String , Object > opMap = new LinkedHashMap < > ( ) ; result . put ( "op" , opMap ) ; for ( MBeanOperationInfo opInfo : mBeanInfo . getOperations ( ) ) { Map < String , Object > map = new HashMap < > ( ) ; List < Map < String , String > > argList = new ArrayList < > ( opInfo . getSignature ( ) . length ) ; for ( MBeanParameterInfo paramInfo : opInfo . getSignature ( ) ) { Map < String , String > args = new HashMap < > ( ) ; args . put ( "desc" , paramInfo . getDescription ( ) ) ; args . put ( "name" , paramInfo . getName ( ) ) ; args . put ( "type" , paramInfo . getType ( ) ) ; argList . add ( args ) ; } map . put ( "args" , argList ) ; map . put ( "ret" , opInfo . getReturnType ( ) ) ; map . put ( "desc" , opInfo . getDescription ( ) ) ; Object ops = opMap . get ( opInfo . getName ( ) ) ; if ( ops != null ) { if ( ops instanceof List ) { // If it is already a list , simply add it to the end ( ( List ) ops ) . add ( map ) ; } else if ( ops instanceof Map ) { // If it is a map , add a list with two elements // ( the old one and the new one ) List < Object > opList = new LinkedList < > ( ) ; opList . add ( ops ) ; opList . add ( map ) ; opMap . put ( opInfo . getName ( ) , opList ) ; } } else { // No value set yet , simply add the map as plain value opMap . put ( opInfo . getName ( ) , map ) ; } } // not Map < String , Object > notMap = new LinkedHashMap < > ( ) ; result . put ( "not" , notMap ) ; for ( MBeanNotificationInfo notInfo : mBeanInfo . getNotifications ( ) ) { Map < String , Object > map = new HashMap < > ( ) ; map . put ( "name" , notInfo . getName ( ) ) ; map . put ( "desc" , notInfo . getDescription ( ) ) ; String [ ] types = notInfo . getNotifTypes ( ) ; List < String > tList = new ArrayList < > ( types . length ) ; Collections . addAll ( tList , types ) ; map . put ( "types" , tList ) ; notMap . put ( notInfo . getName ( ) , map ) ; } // this is default - in case we won ' t find RBACDecorator ( possible in hawtio - wildfly for example ) result . put ( "canInvoke" , true ) ; return result ;
public class Log { /** * Triggers a Report . This method generates the report and send it with all * configured reporters . * @ param message * the message * @ param error * the error * @ return < code > true < / code > if the report was successfully sent by * < b > all < / b > reporters , < code > false < / code > otherwise . */ public static boolean report ( String message , Throwable error ) { } }
boolean acc = true ; for ( Reporter reporter : reporters ) { if ( reportFactory != null && reporter instanceof EnhancedReporter ) { Report report = reportFactory . create ( context , message , error ) ; acc = acc && ( ( EnhancedReporter ) reporter ) . send ( context , report ) ; } else { acc = acc && reporter . send ( context , message , error ) ; } } return acc ;
public class IcsAdapterView { /** * Get the position within the adapter ' s data set for the view , where view is a an adapter item * or a descendant of an adapter item . * @ param view an adapter item , or a descendant of an adapter item . This must be visible in this * AdapterView at the time of the call . * @ return the position within the adapter ' s data set of the view , or { @ link # INVALID _ POSITION } * if the view does not correspond to a list item ( or it is not currently visible ) . */ public int getPositionForView ( View view ) { } }
View listItem = view ; try { View v ; while ( ! ( v = ( View ) listItem . getParent ( ) ) . equals ( this ) ) { listItem = v ; } } catch ( ClassCastException e ) { // We made it up to the window without find this list view return INVALID_POSITION ; } // Search the children for the list item final int childCount = getChildCount ( ) ; for ( int i = 0 ; i < childCount ; i ++ ) { if ( getChildAt ( i ) . equals ( listItem ) ) { return mFirstPosition + i ; } } // Child not found ! return INVALID_POSITION ;
public class CheckButton { /** * Internal use only * @ param data Data */ public void handleData ( String data ) { } }
state = data . equals ( "1" ) ; sendEvent ( new CheckEvent ( this . user , getPayload ( ) , state ) ) ; if ( checkHandler != null ) checkHandler . checked ( state ) ;
public class DefaultConfigurableOptionsFactory { /** * Creates a { @ link DefaultConfigurableOptionsFactory } instance from a { @ link Configuration } . * < p > If no options within { @ link RocksDBConfigurableOptions } has ever been configured , * the created OptionsFactory would not override anything defined in { @ link PredefinedOptions } . * @ param configuration Configuration to be used for the ConfigurableOptionsFactory creation * @ return A ConfigurableOptionsFactory created from the given configuration */ @ Override public DefaultConfigurableOptionsFactory configure ( Configuration configuration ) { } }
for ( String key : CANDIDATE_CONFIGS ) { String newValue = configuration . getString ( key , null ) ; if ( newValue != null ) { if ( checkArgumentValid ( key , newValue ) ) { this . configuredOptions . put ( key , newValue ) ; } } } return this ;
public class LegacySynchronousBus { /** * Posts a message to all registered destinations , waiting up to the specified * number of time units if the internal queue is full . * @ param message * the message to be posted . * @ param timeout * a number of time units to wait if the message cannot be queued immediately * for dispatching . * @ param unit * the time units in which the timeout is expressed . * @ return * the objects itself , for method chaining . * @ throws InterruptedException */ public Bus < M > post ( M message , long timeout , TimeUnit unit ) throws InterruptedException { } }
queue . offer ( message , timeout , unit ) ; return this ;
public class InmemQueue { /** * { @ inheritDoc } */ @ Override public Collection < IQueueMessage < ID , DATA > > getOrphanMessages ( long thresholdTimestampMs ) { } }
if ( isEphemeralDisabled ( ) ) { return null ; } Collection < IQueueMessage < ID , DATA > > orphanMessages = new HashSet < > ( ) ; long now = System . currentTimeMillis ( ) ; ephemeralStorage . forEach ( ( key , msg ) -> { if ( msg . getQueueTimestamp ( ) . getTime ( ) + thresholdTimestampMs < now ) orphanMessages . add ( msg ) ; } ) ; return orphanMessages ;
public class URLNormalizer { /** * < p > Converts < code > https < / code > scheme to < code > http < / code > . < / p > * < code > https : / / www . example . com / & rarr ; http : / / www . example . com / < / code > * @ return this instance */ public URLNormalizer unsecureScheme ( ) { } }
Matcher m = PATTERN_SCHEMA . matcher ( url ) ; if ( m . find ( ) ) { String schema = m . group ( 1 ) ; if ( "https" . equalsIgnoreCase ( schema ) ) { url = m . replaceFirst ( StringUtils . stripEnd ( schema , "Ss" ) + "$2" ) ; } } return this ;
public class BundleHandler { /** * One - shot initialization of JDK 1.2 + ResourceBundle . getBundle ( ) method * having ClassLoader in the signature . */ private static Method getNewGetBundleMethod ( ) { } }
Class clazz ; Class [ ] args ; clazz = ResourceBundle . class ; args = new Class [ ] { String . class , Locale . class , ClassLoader . class } ; try { return clazz . getMethod ( "getBundle" , args ) ; } catch ( Exception e ) { return null ; }
public class VersionHelper { /** * Returns the version to use for the fabric8 archetypes */ public static String fabric8ArchetypesVersion ( ) { } }
String version = System . getenv ( ENV_FABRIC8_ARCHETYPES_VERSION ) ; if ( Strings . isNotBlank ( version ) ) { return version ; } return MavenHelpers . getVersion ( "io.fabric8.archetypes" , "archetypes-catalog" ) ;
public class JobCredentialsInner { /** * Gets a list of jobs credentials . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; JobCredentialInner & gt ; object */ public Observable < ServiceResponse < Page < JobCredentialInner > > > listByAgentNextWithServiceResponseAsync ( final String nextPageLink ) { } }
return listByAgentNextSinglePageAsync ( nextPageLink ) . concatMap ( new Func1 < ServiceResponse < Page < JobCredentialInner > > , Observable < ServiceResponse < Page < JobCredentialInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < JobCredentialInner > > > call ( ServiceResponse < Page < JobCredentialInner > > page ) { String nextPageLink = page . body ( ) . nextPageLink ( ) ; if ( nextPageLink == null ) { return Observable . just ( page ) ; } return Observable . just ( page ) . concatWith ( listByAgentNextWithServiceResponseAsync ( nextPageLink ) ) ; } } ) ;
public class MemorySegment { /** * Wraps the chunk of the underlying memory located between < tt > offset < tt > and * < tt > length < / tt > in a NIO ByteBuffer . * @ param offset The offset in the memory segment . * @ param length The number of bytes to be wrapped as a buffer . * @ return A < tt > ByteBuffer < / tt > backed by the specified portion of the memory segment . * @ throws IndexOutOfBoundsException Thrown , if offset is negative or larger than the memory segment size , * or if the offset plus the length is larger than the segment size . */ public ByteBuffer wrap ( int offset , int length ) { } }
if ( offset > this . memory . length || offset > this . memory . length - length ) { throw new IndexOutOfBoundsException ( ) ; } if ( this . wrapper == null ) { this . wrapper = ByteBuffer . wrap ( this . memory , offset , length ) ; } else { this . wrapper . position ( offset ) ; this . wrapper . limit ( offset + length ) ; } return this . wrapper ;
public class PointerPrototypeHierarchyRepresentationResult { /** * Extract the prototype of a given cluster . When the argument is not a valid * cluster of this Pointer Hierarchy , the return value is unspecified . * @ param members Cluster members * @ return The prototype of the cluster */ public DBID findPrototype ( DBIDs members ) { } }
// Find the last merge within the cluster . // The object with maximum priority will merge outside of the cluster , // So we need the second largest priority . DBIDIter it = members . iter ( ) ; DBIDVar proto = DBIDUtil . newVar ( it ) , last = DBIDUtil . newVar ( it ) ; int maxprio = Integer . MIN_VALUE , secprio = Integer . MIN_VALUE ; for ( ; it . valid ( ) ; it . advance ( ) ) { int prio = mergeOrder . intValue ( it ) ; if ( prio > maxprio ) { secprio = maxprio ; proto . set ( last ) ; maxprio = prio ; last . set ( it ) ; } else if ( prio > secprio ) { secprio = prio ; proto . set ( it ) ; } } return DBIDUtil . deref ( prototypes . assignVar ( proto , proto ) ) ;
public class MirrorTable { /** * Lock the current record . * This method responds differently depending on what open mode the record is in : * OPEN _ DONT _ LOCK - A physical lock is not done . This is usually where deadlocks are possible * ( such as screens ) and where transactions are in use ( and locks are not needed ) . * OPEN _ LOCK _ ON _ EDIT - Holds a lock until an update or close . ( Update crucial data , or hold records for processing ) * Returns false is someone alreay has a lock on this record . * OPEN _ WAIT _ FOR _ LOCK - Don ' t return from edit until you get a lock . ( ie . , Add to the total ) . * Returns false if someone has a hard lock or time runs out . * @ return true if successful , false is lock failed . * @ exception DBException FILE _ NOT _ OPEN * @ exception DBException INVALID _ RECORD - Record not current . */ public int edit ( ) throws DBException { } }
int iErrorCode = super . edit ( ) ; Iterator < BaseTable > iterator = this . getTables ( ) ; while ( iterator . hasNext ( ) ) { BaseTable table = iterator . next ( ) ; if ( ( table != null ) && ( table != this . getNextTable ( ) ) ) { if ( table . getRecord ( ) . getEditMode ( ) == Constants . EDIT_CURRENT ) table . edit ( ) ; } } return iErrorCode ;
public class Notification { /** * Sets metrics to be annotated . * @ param metricsToAnnotate list of metrics . */ public void setMetricsToAnnotate ( List < String > metricsToAnnotate ) { } }
this . metricsToAnnotate . clear ( ) ; if ( metricsToAnnotate != null && ! metricsToAnnotate . isEmpty ( ) ) { for ( String metric : metricsToAnnotate ) { requireArgument ( getMetricToAnnotate ( metric ) != null , "Metrics to annotate should be of the form 'scope:metric[{[tagk=tagv]+}]" ) ; this . metricsToAnnotate . add ( metric ) ; } }
public class ThreadScopeContext { /** * Remove a bean from the context , calling the destruction callback if any . * @ param name bean name * @ return previous value */ public Object remove ( String name ) { } }
Bean bean = beans . get ( name ) ; if ( null != bean ) { beans . remove ( name ) ; bean . destructionCallback . run ( ) ; return bean . object ; } return null ;
public class CSVUtil { /** * Imports the data from CSV to database . * @ param is * @ param offset * @ param count * @ param filter * @ param stmt the column order in the sql should be consistent with the column order in the CSV file . * @ param batchSize * @ param batchInterval * @ param stmtSetter * @ return */ public static < E extends Exception > long importCSV ( final InputStream is , long offset , final long count , final Try . Predicate < String [ ] , E > filter , final PreparedStatement stmt , final int batchSize , final int batchInterval , final Try . BiConsumer < ? super PreparedStatement , ? super String [ ] , SQLException > stmtSetter ) throws UncheckedSQLException , UncheckedIOException , E { } }
final Reader reader = new InputStreamReader ( is ) ; return importCSV ( reader , offset , count , filter , stmt , batchSize , batchInterval , stmtSetter ) ;
public class ASTManager { /** * Parses a Java source file with a given encoding and store the AST into a * { @ link org . walkmod . javalang . ast . CompilationUnit } object . * @ param file * source code to parse * @ param encoding * @ return the abstract syntax tree ( AST ) * @ throws ParseException * when the code contains an invalid syntax * @ throws IOException * file can not be read . */ public static CompilationUnit parse ( File file , String encoding ) throws ParseException , IOException { } }
Reader reader = new InputStreamReader ( new FileInputStream ( file ) , encoding ) ; CompilationUnit cu = parse ( reader ) ; cu . setURI ( file . toURI ( ) ) ; return cu ;
public class Graphs { /** * Merge all nodes and edges of two graphs . * @ param graph1 A { @ link MutableGraph } into which all nodes and edges of { @ literal graph2 } will be merged * @ param graph2 The { @ link Graph } whose nodes and edges will be merged into { @ literal graph1} * @ param < N > The class of the nodes */ public static < N > void merge ( MutableGraph < N > graph1 , Graph < N > graph2 ) { } }
for ( N node : graph2 . nodes ( ) ) { graph1 . addNode ( node ) ; } for ( EndpointPair < N > edge : graph2 . edges ( ) ) { graph1 . putEdge ( edge . nodeU ( ) , edge . nodeV ( ) ) ; }
public class CPFriendlyURLEntryLocalServiceUtil { /** * Creates a new cp friendly url entry with the primary key . Does not add the cp friendly url entry to the database . * @ param CPFriendlyURLEntryId the primary key for the new cp friendly url entry * @ return the new cp friendly url entry */ public static com . liferay . commerce . product . model . CPFriendlyURLEntry createCPFriendlyURLEntry ( long CPFriendlyURLEntryId ) { } }
return getService ( ) . createCPFriendlyURLEntry ( CPFriendlyURLEntryId ) ;
public class BlobStoreWriter { /** * Call this after all the data has been added . */ public void finish ( ) throws IOException , SymmetricKeyException { } }
if ( outStream != null ) { if ( encryptor != null ) outStream . write ( encryptor . encrypt ( null ) ) ; // FileOutputStream is also closed cascadingly outStream . close ( ) ; outStream = null ; // Only create the key if we got all the data successfully blobKey = new BlobKey ( sha1Digest . digest ( ) ) ; md5DigestResult = md5Digest . digest ( ) ; }
public class ApiOvhRouter { /** * Add a network to your router * REST : POST / router / { serviceName } / network * @ param ipNet [ required ] Gateway IP / CIDR Netmask , ( e . g . 192.168.1.254/24) * @ param description [ required ] * @ param vlanTag [ required ] Vlan tag from range 1 to 4094 or NULL for untagged traffic * @ param serviceName [ required ] The internal name of your Router offer */ public OvhTask serviceName_network_POST ( String serviceName , String description , String ipNet , Long vlanTag ) throws IOException { } }
String qPath = "/router/{serviceName}/network" ; StringBuilder sb = path ( qPath , serviceName ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "description" , description ) ; addBody ( o , "ipNet" , ipNet ) ; addBody ( o , "vlanTag" , vlanTag ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhTask . class ) ;
public class MathUtil { /** * Replies the max value . * @ param values are the values to scan . * @ return the max value . */ @ Pure public static int max ( int ... values ) { } }
if ( values == null || values . length == 0 ) { return 0 ; } int max = values [ 0 ] ; for ( final int v : values ) { if ( v > max ) { max = v ; } } return max ;
public class Getter { /** * Returns a { @ code View } with a given id . * @ param id the R . id of the { @ code View } to be returned * @ param index the index of the { @ link View } . { @ code 0 } if only one is available * @ param timeout the timeout in milliseconds * @ return a { @ code View } with a given id */ public View getView ( int id , int index , int timeout ) { } }
return waiter . waitForView ( id , index , timeout ) ;
public class RawResolvedFeatures { /** * Returns an existing instance of { @ link RawResolvedFeatures } or creates a new one that * will be cached on the type . It will not add itself as { @ link EContentAdapter } but use * the { @ link JvmTypeChangeDispatcher } instead . */ static RawResolvedFeatures getResolvedFeatures ( JvmDeclaredType type , CommonTypeComputationServices services ) { } }
final List < Adapter > adapterList = type . eAdapters ( ) ; RawResolvedFeatures adapter = ( RawResolvedFeatures ) EcoreUtil . getAdapter ( adapterList , RawResolvedFeatures . class ) ; if ( adapter != null ) { return adapter ; } final RawResolvedFeatures newAdapter = new RawResolvedFeatures ( type , services ) ; requestNotificationOnChange ( type , new Runnable ( ) { @ Override public void run ( ) { newAdapter . clear ( ) ; adapterList . remove ( newAdapter ) ; } } ) ; adapterList . add ( newAdapter ) ; return newAdapter ;
public class GeocoderWidgetViewImpl { /** * Add handlers */ private void bind ( ) { } }
StopPropagationHandler stopHandler = new StopPropagationHandler ( ) ; flowPanel . addDomHandler ( stopHandler , MouseDownEvent . getType ( ) ) ; flowPanel . addDomHandler ( stopHandler , MouseUpEvent . getType ( ) ) ; flowPanel . addDomHandler ( stopHandler , ClickEvent . getType ( ) ) ; flowPanel . addDomHandler ( stopHandler , DoubleClickEvent . getType ( ) ) ; // add textBox handlers textBox . addKeyPressHandler ( new KeyPressHandler ( ) { public void onKeyPress ( KeyPressEvent event ) { if ( event . getNativeEvent ( ) . getKeyCode ( ) == KeyCodes . KEY_ENTER ) { executeFind ( ) ; } } } ) ; textBox . addClickHandler ( new ClickHandler ( ) { public void onClick ( ClickEvent event ) { if ( messages . findPlaceOnMap ( ) . equals ( textBox . getValue ( ) ) ) { setValue ( null ) ; flowPanel . removeStyleName ( resource . css ( ) . geocoderGadgetTip ( ) ) ; } } } ) ; textBox . addBlurHandler ( new BlurHandler ( ) { public void onBlur ( BlurEvent event ) { if ( textBox . getValue ( ) == null || "" . equals ( textBox . getValue ( ) ) ) { setValue ( messages . findPlaceOnMap ( ) ) ; flowPanel . addStyleName ( resource . css ( ) . geocoderGadgetTip ( ) ) ; } } } ) ; // add magnifying glass handler glass . addClickHandler ( new ClickHandler ( ) { public void onClick ( ClickEvent event ) { executeFind ( ) ; event . stopPropagation ( ) ; } } ) ;
public class AbstractMatrixAligner { /** * methods for MatrixAligner */ @ Override public int [ ] [ ] [ ] getScoreMatrix ( ) { } }
boolean tempStoringScoreMatrix = storingScoreMatrix ; if ( scores == null ) { storingScoreMatrix = true ; align ( ) ; if ( scores == null ) { return null ; } } int [ ] [ ] [ ] copy = scores ; if ( tempStoringScoreMatrix ) { copy = new int [ scores . length ] [ scores [ 0 ] . length ] [ ] ; for ( int i = 0 ; i < copy . length ; i ++ ) { for ( int j = 0 ; j < copy [ 0 ] . length ; j ++ ) { copy [ i ] [ j ] = Arrays . copyOf ( scores [ i ] [ j ] , scores [ i ] [ j ] . length ) ; } } } setStoringScoreMatrix ( tempStoringScoreMatrix ) ; return copy ;
public class JTSGeometryExpressions { /** * Returns Y minima of a bounding box 2d or 3d or a geometry . * @ param expr geometry * @ return y minima */ public static NumberExpression < Double > ymin ( JTSGeometryExpression < ? > expr ) { } }
return Expressions . numberOperation ( Double . class , SpatialOps . YMIN , expr ) ;
public class IndentationAwareCompletionPrefixProvider { /** * Returns the input to parse including the whitespace left to the cursor position since * it may be relevant to the list of proposals for whitespace sensitive languages . */ @ Override public String getInputToParse ( String completeInput , int offset , int completionOffset ) { } }
int fixedOffset = getOffsetIncludingWhitespace ( completeInput , offset , Math . min ( completeInput . length ( ) , completionOffset ) ) ; return super . getInputToParse ( completeInput , fixedOffset , completionOffset ) ;
public class TmdbPeople { /** * Get the movie credits for a specific person id . * @ param personId * @ param language * @ return * @ throws MovieDbException */ public PersonCreditList < CreditMovieBasic > getPersonMovieCredits ( int personId , String language ) throws MovieDbException { } }
TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . ID , personId ) ; parameters . add ( Param . LANGUAGE , language ) ; URL url = new ApiUrl ( apiKey , MethodBase . PERSON ) . subMethod ( MethodSub . MOVIE_CREDITS ) . buildUrl ( parameters ) ; String webpage = httpTools . getRequest ( url ) ; try { TypeReference tr = new TypeReference < PersonCreditList < CreditMovieBasic > > ( ) { } ; return MAPPER . readValue ( webpage , tr ) ; } catch ( IOException ex ) { throw new MovieDbException ( ApiExceptionType . MAPPING_FAILED , "Failed to get person movie credits" , url , ex ) ; }
public class JavaParser { /** * $ ANTLR start synpred135 _ Java */ public final void synpred135_Java_fragment ( ) throws RecognitionException { } }
// src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 656:9 : ( classDeclaration ( ' ; ' ) ? ) // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 656:9 : classDeclaration ( ' ; ' ) ? { pushFollow ( FOLLOW_classDeclaration_in_synpred135_Java2582 ) ; classDeclaration ( ) ; state . _fsp -- ; if ( state . failed ) return ; // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 656:26 : ( ' ; ' ) ? int alt208 = 2 ; int LA208_0 = input . LA ( 1 ) ; if ( ( LA208_0 == 52 ) ) { alt208 = 1 ; } switch ( alt208 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 656:26 : ' ; ' { match ( input , 52 , FOLLOW_52_in_synpred135_Java2584 ) ; if ( state . failed ) return ; } break ; } }
public class Journal { /** * Truncate the journal , removing all log files . Please note truncate * requires the journal to be closed . * @ throws IOException * @ throws OpenJournalException */ public synchronized void truncate ( ) throws OpenJournalException , IOException { } }
if ( ! opened ) { for ( DataFile file : dataFiles . values ( ) ) { removeDataFile ( file ) ; } } else { throw new OpenJournalException ( "The journal is open! The journal must be closed to be truncated." ) ; }
public class QRDecomposition { /** * Return the upper triangular factor * @ return R */ public Matrix getR ( ) { } }
Matrix X = new Matrix ( n , n ) ; double [ ] [ ] R = X . getArray ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i < j ) { R [ i ] [ j ] = QR [ i ] [ j ] ; } else if ( i == j ) { R [ i ] [ j ] = Rdiag [ i ] ; } else { R [ i ] [ j ] = 0.0 ; } } } return X ;
public class ContainerNode { /** * This method adds the properties for this node to the * supplied set . * @ param allProperties The aggregated set of properties */ @ Override protected void includeProperties ( Set < Property > allProperties ) { } }
super . includeProperties ( allProperties ) ; nodes . forEach ( n -> n . includeProperties ( allProperties ) ) ;
public class PathHelper { /** * Get the canonical file of the passed file , if the file is not * < code > null < / code > . * @ param aFile * The file to get the canonical path from . May be < code > null < / code > . * @ return < code > null < / code > if the passed file is < code > null < / code > . * @ throws IOException * If an I / O error occurs , which is possible because the construction * of the canonical pathname may require filesystem queries */ @ Nullable public static Path getCanonicalFile ( @ Nullable final Path aFile ) throws IOException { } }
return aFile == null ? null : aFile . toRealPath ( ) ;
public class StoredProcedure { /** * Compares two values . Treats null as equal and is case insensitive * @ param value1 First value to compare * @ param value2 Second value to compare * @ return true if two values equals */ private boolean equalsNull ( String value1 , String value2 ) { } }
return ( value1 == value2 || value1 == null || ( value1 != null && value1 . equalsIgnoreCase ( value2 ) ) ) ;
public class OWLDisjointObjectPropertiesAxiomImpl_CustomFieldSerializer { /** * Serializes the content of the object into the * { @ link com . google . gwt . user . client . rpc . SerializationStreamWriter } . * @ param streamWriter the { @ link com . google . gwt . user . client . rpc . SerializationStreamWriter } to write the * object ' s content to * @ param instance the object instance to serialize * @ throws com . google . gwt . user . client . rpc . SerializationException * if the serialization operation is not * successful */ @ Override public void serializeInstance ( SerializationStreamWriter streamWriter , OWLDisjointObjectPropertiesAxiomImpl instance ) throws SerializationException { } }
serialize ( streamWriter , instance ) ;
public class OAbstractFile { /** * ( non - Javadoc ) * @ see com . orientechnologies . orient . core . storage . fs . OFileAAA # removeTail ( int ) */ public void removeTail ( int iSizeToShrink ) throws IOException { } }
final int filledUpTo = getFilledUpTo ( ) ; if ( filledUpTo < iSizeToShrink ) iSizeToShrink = 0 ; setFilledUpTo ( filledUpTo - iSizeToShrink ) ;
public class LDF { /** * Run the naive kernel density LOF algorithm . * @ param database Database to query * @ param relation Data to process * @ return LOF outlier result */ public OutlierResult run ( Database database , Relation < O > relation ) { } }
StepProgress stepprog = LOG . isVerbose ( ) ? new StepProgress ( "LDF" , 3 ) : null ; final int dim = RelationUtil . dimensionality ( relation ) ; DBIDs ids = relation . getDBIDs ( ) ; LOG . beginStep ( stepprog , 1 , "Materializing neighborhoods w.r.t. distance function." ) ; KNNQuery < O > knnq = DatabaseUtil . precomputedKNNQuery ( database , relation , getDistanceFunction ( ) , k ) ; // Compute LDEs LOG . beginStep ( stepprog , 2 , "Computing LDEs." ) ; WritableDoubleDataStore ldes = DataStoreUtil . makeDoubleStorage ( ids , DataStoreFactory . HINT_HOT | DataStoreFactory . HINT_TEMP ) ; FiniteProgress densProgress = LOG . isVerbose ( ) ? new FiniteProgress ( "Densities" , ids . size ( ) , LOG ) : null ; for ( DBIDIter it = ids . iter ( ) ; it . valid ( ) ; it . advance ( ) ) { final KNNList neighbors = knnq . getKNNForDBID ( it , k ) ; double sum = 0.0 ; int count = 0 ; // Fast version for double distances for ( DoubleDBIDListIter neighbor = neighbors . iter ( ) ; neighbor . valid ( ) ; neighbor . advance ( ) ) { if ( DBIDUtil . equal ( neighbor , it ) ) { continue ; } final double nkdist = knnq . getKNNForDBID ( neighbor , k ) . getKNNDistance ( ) ; if ( ! ( nkdist > 0. ) || nkdist == Double . POSITIVE_INFINITY ) { sum = Double . POSITIVE_INFINITY ; count ++ ; break ; } final double v = MathUtil . max ( nkdist , neighbor . doubleValue ( ) ) / ( h * nkdist ) ; sum += kernel . density ( v ) / MathUtil . powi ( h * nkdist , dim ) ; count ++ ; } ldes . putDouble ( it , sum / count ) ; LOG . incrementProcessed ( densProgress ) ; } LOG . ensureCompleted ( densProgress ) ; // Compute local density factors . LOG . beginStep ( stepprog , 3 , "Computing LDFs." ) ; WritableDoubleDataStore ldfs = DataStoreUtil . makeDoubleStorage ( ids , DataStoreFactory . HINT_STATIC ) ; // track the maximum value for normalization . DoubleMinMax lofminmax = new DoubleMinMax ( ) ; FiniteProgress progressLOFs = LOG . isVerbose ( ) ? new FiniteProgress ( "Local Density Factors" , ids . size ( ) , LOG ) : null ; for ( DBIDIter it = ids . iter ( ) ; it . valid ( ) ; it . advance ( ) ) { final double lrdp = ldes . doubleValue ( it ) ; final KNNList neighbors = knnq . getKNNForDBID ( it , k ) ; double sum = 0.0 ; int count = 0 ; for ( DBIDIter neighbor = neighbors . iter ( ) ; neighbor . valid ( ) ; neighbor . advance ( ) ) { // skip the point itself if ( DBIDUtil . equal ( neighbor , it ) ) { continue ; } sum += ldes . doubleValue ( neighbor ) ; count ++ ; } sum /= count ; final double div = lrdp + c * sum ; double ldf = div == Double . POSITIVE_INFINITY ? ( sum < Double . POSITIVE_INFINITY ? 0. : 1 ) : ( div > 0 ) ? sum / div : 0 ; ldfs . putDouble ( it , ldf ) ; // update minimum and maximum lofminmax . put ( ldf ) ; LOG . incrementProcessed ( progressLOFs ) ; } LOG . ensureCompleted ( progressLOFs ) ; LOG . setCompleted ( stepprog ) ; // Build result representation . DoubleRelation scoreResult = new MaterializedDoubleRelation ( "Local Density Factor" , "ldf-outlier" , ldfs , ids ) ; OutlierScoreMeta scoreMeta = new BasicOutlierScoreMeta ( lofminmax . getMin ( ) , lofminmax . getMax ( ) , 0.0 , 1. / c , 1 / ( 1 + c ) ) ; OutlierResult result = new OutlierResult ( scoreMeta , scoreResult ) ; return result ;
public class TypeRegistry { /** * Retrieves the registered alias for the provided { @ link Class } . */ public String getClassAlias ( Class clazz ) { } }
if ( clazz == null ) return null ; TypeEncoder < ? , U > encoder = classMapping . get ( clazz ) ; if ( encoder != null ) return encoder . getAlias ( ) ; return null ;
public class PredictionsImpl { /** * Predict an image url and saves the result . * @ param projectId The project id * @ param predictImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the ImagePrediction object */ public Observable < ImagePrediction > predictImageUrlAsync ( UUID projectId , PredictImageUrlOptionalParameter predictImageUrlOptionalParameter ) { } }
return predictImageUrlWithServiceResponseAsync ( projectId , predictImageUrlOptionalParameter ) . map ( new Func1 < ServiceResponse < ImagePrediction > , ImagePrediction > ( ) { @ Override public ImagePrediction call ( ServiceResponse < ImagePrediction > response ) { return response . body ( ) ; } } ) ;
public class VmwareIaasHandler { /** * ( non - Javadoc ) * @ see net . roboconf . target . api . TargetHandler * # isMachineRunning ( net . roboconf . target . api . TargetHandlerParameters , java . lang . String ) */ @ Override public boolean isMachineRunning ( TargetHandlerParameters parameters , String machineId ) throws TargetException { } }
boolean result ; try { final ServiceInstance vmwareServiceInstance = getServiceInstance ( parameters . getTargetProperties ( ) ) ; VirtualMachine vm = getVirtualMachine ( vmwareServiceInstance , machineId ) ; result = vm != null ; } catch ( Exception e ) { throw new TargetException ( e ) ; } return result ;
public class ListServerCertificatesResult { /** * A list of server certificates . * @ return A list of server certificates . */ public java . util . List < ServerCertificateMetadata > getServerCertificateMetadataList ( ) { } }
if ( serverCertificateMetadataList == null ) { serverCertificateMetadataList = new com . amazonaws . internal . SdkInternalList < ServerCertificateMetadata > ( ) ; } return serverCertificateMetadataList ;
public class PieChart { /** * This is the main entry point after the graph has been inflated . Used to initialize the graph * and its corresponding members . */ @ Override protected void initializeGraph ( ) { } }
super . initializeGraph ( ) ; Utils . setLayerToSW ( this ) ; mPieData = new ArrayList < PieModel > ( ) ; mTotalValue = 0 ; mGraphPaint = new Paint ( Paint . ANTI_ALIAS_FLAG ) ; mLegendPaint = new Paint ( Paint . ANTI_ALIAS_FLAG ) ; mLegendPaint . setTextSize ( mLegendTextSize ) ; mLegendPaint . setColor ( mLegendColor ) ; mLegendPaint . setStyle ( Paint . Style . FILL ) ; mValuePaint = new Paint ( Paint . ANTI_ALIAS_FLAG ) ; mValuePaint . setTextSize ( mValueTextSize ) ; mValuePaint . setColor ( mValueTextColor ) ; mValuePaint . setStyle ( Paint . Style . FILL ) ; mGraph . rotateTo ( mPieRotation ) ; mGraph . decelerate ( ) ; mRevealAnimator = ValueAnimator . ofFloat ( 0 , 1 ) ; mRevealAnimator . addUpdateListener ( new ValueAnimator . AnimatorUpdateListener ( ) { @ Override public void onAnimationUpdate ( ValueAnimator animation ) { mRevealValue = animation . getAnimatedFraction ( ) ; invalidateGlobal ( ) ; } } ) ; mRevealAnimator . addListener ( new Animator . AnimatorListener ( ) { @ Override public void onAnimationStart ( Animator animation ) { } @ Override public void onAnimationEnd ( Animator animation ) { mStartedAnimation = false ; } @ Override public void onAnimationCancel ( Animator animation ) { } @ Override public void onAnimationRepeat ( Animator animation ) { } } ) ; if ( mUsePieRotation ) { // Set up an animator to animate the PieRotation property . This is used to // correct the pie ' s orientation after the user lets go of it . mAutoCenterAnimator = ObjectAnimator . ofInt ( PieChart . this , "PieRotation" , 0 ) ; // Add a listener to hook the onAnimationEnd event so that we can do // some cleanup when the pie stops moving . mAutoCenterAnimator . addListener ( new Animator . AnimatorListener ( ) { public void onAnimationStart ( Animator animator ) { } public void onAnimationEnd ( Animator animator ) { mGraph . decelerate ( ) ; } public void onAnimationCancel ( Animator animator ) { } public void onAnimationRepeat ( Animator animator ) { } } ) ; // Create a Scroller to handle the fling gesture . if ( Build . VERSION . SDK_INT < 11 ) { mScroller = new Scroller ( getContext ( ) ) ; } else { mScroller = new Scroller ( getContext ( ) , null , true ) ; } // The scroller doesn ' t have any built - in animation functions - - it just supplies // values when we ask it to . So we have to have a way to call it every frame // until the fling ends . This code ( ab ) uses a ValueAnimator object to generate // a callback on every animation frame . We don ' t use the animated value at all . mScrollAnimator = ValueAnimator . ofFloat ( 0 , 1 ) ; mScrollAnimator . addUpdateListener ( new ValueAnimator . AnimatorUpdateListener ( ) { public void onAnimationUpdate ( ValueAnimator valueAnimator ) { tickScrollAnimation ( ) ; } } ) ; // Create a gesture detector to handle onTouch messages mDetector = new GestureDetector ( PieChart . this . getContext ( ) , new GestureListener ( ) ) ; // Turn off long press - - this control doesn ' t use it , and if long press is enabled , // you can ' t scroll for a bit , pause , then scroll some more ( the pause is interpreted // as a long press , apparently ) mDetector . setIsLongpressEnabled ( false ) ; } if ( this . isInEditMode ( ) ) { addPieSlice ( new PieModel ( "Breakfast" , 15 , Color . parseColor ( "#FE6DA8" ) ) ) ; addPieSlice ( new PieModel ( "Lunch" , 25 , Color . parseColor ( "#56B7F1" ) ) ) ; addPieSlice ( new PieModel ( "Dinner" , 35 , Color . parseColor ( "#CDA67F" ) ) ) ; addPieSlice ( new PieModel ( "Snack" , 25 , Color . parseColor ( "#FED70E" ) ) ) ; }
public class ClientStatsContext { /** * Return a map of { @ link ClientStats } by procedure name . This will * roll up { @ link ClientStats } instances by connection id . Each * { @ link ClientStats } instance will apply to the time period * currently covered by the context . * @ return A map from procedure name to { @ link ClientStats } instances . */ public Map < String , ClientStats > getStatsByProc ( ) { } }
Map < Long , Map < String , ClientStats > > complete = getCompleteStats ( ) ; Map < String , ClientStats > retval = new TreeMap < String , ClientStats > ( ) ; for ( Entry < Long , Map < String , ClientStats > > e : complete . entrySet ( ) ) { for ( Entry < String , ClientStats > e2 : e . getValue ( ) . entrySet ( ) ) { ClientStats current = e2 . getValue ( ) ; ClientStats aggregate = retval . get ( current . getProcedureName ( ) ) ; if ( aggregate == null ) { retval . put ( current . getProcedureName ( ) , ( ClientStats ) current . clone ( ) ) ; } else { aggregate . add ( current ) ; } } } return retval ;
public class HtmlTableRendererBase { /** * Render the TBODY section of the html table . See also method encodeInnerHtml . * @ see javax . faces . render . Renderer # encodeChildren ( FacesContext , UIComponent ) */ public void encodeChildren ( FacesContext facesContext , UIComponent component ) throws IOException { } }
RendererUtils . checkParamValidity ( facesContext , component , UIData . class ) ; beforeBody ( facesContext , ( UIData ) component ) ; encodeInnerHtml ( facesContext , component ) ; afterBody ( facesContext , ( UIData ) component ) ;
public class GenericsUtils { /** * 通过反射 , 获得方法返回值泛型参数的实际类型 . 如 : public Map < String , Buyer > getNames ( ) { } * @ param method 方法 * @ param index 泛型参数所在索引 , 从0开始 . * @ return 泛型参数的实际类型 , 如果没有实现ParameterizedType接口 , 即不支持泛型 , 所以直接返回 < code > Object . class < / code > */ public static Class getMethodGenericReturnType ( Method method , int index ) { } }
Type returnType = method . getGenericReturnType ( ) ; if ( returnType instanceof ParameterizedType ) { ParameterizedType type = ( ParameterizedType ) returnType ; Type [ ] typeArguments = type . getActualTypeArguments ( ) ; if ( index >= typeArguments . length || index < 0 ) { throw new IllegalArgumentException ( "index " + ( index < 0 ? " must > 0 " : " over total arguments" ) ) ; } return ( Class ) typeArguments [ index ] ; } return Object . class ;
public class ProjectParsed { /** * Add filter in the correct list . * @ param filter the filter . */ private void decideTypeFilterToAdd ( Filter filter ) { } }
Filter step = filter ; if ( Operator . MATCH == step . getRelation ( ) . getOperator ( ) || step . getRelation ( ) . getRightTerm ( ) instanceof FunctionSelector ) { if ( matchList . isEmpty ( ) ) { matchList = new ArrayList < > ( ) ; } matchList . add ( filter ) ; } else { if ( filterList . isEmpty ( ) ) { filterList = new ArrayList < > ( ) ; } filterList . add ( filter ) ; }
public class IOUtil { /** * Return array with length size , if length is greater than the previous * size , the array is zero - padded at the end . * @ param bytes * @ param length * @ return zero - padded array with length size */ private static byte [ ] padBytes ( byte [ ] bytes , int length ) { } }
byte [ ] padded = new byte [ length ] ; for ( int i = 0 ; i < bytes . length ; i ++ ) { padded [ i ] = bytes [ i ] ; } return padded ;
public class LUDecomposition { /** * Return upper triangular factor * @ return U */ public double [ ] [ ] getU ( ) { } }
double [ ] [ ] U = new double [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { System . arraycopy ( LU [ i ] , i , U [ i ] , i , n - i ) ; } return U ;
public class SimpleNode { /** * Get the text of the tokens comprising this node . */ public String getText ( ) { } }
StringBuilder text = new StringBuilder ( ) ; Token t = firstToken ; while ( t != null ) { text . append ( t . image ) ; if ( ! t . image . equals ( "." ) ) text . append ( " " ) ; if ( t == lastToken || t . image . equals ( "{" ) || t . image . equals ( ";" ) ) break ; t = t . next ; } return text . toString ( ) ;
public class TaggedFileOutputStream { /** * Get the character code set identifier that represents the JVM ' s file * encoding . This should only be called by the class static initializer . * @ return the character code set id or 0 if the code set ID could not be * determined */ private static int acquireFileEncodingCcsid ( ) { } }
// Get the charset represented by file . encoding Charset charset = null ; String fileEncoding = System . getProperty ( "file.encoding" ) ; try { charset = Charset . forName ( fileEncoding ) ; } catch ( Throwable t ) { // Problem with the JVM ' s file . encoding property } int ccsid = getCcsid ( charset ) ; if ( ccsid == 0 ) { System . err . println ( MessageFormat . format ( BootstrapConstants . messages . getString ( "warn.fileEncodingNotFound" ) , fileEncoding ) ) ; } return ccsid ;
public class CodeGenerator { /** * Generates a static code block that populates the formatter map . */ private static MethodSpec indexFormatters ( String methodName , String registerMethodName , Map < LocaleID , ClassName > dateClasses ) { } }
MethodSpec . Builder method = MethodSpec . methodBuilder ( methodName ) . addModifiers ( PRIVATE , STATIC ) ; for ( Map . Entry < LocaleID , ClassName > entry : dateClasses . entrySet ( ) ) { LocaleID localeId = entry . getKey ( ) ; ClassName className = entry . getValue ( ) ; method . addStatement ( "$T.$L(Locale.$L, $L.class)" , CLDR_BASE , registerMethodName , localeId . safe , className ) ; } return method . build ( ) ;
public class SpnegoCredential { /** * Read the contents of the source into a byte array . * @ param source the byte array source * @ return the byte [ ] read from the source or null */ private static byte [ ] consumeByteSourceOrNull ( final ByteSource source ) { } }
try { if ( source == null || source . isEmpty ( ) ) { return null ; } return source . read ( ) ; } catch ( final IOException e ) { LOGGER . warn ( "Could not consume the byte array source" , e ) ; return null ; }
public class JSettingsPanel { /** * GEN - LAST : event _ infoLabelMouseExited */ private void jCheckBoxLimitMaxXValueActionPerformed ( java . awt . event . ActionEvent evt ) // GEN - FIRST : event _ jCheckBoxLimitMaxXValueActionPerformed { } }
// GEN - HEADEREND : event _ jCheckBoxLimitMaxXValueActionPerformed parent . getGraphPanelChart ( ) . getChartSettings ( ) . setPreventXAxisOverScaling ( jCheckBoxLimitMaxXValue . isSelected ( ) ) ; refreshGraphPreview ( ) ;
public class DefaultTokenServices { /** * Is a refresh token supported for this client ( or the global setting if * { @ link # setClientDetailsService ( ClientDetailsService ) clientDetailsService } is not set . * @ param clientAuth the current authorization request * @ return boolean to indicate if refresh token is supported */ protected boolean isSupportRefreshToken ( OAuth2Request clientAuth ) { } }
if ( clientDetailsService != null ) { ClientDetails client = clientDetailsService . loadClientByClientId ( clientAuth . getClientId ( ) ) ; return client . getAuthorizedGrantTypes ( ) . contains ( "refresh_token" ) ; } return this . supportRefreshToken ;
public class RestReportingEngine { /** * { @ inheritDoc } */ @ Override @ GET @ Path ( "/events/count-by-label" ) public int countEventsByLabel ( @ QueryParam ( "earliest" ) String earliest , @ QueryParam ( "label" ) String label ) throws NotAuthorizedException { } }
accessControlUtils . checkAuthorization ( Action . EXECUTE_REPORT , requestContext ) ; SearchCriteria criteria = new SearchCriteria ( ) . setEarliest ( earliest ) . setDetectionPoint ( new DetectionPoint ( null , label ) ) ; return appSensorServer . getEventStore ( ) . findEvents ( criteria ) . size ( ) ;
public class IntervalTree { /** * / * [ deutsch ] * < p > Erzeugt einen Intervallbaum f & uuml ; r den Type { @ code java . util . Date } gef & uuml ; llt mit den angegebenen * vereinfachten Intervallen . < / p > * @ param intervals collection of simple intervals * @ return new interval tree * @ throws ArithmeticException if the count of intervals overflows an int */ public static IntervalTree < Date , SimpleInterval < Date > > onTraditionalTimeLine ( Collection < SimpleInterval < Date > > intervals ) { } }
return IntervalTree . on ( SimpleInterval . onTraditionalTimeLine ( ) . getTimeLine ( ) , intervals ) ;
public class SchemaBuilder { /** * Adds a new { @ link Mapper } . * @ param field the name of the { @ link Mapper } to be added * @ param mapper the builder of the { @ link Mapper } to be added * @ return this with the specified mapper */ public SchemaBuilder mapper ( String field , MapperBuilder < ? , ? > mapper ) { } }
mapperBuilders . put ( field , mapper ) ; return this ;
public class URAPIs_LDAP_NestedGroupBase { /** * Hit the test servlet to see if getUniqueGroupIdsForUser works when supplied with a valid user in a nested group . * This verifies the various required bundles got installed and are working . */ @ Test public void getUniqueGroupIdsForUserInNestedGroup ( ) throws Exception { } }
// This test will only be executed when using physical LDAP server Assume . assumeTrue ( ! LDAPUtils . USE_LOCAL_LDAP_SERVER ) ; String user = getCN ( ) + nestedUser + getSuffix ( ) ; Log . info ( logClass , "getUniqueGroupIdsForUserInNestedGroup" , "Checking with a valid user." ) ; List < String > list = myServlet . getUniqueGroupIdsForUser ( user ) ; assertTrue ( list . contains ( getCN ( ) + topGroup + getSuffix ( ) ) && list . contains ( getCN ( ) + embeddedGroup + getSuffix ( ) ) ) ; assertEquals ( "There should be two entries" , 2 , list . size ( ) ) ;
public class BasicBondGenerator { /** * Make the inner ring bond , which is slightly shorter than the outer bond . * @ param bond the ring bond * @ param ring the ring that the bond is in * @ param model the renderer model * @ return the line element */ public LineElement generateInnerElement ( IBond bond , IRing ring , RendererModel model ) { } }
Point2d center = GeometryUtil . get2DCenter ( ring ) ; Point2d a = bond . getBegin ( ) . getPoint2d ( ) ; Point2d b = bond . getEnd ( ) . getPoint2d ( ) ; // the proportion to move in towards the ring center double distanceFactor = model . getParameter ( TowardsRingCenterProportion . class ) . getValue ( ) ; double ringDistance = distanceFactor * IDEAL_RINGSIZE / ring . getAtomCount ( ) ; if ( ringDistance < distanceFactor / MIN_RINGSIZE_FACTOR ) ringDistance = distanceFactor / MIN_RINGSIZE_FACTOR ; Point2d w = new Point2d ( ) ; w . interpolate ( a , center , ringDistance ) ; Point2d u = new Point2d ( ) ; u . interpolate ( b , center , ringDistance ) ; double alpha = 0.2 ; Point2d ww = new Point2d ( ) ; ww . interpolate ( w , u , alpha ) ; Point2d uu = new Point2d ( ) ; uu . interpolate ( u , w , alpha ) ; double width = getWidthForBond ( bond , model ) ; Color color = getColorForBond ( bond , model ) ; return new LineElement ( u . x , u . y , w . x , w . y , width , color ) ;
public class PersistentExecutorImpl { /** * { @ inheritDoc } */ @ Override public < T > TaskStatus < T > submit ( Callable < T > callable ) { } }
TaskInfo taskInfo = new TaskInfo ( true ) ; taskInfo . initForOneShotTask ( 0l ) ; // run immediately return newTask ( callable , taskInfo , null , null ) ;
public class RedirectTag { /** * Dispatch as forward */ @ Override void dispatch ( RequestDispatcher dispatcher , JspWriter out , HttpServletRequest request , HttpServletResponse response ) throws JspException , IOException { } }
boolean oldForwarded = isForwarded ( request ) ; try { setForwarded ( request , true ) ; try { // Clear the previous JSP out buffer out . clear ( ) ; dispatcher . forward ( request , response ) ; } catch ( ServletException e ) { throw new JspTagException ( e ) ; } Includer . setPageSkipped ( request ) ; throw ServletUtil . SKIP_PAGE_EXCEPTION ; } finally { setForwarded ( request , oldForwarded ) ; }
public class PatternFormatter { /** * Set the pattern that is when formatting . * @ param pattern * the pattern to set * @ throws IllegalArgumentException * if the pattern is null . */ public void setPattern ( String pattern ) throws IllegalArgumentException { } }
if ( pattern == null ) { throw new IllegalArgumentException ( "The pattern must not be null." ) ; } this . pattern = pattern ; parsePattern ( this . pattern ) ;
public class UriTemplate { /** * Creates a new { @ link UriTemplate } with the given { @ link TemplateVariable } added . * @ param variable must not be { @ literal null } . * @ return will never be { @ literal null } . */ public UriTemplate with ( TemplateVariable variable ) { } }
Assert . notNull ( variable , "Template variable must not be null!" ) ; return with ( new TemplateVariables ( variable ) ) ;
public class EventRowMapper { /** * / * ( non - Javadoc ) * @ see org . springframework . jdbc . core . RowMapper # mapRow ( java . sql . ResultSet , int ) */ @ Override public Event mapRow ( ResultSet rs , int rowNum ) throws SQLException { } }
Event event = new Event ( ) ; event . setPersistedId ( rs . getLong ( "ID" ) ) ; event . setTimestamp ( rs . getTimestamp ( "EI_TIMESTAMP" ) ) ; event . setEventType ( EventTypeEnum . valueOf ( rs . getString ( "EI_EVENT_TYPE" ) ) ) ; Originator originator = new Originator ( ) ; originator . setProcessId ( rs . getString ( "ORIG_PROCESS_ID" ) ) ; originator . setIp ( rs . getString ( "ORIG_IP" ) ) ; originator . setHostname ( rs . getString ( "ORIG_HOSTNAME" ) ) ; originator . setCustomId ( rs . getString ( "ORIG_CUSTOM_ID" ) ) ; originator . setPrincipal ( rs . getString ( "ORIG_PRINCIPAL" ) ) ; event . setOriginator ( originator ) ; MessageInfo messageInfo = new MessageInfo ( ) ; messageInfo . setMessageId ( rs . getString ( "MI_MESSAGE_ID" ) ) ; messageInfo . setFlowId ( rs . getString ( "MI_FLOW_ID" ) ) ; messageInfo . setPortType ( rs . getString ( "MI_PORT_TYPE" ) ) ; messageInfo . setOperationName ( rs . getString ( "MI_OPERATION_NAME" ) ) ; messageInfo . setTransportType ( rs . getString ( "MI_TRANSPORT_TYPE" ) ) ; event . setMessageInfo ( messageInfo ) ; event . setContentCut ( rs . getBoolean ( "CONTENT_CUT" ) ) ; try { event . setContent ( IOUtils . toString ( rs . getClob ( "MESSAGE_CONTENT" ) . getAsciiStream ( ) ) ) ; } catch ( IOException e ) { throw new RuntimeException ( "Error reading content" , e ) ; } return event ;
public class CPAttachmentFileEntryPersistenceImpl { /** * Returns the first cp attachment file entry in the ordered set where uuid = & # 63 ; and companyId = & # 63 ; . * @ param uuid the uuid * @ param companyId the company ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the first matching cp attachment file entry * @ throws NoSuchCPAttachmentFileEntryException if a matching cp attachment file entry could not be found */ @ Override public CPAttachmentFileEntry findByUuid_C_First ( String uuid , long companyId , OrderByComparator < CPAttachmentFileEntry > orderByComparator ) throws NoSuchCPAttachmentFileEntryException { } }
CPAttachmentFileEntry cpAttachmentFileEntry = fetchByUuid_C_First ( uuid , companyId , orderByComparator ) ; if ( cpAttachmentFileEntry != null ) { return cpAttachmentFileEntry ; } StringBundler msg = new StringBundler ( 6 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "uuid=" ) ; msg . append ( uuid ) ; msg . append ( ", companyId=" ) ; msg . append ( companyId ) ; msg . append ( "}" ) ; throw new NoSuchCPAttachmentFileEntryException ( msg . toString ( ) ) ;
public class UpdateApplicationRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateApplicationRequest updateApplicationRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateApplicationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateApplicationRequest . getApplicationName ( ) , APPLICATIONNAME_BINDING ) ; protocolMarshaller . marshall ( updateApplicationRequest . getCurrentApplicationVersionId ( ) , CURRENTAPPLICATIONVERSIONID_BINDING ) ; protocolMarshaller . marshall ( updateApplicationRequest . getApplicationUpdate ( ) , APPLICATIONUPDATE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }