signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class AnimatorModel { /** * Update in reverse mode routine . * @ param extrp The extrapolation value . */ private void updateReversing ( double extrp ) { } }
current -= speed * extrp ; // First frame reached , done if ( Double . compare ( current , first ) <= 0 ) { current = first ; if ( repeat ) { state = AnimState . PLAYING ; current += 1.0 ; } else { state = AnimState . FINISHED ; } }
public class CardUtils { /** * Returns a { @ link Card . CardBrand } corresponding to a partial card number , * or { @ link Card # UNKNOWN } if the card brand can ' t be determined from the input value . * @ param cardNumber a credit card number or partial card number * @ return the { @ link Card . CardBrand } corresponding to that number , * or { @ link Card # UNKNOWN } if it can ' t be determined */ @ NonNull @ Card . CardBrand public static String getPossibleCardType ( @ Nullable String cardNumber ) { } }
return getPossibleCardType ( cardNumber , true ) ;
public class WritableComparator { /** * Get a comparator for a { @ link WritableComparable } implementation . */ public static WritableComparator get ( Class < ? extends WritableComparable > c ) { } }
WritableComparator comparator = comparators . get ( c ) ; if ( comparator == null ) { // force the static initializers to run forceInit ( c ) ; // look to see if it is defined now comparator = comparators . get ( c ) ; // if not , use the generic one if ( comparator == null ) { comparator = new WritableComparator ( c , true ) ; } } return comparator ;
public class Sigmoid { /** * Computes the membership function evaluated at ` x ` * @ param x * @ return ` h / ( 1 + \ exp ( - s ( x - i ) ) ) ` * where ` h ` is the height of the Term , * ` s ` is the slope of the Sigmoid , * ` i ` is the inflection of the Sigmoid */ @ Override public double membership ( double x ) { } }
if ( Double . isNaN ( x ) ) { return Double . NaN ; } return height * 1.0 / ( 1.0 + Math . exp ( - slope * ( x - inflection ) ) ) ;
public class SimpleStringTrie { /** * Return the longest matching prefix of the input string that was added to the trie . * @ param input a string * @ return Optional of longest matching prefix that was added to the trie */ public Optional < String > get ( String input ) { } }
TrieNode currentNode = root ; int i = 0 ; for ( char c : input . toCharArray ( ) ) { TrieNode nextNode = currentNode . getChildren ( ) . get ( c ) ; if ( nextNode != null ) { i ++ ; currentNode = nextNode ; } else { if ( i > 0 && currentNode . isLeaf ( ) ) { return Optional . of ( input . substring ( 0 , i ) ) ; } } } if ( i > 0 && currentNode . isLeaf ( ) ) { return Optional . of ( input . substring ( 0 , i ) ) ; } return Optional . empty ( ) ;
public class TreeGenerator { /** * / < param name = " allowableDepth " > The maximum tree depth < / param > */ private static void PTC1 ( Program program , TreeNode parent_node , double p , int allowableDepth , RandEngine randEngine ) { } }
int child_count = parent_node . arity ( ) ; for ( int i = 0 ; i != child_count ; i ++ ) { Primitive data ; if ( allowableDepth == 0 ) { data = program . anyTerminal ( randEngine ) ; } else if ( randEngine . uniform ( ) <= p ) { data = program . anyOperator ( randEngine ) ; } else { data = program . anyTerminal ( randEngine ) ; } TreeNode child = new TreeNode ( data ) ; parent_node . getChildren ( ) . add ( child ) ; if ( ! data . isTerminal ( ) ) { PTC1 ( program , child , p , allowableDepth - 1 , randEngine ) ; } }
public class RecoverableUnitImpl { /** * Returns the identity of this recoverable unit . * @ return The identity of this recoverable unit . */ @ Override public long identity ( ) { } }
if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "identity" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "identity" , new Long ( _identity ) ) ; return _identity ;
public class OtpEpmd { /** * Register with Epmd , so that other nodes are able to find and connect to * it . * @ param node * the server node that should be registered with Epmd . * @ return true if the operation was successful . False if the node was * already registered . * @ exception java . io . IOException * if there was no response from the name server . */ public static boolean publishPort ( final OtpLocalNode node ) throws IOException { } }
OtpTransport s = null ; s = r4_publish ( node ) ; node . setEpmd ( s ) ; return s != null ;
public class MethodInvokerUtil { /** * if target service is ejb object , cache it , so this function can active * stateful session bean . * @ param targetServiceFactory * @ param targetMetaDef * @ return * @ throws Exception */ public Object createTargetObject ( TargetServiceFactory targetServiceFactory ) { } }
Debug . logVerbose ( "[JdonFramework] now getTargetObject by visitor " , module ) ; Object targetObjRef = null ; try { TargetMetaRequest targetMetaRequest = targetMetaRequestsHolder . getTargetMetaRequest ( ) ; TargetMetaDef targetMetaDef = targetMetaRequest . getTargetMetaDef ( ) ; if ( targetMetaDef . isEJB ( ) ) { // cache the ejb object ComponentVisitor cm = targetMetaRequest . getComponentVisitor ( ) ; targetMetaRequest . setVisitableName ( ComponentKeys . TARGETSERVICE_FACTORY ) ; Debug . logVerbose ( ComponentKeys . TARGETSERVICE_FACTORY + " in action (cache)" , module ) ; targetObjRef = cm . visit ( ) ; } else { Debug . logVerbose ( "[JdonFramework] not active targer service instance cache !!!!" , module ) ; targetObjRef = targetServiceFactory . create ( ) ; } } catch ( Exception e ) { Debug . logError ( "[JdonFramework]createTargetObject error: " + e , module ) ; } return targetObjRef ;
public class OrientModelGraph { /** * Returns true if the model is currently active , returns false if not . */ public boolean isModelActive ( ModelDescription model ) { } }
lockingMechanism . readLock ( ) . lock ( ) ; try { ODocument node = getModel ( model . toString ( ) ) ; return OrientModelGraphUtils . getActiveFieldValue ( node ) ; } finally { lockingMechanism . readLock ( ) . unlock ( ) ; }
public class AbstractPostProcessorChainFactory { /** * ( non - Javadoc ) * @ see * net . jawr . web . resource . bundle . factory . processor . PostProcessorChainFactory # * setCustomPostprocessors ( java . util . Map ) */ @ Override public void setCustomPostprocessors ( Map < String , String > keysClassNames ) { } }
for ( Entry < String , String > entry : keysClassNames . entrySet ( ) ) { ResourceBundlePostProcessor customProcessor = ( ResourceBundlePostProcessor ) ClassLoaderResourceUtils . buildObjectInstance ( ( String ) entry . getValue ( ) ) ; boolean isVariantPostProcessor = customProcessor . getClass ( ) . getAnnotation ( VariantPostProcessor . class ) != null ; if ( customProcessor instanceof BundlingProcessLifeCycleListener ) { listeners . add ( ( BundlingProcessLifeCycleListener ) customProcessor ) ; } String key = ( String ) entry . getKey ( ) ; customPostProcessors . put ( key , getCustomProcessorWrapper ( customProcessor , key , isVariantPostProcessor ) ) ; }
public class FlattenMojo { /** * Creates a flattened { @ link List } of { @ link Repository } elements where those from super - POM are omitted . * @ param repositories is the { @ link List } of { @ link Repository } elements . May be < code > null < / code > . * @ return the flattened { @ link List } of { @ link Repository } elements or < code > null < / code > if < code > null < / code > was * given . */ protected static List < Repository > createFlattenedRepositories ( List < Repository > repositories ) { } }
if ( repositories != null ) { List < Repository > flattenedRepositories = new ArrayList < Repository > ( repositories . size ( ) ) ; for ( Repository repo : repositories ) { // filter inherited repository section from super POM ( see MOJO - 2042 ) . . . if ( ! isCentralRepositoryFromSuperPom ( repo ) ) { flattenedRepositories . add ( repo ) ; } } return flattenedRepositories ; } return repositories ;
public class ArtifactFileEntry { /** * { @ inheritDoc } */ public InputStream getInputStream ( ) throws IOException { } }
try { return store . get ( artifact ) ; } catch ( ArtifactNotFoundException e ) { IOException ioe = new IOException ( "Artifact does not exist" ) ; ioe . initCause ( e ) ; throw ioe ; }
public class ApiOvhConfigBasic { /** * storage for previous CK * @ return File used to store consumer key */ protected File gettmpStore ( String nic ) { } }
if ( consumer_key_storage == null || ! consumer_key_storage . isDirectory ( ) ) { if ( e1 == 0 ) { e1 ++ ; log . error ( "No cert directory, can not save consumer_key! please set `consumer_key_storage` variable to a valid directory in your {}, or in your environ variale OVH_CONSUMER_KEY_STORAGE" , configFiles ) ; } return null ; } return new File ( consumer_key_storage , nic + ".ck.txt" ) ;
public class Util { /** * Converts the ResultSet column values into parameters to the constructor * ( with number of parameters equals the number of columns ) of type * < code > T < / code > then returns an instance of type < code > T < / code > . See See * { @ link Builder # autoMap ( Class ) } . * @ param cls * the class of the resultant instance * @ return an automapped instance */ @ SuppressWarnings ( "unchecked" ) static < T > T autoMap ( ResultSet rs , Class < T > cls ) { } }
try { if ( cls . isInterface ( ) ) { return autoMapInterface ( rs , cls ) ; } else { int n = rs . getMetaData ( ) . getColumnCount ( ) ; for ( Constructor < ? > c : cls . getDeclaredConstructors ( ) ) { if ( n == c . getParameterTypes ( ) . length ) { return autoMap ( rs , ( Constructor < T > ) c ) ; } } throw new RuntimeException ( "constructor with number of parameters=" + n + " not found in " + cls ) ; } } catch ( SQLException e ) { throw new SQLRuntimeException ( e ) ; }
public class StateService { /** * < p > Creates a new instance of an implementation of { @ link StateManager } . * @ param context * the invocation context * @ return a new instance of { @ link StateManager } . * @ since 1.1.1 */ public static final synchronized StateManager getInstance ( Object context ) { } }
return ( instance == null ) ? ( instance = new StateService ( ContextUtils . asApplication ( context ) ) ) : instance ;
public class ChineseCalendar { /** * Return the major solar term on or after December 15 of the given * Gregorian year , that is , the winter solstice of the given year . * Computations are relative to Asia / Shanghai time zone . * @ param gyear a Gregorian year * @ return days after January 1 , 1970 0:00 Asia / Shanghai of the * winter solstice of the given year */ private int winterSolstice ( int gyear ) { } }
long cacheValue = winterSolsticeCache . get ( gyear ) ; if ( cacheValue == CalendarCache . EMPTY ) { // In books December 15 is used , but it fails for some years // using our algorithms , e . g . : 1298 1391 1492 1553 1560 . That // is , winterSolstice ( 1298 ) starts search at Dec 14 08:00:00 // PST 1298 with a final result of Dec 14 10:31:59 PST 1299. long ms = daysToMillis ( computeGregorianMonthStart ( gyear , DECEMBER ) + 1 - EPOCH_JULIAN_DAY ) ; astro . setTime ( ms ) ; // Winter solstice is 270 degrees solar longitude aka Dongzhi long solarLong = astro . getSunTime ( CalendarAstronomer . WINTER_SOLSTICE , true ) ; cacheValue = millisToDays ( solarLong ) ; winterSolsticeCache . put ( gyear , cacheValue ) ; } return ( int ) cacheValue ;
public class Server { /** * Start the server . */ public void run ( ) { } }
String hostName = host != null ? host : "localhost" ; ServerTools . print ( "Starting LanguageTool " + JLanguageTool . VERSION + " (build date: " + JLanguageTool . BUILD_DATE + ", " + JLanguageTool . GIT_SHORT_ID + ") server on " + getProtocol ( ) + "://" + hostName + ":" + port + "..." ) ; server . start ( ) ; isRunning = true ; ServerTools . print ( "Server started" ) ;
public class SeleniumSpec { /** * Verifies that a webelement previously found has { @ code text } as text * @ param index * @ param text */ @ Then ( "^the element on index '(\\d+?)' has '(.+?)' as text$" ) public void assertSeleniumTextOnElementPresent ( Integer index , String text ) { } }
assertThat ( commonspec . getPreviousWebElements ( ) ) . as ( "There are less found elements than required" ) . hasAtLeast ( index ) ; String elementText = commonspec . getPreviousWebElements ( ) . getPreviousWebElements ( ) . get ( index ) . getText ( ) . replace ( "\n" , " " ) . replace ( "\r" , " " ) ; if ( ! elementText . startsWith ( "regex:" ) ) { // We are verifying that a web element contains a string assertThat ( elementText . matches ( "(.*)" + text + "(.*)" ) ) . isTrue ( ) ; } else { // We are verifying that a web element contains a regex assertThat ( elementText . matches ( text . substring ( text . indexOf ( "regex:" ) + 6 , text . length ( ) ) ) ) . isTrue ( ) ; }
public class VersionHelper { /** * Builds a range before version parts . */ public VersionRange before ( final int ... parts ) { } }
checkNotNull ( parts ) ; checkArgument ( parts . length != 0 ) ; StringBuilder buff = new StringBuilder ( ) . append ( "(," ) ; for ( int i = 0 ; i < parts . length ; i ++ ) { buff . append ( parts [ i ] ) ; if ( i + 1 < parts . length ) { buff . append ( "." ) ; } } buff . append ( "-" ) . append ( EARLIEST_SUFFIX ) . append ( ")" ) ; log . trace ( "Range pattern: {}" , buff ) ; return parseRange ( buff . toString ( ) ) ;
public class VRPResourceManager { /** * Get the ID of the VRP a VM belongs to . If the VM does not belong to any VRP , the returned optional string will * not be set to any value . * @ param vm VirtualMachine to get VRP of * @ return ID of the VRP * @ throws InvalidState * @ throws NotFound * @ throws RuntimeFault * @ throws RemoteException */ public String getVRPofVM ( VirtualMachine vm ) throws InvalidState , NotFound , RuntimeFault , RemoteException { } }
return getVimService ( ) . getVRPofVM ( getMOR ( ) , vm . getMOR ( ) ) ;
public class Unchecked { /** * Wrap a { @ link CheckedObjIntConsumer } in a { @ link ObjIntConsumer } . */ public static < T > ObjIntConsumer < T > objIntConsumer ( CheckedObjIntConsumer < T > consumer ) { } }
return objIntConsumer ( consumer , THROWABLE_TO_RUNTIME_EXCEPTION ) ;
public class CommandLineParser { /** * Build properties from command - line arguments and system properties */ public static Properties parseArguments ( String [ ] args ) { } }
Properties props = argumentsToProperties ( args ) ; // complete with only the system properties that start with " sonar . " for ( Map . Entry < Object , Object > entry : System . getProperties ( ) . entrySet ( ) ) { String key = entry . getKey ( ) . toString ( ) ; if ( key . startsWith ( "sonar." ) ) { props . setProperty ( key , entry . getValue ( ) . toString ( ) ) ; } } return props ;
public class HttpTunnelServer { /** * Returns the active server thread , creating and starting it if necessary . * @ return the { @ code ServerThread } ( never { @ code null } ) * @ throws IOException in case of I / O errors */ protected ServerThread getServerThread ( ) throws IOException { } }
synchronized ( this ) { if ( this . serverThread == null ) { ByteChannel channel = this . serverConnection . open ( this . longPollTimeout ) ; this . serverThread = new ServerThread ( channel ) ; this . serverThread . start ( ) ; } return this . serverThread ; }
public class ReadHandler { /** * Return a set of attributes as a map with the attribute name as key and their values as values */ private List < String > getAllAttributesNames ( MBeanServerExecutor pServerManager , ObjectName pObjectName ) throws IOException , ReflectionException , MBeanException , AttributeNotFoundException , InstanceNotFoundException { } }
MBeanInfo mBeanInfo = getMBeanInfo ( pServerManager , pObjectName ) ; List < String > ret = new ArrayList < String > ( ) ; for ( MBeanAttributeInfo attrInfo : mBeanInfo . getAttributes ( ) ) { if ( attrInfo . isReadable ( ) ) { ret . add ( attrInfo . getName ( ) ) ; } } return ret ;
public class NotificationsApi { /** * CometD connect * See the [ CometD documentation ] ( https : / / docs . cometd . org / current / reference / # _ bayeux _ meta _ connect ) for details . * @ return ApiResponse & lt ; Void & gt ; * @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */ public ApiResponse < Void > notificationsConnectWithHttpInfo ( ) throws ApiException { } }
com . squareup . okhttp . Call call = notificationsConnectValidateBeforeCall ( null , null ) ; return apiClient . execute ( call ) ;
public class JarDiff { /** * Clones the method , but changes access , setting deprecated flag . * @ param methodInfo * the original method info * @ return the cloned and deprecated method info . */ private static MethodInfo cloneDeprecated ( MethodInfo methodInfo ) { } }
return new MethodInfo ( methodInfo . getAccess ( ) | Opcodes . ACC_DEPRECATED , methodInfo . getName ( ) , methodInfo . getDesc ( ) , methodInfo . getSignature ( ) , methodInfo . getExceptions ( ) ) ;
public class ConicalGradient { /** * private List < Stop > normalizeStops ( final Stop . . . STOPS ) { return normalizeStops ( 0 , Arrays . asList ( STOPS ) ) ; } * private List < Stop > normalizeStops ( final double OFFSET , final Stop . . . STOPS ) { return normalizeStops ( OFFSET , Arrays . asList ( STOPS ) ) ; } * private List < Stop > normalizeStops ( final List < Stop > STOPS ) { return normalizeStops ( 0 , STOPS ) ; } */ private List < Stop > normalizeStops ( final double OFFSET , final List < Stop > STOPS ) { } }
double offset = Helper . clamp ( 0.0 , 1.0 , OFFSET ) ; List < Stop > stops ; if ( null == STOPS || STOPS . isEmpty ( ) ) { stops = new ArrayList < > ( ) ; stops . add ( new Stop ( 0.0 , Color . TRANSPARENT ) ) ; stops . add ( new Stop ( 1.0 , Color . TRANSPARENT ) ) ; } else { stops = STOPS ; } List < Stop > sortedStops = calculate ( stops , offset ) ; // Reverse the Stops for CCW direction if ( ScaleDirection . COUNTER_CLOCKWISE == scaleDirection ) { List < Stop > sortedStops3 = new ArrayList < > ( ) ; Collections . reverse ( sortedStops ) ; for ( Stop stop : sortedStops ) { sortedStops3 . add ( new Stop ( 1.0 - stop . getOffset ( ) , stop . getColor ( ) ) ) ; } sortedStops = sortedStops3 ; } return sortedStops ;
public class ColumnImpl { /** * Returns the < code > precision < / code > attribute * @ return the value defined for the attribute < code > precision < / code > */ public Integer getPrecision ( ) { } }
if ( childNode . getAttribute ( "precision" ) != null && ! childNode . getAttribute ( "precision" ) . equals ( "null" ) ) { return Integer . valueOf ( childNode . getAttribute ( "precision" ) ) ; } return null ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcAirToAirHeatRecoveryType ( ) { } }
if ( ifcAirToAirHeatRecoveryTypeEClass == null ) { ifcAirToAirHeatRecoveryTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 9 ) ; } return ifcAirToAirHeatRecoveryTypeEClass ;
public class Intersectionf { /** * Find the closest points on the two line segments , store the point on the first line segment in < code > resultA < / code > and * the point on the second line segment in < code > resultB < / code > , and return the square distance between both points . * Reference : Book " Real - Time Collision Detection " chapter 5.1.9 " Closest Points of Two Line Segments " * @ param a0X * the x coordinate of the first line segment ' s first end point * @ param a0Y * the y coordinate of the first line segment ' s first end point * @ param a0Z * the z coordinate of the first line segment ' s first end point * @ param a1X * the x coordinate of the first line segment ' s second end point * @ param a1Y * the y coordinate of the first line segment ' s second end point * @ param a1Z * the z coordinate of the first line segment ' s second end point * @ param b0X * the x coordinate of the second line segment ' s first end point * @ param b0Y * the y coordinate of the second line segment ' s first end point * @ param b0Z * the z coordinate of the second line segment ' s first end point * @ param b1X * the x coordinate of the second line segment ' s second end point * @ param b1Y * the y coordinate of the second line segment ' s second end point * @ param b1Z * the z coordinate of the second line segment ' s second end point * @ param resultA * will hold the point on the first line segment * @ param resultB * will hold the point on the second line segment * @ return the square distance between the two closest points */ public static float findClosestPointsLineSegments ( float a0X , float a0Y , float a0Z , float a1X , float a1Y , float a1Z , float b0X , float b0Y , float b0Z , float b1X , float b1Y , float b1Z , Vector3f resultA , Vector3f resultB ) { } }
float d1x = a1X - a0X , d1y = a1Y - a0Y , d1z = a1Z - a0Z ; float d2x = b1X - b0X , d2y = b1Y - b0Y , d2z = b1Z - b0Z ; float rX = a0X - b0X , rY = a0Y - b0Y , rZ = a0Z - b0Z ; float a = d1x * d1x + d1y * d1y + d1z * d1z ; float e = d2x * d2x + d2y * d2y + d2z * d2z ; float f = d2x * rX + d2y * rY + d2z * rZ ; float EPSILON = 1E-5f ; float s , t ; if ( a <= EPSILON && e <= EPSILON ) { // Both segments degenerate into points resultA . set ( a0X , a0Y , a0Z ) ; resultB . set ( b0X , b0Y , b0Z ) ; return resultA . dot ( resultB ) ; } if ( a <= EPSILON ) { // First segment degenerates into a point s = 0.0f ; t = f / e ; t = Math . min ( Math . max ( t , 0.0f ) , 1.0f ) ; } else { float c = d1x * rX + d1y * rY + d1z * rZ ; if ( e <= EPSILON ) { // Second segment degenerates into a point t = 0.0f ; s = Math . min ( Math . max ( - c / a , 0.0f ) , 1.0f ) ; } else { // The general nondegenerate case starts here float b = d1x * d2x + d1y * d2y + d1z * d2z ; float denom = a * e - b * b ; // If segments not parallel , compute closest point on L1 to L2 and // clamp to segment S1 . Else pick arbitrary s ( here 0) if ( denom != 0.0 ) s = Math . min ( Math . max ( ( b * f - c * e ) / denom , 0.0f ) , 1.0f ) ; else s = 0.0f ; // Compute point on L2 closest to S1 ( s ) using // t = Dot ( ( P1 + D1 * s ) - P2 , D2 ) / Dot ( D2 , D2 ) = ( b * s + f ) / e t = ( b * s + f ) / e ; // If t in [ 0,1 ] done . Else clamp t , recompute s for the new value // of t using s = Dot ( ( P2 + D2 * t ) - P1 , D1 ) / Dot ( D1 , D1 ) = ( t * b - c ) / a // and clamp s to [ 0 , 1] if ( t < 0.0 ) { t = 0.0f ; s = Math . min ( Math . max ( - c / a , 0.0f ) , 1.0f ) ; } else if ( t > 1.0 ) { t = 1.0f ; s = Math . min ( Math . max ( ( b - c ) / a , 0.0f ) , 1.0f ) ; } } } resultA . set ( a0X + d1x * s , a0Y + d1y * s , a0Z + d1z * s ) ; resultB . set ( b0X + d2x * t , b0Y + d2y * t , b0Z + d2z * t ) ; float dX = resultA . x - resultB . x , dY = resultA . y - resultB . y , dZ = resultA . z - resultB . z ; return dX * dX + dY * dY + dZ * dZ ;
public class Preconditions { /** * Precondition that clients are required to fulfill . * Violations are considered to be programming errors , on the clients part . * @ param condition the condition to check * @ param message the fail message template * @ param args the message template arguments * @ throws RequireViolation if the < tt > predicate < / tt > is < b > false < / b > */ public static void require ( boolean condition , String message , Object ... args ) { } }
if ( ! condition ) { throw new RequireViolation ( format ( message , args ) ) ; }
public class Compare { /** * Compare the Levenshtein Distance between the two strings * @ param title1 title * @ param title2 title * @ param distance max distance */ private static boolean compareDistance ( final String title1 , final String title2 , int distance ) { } }
return StringUtils . getLevenshteinDistance ( title1 , title2 ) <= distance ;
public class JacksonDBCollection { /** * Performs an update operation . * @ param id The id of the document to update * @ param update update with which to update < tt > query < / tt > * @ return The write result * @ throws MongoException If an error occurred */ public WriteResult < T , K > updateById ( K id , DBUpdate . Builder update ) throws MongoException { } }
return this . update ( createIdQuery ( id ) , update . serialiseAndGet ( objectMapper ) ) ;
public class RouteTablesInner { /** * Create or updates a route table in a specified resource group . * @ param resourceGroupName The name of the resource group . * @ param routeTableName The name of the route table . * @ param parameters Parameters supplied to the create or update route table operation . * @ 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 < RouteTableInner > beginCreateOrUpdateAsync ( String resourceGroupName , String routeTableName , RouteTableInner parameters , final ServiceCallback < RouteTableInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( beginCreateOrUpdateWithServiceResponseAsync ( resourceGroupName , routeTableName , parameters ) , serviceCallback ) ;
public class KubernetesDeserializer { /** * Registers a Custom Resource Definition Kind */ public static void registerCustomKind ( String apiVersion , String kind , Class < ? extends KubernetesResource > clazz ) { } }
MAP . put ( getKey ( apiVersion , kind ) , clazz ) ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcCsgPrimitive3D ( ) { } }
if ( ifcCsgPrimitive3DEClass == null ) { ifcCsgPrimitive3DEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 156 ) ; } return ifcCsgPrimitive3DEClass ;
public class JsonWriter { /** * Write a boolean field to the JSON file . * @ param fieldName field name * @ param value field value */ private void writeBooleanField ( String fieldName , Object value ) throws IOException { } }
boolean val = ( ( Boolean ) value ) . booleanValue ( ) ; if ( val ) { m_writer . writeNameValuePair ( fieldName , val ) ; }
public class AbstractRequireFiles { /** * ( non - Javadoc ) * @ see org . apache . maven . enforcer . rule . api . EnforcerRule # execute ( org . apache . maven . enforcer . rule . api . EnforcerRuleHelper ) */ public void execute ( EnforcerRuleHelper helper ) throws EnforcerRuleException { } }
if ( ! allowNulls && files . length == 0 ) { throw new EnforcerRuleException ( "The file list is empty and Null files are disabled." ) ; } List < File > failures = new ArrayList < File > ( ) ; for ( File file : files ) { if ( ! allowNulls && file == null ) { failures . add ( file ) ; } else if ( ! checkFile ( file ) ) { failures . add ( file ) ; } } // if anything was found , log it with the optional message . if ( ! failures . isEmpty ( ) ) { String message = getMessage ( ) ; StringBuilder buf = new StringBuilder ( ) ; if ( message != null ) { buf . append ( message + "\n" ) ; } buf . append ( getErrorMsg ( ) ) ; for ( File file : failures ) { if ( file != null ) { buf . append ( file . getAbsolutePath ( ) + "\n" ) ; } else { buf . append ( "(an empty filename was given and allowNulls is false)\n" ) ; } } throw new EnforcerRuleException ( buf . toString ( ) ) ; }
public class ModbusMaster { /** * This function code allows reading the identification and additional information relative to the * physical and functional description of a remote device , only . * The Read Device Identification interface is modeled as an address space composed of a set * of addressable data elements . The data elements are called objects and an object Id * identifies them . * The interface consists of 3 categories of objects : * Basic Device Identification . All objects of this category are mandatory : VendorName , * Product code , and revision number . * Regular Device Identification . In addition to Basic data objects , the device provides * additional and optional identification and description data objects . All of the objects of * this category are defined in the standard but their implementation is optional . * Extended Device Identification . In addition to regular data objects , the device provides * additional and optional identification and description private data about the physical * device itself . All of these data are device dependent . * ObjectId ObjectName / Description Type M / O category * 0x00 VendorName ASCII String Mandatory Basic * 0x01 ProductCode ASCII String Mandatory Basic * 0x02 MajorMinorRevision ASCII String Mandatory Basic * 0x03 VendorUrl ASCII String Optional Regular * 0x04 ProductName ASCII String Optional Regular * 0x05 ModelName ASCII String Optional Regular * 0x06 UserApplicationName ASCII String Optional Regular * 0x07 Reserved Optional Optional Regular * 0x7F * 0x80 Private objects may be optionally device Optional Extended * . . . defined . The range [ 0x80 – 0xFF ] dependant * 0xFF is Product dependant . */ final public MEIReadDeviceIdentification readDeviceIdentification ( int serverAddress , int objectId , ReadDeviceIdentificationCode readDeviceId ) throws ModbusProtocolException , ModbusNumberException , ModbusIOException { } }
EncapsulatedInterfaceTransportResponse response = ( EncapsulatedInterfaceTransportResponse ) processRequest ( ModbusRequestBuilder . getInstance ( ) . buildReadDeviceIdentification ( serverAddress , objectId , readDeviceId ) ) ; return ( MEIReadDeviceIdentification ) response . getMei ( ) ;
public class Geobox { /** * Calculates the great circle distance between two points ( law of cosines ) . * @ param p1 indicating the first point . * @ param p2 indicating the second point . * @ return The 2D great - circle distance between the two given points , in meters . */ public static double distance ( DLocation p1 , DLocation p2 ) { } }
double p1lat = Math . toRadians ( p1 . getLatitude ( ) ) ; double p1lon = Math . toRadians ( p1 . getLongitude ( ) ) ; double p2lat = Math . toRadians ( p2 . getLatitude ( ) ) ; double p2lon = Math . toRadians ( p2 . getLongitude ( ) ) ; return distance ( p1lat , p1lon , p2lat , p2lon ) ;
public class FlowLayoutA { /** * { @ inheritDoc } */ @ Override protected void onMeasure ( int widthMeasureSpec , int heightMeasureSpec ) { } }
super . onMeasure ( widthMeasureSpec , heightMeasureSpec ) ; int sizeWidth = MeasureSpec . getSize ( widthMeasureSpec ) - getPaddingLeft ( ) - getPaddingRight ( ) ; int sizeHeight = MeasureSpec . getSize ( heightMeasureSpec ) ; int modeWidth = MeasureSpec . getMode ( widthMeasureSpec ) ; int modeHeight = MeasureSpec . getMode ( heightMeasureSpec ) ; int width = 0 ; int height = getPaddingTop ( ) + getPaddingBottom ( ) ; int lineWidth = 0 ; int lineHeight = 0 ; int childCount = getChildCount ( ) ; for ( int i = 0 ; i < childCount ; i ++ ) { View child = getChildAt ( i ) ; boolean lastChild = i == childCount - 1 ; if ( child . getVisibility ( ) == View . GONE ) { if ( lastChild ) { width = Math . max ( width , lineWidth ) ; height += lineHeight ; } continue ; } measureChildWithMargins ( child , widthMeasureSpec , lineWidth , heightMeasureSpec , height ) ; LayoutParams lp = ( LayoutParams ) child . getLayoutParams ( ) ; int childWidthMode = MeasureSpec . AT_MOST ; int childWidthSize = sizeWidth ; int childHeightMode = MeasureSpec . AT_MOST ; int childHeightSize = sizeHeight ; if ( lp . width == LayoutParams . MATCH_PARENT ) { childWidthMode = MeasureSpec . EXACTLY ; childWidthSize -= lp . leftMargin + lp . rightMargin ; } else if ( lp . width >= 0 ) { childWidthMode = MeasureSpec . EXACTLY ; childWidthSize = lp . width ; } if ( lp . height >= 0 ) { childHeightMode = MeasureSpec . EXACTLY ; childHeightSize = lp . height ; } else if ( modeHeight == MeasureSpec . UNSPECIFIED ) { childHeightMode = MeasureSpec . UNSPECIFIED ; childHeightSize = 0 ; } child . measure ( MeasureSpec . makeMeasureSpec ( childWidthSize , childWidthMode ) , MeasureSpec . makeMeasureSpec ( childHeightSize , childHeightMode ) ) ; int childWidth = child . getMeasuredWidth ( ) + lp . leftMargin + lp . rightMargin ; if ( lineWidth + childWidth > sizeWidth ) { width = Math . max ( width , lineWidth ) ; lineWidth = childWidth ; height += lineHeight ; lineHeight = child . getMeasuredHeight ( ) + lp . topMargin + lp . bottomMargin ; } else { lineWidth += childWidth ; lineHeight = Math . max ( lineHeight , child . getMeasuredHeight ( ) + lp . topMargin + lp . bottomMargin ) ; } if ( lastChild ) { width = Math . max ( width , lineWidth ) ; height += lineHeight ; } } width += getPaddingLeft ( ) + getPaddingRight ( ) ; setMeasuredDimension ( ( modeWidth == MeasureSpec . EXACTLY ) ? sizeWidth : width , ( modeHeight == MeasureSpec . EXACTLY ) ? sizeHeight : height ) ;
public class StartEventHandler { /** * The results of this method are only used to check syntax */ protected void readDataOutput ( org . w3c . dom . Node xmlNode , StartNode startNode ) { } }
String id = ( ( Element ) xmlNode ) . getAttribute ( "id" ) ; String outputName = ( ( Element ) xmlNode ) . getAttribute ( "name" ) ; dataOutputs . put ( id , outputName ) ;
public class InternalPureXbaseParser { /** * $ ANTLR start synpred35 _ InternalPureXbase */ public final void synpred35_InternalPureXbase_fragment ( ) throws RecognitionException { } }
// InternalPureXbase . g : 3724:6 : ( ( ( ( ruleJvmFormalParameter ) ) ' : ' ) ) // InternalPureXbase . g : 3724:7 : ( ( ( ruleJvmFormalParameter ) ) ' : ' ) { // InternalPureXbase . g : 3724:7 : ( ( ( ruleJvmFormalParameter ) ) ' : ' ) // InternalPureXbase . g : 3725:7 : ( ( ruleJvmFormalParameter ) ) ' : ' { // InternalPureXbase . g : 3725:7 : ( ( ruleJvmFormalParameter ) ) // InternalPureXbase . g : 3726:8 : ( ruleJvmFormalParameter ) { // InternalPureXbase . g : 3726:8 : ( ruleJvmFormalParameter ) // InternalPureXbase . g : 3727:9 : ruleJvmFormalParameter { pushFollow ( FOLLOW_52 ) ; ruleJvmFormalParameter ( ) ; state . _fsp -- ; if ( state . failed ) return ; } } match ( input , 22 , FOLLOW_2 ) ; if ( state . failed ) return ; } }
public class BadgeView { /** * Sets a notification number in the badge . * @ param notifications */ @ SuppressLint ( "SetTextI18n" ) public void setNotifications ( Integer notifications ) { } }
if ( ( notifications != null ) && ( notifications > 0 ) ) { setVisibility ( VISIBLE ) ; if ( notifications > maximum ) { this . setText ( maximum + "+" ) ; } else { this . setText ( notifications . toString ( ) ) ; } } else { setVisibility ( GONE ) ; }
public class CommerceTaxMethodWrapper { /** * Returns the localized name of this commerce tax method in the language , optionally using the default language if no localization exists for the requested language . * @ param languageId the ID of the language * @ param useDefault whether to use the default language if no localization exists for the requested language * @ return the localized name of this commerce tax method */ @ Override public String getName ( String languageId , boolean useDefault ) { } }
return _commerceTaxMethod . getName ( languageId , useDefault ) ;
public class WebLogDataGenerator { /** * Generates the files for the visits relation . The visits entries apply the * following format : < br / > * < code > IP Address | URL | Date ( YYYY - MM - DD ) | Misc . Data ( e . g . User - Agent ) | \ n < / code > * @ param noVisits * Number of entries for the visits relation * @ param noDocs * Number of entries in the documents relation * @ param path * Output path for the visits relation */ private static void genVisits ( int noVisits , int noDocs , String path ) { } }
Random rand = new Random ( Calendar . getInstance ( ) . getTimeInMillis ( ) ) ; try ( BufferedWriter fw = new BufferedWriter ( new FileWriter ( path ) ) ) { for ( int i = 0 ; i < noVisits ; i ++ ) { int year = 2000 + rand . nextInt ( 10 ) ; // yearFilter 3 int month = rand . nextInt ( 12 ) + 1 ; // month between 1 and 12 int day = rand . nextInt ( 27 ) + 1 ; // day between 1 and 28 // IP address StringBuilder visit = new StringBuilder ( rand . nextInt ( 256 ) + "." + rand . nextInt ( 256 ) + "." + rand . nextInt ( 256 ) + "." + rand . nextInt ( 256 ) + "|" ) ; // URL visit . append ( "url_" + rand . nextInt ( noDocs ) + "|" ) ; // Date ( format : YYYY - MM - DD ) visit . append ( year + "-" + month + "-" + day + "|" ) ; // Miscellaneous data , e . g . User - Agent visit . append ( "0.12|Mozilla Firefox 3.1|de|de|Nothing special|124|\n" ) ; fw . write ( visit . toString ( ) ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; }
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcRelAssignsToResource ( ) { } }
if ( ifcRelAssignsToResourceEClass == null ) { ifcRelAssignsToResourceEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 446 ) ; } return ifcRelAssignsToResourceEClass ;
public class JDescTextField { /** * Gained the focus . * Need to get rid of the description ( temporarily ) . */ public void myFocusGained ( ) { } }
m_bInFocus = true ; String strText = super . getText ( ) ; if ( m_strDescription . equals ( strText ) ) { // Don ' t notify of change if ( m_actionListener != null ) this . removeActionListener ( m_actionListener ) ; this . changeFont ( false ) ; super . setText ( Constants . BLANK ) ; if ( m_actionListener != null ) this . addActionListener ( m_actionListener ) ; }
public class Promises { /** * Returns an array of provided { @ code type } and length 0 * wrapped in { @ code Promise } . */ @ SuppressWarnings ( "unchecked" ) @ Contract ( pure = true ) @ NotNull public static < T > Promise < T [ ] > toArray ( @ NotNull Class < T > type ) { } }
return Promise . of ( ( T [ ] ) Array . newInstance ( type , 0 ) ) ;
public class AbstractServer { /** * Quits server by closing server socket and closing client socket handlers . */ protected synchronized void quit ( ) { } }
log . debug ( "Stopping {}" , getName ( ) ) ; closeServerSocket ( ) ; // Close all handlers . Handler threads terminate if run loop exits synchronized ( handlers ) { for ( ProtocolHandler handler : handlers ) { handler . close ( ) ; } handlers . clear ( ) ; } log . debug ( "Stopped {}" , getName ( ) ) ;
public class AmazonS3Client { /** * Adds the specified parameter to the specified request , if the parameter * value is not null . * @ param request * The request to add the parameter to . * @ param paramName * The parameter name . * @ param paramValue * The parameter value . */ private static void addParameterIfNotNull ( Request < ? > request , String paramName , String paramValue ) { } }
if ( paramValue != null ) { request . addParameter ( paramName , paramValue ) ; }
public class HttpPrefixFetchFilter { /** * Returns the normalised form of the given { @ code scheme } . * The normalisation process consists in converting the scheme to lowercase , if { @ code null } it is returned an empty * { @ code String } . * @ param scheme the scheme that will be normalised * @ return a { @ code String } with the host scheme , never { @ code null } * @ see URI # getRawScheme ( ) */ private static String normalisedScheme ( char [ ] scheme ) { } }
if ( scheme == null ) { return "" ; } return new String ( scheme ) . toLowerCase ( Locale . ROOT ) ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcAmountOfSubstanceMeasure ( ) { } }
if ( ifcAmountOfSubstanceMeasureEClass == null ) { ifcAmountOfSubstanceMeasureEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 780 ) ; } return ifcAmountOfSubstanceMeasureEClass ;
public class LocalDirAllocator { /** * Get a path from the local FS . This method should be used if the size of * the file is not known apriori . We go round - robin over the set of disks * ( via the configured dirs ) and return the first complete path where * we could create the parent directory of the passed path . * @ param pathStr the requested path ( this will be created on the first * available disk ) * @ param conf the Configuration object * @ return the complete path to the file on a local disk * @ throws IOException */ public Path getLocalPathForWrite ( String pathStr , Configuration conf ) throws IOException { } }
return getLocalPathForWrite ( pathStr , - 1 , conf ) ;
public class IoDevice { /** * Use this method to turn on and off the visibility of the { @ link Cursor } * @ param visible < code > true < / code > makes the { @ link Cursor } visible and * < code > false < / code > turns off its visibility . */ protected void setVisible ( boolean visible ) { } }
GVRSceneObject sceneObject = gvrCursorController . getCursor ( ) ; if ( sceneObject != null && sceneObject . isEnabled ( ) != visible ) { sceneObject . setEnable ( visible ) ; }
public class AbstractResourceDeliveryHttpHandler { /** * Determine the MIME type of the resource to deliver . * @ param sFilename * The passed filename to stream . Never < code > null < / code > . * @ param aResource * The resolved resource . Never < code > null < / code > . * @ return < code > null < / code > if no MIME type could be determined */ @ OverrideOnDemand @ Nullable protected String determineMimeType ( @ Nonnull final String sFilename , @ Nonnull final IReadableResource aResource ) { } }
return MimeTypeInfoManager . getDefaultInstance ( ) . getPrimaryMimeTypeStringForFilename ( sFilename ) ;
public class SimpleArangoRepository { /** * Finds if a document with the given id exists in the database * @ param id * the id of the document to search for * @ return the object representing the document if found */ @ Override public Optional < T > findById ( final ID id ) { } }
return arangoOperations . find ( id , domainClass ) ;
public class DatabaseImpl { /** * < p > Returns the DocumentStore ' s unique identifier . < / p > * < p > This is used for the checkpoint document in a remote DocumentStore * during replication . < / p > * @ return a unique identifier for the DocumentStore . * @ throws DocumentStoreException if there was an error retrieving the unique identifier from the * database */ public String getPublicIdentifier ( ) throws DocumentStoreException { } }
Misc . checkState ( this . isOpen ( ) , "Database is closed" ) ; try { return get ( queue . submit ( new GetPublicIdentifierCallable ( ) ) ) ; } catch ( ExecutionException e ) { logger . log ( Level . SEVERE , "Failed to get public ID" , e ) ; throw new DocumentStoreException ( "Failed to get public ID" , e ) ; }
public class SearchViewFacade { /** * Look for a child view with the given id . If this view has the given * id , return this view . * @ param id The id to search for . * @ return The view that has the given id in the hierarchy or null */ @ Nullable public View findViewById ( int id ) { } }
if ( searchView != null ) { return searchView . findViewById ( id ) ; } else if ( supportView != null ) { return supportView . findViewById ( id ) ; } throw new IllegalStateException ( ERROR_NO_SEARCHVIEW ) ;
public class RasterLayerPainter { /** * Delete a { @ link Paintable } object from the given { @ link MapContext } . It the object does not exist , nothing * will be done . * @ param paintable * The raster layer * @ param group * The group where the object resides in ( optional ) . * @ param graphics * The context to paint on . */ public void deleteShape ( Paintable paintable , Object group , MapContext context ) { } }
context . getRasterContext ( ) . deleteGroup ( paintable ) ;
public class AWSStorageGatewayClient { /** * Lists the recovery points for a specified gateway . This operation is only supported in the cached volume gateway * type . * Each cache volume has one recovery point . A volume recovery point is a point in time at which all data of the * volume is consistent and from which you can create a snapshot or clone a new cached volume from a source volume . * To create a snapshot from a volume recovery point use the < a > CreateSnapshotFromVolumeRecoveryPoint < / a > operation . * @ param listVolumeRecoveryPointsRequest * @ return Result of the ListVolumeRecoveryPoints 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 . ListVolumeRecoveryPoints * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / storagegateway - 2013-06-30 / ListVolumeRecoveryPoints " * target = " _ top " > AWS API Documentation < / a > */ @ Override public ListVolumeRecoveryPointsResult listVolumeRecoveryPoints ( ListVolumeRecoveryPointsRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeListVolumeRecoveryPoints ( request ) ;
public class Signature { /** * because of the Cipher . RSA / ECB / PKCS1Padding compatibility wrapper */ private static Signature getInstanceRSA ( Provider p ) throws NoSuchAlgorithmException { } }
// try Signature first Service s = p . getService ( "Signature" , RSA_SIGNATURE ) ; if ( s != null ) { Instance instance = GetInstance . getInstance ( s , SignatureSpi . class ) ; return getInstance ( instance , RSA_SIGNATURE ) ; } // check Cipher try { Cipher c = Cipher . getInstance ( RSA_CIPHER , p ) ; return new Delegate ( new CipherAdapter ( c ) , RSA_SIGNATURE ) ; } catch ( GeneralSecurityException e ) { // throw Signature style exception message to avoid confusion , // but append Cipher exception as cause throw new NoSuchAlgorithmException ( "no such algorithm: " + RSA_SIGNATURE + " for provider " + p . getName ( ) , e ) ; }
public class DistributedWorkManagerImpl { /** * { @ inheritDoc } */ @ Override protected void deltaWorkSuccessful ( ) { } }
if ( trace ) log . trace ( "deltaWorkSuccessful" ) ; super . deltaWorkSuccessful ( ) ; if ( distributedStatisticsEnabled && distributedStatistics != null && transport != null ) { try { checkTransport ( ) ; distributedStatistics . sendDeltaWorkSuccessful ( ) ; } catch ( WorkException we ) { log . debugf ( "deltaWorkSuccessful: %s" , we . getMessage ( ) , we ) ; } }
public class PhoneCountryCode { /** * This method parses a { @ link PhoneCountryCode } given as { @ link String } to its { @ link # getCountryCode ( ) int * representation } . * @ param countryCode is the { @ link PhoneCountryCode } as { @ link String } . * @ return the { @ link PhoneCountryCode } as int . */ private static int parseCountryCode ( String countryCode ) { } }
String normalized = countryCode ; if ( normalized . startsWith ( InternationalCallPrefix . PREFIX_PLUS ) ) { normalized = normalized . substring ( 1 ) ; } else if ( normalized . startsWith ( InternationalCallPrefix . PREFIX_00 ) ) { normalized = normalized . substring ( 2 ) ; } else if ( normalized . startsWith ( InternationalCallPrefix . PREFIX_011 ) ) { normalized = normalized . substring ( 3 ) ; } if ( normalized . startsWith ( "0" ) ) { throw new IllegalArgumentException ( countryCode ) ; } try { int cc = Integer . parseInt ( normalized ) ; return cc ; } catch ( NumberFormatException e ) { throw new IllegalArgumentException ( countryCode , e ) ; }
public class Person { /** * Gets the value of the businessAddress property . * This accessor method returns a reference to the live list , * not a snapshot . Therefore any modification you make to the * returned list will be present inside the JAXB object . * This is why there is not a < CODE > set < / CODE > method for the businessAddress property . * For example , to add a new item , do as follows : * < pre > * getBusinessAddress ( ) . add ( newItem ) ; * < / pre > * Objects of the following type ( s ) are allowed in the list { @ link com . ibm . wsspi . security . wim . model . AddressType } */ public List < com . ibm . wsspi . security . wim . model . AddressType > getBusinessAddress ( ) { } }
if ( businessAddress == null ) { businessAddress = new ArrayList < com . ibm . wsspi . security . wim . model . AddressType > ( ) ; } return this . businessAddress ;
public class CloudTasksClient { /** * Renew the current lease of a pull task . * < p > The worker can use this method to extend the lease by a new duration , starting from now . The * new task lease will be returned in the task ' s * [ schedule _ time ] [ google . cloud . tasks . v2beta2 . Task . schedule _ time ] . * < p > Sample code : * < pre > < code > * try ( CloudTasksClient cloudTasksClient = CloudTasksClient . create ( ) ) { * TaskName name = TaskName . of ( " [ PROJECT ] " , " [ LOCATION ] " , " [ QUEUE ] " , " [ TASK ] " ) ; * Timestamp scheduleTime = Timestamp . newBuilder ( ) . build ( ) ; * Duration leaseDuration = Duration . newBuilder ( ) . build ( ) ; * Task response = cloudTasksClient . renewLease ( name . toString ( ) , scheduleTime , leaseDuration ) ; * < / code > < / pre > * @ param name Required . * < p > The task name . For example : * ` projects / PROJECT _ ID / locations / LOCATION _ ID / queues / QUEUE _ ID / tasks / TASK _ ID ` * @ param scheduleTime Required . * < p > The task ' s current schedule time , available in the * [ schedule _ time ] [ google . cloud . tasks . v2beta2 . Task . schedule _ time ] returned by * [ LeaseTasks ] [ google . cloud . tasks . v2beta2 . CloudTasks . LeaseTasks ] response or * [ RenewLease ] [ google . cloud . tasks . v2beta2 . CloudTasks . RenewLease ] response . This restriction * is to ensure that your worker currently holds the lease . * @ param leaseDuration Required . * < p > The desired new lease duration , starting from now . * < p > The maximum lease duration is 1 week . ` lease _ duration ` will be truncated to the nearest * second . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ public final Task renewLease ( String name , Timestamp scheduleTime , Duration leaseDuration ) { } }
RenewLeaseRequest request = RenewLeaseRequest . newBuilder ( ) . setName ( name ) . setScheduleTime ( scheduleTime ) . setLeaseDuration ( leaseDuration ) . build ( ) ; return renewLease ( request ) ;
public class DefaultObservationManager { /** * An Event Listener Component has been dynamically registered in the system , add it to our cache . * @ param event event object containing the new component descriptor * @ param componentManager the { @ link ComponentManager } where the descriptor is registered * @ param descriptor the component descriptor removed from component manager */ private void onEventListenerComponentAdded ( ComponentDescriptorAddedEvent event , ComponentManager componentManager , ComponentDescriptor < EventListener > descriptor ) { } }
try { EventListener eventListener = componentManager . getInstance ( EventListener . class , event . getRoleHint ( ) ) ; if ( getListener ( eventListener . getName ( ) ) != eventListener ) { addListener ( eventListener ) ; } else { this . logger . warn ( "An Event Listener named [{}] already exists, ignoring the [{}] component" , eventListener . getName ( ) , descriptor . getImplementation ( ) . getName ( ) ) ; } } catch ( ComponentLookupException e ) { this . logger . error ( "Failed to lookup the Event Listener [{}] corresponding to the Component registration " + "event for [{}]. Ignoring the event" , new Object [ ] { event . getRoleHint ( ) , descriptor . getImplementation ( ) . getName ( ) , e } ) ; }
public class DoubleTuples { /** * Compute the < i > element - wise < / i > minimum of the the given input * tuples , and store the result in the given * result tuple . * @ param t0 The first input tuple * @ param t1 The second input tuple * @ param result The tuple that will store the result * @ return The result tuple * @ throws IllegalArgumentException If the given tuples do not * have the same { @ link Tuple # getSize ( ) size } */ public static MutableDoubleTuple min ( DoubleTuple t0 , DoubleTuple t1 , MutableDoubleTuple result ) { } }
return DoubleTupleFunctions . apply ( t0 , t1 , Math :: min , result ) ;
public class UfsJournalGarbageCollector { /** * Garbage collects a file if necessary . * @ param file the file * @ param checkpointSequenceNumber the first sequence number that has not been checkpointed */ private void gcFileIfStale ( UfsJournalFile file , long checkpointSequenceNumber ) { } }
if ( file . getEnd ( ) > checkpointSequenceNumber && ! file . isTmpCheckpoint ( ) ) { return ; } long lastModifiedTimeMs ; try { lastModifiedTimeMs = mUfs . getFileStatus ( file . getLocation ( ) . toString ( ) ) . getLastModifiedTime ( ) ; } catch ( IOException e ) { LOG . warn ( "Failed to get the last modified time for {}." , file . getLocation ( ) ) ; return ; } long thresholdMs = file . isTmpCheckpoint ( ) ? ServerConfiguration . getMs ( PropertyKey . MASTER_JOURNAL_TEMPORARY_FILE_GC_THRESHOLD_MS ) : ServerConfiguration . getMs ( PropertyKey . MASTER_JOURNAL_GC_THRESHOLD_MS ) ; if ( System . currentTimeMillis ( ) - lastModifiedTimeMs > thresholdMs ) { deleteNoException ( file . getLocation ( ) ) ; }
public class PersonDirectoryConfiguration { /** * The person attributes DAO that returns the attributes from the request . Uses a * currentUserProvider since the username may not always be provided by the request object . */ @ Bean ( name = "requestAttributesDao" ) @ Qualifier ( "uPortalInternal" ) public IPersonAttributeDao getRequestAttributesDao ( ) { } }
final AdditionalDescriptorsPersonAttributeDao rslt = new AdditionalDescriptorsPersonAttributeDao ( ) ; rslt . setDescriptors ( getRequestAdditionalDescriptors ( ) ) ; rslt . setUsernameAttributeProvider ( getUsernameAttributeProvider ( ) ) ; rslt . setCurrentUserProvider ( getCurrentUserProvider ( ) ) ; return rslt ;
public class AmazonIdentityManagementClient { /** * Retrieves a credential report for the AWS account . For more information about the credential report , see < a * href = " https : / / docs . aws . amazon . com / IAM / latest / UserGuide / credential - reports . html " > Getting Credential Reports < / a > in * the < i > IAM User Guide < / i > . * @ param getCredentialReportRequest * @ return Result of the GetCredentialReport operation returned by the service . * @ throws CredentialReportNotPresentException * The request was rejected because the credential report does not exist . To generate a credential report , * use < a > GenerateCredentialReport < / a > . * @ throws CredentialReportExpiredException * The request was rejected because the most recent credential report has expired . To generate a new * credential report , use < a > GenerateCredentialReport < / a > . For more information about credential report * expiration , see < a * href = " https : / / docs . aws . amazon . com / IAM / latest / UserGuide / credential - reports . html " > Getting Credential * Reports < / a > in the < i > IAM User Guide < / i > . * @ throws CredentialReportNotReadyException * The request was rejected because the credential report is still being generated . * @ throws ServiceFailureException * The request processing has failed because of an unknown error , exception or failure . * @ sample AmazonIdentityManagement . GetCredentialReport * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / iam - 2010-05-08 / GetCredentialReport " target = " _ top " > AWS API * Documentation < / a > */ @ Override public GetCredentialReportResult getCredentialReport ( GetCredentialReportRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeGetCredentialReport ( request ) ;
public class AsciiDocExporter { /** * Method that is called to write deployment information to AsciiDoc document . * @ param deploymentReports list . * @ throws IOException */ protected void writeDeployments ( List < DeploymentReport > deploymentReports ) throws IOException { } }
for ( DeploymentReport deploymentReport : deploymentReports ) { writer . append ( "[cols=\"3*\", options=\"header\"]" ) . append ( NEW_LINE ) ; writer . append ( "." ) . append ( this . resourceBundle . getString ( "asciidoc.reporter.deployment" ) ) . append ( NEW_LINE ) ; writer . append ( "|===" ) . append ( NEW_LINE ) . append ( NEW_LINE ) ; writer . append ( "|NAME" ) . append ( NEW_LINE ) ; writer . append ( "|ARCHIVE" ) . append ( NEW_LINE ) ; writer . append ( "|ORDER" ) . append ( NEW_LINE ) . append ( NEW_LINE ) ; writer . append ( "|" ) . append ( deploymentReport . getName ( ) ) . append ( NEW_LINE ) ; writer . append ( "|" ) . append ( deploymentReport . getArchiveName ( ) ) . append ( NEW_LINE ) ; writer . append ( "|" ) . append ( Integer . toString ( deploymentReport . getOrder ( ) ) ) . append ( NEW_LINE ) . append ( NEW_LINE ) ; writer . append ( "|===" ) . append ( NEW_LINE ) . append ( NEW_LINE ) ; if ( ! "_DEFAULT_" . equals ( deploymentReport . getProtocol ( ) ) ) { writer . append ( "NOTE: " ) . append ( deploymentReport . getProtocol ( ) ) . append ( NEW_LINE ) . append ( NEW_LINE ) ; } }
public class QueryServiceImpl { /** * Frequency analysis . * @ param rawFields Comma seperated list of result vector elements . * Each element has the form < node - nr > : < anno - name > . The * annotation name can be set to " tok " to indicate that the * span should be used instead of an annotation . */ @ GET @ Path ( "search/frequency" ) @ Produces ( "application/xml" ) public FrequencyTable frequency ( @ QueryParam ( "q" ) String query , @ QueryParam ( "corpora" ) String rawCorpusNames , @ QueryParam ( "fields" ) String rawFields ) { } }
requiredParameter ( query , "q" , "AnnisQL query" ) ; requiredParameter ( rawCorpusNames , "corpora" , "comma separated list of corpus names" ) ; requiredParameter ( rawFields , "fields" , "Comma seperated list of result vector elements." ) ; Subject user = SecurityUtils . getSubject ( ) ; List < String > corpusNames = splitCorpusNamesFromRaw ( rawCorpusNames ) ; for ( String c : corpusNames ) { user . checkPermission ( "query:matrix:" + c ) ; } QueryData data = queryDataFromParameters ( query , rawCorpusNames ) ; FrequencyTableQuery ext = FrequencyTableQuery . parse ( rawFields ) ; data . addExtension ( ext ) ; long start = new Date ( ) . getTime ( ) ; FrequencyTable freqTable = queryDao . frequency ( data ) ; long end = new Date ( ) . getTime ( ) ; logQuery ( "FREQUENCY" , query , splitCorpusNamesFromRaw ( rawCorpusNames ) , end - start ) ; return freqTable ;
public class Completable { /** * Returns a Completable instance which manages a resource along * with a custom Completable instance while the subscription is active and performs eager or lazy * resource disposition . * < img width = " 640 " height = " 332 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Completable . using . b . png " alt = " " > * If this overload performs a lazy disposal after the terminal event is emitted . * Exceptions thrown at this time will be delivered to RxJavaPlugins only . * < dl > * < dt > < b > Scheduler : < / b > < / dt > * < dd > { @ code using } does not operate by default on a particular { @ link Scheduler } . < / dd > * < / dl > * @ param < R > the resource type * @ param resourceSupplier the supplier that returns a resource to be managed * @ param completableFunction the function that given a resource returns a non - null * Completable instance that will be subscribed to * @ param disposer the consumer that disposes the resource created by the resource supplier * @ param eager if true , the resource is disposed before the terminal event is emitted , if false , the * resource is disposed after the terminal event has been emitted * @ return the new Completable instance */ @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public static < R > Completable using ( final Callable < R > resourceSupplier , final Function < ? super R , ? extends CompletableSource > completableFunction , final Consumer < ? super R > disposer , final boolean eager ) { } }
ObjectHelper . requireNonNull ( resourceSupplier , "resourceSupplier is null" ) ; ObjectHelper . requireNonNull ( completableFunction , "completableFunction is null" ) ; ObjectHelper . requireNonNull ( disposer , "disposer is null" ) ; return RxJavaPlugins . onAssembly ( new CompletableUsing < R > ( resourceSupplier , completableFunction , disposer , eager ) ) ;
public class Location { /** * The available port speeds for the location . * @ return The available port speeds for the location . */ public java . util . List < String > getAvailablePortSpeeds ( ) { } }
if ( availablePortSpeeds == null ) { availablePortSpeeds = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return availablePortSpeeds ;
public class ConcurrentAutoTable { /** * Atomically set the sum of the striped counters to specified value . * Rather more expensive than a simple store , in order to remain atomic . */ public void set ( long x ) { } }
CAT newcat = new CAT ( null , 4 , x ) ; // Spin until CAS works while ( ! CAS_cat ( _cat , newcat ) ) { /* empty */ }
public class SecurityController { /** * Call { @ link * Callable # call ( Context cx , Scriptable scope , Scriptable thisObj , * Object [ ] args ) } * of < i > callable < / i > under restricted security domain where an action is * allowed only if it is allowed according to the Java stack on the * moment of the < i > execWithDomain < / i > call and < i > securityDomain < / i > . * Any call to { @ link # getDynamicSecurityDomain ( Object ) } during * execution of < tt > callable . call ( cx , scope , thisObj , args ) < / tt > * should return a domain incorporate restrictions imposed by * < i > securityDomain < / i > and Java stack on the moment of callWithDomain * invocation . * The method should always be overridden , it is not declared abstract * for compatibility reasons . */ public Object callWithDomain ( Object securityDomain , Context cx , final Callable callable , Scriptable scope , final Scriptable thisObj , final Object [ ] args ) { } }
return execWithDomain ( cx , scope , new Script ( ) { @ Override public Object exec ( Context cx , Scriptable scope ) { return callable . call ( cx , scope , thisObj , args ) ; } } , securityDomain ) ;
public class CCTask { /** * Sets the project . */ @ Override public void setProject ( final Project project ) { } }
super . setProject ( project ) ; this . compilerDef . setProject ( project ) ; this . linkerDef . setProject ( project ) ;
public class Proxy { /** * Execute a request through Odo processing * @ param httpMethodProxyRequest * @ param httpServletRequest * @ param httpServletResponse * @ param history */ private void executeProxyRequest ( HttpMethod httpMethodProxyRequest , HttpServletRequest httpServletRequest , HttpServletResponse httpServletResponse , History history ) { } }
try { RequestInformation requestInfo = requestInformation . get ( ) ; // Execute the request // set virtual host so the server knows how to direct the request // If the host header exists then this uses that value // Otherwise the hostname from the URL is used processVirtualHostName ( httpMethodProxyRequest , httpServletRequest ) ; cullDisabledPaths ( ) ; // check for existence of ODO _ PROXY _ HEADER // finding it indicates a bad loop back through the proxy if ( httpServletRequest . getHeader ( Constants . ODO_PROXY_HEADER ) != null ) { logger . error ( "Request has looped back into the proxy. This will not be executed: {}" , httpServletRequest . getRequestURL ( ) ) ; return ; } // set ODO _ PROXY _ HEADER httpMethodProxyRequest . addRequestHeader ( Constants . ODO_PROXY_HEADER , "proxied" ) ; requestInfo . blockRequest = hasRequestBlock ( ) ; PluginResponse responseWrapper = new PluginResponse ( httpServletResponse ) ; requestInfo . jsonpCallback = stripJSONPToOutstr ( httpServletRequest , responseWrapper ) ; if ( ! requestInfo . blockRequest ) { logger . info ( "Sending request to server" ) ; history . setModified ( requestInfo . modified ) ; history . setRequestSent ( true ) ; executeRequest ( httpMethodProxyRequest , httpServletRequest , responseWrapper , history ) ; } else { history . setRequestSent ( false ) ; } logOriginalResponseHistory ( responseWrapper , history ) ; applyResponseOverrides ( responseWrapper , httpServletRequest , httpMethodProxyRequest , history ) ; // store history history . setModified ( requestInfo . modified ) ; logRequestHistory ( httpMethodProxyRequest , responseWrapper , history ) ; writeResponseOutput ( responseWrapper , requestInfo . jsonpCallback ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; }
public class CreatePlacements { /** * Runs the example . * @ param adManagerServices the services factory . * @ param session the session . * @ throws ApiException if the API request failed with one or more service errors . * @ throws RemoteException if the API request failed due to other errors . */ public static void runExample ( AdManagerServices adManagerServices , AdManagerSession session ) throws RemoteException { } }
// Get the PlacementService . PlacementServiceInterface placementService = adManagerServices . get ( session , PlacementServiceInterface . class ) ; // Get all ad units . List < AdUnit > adUnits = getAllAdUnits ( adManagerServices , session ) ; // Partition ad units by their size . Set < String > mediumSquareAdUnitIds = Sets . newHashSet ( ) ; Set < String > skyscraperAdUnitIds = Sets . newHashSet ( ) ; Set < String > bannerAdUnitIds = Sets . newHashSet ( ) ; for ( AdUnit adUnit : adUnits ) { if ( adUnit . getParentId ( ) != null && adUnit . getAdUnitSizes ( ) != null ) { for ( AdUnitSize adUnitSize : adUnit . getAdUnitSizes ( ) ) { Size size = adUnitSize . getSize ( ) ; if ( size . getWidth ( ) == 300 && size . getHeight ( ) == 250 ) { mediumSquareAdUnitIds . add ( adUnit . getId ( ) ) ; } else if ( size . getWidth ( ) == 120 && size . getHeight ( ) == 600 ) { skyscraperAdUnitIds . add ( adUnit . getId ( ) ) ; } else if ( size . getWidth ( ) == 468 && size . getHeight ( ) == 60 ) { bannerAdUnitIds . add ( adUnit . getId ( ) ) ; } } } } List < Placement > placementsToCreate = new ArrayList < > ( ) ; // Only create placements with one or more ad unit . if ( ! mediumSquareAdUnitIds . isEmpty ( ) ) { // Create medium square placement . Placement mediumSquareAdUnitPlacement = new Placement ( ) ; mediumSquareAdUnitPlacement . setName ( "Medium Square AdUnit Placement #" + new Random ( ) . nextInt ( Integer . MAX_VALUE ) ) ; mediumSquareAdUnitPlacement . setDescription ( "Contains ad units that can hold creatives of size 300x250" ) ; mediumSquareAdUnitPlacement . setTargetedAdUnitIds ( mediumSquareAdUnitIds . toArray ( new String [ ] { } ) ) ; placementsToCreate . add ( mediumSquareAdUnitPlacement ) ; } if ( ! skyscraperAdUnitIds . isEmpty ( ) ) { // Create skyscraper placement . Placement skyscraperAdUnitPlacement = new Placement ( ) ; skyscraperAdUnitPlacement . setName ( "Skyscraper AdUnit Placement #" + new Random ( ) . nextInt ( Integer . MAX_VALUE ) ) ; skyscraperAdUnitPlacement . setDescription ( "Contains ad units that can hold creatives of size 120x600" ) ; skyscraperAdUnitPlacement . setTargetedAdUnitIds ( skyscraperAdUnitIds . toArray ( new String [ ] { } ) ) ; placementsToCreate . add ( skyscraperAdUnitPlacement ) ; } if ( ! bannerAdUnitIds . isEmpty ( ) ) { // Create banner placement . Placement bannerAdUnitPlacement = new Placement ( ) ; bannerAdUnitPlacement . setName ( "Banner AdUnit Placement #" + new Random ( ) . nextInt ( Integer . MAX_VALUE ) ) ; bannerAdUnitPlacement . setDescription ( "Contains ad units that can hold creatives of size 468x60" ) ; bannerAdUnitPlacement . setTargetedAdUnitIds ( bannerAdUnitIds . toArray ( new String [ ] { } ) ) ; placementsToCreate . add ( bannerAdUnitPlacement ) ; } if ( ! placementsToCreate . isEmpty ( ) ) { // Create the placements on the server . Placement [ ] placements = placementService . createPlacements ( placementsToCreate . toArray ( new Placement [ ] { } ) ) ; for ( Placement createdPlacement : placements ) { System . out . printf ( "A placement with ID %d, name '%s', and containing ad units [%s] was created.%n" , createdPlacement . getId ( ) , createdPlacement . getName ( ) , Joiner . on ( ", " ) . join ( createdPlacement . getTargetedAdUnitIds ( ) ) ) ; } } else { System . out . println ( "No placements were created." ) ; }
public class Trie2_32 { /** * Serialize a Trie2_32 onto an OutputStream . * A Trie2 can be serialized multiple times . * The serialized data is compatible with ICU4C UTrie2 serialization . * Trie2 serialization is unrelated to Java object serialization . * @ param os the stream to which the serialized Trie2 data will be written . * @ return the number of bytes written . * @ throw IOException on an error writing to the OutputStream . */ public int serialize ( OutputStream os ) throws IOException { } }
DataOutputStream dos = new DataOutputStream ( os ) ; int bytesWritten = 0 ; bytesWritten += serializeHeader ( dos ) ; for ( int i = 0 ; i < dataLength ; i ++ ) { dos . writeInt ( data32 [ i ] ) ; } bytesWritten += dataLength * 4 ; return bytesWritten ;
public class TransactionManager { /** * merge a given list of transaction rollback action with given timestamp */ void mergeRolledBackTransaction ( Object [ ] list , int start , int limit ) { } }
for ( int i = start ; i < limit ; i ++ ) { RowAction rowact = ( RowAction ) list [ i ] ; if ( rowact == null || rowact . type == RowActionBase . ACTION_NONE || rowact . type == RowActionBase . ACTION_DELETE_FINAL ) { continue ; } Row row = rowact . memoryRow ; if ( row == null ) { PersistentStore store = rowact . session . sessionData . getRowStore ( rowact . table ) ; row = ( Row ) store . get ( rowact . getPos ( ) , false ) ; } if ( row == null ) { continue ; } synchronized ( row ) { rowact . mergeRollback ( row ) ; } } // } catch ( Throwable t ) { // System . out . println ( " throw in merge " ) ; // t . printStackTrace ( ) ;
public class ResourceProviderCommonsInner { /** * Get the number of iot hubs in the subscription . * Get the number of free and paid iot hubs in the subscription . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ return the { @ link ServiceFuture } object */ public ServiceFuture < List < UserSubscriptionQuotaInner > > listAsync ( final ServiceCallback < List < UserSubscriptionQuotaInner > > serviceCallback ) { } }
return ServiceFuture . fromResponse ( listWithServiceResponseAsync ( ) , serviceCallback ) ;
public class RenderingIntentImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setReserved2 ( Integer newReserved2 ) { } }
Integer oldReserved2 = reserved2 ; reserved2 = newReserved2 ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . RENDERING_INTENT__RESERVED2 , oldReserved2 , reserved2 ) ) ;
public class Vector3f { /** * / * ( non - Javadoc ) * @ see org . joml . Vector3fc # angleCos ( org . joml . Vector3fc ) */ public float angleCos ( Vector3fc v ) { } }
double length1Squared = x * x + y * y + z * z ; double length2Squared = v . x ( ) * v . x ( ) + v . y ( ) * v . y ( ) + v . z ( ) * v . z ( ) ; double dot = x * v . x ( ) + y * v . y ( ) + z * v . z ( ) ; return ( float ) ( dot / ( Math . sqrt ( length1Squared * length2Squared ) ) ) ;
public class LLongToFltFunctionBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */ @ Nonnull public static LLongToFltFunction longToFltFunctionFrom ( Consumer < LLongToFltFunctionBuilder > buildingFunction ) { } }
LLongToFltFunctionBuilder builder = new LLongToFltFunctionBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ;
public class SourceSet { /** * Parses a ` srcset ` value and reports the errors to the given * { @ link ErrorHandler } . */ public static SourceSet parse ( String srcset , ErrorHandler errorHandler ) { } }
return new Parser ( errorHandler ) . parse ( srcset ) ;
public class ReportParser { /** * Parsed passed files and extracts features files . * @ param jsonFiles * JSON files to read * @ return array of parsed features */ public List < Feature > parseJsonFiles ( List < String > jsonFiles ) { } }
if ( jsonFiles . isEmpty ( ) ) { throw new ValidationException ( "None report file was added!" ) ; } List < Feature > featureResults = new ArrayList < > ( ) ; for ( int i = 0 ; i < jsonFiles . size ( ) ; i ++ ) { String jsonFile = jsonFiles . get ( i ) ; // if file is empty ( is not valid JSON report ) , check if should be skipped or not if ( new File ( jsonFile ) . length ( ) == 0 && configuration . containsReducingMethod ( ReducingMethod . SKIP_EMPTY_JSON_FILES ) ) { continue ; } Feature [ ] features = parseForFeature ( jsonFile ) ; LOG . log ( Level . INFO , String . format ( "File '%s' contains %d features" , jsonFile , features . length ) ) ; featureResults . addAll ( Arrays . asList ( features ) ) ; } // report that has no features seems to be not valid if ( featureResults . isEmpty ( ) ) { throw new ValidationException ( "Passed files have no features!" ) ; } return featureResults ;
public class TreeNodeSelector { /** * Compare a node path element ( provided as argument of the selectNode method ) to a node name ( from a JTree ) . * @ param nodePathElement the node path element to compare with the node name * @ param nodeName the node name * @ return true if both match , false otherwise . */ protected boolean compareNodeNames ( String nodePathElement , String nodeName ) { } }
boolean comparisonResult = false ; switch ( mSelectorIdentifier ) { case SELECT_BY_REGEX : comparisonResult = Pattern . matches ( nodePathElement , nodeName ) ; break ; case SELECT_BY_STRING : default : comparisonResult = nodePathElement . equals ( nodeName ) ; break ; } return comparisonResult ;
public class SwapAnnuity { /** * Function to calculate an ( idealized ) swap annuity for a given schedule and discount curve . * Note that , the value returned is divided by the discount factor at evaluation . * This matters , if the discount factor at evaluationTime is not equal to 1.0. * @ param evaluationTime The evaluation time as double . Cash flows prior and including this time are not considered . * @ param schedule The schedule discretization , i . e . , the period start and end dates . End dates are considered payment dates and start of the next period . * @ param discountCurve The discount curve . * @ param model The model , needed only in case the discount curve evaluation depends on an additional curve . * @ return The swap annuity . */ public static RandomVariable getSwapAnnuity ( double evaluationTime , Schedule schedule , DiscountCurveInterface discountCurve , AnalyticModel model ) { } }
RandomVariable value = new RandomVariableFromDoubleArray ( 0.0 ) ; for ( int periodIndex = 0 ; periodIndex < schedule . getNumberOfPeriods ( ) ; periodIndex ++ ) { double paymentDate = schedule . getPayment ( periodIndex ) ; if ( paymentDate <= evaluationTime ) { continue ; } double periodLength = schedule . getPeriodLength ( periodIndex ) ; RandomVariable discountFactor = discountCurve . getDiscountFactor ( model , paymentDate ) ; value = discountFactor . mult ( periodLength ) . add ( value ) ; } return value . div ( discountCurve . getDiscountFactor ( model , evaluationTime ) ) ;
public class FinishingFidelityImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case AfplibPackage . FINISHING_FIDELITY__STP_FIN_EX : return getStpFinEx ( ) ; case AfplibPackage . FINISHING_FIDELITY__REP_FIN_EX : return getRepFinEx ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
public class FatFile { /** * { @ inheritDoc } * < / p > < p > * If the data to be written extends beyond the current * { @ link # getLength ( ) length } of this file , an attempt is made to * { @ link # setLength ( long ) grow } the file so that the data will fit . * Additionally , this method updates the " last accessed " and " last modified " * fields on the directory entry that is associated with this file . * @ param offset { @ inheritDoc } * @ param srcBuf { @ inheritDoc } */ @ Override public void write ( long offset , ByteBuffer srcBuf ) throws ReadOnlyException , IOException { } }
checkWritable ( ) ; updateTimeStamps ( true ) ; final long lastByte = offset + srcBuf . remaining ( ) ; if ( lastByte > getLength ( ) ) { setLength ( lastByte ) ; } chain . writeData ( offset , srcBuf ) ;
public class StreamMessageImpl { /** * ( non - Javadoc ) * @ see javax . jms . StreamMessage # readBoolean ( ) */ @ Override public boolean readBoolean ( ) throws JMSException { } }
backupState ( ) ; try { return MessageConvertTools . asBoolean ( internalReadObject ( ) ) ; } catch ( JMSException e ) { restoreState ( ) ; throw e ; } catch ( RuntimeException e ) { restoreState ( ) ; throw e ; }
public class PublisherFlexible { /** * Gets the publisher wrapped by the specofoed FlexiblePublisher . * @ param publisher The FlexiblePublisher wrapping the publisher . * @ param type The type of the publisher wrapped by the FlexiblePublisher . * @ return The publisher object wrapped by the FlexiblePublisher . * Null is returned if the FlexiblePublisher does not wrap a publisher of the specified type . * @ throws IllegalArgumentException In case publisher is not of type * { @ link org . jenkins _ ci . plugins . flexible _ publish . FlexiblePublisher } */ private T getWrappedPublisher ( Publisher flexiblePublisher , Class < T > type ) { } }
if ( ! ( flexiblePublisher instanceof FlexiblePublisher ) ) { throw new IllegalArgumentException ( String . format ( "Publisher should be of type: '%s'. Found type: '%s'" , FlexiblePublisher . class , flexiblePublisher . getClass ( ) ) ) ; } List < ConditionalPublisher > conditions = ( ( FlexiblePublisher ) flexiblePublisher ) . getPublishers ( ) ; for ( ConditionalPublisher condition : conditions ) { if ( type . isInstance ( condition . getPublisher ( ) ) ) { return type . cast ( condition . getPublisher ( ) ) ; } } return null ;
public class CodeQualityEvaluator { /** * Reusable method for constructing the CodeQualityAuditResponse object for a * @ return CodeQualityAuditResponse */ private CodeQualityAuditResponse getStaticAnalysisResponse ( CollectorItem collectorItem , List < CollectorItem > repoItems , long beginDate , long endDate ) { } }
CodeQualityAuditResponse codeQualityAuditResponse = new CodeQualityAuditResponse ( ) ; if ( collectorItem == null ) return getNotConfigured ( ) ; if ( ! isProjectIdValid ( collectorItem ) ) return getErrorResponse ( collectorItem ) ; List < CodeQuality > codeQualities = codeQualityRepository . findByCollectorItemIdAndTimestampIsBetweenOrderByTimestampDesc ( collectorItem . getId ( ) , beginDate - 1 , endDate + 1 ) ; ObjectMapper mapper = new ObjectMapper ( ) ; if ( CollectionUtils . isEmpty ( codeQualities ) ) { return codeQualityDetailsForMissingStatus ( collectorItem ) ; } else { codeQualityAuditResponse . addAuditStatus ( CodeQualityAuditStatus . CODE_QUALITY_CHECK_IS_CURRENT ) ; } CodeQuality returnQuality = codeQualities . get ( 0 ) ; codeQualityAuditResponse . setUrl ( returnQuality . getUrl ( ) ) ; codeQualityAuditResponse . setCodeQuality ( returnQuality ) ; codeQualityAuditResponse . setLastExecutionTime ( returnQuality . getTimestamp ( ) ) ; for ( CodeQualityMetric metric : returnQuality . getMetrics ( ) ) { // TODO : This is sonar specific - need to move this to api settings via properties file if ( StringUtils . equalsIgnoreCase ( metric . getName ( ) , "quality_gate_details" ) ) { codeQualityAuditResponse . addAuditStatus ( CodeQualityAuditStatus . CODE_QUALITY_GATES_FOUND ) ; if ( metric . getStatus ( ) != null ) { // this applies for sonar 5.3 style data for quality _ gate _ details . Sets CODE _ QUALITY _ AUDIT _ OK if Status is Ok / Warning codeQualityAuditResponse . addAuditStatus ( ( "Ok" . equalsIgnoreCase ( metric . getStatus ( ) . toString ( ) ) || ( "Warning" . equalsIgnoreCase ( metric . getStatus ( ) . toString ( ) ) ) ) ? CodeQualityAuditStatus . CODE_QUALITY_AUDIT_OK : CodeQualityAuditStatus . CODE_QUALITY_AUDIT_FAIL ) ; } else { // this applies for sonar 6.7 style data for quality _ gate _ details . Sets CODE _ QUALITY _ AUDIT _ OK if Status is Ok / Warning TypeReference < HashMap < String , Object > > typeRef = new TypeReference < HashMap < String , Object > > ( ) { } ; Map < String , String > values ; try { values = mapper . readValue ( ( String ) metric . getValue ( ) , typeRef ) ; if ( MapUtils . isNotEmpty ( values ) && values . containsKey ( "level" ) ) { String level = values . get ( "level" ) ; codeQualityAuditResponse . addAuditStatus ( ( level . equalsIgnoreCase ( "Ok" ) || level . equalsIgnoreCase ( "WARN" ) ) ? CodeQualityAuditStatus . CODE_QUALITY_AUDIT_OK : CodeQualityAuditStatus . CODE_QUALITY_AUDIT_FAIL ) ; } JSONObject qualityGateDetails = ( JSONObject ) new JSONParser ( ) . parse ( metric . getValue ( ) . toString ( ) ) ; JSONArray conditions = ( JSONArray ) qualityGateDetails . get ( "conditions" ) ; Iterator itr = conditions . iterator ( ) ; // Iterate through the quality _ gate conditions while ( itr . hasNext ( ) ) { Map condition = ( ( Map ) itr . next ( ) ) ; // Set audit statuses for Thresholds found if they are defined in quality _ gate _ details metric this . auditStatusWhenQualityGateDetailsFound ( condition , codeQualityAuditResponse ) ; } } catch ( IOException e ) { LOGGER . error ( "Error in CodeQualityEvaluator.getStaticAnalysisResponse() - Unable to parse quality_gate metrics - " + e . getMessage ( ) ) ; } catch ( ParseException e ) { LOGGER . error ( "Error in CodeQualityEvaluator.getStaticAnalysisResponse() - Unable to parse quality_gate_details values - " + e . getMessage ( ) ) ; } } } // Set audit statuses if the threshold is met based on the status field of code _ quality metric this . auditStatusWhenQualityGateDetailsNotFound ( metric , codeQualityAuditResponse ) ; } codeQualityAuditResponse . addAuditStatus ( ( StringUtils . containsIgnoreCase ( codeQualityAuditResponse . getAuditStatuses ( ) . toString ( ) , "CODE_QUALITY_AUDIT_FAIL" ) ) ? CodeQualityAuditStatus . CODE_QUALITY_AUDIT_FAIL : CodeQualityAuditStatus . CODE_QUALITY_AUDIT_OK ) ; List < CollectorItemConfigHistory > configHistories = getProfileChanges ( returnQuality , beginDate , endDate ) ; if ( CollectionUtils . isEmpty ( configHistories ) ) { codeQualityAuditResponse . addAuditStatus ( CodeQualityAuditStatus . QUALITY_PROFILE_VALIDATION_AUDIT_NO_CHANGE ) ; return codeQualityAuditResponse ; } Set < String > codeAuthors = CommonCodeReview . getCodeAuthors ( repoItems , beginDate , endDate , commitRepository ) ; List < String > overlap = configHistories . stream ( ) . map ( CollectorItemConfigHistory :: getUserID ) . filter ( codeAuthors :: contains ) . collect ( Collectors . toList ( ) ) ; codeQualityAuditResponse . addAuditStatus ( ! CollectionUtils . isEmpty ( overlap ) ? CodeQualityAuditStatus . QUALITY_PROFILE_VALIDATION_AUDIT_FAIL : CodeQualityAuditStatus . QUALITY_PROFILE_VALIDATION_AUDIT_OK ) ; return codeQualityAuditResponse ;
public class ObjectManager { /** * returns true if the objectManager was warm started . * @ return boolean true if warm started . */ public final boolean warmStarted ( ) { } }
final String methodName = "warmStarted" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName ) ; boolean isWarmStarted = false ; if ( objectManagerState . state == ObjectManagerState . stateWarmStarted ) isWarmStarted = true ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Boolean ( isWarmStarted ) ) ; return isWarmStarted ;
public class ReflectionHelper { /** * Checks if a Class or Method are annotated with the given annotation * @ param elem the Class or Method to reflect on * @ param annotationType the annotation type * @ param checkMetaAnnotations check for meta annotations * @ return true if annotations is present */ public static boolean hasAnnotation ( AnnotatedElement elem , Class < ? extends Annotation > annotationType , boolean checkMetaAnnotations ) { } }
if ( elem . isAnnotationPresent ( annotationType ) ) { return true ; } if ( checkMetaAnnotations ) { for ( Annotation a : elem . getAnnotations ( ) ) { for ( Annotation meta : a . annotationType ( ) . getAnnotations ( ) ) { if ( meta . annotationType ( ) . getName ( ) . equals ( annotationType . getName ( ) ) ) { return true ; } } } } return false ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link GeodeticDatumRefType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link GeodeticDatumRefType } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "geodeticDatumRef" ) public JAXBElement < GeodeticDatumRefType > createGeodeticDatumRef ( GeodeticDatumRefType value ) { } }
return new JAXBElement < GeodeticDatumRefType > ( _GeodeticDatumRef_QNAME , GeodeticDatumRefType . class , null , value ) ;
public class AbstractVariableScope { /** * Sets a variable in the local scope . In contrast to * { @ link # setVariableLocal ( String , Object ) } , the variable is transient that * means it will not be stored in the data base . For example , a transient * variable can be used for a result variable that is only available for * output mapping . */ public void setVariableLocalTransient ( String variableName , Object value ) { } }
TypedValue typedValue = Variables . untypedValue ( value , true ) ; checkJavaSerialization ( variableName , typedValue ) ; CoreVariableInstance coreVariableInstance = getVariableInstanceFactory ( ) . build ( variableName , typedValue , true ) ; getVariableStore ( ) . addVariable ( coreVariableInstance ) ;