signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class SipApplicationSessionImpl { /** * ( non - Javadoc )
* @ see javax . servlet . sip . SipApplicationSession # getSessions ( java . lang . String ) */
public Iterator < ? > getSessions ( String protocol ) { } } | if ( ! isValid ( ) ) { throw new IllegalStateException ( "SipApplicationSession already invalidated !" ) ; } if ( protocol == null ) { throw new NullPointerException ( "protocol given in argument is null" ) ; } if ( "SIP" . equalsIgnoreCase ( protocol ) ) { return getSipSessions ( false ) . iterator ( ) ; } else if ( "HTTP" . equalsIgnoreCase ( protocol ) ) { return getHttpSessions ( ) . iterator ( ) ; } else { throw new IllegalArgumentException ( protocol + " sessions are not handled by this container" ) ; } |
public class ExperimentHelper { /** * This function will calculate the planting date which is the first date
* within the planting window that has an accumulated rainfall amount
* ( P ) in the previous n days .
* @ param data The HashMap of experiment ( including weather data )
* @ param eDate Earliest planting date ( mm - dd or mmdd )
* @ param lDate Latest planting date ( mm - dd or mmdd )
* @ param rain Threshold rainfall amount ( mm )
* @ param days Number of days of accumulation
* @ return An { @ code ArrayList } of { @ code pdate } for each year in the
* weather data . */
public static HashMap < String , ArrayList < String > > getAutoPlantingDate ( HashMap data , String eDate , String lDate , String rain , String days ) { } } | Map wthData ; ArrayList < Map > dailyData ; ArrayList < HashMap < String , String > > eventData ; Event event ; Calendar eDateCal = Calendar . getInstance ( ) ; Calendar lDateCal = Calendar . getInstance ( ) ; int intDays ; int duration ; double accRainAmtTotal ; double accRainAmt ; int expDur ; int startYear = 0 ; Window [ ] windows ; ArrayList < String > pdates = new ArrayList < String > ( ) ; HashMap < String , ArrayList < String > > results = new HashMap < String , ArrayList < String > > ( ) ; // Check input dates
if ( ! isValidDate ( eDate , eDateCal , "-" ) ) { LOG . error ( "INVALID EARLIST DATE:[" + eDate + "]" ) ; return new HashMap < String , ArrayList < String > > ( ) ; } if ( ! isValidDate ( lDate , lDateCal , "-" ) ) { LOG . error ( "INVALID LATEST DATE:[" + lDate + "]" ) ; return new HashMap < String , ArrayList < String > > ( ) ; } if ( eDateCal . after ( lDateCal ) ) { lDateCal . set ( Calendar . YEAR , lDateCal . get ( Calendar . YEAR ) + 1 ) ; } try { duration = Integer . parseInt ( convertMsToDay ( lDateCal . getTimeInMillis ( ) - eDateCal . getTimeInMillis ( ) ) ) ; } catch ( Exception e ) { duration = 0 ; } // Check Number of days of accumulation
try { intDays = Integer . parseInt ( days ) ; } catch ( Exception e ) { LOG . error ( "INVALID NUMBER FOR NUMBER OF DAYS OF ACCUMULATION" ) ; return new HashMap < String , ArrayList < String > > ( ) ; } if ( intDays <= 0 ) { LOG . error ( "NON-POSITIVE NUMBER FOR NUMBER OF DAYS OF ACCUMULATION" ) ; return new HashMap < String , ArrayList < String > > ( ) ; } // Check Threshold rainfall amount
try { accRainAmtTotal = Double . parseDouble ( rain ) ; } catch ( Exception e ) { LOG . error ( "INVALID NUMBER FOR THRESHOLD RAINFALL AMOUNT" ) ; return new HashMap < String , ArrayList < String > > ( ) ; } if ( accRainAmtTotal <= 0 ) { LOG . error ( "NON-POSITIVE NUMBER FOR THRESHOLD RAINFALL AMOUNT" ) ; return new HashMap < String , ArrayList < String > > ( ) ; } // Validation for input parameters
// Weather data check and try to get daily data
dailyData = WeatherHelper . getDailyData ( data ) ; if ( dailyData . isEmpty ( ) ) { LOG . error ( "EMPTY DAILY WEATHER DATA." ) ; return new HashMap < String , ArrayList < String > > ( ) ; } // Check experiment data
// Case for multiple data json structure
Map mgnData = getObjectOr ( data , "management" , new HashMap ( ) ) ; eventData = getObjectOr ( mgnData , "events" , new ArrayList ( ) ) ; // Remove all planting events , for now , as a default . This is because this generates new replaced planting events .
// NOTE : This is the " safest " way to remove items during iteration .
// Iterator < HashMap < String , String > > iter = eventData . iterator ( ) ;
// while ( iter . hasNext ( ) ) {
// if ( getValueOr ( iter . next ( ) , " event " , " " ) . equals ( " planting " ) ) {
// iter . remove ( ) ;
// Check EXP _ DUR is avalaible
try { expDur = Integer . parseInt ( getValueOr ( data , "exp_dur" , "1" ) ) ; } catch ( Exception e ) { expDur = 1 ; } LOG . debug ( "EXP_DUR FOUND: {}" , expDur ) ; // The starting year for multiple year runs may be set with SC _ YEAR .
if ( expDur > 1 ) { try { startYear = Integer . parseInt ( getValueOr ( data , "sc_year" , "" ) . substring ( 0 , 4 ) ) ; } catch ( Exception e ) { LOG . warn ( "Invalid SC_YEAR: {}" , data . get ( "sc_year" ) ) ; startYear = - 99 ; } } LOG . debug ( "START YEAR: {}" , startYear ) ; windows = new Window [ expDur ] ; // Check if there is eventData existing
if ( eventData . isEmpty ( ) ) { LOG . warn ( "EMPTY EVENT DATA." ) ; // event = new Event ( new ArrayList ( ) , " planting " ) ;
} else { event = new Event ( eventData , "planting" ) ; // If only one year is to be simulated , the recorded planting date year will be used ( if available ) .
if ( expDur == 1 ) { if ( event . isEventExist ( ) ) { Map plEvent = event . getCurrentEvent ( ) ; try { startYear = Integer . parseInt ( getValueOr ( plEvent , "date" , "" ) . substring ( 0 , 4 ) ) ; } catch ( Exception e ) { LOG . warn ( "Invalid planting date: {}" , plEvent . get ( "date" ) ) ; startYear = - 99 ; } } else { startYear = - 99 ; } } } int startYearIndex = getStartYearIndex ( dailyData , startYear ) ; // If start year is out of weather data range
if ( startYearIndex == dailyData . size ( ) ) { // If one year duration , then use the first year
if ( expDur == 1 ) { startYearIndex = 0 ; } // If multiple year duration , then report error and end function
else { LOG . error ( "THE START YEAR IS OUT OF DATA RANGE (SC_YEAR:[" + startYear + "]) {}" , startYearIndex ) ; return new HashMap < String , ArrayList < String > > ( ) ; } } // Find the first record which is the ealiest date for the window in each year
int end ; int start = getDailyRecIndex ( dailyData , eDate , startYearIndex , 0 ) ; for ( int i = 0 ; i < windows . length ; i ++ ) { end = getDailyRecIndex ( dailyData , lDate , start , duration ) ; windows [ i ] = new Window ( start , end ) ; if ( i + 1 < windows . length ) { start = getDailyRecIndex ( dailyData , eDate , end , 365 - duration ) ; } } if ( windows [ 0 ] . start == dailyData . size ( ) ) { LOG . warn ( "NO VALID DAILY DATA FOR SEARCH WINDOW" ) ; // return new HashMap < String , ArrayList < String > > ( ) ;
} // Loop each window to try to find appropriate planting date
for ( int i = 0 ; i < windows . length ; i ++ ) { // Check first n days
int last = Math . min ( windows [ i ] . start + intDays , windows [ i ] . end ) ; accRainAmt = 0 ; for ( int j = windows [ i ] . start ; j < last ; j ++ ) { try { accRainAmt += Double . parseDouble ( getValueOr ( dailyData . get ( j ) , "rain" , "0" ) ) ; } catch ( Exception e ) { continue ; } if ( accRainAmt >= accRainAmtTotal ) { LOG . debug ( "1: " + getValueOr ( dailyData . get ( j ) , "w_date" , "" ) + " : " + accRainAmt + ", " + ( accRainAmt >= accRainAmtTotal ) ) ; // event . updateEvent ( " date " , getValueOr ( dailyData . get ( j ) , " w _ date " , " " ) ) ;
// AcePathfinderUtil . insertValue ( ( HashMap ) data , " pdate " , getValueOr ( dailyData . get ( j ) , " w _ date " , " " ) ) ;
pdates . add ( getValueOr ( dailyData . get ( j ) , "w_date" , "" ) ) ; break ; } } if ( accRainAmt >= accRainAmtTotal ) { continue ; } // / / If the window size is smaller than n
// if ( last > windows [ i ] . end ) {
// LOG . info ( " NO APPROPRIATE DATE WAS FOUND FOR NO . " + ( i + 1 ) + " PLANTING EVENT " ) ;
// / / TODO remove one planting event
// / / event . removeEvent ( ) ;
// Check following days
int outIndex = last ; for ( int j = last ; j <= windows [ i ] . end ; j ++ ) { try { accRainAmt -= Double . parseDouble ( getValueOr ( dailyData . get ( j - intDays ) , "rain" , "0" ) ) ; accRainAmt += Double . parseDouble ( getValueOr ( dailyData . get ( j ) , "rain" , "0" ) ) ; } catch ( Exception e ) { continue ; } if ( accRainAmt >= accRainAmtTotal ) { LOG . debug ( "2:" + getValueOr ( dailyData . get ( j ) , "w_date" , "" ) + " : " + accRainAmt + ", " + ( accRainAmt >= accRainAmtTotal ) ) ; // event . updateEvent ( " date " , getValueOr ( dailyData . get ( j ) , " w _ date " , " " ) ) ;
// AcePathfinderUtil . insertValue ( ( HashMap ) data , " pdate " , getValueOr ( dailyData . get ( j ) , " w _ date " , " " ) ) ;
pdates . add ( getValueOr ( dailyData . get ( j ) , "w_date" , "" ) ) ; break ; } outIndex ++ ; } if ( accRainAmt < accRainAmtTotal ) { String lastDay ; if ( startYear > 0 ) { lastDay = ( startYear + i ) + lDate ; } else if ( windows [ i ] . end >= dailyData . size ( ) ) { lastDay = getValueOr ( dailyData . get ( dailyData . size ( ) - 1 ) , "w_date" , "" ) ; } else { lastDay = getValueOr ( dailyData . get ( windows [ i ] . end ) , "w_date" , "" ) ; } LOG . warn ( "Could not find an appropriate day to plant, using {}" , lastDay ) ; pdates . add ( lastDay ) ; } } results . put ( "pdate" , pdates ) ; return results ; |
public class SimpleFileIO { /** * Get the content of the passed file as a string using the system line
* separator . Note : the last line does not end with the passed line separator .
* @ param aFile
* The file to read . May be < code > null < / code > .
* @ param aCharset
* The character set to use . May not be < code > null < / code > .
* @ return < code > null < / code > if the file does not exist , the content
* otherwise . */
@ Nullable public static String getFileAsString ( @ Nullable final File aFile , @ Nonnull final Charset aCharset ) { } } | return aFile == null ? null : StreamHelper . getAllBytesAsString ( FileHelper . getInputStream ( aFile ) , aCharset ) ; |
public class TypedStreamReader { /** * Method called to wrap or convert given conversion - fail exception
* into a full { @ link TypedXMLStreamException } ,
* @ param iae Problem as reported by converter
* @ param lexicalValue Lexical value ( element content , attribute value )
* that could not be converted succesfully . */
protected TypedXMLStreamException _constructTypeException ( IllegalArgumentException iae , String lexicalValue ) { } } | return new TypedXMLStreamException ( lexicalValue , iae . getMessage ( ) , getStartLocation ( ) , iae ) ; |
public class FloatList { /** * Add a new array to the list .
* @ param values values
* @ return was able to add . */
public boolean addArray ( float ... values ) { } } | if ( end + values . length >= this . values . length ) { this . values = grow ( this . values , ( this . values . length + values . length ) * 2 ) ; } System . arraycopy ( values , 0 , this . values , end , values . length ) ; end += values . length ; return true ; |
public class UpgradableLock { /** * Attempt to immediately acquire an exclusive lock .
* @ param locker object trying to become lock owner
* @ return true if acquired */
public final boolean tryLockForWrite ( L locker ) { } } | int state = mState ; if ( state == 0 ) { // no locks are held
if ( isUpgradeOrReadWriteFirst ( ) && setWriteLock ( state ) ) { // keep upgrade state bit clear to indicate automatic upgrade
mOwner = locker ; incrementUpgradeCount ( ) ; incrementWriteCount ( ) ; return true ; } } else if ( state == LOCK_STATE_UPGRADE ) { // only upgrade lock is held ; upgrade to full write lock
if ( mOwner == locker && setWriteLock ( state ) ) { incrementWriteCount ( ) ; return true ; } } else if ( state < 0 ) { // write lock is held , and upgrade lock might be held too
if ( mOwner == locker ) { incrementWriteCount ( ) ; return true ; } } return false ; |
public class DefaultPDUSender { /** * ( non - Javadoc )
* @ see org . jsmpp . PDUSender # sendQuerySm ( java . io . OutputStream , int ,
* java . lang . String , org . jsmpp . TypeOfNumber ,
* org . jsmpp . NumberingPlanIndicator , java . lang . String ) */
public byte [ ] sendQuerySm ( OutputStream os , int sequenceNumber , String messageId , TypeOfNumber sourceAddrTon , NumberingPlanIndicator sourceAddrNpi , String sourceAddr ) throws PDUStringException , IOException { } } | byte [ ] b = pduComposer . querySm ( sequenceNumber , messageId , sourceAddrTon . value ( ) , sourceAddrNpi . value ( ) , sourceAddr ) ; writeAndFlush ( os , b ) ; return b ; |
public class ElementMatchers { /** * Exactly matches a given annotation as an { @ link AnnotationDescription } .
* @ param annotation The annotation to match by its description .
* @ param < T > The type of the matched object .
* @ return An element matcher that exactly matches the given annotation . */
public static < T extends AnnotationDescription > ElementMatcher . Junction < T > is ( Annotation annotation ) { } } | return is ( AnnotationDescription . ForLoadedAnnotation . of ( annotation ) ) ; |
public class BinaryHeapPriorityQueue { /** * Get the priority of a key - - if the key is not in the queue , Double . NEGATIVE _ INFINITY is returned . */
public double getPriority ( E key ) { } } | Entry < E > entry = getEntry ( key ) ; if ( entry == null ) { return Double . NEGATIVE_INFINITY ; } return entry . priority ; |
public class FSImageCompression { /** * Create a compression instance based on the user ' s configuration in the given
* Configuration object .
* @ throws IOException if the specified codec is not available . */
static FSImageCompression createCompression ( Configuration conf , boolean forceUncompressed ) throws IOException { } } | boolean compressImage = ( ! forceUncompressed ) && conf . getBoolean ( HdfsConstants . DFS_IMAGE_COMPRESS_KEY , HdfsConstants . DFS_IMAGE_COMPRESS_DEFAULT ) ; if ( ! compressImage ) { return createNoopCompression ( ) ; } String codecClassName = conf . get ( HdfsConstants . DFS_IMAGE_COMPRESSION_CODEC_KEY , HdfsConstants . DFS_IMAGE_COMPRESSION_CODEC_DEFAULT ) ; return createCompression ( conf , codecClassName ) ; |
public class BatchGetCrawlersResult { /** * A list of names of crawlers not found .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setCrawlersNotFound ( java . util . Collection ) } or { @ link # withCrawlersNotFound ( java . util . Collection ) } if you
* want to override the existing values .
* @ param crawlersNotFound
* A list of names of crawlers not found .
* @ return Returns a reference to this object so that method calls can be chained together . */
public BatchGetCrawlersResult withCrawlersNotFound ( String ... crawlersNotFound ) { } } | if ( this . crawlersNotFound == null ) { setCrawlersNotFound ( new java . util . ArrayList < String > ( crawlersNotFound . length ) ) ; } for ( String ele : crawlersNotFound ) { this . crawlersNotFound . add ( ele ) ; } return this ; |
public class VirtualFile { /** * called after writing to commit that writing succeeded up to position .
* If position > size the size is updated .
* @ param pos */
void commit ( ByteBuffer bb ) { } } | content . limit ( Math . max ( content . limit ( ) , bb . position ( ) ) ) ; boolean removed = refSet . removeItem ( content , bb ) ; assert removed ; |
public class BitWriter { /** * Writes a single bit to the buffer .
* @ param bit
* 0 or 1
* @ throws EncodingException
* if the input is neither 0 nor 1. */
public void writeBit ( final int bit ) throws EncodingException { } } | if ( bit != 0 && bit != 1 ) { throw ErrorFactory . createEncodingException ( ErrorKeys . DIFFTOOL_ENCODING_VALUE_OUT_OF_RANGE , "bit value out of range: " + bit ) ; } this . buffer |= bit << ( 7 - this . bufferLength ) ; this . bufferLength ++ ; if ( bufferLength == 8 ) { write ( buffer ) ; this . bufferLength = 0 ; this . buffer = 0 ; } |
public class Multimaps2 { /** * Constructs an empty { @ code ListMultimap } with enough capacity to hold the specified numbers of keys and values
* without resizing . It uses a linked map internally .
* @ param expectedKeys
* the expected number of distinct keys
* @ param expectedValuesPerKey
* the expected average number of values per key
* @ throws IllegalArgumentException
* if { @ code expectedKeys } or { @ code expectedValuesPerKey } is negative */
public static < K , V > ListMultimap < K , V > newLinkedHashListMultimap ( int expectedKeys , final int expectedValuesPerKey ) { } } | return Multimaps . newListMultimap ( new LinkedHashMap < K , Collection < V > > ( expectedKeys ) , new Supplier < List < V > > ( ) { @ Override public List < V > get ( ) { return Lists . newArrayListWithCapacity ( expectedValuesPerKey ) ; } } ) ; |
public class Main { /** * Compile JavaScript source . */
public void processSource ( String [ ] filenames ) { } } | for ( int i = 0 ; i != filenames . length ; ++ i ) { String filename = filenames [ i ] ; if ( ! filename . endsWith ( ".js" ) ) { addError ( "msg.extension.not.js" , filename ) ; return ; } File f = new File ( filename ) ; String source = readSource ( f ) ; if ( source == null ) return ; String mainClassName = targetName ; if ( mainClassName == null ) { String name = f . getName ( ) ; String nojs = name . substring ( 0 , name . length ( ) - 3 ) ; mainClassName = getClassName ( nojs ) ; } if ( targetPackage . length ( ) != 0 ) { mainClassName = targetPackage + "." + mainClassName ; } Object [ ] compiled = compiler . compileToClassFiles ( source , filename , 1 , mainClassName ) ; if ( compiled == null || compiled . length == 0 ) { return ; } File targetTopDir = null ; if ( destinationDir != null ) { targetTopDir = new File ( destinationDir ) ; } else { String parent = f . getParent ( ) ; if ( parent != null ) { targetTopDir = new File ( parent ) ; } } for ( int j = 0 ; j != compiled . length ; j += 2 ) { String className = ( String ) compiled [ j ] ; byte [ ] bytes = ( byte [ ] ) compiled [ j + 1 ] ; File outfile = getOutputFile ( targetTopDir , className ) ; try { FileOutputStream os = new FileOutputStream ( outfile ) ; try { os . write ( bytes ) ; } finally { os . close ( ) ; } } catch ( IOException ioe ) { addFormatedError ( ioe . toString ( ) ) ; } } } |
public class BounceProxyRecord { /** * Sets the status of the bounce proxy .
* @ param status the status of the bounce proxy
* @ throws IllegalStateException
* if setting this status is not possible for the current bounce
* proxy status . */
public void setStatus ( BounceProxyStatus status ) throws IllegalStateException { } } | // this checks if the transition is valid
if ( this . status . isValidTransition ( status ) ) { this . status = status ; } else { throw new IllegalStateException ( "Illegal status transition from " + this . status + " to " + status ) ; } |
public class Futures { /** * Gets a future result with a default timeout .
* @ param future the future to block
* @ param timeout the future timeout
* @ param timeUnit the future timeout time unit
* @ param < T > the future result type
* @ return the future result
* @ throws RuntimeException if a future exception occurs */
public static < T > T get ( Future < T > future , long timeout , TimeUnit timeUnit ) { } } | try { return future . get ( timeout , timeUnit ) ; } catch ( InterruptedException | ExecutionException | TimeoutException e ) { throw new RuntimeException ( e ) ; } |
public class IntArrayList { /** * Increases the capacity of this < tt > ArrayList < / tt > instance , if
* necessary , to ensure that it can hold at least the number of elements
* specified by the minimum capacity argument .
* @ param minCapacity the desired minimum capacity . */
public void ensureCapacity ( int minCapacity ) { } } | modCount ++ ; int oldCapacity = elementData . length ; if ( minCapacity > oldCapacity ) { int oldData [ ] = elementData ; int newCapacity = ( oldCapacity * 3 ) / 2 + 1 ; if ( newCapacity < minCapacity ) newCapacity = minCapacity ; elementData = new int [ newCapacity ] ; System . arraycopy ( oldData , 0 , elementData , 0 , size ) ; } |
public class AndroidMobileCommandHelper { /** * This method forms a { @ link Map } of parameters for the setting of device network connection .
* @ param bitMask The bitmask of the desired connection
* @ return a key - value pair . The key is the command name . The value is a { @ link Map } command arguments . */
public static Map . Entry < String , Map < String , ? > > setConnectionCommand ( long bitMask ) { } } | String [ ] parameters = new String [ ] { "name" , "parameters" } ; Object [ ] values = new Object [ ] { "network_connection" , ImmutableMap . of ( "type" , bitMask ) } ; return new AbstractMap . SimpleEntry < > ( SET_NETWORK_CONNECTION , prepareArguments ( parameters , values ) ) ; |
public class SoftTFIDFDictionary { /** * Insert a string into the dictionary , and associate it with the
* given value . */
public void put ( String string , Object value ) { } } | if ( frozen ) throw new IllegalStateException ( "can't add new values to a frozen dictionary" ) ; Set valset = ( Set ) valueMap . get ( string ) ; if ( valset == null ) valueMap . put ( string , ( valset = new HashSet ( ) ) ) ; valset . add ( value ) ; |
public class VirtualMachineScaleSetsInner { /** * Starts one or more virtual machines in a VM scale set .
* @ param resourceGroupName The name of the resource group .
* @ param vmScaleSetName The name of the VM scale set .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the OperationStatusResponseInner object */
public Observable < OperationStatusResponseInner > beginStartAsync ( String resourceGroupName , String vmScaleSetName ) { } } | return beginStartWithServiceResponseAsync ( resourceGroupName , vmScaleSetName ) . map ( new Func1 < ServiceResponse < OperationStatusResponseInner > , OperationStatusResponseInner > ( ) { @ Override public OperationStatusResponseInner call ( ServiceResponse < OperationStatusResponseInner > response ) { return response . body ( ) ; } } ) ; |
public class SarlFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EObject create ( EClass eClass ) { } } | switch ( eClass . getClassifierID ( ) ) { case SarlPackage . SARL_SCRIPT : return createSarlScript ( ) ; case SarlPackage . SARL_FIELD : return createSarlField ( ) ; case SarlPackage . SARL_BREAK_EXPRESSION : return createSarlBreakExpression ( ) ; case SarlPackage . SARL_CONTINUE_EXPRESSION : return createSarlContinueExpression ( ) ; case SarlPackage . SARL_ASSERT_EXPRESSION : return createSarlAssertExpression ( ) ; case SarlPackage . SARL_ACTION : return createSarlAction ( ) ; case SarlPackage . SARL_CONSTRUCTOR : return createSarlConstructor ( ) ; case SarlPackage . SARL_BEHAVIOR_UNIT : return createSarlBehaviorUnit ( ) ; case SarlPackage . SARL_CAPACITY_USES : return createSarlCapacityUses ( ) ; case SarlPackage . SARL_REQUIRED_CAPACITY : return createSarlRequiredCapacity ( ) ; case SarlPackage . SARL_CLASS : return createSarlClass ( ) ; case SarlPackage . SARL_INTERFACE : return createSarlInterface ( ) ; case SarlPackage . SARL_ENUMERATION : return createSarlEnumeration ( ) ; case SarlPackage . SARL_ANNOTATION_TYPE : return createSarlAnnotationType ( ) ; case SarlPackage . SARL_ENUM_LITERAL : return createSarlEnumLiteral ( ) ; case SarlPackage . SARL_EVENT : return createSarlEvent ( ) ; case SarlPackage . SARL_CASTED_EXPRESSION : return createSarlCastedExpression ( ) ; case SarlPackage . SARL_SPACE : return createSarlSpace ( ) ; case SarlPackage . SARL_ARTIFACT : return createSarlArtifact ( ) ; case SarlPackage . SARL_AGENT : return createSarlAgent ( ) ; case SarlPackage . SARL_CAPACITY : return createSarlCapacity ( ) ; case SarlPackage . SARL_BEHAVIOR : return createSarlBehavior ( ) ; case SarlPackage . SARL_SKILL : return createSarlSkill ( ) ; case SarlPackage . SARL_FORMAL_PARAMETER : return createSarlFormalParameter ( ) ; default : throw new IllegalArgumentException ( "The class '" + eClass . getName ( ) + "' is not a valid classifier" ) ; } |
public class StaticLog { /** * 打印日志 < br >
* @ param level 日志级别
* @ param t 需在日志中堆栈打印的异常
* @ param format 格式文本 , { } 代表变量
* @ param arguments 变量对应的参数
* @ return 是否为LocationAwareLog日志 */
public static boolean log ( Level level , Throwable t , String format , Object ... arguments ) { } } | return log ( LogFactory . get ( CallerUtil . getCallerCaller ( ) ) , level , t , format , arguments ) ; |
public class EmbeddableUOWManagerImpl { /** * ( non - Javadoc )
* @ see com . ibm . wsspi . uow . UOWManager # getUOWTimeout ( ) */
@ Override public int getUOWTimeout ( ) throws IllegalStateException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getUOWTimeout" , this ) ; final int timeout ; final int uowType = getUOWType ( ) ; switch ( uowType ) { case UOWSynchronizationRegistry . UOW_TYPE_GLOBAL_TRANSACTION : try { timeout = ( ( EmbeddableTransactionImpl ) getUOWScope ( ) ) . getTimeout ( ) ; } catch ( SystemException e ) { final IllegalStateException ise = new IllegalStateException ( e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getUOWTimeout" , ise ) ; throw ise ; } break ; default : final IllegalStateException ise = new IllegalStateException ( "Invalid UOW type: " + uowType ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getUOWTimeout" , ise ) ; throw ise ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getUOWTimeout" , new Integer ( timeout ) ) ; return timeout ; |
public class RestProxy { /** * Create a proxy implementation of the provided Swagger interface .
* @ param swaggerInterface the Swagger interface to provide a proxy implementation for
* @ param serviceClient the ServiceClient that contains the details to use to create the
* RestProxy implementation of the swagger interface
* @ param < A > the type of the Swagger interface
* @ return a proxy implementation of the provided Swagger interface */
@ SuppressWarnings ( "unchecked" ) public static < A > A create ( Class < A > swaggerInterface , ServiceClient serviceClient ) { } } | return create ( swaggerInterface , serviceClient . httpPipeline ( ) , serviceClient . serializerAdapter ( ) ) ; |
public class QueryImpl { /** * This method simply forwards the < code > execute < / code > call to the
* { @ link ExecutableQuery } object returned by
* { @ link QueryHandler # createExecutableQuery } .
* { @ inheritDoc } */
public QueryResult execute ( ) throws RepositoryException { } } | checkInitialized ( ) ; long time = 0 ; if ( log . isDebugEnabled ( ) ) { time = System . currentTimeMillis ( ) ; } QueryResult result = query . execute ( offset , limit , caseInsensitiveOrder ) ; if ( log . isDebugEnabled ( ) ) { time = System . currentTimeMillis ( ) - time ; NumberFormat format = NumberFormat . getNumberInstance ( ) ; format . setMinimumFractionDigits ( 2 ) ; format . setMaximumFractionDigits ( 2 ) ; String seconds = format . format ( ( double ) time / 1000 ) ; log . debug ( "executed in " + seconds + " s. (" + statement + ")" ) ; } return result ; |
public class Base64 { /** * Convenience method for reading a base64 - encoded file and decoding it .
* @ param filename
* Filename for reading encoded data
* @ return decoded byte array or null if unsuccessful
* @ since 2.1 */
public static byte [ ] decodeFromFile ( String filename ) { } } | byte [ ] decodedData = null ; Base64 . InputStream bis = null ; try { // Set up some useful variables
java . io . File file = new java . io . File ( filename ) ; byte [ ] buffer = null ; int length = 0 ; int numBytes = 0 ; // Check for size of file
if ( file . length ( ) > Integer . MAX_VALUE ) { return null ; } // end if : file too big for int index
buffer = new byte [ ( int ) file . length ( ) ] ; // Open a stream
bis = new Base64 . InputStream ( new java . io . BufferedInputStream ( new java . io . FileInputStream ( file ) ) , Base64 . DECODE ) ; // Read until done
while ( ( numBytes = bis . read ( buffer , length , 4096 ) ) >= 0 ) length += numBytes ; // Save in a variable to return
decodedData = new byte [ length ] ; System . arraycopy ( buffer , 0 , decodedData , 0 , length ) ; } // end try
catch ( java . io . IOException e ) { } // end catch : IOException
finally { try { if ( bis != null ) bis . close ( ) ; } catch ( Exception e ) { } } // end finally
return decodedData ; |
public class BS { /** * Returns an < code > IfNotExistsFunction < / code > object which represents an < a href =
* " http : / / docs . aws . amazon . com / amazondynamodb / latest / developerguide / Expressions . Modifying . html "
* > if _ not _ exists ( path , operand ) < / a > function call where path refers to that
* of the current path operand ; used for building expressions .
* < pre >
* " if _ not _ exists ( path , operand ) – If the item does not contain an attribute
* at the specified path , then if _ not _ exists evaluates to operand ; otherwise ,
* it evaluates to path . You can use this function to avoid overwriting an
* attribute already present in the item . "
* < / pre >
* @ param defaultValue
* the default value that will be used as the operand to the
* if _ not _ exists function call . */
public IfNotExistsFunction < BS > ifNotExists ( byte [ ] ... defaultValue ) { } } | return new IfNotExistsFunction < BS > ( this , new LiteralOperand ( new LinkedHashSet < byte [ ] > ( Arrays . asList ( defaultValue ) ) ) ) ; |
public class CommerceDiscountPersistenceImpl { /** * Removes all the commerce discounts where uuid = & # 63 ; and companyId = & # 63 ; from the database .
* @ param uuid the uuid
* @ param companyId the company ID */
@ Override public void removeByUuid_C ( String uuid , long companyId ) { } } | for ( CommerceDiscount commerceDiscount : findByUuid_C ( uuid , companyId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( commerceDiscount ) ; } |
public class CommerceTierPriceEntryPersistenceImpl { /** * Returns the last commerce tier price entry in the ordered set where companyId = & # 63 ; .
* @ param companyId the company ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commerce tier price entry
* @ throws NoSuchTierPriceEntryException if a matching commerce tier price entry could not be found */
@ Override public CommerceTierPriceEntry findByCompanyId_Last ( long companyId , OrderByComparator < CommerceTierPriceEntry > orderByComparator ) throws NoSuchTierPriceEntryException { } } | CommerceTierPriceEntry commerceTierPriceEntry = fetchByCompanyId_Last ( companyId , orderByComparator ) ; if ( commerceTierPriceEntry != null ) { return commerceTierPriceEntry ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "companyId=" ) ; msg . append ( companyId ) ; msg . append ( "}" ) ; throw new NoSuchTierPriceEntryException ( msg . toString ( ) ) ; |
public class SideEffectAnalysis { /** * Tries to establish whether { @ code expression } is side - effect free . The heuristics here are very
* conservative . */
public static boolean hasSideEffect ( ExpressionTree expression ) { } } | if ( expression == null ) { return false ; } SideEffectAnalysis analyzer = new SideEffectAnalysis ( ) ; expression . accept ( analyzer , null ) ; return analyzer . hasSideEffect ; |
public class JobGraph { /** * Checks if the job vertex with the given ID is registered with the job graph .
* @ param id
* the ID of the vertex to search for
* @ return < code > true < / code > if a vertex with the given ID is registered with the job graph , < code > false < / code >
* otherwise . */
private boolean includedInJobGraph ( final JobVertexID id ) { } } | if ( this . inputVertices . containsKey ( id ) ) { return true ; } if ( this . outputVertices . containsKey ( id ) ) { return true ; } if ( this . taskVertices . containsKey ( id ) ) { return true ; } return false ; |
public class JvmComponentTypeImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case TypesPackage . JVM_COMPONENT_TYPE__ARRAY_TYPE : return arrayType != null ; } return super . eIsSet ( featureID ) ; |
public class PropertySheetTableModel { /** * Convenience method to get all the properties of one category . */
private List < Property > getPropertiesForCategory ( List < Property > localProperties , String category ) { } } | List < Property > categoryProperties = new ArrayList < Property > ( ) ; for ( Property property : localProperties ) { if ( property . getCategory ( ) != null && property . getCategory ( ) . equals ( category ) ) { categoryProperties . add ( property ) ; } } return categoryProperties ; |
public class SerializerBase { /** * Adds the given attribute to the set of attributes , even if there is
* no currently open element . This is useful if a SAX startPrefixMapping ( )
* should need to add an attribute before the element name is seen .
* @ param uri the URI of the attribute
* @ param localName the local name of the attribute
* @ param rawName the qualified name of the attribute
* @ param type the type of the attribute ( probably CDATA )
* @ param value the value of the attribute
* @ param XSLAttribute true if this attribute is coming from an xsl : attribute element
* @ return true if the attribute was added ,
* false if an existing value was replaced . */
public boolean addAttributeAlways ( String uri , String localName , String rawName , String type , String value , boolean XSLAttribute ) { } } | boolean was_added ; // final int index =
// ( localName = = null | | uri = = null ) ?
// m _ attributes . getIndex ( rawName ) : m _ attributes . getIndex ( uri , localName ) ;
int index ; // if ( localName = = null | | uri = = null ) {
// index = m _ attributes . getIndex ( rawName ) ;
// else {
// index = m _ attributes . getIndex ( uri , localName ) ;
if ( localName == null || uri == null || uri . length ( ) == 0 ) index = m_attributes . getIndex ( rawName ) ; else { index = m_attributes . getIndex ( uri , localName ) ; } if ( index >= 0 ) { /* We ' ve seen the attribute before .
* We may have a null uri or localName , but all
* we really want to re - set is the value anyway . */
m_attributes . setValue ( index , value ) ; was_added = false ; } else { // the attribute doesn ' t exist yet , create it
m_attributes . addAttribute ( uri , localName , rawName , type , value ) ; was_added = true ; } return was_added ; |
public class HtmlUtils { /** * Get a relative URI for { @ code file } from { @ code output } folder . */
static String createRelativeUri ( File file , File output ) { } } | if ( file == null ) { return null ; } try { file = file . getCanonicalFile ( ) ; output = output . getCanonicalFile ( ) ; if ( file . equals ( output ) ) { throw new IllegalArgumentException ( "File path and output folder are the same." ) ; } StringBuilder builder = new StringBuilder ( ) ; while ( ! file . equals ( output ) ) { if ( builder . length ( ) > 0 ) { builder . insert ( 0 , "/" ) ; } builder . insert ( 0 , file . getName ( ) ) ; file = file . getParentFile ( ) . getCanonicalFile ( ) ; } return builder . toString ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } |
public class TcpConnecter { /** * null if the connection was unsuccessful . */
private SocketChannel connect ( ) { } } | try { // Async connect has finished . Check whether an error occurred
boolean finished = fd . finishConnect ( ) ; assert ( finished ) ; return fd ; } catch ( IOException e ) { return null ; } |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertSFNameToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class ValidationAssert { /** * Verifies that actual value is not valid against given schema
* @ throws AssertionError if the actual value is valid against schema */
public void isInvalid ( ) { } } | ValidationResult validateResult = validate ( ) ; if ( validateResult . isValid ( ) ) { throwAssertionError ( shouldBeInvalid ( actual . getSystemId ( ) ) ) ; } |
public class AWSIotClient { /** * Updates a role alias .
* @ param updateRoleAliasRequest
* @ return Result of the UpdateRoleAlias operation returned by the service .
* @ throws ResourceNotFoundException
* The specified resource does not exist .
* @ throws InvalidRequestException
* The request is not valid .
* @ throws ThrottlingException
* The rate exceeds the limit .
* @ throws UnauthorizedException
* You are not authorized to perform this operation .
* @ throws ServiceUnavailableException
* The service is temporarily unavailable .
* @ throws InternalFailureException
* An unexpected error has occurred .
* @ sample AWSIot . UpdateRoleAlias */
@ Override public UpdateRoleAliasResult updateRoleAlias ( UpdateRoleAliasRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateRoleAlias ( request ) ; |
public class Clique { /** * This version assumes relativeIndices array no longer needs to
* be copied . Further it is assumed that it has already been
* checked or assured by construction that relativeIndices
* is sorted . */
private static Clique valueOfHelper ( int [ ] relativeIndices ) { } } | // if clique already exists , return that one
Clique c = new Clique ( ) ; c . relativeIndices = relativeIndices ; return intern ( c ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcTextFontSelect ( ) { } } | if ( ifcTextFontSelectEClass == null ) { ifcTextFontSelectEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 1167 ) ; } return ifcTextFontSelectEClass ; |
public class Bindings { /** * Creates the value to be injected .
* @ param argument the argument
* @ param context the context
* @ param engine the engine
* @ return the created object */
public static Object create ( ActionParameter argument , Context context , ParameterFactories engine ) { } } | RouteParameterHandler handler = BINDINGS . get ( argument . getSource ( ) ) ; if ( handler != null ) { return handler . create ( argument , context , engine ) ; } else { LoggerFactory . getLogger ( Bindings . class ) . warn ( "Unsupported route parameter in method : {}" , argument . getSource ( ) . name ( ) ) ; return null ; } |
public class AbstractFunctionalityGrounding { /** * Asks the channelProducersHelper for a channel with the given parameters ,
* and creates one when there is none available yet . */
public IChannelProducer getProviderChannelFor ( String functionalityName , String clientName , String conversationID ) throws ServiceGroundingException { } } | IChannelProducer channel = this . channelProducersHelper . getChannel ( functionalityName , clientName , conversationID ) ; if ( null != channel && ! ( channel instanceof InternalChannel ) ) { return channel ; } IChannelProducer newChannel = createProviderChannelFor ( functionalityName , clientName , conversationID ) ; this . channelProducersHelper . addChannel ( newChannel , functionalityName , clientName , conversationID ) ; return newChannel ; |
public class VStack { /** * ( non - Javadoc )
* @ see java . util . Collection # isEmpty ( )
* Runtime : 1 voldemort get operation */
public boolean isEmpty ( ) { } } | VListKey < K > newKey = new VListKey < K > ( _key , 0 ) ; Versioned < Map < String , Object > > firstNode = _storeClient . get ( newKey . mapValue ( ) ) ; return firstNode == null ; |
public class StringMessage { /** * UTF - 8 decodes the message . */
public static StringMessage decode ( ByteArray encodedMessage ) { } } | if ( encodedMessage . size == 0 ) return EMPTY_STRING_MESSAGE ; return new StringMessage ( new String ( encodedMessage . array , 0 , encodedMessage . size , CHARSET ) ) ; |
public class MtasToken { /** * Check real offset .
* @ return the boolean */
final public Boolean checkRealOffset ( ) { } } | if ( ( tokenRealOffset == null ) || ! provideRealOffset ) { return false ; } else if ( tokenOffset == null ) { return true ; } else if ( tokenOffset . getStart ( ) == tokenRealOffset . getStart ( ) && tokenOffset . getEnd ( ) == tokenRealOffset . getEnd ( ) ) { return false ; } else { return true ; } |
public class Call { /** * Abbreviation for { { @ link # methodForArrayOf ( Type , String , Object . . . ) } .
* @ since 1.1
* @ param methodName the name of the method
* @ param optionalParameters the ( optional ) parameters of the method .
* @ return the result of the method execution */
public static < R > Function < Object , R [ ] > arrayOf ( final Type < R > resultType , final String methodName , final Object ... optionalParameters ) { } } | return methodForArrayOf ( resultType , methodName , optionalParameters ) ; |
public class Pattern { /** * Appends a new pattern to the existing one . The new pattern enforces that there is no event matching this pattern
* between the preceding pattern and succeeding this one .
* < p > < b > NOTE : < / b > There has to be other pattern after this one .
* @ param name Name of the new pattern
* @ return A new pattern which is appended to this one */
public Pattern < T , T > notFollowedBy ( final String name ) { } } | if ( quantifier . hasProperty ( Quantifier . QuantifierProperty . OPTIONAL ) ) { throw new UnsupportedOperationException ( "Specifying a pattern with an optional path to NOT condition is not supported yet. " + "You can simulate such pattern with two independent patterns, one with and the other without " + "the optional part." ) ; } return new Pattern < > ( name , this , ConsumingStrategy . NOT_FOLLOW , afterMatchSkipStrategy ) ; |
public class FunctionGenerator { /** * Creates a function whose body goes from the child of parentExpr
* up to ( and including ) the functionBodyEndExpr .
* @ param parentExpr */
private void createFunctionIfNeeded ( AbstractFunctionExpression parentExpr ) { } } | GroovyExpression potentialFunctionBody = parentExpr . getCaller ( ) ; if ( creatingFunctionShortensGremlin ( potentialFunctionBody ) ) { GroovyExpression functionCall = null ; if ( nextFunctionBodyStart instanceof AbstractFunctionExpression ) { // The function body start is a a function call . In this
// case , we generate a function that takes one argument , which
// is a graph traversal . We have an expression tree that
// looks kind of like the following :
// parentExpr
// / caller
// potentialFunctionBody
// / caller
// / caller
// nextFunctionBodyStart
// / caller
// oldCaller
// Note that potentialFunctionBody and nextFunctionBodyStart
// could be the same expression . Let ' s say that the next
// function name is f1
// We reshuffle these expressions to the following :
// parentExpr
// / caller
// f1 ( oldCaller )
// potentialFunctionBody < - body of new function " f1 ( GraphTraversal x ) "
// / caller
// / caller
// nextFunctionBodyStart
// / caller
// As an example , suppose parentExpr is g . V ( ) . or ( x , y ) . has ( a ) . has ( b ) . has ( c )
// where has ( a ) is nextFunctionBodyStart .
// We generate a function f1 = { GraphTraversal x - > x . has ( a ) . has ( b ) }
// parentExpr would become : f1 ( g . V ( ) . or ( x , y ) ) . has ( c )
AbstractFunctionExpression nextFunctionBodyStartFunction = ( AbstractFunctionExpression ) nextFunctionBodyStart ; String variableName = "x" ; IdentifierExpression var = new IdentifierExpression ( variableName ) ; GroovyExpression oldCaller = nextFunctionBodyStartFunction . getCaller ( ) ; nextFunctionBodyStartFunction . setCaller ( var ) ; currentFunctionName = context . addFunctionDefinition ( new VariableDeclaration ( factory . getTraversalExpressionClass ( ) , "x" ) , potentialFunctionBody ) ; functionCall = new FunctionCallExpression ( potentialFunctionBody . getType ( ) , currentFunctionName , oldCaller ) ; } else { // The function body start is a not a function call . In this
// case , we generate a function that takes no arguments .
// As an example , suppose parentExpr is g . V ( ) . has ( a ) . has ( b ) . has ( c )
// where g is nextFunctionBodyStart .
// We generate a function f1 = { g . V ( ) . has ( a ) . has ( b ) }
// parentExpr would become : f1 ( ) . has ( c )
currentFunctionName = context . addFunctionDefinition ( null , potentialFunctionBody ) ; functionCall = new FunctionCallExpression ( potentialFunctionBody . getType ( ) , currentFunctionName ) ; } // functionBodyEnd is now part of a function definition , don ' t propagate it
nextFunctionBodyStart = null ; parentExpr . setCaller ( functionCall ) ; } |
public class VarSet { /** * Gets the subset of vars with the specified type . */
public static List < Var > getVarsOfType ( List < Var > vars , VarType type ) { } } | ArrayList < Var > subset = new ArrayList < Var > ( ) ; for ( Var v : vars ) { if ( v . getType ( ) == type ) { subset . add ( v ) ; } } return subset ; |
public class CipherLiteInputStream { /** * Reads and process the next chunk of data into memory .
* @ return the length of the data chunk read and processed , or - 1 if end of
* stream .
* @ throws IOException
* if there is an IO exception from the underlying input stream
* @ throws SecurityException
* if there is authentication failure */
private int nextChunk ( ) throws IOException { } } | abortIfNeeded ( ) ; if ( eof ) return - 1 ; bufout = null ; int len = in . read ( bufin ) ; if ( len == - 1 ) { eof = true ; // Skip doFinal if it ' s a multi - part upload but not the last part
if ( ! multipart || lastMultiPart ) { try { bufout = cipherLite . doFinal ( ) ; if ( bufout == null ) { // bufout can be null , for example , when it was the
// javax . crypto . NullCipher
return - 1 ; } curr_pos = 0 ; return max_pos = bufout . length ; } catch ( IllegalBlockSizeException ignore ) { // like the RI
} catch ( BadPaddingException e ) { if ( S3CryptoScheme . isAesGcm ( cipherLite . getCipherAlgorithm ( ) ) ) throw new SecurityException ( e ) ; } } return - 1 ; } bufout = cipherLite . update ( bufin , 0 , len ) ; curr_pos = 0 ; return max_pos = ( bufout == null ? 0 : bufout . length ) ; |
public class CssSmartSpritesResourceReader { /** * Returns the file of the generated CSS
* @ param path
* the path of the CSS
* @ return the file of the generated CSS */
public File getGeneratedCssFile ( String path ) { } } | String rootDir = tempDir + JawrConstant . CSS_SMARTSPRITES_TMP_DIR ; String fPath = null ; if ( jawrConfig . isWorkingDirectoryInWebApp ( ) ) { fPath = jawrConfig . getContext ( ) . getRealPath ( rootDir + getCssPath ( path ) ) ; } else { fPath = rootDir + getCssPath ( path ) ; } return new File ( fPath ) ; |
public class JobRescheduleService { /** * / * package */
int rescheduleJobs ( JobManager manager , Collection < JobRequest > requests ) { } } | int rescheduledCount = 0 ; boolean exceptionThrown = false ; for ( JobRequest request : requests ) { boolean reschedule ; if ( request . isStarted ( ) ) { Job job = manager . getJob ( request . getJobId ( ) ) ; reschedule = job == null ; } else { reschedule = ! manager . getJobProxy ( request . getJobApi ( ) ) . isPlatformJobScheduled ( request ) ; } if ( reschedule ) { // update execution window
try { request . cancelAndEdit ( ) . build ( ) . schedule ( ) ; } catch ( Exception e ) { // this may crash ( e . g . more than 100 jobs with JobScheduler ) , but it ' s not catchable for the user
// better catch here , otherwise app will end in a crash loop
if ( ! exceptionThrown ) { CAT . e ( e ) ; exceptionThrown = true ; } } rescheduledCount ++ ; } } return rescheduledCount ; |
public class TokenMapperGeneric { /** * Returns the Lucene { @ link BytesRef } represented by the specified Cassandra { @ link Token } .
* @ param token A Cassandra { @ link Token } .
* @ return The Lucene { @ link BytesRef } represented by the specified Cassandra { @ link Token } . */
@ SuppressWarnings ( "unchecked" ) public BytesRef bytesRef ( Token token ) { } } | ByteBuffer bb = factory . toByteArray ( token ) ; byte [ ] bytes = ByteBufferUtils . asArray ( bb ) ; return new BytesRef ( bytes ) ; |
public class IR { /** * literals */
public static Node objectlit ( Node ... propdefs ) { } } | Node objectlit = new Node ( Token . OBJECTLIT ) ; for ( Node propdef : propdefs ) { switch ( propdef . getToken ( ) ) { case STRING_KEY : case MEMBER_FUNCTION_DEF : case GETTER_DEF : case SETTER_DEF : case SPREAD : case COMPUTED_PROP : break ; default : throw new IllegalStateException ( "Unexpected OBJECTLIT child: " + propdef ) ; } objectlit . addChildToBack ( propdef ) ; } return objectlit ; |
public class HttpStatusCodeException { /** * Return the response body as a string .
* @ since 3.0.5 */
public String getResponseBodyAsString ( ) { } } | final ByteBuf bodyByteBuf = httpInputMessage . getBody ( ) ; final String contentEncoding = httpInputMessage . getHeaders ( ) . get ( HttpHeaders . CONTENT_ENCODING ) ; byte [ ] bytes = new byte [ bodyByteBuf . readableBytes ( ) ] ; bodyByteBuf . readBytes ( bytes ) ; return new String ( bytes , contentEncoding != null ? Charset . forName ( contentEncoding ) : Charset . forName ( DEFAULT_CHARSET ) ) ; |
public class ControlBeanContextSupport { /** * This method instructs the bean that it is OK to use the Gui . */
public void okToUseGui ( ) { } } | if ( _mayUseGui ) return ; _mayUseGui = true ; for ( Object o : _children . keySet ( ) ) { if ( o instanceof Visibility ) { ( ( Visibility ) o ) . okToUseGui ( ) ; } } |
public class JDBC4ResultSet { /** * ResultSet object as an int in the Java programming language . */
@ Override public int getInt ( int columnIndex ) throws SQLException { } } | checkColumnBounds ( columnIndex ) ; try { Long longValue = getPrivateInteger ( columnIndex ) ; if ( longValue > Integer . MAX_VALUE || longValue < Integer . MIN_VALUE ) { throw new SQLException ( "Value out of int range" ) ; } return longValue . intValue ( ) ; } catch ( Exception x ) { throw SQLError . get ( x ) ; } |
public class PartialResponseChangesTypeImpl { /** * If not already created , a new < code > attributes < / code > element will be created and returned .
* Otherwise , the first existing < code > attributes < / code > element will be returned .
* @ return the instance defined for the element < code > attributes < / code > */
public PartialResponseAttributesType < PartialResponseChangesType < T > > getOrCreateAttributes ( ) { } } | List < Node > nodeList = childNode . get ( "attributes" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new PartialResponseAttributesTypeImpl < PartialResponseChangesType < T > > ( this , "attributes" , childNode , nodeList . get ( 0 ) ) ; } return createAttributes ( ) ; |
public class BaseMessageProcessor { /** * Get the message queue registry ID from this message .
* @ param internalMessage The message to get the registry ID from .
* @ return Integer The registry ID . */
public Integer getRegistryID ( BaseMessage internalMessageReply ) { } } | Integer intRegistryID = null ; Object objRegistryID = null ; if ( internalMessageReply . getMessageHeader ( ) instanceof TrxMessageHeader ) // Always
objRegistryID = ( ( TrxMessageHeader ) internalMessageReply . getMessageHeader ( ) ) . getMessageHeaderMap ( ) . get ( TrxMessageHeader . REGISTRY_ID ) ; if ( objRegistryID == null ) objRegistryID = internalMessageReply . get ( TrxMessageHeader . REGISTRY_ID ) ; if ( objRegistryID instanceof Integer ) intRegistryID = ( Integer ) objRegistryID ; else if ( objRegistryID instanceof String ) { try { intRegistryID = new Integer ( Integer . parseInt ( ( String ) objRegistryID ) ) ; } catch ( NumberFormatException ex ) { intRegistryID = null ; } } return intRegistryID ; |
public class Socks4ClientBootstrap { /** * Hijack super class ' s pipelineFactory and return our own that
* does the connect to SOCKS proxy and does the handshake . */
@ Override public ChannelPipelineFactory getPipelineFactory ( ) { } } | return new ChannelPipelineFactory ( ) { @ Override public ChannelPipeline getPipeline ( ) throws Exception { final ChannelPipeline cp = Channels . pipeline ( ) ; cp . addLast ( FRAME_DECODER , new FixedLengthFrameDecoder ( 8 ) ) ; cp . addLast ( HANDSHAKE , new Socks4HandshakeHandler ( Socks4ClientBootstrap . super . getPipelineFactory ( ) ) ) ; return cp ; } } ; |
public class SteadyStateEvolutionEngine { /** * { @ inheritDoc } */
@ Override protected List < EvaluatedCandidate < T > > nextEvolutionStep ( List < EvaluatedCandidate < T > > evaluatedPopulation , int eliteCount , Random rng ) { } } | EvolutionUtils . sortEvaluatedPopulation ( evaluatedPopulation , fitnessEvaluator . isNatural ( ) ) ; List < T > selectedCandidates = selectionStrategy . select ( evaluatedPopulation , fitnessEvaluator . isNatural ( ) , selectionSize , rng ) ; List < EvaluatedCandidate < T > > offspring = evaluatePopulation ( evolutionScheme . apply ( selectedCandidates , rng ) ) ; doReplacement ( evaluatedPopulation , offspring , eliteCount , rng ) ; return evaluatedPopulation ; |
public class JSONWriter { /** * value .
* @ param value value .
* @ return this .
* @ throws IOException */
public JSONWriter valueInt ( int value ) throws IOException { } } | beforeValue ( ) ; writer . write ( String . valueOf ( value ) ) ; return this ; |
public class ElementMatchers { /** * Matches a { @ link ModifierReviewable } that is { @ code static } .
* @ param < T > The type of the matched object .
* @ return A matcher for a { @ code static } modifier reviewable . */
public static < T extends ModifierReviewable . OfByteCodeElement > ElementMatcher . Junction < T > isStatic ( ) { } } | return new ModifierMatcher < T > ( ModifierMatcher . Mode . STATIC ) ; |
public class StringHelper { /** * Get a concatenated String from all elements of the passed array , separated by
* the specified separator char .
* @ param cSep
* The separator to use .
* @ param aElements
* The container to convert . May be < code > null < / code > or empty .
* @ param nOfs
* The offset to start from .
* @ param nLen
* The number of elements to implode .
* @ return The concatenated string .
* @ param < ELEMENTTYPE >
* The type of elements to be imploded . */
@ Nonnull public static < ELEMENTTYPE > String getImploded ( final char cSep , @ Nullable final ELEMENTTYPE [ ] aElements , @ Nonnegative final int nOfs , @ Nonnegative final int nLen ) { } } | return getImplodedMapped ( Character . toString ( cSep ) , aElements , nOfs , nLen , String :: valueOf ) ; |
public class CmsAccountsApp { /** * Gets list of users for organizational unit . < p >
* @ param cms the CMS context
* @ param ou the OU path
* @ param recursive true if users from other OUs should be retrieved
* @ return the list of users , without their additional info
* @ throws CmsException if something goes wrong */
public List < CmsUser > getUsersWithoutAdditionalInfo ( CmsObject cms , I_CmsOuTreeType type , String ou , boolean recursive ) throws CmsException { } } | return CmsPrincipal . filterCoreUsers ( OpenCms . getOrgUnitManager ( ) . getUsersWithoutAdditionalInfo ( cms , ou , recursive ) ) ; |
public class UsersTableModel { /** * Adds a new user to this model
* @ param user the user */
public void addUser ( User user ) { } } | this . users . add ( user ) ; this . fireTableRowsInserted ( this . users . size ( ) - 1 , this . users . size ( ) - 1 ) ; |
public class AptUtil { /** * Returns the package name of the given { @ link TypeMirror } .
* @ param elementUtils
* @ param typeUtils
* @ param type
* @ return the package name
* @ author backpaper0
* @ author vvakame */
public static String getPackageName ( Elements elementUtils , Types typeUtils , TypeMirror type ) { } } | TypeVisitor < DeclaredType , Object > tv = new SimpleTypeVisitor6 < DeclaredType , Object > ( ) { @ Override public DeclaredType visitDeclared ( DeclaredType t , Object p ) { return t ; } } ; DeclaredType dt = type . accept ( tv , null ) ; if ( dt != null ) { ElementVisitor < TypeElement , Object > ev = new SimpleElementVisitor6 < TypeElement , Object > ( ) { @ Override public TypeElement visitType ( TypeElement e , Object p ) { return e ; } } ; TypeElement el = typeUtils . asElement ( dt ) . accept ( ev , null ) ; if ( el != null && el . getNestingKind ( ) != NestingKind . TOP_LEVEL ) { return AptUtil . getPackageName ( elementUtils , el ) ; } } return AptUtil . getPackageNameSub ( type ) ; |
public class BuildTasksInner { /** * Get the source control properties for a build task .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ param buildTaskName The name of the container registry build task .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the SourceRepositoryPropertiesInner object */
public Observable < SourceRepositoryPropertiesInner > listSourceRepositoryPropertiesAsync ( String resourceGroupName , String registryName , String buildTaskName ) { } } | return listSourceRepositoryPropertiesWithServiceResponseAsync ( resourceGroupName , registryName , buildTaskName ) . map ( new Func1 < ServiceResponse < SourceRepositoryPropertiesInner > , SourceRepositoryPropertiesInner > ( ) { @ Override public SourceRepositoryPropertiesInner call ( ServiceResponse < SourceRepositoryPropertiesInner > response ) { return response . body ( ) ; } } ) ; |
public class AmazonEC2Client { /** * Describes the ClassicLink status of one or more VPCs .
* @ param describeVpcClassicLinkRequest
* @ return Result of the DescribeVpcClassicLink operation returned by the service .
* @ sample AmazonEC2 . DescribeVpcClassicLink
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / DescribeVpcClassicLink " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DescribeVpcClassicLinkResult describeVpcClassicLink ( DescribeVpcClassicLinkRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeVpcClassicLink ( request ) ; |
public class Jar { /** * Adds an entry to this JAR .
* @ param path the entry ' s path within the JAR
* @ param file the path of the file to add as an entry
* @ return { @ code this } */
public Jar addEntry ( Path path , String file ) throws IOException { } } | return addEntry ( path , Paths . get ( file ) ) ; |
public class SARLJvmModelInferrer { /** * Remove the type parameters from the given type .
* < p > < table >
* < thead > < tr > < th > Referenced type < / th > < th > Input < / th > < th > Replied referenced type < / th > < th > Output < / th > < / tr > < / thead >
* < tbody >
* < tr > < td > Type with generic type parameter < / td > < td > { @ code T < G > } < / td > < td > the type itself < / td > < td > { @ code T } < / td > < / tr >
* < tr > < td > Type without generic type parameter < / td > < td > { @ code T } < / td > < td > the type itself < / td > < td > { @ code T } < / td > < / tr >
* < tr > < td > Type parameter without bound < / td > < td > { @ code < S > } < / td > < td > { @ code Object } < / td > < td > { @ code Object } < / td > < / tr >
* < tr > < td > Type parameter with lower bound < / td > < td > { @ code < S super B > } < / td > < td > { @ code Object } < / td > < td > { @ code Object } < / td > < / tr >
* < tr > < td > Type parameter with upper bound < / td > < td > { @ code < S extends B > } < / td > < td > the bound type < / td > < td > { @ code B } < / td > < / tr >
* < / tbody >
* < / table >
* @ param type the type .
* @ param context the context in which the reference is located .
* @ return the same type without the type parameters . */
protected JvmTypeReference skipTypeParameters ( JvmTypeReference type , Notifier context ) { } } | final LightweightTypeReference ltr = Utils . toLightweightTypeReference ( type , this . services ) ; return ltr . getRawTypeReference ( ) . toJavaCompliantTypeReference ( ) ; |
public class Strings { /** * Check whether the given String is an identifier according to the EJB - QL definition . See The EJB 2.0 Documentation
* Section 11.2.6.1.
* @ param s String to check
* @ return < code > true < / code > if the given String is a reserved identifier in EJB - QL , < code > false < / code > otherwise . */
public final static boolean isEjbQlIdentifier ( String s ) { } } | if ( s == null || s . length ( ) == 0 ) { return false ; } for ( int i = 0 ; i < ejbQlIdentifiers . length ; i ++ ) { if ( ejbQlIdentifiers [ i ] . equalsIgnoreCase ( s ) ) { return true ; } } return false ; |
public class Deferrers { /** * Defer some action .
* @ param deferred action to be defer .
* @ return the same object from arguments
* @ since 1.0 */
@ Weight ( Weight . Unit . NORMAL ) public static Deferred defer ( @ Nonnull final Deferred deferred ) { } } | REGISTRY . get ( ) . add ( assertNotNull ( deferred ) ) ; return deferred ; |
public class SubQuery { /** * Fills the table with a result set */
public void materialise ( Session session ) { } } | PersistentStore store ; // table constructors
if ( isDataExpression ) { store = session . sessionData . getSubqueryRowStore ( table ) ; dataExpression . insertValuesIntoSubqueryTable ( session , store ) ; return ; } Result result = queryExpression . getResult ( session , isExistsPredicate ? 1 : 0 ) ; RowSetNavigatorData navigator = ( ( RowSetNavigatorData ) result . getNavigator ( ) ) ; if ( uniqueRows ) { navigator . removeDuplicates ( ) ; } store = session . sessionData . getSubqueryRowStore ( table ) ; table . insertResult ( store , result ) ; result . getNavigator ( ) . close ( ) ; |
public class BufferedByteInputOutput { /** * Write buf to the buffer , will block until it can write len bytes .
* Will fail if buffer is closed . */
public void write ( byte [ ] buf , int off , int len ) throws IOException { } } | while ( true ) { lockW . lock ( ) ; try { // fail if closed
checkClosed ( ) ; final int lenToWrite = Math . min ( len , length - availableCount . get ( ) ) ; final int lenForward = Math . min ( lenToWrite , length - writeCursor ) ; final int lenRemaining = lenToWrite - lenForward ; // after writeCursor
if ( lenForward > 0 ) { System . arraycopy ( buf , off , bytes , writeCursor , lenForward ) ; incWriteCursor ( lenForward ) ; } // before writeCursor
if ( lenRemaining > 0 ) { System . arraycopy ( buf , off + lenForward , bytes , 0 , lenRemaining ) ; incWriteCursor ( lenRemaining ) ; } availableCount . addAndGet ( lenToWrite ) ; totalWritten += lenToWrite ; // modify offset and len for next iteration
off += lenToWrite ; len -= lenToWrite ; if ( len == 0 ) { return ; } } finally { lockW . unlock ( ) ; } sleep ( 1 ) ; } |
public class TrialScopes { /** * Makes a new TrialContext that can be used to invoke */
static TrialContext makeContext ( UUID trialId , int trialNumber , Experiment experiment ) { } } | return new TrialContext ( trialId , trialNumber , experiment ) ; |
public class Maths { /** * Get the value if it is between min and max , min if the value is less than min , or max if the
* value is greater than max . */
public static int clamp ( int value , int min , int max ) { } } | return Math . min ( Math . max ( min , value ) , max ) ; |
public class SeleniumHelper { /** * Takes screenshot of current page ( as . png ) .
* @ param baseName name for file created ( without extension ) ,
* if a file already exists with the supplied name an
* ' _ index ' will be added .
* @ return absolute path of file created . */
public String takeScreenshot ( String baseName ) { } } | String result = null ; WebDriver d = driver ( ) ; if ( ! ( d instanceof TakesScreenshot ) ) { d = new Augmenter ( ) . augment ( d ) ; } if ( d instanceof TakesScreenshot ) { TakesScreenshot ts = ( TakesScreenshot ) d ; byte [ ] png = ts . getScreenshotAs ( OutputType . BYTES ) ; result = writeScreenshot ( baseName , png ) ; } return result ; |
public class ZKBrokerPartitionInfo { /** * Generate a sequence of ( brokerId , numPartitions ) for all topics registered in zookeeper
* @ param allBrokers all register brokers
* @ return a mapping from topic to sequence of ( brokerId , numPartitions ) */
private Map < String , SortedSet < Partition > > getZKTopicPartitionInfo ( Map < Integer , Broker > allBrokers ) { } } | final Map < String , SortedSet < Partition > > brokerPartitionsPerTopic = new HashMap < String , SortedSet < Partition > > ( ) ; ZkUtils . makeSurePersistentPathExists ( zkClient , ZkUtils . BrokerTopicsPath ) ; List < String > topics = ZkUtils . getChildrenParentMayNotExist ( zkClient , ZkUtils . BrokerTopicsPath ) ; for ( String topic : topics ) { // find the number of broker partitions registered for this topic
String brokerTopicPath = ZkUtils . BrokerTopicsPath + "/" + topic ; List < String > brokerList = ZkUtils . getChildrenParentMayNotExist ( zkClient , brokerTopicPath ) ; final SortedSet < Partition > sortedBrokerPartitions = new TreeSet < Partition > ( ) ; final Set < Integer > existBids = new HashSet < Integer > ( ) ; for ( String bid : brokerList ) { final int ibid = Integer . parseInt ( bid ) ; final String numPath = brokerTopicPath + "/" + bid ; final Integer numPartition = Integer . valueOf ( ZkUtils . readData ( zkClient , numPath ) ) ; for ( int i = 0 ; i < numPartition . intValue ( ) ; i ++ ) { sortedBrokerPartitions . add ( new Partition ( ibid , i ) ) ; } existBids . add ( ibid ) ; } // add all brokers after topic created
for ( Integer bid : allBrokers . keySet ( ) ) { if ( ! existBids . contains ( bid ) ) { sortedBrokerPartitions . add ( new Partition ( bid , 0 ) ) ; // this broker run after topic created
} } logger . debug ( "Broker ids and # of partitions on each for topic: " + topic + " = " + sortedBrokerPartitions ) ; brokerPartitionsPerTopic . put ( topic , sortedBrokerPartitions ) ; } return brokerPartitionsPerTopic ; |
public class InternalPureXbaseParser { /** * InternalPureXbase . g : 2991:1 : ruleXSetLiteral returns [ EObject current = null ] : ( ( ) otherlv _ 1 = ' # ' otherlv _ 2 = ' { ' ( ( ( lv _ elements _ 3_0 = ruleXExpression ) ) ( otherlv _ 4 = ' , ' ( ( lv _ elements _ 5_0 = ruleXExpression ) ) ) * ) ? otherlv _ 6 = ' } ' ) ; */
public final EObject ruleXSetLiteral ( ) throws RecognitionException { } } | EObject current = null ; Token otherlv_1 = null ; Token otherlv_2 = null ; Token otherlv_4 = null ; Token otherlv_6 = null ; EObject lv_elements_3_0 = null ; EObject lv_elements_5_0 = null ; enterRule ( ) ; try { // InternalPureXbase . g : 2997:2 : ( ( ( ) otherlv _ 1 = ' # ' otherlv _ 2 = ' { ' ( ( ( lv _ elements _ 3_0 = ruleXExpression ) ) ( otherlv _ 4 = ' , ' ( ( lv _ elements _ 5_0 = ruleXExpression ) ) ) * ) ? otherlv _ 6 = ' } ' ) )
// InternalPureXbase . g : 2998:2 : ( ( ) otherlv _ 1 = ' # ' otherlv _ 2 = ' { ' ( ( ( lv _ elements _ 3_0 = ruleXExpression ) ) ( otherlv _ 4 = ' , ' ( ( lv _ elements _ 5_0 = ruleXExpression ) ) ) * ) ? otherlv _ 6 = ' } ' )
{ // InternalPureXbase . g : 2998:2 : ( ( ) otherlv _ 1 = ' # ' otherlv _ 2 = ' { ' ( ( ( lv _ elements _ 3_0 = ruleXExpression ) ) ( otherlv _ 4 = ' , ' ( ( lv _ elements _ 5_0 = ruleXExpression ) ) ) * ) ? otherlv _ 6 = ' } ' )
// InternalPureXbase . g : 2999:3 : ( ) otherlv _ 1 = ' # ' otherlv _ 2 = ' { ' ( ( ( lv _ elements _ 3_0 = ruleXExpression ) ) ( otherlv _ 4 = ' , ' ( ( lv _ elements _ 5_0 = ruleXExpression ) ) ) * ) ? otherlv _ 6 = ' } '
{ // InternalPureXbase . g : 2999:3 : ( )
// InternalPureXbase . g : 3000:4:
{ if ( state . backtracking == 0 ) { current = forceCreateModelElement ( grammarAccess . getXSetLiteralAccess ( ) . getXSetLiteralAction_0 ( ) , current ) ; } } otherlv_1 = ( Token ) match ( input , 58 , FOLLOW_40 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { newLeafNode ( otherlv_1 , grammarAccess . getXSetLiteralAccess ( ) . getNumberSignKeyword_1 ( ) ) ; } otherlv_2 = ( Token ) match ( input , 59 , FOLLOW_41 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { newLeafNode ( otherlv_2 , grammarAccess . getXSetLiteralAccess ( ) . getLeftCurlyBracketKeyword_2 ( ) ) ; } // InternalPureXbase . g : 3014:3 : ( ( ( lv _ elements _ 3_0 = ruleXExpression ) ) ( otherlv _ 4 = ' , ' ( ( lv _ elements _ 5_0 = ruleXExpression ) ) ) * ) ?
int alt54 = 2 ; int LA54_0 = input . LA ( 1 ) ; if ( ( ( LA54_0 >= RULE_STRING && LA54_0 <= RULE_ID ) || ( LA54_0 >= 14 && LA54_0 <= 15 ) || LA54_0 == 28 || ( LA54_0 >= 44 && LA54_0 <= 45 ) || LA54_0 == 50 || ( LA54_0 >= 58 && LA54_0 <= 59 ) || LA54_0 == 61 || LA54_0 == 64 || LA54_0 == 66 || ( LA54_0 >= 69 && LA54_0 <= 80 ) ) ) { alt54 = 1 ; } switch ( alt54 ) { case 1 : // InternalPureXbase . g : 3015:4 : ( ( lv _ elements _ 3_0 = ruleXExpression ) ) ( otherlv _ 4 = ' , ' ( ( lv _ elements _ 5_0 = ruleXExpression ) ) ) *
{ // InternalPureXbase . g : 3015:4 : ( ( lv _ elements _ 3_0 = ruleXExpression ) )
// InternalPureXbase . g : 3016:5 : ( lv _ elements _ 3_0 = ruleXExpression )
{ // InternalPureXbase . g : 3016:5 : ( lv _ elements _ 3_0 = ruleXExpression )
// InternalPureXbase . g : 3017:6 : lv _ elements _ 3_0 = ruleXExpression
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXSetLiteralAccess ( ) . getElementsXExpressionParserRuleCall_3_0_0 ( ) ) ; } pushFollow ( FOLLOW_42 ) ; lv_elements_3_0 = ruleXExpression ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElementForParent ( grammarAccess . getXSetLiteralRule ( ) ) ; } add ( current , "elements" , lv_elements_3_0 , "org.eclipse.xtext.xbase.Xbase.XExpression" ) ; afterParserOrEnumRuleCall ( ) ; } } } // InternalPureXbase . g : 3034:4 : ( otherlv _ 4 = ' , ' ( ( lv _ elements _ 5_0 = ruleXExpression ) ) ) *
loop53 : do { int alt53 = 2 ; int LA53_0 = input . LA ( 1 ) ; if ( ( LA53_0 == 57 ) ) { alt53 = 1 ; } switch ( alt53 ) { case 1 : // InternalPureXbase . g : 3035:5 : otherlv _ 4 = ' , ' ( ( lv _ elements _ 5_0 = ruleXExpression ) )
{ otherlv_4 = ( Token ) match ( input , 57 , FOLLOW_3 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { newLeafNode ( otherlv_4 , grammarAccess . getXSetLiteralAccess ( ) . getCommaKeyword_3_1_0 ( ) ) ; } // InternalPureXbase . g : 3039:5 : ( ( lv _ elements _ 5_0 = ruleXExpression ) )
// InternalPureXbase . g : 3040:6 : ( lv _ elements _ 5_0 = ruleXExpression )
{ // InternalPureXbase . g : 3040:6 : ( lv _ elements _ 5_0 = ruleXExpression )
// InternalPureXbase . g : 3041:7 : lv _ elements _ 5_0 = ruleXExpression
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXSetLiteralAccess ( ) . getElementsXExpressionParserRuleCall_3_1_1_0 ( ) ) ; } pushFollow ( FOLLOW_42 ) ; lv_elements_5_0 = ruleXExpression ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElementForParent ( grammarAccess . getXSetLiteralRule ( ) ) ; } add ( current , "elements" , lv_elements_5_0 , "org.eclipse.xtext.xbase.Xbase.XExpression" ) ; afterParserOrEnumRuleCall ( ) ; } } } } break ; default : break loop53 ; } } while ( true ) ; } break ; } otherlv_6 = ( Token ) match ( input , 60 , FOLLOW_2 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { newLeafNode ( otherlv_6 , grammarAccess . getXSetLiteralAccess ( ) . getRightCurlyBracketKeyword_4 ( ) ) ; } } } if ( state . backtracking == 0 ) { leaveRule ( ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class ContainerAwareExecutionVenue { /** * In the case of ContextRefreshedEvent ( that is , once all Spring configuration is loaded ) , the following actions
* will be taken :
* < list >
* < li > the superclass ' s onAppEvent will initialise all services < / li >
* < li > The JMXControl will be retrieved from the application context and all registered Exportable implementations will be exported < / li >
* < li > All registered StartingGateListeners will be notified that the starting gate is open < / li >
* < li > A status check will be made on every registered service , with the status logged < / li >
* < / list > */
@ Override public void onApplicationEvent ( ApplicationEvent event ) { } } | if ( event instanceof ContextRefreshedEvent ) { super . onApplicationEvent ( event ) ; try { final ApplicationContext ctx = ( ( ContextRefreshedEvent ) event ) . getApplicationContext ( ) ; // Check that the JMXControl exists before registering all exportables
// see JMXControl javadocs for why we have to do it this way
JMXControl jmxControl = JMXControl . getFromContext ( ctx ) ; if ( jmxControl == null ) { throw new PanicInTheCougar ( "jmxControl bean not found in ApplicationContext" ) ; } if ( exportables != null ) { for ( Exportable exportable : exportables ) { exportable . export ( jmxControl ) ; } } // Open the starting gate
notifyStartingGateListeners ( ) ; Collection < ServiceAware > serviceAwareImpls = getServiceAwareImplementations ( ctx ) ; if ( serviceAwareImpls != null && serviceAwareImpls . size ( ) > 0 ) { Set < Service > services = new HashSet < Service > ( ) ; Collection < Map < ServiceDefinition , Service > > serviceDefinitions = getServiceImplementationMap ( ) . values ( ) ; for ( Map < ServiceDefinition , Service > serviceDefinition : serviceDefinitions ) { services . addAll ( serviceDefinition . values ( ) ) ; } for ( ServiceAware serviceAware : serviceAwareImpls ) { serviceAware . setServices ( services ) ; } } Status status = monitorRegistry . getStatusAggregator ( ) . getStatus ( ) ; if ( status != Status . OK ) { LOGGER . warn ( "Cougar returned status {} at startup" , status ) ; } else { LOGGER . info ( "Cougar returned status {} at startup" , status ) ; } } catch ( Exception e ) { throw new PanicInTheCougar ( "Failed to initialise server" , e ) ; } logSuccessfulCougarStartup ( ) ; } |
public class PhoneNumberUtil { /** * format phone number in DIN 5008 format with cursor position handling .
* @ param pphoneNumber phone number as String to format with cursor position
* @ param pcountryCode iso code of country
* @ return formated phone number as String with new cursor position */
public final ValueWithPos < String > formatDin5008WithPos ( final ValueWithPos < String > pphoneNumber , final String pcountryCode ) { } } | return valueWithPosDefaults ( this . formatDin5008WithPos ( this . parsePhoneNumber ( pphoneNumber , pcountryCode ) , CreatePhoneCountryConstantsClass . create ( ) . countryMap ( ) . get ( StringUtils . defaultString ( pcountryCode ) ) ) , pphoneNumber ) ; |
public class LoadBalancerTlsCertificate { /** * An array of LoadBalancerTlsCertificateDomainValidationRecord objects describing the records .
* @ param domainValidationRecords
* An array of LoadBalancerTlsCertificateDomainValidationRecord objects describing the records . */
public void setDomainValidationRecords ( java . util . Collection < LoadBalancerTlsCertificateDomainValidationRecord > domainValidationRecords ) { } } | if ( domainValidationRecords == null ) { this . domainValidationRecords = null ; return ; } this . domainValidationRecords = new java . util . ArrayList < LoadBalancerTlsCertificateDomainValidationRecord > ( domainValidationRecords ) ; |
public class SerializationUtil { /** * Reads a list from the given { @ link ObjectDataInput } . It is expected that
* the next int read from the data input is the list ' s size , then that
* many objects are read from the data input and returned as a list .
* @ param in data input to read from
* @ param < T > type of items
* @ return list of items read from data input
* @ throws IOException when an error occurs while reading from the input */
public static < T > List < T > readList ( ObjectDataInput in ) throws IOException { } } | int size = in . readInt ( ) ; if ( size == 0 ) { return Collections . emptyList ( ) ; } List < T > list = new ArrayList < > ( size ) ; for ( int i = 0 ; i < size ; i ++ ) { T item = in . readObject ( ) ; list . add ( item ) ; } return list ; |
public class Entry { /** * A read - only property used for retrieving the start time of the entry . The
* property gets updated whenever the start time inside the entry interval
* changes ( see { @ link # intervalProperty ( ) } ) .
* @ return the start time of the entry */
public final ReadOnlyObjectProperty < LocalTime > startTimeProperty ( ) { } } | if ( startTime == null ) { startTime = new ReadOnlyObjectWrapper < > ( this , "startTime" , getInterval ( ) . getStartTime ( ) ) ; // $ NON - NLS - 1 $
} return startTime . getReadOnlyProperty ( ) ; |
public class nsip6 { /** * Use this API to delete nsip6 resources . */
public static base_responses delete ( nitro_service client , nsip6 resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { nsip6 deleteresources [ ] = new nsip6 [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { deleteresources [ i ] = new nsip6 ( ) ; deleteresources [ i ] . ipv6address = resources [ i ] . ipv6address ; deleteresources [ i ] . td = resources [ i ] . td ; } result = delete_bulk_request ( client , deleteresources ) ; } return result ; |
public class DateBetween { /** * 计算两个日期相差年数 < br >
* 在非重置情况下 , 如果起始日期的月小于结束日期的月 , 年数要少算1 ( 不足1年 )
* @ param isReset 是否重置时间为起始时间 ( 重置月天时分秒 )
* @ return 相差年数
* @ since 3.0.8 */
public long betweenYear ( boolean isReset ) { } } | final Calendar beginCal = DateUtil . calendar ( begin ) ; final Calendar endCal = DateUtil . calendar ( end ) ; int result = endCal . get ( Calendar . YEAR ) - beginCal . get ( Calendar . YEAR ) ; if ( false == isReset ) { endCal . set ( Calendar . YEAR , beginCal . get ( Calendar . YEAR ) ) ; long between = endCal . getTimeInMillis ( ) - beginCal . getTimeInMillis ( ) ; if ( between < 0 ) { return result - 1 ; } } return result ; |
public class MessageStoreImpl { /** * Initalizes the message store using the given JetStream configuration . Copies the relevant
* pieces of data into a MessageStoreConfiguration object which is then used to initialize
* the message store . Will only initialize PMI if this is not a reload .
* @ param engineConfiguration
* @ param isReload
* @ see com . ibm . ws . sib . admin . JsEngineComponent # initialize ( com . ibm . ws . sib . admin . JsMessagingEngine ) */
private void initialize ( JsMessagingEngine engineConfiguration , boolean isReload ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "initialize" , new Object [ ] { "isReload=" + isReload , "Config=" + engineConfiguration } ) ; _messagingEngine = engineConfiguration ; final WASConfiguration configuration = WASConfiguration . getDefaultWasConfiguration ( ) ; // Always support warm - restart . D178260
configuration . setCleanPersistenceOnStart ( false ) ; // Venu Liberty change : changed the way we get FileStore config object
SIBFileStore fs = ( SIBFileStore ) _messagingEngine . getFilestore ( ) ; // there is no getLogFile ! ! lohith liberty change
configuration . setObjectManagerLogDirectory ( fs . getPath ( ) ) ; configuration . setObjectManagerLogSize ( fs . getLogFileSize ( ) ) ; configuration . setObjectManagerPermanentStoreDirectory ( fs . getPath ( ) ) ; configuration . setObjectManagerMinimumPermanentStoreSize ( fs . getMinPermanentFileStoreSize ( ) ) ; configuration . setObjectManagerMaximumPermanentStoreSize ( fs . getMaxPermanentFileStoreSize ( ) ) ; configuration . setObjectManagerPermanentStoreSizeUnlimited ( fs . isUnlimitedPermanentStoreSize ( ) ) ; configuration . setObjectManagerTemporaryStoreDirectory ( fs . getPath ( ) ) ; configuration . setObjectManagerMinimumTemporaryStoreSize ( fs . getMinTemporaryFileStoreSize ( ) ) ; configuration . setObjectManagerMaximumTemporaryStoreSize ( fs . getMaxTemporaryFileStoreSize ( ) ) ; configuration . setObjectManagerTemporaryStoreSizeUnlimited ( fs . isUnlimitedTemporaryStoreSize ( ) ) ; // Finally , make sure that the message store type in the engine configuration has
// the corresponding configuration information . Otherwise , we ' re not going to get very far . . .
if ( ( engineConfiguration . getMessageStoreType ( ) == JsMessagingEngine . MESSAGE_STORE_TYPE_DATASTORE ) && ( engineConfiguration . datastoreExists ( ) ) ) { configuration . setPersistentMessageStoreClassname ( MessageStoreConstants . PERSISTENT_MESSAGE_STORE_CLASS_DATABASE ) ; // Defect 449837
if ( ! isReload ) { SibTr . info ( tc , "MESSAGING_ENGINE_PERSISTENCE_DATASTORE_SIMS1568" , new Object [ ] { engineConfiguration . getName ( ) } ) ; } } else if ( ( engineConfiguration . getMessageStoreType ( ) == JsMessagingEngine . MESSAGE_STORE_TYPE_FILESTORE ) && ( engineConfiguration . filestoreExists ( ) ) ) { configuration . setPersistentMessageStoreClassname ( MessageStoreConstants . PERSISTENT_MESSAGE_STORE_CLASS_OBJECTMANAGER ) ; // Defect 449837
if ( ! isReload ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Messaging engine " + engineConfiguration . getName ( ) + " is using a file store." ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "initialize" ) ; throw new IllegalStateException ( nls . getString ( "MSGSTORE_CONFIGURATION_ERROR_SIMS0503" ) ) ; } initialize ( configuration , isReload ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "initialize" ) ; |
public class HTMLExtractor { /** * Checks if any of the elements matched by the { @ code selector } contain the attribute { @ code attributeName } . The { @ code url } is used
* only for caching purposes , to avoid parsing multiple times the markup returned for the same resource .
* @ param url the url that identifies the markup
* @ param markup the markup
* @ param selector the selector used for retrieval
* @ param attributeName the attribute ' s name
* @ return { @ code true } if the attribute was found , { @ code false } otherwise */
public static boolean hasAttribute ( String url , String markup , String selector , String attributeName ) { } } | ensureMarkup ( url , markup ) ; Document document = documents . get ( url ) ; Elements elements = document . select ( selector ) ; return ! elements . isEmpty ( ) && elements . hasAttr ( attributeName ) ; |
public class CacheHandler { /** * 从数据源中获取最新数据 , 并写入缓存 。 注意 : 这里不使用 “ 拿来主义 ” 机制 , 是因为当前可能是更新数据的方法 。
* @ param pjp CacheAopProxyChain
* @ param cache Cache注解
* @ return 最新数据
* @ throws Throwable 异常 */
private Object writeOnly ( CacheAopProxyChain pjp , Cache cache ) throws Throwable { } } | DataLoaderFactory factory = DataLoaderFactory . getInstance ( ) ; DataLoader dataLoader = factory . getDataLoader ( ) ; CacheWrapper < Object > cacheWrapper ; try { cacheWrapper = dataLoader . init ( pjp , cache , this ) . getData ( ) . getCacheWrapper ( ) ; } catch ( Throwable e ) { throw e ; } finally { factory . returnObject ( dataLoader ) ; } Object result = cacheWrapper . getCacheObject ( ) ; Object [ ] arguments = pjp . getArgs ( ) ; if ( scriptParser . isCacheable ( cache , pjp . getTarget ( ) , arguments , result ) ) { CacheKeyTO cacheKey = getCacheKey ( pjp , cache , result ) ; // 注意 : 这里只能获取AutoloadTO , 不能生成AutoloadTO
AutoLoadTO autoLoadTO = autoLoadHandler . getAutoLoadTO ( cacheKey ) ; try { writeCache ( pjp , pjp . getArgs ( ) , cache , cacheKey , cacheWrapper ) ; if ( null != autoLoadTO ) { // 同步加载时间
autoLoadTO . setLastLoadTime ( cacheWrapper . getLastLoadTime ( ) ) // 同步过期时间
. setExpire ( cacheWrapper . getExpire ( ) ) ; } } catch ( Exception ex ) { log . error ( ex . getMessage ( ) , ex ) ; } } return result ; |
public class GeoTarget { /** * Parent IDs are legacy , and some records are inconsistent , so we following AdX ' s docs
* and build hierarchy by the canonical names . Notice canonical names are not always
* unique for leaf records , e . g . " New York , New York , United States " can be either the
* City ( 1023191 ) or the County ( 9058761 ) ; that ' s why we need the TargetType to compose
* a unique CanonicalKey . But parent records are unique , e . g . " New York , United States "
* = State ( 21167 ) , which is parent for both NY / City and NY / County . The hierarchy by
* parent IDs can be different , eg : NY / City < Queens / County < NY / State < - US / Country .
* To make this even more interesting , we can have records like this :
* < pre >
* name = " Champaign & Springfield - Decatur , IL "
* canonicalName = " Champaign & Springfield - Decatur , IL , Illinois , United States "
* < / pre >
* Simply using the first comma to split the parent ' s canonical name will not work ,
* so we need a special case : if the name contains a comma , use its length as a prefix
* for splitting . ( Cannot use this rule for every record either , because that would fail
* in a few records like " Burgos " / " Province of Burgos , Castile and Leon , Spain " ) .
* < p > Some records fail to match the parent by canonical name , for example
* " Zalau , Salaj County , Romania " , the parent record is " Salaj , Romania " . */
String findCanonParentName ( ) { } } | int pos = name . indexOf ( ',' ) ; if ( pos == - 1 ) { int canonPos = key . canonicalName . indexOf ( ',' ) ; return canonPos == - 1 ? null : key . canonicalName . substring ( canonPos + 1 ) ; } else { int commas = 1 ; for ( int i = pos + 1 ; i < name . length ( ) ; ++ i ) { if ( name . charAt ( i ) == ',' ) { ++ commas ; } } int canonPos ; for ( canonPos = 0 ; canonPos < key . canonicalName . length ( ) && commas >= 0 ; ++ canonPos ) { if ( key . canonicalName . charAt ( canonPos ) == ',' ) { -- commas ; } } if ( commas == 0 ) { return null ; } else if ( commas != - 1 || canonPos == key . canonicalName . length ( ) ) { return null ; } else { return key . canonicalName . substring ( canonPos + 1 ) ; } } |
public class GetCurrentMetricDataRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetCurrentMetricDataRequest getCurrentMetricDataRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getCurrentMetricDataRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getCurrentMetricDataRequest . getInstanceId ( ) , INSTANCEID_BINDING ) ; protocolMarshaller . marshall ( getCurrentMetricDataRequest . getFilters ( ) , FILTERS_BINDING ) ; protocolMarshaller . marshall ( getCurrentMetricDataRequest . getGroupings ( ) , GROUPINGS_BINDING ) ; protocolMarshaller . marshall ( getCurrentMetricDataRequest . getCurrentMetrics ( ) , CURRENTMETRICS_BINDING ) ; protocolMarshaller . marshall ( getCurrentMetricDataRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( getCurrentMetricDataRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ApiOvhMe { /** * Get this object properties
* REST : GET / me / deposit / { depositId } / details / { depositDetailId }
* @ param depositId [ required ]
* @ param depositDetailId [ required ] */
public OvhDepositDetail deposit_depositId_details_depositDetailId_GET ( String depositId , String depositDetailId ) throws IOException { } } | String qPath = "/me/deposit/{depositId}/details/{depositDetailId}" ; StringBuilder sb = path ( qPath , depositId , depositDetailId ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhDepositDetail . class ) ; |
public class SyncMembersInner { /** * Gets a sync member database schema .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ param databaseName The name of the database on which the sync group is hosted .
* @ param syncGroupName The name of the sync group on which the sync member is hosted .
* @ param syncMemberName The name of the sync member .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < List < SyncFullSchemaPropertiesInner > > listMemberSchemasAsync ( final String resourceGroupName , final String serverName , final String databaseName , final String syncGroupName , final String syncMemberName , final ListOperationCallback < SyncFullSchemaPropertiesInner > serviceCallback ) { } } | return AzureServiceFuture . fromPageResponse ( listMemberSchemasSinglePageAsync ( resourceGroupName , serverName , databaseName , syncGroupName , syncMemberName ) , new Func1 < String , Observable < ServiceResponse < Page < SyncFullSchemaPropertiesInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < SyncFullSchemaPropertiesInner > > > call ( String nextPageLink ) { return listMemberSchemasNextSinglePageAsync ( nextPageLink ) ; } } , serviceCallback ) ; |
public class MicrochipPotentiometerDeviceController { /** * Enables or disables a wiper ' s lock .
* Hint : This will only work using the & quot ; High Volate Command & quot ; ( see 3.1 ) .
* @ param channel Which wiper
* @ param locked Whether to enable the wiper ' s lock
* @ throws IOException Thrown if communication fails or device returned a malformed result */
public void setWiperLock ( final DeviceControllerChannel channel , final boolean locked ) throws IOException { } } | if ( channel == null ) { throw new RuntimeException ( "null-channel is not allowed. For devices " + "knowing just one wiper Channel.A is mandatory for " + "parameter 'channel'" ) ; } byte memAddr = channel . getNonVolatileMemoryAddress ( ) ; // increasing or decreasing on non - volatile wipers
// enables or disables WiperLock ( see 7.8)
increaseOrDecrease ( memAddr , locked , 1 ) ; |
public class GISTrainer { /** * / * Compute one iteration of GIS and return log - likelihood . */
private double nextIteration ( double correctionConstant ) { } } | // compute contribution of p ( a | b _ i ) for each feature and the new
// correction parameter
double loglikelihood = 0.0 ; int numEvents = 0 ; int numCorrect = 0 ; int numberOfThreads = modelExpects . length ; ExecutorService executor = Executors . newFixedThreadPool ( numberOfThreads ) ; int taskSize = numUniqueEvents / numberOfThreads ; int leftOver = numUniqueEvents % numberOfThreads ; List < Future < ? > > futures = new ArrayList < > ( ) ; for ( int i = 0 ; i < numberOfThreads ; i ++ ) { int len = i == numberOfThreads - 1 ? taskSize + leftOver : taskSize ; futures . add ( executor . submit ( new ModelExpactationComputeTask ( i , i * taskSize , len ) ) ) ; } for ( Future < ? > future : futures ) { ModelExpactationComputeTask finishedTask ; try { finishedTask = ( ModelExpactationComputeTask ) future . get ( ) ; } catch ( InterruptedException e ) { // TODO : We got interrupted , but that is currently not really supported !
// For now we just print the exception and fail hard . We hopefully soon
// handle this case properly !
e . printStackTrace ( ) ; throw new IllegalStateException ( "Interruption is not supported!" , e ) ; } catch ( ExecutionException e ) { // Only runtime exception can be thrown during training , if one was thrown
// it should be re - thrown . That could for example be a NullPointerException
// which is caused through a bug in our implementation .
throw new RuntimeException ( "Exception during training: " + e . getMessage ( ) , e ) ; } // When they are done , retrieve the results . . .
numEvents += finishedTask . getNumEvents ( ) ; numCorrect += finishedTask . getNumCorrect ( ) ; loglikelihood += finishedTask . getLoglikelihood ( ) ; } executor . shutdown ( ) ; // merge the results of the two computations
for ( int pi = 0 ; pi < featNames . length ; pi ++ ) { int [ ] activeOutcomes = params [ pi ] . getOutcomes ( ) ; for ( int aoi = 0 ; aoi < activeOutcomes . length ; aoi ++ ) { for ( int i = 1 ; i < modelExpects . length ; i ++ ) { modelExpects [ 0 ] [ pi ] . updateParameter ( aoi , modelExpects [ i ] [ pi ] . getParameters ( ) [ aoi ] ) ; } } } // compute the new parameter values
for ( int pi = 0 ; pi < featNames . length ; pi ++ ) { double [ ] observed = observedExpects [ pi ] . getParameters ( ) ; double [ ] model = modelExpects [ 0 ] [ pi ] . getParameters ( ) ; int [ ] activeOutcomes = params [ pi ] . getOutcomes ( ) ; for ( int aoi = 0 ; aoi < activeOutcomes . length ; aoi ++ ) { if ( useGaussianSmoothing ) { params [ pi ] . updateParameter ( aoi , gaussianUpdate ( pi , aoi , correctionConstant ) ) ; } else { if ( model [ aoi ] == 0 ) { LOG . error ( "Model expects == 0 for " + featNames [ pi ] + " " + labels [ aoi ] ) ; } params [ pi ] . updateParameter ( aoi , ( ( Math . log ( observed [ aoi ] ) - Math . log ( model [ aoi ] ) ) / correctionConstant ) ) ; } for ( MutableContext [ ] modelExpect : modelExpects ) { modelExpect [ pi ] . setParameter ( aoi , 0.0 ) ; // re - initialize to 0.0 ' s
} } } LOG . debug ( "loglikelihood = " + loglikelihood + "\taccuracy: " + ( ( double ) numCorrect / numEvents ) * 100 ) ; return loglikelihood ; |
public class CPDefinitionSpecificationOptionValuePersistenceImpl { /** * Returns the last cp definition specification option value in the ordered set where CPSpecificationOptionId = & # 63 ; .
* @ param CPSpecificationOptionId the cp specification option ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching cp definition specification option value
* @ throws NoSuchCPDefinitionSpecificationOptionValueException if a matching cp definition specification option value could not be found */
@ Override public CPDefinitionSpecificationOptionValue findByCPSpecificationOptionId_Last ( long CPSpecificationOptionId , OrderByComparator < CPDefinitionSpecificationOptionValue > orderByComparator ) throws NoSuchCPDefinitionSpecificationOptionValueException { } } | CPDefinitionSpecificationOptionValue cpDefinitionSpecificationOptionValue = fetchByCPSpecificationOptionId_Last ( CPSpecificationOptionId , orderByComparator ) ; if ( cpDefinitionSpecificationOptionValue != null ) { return cpDefinitionSpecificationOptionValue ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "CPSpecificationOptionId=" ) ; msg . append ( CPSpecificationOptionId ) ; msg . append ( "}" ) ; throw new NoSuchCPDefinitionSpecificationOptionValueException ( msg . toString ( ) ) ; |
public class InternationalizationServiceSingleton { /** * Retrieves the set of resource bundles handled by the system providing messages for the given locale .
* @ param locale the locale
* @ return the set of resource bundle , empty if none . */
@ Override public Collection < ResourceBundle > bundles ( Locale locale ) { } } | Set < ResourceBundle > bundles = new LinkedHashSet < > ( ) ; for ( I18nExtension extension : extensions ) { if ( extension . locale ( ) . equals ( locale ) ) { bundles . add ( extension . bundle ( ) ) ; } } return bundles ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.