signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class DateParser { /** * Converts a relative 2 - digit year to an absolute 4 - digit year
* @ param shortYear the relative year
* @ return the absolute year */
protected static int yearFrom2Digits ( int shortYear , int currentYear ) { } } | if ( shortYear < 100 ) { shortYear += currentYear - ( currentYear % 100 ) ; if ( Math . abs ( shortYear - currentYear ) >= 50 ) { if ( shortYear < currentYear ) { return shortYear + 100 ; } else { return shortYear - 100 ; } } } return shortYear ; |
public class MarkdownMojo { /** * An accepted file was deleted - deletes the output file .
* @ param file the file
* @ return { @ code true } */
@ Override public boolean fileDeleted ( File file ) { } } | File output = getOutputFile ( file , OUTPUT_EXTENSION ) ; FileUtils . deleteQuietly ( output ) ; return true ; |
public class Formatter { /** * Closes this formatter . If the destination implements the { @ link
* java . io . Closeable } interface , its { @ code close } method will be invoked .
* < p > Closing a formatter allows it to release resources it may be holding
* ( such as open files ) . If the formatter is already ... | if ( out instanceof Closeable ) { closed = true ; ( ( Closeable ) out ) . close ( ) ; } |
public class AstUtil { /** * Returns true if the expression is a binary expression with the specified token .
* @ param expression
* expression
* @ param token
* token
* @ return
* as described */
public static boolean isBinaryExpressionType ( Expression expression , String token ) { } } | if ( expression instanceof BinaryExpression ) { if ( token . equals ( ( ( BinaryExpression ) expression ) . getOperation ( ) . getText ( ) ) ) { return true ; } } return false ; |
public class UnicodeSet { /** * Append the < code > toPattern ( ) < / code > representation of a
* string to the given < code > Appendable < / code > . */
private static < T extends Appendable > T _appendToPat ( T buf , String s , boolean escapeUnprintable ) { } } | int cp ; for ( int i = 0 ; i < s . length ( ) ; i += Character . charCount ( cp ) ) { cp = s . codePointAt ( i ) ; _appendToPat ( buf , cp , escapeUnprintable ) ; } return buf ; |
public class JsonInput { /** * opening quite already consumed */
String parseString ( ) throws IOException { } } | buf . setLength ( 0 ) ; char next = readNext ( ) ; while ( next != '"' ) { if ( next == '\\' ) { parseEscape ( ) ; } else { buf . append ( next ) ; } next = readNext ( ) ; } return buf . toString ( ) ; |
public class RestBuilder { /** * Creates a provider that delivers type when needed
* @ param provider to be executed when needed
* @ param < T > provided object as argument
* @ return builder */
@ SuppressWarnings ( "unchecked" ) public < T > RestBuilder addProvider ( Class < ? extends ContextProvider < T > > pro... | Assert . notNull ( provider , "Missing context provider!" ) ; registeredProviders . put ( null , provider ) ; return this ; |
public class BuffReaderParseFactory { /** * Not supported at this time . */
@ Override public Parser newFixedLengthParser ( final Connection con , final File dataSource , final String dataDefinition ) { } } | throw new UnsupportedOperationException ( "Not supported..." ) ; |
public class VpTree { /** * Recursively search for the k nearest neighbors to target .
* @ param target target point
* @ param maxDistance maximum distance
* @ param k number of neighbors to find */
private PriorityQueue < HeapItem > search ( final double [ ] target , double maxDistance , final int k ) { } } | PriorityQueue < HeapItem > heap = new PriorityQueue < HeapItem > ( ) ; if ( root == null ) { return heap ; } double tau = maxDistance ; final FastQueue < Node > nodes = new FastQueue < Node > ( 20 , Node . class , false ) ; nodes . add ( root ) ; while ( nodes . size ( ) > 0 ) { final Node node = nodes . removeTail ( )... |
public class PartitioningNearestNeighborFinder { /** * Computes the principle vectors , which represent a set of prototypical
* terms that span the semantic space
* @ param numPrincipleVectors */
private void computePrincipleVectors ( int numPrincipleVectors ) { } } | // Group all of the sspace ' s vectors into a Matrix so that we can
// cluster them
final int numTerms = sspace . getWords ( ) . size ( ) ; final List < DoubleVector > termVectors = new ArrayList < DoubleVector > ( numTerms ) ; String [ ] termAssignments = new String [ numTerms ] ; int k = 0 ; for ( String term : sspac... |
public class JacksonObjectProvider { /** * { @ inheritDoc } */
@ Override public FilterProvider transform ( final ObjectGraph graph ) { } } | // Root entity .
final FilteringPropertyFilter root = new FilteringPropertyFilter ( graph . getEntityClass ( ) , graph . getFields ( ) , createSubfilters ( graph . getEntityClass ( ) , graph . getSubgraphs ( ) ) ) ; return new FilteringFilterProvider ( root ) ; |
public class BshClassManager { /** * Indicate that the specified class name has been defined and may be
* loaded normally . */
protected void doneDefiningClass ( String className ) { } } | String baseName = Name . suffix ( className , 1 ) ; definingClasses . remove ( className ) ; definingClassesBaseNames . remove ( baseName ) ; |
public class UserCustomTableReader { /** * { @ inheritDoc } */
@ Override protected UserCustomColumn createColumn ( UserCustomResultSet result , int index , String name , String type , Long max , boolean notNull , int defaultValueIndex , boolean primaryKey ) { } } | GeoPackageDataType dataType = getDataType ( type ) ; Object defaultValue = result . getValue ( defaultValueIndex , dataType ) ; UserCustomColumn column = new UserCustomColumn ( index , name , dataType , max , notNull , defaultValue , primaryKey ) ; return column ; |
public class FutureUtils { /** * This function takes a { @ link CompletableFuture } and a handler function for the result of this future . If the
* input future is already done , this function returns { @ link CompletableFuture # handle ( BiFunction ) } . Otherwise ,
* the return value is { @ link CompletableFuture... | return completableFuture . isDone ( ) ? completableFuture . handle ( handler ) : completableFuture . handleAsync ( handler , executor ) ; |
public class JsonRpcServerHandler { /** * Determines whether the response to the request should be pretty - printed .
* @ param request the HTTP request .
* @ return { @ code true } if the response should be pretty - printed . */
private boolean shouldPrettyPrint ( HttpRequest request ) { } } | QueryStringDecoder decoder = new QueryStringDecoder ( request . getUri ( ) , Charsets . UTF_8 , true , 2 ) ; Map < String , List < String > > parameters = decoder . parameters ( ) ; if ( parameters . containsKey ( PP_PARAMETER ) ) { return parseBoolean ( parameters . get ( PP_PARAMETER ) . get ( 0 ) ) ; } else if ( par... |
public class ValidatorBuilderDouble { /** * @ see # range ( Range )
* @ param min the minimum allowed value .
* @ param max the maximum allowed value .
* @ return this build instance for fluent API calls . */
public ValidatorBuilderDouble < PARENT > range ( double min , double max ) { } } | return range ( new Range < > ( Double . valueOf ( min ) , Double . valueOf ( max ) ) ) ; |
public class ManifestDocumentBinding { /** * This method binds a ChunksManifest object to the content of the arg xml .
* @ param xml manifest document to be bound to ChunksManifest object
* @ return ChunksManifest object */
public static ChunksManifest createManifestFrom ( InputStream xml ) { } } | try { ChunksManifestDocument doc = ChunksManifestDocument . Factory . parse ( xml ) ; return ManifestElementReader . createManifestFrom ( doc ) ; } catch ( XmlException e ) { throw new DuraCloudRuntimeException ( e ) ; } catch ( IOException e ) { throw new DuraCloudRuntimeException ( e ) ; } |
public class ServiceClientChecks { /** * Processes a token from the required tokens list when the TreeWalker visits it .
* @ param token Node in the AST . */
@ Override public void visitToken ( DetailAST token ) { } } | // Failed to load ServiceClient ' s class , don ' t validate anything .
if ( this . serviceClientClass == null ) { return ; } switch ( token . getType ( ) ) { case TokenTypes . PACKAGE_DEF : this . extendsServiceClient = extendsServiceClient ( token ) ; break ; case TokenTypes . CTOR_DEF : if ( this . extendsServiceCli... |
public class HashPartitioner { /** * Use { @ link Object # hashCode ( ) } to partition . */
public int getPartition ( K key , V value , int numReduceTasks ) { } } | return ( key . hashCode ( ) & Integer . MAX_VALUE ) % numReduceTasks ; |
public class SMailPostalMotorbike { protected String resolveProtocolKey ( String key ) { } } | return MotorbikeSecurityType . SSL . equals ( securityType ) ? Srl . replace ( key , ".smtp." , ".smtps." ) : key ; |
public class WrappingUtils { /** * Applies the given rounding params on the specified rounded drawable . */
static void applyRoundingParams ( Rounded rounded , RoundingParams roundingParams ) { } } | rounded . setCircle ( roundingParams . getRoundAsCircle ( ) ) ; rounded . setRadii ( roundingParams . getCornersRadii ( ) ) ; rounded . setBorder ( roundingParams . getBorderColor ( ) , roundingParams . getBorderWidth ( ) ) ; rounded . setPadding ( roundingParams . getPadding ( ) ) ; rounded . setScaleDownInsideBorders... |
public class LogPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getNewCheckoutAdded ( ) { } } | if ( newCheckoutAddedEClass == null ) { newCheckoutAddedEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( LogPackage . eNS_URI ) . getEClassifiers ( ) . get ( 11 ) ; } return newCheckoutAddedEClass ; |
public class QrCode { /** * Splits data into blocks , adds error correction and then interleaves the blocks and error correction data . */
private static void addEcc ( int [ ] fullstream , int [ ] datastream , int version , int data_cw , int blocks ) { } } | int ecc_cw = QR_TOTAL_CODEWORDS [ version - 1 ] - data_cw ; int short_data_block_length = data_cw / blocks ; int qty_long_blocks = data_cw % blocks ; int qty_short_blocks = blocks - qty_long_blocks ; int ecc_block_length = ecc_cw / blocks ; int i , j , length_this_block , posn ; int [ ] data_block = new int [ short_dat... |
public class Convert { /** * Escape all unicode characters in string . */
public static String escapeUnicode ( String s ) { } } | int len = s . length ( ) ; int i = 0 ; while ( i < len ) { char ch = s . charAt ( i ) ; if ( ch > 255 ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( s . substring ( 0 , i ) ) ; while ( i < len ) { ch = s . charAt ( i ) ; if ( ch > 255 ) { buf . append ( "\\u" ) ; buf . append ( Character . forDigit ( ( ... |
public class AbstractOracleQuery { /** * START WITH specifies the root row ( s ) of the hierarchy .
* @ param cond condition
* @ return the current object */
@ WithBridgeMethods ( value = OracleQuery . class , castRequired = true ) public < A > C startWith ( Predicate cond ) { } } | return addFlag ( Position . BEFORE_ORDER , START_WITH , cond ) ; |
public class MPPUtility { /** * Determine the length of a nul terminated UTF16LE string in bytes .
* @ param data string data
* @ param offset offset into string data
* @ return length in bytes */
private static final int getUnicodeStringLengthInBytes ( byte [ ] data , int offset ) { } } | int result ; if ( data == null || offset >= data . length ) { result = 0 ; } else { result = data . length - offset ; for ( int loop = offset ; loop < ( data . length - 1 ) ; loop += 2 ) { if ( data [ loop ] == 0 && data [ loop + 1 ] == 0 ) { result = loop - offset ; break ; } } } return result ; |
public class ResourceGroupsInner { /** * Checks whether a resource group exists .
* @ param resourceGroupName The name of the resource group to check . The name is case insensitive .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the Boolean object */
pub... | if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( this . ... |
public class BpmnParse { /** * IoMappings / / / / / */
protected void parseActivityInputOutput ( Element activityElement , ActivityImpl activity ) { } } | Element extensionElements = activityElement . element ( "extensionElements" ) ; if ( extensionElements != null ) { IoMapping inputOutput = null ; try { inputOutput = parseInputOutput ( extensionElements ) ; } catch ( BpmnParseException e ) { addError ( e ) ; } if ( inputOutput != null ) { if ( checkActivityInputOutputS... |
public class ConcurrentGroupServerUpdatePolicy { /** * Records the result of updating a server group .
* @ param serverGroup the server group ' s name . Cannot be < code > null < / code >
* @ param failed < code > true < / code > if the server group update failed ;
* < code > false < / code > if it succeeded */
p... | synchronized ( this ) { if ( groups . contains ( serverGroup ) ) { responseCount ++ ; if ( failed ) { this . failed = true ; } DomainControllerLogger . HOST_CONTROLLER_LOGGER . tracef ( "Recorded group result for '%s': failed = %s" , serverGroup , failed ) ; notifyAll ( ) ; } else { throw DomainControllerLogger . HOST_... |
public class DigitList { /** * Returns true if this DigitList represents Long . MIN _ VALUE ;
* false , otherwise . This is required so that getLong ( ) works . */
private boolean isLongMIN_VALUE ( ) { } } | if ( decimalAt != count || count != MAX_LONG_DIGITS ) return false ; for ( int i = 0 ; i < count ; ++ i ) { if ( digits [ i ] != LONG_MIN_REP [ i ] ) return false ; } return true ; |
public class BeanUtils { /** * 循环向上转型 , 获取对象的DeclaredField . */
private static Field getDeclaredField ( Object object , String fieldName ) throws NoSuchFieldException { } } | Assert . notNull ( object ) ; return getDeclaredField ( object . getClass ( ) , fieldName ) ; |
public class AngularMomentum { /** * Calculates the I - operator */
public Matrix getIminus ( ) { } } | Matrix Iminus = new Matrix ( size , size ) ; int i , j ; for ( i = 0 ; i < size ; i ++ ) for ( j = 0 ; j < size ; j ++ ) Iminus . matrix [ i ] [ j ] = 0d ; for ( i = 1 ; i < size ; i ++ ) Iminus . matrix [ i ] [ i - 1 ] = Math . sqrt ( J * J + J - ( J - i ) * ( J - i ) - ( J - i ) ) ; return Iminus ; |
public class HttpServletResponseImpl { /** * Determine if a URI string has a < code > scheme < / code > component . */
private boolean hasScheme ( String uri ) { } } | int len = uri . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = uri . charAt ( i ) ; if ( c == ':' ) { return i > 0 ; } else if ( ! Character . isLetterOrDigit ( c ) && ( c != '+' && c != '-' && c != '.' ) ) { return false ; } } return false ; |
public class ProvidenceHelper { /** * Get a field value from a message with optional chaining . If the field is
* not set , or any message in the chain leading up to the last message is
* missing , it will return an empty optional . Otherwise the leaf field value .
* Note that this will only check for MESSAGE typ... | if ( fields == null || fields . length == 0 ) { throw new IllegalArgumentException ( "No fields arguments." ) ; } PField field = fields [ 0 ] ; if ( ! message . has ( field . getId ( ) ) ) { return Optional . empty ( ) ; } if ( fields . length > 1 ) { if ( field . getType ( ) != PType . MESSAGE ) { throw new IllegalArg... |
public class AbstractScriptEngine { /** * Sets the specified value with the specified key in the < code > ENGINE _ SCOPE < / code >
* < code > Bindings < / code > of the protected < code > context < / code > field .
* @ param key The specified key .
* @ param value The specified value .
* @ throws NullPointerEx... | Bindings nn = getBindings ( ScriptContext . ENGINE_SCOPE ) ; if ( nn != null ) { nn . put ( key , value ) ; } |
public class SessionImpl { /** * @ see javax . servlet . http . HttpSession # setAttribute ( java . lang . String , java . lang . Object ) */
@ Override public void setAttribute ( String name , Object value ) { } } | final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "setAttribute: " + name + "=" + value ) ; } if ( null == value ) { removeAttribute ( name ) ; return ; } if ( isInvalid ( ) ) { throw new IllegalStateException ( "Session is invalid" ) ; } Http... |
public class PayMchAPI { /** * 下载对账单
* @ param downloadbill downloadbill
* @ param key key
* @ return DownloadbillResult */
public static DownloadbillResult payDownloadbill ( MchDownloadbill downloadbill , String key ) { } } | Map < String , String > map = MapUtil . objectToMap ( downloadbill ) ; String sign = SignatureUtil . generateSign ( map , downloadbill . getSign_type ( ) , key ) ; downloadbill . setSign ( sign ) ; String closeorderXML = XMLConverUtil . convertToXML ( downloadbill ) ; HttpUriRequest httpUriRequest = RequestBuilder . po... |
public class Ifc4FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIfcBSplineSurfaceFormToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class OkRequest { /** * Write stream to request body
* The given stream will be closed once sending completes
* @ param input
* @ return this request */
public OkRequest < T > send ( final InputStream input ) throws IOException { } } | openOutput ( ) ; copy ( input , mOutput ) ; return this ; |
public class BasePanel { /** * " Clone " this screen .
* @ return true if successful . */
public boolean onNewWindow ( ) { } } | String strLastCommand = Utility . addURLParam ( null , Params . MENU , Constant . BLANK ) ; // " ? menu = " ; / / Blank command = home
this . handleCommand ( strLastCommand , this , ScreenConstants . USE_NEW_WINDOW | ScreenConstants . DONT_PUSH_TO_BROWSER ) ; // Process the last ? menu = command in a new window
return ... |
public class Notification { /** * Returns an Update String for CQL if there is data .
* Returns null if nothing to update
* @ return */
private String update ( ) { } } | // If this has been done before , there is no change in checkSum and the last time notified is within GracePeriod
if ( checksum != 0 && checksum ( ) == checksum && now < last . getTime ( ) + graceEnds && now > last . getTime ( ) + lastdays ) { return null ; } else { return "UPDATE authz.notify SET last = '" + Chrono . ... |
public class GisModelCurveCalculator { /** * This method calculates an array of Point2D that represents an arc . The distance
* between it points is 1 angular unit
* @ param c Point2D that represents the center of the arc
* @ param r double value that represents the radius of the arc
* @ param sa double value t... | int isa = ( int ) sa ; int iea = ( int ) ea ; double angulo ; Point2D [ ] pts ; if ( sa <= ea ) { pts = new Point2D [ ( iea - isa ) + 2 ] ; angulo = sa ; pts [ 0 ] = new Point2D . Double ( c . getX ( ) + r * Math . cos ( angulo * Math . PI / ( double ) 180.0 ) , c . getY ( ) + r * Math . sin ( angulo * Math . PI / ( do... |
public class WonderPushDialogBuilder { /** * Read styled attributes , they will defined in an AlertDialog shown by the given activity .
* You must call { @ link TypedArray # recycle ( ) } after having read the desired attributes .
* @ see Context # obtainStyledAttributes ( android . util . AttributeSet , int [ ] , ... | AlertDialog . Builder builder = new AlertDialog . Builder ( activity ) ; AlertDialog dialog = builder . create ( ) ; TypedArray ta = dialog . getContext ( ) . obtainStyledAttributes ( null , attrs , defStyleAttr , defStyleRef ) ; dialog . dismiss ( ) ; return ta ; |
public class FileUtil { /** * Copy a file to new destination .
* @ param srcFile
* @ param destFile */
public static void copyFile ( File srcFile , File destFile ) { } } | OutputStream out = null ; InputStream in = null ; try { if ( ! destFile . getParentFile ( ) . exists ( ) ) destFile . getParentFile ( ) . mkdirs ( ) ; in = new FileInputStream ( srcFile ) ; out = new FileOutputStream ( destFile ) ; // Transfer bytes from in to out
byte [ ] buf = new byte [ 1024 ] ; int len ; while ( ( ... |
public class CommerceWarehouseLocalServiceBaseImpl { /** * Returns the number of rows matching the dynamic query .
* @ param dynamicQuery the dynamic query
* @ param projection the projection to apply to the query
* @ return the number of rows matching the dynamic query */
@ Override public long dynamicQueryCount... | return commerceWarehousePersistence . countWithDynamicQuery ( dynamicQuery , projection ) ; |
public class MediumMapPageNumberImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . MEDIUM_MAP_PAGE_NUMBER__PAGE_NUM : return PAGE_NUM_EDEFAULT == null ? pageNum != null : ! PAGE_NUM_EDEFAULT . equals ( pageNum ) ; } return super . eIsSet ( featureID ) ; |
public class Query { /** * Creates and returns a new Query that ' s additionally sorted by the specified field .
* @ param field The field to sort by .
* @ return The created Query . */
@ Nonnull public Query orderBy ( @ Nonnull String field ) { } } | return orderBy ( FieldPath . fromDotSeparatedString ( field ) , Direction . ASCENDING ) ; |
public class AsyncListEngine { /** * Display extension */
@ Override public void subscribe ( ListEngineDisplayListener < T > listener ) { } } | if ( ! listeners . contains ( listener ) ) { listeners . add ( listener ) ; } |
public class PreComputedContextExtractor { /** * { @ inheritDoc } */
public void processDocument ( BufferedReader document , Wordsi wordsi ) { } } | String line ; try { line = document . readLine ( ) ; } catch ( IOException ioe ) { throw new IOError ( ioe ) ; } // Split the header from the rest of the context . The header must be
// the focus word for this context .
String [ ] headerRest = line . split ( "\\s+" , 2 ) ; // Reject any words not accepted by wordsi .
i... |
public class Entities { /** * Walks through all entities ( recursive and breadth - first ) . Walking can be stopped or filtered
* based on the visit result returned .
* This is equivalent to { @ code walkEntityTree ( container , Integer . MAX _ VALUE , visitor ) }
* @ param container
* Entity container .
* @ ... | walkEntityTree ( container , Integer . MAX_VALUE , visitor ) ; |
public class EntityResource { /** * Gets the list of entities for a given entity type .
* @ param entityType name of a type which is unique */
public Response getEntityListByType ( String entityType ) { } } | try { Preconditions . checkNotNull ( entityType , "Entity type cannot be null" ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Fetching entity list for type={} " , entityType ) ; } final List < String > entityList = metadataService . getEntityList ( entityType ) ; JSONObject response = new JSONObject ( ) ; respons... |
public class ComponentStateHelper { /** * One and only implementation of
* save - state - makes all other implementations
* unnecessary .
* @ param context
* @ return the saved state */
public Object saveState ( FacesContext context ) { } } | if ( context == null ) { throw new NullPointerException ( ) ; } if ( component . initialStateMarked ( ) ) { return saveMap ( context , deltaMap ) ; } else { return saveMap ( context , defaultMap ) ; } |
public class Inputs { /** * Loads an { @ link Inputs } object from am XML file .
* @ param file
* @ return
* @ throws JAXBException */
public static Inputs load ( InputStream in ) throws JAXBException { } } | JAXBContext context = JAXBContext . newInstance ( Inputs . class , RF2Input . class , OWLInput . class ) ; Unmarshaller u = context . createUnmarshaller ( ) ; Inputs inputs = ( Inputs ) u . unmarshal ( in ) ; return inputs ; |
public class Property { /** * { @ inheritDoc } */
public void writeValue ( @ NotNull Object entity , @ Nullable Object value ) { } } | try { getWriteMethod ( ) . invoke ( entity , value ) ; } catch ( InvocationTargetException | IllegalAccessException e ) { LOGGER . warn ( "Can't invoker write method" , e ) ; } |
public class ComponentsInner { /** * Get status for an ongoing purge operation .
* @ param resourceGroupName The name of the resource group .
* @ param resourceName The name of the Application Insights component resource .
* @ param purgeId In a purge status request , this is the Id of the operation the status of... | return ServiceFuture . fromResponse ( getPurgeStatusWithServiceResponseAsync ( resourceGroupName , resourceName , purgeId ) , serviceCallback ) ; |
public class StringUtils { /** * Splits the input string with the given regex and filters empty strings .
* @ param input the string to split .
* @ return the array of strings computed by splitting this string */
public static String [ ] split ( String input , String regex ) { } } | if ( input == null ) { return null ; } String [ ] arr = input . split ( regex ) ; List < String > results = new ArrayList < > ( arr . length ) ; for ( String a : arr ) { if ( ! a . trim ( ) . isEmpty ( ) ) { results . add ( a ) ; } } return results . toArray ( new String [ 0 ] ) ; |
public class ComponentFactory { /** * Add a new component type to the factory . This method throws an exception
* if the class cannot be resolved . The name of the component IS NOT
* verified to allow component implementations to be overridden .
* @ param name
* @ param cls
* @ throws ClassNotFoundException *... | if ( locked ) { throw new IllegalStateException ( "Component factory is locked. Components cannot be added" ) ; } supported . put ( name , cls ) ; // add name to end of order vector
if ( ! order . contains ( name ) ) order . addElement ( name ) ; |
public class Mutations { /** * Concatenates this and other */
public Mutations < S > concat ( final Mutations < S > other ) { } } | return new MutationsBuilder < > ( alphabet , false ) . ensureCapacity ( this . size ( ) + other . size ( ) ) . append ( this ) . append ( other ) . createAndDestroy ( ) ; |
public class NetworkServiceRecordAgent { /** * Create a new PhysicalnetworkFunctionRecord and add it ot a NetworkServiceRecord .
* @ param idNsr the ID of the NetworkServiceRecord
* @ param physicalNetworkFunctionRecord the new PhysicalNetworkFunctionRecord
* @ return the new PhysicalNetworkFunctionRecord
* @ t... | String url = idNsr + "/pnfrecords" + "/" ; return ( PhysicalNetworkFunctionRecord ) requestPost ( url , physicalNetworkFunctionRecord ) ; |
public class TextBuilder { /** * Print a double to internal buffer or output ( os or writer )
* @ param d
* @ return this builder */
public final TextBuilder p ( double d ) { } } | if ( null != __buffer ) __append ( d ) ; else __caller . p ( d ) ; return this ; |
public class CmsCmisUtil { /** * Converts an OpenCms ACE to a list of basic CMIS permissions . < p >
* @ param ace the access control entry
* @ return the list of permissions */
public static List < String > getCmisPermissions ( CmsAccessControlEntry ace ) { } } | int permissionBits = ace . getPermissions ( ) . getPermissions ( ) ; List < String > result = new ArrayList < String > ( ) ; if ( 0 != ( permissionBits & CmsPermissionSet . PERMISSION_READ ) ) { result . add ( A_CmsCmisRepository . CMIS_READ ) ; } if ( 0 != ( permissionBits & CmsPermissionSet . PERMISSION_WRITE ) ) { r... |
public class ReferenceStream { /** * removeFirstMatching ( aka DestructiveGet ) .
* @ param filter
* @ param transaction
* must not be null .
* @ return Item may be null .
* @ throws { @ link MessageStoreException } if the item was spilled and could not
* be unspilled . Or if item not found in backing store... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "removeFirstMatching" , new Object [ ] { filter , transaction } ) ; ReferenceCollection ic = ( ( ReferenceCollection ) _getMembership ( ) ) ; ItemReference item = null ; if ( ic != null ) { item = ( ItemReference ) ic... |
public class AppServicePlansInner { /** * Get a Virtual Network associated with an App Service plan .
* Get a Virtual Network associated with an App Service plan .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the App Service plan .
* @ param vnetN... | return ServiceFuture . fromResponse ( getVnetFromServerFarmWithServiceResponseAsync ( resourceGroupName , name , vnetName ) , serviceCallback ) ; |
public class XScreenField { /** * Get the current string value in HTML . < p / >
* May want to check GetRootScreen ( ) . GetScreenType ( ) & INPUT / DISPLAY _ MODE
* @ param strFieldType The field type
* @ exception DBException File exception . */
public void printDisplayControl ( PrintWriter out , String strFiel... | if ( this . getScreenField ( ) . getConverter ( ) == null ) return ; String strData = Utility . encodeXML ( this . getScreenField ( ) . getSFieldValue ( true , false ) ) ; if ( ( strData == null ) || ( strData . length ( ) == 0 ) ) strData = DBConstants . BLANK ; // ? " < br > " ;
// + String strHyperlink = this . getS... |
public class DirectoryWatchService { /** * - - - - - private methods - - - - - */
private boolean handleWatchEvent ( final boolean registerWatchKey , final WatchEventItem item ) throws IOException { } } | final WatchEvent event = item . getEvent ( ) ; final Path root = item . getRoot ( ) ; final Path parent = item . getPath ( ) ; boolean result = true ; // default is " don ' t cancel watch key "
try ( final Tx tx = StructrApp . getInstance ( ) . tx ( ) ) { final Path path = parent . resolve ( ( Path ) event . context ( ... |
public class Matrix4d { /** * Apply rotation of < code > angles . x < / code > radians about the X axis , followed by a rotation of < code > angles . y < / code > radians about the Y axis and
* followed by a rotation of < code > angles . z < / code > radians about the Z axis .
* When used with a right - handed coor... | return rotateXYZ ( angles . x , angles . y , angles . z ) ; |
public class DataService { /** * Method to delete record for the given entity in asynchronous fashion
* @ param entity
* the entity
* @ param callbackHandler
* the callback handler
* @ throws FMSException */
public < T extends IEntity > void deleteAsync ( T entity , CallbackHandler callbackHandler ) throws FM... | IntuitMessage intuitMessage = prepareDelete ( entity ) ; // set callback handler
intuitMessage . getRequestElements ( ) . setCallbackHandler ( callbackHandler ) ; // execute async interceptors
executeAsyncInterceptors ( intuitMessage ) ; |
public class CommerceShipmentItemPersistenceImpl { /** * Returns a range of all the commerce shipment items .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result ... | return findAll ( start , end , null ) ; |
public class HttpInputStream { /** * Reads into an array of bytes until all requested bytes have been
* read or a ' \ n ' is encountered , in which case the ' \ n ' is read into
* the array as well .
* @ param b the buffer where data is stored
* @ param off the start offset of the data
* @ param len the lengt... | if ( TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { // 306998.15
logger . logp ( Level . FINE , CLASS_NAME , "readLine" , "readLine" ) ; } if ( total >= limit ) { if ( TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { // 306998.15
logger . logp ( ... |
public class KeyVaultClientBaseImpl { /** * Permanently deletes the specified storage account .
* The purge deleted storage account operation removes the secret permanently , without the possibility of recovery . This operation can only be performed on a soft - delete enabled vault . This operation requires the stora... | purgeDeletedStorageAccountWithServiceResponseAsync ( vaultBaseUrl , storageAccountName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class DateBuilder { /** * Returns a date that is rounded to the previous even hour below the given
* date .
* For example an input date with a time of 08:13:54 would result in a date
* with the time of 08:00:00.
* @ param date
* the Date to round , if < code > null < / code > the current time will be
... | final Calendar c = PDTFactory . createCalendar ( ) ; c . setTime ( date != null ? date : new Date ( ) ) ; c . set ( Calendar . MINUTE , 0 ) ; c . set ( Calendar . SECOND , 0 ) ; c . set ( Calendar . MILLISECOND , 0 ) ; return c . getTime ( ) ; |
public class Xoauth2Sasl { /** * Builds an XOAUTH2 SASL client response .
* According to https : / / developers . google . com / gmail / xoauth2 _ protocol the SASL XOAUTH2 initial
* client response has the following format :
* { @ code base64 ( " user = " { User } " ^ Aauth = Bearer " { Access Token } " ^ A ^ A ... | StringBuilder authString = new StringBuilder ( ) . append ( "user=" ) . append ( user ) . append ( ctrlA ) . append ( "auth=Bearer " ) . append ( accessToken ) . append ( ctrlA ) . append ( ctrlA ) ; return Base64 . encode ( authString . toString ( ) . getBytes ( ) ) ; |
public class TableModelUtils { /** * Convert database metaData to TableModels , note : < br / >
* 1 ) This method does not close connection , do not forgot close it later < br / >
* 2 ) This method does not read sequence , index , unique constraints */
public static TableModel [ ] db2Models ( Connection con , Diale... | return TableModelUtilsOfDb . db2Models ( con , dialect ) ; |
public class LofQuery { /** * { @ inheritDoc } */
@ Override public void execute ( TridentTuple tuple , String result , TridentCollector collector ) { } } | collector . emit ( new Values ( result ) ) ; |
public class RequestedGlobalProperties { /** * This method resets the properties to a state where no properties are given . */
public void reset ( ) { } } | this . partitioning = PartitioningProperty . RANDOM_PARTITIONED ; this . ordering = null ; this . partitioningFields = null ; this . dataDistribution = null ; this . customPartitioner = null ; |
public class MailSender { /** * 配置邮箱
* @ param mailHost 邮件服务器
* @ param personal 个人名称
* @ param from 发件箱
* @ param key 密码 */
public static void config ( MailHost mailHost , String personal , String from , String key ) { } } | setHost ( mailHost ) ; setPersonal ( personal ) ; setFrom ( from ) ; setKey ( key ) ; |
public class DoubleLinkedPoiCategory { /** * This method calculates a unique ID for all nodes in the tree . For each node ' s ' n ' ID named
* ' ID _ ' n at depth ' d ' the following invariants must be true :
* < ul >
* < li > ID > max ( ID of all child nodes ) < / li >
* < li > All nodes ' IDs left of n must b... | int newMax = maxValue ; for ( PoiCategory c : rootNode . childCategories ) { newMax = calculateCategoryIDs ( ( DoubleLinkedPoiCategory ) c , newMax ) ; } rootNode . id = newMax ; return newMax + 1 ; |
public class DeployTargetResolver { /** * Process user configuration of " projectId " . If set to GCLOUD _ CONFIG then read from gcloud ' s
* global state . If set but not a keyword then just return the set value . */
public String getProject ( String configString ) { } } | if ( configString == null || configString . trim ( ) . isEmpty ( ) || configString . equals ( APPENGINE_CONFIG ) ) { throw new GradleException ( PROJECT_ERROR ) ; } if ( configString . equals ( GCLOUD_CONFIG ) ) { try { String gcloudProject = cloudSdkOperations . getGcloud ( ) . getConfig ( ) . getProject ( ) ; if ( gc... |
public class ZWaveAlarmSensorCommandClass { /** * Gets a SerialMessage with the SENSOR _ ALARM _ GET command
* @ return the serial message */
public SerialMessage getMessage ( AlarmType alarmType ) { } } | logger . debug ( "Creating new message for application command SENSOR_ALARM_GET for node {}" , this . getNode ( ) . getNodeId ( ) ) ; SerialMessage result = new SerialMessage ( this . getNode ( ) . getNodeId ( ) , SerialMessage . SerialMessageClass . SendData , SerialMessage . SerialMessageType . Request , SerialMessag... |
public class ReflectionUtils { /** * Finds all declared fields in given < tt > clazz < / tt > and its super classes .
* @ param clazz
* @ return */
public static Field [ ] getDeclaredFieldsInHierarchy ( Class < ? > clazz ) { } } | List < Field > fields = new ArrayList < Field > ( ) ; for ( Class < ? > acls = clazz ; acls != null ; acls = acls . getSuperclass ( ) ) { for ( Field field : acls . getDeclaredFields ( ) ) { fields . add ( field ) ; } } return fields . toArray ( new Field [ fields . size ( ) ] ) ; |
public class GetLoadBalancersRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetLoadBalancersRequest getLoadBalancersRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getLoadBalancersRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getLoadBalancersRequest . getPageToken ( ) , PAGETOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: ... |
public class StandardHlsSettingsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( StandardHlsSettings standardHlsSettings , ProtocolMarshaller protocolMarshaller ) { } } | if ( standardHlsSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( standardHlsSettings . getAudioRenditionSets ( ) , AUDIORENDITIONSETS_BINDING ) ; protocolMarshaller . marshall ( standardHlsSettings . getM3u8Settings ( ) , M3U8SETT... |
public class FileGenerator { /** * XMLFilter methods */
@ Override public void endElement ( final String uri , final String localName , final String qName ) throws SAXException { } } | if ( ! ( DITA_OT_NS . equals ( uri ) && EXTENSION_ELEM . equals ( localName ) ) ) { getContentHandler ( ) . endElement ( uri , localName , qName ) ; } |
public class Metric { /** * Adds a value to the list of values .
* @ param value The value to add to the list of values */
public void addValue ( String value ) { } } | if ( this . values == null ) this . values = new ArrayList < String > ( ) ; this . values . add ( value ) ; |
public class ComparatorCompat { /** * Adds the comparator , that uses a function for extract
* a { @ link java . lang . Comparable } sort key , to the chain .
* @ param < U > the type of the sort key
* @ param keyExtractor the function that extracts the sort key
* @ return the new { @ code ComparatorCompat } in... | return thenComparing ( comparing ( keyExtractor ) ) ; |
public class Client { /** * Sends a CSR to the SCEP server for enrolling in a PKI .
* This method enrols the provider < tt > CertificationRequest < / tt > into the
* PKI represented by the SCEP server .
* @ param identity
* the identity of the client .
* @ param key
* the private key to sign the SCEP reques... | LOGGER . debug ( "Enrolling certificate with CA" ) ; if ( isSelfSigned ( identity ) ) { LOGGER . debug ( "Certificate is self-signed" ) ; X500Name csrSubject = csr . getSubject ( ) ; X500Name idSubject = X500Utils . toX500Name ( identity . getSubjectX500Principal ( ) ) ; if ( ! csrSubject . equals ( idSubject ) ) { LOG... |
public class BackendBucketClient { /** * Deletes the specified BackendBucket resource .
* < p > Sample code :
* < pre > < code >
* try ( BackendBucketClient backendBucketClient = BackendBucketClient . create ( ) ) {
* ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName . of ( " [ PROJE... | DeleteBackendBucketHttpRequest request = DeleteBackendBucketHttpRequest . newBuilder ( ) . setBackendBucket ( backendBucket == null ? null : backendBucket . toString ( ) ) . build ( ) ; return deleteBackendBucket ( request ) ; |
public class BeetlUtil { /** * 判断一个路径是否指到外部了 , 比如 . . / . . / test . txt就指到外部
* @ param child
* @ return */
public static boolean isOutsideOfRoot ( String child ) { } } | if ( child == null ) return true ; char [ ] array = child . toCharArray ( ) ; int root = 0 ; if ( array . length == 0 ) return true ; int start = 0 ; if ( array [ 0 ] == '/' || array [ 0 ] == '\\' ) { start = 1 ; } StringBuilder dir = new StringBuilder ( ) ; for ( int i = start ; i < array . length ; i ++ ) { char c = ... |
public class VersionUtil { /** * 获取下一个版本
* @ param nextVersionClass
* @ param current
* @ return
* @ throws VersionException */
public static Object nextVersion ( Class < ? extends NextVersion > nextVersionClass , Object current ) throws VersionException { } } | try { NextVersion nextVersion ; if ( CACHE . containsKey ( nextVersionClass ) ) { nextVersion = CACHE . get ( nextVersionClass ) ; } else { LOCK . lock ( ) ; try { if ( ! CACHE . containsKey ( nextVersionClass ) ) { CACHE . put ( nextVersionClass , nextVersionClass . newInstance ( ) ) ; } nextVersion = CACHE . get ( ne... |
public class LicenseKeyFilter { /** * Adds the License key to the client request .
* @ param request The client request */
public void filter ( ClientRequestContext request ) throws IOException { } } | if ( ! request . getHeaders ( ) . containsKey ( "X-License-Key" ) ) request . getHeaders ( ) . add ( "X-License-Key" , this . licensekey ) ; |
public class ExportImportHelper { public void exportTo ( OutputStream stream ) { } } | XStream xStream = createXStream ( ) ; xStream . toXML ( dataSets , stream ) ; logger . info ( "Exported to Stream: size=[{}] keys={}" , dataSets . size ( ) , dataSets . keySet ( ) ) ; |
public class XMLUtil { /** * Replies the color that corresponds to the specified attribute ' s path .
* < p > The path is an ordered list of tag ' s names and ended by the name of
* the attribute .
* Be careful about the fact that the names are case sensitives .
* @ param document is the XML document to explore... | assert document != null : AssertMessages . notNullParameter ( 0 ) ; return getAttributeColorWithDefault ( document , true , 0 , path ) ; |
public class ExpandableRecyclerAdapter { /** * Given the index relative to the entire RecyclerView for a child item ,
* returns the child position within the child list of the parent . */
@ UiThread int getChildPosition ( int flatPosition ) { } } | if ( flatPosition == 0 ) { return 0 ; } int childCount = 0 ; for ( int i = 0 ; i < flatPosition ; i ++ ) { ExpandableWrapper < P , C > listItem = mFlatItemList . get ( i ) ; if ( listItem . isParent ( ) ) { childCount = 0 ; } else { childCount ++ ; } } return childCount ; |
public class NamespaceNotifierClient { /** * Called right after a reconnect to resubscribe to all events . Must be
* called with the connection lock acquired . */
private boolean resubscribe ( ) throws TransactionIdTooOldException , InterruptedException { } } | for ( NamespaceEventKey eventKey : watchedEvents . keySet ( ) ) { NamespaceEvent event = eventKey . getEvent ( ) ; if ( ! subscribe ( event . getPath ( ) , EventType . fromByteValue ( event . getType ( ) ) , watchedEvents . get ( eventKey ) ) ) { return false ; } } return true ; |
public class LangPropsService { /** * Gets a value from { @ link org . b3log . latke . Latkes # getLocale ( ) the current locale } specified language properties
* file with the specified key .
* @ param key the specified key
* @ return value */
public String get ( final String key ) { } } | return get ( Keys . LANGUAGE , key , Locales . getLocale ( ) ) ; |
public class SerialInterrupt { /** * Java consumer code can all this method to register itself as a listener for pin state
* changes .
* @ see com . pi4j . jni . SerialInterruptListener
* @ see com . pi4j . jni . SerialInterruptEvent
* @ param fileDescriptor the serial file descriptor / handle
* @ param liste... | if ( ! listeners . containsKey ( fileDescriptor ) ) { listeners . put ( fileDescriptor , listener ) ; enableSerialDataReceiveCallback ( fileDescriptor ) ; } |
public class DecomposeHomography { /** * W = [ H * a , H * b , hat ( H * a ) * H * b ] */
private void setW ( DMatrixRMaj W , DMatrixRMaj H , Vector3D_F64 a , Vector3D_F64 b ) { } } | GeometryMath_F64 . mult ( H , b , tempV ) ; setColumn ( W , 1 , tempV ) ; GeometryMath_F64 . mult ( H , a , tempV ) ; setColumn ( W , 0 , tempV ) ; GeometryMath_F64 . crossMatrix ( tempV , Hv2 ) ; CommonOps_DDRM . mult ( Hv2 , H , tempM ) ; GeometryMath_F64 . mult ( tempM , b , tempV ) ; setColumn ( W , 2 , tempV ) ; |
public class SailthruClient { /** * Delete existing blast
* @ param blastId
* @ throws IOException */
public JsonResponse deleteBlast ( Integer blastId ) throws IOException { } } | Blast blast = new Blast ( ) ; blast . setBlastId ( blastId ) ; return apiDelete ( blast ) ; |
public class XMLConfigAdmin { /** * remove a CFX Tag
* @ param name
* @ throws ExpressionException
* @ throws SecurityException */
public void removeCFX ( String name ) throws ExpressionException , SecurityException { } } | checkWriteAccess ( ) ; // check parameters
if ( name == null || name . length ( ) == 0 ) throw new ExpressionException ( "name for CFX Tag can be a empty value" ) ; renameOldstyleCFX ( ) ; Element mappings = _getRootElement ( "ext-tags" ) ; Element [ ] children = XMLConfigWebFactory . getChildren ( mappings , "ext-tag"... |
public class JumboCyclicVertexSearch { /** * AND the to bit sets together and return the result . Neither input is
* modified .
* @ param x first bit set
* @ param y second bit set
* @ return the AND of the two bit sets */
static BitSet and ( BitSet x , BitSet y ) { } } | BitSet z = copy ( x ) ; z . and ( y ) ; return z ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.