signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class base64 { /** * Convert a base64 - encoded String to binary data
* @ param str A String containing the encoded data
* @ return An array containing the binary data , or null if the string is invalid */
public static byte [ ] fromString ( String str ) { } } | ByteArrayOutputStream bs = new ByteArrayOutputStream ( ) ; byte [ ] raw = str . getBytes ( ) ; for ( int i = 0 ; i < raw . length ; i ++ ) { if ( ! Character . isWhitespace ( ( char ) raw [ i ] ) ) bs . write ( raw [ i ] ) ; } byte [ ] in = bs . toByteArray ( ) ; if ( in . length % 4 != 0 ) { return null ; } bs . reset... |
public class ExperimentsInner { /** * Gets a list of Experiments within the specified Workspace .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param workspaceName The name of the workspace . Workspace names can only contain a combination of alphanumeric characters along... | return listByWorkspaceSinglePageAsync ( resourceGroupName , workspaceName , experimentsListByWorkspaceOptions ) . concatMap ( new Func1 < ServiceResponse < Page < ExperimentInner > > , Observable < ServiceResponse < Page < ExperimentInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < ExperimentI... |
public class IceAgent { /** * Gathers all available candidates and sets the components of each media
* stream .
* @ param portManager
* The manager that handles port range for ICE candidate harvest
* @ throws HarvestException
* An error occurred while harvesting candidates */
public void harvest ( RtpPortMana... | // Initialize the selector if necessary
if ( this . selector == null || ! this . selector . isOpen ( ) ) { try { this . selector = Selector . open ( ) ; } catch ( IOException e ) { throw new HarvestException ( "Could not initialize selector" , e ) ; } } // Gather candidates for each media stream
for ( IceMediaStream me... |
public class Code { /** * Sets { @ code target } to the length of the array in { @ code array } . */
public < T > void arrayLength ( Local < Integer > target , Local < T > array ) { } } | addInstruction ( new ThrowingInsn ( Rops . ARRAY_LENGTH , sourcePosition , RegisterSpecList . make ( array . spec ( ) ) , catches ) ) ; moveResult ( target , true ) ; |
public class FnString { /** * Replaces in the target String all substrings matching the specified regular expression
* with the specified replacement String .
* Regular expressions must conform to the < tt > java . util . regex . Pattern < / tt > format .
* @ param regex the regular expression to match against
... | return new Replace ( regex , replacement , ReplaceType . ALL ) ; |
public class ExternalContext { /** * < p class = " changed _ added _ 2_0 " > < span class = " changed _ modified _ 2_2 " > Adds < / span > the cookie represented by the
* arguments to the response . < / p >
* < div class = " changed _ added _ 2_0 " >
* < p > < em > Servlet : < / em > This must be accomplished by ... | if ( defaultExternalContext != null ) { defaultExternalContext . addResponseCookie ( name , value , properties ) ; } else { throw new UnsupportedOperationException ( ) ; } |
public class ResourcePoolsBuilder { /** * Add the { @ link ResourcePool } of { @ link ResourceType } in the returned builder .
* @ param type the resource type
* @ param size the pool size
* @ param unit the pool size unit
* @ param persistent if the pool is to be persistent
* @ return a new builder with the ... | return with ( new SizedResourcePoolImpl < > ( type , size , unit , persistent ) ) ; |
public class SqlDateTimeUtils { public static long timestampFloor ( TimeUnitRange range , long ts , TimeZone tz ) { } } | // assume that we are at UTC timezone , just for algorithm performance
long offset = tz . getOffset ( ts ) ; long utcTs = ts + offset ; switch ( range ) { case HOUR : return floor ( utcTs , MILLIS_PER_HOUR ) - offset ; case DAY : return floor ( utcTs , MILLIS_PER_DAY ) - offset ; case MONTH : case YEAR : case QUARTER :... |
public class VideoDisplayActivity { /** * Sets up the camera if it is not already setup . */
private void setUpAndConfigureCamera ( ) { } } | // Open and configure the camera
mCamera = openConfigureCamera ( mCameraInfo ) ; setCameraDisplayOrientation ( mCameraInfo , mCamera ) ; // Create an instance of Camera
mPreview . setCamera ( mCamera ) ; if ( processing != null ) { processing . init ( mDraw , mCamera , mCameraInfo , previewRotation ) ; } |
public class ReadExcelUtils { /** * 将指定WorkBook里的记录封装成指定类型放入List中返回
* @ param clazz 指定封装类型
* @ param workbook
* @ return 无结果返回空List
* @ throws ReadExcelException */
public static < T > List < T > handleWorkBookToBeans ( Class < T > clazz , Workbook workbook ) throws ReadExcelException { } } | List < Map < String , Object > > listMap = ReadExcelUtils . handleWorkBookToMapList ( workbook ) ; List < T > beans = new ArrayList < T > ( ) ; for ( Map < String , Object > map : listMap ) { T bean = CommonUtils . toBean ( map , clazz ) ; if ( bean != null ) { beans . add ( bean ) ; } } return beans ; |
public class GraphIOUtil { /** * Optimal / Optional mergeDelimitedFrom - If the message does not fit the buffer , no merge is done and this method
* will return false .
* This is strictly for reading a single message from the stream because the buffer is aggressively filled when
* reading the delimited size ( whi... | return optMergeDelimitedFrom ( in , message , schema , true , buffer ) ; |
public class Element { /** * Gets a property value of this element .
* < p > If the property is a list - property , the first element is returned . < / p >
* @ param propertyName Name of the property .
* @ return Value of the current element casted to { @ code int } .
* @ throws NullPointerException if { @ code... | if ( propertyName == null ) { throw new NullPointerException ( "propertyName must not be null." ) ; } Integer index = propertyMap . get ( propertyName ) ; if ( index == null ) { throw new IllegalArgumentException ( "non existent property: '" + propertyName + "'." ) ; } if ( data [ index ] . length == 0 ) { throw new In... |
public class SpecificTxTemplate { /** * Error is propagated if runtime or rethrown as runtime exception .
* @ param action action to execute within transaction ( new or ongoing )
* @ param < T > return value type
* @ return value produced by action */
public < T > T doInTransaction ( final SpecificTxAction < T , ... | return doInTransaction ( null , action ) ; |
public class ThreadPool { /** * sets this thread pool to create threads which are decorated via
* setupThreadStub */
public void setDecoratedZOS ( ) { } } | // 331761A
if ( xMemSetupThread == null ) { try { final Class xMemCRBridgeClass = Class . forName ( "com.ibm.ws390.xmem.XMemCRBridgeImpl" ) ; xMemSetupThread = xMemCRBridgeClass . getMethod ( "setupThreadStub" , new Class [ ] { java . lang . Object . class } ) ; } catch ( Throwable t ) { if ( tc . isEventEnabled ( ) ) ... |
public class MangooUtils { /** * Copies a given map to a new map instance
* @ param originalMap The map to copy
* @ return A new Map instance with value from originalMap */
public static Map < String , String > copyMap ( Map < String , String > originalMap ) { } } | Objects . requireNonNull ( originalMap , Required . MAP . toString ( ) ) ; return new HashMap < > ( originalMap ) ; |
public class MaterialComboBox { /** * Only return a single value even if multi support is activate . */
public T getSingleValue ( ) { } } | List < T > values = getSelectedValue ( ) ; if ( ! values . isEmpty ( ) ) { return values . get ( 0 ) ; } return null ; |
public class LOiToDblFunctionBuilder { /** * One of ways of creating builder . This might be the only way ( considering all _ functional _ builders ) that might be utilize to specify generic params only once . */
@ Nonnull public static < T > LOiToDblFunctionBuilder < T > oiToDblFunction ( Consumer < LOiToDblFunction <... | return new LOiToDblFunctionBuilder ( consumer ) ; |
public class RedissonPriorityQueue { /** * TODO cache result */
private static String calcClassSign ( String name ) { } } | try { Class < ? > clazz = Class . forName ( name ) ; ByteArrayOutputStream result = new ByteArrayOutputStream ( ) ; ObjectOutputStream outputStream = new ObjectOutputStream ( result ) ; outputStream . writeObject ( clazz ) ; outputStream . close ( ) ; MessageDigest crypt = MessageDigest . getInstance ( "SHA-1" ) ; cryp... |
public class AbstractReaderModule { /** * Initialize reusable filters . */
void initFilters ( ) { } } | tempFileNameScheme . setBaseDir ( job . getInputDir ( ) ) ; listFilter = new GenListModuleReader ( ) ; listFilter . setLogger ( logger ) ; listFilter . setPrimaryDitamap ( rootFile ) ; listFilter . setJob ( job ) ; listFilter . setFormatFilter ( formatFilter ) ; if ( profilingEnabled ) { filterUtils = parseFilterFile (... |
public class DateTimeFormatterBuilder { /** * Appends the value of a date - time field to the formatter using a normal
* output style .
* The value of the field will be output during a print .
* If the value cannot be obtained then an exception will be thrown .
* The value will be printed as per the normal prin... | Jdk8Methods . requireNonNull ( field , "field" ) ; appendValue ( new NumberPrinterParser ( field , 1 , 19 , SignStyle . NORMAL ) ) ; return this ; |
public class Normalization { /** * Normalize the sequence by zero mean unit variance
* @ param schema Schema of the data to normalize
* @ param sequence Sequence data
* @ param excludeColumns List of columns to exclude from the normalization
* @ return Normalized sequence */
public static JavaRDD < List < List ... | DataRowsFacade frame = DataFrames . toDataFrameSequence ( schema , sequence ) ; if ( excludeColumns == null ) excludeColumns = Arrays . asList ( DataFrames . SEQUENCE_UUID_COLUMN , DataFrames . SEQUENCE_INDEX_COLUMN ) ; else { excludeColumns = new ArrayList < > ( excludeColumns ) ; excludeColumns . add ( DataFrames . S... |
public class Position { /** * Encode line and column numbers in an integer as :
* { @ code line - number < < LINESHIFT + column - number } .
* { @ link Position # NOPOS } represents an undefined position .
* @ param line number of line ( first is 1)
* @ param col number of character on line ( first is 1)
* @ ... | if ( line < 1 ) throw new IllegalArgumentException ( "line must be greater than 0" ) ; if ( col < 1 ) throw new IllegalArgumentException ( "column must be greater than 0" ) ; if ( line > MAXLINE || col > MAXCOLUMN ) { return NOPOS ; } return ( line << LINESHIFT ) + col ; |
public class Strman { /** * Returns a repeated string given a multiplier .
* @ param value The input String
* @ param multiplier Number of repeats
* @ return The String repeated */
public static String repeat ( final String value , final int multiplier ) { } } | validate ( value , NULL_STRING_PREDICATE , NULL_STRING_MSG_SUPPLIER ) ; return Stream . generate ( ( ) -> value ) . limit ( multiplier ) . collect ( joining ( ) ) ; |
public class Matchers { /** * Returns a matcher that matches context elements whose { @ link ContextElement # identifier ( ) }
* match against the supplied matcher .
* @ param matcher { @ code Class < ? > } matcher
* @ return a { @ code ContextElement } matcher */
public static Matcher < ContextElement > identifi... | return new Matcher < ContextElement > ( ) { @ Override protected boolean matchesSafely ( ContextElement t ) { return matcher . matches ( t . identifier ( ) ) ; } @ Override public String toString ( ) { return "an identifier that is " + matcher ; } } ; |
public class ConvertDescriptors { /** * Converts a regular feature description into a NCC feature description
* @ param input Tuple descriptor . ( not modified )
* @ param output The equivalent NCC feature . ( modified ) */
public static void convertNcc ( TupleDesc_F64 input , NccFeature output ) { } } | if ( input . size ( ) != output . size ( ) ) throw new IllegalArgumentException ( "Feature lengths do not match." ) ; double mean = 0 ; for ( int i = 0 ; i < input . value . length ; i ++ ) { mean += input . value [ i ] ; } mean /= input . value . length ; double variance = 0 ; for ( int i = 0 ; i < input . value . len... |
public class RawLocalFileSystem { /** * Use the command chown to set owner . */
@ Override public void setOwner ( Path p , String username , String groupname ) throws IOException { } } | if ( username == null && groupname == null ) { throw new IOException ( "username == null && groupname == null" ) ; } if ( username == null ) { execCommand ( pathToFile ( p ) , Shell . SET_GROUP_COMMAND , groupname ) ; } else { // OWNER [ : [ GROUP ] ]
String s = username + ( groupname == null ? "" : ":" + groupname ) ;... |
public class DynamicSSLPanel { /** * Saving Root CA certificate to disk . */
private void doSave ( ) { } } | if ( txt_PubCert . getDocument ( ) . getLength ( ) < MIN_CERT_LENGTH ) { logger . error ( "Illegal state! There seems to be no certificate available." ) ; bt_save . setEnabled ( false ) ; } final JFileChooser fc = new JFileChooser ( System . getProperty ( "user.home" ) ) ; fc . setFileSelectionMode ( JFileChooser . FIL... |
public class AbstractImmutableSubstitutionImpl { /** * Most functional terms do not accept NULL as arguments . If this happens , they become NULL . */
private Map . Entry < Variable , ImmutableTerm > applyNullNormalization ( Map . Entry < Variable , ImmutableTerm > substitutionEntry ) { } } | ImmutableTerm value = substitutionEntry . getValue ( ) ; if ( value instanceof ImmutableFunctionalTerm ) { ImmutableTerm newValue = normalizeFunctionalTerm ( ( ImmutableFunctionalTerm ) value ) ; return newValue . equals ( value ) ? substitutionEntry : new AbstractMap . SimpleEntry < > ( substitutionEntry . getKey ( ) ... |
public class CommerceNotificationTemplateUtil { /** * Returns all the commerce notification templates where uuid = & # 63 ; and companyId = & # 63 ; .
* @ param uuid the uuid
* @ param companyId the company ID
* @ return the matching commerce notification templates */
public static List < CommerceNotificationTemp... | return getPersistence ( ) . findByUuid_C ( uuid , companyId ) ; |
public class JavaParser { /** * src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 552:1 : typeArguments : ' < ' typeArgument ( ' , ' typeArgument ) * ' > ' ; */
public final void typeArguments ( ) throws RecognitionException { } } | int typeArguments_StartIndex = input . index ( ) ; try { if ( state . backtracking > 0 && alreadyParsedRule ( input , 53 ) ) { return ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 553:5 : ( ' < ' typeArgument ( ' , ' typeArgument ) * ' > ' )
// src / main / resources /... |
public class RedisHashMap { /** * 返回长度
* @ return */
public long length ( ) { } } | try { if ( isCluster ( groupName ) ) { return getBinaryJedisClusterCommands ( groupName ) . hlen ( keyBytes ) ; } else { return getBinaryJedisCommands ( groupName ) . hlen ( keyBytes ) ; } } finally { getJedisProvider ( groupName ) . release ( ) ; } |
public class StreamAppenderatorDriver { /** * Register the segments in the given { @ link SegmentsAndMetadata } to be handed off and execute a background task which
* waits until the hand off completes .
* @ param segmentsAndMetadata the result segments and metadata of
* { @ link # publish ( TransactionalSegmentP... | if ( segmentsAndMetadata == null ) { return Futures . immediateFuture ( null ) ; } else { final List < SegmentIdWithShardSpec > waitingSegmentIdList = segmentsAndMetadata . getSegments ( ) . stream ( ) . map ( SegmentIdWithShardSpec :: fromDataSegment ) . collect ( Collectors . toList ( ) ) ; final Object metadata = Pr... |
public class FilteringScore { /** * Evaluates the given index for its filtering capabilities against the
* given filter .
* @ param index index to evaluate
* @ param filter filter which cannot contain any logical ' or ' operations .
* @ throws IllegalArgumentException if index is null or filter is not supported... | if ( index == null ) { throw new IllegalArgumentException ( "Index required" ) ; } return evaluate ( index . getOrderedProperties ( ) , index . isUnique ( ) , index . isClustered ( ) , filter ) ; |
public class CEMIFactory { /** * Returns an EMI1 / EMI2 - formatted message of the supplied cEMI L - Data message .
* @ param msg a cEMI L - Data message
* @ return byte array containing the link layer message in EMI format
* @ throws KNXIllegalArgumentException on unsupported ASDU length */
public static byte [ ... | int mc = msg . getMessageCode ( ) ; final KNXAddress dst = msg . getDestination ( ) ; // find out if we need L - Data system broadcast
if ( msg . isSystemBroadcast ( ) ) mc = Emi1_LSysBcast_req ; if ( dst . getRawAddress ( ) == 0 ) { // APCI domain address . read is always system broadcast
if ( DataUnitBuilder . getAPD... |
public class StringArrayMapper { /** * This method creates a field remap table . This is useful for CSV / TSV type files where you have to similar headers
* and you need to map from one format to the other . Control fields is the desired format , remapped fields is the
* format that you need to convert from . The r... | // create hash map with remapped fields
HashMap < String , Integer > map = new HashMap < String , Integer > ( ) ; for ( int index = 0 ; index < remappedFields . length ; index ++ ) { String field = remappedFields [ index ] ; map . put ( field , index ) ; } // create remap table
int remap [ ] = new int [ controlFields .... |
public class FileSourceFactory { /** * Return sa list of FileSources based on the name . If the name
* is a directory then it returns all the files in that directory
* ending with . jadt . Otherwise it is assumed that the name
* is a file . */
@ Override public List < FileSource > createSources ( String srcName )... | final File dirOrFile = new File ( srcName ) ; final File [ ] files = dirOrFile . listFiles ( FILTER ) ; if ( files != null ) { final List < FileSource > sources = new ArrayList < FileSource > ( files . length ) ; for ( File file : files ) { sources . add ( new FileSource ( file ) ) ; } return sources ; } else { return ... |
public class GreenPepperXmlRpcServer { /** * < p > getAllEnvironmentTypes . < / p >
* @ return a { @ link java . util . Vector } object . */
public Vector < Object > getAllEnvironmentTypes ( ) { } } | try { List < EnvironmentType > envTypes = service . getAllEnvironmentTypes ( ) ; log . debug ( "Retrieved All Environment Types number: " + envTypes . size ( ) ) ; return XmlRpcDataMarshaller . toXmlRpcEnvironmentTypesParameters ( envTypes ) ; } catch ( Exception e ) { return errorAsVector ( e , ENVTYPES_NOT_FOUND ) ; ... |
public class SimpleXpathEngine { /** * returns namespace declarations for all namespaces known to the
* current context . */
private String getNamespaceDeclarations ( ) { } } | StringBuilder nsDecls = new StringBuilder ( ) ; String quoteStyle = "'" ; for ( Iterator keys = ctx . getPrefixes ( ) ; keys . hasNext ( ) ; ) { String prefix = ( String ) keys . next ( ) ; String uri = ctx . getNamespaceURI ( prefix ) ; if ( uri == null ) { continue ; } // this shouldn ' t have happened , but better s... |
public class EventLoggerListener { /** * This method receives the log event and logs it .
* @ param logEvent
* Event to be logged */
@ Subscribe public final void receive ( final LogEvent logEvent ) { } } | final String sClassName = logEvent . getSource ( ) . getClass ( ) . getName ( ) ; Logger logger = loggersMap . get ( sClassName ) ; if ( logger == null ) { logger = LoggerFactory . getLogger ( logEvent . getSource ( ) . getClass ( ) ) ; loggersMap . put ( sClassName , logger ) ; } final Throwable error = logEvent . get... |
public class InitiateContainer { /** * not ' target ' to the delegate container */
public void setup ( @ Observes EventContext < SetupContainer > setup ) throws Exception { } } | SetupContainer event = setup . getEvent ( ) ; if ( isChameleonContainer ( event ) ) { initiateChameleon ( event ) ; } setup . proceed ( ) ; |
public class ClustersInner { /** * Gets the specified cluster .
* @ param resourceGroupName The name of the resource group .
* @ param clusterName The name of the cluster .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rej... | return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , clusterName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class JTMConfigurationProvider { /** * Called by DS to activate service */
protected void activate ( ComponentContext cc ) { } } | _runtimeMetaDataProvider = new LibertyRuntimeMetaDataProvider ( this ) ; activateHasBeenCalled = true ; _transactionSettingsProviders . activate ( cc ) ; _cc = cc ; // Irrespective of the logtype we need to get the properties
_props = _cc . getProperties ( ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "activate ... |
public class MethodNameAnalyzer { public OptionalThing < String > analyzeRestfulHttpMethod ( Method executeMethod ) { } } | final String extracted = extractRestfulHttpMethod ( executeMethod ) ; assertResfulHttpMethodIfExists ( executeMethod , extracted ) ; return OptionalThing . ofNullable ( extracted , ( ) -> { throw new IllegalStateException ( "Not found RESTful HTTP method: " + toSimpleMethodExp ( executeMethod ) ) ; } ) ; |
public class RevertedGraph { /** * { @ inheritDoc } */
public E getEdge ( V source , V target ) { } } | return directedGraph . getEdge ( target , source ) ; |
public class StateModelVerfier { /** * This method checks for the basic contracts of the state model :
* < ol >
* < li > There is exact one , non - null start state . < / li >
* < li > The start state has at least one transition . < / li >
* < li > The end state set is not null . < / li >
* < li > The end sta... | if ( stateModel . getStartState ( ) == null ) { throw new StateModelException ( "No start state is defined." ) ; } if ( stateModel . getStartState ( ) . getTransitions ( ) == null ) { throw new StateModelException ( "No transition(s) for start state is/are defined, but an invalid null is returned." ) ; } if ( stateMode... |
public class ActionMapping { /** * 初始化 < br >
* 查找指定包中类的所有方法 , 用于Action请求 < br >
* 会排除Object对象中的public方法
* @ param packageNames Action类所在包的位置
* @ throws Exception */
public final void init ( String [ ] packageNames ) { } } | if ( ArrayUtil . isEmpty ( packageNames ) ) { return ; } final Set < Class < ? > > actionClasses = new HashSet < Class < ? > > ( ) ; final Filter < Class < ? > > actionClassFilter = createActionClassFilter ( ) ; // Action类的过滤器 , 剔除不符合过滤条件的类
for ( String packageName : packageNames ) { if ( StrUtil . isNotBlank ( package... |
public class ConfigUtil { /** * create a composite configuration that wraps the configuration sent by the
* user . this util will also load the " defaultConfig . properties " file loaded
* relative to the given " clazz " parameter
* @ param clazz
* - the class that acts as referenced location of
* " defaultCo... | final CompositeConfiguration compositeConfiguration = new CompositeConfiguration ( ) ; final Configuration defaultConfiguration = ConfigurationFactory . getDefaultConfiguration ( ) ; if ( configuration != null ) { compositeConfiguration . addConfiguration ( configuration ) ; } compositeConfiguration . addConfiguration ... |
public class SoyTreeUtils { /** * Clones the given node and then generates and sets new ids on all the cloned nodes ( by default ,
* SoyNode . copy ( copyState ) creates cloned nodes with the same ids as the original nodes ) .
* < p > This function will use the original Soy tree ' s node id generator to generate th... | // Clone the node .
@ SuppressWarnings ( "unchecked" ) T clone = ( T ) origNode . copy ( new CopyState ( ) ) ; // Generate new ids .
( new GenNewIdsVisitor ( nodeIdGen ) ) . exec ( clone ) ; return clone ; |
public class AsyncTableEntryReader { /** * Reads a single { @ link TableEntry } from the given InputStream . The { @ link TableEntry } itself is not constructed ,
* rather all of its components are returned individually .
* @ param input An InputStream to read from .
* @ param segmentOffset The Segment Offset tha... | val h = serializer . readHeader ( input ) ; long version = getKeyVersion ( h , segmentOffset ) ; byte [ ] key = StreamHelpers . readAll ( input , h . getKeyLength ( ) ) ; byte [ ] value = h . isDeletion ( ) ? null : ( h . getValueLength ( ) == 0 ? new byte [ 0 ] : StreamHelpers . readAll ( input , h . getValueLength ( ... |
public class DataSourceConnectionSource { /** * Initialize the class after the setters have been called . If you are using the no - arg constructor and Spring type
* wiring , this should be called after all of the set methods .
* @ throws SQLException
* If the driver associated with the database URL is not found ... | if ( initialized ) { return ; } if ( dataSource == null ) { throw new IllegalStateException ( "dataSource was never set on " + getClass ( ) . getSimpleName ( ) ) ; } if ( databaseType == null ) { if ( databaseUrl == null ) { throw new IllegalStateException ( "either the databaseUri or the databaseType must be set on " ... |
public class JBBPUtils { /** * Check that a byte array ends with some byte values .
* @ param array array to be checked , must not be null
* @ param str a byte string which will be checked as the end sequence of the
* array , must not be null
* @ return true if the string is the end sequence of the array , fals... | boolean result = false ; if ( array . length >= str . length ) { result = true ; int index = str . length ; int arrindex = array . length ; while ( -- index >= 0 ) { if ( array [ -- arrindex ] != str [ index ] ) { result = false ; break ; } } } return result ; |
public class Component { /** * Constructs a < code > RuntimeException < / code > based on the given
* information .
* A message is constructed and logged at ERROR level before being returned as a
* < code > RuntimeException < / code > .
* @ param field
* field name used when throwing < code > RuntimeException... | String msg = "tag '" + getComponentName ( ) + "', field '" + field + ( parameters != null && parameters . containsKey ( "name" ) ? "', name '" + parameters . get ( "name" ) : "" ) + "': " + errorMsg ; throw new StrutsException ( msg , e ) ; |
public class RiakUserMetadata { /** * Get a user metadata entry .
* This method and its { @ link RiakUserMetadata # put ( java . lang . String , java . lang . String , java . nio . charset . Charset ) }
* counterpart use the supplied { @ code Charset } to convert the { @ code String } s .
* @ param key the key fo... | BinaryValue wrappedKey = BinaryValue . unsafeCreate ( key . getBytes ( charset ) ) ; BinaryValue value = meta . get ( wrappedKey ) ; if ( value != null ) { return value . toString ( charset ) ; } else { return null ; } |
public class OWLObjectPropertyImpl_CustomFieldSerializer { /** * Deserializes the content of the object from the
* { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } .
* @ param streamReader the { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } to read the ... | deserialize ( streamReader , instance ) ; |
public class PRCurve { /** * the f - measure if we just guess as negativ the first numleft and guess as poitive the last numright */
public double fmeasure ( int numleft , int numright ) { } } | int tp = 0 , fp = 0 , fn = 0 ; tp = numpositive [ numright ] ; fp = numright - tp ; fn = numleft - numnegative [ numleft ] ; return f1 ( tp , fp , fn ) ; |
public class RuleBasedCollator { /** * < strong > [ icu ] < / strong > Sets the variable top to the primary weight of the specified string .
* < p > Beginning with ICU 53 , the variable top is pinned to
* the top of one of the supported reordering groups ,
* and it must not be beyond the last of those groups .
... | checkNotFrozen ( ) ; if ( varTop == null || varTop . length ( ) == 0 ) { throw new IllegalArgumentException ( "Variable top argument string can not be null or zero in length." ) ; } boolean numeric = settings . readOnly ( ) . isNumeric ( ) ; long ce1 , ce2 ; if ( settings . readOnly ( ) . dontCheckFCD ( ) ) { UTF16Coll... |
public class CmsDefaultLinkSubstitutionHandler { /** * Checks if the link target is a secure link . < p
* @ param cms the current CMS context
* @ param vfsName the path of the link target
* @ param targetSite the target site containing the detail page
* @ param secureRequest true if the currently running reques... | return OpenCms . getStaticExportManager ( ) . isSecureLink ( cms , vfsName , targetSite . getSiteRoot ( ) , secureRequest ) ; |
public class ContextServiceImpl { /** * Names of methods to which we should apply context .
* When not configured , this returns null , in which case the invoker should
* default to all methods that aren ' t defined on java . lang . Object .
* So , for example , myTask . doSomething would run with context but . t... | lock . readLock ( ) . lock ( ) ; try { @ SuppressWarnings ( "unchecked" ) Collection < String > contextualMethods = ( Collection < String > ) properties . get ( CONTEXTUAL_METHODS ) ; return contextualMethods ; } finally { lock . readLock ( ) . unlock ( ) ; } |
public class GetStringComparator { /** * Compare two chunks based on assumed same length . 0 if the same .
* @ param thisChunk the first chunk to be compared
* @ param thatChunk the second chunk to be compared
* @ return the difference in length ( l1 - l2) */
private int compareChunks ( final String thisChunk , f... | final int thisChunkLength = thisChunk . length ( ) ; for ( int i = 0 ; i < thisChunkLength ; i ++ ) { final int result = thisChunk . charAt ( i ) - thatChunk . charAt ( i ) ; if ( result != 0 ) { return result ; } } return 0 ; |
public class DefaultInterfaceEra { @ Override public String getDisplayName ( TextStyle style , Locale locale ) { } } | return new DateTimeFormatterBuilder ( ) . appendText ( ERA , style ) . toFormatter ( locale ) . format ( this ) ; |
public class QRDecompositionHouseholder_DDRM { /** * This function performs sanity check on the input for decompose and sets up the QR matrix .
* @ param A */
protected void commonSetup ( DMatrixRMaj A ) { } } | setExpectedMaxSize ( A . numRows , A . numCols ) ; QR . set ( A ) ; |
public class AttrWait { /** * Creates a new attribute instance from the provided String .
* @ param str string representation of the attribute
* @ return attribute instance or { @ code null } if provided string is
* { @ code null }
* @ throws BOSHException on parse or validation failure */
static AttrWait creat... | if ( str == null ) { return null ; } else { return new AttrWait ( str ) ; } |
public class PageFlowUtils { /** * Add a validation error that will be shown with the Errors and Error tags .
* @ deprecated Use { @ link # addActionError ( ServletRequest , String , String , Object [ ] ) } instead .
* @ param propertyName the name of the property with which to associate this error .
* @ param me... | addActionError ( request , propertyName , messageKey , new Object [ ] { messageArg } ) ; |
public class Project { /** * < p > removeRepository . < / p >
* @ param repo a { @ link com . greenpepper . server . domain . Repository } object .
* @ throws com . greenpepper . server . GreenPepperServerException if any . */
public void removeRepository ( Repository repo ) throws GreenPepperServerException { } } | if ( ! repositories . contains ( repo ) ) { throw new GreenPepperServerException ( GreenPepperServerErrorKey . REPOSITORY_NOT_FOUND , "Repository not found" ) ; } repositories . remove ( repo ) ; repo . setProject ( null ) ; |
public class ApiOvhIpLoadbalancing { /** * Get this object properties
* REST : GET / ipLoadbalancing / { serviceName } / tcp / route / { routeId } / rule / { ruleId }
* @ param serviceName [ required ] The internal name of your IP load balancing
* @ param routeId [ required ] Id of your route
* @ param ruleId [... | String qPath = "/ipLoadbalancing/{serviceName}/tcp/route/{routeId}/rule/{ruleId}" ; StringBuilder sb = path ( qPath , serviceName , routeId , ruleId ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhRouteRule . class ) ; |
public class Endian { /** * Reads the next big - endian unsigned 16 bit integer from the
* given stream .
* @ param input the input stream to read from
* @ return the next 16 - bit big - endian integer
* @ throws IOException if an IO error occurs */
public static char bigChar ( InputStream input ) throws IOExce... | int hi = input . read ( ) ; if ( hi < 0 ) { throw new EOFException ( ) ; } int lo = input . read ( ) ; if ( lo < 0 ) { throw new EOFException ( ) ; } return ( char ) ( ( hi << 8 ) | lo ) ; |
public class DeviceAttribute_3DAODefaultImpl { public void insert_u64 ( final long argin ) { } } | final long [ ] values = new long [ 1 ] ; values [ 0 ] = argin ; attrval . r_dim . dim_x = 1 ; attrval . r_dim . dim_y = 0 ; DevVarULong64ArrayHelper . insert ( attrval . value , values ) ; |
public class UScale { /** * Test the scalability of a consumer that requires T input data .
* @ param < T >
* the type of the input data needed by the Consumer
* @ param title
* the title to apply to all reports and results
* @ param consumer
* the Consumer that processes the T data
* @ param scaler
* a... | final ScaleControl < T > scontrol = new ScaleControl < > ( consumer , scaler , reusedata ) ; final TaskRunnerBuilder builder = ( name , scale ) -> scontrol . buildTask ( name , scale ) ; return scaleMapper ( title , builder ) ; |
public class HashRangeExpressionBuilder { /** * Generate a hash range expression .
* @ return hash range expression */
public HashRangeExpression build ( Integer hashColumnIndex ) { } } | Map < Integer , Integer > ranges = m_builder . build ( ) ; HashRangeExpression predicate = new HashRangeExpression ( ) ; predicate . setRanges ( ranges ) ; predicate . setHashColumnIndex ( hashColumnIndex ) ; return predicate ; |
public class ExchangeRateBuilder { /** * Sets the { @ link javax . money . convert . ExchangeRate } chain .
* @ param exchangeRates the { @ link javax . money . convert . ExchangeRate } chain to be applied
* @ return the builder instance */
public ExchangeRateBuilder setRateChain ( ExchangeRate ... exchangeRates ) ... | this . rateChain . clear ( ) ; if ( exchangeRates != null ) { this . rateChain . addAll ( Arrays . asList ( exchangeRates . clone ( ) ) ) ; } return this ; |
public class ELKILogRecord { /** * Infer a caller , ignoring logging - related classes . */
private void inferCallerELKI ( ) { } } | needToInferCaller = false ; StackTraceElement [ ] stack = ( new Throwable ( ) ) . getStackTrace ( ) ; int ix = 0 ; // skip back to the logger .
while ( ix < stack . length ) { StackTraceElement frame = stack [ ix ] ; final String cls = frame . getClassName ( ) ; if ( cls . equals ( START_TRACE_AT ) ) { break ; } ix ++ ... |
public class SpELFunction { /** * 创建SpEL执行上下文
* @ param rootObject
* SpEL表达式根对象
* @ param context
* Beetl上下文对象
* @ return SpEL表达式执行上下文 */
private EvaluationContext createEvaluationContext ( Object rootObject , Context beetlContext ) { } } | StandardEvaluationContext context = new StandardEvaluationContext ( rootObject ) ; // 允许使用 # context访问Beetl上下文
context . setVariable ( "context" , beetlContext ) ; // 允许使用 # global访问Beetl上下文的全局变量
context . setVariable ( "global" , beetlContext . globalVar ) ; // 注册WebRender定义的全局变量
context . setVariable ( "ctxPath" , be... |
public class ReverseState { /** * Update the state with the specified trust anchor .
* @ param anchor the most - trusted CA
* @ param buildParams builder parameters */
public void updateState ( TrustAnchor anchor , BuilderParams buildParams ) throws CertificateException , IOException , CertPathValidatorException { ... | trustAnchor = anchor ; X509Certificate trustedCert = anchor . getTrustedCert ( ) ; if ( trustedCert != null ) { updateState ( trustedCert ) ; } else { X500Principal caName = anchor . getCA ( ) ; updateState ( anchor . getCAPublicKey ( ) , caName ) ; } // The user specified AlgorithmChecker and RevocationChecker may not... |
public class ApiOvhDedicatedinstallationTemplate { /** * Get this object properties
* REST : GET / dedicated / installationTemplate / { templateName }
* @ param templateName [ required ] This template name */
public OvhTemplates templateName_GET ( String templateName ) throws IOException { } } | String qPath = "/dedicated/installationTemplate/{templateName}" ; StringBuilder sb = path ( qPath , templateName ) ; String resp = execN ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhTemplates . class ) ; |
public class WebSiteManagementClientImpl { /** * Updates publishing user .
* Updates publishing user .
* @ param userDetails Details of publishing user
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail th... | return ServiceFuture . fromResponse ( updatePublishingUserWithServiceResponseAsync ( userDetails ) , serviceCallback ) ; |
public class TimeZoneNamesImpl { /** * Returns a set of names for the given meta zone ID . This method loads
* the set of names into the internal map and trie for future references .
* @ param mzID the meta zone ID
* @ return An instance of ZNames that includes a set of meta zone display names . */
private synchr... | ZNames mznames = _mzNamesMap . get ( mzID ) ; if ( mznames == null ) { ZNamesLoader loader = new ZNamesLoader ( ) ; loader . loadMetaZone ( _zoneStrings , mzID ) ; mznames = ZNames . createMetaZoneAndPutInCache ( _mzNamesMap , loader . getNames ( ) , mzID ) ; } return mznames ; |
public class ModifyListenerRequest { /** * The actions for the default rule . The rule must include one forward action or one or more fixed - response actions .
* If the action type is < code > forward < / code > , you specify a target group . The protocol of the target group must be
* HTTP or HTTPS for an Applicat... | if ( this . defaultActions == null ) { setDefaultActions ( new java . util . ArrayList < Action > ( defaultActions . length ) ) ; } for ( Action ele : defaultActions ) { this . defaultActions . add ( ele ) ; } return this ; |
public class JPAExpressions { /** * Create a new detached JPQLQuery instance with the given projection
* @ param exprs projection
* @ return select ( distinct expr ) */
public static JPQLQuery < Tuple > selectDistinct ( Expression < ? > ... exprs ) { } } | return new JPASubQuery < Void > ( ) . select ( exprs ) . distinct ( ) ; |
public class ClassicLoadBalancersConfig { /** * One or more Classic Load Balancers .
* @ param classicLoadBalancers
* One or more Classic Load Balancers . */
public void setClassicLoadBalancers ( java . util . Collection < ClassicLoadBalancer > classicLoadBalancers ) { } } | if ( classicLoadBalancers == null ) { this . classicLoadBalancers = null ; return ; } this . classicLoadBalancers = new com . amazonaws . internal . SdkInternalList < ClassicLoadBalancer > ( classicLoadBalancers ) ; |
public class lacp { /** * Use this API to fetch filtered set of lacp resources .
* filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */
public static lacp [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | lacp obj = new lacp ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; lacp [ ] response = ( lacp [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class WebSocketConnectionRegistry { /** * Sign in a connection to the registry by key .
* Note multiple connections can be attached to the same key
* @ param key
* the key
* @ param connection
* the websocket connection
* @ see # register ( String , WebSocketConnection ) */
public void signIn ( Strin... | ConcurrentMap < WebSocketConnection , WebSocketConnection > bag = ensureConnectionList ( key ) ; bag . put ( connection , connection ) ; |
public class clusternodegroup { /** * Use this API to update clusternodegroup resources . */
public static base_responses update ( nitro_service client , clusternodegroup resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { clusternodegroup updateresources [ ] = new clusternodegroup [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { updateresources [ i ] = new clusternodegroup ( ) ; updateresources [ i ] . name = resources [ i ] .... |
public class Layout { /** * Calculate the child size along the axis
* @ param dataIndex data index
* @ param axis { @ link Axis }
* @ return child size */
public float getChildSize ( final int dataIndex , final Axis axis ) { } } | float size = 0 ; Widget child = mContainer . get ( dataIndex ) ; if ( child != null ) { switch ( axis ) { case X : size = child . getLayoutWidth ( ) ; break ; case Y : size = child . getLayoutHeight ( ) ; break ; case Z : size = child . getLayoutDepth ( ) ; break ; default : throw new RuntimeAssertion ( "Bad axis speci... |
public class Word { /** * Returns the { @ link Component } object if
* @ return
* The neoclassical component affix
* @ throws IllegalStateException when this word is not a neoclassical compound */
public Component getNeoclassicalAffix ( ) { } } | Preconditions . checkState ( isCompound ( ) , MSG_NOT_COMPOUND , this ) ; Preconditions . checkState ( getCompoundType ( ) == CompoundType . NEOCLASSICAL , MSG_NOT_NEOCLASSICAL , this ) ; for ( Component c : components ) if ( c . isNeoclassicalAffix ( ) ) return c ; throw new IllegalArgumentException ( String . format ... |
public class OpenTSDBMain { /** * Executes the target tool
* @ param targetTool the name of the target tool to execute
* @ param args The command line arguments minus the tool name */
private static void process ( String targetTool , String [ ] args ) { } } | if ( "mkmetric" . equals ( targetTool ) ) { shift ( args ) ; } if ( ! "tsd" . equals ( targetTool ) ) { try { COMMANDS . get ( targetTool ) . getDeclaredMethod ( "main" , String [ ] . class ) . invoke ( null , new Object [ ] { args } ) ; } catch ( Exception x ) { log . error ( "Failed to call [" + targetTool + "]." , x... |
public class EquivalentClassPartitioner { /** * Find the topological equivalent class for the given weight .
* @ param weight array contains weight of the nodes
* @ return an array contains the automorphism partition */
public int [ ] findTopoEquivClass ( double [ ] weight ) { } } | int trialCount , i ; int equivalentClass [ ] = new int [ weight . length ] ; int count = checkDiffNumber ( weight ) ; trialCount = count ; if ( count == nodeNumber ) { for ( i = 1 ; i <= nodeNumber ; i ++ ) { equivalentClass [ i ] = i ; } equivalentClass [ 0 ] = count ; return equivalentClass ; } do { count = trialCoun... |
public class Connection { /** * Used in conjunction with { @ link # verifyIdentity ( byte [ ] ) } to prove
* that we actually own the private key of the given key pair . */
public void proveIdentity ( byte [ ] sharedSecret , KeyPair key ) throws IOException , GeneralSecurityException { } } | String algorithm = detectKeyAlgorithm ( key ) ; writeUTF ( algorithm ) ; writeKey ( key . getPublic ( ) ) ; Signature sig = Signature . getInstance ( "SHA1with" + algorithm ) ; sig . initSign ( key . getPrivate ( ) ) ; sig . update ( key . getPublic ( ) . getEncoded ( ) ) ; sig . update ( sharedSecret ) ; writeObject (... |
public class TypicalFaicliApiFailureHook { protected FaicliFailureErrorPart createJsonistaError ( ApiFailureResource resource , String field , String message , String delimiter ) { } } | final String code = Srl . substringFirstFront ( message , delimiter ) . trim ( ) ; // e . g . LENGTH
final String json = "{" + Srl . substringFirstRear ( message , delimiter ) . trim ( ) + "}" ; // e . g . { min : { min } , max : { max } }
final Map < String , Object > data = parseJsonistaData ( resource , field , code... |
public class Iterables { /** * Converts enumeration into iterable */
public static < T > Iterable < T > toIterable ( Enumeration < T > in ) { } } | List < T > out = new LinkedList < T > ( ) ; while ( in . hasMoreElements ( ) ) { out . add ( in . nextElement ( ) ) ; } return out ; |
public class ResourceBundleMessagesGenerator { /** * ( non - Javadoc )
* @ see
* net . jawr . web . resource . bundle . generator . ResourceGenerator # createResource
* ( java . lang . String , java . nio . charset . Charset ) */
@ Override public Reader generateResource ( String path , GeneratorContext context )... | MessageBundleScriptCreator creator = new MessageBundleScriptCreator ( context , control ) ; addLinkedResources ( path , context ) ; return creator . createScript ( context . getCharset ( ) ) ; |
public class SeleniumServerMojo { /** * Set the RepositoryMap used to get file information .
* If the supplied map is invalid it will default to the pre - packaged one here .
* @ throws MojoExecutionException */
private void setRepositoryMapFile ( ) throws MojoExecutionException { } } | if ( this . customRepositoryMap != null && ! this . customRepositoryMap . isEmpty ( ) ) { File repositoryMap = getRepositoryMapFile ( this . customRepositoryMap ) ; if ( repositoryMap . exists ( ) ) { checkRepositoryMapIsValid ( repositoryMap ) ; try { this . xmlRepositoryMap = repositoryMap . toURI ( ) . toURL ( ) . o... |
public class PropertyAccessorFactory { /** * Gets the property accessor .
* @ param clazz
* the clazz
* @ return the property accessor */
@ SuppressWarnings ( "unchecked" ) public static PropertyAccessor getPropertyAccessor ( Class < ? > clazz ) { } } | PropertyAccessor < ? > accessor ; if ( clazz . isEnum ( ) ) { accessor = new EnumAccessor ( ) ; } else { accessor = map . get ( clazz ) ; } // allow fall - back to Object streamer .
if ( null == accessor ) { if ( Enum . class . isAssignableFrom ( clazz ) ) { accessor = map . get ( Enum . class ) ; } else { accessor = m... |
public class Task { /** * Retrieve the start slack .
* @ return start slack */
public Duration getStartSlack ( ) { } } | Duration startSlack = ( Duration ) getCachedValue ( TaskField . START_SLACK ) ; if ( startSlack == null ) { Duration duration = getDuration ( ) ; if ( duration != null ) { startSlack = DateHelper . getVariance ( this , getEarlyStart ( ) , getLateStart ( ) , duration . getUnits ( ) ) ; set ( TaskField . START_SLACK , st... |
public class IntListUtil { /** * Returns the total of all of the values in the list . */
public static int sum ( int [ ] list ) { } } | int total = 0 , lsize = list . length ; for ( int ii = 0 ; ii < lsize ; ii ++ ) { total += list [ ii ] ; } return total ; |
public class Table { /** * Return the position of the constraint within the list */
int getConstraintIndex ( String constraintName ) { } } | for ( int i = 0 , size = constraintList . length ; i < size ; i ++ ) { if ( constraintList [ i ] . getName ( ) . name . equals ( constraintName ) ) { return i ; } } return - 1 ; |
public class BusHandler { /** * Update sendAllowed setting for this bus and any targetting Handlers .
* @ param foreignBusDefinition */
public void updateSendAllowed ( boolean oldSendAllowed , boolean newSendAllowed ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "updateSendAllowed" , new Object [ ] { Boolean . valueOf ( oldSendAllowed ) , Boolean . valueOf ( newSendAllowed ) } ) ; if ( oldSendAllowed && ! newSendAllowed ) setForeignBusSendAllowed ( false ) ; else if ( ! oldSendAllow... |
public class DescriptorVisibilityFilter { /** * Returns the { @ link Level } to log an uncaught exception from a { @ link DescriptorVisibilityFilter } . We
* need to suppress repeated exceptions as there can be many invocations of the { @ link DescriptorVisibilityFilter }
* triggered by the UI and spamming the logs... | Long interval = SystemProperties . getLong ( DescriptorVisibilityFilter . class . getName ( ) + ".badFilterLogWarningIntervalMinutes" , 60L ) ; // the healthy path will never see this synchronized block
synchronized ( ResourceHolder . BAD_FILTERS ) { Long lastTime = ResourceHolder . BAD_FILTERS . get ( f ) ; if ( lastT... |
public class IntTrie { /** * Gets the value associated with the codepoint .
* If no value is associated with the codepoint , a default value will be
* returned .
* @ param ch codepoint
* @ return offset to data */
public final int getCodePointValue ( int ch ) { } } | int offset ; // fastpath for U + 0000 . . U + D7FF
if ( 0 <= ch && ch < UTF16 . LEAD_SURROGATE_MIN_VALUE ) { // copy of getRawOffset ( )
offset = ( m_index_ [ ch >> INDEX_STAGE_1_SHIFT_ ] << INDEX_STAGE_2_SHIFT_ ) + ( ch & INDEX_STAGE_3_MASK_ ) ; return m_data_ [ offset ] ; } // handle U + D800 . . U + 10FFFF
offset = ... |
public class PluginCache { /** * Adds the plugin list to the plugins for the account .
* @ param plugins The plugins to add */
public void add ( Collection < Plugin > plugins ) { } } | for ( Plugin plugin : plugins ) this . plugins . put ( plugin . getId ( ) , plugin ) ; |
public class InfixExpression { /** * Visits this node , the left operand , and the right operand . */
@ Override public void visit ( NodeVisitor v ) { } } | if ( v . visit ( this ) ) { left . visit ( v ) ; right . visit ( v ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.