signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class IntTupleCollections { /** * Create the specified number of tuples with the given dimensions
* ( { @ link Tuple # getSize ( ) size } ) , all initialized to zero , and place
* them into the given target collection
* @ param dimensions The dimensions ( { @ link Tuple # getSize ( ) size } )
* of the tuples to create
* @ param numElements The number of tuples to create
* @ param target The target collection
* @ throws IllegalArgumentException If the given dimensions are negative */
public static void create ( int dimensions , int numElements , Collection < ? super MutableIntTuple > target ) { } } | for ( int i = 0 ; i < numElements ; i ++ ) { target . add ( IntTuples . create ( dimensions ) ) ; } |
public class TargetSpecifications { /** * { @ link Specification } for retrieving { @ link Target } s that don ' t have the
* given distribution set in their action history
* @ param distributionSetId
* the ID of the distribution set which must not be assigned
* @ return the { @ link Target } { @ link Specification } */
public static Specification < JpaTarget > hasNotDistributionSetInActions ( final Long distributionSetId ) { } } | return ( targetRoot , query , cb ) -> { final ListJoin < JpaTarget , JpaAction > actionsJoin = targetRoot . join ( JpaTarget_ . actions , JoinType . LEFT ) ; actionsJoin . on ( cb . equal ( actionsJoin . get ( JpaAction_ . distributionSet ) . get ( JpaDistributionSet_ . id ) , distributionSetId ) ) ; return cb . isNull ( actionsJoin . get ( JpaAction_ . id ) ) ; } ; |
public class AbstractJsonDeserializer { /** * Convenience method for subclasses .
* @ param paramName the name of the parameter
* @ param errorMessage the errormessage to add to the exception if the param does not exist .
* @ param mapToUse the map to use as input parametersource
* @ return a stringparameter with given name . If it does not exist and the errormessage is provided ,
* an IOException is thrown with that message . if the errormessage is not provided , null is returned .
* @ throws IOException Exception if the paramname does not exist and an errormessage is provided . */
protected String getStringParam ( String paramName , String errorMessage , Map < String , Object > mapToUse ) throws IOException { } } | return getTypedParam ( paramName , errorMessage , String . class , mapToUse ) ; |
public class LongMapperBuilder { /** * Returns the { @ link LongMapper } represented by this { @ link MapperBuilder } .
* @ param field the name of the field to be built
* @ return the { @ link LongMapper } represented by this */
@ Override public LongMapper build ( String field ) { } } | return new LongMapper ( field , column , validated , boost ) ; |
public class AWSOpsWorksCMClient { /** * Deletes the server and the underlying AWS CloudFormation stacks ( including the server ' s EC2 instance ) . When you
* run this command , the server state is updated to < code > DELETING < / code > . After the server is deleted , it is no
* longer returned by < code > DescribeServer < / code > requests . If the AWS CloudFormation stack cannot be deleted , the
* server cannot be deleted .
* This operation is asynchronous .
* An < code > InvalidStateException < / code > is thrown when a server deletion is already in progress . A
* < code > ResourceNotFoundException < / code > is thrown when the server does not exist . A
* < code > ValidationException < / code > is raised when parameters of the request are not valid .
* @ param deleteServerRequest
* @ return Result of the DeleteServer operation returned by the service .
* @ throws InvalidStateException
* The resource is in a state that does not allow you to perform a specified action .
* @ throws ResourceNotFoundException
* The requested resource does not exist , or access was denied .
* @ throws ValidationException
* One or more of the provided request parameters are not valid .
* @ sample AWSOpsWorksCM . DeleteServer
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / opsworkscm - 2016-11-01 / DeleteServer " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DeleteServerResult deleteServer ( DeleteServerRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDeleteServer ( request ) ; |
public class ReactorManager { /** * Creates a staging factory indicated by the { @ link ExamReactorStrategy } annotation of the test
* class .
* @ param testClass
* @ return staging factory */
private StagedExamReactorFactory getStagingFactory ( Class < ? > testClass ) { } } | ExamReactorStrategy strategy = testClass . getAnnotation ( ExamReactorStrategy . class ) ; String strategyName = cm . getProperty ( EXAM_REACTOR_STRATEGY_KEY ) ; StagedExamReactorFactory fact ; try { if ( strategy != null ) { fact = strategy . value ( ) [ 0 ] . newInstance ( ) ; return fact ; } } catch ( IllegalAccessException | InstantiationException exc ) { throw new TestContainerException ( exc ) ; } if ( strategyName == null ) { if ( systemType . equals ( EXAM_SYSTEM_CDI ) || systemType . equals ( EXAM_SYSTEM_JAVAEE ) ) { strategyName = EXAM_REACTOR_STRATEGY_PER_SUITE ; } else { // OSGi default from Pax Exam 2 . x
strategyName = EXAM_REACTOR_STRATEGY_PER_METHOD ; } } fact = reactorStrategies . get ( strategyName ) ; if ( fact == null ) { throw new IllegalArgumentException ( "unknown reactor strategy " + strategyName ) ; } return fact ; |
public class MainActivity { /** * Exercise the NetworkMonitor API */
private void getNetworkInfo ( ) { } } | // Create a listener to check for new network connections ( e . g . switching from mobile to Wifi , or losing internet connection )
NetworkConnectionListener listener = new NetworkConnectionListener ( ) { @ Override public void networkChanged ( NetworkConnectionType newConnection ) { Log . i ( "BMSCore" , "New network connection: " + newConnection . toString ( ) ) ; } } ; // Initilize the network monitor with the application context and network change listener
this . networkMonitor = new NetworkMonitor ( getApplicationContext ( ) , listener ) ; // Start listening for network changes
networkMonitor . startMonitoringNetworkChanges ( ) ; // See if the device currently has internet access , and see what type of connection it is using
Log . i ( "BMSCore" , "Is connected to the internet: " + networkMonitor . isInternetAccessAvailable ( ) ) ; Log . i ( "BMSCore" , "Connection type: " + networkMonitor . getCurrentConnectionType ( ) . toString ( ) ) ; // Check that the user has given permissions to read the phone ' s state .
// If permission is granted , get the type of mobile data network being used .
int networkPermission = ContextCompat . checkSelfPermission ( this , Manifest . permission . READ_PHONE_STATE ) ; if ( networkPermission == PackageManager . PERMISSION_GRANTED ) { Log . i ( "BMSCore" , "Mobile network type: " + networkMonitor . getMobileNetworkType ( ) ) ; } else { Log . i ( "BMSCore" , "Obtaining permission to read phone state" ) ; if ( ActivityCompat . shouldShowRequestPermissionRationale ( this , Manifest . permission . READ_PHONE_STATE ) ) { // Asynchronously explain to the user why you are attempting to request this permission .
// Once this is done , try to request the permission again .
} else { ActivityCompat . requestPermissions ( this , new String [ ] { Manifest . permission . READ_PHONE_STATE } , MY_PERMISSIONS_READ_PHONE_STATE ) ; } } |
public class CmsToolManager { /** * Registers all tool handlers recursively for a given tool root . < p >
* @ param cms the cms context object
* @ param toolRoot the tool root
* @ param len the recursion level
* @ param handlers the list of handlers to register */
private void registerHandlerList ( CmsObject cms , CmsToolRootHandler toolRoot , int len , List < I_CmsToolHandler > handlers ) { } } | boolean found = false ; Iterator < I_CmsToolHandler > it = handlers . iterator ( ) ; while ( it . hasNext ( ) ) { I_CmsToolHandler handler = it . next ( ) ; int myLen = CmsStringUtil . splitAsArray ( handler . getPath ( ) , TOOLPATH_SEPARATOR ) . length ; if ( ( ( len == myLen ) && ! handler . getPath ( ) . equals ( TOOLPATH_SEPARATOR ) ) || ( ( len == 1 ) && handler . getPath ( ) . equals ( TOOLPATH_SEPARATOR ) ) ) { found = true ; registerAdminTool ( cms , toolRoot , handler ) ; } } if ( found ) { registerHandlerList ( cms , toolRoot , len + 1 , handlers ) ; } |
public class ApiOvhOrder { /** * Get prices and contracts information
* REST : GET / order / telephony / { billingAccount } / portability
* @ param desireDate [ required ] The date you want for portability execution . Overridden if flag executeAsSoonAsPossible is set
* @ param type [ required ] The type of number : landline or special
* @ param callNumber [ required ] The number you want to port
* @ param streetName [ required ] Address street name
* @ param firstName [ required ] Your firstname
* @ param listNumbers [ required ] Extra numbers to be ported , a comma separated list of numbers
* @ param socialReason [ required ] Your social reason
* @ param name [ required ] Your name
* @ param country [ required ] Country of number
* @ param stair [ required ] Address stair
* @ param zip [ required ] Address zip code
* @ param streetNumberExtra [ required ] Address street number extra : bis , ter , . . .
* @ param contactNumber [ required ] Your contact phone number
* @ param lineToRedirectAliasTo [ required ] Redirect ported numbers to the specific line
* @ param rio [ required ] RIO of the number for individual offer
* @ param mobilePhone [ required ] Mobile phone to use to text portability status
* @ param building [ required ] Address building
* @ param streetNumber [ required ] Address street number
* @ param executeAsSoonAsPossible [ required ] Ask to port the number as soon as possible
* @ param displayUniversalDirectory [ required ] Publish informations on directory ? ( Yellow Pages , 118XXX , . . . )
* @ param floor [ required ] Address floor
* @ param specialNumberCategory [ required ] The special number category ( needed if type is special )
* @ param siret [ required ] If you port under your society , the SIRET number
* @ param fiabilisation [ required ] Ask for a fiabilisation or not ( FR only )
* @ param streetType [ required ] Address street type
* @ param contactName [ required ] Your contact name
* @ param door [ required ] Address door
* @ param offer [ required ] The offer : individual or company
* @ param city [ required ] Address city
* @ param billingAccount [ required ] The name of your billingAccount */
public OvhOrder telephony_billingAccount_portability_GET ( String billingAccount , String building , String callNumber , String city , String contactName , String contactNumber , OvhCountriesAvailable country , Date desireDate , Boolean displayUniversalDirectory , String door , Boolean executeAsSoonAsPossible , Boolean fiabilisation , String firstName , Double floor , String lineToRedirectAliasTo , String listNumbers , String mobilePhone , String name , OvhOfferType offer , String rio , String siret , OvhSocialReason socialReason , OvhSpecialNumberCategoryEnum specialNumberCategory , Double stair , String streetName , Double streetNumber , String streetNumberExtra , String streetType , OvhNumberType type , String zip ) throws IOException { } } | String qPath = "/order/telephony/{billingAccount}/portability" ; StringBuilder sb = path ( qPath , billingAccount ) ; query ( sb , "building" , building ) ; query ( sb , "callNumber" , callNumber ) ; query ( sb , "city" , city ) ; query ( sb , "contactName" , contactName ) ; query ( sb , "contactNumber" , contactNumber ) ; query ( sb , "country" , country ) ; query ( sb , "desireDate" , desireDate ) ; query ( sb , "displayUniversalDirectory" , displayUniversalDirectory ) ; query ( sb , "door" , door ) ; query ( sb , "executeAsSoonAsPossible" , executeAsSoonAsPossible ) ; query ( sb , "fiabilisation" , fiabilisation ) ; query ( sb , "firstName" , firstName ) ; query ( sb , "floor" , floor ) ; query ( sb , "lineToRedirectAliasTo" , lineToRedirectAliasTo ) ; query ( sb , "listNumbers" , listNumbers ) ; query ( sb , "mobilePhone" , mobilePhone ) ; query ( sb , "name" , name ) ; query ( sb , "offer" , offer ) ; query ( sb , "rio" , rio ) ; query ( sb , "siret" , siret ) ; query ( sb , "socialReason" , socialReason ) ; query ( sb , "specialNumberCategory" , specialNumberCategory ) ; query ( sb , "stair" , stair ) ; query ( sb , "streetName" , streetName ) ; query ( sb , "streetNumber" , streetNumber ) ; query ( sb , "streetNumberExtra" , streetNumberExtra ) ; query ( sb , "streetType" , streetType ) ; query ( sb , "type" , type ) ; query ( sb , "zip" , zip ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhOrder . class ) ; |
public class BaseSparseNDArrayCOO { /** * Returns the indices of non - zero element of the vector
* @ return indices in Databuffer */
@ Override public DataBuffer getVectorCoordinates ( ) { } } | int idx ; if ( isRowVector ( ) ) { idx = 1 ; } else if ( isColumnVector ( ) ) { idx = 0 ; } else { throw new UnsupportedOperationException ( ) ; } // FIXME : int cast
int [ ] temp = new int [ ( int ) length ( ) ] ; for ( int i = 0 ; i < length ( ) ; i ++ ) { temp [ i ] = getUnderlyingIndicesOf ( i ) . getInt ( idx ) ; } return Nd4j . createBuffer ( temp ) ; |
public class ErrorLog { /** * Appends an action to the log .
* @ param action
* the action to append .
* @ throws IOException
* if the node cannot be written to the redo log . */
public void append ( final String action , final String uuid ) throws IOException { } } | initOut ( ) ; out . write ( ByteBuffer . wrap ( ( action + " " + uuid + "\n" ) . getBytes ( ) ) ) ; |
public class Histogram { /** * Get the value at a given position . */
public double get ( double index ) { } } | ListIterator < Bucket > b = buckets_ . listIterator ( 0 ) ; ListIterator < Bucket > e = buckets_ . listIterator ( buckets_ . size ( ) ) ; while ( b . nextIndex ( ) < e . previousIndex ( ) ) { final ListIterator < Bucket > mid = buckets_ . listIterator ( b . nextIndex ( ) / 2 + e . nextIndex ( ) / 2 ) ; final Bucket mid_bucket = mid . next ( ) ; mid . previous ( ) ; // Undo position change made by mid . next ( ) .
if ( mid_bucket . getRunningEventsCount ( ) == index && mid . nextIndex ( ) >= e . previousIndex ( ) ) { return mid_bucket . getRange ( ) . getCeil ( ) ; } else if ( mid_bucket . getRunningEventsCount ( ) <= index ) { b = mid ; b . next ( ) ; } else if ( mid_bucket . getRunningEventsCount ( ) - mid_bucket . getEvents ( ) > index ) { e = mid ; } else { b = mid ; break ; } } final Bucket bucket = b . next ( ) ; b . previous ( ) ; // Undo position change made by b . next ( ) .
final double low = bucket . getRunningEventsCount ( ) - bucket . getEvents ( ) ; final double off = index - low ; final double left_fraction = off / bucket . getEvents ( ) ; final double right_fraction = 1 - left_fraction ; return bucket . getRange ( ) . getCeil ( ) * left_fraction + bucket . getRange ( ) . getFloor ( ) * right_fraction ; |
public class IfcStructuralItemImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcRelConnectsStructuralActivity > getAssignedStructuralActivity ( ) { } } | return ( EList < IfcRelConnectsStructuralActivity > ) eGet ( Ifc4Package . Literals . IFC_STRUCTURAL_ITEM__ASSIGNED_STRUCTURAL_ACTIVITY , true ) ; |
public class Logger { /** * resource bundle and then call " void log ( LogRecord ) " . */
private void doLog ( LogRecord lr , String rbname ) { } } | lr . setLoggerName ( name ) ; if ( rbname != null ) { lr . setResourceBundleName ( rbname ) ; lr . setResourceBundle ( findResourceBundle ( rbname , false ) ) ; } log ( lr ) ; |
public class UserTypeUtil { /** * Returns a java class name for a user type . */
public static String getClassName ( UserType userType ) { } } | String name = userType . getName ( ) ; return Formatter . toPascalCase ( name ) ; |
public class WindowedBoltExecutor { /** * Start the trigger policy and waterMarkEventGenerator if set */
protected void start ( ) { } } | if ( waterMarkEventGenerator != null ) { LOG . debug ( "Starting waterMarkEventGenerator" ) ; waterMarkEventGenerator . start ( ) ; } LOG . debug ( "Starting trigger policy" ) ; triggerPolicy . start ( ) ; |
public class BaseDestinationHandler { /** * Handle a remote request to delete a local durable subscription .
* @ param subName The name of the durable subscription to delete .
* @ return DurableConstants . STATUS _ OK if the delete works ,
* DurableConstants . STATUS _ SUB _ NOT _ FOUND if no such subscription
* exists , DurableConstants . STATUS _ SUB _ CARDINALITY _ ERROR if
* the subscription can ' t be deleted because there are attached
* consumers , or DurableConstants . STATUS _ SUB _ GENERAL _ ERROR if an
* exception occurs while deleting the subscription . */
public int deleteDurableFromRemote ( String subName ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "deleteDurableFromRemote" , subName ) ; int status = _pubSubRealization . deleteDurableFromRemote ( subName ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "deleteDurableFromRemote" , Integer . valueOf ( status ) ) ; return status ; |
public class CmsDriverManager { /** * Returns all roles the given user has for the given resource . < p >
* @ param dbc the current database context
* @ param user the user to check
* @ param resource the resource to check the roles for
* @ return a list of { @ link CmsRole } objects
* @ throws CmsException if something goes wrong */
public List < CmsRole > getRolesForResource ( CmsDbContext dbc , CmsUser user , CmsResource resource ) throws CmsException { } } | // guest user has no role
if ( user . isGuestUser ( ) ) { return Collections . emptyList ( ) ; } // try to read from cache
String key = user . getId ( ) . toString ( ) + resource . getRootPath ( ) ; List < CmsRole > result = m_monitor . getCachedRoleList ( key ) ; if ( result != null ) { return result ; } result = new ArrayList < CmsRole > ( ) ; Iterator < CmsOrganizationalUnit > itOus = getResourceOrgUnits ( dbc , resource ) . iterator ( ) ; while ( itOus . hasNext ( ) ) { CmsOrganizationalUnit ou = itOus . next ( ) ; // read all roles of the current user
List < CmsGroup > groups = new ArrayList < CmsGroup > ( getGroupsOfUser ( dbc , user . getName ( ) , ou . getName ( ) , false , true , false , dbc . getRequestContext ( ) . getRemoteAddress ( ) ) ) ; // check the roles applying to the given resource
Iterator < CmsGroup > it = groups . iterator ( ) ; while ( it . hasNext ( ) ) { CmsGroup group = it . next ( ) ; CmsRole givenRole = CmsRole . valueOf ( group ) . forOrgUnit ( null ) ; if ( givenRole . isOrganizationalUnitIndependent ( ) || result . contains ( givenRole ) ) { // skip already added roles
continue ; } result . add ( givenRole ) ; } } result = Collections . unmodifiableList ( result ) ; m_monitor . cacheRoleList ( key , result ) ; return result ; |
public class MapFacts { /** * Returns a map factory that generates
* < code > NoCompTreeMap < / code > . { @ link
* jpaul . DataStructs . NoCompTreeMap NoCompTreeMap } is a binary
* tree - backed map that does not require a user - defined { @ link
* java . util . Comparator Comparator } between keys . */
public static < K , V > MapFactory < K , V > noCompTree ( ) { } } | return new MapFactory < K , V > ( ) { private static final long serialVersionUID = 5687187370812696757L ; public Map < K , V > create ( ) { return new NoCompTreeMap < K , V > ( ) ; } public Map < K , V > create ( Map < K , V > m ) { if ( m instanceof NoCompTreeMap /* < K , V > */
) { return ( ( NoCompTreeMap < K , V > ) m ) . clone ( ) ; } return super . create ( m ) ; } } ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getIfcDocumentStatusEnum ( ) { } } | if ( ifcDocumentStatusEnumEEnum == null ) { ifcDocumentStatusEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 814 ) ; } return ifcDocumentStatusEnumEEnum ; |
public class UserNameServiceImpl { /** * { @ inheritDoc } */
@ Override public int findOptionByIgnoreCaseText ( String text , Select dropDown ) { } } | int index = 0 ; for ( WebElement option : dropDown . getOptions ( ) ) { if ( comparingNames ( text , option . getText ( ) ) ) { return index ; } index ++ ; } return - 1 ; |
public class JSMin { /** * / * next - - get the next character , excluding comments . peek ( ) is used to see
* if a ' / ' is followed by a ' / ' or ' * ' . */
private int next ( ) throws IOException { } } | int c = get ( ) ; if ( c == '/' ) { switch ( peek ( ) ) { case '/' : for ( ; ; ) { c = get ( ) ; if ( c <= '\n' ) { break ; } } break ; case '*' : get ( ) ; while ( c != ' ' ) { switch ( get ( ) ) { case '*' : if ( peek ( ) == '/' ) { get ( ) ; c = ' ' ; } break ; case EOF : error ( "Unterminated comment." ) ; } } break ; } } theY = theX ; theX = c ; return c ; |
public class SameAsTargets { /** * TODO : Generalise it to quads and so on */
public static SameAsTargets extract ( Mapping mapping ) { } } | Optional < RDFAtomPredicate > triplePredicate = mapping . getRDFAtomPredicates ( ) . stream ( ) . filter ( p -> p instanceof TriplePredicate ) . findFirst ( ) ; return triplePredicate . map ( p -> { ImmutableSet < Constant > iriTemplates = extractSameAsIRITemplates ( mapping , p ) ; return extractSameAsTargets ( iriTemplates , mapping , p ) ; } ) . orElseGet ( ( ) -> new SameAsTargets ( ImmutableSet . of ( ) , ImmutableSet . of ( ) ) ) ; |
public class RequestMessage { /** * Sets a name for this tap stream . If the tap stream fails this name can be
* used to try to restart the tap stream from where it last left off .
* @ param n The name for the tap stream . */
public void setName ( String n ) { } } | if ( n . length ( ) > 65535 ) { throw new IllegalArgumentException ( "Tap name too long" ) ; } totalbody += n . length ( ) - name . length ( ) ; keylength = ( short ) n . length ( ) ; name = n ; |
public class CassandraDefs { /** * Create a SlicePredicate that starts at the given column name , selecting up to
* { @ link # MAX _ COLS _ BATCH _ SIZE } columns .
* @ param startColName Starting column name as a byte [ ] .
* @ param endColName Ending column name as a byte [ ]
* @ return SlicePredicate that starts at the given starting column name ,
* ends at the given ending column name , selecting up to
* { @ link # MAX _ COLS _ BATCH _ SIZE } columns . */
static SlicePredicate slicePredicateStartEndCol ( byte [ ] startColName , byte [ ] endColName , int count ) { } } | if ( startColName == null ) startColName = EMPTY_BYTES ; if ( endColName == null ) endColName = EMPTY_BYTES ; SliceRange sliceRange = new SliceRange ( ByteBuffer . wrap ( startColName ) , ByteBuffer . wrap ( endColName ) , false , count ) ; SlicePredicate slicePred = new SlicePredicate ( ) ; slicePred . setSlice_range ( sliceRange ) ; return slicePred ; |
public class JSONObject { /** * Get the value object associated with a key .
* @ param key
* A key string .
* @ return The object associated with the key .
* @ throws JSONException
* if the key is not found . */
public Object get ( String key ) throws JSONException { } } | if ( key == null ) { throw new JSONException ( "Null key." ) ; } Object object = this . opt ( key ) ; if ( object == null ) { throw new JSONException ( "JSONObject[" + quote ( key ) + "] not found." ) ; } return object ; |
public class CommercePriceListUtil { /** * Returns the last commerce price list in the ordered set where companyId = & # 63 ; .
* @ param companyId the company ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commerce price list , or < code > null < / code > if a matching commerce price list could not be found */
public static CommercePriceList fetchByCompanyId_Last ( long companyId , OrderByComparator < CommercePriceList > orderByComparator ) { } } | return getPersistence ( ) . fetchByCompanyId_Last ( companyId , orderByComparator ) ; |
public class DatatypeBuilderImpl { /** * Return Integer . MAX _ VALUE for values that are too big */
private int convertNonNegativeInteger ( String str ) { } } | str = str . trim ( ) ; DecimalDatatype decimal = new DecimalDatatype ( ) ; if ( ! decimal . lexicallyAllows ( str ) ) return - 1 ; // Canonicalize the value
str = decimal . getValue ( str , null ) . toString ( ) ; // Reject negative and fractional numbers
if ( str . charAt ( 0 ) == '-' || str . indexOf ( '.' ) >= 0 ) return - 1 ; try { return Integer . parseInt ( str ) ; } catch ( NumberFormatException e ) { // Map out of range integers to MAX _ VALUE
return Integer . MAX_VALUE ; } |
public class HttpUtil { /** * Performs an HTTP GET using the given client , sending the response body
* to the given stream ( which won ' t be auto - closed ) .
* @ param httpClient the client to use .
* @ param requestURI the http or https url .
* @ param sink the stream to send the content to ( it won ' t be auto - closed )
* @ return the resulting entity
* @ throws IOException if the request fails for any reason , including
* a non - 200 status code . */
public static HttpEntity get ( HttpClient httpClient , URI requestURI , OutputStream sink ) throws IOException { } } | HttpEntity entity = doGet ( httpClient , requestURI ) ; if ( entity != null ) { entity . writeTo ( sink ) ; } return entity ; |
public class ColorUtils { /** * Convert the hex color values to a hex color , shorthanded when possible
* @ param red
* red hex color in format RR or R
* @ param green
* green hex color in format GG or G
* @ param blue
* blue hex color in format BB or B
* @ param alpha
* alpha hex color in format AA or A , null to not include alpha
* @ return hex color in format # ARGB , # RGB , # AARRGGBB , or # RRGGBB */
public static String toColorShorthandWithAlpha ( String red , String green , String blue , String alpha ) { } } | return shorthandHex ( toColorWithAlpha ( red , green , blue , alpha ) ) ; |
public class DefaultApplicationObjectConfigurer { /** * Sets the { @ link LabelInfo } of the given object . The label info is created
* after loading the encoded label string from this instance ' s
* { @ link MessageSource } using a message code in the format
* < pre >
* & lt ; objectName & gt ; . label
* < / pre >
* @ param configurable The object to be configured . Must not be null .
* @ param objectName The name of the configurable object , unique within the
* application . Must not be null .
* @ throws IllegalArgumentException if either argument is null . */
protected void configureLabel ( LabelConfigurable configurable , String objectName ) { } } | Assert . notNull ( configurable , "configurable" ) ; Assert . notNull ( objectName , "objectName" ) ; String labelStr = loadMessage ( objectName + "." + LABEL_KEY ) ; if ( StringUtils . hasText ( labelStr ) ) { LabelInfo labelInfo = LabelInfo . valueOf ( labelStr ) ; configurable . setLabelInfo ( labelInfo ) ; } |
public class Mapper { /** * see { @ link # comparator ( Mapper ) }
* @ param mapper mapper
* @ param reverse if true , reverse the order of comparison
* @ return comparator */
public static Comparator comparator ( final Mapper mapper , final boolean reverse ) { } } | return new Comparator ( ) { public int compare ( Object o , Object o1 ) { return ( ( Comparable ) mapper . map ( reverse ? o1 : o ) ) . compareTo ( mapper . map ( reverse ? o : o1 ) ) ; } } ; |
public class DiffCalculator { /** * Transmits a partial DiffTask .
* @ param result
* Reference to the DiffTask
* @ throws TimeoutException
* if a timeout occurred */
protected void transmitPartialTask ( final Task < Diff > result ) throws TimeoutException { } } | if ( this . partCounter == 1 ) { this . result . setTaskType ( TaskTypes . TASK_PARTIAL_FIRST ) ; this . taskTransmitter . transmitDiff ( result ) ; } else { this . result . setTaskType ( TaskTypes . TASK_PARTIAL ) ; this . taskTransmitter . transmitPartialDiff ( result ) ; } |
public class ShutdownGatewayRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ShutdownGatewayRequest shutdownGatewayRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( shutdownGatewayRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( shutdownGatewayRequest . getGatewayARN ( ) , GATEWAYARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CommonG { /** * Remove a subelement in a JsonPath
* @ param jsonString String of the json
* @ param expr regex to be removed */
public String removeJSONPathElement ( String jsonString , String expr ) { } } | Configuration conf = Configuration . builder ( ) . jsonProvider ( new GsonJsonProvider ( ) ) . mappingProvider ( new GsonMappingProvider ( ) ) . build ( ) ; DocumentContext context = JsonPath . using ( conf ) . parse ( jsonString ) ; context . delete ( expr ) ; return context . jsonString ( ) ; |
public class DatabaseHashMap { /** * stores userid / passwd information */
void setUserInfo ( ) { } } | String smcDBID = _smc . getSessionDBID ( ) ; if ( smcDBID != null && smcDBID . indexOf ( "::" ) != - 1 ) { try { dbid = smcDBID . substring ( 0 , smcDBID . indexOf ( "::" ) ) ; collectionName = smcDBID . substring ( smcDBID . indexOf ( "::" ) + 2 ) ; if ( collectionName . indexOf ( "$V" ) > 0 ) { collectionName = collectionName . substring ( 0 , collectionName . indexOf ( "$V" ) - 1 ) ; String dbConnectVersionName = smcDBID . substring ( smcDBID . indexOf ( "$V" ) + 2 ) ; dbConnectVersion = ( int ) ( new Double ( dbConnectVersionName ) ) . doubleValue ( ) ; } } catch ( Exception e ) { com . ibm . ws . ffdc . FFDCFilter . processException ( e , "com.ibm.ws.session.store.db.DatabaseHashMap.setUserInfo" , "241" , this ) ; LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . SEVERE , methodClassName , methodNames [ SET_USER_INFO ] , "CommonMessage.exception" , e ) ; } } else dbid = smcDBID ; dbpwd = _smc . getSessionDBPWD ( ) ; |
public class ProxyManager { /** * Get the proxy port currently configured .
* This method first locates a proxy host setting , then returns the proxy port from the same location .
* @ param server a specific server to check for proxy settings ( may be null )
* @ return a network port , or 0 if no proxy is configured */
public static int getProxyPort ( AppleServer server ) { } } | String host = server != null ? server . getProxyHost ( ) : null ; if ( host != null && host . length ( ) > 0 ) { return server . getProxyPort ( ) ; } else { host = System . getProperty ( LOCAL_PROXY_HOST_PROPERTY ) ; if ( host != null && host . length ( ) > 0 ) { return Integer . parseInt ( System . getProperty ( LOCAL_PROXY_PORT_PROPERTY ) ) ; } else { host = System . getProperty ( JVM_PROXY_HOST_PROPERTY ) ; if ( host != null && host . length ( ) > 0 ) { return Integer . parseInt ( System . getProperty ( JVM_PROXY_PORT_PROPERTY ) ) ; } else { return 0 ; } } } |
public class ViaHeaderImpl { /** * { @ inheritDoc } */
@ Override public Buffer getParameter ( final String name ) throws SipParseException , IllegalArgumentException { } } | return getParameter ( Buffers . wrap ( name ) ) ; |
public class Matrix4f { /** * Apply an orthographic projection transformation for a right - handed coordinate system
* using the given NDC z range to this matrix and store the result in < code > dest < / code > .
* If < code > M < / code > is < code > this < / code > matrix and < code > O < / code > the orthographic projection matrix ,
* then the new matrix will be < code > M * O < / code > . So when transforming a
* vector < code > v < / code > with the new matrix by using < code > M * O * v < / code > , the
* orthographic projection transformation will be applied first !
* In order to set the matrix to an orthographic projection without post - multiplying it ,
* use { @ link # setOrtho ( float , float , float , float , float , float , boolean ) setOrtho ( ) } .
* Reference : < a href = " http : / / www . songho . ca / opengl / gl _ projectionmatrix . html # ortho " > http : / / www . songho . ca < / a >
* @ see # setOrtho ( float , float , float , float , float , float , boolean )
* @ param left
* the distance from the center to the left frustum edge
* @ param right
* the distance from the center to the right frustum edge
* @ param bottom
* the distance from the center to the bottom frustum edge
* @ param top
* the distance from the center to the top frustum edge
* @ param zNear
* near clipping plane distance
* @ param zFar
* far clipping plane distance
* @ param zZeroToOne
* whether to use Vulkan ' s and Direct3D ' s NDC z range of < code > [ 0 . . + 1 ] < / code > when < code > true < / code >
* or whether to use OpenGL ' s NDC z range of < code > [ - 1 . . + 1 ] < / code > when < code > false < / code >
* @ param dest
* will hold the result
* @ return dest */
public Matrix4f ortho ( float left , float right , float bottom , float top , float zNear , float zFar , boolean zZeroToOne , Matrix4f dest ) { } } | if ( ( properties & PROPERTY_IDENTITY ) != 0 ) return dest . setOrtho ( left , right , bottom , top , zNear , zFar , zZeroToOne ) ; return orthoGeneric ( left , right , bottom , top , zNear , zFar , zZeroToOne , dest ) ; |
public class OutgoingFileTransfer { /** * This methods handles the transfer and stream negotiation process . It
* returns immediately and its progress will be updated through the
* { @ link NegotiationProgress } callback .
* @ param fileName
* The name of the file that will be transmitted . It is
* preferable for this name to have an extension as it will be
* used to determine the type of file it is .
* @ param fileSize
* The size in bytes of the file that will be transmitted .
* @ param description
* A description of the file that will be transmitted .
* @ param progress
* A callback to monitor the progress of the file transfer
* negotiation process and to retrieve the OutputStream when it
* is complete . */
public synchronized void sendFile ( final String fileName , final long fileSize , final String description , final NegotiationProgress progress ) { } } | if ( progress == null ) { throw new IllegalArgumentException ( "Callback progress cannot be null." ) ; } checkTransferThread ( ) ; if ( isDone ( ) || outputStream != null ) { throw new IllegalStateException ( "The negotiation process has already" + " been attempted for this file transfer" ) ; } setFileInfo ( fileName , fileSize ) ; this . callback = progress ; transferThread = new Thread ( new Runnable ( ) { @ Override public void run ( ) { try { OutgoingFileTransfer . this . outputStream = negotiateStream ( fileName , fileSize , description ) ; progress . outputStreamEstablished ( OutgoingFileTransfer . this . outputStream ) ; } catch ( XMPPErrorException e ) { handleXMPPException ( e ) ; } catch ( Exception e ) { setException ( e ) ; } } } , "File Transfer Negotiation " + streamID ) ; transferThread . start ( ) ; |
public class WebDavNamespaceContext { /** * Returns the list of registered for this URI namespace prefixes .
* @ see javax . xml . namespace . NamespaceContext # getPrefixes ( String )
* @ param namespaceURI namespace URI
* @ return list of registered for prefixes */
public Iterator < String > getPrefixes ( String namespaceURI ) { } } | List < String > list = new ArrayList < String > ( ) ; list . add ( getPrefix ( namespaceURI ) ) ; return list . iterator ( ) ; |
public class DateUtil { /** * Get the month of the date
* @ param date date
* @ return month of the date */
public static int getMonth ( Date date ) { } } | Calendar c = Calendar . getInstance ( ) ; c . setTime ( date ) ; return c . get ( Calendar . MONTH ) ; |
public class ListRootsResult { /** * A list of roots that are defined in an organization .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setRoots ( java . util . Collection ) } or { @ link # withRoots ( java . util . Collection ) } if you want to override the
* existing values .
* @ param roots
* A list of roots that are defined in an organization .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListRootsResult withRoots ( Root ... roots ) { } } | if ( this . roots == null ) { setRoots ( new java . util . ArrayList < Root > ( roots . length ) ) ; } for ( Root ele : roots ) { this . roots . add ( ele ) ; } return this ; |
public class SwaptionDataLattice { /** * Convert tenor given as offset in months to year fraction .
* @ param maturityInMonths The maturity as offset in months .
* @ param tenorInMonths The tenor as offset in months .
* @ return THe tenor as year fraction . */
private double convertTenor ( int maturityInMonths , int tenorInMonths ) { } } | Schedule schedule = fixMetaSchedule . generateSchedule ( referenceDate , maturityInMonths , tenorInMonths ) ; return schedule . getPayment ( schedule . getNumberOfPeriods ( ) - 1 ) ; |
public class RedBlackTree { /** * Removes the largest key and associated value from the symbol table .
* @ throws NoSuchElementException
* if the symbol table is empty */
public void deleteMax ( ) { } } | if ( isEmpty ( ) ) throw new NoSuchElementException ( "BST underflow" ) ; // if both children of root are black , set root to red
if ( ! isRed ( root . getLeft ( ) ) && ! isRed ( root . getRight ( ) ) ) root . setColor ( RED ) ; root = deleteMax ( root ) ; if ( ! isEmpty ( ) ) { root . setParent ( null ) ; root . setColor ( BLACK ) ; } // assert check ( ) ; |
public class SameDiff { /** * Create a new scalar ( rank 0 ) SDVariable with the specified value and datatype
* @ param name Name of the SDVariable
* @ param dataType Data type of the scalar
* @ param value Value to initialize the variable with
* @ return SDVariable */
public SDVariable scalar ( String name , DataType dataType , Number value ) { } } | try ( MemoryWorkspace ws = Nd4j . getMemoryManager ( ) . scopeOutOfWorkspaces ( ) ) { return var ( name , Nd4j . scalar ( dataType , value ) ) ; } |
public class Font { /** * Gets the style that can be used with the calculated < CODE > BaseFont
* < / CODE > .
* @ return the style that can be used with the calculated < CODE > BaseFont
* < / CODE > */
public int getCalculatedStyle ( ) { } } | int style = this . style ; if ( style == UNDEFINED ) { style = NORMAL ; } if ( baseFont != null ) return style ; if ( family == SYMBOL || family == ZAPFDINGBATS ) return style ; else return style & ( ~ BOLDITALIC ) ; |
public class Slice { /** * Transfers this buffer ' s data to the specified destination starting at
* the specified absolute { @ code index } .
* @ param destinationIndex the first index of the destination
* @ param length the number of bytes to transfer
* @ throws IndexOutOfBoundsException if the specified { @ code index } is less than { @ code 0 } ,
* if the specified { @ code dstIndex } is less than { @ code 0 } ,
* if { @ code index + length } is greater than
* { @ code this . capacity } , or
* if { @ code dstIndex + length } is greater than
* { @ code dst . length } */
public void getBytes ( int index , byte [ ] destination , int destinationIndex , int length ) { } } | checkPositionIndexes ( index , index + length , this . length ) ; checkPositionIndexes ( destinationIndex , destinationIndex + length , destination . length ) ; index += offset ; System . arraycopy ( data , index , destination , destinationIndex , length ) ; |
public class EntityTypeMetadataResolver { /** * Determines if any given element in another { @ link Collection } is contained in
* this set .
* @ param set
* The set .
* @ param other
* The other { @ link Collection } .
* @ return < code > true < / code > if any other element is contained . */
public < T > boolean containsAny ( Set < T > set , Collection < T > other ) { } } | for ( T t : other ) { if ( set . contains ( t ) ) { return true ; } } return false ; |
public class CharOperation { /** * Answers true if the given name starts with the given prefix , false otherwise . The comparison is case sensitive . < br >
* < br >
* For example :
* < ol >
* < li >
* < pre >
* prefix = { ' a ' , ' b ' }
* name = { ' a ' , ' b ' , ' b ' , ' a ' , ' b ' , ' a ' }
* result = & gt ; true
* < / pre >
* < / li >
* < li >
* < pre >
* prefix = { ' a ' , ' c ' }
* name = { ' a ' , ' b ' , ' b ' , ' a ' , ' b ' , ' a ' }
* result = & gt ; false
* < / pre >
* < / li >
* < / ol >
* @ param prefix
* the given prefix
* @ param name
* the given name
* @ return true if the given name starts with the given prefix , false otherwise
* @ throws NullPointerException
* if the given name is null or if the given prefix is null */
public static final boolean prefixEquals ( char [ ] prefix , char [ ] name ) { } } | int max = prefix . length ; if ( name . length < max ) { return false ; } for ( int i = max ; -- i >= 0 ; ) { // assumes the prefix is not larger than the name
if ( prefix [ i ] != name [ i ] ) { return false ; } } return true ; |
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public IfcSpaceHeaterTypeEnum createIfcSpaceHeaterTypeEnumFromString ( EDataType eDataType , String initialValue ) { } } | IfcSpaceHeaterTypeEnum result = IfcSpaceHeaterTypeEnum . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class AppConfigChecker { /** * F743-6605 */
static void validateStatefulTimeoutOnInterfaces ( Class < ? > [ ] ifaces , TraceComponent tc ) { } } | if ( ifaces != null ) { for ( Class < ? > iface : ifaces ) { // d618337
if ( iface . isInterface ( ) && iface . getAnnotation ( StatefulTimeout . class ) != null ) { // interface contains class - level @ StatefulTimeout annotation
Tr . warning ( tc , "STATEFUL_TIMEOUT_ON_INTERFACE_CNTR0306W" , iface . getName ( ) ) ; continue ; } } } |
public class XReturnExpressionImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public NotificationChain eInverseRemove ( InternalEObject otherEnd , int featureID , NotificationChain msgs ) { } } | switch ( featureID ) { case XbasePackage . XRETURN_EXPRESSION__EXPRESSION : return basicSetExpression ( null , msgs ) ; } return super . eInverseRemove ( otherEnd , featureID , msgs ) ; |
public class PostalCodeElement { /** * Gets the value of the postalCodeNumberExtension 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 postalCodeNumberExtension property .
* For example , to add a new item , do as follows :
* < pre >
* getPostalCodeNumberExtension ( ) . add ( newItem ) ;
* < / pre >
* Objects of the following type ( s ) are allowed in the list
* { @ link PostalCodeElement . PostalCodeNumberExtension } */
public List < PostalCodeElement . PostalCodeNumberExtension > getPostalCodeNumberExtension ( ) { } } | if ( postalCodeNumberExtension == null ) { postalCodeNumberExtension = new ArrayList < PostalCodeElement . PostalCodeNumberExtension > ( ) ; } return this . postalCodeNumberExtension ; |
public class StorageType { /** * List of limits that are applicable for given storage type .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setStorageTypeLimits ( java . util . Collection ) } or { @ link # withStorageTypeLimits ( java . util . Collection ) } if
* you want to override the existing values .
* @ param storageTypeLimits
* List of limits that are applicable for given storage type .
* @ return Returns a reference to this object so that method calls can be chained together . */
public StorageType withStorageTypeLimits ( StorageTypeLimit ... storageTypeLimits ) { } } | if ( this . storageTypeLimits == null ) { setStorageTypeLimits ( new java . util . ArrayList < StorageTypeLimit > ( storageTypeLimits . length ) ) ; } for ( StorageTypeLimit ele : storageTypeLimits ) { this . storageTypeLimits . add ( ele ) ; } return this ; |
public class PtoPLocalMsgsItemStream { /** * ( non - Javadoc ) */
@ Override public ConsumerManager createConsumerManager ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createConsumerManager" ) ; ConsumerDispatcher consumerDispatcher = ( ConsumerDispatcher ) getOutputHandler ( ) ; if ( consumerDispatcher == null ) { consumerDispatcher = new ConsumerDispatcher ( destinationHandler , this , new ConsumerDispatcherState ( ) ) ; setOutputHandler ( consumerDispatcher ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createConsumerManager" , consumerDispatcher ) ; return consumerDispatcher ; |
public class XmlParser { /** * Parses the content of the given file as XML turning it into a tree
* of Nodes .
* @ param file the File containing the XML to be parsed
* @ return the root node of the parsed tree of Nodes
* @ throws SAXException Any SAX exception , possibly
* wrapping another exception .
* @ throws IOException An IO exception from the parser ,
* possibly from a byte stream or character stream
* supplied by the application . */
public Node parse ( File file ) throws IOException , SAXException { } } | InputSource input = new InputSource ( new FileInputStream ( file ) ) ; input . setSystemId ( "file://" + file . getAbsolutePath ( ) ) ; getXMLReader ( ) . parse ( input ) ; return parent ; |
public class MonitoringFilter { /** * { @ inheritDoc } */
@ Override public void doFilter ( ServletRequest request , ServletResponse response , FilterChain chain ) throws IOException , ServletException { } } | if ( ! ( request instanceof HttpServletRequest ) || ! ( response instanceof HttpServletResponse ) || monitoringDisabled || ! instanceEnabled ) { // si ce n ' est pas une requête http ou si le monitoring est désactivé , on fait suivre
chain . doFilter ( request , response ) ; return ; } final HttpServletRequest httpRequest = ( HttpServletRequest ) request ; final HttpServletResponse httpResponse = ( HttpServletResponse ) response ; if ( httpRequest . getRequestURI ( ) . equals ( getMonitoringUrl ( httpRequest ) ) ) { doMonitoring ( httpRequest , httpResponse ) ; return ; } if ( ! httpCounter . isDisplayed ( ) || isRequestExcluded ( ( HttpServletRequest ) request ) ) { // si cette url est exclue ou si le counter http est désactivé , on ne monitore pas cette requête http
chain . doFilter ( request , response ) ; return ; } doFilter ( chain , httpRequest , httpResponse ) ; |
public class fasta { /** * naive */
public static final byte selectRandom ( frequency [ ] a ) { } } | int len = a . length ; double r = random ( 1.0 ) ; for ( int i = 0 ; i < len ; i ++ ) if ( r < a [ i ] . p ) return a [ i ] . c ; return a [ len - 1 ] . c ; |
public class LongTupleNeighborhoodIterables { /** * Creates an iterable that provides iterators for iterating over the
* Moore neighborhood of the given center and the given radius . < br >
* < br >
* Also see < a href = " . . / . . / package - summary . html # Neighborhoods " >
* Neighborhoods < / a >
* @ param center The center of the Moore neighborhood
* A copy of this tuple will be stored internally .
* @ param radius The radius of the Moore neighborhood
* @ param order The iteration { @ link Order }
* @ return The iterable */
public static Iterable < MutableLongTuple > mooreNeighborhoodIterable ( LongTuple center , int radius , Order order ) { } } | return mooreNeighborhoodIterable ( center , radius , null , null , order ) ; |
public class BusItinerary { /** * Add road segments inside the bus itinerary .
* @ param segments is the segment to add .
* @ param autoConnectHalts indicates if the invalid itinery halts are trying to
* be connected to the added segments . If < code > true < / code > { @ link # putInvalidHaltsOnRoads ( BusItineraryHalt . . . ) }
* is invoked .
* @ param enableLoopAutoBuild indicates if the automatic building of loop is enabled .
* @ return < code > true < / code > if the segment was added , otherwise < code > false < / code > .
* @ since 4.0
* @ see # addRoadSegment ( RoadSegment )
* @ see # addRoadSegments ( RoadPath )
* @ see # addRoadSegment ( RoadSegment , boolean )
* @ see # putInvalidHaltsOnRoads ( BusItineraryHalt . . . ) */
public boolean addRoadSegments ( RoadPath segments , boolean autoConnectHalts , boolean enableLoopAutoBuild ) { } } | if ( segments == null || segments . isEmpty ( ) ) { return false ; } BusItineraryHalt halt ; RoadSegment sgmt ; final Map < BusItineraryHalt , RoadSegment > haltMapping = new TreeMap < > ( ( obj1 , obj2 ) -> Integer . compare ( System . identityHashCode ( obj1 ) , System . identityHashCode ( obj2 ) ) ) ; final Iterator < BusItineraryHalt > haltIterator = this . validHalts . iterator ( ) ; while ( haltIterator . hasNext ( ) ) { halt = haltIterator . next ( ) ; sgmt = this . roadSegments . getRoadSegmentAt ( halt . getRoadSegmentIndex ( ) ) ; haltMapping . put ( halt , sgmt ) ; } final boolean isValidBefore = isValidPrimitive ( ) ; final RoadPath changedPath = this . roadSegments . addAndGetPath ( segments ) ; if ( changedPath != null ) { if ( enableLoopAutoBuild ) { autoLoop ( isValidBefore , changedPath , segments ) ; } int nIdx ; for ( final Entry < BusItineraryHalt , RoadSegment > entry : haltMapping . entrySet ( ) ) { halt = entry . getKey ( ) ; sgmt = entry . getValue ( ) ; nIdx = this . roadSegments . indexOf ( sgmt ) ; halt . setRoadSegmentIndex ( nIdx ) ; halt . checkPrimitiveValidity ( ) ; } final BusItineraryHalt [ ] tabV = new BusItineraryHalt [ this . validHalts . size ( ) ] ; this . validHalts . toArray ( tabV ) ; this . validHalts . clear ( ) ; for ( final BusItineraryHalt busHalt : tabV ) { assert busHalt != null && busHalt . isValidPrimitive ( ) ; ListUtil . addIfAbsent ( this . validHalts , VALID_HALT_COMPARATOR , busHalt ) ; } if ( this . roadNetwork == null ) { final RoadNetwork network = segments . getFirstSegment ( ) . getRoadNetwork ( ) ; this . roadNetwork = new WeakReference < > ( network ) ; network . addRoadNetworkListener ( this ) ; } fireShapeChanged ( new BusChangeEvent ( this , BusChangeEventType . SEGMENT_ADDED , segments . getLastSegment ( ) , this . roadSegments . indexOf ( segments . getLastSegment ( ) ) , "shape" , // $ NON - NLS - 1 $
null , null ) ) ; // Try to connect the itinerary halts to
// the road segments
if ( autoConnectHalts ) { putInvalidHaltsOnRoads ( ) ; } else { checkPrimitiveValidity ( ) ; } return true ; } return false ; |
public class IxSourceQueuedIterator { /** * Cast the object back to a typed value .
* @ param value the value to cast back
* @ return the typed value , maybe null */
@ SuppressWarnings ( "unchecked" ) protected final U fromObject ( Object value ) { } } | return value == NULL ? null : ( U ) value ; |
public class QuadTree { /** * Inserts the element and bounding _ box into the QuadTree at the given
* quad _ handle . Note that a copy will me made of the input bounding _ box .
* Note that this will invalidate any active iterator on the QuadTree .
* Returns an Element _ handle corresponding to the element and bounding _ box .
* \ param element The element of the Geometry to be inserted .
* \ param bounding _ box The bounding _ box of the Geometry to be inserted .
* \ param hint _ index A handle used as a hint where to place the element . This can
* be a handle obtained from a previous insertion and is useful on data
* having strong locality such as segments of a Polygon . */
public int insert ( int element , Envelope2D boundingBox , int hintIndex ) { } } | return m_impl . insert ( element , boundingBox , hintIndex ) ; |
public class StreamDescription { /** * Represents the current enhanced monitoring settings of the stream .
* @ param enhancedMonitoring
* Represents the current enhanced monitoring settings of the stream . */
public void setEnhancedMonitoring ( java . util . Collection < EnhancedMetrics > enhancedMonitoring ) { } } | if ( enhancedMonitoring == null ) { this . enhancedMonitoring = null ; return ; } this . enhancedMonitoring = new com . amazonaws . internal . SdkInternalList < EnhancedMetrics > ( enhancedMonitoring ) ; |
public class GoogleCodingConvention { /** * { @ inheritDoc }
* < p > In Google code , the package name of a source file is its file path .
* Exceptions : if a source file ' s parent directory is " test " , " tests " , or
* " testing " , that directory is stripped from the package name .
* If a file is generated , strip the " genfiles " prefix to try
* to match the package of the generating file . */
@ Override @ GwtIncompatible // TODO ( tdeegan ) : Remove use of Matcher # group to make this fully GWT compatible .
public String getPackageName ( StaticSourceFile source ) { } } | String name = source . getName ( ) ; Matcher genfilesMatcher = GENFILES_DIR . matcher ( name ) ; if ( genfilesMatcher . find ( ) ) { name = genfilesMatcher . group ( 2 ) ; } Matcher m = PACKAGE_WITH_TEST_DIR . matcher ( name ) ; if ( m . find ( ) ) { return m . group ( 1 ) ; } else { int lastSlash = name . lastIndexOf ( '/' ) ; return lastSlash == - 1 ? "" : name . substring ( 0 , lastSlash ) ; } |
public class JDBCPersistenceManagerImpl { /** * / * ( non - Javadoc )
* @ see com . ibm . jbatch . container . services . IPersistenceManagerService # createStepExecution ( long , com . ibm . jbatch . container . context . impl . StepContextImpl ) */
@ Override public StepExecutionImpl createStepExecution ( long rootJobExecId , StepContextImpl stepContext ) { } } | StepExecutionImpl stepExecution = null ; String batchStatus = stepContext . getBatchStatus ( ) == null ? BatchStatus . STARTING . name ( ) : stepContext . getBatchStatus ( ) . name ( ) ; String exitStatus = stepContext . getExitStatus ( ) ; String stepName = stepContext . getStepName ( ) ; if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "batchStatus: " + batchStatus + " | stepName: " + stepName ) ; } long readCount = 0 ; long writeCount = 0 ; long commitCount = 0 ; long rollbackCount = 0 ; long readSkipCount = 0 ; long processSkipCount = 0 ; long filterCount = 0 ; long writeSkipCount = 0 ; Timestamp startTime = stepContext . getStartTimeTS ( ) ; Timestamp endTime = stepContext . getEndTimeTS ( ) ; Metric [ ] metrics = stepContext . getMetrics ( ) ; for ( int i = 0 ; i < metrics . length ; i ++ ) { if ( metrics [ i ] . getType ( ) . equals ( MetricImpl . MetricType . READ_COUNT ) ) { readCount = metrics [ i ] . getValue ( ) ; } else if ( metrics [ i ] . getType ( ) . equals ( MetricImpl . MetricType . WRITE_COUNT ) ) { writeCount = metrics [ i ] . getValue ( ) ; } else if ( metrics [ i ] . getType ( ) . equals ( MetricImpl . MetricType . PROCESS_SKIP_COUNT ) ) { processSkipCount = metrics [ i ] . getValue ( ) ; } else if ( metrics [ i ] . getType ( ) . equals ( MetricImpl . MetricType . COMMIT_COUNT ) ) { commitCount = metrics [ i ] . getValue ( ) ; } else if ( metrics [ i ] . getType ( ) . equals ( MetricImpl . MetricType . ROLLBACK_COUNT ) ) { rollbackCount = metrics [ i ] . getValue ( ) ; } else if ( metrics [ i ] . getType ( ) . equals ( MetricImpl . MetricType . READ_SKIP_COUNT ) ) { readSkipCount = metrics [ i ] . getValue ( ) ; } else if ( metrics [ i ] . getType ( ) . equals ( MetricImpl . MetricType . FILTER_COUNT ) ) { filterCount = metrics [ i ] . getValue ( ) ; } else if ( metrics [ i ] . getType ( ) . equals ( MetricImpl . MetricType . WRITE_SKIP_COUNT ) ) { writeSkipCount = metrics [ i ] . getValue ( ) ; } } Serializable persistentData = stepContext . getPersistentUserData ( ) ; stepExecution = createStepExecution ( rootJobExecId , batchStatus , exitStatus , stepName , readCount , writeCount , commitCount , rollbackCount , readSkipCount , processSkipCount , filterCount , writeSkipCount , startTime , endTime , persistentData ) ; return stepExecution ; |
public class Html5WebSocket { /** * { @ inheritDoc } */
@ Override public void setBinaryType ( @ Nonnull final BinaryType binaryType ) throws IllegalStateException { } } | checkConnected ( ) ; _webSocket . setBinaryType ( binaryType . name ( ) . toLowerCase ( ) ) ; |
public class RedisClient { /** * Test if the specified key exists .
* @ param key
* @ return
* @ throws Exception */
public boolean exists ( String key ) throws Exception { } } | boolean isExist = false ; Jedis jedis = null ; try { jedis = this . jedisPool . getResource ( ) ; isExist = jedis . exists ( SafeEncoder . encode ( key ) ) ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) , e ) ; this . jedisPool . returnBrokenResource ( jedis ) ; throw e ; } finally { if ( jedis != null ) { this . jedisPool . returnResource ( jedis ) ; } } return isExist ; |
public class SnackbarBuilder { /** * Set the callback to be informed of the Snackbar being dismissed due to another Snackbar being shown .
* @ param callback The callback .
* @ return This instance . */
@ SuppressWarnings ( "WeakerAccess" ) public SnackbarBuilder consecutiveDismissCallback ( final SnackbarConsecutiveDismissCallback callback ) { } } | callbacks . add ( new SnackbarCallback ( ) { public void onSnackbarDismissedAfterAnotherShown ( Snackbar snackbar ) { callback . onSnackbarDismissedAfterAnotherShown ( snackbar ) ; } } ) ; return this ; |
public class ReflectionHelper { /** * Introspect the given object .
* @ param obj object for introspection .
* @ return a map containing object ' s field values .
* @ throws IntrospectionException if an exception occurs during introspection
* @ throws InvocationTargetException if property getter throws an exception
* @ throws IllegalAccessException if property getter is inaccessible */
public static Map < String , Object > introspect ( Object obj ) throws IntrospectionException , InvocationTargetException , IllegalAccessException { } } | Map < String , Object > result = new HashMap < > ( ) ; BeanInfo info = Introspector . getBeanInfo ( obj . getClass ( ) ) ; for ( PropertyDescriptor pd : info . getPropertyDescriptors ( ) ) { Method reader = pd . getReadMethod ( ) ; String name = pd . getName ( ) ; if ( reader != null && ! "class" . equals ( name ) ) { result . put ( name , reader . invoke ( obj ) ) ; } } return result ; |
public class ReflectionUtil { /** * 直接设置对象属性值 , 无视private / protected修饰符 , 不经过setter函数 .
* 性能较差 , 用于单次调用的场景 */
public static void setFieldValue ( final Object obj , final String fieldName , final Object value ) { } } | Field field = getField ( obj . getClass ( ) , fieldName ) ; if ( field == null ) { throw new IllegalArgumentException ( "Could not find field [" + fieldName + "] on target [" + obj + ']' ) ; } setField ( obj , field , value ) ; |
public class Iconomy6 { /** * Import accounts from the database .
* @ param sender The command sender so we can send back messages .
* @ return True if the convert is done . Else false . */
private boolean importDatabase ( String sender ) { } } | Connection connection = null ; PreparedStatement statement = null ; try { connection = db . getConnection ( ) ; if ( getDbConnectInfo ( ) . get ( "tablename" ) != null ) { statement = connection . prepareStatement ( "SELECT * FROM " + getDbConnectInfo ( ) . get ( "tablename" ) ) ; } else { statement = connection . prepareStatement ( IConomyTable . SELECT_ENTRY ) ; } ResultSet set = statement . executeQuery ( ) ; List < User > userList = new ArrayList < > ( ) ; while ( set . next ( ) ) { userList . add ( new User ( set . getString ( "username" ) , set . getDouble ( "balance" ) ) ) ; } addAccountToString ( sender , userList ) ; } catch ( SQLException e ) { e . printStackTrace ( ) ; } finally { Tools . closeJDBCStatement ( statement ) ; Tools . closeJDBCConnection ( connection ) ; } return true ; |
public class RenameHandler { /** * this is a method to aid IDE debugging of class initialization */
private static RenameHandler createInstance ( ) { } } | // log errors to System . err , as problems in static initializers can be troublesome to diagnose
RenameHandler instance = create ( false ) ; try { // calling loadFromClasspath ( ) is the best option even though it mutates INSTANCE
// only serious errors will be caught here , most errors will log from parseRenameFile ( )
instance . loadFromClasspath ( ) ; } catch ( IllegalStateException ex ) { System . err . println ( "ERROR: " + ex . getMessage ( ) ) ; ex . printStackTrace ( ) ; } catch ( Throwable ex ) { System . err . println ( "ERROR: Failed to load Renamed.ini files: " + ex . getMessage ( ) ) ; ex . printStackTrace ( ) ; } return instance ; |
public class MathExpressions { /** * Create a { @ code power ( num , exponent ) } expression
* < p > Returns num raised to the power exponent < / p >
* @ param num numeric expression
* @ param exponent exponent
* @ return power ( num , exponent ) */
public static < A extends Number & Comparable < ? > > NumberExpression < Double > power ( Expression < A > num , int exponent ) { } } | return Expressions . numberOperation ( Double . class , Ops . MathOps . POWER , num , ConstantImpl . create ( exponent ) ) ; |
public class Mapper { /** * Converts an entity ( POJO ) to a DBObject . A special field will be added to keep track of the class type .
* @ param datastore the Datastore to use when fetching this reference
* @ param dbObject the DBObject
* @ param < T > the type of the referenced entity
* @ return the entity
* @ morphia . internal
* @ deprecated no replacement is planned */
@ Deprecated < T > T fromDBObject ( final Datastore datastore , final DBObject dbObject ) { } } | if ( dbObject . containsField ( opts . getDiscriminatorField ( ) ) ) { T entity = opts . getObjectFactory ( ) . createInstance ( null , dbObject ) ; entity = fromDb ( datastore , dbObject , entity , createEntityCache ( ) ) ; return entity ; } else { throw new MappingException ( format ( "The DBObject does not contain a %s key. Determining entity type is impossible." , opts . getDiscriminatorField ( ) ) ) ; } |
public class PreferenceActivity { /** * Obtains the elevation of the activity ' s toolbar from the activity ' s theme . */
private void obtainToolbarElevation ( ) { } } | int elevation ; try { elevation = ThemeUtil . getDimensionPixelSize ( this , R . attr . toolbarElevation ) ; } catch ( NotFoundException e ) { elevation = getResources ( ) . getDimensionPixelSize ( R . dimen . toolbar_elevation ) ; } setToolbarElevation ( pixelsToDp ( this , elevation ) ) ; |
public class AbstractSocket { /** * When one or more new messages have arrived , call this to distribute to all of the listeners .
* If need to wait until all of the listeners have handled the messages , can call Future . get ( )
* or Future . isDone ( ) .
* @ throws IllegalStateException if this socket is closed */
protected Future < ? > callOnMessages ( final List < ? extends Message > messages ) throws IllegalStateException { } } | if ( isClosed ( ) ) throw new IllegalStateException ( "Socket is closed" ) ; if ( messages . isEmpty ( ) ) throw new IllegalArgumentException ( "messages may not be empty" ) ; return listenerManager . enqueueEvent ( new ConcurrentListenerManager . Event < SocketListener > ( ) { @ Override public Runnable createCall ( final SocketListener listener ) { return new Runnable ( ) { @ Override public void run ( ) { listener . onMessages ( AbstractSocket . this , messages ) ; } } ; } } ) ; |
public class ListPolicyVersionsResult { /** * The policy versions .
* @ param policyVersions
* The policy versions . */
public void setPolicyVersions ( java . util . Collection < PolicyVersion > policyVersions ) { } } | if ( policyVersions == null ) { this . policyVersions = null ; return ; } this . policyVersions = new java . util . ArrayList < PolicyVersion > ( policyVersions ) ; |
public class LanguageAlchemyEntity { /** * Set ISO - 639-3 code for the detected language .
* For more information on ISO - 639-3 : @ see < a href = " http : / / en . wikipedia . org / wiki / ISO _ 639-3 " > http : / / en . wikipedia . org / wiki / ISO _ 639-3 < / a > < / a >
* @ param iso6393 ISO - 639-3 code for the detected language */
public void setIso6393 ( String iso6393 ) { } } | if ( iso6393 != null ) { iso6393 = iso6393 . trim ( ) ; } this . iso6393 = iso6393 ; |
public class ConcurrentHeapThetaBuffer { /** * Propagates a single hash value to the shared sketch
* @ param hash to be propagated */
private boolean propagateToSharedSketch ( final long hash ) { } } | // noinspection StatementWithEmptyBody
while ( localPropagationInProgress . get ( ) ) { } // busy wait until previous propagation completed
localPropagationInProgress . set ( true ) ; final boolean res = shared . propagate ( localPropagationInProgress , null , hash ) ; // in this case the parent empty _ and curCount _ were not touched
thetaLong_ = shared . getVolatileTheta ( ) ; return res ; |
public class RoleAssignmentsInner { /** * Get the specified role assignment .
* @ param scope The scope of the role assignment .
* @ param roleAssignmentName The name of the role assignment to get .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the RoleAssignmentInner object */
public Observable < RoleAssignmentInner > getAsync ( String scope , String roleAssignmentName ) { } } | return getWithServiceResponseAsync ( scope , roleAssignmentName ) . map ( new Func1 < ServiceResponse < RoleAssignmentInner > , RoleAssignmentInner > ( ) { @ Override public RoleAssignmentInner call ( ServiceResponse < RoleAssignmentInner > response ) { return response . body ( ) ; } } ) ; |
public class CharStreams { /** * Reads all of the lines from a { @ link Readable } object . The lines do not include
* line - termination characters , but do include other leading and trailing whitespace .
* < p > Does not close the { @ code Readable } . If reading files or resources you should use the
* { @ link Files # readLines } and { @ link Resources # readLines } methods .
* @ param r the object to read from
* @ return a mutable { @ link List } containing all the lines
* @ throws IOException if an I / O error occurs */
public static List < String > readLines ( Readable r ) throws IOException { } } | List < String > result = new ArrayList < String > ( ) ; LineReader lineReader = new LineReader ( r ) ; String line ; while ( ( line = lineReader . readLine ( ) ) != null ) { result . add ( line ) ; } return result ; |
public class RandomAccessStorageModule { /** * { @ inheritDoc } */
@ Override public void write ( byte [ ] bytes , long storageIndex ) throws IOException { } } | randomAccessFile . seek ( storageIndex ) ; randomAccessFile . write ( bytes , 0 , bytes . length ) ; |
public class DefaultFastFileStorageClient { /** * 获取缩略图
* @ param inputStream
* @ return
* @ throws IOException */
private ByteArrayInputStream generateThumbImageByDefault ( InputStream inputStream ) throws IOException { } } | LOGGER . debug ( "根据默认配置生成缩略图" ) ; // 在内存当中生成缩略图
ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; // @ formatter : off
Thumbnails . of ( inputStream ) . size ( thumbImageConfig . getWidth ( ) , thumbImageConfig . getHeight ( ) ) . toOutputStream ( out ) ; // @ formatter : on
return new ByteArrayInputStream ( out . toByteArray ( ) ) ; |
public class MsgDestinationsPresenter { /** * JMS */
void loadJMSConfig ( ) { } } | ModelNode address = Baseadress . get ( ) ; address . add ( "subsystem" , "messaging" ) ; address . add ( "hornetq-server" , getCurrentServer ( ) ) ; loadJMSCmd . execute ( address , new SimpleCallback < AggregatedJMSModel > ( ) { @ Override public void onSuccess ( AggregatedJMSModel result ) { getJMSView ( ) . setConnectionFactories ( result . getFactories ( ) ) ; getJMSView ( ) . setQueues ( result . getQueues ( ) ) ; getJMSView ( ) . setTopics ( result . getTopics ( ) ) ; } } ) ; |
public class ExpiringReference { /** * Creates an expiring reference with the supplied value and expiration time . */
public static < T > ExpiringReference < T > create ( T value , long expireMillis ) { } } | return new ExpiringReference < T > ( value , expireMillis ) ; |
public class ConditionalBuilder { /** * Adds an { @ code else if } clause with the given predicate and consequent to this conditional . */
public ConditionalBuilder addElseIf ( Expression predicate , Statement consequent ) { } } | conditions . add ( new IfThenPair < > ( predicate , consequent ) ) ; return this ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public IDDUNITBASE createIDDUNITBASEFromString ( EDataType eDataType , String initialValue ) { } } | IDDUNITBASE result = IDDUNITBASE . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class SQLiteTypeManager_int { /** * Créee un trigger qui permet la maj automatique d ' un champ de statut ( INTEGER ) dont la valeur signifiera : - 0 : enregistrement créé localement - 1 :
* enregistrement copie conforme du serveur - 2 : enregistrement modifié localement
* @ see com . hexa . client . sql . SQLiteTypeManagerManager . SQLiteTypeManager # localRecordStateCreateTriggerSql ( java . lang . String , java . lang . String ) */
@ Override public Boolean localRecordStateCreateTriggerSql ( SQLite db , String tableName , String fieldName ) { } } | String triggerSql = "CREATE TRIGGER IF NOT EXISTS " + tableName + "_" + fieldName + "_localstate_update BEFORE UPDATE ON " + tableName + " FOR EACH ROW " + "WHEN NEW." + fieldName + " <> 1 " + "BEGIN " + "UPDATE " + tableName + " SET " + fieldName + " = 2 WHERE id=NEW.id; END" ; db . execute ( triggerSql ) ; return true ; |
public class RequestParamMap { /** * This method doesn ' t make sense but it should stay , so that it ' s easy to
* spot usage of this invalid method .
* @ param sBaseName
* Base name
* @ return Base name as is . */
@ Nonnull @ Nonempty @ Deprecated public static String getFieldName ( @ Nonnull @ Nonempty final String sBaseName ) { } } | ValueEnforcer . notEmpty ( sBaseName , "BaseName" ) ; return sBaseName ; |
public class ConfigOptionsDocGenerator { /** * This method generates html tables from set of classes containing { @ link ConfigOption ConfigOptions } .
* < p > For each class 1 or more html tables will be generated and placed into a separate file , depending on whether
* the class is annotated with { @ link ConfigGroups } . The tables contain the key , default value and description for
* every { @ link ConfigOption } .
* < p > One additional table is generated containing all { @ link ConfigOption ConfigOptions } that are annotated with
* { @ link org . apache . flink . annotation . docs . Documentation . CommonOption } .
* @ param args
* [ 0 ] output directory for the generated files
* [ 1 ] project root directory */
public static void main ( String [ ] args ) throws IOException , ClassNotFoundException { } } | String outputDirectory = args [ 0 ] ; String rootDir = args [ 1 ] ; for ( OptionsClassLocation location : LOCATIONS ) { createTable ( rootDir , location . getModule ( ) , location . getPackage ( ) , outputDirectory , DEFAULT_PATH_PREFIX ) ; } generateCommonSection ( rootDir , outputDirectory , LOCATIONS , DEFAULT_PATH_PREFIX ) ; |
public class Journal { /** * Write the given byte buffer record , either sync ( if
* { @ code WriteType . SYNC } ) or async ( if { @ code WriteType . ASYNC } ) , and
* returns the stored { @ link Location } . < br / > A sync write causes all
* previously batched async writes to be synced too . < br / > The provided
* callback will be invoked if sync is completed or if some error occurs
* during syncing .
* @ param data
* @ param write
* @ param callback
* @ return
* @ throws IOException
* @ throws ClosedJournalException */
public Location write ( byte [ ] data , WriteType write , WriteCallback callback ) throws ClosedJournalException , IOException { } } | Location loc = appender . storeItem ( data , Location . USER_RECORD_TYPE , write . equals ( WriteType . SYNC ) ? true : false , callback ) ; return loc ; |
public class CSV { /** * Reads in the given CSV dataset as a simple CSV file
* @ param path the CSV file
* @ param lines _ to _ skip the number of lines to skip when reading in the CSV
* ( used to skip header information )
* @ param cat _ cols a set of the indices to treat as categorical features .
* @ return a simple dataset of the given CSV file
* @ throws IOException */
public static SimpleDataSet read ( Path path , int lines_to_skip , Set < Integer > cat_cols ) throws IOException { } } | return read ( path , DEFAULT_DELIMITER , lines_to_skip , DEFAULT_COMMENT , cat_cols ) ; |
public class PersistenceUnitComponent { /** * @ see javax . persistence . spi . PersistenceUnitInfo # getTransactionType ( ) */
@ Override public PersistenceUnitTransactionType getTransactionType ( ) { } } | if ( persistenceUnitXml . getTransactionType ( ) == org . wisdom . framework . jpa . model . PersistenceUnitTransactionType . RESOURCE_LOCAL ) { return PersistenceUnitTransactionType . RESOURCE_LOCAL ; } else { return PersistenceUnitTransactionType . JTA ; } |
public class ExceptionUtilities { /** * Gets the root cause of an Exception / Error
* @ param throwable The exception / error to find the root cause of .
* @ return The root cause of the exception , or throwable if it is the root cause . */
public static Throwable getRootCause ( Throwable throwable ) { } } | if ( throwable . getCause ( ) != null ) return getRootCause ( throwable . getCause ( ) ) ; return throwable ; |
public class LogPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getNewUserAdded ( ) { } } | if ( newUserAddedEClass == null ) { newUserAddedEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( LogPackage . eNS_URI ) . getEClassifiers ( ) . get ( 7 ) ; } return newUserAddedEClass ; |
public class Matrix { /** * Transposes a 4 x 4 matrix .
* @ param mTrans the array that holds the output inverted matrix
* @ param mTransOffset an offset into mInv where the inverted matrix is
* stored .
* @ param m the input array
* @ param mOffset an offset into m where the matrix is stored . */
public static void transposeM ( float [ ] mTrans , int mTransOffset , float [ ] m , int mOffset ) { } } | for ( int i = 0 ; i < 4 ; i ++ ) { int mBase = i * 4 + mOffset ; mTrans [ i + mTransOffset ] = m [ mBase ] ; mTrans [ i + 4 + mTransOffset ] = m [ mBase + 1 ] ; mTrans [ i + 8 + mTransOffset ] = m [ mBase + 2 ] ; mTrans [ i + 12 + mTransOffset ] = m [ mBase + 3 ] ; } |
public class DynamicSelectEkstaziMojo { /** * Implements ' select ' that does not require changes to any
* existing plugin in configuration file ( s ) . */
private void executeThis ( ) throws MojoExecutionException { } } | // Try to attach agent that will modify Surefire .
if ( AgentLoader . loadEkstaziAgent ( ) ) { // Prepare initial list of options and set property .
System . setProperty ( AbstractMojoInterceptor . ARGLINE_INTERNAL_PROP , prepareEkstaziOptions ( ) ) ; // Find non affected classes and set property .
List < String > nonAffectedClasses = computeNonAffectedClasses ( ) ; System . setProperty ( AbstractMojoInterceptor . EXCLUDES_INTERNAL_PROP , Arrays . toString ( nonAffectedClasses . toArray ( new String [ 0 ] ) ) ) ; } else { throw new MojoExecutionException ( "Ekstazi cannot attach to the JVM, please specify Ekstazi 'restore' explicitly." ) ; } |
public class MFPPush { /** * Unsubscribes to the given tag
* @ param tagName name of the tag
* @ param listener Mandatory listener class . When the subscription is deleted
* successfully the { @ link MFPPushResponseListener } . onSuccess
* method is called with the tagName for which subscription is
* deleted . { @ link MFPPushResponseListener } . onFailure method is
* called otherwise */
public void unsubscribe ( final String tagName , final MFPPushResponseListener < String > listener ) { } } | if ( isAbleToSubscribe ( ) ) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder ( applicationId ) ; String path = builder . getSubscriptionsUrl ( deviceId , tagName ) ; if ( path == DEVICE_ID_NULL ) { listener . onFailure ( new MFPPushException ( "The device is not registered yet. Please register device before calling subscriptions API" ) ) ; return ; } logger . debug ( "MFPPush:unsubscribe() - The tag unsubscription path is: " + path ) ; MFPPushInvoker invoker = MFPPushInvoker . newInstance ( appContext , path , Request . DELETE , clientSecret ) ; invoker . setResponseListener ( new ResponseListener ( ) { @ Override public void onSuccess ( Response response ) { logger . info ( "MFPPush:unsubscribe() - Tag unsubscription successful. The response is: " + response . toString ( ) ) ; listener . onSuccess ( tagName ) ; } @ Override public void onFailure ( Response response , Throwable throwable , JSONObject jsonObject ) { // Error while Unsubscribing to tags .
logger . error ( "MFPPush: Error while Unsubscribing to tags" ) ; listener . onFailure ( getException ( response , throwable , jsonObject ) ) ; } } ) ; invoker . execute ( ) ; } |
public class WiringPiGpioProviderBase { /** * internal */
protected void updateInterruptListener ( Pin pin ) { } } | // enable or disable single static listener with the native impl
if ( listeners . size ( ) > 0 ) { // setup interrupt listener native thread and enable callbacks
if ( ! com . pi4j . wiringpi . GpioInterrupt . hasListener ( this ) ) { com . pi4j . wiringpi . GpioInterrupt . addListener ( this ) ; } // only configure WiringPi interrupts for digital input pins
if ( pinModeCache [ pin . getAddress ( ) ] == PinMode . DIGITAL_INPUT ) { // enable or disable the individual pin listener
if ( listeners . containsKey ( pin ) && listeners . get ( pin ) . size ( ) > 0 ) { // enable interrupt listener for this pin
com . pi4j . wiringpi . GpioInterrupt . enablePinStateChangeCallback ( pin . getAddress ( ) ) ; } else { // disable interrupt listener for this pin
com . pi4j . wiringpi . GpioInterrupt . disablePinStateChangeCallback ( pin . getAddress ( ) ) ; } } } else { // disable interrupt listener for this pins
com . pi4j . wiringpi . GpioInterrupt . disablePinStateChangeCallback ( pin . getAddress ( ) ) ; // remove interrupt listener , disable native thread and callbacks
if ( com . pi4j . wiringpi . GpioInterrupt . hasListener ( this ) ) { com . pi4j . wiringpi . GpioInterrupt . removeListener ( this ) ; } } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.