signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcMetric ( ) { } }
if ( ifcMetricEClass == null ) { ifcMetricEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 383 ) ; } return ifcMetricEClass ;
public class ArchiveInputStream { /** * Sets the currentSource to the new file or to < code > null < / code > if the last file has been * transmitted . * @ return The new source , the same as { @ link # currentSource } . */ private byte [ ] startNextFile ( ) { } }
byte [ ] ret ; if ( currentSource == softDeviceBytes && bootloaderBytes != null && ( type & DfuBaseService . TYPE_BOOTLOADER ) > 0 ) { ret = currentSource = bootloaderBytes ; } else if ( currentSource != applicationBytes && applicationBytes != null && ( type & DfuBaseService . TYPE_APPLICATION ) > 0 ) { ret = currentSource = applicationBytes ; } else { ret = currentSource = null ; } bytesReadFromCurrentSource = 0 ; return ret ;
public class EntryStream { /** * Performs a mapping of the stream keys and values to a partial function * removing the elements to which the function is not applicable . * If the mapping function returns { @ link Optional # empty ( ) } , the original * entry will be removed from the resulting stream . The mapping function * may not return null . * This is an < a href = " package - summary . html # StreamOps " > intermediate * operation < / a > . * The { @ code mapKeyValuePartial ( ) } operation has the effect of applying a * one - to - zero - or - one transformation to the elements of the stream , and then * flattening the resulting elements into a new stream . * @ param < R > The element type of the new stream * @ param mapper a < a * href = " package - summary . html # NonInterference " > non - interfering < / a > , * < a href = " package - summary . html # Statelessness " > stateless < / a > * partial function to apply to original keys and values which returns a present optional * if it ' s applicable , or an empty optional otherwise * @ return the new stream * @ since 0.6.8 */ public < R > StreamEx < R > mapKeyValuePartial ( BiFunction < ? super K , ? super V , ? extends Optional < ? extends R > > mapper ) { } }
return mapPartial ( toFunction ( mapper ) ) ;
public class ExecutorFilter { /** * { @ inheritDoc } */ @ Override public final void exceptionCaught ( NextFilter nextFilter , IoSession session , Throwable cause ) { } }
if ( eventTypes . contains ( IoEventType . EXCEPTION_CAUGHT ) ) { IoFilterEvent event = new IoFilterEvent ( nextFilter , IoEventType . EXCEPTION_CAUGHT , session , cause ) ; fireEvent ( event ) ; } else { nextFilter . exceptionCaught ( session , cause ) ; }
public class WordCountTopology { /** * Main method */ public static void main ( String [ ] args ) throws AlreadyAliveException , InvalidTopologyException { } }
if ( args . length < 1 ) { throw new RuntimeException ( "Specify topology name" ) ; } int parallelism = 1 ; if ( args . length > 1 ) { parallelism = Integer . parseInt ( args [ 1 ] ) ; } TopologyBuilder builder = new TopologyBuilder ( ) ; builder . setSpout ( "word" , new WordSpout ( ) , parallelism ) ; builder . setBolt ( "consumer" , new ConsumerBolt ( ) , parallelism ) . fieldsGrouping ( "word" , new Fields ( "word" ) ) ; Config conf = new Config ( ) ; conf . setNumStmgrs ( parallelism ) ; // configure component resources conf . setComponentRam ( "word" , ByteAmount . fromMegabytes ( ExampleResources . COMPONENT_RAM_MB ) ) ; conf . setComponentRam ( "consumer" , ByteAmount . fromMegabytes ( ExampleResources . COMPONENT_RAM_MB ) ) ; conf . setComponentCpu ( "word" , 1.0 ) ; conf . setComponentCpu ( "consumer" , 1.0 ) ; // configure container resources conf . setContainerDiskRequested ( ExampleResources . getContainerDisk ( 2 * parallelism , parallelism ) ) ; conf . setContainerRamRequested ( ExampleResources . getContainerRam ( 2 * parallelism , parallelism ) ) ; conf . setContainerCpuRequested ( ExampleResources . getContainerCpu ( 2 * parallelism , parallelism ) ) ; HeronSubmitter . submitTopology ( args [ 0 ] , conf , builder . createTopology ( ) ) ;
public class IndexHashTable { /** * Gets next equal node . */ public int getNextNode ( int elementHandle ) { } }
int element = m_lists . getElement ( elementHandle ) ; int ptr = m_lists . getNext ( elementHandle ) ; while ( ptr != - 1 ) { int e = m_lists . getElement ( ptr ) ; if ( m_hash . equal ( e , element ) ) { return ptr ; } ptr = m_lists . getNext ( ptr ) ; } return - 1 ;
public class PickleUtils { /** * encode an arbitrary long number into a byte array ( little endian ) . */ public static byte [ ] encode_long ( BigInteger big ) { } }
byte [ ] data = big . toByteArray ( ) ; // reverse the byte array because pickle uses little endian byte [ ] data2 = new byte [ data . length ] ; for ( int i = 0 ; i < data . length ; ++ i ) data2 [ data . length - i - 1 ] = data [ i ] ; return data2 ;
public class NameNode { /** * { @ inheritDoc } */ public long nextGenerationStamp ( Block block , boolean fromNN ) throws IOException { } }
myMetrics . numNextGenerationStamp . inc ( ) ; return namesystem . nextGenerationStampForBlock ( block , fromNN ) ;
public class GenericOptionsParser { /** * If libjars are set in the conf , parse the libjars . * @ param conf * @ return libjar urls * @ throws IOException */ public static URL [ ] getLibJars ( Configuration conf ) throws IOException { } }
String jars = conf . get ( "tmpjars" ) ; if ( jars == null ) { return null ; } String [ ] files = jars . split ( "," ) ; URL [ ] cp = new URL [ files . length ] ; for ( int i = 0 ; i < cp . length ; i ++ ) { Path tmp = new Path ( files [ i ] ) ; cp [ i ] = FileSystem . getLocal ( conf ) . pathToFile ( tmp ) . toURI ( ) . toURL ( ) ; } return cp ;
public class BeansToExcelOnTemplate { /** * 处理 @ ExcelCell注解的字段 。 * @ param field JavaBean反射字段 。 * @ param bean 字段所在的JavaBean 。 */ @ SneakyThrows private void processExcelCellAnnotation ( Field field , Object bean ) { } }
val ann = field . getAnnotation ( ExcelCell . class ) ; if ( ann == null ) return ; Object fv = Fields . invokeField ( field , bean ) ; if ( ann . sheetName ( ) ) { if ( StringUtils . isNotEmpty ( ann . replace ( ) ) ) { // 有内容需要替换 fv = sheet . getSheetName ( ) . replace ( ann . replace ( ) , Str . nullThen ( fv , "" ) ) ; } val wb = sheet . getWorkbook ( ) ; val oldSheetName = sheet . getSheetName ( ) ; val newSheetName = "" + fv ; wb . setSheetName ( wb . getSheetIndex ( sheet ) , newSheetName ) ; PoiUtil . fixChartSheetNameRef ( sheet , oldSheetName , newSheetName ) ; } else { val cell = PoiUtil . findCell ( sheet , ann . value ( ) , StringUtils . defaultIfEmpty ( ann . searchKey ( ) , "{" + field . getName ( ) + "}" ) ) ; if ( cell == null ) { log . warn ( "unable to find cell for {} in field {}" , ann , field ) ; return ; } if ( StringUtils . isNotEmpty ( ann . replace ( ) ) ) { // 有内容需要替换 val old = PoiUtil . getCellStringValue ( cell ) ; fv = old . replace ( ann . replace ( ) , Str . nullThen ( fv , "" ) ) ; } applyTemplateCellStyle ( field , bean , ann , cell ) ; val strCellValue = PoiUtil . writeCellValue ( cell , fv ) ; fixMaxRowHeightRatio ( cell . getRow ( ) , ann . maxLineLen ( ) , strCellValue ) ; }
public class ServerRegistry { /** * Update one Hadoop location * @ param originalName the original location name ( might have changed ) * @ param server the location */ public synchronized void updateServer ( String originalName , HadoopServer server ) { } }
// Update the map if the location name has changed if ( ! server . getLocationName ( ) . equals ( originalName ) ) { servers . remove ( originalName ) ; servers . put ( server . getLocationName ( ) , server ) ; } store ( ) ; fireListeners ( server , SERVER_STATE_CHANGED ) ;
public class BinaryRowProtocol { /** * Get double from raw binary format . * @ param columnInfo column information * @ return double value * @ throws SQLException if column is not numeric or is not in Double bounds ( unsigned columns ) . */ public double getInternalDouble ( ColumnInformation columnInfo ) throws SQLException { } }
if ( lastValueWasNull ( ) ) { return 0 ; } switch ( columnInfo . getColumnType ( ) ) { case BIT : return parseBit ( ) ; case TINYINT : return getInternalTinyInt ( columnInfo ) ; case SMALLINT : case YEAR : return getInternalSmallInt ( columnInfo ) ; case INTEGER : case MEDIUMINT : return getInternalMediumInt ( columnInfo ) ; case BIGINT : long valueLong = ( ( buf [ pos ] & 0xff ) + ( ( long ) ( buf [ pos + 1 ] & 0xff ) << 8 ) + ( ( long ) ( buf [ pos + 2 ] & 0xff ) << 16 ) + ( ( long ) ( buf [ pos + 3 ] & 0xff ) << 24 ) + ( ( long ) ( buf [ pos + 4 ] & 0xff ) << 32 ) + ( ( long ) ( buf [ pos + 5 ] & 0xff ) << 40 ) + ( ( long ) ( buf [ pos + 6 ] & 0xff ) << 48 ) + ( ( long ) ( buf [ pos + 7 ] & 0xff ) << 56 ) ) ; if ( columnInfo . isSigned ( ) ) { return valueLong ; } else { return new BigInteger ( 1 , new byte [ ] { ( byte ) ( valueLong >> 56 ) , ( byte ) ( valueLong >> 48 ) , ( byte ) ( valueLong >> 40 ) , ( byte ) ( valueLong >> 32 ) , ( byte ) ( valueLong >> 24 ) , ( byte ) ( valueLong >> 16 ) , ( byte ) ( valueLong >> 8 ) , ( byte ) valueLong } ) . doubleValue ( ) ; } case FLOAT : return getInternalFloat ( columnInfo ) ; case DOUBLE : long valueDouble = ( ( buf [ pos ] & 0xff ) + ( ( long ) ( buf [ pos + 1 ] & 0xff ) << 8 ) + ( ( long ) ( buf [ pos + 2 ] & 0xff ) << 16 ) + ( ( long ) ( buf [ pos + 3 ] & 0xff ) << 24 ) + ( ( long ) ( buf [ pos + 4 ] & 0xff ) << 32 ) + ( ( long ) ( buf [ pos + 5 ] & 0xff ) << 40 ) + ( ( long ) ( buf [ pos + 6 ] & 0xff ) << 48 ) + ( ( long ) ( buf [ pos + 7 ] & 0xff ) << 56 ) ) ; return Double . longBitsToDouble ( valueDouble ) ; case DECIMAL : case VARSTRING : case VARCHAR : case STRING : case OLDDECIMAL : try { return Double . valueOf ( new String ( buf , pos , length , StandardCharsets . UTF_8 ) ) ; } catch ( NumberFormatException nfe ) { SQLException sqlException = new SQLException ( "Incorrect format for getDouble for data field with type " + columnInfo . getColumnType ( ) . getJavaTypeName ( ) , "22003" , 1264 ) ; // noinspection UnnecessaryInitCause sqlException . initCause ( nfe ) ; throw sqlException ; } default : throw new SQLException ( "getDouble not available for data field type " + columnInfo . getColumnType ( ) . getJavaTypeName ( ) ) ; }
public class ConfigurationUtils { public static void setTo ( Configured from , Object ... targets ) { } }
for ( Object target : targets ) { if ( target instanceof Configured ) { Configured configuredTarget = ( Configured ) target ; configuredTarget . setConf ( from . getConf ( ) ) ; } }
public class system { /** * Compresses a single file ( source ) and prepares a zip file ( target ) * @ param source * @ param target * @ throws IOException */ public static void compress ( File source , File target ) throws IOException { } }
ZipOutputStream zipOut = new ZipOutputStream ( new BufferedOutputStream ( new FileOutputStream ( target ) ) ) ; ZipEntry zipEntry = new ZipEntry ( source . getName ( ) ) ; zipOut . putNextEntry ( zipEntry ) ; BufferedInputStream bis = new BufferedInputStream ( new FileInputStream ( source ) , BUFFER ) ; byte data [ ] = new byte [ BUFFER ] ; int count = 0 ; while ( ( count = bis . read ( data , 0 , BUFFER ) ) != - 1 ) { zipOut . write ( data , 0 , count ) ; } bis . close ( ) ; zipOut . close ( ) ;
public class AWSDirectoryServiceClient { /** * Deletes an AWS Directory Service directory . * Before you call < code > DeleteDirectory < / code > , ensure that all of the required permissions have been explicitly * granted through a policy . For details about what permissions are required to run the < code > DeleteDirectory < / code > * operation , see < a * href = " http : / / docs . aws . amazon . com / directoryservice / latest / admin - guide / UsingWithDS _ IAM _ ResourcePermissions . html " * > AWS Directory Service API Permissions : Actions , Resources , and Conditions Reference < / a > . * @ param deleteDirectoryRequest * Contains the inputs for the < a > DeleteDirectory < / a > operation . * @ return Result of the DeleteDirectory operation returned by the service . * @ throws EntityDoesNotExistException * The specified entity could not be found . * @ throws ClientException * A client exception has occurred . * @ throws ServiceException * An exception has occurred in AWS Directory Service . * @ sample AWSDirectoryService . DeleteDirectory * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ds - 2015-04-16 / DeleteDirectory " target = " _ top " > AWS API * Documentation < / a > */ @ Override public DeleteDirectoryResult deleteDirectory ( DeleteDirectoryRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDeleteDirectory ( request ) ;
public class ClientRegistry { /** * Gets the { @ link MalisisRenderer } classes to use for the object . < br > * the Classes are given by the { @ link MalisisRendered } annotation on that object class . * @ param object the object * @ return the renderer classes */ private Pair < Class < ? extends MalisisRenderer < ? > > , Class < ? extends MalisisRenderer < ? > > > getRendererClasses ( Object object ) { } }
Class < ? > objClass = object . getClass ( ) ; MalisisRendered annotation = objClass . getAnnotation ( MalisisRendered . class ) ; if ( annotation == null ) return null ; if ( annotation . value ( ) != DefaultRenderer . Null . class ) return Pair . of ( annotation . value ( ) , annotation . value ( ) ) ; else return Pair . of ( annotation . block ( ) , annotation . item ( ) ) ;
public class Optimizer { /** * Since we do not need to capture the contents , nested sequences can be simplified to * a just a simple sequence . For example , { @ code " a ( b . * c ) d " = > " ab . * cd " } . */ static Matcher flattenNestedSequences ( Matcher matcher ) { } }
if ( matcher instanceof SeqMatcher ) { List < Matcher > matchers = matcher . < SeqMatcher > as ( ) . matchers ( ) ; List < Matcher > ms = new ArrayList < > ( ) ; for ( Matcher m : matchers ) { if ( m instanceof SeqMatcher ) { ms . addAll ( m . < SeqMatcher > as ( ) . matchers ( ) ) ; } else { ms . add ( m ) ; } } return SeqMatcher . create ( ms ) ; } return matcher ;
public class Sysprop { /** * Returns the value of a property for a given key . * @ param name the key * @ return the value */ public Object getProperty ( String name ) { } }
if ( ! StringUtils . isBlank ( name ) ) { return getProperties ( ) . get ( name ) ; } return null ;
public class ProviderSignInController { /** * internal helpers */ private RedirectView handleSignIn ( Connection < ? > connection , ConnectionFactory < ? > connectionFactory , NativeWebRequest request ) { } }
List < String > userIds = usersConnectionRepository . findUserIdsWithConnection ( connection ) ; if ( userIds . size ( ) == 0 ) { ProviderSignInAttempt signInAttempt = new ProviderSignInAttempt ( connection ) ; sessionStrategy . setAttribute ( request , ProviderSignInAttempt . SESSION_ATTRIBUTE , signInAttempt ) ; return redirect ( signUpUrl ) ; } else if ( userIds . size ( ) == 1 ) { usersConnectionRepository . createConnectionRepository ( userIds . get ( 0 ) ) . updateConnection ( connection ) ; String originalUrl = signInAdapter . signIn ( userIds . get ( 0 ) , connection , request ) ; postSignIn ( connectionFactory , connection , ( WebRequest ) request ) ; return originalUrl != null ? redirect ( originalUrl ) : redirect ( postSignInUrl ) ; } else { return redirect ( URIBuilder . fromUri ( signInUrl ) . queryParam ( "error" , "multiple_users" ) . build ( ) . toString ( ) ) ; }
public class NetUtils { /** * PUT请求 * @ param url 请求的URL * @ param body 内容正文 * @ return 响应内容 * @ since 1.1.0 */ public static String put ( String url , String body ) { } }
return request ( HttpRequest . put ( replaceLocalHost ( url ) ) , body ) . body ( ) ;
public class GroupHandlerImpl { /** * Notifying listeners after group creation . * @ param group * the group which is used in create operation * @ param isNew * true , if we have a deal with new group , otherwise it is false * which mean update operation is in progress * @ throws Exception * if any listener failed to handle the event */ private void postSave ( Group group , boolean isNew ) throws Exception { } }
for ( GroupEventListener listener : listeners ) { listener . postSave ( group , isNew ) ; }
public class AutoReconnectGateway { /** * Reconnect session after specified interval . * @ param timeInMillis is the interval . */ private void reconnectAfter ( final long timeInMillis ) { } }
new Thread ( ) { @ Override public void run ( ) { LOGGER . info ( "Schedule reconnect after {} millis" , timeInMillis ) ; try { Thread . sleep ( timeInMillis ) ; } catch ( InterruptedException e ) { } int attempt = 0 ; while ( session == null || session . getSessionState ( ) . equals ( SessionState . CLOSED ) ) { try { LOGGER . info ( "Reconnecting attempt #{} ..." , ++ attempt ) ; session = newSession ( ) ; } catch ( IOException e ) { LOGGER . error ( "Failed opening connection and bind to " + remoteIpAddress + ":" + remotePort , e ) ; // wait for a second try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException ee ) { } } } } } . start ( ) ;
public class PorterStemmer { /** * / * setto ( s ) sets ( j + 1 ) , . . . k to the characters in the string s , readjusting */ private final void setto ( String s ) { } }
int l = s . length ( ) ; int o = j + 1 ; for ( int i = 0 ; i < l ; i ++ ) sb . setCharAt ( o + i , s . charAt ( i ) ) ; k = j + l ;
public class ManualDescriptor { /** * setter for dBInfoList - sets A collection of objects of type uima . julielab . uima . DBInfo , O * @ generated * @ param v value to set into the feature */ public void setDBInfoList ( FSArray v ) { } }
if ( ManualDescriptor_Type . featOkTst && ( ( ManualDescriptor_Type ) jcasType ) . casFeat_dBInfoList == null ) jcasType . jcas . throwFeatMissing ( "dBInfoList" , "de.julielab.jules.types.pubmed.ManualDescriptor" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( ManualDescriptor_Type ) jcasType ) . casFeatCode_dBInfoList , jcasType . ll_cas . ll_getFSRef ( v ) ) ;
public class StringUtil { /** * 将驼峰风格替换为下划线风格 */ public static String camelhumpToUnderline ( String str ) { } }
final int size ; final char [ ] chars ; final StringBuilder sb = new StringBuilder ( ( size = ( chars = str . toCharArray ( ) ) . length ) * 3 / 2 + 1 ) ; char c ; for ( int i = 0 ; i < size ; i ++ ) { c = chars [ i ] ; if ( isUppercaseAlpha ( c ) ) { sb . append ( '_' ) . append ( toLowerAscii ( c ) ) ; } else { sb . append ( c ) ; } } return sb . charAt ( 0 ) == '_' ? sb . substring ( 1 ) : sb . toString ( ) ;
public class AIStream { /** * / * ( non - Javadoc ) * @ see com . ibm . ws . sib . processor . gd . Stream # getCompletedPrefix ( ) */ public long getCompletedPrefix ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getCompletedPrefix" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getCompletedPrefix" , Long . valueOf ( _targetStream . getCompletedPrefix ( ) ) ) ; return _targetStream . getCompletedPrefix ( ) ;
public class PelopsClient { /** * ( non - Javadoc ) * @ see com . impetus . kundera . client . Client # findIdsByColumn ( java . lang . String , * java . lang . String , java . lang . String , java . lang . String , java . lang . Object , * java . lang . Class ) */ @ Override public Object [ ] findIdsByColumn ( String schemaName , String tableName , String pKeyName , String columnName , Object columnValue , Class entityClazz ) { } }
List < Object > rowKeys = new ArrayList < Object > ( ) ; if ( getCqlVersion ( ) . equalsIgnoreCase ( CassandraConstants . CQL_VERSION_3_0 ) ) { rowKeys = findIdsByColumnUsingCql ( schemaName , tableName , pKeyName , columnName , columnValue , entityClazz ) ; } else { Selector selector = clientFactory . getSelector ( pool ) ; SlicePredicate slicePredicate = Selector . newColumnsPredicateAll ( false , 10000 ) ; EntityMetadata metadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , entityClazz ) ; IndexClause ix = Selector . newIndexClause ( Bytes . EMPTY , 10000 , Selector . newIndexExpression ( columnName + Constants . JOIN_COLUMN_NAME_SEPARATOR + columnValue , IndexOperator . EQ , Bytes . fromByteArray ( PropertyAccessorHelper . getBytes ( columnValue ) ) ) ) ; Map < Bytes , List < Column > > qResults = selector . getIndexedColumns ( tableName , ix , slicePredicate , getConsistencyLevel ( ) ) ; // iterate through complete map and Iterator < Bytes > rowIter = qResults . keySet ( ) . iterator ( ) ; while ( rowIter . hasNext ( ) ) { Bytes rowKey = rowIter . next ( ) ; PropertyAccessor < ? > accessor = PropertyAccessorFactory . getPropertyAccessor ( ( Field ) metadata . getIdAttribute ( ) . getJavaMember ( ) ) ; Object value = accessor . fromBytes ( metadata . getIdAttribute ( ) . getJavaType ( ) , rowKey . toByteArray ( ) ) ; rowKeys . add ( value ) ; } } if ( rowKeys != null && ! rowKeys . isEmpty ( ) ) { return rowKeys . toArray ( new Object [ 0 ] ) ; } if ( log . isInfoEnabled ( ) ) { log . info ( "No row keys found, returning null." ) ; } return null ;
public class RequestCreator { /** * Asynchronously fulfills the request into the specified { @ link ImageView } and invokes the * target { @ link Callback } if it ' s not { @ code null } . * < em > Note : < / em > The { @ link Callback } param is a strong reference and will prevent your * { @ link android . app . Activity } or { @ link android . app . Fragment } from being garbage collected . If * you use this method , it is < b > strongly < / b > recommended you invoke an adjacent * { @ link Picasso # cancelRequest ( android . widget . ImageView ) } call to prevent temporary leaking . */ public void into ( @ NonNull ImageView target , @ Nullable Callback callback ) { } }
long started = System . nanoTime ( ) ; checkMain ( ) ; if ( target == null ) { throw new IllegalArgumentException ( "Target must not be null." ) ; } if ( ! data . hasImage ( ) ) { picasso . cancelRequest ( target ) ; if ( setPlaceholder ) { setPlaceholder ( target , getPlaceholderDrawable ( ) ) ; } return ; } if ( deferred ) { if ( data . hasSize ( ) ) { throw new IllegalStateException ( "Fit cannot be used with resize." ) ; } int width = target . getWidth ( ) ; int height = target . getHeight ( ) ; if ( width == 0 || height == 0 ) { if ( setPlaceholder ) { setPlaceholder ( target , getPlaceholderDrawable ( ) ) ; } picasso . defer ( target , new DeferredRequestCreator ( this , target , callback ) ) ; return ; } data . resize ( width , height ) ; } Request request = createRequest ( started ) ; if ( shouldReadFromMemoryCache ( request . memoryPolicy ) ) { Bitmap bitmap = picasso . quickMemoryCacheCheck ( request . key ) ; if ( bitmap != null ) { picasso . cancelRequest ( target ) ; RequestHandler . Result result = new RequestHandler . Result ( bitmap , MEMORY ) ; setResult ( target , picasso . context , result , noFade , picasso . indicatorsEnabled ) ; if ( picasso . loggingEnabled ) { log ( OWNER_MAIN , VERB_COMPLETED , request . plainId ( ) , "from " + MEMORY ) ; } if ( callback != null ) { callback . onSuccess ( ) ; } return ; } } if ( setPlaceholder ) { setPlaceholder ( target , getPlaceholderDrawable ( ) ) ; } Action action = new ImageViewAction ( picasso , target , request , errorDrawable , errorResId , noFade , callback ) ; picasso . enqueueAndSubmit ( action ) ;
public class UserInfoHelper { /** * per oidc - connect - core - 1.0 sec 5.3.2 , sub claim of userinfo response must match sub claim in id token . */ protected boolean isUserInfoValid ( String userInfoStr , String subClaim ) { } }
String userInfoSubClaim = getUserInfoSubClaim ( userInfoStr ) ; if ( userInfoSubClaim == null || subClaim == null || userInfoSubClaim . compareTo ( subClaim ) != 0 ) { Tr . error ( tc , "USERINFO_INVALID" , new Object [ ] { userInfoStr , subClaim } ) ; return false ; } return true ;
public class MorphiaMongoDatastore { protected < T , K extends Serializable > Query < T > _buildQuery ( final DAO < T , K > dao , final Class < T > type , final QueryParams params ) { } }
Query < T > query = null ; try { query = dao . createQuery ( ) ; QueryBuilder builder = _getQueryBuilderFactory ( ) . newBuilder ( type ) ; query = builder . build ( query , params ) ; } catch ( RepositoryConfigurationException ex ) { throw ex ; } catch ( QueryException ex ) { throw ex ; } catch ( Exception ex ) { throw new QueryException ( ex ) ; } return query ;
public class DefaultPDUSender { /** * ( non - Javadoc ) * @ see org . jsmpp . PDUSender # sendDeliverSmResp ( java . io . OutputStream , int , int , String ) */ @ Override public byte [ ] sendDeliverSmResp ( OutputStream os , int commandStatus , int sequenceNumber , String messageId ) throws IOException { } }
byte [ ] b = pduComposer . deliverSmResp ( commandStatus , sequenceNumber , messageId ) ; writeAndFlush ( os , b ) ; return b ;
public class JMatrix { /** * Form the eigenvectors of a real nonsymmetric matrix by back transforming * those of the corresponding balanced matrix determined by balance . */ private static void balbak ( DenseMatrix V , double [ ] scale ) { } }
int n = V . nrows ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { V . mul ( i , j , scale [ i ] ) ; } }
public class Clipboard { /** * This method returns one of available aggregations , if there ' s at least 1 ready . * @ return */ public VoidAggregation nextCandidate ( ) { } }
VoidAggregation result = completedQueue . poll ( ) ; // removing aggregation from tracking table if ( result != null ) { completedCounter . decrementAndGet ( ) ; unpin ( result . getOriginatorId ( ) , result . getTaskId ( ) ) ; } return result ;
public class LZFDecodingInterceptor { /** * Check if content encoding is LZF . * < p / > If encoding is LZF , wrap the InputStream for that message in LZFInputStream to decode it * @ param context Context for HTTP request / response * @ return context . proceed ( ) * @ throws IOException * @ throws WebApplicationException */ public Object read ( MessageBodyReaderContext context ) throws IOException , WebApplicationException { } }
Object encoding = context . getHeaders ( ) . getFirst ( HttpHeaders . CONTENT_ENCODING ) ; if ( encoding != null && encoding . toString ( ) . equalsIgnoreCase ( "lzf" ) ) { InputStream old = context . getInputStream ( ) ; LZFInputStream is = new LZFInputStream ( old ) ; context . setInputStream ( is ) ; try { return context . proceed ( ) ; } finally { context . setInputStream ( old ) ; } } else { return context . proceed ( ) ; }
public class CryptonitAdapters { /** * Adapt the user ' s trades */ public static UserTrades adaptTradeHistory ( CryptonitUserTransaction [ ] cryptonitUserTransactions ) { } }
List < UserTrade > trades = new ArrayList < > ( ) ; long lastTradeId = 0 ; for ( CryptonitUserTransaction t : cryptonitUserTransactions ) { if ( ! t . getType ( ) . equals ( CryptonitUserTransaction . TransactionType . trade ) ) { // skip account deposits and withdrawals . continue ; } final OrderType orderType ; if ( t . getCounterAmount ( ) . doubleValue ( ) == 0.0 ) { orderType = t . getBaseAmount ( ) . doubleValue ( ) < 0.0 ? OrderType . ASK : OrderType . BID ; } else { orderType = t . getCounterAmount ( ) . doubleValue ( ) > 0.0 ? OrderType . ASK : OrderType . BID ; } long tradeId = t . getId ( ) ; if ( tradeId > lastTradeId ) { lastTradeId = tradeId ; } final CurrencyPair pair = new CurrencyPair ( t . getBaseCurrency ( ) . toUpperCase ( ) , t . getCounterCurrency ( ) . toUpperCase ( ) ) ; UserTrade trade = new UserTrade ( orderType , t . getBaseAmount ( ) . abs ( ) , pair , t . getPrice ( ) . abs ( ) , t . getDatetime ( ) , Long . toString ( tradeId ) , Long . toString ( t . getOrderId ( ) ) , t . getFee ( ) , Currency . getInstance ( t . getFeeCurrency ( ) . toUpperCase ( ) ) ) ; trades . add ( trade ) ; } return new UserTrades ( trades , lastTradeId , TradeSortType . SortByID ) ;
public class IterUtil { /** * 将键列表和值列表转换为Map < br > * 以键为准 , 值与键位置需对应 。 如果键元素数多于值元素 , 多余部分值用null代替 。 < br > * 如果值多于键 , 忽略多余的值 。 * @ param < K > 键类型 * @ param < V > 值类型 * @ param keys 键列表 * @ param values 值列表 * @ param isOrder 是否有序 * @ return 标题内容Map * @ since 4.1.12 */ public static < K , V > Map < K , V > toMap ( Iterator < K > keys , Iterator < V > values , boolean isOrder ) { } }
final Map < K , V > resultMap = MapUtil . newHashMap ( isOrder ) ; if ( isNotEmpty ( keys ) ) { while ( keys . hasNext ( ) ) { resultMap . put ( keys . next ( ) , ( null != values && values . hasNext ( ) ) ? values . next ( ) : null ) ; } } return resultMap ;
public class DataFrameJoiner { /** * Adds rows to destination for each row in table1 , with the columns from table2 added as missing values in each */ @ SuppressWarnings ( { } }
"rawtypes" , "unchecked" } ) private void withMissingLeftJoin ( Table destination , Table table1 ) { for ( int c = 0 ; c < destination . columnCount ( ) ; c ++ ) { if ( c < table1 . columnCount ( ) ) { Column t1Col = table1 . column ( c ) ; destination . column ( c ) . append ( t1Col ) ; } else { for ( int r1 = 0 ; r1 < table1 . rowCount ( ) ; r1 ++ ) { destination . column ( c ) . appendMissing ( ) ; } } }
public class SSLHandlerFactory { /** * Add common configs for both client and server ssl engines . * @ param engine client / server ssl engine . * @ return sslEngine */ public SSLEngine addCommonConfigs ( SSLEngine engine ) { } }
if ( sslConfig . getCipherSuites ( ) != null && sslConfig . getCipherSuites ( ) . length > 0 ) { engine . setEnabledCipherSuites ( sslConfig . getCipherSuites ( ) ) ; } if ( sslConfig . getEnableProtocols ( ) != null && sslConfig . getEnableProtocols ( ) . length > 0 ) { engine . setEnabledProtocols ( sslConfig . getEnableProtocols ( ) ) ; } engine . setEnableSessionCreation ( sslConfig . isEnableSessionCreation ( ) ) ; return engine ;
public class ListKeysResult { /** * A list of keys . * @ return A list of keys . */ public java . util . List < KeyListEntry > getKeys ( ) { } }
if ( keys == null ) { keys = new com . ibm . cloud . objectstorage . internal . SdkInternalList < KeyListEntry > ( ) ; } return keys ;
public class GetConfigurationSetEventDestinationsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetConfigurationSetEventDestinationsRequest getConfigurationSetEventDestinationsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getConfigurationSetEventDestinationsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getConfigurationSetEventDestinationsRequest . getConfigurationSetName ( ) , CONFIGURATIONSETNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Agent { /** * This method is invoked by iPojo every time a new plug - in appears . * @ param pi the appearing plugin . */ public void pluginAppears ( PluginInterface pi ) { } }
if ( pi != null ) { this . logger . info ( "Plugin '" + pi . getPluginName ( ) + "' is now available in Roboconf's agent." ) ; this . plugins . add ( pi ) ; listPlugins ( ) ; }
public class AlertsInner { /** * Gets all the alerts for a data box edge / gateway device . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the PagedList & lt ; AlertInner & gt ; object if successful . */ public PagedList < AlertInner > listByDataBoxEdgeDeviceNext ( final String nextPageLink ) { } }
ServiceResponse < Page < AlertInner > > response = listByDataBoxEdgeDeviceNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) ; return new PagedList < AlertInner > ( response . body ( ) ) { @ Override public Page < AlertInner > nextPage ( String nextPageLink ) { return listByDataBoxEdgeDeviceNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ;
public class base { /** * Normalize the given double array , so that it sum to one . The * normalization is performed in place and the same { @ code values } are * returned . * @ param values the values to normalize . * @ return the { @ code values } array . * @ throws NullPointerException if the given double array is { @ code null } . */ public static double [ ] normalize ( final double [ ] values ) { } }
final double sum = 1.0 / DoubleAdder . sum ( values ) ; for ( int i = values . length ; -- i >= 0 ; ) { values [ i ] = values [ i ] * sum ; } return values ;
public class TokContextGenerator { /** * Builds up the list of features based on the information in the Object , * which is a pair containing a String and and Integer which * indicates the index of the position we are investigating . */ public String [ ] getContext ( Object o ) { } }
String sb = ( String ) ( ( ObjectIntPair ) o ) . a ; int id = ( ( ObjectIntPair ) o ) . b ; List preds = new ArrayList ( ) ; preds . add ( "p=" + sb . substring ( 0 , id ) ) ; preds . add ( "s=" + sb . substring ( id ) ) ; if ( id > 0 ) { addCharPreds ( "p1" , sb . charAt ( id - 1 ) , preds ) ; if ( id > 1 ) { addCharPreds ( "p2" , sb . charAt ( id - 2 ) , preds ) ; preds . add ( "p21=" + sb . charAt ( id - 2 ) + sb . charAt ( id - 1 ) ) ; } else { preds . add ( "p2=bok" ) ; } preds . add ( "p1f1=" + sb . charAt ( id - 1 ) + sb . charAt ( id ) ) ; } else { preds . add ( "p1=bok" ) ; } addCharPreds ( "f1" , sb . charAt ( id ) , preds ) ; if ( id + 1 < sb . length ( ) ) { addCharPreds ( "f2" , sb . charAt ( id + 1 ) , preds ) ; preds . add ( "f12=" + sb . charAt ( id ) + sb . charAt ( id + 1 ) ) ; } else { preds . add ( "f2=bok" ) ; } if ( sb . charAt ( 0 ) == '&' && sb . charAt ( sb . length ( ) - 1 ) == ';' ) { preds . add ( "cc" ) ; // character code } String [ ] context = new String [ preds . size ( ) ] ; preds . toArray ( context ) ; return context ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } * { @ link CmisAccessControlListType } { @ code > } */ @ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "removeACEs" , scope = CreateDocumentFromSource . class ) public JAXBElement < CmisAccessControlListType > createCreateDocumentFromSourceRemoveACEs ( CmisAccessControlListType value ) { } }
return new JAXBElement < CmisAccessControlListType > ( _CreateDocumentRemoveACEs_QNAME , CmisAccessControlListType . class , CreateDocumentFromSource . class , value ) ;
public class PriorityQueue { /** * Inserts the specified element into this priority queue . If { @ code uniqueness } is enabled and this priority queue already * contains the element , the call leaves the queue unchanged and returns false . * @ return true if the element was added to this queue , else false * @ throws ClassCastException if the specified element cannot be compared with elements currently in this priority queue * according to the priority queue ' s ordering * @ throws IllegalArgumentException if the specified element is null */ public boolean add ( E e ) { } }
if ( e == null ) throw new IllegalArgumentException ( "Element cannot be null." ) ; if ( uniqueness && ! set . add ( e ) ) return false ; int i = size ; if ( i >= queue . length ) growToSize ( i + 1 ) ; size = i + 1 ; if ( i == 0 ) queue [ 0 ] = e ; else siftUp ( i , e ) ; return true ;
import java . util . * ; class GetEveryNthElement { /** * This function retrieves every nth element from a given list . * Examples : * getEveryNthElement ( Arrays . asList ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ) , 2 ) - > [ 1 , 3 , 5 , 7 , 9] * getEveryNthElement ( Arrays . asList ( 10 , 15 , 19 , 17 , 16 , 18 ) , 3 ) - > [ 10 , 17] * getEveryNthElement ( Arrays . asList ( 14 , 16 , 19 , 15 , 17 ) , 4 ) - > [ 14 , 17] * @ param array The list from which to retrieve elements . * @ param interval The interval at which elements should be retrieved ( n ) . * @ return A list containing every nth element of the original list . */ public static List < Integer > getEveryNthElement ( List < Integer > array , int interval ) { } }
List < Integer > result = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < array . size ( ) ; i += interval ) { result . add ( array . get ( i ) ) ; } return result ;
public class InterceptorComponent { /** * Add the WComponent to the end of the interceptor chain . * @ param ui the WComponent to add . */ public void attachUI ( final WComponent ui ) { } }
if ( backing == null || backing instanceof WComponent ) { backing = ui ; } else if ( backing instanceof InterceptorComponent ) { ( ( InterceptorComponent ) backing ) . attachUI ( ui ) ; } else { throw new IllegalStateException ( "Unable to attachUI. Unknown type of WebComponent encountered. " + backing . getClass ( ) . getName ( ) ) ; }
public class PersistentPropertyBinder { /** * @ see # bind ( ObjectProperty , String ) * @ param property * { @ link Property } to bind * @ param key * unique application store key */ public void bind ( final StringProperty property , String key ) { } }
String value = prefs . get ( validateKey ( key ) , null ) ; if ( value != null ) { property . set ( value ) ; } property . addListener ( o -> prefs . put ( key , property . getValue ( ) ) ) ;
public class BurlapProxy { /** * Handles the object invocation . * @ param proxy the proxy object to invoke * @ param method the method to call * @ param args the arguments to the proxy object */ public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { } }
String methodName = method . getName ( ) ; Class [ ] params = method . getParameterTypes ( ) ; // equals and hashCode are special cased if ( methodName . equals ( "equals" ) && params . length == 1 && params [ 0 ] . equals ( Object . class ) ) { Object value = args [ 0 ] ; if ( value == null || ! Proxy . isProxyClass ( value . getClass ( ) ) ) return new Boolean ( false ) ; BurlapProxy handler = ( BurlapProxy ) Proxy . getInvocationHandler ( value ) ; return new Boolean ( _url . equals ( handler . getURL ( ) ) ) ; } else if ( methodName . equals ( "hashCode" ) && params . length == 0 ) return new Integer ( _url . hashCode ( ) ) ; else if ( methodName . equals ( "getBurlapType" ) ) return proxy . getClass ( ) . getInterfaces ( ) [ 0 ] . getName ( ) ; else if ( methodName . equals ( "getBurlapURL" ) ) return _url . toString ( ) ; else if ( methodName . equals ( "toString" ) && params . length == 0 ) return getClass ( ) . getSimpleName ( ) + "[" + _url + "]" ; InputStream is = null ; URLConnection conn = null ; HttpURLConnection httpConn = null ; try { conn = _factory . openConnection ( _url ) ; httpConn = ( HttpURLConnection ) conn ; httpConn . setRequestMethod ( "POST" ) ; conn . setRequestProperty ( "Content-Type" , "text/xml" ) ; OutputStream os ; try { os = conn . getOutputStream ( ) ; } catch ( Exception e ) { throw new BurlapRuntimeException ( e ) ; } BurlapOutput out = _factory . getBurlapOutput ( os ) ; if ( ! _factory . isOverloadEnabled ( ) ) { } else if ( args != null ) methodName = methodName + "__" + args . length ; else methodName = methodName + "__0" ; if ( log . isLoggable ( Level . FINE ) ) log . fine ( this + " calling " + methodName + " (" + method + ")" ) ; out . call ( methodName , args ) ; try { os . flush ( ) ; } catch ( Exception e ) { throw new BurlapRuntimeException ( e ) ; } if ( conn instanceof HttpURLConnection ) { httpConn = ( HttpURLConnection ) conn ; int code = 500 ; try { code = httpConn . getResponseCode ( ) ; } catch ( Exception e ) { } if ( code != 200 ) { StringBuffer sb = new StringBuffer ( ) ; int ch ; try { is = httpConn . getInputStream ( ) ; if ( is != null ) { while ( ( ch = is . read ( ) ) >= 0 ) sb . append ( ( char ) ch ) ; is . close ( ) ; } is = httpConn . getErrorStream ( ) ; if ( is != null ) { while ( ( ch = is . read ( ) ) >= 0 ) sb . append ( ( char ) ch ) ; } } catch ( FileNotFoundException e ) { throw new BurlapRuntimeException ( code + ": " + String . valueOf ( e ) ) ; } catch ( IOException e ) { } if ( is != null ) is . close ( ) ; throw new BurlapProtocolException ( code + ": " + sb . toString ( ) ) ; } } is = conn . getInputStream ( ) ; AbstractBurlapInput in = _factory . getBurlapInput ( is ) ; return in . readReply ( method . getReturnType ( ) ) ; } catch ( BurlapProtocolException e ) { throw new BurlapRuntimeException ( e ) ; } finally { try { if ( is != null ) is . close ( ) ; } catch ( IOException e ) { } if ( httpConn != null ) httpConn . disconnect ( ) ; }
public class EqualExpectation { /** * { @ inheritDoc } */ public boolean meets ( Object result ) { } }
if ( isArray ( matchee ) ) { return isArray ( result ) && Arrays . deepEquals ( ( Object [ ] ) matchee , ( Object [ ] ) result ) ; } return matchee . equals ( result ) ;
public class CheckForbiddenApis { /** * Executes the forbidden apis task . */ @ TaskAction public void checkForbidden ( ) throws ForbiddenApiException { } }
final FileCollection classesDirs = getClassesDirs ( ) ; final FileCollection classpath = getClasspath ( ) ; if ( classesDirs == null || classpath == null ) { throw new InvalidUserDataException ( "Missing 'classesDirs' or 'classpath' property." ) ; } final Logger log = new Logger ( ) { @ Override public void error ( String msg ) { getLogger ( ) . error ( msg ) ; } @ Override public void warn ( String msg ) { getLogger ( ) . warn ( msg ) ; } @ Override public void info ( String msg ) { getLogger ( ) . info ( msg ) ; } } ; final Set < File > cpElements = new LinkedHashSet < File > ( ) ; cpElements . addAll ( classpath . getFiles ( ) ) ; cpElements . addAll ( classesDirs . getFiles ( ) ) ; final URL [ ] urls = new URL [ cpElements . size ( ) ] ; try { int i = 0 ; for ( final File cpElement : cpElements ) { urls [ i ++ ] = cpElement . toURI ( ) . toURL ( ) ; } assert i == urls . length ; } catch ( MalformedURLException mfue ) { throw new InvalidUserDataException ( "Failed to build classpath URLs." , mfue ) ; } URLClassLoader urlLoader = null ; final ClassLoader loader = ( urls . length > 0 ) ? ( urlLoader = URLClassLoader . newInstance ( urls , ClassLoader . getSystemClassLoader ( ) ) ) : ClassLoader . getSystemClassLoader ( ) ; try { final EnumSet < Checker . Option > options = EnumSet . noneOf ( Checker . Option . class ) ; if ( getFailOnMissingClasses ( ) ) options . add ( FAIL_ON_MISSING_CLASSES ) ; if ( ! getIgnoreFailures ( ) ) options . add ( FAIL_ON_VIOLATION ) ; if ( getFailOnUnresolvableSignatures ( ) ) options . add ( FAIL_ON_UNRESOLVABLE_SIGNATURES ) ; if ( getDisableClassloadingCache ( ) ) options . add ( DISABLE_CLASSLOADING_CACHE ) ; final Checker checker = new Checker ( log , loader , options ) ; if ( ! checker . isSupportedJDK ) { final String msg = String . format ( Locale . ENGLISH , "Your Java runtime (%s %s) is not supported by the forbiddenapis plugin. Please run the checks with a supported JDK!" , System . getProperty ( "java.runtime.name" ) , System . getProperty ( "java.runtime.version" ) ) ; if ( getFailOnUnsupportedJava ( ) ) { throw new GradleException ( msg ) ; } else { log . warn ( msg ) ; return ; } } final Set < String > suppressAnnotations = getSuppressAnnotations ( ) ; if ( suppressAnnotations != null ) { for ( String a : suppressAnnotations ) { checker . addSuppressAnnotation ( a ) ; } } try { final Set < String > bundledSignatures = getBundledSignatures ( ) ; if ( bundledSignatures != null ) { final String bundledSigsJavaVersion = getTargetCompatibility ( ) ; if ( bundledSigsJavaVersion == null ) { log . warn ( "The 'targetCompatibility' project or task property is missing. " + "Trying to read bundled JDK signatures without compiler target. " + "You have to explicitly specify the version in the resource name." ) ; } for ( String bs : bundledSignatures ) { checker . addBundledSignatures ( bs , bundledSigsJavaVersion ) ; } } if ( getInternalRuntimeForbidden ( ) ) { log . warn ( DEPRECATED_WARN_INTERNALRUNTIME ) ; checker . addBundledSignatures ( BS_JDK_NONPORTABLE , null ) ; } final FileCollection signaturesFiles = getSignaturesFiles ( ) ; if ( signaturesFiles != null ) for ( final File f : signaturesFiles ) { checker . parseSignaturesFile ( f ) ; } final Set < URL > signaturesURLs = getSignaturesURLs ( ) ; if ( signaturesURLs != null ) for ( final URL url : signaturesURLs ) { checker . parseSignaturesFile ( url ) ; } final List < String > signatures = getSignatures ( ) ; if ( signatures != null && ! signatures . isEmpty ( ) ) { final StringBuilder sb = new StringBuilder ( ) ; for ( String line : signatures ) { sb . append ( line ) . append ( NL ) ; } checker . parseSignaturesString ( sb . toString ( ) ) ; } } catch ( IOException ioe ) { throw new ResourceException ( "IO problem while reading files with API signatures." , ioe ) ; } catch ( ParseException pe ) { throw new InvalidUserDataException ( "Parsing signatures failed: " + pe . getMessage ( ) , pe ) ; } if ( checker . hasNoSignatures ( ) ) { if ( options . contains ( FAIL_ON_UNRESOLVABLE_SIGNATURES ) ) { throw new InvalidUserDataException ( "No API signatures found; use properties 'signatures', 'bundledSignatures', 'signaturesURLs', and/or 'signaturesFiles' to define those!" ) ; } else { log . info ( "Skipping execution because no API signatures are available." ) ; return ; } } try { checker . addClassesToCheck ( getClassFiles ( ) ) ; } catch ( IOException ioe ) { throw new ResourceException ( "Failed to load one of the given class files." , ioe ) ; } checker . run ( ) ; } finally { // Java 7 supports closing URLClassLoader , so check for Closeable interface : if ( urlLoader instanceof Closeable ) try { ( ( Closeable ) urlLoader ) . close ( ) ; } catch ( IOException ioe ) { // ignore } }
public class Builder { /** * Returns the special header expected by RPM for * a particular header . * @ param tag the tag to get * @ param count the number to get * @ return the header bytes */ protected byte [ ] getSpecial ( final int tag , final int count ) { } }
final ByteBuffer buffer = ByteBuffer . allocate ( 16 ) ; buffer . putInt ( tag ) ; buffer . putInt ( 0x00000007 ) ; buffer . putInt ( count * - 16 ) ; buffer . putInt ( 0x00000010 ) ; return buffer . array ( ) ;
public class ColumnInfoMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ColumnInfo columnInfo , ProtocolMarshaller protocolMarshaller ) { } }
if ( columnInfo == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( columnInfo . getCatalogName ( ) , CATALOGNAME_BINDING ) ; protocolMarshaller . marshall ( columnInfo . getSchemaName ( ) , SCHEMANAME_BINDING ) ; protocolMarshaller . marshall ( columnInfo . getTableName ( ) , TABLENAME_BINDING ) ; protocolMarshaller . marshall ( columnInfo . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( columnInfo . getLabel ( ) , LABEL_BINDING ) ; protocolMarshaller . marshall ( columnInfo . getType ( ) , TYPE_BINDING ) ; protocolMarshaller . marshall ( columnInfo . getPrecision ( ) , PRECISION_BINDING ) ; protocolMarshaller . marshall ( columnInfo . getScale ( ) , SCALE_BINDING ) ; protocolMarshaller . marshall ( columnInfo . getNullable ( ) , NULLABLE_BINDING ) ; protocolMarshaller . marshall ( columnInfo . getCaseSensitive ( ) , CASESENSITIVE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class JaxWsImplBeanCDICustomizer { @ FFDCIgnore ( NameNotFoundException . class ) private BeanManager getBeanManager ( ) { } }
BeanManager manager = null ; // if ( manager ! = null ) // return manager ; // else { try { InitialContext initialContext = new InitialContext ( ) ; manager = ( BeanManager ) initialContext . lookup ( "java:comp/BeanManager" ) ; // manager = CDI . current ( ) . getBeanManager ( ) ; JAXWSCDIServiceImplByJndi . setBeanManager ( manager ) ; } catch ( NameNotFoundException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Couldn't get BeanManager through JNDI: " + JAXWSCDIConstants . JDNI_STRING + ", but ignore the FFDC: " + e . toString ( ) ) ; } } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Couldn't get BeanManager through JNDI: " + JAXWSCDIConstants . JDNI_STRING + ". " + e . toString ( ) ) ; } } return manager ;
public class Navigate { /** * Navigates up to specified activity in the back stack skipping intermediate activities */ public void navigateUp ( Intent intent ) { } }
intent . setFlags ( Intent . FLAG_ACTIVITY_CLEAR_TOP | Intent . FLAG_ACTIVITY_SINGLE_TOP ) ; start ( intent ) ; finish ( ) ;
public class ExpressRouteCrossConnectionsInner { /** * Updates an express route cross connection tags . * @ param resourceGroupName The name of the resource group . * @ param crossConnectionName The name of the cross connection . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the ExpressRouteCrossConnectionInner object */ public Observable < ExpressRouteCrossConnectionInner > beginUpdateTagsAsync ( String resourceGroupName , String crossConnectionName ) { } }
return beginUpdateTagsWithServiceResponseAsync ( resourceGroupName , crossConnectionName ) . map ( new Func1 < ServiceResponse < ExpressRouteCrossConnectionInner > , ExpressRouteCrossConnectionInner > ( ) { @ Override public ExpressRouteCrossConnectionInner call ( ServiceResponse < ExpressRouteCrossConnectionInner > response ) { return response . body ( ) ; } } ) ;
public class HttpServer { /** * Creates a new server using the passed port . * @ param port Port for the server . { @ code 0 } to use ephemeral port . * @ param serverGroup Eventloop group to be used for server sockets . * @ param clientGroup Eventloop group to be used for client sockets . * @ param channelClass The class to be used for server channel . * @ return A new { @ link HttpServer } */ public static HttpServer < ByteBuf , ByteBuf > newServer ( int port , EventLoopGroup serverGroup , EventLoopGroup clientGroup , Class < ? extends ServerChannel > channelClass ) { } }
return _newServer ( TcpServer . newServer ( port , serverGroup , clientGroup , channelClass ) ) ;
public class A_CmsResourceCollector { /** * Returns the link to create a new XML content item in the folder pointed to by the parameter . < p > * @ param cms the current CmsObject * @ param param the folder name to use * @ return the link to create a new XML content item in the folder * @ throws CmsException if something goes wrong */ protected String getCreateInFolder ( CmsObject cms , String param ) throws CmsException { } }
return getCreateInFolder ( cms , new CmsCollectorData ( param ) ) ;
public class AbstractJaxRsResourceProvider { /** * Execute a custom operation * @ param resource the resource to create * @ param requestType the type of request * @ param id the id of the resource on which to perform the operation * @ param operationName the name of the operation to execute * @ param operationType the rest operation type * @ return the response * @ see < a href = " https : / / www . hl7 . org / fhir / operations . html " > https : / / www . hl7 . org / fhir / operations . html < / a > */ protected Response customOperation ( final String resource , final RequestTypeEnum requestType , final String id , final String operationName , final RestOperationTypeEnum operationType ) throws IOException { } }
final Builder request = getResourceRequest ( requestType , operationType ) . resource ( resource ) . id ( id ) ; return execute ( request , operationName ) ;
public class AbstractEngineSync { /** * Gets the compiled value from cache this is a synchronous operation since there is no blocking or I / O */ public T getTemplateFromCache ( String filename ) { } }
LRUCache . CacheEntry < String , T > cachedTemplate = cache . get ( filename ) ; // this is to avoid null pointer exception in case of the layout composite template if ( cachedTemplate == null ) { return null ; } return cachedTemplate . compiled ;
public class ComicChatOverlay { /** * Given the specified label dimensions , attempt to find the height that will give us the * width / height ratio that is closest to the golden ratio . */ protected int getGoldenLabelHeight ( Dimension d ) { } }
// compute the ratio of the one line ( addin ' the paddin ' ) double lastratio = ( ( double ) d . width + ( PAD * 2 ) ) / ( ( double ) d . height + ( PAD * 2 ) ) ; // now try increasing the # of lines and seeing if we get closer to the golden ratio for ( int lines = 2 ; true ; lines ++ ) { double ratio = ( ( double ) ( d . width / lines ) + ( PAD * 2 ) ) / ( ( double ) ( d . height * lines ) + ( PAD * 2 ) ) ; if ( Math . abs ( ratio - GOLDEN ) < Math . abs ( lastratio - GOLDEN ) ) { // we ' re getting closer lastratio = ratio ; } else { // we ' re getting further away , the last one was the one we want return lines - 1 ; } }
public class DescribeRepositoriesRequest { /** * A list of repositories to describe . If this parameter is omitted , then all repositories in a registry are * described . * @ param repositoryNames * A list of repositories to describe . If this parameter is omitted , then all repositories in a registry are * described . */ public void setRepositoryNames ( java . util . Collection < String > repositoryNames ) { } }
if ( repositoryNames == null ) { this . repositoryNames = null ; return ; } this . repositoryNames = new java . util . ArrayList < String > ( repositoryNames ) ;
public class DateControl { /** * Sets the value of { @ link # defaultCalendarProviderProperty ( ) } . * @ param provider the default calendar provider */ public final void setDefaultCalendarProvider ( Callback < DateControl , Calendar > provider ) { } }
requireNonNull ( provider ) ; defaultCalendarProviderProperty ( ) . set ( provider ) ;
public class StreamSource { /** * Create a FutureStream . his will call FutureStream # futureStream ( Stream ) which creates * a sequential LazyFutureStream * < pre > * { @ code * PushableFutureStream < Integer > pushable = StreamSource . futureStream ( QueueFactories . boundedNonBlockingQueue ( 1000 ) , new LazyReact ( ) ) ; * pushable . getInput ( ) . add ( 100 ) ; * pushable . getInput ( ) . close ( ) ; * assertThat ( pushable . getStream ( ) . collect ( CyclopsCollectors . toList ( ) ) , * hasItem ( 100 ) ) ; * } < / pre > * @ param adapter Adapter to create a LazyFutureStream from * @ return A LazyFutureStream that will accept values from the supplied adapter */ public static < T > FutureStream < T > futureStream ( final Adapter < T > adapter , final LazyReact react ) { } }
return react . fromAdapter ( adapter ) ;
public class ClassHash { /** * Set method hash for given method . * @ param method * the method * @ param methodHash * the method hash */ public void setMethodHash ( XMethod method , byte [ ] methodHash ) { } }
methodHashMap . put ( method , new MethodHash ( method . getName ( ) , method . getSignature ( ) , method . isStatic ( ) , methodHash ) ) ;
public class MoveOnEventHandler { /** * Called when a change is the record status is about to happen / has happened . * If this file is selected ( opened ) move the field . * @ param field If this file change is due to a field , this is the field . * @ param iChangeType The type of change that occurred . * @ param bDisplayOption If true , display any changes . * @ return an error code . */ public int doRecordChange ( FieldInfo field , int iChangeType , boolean bDisplayOption ) { } }
// Read a valid record int iErrorCode = super . doRecordChange ( field , iChangeType , bDisplayOption ) ; // Initialize the record if ( iErrorCode != DBConstants . NORMAL_RETURN ) return iErrorCode ; if ( ( ( iChangeType == DBConstants . SELECT_TYPE ) && ( m_bMoveOnSelect ) ) || ( ( iChangeType == DBConstants . AFTER_ADD_TYPE ) && ( m_bMoveOnAdd ) ) || ( ( iChangeType == DBConstants . AFTER_UPDATE_TYPE ) && ( m_bMoveOnUpdate ) ) ) this . moveTheData ( bDisplayOption , DBConstants . SCREEN_MOVE ) ; // Do trigger a record change . return iErrorCode ;
public class AbstractCommandLineRunner { /** * Creates module objects from a list of js module specifications . * @ param specs A list of js module specifications , not null or empty . * @ param inputs A list of JS file paths , not null * @ return An array of module objects */ public static List < JSModule > createJsModules ( List < JsModuleSpec > specs , List < SourceFile > inputs ) throws IOException { } }
checkState ( specs != null ) ; checkState ( ! specs . isEmpty ( ) ) ; checkState ( inputs != null ) ; List < String > moduleNames = new ArrayList < > ( specs . size ( ) ) ; Map < String , JSModule > modulesByName = new LinkedHashMap < > ( ) ; Map < String , Integer > modulesFileCountMap = new LinkedHashMap < > ( ) ; int numJsFilesExpected = 0 ; int minJsFilesRequired = 0 ; for ( JsModuleSpec spec : specs ) { if ( modulesByName . containsKey ( spec . name ) ) { throw new FlagUsageException ( "Duplicate module name: " + spec . name ) ; } JSModule module = new JSModule ( spec . name ) ; for ( String dep : spec . deps ) { JSModule other = modulesByName . get ( dep ) ; if ( other == null ) { throw new FlagUsageException ( "Module '" + spec . name + "' depends on unknown module '" + dep + "'. Be sure to list modules in dependency order." ) ; } module . addDependency ( other ) ; } // We will allow modules of zero input . if ( spec . numJsFiles < 0 ) { numJsFilesExpected = - 1 ; } else { minJsFilesRequired += spec . numJsFiles ; } if ( numJsFilesExpected >= 0 ) { numJsFilesExpected += spec . numJsFiles ; } // Add modules in reverse order so that source files are allocated to // modules in reverse order . This allows the first module // ( presumably the base module ) to have a size of ' auto ' moduleNames . add ( 0 , spec . name ) ; modulesFileCountMap . put ( spec . name , spec . numJsFiles ) ; modulesByName . put ( spec . name , module ) ; } final int totalNumJsFiles = inputs . size ( ) ; if ( numJsFilesExpected >= 0 || minJsFilesRequired > totalNumJsFiles ) { if ( minJsFilesRequired > totalNumJsFiles ) { numJsFilesExpected = minJsFilesRequired ; } if ( numJsFilesExpected > totalNumJsFiles ) { throw new FlagUsageException ( "Not enough JS files specified. Expected " + numJsFilesExpected + " but found " + totalNumJsFiles ) ; } else if ( numJsFilesExpected < totalNumJsFiles ) { throw new FlagUsageException ( "Too many JS files specified. Expected " + numJsFilesExpected + " but found " + totalNumJsFiles ) ; } } int numJsFilesLeft = totalNumJsFiles ; int moduleIndex = 0 ; for ( String moduleName : moduleNames ) { // Parse module inputs . int numJsFiles = modulesFileCountMap . get ( moduleName ) ; JSModule module = modulesByName . get ( moduleName ) ; // Check if the first js module specified ' auto ' for the number of files if ( moduleIndex == moduleNames . size ( ) - 1 && numJsFiles == - 1 ) { numJsFiles = numJsFilesLeft ; } List < SourceFile > moduleFiles = inputs . subList ( numJsFilesLeft - numJsFiles , numJsFilesLeft ) ; for ( SourceFile input : moduleFiles ) { module . add ( input ) ; } numJsFilesLeft -= numJsFiles ; moduleIndex ++ ; } return new ArrayList < > ( modulesByName . values ( ) ) ;
public class CIDRRangeValidator { /** * ( non - Javadoc ) * @ see javax . validation . ConstraintValidator # isValid ( java . lang . Object , * javax . validation . ConstraintValidatorContext ) */ @ Override public boolean isValid ( String value , ConstraintValidatorContext context ) { } }
// may contain multiple values , semicolon separated . if ( ! StringUtils . isBlank ( value ) ) { String [ ] values = value . split ( ";" ) ; for ( String val : values ) { try { new IpAddressMatcher ( val ) ; } catch ( IllegalArgumentException ex ) { return false ; } } return true ; } else { return true ; }
public class CmsDriverManager { /** * Removes the given resource to the given user ' s publish list . < p > * @ param dbc the database context * @ param userId the user ' s id * @ param structureIds the collection of structure IDs to remove * @ throws CmsDataAccessException if something goes wrong */ public void removeResourceFromUsersPubList ( CmsDbContext dbc , CmsUUID userId , Collection < CmsUUID > structureIds ) throws CmsDataAccessException { } }
for ( CmsUUID structureId : structureIds ) { CmsLogEntry entry = new CmsLogEntry ( userId , System . currentTimeMillis ( ) , structureId , CmsLogEntryType . RESOURCE_HIDDEN , new String [ ] { readResource ( dbc , structureId , CmsResourceFilter . ALL ) . getRootPath ( ) } ) ; log ( dbc , entry , true ) ; }
public class RelationalOperations { /** * Returns true of polyline _ a contains point _ b . */ private static boolean polylineContainsPoint_ ( Polyline polyline_a , Point point_b , double tolerance , ProgressTracker progress_tracker ) { } }
// Quick rasterize test to see whether the the geometries are disjoint . if ( tryRasterizedContainsOrDisjoint_ ( polyline_a , point_b , tolerance , false ) == Relation . disjoint ) return false ; Point2D pt_b = point_b . getXY ( ) ; return linearPathContainsPoint_ ( polyline_a , pt_b , tolerance ) ;
public class SibRaEngineComponent { /** * Deregisters a listener for active messaging engines on a bus . * @ param listener * the listener to deregister * @ param busName * the name of the bus the listener was registered with */ public static void deregisterMessagingEngineListener ( final SibRaMessagingEngineListener listener , final String busName ) { } }
final String methodName = "deregisterMessagingEngineListener" ; if ( TRACE . isEntryEnabled ( ) ) { SibTr . entry ( TRACE , methodName , new Object [ ] { listener , busName } ) ; } synchronized ( MESSAGING_ENGINE_LISTENERS ) { final Set listeners = ( Set ) MESSAGING_ENGINE_LISTENERS . get ( busName ) ; if ( listeners != null ) { listeners . remove ( listener ) ; if ( listeners . isEmpty ( ) ) { MESSAGING_ENGINE_LISTENERS . remove ( busName ) ; } } } if ( TRACE . isEntryEnabled ( ) ) { SibTr . exit ( TRACE , methodName ) ; }
public class ListFuncSup { /** * define a function to deal with each element in the list with given * start index * @ param func * a function takes in each element from list and * iterator info < br > * and returns last loop value * @ param index * the index where to start iteration * @ return return ' last loop value ' . < br > * check * < a href = " https : / / github . com / wkgcass / Style / " > tutorial < / a > for * more info about ' last loop value ' * @ see IteratorInfo */ public < R > R forEach ( RFunc2 < R , T , IteratorInfo < R > > func , int index ) { } }
return forEach ( $ ( func ) , index ) ;
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public String convertMDDMDDFlgsToString ( EDataType eDataType , Object instanceValue ) { } }
return instanceValue == null ? null : instanceValue . toString ( ) ;
public class ReflectiveInterceptor { /** * What ' s the " boxed " version of a given primtive type . */ private static Class < ? > boxTypeFor ( Class < ? > primType ) { } }
if ( primType == int . class ) { return Integer . class ; } else if ( primType == boolean . class ) { return Boolean . class ; } else if ( primType == byte . class ) { return Byte . class ; } else if ( primType == char . class ) { return Character . class ; } else if ( primType == double . class ) { return Double . class ; } else if ( primType == float . class ) { return Float . class ; } else if ( primType == long . class ) { return Long . class ; } else if ( primType == short . class ) { return Short . class ; } throw new IllegalStateException ( "Forgotten a case in this method?" ) ;
public class DocumentBuilderFactory { /** * Returns an instance of the named implementation of { @ code DocumentBuilderFactory } . * @ throws FactoryConfigurationError if { @ code factoryClassName } is not available or cannot be * instantiated . * @ since 1.6 */ public static DocumentBuilderFactory newInstance ( String factoryClassName , ClassLoader classLoader ) { } }
if ( factoryClassName == null ) { throw new FactoryConfigurationError ( "factoryClassName == null" ) ; } if ( classLoader == null ) { classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; } try { Class < ? > type = classLoader != null ? classLoader . loadClass ( factoryClassName ) : Class . forName ( factoryClassName ) ; return ( DocumentBuilderFactory ) type . newInstance ( ) ; } catch ( ClassNotFoundException e ) { throw new FactoryConfigurationError ( e ) ; } catch ( InstantiationException e ) { throw new FactoryConfigurationError ( e ) ; } catch ( IllegalAccessException e ) { throw new FactoryConfigurationError ( e ) ; }
public class Resolve { /** * Is given protected symbol accessible if it is selected from given site * and the selection takes place in given class ? * @ param sym The symbol with protected access * @ param c The class where the access takes place * @ site The type of the qualifier */ private boolean isProtectedAccessible ( Symbol sym , ClassSymbol c , Type site ) { } }
Type newSite = site . hasTag ( TYPEVAR ) ? site . getUpperBound ( ) : site ; while ( c != null && ! ( c . isSubClass ( sym . owner , types ) && ( c . flags ( ) & INTERFACE ) == 0 && // In JLS 2e 6.6.2.1 , the subclass restriction applies // only to instance fields and methods - - types are excluded // regardless of whether they are declared ' static ' or not . ( ( sym . flags ( ) & STATIC ) != 0 || sym . kind == TYP || newSite . tsym . isSubClass ( c , types ) ) ) ) c = c . owner . enclClass ( ) ; return c != null ;
public class FLVReader { /** * { @ inheritDoc } */ @ Override public void decodeHeader ( ) { } }
// flv header is 9 bytes fillBuffer ( 9 ) ; header = new FLVHeader ( ) ; // skip signature in . skip ( 4 ) ; header . setTypeFlags ( in . get ( ) ) ; header . setDataOffset ( in . getInt ( ) ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Header: {}" , header . toString ( ) ) ; }
public class JointParsingState { /** * 得到当前状态的特征 * @ return 特征表 */ public ArrayList < String > getFeatures ( ) { } }
if ( isFinalState ( ) ) return null ; ArrayList < String > featurelist = new ArrayList < String > ( ) ; int rightFocus = leftFocus + 1 ; // ISparseVector vec = new HashSparseVector ( ) ; // 所有的联合feature featurelist . add ( combinedFeature ( "+0+1" , POS , new int [ ] { 0 , 1 } ) ) ; featurelist . add ( combinedFeature ( "-1+0+1" , POS , new int [ ] { - 1 , 0 , 1 } ) ) ; featurelist . add ( combinedFeature ( "+0+1+2" , POS , new int [ ] { 0 , 1 , 2 } ) ) ; featurelist . add ( combinedFeature ( "+1+2+3" , POS , new int [ ] { 1 , 2 , 3 } ) ) ; featurelist . add ( combinedFeature ( "-2+3+4" , POS , new int [ ] { 2 , 3 , 4 } ) ) ; featurelist . add ( combinedFeature ( "+0+1" , LEX , new int [ ] { 0 , 1 } ) ) ; featurelist . add ( combinedFeature ( "-1+0+1" , LEX , new int [ ] { - 1 , 0 , 1 } ) ) ; featurelist . add ( combinedFeature ( "+0+1+2" , LEX , new int [ ] { 0 , 1 , 2 } ) ) ; // 设定上下文窗口大小 int l = 2 ; int r = 4 ; for ( int i = 0 ; i <= l ; i ++ ) { // 特征前缀 String posFeature = "-" + String . valueOf ( i ) + POS ; String lexFeature = "-" + String . valueOf ( i ) + LEX ; String lcLexFeature = "-" + String . valueOf ( i ) + CH_L_LEX ; String lcPosFeature = "-" + String . valueOf ( i ) + CH_L_POS ; String rcLexFeature = "-" + String . valueOf ( i ) + CH_R_LEX ; String rcPosFeature = "-" + String . valueOf ( i ) + CH_R_POS ; String lcDepFeature = "-" + String . valueOf ( i ) + CH_L_DEP ; String rcDepFeature = "-" + String . valueOf ( i ) + CH_R_DEP ; if ( leftFocus - i < 0 ) { featurelist . add ( lexFeature + START + String . valueOf ( i - leftFocus ) ) ; featurelist . add ( posFeature + START + String . valueOf ( i - leftFocus ) ) ; } else { featurelist . add ( lexFeature + sent . words [ trees . get ( leftFocus - i ) . id ] ) ; featurelist . add ( posFeature + sent . tags [ trees . get ( leftFocus - i ) . id ] ) ; if ( trees . get ( leftFocus - i ) . leftChilds . size ( ) != 0 ) { for ( int j = 0 ; j < trees . get ( leftFocus - i ) . leftChilds . size ( ) ; j ++ ) { int leftChildIndex = trees . get ( leftFocus - i ) . leftChilds . get ( j ) . id ; featurelist . add ( lcLexFeature + sent . words [ leftChildIndex ] ) ; featurelist . add ( lcPosFeature + sent . tags [ leftChildIndex ] ) ; featurelist . add ( lcDepFeature + sent . getDepClass ( leftChildIndex ) ) ; } } else { featurelist . add ( lcLexFeature + NULL ) ; featurelist . add ( lcPosFeature + NULL ) ; } if ( trees . get ( leftFocus - i ) . rightChilds . size ( ) != 0 ) { for ( int j = 0 ; j < trees . get ( leftFocus - i ) . rightChilds . size ( ) ; j ++ ) { int rightChildIndex = trees . get ( leftFocus - i ) . rightChilds . get ( j ) . id ; featurelist . add ( rcLexFeature + sent . words [ rightChildIndex ] ) ; featurelist . add ( rcPosFeature + sent . tags [ rightChildIndex ] ) ; featurelist . add ( rcDepFeature + sent . getDepClass ( rightChildIndex ) ) ; } } else { featurelist . add ( rcLexFeature + NULL ) ; featurelist . add ( rcPosFeature + NULL ) ; } } } for ( int i = 0 ; i <= r ; i ++ ) { String posFeature = "+" + String . valueOf ( i ) + POS ; String lexFeature = "+" + String . valueOf ( i ) + LEX ; String lcLexFeature = "+" + String . valueOf ( i ) + CH_L_LEX ; String rcLexFeature = "+" + String . valueOf ( i ) + CH_R_LEX ; String lcPosFeature = "+" + String . valueOf ( i ) + CH_L_POS ; String rcPosFeature = "+" + String . valueOf ( i ) + CH_R_POS ; String lcDepFeature = "+" + String . valueOf ( i ) + CH_L_DEP ; String rcDepFeature = "+" + String . valueOf ( i ) + CH_R_DEP ; if ( rightFocus + i >= trees . size ( ) ) { featurelist . add ( lexFeature + END + String . valueOf ( rightFocus + i - trees . size ( ) + 3 ) ) ; featurelist . add ( posFeature + END + String . valueOf ( rightFocus + i - trees . size ( ) + 3 ) ) ; } else { featurelist . add ( lexFeature + sent . words [ trees . get ( rightFocus + i ) . id ] ) ; featurelist . add ( posFeature + sent . tags [ trees . get ( rightFocus + i ) . id ] ) ; if ( trees . get ( rightFocus + i ) . leftChilds . size ( ) != 0 ) { for ( int j = 0 ; j < trees . get ( rightFocus + i ) . leftChilds . size ( ) ; j ++ ) { int leftChildIndex = trees . get ( rightFocus + i ) . leftChilds . get ( j ) . id ; featurelist . add ( lcLexFeature + sent . words [ leftChildIndex ] ) ; featurelist . add ( lcPosFeature + sent . tags [ leftChildIndex ] ) ; featurelist . add ( lcDepFeature + sent . getDepClass ( leftChildIndex ) ) ; } } else { featurelist . add ( lcLexFeature + NULL ) ; featurelist . add ( lcPosFeature + NULL ) ; } if ( trees . get ( rightFocus + i ) . rightChilds . size ( ) != 0 ) { for ( int j = 0 ; j < trees . get ( rightFocus + i ) . rightChilds . size ( ) ; j ++ ) { int rightChildIndex = trees . get ( rightFocus + i ) . rightChilds . get ( j ) . id ; featurelist . add ( rcLexFeature + sent . words [ rightChildIndex ] ) ; featurelist . add ( rcPosFeature + sent . tags [ rightChildIndex ] ) ; featurelist . add ( rcDepFeature + sent . getDepClass ( rightChildIndex ) ) ; } } else { featurelist . add ( rcLexFeature + NULL ) ; featurelist . add ( rcPosFeature + NULL ) ; } } } return featurelist ;
public class BeanDefinitionParser { /** * Get the value of a property element . May be a list etc . Also used for * constructor arguments , " propertyName " being null in this case . * @ param ele a { @ link org . w3c . dom . Element } object . * @ param bd a { @ link org . springframework . beans . factory . config . BeanDefinition } object . * @ param propertyName a { @ link java . lang . String } object . * @ return a { @ link java . lang . Object } object . */ public Object parsePropertyValue ( Element ele , BeanDefinition bd , String propertyName ) { } }
String elementName = ( propertyName != null ) ? "<property> element for property '" + propertyName + "'" : "<constructor-arg> element" ; // Should only have one child element : ref , value , list , etc . NodeList nl = ele . getChildNodes ( ) ; Element subElement = null ; for ( int i = 0 ; i < nl . getLength ( ) ; i ++ ) { Node node = nl . item ( i ) ; if ( node instanceof Element && ! nodeNameEquals ( node , DESCRIPTION_ELEMENT ) && ! nodeNameEquals ( node , META_ELEMENT ) ) { // Child element is what we ' re looking for . if ( subElement != null ) error ( elementName + " must not contain more than one sub-element" , ele ) ; else subElement = ( Element ) node ; } } boolean hasRefAttribute = ele . hasAttribute ( REF_ATTRIBUTE ) ; boolean hasValueAttribute = ele . hasAttribute ( VALUE_ATTRIBUTE ) ; if ( ( hasRefAttribute && hasValueAttribute ) || ( ( hasRefAttribute || hasValueAttribute ) && subElement != null ) ) { error ( elementName + " is only allowed to contain either 'ref' attribute OR 'value' attribute OR sub-element" , ele ) ; } if ( hasRefAttribute ) { String refName = ele . getAttribute ( REF_ATTRIBUTE ) ; if ( ! StringUtils . hasText ( refName ) ) error ( elementName + " contains empty 'ref' attribute" , ele ) ; RuntimeBeanReference ref = new RuntimeBeanReference ( refName ) ; ref . setSource ( extractSource ( ele ) ) ; return ref ; } else if ( hasValueAttribute ) { TypedStringValue valueHolder = new TypedStringValue ( ele . getAttribute ( VALUE_ATTRIBUTE ) ) ; valueHolder . setSource ( extractSource ( ele ) ) ; return valueHolder ; } else if ( subElement != null ) { return parsePropertySubElement ( subElement , bd ) ; } else { // Neither child element nor " ref " or " value " attribute found . error ( elementName + " must specify a ref or value" , ele ) ; return null ; }
public class Validators { /** * Creates and returns a validator , which allows to validate texts to ensure , that they are not * empty . * @ param context * The context , which should be used to retrieve the error message , as an instance of * the class { @ link Context } . The context may not be null * @ param resourceId * The resource ID of the string resource , which contains the error message , which * should be set , as an { @ link Integer } value . The resource ID must correspond to a * valid string resource * @ return The validator , which has been created , as an instance of the type { @ link Validator } */ public static Validator < CharSequence > notEmpty ( @ NonNull final Context context , @ StringRes final int resourceId ) { } }
return new NotEmptyValidator ( context , resourceId ) ;
public class BTreeTraverser { /** * for tests only */ static boolean isInDupMode ( @ NotNull final AddressIterator addressIterator ) { } }
// hasNext ( ) updates ' inDupTree ' return addressIterator . hasNext ( ) && ( ( BTreeTraverserDup ) addressIterator . getTraverser ( ) ) . inDupTree ;
public class AWSMigrationHubClient { /** * Lists discovered resources associated with the given < code > MigrationTask < / code > . * @ param listDiscoveredResourcesRequest * @ return Result of the ListDiscoveredResources operation returned by the service . * @ throws AccessDeniedException * You do not have sufficient access to perform this action . * @ throws InternalServerErrorException * Exception raised when there is an internal , configuration , or dependency error encountered . * @ throws ServiceUnavailableException * Exception raised when there is an internal , configuration , or dependency error encountered . * @ throws InvalidInputException * Exception raised when the provided input violates a policy constraint or is entered in the wrong format * or data type . * @ throws ResourceNotFoundException * Exception raised when the request references a resource ( ADS configuration , update stream , migration * task , etc . ) that does not exist in ADS ( Application Discovery Service ) or in Migration Hub ' s repository . * @ sample AWSMigrationHub . ListDiscoveredResources * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / AWSMigrationHub - 2017-05-31 / ListDiscoveredResources " * target = " _ top " > AWS API Documentation < / a > */ @ Override public ListDiscoveredResourcesResult listDiscoveredResources ( ListDiscoveredResourcesRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeListDiscoveredResources ( request ) ;
public class CachedResultSet { /** * Builds a name - to - column index for quick access to data by columm names . * @ return a { @ code Map } that maps column names to column positions starting from 0 */ public Map < String , Integer > buildIndex ( ) { } }
Map < String , Integer > index = new HashMap < String , Integer > ( ) ; for ( int i = 0 ; i < columns . length ; ++ i ) { index . put ( columns [ i ] , i ) ; } return index ;
public class PharmacophoreQueryAtom { /** * Checks whether this query atom matches a target atom . * Currently a query pharmacophore atom will match a target pharmacophore group if the * symbols of the two groups match . This is based on the assumption that * pharmacophore groups with the same symbol will have the same SMARTS * pattern . * @ param atom A target pharmacophore group * @ return true if the current query group has the same symbol as the target group */ @ Override public boolean matches ( IAtom atom ) { } }
PharmacophoreAtom patom = PharmacophoreAtom . get ( atom ) ; return patom . getSymbol ( ) . equals ( getSymbol ( ) ) ;
public class AbstractLockedMessageEnumeration { /** * / * ( non - Javadoc ) * @ see com . ibm . wsspi . sib . core . LockedMessageEnumeration # getConsumerSession ( ) */ public ConsumerSession getConsumerSession ( ) throws SISessionUnavailableException , SISessionDroppedException , SIIncorrectCallException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && CoreSPILockedMessageEnumeration . tc . isEntryEnabled ( ) ) SibTr . entry ( CoreSPILockedMessageEnumeration . tc , "getConsumerSession" , new Integer ( hashCode ( ) ) ) ; checkValidState ( "getConsumerSession" ) ; localConsumerPoint . checkNotClosed ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && CoreSPILockedMessageEnumeration . tc . isEntryEnabled ( ) ) SibTr . exit ( CoreSPILockedMessageEnumeration . tc , "getConsumerSession" , consumerSession ) ; return consumerSession ;
public class CommerceUserSegmentCriterionServiceBaseImpl { /** * Sets the commerce user segment entry local service . * @ param commerceUserSegmentEntryLocalService the commerce user segment entry local service */ public void setCommerceUserSegmentEntryLocalService ( com . liferay . commerce . user . segment . service . CommerceUserSegmentEntryLocalService commerceUserSegmentEntryLocalService ) { } }
this . commerceUserSegmentEntryLocalService = commerceUserSegmentEntryLocalService ;
public class DoubleArrays { /** * TODO : This should live in a matrix class */ public static double sum ( double [ ] [ ] matrix ) { } }
double sum = 0 ; for ( int i = 0 ; i < matrix . length ; i ++ ) { sum += sum ( matrix [ i ] ) ; } return sum ;
public class DeviceAttribute_3DAODefaultImpl { public void insert ( final boolean [ ] argin , final int dim_x , final int dim_y ) { } }
attrval . r_dim . dim_x = dim_x ; attrval . r_dim . dim_y = dim_y ; DevVarBooleanArrayHelper . insert ( attrval . value , argin ) ;
public class ConfigRestClientUtil { /** * 创建或者更新索引文档 , 适应于部分更新 * @ param indexName * @ param indexType * @ param addTemplate * @ param bean * @ param refreshOption * @ return * @ throws ElasticSearchException */ public String addDocument ( String indexName , String indexType , String addTemplate , Object bean , String refreshOption ) throws ElasticSearchException { } }
StringBuilder builder = new StringBuilder ( ) ; ClassUtil . ClassInfo classInfo = ClassUtil . getClassInfo ( bean . getClass ( ) ) ; Object id = BuildTool . getId ( bean , classInfo ) ; Object routing = BuildTool . getRouting ( bean , classInfo ) ; builder . append ( indexName ) . append ( "/" ) . append ( indexType ) ; if ( id != null ) { builder . append ( "/" ) . append ( id ) ; } Object parentId = BuildTool . getParentId ( bean , classInfo ) ; if ( refreshOption != null ) { builder . append ( "?" ) . append ( refreshOption ) ; if ( parentId != null ) { builder . append ( "&parent=" ) . append ( parentId ) ; } if ( routing != null ) { builder . append ( "&routing=" ) . append ( routing ) ; } } else if ( parentId != null ) { builder . append ( "?parent=" ) . append ( parentId ) ; if ( routing != null ) { builder . append ( "&routing=" ) . append ( routing ) ; } } else if ( routing != null ) { builder . append ( "?routing=" ) . append ( routing ) ; } String path = builder . toString ( ) ; builder . setLength ( 0 ) ; path = this . client . executeHttp ( path , ESTemplateHelper . evalDocumentTemplate ( esUtil , builder , indexType , indexName , addTemplate , bean , "create" ) , ClientUtil . HTTP_POST ) ; builder = null ; return path ;
public class CodaBarReader { /** * Records the size of all runs of white and black pixels , starting with white . * This is just like recordPattern , except it records all the counters , and * uses our builtin " counters " member for storage . * @ param row row to count from */ private void setCounters ( BitArray row ) throws NotFoundException { } }
counterLength = 0 ; // Start from the first white bit . int i = row . getNextUnset ( 0 ) ; int end = row . getSize ( ) ; if ( i >= end ) { throw NotFoundException . getNotFoundInstance ( ) ; } boolean isWhite = true ; int count = 0 ; while ( i < end ) { if ( row . get ( i ) != isWhite ) { count ++ ; } else { counterAppend ( count ) ; count = 1 ; isWhite = ! isWhite ; } i ++ ; } counterAppend ( count ) ;
public class DescribeNetworkInterfaceAttributeRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional * parameters to enable operation dry - run . */ @ Override public Request < DescribeNetworkInterfaceAttributeRequest > getDryRunRequest ( ) { } }
Request < DescribeNetworkInterfaceAttributeRequest > request = new DescribeNetworkInterfaceAttributeRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ;
public class OmsPitfiller { /** * Calculate the drainage direction with the D8 method . * < p > Find the direction that has the maximum * slope and set it as the drainage direction the in the cell ( r , c ) * in the dir matrix . * @ param pitValue the value of pit in row / col . * @ param row row of the cell in the matrix . * @ param col col of the cell in the matrix . * @ param dir the drainage direction matrix to set the dircetion in . The cell contains an int value in the range 0 to 8 * ( or 10 if it is an outlet point ) . * @ param fact is the direction factor ( 1 / lenght ) . */ private void setDirection ( double pitValue , int row , int col , int [ ] [ ] dir , double [ ] fact ) { } }
dir [ col ] [ row ] = 0 ; /* This necessary to repeat passes after level raised */ double smax = 0.0 ; // examine adjacent cells first for ( int k = 1 ; k <= 8 ; k ++ ) { int cn = col + DIR_WITHFLOW_EXITING_INVERTED [ k ] [ 0 ] ; int rn = row + DIR_WITHFLOW_EXITING_INVERTED [ k ] [ 1 ] ; double pitN = pitIter . getSampleDouble ( cn , rn , 0 ) ; if ( isNovalue ( pitN ) ) { dir [ col ] [ row ] = - 1 ; break ; } if ( dir [ col ] [ row ] != - 1 ) { double slope = fact [ k ] * ( pitValue - pitN ) ; if ( slope > smax ) { smax = slope ; // maximum slope gives the drainage direction dir [ col ] [ row ] = k ; } } }
public class MetadataBlockHeader { /** * Create a meta - data block header of the given type , and return the result * in a new EncodedElement ( so data is ready to be placed directly in FLAC * stream ) * @ param lastBlock True if this is the last meta - block in the stream . False * otherwise . * @ param type enum indicating which type of block we ' re creating . * @ param length Length of the meta - data block which follows this header . * @ return EncodedElement containing the header . */ public static EncodedElement getMetadataBlockHeader ( boolean lastBlock , MetadataBlockType type , int length ) { } }
EncodedElement ele = new EncodedElement ( 4 , 0 ) ; int encodedLastBlock = ( lastBlock ) ? 1 : 0 ; ele . addInt ( encodedLastBlock , 1 ) ; int encodedType = 0 ; MetadataBlockType [ ] vals = MetadataBlockType . values ( ) ; for ( int i = 0 ; i < vals . length ; i ++ ) { if ( vals [ i ] == type ) { encodedType = i ; break ; } } ele . addInt ( encodedType , 7 ) ; ele . addInt ( length , 24 ) ; return ele ;
public class ModelFactory { /** * Register Blueprint from instance . * @ param blueprint Blueprint * @ throws RegisterBlueprintException failed to register blueprint */ public void registerBlueprint ( Object blueprint ) throws RegisterBlueprintException { } }
Blueprint blueprintAnnotation = blueprint . getClass ( ) . getAnnotation ( Blueprint . class ) ; if ( blueprintAnnotation == null ) { throw new RegisterBlueprintException ( "Blueprint class not annotated by @Blueprint: " + blueprint ) ; } Class target = blueprintAnnotation . value ( ) ; List < ModelField > modelFields = new ArrayList < ModelField > ( ) ; logger . debug ( "Registering {} blueprint for {}" , blueprint . getClass ( ) , target ) ; Constructable newInstance = null ; List < Callback > afterCreateCallbacks = new ArrayList < Callback > ( ) ; // Get all fields for the blueprint target class Collection < Field > fields = getAllFields ( blueprint . getClass ( ) ) . values ( ) ; for ( Field field : fields ) { field . setAccessible ( true ) ; // Register ConstructorCallback field if ( field . getType ( ) . equals ( ConstructorCallback . class ) || field . getType ( ) . equals ( com . tobedevoured . modelcitizen . callback . ConstructorCallback . class ) ) { Object fieldVal = null ; try { fieldVal = field . get ( blueprint ) ; } catch ( IllegalArgumentException e ) { throw new RegisterBlueprintException ( e ) ; } catch ( IllegalAccessException e ) { throw new RegisterBlueprintException ( e ) ; } if ( fieldVal instanceof Constructable ) { logger . debug ( "Registering ConstructorCallback for {}" , blueprint . getClass ( ) ) ; newInstance = ( Constructable ) fieldVal ; } else { throw new RegisterBlueprintException ( "Blueprint " + blueprint . getClass ( ) . getSimpleName ( ) + " Field class for " + field . getName ( ) + " is invalid ConstructorCallback" ) ; } // ConstructorCallback is only used to create new instance . continue ; } // Register AfterCreateCallback field if ( field . getType ( ) . equals ( AfterCreateCallback . class ) ) { Object fieldVal = null ; try { fieldVal = field . get ( blueprint ) ; } catch ( IllegalArgumentException e ) { throw new RegisterBlueprintException ( e ) ; } catch ( IllegalAccessException e ) { throw new RegisterBlueprintException ( e ) ; } if ( fieldVal instanceof AfterCreateCallback ) { logger . debug ( "Registering AfterCreateCallback for {}" , blueprint . getClass ( ) ) ; afterCreateCallbacks . add ( ( AfterCreateCallback ) fieldVal ) ; } else { throw new RegisterBlueprintException ( "Blueprint " + blueprint . getClass ( ) . getSimpleName ( ) + " Field class for " + field . getName ( ) + " is invalid AfterCreateCallback" ) ; } // AfterCreateCallback is only used in callbacks continue ; } // Process @ Default Default defaultAnnotation = field . getAnnotation ( Default . class ) ; if ( defaultAnnotation != null ) { DefaultField defaultField = new DefaultField ( ) ; defaultField . setName ( field . getName ( ) ) ; defaultField . setForce ( defaultAnnotation . force ( ) ) ; try { defaultField . setValue ( field . get ( blueprint ) ) ; } catch ( IllegalArgumentException e ) { throw new RegisterBlueprintException ( e ) ; } catch ( IllegalAccessException e ) { throw new RegisterBlueprintException ( e ) ; } defaultField . setTarget ( field . getType ( ) ) ; defaultField . setFieldClass ( field . getType ( ) ) ; modelFields . add ( defaultField ) ; logger . trace ( " Setting default for {} to {} and forced {}" , new Object [ ] { defaultField . getName ( ) , defaultField . getValue ( ) , defaultField . isForce ( ) } ) ; } // Process @ Mapped Mapped mapped = field . getAnnotation ( Mapped . class ) ; if ( mapped != null ) { MappedField mappedField = new MappedField ( ) ; mappedField . setName ( field . getName ( ) ) ; if ( field . getAnnotation ( Nullable . class ) != null ) { mappedField . setNullable ( true ) ; } // If @ Mapped ( target ) not set , use Field ' s class if ( NotSet . class . equals ( mapped . target ( ) ) ) { mappedField . setTarget ( field . getType ( ) ) ; // Use @ Mapped ( target ) for MappedField # target } else { mappedField . setTarget ( mapped . target ( ) ) ; } mappedField . setFieldClass ( field . getType ( ) ) ; modelFields . add ( mappedField ) ; logger . trace ( " Setting mapped for {} to {}" , mappedField . getName ( ) , mappedField . getTarget ( ) ) ; } // Process @ MappedList MappedList mappedCollection = field . getAnnotation ( MappedList . class ) ; if ( mappedCollection != null ) { MappedListField listField = new MappedListField ( ) ; listField . setName ( field . getName ( ) ) ; listField . setFieldClass ( field . getType ( ) ) ; listField . setSize ( mappedCollection . size ( ) ) ; listField . setIgnoreEmpty ( mappedCollection . ignoreEmpty ( ) ) ; listField . setForce ( mappedCollection . force ( ) ) ; // If @ MappedList ( target ) not set , use Field ' s class if ( NotSet . class . equals ( mappedCollection . target ( ) ) ) { listField . setTarget ( field . getType ( ) ) ; // Use @ MappedList ( target ) for MappedListField # target } else { listField . setTarget ( mappedCollection . target ( ) ) ; } // If @ MappedList ( targetList ) not set , use ArrayList if ( NotSet . class . equals ( mappedCollection . targetList ( ) ) ) { listField . setTargetList ( ArrayList . class ) ; } else { // Ensure that the targetList implements List boolean implementsList = false ; for ( Class interf : mappedCollection . targetList ( ) . getInterfaces ( ) ) { if ( List . class . equals ( interf ) ) { implementsList = true ; break ; } } if ( ! implementsList ) { throw new RegisterBlueprintException ( "@MappedList targetList must implement List for field " + field . getName ( ) ) ; } listField . setTargetList ( mappedCollection . targetList ( ) ) ; } modelFields . add ( listField ) ; logger . trace ( " Setting mapped list for {} to {} as <{}> and forced {}" , new Object [ ] { listField . getName ( ) , listField . getFieldClass ( ) , listField . getTarget ( ) , listField . isForce ( ) } ) ; } // Process @ MappedSet MappedSet mappedSet = field . getAnnotation ( MappedSet . class ) ; if ( mappedSet != null ) { MappedSetField setField = new MappedSetField ( ) ; setField . setName ( field . getName ( ) ) ; setField . setFieldClass ( field . getType ( ) ) ; setField . setSize ( mappedSet . size ( ) ) ; setField . setIgnoreEmpty ( mappedSet . ignoreEmpty ( ) ) ; setField . setForce ( mappedSet . force ( ) ) ; // XXX : @ MappedSet ( target ) is required // If @ MappedSet ( target ) not set if ( NotSet . class . equals ( mappedSet . target ( ) ) ) { // XXX : incorrect , should use generic defined by Set , luckily annotation forces target to be set setField . setTarget ( field . getType ( ) ) ; // Use @ MappedSet ( target ) for MappedSet # target } else { setField . setTarget ( mappedSet . target ( ) ) ; } // If @ MappedSet ( targetSet ) not set , use HashSet if ( NotSet . class . equals ( mappedSet . targetSet ( ) ) ) { setField . setTargetSet ( HashSet . class ) ; } else { // Ensure that the targetSet implements Set boolean implementsSet = false ; for ( Class interf : mappedSet . targetSet ( ) . getInterfaces ( ) ) { if ( Set . class . equals ( interf ) ) { implementsSet = true ; break ; } } if ( ! implementsSet ) { throw new RegisterBlueprintException ( "@MappedSet targetSet must implement Set for field " + field . getName ( ) ) ; } setField . setTargetSet ( mappedSet . targetSet ( ) ) ; } modelFields . add ( setField ) ; logger . trace ( " Setting mapped set for {} to {} as <{}> and is forced {}" , new Object [ ] { setField . getName ( ) , setField . getFieldClass ( ) , setField . getTarget ( ) , setField . isForce ( ) } ) ; } } blueprints . add ( blueprint ) ; Class templateClass = blueprintAnnotation . template ( ) ; BlueprintTemplate template = null ; try { template = ( BlueprintTemplate ) ConstructorUtils . invokeConstructor ( templateClass , null ) ; } catch ( NoSuchMethodException e ) { throw new RegisterBlueprintException ( e ) ; } catch ( IllegalAccessException e ) { throw new RegisterBlueprintException ( e ) ; } catch ( InvocationTargetException e ) { throw new RegisterBlueprintException ( e ) ; } catch ( InstantiationException e ) { throw new RegisterBlueprintException ( e ) ; } // Create Erector for this Blueprint Erector erector = new Erector ( ) ; erector . setTemplate ( template ) ; erector . setBlueprint ( blueprint ) ; erector . setModelFields ( modelFields ) ; erector . setTarget ( target ) ; erector . setNewInstance ( newInstance ) ; erector . setCallbacks ( "afterCreate" , afterCreateCallbacks ) ; erectors . put ( target , erector ) ;
public class TimeSection { /** * Defines the color that will be used to colorize the section * in a clock . * @ param COLOR */ public void setColor ( final Color COLOR ) { } }
if ( null == color ) { _color = COLOR ; } else { color . set ( COLOR ) ; }
public class CPDefinitionLinkPersistenceImpl { /** * Returns an ordered range of all the cp definition links where CPDefinitionId = & # 63 ; and type = & # 63 ; . * Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CPDefinitionLinkModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order . * @ param CPDefinitionId the cp definition ID * @ param type the type * @ param start the lower bound of the range of cp definition links * @ param end the upper bound of the range of cp definition links ( not inclusive ) * @ param orderByComparator the comparator to order the results by ( optionally < code > null < / code > ) * @ param retrieveFromCache whether to retrieve from the finder cache * @ return the ordered range of matching cp definition links */ @ Override public List < CPDefinitionLink > findByCPD_T ( long CPDefinitionId , String type , int start , int end , OrderByComparator < CPDefinitionLink > orderByComparator , boolean retrieveFromCache ) { } }
boolean pagination = true ; FinderPath finderPath = null ; Object [ ] finderArgs = null ; if ( ( start == QueryUtil . ALL_POS ) && ( end == QueryUtil . ALL_POS ) && ( orderByComparator == null ) ) { pagination = false ; finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CPD_T ; finderArgs = new Object [ ] { CPDefinitionId , type } ; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_CPD_T ; finderArgs = new Object [ ] { CPDefinitionId , type , start , end , orderByComparator } ; } List < CPDefinitionLink > list = null ; if ( retrieveFromCache ) { list = ( List < CPDefinitionLink > ) finderCache . getResult ( finderPath , finderArgs , this ) ; if ( ( list != null ) && ! list . isEmpty ( ) ) { for ( CPDefinitionLink cpDefinitionLink : list ) { if ( ( CPDefinitionId != cpDefinitionLink . getCPDefinitionId ( ) ) || ! Objects . equals ( type , cpDefinitionLink . getType ( ) ) ) { list = null ; break ; } } } } if ( list == null ) { StringBundler query = null ; if ( orderByComparator != null ) { query = new StringBundler ( 4 + ( orderByComparator . getOrderByFields ( ) . length * 2 ) ) ; } else { query = new StringBundler ( 4 ) ; } query . append ( _SQL_SELECT_CPDEFINITIONLINK_WHERE ) ; query . append ( _FINDER_COLUMN_CPD_T_CPDEFINITIONID_2 ) ; boolean bindType = false ; if ( type == null ) { query . append ( _FINDER_COLUMN_CPD_T_TYPE_1 ) ; } else if ( type . equals ( "" ) ) { query . append ( _FINDER_COLUMN_CPD_T_TYPE_3 ) ; } else { bindType = true ; query . append ( _FINDER_COLUMN_CPD_T_TYPE_2 ) ; } if ( orderByComparator != null ) { appendOrderByComparator ( query , _ORDER_BY_ENTITY_ALIAS , orderByComparator ) ; } else if ( pagination ) { query . append ( CPDefinitionLinkModelImpl . ORDER_BY_JPQL ) ; } String sql = query . toString ( ) ; Session session = null ; try { session = openSession ( ) ; Query q = session . createQuery ( sql ) ; QueryPos qPos = QueryPos . getInstance ( q ) ; qPos . add ( CPDefinitionId ) ; if ( bindType ) { qPos . add ( type ) ; } if ( ! pagination ) { list = ( List < CPDefinitionLink > ) QueryUtil . list ( q , getDialect ( ) , start , end , false ) ; Collections . sort ( list ) ; list = Collections . unmodifiableList ( list ) ; } else { list = ( List < CPDefinitionLink > ) QueryUtil . list ( q , getDialect ( ) , start , end ) ; } cacheResult ( list ) ; finderCache . putResult ( finderPath , finderArgs , list ) ; } catch ( Exception e ) { finderCache . removeResult ( finderPath , finderArgs ) ; throw processException ( e ) ; } finally { closeSession ( session ) ; } } return list ;
public class GradientEditor { /** * Sort the control points based on their position */ private void sortPoints ( ) { } }
final ControlPoint firstPt = ( ControlPoint ) list . get ( 0 ) ; final ControlPoint lastPt = ( ControlPoint ) list . get ( list . size ( ) - 1 ) ; Comparator compare = new Comparator ( ) { public int compare ( Object first , Object second ) { if ( first == firstPt ) { return - 1 ; } if ( second == lastPt ) { return - 1 ; } float a = ( ( ControlPoint ) first ) . pos ; float b = ( ( ControlPoint ) second ) . pos ; return ( int ) ( ( a - b ) * 10000 ) ; } } ; Collections . sort ( list , compare ) ;
public class JDBCSQLXML { /** * Returns a Source for reading the XML value designated by this SQLXML instance . * Sources are used as inputs to XML parsers and XSLT transformers . * Sources for XML parsers will have namespace processing on by default . * The systemID of the Source is implementation dependent . * The SQL XML object becomes not readable when this method is called and * may also become not writable depending on implementation . * Note that SAX is a callback architecture , so a returned * SAXSource should then be set with a content handler that will * receive the SAX events from parsing . The content handler * will receive callbacks based on the contents of the XML . * < pre > * SAXSource saxSource = sqlxml . getSource ( SAXSource . class ) ; * XMLReader xmlReader = saxSource . getXMLReader ( ) ; * xmlReader . setContentHandler ( myHandler ) ; * xmlReader . parse ( saxSource . getInputSource ( ) ) ; * < / pre > * @ param sourceClass The class of the source , or null . * If the class is null , a vendor specifc Source implementation will be returned . * The following classes are supported at a minimum : * < pre > * javax . xml . transform . dom . DOMSource - returns a DOMSource * javax . xml . transform . sax . SAXSource - returns a SAXSource * javax . xml . transform . stax . StAXSource - returns a StAXSource * javax . xml . transform . stream . StreamSource - returns a StreamSource * < / pre > * @ return a Source for reading the XML value . * @ throws SQLException if there is an error processing the XML value * or if this feature is not supported . * The getCause ( ) method of the exception may provide a more detailed exception , for example , * if an XML parser exception occurs . * An exception is thrown if the state is not readable . * @ exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method * @ since JDK 1.6 Build 79 */ @ SuppressWarnings ( "unchecked" ) public synchronized < T extends Source > T getSource ( Class < T > sourceClass ) throws SQLException { } }
checkClosed ( ) ; checkReadable ( ) ; final Source source = getSourceImpl ( sourceClass ) ; setReadable ( false ) ; setWritable ( false ) ; return ( T ) source ;
public class AuthTokenRegistry { /** * Get all tokens of the specified auth subject . All tokens are returned , no * matter whether they are expired or not . * @ param aSubject * The subject to query . May not be < code > null < / code > . * @ return The list and never < code > null < / code > . */ @ Nonnull public static ICommonsList < IAuthToken > getAllTokensOfSubject ( @ Nonnull final IAuthSubject aSubject ) { } }
ValueEnforcer . notNull ( aSubject , "Subject" ) ; return s_aRWLock . readLocked ( ( ) -> CommonsArrayList . createFiltered ( s_aMap . values ( ) , aToken -> aToken . getIdentification ( ) . hasAuthSubject ( aSubject ) ) ) ;