signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class FastTrackTable { /** * Retrieve a specific row by index number , creating a blank row if this row does not exist . * @ param index index number * @ return MapRow instance */ private MapRow getRow ( int index ) { } }
MapRow result ; if ( index == m_rows . size ( ) ) { result = new MapRow ( this , new HashMap < FastTrackField , Object > ( ) ) ; m_rows . add ( result ) ; } else { result = m_rows . get ( index ) ; } return result ;
public class SpringMain { /** * Displays the command line options . */ public void showOptions ( ) { } }
showOptionsHeader ( ) ; for ( Option option : options ) { System . out . println ( option . getInformation ( ) ) ; }
public class TaxinvoiceServiceImp { /** * / * ( non - Javadoc ) * @ see com . popbill . api . TaxinvoiceService # issue ( java . lang . String , com . popbill . api . taxinvoice . MgtKeyType , java . lang . String , java . lang . String ) */ @ Override public IssueResponse issue ( String CorpNum , MgtKeyType KeyType , String MgtKey , String Memo ) throws PopbillException { } }
return issue ( CorpNum , KeyType , MgtKey , Memo , null ) ;
public class DoubleIntegerDBIDKNNHeap { /** * Do a full update for the heap . * @ param distance * Distance * @ param iid * Object id */ private void updateHeap ( final double distance , final int iid ) { } }
final double prevdist = kdist ; final int previd = heap . peekValue ( ) ; heap . replaceTopElement ( distance , iid ) ; kdist = heap . peekKey ( ) ; // If the kdist improved , zap ties . if ( kdist < prevdist ) { numties = 0 ; } else { addToTies ( previd ) ; }
public class FrameMetadata { /** * TODO : UGH : use reflection ! */ public static HashMap < String , Object > makeEmptyFrameMeta ( ) { } }
HashMap < String , Object > hm = new LinkedHashMap < > ( ) ; // preserve insertion order for ( String key : FrameMetadata . METAVALUES ) hm . put ( key , null ) ; return hm ;
public class CalibratingTimer { /** * Initializes this timer . Must be called before the timer is used . * @ param milliDivider - value by which current ( ) must be divided to get milliseconds * @ param microDivider - value by which current ( ) must be divided to get microseconds */ protected void init ( long milliDivider , long microDivider ) { } }
_milliDivider = milliDivider ; _microDivider = microDivider ; reset ( ) ; log . info ( "Using " + getClass ( ) + " timer" , "mfreq" , _milliDivider , "ufreq" , _microDivider , "start" , _startStamp ) ;
public class ReflectUtil { /** * 设置field值 * @ param obj 对象 * @ param field 对象的字段 * @ param fieldValue 字段值 * @ param < T > 字段值泛型 * @ return 字段值 */ public static < T extends Object > T setFieldValue ( Object obj , Field field , T fieldValue ) { } }
Assert . notNull ( obj , "obj不能为空" ) ; Assert . notNull ( field , "field不能为空" ) ; try { field . set ( obj , fieldValue ) ; } catch ( IllegalAccessException e ) { String msg = StringUtils . format ( "类型[{0}]的字段[{1}]不允许设置" , obj . getClass ( ) , field . getName ( ) ) ; log . error ( msg ) ; throw new ReflectException ( msg , e ) ; } return fieldValue ;
public class PadOperation { /** * Returns the character which is used for the padding . If the character string is longer than one char , the first * char will be used . */ private Character getPadCharacter ( String characterString ) { } }
if ( characterString . length ( ) > 0 ) { getLogger ( ) . debug ( "The given character string is longer than one element. The first character is used." ) ; } return characterString . charAt ( 0 ) ;
public class LottieDrawable { /** * These Drawable . Callback methods proxy the calls so that this is the drawable that is * actually invalidated , not a child one which will not pass the view ' s validateDrawable check . */ @ Override public void invalidateDrawable ( @ NonNull Drawable who ) { } }
Callback callback = getCallback ( ) ; if ( callback == null ) { return ; } callback . invalidateDrawable ( this ) ;
public class CommonsConnector { /** * It close the logical connection . * @ param clusterName the connection identifier . */ @ Override public void close ( ClusterName clusterName ) { } }
logger . info ( "Close connection to cluster [" + clusterName + "] from connector [" + this . getClass ( ) . getSimpleName ( ) + "]" ) ; connectionHandler . closeConnection ( clusterName . getName ( ) ) ;
public class CommercePriceEntryPersistenceImpl { /** * Returns the first commerce price entry in the ordered set where CPInstanceUuid = & # 63 ; . * @ param CPInstanceUuid the cp instance uuid * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the first matching commerce price entry * @ throws NoSuchPriceEntryException if a matching commerce price entry could not be found */ @ Override public CommercePriceEntry findByCPInstanceUuid_First ( String CPInstanceUuid , OrderByComparator < CommercePriceEntry > orderByComparator ) throws NoSuchPriceEntryException { } }
CommercePriceEntry commercePriceEntry = fetchByCPInstanceUuid_First ( CPInstanceUuid , orderByComparator ) ; if ( commercePriceEntry != null ) { return commercePriceEntry ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "CPInstanceUuid=" ) ; msg . append ( CPInstanceUuid ) ; msg . append ( "}" ) ; throw new NoSuchPriceEntryException ( msg . toString ( ) ) ;
public class InterconnectClient { /** * Retrieves the list of interconnect available to the specified project . * < p > Sample code : * < pre > < code > * try ( InterconnectClient interconnectClient = InterconnectClient . create ( ) ) { * ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ; * for ( Interconnect element : interconnectClient . listInterconnects ( project . toString ( ) ) . iterateAll ( ) ) { * / / doThingsWith ( element ) ; * < / code > < / pre > * @ param project Project ID for this request . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final ListInterconnectsPagedResponse listInterconnects ( String project ) { } }
ListInterconnectsHttpRequest request = ListInterconnectsHttpRequest . newBuilder ( ) . setProject ( project ) . build ( ) ; return listInterconnects ( request ) ;
public class Key { /** * Generate a random key * @ param random * source of entropy * @ return a new shared secret key */ public static Key generateKey ( final Random random ) { } }
final byte [ ] signingKey = new byte [ signingKeyBytes ] ; random . nextBytes ( signingKey ) ; final byte [ ] encryptionKey = new byte [ encryptionKeyBytes ] ; random . nextBytes ( encryptionKey ) ; return new Key ( signingKey , encryptionKey ) ;
public class CommerceShipmentItemPersistenceImpl { /** * Returns the commerce shipment item with the primary key or throws a { @ link com . liferay . portal . kernel . exception . NoSuchModelException } if it could not be found . * @ param primaryKey the primary key of the commerce shipment item * @ return the commerce shipment item * @ throws NoSuchShipmentItemException if a commerce shipment item with the primary key could not be found */ @ Override public CommerceShipmentItem findByPrimaryKey ( Serializable primaryKey ) throws NoSuchShipmentItemException { } }
CommerceShipmentItem commerceShipmentItem = fetchByPrimaryKey ( primaryKey ) ; if ( commerceShipmentItem == null ) { if ( _log . isDebugEnabled ( ) ) { _log . debug ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } throw new NoSuchShipmentItemException ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } return commerceShipmentItem ;
public class PrimitiveIntegerArrayJsonDeserializer { /** * { @ inheritDoc } */ @ Override protected int [ ] doDeserializeSingleArray ( JsonReader reader , JsonDeserializationContext ctx , JsonDeserializerParameters params ) { } }
return new int [ ] { IntegerJsonDeserializer . getInstance ( ) . deserialize ( reader , ctx , params ) } ;
public class LogRecord { /** * Returns the position of the byte cursor for the mapped byte buffer . * @ return The byte cursor position . */ protected int position ( ) { } }
if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "position" , this ) ; int position = _absolutePosition + _buffer . position ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "position" , new Integer ( position ) ) ; return position ;
public class RootMembership { /** * This method essentially drives the initial loading of the cache layer from the * persistence layer . * @ throws SevereMessageStoreException */ public final void initialize ( ) throws PersistenceException , SevereMessageStoreException { } }
PersistentMessageStore pm = _messageStore . getPersistentMessageStore ( ) ; final HashMap tupleMap = _buildTupleMap ( pm ) ; _buildStreamTree ( tupleMap ) ; _recoverStreamsWithInDoubts ( pm ) ;
public class UserCoreDao { /** * Build where ( or selection ) LIKE statement for a single field * @ param field * field name * @ param value * column value * @ return where clause * @ since 3.0.1 */ public String buildWhereLike ( String field , ColumnValue value ) { } }
String where ; if ( value != null ) { if ( value . getTolerance ( ) != null ) { throw new GeoPackageException ( "Field value tolerance not supported for LIKE query, Field: " + field + ", Value: " + ", Tolerance: " + value . getTolerance ( ) ) ; } where = buildWhereLike ( field , value . getValue ( ) ) ; } else { where = buildWhere ( field , null , null ) ; } return where ;
public class AbstractIntObjectMap { /** * Fills all keys and values < i > sorted ascending by key < / i > into the specified lists . * Fills into the lists , starting at index 0. * After this call returns the specified lists both have a new size that equals < tt > this . size ( ) < / tt > . * < b > Example : < / b > * < br > * < tt > keys = ( 8,7,6 ) , values = ( 1,2,2 ) - - > keyList = ( 6,7,8 ) , valueList = ( 2,2,1 ) < / tt > * @ param keyList the list to be filled with keys , can have any size . * @ param valueList the list to be filled with values , can have any size . */ public void pairsSortedByKey ( final IntArrayList keyList , final ObjectArrayList valueList ) { } }
keys ( keyList ) ; keyList . sort ( ) ; valueList . setSize ( keyList . size ( ) ) ; for ( int i = keyList . size ( ) ; -- i >= 0 ; ) { valueList . setQuick ( i , get ( keyList . getQuick ( i ) ) ) ; }
public class JsonParser { /** * Advance one character ahead , or return { @ link Token # EOF } on end of input . */ private int advanceChar ( ) throws JsonParserException { } }
if ( eof ) return - 1 ; int c = string . charAt ( index ) ; if ( c == '\n' ) { linePos ++ ; rowPos = index + 1 ; utf8adjust = 0 ; } index ++ ; if ( index >= bufferLength ) eof = true ; return c ;
public class MessageBuilder { /** * Creates a FILE _ HEADER message . * @ param length the lenght of the file . * @ return a protobuf message . */ public static Message buildFileHeader ( long length ) { } }
ZabMessage . FileHeader header = ZabMessage . FileHeader . newBuilder ( ) . setLength ( length ) . build ( ) ; return Message . newBuilder ( ) . setType ( MessageType . FILE_HEADER ) . setFileHeader ( header ) . build ( ) ;
public class ConfigOption { /** * # # # # # HELPER METHODS # # # # # */ public static final < E extends Enum > E getEnumValue ( String str , Class < E > enumClass ) { } }
str = str . trim ( ) ; if ( StringUtils . isBlank ( str ) ) return null ; for ( E e : enumClass . getEnumConstants ( ) ) { if ( e . toString ( ) . equalsIgnoreCase ( str ) ) return e ; } throw new IllegalArgumentException ( "Invalid enum string provided for [" + enumClass + "]: " + str ) ;
public class CSSDecoder { /** * Returns the length in pixels from a CSS definition . < code > null < / code > values * of the lengths are interpreted as zero . * @ param value The length or percentage value to be converted * @ param auto True , if the property is set to < code > auto < / code > * @ param defval The length value to be used when the first one is null * @ param autoval The value to be used when " auto " is specified * @ param whole the length to be returned as 100 % ( in case of percentage values ) */ public int getLength ( TermLengthOrPercent value , boolean auto , TermLengthOrPercent defval , TermLengthOrPercent autoval , int whole ) { } }
TermLengthOrPercent val = value ; if ( value == null ) val = defval ; if ( auto ) val = autoval ; if ( val != null ) return ( int ) context . pxLength ( val , whole ) ; else return 0 ;
public class BucketManager { /** * TODO : 准备干掉setImage 、 unsetImage , 重写 */ public Response setImage ( String bucket , String srcSiteUrl , String host ) throws QiniuException { } }
String encodedSiteUrl = UrlSafeBase64 . encodeToString ( srcSiteUrl ) ; String encodedHost = null ; if ( host != null && host . length ( ) > 0 ) { encodedHost = UrlSafeBase64 . encodeToString ( host ) ; } String path = String . format ( "/image/%s/from/%s" , bucket , encodedSiteUrl ) ; if ( encodedHost != null ) { path += String . format ( "/host/%s" , encodedHost ) ; } return pubPost ( path ) ;
public class IPv6AddressRange { /** * Extend the range just enough at its head or tail such that the given address is included . * @ param address address to extend the range to * @ return new ( bigger ) range */ public IPv6AddressRange extend ( IPv6Address address ) { } }
if ( address . compareTo ( first ) < 0 ) return fromFirstAndLast ( address , last ) ; else if ( address . compareTo ( last ) > 0 ) return fromFirstAndLast ( first , address ) ; else return this ;
public class XmlMarshaller { /** * 根据结构体 , 构建XML内容 */ private StringBuffer buildXMLNodeByString ( NodeConfig config , int deep ) { } }
StringBuffer xmlBuffer = new StringBuffer ( ) ; String tagName = config . getName ( ) ; if ( isLowCase == true ) { tagName = StringUtils . lowerCase ( config . getName ( ) ) ; } List < Namespace > namespaces = config . getNamespace ( ) ; if ( namespaces != null && namespaces . size ( ) > 0 ) { Namespace namespace = namespaces . get ( 0 ) ; if ( ! namespace . getPrefix ( ) . equals ( "" ) ) { tagName = namespace . getPrefix ( ) + ":" + tagName ; } } Object tagValue = config . getValue ( ) ; if ( tagValue == null ) { tagValue = "" ; } if ( tagValue instanceof CdataText ) { tagValue = String . format ( "<![CDATA[%s]]>" , ( ( CdataText ) tagValue ) . getData ( ) ) ; } else if ( tagValue instanceof XmlText ) { tagValue = ( ( XmlText ) tagValue ) . getXml ( ) ; } else if ( cdata == true ) { if ( XmlElementUtils . containXMLEscapeChar ( tagValue . toString ( ) ) ) { tagValue = String . format ( "<![CDATA[%s]]>" , tagValue . toString ( ) ) ; } } StringBuffer attributeBuffer = new StringBuffer ( ) ; StringBuffer nodeBuffer = new StringBuffer ( ) ; List < AttributeConfig > attributeList = config . getAttribute ( ) ; if ( attributeList != null && attributeList . size ( ) > 0 ) { for ( AttributeConfig attribute : attributeList ) { if ( attribute . getValue ( ) != null ) { if ( nodeMode == false ) { if ( isLowCase == true ) { attributeBuffer . append ( String . format ( "%s=\"%s\" " , StringUtils . lowerCase ( attribute . getName ( ) ) , attribute . getValue ( ) ) ) ; } else { attributeBuffer . append ( String . format ( "%s=\"%s\" " , attribute . getName ( ) , attribute . getValue ( ) ) ) ; } } else { NodeConfig node = new NodeConfig ( ) ; node . setName ( attribute . getName ( ) ) ; node . setValue ( attribute . getValue ( ) ) ; nodeBuffer . append ( buildXMLNodeByString ( node , deep + 1 ) ) ; } } } } boolean isDeep = true ; List < NodeConfig > childrenNodeList = config . getChildrenNodes ( ) ; if ( childrenNodeList != null && childrenNodeList . size ( ) > 0 ) { for ( NodeConfig childNode : childrenNodeList ) { StringBuffer nodeXML = null ; if ( childNode . getName ( ) . equals ( tagName ) ) { nodeXML = buildXMLNodeByString ( childNode , deep ) ; isDeep = false ; } else { nodeXML = buildXMLNodeByString ( childNode , deep + 1 ) ; } nodeBuffer . append ( nodeXML ) ; } } if ( isDeep == false ) { return nodeBuffer ; } String tab = "" ; if ( prettyPrint ) { for ( int i = 0 ; i < deep ; i ++ ) { tab += indent ; } } if ( ! tagName . equals ( Constant . XML_TAG ) ) { if ( deep == 0 ) { xmlBuffer . append ( tab + "<" + tagName + super . namespaces ) ; } else { xmlBuffer . append ( tab + "<" + tagName ) ; } } if ( attributeBuffer != null && attributeBuffer . length ( ) > 0 ) { xmlBuffer . append ( " " + attributeBuffer . toString ( ) . trim ( ) ) ; } if ( ! tagName . equals ( Constant . XML_TAG ) ) { if ( nodeBuffer . length ( ) > 0 ) { xmlBuffer . append ( ">" ) ; } else { if ( tagValue != null ) { xmlBuffer . append ( ">" ) ; } else { xmlBuffer . append ( "/>" + endOfLine ) ; } } } if ( nodeBuffer . length ( ) > 0 ) { xmlBuffer . append ( endOfLine + nodeBuffer ) ; xmlBuffer . append ( tab + "</" + tagName + ">" + endOfLine ) ; } else { if ( tagValue != null ) { if ( ! tagName . equals ( Constant . XML_TAG ) ) { xmlBuffer . append ( tagValue . toString ( ) ) ; xmlBuffer . append ( "</" + tagName + ">" + endOfLine ) ; } else { xmlBuffer . append ( tab + tagValue + endOfLine ) ; } } } return xmlBuffer ;
public class Capsule3d { /** * Replies the center point of the capsule . * @ return the center point . */ @ Pure @ Override public Point3d getCenter ( ) { } }
return new Point3d ( ( this . medial1 . getX ( ) + this . medial2 . getX ( ) ) / 2. , ( this . medial1 . getY ( ) + this . medial2 . getY ( ) ) / 2. , ( this . medial1 . getZ ( ) + this . medial2 . getZ ( ) ) / 2. ) ;
public class RestletUtilSesameRealm { /** * Returns the modifiable list of root groups . * @ return The modifiable list of root groups . */ public List < Group > getRootGroups ( ) { } }
List < Group > results = this . cachedRootGroups ; if ( results == null ) { synchronized ( this ) { results = this . cachedRootGroups ; if ( results == null ) { results = new ArrayList < Group > ( ) ; RepositoryConnection conn = null ; try { conn = this . getRepository ( ) . getConnection ( ) ; final RepositoryResult < Statement > rootGroupStatements = conn . getStatements ( null , RDF . TYPE , SesameRealmConstants . OAS_ROOTGROUP , true , this . getContexts ( ) ) ; try { while ( rootGroupStatements . hasNext ( ) ) { final Statement nextRootGroupStatement = rootGroupStatements . next ( ) ; if ( nextRootGroupStatement . getSubject ( ) instanceof URI ) { final URI nextRootGroupUri = ( URI ) nextRootGroupStatement . getSubject ( ) ; // add the group recursively to enable member groups to be added // recursively results . add ( this . createGroupHierarchy ( null , conn , nextRootGroupUri ) ) ; } else { this . log . warn ( "Not including root group as it did not have a URI identifier: {}" , nextRootGroupStatement ) ; } } } finally { rootGroupStatements . close ( ) ; } } catch ( final RepositoryException e ) { this . log . error ( "Found exception while trying to get root groups" , e ) ; } finally { try { if ( conn != null ) { conn . close ( ) ; } } catch ( final RepositoryException e ) { this . log . error ( "Found unexpected exception while closing repository connection" , e ) ; } } this . cachedRootGroups = results ; } } } return results ; // throw new RuntimeException ( // " TODO : Implement code not to rely on getting a complete list of groups where possible " ) ; // return this . rootGroups ;
public class FramesHandler { /** * Remove ALL an unlocked frames . Throws IAE for all deletes that failed * ( perhaps because the Frames were locked & in - use ) . */ @ SuppressWarnings ( "unused" ) // called through reflection by RequestServer public FramesV3 deleteAll ( int version , FramesV3 frames ) { } }
final Key [ ] keys = KeySnapshot . globalKeysOfClass ( Frame . class ) ; ArrayList < String > missing = new ArrayList < > ( ) ; Futures fs = new Futures ( ) ; for ( Key key : keys ) { try { getFromDKV ( "(none)" , key ) . delete ( null , fs ) ; } catch ( IllegalArgumentException iae ) { missing . add ( key . toString ( ) ) ; } } fs . blockForPending ( ) ; if ( missing . size ( ) != 0 ) throw new H2OKeysNotFoundArgumentException ( "(none)" , missing . toArray ( new String [ missing . size ( ) ] ) ) ; return frames ;
public class FunctionApplication { /** * Exit and print an error message if debug flag set . * @ param isDebug flag for print error * @ param e exception passed in */ static void exitWithError ( Boolean isDebug , Exception e ) { } }
System . err . println ( "Error executing function (Use -x for more information): " + e . getMessage ( ) ) ; if ( isDebug ) { System . err . println ( ) ; System . err . println ( "Error Detail" ) ; System . err . println ( "------------" ) ; e . printStackTrace ( System . err ) ; } System . exit ( 1 ) ;
public class StrSpliter { /** * 通过正则切分字符串为字符串数组 * @ param str 被切分的字符串 * @ param separatorPattern 分隔符正则 { @ link Pattern } * @ param limit 限制分片数 * @ param isTrim 是否去除切分字符串后每个元素两边的空格 * @ param ignoreEmpty 是否忽略空串 * @ return 切分后的集合 * @ since 3.0.8 */ public static String [ ] splitToArray ( String str , Pattern separatorPattern , int limit , boolean isTrim , boolean ignoreEmpty ) { } }
return toArray ( split ( str , separatorPattern , limit , isTrim , ignoreEmpty ) ) ;
public class Branch { /** * < p > Initialises a session with the Branch API , with associated data from the supplied * { @ link Uri } . < / p > * @ param data A { @ link Uri } variable containing the details of the source link that led to this * initialisation action . * @ param activity The calling { @ link Activity } for context . * @ return A { @ link Boolean } value that returns < i > false < / i > if unsuccessful . */ public boolean initSessionWithData ( Uri data , Activity activity ) { } }
readAndStripParam ( data , activity ) ; return initSession ( ( BranchReferralInitListener ) null , activity ) ;
public class FoundationLoggingDispatcher { /** * { @ inheritDoc } */ public void run ( ) { } }
boolean isActive = true ; // if interrupted ( unlikely ) , end thread try { // loop until the AsyncAppender is closed . while ( isActive ) { LoggingEvent [ ] events = null ; // extract pending events while synchronized // on buffer synchronized ( buffer ) { int bufferSize = buffer . size ( ) ; isActive = ! isAsyncAppenderClosed ( parent ) ; while ( ( bufferSize == 0 ) && isActive ) { buffer . wait ( ) ; bufferSize = buffer . size ( ) ; isActive = ! isAsyncAppenderClosed ( parent ) ; } if ( bufferSize > 0 ) { events = new LoggingEvent [ bufferSize + discardMap . size ( ) ] ; buffer . toArray ( events ) ; // add events due to buffer overflow int index = bufferSize ; for ( Iterator iter = discardMap . values ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { events [ index ++ ] = ( ( DiscardSummary ) iter . next ( ) ) . createEvent ( ) ; } // clear buffer and discard map buffer . clear ( ) ; discardMap . clear ( ) ; // allow blocked appends to continue buffer . notifyAll ( ) ; } } // process events after lock on buffer is released . if ( events != null ) { for ( int i = 0 ; i < events . length ; i ++ ) { synchronized ( appenders ) { LoggingEvent event = events [ i ] ; @ SuppressWarnings ( "unchecked" ) Enumeration < Appender > allAppenders = appenders . getAllAppenders ( ) ; while ( allAppenders . hasMoreElements ( ) ) { Appender appender = allAppenders . nextElement ( ) ; // since we may update the appender layout we must sync so other threads won ' t use it by mistake synchronized ( appender ) { Layout originalLayout = appender . getLayout ( ) ; boolean appenderUpdated = udpateLayoutIfNeeded ( appender , event ) ; appender . doAppend ( event ) ; if ( appenderUpdated ) { appender . setLayout ( originalLayout ) ; } } } } } } } } catch ( InterruptedException ex ) { Thread . currentThread ( ) . interrupt ( ) ; }
public class Config { /** * Extends the runtime classpath to include the files or directories specified . * @ param files one or more File objects representing a single JAR file or a directory containing JARs . * @ since 1.0.0 */ public void expandClasspath ( File ... files ) { } }
ClassLoader classLoader = ClassLoader . getSystemClassLoader ( ) ; Class < URLClassLoader > urlClass = URLClassLoader . class ; for ( File file : files ) { LOGGER . info ( "Expanding classpath to include: " + file . getAbsolutePath ( ) ) ; URI fileUri = file . toURI ( ) ; try { Method method = urlClass . getDeclaredMethod ( "addURL" , URL . class ) ; method . setAccessible ( true ) ; method . invoke ( classLoader , fileUri . toURL ( ) ) ; } catch ( MalformedURLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e ) { LOGGER . error ( "Error expanding classpath" , e ) ; } }
public class Path { /** * Add a line to the contour or hole which ends at the specified * location . * @ param x The x coordinate to draw the line to * @ param y The y coordiante to draw the line to */ public void lineTo ( float x , float y ) { } }
if ( hole != null ) { hole . add ( new float [ ] { x , y } ) ; } else { localPoints . add ( new float [ ] { x , y } ) ; } cx = x ; cy = y ; pointsDirty = true ;
public class MapboxMapMatching { /** * Wrapper method for Retrofits { @ link Call # enqueue ( Callback ) } call returning a response specific * to the Map Matching API . Use this method to make a directions request on the Main Thread . * @ param callback a { @ link Callback } which is used once the { @ link MapMatchingResponse } is * created . * @ since 1.0.0 */ @ Override public void enqueueCall ( final Callback < MapMatchingResponse > callback ) { } }
getCall ( ) . enqueue ( new Callback < MapMatchingResponse > ( ) { @ Override public void onResponse ( Call < MapMatchingResponse > call , Response < MapMatchingResponse > response ) { MatchingResponseFactory factory = new MatchingResponseFactory ( MapboxMapMatching . this ) ; Response < MapMatchingResponse > generatedResponse = factory . generate ( response ) ; callback . onResponse ( call , generatedResponse ) ; } @ Override public void onFailure ( Call < MapMatchingResponse > call , Throwable throwable ) { callback . onFailure ( call , throwable ) ; } } ) ;
public class PhoneNumberUtil { /** * parse phone number . * @ param pphoneNumber phone number as string * @ param pphoneNumberData phone number data to fill * @ param pcountryData country data * @ return PhoneNumberData , the same as in second parameter */ public ValueWithPos < PhoneNumberData > parsePhoneNumber ( final ValueWithPos < String > pphoneNumber , final PhoneNumberInterface pphoneNumberData , final PhoneCountryData pcountryData ) { } }
if ( pphoneNumber == null || pphoneNumberData == null ) { return null ; } int cursorpos = pphoneNumber . getPos ( ) ; int cursorpossub = 0 ; for ( int pos = 0 ; pos < cursorpos && pos < StringUtils . length ( pphoneNumber . getValue ( ) ) ; pos ++ ) { final char character = pphoneNumber . getValue ( ) . charAt ( pos ) ; if ( character < '0' || character > '9' ) { cursorpossub ++ ; } } cursorpos -= cursorpossub ; boolean needsAreaCode = false ; int minLength = 2 ; int maxLength = 15 ; pphoneNumberData . setCountryCode ( null ) ; pphoneNumberData . setAreaCode ( null ) ; pphoneNumberData . setLineNumber ( null ) ; pphoneNumberData . setExtension ( null ) ; final StringBuilder cleanupString = new StringBuilder ( pphoneNumber . getValue ( ) . length ( ) ) ; final boolean containsMinus = StringUtils . contains ( pphoneNumber . getValue ( ) , '-' ) ; boolean hasSeperator = false ; for ( final char character : StringUtils . reverse ( pphoneNumber . getValue ( ) ) . toCharArray ( ) ) { switch ( character ) { case '0' : case '1' : case '2' : case '3' : case '4' : case '5' : case '6' : case '7' : case '8' : case '9' : cleanupString . append ( character ) ; break ; case '-' : if ( ! hasSeperator ) { cleanupString . append ( character ) ; hasSeperator = true ; } break ; case ' ' : if ( ! hasSeperator && ! containsMinus && cleanupString . length ( ) <= 5 ) { cleanupString . append ( '-' ) ; hasSeperator = true ; } break ; default : // ignore all other characters break ; } } String phoneNumberWork = StringUtils . reverse ( cleanupString . toString ( ) ) ; if ( pcountryData != null ) { if ( StringUtils . isNotEmpty ( pcountryData . getExitCode ( ) ) && phoneNumberWork . startsWith ( pcountryData . getExitCode ( ) ) ) { phoneNumberWork = phoneNumberWork . substring ( pcountryData . getExitCode ( ) . length ( ) ) ; cursorpos -= pcountryData . getExitCode ( ) . length ( ) ; } else if ( StringUtils . isNotEmpty ( pcountryData . getTrunkCode ( ) ) && phoneNumberWork . startsWith ( pcountryData . getTrunkCode ( ) ) ) { phoneNumberWork = pcountryData . getCountryCodeData ( ) . getCountryCode ( ) + phoneNumberWork . substring ( pcountryData . getTrunkCode ( ) . length ( ) ) ; if ( cursorpos >= pcountryData . getTrunkCode ( ) . length ( ) ) { cursorpos -= pcountryData . getTrunkCode ( ) . length ( ) ; cursorpos += StringUtils . length ( pcountryData . getCountryCodeData ( ) . getCountryCode ( ) ) ; } } } for ( final PhoneCountryCodeData countryCode : CreatePhoneCountryConstantsClass . create ( ) . countryCodeData ( ) ) { if ( phoneNumberWork . startsWith ( countryCode . getCountryCode ( ) ) ) { pphoneNumberData . setCountryCode ( countryCode . getCountryCode ( ) ) ; maxLength -= StringUtils . length ( countryCode . getCountryCode ( ) ) ; if ( pphoneNumberData instanceof PhoneNumberExtendedInterface ) { ( ( PhoneNumberExtendedInterface ) pphoneNumberData ) . setCountryName ( countryCode . getCountryCodeName ( ) ) ; } phoneNumberWork = phoneNumberWork . substring ( countryCode . getCountryCode ( ) . length ( ) ) ; if ( phoneNumberWork . startsWith ( PhoneNumberUtil . EXTENSION_SEPARATOR ) ) { phoneNumberWork = phoneNumberWork . substring ( 1 ) ; } if ( countryCode . getPhoneCountryData ( ) != null ) { needsAreaCode = countryCode . getPhoneCountryData ( ) . isAreaCodeMustBeFilled ( ) ; if ( StringUtils . isNotEmpty ( countryCode . getPhoneCountryData ( ) . getTrunkCode ( ) ) && phoneNumberWork . startsWith ( countryCode . getPhoneCountryData ( ) . getTrunkCode ( ) ) ) { phoneNumberWork = phoneNumberWork . substring ( countryCode . getPhoneCountryData ( ) . getTrunkCode ( ) . length ( ) ) ; if ( cursorpos >= countryCode . getPhoneCountryData ( ) . getTrunkCode ( ) . length ( ) ) { cursorpos -= countryCode . getPhoneCountryData ( ) . getTrunkCode ( ) . length ( ) ; } } } for ( final PhoneAreaCodeData areaCode : countryCode . getAreaCodeData ( ) ) { if ( areaCode . isRegEx ( ) && phoneNumberWork . matches ( "^" + areaCode . getAreaCode ( ) + ".*" ) ) { final String areaCodeRemember = phoneNumberWork ; phoneNumberWork = phoneNumberWork . replaceFirst ( areaCode . getAreaCode ( ) , StringUtils . EMPTY ) ; pphoneNumberData . setAreaCode ( areaCodeRemember . substring ( 0 , areaCodeRemember . length ( ) - phoneNumberWork . length ( ) ) ) ; if ( pphoneNumberData instanceof PhoneNumberExtendedInterface ) { ( ( PhoneNumberExtendedInterface ) pphoneNumberData ) . setAreaName ( areaCode . getAreaName ( ) ) ; } minLength = areaCode . getMinLength ( ) ; maxLength = areaCode . getMaxLength ( ) ; break ; } else if ( ! areaCode . isRegEx ( ) && phoneNumberWork . startsWith ( areaCode . getAreaCode ( ) ) ) { pphoneNumberData . setAreaCode ( areaCode . getAreaCode ( ) ) ; if ( pphoneNumberData instanceof PhoneNumberExtendedInterface ) { ( ( PhoneNumberExtendedInterface ) pphoneNumberData ) . setAreaName ( areaCode . getAreaName ( ) ) ; } phoneNumberWork = phoneNumberWork . substring ( areaCode . getAreaCode ( ) . length ( ) ) ; minLength = areaCode . getMinLength ( ) ; maxLength = areaCode . getMaxLength ( ) ; break ; } } if ( phoneNumberWork . startsWith ( PhoneNumberUtil . EXTENSION_SEPARATOR ) ) { phoneNumberWork = phoneNumberWork . substring ( 1 ) ; } if ( phoneNumberWork . contains ( PhoneNumberUtil . EXTENSION_SEPARATOR ) ) { final String [ ] splitedPhoneNumber = phoneNumberWork . split ( PhoneNumberUtil . EXTENSION_SEPARATOR ) ; pphoneNumberData . setLineNumber ( splitedPhoneNumber [ 0 ] ) ; if ( splitedPhoneNumber . length > 1 ) { pphoneNumberData . setExtension ( splitedPhoneNumber [ 1 ] ) ; } } else { pphoneNumberData . setLineNumber ( phoneNumberWork ) ; } break ; } } if ( pphoneNumberData instanceof ValidationInterface ) { int callNummerLength = StringUtils . length ( pphoneNumberData . getLineNumber ( ) ) ; int completeNumberLength = callNummerLength ; if ( StringUtils . isNotEmpty ( pphoneNumberData . getExtension ( ) ) ) { // if we do have extensions , phone number including extension may be longer then allowed // number , but at least one digit counts callNummerLength ++ ; completeNumberLength += StringUtils . length ( pphoneNumberData . getExtension ( ) ) ; } ( ( ValidationInterface ) pphoneNumberData ) . setValid ( StringUtils . isNotEmpty ( pphoneNumberData . getCountryCode ( ) ) && StringUtils . isNotEmpty ( pphoneNumberData . getLineNumber ( ) ) && ( StringUtils . isNotEmpty ( pphoneNumberData . getAreaCode ( ) ) || ! needsAreaCode ) && ( callNummerLength >= minLength && callNummerLength <= maxLength || completeNumberLength >= minLength && completeNumberLength <= maxLength ) ) ; } if ( cursorpos < 0 ) { cursorpos = 0 ; } else { final int calculatedlength = StringUtils . length ( pphoneNumberData . getCountryCode ( ) ) + StringUtils . length ( pphoneNumberData . getAreaCode ( ) ) + StringUtils . length ( pphoneNumberData . getLineNumber ( ) ) + StringUtils . length ( pphoneNumberData . getExtension ( ) ) ; if ( cursorpos > calculatedlength ) { cursorpos = calculatedlength ; } } return new ValueWithPos < > ( new PhoneNumberData ( pphoneNumberData ) , cursorpos ) ;
public class AbstractResultSetWrapper { /** * { @ inheritDoc } * @ see java . sql . ResultSet # updateSQLXML ( java . lang . String , java . sql . SQLXML ) */ @ Override public void updateSQLXML ( final String columnLabel , final SQLXML xmlObject ) throws SQLException { } }
wrapped . updateSQLXML ( columnLabel , xmlObject ) ;
public class ArrayFunctions { /** * Returned expression results in new array with value appended . */ public static Expression arrayAppend ( Expression expression , Expression value ) { } }
return x ( "ARRAY_APPEND(" + expression . toString ( ) + ", " + value . toString ( ) + ")" ) ;
public class BaseRecordMessageFilter { /** * Are these filters functionally the same ? * @ return true if they are . */ public boolean isSameFilter ( BaseMessageFilter filter ) { } }
if ( filter . getClass ( ) . equals ( this . getClass ( ) ) ) { if ( this . get ( DB_NAME ) != null ) if ( this . get ( DB_NAME ) . equals ( filter . get ( DB_NAME ) ) ) if ( this . get ( TABLE_NAME ) != null ) if ( this . get ( TABLE_NAME ) . equals ( filter . get ( TABLE_NAME ) ) ) { return true ; } if ( filter . isFilterMatch ( this ) ) ; } return false ;
public class SimpleExecutionRunnable { /** * Creates InProgress execution message for the next step , base on current execution message - used for short cut ! */ private ExecutionMessage createInProgressExecutionMessage ( Execution nextStepExecution ) { } }
// Take care of worker group String groupName = nextStepExecution . getGroupName ( ) ; if ( groupName == null ) { groupName = WorkerNode . DEFAULT_WORKER_GROUPS [ 0 ] ; } Long id = queueStateIdGeneratorService . generateStateId ( ) ; // Stay in the same worker in the next step return new ExecutionMessage ( id , executionMessage . getWorkerId ( ) , groupName , executionMessage . getMsgId ( ) , ExecStatus . IN_PROGRESS , nextStepExecution , converter . createPayload ( nextStepExecution ) , 0 ) . setWorkerKey ( executionMessage . getWorkerKey ( ) ) ;
public class ThreadObjectHprofGCRoot { /** * ~ Methods - - - - - */ public StackTraceElement [ ] getStackTrace ( ) { } }
int stackTraceSerialNumber = getStackTraceSerialNumber ( ) ; if ( stackTraceSerialNumber != 0 ) { StackTrace stackTrace = heap . getStackTraceSegment ( ) . getStackTraceBySerialNumber ( stackTraceSerialNumber ) ; if ( stackTrace != null ) { StackFrame [ ] frames = stackTrace . getStackFrames ( ) ; StackTraceElement [ ] stackElements = new StackTraceElement [ frames . length ] ; for ( int i = 0 ; i < frames . length ; i ++ ) { StackFrame f = frames [ i ] ; String className = f . getClassName ( ) ; String method = f . getMethodName ( ) ; String source = f . getSourceFile ( ) ; int number = f . getLineNumber ( ) ; if ( number == StackFrame . NATIVE_METHOD ) { number = - 2 ; } else if ( number == StackFrame . NO_LINE_INFO || number == StackFrame . UNKNOWN_LOCATION ) { number = - 1 ; } stackElements [ i ] = new StackTraceElement ( className , method , source , number ) ; } return stackElements ; } } return null ;
public class IR { /** * helper methods */ private static Node binaryOp ( Token token , Node expr1 , Node expr2 ) { } }
checkState ( mayBeExpression ( expr1 ) , expr1 ) ; checkState ( mayBeExpression ( expr2 ) , expr2 ) ; return new Node ( token , expr1 , expr2 ) ;
public class MolfileEncoder { /** * method to compress the given molfile in a gezipped Base64 string * @ param str given molfile * @ throws EncoderException */ private static String compress ( String str ) throws EncoderException { } }
ByteArrayOutputStream rstBao = null ; GZIPOutputStream zos = null ; try { rstBao = new ByteArrayOutputStream ( ) ; zos = new GZIPOutputStream ( rstBao ) ; zos . write ( str . getBytes ( ) ) ; IOUtils . closeQuietly ( zos ) ; byte [ ] bytes = rstBao . toByteArray ( ) ; return Base64 . encodeBase64String ( bytes ) ; } catch ( Exception e ) { throw new EncoderException ( "Molfile could not be compressed. " + str ) ; } finally { IOUtils . closeQuietly ( zos ) ; }
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcOwnerHistory ( ) { } }
if ( ifcOwnerHistoryEClass == null ) { ifcOwnerHistoryEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 343 ) ; } return ifcOwnerHistoryEClass ;
public class CmsColorSelector { /** * Fires whenever the user generates picking events along the color picker bar . < p > * @ param y the distance along the y - axis */ public void onBarSelected ( int y ) { } }
switch ( m_colorMode ) { case CmsSliderBar . HUE : m_hue = 360 - percentOf ( y , 360 ) ; m_tbHue . setText ( Integer . toString ( m_hue ) ) ; onChange ( m_tbHue ) ; break ; case CmsSliderBar . SATURATIN : m_saturation = 100 - percentOf ( y , 100 ) ; m_tbSaturation . setText ( Integer . toString ( m_saturation ) ) ; onChange ( m_tbSaturation ) ; break ; case CmsSliderBar . BRIGHTNESS : m_brightness = 100 - percentOf ( y , 100 ) ; m_tbBrightness . setText ( Integer . toString ( m_brightness ) ) ; onChange ( m_tbBrightness ) ; break ; case CmsSliderBar . RED : m_red = 255 - y ; m_tbRed . setText ( Integer . toString ( m_red ) ) ; onChange ( m_tbRed ) ; break ; case CmsSliderBar . GREEN : m_green = 255 - y ; m_tbGreen . setText ( Integer . toString ( m_green ) ) ; onChange ( m_tbGreen ) ; break ; case CmsSliderBar . BLUE : m_blue = 255 - y ; m_tbBlue . setText ( Integer . toString ( m_blue ) ) ; onChange ( m_tbBlue ) ; break ; default : break ; }
public class EventReader { /** * Clean up the message after CPL finishes the processing . * < li > If the source is filtered out , the message will be deleted with { @ link ProgressState # deleteFilteredMessage } . < / li > * < li > If the processing is successful , the message with be deleted with { @ link ProgressState # deleteMessage } . < / li > * < li > If the processing failed due to downloading logs , the message will not be deleted regardless of * { @ link ProcessingConfiguration # isDeleteMessageUponFailure ( ) } value . Otherwise , this property controls the * deletion decision . < / li > */ private void cleanupMessage ( boolean filterSourceOut , boolean downloadLogsSuccess , boolean processSourceSuccess , CloudTrailSource source ) { } }
if ( filterSourceOut ) { deleteMessageAfterProcessSource ( ProgressState . deleteFilteredMessage , source ) ; } else if ( processSourceSuccess || sqsManager . shouldDeleteMessageUponFailure ( ! downloadLogsSuccess ) ) { deleteMessageAfterProcessSource ( ProgressState . deleteMessage , source ) ; }
public class CurrentSpanUtils { /** * Wraps a { @ link Runnable } so that it executes with the { @ code span } as the current { @ code Span } . * @ param span the { @ code Span } to be set as current . * @ param endSpan if { @ code true } the returned { @ code Runnable } will close the { @ code Span } . * @ param runnable the { @ code Runnable } to run in the { @ code Span } . * @ return the wrapped { @ code Runnable } . */ static Runnable withSpan ( Span span , boolean endSpan , Runnable runnable ) { } }
return new RunnableInSpan ( span , runnable , endSpan ) ;
public class ResourcesInner { /** * Checks by ID whether a resource exists . * @ param resourceId The fully qualified ID of the resource , including the resource name and resource type . Use the format , / subscriptions / { guid } / resourceGroups / { resource - group - name } / { resource - provider - namespace } / { resource - type } / { resource - name } * @ param apiVersion The API version to use for the operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the Boolean object */ public Observable < ServiceResponse < Boolean > > checkExistenceByIdWithServiceResponseAsync ( String resourceId , String apiVersion ) { } }
if ( resourceId == null ) { throw new IllegalArgumentException ( "Parameter resourceId is required and cannot be null." ) ; } if ( apiVersion == null ) { throw new IllegalArgumentException ( "Parameter apiVersion is required and cannot be null." ) ; } return service . checkExistenceById ( resourceId , apiVersion , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < Void > , Observable < ServiceResponse < Boolean > > > ( ) { @ Override public Observable < ServiceResponse < Boolean > > call ( Response < Void > response ) { try { ServiceResponse < Boolean > clientResponse = checkExistenceByIdDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class TrackerMeanShiftLikelihood { /** * Updates the target ' s location in the image by performing a mean - shift search . Returns if it was * successful at finding the target or not . If it fails once it will need to be re - initialized * @ param image Most recent image in the sequence * @ return true for success or false if it failed */ public boolean process ( T image ) { } }
if ( failed ) return false ; targetModel . setImage ( image ) ; // mark the region where the pdf has been modified as dirty dirty . set ( location . x0 , location . y0 , location . x0 + location . width , location . y0 + location . height ) ; // compute the pdf inside the initial rectangle updatePdfImage ( location . x0 , location . y0 , location . x0 + location . width , location . y0 + location . height ) ; // current location of the target int x0 = location . x0 ; int y0 = location . y0 ; // previous location of the target in the most recent iteration int prevX = x0 ; int prevY = y0 ; // iterate until it converges or reaches the maximum number of iterations for ( int i = 0 ; i < maxIterations ; i ++ ) { // compute the weighted centroid using the likelihood function float totalPdf = 0 ; float sumX = 0 ; float sumY = 0 ; for ( int y = 0 ; y < location . height ; y ++ ) { int indexPdf = pdf . startIndex + pdf . stride * ( y + y0 ) + x0 ; for ( int x = 0 ; x < location . width ; x ++ ) { float p = pdf . data [ indexPdf ++ ] ; totalPdf += p ; sumX += ( x0 + x ) * p ; sumY += ( y0 + y ) * p ; } } // if the target isn ' t likely to be in view , give up if ( totalPdf <= minimumSum ) { failed = true ; return false ; } // Use the new center to find the new top left corner , while rounding to the nearest integer x0 = ( int ) ( sumX / totalPdf - location . width / 2 + 0.5f ) ; y0 = ( int ) ( sumY / totalPdf - location . height / 2 + 0.5f ) ; // make sure it doesn ' t go outside the image if ( x0 < 0 ) x0 = 0 ; else if ( x0 >= image . width - location . width ) x0 = image . width - location . width ; if ( y0 < 0 ) y0 = 0 ; else if ( y0 >= image . height - location . height ) y0 = image . height - location . height ; // see if it has converged if ( x0 == prevX && y0 == prevY ) break ; // save the previous location prevX = x0 ; prevY = y0 ; // update the pdf updatePdfImage ( x0 , y0 , x0 + location . width , y0 + location . height ) ; } // update the output location . x0 = x0 ; location . y0 = y0 ; // clean up the image for the next iteration ImageMiscOps . fillRectangle ( pdf , - 1 , dirty . x0 , dirty . y0 , dirty . x1 - dirty . x0 , dirty . y1 - dirty . y0 ) ; return true ;
public class LineBuffer { /** * Clear the entire buffer , and the terminal area it represents . */ public void clear ( ) { } }
if ( buffer . size ( ) > 0 ) { terminal . format ( "\r%s" , CURSOR_ERASE ) ; for ( int i = 1 ; i < buffer . size ( ) ; ++ i ) { terminal . format ( "%s%s" , UP , CURSOR_ERASE ) ; } buffer . clear ( ) ; }
public class Validator { /** * Add message when validate failure . */ protected void addError ( String errorKey , String errorMessage ) { } }
invalid = true ; controller . setAttr ( errorKey , errorMessage ) ; if ( shortCircuit ) { throw new ValidateException ( ) ; }
public class MockArtifactStore { /** * { @ inheritDoc } */ public synchronized Set < String > getVersions ( String groupId , String artifactId ) { } }
Map < String , Map < String , Map < Artifact , Content > > > artifactMap = contents . get ( groupId ) ; Map < String , Map < Artifact , Content > > versionMap = ( artifactMap == null ? null : artifactMap . get ( artifactId ) ) ; return new TreeSet < String > ( versionMap == null ? Collections . < String > emptySet ( ) : versionMap . keySet ( ) ) ;
public class BenchmarkOutputParser { /** * Opens a resource from classpath . * @ param file * Filename of resource * @ return Stream of given file * @ throws IOException * Failed to open resource */ private static InputStream openResource ( final String file ) throws IOException { } }
InputStream stream = HtmlConverterApplication . class . getResourceAsStream ( "/" + file ) ; if ( stream == null ) { throw new FileNotFoundException ( file ) ; } else { return stream ; }
public class ComputeFunction { /** * Sets the new value of this vertex . * < p > This should be called at most once per ComputeFunction . * @ param newValue The new vertex value . */ public final void setNewVertexValue ( VV newValue ) { } }
if ( setNewVertexValueCalled ) { throw new IllegalStateException ( "setNewVertexValue should only be called at most once per updateVertex" ) ; } setNewVertexValueCalled = true ; outVertex . f1 = newValue ; out . collect ( Either . Left ( outVertex ) ) ;
public class Decoder { /** * < p > Decodes a QR Code represented as a { @ link BitMatrix } . A 1 or " true " is taken to mean a black module . < / p > * @ param bits booleans representing white / black QR Code modules * @ param hints decoding hints that should be used to influence decoding * @ return text and bytes encoded within the QR Code * @ throws FormatException if the QR Code cannot be decoded * @ throws ChecksumException if error correction fails */ public DecoderResult decode ( BitMatrix bits , Map < DecodeHintType , ? > hints ) throws FormatException , ChecksumException { } }
// Construct a parser and read version , error - correction level BitMatrixParser parser = new BitMatrixParser ( bits ) ; FormatException fe = null ; ChecksumException ce = null ; try { return decode ( parser , hints ) ; } catch ( FormatException e ) { fe = e ; } catch ( ChecksumException e ) { ce = e ; } try { // Revert the bit matrix parser . remask ( ) ; // Will be attempting a mirrored reading of the version and format info . parser . setMirror ( true ) ; // Preemptively read the version . parser . readVersion ( ) ; // Preemptively read the format information . parser . readFormatInformation ( ) ; /* * Since we ' re here , this means we have successfully detected some kind * of version and format information when mirrored . This is a good sign , * that the QR code may be mirrored , and we should try once more with a * mirrored content . */ // Prepare for a mirrored reading . parser . mirror ( ) ; DecoderResult result = decode ( parser , hints ) ; // Success ! Notify the caller that the code was mirrored . result . setOther ( new QRCodeDecoderMetaData ( true ) ) ; return result ; } catch ( FormatException | ChecksumException e ) { // Throw the exception from the original reading if ( fe != null ) { throw fe ; } throw ce ; // If fe is null , this can ' t be }
public class ResolvedTargets { /** * A list of parameter values sent to targets that resolved during the Automation execution . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setParameterValues ( java . util . Collection ) } or { @ link # withParameterValues ( java . util . Collection ) } if you * want to override the existing values . * @ param parameterValues * A list of parameter values sent to targets that resolved during the Automation execution . * @ return Returns a reference to this object so that method calls can be chained together . */ public ResolvedTargets withParameterValues ( String ... parameterValues ) { } }
if ( this . parameterValues == null ) { setParameterValues ( new com . amazonaws . internal . SdkInternalList < String > ( parameterValues . length ) ) ; } for ( String ele : parameterValues ) { this . parameterValues . add ( ele ) ; } return this ;
public class Function { /** * Logging of an Exception in a function with a simple message outputting the name and call parameters of the function * @ param caller The element that caused the error * @ param t The thrown Exception * @ param parameters The method parameters */ protected void logException ( final Object caller , final Throwable t , final Object [ ] parameters ) { } }
logException ( t , "{}: Exception in '{}' for parameters: {}" , new Object [ ] { getReplacement ( ) , caller , getParametersAsString ( parameters ) } ) ;
public class FnInteger { /** * It performs the operation target < sup > power < / sup > and returns its value . The result * precision and rounding mode is specified by the given { @ link MathContext } * @ param power the power to raise the target to * @ param mathContext the { @ link MathContext } to specify precision and { @ link RoundingMode } * @ return the result of target < sup > power < / sup > */ public final static Function < Integer , Integer > pow ( int power , MathContext mathContext ) { } }
return new Pow ( power , mathContext ) ;
public class AlertPolicyCache { /** * Returns the cache of alert channels for the given policy , creating one if it doesn ' t exist . * @ param policyId The id of the policy for the cache of alert channels * @ return The cache of alert channels for the given policy */ public AlertChannelCache alertChannels ( long policyId ) { } }
AlertChannelCache cache = channels . get ( policyId ) ; if ( cache == null ) channels . put ( policyId , cache = new AlertChannelCache ( policyId ) ) ; return cache ;
public class Sessions { /** * 获取客服聊天记录 * @ param start 开始时间 * @ param end 结束时间 * @ param index 查询第几页 * @ param size 每页大小 * @ return 聊天记录 */ public List < SessionLog > listSessionLogs ( Date start , Date end , int index , int size ) { } }
String url = WxEndpoint . get ( "url.care.session.logs" ) ; Map < String , Object > request = new HashMap < > ( ) ; request . put ( "starttime" , start . getTime ( ) / 1000 ) ; request . put ( "endtime" , end . getTime ( ) / 1000 ) ; request . put ( "pageindex" , index ) ; request . put ( "pagesize" , size ) ; String json = JsonMapper . nonEmptyMapper ( ) . toJson ( request ) ; logger . debug ( "get session logs: {}" , json ) ; String response = wxClient . post ( url , json ) ; SessionLogList sessionLogList = JsonMapper . defaultMapper ( ) . fromJson ( response , SessionLogList . class ) ; return sessionLogList . getLogs ( ) ;
public class WebUtils { /** * Put recaptcha settings flow scope . * @ param context the context * @ param googleRecaptcha the properties */ public static void putRecaptchaPropertiesFlowScope ( final RequestContext context , final GoogleRecaptchaProperties googleRecaptcha ) { } }
val flowScope = context . getFlowScope ( ) ; flowScope . put ( "recaptchaSiteKey" , googleRecaptcha . getSiteKey ( ) ) ; flowScope . put ( "recaptchaInvisible" , googleRecaptcha . isInvisible ( ) ) ; flowScope . put ( "recaptchaPosition" , googleRecaptcha . getPosition ( ) ) ; flowScope . put ( "recaptchaVersion" , googleRecaptcha . getVersion ( ) . name ( ) . toLowerCase ( ) ) ;
public class FileLock { /** * 释放锁 */ public void release ( ) { } }
try { if ( lock != null ) { lock . release ( ) ; } } catch ( IOException e ) { throw new RuntimeException ( e ) ; } finally { if ( channel != null ) { try { channel . close ( ) ; // also releases the lock } catch ( IOException e ) { LOGGER . error ( "file channel close failed." , e ) ; } } }
public class Tools { /** * Checks the bilingual input ( bitext ) . * @ param src Source text . * @ param trg Target text . * @ param srcLt Source JLanguageTool ( used to analyze the text ) . * @ param trgLt Target JLanguageTool ( used to analyze the text ) . * @ param bRules Bilingual rules used in addition to target standard rules . * @ return The list of rule matches on the bitext . * @ since 1.0.1 */ public static List < RuleMatch > checkBitext ( String src , String trg , JLanguageTool srcLt , JLanguageTool trgLt , List < BitextRule > bRules ) throws IOException { } }
AnalyzedSentence srcText = srcLt . getAnalyzedSentence ( src ) ; AnalyzedSentence trgText = trgLt . getAnalyzedSentence ( trg ) ; List < Rule > nonBitextRules = trgLt . getAllRules ( ) ; List < RuleMatch > ruleMatches = trgLt . checkAnalyzedSentence ( JLanguageTool . ParagraphHandling . NORMAL , nonBitextRules , trgText ) ; for ( BitextRule bRule : bRules ) { RuleMatch [ ] curMatch = bRule . match ( srcText , trgText ) ; if ( curMatch != null && curMatch . length > 0 ) { // adjust positions for bitext rules for ( RuleMatch match : curMatch ) { if ( match . getColumn ( ) < 0 ) { match . setColumn ( 1 ) ; } if ( match . getEndColumn ( ) < 0 ) { match . setEndColumn ( trg . length ( ) + 1 ) ; // we count from 0 } if ( match . getLine ( ) < 0 ) { match . setLine ( 1 ) ; } if ( match . getEndLine ( ) < 0 ) { match . setEndLine ( 1 ) ; } ruleMatches . add ( match ) ; } } } return ruleMatches ;
public class TypicalLoginAssist { /** * Do actually login for the user by given entity . ( no silent ) * @ param givenEntity The given entity for user . ( NotNull ) * @ param option The option of login specified by caller . ( NotNull ) */ protected void doLoginByGivenEntity ( USER_ENTITY givenEntity , LoginSpecifiedOption option ) { } }
assertGivenEntityRequired ( givenEntity ) ; handleLoginSuccess ( givenEntity , option ) ;
public class DockerRule { /** * Return { @ link CLI } for jenkins docker container . * / / TODO no way specify CliPort ( hacky resolution { @ link DockerCLI } ) */ public DockerCLI createCliForInspect ( InspectContainerResponse inspect ) throws IOException , InterruptedException { } }
LOG . debug ( "Creating CLI for {}" , inspect ) ; Integer httpPort = null ; // CLI mess around ports Integer cliPort = null ; // should be this Integer jnlpAgentPort = null ; // but in reality used this final Map < ExposedPort , Ports . Binding [ ] > bindings = inspect . getNetworkSettings ( ) . getPorts ( ) . getBindings ( ) ; LOG . trace ( "Bindings: {}" , bindings ) ; for ( Map . Entry < ExposedPort , Ports . Binding [ ] > entry : bindings . entrySet ( ) ) { if ( entry . getKey ( ) . getPort ( ) == JENKINS_DEFAULT . httpPort ) { httpPort = Integer . valueOf ( entry . getValue ( ) [ 0 ] . getHostPortSpec ( ) ) ; } if ( entry . getKey ( ) . getPort ( ) == JENKINS_DEFAULT . tcpPort ) { final Ports . Binding binding = entry . getValue ( ) [ 0 ] ; jnlpAgentPort = Integer . valueOf ( binding . getHostPortSpec ( ) ) ; } if ( entry . getKey ( ) . getPort ( ) == JENKINS_DEFAULT . jnlpPort ) { cliPort = Integer . valueOf ( entry . getValue ( ) [ 0 ] . getHostPortSpec ( ) ) ; } } LOG . trace ( "Creating URL {}" , bindings ) ; final URL url = new URL ( "http://" + getHost ( ) + ":" + httpPort . toString ( ) ) ; LOG . trace ( "Created URL {}" , url . toExternalForm ( ) ) ; if ( isNull ( jnlpAgentPort ) ) { throw new IOException ( "Can't get jnlpPort." + bindings . toString ( ) ) ; } return createCliWithWait ( url , jnlpAgentPort ) ;
public class ChatRoomClient { /** * Add members to chat room * @ param roomId chat room id * @ param members { @ link Members } * @ return No content * @ throws APIConnectionException connect exception * @ throws APIRequestException request exception */ public ResponseWrapper addChatRoomMember ( long roomId , Members members ) throws APIConnectionException , APIRequestException { } }
Preconditions . checkArgument ( roomId > 0 , "room id is invalid" ) ; Preconditions . checkArgument ( members != null , "members should not be empty" ) ; return _httpClient . sendPut ( _baseUrl + mChatRoomPath + "/" + roomId + "/members" , members . toString ( ) ) ;
public class PoolablePreparedStatement { /** * Method setDate . * @ param parameterIndex * @ param x * @ throws SQLException * @ see java . sql . PreparedStatement # setDate ( int , Date ) */ @ Override public void setDate ( int parameterIndex , Date x ) throws SQLException { } }
internalStmt . setDate ( parameterIndex , x ) ;
public class BigtableDataGrpcClient { /** * { @ inheritDoc } */ @ Override public ListenableFuture < List < SampleRowKeysResponse > > sampleRowKeysAsync ( SampleRowKeysRequest request ) { } }
if ( shouldOverrideAppProfile ( request . getAppProfileId ( ) ) ) { request = request . toBuilder ( ) . setAppProfileId ( clientDefaultAppProfileId ) . build ( ) ; } return createStreamingListener ( request , sampleRowKeysAsync , request . getTableName ( ) ) . getAsyncResult ( ) ;
public class BasicDoubleLinkedNode { /** * This method inserts the given { @ code node } into the list immediately before the position represented by this node . * @ param node is the { @ link BasicDoubleLinkedNode node } to add . */ public void insertAsPrevious ( BasicDoubleLinkedNode < V > node ) { } }
if ( this . previous != null ) { this . previous . setNext ( node ) ; node . previous = this . previous ; } node . setNext ( this ) ; this . previous = node ;
public class CrumbIssuerDescriptor { /** * Set the request parameter name . Must not be null . * @ param requestField */ public void setCrumbRequestField ( String requestField ) { } }
if ( Util . fixEmptyAndTrim ( requestField ) == null ) { crumbRequestField = CrumbIssuer . DEFAULT_CRUMB_NAME ; } else { crumbRequestField = requestField ; }
public class TCAbortMessageImpl { /** * ( non - Javadoc ) * @ see org . restcomm . protocols . ss7 . tcap . asn . Encodable # decode ( org . mobicents . protocols . asn . AsnInputStream ) */ public void decode ( AsnInputStream ais ) throws ParseException { } }
this . destinationTransactionId = null ; this . dp = null ; this . pAbortCause = null ; this . userAbortInformation = null ; try { AsnInputStream localAis = ais . readSequenceStream ( ) ; // transaction portion TransactionID tid = TcapFactory . readTransactionID ( localAis ) ; if ( tid . getFirstElem ( ) == null || tid . getSecondElem ( ) != null ) { throw new ParseException ( PAbortCause . BadlyStructuredTransactionPortion , "Error decoding TCAbortMessage: transactionId must contain one and only one transactionId" ) ; } this . destinationTransactionId = tid . getFirstElem ( ) ; if ( localAis . available ( ) == 0 ) { throw new ParseException ( PAbortCause . UnrecognizedDialoguePortionID , "Error decoding TCAbortMessage: neither P-Abort-cause nor dialog portion or userInformation is found" ) ; } int tag = localAis . readTag ( ) ; if ( localAis . getTagClass ( ) != Tag . CLASS_PRIVATE ) throw new ParseException ( PAbortCause . UnrecognizedDialoguePortionID , "Error decoding TCAbortMessage: bad tagClass for P-Abort-cause, userInformation or abortCause, found tagClass=" + localAis . getTagClass ( ) ) ; switch ( tag ) { case TCAbortMessage . _TAG_P_ABORT_CAUSE : // P - Abort - cause if ( ! localAis . isTagPrimitive ( ) ) throw new ParseException ( PAbortCause . IncorrectTransactionPortion , "Error decoding TCAbortMessage: P_ABORT_CAUSE is not primitive" ) ; int i1 = ( int ) localAis . readInteger ( ) ; this . pAbortCause = PAbortCause . getFromInt ( i1 ) ; break ; case DialogPortion . _TAG_DIALOG_PORTION : case TCAbortMessage . _TAG_USER_ABORT_INFORMATION : // Dialog portion ( opt ) + UserAbortInformation if ( tag == DialogPortion . _TAG_DIALOG_PORTION ) { // Dialog portion this . dp = TcapFactory . createDialogPortion ( localAis ) ; if ( localAis . available ( ) == 0 ) return ; tag = localAis . readTag ( ) ; } // UserAbortInformation if ( tag != TCAbortMessage . _TAG_USER_ABORT_INFORMATION || localAis . getTagClass ( ) != Tag . CLASS_PRIVATE || localAis . isTagPrimitive ( ) ) throw new ParseException ( PAbortCause . IncorrectTransactionPortion , "Error decoding TCAbortMessage: bad tag or tagClass or is primitive for userAbortInformation, found tagClass=" + localAis . getTagClass ( ) + ", tag" + tag ) ; UserInformationElementImpl uai = new UserInformationElementImpl ( ) ; AsnInputStream localAis2 = localAis . readSequenceStream ( ) ; if ( localAis2 . available ( ) > 0 ) { tag = localAis2 . readTag ( ) ; if ( tag != Tag . EXTERNAL || localAis2 . getTagClass ( ) != Tag . CLASS_UNIVERSAL || localAis2 . isTagPrimitive ( ) ) throw new ParseException ( PAbortCause . IncorrectTransactionPortion , "Error decoding TCAbortMessage: bad tag or tagClass or is primitive for userAbortInformation - External, found tagClass=" + localAis2 . getTagClass ( ) + ", tag" + tag ) ; uai . decode ( localAis2 ) ; if ( uai . isOid ( ) ) this . userAbortInformation = uai ; } break ; default : throw new ParseException ( PAbortCause . IncorrectTransactionPortion , "Error decoding TCAbortMessage: bad tag for P-Abort-cause, userInformation or abortCause, found tag=" + tag ) ; } } catch ( IOException e ) { throw new ParseException ( PAbortCause . BadlyStructuredDialoguePortion , "IOException while decoding TCAbortMessage: " + e . getMessage ( ) , e ) ; } catch ( AsnException e ) { throw new ParseException ( PAbortCause . BadlyStructuredDialoguePortion , "AsnException while decoding TCAbortMessage: " + e . getMessage ( ) , e ) ; }
public class HazelcastCachingProvider { /** * Create the { @ link java . util . Properties } with the provided config file location . * @ param configFileLocation the location of the config file to configure * @ return properties instance pre - configured with the configuration location */ public static Properties propertiesByLocation ( String configFileLocation ) { } }
Properties properties = new Properties ( ) ; properties . setProperty ( HAZELCAST_CONFIG_LOCATION , configFileLocation ) ; return properties ;
public class DraggableContainment { /** * Method setting the right parameter * @ param arrayParam * Array parameter * @ param helperEnumParam * ContainmentEnum parameter * @ param stringParam * Selector or Element * @ param selector * Selector */ private void setParam ( ArrayItemOptions < IntegerItemOptions > arrayParam , ContainmentEnum containmentEnumParam , String stringParam , LiteralOption selector ) { } }
this . arrayParam = arrayParam ; this . containmentEnumParam = containmentEnumParam ; this . stringParam = stringParam ; this . selector = selector ;
public class ExpressionTemplate { /** * Generates a { @ link SuggestedFix } replacing the specified match ( usually of another template ) * with this template . */ @ Override public Fix replace ( ExpressionTemplateMatch match ) { } }
Inliner inliner = match . createInliner ( ) ; Context context = inliner . getContext ( ) ; if ( annotations ( ) . containsKey ( UseImportPolicy . class ) ) { ImportPolicy . bind ( context , annotations ( ) . getInstance ( UseImportPolicy . class ) . value ( ) ) ; } else { ImportPolicy . bind ( context , ImportPolicy . IMPORT_TOP_LEVEL ) ; } int prec = getPrecedence ( match . getLocation ( ) , context ) ; SuggestedFix . Builder fix = SuggestedFix . builder ( ) ; try { StringWriter writer = new StringWriter ( ) ; pretty ( inliner . getContext ( ) , writer ) . printExpr ( expression ( ) . inline ( inliner ) , prec ) ; fix . replace ( match . getLocation ( ) , writer . toString ( ) ) ; } catch ( CouldNotResolveImportException e ) { logger . log ( SEVERE , "Failure to resolve in replacement" , e ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } return addImports ( inliner , fix ) ;
public class CmsEntity { /** * Clones the given entity keeping all entity ids . < p > * @ return returns the cloned instance */ public CmsEntity cloneEntity ( ) { } }
CmsEntity clone = new CmsEntity ( getId ( ) , getTypeName ( ) ) ; for ( CmsEntityAttribute attribute : getAttributes ( ) ) { if ( attribute . isSimpleValue ( ) ) { List < String > values = attribute . getSimpleValues ( ) ; for ( String value : values ) { clone . addAttributeValue ( attribute . getAttributeName ( ) , value ) ; } } else { List < CmsEntity > values = attribute . getComplexValues ( ) ; for ( CmsEntity value : values ) { clone . addAttributeValue ( attribute . getAttributeName ( ) , value . cloneEntity ( ) ) ; } } } return clone ;
public class FNLPCorpus { /** * 将数据输出到一个文件 * @ param path */ public void writeOne ( String path ) { } }
File f = new File ( path ) ; if ( ! f . getParentFile ( ) . exists ( ) ) { f . getParentFile ( ) . mkdirs ( ) ; } Writer out = null ; try { out = new OutputStreamWriter ( new FileOutputStream ( path ) , "utf8" ) ; Iterator < FNLPDoc > it = docs . iterator ( ) ; while ( it . hasNext ( ) ) { FNLPDoc doc = it . next ( ) ; out . write ( doc . toString ( ) ) ; out . write ( "\n" ) ; } out . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; }
public class JSLocalConsumerPoint { /** * If a message has been attached to this LCP , detach it and return it * NOTE : Callers to this method will have the JSLocalConsumerPoint locked * @ return The message which was attached * @ throws SIResourceException */ SIMPMessage getAttachedMessage ( ) throws SIResourceException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getAttachedMessage" , this ) ; SIMPMessage msg = null ; // check if there really is a message attached if ( _msgAttached ) { // If the message wasn ' t locked when it was attached ( we are a forwardScanning // consumer ) we need to go and look for it now . if ( _msgOnItemStream && ! _msgLocked ) { // Attempt to lock the attached message on the itemstream msg = getEligibleMsgLocked ( null ) ; } else msg = _attachedMessage ; // show that there is no longer an attached message available _msgAttached = false ; _msgLocked = false ; _attachedMessage = null ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getAttachedMessage" , msg ) ; // simply return the attached message ( if there is one ) return msg ;
public class DefaultAccess { /** * Resumes an in - progress listing of object fields . * @ param context * the context of this request * @ param sessionToken * the token of the session in which the remaining results can be * obtained * @ return the next set of results from the initial field search * @ throws ServerException * If any type of error occurred fulfilling the request . */ @ Override public FieldSearchResult resumeFindObjects ( Context context , String sessionToken ) throws ServerException { } }
m_authorizationModule . enforceFindObjects ( context ) ; return m_manager . resumeFindObjects ( context , sessionToken ) ;
public class PasswordEditText { /** * Verifies the strength of the current password , depending on the constraints , which have been * added and adapts the appearance of the view accordingly . */ private void verifyPasswordStrength ( ) { } }
if ( isEnabled ( ) && ! constraints . isEmpty ( ) && ! TextUtils . isEmpty ( getText ( ) ) ) { float score = getPasswordStrength ( ) ; adaptHelperText ( score ) ; } else { setHelperText ( regularHelperText ) ; }
public class QuartzSchedulerThread { /** * The main processing loop of the < code > QuartzSchedulerThread < / code > . */ @ Override public void run ( ) { } }
boolean lastAcquireFailed = false ; while ( ! halted . get ( ) ) { try { // check if we ' re supposed to pause . . . synchronized ( sigLock ) { while ( paused && ! halted . get ( ) ) { try { // wait until togglePause ( false ) is called . . . sigLock . wait ( 1000L ) ; } catch ( InterruptedException ignore ) { } } if ( halted . get ( ) ) { break ; } } int availThreadCount = quartzSchedulerResources . getThreadPool ( ) . blockForAvailableThreads ( ) ; if ( availThreadCount > 0 ) { // will always be true , due to semantics of blockForAvailableThreads . . . List < OperableTrigger > triggers = null ; long now = System . currentTimeMillis ( ) ; clearSignaledSchedulingChange ( ) ; try { triggers = quartzSchedulerResources . getJobStore ( ) . acquireNextTriggers ( now + idleWaitTime , Math . min ( availThreadCount , quartzSchedulerResources . getMaxBatchSize ( ) ) , quartzSchedulerResources . getBatchTimeWindow ( ) ) ; lastAcquireFailed = false ; logger . debug ( "batch acquisition of " + ( triggers == null ? 0 : triggers . size ( ) ) + " triggers" ) ; } catch ( JobPersistenceException jpe ) { lastAcquireFailed = true ; } catch ( RuntimeException e ) { if ( ! lastAcquireFailed ) { logger . error ( "quartzSchedulerThreadLoop: RuntimeException " + e . getMessage ( ) , e ) ; } lastAcquireFailed = true ; } if ( triggers != null && ! triggers . isEmpty ( ) ) { now = System . currentTimeMillis ( ) ; long triggerTime = triggers . get ( 0 ) . getNextFireTime ( ) . getTime ( ) ; long timeUntilTrigger = triggerTime - now ; while ( timeUntilTrigger > 2 ) { synchronized ( sigLock ) { if ( halted . get ( ) ) { break ; } if ( ! isCandidateNewTimeEarlierWithinReason ( triggerTime , false ) ) { try { // we could have blocked a long while // on ' synchronize ' , so we must recompute now = System . currentTimeMillis ( ) ; timeUntilTrigger = triggerTime - now ; if ( timeUntilTrigger >= 1 ) { sigLock . wait ( timeUntilTrigger ) ; } } catch ( InterruptedException ignore ) { } } } if ( releaseIfScheduleChangedSignificantly ( triggers , triggerTime ) ) { break ; } now = System . currentTimeMillis ( ) ; timeUntilTrigger = triggerTime - now ; } // this happens if releaseIfScheduleChangedSignificantly decided to release triggers if ( triggers . isEmpty ( ) ) { continue ; } // set triggers to ' executing ' List < TriggerFiredResult > bndles = new ArrayList < TriggerFiredResult > ( ) ; boolean goAhead = true ; synchronized ( sigLock ) { goAhead = ! halted . get ( ) ; } if ( goAhead ) { try { List < TriggerFiredResult > res = quartzSchedulerResources . getJobStore ( ) . triggersFired ( triggers ) ; if ( res != null ) { bndles = res ; } } catch ( SchedulerException se ) { quartzScheduler . notifySchedulerListenersError ( "An error occurred while firing triggers '" + triggers + "'" , se ) ; } } for ( int i = 0 ; i < bndles . size ( ) ; i ++ ) { TriggerFiredResult result = bndles . get ( i ) ; TriggerFiredBundle bndle = result . getTriggerFiredBundle ( ) ; Exception exception = result . getException ( ) ; if ( exception instanceof RuntimeException ) { logger . error ( "RuntimeException while firing trigger " + triggers . get ( i ) , exception ) ; continue ; } // it ' s possible to get ' null ' if the triggers was paused , // blocked , or other similar occurrences that prevent it being // fired at this time . . . or if the scheduler was shutdown ( halted ) if ( bndle == null ) { try { quartzSchedulerResources . getJobStore ( ) . releaseAcquiredTrigger ( triggers . get ( i ) ) ; } catch ( SchedulerException se ) { quartzScheduler . notifySchedulerListenersError ( "An error occurred while releasing triggers '" + triggers . get ( i ) . getName ( ) + "'" , se ) ; } continue ; } // TODO : improvements : // 2 - make sure we can get a job runshell before firing triggers , or // don ' t let that throw an exception ( right now it never does , // but the signature says it can ) . // 3 - acquire more triggers at a time ( based on num threads available ? ) JobRunShell shell = null ; try { shell = quartzSchedulerResources . getJobRunShellFactory ( ) . createJobRunShell ( bndle ) ; shell . initialize ( quartzScheduler ) ; } catch ( SchedulerException se ) { try { quartzSchedulerResources . getJobStore ( ) . triggeredJobComplete ( triggers . get ( i ) , bndle . getJobDetail ( ) , CompletedExecutionInstruction . SET_ALL_JOB_TRIGGERS_ERROR ) ; } catch ( SchedulerException se2 ) { quartzScheduler . notifySchedulerListenersError ( "An error occurred while placing job's triggers in error state '" + triggers . get ( i ) . getName ( ) + "'" , se2 ) ; } continue ; } if ( quartzSchedulerResources . getThreadPool ( ) . runInThread ( shell ) == false ) { try { // this case should never happen , as it is indicative of the // scheduler being shutdown or a bug in the thread pool or // a thread pool being used concurrently - which the docs // say not to do . . . logger . error ( "ThreadPool.runInThread() return false!" ) ; quartzSchedulerResources . getJobStore ( ) . triggeredJobComplete ( triggers . get ( i ) , bndle . getJobDetail ( ) , CompletedExecutionInstruction . SET_ALL_JOB_TRIGGERS_ERROR ) ; } catch ( SchedulerException se2 ) { quartzScheduler . notifySchedulerListenersError ( "An error occurred while placing job's triggers in error state '" + triggers . get ( i ) . getName ( ) + "'" , se2 ) ; } } } continue ; // while ( ! halted ) } } else { // if ( availThreadCount > 0) // should never happen , if threadPool . blockForAvailableThreads ( ) follows contract continue ; // while ( ! halted ) } long now = System . currentTimeMillis ( ) ; long waitTime = now + getRandomizedIdleWaitTime ( ) ; long timeUntilContinue = waitTime - now ; synchronized ( sigLock ) { try { sigLock . wait ( timeUntilContinue ) ; } catch ( InterruptedException ignore ) { } } } catch ( RuntimeException re ) { logger . error ( "Runtime error occurred in main trigger firing loop." , re ) ; } } // while ( ! halted ) // drop references to scheduler stuff to aid garbage collection . . . quartzScheduler = null ; quartzSchedulerResources = null ;
public class Nfs3 { /** * Convenience method to check String parameters that cannot be blank . * @ param value The parameter value . * @ param name The parameter name , for exception messages . */ private void checkForBlank ( String value , String name ) { } }
if ( StringUtils . isBlank ( value ) ) { throw new IllegalArgumentException ( name + " cannot be empty" ) ; }
public class SEPWorker { /** * collection at the same time */ private void startSpinning ( ) { } }
assert get ( ) == Work . WORKING ; pool . spinningCount . incrementAndGet ( ) ; set ( Work . SPINNING ) ;
public class SEPAParserFactory { /** * Gibt den passenden SEPA Parser für die angegebene PAIN - Version . * @ param version die PAIN - Version . * @ return ISEPAParser */ public static ISEPAParser get ( SepaVersion version ) { } }
ISEPAParser parser = null ; String className = version . getParserClass ( ) ; try { log . debug ( "trying to init SEPA parser: " + className ) ; Class cl = Class . forName ( className ) ; parser = ( ISEPAParser ) cl . newInstance ( ) ; } catch ( Exception e ) { String msg = "Error creating SEPA parser" ; throw new HBCI_Exception ( msg , e ) ; } return parser ;
public class ParameterUtil { /** * Get child dependent parameters * @ param params list of parameters * @ param p current parameter * @ return a map of all parameters that use the current parameter in theirs source definition */ public static Map < String , QueryParameter > getChildDependentParameters ( List < QueryParameter > params , QueryParameter p ) { } }
Map < String , QueryParameter > result = new HashMap < String , QueryParameter > ( ) ; for ( QueryParameter param : params ) { if ( ! param . equals ( p ) ) { if ( param . isDependent ( ) ) { List < String > names = param . getDependentParameterNames ( ) ; if ( names . contains ( p . getName ( ) ) ) { result . put ( param . getName ( ) , param ) ; } } } } return result ;
public class CmsJspCategoryAccessBean { /** * Returns all categories that are direct children of the current main category . * @ return all categories that are direct children of the current main category . */ public List < CmsCategory > getTopItems ( ) { } }
List < CmsCategory > categories = new ArrayList < CmsCategory > ( ) ; String matcher = Pattern . quote ( m_mainCategoryPath ) + "[^/]*/" ; for ( CmsCategory category : m_categories ) { if ( category . getPath ( ) . matches ( matcher ) ) { categories . add ( category ) ; } } return categories ;
public class GeomUtil { /** * Get a line between two points in a shape * @ param shape The shape * @ param sx The x coordinate of the start point * @ param sy The y coordinate of the start point * @ param e The index of the end point * @ return The line between the two points */ public Line getLine ( Shape shape , float sx , float sy , int e ) { } }
float [ ] end = shape . getPoint ( e ) ; Line line = new Line ( sx , sy , end [ 0 ] , end [ 1 ] ) ; return line ;
public class PFCImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . PFC__PFC_FLGS : return PFC_FLGS_EDEFAULT == null ? pfcFlgs != null : ! PFC_FLGS_EDEFAULT . equals ( pfcFlgs ) ; case AfplibPackage . PFC__TRIPLETS : return triplets != null && ! triplets . isEmpty ( ) ; } return super . eIsSet ( featureID ) ;
public class LambdaFactory { /** * Convenience wrapper for { @ link # createLambda ( String , TypeReference ) } * which throws unchecked exception instead of checked one . * @ see # createLambda ( String , TypeReference ) */ public < T > T createLambdaUnchecked ( String code , TypeReference < T > type ) { } }
try { return createLambda ( code , type ) ; } catch ( LambdaCreationException e ) { throw new LambdaCreationRuntimeException ( e ) ; }
public class XmlConfiguration { /** * Call a set method . This method makes a best effort to find a matching set method . The type of * the value is used to find a suitable set method by 1 . Trying for a trivial type match . 2. * Looking for a native type match . 3 . Trying all correctly named methods for an auto * conversion . 4 . Attempting to construct a suitable value from original value . @ param obj * @ param node */ private void set ( Object obj , XmlParser . Node node ) throws ClassNotFoundException , NoSuchMethodException , InvocationTargetException , IllegalAccessException { } }
String attr = node . getAttribute ( "name" ) ; String name = "set" + attr . substring ( 0 , 1 ) . toUpperCase ( ) + attr . substring ( 1 ) ; Object value = value ( obj , node ) ; Object [ ] arg = { value } ; Class oClass = nodeClass ( node ) ; if ( oClass != null ) obj = null ; else oClass = obj . getClass ( ) ; Class [ ] vClass = { Object . class } ; if ( value != null ) vClass [ 0 ] = value . getClass ( ) ; if ( log . isDebugEnabled ( ) ) log . debug ( obj + "." + name + "(" + vClass [ 0 ] + " " + value + ")" ) ; // Try for trivial match try { Method set = oClass . getMethod ( name , vClass ) ; set . invoke ( obj , arg ) ; return ; } catch ( IllegalArgumentException e ) { LogSupport . ignore ( log , e ) ; } catch ( IllegalAccessException e ) { LogSupport . ignore ( log , e ) ; } catch ( NoSuchMethodException e ) { LogSupport . ignore ( log , e ) ; } // Try for native match try { Field type = vClass [ 0 ] . getField ( "TYPE" ) ; vClass [ 0 ] = ( Class ) type . get ( null ) ; Method set = oClass . getMethod ( name , vClass ) ; set . invoke ( obj , arg ) ; return ; } catch ( NoSuchFieldException e ) { LogSupport . ignore ( log , e ) ; } catch ( IllegalArgumentException e ) { LogSupport . ignore ( log , e ) ; } catch ( IllegalAccessException e ) { LogSupport . ignore ( log , e ) ; } catch ( NoSuchMethodException e ) { LogSupport . ignore ( log , e ) ; } // Try a field try { Field field = oClass . getField ( attr ) ; if ( Modifier . isPublic ( field . getModifiers ( ) ) ) { field . set ( obj , value ) ; return ; } } catch ( NoSuchFieldException e ) { LogSupport . ignore ( log , e ) ; } // Search for a match by trying all the set methods Method [ ] sets = oClass . getMethods ( ) ; Method set = null ; for ( int s = 0 ; sets != null && s < sets . length ; s ++ ) { if ( name . equals ( sets [ s ] . getName ( ) ) && sets [ s ] . getParameterTypes ( ) . length == 1 ) { // lets try it try { set = sets [ s ] ; sets [ s ] . invoke ( obj , arg ) ; return ; } catch ( IllegalArgumentException e ) { LogSupport . ignore ( log , e ) ; } catch ( IllegalAccessException e ) { LogSupport . ignore ( log , e ) ; } } } // Try converting the arg to the last set found . if ( set != null ) { try { Class sClass = set . getParameterTypes ( ) [ 0 ] ; if ( sClass . isPrimitive ( ) ) { for ( int t = 0 ; t < __primitives . length ; t ++ ) { if ( sClass . equals ( __primitives [ t ] ) ) { sClass = __primitiveHolders [ t ] ; break ; } } } Constructor cons = sClass . getConstructor ( vClass ) ; arg [ 0 ] = cons . newInstance ( arg ) ; set . invoke ( obj , arg ) ; return ; } catch ( NoSuchMethodException e ) { LogSupport . ignore ( log , e ) ; } catch ( IllegalAccessException e ) { LogSupport . ignore ( log , e ) ; } catch ( InstantiationException e ) { LogSupport . ignore ( log , e ) ; } } // No Joy throw new NoSuchMethodException ( oClass + "." + name + "(" + vClass [ 0 ] + ")" ) ;
public class ImgUtil { /** * 获取 { @ link ImageOutputStream } * @ param out { @ link OutputStream } * @ return { @ link ImageOutputStream } * @ throws IORuntimeException IO异常 * @ since 3.1.2 */ public static ImageOutputStream getImageOutputStream ( OutputStream out ) throws IORuntimeException { } }
try { return ImageIO . createImageOutputStream ( out ) ; } catch ( IOException e ) { throw new IORuntimeException ( e ) ; }
public class CommonDictionaryMaker { /** * 同compute * @ param sentenceList */ public void learn ( List < Sentence > sentenceList ) { } }
List < List < IWord > > s = new ArrayList < List < IWord > > ( sentenceList . size ( ) ) ; for ( Sentence sentence : sentenceList ) { s . add ( sentence . wordList ) ; } compute ( s ) ;
public class Assertions { /** * Assert condition flag is TRUE . GEL will be notified about error . * @ param message message describing situation * @ param condition condition which must be true * @ throws AssertionError if the condition is not true * @ since 1.0 */ public static void assertTrue ( @ Nullable final String message , final boolean condition ) { } }
if ( ! condition ) { final AssertionError error = new AssertionError ( GetUtils . ensureNonNull ( message , "Condition must be TRUE" ) ) ; MetaErrorListeners . fireError ( error . getMessage ( ) , error ) ; throw error ; }
public class UnpeerVpcRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UnpeerVpcRequest unpeerVpcRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( unpeerVpcRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class UpdateClusterRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateClusterRequest updateClusterRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateClusterRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateClusterRequest . getClusterId ( ) , CLUSTERID_BINDING ) ; protocolMarshaller . marshall ( updateClusterRequest . getRoleARN ( ) , ROLEARN_BINDING ) ; protocolMarshaller . marshall ( updateClusterRequest . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( updateClusterRequest . getResources ( ) , RESOURCES_BINDING ) ; protocolMarshaller . marshall ( updateClusterRequest . getAddressId ( ) , ADDRESSID_BINDING ) ; protocolMarshaller . marshall ( updateClusterRequest . getShippingOption ( ) , SHIPPINGOPTION_BINDING ) ; protocolMarshaller . marshall ( updateClusterRequest . getNotification ( ) , NOTIFICATION_BINDING ) ; protocolMarshaller . marshall ( updateClusterRequest . getForwardingAddressId ( ) , FORWARDINGADDRESSID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ClientService { /** * Return all Clients for a profile * @ param profileId ID of profile clients belong to * @ return collection of the Clients found * @ throws Exception exception */ public List < Client > findAllClients ( int profileId ) throws Exception { } }
ArrayList < Client > clients = new ArrayList < Client > ( ) ; PreparedStatement query = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { query = sqlConnection . prepareStatement ( "SELECT * FROM " + Constants . DB_TABLE_CLIENT + " WHERE " + Constants . GENERIC_PROFILE_ID + " = ?" ) ; query . setInt ( 1 , profileId ) ; results = query . executeQuery ( ) ; while ( results . next ( ) ) { clients . add ( this . getClientFromResultSet ( results ) ) ; } } catch ( Exception e ) { throw e ; } finally { try { if ( results != null ) { results . close ( ) ; } } catch ( Exception e ) { } try { if ( query != null ) { query . close ( ) ; } } catch ( Exception e ) { } } return clients ;
public class IPv6AddressHelpers { /** * Replaces a w . x . y . z substring at the end of the given string with corresponding hexadecimal notation . This is useful in case the * string was using IPv4 - Mapped address notation . */ static String rewriteIPv4MappedNotation ( String string ) { } }
if ( ! string . contains ( "." ) ) { return string ; } else { int lastColon = string . lastIndexOf ( ":" ) ; String firstPart = string . substring ( 0 , lastColon + 1 ) ; String mappedIPv4Part = string . substring ( lastColon + 1 ) ; if ( mappedIPv4Part . contains ( "." ) ) { String [ ] dotSplits = DOT_DELIM . split ( mappedIPv4Part ) ; if ( dotSplits . length != 4 ) throw new IllegalArgumentException ( String . format ( "can not parse [%s]" , string ) ) ; StringBuilder rewrittenString = new StringBuilder ( ) ; rewrittenString . append ( firstPart ) ; int byteZero = Integer . parseInt ( dotSplits [ 0 ] ) ; int byteOne = Integer . parseInt ( dotSplits [ 1 ] ) ; int byteTwo = Integer . parseInt ( dotSplits [ 2 ] ) ; int byteThree = Integer . parseInt ( dotSplits [ 3 ] ) ; rewrittenString . append ( String . format ( "%02x" , byteZero ) ) ; rewrittenString . append ( String . format ( "%02x" , byteOne ) ) ; rewrittenString . append ( ":" ) ; rewrittenString . append ( String . format ( "%02x" , byteTwo ) ) ; rewrittenString . append ( String . format ( "%02x" , byteThree ) ) ; return rewrittenString . toString ( ) ; } else { throw new IllegalArgumentException ( String . format ( "can not parse [%s]" , string ) ) ; } }
public class NumberConverter { /** * 转换为BigInteger < br > * 如果给定的值为空 , 或者转换失败 , 返回默认值 < br > * 转换失败不会报错 * @ param value 被转换的值 * @ return 结果 */ private BigInteger toBigInteger ( Object value ) { } }
if ( value instanceof Long ) { return BigInteger . valueOf ( ( Long ) value ) ; } else if ( value instanceof Boolean ) { return BigInteger . valueOf ( ( boolean ) value ? 1 : 0 ) ; } final String valueStr = convertToStr ( value ) ; if ( StrUtil . isBlank ( valueStr ) ) { return null ; } return new BigInteger ( valueStr ) ;
public class ExecutorHealthChecker { /** * Groups Executable flow by Executors to reduce number of REST calls . * @ return executor to list of flows map */ private Map < Optional < Executor > , List < ExecutableFlow > > getFlowToExecutorMap ( ) { } }
final HashMap < Optional < Executor > , List < ExecutableFlow > > exFlowMap = new HashMap < > ( ) ; try { for ( final Pair < ExecutionReference , ExecutableFlow > runningFlow : this . executorLoader . fetchActiveFlows ( ) . values ( ) ) { final Optional < Executor > executor = runningFlow . getFirst ( ) . getExecutor ( ) ; List < ExecutableFlow > flows = exFlowMap . get ( executor ) ; if ( flows == null ) { flows = new ArrayList < > ( ) ; exFlowMap . put ( executor , flows ) ; } flows . add ( runningFlow . getSecond ( ) ) ; } } catch ( final ExecutorManagerException e ) { logger . error ( "Failed to get flow to executor map" ) ; } return exFlowMap ;
public class DefaultCacheableResourceService { /** * Download and copy the resource for use . * @ param resourceLocation { @ link String } , the resource location * @ param type { @ link ResourceType } , the type of resource * @ return the resource copy { @ link File } ready for processing * @ throws ResourceDownloadError Throw if an error occurred resolving or * copying the resource */ private File downloadResourceForUse ( String resourceLocation , ResourceType type ) throws ResourceDownloadError { } }
File downloadResource = downloadResource ( resourceLocation , type ) ; return copyResource ( downloadResource , resourceLocation ) ;