signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class FieldCode { /** * To code . * @ return the string */ public String toCode ( ) { } }
String ret = "" ; if ( StringUtils . isEmpty ( scope ) ) { ret = "private " ; } else { ret = scope + ClassCode . BLANK_STRING ; } ret += type + ClassCode . BLANK_STRING + name ; if ( ! StringUtils . isEmpty ( defaultValue ) ) { ret += "=" + defaultValue ; } return ret ;
public class CmsADECache { /** * Removes the container page identified by its structure id from the cache . < p > * @ param structureId the container page ' s structure id * @ param online if online or offline */ public void uncacheContainerPage ( CmsUUID structureId , boolean online ) { } }
try { m_lock . writeLock ( ) . lock ( ) ; if ( online ) { m_containerPagesOnline . remove ( getCacheKey ( structureId , true ) ) ; m_containerPagesOnline . remove ( getCacheKey ( structureId , false ) ) ; } else { m_containerPagesOffline . remove ( getCacheKey ( structureId , true ) ) ; m_containerPagesOffline . remove...
public class diff_match_patch { /** * Add some padding on text start and end so that edges can match something . * Intended to be called only from within patch _ apply . * @ param patches * Array of Patch objects . * @ return The padding string added to each side . */ public String patch_addPadding ( LinkedList...
short paddingLength = Patch_Margin ; String nullPadding = "" ; for ( short x = 1 ; x <= paddingLength ; x ++ ) { nullPadding += String . valueOf ( ( char ) x ) ; } // Bump all the patches forward . for ( Patch aPatch : patches ) { aPatch . start1 += paddingLength ; aPatch . start2 += paddingLength ; } // Add some paddi...
public class NettyClientHandler { /** * Gets the client stream associated to the given HTTP / 2 stream object . */ private NettyClientStream . TransportState clientStream ( Http2Stream stream ) { } }
return stream == null ? null : ( NettyClientStream . TransportState ) stream . getProperty ( streamKey ) ;
public class ParameterReplacer { /** * - - - - - JDBC 3.0 - - - - - */ public void setURL ( int parameterIndex , java . net . URL x ) { } }
record ( parameterIndex , getDeclaredMethod ( PreparedStatement . class , "setURL" , int . class , URL . class ) , parameterIndex , x ) ;
public class TypedScopeCreator { /** * Returns the { @ link Module } corresponding to this scope root , or null if not a module root . */ @ Nullable private Module getModuleFromScopeRoot ( Node moduleBody ) { } }
if ( moduleBody . isModuleBody ( ) ) { // TODO ( b / 128633181 ) : handle ES modules here Node scriptNode = moduleBody . getParent ( ) ; checkState ( scriptNode . getBooleanProp ( Node . GOOG_MODULE ) , "Typechecking of non-goog-modules not supported" ) ; Node googModuleCall = moduleBody . getFirstChild ( ) ; String na...
public class BasicPathFinder { /** * Runs a recursive depth - first search from a { @ link KamNode } in search of * the < tt > target < / tt > node . When a { @ link SimplePath } is found to the * < tt > target < / tt > the { @ link Stack } of { @ link KamEdge } is collected and * the algorithm continues . < br /...
depth += 1 ; if ( depth > maxSearchDepth ) { return ; } // get adjacent edges final Set < KamEdge > edges = kam . getAdjacentEdges ( cnode , BOTH ) ; for ( final KamEdge edge : edges ) { if ( pushEdge ( edge , nodeStack , edgeStack ) ) { final KamNode edgeOppositeNode = nodeStack . peek ( ) ; // we have found a path fr...
public class LexicaHelper { /** * TODO should not be static */ private static String getTokenDescPath ( AnalysisEngineDescription tokenDesc ) throws IOException , ResourceInitializationException , SAXException { } }
if ( tokenDescrPath != null ) return tokenDescrPath . getAbsolutePath ( ) ; tokenDescrPath = File . createTempFile ( "tmp" , "TokenizerAnnotator.xml" ) ; tokenDesc . toXML ( new FileWriter ( tokenDescrPath ) ) ; return tokenDescrPath . getAbsolutePath ( ) ;
public class StringTokenizer { /** * Returns the next token in this string tokenizer ' s string . First , * the set of characters considered to be delimiters by this * < tt > StringTokenizer < / tt > object is changed to be the characters in * the string < tt > delim < / tt > . Then the next token in the string ...
m_delimiters_ = EMPTY_DELIMITER_ ; if ( delim != null && delim . length ( ) > 0 ) { m_delimiters_ = new UnicodeSet ( ) ; m_delimiters_ . addAll ( delim ) ; } return nextToken ( m_delimiters_ ) ;
public class ThriftClient { /** * Populate data . * @ param m * the m * @ param keySlices * the key slices * @ param entities * the entities * @ param isRelational * the is relational * @ param relationNames * the relation names * @ return the list */ private List populateData ( EntityMetadata m ,...
try { if ( m . getType ( ) . isSuperColumnFamilyMetadata ( ) ) { List < Object > rowKeys = ThriftDataResultHelper . getRowKeys ( keySlices , m ) ; Object [ ] rowIds = rowKeys . toArray ( ) ; entities . addAll ( findAll ( m . getEntityClazz ( ) , null , rowIds ) ) ; } else { for ( KeySlice keySlice : keySlices ) { byte ...
public class ControlBeanContextSupport { /** * Analagous to < code > java . lang . ClassLoader . getResourceAsStream ( ) < / code > , * this method allows a < code > BeanContext < / code > implementation * to interpose behavior between the child < code > Component < / code > * and underlying < code > ClassLoader ...
// bcc must be a child of this context if ( ! contains ( bcc ) ) { throw new IllegalArgumentException ( "Child is not a member of this context" ) ; } ClassLoader cl = bcc . getClass ( ) . getClassLoader ( ) ; InputStream is ; if ( cl != null && ( is = cl . getResourceAsStream ( name ) ) != null ) { return is ; } return...
public class GraphHandler { /** * Writes the given byte array into a file . * This function logs an error but doesn ' t throw if it fails . * @ param query The query being handled ( for logging purposes ) . * @ param path The path to write to . * @ param contents The contents to write into the file . */ private...
try { final FileOutputStream out = new FileOutputStream ( path ) ; try { out . write ( contents ) ; } finally { out . close ( ) ; } } catch ( FileNotFoundException e ) { logError ( query , "Failed to create file " + path , e ) ; } catch ( IOException e ) { logError ( query , "Failed to write file " + path , e ) ; }
public class AbstractMarkerLanguageParser { /** * Extract the validation components that are specific to the marker language . * @ param inputFile the input file . * @ param rootFolder the root folder in which the input file is located . * @ param context the generation context . * @ return the validation compo...
return getSpecificValidationComponents ( transform ( inputFile , false ) , inputFile , rootFolder , context ) ;
public class ReverseMap { /** * Creates a reverse map name corresponding to an address contained in * an array of 4 integers between 0 and 255 ( for an IPv4 address ) or 16 * integers between 0 and 255 ( for an IPv6 address ) . * @ param addr The address from which to build a name . * @ return The name correspo...
byte [ ] bytes = new byte [ addr . length ] ; for ( int i = 0 ; i < addr . length ; i ++ ) { if ( addr [ i ] < 0 || addr [ i ] > 0xFF ) throw new IllegalArgumentException ( "array must " + "contain values " + "between 0 and 255" ) ; bytes [ i ] = ( byte ) addr [ i ] ; } return fromAddress ( bytes ) ;
public class ObjectInputStream { /** * Reads the content of the receiver based on the previously read token * { @ code tc } . * @ param tc * The token code for the next item in the stream * @ return the object read from the stream * @ throws IOException * If an IO exception happened when reading the class ...
switch ( tc ) { case TC_BLOCKDATA : return readBlockData ( ) ; case TC_BLOCKDATALONG : return readBlockDataLong ( ) ; case TC_CLASS : return readNewClass ( false ) ; case TC_CLASSDESC : return readNewClassDesc ( false ) ; case TC_ARRAY : return readNewArray ( false ) ; case TC_OBJECT : return readNewObject ( false ) ; ...
public class SVGAndroidRenderer { /** * Any unspecified fields in this pattern can be ' borrowed ' from another * pattern specified by the href attribute . */ private void fillInChainedPatternFields ( Pattern pattern , String href ) { } }
// Locate the referenced object SVG . SvgObject ref = pattern . document . resolveIRI ( href ) ; if ( ref == null ) { // Non - existent warn ( "Pattern reference '%s' not found" , href ) ; return ; } if ( ! ( ref instanceof Pattern ) ) { error ( "Pattern href attributes must point to other pattern elements" ) ; return ...
public class Log4jUtil { /** * 根据配置文件路径初始化日志配置 * @ param logConfigpath */ public static void reInitLogConfig ( String logConfigpath ) { } }
try { LoggerContext context = ( LoggerContext ) LogManager . getContext ( false ) ; context . setConfigLocation ( new File ( logConfigpath ) . toURI ( ) ) ; context . reconfigure ( ) ; // 重新初始化Log4j2的配置上下文 Logger log = LoggerFactory . getLogger ( Log4jUtil . class ) ; log . info ( "日志配置重新初始化完成:" + logConfigpath ) ; } c...
public class QrCodeUtil { /** * 生成二维码到文件 , 二维码图片格式取决于文件的扩展名 * @ param content 文本内容 * @ param width 宽度 * @ param height 高度 * @ param targetFile 目标文件 , 扩展名决定输出格式 * @ return 目标文件 */ public static File generate ( String content , int width , int height , File targetFile ) { } }
final BufferedImage image = generate ( content , width , height ) ; ImgUtil . write ( image , targetFile ) ; return targetFile ;
public class OpenAPIUIBundlesUpdater { /** * Return as a string the contents of a file in the bundle . */ private static String getResource ( Bundle myBundle , String resourcePath ) { } }
if ( myBundle == null ) return null ; String bundleShortDescription = getBundleDescription ( myBundle ) ; StringBuilder responseString = new StringBuilder ( ) ; URL bundleResource = myBundle . getResource ( resourcePath ) ; if ( bundleResource != null ) { BufferedReader br = null ; try { // read the requested resource ...
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link SingleOperationRefType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link SingleOperationRefType } ...
return new JAXBElement < SingleOperationRefType > ( _SingleOperationRef_QNAME , SingleOperationRefType . class , null , value ) ;
public class AuditTaskProcessorFactory { /** * ( non - Javadoc ) * @ see * org . duracloud . mill . workman . TaskProcessorFactory # create ( org . duracloud . * common . queue . task . Task ) */ @ Override public final TaskProcessor create ( Task task ) throws TaskProcessorCreationFailedException { } }
if ( isSupported ( task ) ) { log . debug ( "creating task processor for " + task ) ; AuditTask auditTask = new AuditTask ( ) ; auditTask . readTask ( task ) ; return createImpl ( auditTask ) ; } throw new TaskProcessorCreationFailedException ( "Task is not an Audit task" ) ;
public class druidGParser { /** * druidG . g : 121:1 : insertRTStmnt returns [ RTInsertMeta iMeta ] : ( INSERT _ REALTIME WS INTO WS ( id = ID ) ( WS ) ? LPARAN ( WS ) ? selectItems [ iMeta ] ( ( WS ) ? ' , ' ( WS ) ? selectItems [ iMeta ] ) * ( WS ) ? RPARAN ( WS ) ? ) VALUES ( WS ) ? LPARAN ( WS ) ? ( a = anyValue ) ...
RTInsertMeta iMeta = null ; Token id = null ; Token gran = null ; Object a = null ; List < Interval > i = null ; iMeta = new RTInsertMeta ( ) ; try { // druidG . g : 123:2 : ( ( INSERT _ REALTIME WS INTO WS ( id = ID ) ( WS ) ? LPARAN ( WS ) ? selectItems [ iMeta ] ( ( WS ) ? ' , ' ( WS ) ? selectItems [ iMeta ] ) * ( ...
public class ListOfInterpreter { /** * { @ inheritDoc } */ public void execute ( Example example ) { } }
try { List < Fixture > fixtures = getFixtureList ( ) ; Example headers = example . at ( 0 , 0 ) ; Iterator < Fixture > it = fixtures . iterator ( ) ; Example row ; for ( row = example . nextSibling ( ) ; row != null && it . hasNext ( ) && canContinue ( stats ) ; row = row . nextSibling ( ) ) { processRow ( row . firstC...
public class CollectionLiteralsTypeComputer { /** * If the expected type is a subtype of { @ link Map } , the resolved super type is returned . * This allows to query for the type arguments that are available on the expectation . */ protected LightweightTypeReference getMapExpectation ( LightweightTypeReference expec...
if ( expectation != null && expectation . isResolved ( ) ) { LightweightTypeReference result = expectation . getSuperType ( Map . class ) ; if ( result != null && result . getTypeArguments ( ) . size ( ) == 2 ) { return result ; } } return null ;
public class Frame { /** * Returns an { @ link Indexer } for the < i > i < / i > th image plane . */ public < I extends Indexer > I createIndexer ( boolean direct , int i ) { } }
long [ ] sizes = { imageHeight , imageWidth , imageChannels } ; long [ ] strides = { imageStride , imageChannels , 1 } ; Buffer buffer = image [ i ] ; Object array = buffer . hasArray ( ) ? buffer . array ( ) : null ; switch ( imageDepth ) { case DEPTH_UBYTE : return array != null ? ( I ) UByteIndexer . create ( ( byte...
public class Neighbours { /** * Removes a Neighbouring ME . * When deleting an ME , all proxy subscriptions that were registered need * to be removed . * @ param meUUID The uuid of the Neighbouring ME . * @ param busId The bus that this ME belongs to . * @ param transaction The transaction in which to remove ...
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "removeNeighbour" , new Object [ ] { busId , transaction } ) ; boolean recoveredNeighbour = false ; Neighbour neighbour = null ; synchronized ( _neighbours ) { neighbour = ( Neighbour ) _neighbours . get ( meUUID ) ; } if ( ...
public class AsyncHttpClientRestClient { /** * Delegate to { @ link AsyncHttpClientRestClient # doGet ( String ) } and also use { @ link Gson } to parse the returned json * into the requested object * @ param url url to call * @ param returnType taskType to parse the returned json into * @ param < T > the retur...
RestClientResponse response = doGet ( url ) ; String responseBody = response . getResponseBody ( ) ; return ( T ) gson . fromJson ( responseBody , returnType ) ;
public class PossibleIncompleteSerialization { /** * implements the visitor to look for classes that are serializable , and are derived from non serializable classes and don ' t either implement methods in * Externalizable or Serializable to save parent class fields . * @ param classContext * the context object o...
try { JavaClass cls = classContext . getJavaClass ( ) ; if ( isSerializable ( cls ) ) { JavaClass superCls = cls . getSuperClass ( ) ; if ( ! isSerializable ( superCls ) && hasSerializableFields ( superCls ) && ! hasSerializingMethods ( cls ) ) { bugReporter . reportBug ( new BugInstance ( this , BugType . PIS_POSSIBLE...
public class HadoopInputSplit { private void writeObject ( ObjectOutputStream out ) throws IOException { } }
// serialize the parent fields and the final fields out . defaultWriteObject ( ) ; // write the input split ( ( Writable ) mapreduceInputSplit ) . write ( out ) ;
public class Logging { /** * Split type : : name into type and name - returns type */ private String get_target_type ( String ttype_tname ) { } }
String [ ] split ; try { split = ttype_tname . split ( LOGGING_SEPARATOR ) ; } catch ( Exception e ) { return "unknown" ; } return split [ 0 ] ;
public class SubReportBuilder { /** * defines the KEY in the parent report parameters map where to get the subreport parameters map . * @ param path where to get the parameter map for the subrerpot . * @ return */ public SubReportBuilder setParameterMapPath ( String path ) { } }
subreport . setParametersExpression ( path ) ; subreport . setParametersMapOrigin ( DJConstants . SUBREPORT_PARAMETER_MAP_ORIGIN_PARAMETER ) ; return this ;
public class WebSocketNodeService { /** * 强制关闭用户的WebSocket * @ param userid Serializable * @ param targetAddress InetSocketAddress * @ return 无返回值 */ @ Override public CompletableFuture < Integer > forceCloseWebSocket ( Serializable userid , @ RpcTargetAddress InetSocketAddress targetAddress ) { } }
// 不能从sncpNodeAddresses中移除 , 因为engine . forceCloseWebSocket 会调用到disconnect if ( logger . isLoggable ( Level . FINEST ) ) logger . finest ( WebSocketNodeService . class . getSimpleName ( ) + ".event: " + userid + " forceCloseWebSocket from " + targetAddress ) ; if ( localEngine == null ) return CompletableFuture . compl...
public class TaskNodeStatusImpl { /** * This needs to happen in line rather than in a stage because we need to note . * the messages we send to the tasks before we start processing msgs from the * nodes . ( Acks and Topology msgs ) */ @ Override public void expectAckFor ( final Type msgType , final String srcId ) {...
LOG . entering ( "TaskNodeStatusImpl" , "expectAckFor" , new Object [ ] { getQualifiedName ( ) , msgType , srcId } ) ; LOG . finest ( getQualifiedName ( ) + "Adding " + srcId + " to sources" ) ; statusMap . add ( msgType , srcId ) ; LOG . exiting ( "TaskNodeStatusImpl" , "expectAckFor" , getQualifiedName ( ) + "Sources...
public class HtmlReporter { /** * Construct HTML code snippet for stack trace information . * @ param cause the causing error . * @ return */ private String getStackTraceHtml ( Throwable cause ) { } }
StringBuilder stackTraceBuilder = new StringBuilder ( ) ; stackTraceBuilder . append ( cause . getClass ( ) . getName ( ) ) . append ( ": " ) . append ( cause . getMessage ( ) ) . append ( "\n " ) ; for ( int i = 0 ; i < cause . getStackTrace ( ) . length ; i ++ ) { stackTraceBuilder . append ( "\n\t at " ) ; stackTrac...
public class Package { /** * Add a { @ link Tag } to this { @ link Package } */ public void addTag ( Tag tag ) { } }
set ( PackageMetadata . TAGS , concat ( getTags ( ) , singletonList ( tag ) ) ) ;
public class AdaptiveTableLayout { /** * Remove item view holders from base collection * @ param toRemove Collection with view holders which need to remove */ private void removeViewHolders ( @ Nullable Collection < ViewHolder > toRemove ) { } }
if ( toRemove != null ) { for ( ViewHolder holder : toRemove ) { mViewHolders . remove ( holder . getRowIndex ( ) , holder . getColumnIndex ( ) ) ; } }
public class KeyboardManager { /** * Notifies all registered key observers of the supplied key event . This method provides a * thread - safe manner in which to notify the observers , which is necessary since the * { @ link KeyInfo } objects do various antics from the interval manager thread whilst we may do * ot...
_keyOp . init ( id , keyCode , timestamp ) ; _observers . apply ( _keyOp ) ;
public class ContextUtils { /** * copy assets file to destinations . * @ param context * @ param srcFile source file in assets . * @ param dstFile destination files , full path with folder . if folder is empty , * means copy to context ' s files folder . * @ return { @ link # COPY _ SUCCESS } means success . ...
int result = COPY_SUCCESS ; InputStream in = null ; OutputStream out = null ; try { File fi ; if ( dstFile . equals ( FileUtils . getFileName ( dstFile ) ) ) { fi = new File ( context . getFilesDir ( ) , dstFile ) ; } else { fi = new File ( dstFile ) ; } in = context . getAssets ( ) . open ( srcFile , AssetManager . AC...
public class PlayCollectContext { /** * A legal digit map as described in < a href = " https : / / tools . ietf . org / html / rfc2885 # section - 7.1.14 " > section 7.1.14 < / a > of the * MEGACO protocol using the DTMF mappings associated with the Megaco DTMF Detection Package described in the Megaco * protocol d...
String pattern = Optional . fromNullable ( getParameter ( SignalParameters . DIGIT_PATTERN . symbol ( ) ) ) . or ( "" ) ; if ( ! pattern . isEmpty ( ) ) { // Replace pattern to comply with MEGACO digitMap pattern = pattern . replace ( "." , "*" ) . replace ( "x" , "\\d" ) ; } return pattern ;
public class ProducerSequenceFactory { /** * bitmap cache get - > * background thread hand - off - > multiplex - > bitmap cache - > decode - > * branch on separate images * - > exif resize and rotate - > exif thumbnail creation * - > local image resize and rotate - > add meta data producer - > multiplex - > enc...
if ( mLocalImageFileFetchSequence == null ) { LocalFileFetchProducer localFileFetchProducer = mProducerFactory . newLocalFileFetchProducer ( ) ; mLocalImageFileFetchSequence = newBitmapCacheGetToLocalTransformSequence ( localFileFetchProducer ) ; } return mLocalImageFileFetchSequence ;
public class TimedCache { /** * 定时清理 * @ param delay 间隔时长 , 单位毫秒 */ public void schedulePrune ( long delay ) { } }
this . pruneJobFuture = GlobalPruneTimer . INSTANCE . schedule ( new Runnable ( ) { @ Override public void run ( ) { prune ( ) ; } } , delay ) ;
public class ListVolumeInitiatorsResult { /** * The host names and port numbers of all iSCSI initiators that are connected to the gateway . * @ param initiators * The host names and port numbers of all iSCSI initiators that are connected to the gateway . */ public void setInitiators ( java . util . Collection < Str...
if ( initiators == null ) { this . initiators = null ; return ; } this . initiators = new com . amazonaws . internal . SdkInternalList < String > ( initiators ) ;
public class CmsXmlContentDefinition { /** * Calculates the schema type for the given element name by recursing into the schema structure . < p > * @ param elementPath the element xpath to look up the type for * @ return the type for the given element name , or < code > null < / code > if no * node is defined wit...
String path = CmsXmlUtils . getFirstXpathElement ( elementPath ) ; I_CmsXmlSchemaType type = m_types . get ( path ) ; if ( type == null ) { // no node with the given path defined in schema return null ; } // check if recursion is required to get value from a nested schema if ( type . isSimpleType ( ) || ! CmsXmlUtils ....
public class ClassicLockView { /** * Displays a progress bar on top of the action button . This will also * enable or disable the action button . * @ param show whether to show or hide the action bar . */ public void showProgress ( boolean show ) { } }
if ( actionButton != null ) { actionButton . showProgress ( show ) ; } if ( formLayout != null ) { formLayout . setEnabled ( ! show ) ; }
public class NoProxyPortSelector { /** * Retrieve ( and create , if necessary ) the singleton instance . * @ return the NoProxyPortSelector singleton */ public static NoProxyPortSelector getInstance ( ) { } }
if ( _instance == null ) { synchronized ( NoProxyPortSelector . class ) { if ( _instance == null ) { _instance = new NoProxyPortSelector ( ) ; } } } return _instance ;
public class Log4jUtils { /** * ( Re ) Loads the config file using { @ link DOMConfigurator } for { @ code . xml } files and { @ link PropertyConfigurator } for { @ code . proeprties } files . * Reloads the file automatically when changed . * @ param configFile log4j configuration file , { @ code . properties } or ...
long watchDelay = delay == 0 ? Log4jUtils . DEFAULT_WATCH_DELAY : delay ; if ( configFile != null ) { if ( configFile . endsWith ( XML_FILE_EXENSION ) ) { DOMConfigurator . configureAndWatch ( configFile , watchDelay ) ; } else PropertyConfigurator . configureAndWatch ( configFile , watchDelay ) ; } if ( logger . isInf...
public class Labeling { /** * labeling observation sequences . * @ param data list of sequences with specified format which can be read by DataReader * @ return a list of sentences with tags annotated */ @ SuppressWarnings ( "unchecked" ) public List seqLabeling ( String data ) { } }
List < Sentence > obsvSeqs = dataReader . readString ( data ) ; return labeling ( obsvSeqs ) ;
public class AbstractCodeCreator { /** * adds requirements on one or more files that must be copied into the project , * this is only for files that already exist in tcMenu library , prefer to use the * other version that takes ` PluiginFileDependency ` * @ see PluginFileDependency * @ param files the list of l...
libraryFiles . addAll ( Arrays . stream ( files ) . map ( PluginFileDependency :: fileInTcMenu ) . collect ( Collectors . toList ( ) ) ) ;
public class NoCacheDatabase { /** * Export a tango device into the tango db ( execute DbExportDevice on DB * device ) * @ param info * export info { @ link DeviceExportInfo } * @ throws DevFailed */ @ Override public void exportDevice ( final DeviceExportInfo info ) throws DevFailed { } }
final String [ ] array = info . toStringArray ( ) ; final DeviceData argin = new DeviceData ( ) ; argin . insert ( array ) ; database . command_inout ( "DbExportDevice" , argin ) ;
public class NumberUtil { /** * 将10进制的String安全的转化为Integer . * 当str为空或非数字字符串时 , 返回default值 */ public static Integer toIntObject ( @ Nullable String str , Integer defaultValue ) { } }
if ( StringUtils . isEmpty ( str ) ) { return defaultValue ; } try { return Integer . valueOf ( str ) ; } catch ( final NumberFormatException nfe ) { return defaultValue ; }
public class XBELConverter { /** * { @ inheritDoc } */ @ Override public XBELDocument unmarshal ( File f ) throws JAXBException , IOException { } }
final Unmarshaller unmarshaller = createNewUnmashaller ( ) ; FileInputStream fis = new FileInputStream ( f ) ; Reader reader = new InputStreamReader ( fis , UTF_8 ) ; return ( XBELDocument ) unmarshaller . unmarshal ( reader ) ;
public class AtomicVariableWidthArray { /** * Sets the element at the given index , but only if the previous value was the expected value . * @ param i the index * @ param expect the expected value * @ param update the new value * @ return true on success */ public final boolean compareAndSet ( int i , int expe...
if ( fullWidth ) { return array . compareAndSet ( i , expect , update ) ; } boolean success = false ; int index = getIndex ( i ) ; int subIndex = getSubIndex ( i ) ; while ( ! success ) { int prev = array . get ( index ) ; if ( unPack ( prev , subIndex ) != expect ) { return false ; } int next = pack ( prev , update , ...
import java . util . ArrayList ; import java . util . List ; public class ListAddition { /** * The function adds two lists element - wise . * > > > list _ addition ( [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ) * [ 5 , 7 , 9] * > > > list _ addition ( [ 1 , 2 ] , [ 3 , 4 ] ) * [ 4 , 6] * > > > list _ addition ( [ 10 , 20 ...
List < Integer > combined = new ArrayList < > ( ) ; int size = Math . min ( list1 . size ( ) , list2 . size ( ) ) ; for ( int i = 0 ; i < size ; i ++ ) { combined . add ( list1 . get ( i ) + list2 . get ( i ) ) ; } return combined ;
public class Hosts { /** * Chooses one of the available { @ link InetAddress } based on the specified preference . * If the preferred address is not part of the available addresses it will be ignored . * @ param preferred * @ return */ private static InetAddress chooseAddress ( String preferred ) throws UnknownHo...
Set < InetAddress > addresses = getAddresses ( ) ; if ( preferred != null && ! preferred . isEmpty ( ) ) { // Favor preferred address if exists try { InetAddress preferredAddress = InetAddress . getByName ( preferred ) ; if ( addresses != null && addresses . contains ( preferredAddress ) ) { LOG . info ( "preferred add...
public class ParallelTaskManager { /** * Clean wait task queue . */ public synchronized void cleanWaitTaskQueue ( ) { } }
for ( ParallelTask task : waitQ ) { task . setState ( ParallelTaskState . COMPLETED_WITH_ERROR ) ; task . getTaskErrorMetas ( ) . add ( new TaskErrorMeta ( TaskErrorType . USER_CANCELED , "NA" ) ) ; logger . info ( "task {} removed from wait q. This task has been marked as USER CANCELED." , task . getTaskId ( ) ) ; } w...
public class GrowQueue_I8 { /** * Returns the index of the first element with the specified ' value ' . return - 1 if it wasn ' t found * @ param value Value to search for * @ return index or - 1 if it ' s not in the list */ public int indexOf ( byte value ) { } }
for ( int i = 0 ; i < size ; i ++ ) { if ( data [ i ] == value ) return i ; } return - 1 ;
public class Util { /** * Rolls back a { @ link Connection } and logs exceptions without throwing . * @ param connection */ static void rollback ( Connection connection ) { } }
if ( connection != null ) try { connection . rollback ( ) ; log . debug ( "rolled back" ) ; } catch ( SQLException e ) { throw new SQLRuntimeException ( e ) ; }
public class CellConstraints { /** * Checks and verifies that the horizontal alignment is a horizontal and the vertical alignment * is vertical . * @ param horizontalAlignment the horizontal alignment * @ param verticalAlignment the vertical alignment * @ throws IllegalArgumentException if an alignment is inval...
if ( ! horizontalAlignment . isHorizontal ( ) ) { throw new IllegalArgumentException ( "The horizontal alignment must be one of: left, center, right, fill, default." ) ; } if ( ! verticalAlignment . isVertical ( ) ) { throw new IllegalArgumentException ( "The vertical alignment must be one of: top, center, bottom, fill...
public class GVRAndroidResource { /** * Close the open stream . * Close the stream if it was opened before */ public synchronized final void closeStream ( ) { } }
try { if ( ( stream != null ) && ( streamState == StreamStates . OPEN ) ) { stream . close ( ) ; stream = null ; } streamState = StreamStates . CLOSED ; } catch ( IOException e ) { e . printStackTrace ( ) ; }
public class ReferenceDataSourceDescriptionMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ReferenceDataSourceDescription referenceDataSourceDescription , ProtocolMarshaller protocolMarshaller ) { } }
if ( referenceDataSourceDescription == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( referenceDataSourceDescription . getReferenceId ( ) , REFERENCEID_BINDING ) ; protocolMarshaller . marshall ( referenceDataSourceDescription . getTableNam...
public class CoreBiGramTableDictionary { /** * 热更新二元接续词典 < br > * 集群环境 ( 或其他IOAdapter ) 需要自行删除缓存文件 * @ return 是否成功 */ public static boolean reload ( ) { } }
String biGramDictionaryPath = HanLP . Config . BiGramDictionaryPath ; IOUtil . deleteFile ( biGramDictionaryPath + ".table" + Predefine . BIN_EXT ) ; return load ( biGramDictionaryPath ) ;
public class DSetImpl { /** * Determine whether this set is a proper superset of the set referenced by * < code > otherSet < / code > . * @ paramotherSetAnother set . * @ return True if this set is a proper superset of the set referenced by * < code > otherSet < / code > , otherwise false . */ public boolean pr...
return ( otherSet . size ( ) > 0 && otherSet . size ( ) < this . size ( ) && this . supersetOf ( otherSet ) ) ;
public class JcElement { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div > * < div color = ' red ' style = " font - size : 18px ; color : red " > < i > access the id of a node or relation , return a < b > JcNumber < / b > < / i > < /...
JcNumber ret = new JcNumber ( null , this , new FunctionInstance ( FUNCTION . PropertyContainer . ID , 1 ) ) ; QueryRecorder . recordInvocationConditional ( this , "id" , ret ) ; return ret ;
public class TypeUtil { /** * Creates a RegEx Pattern object , if given String is a valid regular expression . * @ param _ regExStr regex string to check * @ return Pattern - Object or null if given String is no valid RegEx */ public static Pattern createRegExPatternIfValid ( String _regExStr ) { } }
if ( StringUtil . isBlank ( _regExStr ) ) { return null ; } Pattern pattern ; try { pattern = Pattern . compile ( _regExStr ) ; } catch ( PatternSyntaxException _ex ) { return null ; } return pattern ;
public class Queue { /** * Gets a new QueueBuilder using this Queue as the parent . */ public < P extends ProcessBuilder > QueueBuilder < P > newQueueBuilder ( Class < P > process_builder_class ) { } }
return QueueFactory . newQueueBuilder ( this , process_builder_class ) ;
public class ConvertNumberHandler { /** * ( non - Javadoc ) * @ see org . apache . myfaces . view . facelets . tag . ObjectHandler # setAttributes ( javax . faces . view . facelets . FaceletContext , java . lang . Object ) */ public void setAttributes ( FaceletContext ctx , Object obj ) { } }
super . setAttributes ( ctx , obj ) ; NumberConverter c = ( NumberConverter ) obj ; if ( this . locale != null ) { c . setLocale ( ComponentSupport . getLocale ( ctx , this . locale ) ) ; }
public class EC2Instance { /** * Get encrypted initial Windows password . This method only definitely works with standard Amazon AMIs : * http : / / aws . amazon . com / windows / amis / * Other AMIs in the public library may have had their password changed , and it will not be retrievable on instances * launched...
APITrace . begin ( getProvider ( ) , "getPassword" ) ; try { return new GetPassCallable ( instanceId , getProvider ( ) ) . call ( ) ; } catch ( CloudException ce ) { throw ce ; } catch ( Exception e ) { throw new InternalException ( e ) ; } finally { APITrace . end ( ) ; }
public class TreeMutator { /** * Mutates the given chromosome . * @ see # mutate ( Gene , Random ) * @ param chromosome the chromosome to mutate * @ param p the mutation probability for the underlying genetic objects * @ param random the random engine used for the genotype mutation * @ return the mutation res...
final int P = probability . toInt ( p ) ; return random . nextInt ( ) < P ? mutate ( chromosome ) : MutatorResult . of ( chromosome ) ;
public class DescribeEntityAggregatesResult { /** * The number of entities that are affected by each of the specified events . * @ param entityAggregates * The number of entities that are affected by each of the specified events . */ public void setEntityAggregates ( java . util . Collection < EntityAggregate > ent...
if ( entityAggregates == null ) { this . entityAggregates = null ; return ; } this . entityAggregates = new java . util . ArrayList < EntityAggregate > ( entityAggregates ) ;
public class XAResourceRecoveryImpl { /** * Close a managed connection * @ param mc The managed connection */ private void close ( ManagedConnection mc ) { } }
log . debugf ( "Closing managed connection for recovery (%s)" , mc ) ; if ( mc != null ) { try { mc . cleanup ( ) ; } catch ( ResourceException ire ) { log . debugf ( "Error during recovery cleanup" , ire ) ; } } if ( mc != null ) { try { mc . destroy ( ) ; } catch ( ResourceException ire ) { log . debugf ( "Error duri...
public class GeoFire { /** * Removes the location for a key from this GeoFire . * @ param key The key to remove from this GeoFire * @ param completionListener A completion listener that is called once the location is successfully removed * from the server or an error occurred */ public void removeLocation ( final...
if ( key == null ) { throw new NullPointerException ( ) ; } DatabaseReference keyRef = this . getDatabaseRefForKey ( key ) ; if ( completionListener != null ) { keyRef . setValue ( null , new DatabaseReference . CompletionListener ( ) { @ Override public void onComplete ( DatabaseError databaseError , DatabaseReference...
public class ConditionalCheck { /** * Ensures that a passed boolean is not equal to another boolean . The comparison is made using * < code > expected = = check < / code > . * @ param condition * condition must be { @ code true } ^ so that the check will be performed * @ param expected * Expected value * @ ...
if ( condition ) { Check . notEquals ( expected , check , message ) ; }
public class NetTimeConnector { /** * / * [ deutsch ] * < p > Liefert die aktuelle Zeit , nachdem eine Verbindung wenigstens * einmal hergestellt wurde . < / p > * < p > Hat es noch keine Verbindung gegeben , dann zeigt diese Methode * lediglich die Zeit an , zu der diese Uhr konstruiert wurde . Zu * beachten...
final ConnectionResult cr = this . result ; if ( cr == null ) { return this . startMoment ; } long localMicros = SystemClock . MONOTONIC . realTimeInMicros ( ) ; long amount = localMicros + cr . getActualOffset ( localMicros ) - extractMicros ( cr . lastMoment ) ; return cr . lastMoment . plus ( amount * 1000 , SI . NA...
public class NtFileNodeRepresentation { /** * ( non - Javadoc ) * @ see * org . exoplatform . services . jcr . ext . resource . NodeRepresentation # getProperties ( java . lang . String ) */ public Collection < HierarchicalProperty > getProperties ( String name ) throws RepositoryException { } }
ArrayList < HierarchicalProperty > props = new ArrayList < HierarchicalProperty > ( ) ; if ( "jcr:primaryType" . equals ( name ) || "jcr:mixinTypes" . equals ( name ) ) return null ; if ( content != null && content . getProperty ( name ) != null ) { props . addAll ( content . getProperties ( name ) ) ; } try { String n...
public class TaskAddHeaders { /** * Set the time at which the resource was last modified . * @ param lastModified the lastModified value to set * @ return the TaskAddHeaders object itself . */ public TaskAddHeaders withLastModified ( DateTime lastModified ) { } }
if ( lastModified == null ) { this . lastModified = null ; } else { this . lastModified = new DateTimeRfc1123 ( lastModified ) ; } return this ;
public class UnicodeSet { /** * Removes the specified string from this set if it is present . * The set will not contain the specified string once the call * returns . * @ param s the string to be removed * @ return this object , for chaining */ public final UnicodeSet remove ( CharSequence s ) { } }
int cp = getSingleCP ( s ) ; if ( cp < 0 ) { strings . remove ( s . toString ( ) ) ; pat = null ; } else { remove ( cp , cp ) ; } return this ;
public class ClassName { /** * Returns the package component of { @ code pathName } . * @ param pathName a dot - separated path */ @ Requires ( "pathName != null" ) @ Ensures ( "result != null" ) public static String getPackageName ( String pathName ) { } }
int lastSep = pathName . lastIndexOf ( '.' ) ; if ( lastSep == - 1 ) { return "" ; } else { return pathName . substring ( 0 , lastSep ) ; }
public class KafkaQueue { protected KafkaClient buildKafkaClient ( ) throws Exception { } }
if ( StringUtils . isBlank ( bootstrapServers ) ) { throw new IllegalStateException ( "Kafka bootstrap server list is not defined." ) ; } KafkaClient kafkaClient = new KafkaClient ( bootstrapServers ) ; kafkaClient . setProducerProperties ( consumerProps ) . setConsumerProperties ( consumerProps ) ; kafkaClient . init ...
public class LinkPredicates { /** * Returns a Predicate that is matching links having the specified type { @ link Link # getType ( ) type } * @ param type the expected media type of the link * @ return Predicate used to select links */ public static Predicate < Link > havingType ( final String type ) { } }
return link -> type . equals ( link . getType ( ) ) ;
public class BceHttpClient { /** * Create asynchronous http client based on connection manager . * @ param connectionManager Asynchronous http client connection manager . * @ return Asynchronous http client based on connection manager . */ protected CloseableHttpAsyncClient createHttpAsyncClient ( NHttpClientConnec...
HttpAsyncClientBuilder builder = HttpAsyncClients . custom ( ) . setConnectionManager ( connectionManager ) ; int socketBufferSizeInBytes = this . config . getSocketBufferSizeInBytes ( ) ; if ( socketBufferSizeInBytes > 0 ) { builder . setDefaultConnectionConfig ( ConnectionConfig . custom ( ) . setBufferSize ( socketB...
public class ChannelOutboundBuffer { /** * Returns an array of direct NIO buffers if the currently pending messages are made of { @ link ByteBuf } only . * { @ link # nioBufferCount ( ) } and { @ link # nioBufferSize ( ) } will return the number of NIO buffers in the returned * array and the total number of readabl...
assert maxCount > 0 ; assert maxBytes > 0 ; long nioBufferSize = 0 ; int nioBufferCount = 0 ; final InternalThreadLocalMap threadLocalMap = InternalThreadLocalMap . get ( ) ; ByteBuffer [ ] nioBuffers = NIO_BUFFERS . get ( threadLocalMap ) ; Entry entry = flushedEntry ; while ( isFlushedEntry ( entry ) && entry . msg i...
public class VersionChecker { /** * Consumes the version field from the given input and raises an exception if the record is in a newer version , * written by a newer version of Hibernate OGM . * @ param input the input to read from * @ param supportedVersion the type version supported by this version of OGM * ...
int version = input . readInt ( ) ; if ( version != supportedVersion ) { throw LOG . unexpectedKeyVersion ( externalizedType , version , supportedVersion ) ; }
public class CompoundEvent { /** * Commits this transaction by posting this event to the distributed object event queue . All * participating dobjects will have their transaction references cleared and will go back to * normal operation . */ public void commit ( ) { } }
// first clear our target clearTarget ( ) ; // then post this event onto the queue ( but only if we actually // accumulated some events ) int size = _events . size ( ) ; switch ( size ) { case 0 : // nothing doing break ; case 1 : // no point in being compound _omgr . postEvent ( _events . get ( 0 ) ) ; break ; default...
public class DeploymentScenario { /** * Get all { @ link DeploymentDescription } defined to be deployed during Test startup for a specific { @ link * TargetDescription } ordered . * @ param target * The Target to filter on * @ return A List of found { @ link DeploymentDescription } . Will return a empty list if...
Validate . notNull ( target , "Target must be specified" ) ; List < Deployment > startupDeployments = new ArrayList < Deployment > ( ) ; for ( Deployment deployment : deployments ) { DeploymentDescription desc = deployment . getDescription ( ) ; if ( desc . managed ( ) && target . equals ( desc . getTarget ( ) ) ) { st...
public class AudienceSegmentCriteria { /** * Sets the operator value for this AudienceSegmentCriteria . * @ param operator * The comparison operator . This attribute is required . */ public void setOperator ( com . google . api . ads . admanager . axis . v201811 . AudienceSegmentCriteriaComparisonOperator operator ) ...
this . operator = operator ;
public class InternalXtextParser { /** * InternalXtext . g : 2170:1 : rulePredicatedKeyword returns [ EObject current = null ] : ( ( ( ( lv _ predicated _ 0_0 = ' = > ' ) ) | ( ( lv _ firstSetPredicated _ 1_0 = ' - > ' ) ) ) ( ( lv _ value _ 2_0 = RULE _ STRING ) ) ) ; */ public final EObject rulePredicatedKeyword ( ) ...
EObject current = null ; Token lv_predicated_0_0 = null ; Token lv_firstSetPredicated_1_0 = null ; Token lv_value_2_0 = null ; enterRule ( ) ; try { // InternalXtext . g : 2176:2 : ( ( ( ( ( lv _ predicated _ 0_0 = ' = > ' ) ) | ( ( lv _ firstSetPredicated _ 1_0 = ' - > ' ) ) ) ( ( lv _ value _ 2_0 = RULE _ STRING ) ) ...
public class ScopeContext { /** * return the session count of this application context * @ return */ public int getAppContextSessionCount ( PageContext pc ) { } }
ApplicationContext appContext = pc . getApplicationContext ( ) ; if ( pc . getSessionType ( ) == Config . SESSION_TYPE_JEE ) return 0 ; Map < String , Scope > context = getSubMap ( cfSessionContexts , appContext . getName ( ) ) ; return getCount ( context ) ;
public class HdfsOutputSwitcher { /** * メッセージをHDFSに出力する 。 * @ param target 出力内容 * @ param nowTime 出力時刻 * @ throws IOException 入出力エラー発生時 */ public void append ( String target , long nowTime ) throws IOException { } }
if ( this . nextSwitchTime <= nowTime ) { switchWriter ( nowTime ) ; } this . currentWriter . append ( target ) ;
public class Router { /** * 记录路由路径记录 * @ param routerName 路由名字 * @ since 5.2.0 */ protected void recordRouterWay ( String routerName ) { } }
if ( RpcInternalContext . isAttachmentEnable ( ) ) { RpcInternalContext context = RpcInternalContext . getContext ( ) ; String record = ( String ) context . getAttachment ( RpcConstants . INTERNAL_KEY_ROUTER_RECORD ) ; record = record == null ? routerName : record + ">" + routerName ; context . setAttachment ( RpcConst...
public class Fingerprint { /** * Parses the input status and returns a tag map . * @ param ufsName the name of the ufs , should be { @ link UnderFileSystem # getUnderFSType ( ) } * @ param status the { @ link UfsStatus } to create the tagmap from * @ return the tag map object */ private static Map < Tag , String ...
Map < Tag , String > tagMap = new HashMap < > ( ) ; tagMap . put ( Tag . UFS , ufsName ) ; tagMap . put ( Tag . OWNER , status . getOwner ( ) ) ; tagMap . put ( Tag . GROUP , status . getGroup ( ) ) ; tagMap . put ( Tag . MODE , String . valueOf ( status . getMode ( ) ) ) ; if ( status instanceof UfsFileStatus ) { tagM...
public class FilterStreamXMLStreamWriter { /** * Write the XML Declaration . * @ param encoding the XML version * @ param version the XML encoding * @ throws FilterException */ public void writeStartDocument ( String encoding , String version ) throws FilterException { } }
try { this . writer . writeStartDocument ( encoding , version ) ; } catch ( XMLStreamException e ) { throw new FilterException ( "Failed to write start document" , e ) ; }
public class CompletableFuture { /** * Completes with the given ( non - null ) exceptional result as a wrapped CompletionException unless * it is one already , unless already completed . May complete with the given Object r ( which must * have been the result of a source future ) if it is equivalent , i . e . if th...
return U . compareAndSwapObject ( this , RESULT , null , encodeThrowable ( x , r ) ) ;
public class ClosureCodingConvention { /** * Extracts X from goog . provide ( ' X ' ) , if the applied Node is goog . * @ return The extracted class name , or null . */ @ Override public String extractClassNameIfProvide ( Node node , Node parent ) { } }
String namespace = extractClassNameIfGoog ( node , parent , "goog.provide" ) ; if ( namespace == null ) { namespace = extractClassNameIfGoog ( node , parent , "goog.module" ) ; } return namespace ;
public class ArrayIndexOutOfBounds { /** * overrides the visitor to collect parameter registers * @ param obj * the code block of the currently parsed method */ @ Override public void visitCode ( Code obj ) { } }
Method m = getMethod ( ) ; stack . resetForMethodEntry ( this ) ; initializedRegs . clear ( ) ; modifyRegs . clear ( ) ; Type [ ] argTypes = m . getArgumentTypes ( ) ; int arg = m . isStatic ( ) ? 0 : 1 ; for ( Type argType : argTypes ) { String argSig = argType . getSignature ( ) ; initializedRegs . set ( arg ) ; arg ...
public class Command { /** * Extract a double array from a CORBA Any object . * @ param in The CORBA Any object * @ return The extracted double array * @ exception DevFailed If the Any object does not contains a data of the * waited type . * Click < a href = " . . / . . / tango _ basic / idl _ html / Tango . ...
double [ ] data = null ; try { data = DevVarDoubleArrayHelper . extract ( in ) ; } catch ( BAD_OPERATION ex ) { throw_bad_type ( "DevVarDoubleArray" ) ; } return data ;
public class ImageStatistics { /** * Returns the sum of all the pixels in the image . * @ param img Input image . Not modified . */ public static int sum ( GrayS16 img ) { } }
if ( BoofConcurrency . USE_CONCURRENT ) { return ImplImageStatistics_MT . sum ( img ) ; } else { return ImplImageStatistics . sum ( img ) ; }
public class ApplicationGatewaysInner { /** * Creates or updates the specified application gateway . * @ param resourceGroupName The name of the resource group . * @ param applicationGatewayName The name of the application gateway . * @ param parameters Parameters supplied to the create or update application gate...
return beginCreateOrUpdateWithServiceResponseAsync ( resourceGroupName , applicationGatewayName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ;
public class policyhttpcallout { /** * Use this API to fetch all the policyhttpcallout resources that are configured on netscaler . */ public static policyhttpcallout [ ] get ( nitro_service service ) throws Exception { } }
policyhttpcallout obj = new policyhttpcallout ( ) ; policyhttpcallout [ ] response = ( policyhttpcallout [ ] ) obj . get_resources ( service ) ; return response ;
public class RecastArea { /** * / @ see rcCompactHeightfield , rcMedianFilterWalkableArea */ public void markCylinderArea ( Context ctx , float [ ] pos , float r , float h , AreaModification areaMod , CompactHeightfield chf ) { } }
ctx . startTimer ( "MARK_CYLINDER_AREA" ) ; float bmin [ ] = new float [ 3 ] , bmax [ ] = new float [ 3 ] ; bmin [ 0 ] = pos [ 0 ] - r ; bmin [ 1 ] = pos [ 1 ] ; bmin [ 2 ] = pos [ 2 ] - r ; bmax [ 0 ] = pos [ 0 ] + r ; bmax [ 1 ] = pos [ 1 ] + h ; bmax [ 2 ] = pos [ 2 ] + r ; float r2 = r * r ; int minx = ( int ) ( ( ...
public class IntervalTaggerWrapper { /** * invokes the IntervalTagger ' s process method . */ public void process ( JCas jcas ) { } }
try { tagger . process ( jcas ) ; } catch ( AnalysisEngineProcessException e ) { e . printStackTrace ( ) ; }