signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class AbstractCheck { /** * Check if any element of the given set has changed . */ private boolean hasHashChanged ( Set < RegData > regData ) { } }
for ( RegData el : regData ) { if ( hasHashChanged ( mHasher , el ) ) { return true ; } } return false ;
public class Flowable { /** * Retries until the given stop function returns true . * < dl > * < dt > < b > Backpressure : < / b > < / dt > * < dd > The operator honors downstream backpressure and expects the source { @ code Publisher } to honor backpressure as well . * If this expectation is violated , the operator < em > may < / em > throw an { @ code IllegalStateException } . < / dd > * < dt > < b > Scheduler : < / b > < / dt > * < dd > { @ code retryUntil } does not operate by default on a particular { @ link Scheduler } . < / dd > * < / dl > * @ param stop the function that should return true to stop retrying * @ return the new Flowable instance */ @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > retryUntil ( final BooleanSupplier stop ) { } }
ObjectHelper . requireNonNull ( stop , "stop is null" ) ; return retry ( Long . MAX_VALUE , Functions . predicateReverseFor ( stop ) ) ;
public class LToIntTriFunctionBuilder { /** * One of ways of creating builder . In most cases ( considering all _ functional _ builders ) it requires to provide generic parameters ( in most cases redundantly ) */ @ Nonnull public static < T1 , T2 , T3 > LToIntTriFunctionBuilder < T1 , T2 , T3 > toIntTriFunction ( ) { } }
return new LToIntTriFunctionBuilder ( ) ;
public class Text { /** * Escapes all illegal JCR name characters of a string . The encoding is loosely modeled after URI * encoding , but only encodes the characters it absolutely needs to in order to make the resulting * string a valid JCR name . Use { @ link # unescapeIllegalJcrChars ( String ) } for decoding . < br > QName * EBNF : < br > * { @ code * < xmp > simplename : : = onecharsimplename | twocharsimplename | threeormorecharname * onecharsimplename : : = ( * Any Unicode character except : ' . ' , ' / ' , ' : ' , ' [ ' , ' ] ' , ' * ' , ' ' ' , ' " ' , * ' | ' or any whitespace character * ) twocharsimplename : : = ' . ' onecharsimplename | * onecharsimplename ' . ' | onecharsimplename onecharsimplename threeormorecharname : : = nonspace * string nonspace string : : = char | string char char : : = nonspace | ' ' nonspace : : = ( * Any * Unicode character except : ' / ' , ' : ' , ' [ ' , ' ] ' , ' * ' , ' ' ' , ' " ' , ' | ' or any whitespace character * ) * < / xmp > * @ param name * the name to escape * @ return the escaped name */ public static String escapeIllegalJcrChars ( String name ) { } }
StringBuilder buffer = new StringBuilder ( name . length ( ) * 2 ) ; for ( int i = 0 ; i < name . length ( ) ; i ++ ) { char ch = name . charAt ( i ) ; if ( ch == '%' || ch == '/' || ch == ':' || ch == '[' || ch == ']' || ch == '*' || ch == '\'' || ch == '"' || ch == '|' || ( ch == '.' && name . length ( ) < 3 ) || ( ch == ' ' && ( i == 0 || i == name . length ( ) - 1 ) ) || ch == '\t' || ch == '\r' || ch == '\n' ) { buffer . append ( '%' ) ; buffer . append ( Character . toUpperCase ( Character . forDigit ( ch / 16 , 16 ) ) ) ; buffer . append ( Character . toUpperCase ( Character . forDigit ( ch % 16 , 16 ) ) ) ; } else { buffer . append ( ch ) ; } } return buffer . toString ( ) ;
public class PrimitiveBuilder { /** * Builds a new instance of the primitive . * The returned instance will be distinct from all other instances of the same primitive on this node , with a * distinct session , ordering guarantees , memory , etc . * @ return a new instance of the primitive */ @ Override public P build ( ) { } }
try { return buildAsync ( ) . join ( ) ; } catch ( Exception e ) { if ( e instanceof CompletionException && e . getCause ( ) instanceof RuntimeException ) { throw ( RuntimeException ) e . getCause ( ) ; } else { throw e ; } }
public class LatLong { /** * Constructs a new LatLong from a comma - separated String containing latitude and * longitude values ( also ' ; ' , ' : ' and whitespace work as separator ) . * Latitude and longitude are interpreted as measured in degrees . * @ param latLonString the String containing the latitude and longitude values * @ return the LatLong * @ throws IllegalArgumentException if the latLonString could not be interpreted as a coordinate */ public static LatLong fromString ( String latLonString ) { } }
String [ ] split = latLonString . split ( "[,;:\\s]" ) ; if ( split . length != 2 ) throw new IllegalArgumentException ( "cannot read coordinate, not a valid format" ) ; double latitude = Double . parseDouble ( split [ 0 ] ) ; double longitude = Double . parseDouble ( split [ 1 ] ) ; return new LatLong ( latitude , longitude ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link SalesRep } { @ code > } } */ @ XmlElementDecl ( namespace = "http://schema.intuit.com/finance/v3" , name = "SalesRep" , substitutionHeadNamespace = "http://schema.intuit.com/finance/v3" , substitutionHeadName = "IntuitObject" ) public JAXBElement < SalesRep > createSalesRep ( SalesRep value ) { } }
return new JAXBElement < SalesRep > ( _SalesRep_QNAME , SalesRep . class , null , value ) ;
public class AutoMlClient { /** * Lists table specs in a dataset . * < p > Sample code : * < pre > < code > * try ( AutoMlClient autoMlClient = AutoMlClient . create ( ) ) { * DatasetName parent = DatasetName . of ( " [ PROJECT ] " , " [ LOCATION ] " , " [ DATASET ] " ) ; * for ( TableSpec element : autoMlClient . listTableSpecs ( parent ) . iterateAll ( ) ) { * / / doThingsWith ( element ) ; * < / code > < / pre > * @ param parent The resource name of the dataset to list table specs from . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ public final ListTableSpecsPagedResponse listTableSpecs ( DatasetName parent ) { } }
ListTableSpecsRequest request = ListTableSpecsRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . build ( ) ; return listTableSpecs ( request ) ;
public class FTPFileSystem { /** * Convenience method , so that we don ' t open a new connection when using this * method from within another method . Otherwise every API invocation incurs * the overhead of opening / closing a TCP connection . */ private FileStatus [ ] listStatus ( FTPClient client , Path file ) throws IOException { } }
Path workDir = new Path ( client . printWorkingDirectory ( ) ) ; Path absolute = makeAbsolute ( workDir , file ) ; FileStatus fileStat = getFileStatus ( client , absolute ) ; if ( ! fileStat . isDir ( ) ) { return new FileStatus [ ] { fileStat } ; } FTPFile [ ] ftpFiles = client . listFiles ( absolute . toUri ( ) . getPath ( ) ) ; FileStatus [ ] fileStats = new FileStatus [ ftpFiles . length ] ; for ( int i = 0 ; i < ftpFiles . length ; i ++ ) { fileStats [ i ] = getFileStatus ( ftpFiles [ i ] , absolute ) ; } return fileStats ;
public class ExpressionUtils { /** * Create a { @ code count ( source ) } expression * @ param source source * @ return count ( source ) */ public static Expression < Long > count ( Expression < ? > source ) { } }
return operation ( Long . class , Ops . AggOps . COUNT_AGG , source ) ;
public class CmsObject { /** * This method works just like { @ link CmsObject # adjustLinks ( String , String ) } , but instead of specifying * a single source and target folder , you can specify multiple sources and the corresponding targets in * a map of strings . * @ param sourceTargetMap a map with the source files as keys and the corresponding targets as values * @ param targetParentFolder the folder into which the source files have been copied * @ throws CmsException if something goes wrong */ public void adjustLinks ( Map < String , String > sourceTargetMap , String targetParentFolder ) throws CmsException { } }
CmsObject cms = OpenCms . initCmsObject ( this ) ; cms . getRequestContext ( ) . setSiteRoot ( "" ) ; List < CmsPair < String , String > > sourcesAndTargets = new ArrayList < CmsPair < String , String > > ( ) ; for ( Map . Entry < String , String > entry : sourceTargetMap . entrySet ( ) ) { String rootSource = addSiteRoot ( entry . getKey ( ) ) ; String rootTarget = addSiteRoot ( entry . getValue ( ) ) ; sourcesAndTargets . add ( CmsPair . create ( rootSource , rootTarget ) ) ; } String rootTargetParentFolder = addSiteRoot ( targetParentFolder ) ; CmsLinkRewriter rewriter = new CmsLinkRewriter ( cms , rootTargetParentFolder , sourcesAndTargets ) ; rewriter . rewriteLinks ( ) ;
public class State { /** * Get the value of a property as a list of strings , using the given default value if the property is not set . * @ param key property key * @ param def default value * @ return value ( the default value if the property is not set ) associated with the key as a list of strings */ public List < String > getPropAsList ( String key , String def ) { } }
return LIST_SPLITTER . splitToList ( getProp ( key , def ) ) ;
public class StandardMessageResolver { /** * Resolve messages for a specific origin and locale . * This is meant to be overridden by subclasses if necessary , so that the way in which messages * are obtained for a specific origin can be modified without changing the rest of the * message resolution mechanisms . * The standard mechanism will look for files in the classpath ( only classpath ) , * at the same package and with the same name as the origin class , with { @ code . properties } * extension . * @ param origin the origin * @ param locale the locale * @ return a Map containing all the possible messages for the specified origin and locale . Can return null . */ protected Map < String , String > resolveMessagesForOrigin ( final Class < ? > origin , final Locale locale ) { } }
return StandardMessageResolutionUtils . resolveMessagesForOrigin ( origin , locale ) ;
public class JavaRNG { /** * Helper method to convert seed bytes into the long value required by the * super class . */ private static long createLongSeed ( byte [ ] seed ) { } }
if ( seed == null || seed . length != SEED_SIZE_BYTES ) { throw new IllegalArgumentException ( "Java RNG requires a 64-bit (8-byte) seed." ) ; } return BinaryUtils . convertBytesToLong ( seed , 0 ) ;
public class MembershipTypeHandlerImpl { /** * Notifying listeners before membership type deletion . * @ param type * the membership which is used in delete operation * @ throws Exception * if any listener failed to handle the event */ private void preDelete ( MembershipType type ) throws Exception { } }
for ( MembershipTypeEventListener listener : listeners ) { listener . preDelete ( type ) ; }
public class JimfsFileSystems { /** * Creates the default view of the file system using the given working directory . */ private static FileSystemView createDefaultView ( Configuration config , JimfsFileStore fileStore , PathService pathService ) throws IOException { } }
JimfsPath workingDirPath = pathService . parsePath ( config . workingDirectory ) ; Directory dir = fileStore . getRoot ( workingDirPath . root ( ) ) ; if ( dir == null ) { throw new IllegalArgumentException ( "Invalid working dir path: " + workingDirPath ) ; } for ( Name name : workingDirPath . names ( ) ) { Directory newDir = fileStore . directoryCreator ( ) . get ( ) ; fileStore . setInitialAttributes ( newDir ) ; dir . link ( name , newDir ) ; dir = newDir ; } return new FileSystemView ( fileStore , dir , workingDirPath ) ;
public class StyleUtils { /** * Create new polygon options populated with the feature row style * @ param geoPackage GeoPackage * @ param featureRow feature row * @ param density display density : { @ link android . util . DisplayMetrics # density } * @ return polygon options populated with the feature style */ public static PolygonOptions createPolygonOptions ( GeoPackage geoPackage , FeatureRow featureRow , float density ) { } }
PolygonOptions polygonOptions = new PolygonOptions ( ) ; setFeatureStyle ( polygonOptions , geoPackage , featureRow , density ) ; return polygonOptions ;
public class ZPoller { /** * Register a Socket for polling on specified events . * @ param socket the registering socket . * @ param handler the events handler for this socket * @ param events the events to listen to , as a mask composed by ORing POLLIN , POLLOUT and POLLERR . * @ return true if registered , otherwise false */ public final boolean register ( final Socket socket , final EventsHandler handler , final int events ) { } }
if ( socket == null ) { return false ; } return add ( socket , create ( socket , handler , events ) ) ;
public class AWSStorageGatewayClient { /** * Sends you notification through CloudWatch Events when all files written to your NFS file share have been uploaded * to Amazon S3. * AWS Storage Gateway can send a notification through Amazon CloudWatch Events when all files written to your file * share up to that point in time have been uploaded to Amazon S3 . These files include files written to the NFS file * share up to the time that you make a request for notification . When the upload is done , Storage Gateway sends you * notification through an Amazon CloudWatch Event . You can configure CloudWatch Events to send the notification * through event targets such as Amazon SNS or AWS Lambda function . This operation is only supported for file * gateways . * For more information , see Getting File Upload Notification in the Storage Gateway User Guide * ( https : / / docs . aws . amazon * . com / storagegateway / latest / userguide / monitoring - file - gateway . html # get - upload - notification ) . * @ param notifyWhenUploadedRequest * @ return Result of the NotifyWhenUploaded operation returned by the service . * @ throws InvalidGatewayRequestException * An exception occurred because an invalid gateway request was issued to the service . For more information , * see the error and message fields . * @ throws InternalServerErrorException * An internal server error has occurred during the request . For more information , see the error and message * fields . * @ sample AWSStorageGateway . NotifyWhenUploaded * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / storagegateway - 2013-06-30 / NotifyWhenUploaded " * target = " _ top " > AWS API Documentation < / a > */ @ Override public NotifyWhenUploadedResult notifyWhenUploaded ( NotifyWhenUploadedRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeNotifyWhenUploaded ( request ) ;
public class Node { /** * Provides a collection of all the nodes in the tree * using a breadth - first traversal . * @ return the list of ( breadth - first ) ordered nodes */ public List breadthFirst ( ) { } }
List answer = new NodeList ( ) ; answer . add ( this ) ; answer . addAll ( breadthFirstRest ( ) ) ; return answer ;
public class SingletonLaContainerFactory { protected static void showBoot ( ) { } }
logger . info ( "Lasta Di boot successfully." ) ; logger . info ( " SmartDeploy Mode: {}" , SmartDeployUtil . getDeployMode ( container ) ) ; if ( getContainer ( ) . hasComponentDef ( NamingConvention . class ) ) { // just in case final NamingConvention convention = getContainer ( ) . getComponent ( NamingConvention . class ) ; final StringBuilder sb = new StringBuilder ( ) ; for ( String rootPkg : convention . getRootPackageNames ( ) ) { if ( sb . length ( ) > 0 ) { sb . append ( ", " ) ; } sb . append ( rootPkg ) ; } logger . info ( " Smart Package: {}" , sb . toString ( ) ) ; }
public class Message { /** * Serialize this message to the provided OutputStream using the bitcoin wire format . * @ param stream * @ throws IOException */ public final void bitcoinSerialize ( OutputStream stream ) throws IOException { } }
// 1st check for cached bytes . if ( payload != null && length != UNKNOWN_LENGTH ) { stream . write ( payload , offset , length ) ; return ; } bitcoinSerializeToStream ( stream ) ;
public class EncodingInfo { /** * This is heart of the code that determines if a given high / low * surrogate pair forms a character that is in the given encoding . * This method is probably expensive , and the answer should be cached . * This method is not a public API , * and should only be used internally within the serializer . * @ param high the high char of * a high / low surrogate pair . * @ param low the low char of a high / low surrogate pair . * @ param encoding the Java name of the encoding . * @ xsl . usage internal */ private static boolean inEncoding ( char high , char low , String encoding ) { } }
boolean isInEncoding ; try { char cArray [ ] = new char [ 2 ] ; cArray [ 0 ] = high ; cArray [ 1 ] = low ; // Construct a String from the char String s = new String ( cArray ) ; // Encode the String into a sequence of bytes // using the given , named charset . byte [ ] bArray = s . getBytes ( encoding ) ; isInEncoding = inEncoding ( high , bArray ) ; } catch ( Exception e ) { isInEncoding = false ; } return isInEncoding ;
public class StringUtils { /** * Find the last occurrence . * @ param container the string on which we search * @ param charSeq the string which we search for the occurrence * @ param begin the start position in container to search from * @ return the position where charSeq occurs for the last time in container ( from right to left ) . */ public static int findLastOf ( String container , String charSeq , int begin ) { } }
// find the last occurrence of one of characters in charSeq from begin backward for ( int i = begin ; i < container . length ( ) && i >= 0 ; -- i ) { if ( charSeq . contains ( "" + container . charAt ( i ) ) ) return i ; } return - 1 ;
public class Query { /** * < pre > * { field : < field > , op : < op > , rvalue : < value > } * < / pre > */ public static Query withValue ( String field , BinOp op , Object value ) { } }
return withValue ( field , op , Literal . value ( value ) ) ;
public class StreamDescription { /** * The shards that comprise the stream . * @ param shards * The shards that comprise the stream . */ public void setShards ( java . util . Collection < Shard > shards ) { } }
if ( shards == null ) { this . shards = null ; return ; } this . shards = new com . amazonaws . internal . SdkInternalList < Shard > ( shards ) ;
public class HtmlBuilder { /** * Adds a CSS StyleSheet link . */ private T cssResource ( String path ) throws IOException { } }
return ( T ) write ( "<link href=\"../resource/" ) . write ( path ) . write ( "\" rel=\"stylesheet\" type=\"text/css\" />" ) ;
public class IoUtil { /** * 将 { @ link InputStream } 转换为支持mark标记的流 < br > * 若原流支持mark标记 , 则返回原流 , 否则使用 { @ link BufferedInputStream } 包装之 * @ param in 流 * @ return { @ link InputStream } * @ since 4.0.9 */ public static InputStream toMarkSupportStream ( InputStream in ) { } }
if ( null == in ) { return null ; } if ( false == in . markSupported ( ) ) { return new BufferedInputStream ( in ) ; } return in ;
public class LogNormalDistributionTypeImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case BpsimPackage . LOG_NORMAL_DISTRIBUTION_TYPE__MEAN : return isSetMean ( ) ; case BpsimPackage . LOG_NORMAL_DISTRIBUTION_TYPE__STANDARD_DEVIATION : return isSetStandardDeviation ( ) ; } return super . eIsSet ( featureID ) ;
public class Strings { /** * Splits string into not empty , trimmed items , using specified separator ( s ) or space if no separator provided . Please * note that returned list does not contain empty items and that all items are trimmed using standard * { @ link String # trim ( ) } . * Returns null if string argument is null and empty list if is empty . This method supports a variable number of * separator characters - as accepted by { @ link # isSeparator ( char , char . . . ) } predicate ; if none given uses space . * @ param string source string , * @ param separators variable number of characters used as separators . * @ return strings list , possible empty . */ public static List < String > split ( String string , char ... separators ) { } }
if ( string == null ) { return null ; } class ItemsList { List < String > list = new ArrayList < String > ( ) ; void add ( StringBuilder wordBuilder ) { String value = wordBuilder . toString ( ) . trim ( ) ; if ( ! value . isEmpty ( ) ) { list . add ( value ) ; } } } ItemsList itemsList = new ItemsList ( ) ; StringBuilder itemBuilder = new StringBuilder ( ) ; for ( int i = 0 ; i < string . length ( ) ; ++ i ) { char c = string . charAt ( i ) ; // append to on building item all characters that are not separators if ( ! isSeparator ( c , separators ) ) { itemBuilder . append ( c ) ; } // if separator found add item to list and reset builder if ( itemBuilder . length ( ) > 0 ) { if ( isSeparator ( c , separators ) ) { itemsList . add ( itemBuilder ) ; itemBuilder . setLength ( 0 ) ; } } } itemsList . add ( itemBuilder ) ; return itemsList . list ;
public class VictimsSqlDB { /** * Remove all records matching the records in the given { @ link RecordStream } * if it exists . * @ param recordStream * @ throws SQLException * @ throws IOException */ protected int remove ( Connection connection , RecordStream recordStream ) throws SQLException , IOException { } }
int count = 0 ; PreparedStatement ps = statement ( connection , Query . DELETE_RECORD_HASH ) ; while ( recordStream . hasNext ( ) ) { VictimsRecord vr = recordStream . getNext ( ) ; setObjects ( ps , vr . hash ) ; ps . addBatch ( ) ; count ++ ; } executeBatchAndClose ( ps ) ; return count ;
public class CommercePaymentMethodGroupRelLocalServiceBaseImpl { /** * Returns a range of all the commerce payment method group rels . * Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link com . liferay . commerce . payment . model . impl . CommercePaymentMethodGroupRelModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order . * @ param start the lower bound of the range of commerce payment method group rels * @ param end the upper bound of the range of commerce payment method group rels ( not inclusive ) * @ return the range of commerce payment method group rels */ @ Override public List < CommercePaymentMethodGroupRel > getCommercePaymentMethodGroupRels ( int start , int end ) { } }
return commercePaymentMethodGroupRelPersistence . findAll ( start , end ) ;
public class DirRecord { /** * Return true if the record contains all of the values of the given * attribute . * @ param attr Attribute we ' re looking for * @ return boolean true if we found it * @ throws NamingException */ public boolean contains ( Attribute attr ) throws NamingException { } }
if ( attr == null ) { return false ; // protect } Attribute recAttr = getAttributes ( ) . get ( attr . getID ( ) ) ; if ( recAttr == null ) { return false ; } NamingEnumeration ne = attr . getAll ( ) ; while ( ne . hasMore ( ) ) { if ( ! recAttr . contains ( ne . next ( ) ) ) { return false ; } } return true ;
public class LEInputStream { /** * Read an array of 32bit words . * @ param length * size of the array ( in 32bit word count , not byte count ) * @ return the array of 32bit words * @ throws IOException */ public int [ ] readIntArray ( int length ) throws IOException { } }
int arr [ ] = new int [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { arr [ i ] = readInt ( ) ; } return arr ;
public class Hash { /** * We don ' t have Guava here */ private static String bytesToHex ( byte [ ] bytes ) { } }
char [ ] hexChars = new char [ bytes . length * 2 ] ; for ( int i = 0 ; i < bytes . length ; i ++ ) { int v = bytes [ i ] & 0xFF ; hexChars [ i * 2 ] = hexArray [ v >>> 4 ] ; hexChars [ i * 2 + 1 ] = hexArray [ v & 0x0F ] ; } return new String ( hexChars ) ;
public class CleverTapAPI { /** * only call async */ private void updateLocalStore ( final Context context , final JSONObject event , final int type ) { } }
if ( type == Constants . RAISED_EVENT ) { getLocalDataStore ( ) . persistEvent ( context , event , type ) ; }
public class SqlValidatorImpl { /** * Validates access to a table . * @ param table Table * @ param requiredAccess Access requested on table */ private void validateAccess ( SqlNode node , SqlValidatorTable table , SqlAccessEnum requiredAccess ) { } }
if ( table != null ) { SqlAccessType access = table . getAllowedAccess ( ) ; if ( ! access . allowsAccess ( requiredAccess ) ) { throw newValidationError ( node , RESOURCE . accessNotAllowed ( requiredAccess . name ( ) , table . getQualifiedName ( ) . toString ( ) ) ) ; } }
public class gslbconfig { /** * Use this API to sync gslbconfig . */ public static base_response sync ( nitro_service client , gslbconfig resource ) throws Exception { } }
gslbconfig syncresource = new gslbconfig ( ) ; syncresource . preview = resource . preview ; syncresource . debug = resource . debug ; syncresource . forcesync = resource . forcesync ; syncresource . nowarn = resource . nowarn ; syncresource . saveconfig = resource . saveconfig ; syncresource . command = resource . command ; return syncresource . perform_operation ( client , "sync" ) ;
public class CompositeELResolver { /** * For a given base and property , attempts to identify the most general type that is acceptable * for an object to be passed as the value parameter in a future call to the * { @ link # setValue ( ELContext , Object , Object , Object ) } method . The result is obtained by * querying all component resolvers . If this resolver handles the given ( base , property ) pair , * the propertyResolved property of the ELContext object must be set to true by the resolver , * before returning . If this property is not true after this method is called , the caller should * ignore the return value . First , propertyResolved is set to false on the provided ELContext . * Next , for each component resolver in this composite : * < ol > * < li > The getType ( ) method is called , passing in the provided context , base and property . < / li > * < li > If the ELContext ' s propertyResolved flag is false then iteration continues . < / li > * < li > Otherwise , iteration stops and no more component resolvers are considered . The value * returned by getType ( ) is returned by this method . < / li > * < / ol > * If none of the component resolvers were able to perform this operation , the value null is * returned and the propertyResolved flag remains set to false . Any exception thrown by * component resolvers during the iteration is propagated to the caller of this method . * @ param context * The context of this evaluation . * @ param base * The base object to return the most general property type for , or null to enumerate * the set of top - level variables that this resolver can evaluate . * @ param property * The property or variable to return the acceptable type for . * @ return If the propertyResolved property of ELContext was set to true , then the most general * acceptable type ; otherwise undefined . * @ throws NullPointerException * if context is null * @ throws PropertyNotFoundException * if base is not null and the specified property does not exist or is not readable . * @ throws ELException * if an exception was thrown while performing the property or variable resolution . * The thrown exception must be included as the cause property of this exception , if * available . */ @ Override public Class < ? > getType ( ELContext context , Object base , Object property ) { } }
context . setPropertyResolved ( false ) ; for ( int i = 0 , l = resolvers . size ( ) ; i < l ; i ++ ) { Class < ? > type = resolvers . get ( i ) . getType ( context , base , property ) ; if ( context . isPropertyResolved ( ) ) { return type ; } } return null ;
public class GrapesClient { /** * Return the list of module dependencies * @ param moduleName * @ param moduleVersion * @ param fullRecursive * @ param corporate * @ param thirdParty * @ return List < Dependency > * @ throws GrapesCommunicationException */ public List < Dependency > getModuleDependencies ( final String moduleName , final String moduleVersion , final Boolean fullRecursive , final Boolean corporate , final Boolean thirdParty ) throws GrapesCommunicationException { } }
final Client client = getClient ( ) ; final WebResource resource = client . resource ( serverURL ) . path ( RequestUtils . getArtifactDependencies ( moduleName , moduleVersion ) ) ; final ClientResponse response = resource . queryParam ( ServerAPI . SCOPE_COMPILE_PARAM , "true" ) . queryParam ( ServerAPI . SCOPE_PROVIDED_PARAM , "true" ) . queryParam ( ServerAPI . SCOPE_RUNTIME_PARAM , "true" ) . queryParam ( ServerAPI . SCOPE_TEST_PARAM , "true" ) . queryParam ( ServerAPI . RECURSIVE_PARAM , fullRecursive . toString ( ) ) . queryParam ( ServerAPI . SHOW_CORPORATE_PARAM , corporate . toString ( ) ) . queryParam ( ServerAPI . SHOW_THIRPARTY_PARAM , thirdParty . toString ( ) ) . accept ( MediaType . APPLICATION_JSON ) . get ( ClientResponse . class ) ; client . destroy ( ) ; if ( ClientResponse . Status . OK . getStatusCode ( ) != response . getStatus ( ) ) { final String message = String . format ( FAILED_TO_GET_MODULE , "get module ancestors " , moduleName , moduleVersion ) ; if ( LOG . isErrorEnabled ( ) ) { LOG . error ( String . format ( HTTP_STATUS_TEMPLATE_MSG , message , response . getStatus ( ) ) ) ; } throw new GrapesCommunicationException ( message , response . getStatus ( ) ) ; } return response . getEntity ( new GenericType < List < Dependency > > ( ) { } ) ;
public class ReportMaker { /** * Generate the HTML catalog report from a newly compiled VoltDB catalog */ public static String report ( Catalog catalog , long minHeap , boolean isPro , int hostCount , int sitesPerHost , int kfactor , ArrayList < Feedback > warnings , String autoGenDDL ) throws IOException { } }
// asynchronously get platform properties new Thread ( ) { @ Override public void run ( ) { PlatformProperties . getPlatformProperties ( ) ; } } . start ( ) ; URL url = Resources . getResource ( ReportMaker . class , "template.html" ) ; String contents = Resources . toString ( url , Charsets . UTF_8 ) ; Cluster cluster = catalog . getClusters ( ) . get ( "cluster" ) ; assert ( cluster != null ) ; Database db = cluster . getDatabases ( ) . get ( "database" ) ; assert ( db != null ) ; String statsData = getStatsHTML ( db , minHeap , warnings ) ; contents = contents . replace ( "##STATS##" , statsData ) ; // generateProceduresTable needs to happen before generateSchemaTable // because some metadata used in the later is generated in the former String procData = generateProceduresTable ( db . getTables ( ) , db . getProcedures ( ) ) ; contents = contents . replace ( "##PROCS##" , procData ) ; String schemaData = generateSchemaTable ( db ) ; contents = contents . replace ( "##SCHEMA##" , schemaData ) ; DatabaseSizes sizes = CatalogSizing . getCatalogSizes ( db , DrRoleType . XDCR . value ( ) . equals ( cluster . getDrrole ( ) ) ) ; String sizeData = generateSizeTable ( sizes ) ; contents = contents . replace ( "##SIZES##" , sizeData ) ; String clusterConfig = generateClusterConfiguration ( isPro , hostCount , sitesPerHost , kfactor ) ; contents = contents . replace ( "##CLUSTERCONFIG##" , clusterConfig ) ; String sizeSummary = generateSizeSummary ( sizes ) ; contents = contents . replace ( "##SIZESUMMARY##" , sizeSummary ) ; String heapSummary = generateRecommendedServerSettings ( sizes ) ; contents = contents . replace ( "##RECOMMENDEDSERVERSETTINGS##" , heapSummary ) ; String platformData = PlatformProperties . getPlatformProperties ( ) . toHTML ( ) ; contents = contents . replace ( "##PLATFORM##" , platformData ) ; contents = contents . replace ( "##VERSION##" , VoltDB . instance ( ) . getVersionString ( ) ) ; contents = contents . replace ( "##DDL##" , escapeHtml4 ( autoGenDDL ) ) ; DateFormat df = new SimpleDateFormat ( "d MMM yyyy HH:mm:ss z" ) ; contents = contents . replace ( "##TIMESTAMP##" , df . format ( m_timestamp ) ) ; String msg = Encoder . hexEncode ( VoltDB . instance ( ) . getVersionString ( ) + "," + System . currentTimeMillis ( ) ) ; contents = contents . replace ( "get.py?a=KEY&" , String . format ( "get.py?a=%s&" , msg ) ) ; return contents ;
public class OrderableDBInstanceOption { /** * A list of the supported DB engine modes . * @ return A list of the supported DB engine modes . */ public java . util . List < String > getSupportedEngineModes ( ) { } }
if ( supportedEngineModes == null ) { supportedEngineModes = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return supportedEngineModes ;
public class JavacServer { /** * Start a server using a settings string . Typically : " - - startserver : portfile = / tmp / myserver , poolsize = 3 " and the string " portfile = / tmp / myserver , poolsize = 3" * is sent as the settings parameter . Returns 0 on success , - 1 on failure . */ public static int startServer ( String settings , PrintStream err ) { } }
try { String portfile = Util . extractStringOption ( "portfile" , settings ) ; // The log file collects more javac server specific log information . String logfile = Util . extractStringOption ( "logfile" , settings ) ; // The stdouterr file collects all the System . out and System . err writes to disk . String stdouterrfile = Util . extractStringOption ( "stdouterrfile" , settings ) ; // We could perhaps use System . setOut and setErr here . // But for the moment we rely on the client to spawn a shell where stdout // and stderr are redirected already . // The pool size is a limit the number of concurrent compiler threads used . // The server might use less than these to avoid memory problems . int poolsize = Util . extractIntOption ( "poolsize" , settings ) ; if ( poolsize <= 0 ) { // If not set , default to the number of cores . poolsize = Runtime . getRuntime ( ) . availableProcessors ( ) ; } // How many seconds of inactivity will the server accept before quitting ? int keepalive = Util . extractIntOption ( "keepalive" , settings ) ; if ( keepalive <= 0 ) { keepalive = 120 ; } // The port file is locked and the server port and cookie is written into it . PortFile portFile = getPortFile ( portfile ) ; JavacServer s ; synchronized ( portFile ) { portFile . lock ( ) ; portFile . getValues ( ) ; if ( portFile . containsPortInfo ( ) ) { err . println ( "Javac server not started because portfile exists!" ) ; portFile . unlock ( ) ; return - 1 ; } s = new JavacServer ( poolsize , logfile ) ; portFile . setValues ( s . getPort ( ) , s . getCookie ( ) ) ; portFile . unlock ( ) ; } // Run the server . Will delete the port file when shutting down . // It will shut down automatically when no new requests have come in // during the last 125 seconds . s . run ( portFile , err , keepalive ) ; // The run loop for the server has exited . return 0 ; } catch ( Exception e ) { e . printStackTrace ( err ) ; return - 1 ; }
public class OrmLiteConfigUtil { /** * Writes a configuration fileName in the raw directory with the configuration for classes . * @ param sortClasses * Set to true to sort the classes by name before the file is generated . */ public static void writeConfigFile ( String fileName , Class < ? > [ ] classes , boolean sortClasses ) throws SQLException , IOException { } }
File rawDir = findRawDir ( new File ( "." ) ) ; if ( rawDir == null ) { System . err . println ( "Could not find " + RAW_DIR_NAME + " directory which is typically in the " + RESOURCE_DIR_NAME + " directory" ) ; } else { File configFile = new File ( rawDir , fileName ) ; writeConfigFile ( configFile , classes , sortClasses ) ; }
public class CommerceShippingMethodPersistenceImpl { /** * Removes all the commerce shipping methods where groupId = & # 63 ; from the database . * @ param groupId the group ID */ @ Override public void removeByGroupId ( long groupId ) { } }
for ( CommerceShippingMethod commerceShippingMethod : findByGroupId ( groupId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( commerceShippingMethod ) ; }
public class AdHocPlannedStmtBatch { /** * Retrieve all the SQL statement text as a list of strings . * @ return list of SQL statement strings */ public List < String > getSQLStatements ( ) { } }
List < String > sqlStatements = new ArrayList < > ( plannedStatements . size ( ) ) ; for ( AdHocPlannedStatement plannedStatement : plannedStatements ) { sqlStatements . add ( new String ( plannedStatement . sql , Constants . UTF8ENCODING ) ) ; } return sqlStatements ;
public class LegacyClientUtils { /** * Legacy Client send 2 Hash type : S256 and S384 */ public static boolean checkHash ( Platform platform , byte [ ] aMsg , int hashPos , int hashCount ) { } }
if ( hashCount != 2 ) return false ; boolean result = ( platform . getUtils ( ) . equals ( HashType . SHA256 . getType ( ) , 0 , aMsg , hashPos , 4 ) && platform . getUtils ( ) . equals ( HashType . SHA384 . getType ( ) , 0 , aMsg , hashPos + 1 * 4 , 4 ) ) ; return result ;
public class AbstractTaggerTrainer { /** * Automatically create a tag dictionary from training data . * @ param aDictSamples * the dictSamples created from training data * @ param aDictCutOff * the cutoff to create the dictionary */ protected final void createAutomaticDictionary ( final ObjectStream < POSSample > aDictSamples , final int aDictCutOff ) { } }
if ( aDictCutOff != Flags . DEFAULT_DICT_CUTOFF ) { try { TagDictionary dict = getPosTaggerFactory ( ) . getTagDictionary ( ) ; if ( dict == null ) { dict = getPosTaggerFactory ( ) . createEmptyTagDictionary ( ) ; getPosTaggerFactory ( ) . setTagDictionary ( dict ) ; } if ( dict instanceof MutableTagDictionary ) { POSTaggerME . populatePOSDictionary ( aDictSamples , ( MutableTagDictionary ) dict , aDictCutOff ) ; } else { throw new IllegalArgumentException ( "Can't extend a POSDictionary" + " that does not implement MutableTagDictionary." ) ; } this . dictSamples . reset ( ) ; } catch ( final IOException e ) { throw new TerminateToolException ( - 1 , "IO error while creating/extending POS Dictionary: " + e . getMessage ( ) , e ) ; } }
public class JSONNavi { /** * get the current object value as Integer if the current Object can not be * cast as Integer return null . */ public Integer asIntegerObj ( ) { } }
if ( current == null ) return null ; if ( current instanceof Number ) { if ( current instanceof Integer ) return ( Integer ) current ; if ( current instanceof Long ) { Long l = ( Long ) current ; if ( l . longValue ( ) == l . intValue ( ) ) { return Integer . valueOf ( l . intValue ( ) ) ; } } return null ; } return null ;
public class JobHistory { /** * Log a number of keys and values with record . the array length of keys and values * should be same . * @ param recordType type of log event * @ param keys type of log event * @ param values type of log event */ static void log ( ArrayList < PrintWriter > writers , RecordTypes recordType , Keys [ ] keys , String [ ] values ) { } }
StringBuffer buf = new StringBuffer ( recordType . name ( ) ) ; buf . append ( DELIMITER ) ; for ( int i = 0 ; i < keys . length ; i ++ ) { buf . append ( keys [ i ] ) ; buf . append ( "=\"" ) ; values [ i ] = escapeString ( values [ i ] ) ; buf . append ( values [ i ] ) ; buf . append ( "\"" ) ; buf . append ( DELIMITER ) ; } buf . append ( LINE_DELIMITER_CHAR ) ; for ( PrintWriter out : writers ) { LogTask task = new LogTask ( out , buf . toString ( ) ) ; fileManager . addWriteTask ( task ) ; }
public class NonBlockingHashMap { /** * Write a NBHM to a stream */ private void writeObject ( java . io . ObjectOutputStream s ) throws IOException { } }
s . defaultWriteObject ( ) ; // Nothing to write for ( Object K : keySet ( ) ) { final Object V = get ( K ) ; // Do an official ' get ' s . writeObject ( K ) ; // Write the < TypeK , TypeV > pair s . writeObject ( V ) ; } s . writeObject ( null ) ; // Sentinel to indicate end - of - data s . writeObject ( null ) ;
public class AuthorInfo { /** * setter for contact - sets Contact information ( emails , phones , etc . ) , O * @ generated * @ param v value to set into the feature */ public void setContact ( String v ) { } }
if ( AuthorInfo_Type . featOkTst && ( ( AuthorInfo_Type ) jcasType ) . casFeat_contact == null ) jcasType . jcas . throwFeatMissing ( "contact" , "de.julielab.jules.types.AuthorInfo" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( AuthorInfo_Type ) jcasType ) . casFeatCode_contact , v ) ;
public class CmsEditSiteForm { /** * Checks if there are at least one character in the folder name , * also ensures that it ends with a ' / ' and doesn ' t start with ' / ' . < p > * @ param resourcename folder name to check ( complete path ) * @ return the validated folder name * @ throws CmsIllegalArgumentException if the folder name is empty or < code > null < / code > */ String ensureFoldername ( String resourcename ) { } }
if ( CmsStringUtil . isEmpty ( resourcename ) ) { return "" ; } if ( ! CmsResource . isFolder ( resourcename ) ) { resourcename = resourcename . concat ( "/" ) ; } if ( resourcename . charAt ( 0 ) == '/' ) { resourcename = resourcename . substring ( 1 ) ; } return resourcename ;
public class StringValidator { /** * Checks that an input value is not empty . * @ param input the input value to check . * @ param message the validation message to create in case the validation fails . * @ return a new { @ linkplain StringValidator } instance for further validation steps . * @ throws ValidationException if the validation fails . */ public static StringValidator checkNotEmpty ( @ Nullable String input , ValidationMessage message ) throws ValidationException { } }
if ( input == null || input . length ( ) == 0 ) { throw new ValidationException ( message . format ( input ) ) ; } return new StringValidator ( input ) ;
public class ApiOvhPrice { /** * Get price of backup storage offer * REST : GET / price / dedicated / server / backupStorage / { capacity } * @ param capacity [ required ] Capacity in gigabytes of backup storage offer */ public OvhPrice dedicated_server_backupStorage_capacity_GET ( net . minidev . ovh . api . price . dedicated . server . OvhBackupStorageEnum capacity ) throws IOException { } }
String qPath = "/price/dedicated/server/backupStorage/{capacity}" ; StringBuilder sb = path ( qPath , capacity ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhPrice . class ) ;
public class GitlabAPI { /** * Updates an existing variable . * @ param projectId The ID of the project containing the variable . * @ param key The key of the variable to update . * @ param newValue The updated value . * @ return The updated , deserialized variable . * @ throws IOException on gitlab api call error */ public GitlabBuildVariable updateBuildVariable ( Integer projectId , String key , String newValue ) throws IOException { } }
String tailUrl = GitlabProject . URL + "/" + projectId + GitlabBuildVariable . URL + "/" + key ; GitlabHTTPRequestor requestor = retrieve ( ) . method ( PUT ) ; if ( newValue != null ) { requestor = requestor . with ( "value" , newValue ) ; } return requestor . to ( tailUrl , GitlabBuildVariable . class ) ;
public class AdminServlet { private Element lifeCycle ( HttpServletRequest request , String id , LifeCycle lc ) { } }
return lifeCycle ( request , id , lc , lc . toString ( ) ) ;
public class DOMHelper { /** * Get the first unparented node in the ancestor chain . * @ deprecated * @ param node Starting node , to specify which chain to chase * @ return the topmost ancestor . */ public Node getRoot ( Node node ) { } }
Node root = null ; while ( node != null ) { root = node ; node = getParentOfNode ( node ) ; } return root ;
public class Task { /** * / * package */ static Task < Void > delay ( long delay , ScheduledExecutorService executor , final CancellationToken cancellationToken ) { } }
if ( cancellationToken != null && cancellationToken . isCancellationRequested ( ) ) { return Task . cancelled ( ) ; } if ( delay <= 0 ) { return Task . forResult ( null ) ; } final bolts . TaskCompletionSource < Void > tcs = new bolts . TaskCompletionSource < > ( ) ; final ScheduledFuture < ? > scheduled = executor . schedule ( new Runnable ( ) { @ Override public void run ( ) { tcs . trySetResult ( null ) ; } } , delay , TimeUnit . MILLISECONDS ) ; if ( cancellationToken != null ) { cancellationToken . register ( new Runnable ( ) { @ Override public void run ( ) { scheduled . cancel ( true ) ; tcs . trySetCancelled ( ) ; } } ) ; } return tcs . getTask ( ) ;
public class HiveConverterUtils { /** * Get the staging table location of format : < final table location > / < staging table name > * @ param outputDataLocation output table data lcoation . * @ return staging table location . */ public static String getStagingDataLocation ( String outputDataLocation , String stagingTableName ) { } }
return outputDataLocation + Path . SEPARATOR + stagingTableName ;
public class BshArray { /** * Set element value of array or list at index . * Array . set for array or List . set for list . * @ param array to set value for . * @ param index of the element to set * @ param val the value to set * @ throws UtilTargetError wrapped target exceptions */ @ SuppressWarnings ( "unchecked" ) public static void setIndex ( Object array , int index , Object val ) throws ReflectError , UtilTargetError { } }
try { val = Primitive . unwrap ( val ) ; if ( array instanceof List ) ( ( List < Object > ) array ) . set ( index , val ) ; else Array . set ( array , index , val ) ; } catch ( IllegalArgumentException e1 ) { // fabricated array store exception throw new UtilTargetError ( new ArrayStoreException ( e1 . getMessage ( ) ) ) ; } catch ( IndexOutOfBoundsException e1 ) { int len = array instanceof List ? ( ( List < ? > ) array ) . size ( ) : Array . getLength ( array ) ; throw new UtilTargetError ( "Index " + index + " out-of-bounds for length " + len , e1 ) ; }
public class HessianBlobIntensity { /** * Feature intensity using the trace of the Hessian matrix . This is also known as the Laplacian . * @ param featureIntensity Output feature intensity . Modified . * @ param hessianXX Second derivative along x - axis . Not modified . * @ param hessianYY Second derivative along y - axis . Not modified . */ public static void trace ( GrayF32 featureIntensity , GrayF32 hessianXX , GrayF32 hessianYY ) { } }
InputSanityCheck . checkSameShape ( featureIntensity , hessianXX , hessianYY ) ; ImplHessianBlobIntensity . trace ( featureIntensity , hessianXX , hessianYY ) ;
public class J4pRequestHandler { private JSONObject getJsonRequestContent ( J4pRequest pRequest ) { } }
JSONObject requestContent = pRequest . toJson ( ) ; if ( defaultTargetConfig != null && pRequest . getTargetConfig ( ) == null ) { requestContent . put ( "target" , defaultTargetConfig . toJson ( ) ) ; } return requestContent ;
public class StructureDiagramGenerator { /** * Places the first bond of the first ring such that one atom is at ( 0,0 ) and * the other one at the position given by bondVector * @ param bondVector A 2D vector to point to the position of the second bond * atom * @ param bond the bond to lay out * @ return an IAtomContainer with the atoms of the bond and the bond itself */ private IAtomContainer placeFirstBond ( IBond bond , Vector2d bondVector ) { } }
IAtomContainer sharedAtoms = null ; bondVector . normalize ( ) ; logger . debug ( "placeFirstBondOfFirstRing->bondVector.length():" + bondVector . length ( ) ) ; bondVector . scale ( bondLength ) ; logger . debug ( "placeFirstBondOfFirstRing->bondVector.length() after scaling:" + bondVector . length ( ) ) ; IAtom atom ; Point2d point = new Point2d ( 0 , 0 ) ; atom = bond . getBegin ( ) ; logger . debug ( "Atom 1 of first Bond: " + ( molecule . indexOf ( atom ) + 1 ) ) ; atom . setPoint2d ( point ) ; atom . setFlag ( CDKConstants . ISPLACED , true ) ; point = new Point2d ( 0 , 0 ) ; atom = bond . getEnd ( ) ; logger . debug ( "Atom 2 of first Bond: " + ( molecule . indexOf ( atom ) + 1 ) ) ; point . add ( bondVector ) ; atom . setPoint2d ( point ) ; atom . setFlag ( CDKConstants . ISPLACED , true ) ; /* * The new ring is layed out relativ to some shared atoms that have * already been placed . Usually this is another ring , that has * already been draw and to which the new ring is somehow connected , * or some other system of atoms in an aliphatic chain . In this * case , it ' s the first bond that we layout by hand . */ sharedAtoms = atom . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; sharedAtoms . addAtom ( bond . getBegin ( ) ) ; sharedAtoms . addAtom ( bond . getEnd ( ) ) ; sharedAtoms . addBond ( bond ) ; return sharedAtoms ;
public class AbstractResultSet { /** * { @ inheritDoc } */ public boolean absolute ( final int row ) throws SQLException { } }
final int r = ( row < 0 ) ? this . fetchSize + 1 + row : row ; if ( r < this . row ) { throw new SQLException ( "Backward move" ) ; } // end of if if ( r > this . fetchSize ) { this . row = this . fetchSize + 1 ; return false ; } // end of if this . row = r ; return true ;
public class SqlHelper { /** * insert table ( ) 列 * @ param entityClass * @ param skipId 是否从列中忽略id类型 * @ param notNull 是否判断 ! = null * @ param notEmpty 是否判断String类型 ! = ' ' * @ return */ public static String insertColumns ( Class < ? > entityClass , boolean skipId , boolean notNull , boolean notEmpty ) { } }
StringBuilder sql = new StringBuilder ( ) ; sql . append ( "<trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\">" ) ; // 获取全部列 Set < EntityColumn > columnSet = EntityHelper . getColumns ( entityClass ) ; // 当某个列有主键策略时 , 不需要考虑他的属性是否为空 , 因为如果为空 , 一定会根据主键策略给他生成一个值 for ( EntityColumn column : columnSet ) { if ( ! column . isInsertable ( ) ) { continue ; } if ( skipId && column . isId ( ) ) { continue ; } if ( notNull ) { sql . append ( SqlHelper . getIfNotNull ( column , column . getColumn ( ) + "," , notEmpty ) ) ; } else { sql . append ( column . getColumn ( ) + "," ) ; } } sql . append ( "</trim>" ) ; return sql . toString ( ) ;
public class MapfishMapContext { /** * Return the map bounds rotated with the set rotation . The bounds are adapted to rounding changes of the * size of the paint area . * @ param paintAreaPrecise The exact size of the paint area . * @ param paintArea The rounded size of the paint area . * @ return Rotated bounds . */ public MapBounds getRotatedBounds ( final Rectangle2D . Double paintAreaPrecise , final Rectangle paintArea ) { } }
final MapBounds rotatedBounds = this . getRotatedBounds ( ) ; if ( rotatedBounds instanceof CenterScaleMapBounds ) { return rotatedBounds ; } final ReferencedEnvelope envelope = ( ( BBoxMapBounds ) rotatedBounds ) . toReferencedEnvelope ( null ) ; // the paint area size and the map bounds are rotated independently . because // the paint area size is rounded to integers , the map bounds have to be adjusted // to these rounding changes . final double widthRatio = paintArea . getWidth ( ) / paintAreaPrecise . getWidth ( ) ; final double heightRatio = paintArea . getHeight ( ) / paintAreaPrecise . getHeight ( ) ; final double adaptedWidth = envelope . getWidth ( ) * widthRatio ; final double adaptedHeight = envelope . getHeight ( ) * heightRatio ; final double widthDiff = adaptedWidth - envelope . getWidth ( ) ; final double heigthDiff = adaptedHeight - envelope . getHeight ( ) ; envelope . expandBy ( widthDiff / 2.0 , heigthDiff / 2.0 ) ; return new BBoxMapBounds ( envelope ) ;
public class OfflinePlugin { /** * Called when the OfflineDownloadService has finished downloading . * @ param offlineDownload the offline download to stop tracking * @ since 0.1.0 */ void removeDownload ( OfflineDownloadOptions offlineDownload , boolean canceled ) { } }
if ( canceled ) { stateChangeDispatcher . onCancel ( offlineDownload ) ; } else { stateChangeDispatcher . onSuccess ( offlineDownload ) ; } offlineDownloads . remove ( offlineDownload ) ;
public class AnnotationExpander { /** * 合成したアノテーションの属性を 、 構成されるアノテーションに反映する 。 * @ param compositionAnno * @ param nestedAnno * @ return */ private ExpandedAnnotation overrideAttribute ( final Annotation compositionAnno , final ExpandedAnnotation nestedAnno ) { } }
final Annotation originalAnno = nestedAnno . getOriginal ( ) ; if ( ! isOverridableAnnotation ( originalAnno ) ) { return nestedAnno ; } // 上書きするアノテーションの属性の組み立て final Map < String , Object > overrideAttrs = buildOverrideAttribute ( compositionAnno , nestedAnno ) ; if ( overrideAttrs . isEmpty ( ) ) { return nestedAnno ; } // 既存のアノテーションの属性の作成 final Class < ? > annotationClass = originalAnno . annotationType ( ) ; final Map < String , Object > defaultValues = new HashMap < > ( ) ; for ( Method method : annotationClass . getMethods ( ) ) { try { method . setAccessible ( true ) ; if ( method . getParameterCount ( ) == 0 ) { final Object value = method . invoke ( originalAnno ) ; defaultValues . put ( method . getName ( ) , value ) ; } else { final Object value = method . getDefaultValue ( ) ; if ( value != null ) { defaultValues . put ( method . getName ( ) , value ) ; } } } catch ( IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { throw new RuntimeException ( String . format ( "fail get annotation attribute %s#%s." , annotationClass . getName ( ) , method . getName ( ) ) , e ) ; } } // アノテーションのインスタンスの組み立てなおし final ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; final Object annoObj = Proxy . newProxyInstance ( classLoader , new Class [ ] { annotationClass } , new InvocationHandler ( ) { @ Override public Object invoke ( final Object proxy , final Method method , final Object [ ] args ) throws Throwable { final String name = method . getName ( ) ; if ( name . equals ( "annotationType" ) ) { return annotationClass ; } else if ( overrideAttrs . containsKey ( name ) ) { return overrideAttrs . get ( name ) ; } else { return defaultValues . get ( name ) ; } } } ) ; // 値をコピーする final ExpandedAnnotation propagatedAnno = new ExpandedAnnotation ( ( Annotation ) annoObj , nestedAnno . isComposed ( ) ) ; propagatedAnno . setIndex ( nestedAnno . getIndex ( ) ) ; propagatedAnno . addChilds ( nestedAnno . getChilds ( ) ) ; return propagatedAnno ;
public class WorkflowTypeInfoMarshaller { /** * Marshall the given parameter object . */ public void marshall ( WorkflowTypeInfo workflowTypeInfo , ProtocolMarshaller protocolMarshaller ) { } }
if ( workflowTypeInfo == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( workflowTypeInfo . getWorkflowType ( ) , WORKFLOWTYPE_BINDING ) ; protocolMarshaller . marshall ( workflowTypeInfo . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( workflowTypeInfo . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( workflowTypeInfo . getCreationDate ( ) , CREATIONDATE_BINDING ) ; protocolMarshaller . marshall ( workflowTypeInfo . getDeprecationDate ( ) , DEPRECATIONDATE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class PreExecutionInterceptorContext { /** * Requests that this request should not be profiled * @ param reason the reason why no call tree should be collected ( debug message ) * @ return < code > this < / code > for chaining */ public PreExecutionInterceptorContext shouldNotCollectCallTree ( String reason ) { } }
if ( ! mustCollectCallTree ) { logger . debug ( "Should not collect call tree because {}" , reason ) ; collectCallTree = false ; } return this ;
public class ModelsImpl { /** * Deletes a hierarchical entity extractor child from the application . * @ param appId The application ID . * @ param versionId The version ID . * @ param hEntityId The hierarchical entity extractor ID . * @ param hChildId The hierarchical entity extractor child ID . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < OperationStatus > deleteHierarchicalEntityChildAsync ( UUID appId , String versionId , UUID hEntityId , UUID hChildId , final ServiceCallback < OperationStatus > serviceCallback ) { } }
return ServiceFuture . fromResponse ( deleteHierarchicalEntityChildWithServiceResponseAsync ( appId , versionId , hEntityId , hChildId ) , serviceCallback ) ;
public class AbstractCompletableFuture { /** * Sets the result . If { @ code result } is an instance of Throwable , this * future will be completed exceptionally . That is , { @ link # get } will throw * the exception rather than return it . * @ return true , if this call made this future to complete */ protected boolean setResult ( Object result ) { } }
for ( ; ; ) { Object currentState = this . state ; if ( isDoneState ( currentState ) ) { return false ; } if ( STATE . compareAndSet ( this , currentState , result ) ) { done ( ) ; notifyThreadsWaitingOnGet ( ) ; runAsynchronous ( ( ExecutionCallbackNode ) currentState , result ) ; break ; } } return true ;
public class ESHttpMarshaller { /** * Creates a list of " application / vnd . eventstore . events ( + json / + xml ) " entries surrounded by " [ ] " ( JSON ) or * " & lt ; Events & gt ; & lt ; / Events & gt ; " ( XML ) . * @ param registry * Registry with known serializers . * @ param commonEvents * Events to marshal . * @ return Single event body . */ @ NotNull public final String marshal ( @ NotNull final SerializerRegistry registry , @ NotNull final List < CommonEvent > commonEvents ) { } }
Contract . requireArgNotNull ( "registry" , registry ) ; Contract . requireArgNotNull ( "commonEvents" , commonEvents ) ; final Serializer serializer = registry . getSerializer ( EscEvents . SER_TYPE ) ; final List < EscEvent > eventList = new ArrayList < > ( ) ; for ( final CommonEvent commonEvent : commonEvents ) { eventList . add ( createEscEvent ( registry , serializer . getMimeType ( ) , commonEvent ) ) ; } final EscEvents events = new EscEvents ( eventList ) ; final byte [ ] data = serializer . marshal ( events , EscEvents . SER_TYPE ) ; return new String ( data , serializer . getMimeType ( ) . getEncoding ( ) ) ;
public class QueryParameters { /** * Setter function of QueryParameters * @ param key Key * @ param value Value * @ param type SQL Type * @ param direction Direction ( used for Stored Procedures calls ) * @ return this instance of QueryRunner */ public QueryParameters set ( String key , Object value , Integer type , Direction direction ) { } }
return this . set ( key , value , type , direction , this . orderSize ( ) ) ;
public class Sets { /** * Union of the sets A and B , denoted A ∪ B , is the set of all objects that * are a member of A , or B , or both * @ param < T > * @ param sets * @ return */ public static final < T > Set < T > union ( Collection < Set < T > > sets ) { } }
Set < T > set = new HashSet < > ( ) ; for ( Set < T > s : sets ) { set . addAll ( s ) ; } return set ;
public class HttpResponseMessageImpl { /** * Called the parsing of the first line is complete . Performs checks * on whether all the necessary data has been found . * @ throws MalformedMessageException */ @ Override protected void parsingComplete ( ) throws MalformedMessageException { } }
// HTTP - Version SP Status - Code SP Reason - Phrase CRLF // PK20069 : reason - phrase is 0 or more characters int num = getNumberFirstLineTokens ( ) ; if ( 3 != num && 2 != num ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "numFirstLineTokensRead is " + getNumberFirstLineTokens ( ) ) ; } if ( getServiceContext ( ) . getHttpConfig ( ) . getDebugLog ( ) . isEnabled ( DebugLog . Level . WARN ) ) { getServiceContext ( ) . getHttpConfig ( ) . getDebugLog ( ) . log ( DebugLog . Level . WARN , HttpMessages . MSG_PARSE_INVALID_FIRSTLINE , getServiceContext ( ) ) ; } throw new MalformedMessageException ( "Received " + getNumberFirstLineTokens ( ) + " first line tokens" ) ; }
public class ReflectionUtilities { /** * Given a Type , return all of the classes it extends and interfaces it implements ( including the class itself ) . * Examples : * < pre > { @ code * Integer . class - > { Integer . class , Number . class , Object . class } * T - > Object * ? - > Object * HashSet < T > - > { HashSet < T > , Set < T > , Collection < T > , Object } * FooEventHandler - > { FooEventHandler , EventHandler < Foo > , Object } * } < / pre > */ public static Iterable < Type > classAndAncestors ( final Type c ) { } }
final List < Type > workQueue = new ArrayList < > ( ) ; Type clazz = c ; workQueue . add ( clazz ) ; if ( getRawClass ( clazz ) . isInterface ( ) ) { workQueue . add ( Object . class ) ; } for ( int i = 0 ; i < workQueue . size ( ) ; i ++ ) { clazz = workQueue . get ( i ) ; if ( clazz instanceof Class ) { final Class < ? > clz = ( Class < ? > ) clazz ; final Type sc = clz . getSuperclass ( ) ; if ( sc != null ) { workQueue . add ( sc ) ; // c . getSuperclass ( ) ) ; } workQueue . addAll ( Arrays . asList ( clz . getGenericInterfaces ( ) ) ) ; } else if ( clazz instanceof ParameterizedType ) { final ParameterizedType pt = ( ParameterizedType ) clazz ; final Class < ? > rawPt = ( Class < ? > ) pt . getRawType ( ) ; final Type sc = rawPt . getSuperclass ( ) ; // workQueue . add ( pt ) ; // workQueue . add ( rawPt ) ; if ( sc != null ) { workQueue . add ( sc ) ; } workQueue . addAll ( Arrays . asList ( rawPt . getGenericInterfaces ( ) ) ) ; } else if ( clazz instanceof WildcardType ) { workQueue . add ( Object . class ) ; // XXX not really correct , but close enough ? } else if ( clazz instanceof TypeVariable ) { workQueue . add ( Object . class ) ; // XXX not really correct , but close enough ? } else { throw new RuntimeException ( clazz . getClass ( ) + " " + clazz + " is of unknown type!" ) ; } } return workQueue ;
public class UserProfileHandlerImpl { /** * Remove user profile from storage . */ private UserProfile removeUserProfile ( Session session , String userName , boolean broadcast ) throws Exception { } }
Node profileNode ; try { profileNode = utils . getProfileNode ( session , userName ) ; } catch ( PathNotFoundException e ) { return null ; } UserProfile profile = readProfile ( userName , profileNode ) ; if ( broadcast ) { preDelete ( profile , broadcast ) ; } profileNode . remove ( ) ; session . save ( ) ; removeFromCache ( profile ) ; if ( broadcast ) { postDelete ( profile ) ; } return profile ;
public class RhinoEngine { /** * / * ( non - Javadoc ) * @ see minium . script . rhinojs . JsEngine # contains ( java . lang . String ) */ @ Override public boolean contains ( final String varName ) { } }
return runWithContext ( new RhinoCallable < Boolean , RuntimeException > ( ) { @ Override protected Boolean doCall ( Context cx , Scriptable scope ) { return scope . get ( varName , scope ) != null ; } } ) ;
public class Unifier { /** * Used to add neutral elements ( { @ link AnalyzedTokenReadings } to the * unified sequence . Useful if the sequence contains punctuation or connectives , for example . * @ param analyzedTokenReadings A neutral element to be added . * @ since 2.5 */ public final void addNeutralElement ( AnalyzedTokenReadings analyzedTokenReadings ) { } }
tokSequence . add ( analyzedTokenReadings ) ; List < Map < String , Set < String > > > tokEquivs = new ArrayList < > ( analyzedTokenReadings . getReadingsLength ( ) ) ; Map < String , Set < String > > map = new ConcurrentHashMap < > ( ) ; map . put ( UNIFY_IGNORE , new HashSet < > ( ) ) ; for ( int i = 0 ; i < analyzedTokenReadings . getReadingsLength ( ) ; i ++ ) { tokEquivs . add ( map ) ; } tokSequenceEquivalences . add ( tokEquivs ) ; readingsCounter ++ ;
public class DelegateClassLoader { /** * { @ inheritDoc } */ @ Override public InputStream getResourceAsStream ( final String name ) { } }
InputStream is = null ; if ( parent != null ) { is = parent . getResourceAsStream ( name ) ; } return ( is == null ) ? delegate . getResourceAsStream ( name ) : is ;
public class MBeanServerHandler { /** * Initialise this server handler and register as an MBean */ private void initMBean ( ) { } }
try { registerMBean ( this , getObjectName ( ) ) ; } catch ( InstanceAlreadyExistsException exp ) { // This is no problem , since this MBeanServerHandlerMBean holds only global information // with no special state ( so all instances of this MBean behave similar ) // This exception can happen , when multiple servlets get registered within the same JVM } catch ( MalformedObjectNameException e ) { // Cannot happen , otherwise this is a bug . We should be always provide our own name in correct // form . throw new IllegalStateException ( "Internal Error: Own ObjectName " + getObjectName ( ) + " is malformed" , e ) ; } catch ( NotCompliantMBeanException e ) { // Same here throw new IllegalStateException ( "Internal Error: " + this . getClass ( ) . getName ( ) + " is not a compliant MBean" , e ) ; }
public class MMCIFFileTools { /** * Given a mmCIF bean produces a String representing it in mmCIF loop format as a single record line * @ param record * @ param fields Set of fields for the record . If null , will be calculated from the class of the record * @ param sizes the size of each of the fields * @ return */ private static String toSingleLoopLineMmCifString ( Object record , Field [ ] fields , int [ ] sizes ) { } }
StringBuilder str = new StringBuilder ( ) ; Class < ? > c = record . getClass ( ) ; if ( fields == null ) fields = getFields ( c ) ; if ( sizes . length != fields . length ) throw new IllegalArgumentException ( "The given sizes of fields differ from the number of declared fields" ) ; int i = - 1 ; for ( Field f : fields ) { i ++ ; f . setAccessible ( true ) ; try { Object obj = f . get ( record ) ; String val ; if ( obj == null ) { logger . debug ( "Field {} is null, will write it out as {}" , f . getName ( ) , MMCIF_MISSING_VALUE ) ; val = MMCIF_MISSING_VALUE ; } else { val = ( String ) obj ; } str . append ( String . format ( "%-" + sizes [ i ] + "s " , addMmCifQuoting ( val ) ) ) ; } catch ( IllegalAccessException e ) { logger . warn ( "Field {} is inaccessible" , f . getName ( ) ) ; continue ; } catch ( ClassCastException e ) { logger . warn ( "Could not cast value to String for field {}" , f . getName ( ) ) ; continue ; } } str . append ( newline ) ; return str . toString ( ) ;
public class Mirrors { /** * TODO ( ronshapiro ) : this is used in AutoFactory and Dagger , consider moving it into auto - common . */ static < T > Optional < Equivalence . Wrapper < T > > wrapOptionalInEquivalence ( Equivalence < T > equivalence , Optional < T > optional ) { } }
return optional . isPresent ( ) ? Optional . of ( equivalence . wrap ( optional . get ( ) ) ) : Optional . < Equivalence . Wrapper < T > > absent ( ) ;
public class ServiceActionSummaryMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ServiceActionSummary serviceActionSummary , ProtocolMarshaller protocolMarshaller ) { } }
if ( serviceActionSummary == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( serviceActionSummary . getId ( ) , ID_BINDING ) ; protocolMarshaller . marshall ( serviceActionSummary . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( serviceActionSummary . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( serviceActionSummary . getDefinitionType ( ) , DEFINITIONTYPE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class LocalConnection { /** * / * ( non - Javadoc ) * @ see net . timewalker . ffmq4 . common . connection . AbstractConnection # setClientID ( java . lang . String ) */ @ Override public final void setClientID ( String clientID ) throws JMSException { } }
externalAccessLock . readLock ( ) . lock ( ) ; try { super . setClientID ( clientID ) ; try { ClientIDRegistry . getInstance ( ) . register ( clientID ) ; } catch ( JMSException e ) { this . clientID = null ; // Clear client ID throw e ; } } finally { externalAccessLock . readLock ( ) . unlock ( ) ; }
public class DRUMSIterator { /** * Returns < code > true < / code > if this iterator has one more element , otherwise it returns < code > false < / code > . If an * error occurs while accessing the bucket file an { @ link IllegalStateException } is thrown . */ @ Override public boolean hasNext ( ) { } }
if ( readBuffer != null && readBuffer . remaining ( ) != 0 ) { logger . debug ( "There are still elements in the readBuffer" ) ; return true ; } else if ( actualFile != null && actualFileOffset < actualFile . getFilledUpFromContentStart ( ) ) { logger . debug ( "The end of the actual file is not reached yet." ) ; return true ; } // Since version 0.2.23 - SNAPSHOT all files are created , even if they don ' t contain elements else if ( actualBucketId < numberOfBuckets - 1 ) { logger . debug ( "Not all files were read. Trying to open next file" ) ; try { this . handleFile ( ) ; } catch ( FileLockException e ) { logger . error ( "Skipping file. Not all elements might have been iterated. {}" , e ) ; } catch ( IOException e ) { logger . error ( "Skipping file. Not all elements might have been iterated. {}" , e ) ; } return hasNext ( ) ; } if ( actualFile != null ) { actualFile . close ( ) ; } return false ;
public class CharUtils { /** * < p > Converts the String to a Character using the first character , returning * null for empty Strings . < / p > * < p > For ASCII 7 bit characters , this uses a cache that will return the * same Character object each time . < / p > * < pre > * CharUtils . toCharacterObject ( null ) = null * CharUtils . toCharacterObject ( " " ) = null * CharUtils . toCharacterObject ( " A " ) = ' A ' * CharUtils . toCharacterObject ( " BA " ) = ' B ' * < / pre > * @ param str the character to convert * @ return the Character value of the first letter of the String */ public static Character toCharacterObject ( String str ) { } }
if ( StringUtils . isEmpty ( str ) ) { return null ; } return toCharacterObject ( str . charAt ( 0 ) ) ;
public class FontFactoryImp { /** * Register fonts in some probable directories . It usually works in Windows , * Linux and Solaris . * @ return the number of fonts registered */ public int registerDirectories ( ) { } }
int count = 0 ; count += registerDirectory ( "c:/windows/fonts" ) ; count += registerDirectory ( "c:/winnt/fonts" ) ; count += registerDirectory ( "d:/windows/fonts" ) ; count += registerDirectory ( "d:/winnt/fonts" ) ; count += registerDirectory ( "/usr/share/X11/fonts" , true ) ; count += registerDirectory ( "/usr/X/lib/X11/fonts" , true ) ; count += registerDirectory ( "/usr/openwin/lib/X11/fonts" , true ) ; count += registerDirectory ( "/usr/share/fonts" , true ) ; count += registerDirectory ( "/usr/X11R6/lib/X11/fonts" , true ) ; count += registerDirectory ( "/Library/Fonts" ) ; count += registerDirectory ( "/System/Library/Fonts" ) ; return count ;
public class EnumOrderAccessor { /** * Create the accessor for enum . * @ param child accessor for inherited datatype . * @ return created accessor */ public static < T extends Enum < T > > IAccessor < T > createAccessor ( Class < T > clazz ) { } }
return new EnumOrderAccessor < T > ( clazz ) ;
public class SheetTemplateHandler { /** * 构建SheetTemplate */ public static SheetTemplate sheetTemplateBuilder ( String templatePath ) throws Excel4JException { } }
SheetTemplate sheetTemplate = new SheetTemplate ( ) ; try { // 读取模板文件 sheetTemplate . workbook = WorkbookFactory . create ( new FileInputStream ( new File ( templatePath ) ) ) ; } catch ( Exception e ) { // 读取模板相对文件 try { sheetTemplate . workbook = WorkbookFactory . create ( SheetTemplateHandler . class . getResourceAsStream ( templatePath ) ) ; } catch ( IOException | InvalidFormatException e1 ) { throw new Excel4JException ( e1 ) ; } } return sheetTemplate ;
public class ValueExpression { /** * @ param context The EL context for this evaluation * @ return This default implementation always returns < code > null < / code > * @ since EL 2.2 */ public ValueReference getValueReference ( ELContext context ) { } }
// Expected to be over - ridden by implementation context . notifyBeforeEvaluation ( getExpressionString ( ) ) ; context . notifyAfterEvaluation ( getExpressionString ( ) ) ; return null ;
public class HiveTargetPathHelper { /** * Compute the target { @ link Path } for a file or directory copied by Hive distcp . * The target locations of data files for this table depend on the values of the resolved table root ( e . g . * the value of { @ link # COPY _ TARGET _ TABLE _ ROOT } with tokens replaced ) and { @ link # RELOCATE _ DATA _ FILES _ KEY } : * * if { @ link # RELOCATE _ DATA _ FILES _ KEY } is true , then origin file / path / to / file / myFile will be written to * / resolved / table / root / < partition > / myFile * * if { @ link # COPY _ TARGET _ TABLE _ PREFIX _ TOBE _ REPLACED } and { @ link # COPY _ TARGET _ TABLE _ PREFIX _ REPLACEMENT } are defined , * then the specified prefix in each file will be replaced by the specified replacement . * * otherwise , if the resolved table root is defined ( e . g . { @ link # COPY _ TARGET _ TABLE _ ROOT } is defined in the * properties ) , we define : * origin _ table _ root : = the deepest non glob ancestor of table . getSc ( ) . getLocation ( ) iff getLocation ( ) points to * a single glob . ( e . g . / path / to / * & # 47 ; files - > / path / to ) . If getLocation ( ) contains none * or multiple globs , job will fail . * relative _ path : = path of the file relative to origin _ table _ root . If the path of the file is not a descendant * of origin _ table _ root , job will fail . * target _ path : = / resolved / table / root / relative / path * This mode is useful when moving a table with a complicated directory structure to a different base directory . * * otherwise the target is identical to the origin path . * @ param sourcePath Source path to be transformed . * @ param targetFs target { @ link FileSystem } * @ param partition partition this file belongs to . * @ param isConcreteFile true if this is a path to an existing file in HDFS . */ public Path getTargetPath ( Path sourcePath , FileSystem targetFs , Optional < Partition > partition , boolean isConcreteFile ) { } }
if ( this . relocateDataFiles ) { Preconditions . checkArgument ( this . targetTableRoot . isPresent ( ) , "Must define %s to relocate data files." , COPY_TARGET_TABLE_ROOT ) ; Path path = this . targetTableRoot . get ( ) ; if ( partition . isPresent ( ) ) { path = addPartitionToPath ( path , partition . get ( ) ) ; } if ( ! isConcreteFile ) { return targetFs . makeQualified ( path ) ; } return targetFs . makeQualified ( new Path ( path , sourcePath . getName ( ) ) ) ; } // both prefixs must be present as the same time // can not used with option { @ link # COPY _ TARGET _ TABLE _ ROOT } if ( this . targetTablePrefixTobeReplaced . isPresent ( ) || this . targetTablePrefixReplacement . isPresent ( ) ) { Preconditions . checkState ( this . targetTablePrefixTobeReplaced . isPresent ( ) , String . format ( "Must specify both %s option and %s option together" , COPY_TARGET_TABLE_PREFIX_TOBE_REPLACED , COPY_TARGET_TABLE_PREFIX_REPLACEMENT ) ) ; Preconditions . checkState ( this . targetTablePrefixReplacement . isPresent ( ) , String . format ( "Must specify both %s option and %s option together" , COPY_TARGET_TABLE_PREFIX_TOBE_REPLACED , COPY_TARGET_TABLE_PREFIX_REPLACEMENT ) ) ; Preconditions . checkState ( ! this . targetTableRoot . isPresent ( ) , String . format ( "Can not specify the option %s with option %s " , COPY_TARGET_TABLE_ROOT , COPY_TARGET_TABLE_PREFIX_REPLACEMENT ) ) ; Path targetPathWithoutSchemeAndAuthority = HiveCopyEntityHelper . replacedPrefix ( sourcePath , this . targetTablePrefixTobeReplaced . get ( ) , this . targetTablePrefixReplacement . get ( ) ) ; return targetFs . makeQualified ( targetPathWithoutSchemeAndAuthority ) ; } else if ( this . targetTableRoot . isPresent ( ) ) { Preconditions . checkArgument ( this . dataset . getTableRootPath ( ) . isPresent ( ) , "Cannot move paths to a new root unless table has exactly one location." ) ; Preconditions . checkArgument ( PathUtils . isAncestor ( this . dataset . getTableRootPath ( ) . get ( ) , sourcePath ) , "When moving paths to a new root, all locations must be descendants of the table root location. " + "Table root location: %s, file location: %s." , this . dataset . getTableRootPath ( ) , sourcePath ) ; Path relativePath = PathUtils . relativizePath ( sourcePath , this . dataset . getTableRootPath ( ) . get ( ) ) ; return targetFs . makeQualified ( new Path ( this . targetTableRoot . get ( ) , relativePath ) ) ; } else { return targetFs . makeQualified ( PathUtils . getPathWithoutSchemeAndAuthority ( sourcePath ) ) ; }
public class FacebookRestClient { /** * Sets the FBML for the profile box , profile actions , and mobile devices for the user or page profile with ID < code > profileId < / code > . * Refer to the FBML documentation for a description of the markup and its role in various contexts . * @ param profileFbmlMarkup the FBML for the profile box * @ param profileActionFbmlMarkup the FBML for the profile actions * @ param mobileFbmlMarkup the FBML for mobile devices * @ param profileId a page or user ID ( null for the logged - in user ) * @ return a boolean indicating whether the FBML was successfully set * @ see < a href = " http : / / wiki . developers . facebook . com / index . php / Profile . setFBML " > * Developers wiki : Profile . setFBML < / a > */ public boolean profile_setFBML ( CharSequence profileFbmlMarkup , CharSequence profileActionFbmlMarkup , CharSequence mobileFbmlMarkup , Long profileId ) throws FacebookException , IOException { } }
if ( null == profileFbmlMarkup && null == profileActionFbmlMarkup && null == mobileFbmlMarkup ) { throw new IllegalArgumentException ( "At least one of the FBML parameters must be provided" ) ; } if ( this . isDesktop ( ) && ( null != profileId && this . _userId != profileId ) ) { throw new IllegalArgumentException ( "Can't set FBML for another user from desktop app" ) ; } FacebookMethod method = FacebookMethod . PROFILE_SET_FBML ; ArrayList < Pair < String , CharSequence > > params = new ArrayList < Pair < String , CharSequence > > ( method . numParams ( ) ) ; if ( null != profileId && ! this . isDesktop ( ) ) params . add ( new Pair < String , CharSequence > ( "uid" , profileId . toString ( ) ) ) ; if ( null != profileFbmlMarkup ) params . add ( new Pair < String , CharSequence > ( "profile" , profileFbmlMarkup ) ) ; if ( null != profileActionFbmlMarkup ) params . add ( new Pair < String , CharSequence > ( "profile_action" , profileActionFbmlMarkup ) ) ; if ( null != mobileFbmlMarkup ) params . add ( new Pair < String , CharSequence > ( "mobile_fbml" , mobileFbmlMarkup ) ) ; return extractBoolean ( this . callMethod ( method , params ) ) ;
public class LevenbergMarquardt { /** * A = H + lambda * I < br > * < br > * where I is an identity matrix . */ private void computeA ( DenseMatrix64F A , DenseMatrix64F H , double lambda ) { } }
final int numParam = param . getNumElements ( ) ; A . set ( H ) ; for ( int i = 0 ; i < numParam ; i ++ ) { A . set ( i , i , A . get ( i , i ) + lambda ) ; }
public class ToolbarLarge { /** * Obtains the resource id of the theme , which should be applied on the toolbar . * @ return The resource id of the theme as an { @ link Integer } value */ private int obtainTheme ( ) { } }
TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( new int [ ] { R . attr . toolbarTheme } ) ; return typedArray . getResourceId ( 0 , 0 ) ;
public class CommonOps_DDRM { /** * Computes the sum of all the elements in the matrix : < br > * < br > * sum ( i = 1 : m , j = 1 : n ; a < sub > ij < / sub > ) * @ param mat An m by n matrix . Not modified . * @ return The sum of the elements . */ public static double elementSum ( DMatrixD1 mat ) { } }
double total = 0 ; int size = mat . getNumElements ( ) ; for ( int i = 0 ; i < size ; i ++ ) { total += mat . get ( i ) ; } return total ;
public class TextAnalysis { /** * Entropy double . * @ param source the source * @ return the double */ public double entropy ( final String source ) { } }
double output = 0 ; for ( int i = 1 ; i < source . length ( ) ; i ++ ) { TrieNode node = this . inner . matchEnd ( source . substring ( 0 , i ) ) ; Optional < ? extends TrieNode > child = node . getChild ( source . charAt ( i ) ) ; while ( ! child . isPresent ( ) ) { output += Math . log ( 1.0 / node . getCursorCount ( ) ) ; node = node . godparent ( ) ; child = node . getChild ( source . charAt ( i ) ) ; } output += Math . log ( child . get ( ) . getCursorCount ( ) * 1.0 / node . getCursorCount ( ) ) ; } return - output / Math . log ( 2 ) ;
public class WebSockets { /** * Sends a complete text message , invoking the callback when complete * @ param message The text to send * @ param wsChannel The web socket channel * @ param callback The callback to invoke on completion * @ param context The context object that will be passed to the callback on completion */ public static < T > void sendText ( final ByteBuffer message , final WebSocketChannel wsChannel , final WebSocketCallback < T > callback , T context ) { } }
sendInternal ( message , WebSocketFrameType . TEXT , wsChannel , callback , context , - 1 ) ;