signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class ClientService { /** * This function returns a { @ link List } of PAYMILL { @ link Client } objects . In which order this list is returned depends on the
* optional parameters . If < code > null < / code > is given , no filter or order will be applied .
* @ param filter
* { @ link com . paymill . models . Client . Filter } or < code > null < / code >
* @ param order
* { @ link com . paymill . models . Client . Order } or < code > null < / code >
* @ return { @ link PaymillList } which contains a { @ link List } of PAYMILL { @ link Client } s and their total count . */
public PaymillList < Client > list ( Client . Filter filter , Client . Order order ) { } }
|
return this . list ( filter , order , null , null ) ;
|
public class Download { /** * Downloads the content to a specified file .
* @ param config the ` HttpConfig ` instance
* @ param file the file where content will be downloaded */
public static void toFile ( final HttpConfig config , final File file ) { } }
|
toFile ( config , ContentTypes . ANY . getAt ( 0 ) , file ) ;
|
public class ThreadContext { /** * Set the inbound connection info on this context to the input value .
* @ param connectionInfo */
public void setInboundConnectionInfo ( Map < String , Object > connectionInfo ) { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "setInboundConnectionInfo" ) ; this . inboundConnectionInfo = connectionInfo ;
|
public class MemcmpEncoder { /** * Bytes are encoded by writing all bytes out as themselves , except for bytes
* of value 0x00 . Bytes of value 0x00 are encoded as two bytes , 0x00 0x01 . The
* end marker is signified by two 0x00 bytes . This guarantees that the end
* marker is the least possible value .
* @ param bytes
* The bytes to encode .
* @ param start
* The start of the byte array to encode .
* @ param len
* The length of the byte array to encode . */
@ Override public void writeBytes ( byte [ ] bytes , int start , int len ) throws IOException { } }
|
for ( int i = start ; i < start + len ; ++ i ) { if ( bytes [ i ] == 0x00 ) { out . write ( 0 ) ; out . write ( 1 ) ; } else { out . write ( ( int ) bytes [ i ] ) ; } } out . write ( 0 ) ; out . write ( 0 ) ;
|
public class EverySupportingMessagingService { /** * Sends the message . The message can be anything with any content and that
* must be delivered to something or someone .
* Ask each sender if it is able to handle the message . Each sender that
* can ' t handle the message is skipped . Each sender that is able to handle
* it will be called in order to really send the message .
* @ param message
* the message to send
* @ throws MessagingException
* when the message couldn ' t be sent
* @ throws MessageNotSentException
* when no sender could handle the message */
@ Override public void send ( Message message ) throws MessagingException { } }
|
LOG . info ( "Sending message..." ) ; LOG . debug ( "{}" , message ) ; LOG . debug ( "Find senders that is able to send the message {}" , message ) ; boolean sent = false ; for ( ConditionalSender sender : senders ) { if ( sender . supports ( message ) ) { LOG . debug ( "Sending message {} using sender {}..." , message , sender ) ; sender . send ( message ) ; LOG . debug ( "Message {} sent using sender {}" , message , sender ) ; sent = true ; } else { LOG . debug ( "Sender {} can't handle the message {}" , sender , message ) ; } } if ( sent ) { LOG . info ( "Message sent" ) ; LOG . debug ( "{}" , message ) ; } else { throw new MessageNotSentException ( "No sender available to send the message" , message ) ; }
|
public class GeometryIndexService { /** * Checks to see if a given index is the child of another index .
* @ param parentIndex
* The so - called parent index .
* @ param childIndex
* The so - called child index .
* @ return Is the second index really a child of the first index ? */
public boolean isChildOf ( GeometryIndex parentIndex , GeometryIndex childIndex ) { } }
|
if ( parentIndex . getValue ( ) != childIndex . getValue ( ) ) { return false ; } if ( parentIndex . hasChild ( ) && childIndex . hasChild ( ) ) { return isChildOf ( parentIndex . getChild ( ) , childIndex . getChild ( ) ) ; } else if ( ! parentIndex . hasChild ( ) && childIndex . hasChild ( ) ) { return true ; } return false ;
|
public class IOUtils { /** * Read next string from input stream .
* @ param is The input stream to read .
* @ param term Terminator character .
* @ return The string up until , but not including the terminator .
* @ throws IOException when unable to read from stream . */
public static String readString ( InputStream is , String term ) throws IOException { } }
|
return readString ( new Utf8StreamReader ( is ) , term ) ;
|
public class ModifyTableBuilder { /** * This method will build { @ link ModifyColumnFamiliesRequest } objects based on a diff of the
* new and existing set of column descriptors . This is for use in
* { @ link org . apache . hadoop . hbase . client . Admin # modifyTable ( TableName , HTableDescriptor ) } .
* @ param newTableDesc a { @ link HTableDescriptor } object .
* @ param currentTableDesc a { @ link HTableDescriptor } object .
* @ return a { @ link ModifyTableBuilder } object to request modification along with GCRule . */
public static ModifyTableBuilder buildModifications ( HTableDescriptor newTableDesc , HTableDescriptor currentTableDesc ) { } }
|
Preconditions . checkNotNull ( newTableDesc ) ; Preconditions . checkNotNull ( currentTableDesc ) ; ModifyTableBuilder requestBuilder = ModifyTableBuilder . newBuilder ( currentTableDesc . getTableName ( ) ) ; Set < String > currentColumnNames = getColumnNames ( currentTableDesc ) ; Set < String > newColumnNames = getColumnNames ( newTableDesc ) ; for ( HColumnDescriptor hColumnDescriptor : newTableDesc . getFamilies ( ) ) { String columnName = hColumnDescriptor . getNameAsString ( ) ; if ( currentColumnNames . contains ( columnName ) ) { requestBuilder . modify ( hColumnDescriptor ) ; } else { requestBuilder . add ( hColumnDescriptor ) ; } } Set < String > columnsToRemove = new HashSet < > ( currentColumnNames ) ; columnsToRemove . removeAll ( newColumnNames ) ; for ( String column : columnsToRemove ) { requestBuilder . delete ( column ) ; } return requestBuilder ;
|
public class AttributeCollector { /** * Method called to allow reusing of collector , usually right before
* starting collecting attributes for a new start tag .
* Note : public only so that it can be called by unit tests . */
public void reset ( ) { } }
|
if ( mNsCount > 0 ) { mNamespaceBuilder . reset ( ) ; mDefaultNsDeclared = false ; mNsCount = 0 ; } /* No need to clear attr name , or NS prefix Strings ; they are
* canonicalized and will be referenced by symbol table in any
* case . . . so we can save trouble of cleaning them up . This Object
* will get GC ' ed soon enough , after parser itself gets disposed of . */
if ( mAttrCount > 0 ) { mValueBuilder . reset ( ) ; mAttrCount = 0 ; if ( mXmlIdAttrIndex >= 0 ) { mXmlIdAttrIndex = XMLID_IX_NONE ; } } /* Note : attribute values will be cleared later on , when validating
* namespaces . This so that we know how much to clean up ; and
* occasionally can also just avoid clean up ( when resizing ) */
|
public class Config { /** * Retrieve an < code > InetAddress < / code > . If the address is not
* an IP address and cannot be resolved < code > null < / code > will
* be returned . */
public static InetAddress getInetAddress ( Properties props , String key , InetAddress def ) { } }
|
String addr = props . getProperty ( key ) ; if ( addr != null ) { try { def = InetAddress . getByName ( addr ) ; } catch ( UnknownHostException uhe ) { log . error ( "Unknown host " + addr , uhe ) ; } } return def ;
|
public class BitsUtil { /** * Compute the cardinality ( number of set bits )
* Low - endian layout for the array .
* @ param v Value
* @ return Number of bits set in long [ ] */
public static int cardinality ( long [ ] v ) { } }
|
int sum = 0 ; for ( int i = 0 ; i < v . length ; i ++ ) { sum += Long . bitCount ( v [ i ] ) ; } return sum ;
|
public class A_CmsAjaxGallery { /** * Returns a JSON object containing information of the given resource for usage in the gallery . < p >
* The content of the JSON object consists of a common and a specific part of the given resource . < p >
* @ param res the resource to create the object from
* @ return the JSON object containing information from the given resource */
protected JSONObject buildJsonItemObject ( CmsResource res ) { } }
|
// create a new JSON object
JSONObject jsonObj = new JSONObject ( ) ; String sitePath = getCms ( ) . getRequestContext ( ) . getSitePath ( res ) ; // fill JSON object with common information
buildJsonItemCommonPart ( jsonObj , res , sitePath ) ; // fill JSON object with specific information
buildJsonItemSpecificPart ( jsonObj , res , sitePath ) ; return jsonObj ;
|
public class RequestController { /** * Pauses a given entry point . This can be used to stop all requests though a given mechanism , e . g . all web requests
* @ param controlPoint The control point
* @ param listener The listener */
public synchronized void pauseControlPoint ( final String controlPoint , ServerActivityCallback listener ) { } }
|
final List < ControlPoint > eps = new ArrayList < ControlPoint > ( ) ; for ( ControlPoint ep : entryPoints . values ( ) ) { if ( ep . getEntryPoint ( ) . equals ( controlPoint ) ) { if ( ! ep . isPaused ( ) ) { eps . add ( ep ) ; } } } if ( eps . isEmpty ( ) ) { if ( listener != null ) { listener . done ( ) ; } } CountingRequestCountCallback realListener = new CountingRequestCountCallback ( eps . size ( ) , listener ) ; for ( ControlPoint ep : eps ) { ep . pause ( realListener ) ; }
|
public class Bessel { /** * Bessel function of the first kind , of order 0.
* @ param x Value .
* @ return I0 value . */
public static double I0 ( double x ) { } }
|
double ans ; double ax = Math . abs ( x ) ; if ( ax < 3.75 ) { double y = x / 3.75 ; y = y * y ; ans = 1.0 + y * ( 3.5156229 + y * ( 3.0899424 + y * ( 1.2067492 + y * ( 0.2659732 + y * ( 0.360768e-1 + y * 0.45813e-2 ) ) ) ) ) ; } else { double y = 3.75 / ax ; ans = ( Math . exp ( ax ) / Math . sqrt ( ax ) ) * ( 0.39894228 + y * ( 0.1328592e-1 + y * ( 0.225319e-2 + y * ( - 0.157565e-2 + y * ( 0.916281e-2 + y * ( - 0.2057706e-1 + y * ( 0.2635537e-1 + y * ( - 0.1647633e-1 + y * 0.392377e-2 ) ) ) ) ) ) ) ) ; } return ans ;
|
public class LabAccountsInner { /** * Get regional availability information for each size category configured under a lab account .
* @ param resourceGroupName The name of the resource group .
* @ param labAccountName The name of the lab Account .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the GetRegionalAvailabilityResponseInner object */
public Observable < ServiceResponse < GetRegionalAvailabilityResponseInner > > getRegionalAvailabilityWithServiceResponseAsync ( String resourceGroupName , String labAccountName ) { } }
|
if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( labAccountName == null ) { throw new IllegalArgumentException ( "Parameter labAccountName is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } return service . getRegionalAvailability ( this . client . subscriptionId ( ) , resourceGroupName , labAccountName , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < GetRegionalAvailabilityResponseInner > > > ( ) { @ Override public Observable < ServiceResponse < GetRegionalAvailabilityResponseInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < GetRegionalAvailabilityResponseInner > clientResponse = getRegionalAvailabilityDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
|
public class KiteTicker { /** * Setting different modes for an arraylist of tokens .
* @ param tokens an arraylist of tokens
* @ param mode the mode that needs to be set . Scroll up to see different
* kind of modes */
public void setMode ( ArrayList < Long > tokens , String mode ) { } }
|
JSONObject jobj = new JSONObject ( ) ; try { // int a [ ] = { 256265 , 408065 , 779521 , 738561 , 177665 , 25601 } ;
JSONArray list = new JSONArray ( ) ; JSONArray listMain = new JSONArray ( ) ; listMain . put ( 0 , mode ) ; for ( int i = 0 ; i < tokens . size ( ) ; i ++ ) { list . put ( i , tokens . get ( i ) ) ; } listMain . put ( 1 , list ) ; jobj . put ( "a" , mSetMode ) ; jobj . put ( "v" , listMain ) ; for ( int i = 0 ; i < tokens . size ( ) ; i ++ ) { modeMap . put ( tokens . get ( i ) , mode ) ; } } catch ( JSONException e ) { e . printStackTrace ( ) ; } if ( ws != null ) { ws . sendText ( jobj . toString ( ) ) ; }
|
public class SQLExpressions { /** * Convert timestamp to date
* @ param dateTime timestamp
* @ return date */
public static < D extends Comparable > DateExpression < D > date ( DateTimeExpression < D > dateTime ) { } }
|
return Expressions . dateOperation ( dateTime . getType ( ) , Ops . DateTimeOps . DATE , dateTime ) ;
|
public class Config { /** * Sets the map of { @ link com . hazelcast . ringbuffer . Ringbuffer } configurations ,
* mapped by config name . The config name may be a pattern with which the
* configuration will be obtained in the future .
* @ param ringbufferConfigs the ringbuffer configuration map to set
* @ return this config instance */
public Config setRingbufferConfigs ( Map < String , RingbufferConfig > ringbufferConfigs ) { } }
|
this . ringbufferConfigs . clear ( ) ; this . ringbufferConfigs . putAll ( ringbufferConfigs ) ; for ( Entry < String , RingbufferConfig > entry : ringbufferConfigs . entrySet ( ) ) { entry . getValue ( ) . setName ( entry . getKey ( ) ) ; } return this ;
|
public class HtmlDocumentBuilder { /** * < p > parse . < / p >
* @ param html a { @ link java . lang . String } object .
* @ return a { @ link com . greenpepper . Example } object . */
public Example parse ( String html ) { } }
|
String text = removeComments ( html ) ; return doParse ( text ) ;
|
public class JBBPDslBuilder { /** * Add named parametric custom variable .
* @ param type custom type , must not be null
* @ param name name of the field , can be null for anonymous
* @ param param optional parameter for the field , can be null
* @ return the builder instance , must not be null */
public JBBPDslBuilder Custom ( final String type , final String name , final String param ) { } }
|
final ItemCustom custom = new ItemCustom ( type , name , this . byteOrder ) ; custom . bitLenExpression = param == null ? null : assertExpressionChars ( param ) ; this . addItem ( custom ) ; return this ;
|
public class HyperionClient { /** * Read the response and unmarshall into the expected type
* @ param response The http response
* @ param javaType The type to return
* @ return The response value */
protected < T > T readResponse ( Response response , JavaType javaType ) { } }
|
try { return objectMapper . readValue ( response . body ( ) . byteStream ( ) , javaType ) ; } catch ( IOException e ) { throw new ClientMarshallingException ( "Error reading results." , e ) ; }
|
public class AccountingChronology { /** * Checks if the specified year is a leap year .
* An Accounting proleptic - year is leap if the time between the end of the previous year
* and the end of the current year is 371 days .
* This method does not validate the year passed in , and only has a
* well - defined result for years in the supported range .
* @ param prolepticYear the proleptic - year to check , not validated for range
* @ return true if the year is a leap year */
@ Override public boolean isLeapYear ( long prolepticYear ) { } }
|
return Math . floorMod ( prolepticYear + getISOLeapYearCount ( prolepticYear ) + yearZeroDifference , 7 ) == 0 || Math . floorMod ( prolepticYear + getISOLeapYearCount ( prolepticYear + 1 ) + yearZeroDifference , 7 ) == 0 ;
|
public class CommerceAddressUtil { /** * Returns all the commerce addresses where groupId = & # 63 ; and classNameId = & # 63 ; and classPK = & # 63 ; .
* @ param groupId the group ID
* @ param classNameId the class name ID
* @ param classPK the class pk
* @ return the matching commerce addresses */
public static List < CommerceAddress > findByG_C_C ( long groupId , long classNameId , long classPK ) { } }
|
return getPersistence ( ) . findByG_C_C ( groupId , classNameId , classPK ) ;
|
public class Command { /** * Create a CORBA Any object and insert a float data in it .
* @ param data The float data to be inserted into the Any object
* @ exception DevFailed If the Any object creation failed .
* Click < a href = " . . / . . / tango _ basic / idl _ html / Tango . html # DevFailed " > here < / a > to read
* < b > DevFailed < / b > exception specification */
public Any insert ( float data ) throws DevFailed { } }
|
Any out_any = alloc_any ( ) ; out_any . insert_float ( data ) ; return out_any ;
|
public class JmsSessionImpl { /** * This method is overriden by subclasses in order to instantiate an instance
* of the MsgProducer class . This means that the QueueSession . createSender
* method can delegate straight to Session . createProducer , and still get back
* an instance of a QueueSender , rather than a vanilla MessageProducer .
* Note , since this method is over - ridden by Queue and Topic specific classes ,
* updates to any one of these methods will require consideration of the
* other two versions . */
JmsMsgProducer instantiateProducer ( Destination jmsDestination ) throws JMSException { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "instantiateProducer" , jmsDestination ) ; JmsMsgProducer messageProducer = new JmsMsgProducerImpl ( jmsDestination , coreConnection , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "instantiateProducer" , messageProducer ) ; return messageProducer ;
|
public class CodeGenBase { /** * Emits generated code to a file .
* @ param outputFolder
* outputFolder The output folder that will store the generated code .
* @ param fileName
* The name of the file that will store the generated code .
* @ param code
* The generated code .
* @ param encoding
* The encoding to use for the generated code . */
public static void emitCode ( File outputFolder , String fileName , String code , String encoding ) { } }
|
try { File javaFile = new File ( outputFolder , File . separator + fileName ) ; javaFile . getParentFile ( ) . mkdirs ( ) ; javaFile . createNewFile ( ) ; PrintWriter writer = new PrintWriter ( new OutputStreamWriter ( new FileOutputStream ( javaFile , false ) , encoding ) ) ; BufferedWriter out = new BufferedWriter ( writer ) ; out . write ( code ) ; out . close ( ) ; } catch ( IOException e ) { log . error ( "Error when saving class file: " + fileName ) ; e . printStackTrace ( ) ; }
|
public class SeqRes2AtomAligner { /** * Map the seqRes groups to the atomRes chain .
* Updates the atomRes chain object with the mapped data
* The seqRes chain should not be needed after this and atomRes should be further used .
* @ param atomRes the chain containing ATOM groups ( in atomGroups slot ) . This chain
* is modified to contain in its seqresGroups slot the mapped atom groups
* @ param seqRes the chain containing SEQRES groups ( in atomGroups slot ) . This chain
* is not modified */
public void mapSeqresRecords ( Chain atomRes , Chain seqRes ) { } }
|
List < Group > seqResGroups = seqRes . getAtomGroups ( ) ; List < Group > atmResGroups = atomRes . getAtomGroups ( ) ; logger . debug ( "Comparing ATOM {} ({} groups) to SEQRES {} ({} groups) " , atomRes . getId ( ) , atmResGroups . size ( ) , seqRes . getId ( ) , seqResGroups . size ( ) ) ; List < Group > matchedGroups = trySimpleMatch ( seqResGroups , atmResGroups ) ; if ( matchedGroups != null ) { // update the new SEQRES list
atomRes . setSeqResGroups ( matchedGroups ) ; return ; } logger . debug ( "Could not map SEQRES to ATOM records easily, need to align..." ) ; int numAminosSeqres = seqRes . getAtomGroups ( GroupType . AMINOACID ) . size ( ) ; int numNucleotidesSeqres = seqRes . getAtomGroups ( GroupType . NUCLEOTIDE ) . size ( ) ; if ( numAminosSeqres < 1 ) { if ( numNucleotidesSeqres > 1 ) { logger . debug ( "SEQRES chain {} is a nucleotide chain ({} nucleotides), aligning nucleotides..." , seqRes . getId ( ) , numNucleotidesSeqres ) ; alignNucleotideChains ( seqRes , atomRes ) ; return ; } else { logger . debug ( "SEQRES chain {} contains {} amino acids and {} nucleotides, ignoring..." , seqRes . getId ( ) , numAminosSeqres , numNucleotidesSeqres ) ; return ; } } if ( atomRes . getAtomGroups ( GroupType . AMINOACID ) . size ( ) < 1 ) { logger . debug ( "ATOM chain {} does not contain amino acids, ignoring..." , atomRes . getId ( ) ) ; return ; } logger . debug ( "Proceeding to do protein alignment for chain {}" , atomRes . getId ( ) ) ; boolean noMatchFound = alignProteinChains ( seqResGroups , atomRes . getAtomGroups ( ) ) ; if ( ! noMatchFound ) { atomRes . setSeqResGroups ( seqResGroups ) ; }
|
public class UNode { /** * Create a MAP UNode with the given node name .
* @ param name Name for new MAP node .
* @ return New MAP UNode . */
public static UNode createMapNode ( String name ) { } }
|
return new UNode ( name , NodeType . MAP , null , false , "" ) ;
|
public class DataTypeFactory { /** * Provides access to the data type factory associated with the specified type name .
* @ param tname the name of the data type for the desired factory
* @ return the factory representing the specified type name
* @ throws InvalidAttributeException when an unknown type is sought out */
static public DataTypeFactory < ? > getInstance ( String tname ) { } }
|
DataTypeFactory < ? > factory = factories . get ( tname ) ; if ( factory == null ) { throw new InvalidAttributeException ( "Unknown type name: " + tname ) ; } return factory ;
|
public class GCI { /** * B & # 8849 ; C & # 8851 ; D & rarr ; { B & # 8849 ; C , B & # 8849 ; D }
* @ param gcis
* @ return */
Inclusion [ ] rule7 ( Inclusion [ ] gcis ) { } }
|
assert isRule7Applicable ( ) ; final Conjunction conjunction = ( Conjunction ) rhs ; final AbstractConcept [ ] concepts = conjunction . getConcepts ( ) ; if ( concepts . length > gcis . length ) { gcis = new Inclusion [ concepts . length ] ; } for ( int i = 0 ; i < concepts . length ; i ++ ) { gcis [ i ] = new GCI ( lhs , concepts [ i ] ) ; } return gcis ;
|
public class ServiceProviders { /** * Returns true if the { @ link ClassLoader } is for android . */
static boolean isAndroid ( ClassLoader cl ) { } }
|
try { // Specify a class loader instead of null because we may be running under Robolectric
Class . forName ( "android.app.Application" , /* initialize = */
false , cl ) ; return true ; } catch ( Exception e ) { // If Application isn ' t loaded , it might as well not be Android .
return false ; }
|
public class JvmArrayTypeImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public NotificationChain basicSetComponentType ( JvmComponentType newComponentType , NotificationChain msgs ) { } }
|
msgs = eBasicSetContainer ( ( InternalEObject ) newComponentType , TypesPackage . JVM_ARRAY_TYPE__COMPONENT_TYPE , msgs ) ; return msgs ;
|
public class NavigationHelper { /** * Based on the list of measured intersections and the step distance traveled , finds
* the current intersection a user is traveling along .
* @ param intersections along the step
* @ param measuredIntersections measured intersections along the step
* @ param stepDistanceTraveled how far the user has traveled along the step
* @ return the current step intersection
* @ since 0.13.0 */
public static StepIntersection findCurrentIntersection ( @ NonNull List < StepIntersection > intersections , @ NonNull List < Pair < StepIntersection , Double > > measuredIntersections , double stepDistanceTraveled ) { } }
|
for ( Pair < StepIntersection , Double > measuredIntersection : measuredIntersections ) { double intersectionDistance = measuredIntersection . second ; int intersectionIndex = measuredIntersections . indexOf ( measuredIntersection ) ; int nextIntersectionIndex = intersectionIndex + ONE_INDEX ; int measuredIntersectionSize = measuredIntersections . size ( ) ; boolean hasValidNextIntersection = nextIntersectionIndex < measuredIntersectionSize ; if ( hasValidNextIntersection ) { double nextIntersectionDistance = measuredIntersections . get ( nextIntersectionIndex ) . second ; if ( stepDistanceTraveled > intersectionDistance && stepDistanceTraveled < nextIntersectionDistance ) { return measuredIntersection . first ; } } else if ( stepDistanceTraveled > measuredIntersection . second ) { return measuredIntersection . first ; } else { return measuredIntersections . get ( FIRST_INTERSECTION ) . first ; } } return intersections . get ( FIRST_INTERSECTION ) ;
|
public class ScalableStatistics { /** * Adds the given data value to the data set */
public void add ( double value ) { } }
|
count ++ ; min = Math . min ( min , value ) ; max = Math . max ( max , value ) ; sum += value ; sumOfSquares += value * value ; addQuantileValue ( value ) ;
|
public class LofCalculator { /** * basePointの局所外れ係数 ( Local outlier factor ) を算出する 。
* @ param basePoint 算出元対象点
* @ param dataSet 全体データ
* @ return 局所外れ係数 */
protected static double calculateLof ( LofPoint basePoint , LofDataSet dataSet ) { } }
|
int countedData = 0 ; double totalAmount = 0.0d ; for ( String targetDataId : basePoint . getkDistanceNeighbor ( ) ) { LofPoint targetPoint = dataSet . getDataMap ( ) . get ( targetDataId ) ; totalAmount = totalAmount + ( targetPoint . getLrd ( ) / basePoint . getLrd ( ) ) ; countedData ++ ; } if ( countedData == 0 ) { return totalAmount ; } return totalAmount / ( countedData ) ;
|
public class HttpContinue { /** * Creates a response sender that can be used to send a HTTP 100 - continue response .
* @ param exchange The exchange
* @ return The response sender */
public static ContinueResponseSender createResponseSender ( final HttpServerExchange exchange ) throws IOException { } }
|
if ( ! exchange . isResponseChannelAvailable ( ) ) { throw UndertowMessages . MESSAGES . cannotSendContinueResponse ( ) ; } if ( exchange . getAttachment ( ALREADY_SENT ) != null ) { return new ContinueResponseSender ( ) { @ Override public boolean send ( ) throws IOException { return true ; } @ Override public void awaitWritable ( ) throws IOException { } @ Override public void awaitWritable ( long time , TimeUnit timeUnit ) throws IOException { } } ; } HttpServerExchange newExchange = exchange . getConnection ( ) . sendOutOfBandResponse ( exchange ) ; exchange . putAttachment ( ALREADY_SENT , true ) ; newExchange . setStatusCode ( StatusCodes . CONTINUE ) ; newExchange . getResponseHeaders ( ) . put ( Headers . CONTENT_LENGTH , 0 ) ; final StreamSinkChannel responseChannel = newExchange . getResponseChannel ( ) ; return new ContinueResponseSender ( ) { boolean shutdown = false ; @ Override public boolean send ( ) throws IOException { if ( ! shutdown ) { shutdown = true ; responseChannel . shutdownWrites ( ) ; } return responseChannel . flush ( ) ; } @ Override public void awaitWritable ( ) throws IOException { responseChannel . awaitWritable ( ) ; } @ Override public void awaitWritable ( final long time , final TimeUnit timeUnit ) throws IOException { responseChannel . awaitWritable ( time , timeUnit ) ; } } ;
|
public class CDDImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } }
|
switch ( featureID ) { case AfplibPackage . CDD__XOC_BASE : return XOC_BASE_EDEFAULT == null ? xocBase != null : ! XOC_BASE_EDEFAULT . equals ( xocBase ) ; case AfplibPackage . CDD__YOC_BASE : return YOC_BASE_EDEFAULT == null ? yocBase != null : ! YOC_BASE_EDEFAULT . equals ( yocBase ) ; case AfplibPackage . CDD__XOC_UNITS : return XOC_UNITS_EDEFAULT == null ? xocUnits != null : ! XOC_UNITS_EDEFAULT . equals ( xocUnits ) ; case AfplibPackage . CDD__YOC_UNITS : return YOC_UNITS_EDEFAULT == null ? yocUnits != null : ! YOC_UNITS_EDEFAULT . equals ( yocUnits ) ; case AfplibPackage . CDD__XOC_SIZE : return XOC_SIZE_EDEFAULT == null ? xocSize != null : ! XOC_SIZE_EDEFAULT . equals ( xocSize ) ; case AfplibPackage . CDD__YOC_SIZE : return YOC_SIZE_EDEFAULT == null ? yocSize != null : ! YOC_SIZE_EDEFAULT . equals ( yocSize ) ; case AfplibPackage . CDD__TRIPLETS : return triplets != null && ! triplets . isEmpty ( ) ; } return super . eIsSet ( featureID ) ;
|
public class TransitionsExtractorImpl { /** * Check the tile transition and add it to transitions collection if valid .
* @ param transitions The transitions collection .
* @ param extractor The transition extractor .
* @ param tile The tile to check . */
private static void checkTransition ( Map < Transition , Collection < TileRef > > transitions , MapTransitionExtractor extractor , Tile tile ) { } }
|
final Transition transition = extractor . getTransition ( tile ) ; if ( transition != null ) { getTiles ( transitions , transition ) . add ( new TileRef ( tile ) ) ; final Transition symetric = new Transition ( transition . getType ( ) . getSymetric ( ) , transition . getOut ( ) , transition . getIn ( ) ) ; getTiles ( transitions , symetric ) . add ( new TileRef ( tile ) ) ; }
|
public class ConfigurationAdminOptions { /** * Creates an overriding , empty configuration for the given PID
* @ param pid
* the pid for this configuration
* @ return empty configuration */
public static ConfigurationOption overrideConfiguration ( String pid ) { } }
|
return new org . ops4j . pax . exam . cm . internal . ConfigurationProvisionOption ( pid , new HashMap < String , Object > ( ) ) . override ( true ) . create ( false ) ;
|
public class TempFile { /** * Gets the temp file .
* @ exception IllegalStateException if already deleted */
public File getFile ( ) throws IllegalStateException { } }
|
File f = tempFile ; if ( f == null ) throw new IllegalStateException ( ) ; return f ;
|
public class GuardingHttpServletResponse { /** * / * ( non - Javadoc )
* @ see javax . servlet . http . HttpServletResponseWrapper # setHeader ( java . lang . String , java . lang . String ) */
@ Override public void setHeader ( String name , String value ) { } }
|
this . checkState ( ) ; super . setHeader ( name , value ) ;
|
public class ConstantSize { /** * Splits a string that encodes size with unit into the size and unit substrings . Returns an
* array of two strings .
* @ param encodedValueAndUnit a strings that represents a size with unit , trimmed and in lower
* case
* @ return the first element is size , the second is unit */
private static String [ ] splitValueAndUnit ( String encodedValueAndUnit ) { } }
|
String [ ] result = new String [ 2 ] ; int len = encodedValueAndUnit . length ( ) ; int firstLetterIndex = len ; while ( firstLetterIndex > 0 && Character . isLetter ( encodedValueAndUnit . charAt ( firstLetterIndex - 1 ) ) ) { firstLetterIndex -- ; } result [ 0 ] = encodedValueAndUnit . substring ( 0 , firstLetterIndex ) ; result [ 1 ] = encodedValueAndUnit . substring ( firstLetterIndex ) ; return result ;
|
public class ManagedPolicyDetail { /** * A list containing information about the versions of the policy .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setPolicyVersionList ( java . util . Collection ) } or { @ link # withPolicyVersionList ( java . util . Collection ) } if
* you want to override the existing values .
* @ param policyVersionList
* A list containing information about the versions of the policy .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ManagedPolicyDetail withPolicyVersionList ( PolicyVersion ... policyVersionList ) { } }
|
if ( this . policyVersionList == null ) { setPolicyVersionList ( new com . amazonaws . internal . SdkInternalList < PolicyVersion > ( policyVersionList . length ) ) ; } for ( PolicyVersion ele : policyVersionList ) { this . policyVersionList . add ( ele ) ; } return this ;
|
public class DescribeBudgetRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeBudgetRequest describeBudgetRequest , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( describeBudgetRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeBudgetRequest . getAccountId ( ) , ACCOUNTID_BINDING ) ; protocolMarshaller . marshall ( describeBudgetRequest . getBudgetName ( ) , BUDGETNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class PubSubManager { /** * Creates a node with default configuration .
* @ param nodeId The id of the node , which must be unique within the
* pubsub service
* @ return The node that was created
* @ throws XMPPErrorException
* @ throws NoResponseException
* @ throws NotConnectedException
* @ throws InterruptedException */
public LeafNode createNode ( String nodeId ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } }
|
return ( LeafNode ) createNode ( nodeId , null ) ;
|
public class PGStream { /** * Read a tuple from the back end . A tuple is a two dimensional array of bytes . This variant reads
* the V3 protocol ' s tuple representation .
* @ return tuple from the back end
* @ throws IOException if a data I / O error occurs */
public byte [ ] [ ] receiveTupleV3 ( ) throws IOException , OutOfMemoryError { } }
|
// TODO : use msgSize
int msgSize = receiveInteger4 ( ) ; int nf = receiveInteger2 ( ) ; byte [ ] [ ] answer = new byte [ nf ] [ ] ; OutOfMemoryError oom = null ; for ( int i = 0 ; i < nf ; ++ i ) { int size = receiveInteger4 ( ) ; if ( size != - 1 ) { try { answer [ i ] = new byte [ size ] ; receive ( answer [ i ] , 0 , size ) ; } catch ( OutOfMemoryError oome ) { oom = oome ; skip ( size ) ; } } } if ( oom != null ) { throw oom ; } return answer ;
|
public class OpenApiReaderException { /** * Returns a reason for the errors in the document at the given location . */
private static String errorReasonFor ( URL location , List < String > errors ) { } }
|
return Stream . concat ( Stream . of ( String . format ( "%s conformance problem(s) found in Open API document%s" , errors . size ( ) , locationId ( location ) ) ) , IntStream . range ( 0 , errors . size ( ) ) . mapToObj ( i -> String . format ( "[%s] %s" , i , errors . get ( i ) ) ) ) . collect ( joining ( "\n" ) ) ;
|
public class ColorAnalyzer { /** * Obtains the percentage of the text that has the given color .
* @ param color the color to be tested .
* @ return the percentage ( 0 . . 1) */
public double getColorPercentage ( Color color ) { } }
|
if ( color == null ) return 0 ; else { Integer num = colors . get ( colorKey ( color ) ) ; if ( num == null ) num = 0 ; if ( totalLength == 0 ) return 0 ; else return ( double ) num / totalLength ; }
|
public class ActionExecutionOutputMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ActionExecutionOutput actionExecutionOutput , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( actionExecutionOutput == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( actionExecutionOutput . getOutputArtifacts ( ) , OUTPUTARTIFACTS_BINDING ) ; protocolMarshaller . marshall ( actionExecutionOutput . getExecutionResult ( ) , EXECUTIONRESULT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class CompilerConfiguration { /** * Adds compilation customizers to the compilation process . A compilation customizer is a class node
* operation which performs various operations going from adding imports to access control .
* @ param customizers the list of customizers to be added
* @ return this configuration instance */
public CompilerConfiguration addCompilationCustomizers ( CompilationCustomizer ... customizers ) { } }
|
if ( customizers == null ) throw new IllegalArgumentException ( "provided customizers list must not be null" ) ; compilationCustomizers . addAll ( Arrays . asList ( customizers ) ) ; return this ;
|
public class MultimapSubject { /** * Fails if the multimap contains the given key . */
public void doesNotContainKey ( @ NullableDecl Object key ) { } }
|
check ( "keySet()" ) . that ( actual ( ) . keySet ( ) ) . doesNotContain ( key ) ;
|
public class Stream { /** * Returns a stream of tuples which are aggregated results of a window which slides at duration of { @ code slidingInterval }
* and completes a window at { @ code windowDuration }
* @ param windowDuration represents window duration configuration
* @ param inputFields projected fields for aggregator
* @ param aggregator aggregator to run on the window of tuples to compute the result and emit to the stream .
* @ param functionFields fields of values to emit with aggregation .
* @ return the new stream with this operation . */
public Stream slidingWindow ( BaseWindowedBolt . Duration windowDuration , BaseWindowedBolt . Duration slidingInterval , WindowsStoreFactory windowStoreFactory , Fields inputFields , Aggregator aggregator , Fields functionFields ) { } }
|
return window ( SlidingDurationWindow . of ( windowDuration , slidingInterval ) , windowStoreFactory , inputFields , aggregator , functionFields ) ;
|
public class FieldDocImpl { /** * Get the value of a constant field .
* @ return the value of a constant field . The value is
* automatically wrapped in an object if it has a primitive type .
* If the field is not constant , returns null . */
public Object constantValue ( ) { } }
|
Object result = sym . getConstValue ( ) ; if ( result != null && sym . type . hasTag ( BOOLEAN ) ) // javac represents false and true as Integers 0 and 1
result = Boolean . valueOf ( ( ( Integer ) result ) . intValue ( ) != 0 ) ; return result ;
|
public class HttpQuery { /** * Sets the local serializer based on a query string parameter or content type .
* If the caller supplies a " serializer = " parameter , the proper serializer is
* loaded if found . If the serializer doesn ' t exist , an exception will be
* thrown and the user gets an error
* If no query string parameter is supplied , the Content - Type header for the
* request is parsed and if a matching serializer is found , it ' s used .
* Otherwise we default to the HttpJsonSerializer .
* @ throws InvocationTargetException if the serializer cannot be instantiated
* @ throws IllegalArgumentException if the serializer cannot be instantiated
* @ throws InstantiationException if the serializer cannot be instantiated
* @ throws IllegalAccessException if a security manager is blocking access
* @ throws BadRequestException if a serializer requested via query string does
* not exist */
public void setSerializer ( ) throws InvocationTargetException , IllegalArgumentException , InstantiationException , IllegalAccessException { } }
|
if ( this . hasQueryStringParam ( "serializer" ) ) { final String qs = this . getQueryStringParam ( "serializer" ) ; Constructor < ? extends HttpSerializer > ctor = serializer_map_query_string . get ( qs ) ; if ( ctor == null ) { this . serializer = new HttpJsonSerializer ( this ) ; throw new BadRequestException ( HttpResponseStatus . BAD_REQUEST , "Requested serializer was not found" , "Could not find a serializer with the name: " + qs ) ; } this . serializer = ctor . newInstance ( this ) ; return ; } // attempt to parse the Content - Type string . We only want the first part ,
// not the character set . And if the CT is missing , we ' ll use the default
// serializer
String content_type = request ( ) . headers ( ) . get ( "Content-Type" ) ; if ( content_type == null || content_type . isEmpty ( ) ) { return ; } if ( content_type . indexOf ( ";" ) > - 1 ) { content_type = content_type . substring ( 0 , content_type . indexOf ( ";" ) ) ; } Constructor < ? extends HttpSerializer > ctor = serializer_map_content_type . get ( content_type ) ; if ( ctor == null ) { return ; } this . serializer = ctor . newInstance ( this ) ;
|
public class PactDslRequestWithPath { /** * The body of the request with possible single quotes as delimiters
* and using { @ link QuoteUtil } to convert single quotes to double quotes if required .
* @ param body Request body in string form */
public PactDslRequestWithPath bodyWithSingleQuotes ( String body ) { } }
|
if ( body != null ) { body = QuoteUtil . convert ( body ) ; } return body ( body ) ;
|
public class Utils { /** * Return the list of ProgramElementDoc objects as Array . */
public ProgramElementDoc [ ] toProgramElementDocArray ( List < ProgramElementDoc > list ) { } }
|
ProgramElementDoc [ ] pgmarr = new ProgramElementDoc [ list . size ( ) ] ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { pgmarr [ i ] = list . get ( i ) ; } return pgmarr ;
|
public class MPP14CalendarFactory { /** * { @ inheritDoc } */
@ Override protected VarMeta getCalendarVarMeta ( DirectoryEntry directory ) throws IOException { } }
|
return new VarMeta12 ( new DocumentInputStream ( ( ( DocumentEntry ) directory . getEntry ( "VarMeta" ) ) ) ) ;
|
public class ConnectionTypesInner { /** * Retrieve the connectiontype identified by connectiontype name .
* @ param resourceGroupName Name of an Azure Resource group .
* @ param automationAccountName The name of the automation account .
* @ param connectionTypeName The name of connectiontype .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the ConnectionTypeInner object if successful . */
public ConnectionTypeInner get ( String resourceGroupName , String automationAccountName , String connectionTypeName ) { } }
|
return getWithServiceResponseAsync ( resourceGroupName , automationAccountName , connectionTypeName ) . toBlocking ( ) . single ( ) . body ( ) ;
|
public class Position { /** * the indicated range has been passed by the scanner . */
public void update ( char [ ] data , int start , int end ) { } }
|
int i ; for ( i = start ; i < end ; i ++ ) { if ( data [ i ] == '\n' ) { col = 1 ; line ++ ; } else { col ++ ; } } ofs += ( end - start ) ;
|
public class HashOperations { /** * Inserts the given long array into the given hash table array of the target size ,
* removes any negative input values , ignores duplicates and counts the values inserted .
* The given hash table may have values , but they must have been inserted by this method or one
* of the other OADH insert methods in this class and they may not be dirty .
* This method performs additional checks against potentially invalid hash values or theta values .
* Returns the count of values actually inserted .
* @ param srcArr the source hash array to be potentially inserted
* @ param hashTable The correctly sized target hash table that must be a power of two .
* @ param lgArrLongs < a href = " { @ docRoot } / resources / dictionary . html # lgArrLongs " > See lgArrLongs < / a > .
* lgArrLongs & le ; log2 ( hashTable . length ) .
* @ param thetaLong must greater than zero
* < a href = " { @ docRoot } / resources / dictionary . html # thetaLong " > See Theta Long < / a >
* @ return the count of values actually inserted */
public static int hashArrayInsert ( final long [ ] srcArr , final long [ ] hashTable , final int lgArrLongs , final long thetaLong ) { } }
|
int count = 0 ; final int arrLen = srcArr . length ; checkThetaCorruption ( thetaLong ) ; for ( int i = 0 ; i < arrLen ; i ++ ) { // scan source array , build target array
final long hash = srcArr [ i ] ; checkHashCorruption ( hash ) ; if ( continueCondition ( thetaLong , hash ) ) { continue ; } if ( hashSearchOrInsert ( hashTable , lgArrLongs , hash ) < 0 ) { count ++ ; } } return count ;
|
public class RandomVariable { /** * / * ( non - Javadoc )
* @ see net . finmath . stochastic . RandomVariableInterface # getQuantile ( ) */
@ Override public double getQuantile ( double quantile ) { } }
|
if ( isDeterministic ( ) ) { return valueIfNonStochastic ; } if ( size ( ) == 0 ) { return Double . NaN ; } double [ ] realizationsSorted = realizations . clone ( ) ; java . util . Arrays . sort ( realizationsSorted ) ; int indexOfQuantileValue = Math . min ( Math . max ( ( int ) Math . round ( ( size ( ) + 1 ) * quantile - 1 ) , 0 ) , size ( ) - 1 ) ; return realizationsSorted [ indexOfQuantileValue ] ;
|
public class CmsADEConfigData { /** * Creates the content directory for this configuration node if possible . < p >
* @ throws CmsException if something goes wrong */
protected void createContentDirectory ( ) throws CmsException { } }
|
if ( ! isModuleConfiguration ( ) ) { String contentFolder = getContentFolderPath ( ) ; if ( ! getCms ( ) . existsResource ( contentFolder ) ) { getCms ( ) . createResource ( contentFolder , OpenCms . getResourceManager ( ) . getResourceType ( CmsResourceTypeFolder . getStaticTypeName ( ) ) ) ; } }
|
public class JMSManager { /** * This is a synchronous listen . The caller will block until a message is
* received for the given destination .
* Messages will be filtered based on the provided message selector .
* @ param dest
* the Destination to listen on
* @ param messageSelector
* selection criteria for filtering messages
* @ return the Message received for the given Destination
* @ throws MessagingException */
public Message listen ( Destination dest , String messageSelector ) throws MessagingException { } }
|
if ( logger . isDebugEnabled ( ) ) { logger . debug ( "listen() - Synchronous listen on destination " + dest ) ; } try { Session s = connection . createSession ( false , Session . AUTO_ACKNOWLEDGE ) ; MessageConsumer c = s . createConsumer ( dest , messageSelector ) ; Message msg = c . receive ( ) ; s . close ( ) ; return msg ; } catch ( JMSException e ) { throw new MessagingException ( e . getMessage ( ) , e ) ; }
|
public class WidgetUtilImpl { /** * Creates the HTML needed to display a Java applet . */
public HTML createApplet ( String ident , String archive , String clazz , String width , String height , boolean mayScript , String ptags ) { } }
|
String html = "<object classid=\"java:" + clazz + ".class\" " + "type=\"application/x-java-applet\" archive=\"" + archive + "\" " + "width=\"" + width + "\" height=\"" + height + "\">" ; if ( mayScript ) { html += "<param name=\"mayscript\" value=\"true\"/>" ; } html += ptags ; html += "</object>" ; return new HTML ( html ) ;
|
public class Master { /** * Launches the master process . */
public synchronized void start ( ) { } }
|
Preconditions . checkState ( mProcess == null , "Master is already running" ) ; LOG . info ( "Starting master with port {}" , mProperties . get ( PropertyKey . MASTER_RPC_PORT ) ) ; mProcess = new ExternalProcess ( mProperties , LimitedLifeMasterProcess . class , new File ( mLogsDir , "master.out" ) ) ; try { mProcess . start ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; }
|
public class MessageStore { /** * Add message to the storage .
* Every call will change values returned by { @ link # getNextPosition ( ) } and
* { @ link # getLatestPosition ( ) } . Any call may change value returned by
* { @ link # getFirstPosition ( ) } , which will happen if a message is discarded
* due to hitting the message store capacity .
* @ param msg
* Message in question .
* @ return Position of the message . */
public synchronized int add ( final Message msg ) { } }
|
final int nextKey = this . getNextPosition ( ) ; this . store . put ( nextKey , msg ) ; MessageStore . LOGGER . info ( "Message #{} stored on position #{}" , msg . getUniqueId ( ) , nextKey ) ; this . nextMessagePosition . incrementAndGet ( ) ; if ( this . store . size ( ) > this . messageLimit ) { // discard first message if we ' re over limit
this . store . remove ( this . store . firstKey ( ) ) ; } return nextKey ;
|
public class DisjointMultiDeletionNeighbourhood { /** * Generates the list of all possible moves that perform \ ( k \ ) deletions , where \ ( k \ ) is the fixed number
* specified at construction . Note : taking into account the current number of selected items , the imposed
* minimum subset size ( if set ) and the fixed IDs ( if any ) may result in fewer deletions ( as many as possible ) .
* May return an empty list if no moves can be generated .
* @ param solution solution for which all possible multi deletion moves are generated
* @ return list of all multi deletion moves , may be empty */
@ Override public List < SubsetMove > getAllMoves ( SubsetSolution solution ) { } }
|
// create empty list to store generated moves
List < SubsetMove > moves = new ArrayList < > ( ) ; // get set of candidate IDs for removal ( fixed IDs are discarded )
Set < Integer > delCandidates = getRemoveCandidates ( solution ) ; // compute number of deletions
int curNumDel = numDeletions ( delCandidates , solution ) ; if ( curNumDel == 0 ) { // impossible : return empty set
return moves ; } // create all moves that remove curNumDel items
Set < Integer > del ; SubsetIterator < Integer > itDel = new SubsetIterator < > ( delCandidates , curNumDel ) ; while ( itDel . hasNext ( ) ) { del = itDel . next ( ) ; // create and add move
moves . add ( new GeneralSubsetMove ( Collections . emptySet ( ) , del ) ) ; } // return all moves
return moves ;
|
public class JobsResource { /** * Returns the job status for the given job id . The job status includes things like where it ' s
* deployed , and the status of the jobs where it ' s deployed , etc .
* @ param id The job ID .
* @ return The job status . */
@ Path ( "{id}/status" ) @ GET @ Produces ( APPLICATION_JSON ) @ Timed @ ExceptionMetered public Optional < JobStatus > statusGet ( @ PathParam ( "id" ) @ Valid final JobId id ) { } }
|
if ( ! id . isFullyQualified ( ) ) { throw badRequest ( "Invalid id" ) ; } return Optional . fromNullable ( model . getJobStatus ( id ) ) ;
|
public class AWSIoTAnalyticsClient { /** * Updates the settings of a data store .
* @ param updateDatastoreRequest
* @ return Result of the UpdateDatastore operation returned by the service .
* @ throws InvalidRequestException
* The request was not valid .
* @ throws ResourceNotFoundException
* A resource with the specified name could not be found .
* @ throws InternalFailureException
* There was an internal failure .
* @ throws ServiceUnavailableException
* The service is temporarily unavailable .
* @ throws ThrottlingException
* The request was denied due to request throttling .
* @ sample AWSIoTAnalytics . UpdateDatastore
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / iotanalytics - 2017-11-27 / UpdateDatastore " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public UpdateDatastoreResult updateDatastore ( UpdateDatastoreRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executeUpdateDatastore ( request ) ;
|
public class GroovyClassLoader { /** * Parses the given text into a Java class capable of being run
* @ param text the text of the script / class to parse
* @ return the main class defined in the given script */
public Class parseClass ( String text ) throws CompilationFailedException { } }
|
return parseClass ( text , "script" + System . currentTimeMillis ( ) + Math . abs ( text . hashCode ( ) ) + ".groovy" ) ;
|
public class NoiseNullDeref { /** * Find set of blocks which were known to be dead before doing the null
* pointer analysis .
* @ return set of previously dead blocks , indexed by block id
* @ throws CFGBuilderException
* @ throws DataflowAnalysisException */
private BitSet findPreviouslyDeadBlocks ( ) throws DataflowAnalysisException , CFGBuilderException { } }
|
BitSet deadBlocks = new BitSet ( ) ; ValueNumberDataflow vnaDataflow = classContext . getValueNumberDataflow ( method ) ; for ( Iterator < BasicBlock > i = vnaDataflow . getCFG ( ) . blockIterator ( ) ; i . hasNext ( ) ; ) { BasicBlock block = i . next ( ) ; ValueNumberFrame vnaFrame = vnaDataflow . getStartFact ( block ) ; if ( vnaFrame . isTop ( ) ) { deadBlocks . set ( block . getLabel ( ) ) ; } } return deadBlocks ;
|
public class OptionalWeak { /** * Shortcut for as ( List . class ) , with malleable generic type
* @ see OptionalWeak # as ( Class ) */
public < T > Optional < List < T > > asList ( ) { } }
|
return inner . filter ( d -> d . isList ( ) ) . map ( d -> d . asList ( ) ) ;
|
public class PropNeighBoolsChannel2 { @ Override public void propagate ( int evtmask ) throws ContradictionException { } }
|
for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( matrix [ i ] [ j ] . getLB ( ) == 1 ) { g . enforceArc ( i , j , this ) ; } else if ( matrix [ i ] [ j ] . getUB ( ) == 0 ) { g . removeArc ( i , j , this ) ; } } }
|
public class HttpResponse { /** * 创建CompletionHandler子类的实例 < br >
* 传入的CompletionHandler子类必须是public , 且保证其子类可被继承且completed 、 failed可被重载且包含空参数的构造函数 。
* @ param < H > 泛型
* @ param handlerClass CompletionHandler子类
* @ return CompletionHandler */
@ SuppressWarnings ( "unchecked" ) public < H extends CompletionHandler > H createAsyncHandler ( Class < H > handlerClass ) { } }
|
if ( handlerClass == null || handlerClass == CompletionHandler . class ) return ( H ) createAsyncHandler ( ) ; return context . loadAsyncHandlerCreator ( handlerClass ) . create ( createAsyncHandler ( ) ) ;
|
public class MyFiles { /** * 将字符串写到文件
* @ param path
* @ param str
* @ throws IOException */
public static void write ( String path , String str ) throws IOException { } }
|
BufferedWriter out = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( path ) , "utf8" ) ) ; out . append ( str ) ; out . close ( ) ;
|
public class XSDocument { /** * type = " qname ( $ typeNS , $ typeLocalpart ) " */
public XSDocument type ( String typeNS , String typeLocalpart ) throws SAXException { } }
|
xml . addAttribute ( "type" , xml . toQName ( typeNS , typeLocalpart ) ) ; return this ;
|
public class ByteBufferUtil { /** * Encode a String in a ByteBuffer using UTF _ 8.
* @ param s the string to encode
* @ return the encoded string */
public static ByteBuffer bytes ( String s ) { } }
|
return ByteBuffer . wrap ( s . getBytes ( StandardCharsets . UTF_8 ) ) ;
|
public class WebhookClientBuilder { /** * Builds a new { @ link net . dv8tion . jda . webhook . WebhookClient WebhookClient } instance
* with the current state of this builder .
* < p > < b > < u > Remember to close the WebhookClient once you don ' t need it anymore to free resources ! < / u > < / b >
* @ return The new WebhookClient instance */
public WebhookClient build ( ) { } }
|
OkHttpClient client = this . client ; if ( client == null ) { if ( builder == null ) builder = DEFAULT_HTTP_BUILDER ; client = builder . build ( ) ; } if ( pool == null ) { if ( threadFactory == null ) threadFactory = new DefaultWebhookThreadFactory ( ) ; pool = Executors . newSingleThreadScheduledExecutor ( threadFactory ) ; } return new WebhookClient ( id , token , client , pool ) ;
|
public class Transform { /** * Build Java code to represent a type reference to the given class .
* This will be of the form " pkg . Cls1 " or " pkc . Cls2 [ ] " or " primtype " .
* @ param builder the builder in which to build the type reference
* @ param cls the type for the reference */
private static void buildClass ( StringBuilder builder , Class cls ) { } }
|
int arrayDims = 0 ; Class tmp = cls ; while ( tmp . isArray ( ) ) { arrayDims ++ ; tmp = tmp . getComponentType ( ) ; } builder . append ( tmp . getName ( ) ) ; if ( arrayDims > 0 ) { for ( ; arrayDims > 0 ; arrayDims -- ) { builder . append ( "[]" ) ; } }
|
public class RowMajorSparseMatrix { /** * Parses { @ link RowMajorSparseMatrix } from the given CSV string .
* @ param csv the CSV string representing a matrix
* @ return a parsed matrix */
public static RowMajorSparseMatrix fromCSV ( String csv ) { } }
|
return Matrix . fromCSV ( csv ) . to ( Matrices . SPARSE_ROW_MAJOR ) ;
|
public class Utils { /** * Converts a Set of Date objects to a Set of Calendar objects .
* @ param dates
* @ return the converted Set & lt ; Calendar & gt ; */
public static HolidayCalendar < Calendar > toHolidayCalendarSet ( final HolidayCalendar < Date > dates ) { } }
|
final Set < Calendar > calendars = new HashSet < > ( ) ; for ( final Date date : dates . getHolidays ( ) ) { calendars . add ( getCal ( date ) ) ; } return new DefaultHolidayCalendar < > ( calendars , getCal ( dates . getEarlyBoundary ( ) ) , getCal ( dates . getLateBoundary ( ) ) ) ;
|
public class HammerWidget { /** * Unregister Hammer Gwt handler .
* @ param eventType { @ link org . geomajas . hammergwt . client . event . EventType }
* @ since 1.0.0 */
@ Api public void unregisterHandler ( EventType eventType ) { } }
|
if ( ! jsHandlersMap . containsKey ( eventType ) ) { return ; } HammerGwt . off ( hammertime , eventType , ( NativeHammmerHandler ) jsHandlersMap . remove ( eventType ) ) ;
|
public class DefaultBigDecimalMath { /** * Returns the { @ link BigDecimal } that is < code > x % y < / code > using the default { @ link MathContext } .
* @ param x the x value
* @ param y the y value to divide
* @ return the resulting { @ link BigDecimal } with the precision specified in the default { @ link MathContext }
* @ see # setDefaultMathContext ( MathContext )
* @ see BigDecimal # remainder ( BigDecimal , MathContext ) */
public static BigDecimal remainder ( BigDecimal x , BigDecimal y ) { } }
|
return x . remainder ( y , defaultMathContext ) ;
|
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public ColorSpecificationColSpce createColorSpecificationColSpceFromString ( EDataType eDataType , String initialValue ) { } }
|
ColorSpecificationColSpce result = ColorSpecificationColSpce . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ;
|
public class CmsPreferences { /** * Builds the html for the direct edit button style select box . < p >
* @ param htmlAttributes optional html attributes for the & lgt ; select & gt ; tag
* @ return the html for the direct edit button style select box */
public String buildSelectDirectEditButtonStyle ( String htmlAttributes ) { } }
|
int selectedIndex = Integer . parseInt ( getParamTabEdDirectEditButtonStyle ( ) ) ; return buildSelectButtonStyle ( htmlAttributes , selectedIndex ) ;
|
public class Cron4jJob { @ Override public synchronized void becomeNonCron ( ) { } }
|
verifyCanScheduleState ( ) ; if ( JobChangeLog . isEnabled ( ) ) { JobChangeLog . log ( "#job ...Becoming non-cron: {}" , toString ( ) ) ; } cron4jId . ifPresent ( id -> { cron4jTask . becomeNonCrom ( ) ; cron4jNow . getCron4jScheduler ( ) . deschedule ( id ) ; cron4jId = OptionalThing . empty ( ) ; } ) ;
|
public class FaunusPipeline { /** * Go back to an element a named step ago .
* Currently only backing up to vertices is supported .
* @ param step the name of the step to back up to
* @ return the extended FaunusPipeline */
public FaunusPipeline back ( final String step ) { } }
|
this . state . assertNotLocked ( ) ; this . state . assertNoProperty ( ) ; this . compiler . addMapReduce ( BackFilterMapReduce . Map . class , BackFilterMapReduce . Combiner . class , BackFilterMapReduce . Reduce . class , LongWritable . class , Holder . class , NullWritable . class , FaunusVertex . class , BackFilterMapReduce . createConfiguration ( this . state . getElementType ( ) , this . state . getStep ( step ) ) ) ; makeMapReduceString ( BackFilterMapReduce . class , step ) ; return this ;
|
public class TemplateProcessor { /** * Instantiates the templates specified by @ Template within @ Templates */
public List < ? super OpenShiftResource > processTemplateResources ( ) { } }
|
List < ? extends OpenShiftResource > resources ; final List < ? super OpenShiftResource > processedResources = new ArrayList < > ( ) ; templates = OpenShiftResourceFactory . getTemplates ( getType ( ) ) ; boolean sync_instantiation = OpenShiftResourceFactory . syncInstantiation ( getType ( ) ) ; /* Instantiate templates */
for ( Template template : templates ) { resources = processTemplate ( template ) ; if ( resources != null ) { if ( sync_instantiation ) { /* synchronous template instantiation */
processedResources . addAll ( resources ) ; } else { /* asynchronous template instantiation */
try { delay ( openShiftAdapter , resources ) ; } catch ( Throwable t ) { throw new IllegalArgumentException ( asynchronousDelayErrorMessage ( ) , t ) ; } } } } return processedResources ;
|
public class BaasDocument { /** * Asynchronously retrieves the list of documents readable to the user in < code > collection < / code > .
* @ param collection the collection to retrieve not < code > null < / code >
* @ param handler a callback to be invoked with the result of the request
* @ return a { @ link com . baasbox . android . RequestToken } to handle the asynchronous request */
public static RequestToken fetchAll ( String collection , BaasHandler < List < BaasDocument > > handler ) { } }
|
return fetchAll ( collection , null , RequestOptions . DEFAULT , handler ) ;
|
public class MgmtSystemManagementResource { /** * Collects and returns system usage statistics . It provides a system wide
* overview and tenant based stats .
* @ return system usage statistics */
@ Override public ResponseEntity < MgmtSystemStatisticsRest > getSystemUsageStats ( ) { } }
|
final SystemUsageReportWithTenants report = systemManagement . getSystemUsageStatisticsWithTenants ( ) ; final MgmtSystemStatisticsRest result = new MgmtSystemStatisticsRest ( ) . setOverallActions ( report . getOverallActions ( ) ) . setOverallArtifacts ( report . getOverallArtifacts ( ) ) . setOverallArtifactVolumeInBytes ( report . getOverallArtifactVolumeInBytes ( ) ) . setOverallTargets ( report . getOverallTargets ( ) ) . setOverallTenants ( report . getTenants ( ) . size ( ) ) ; result . setTenantStats ( report . getTenants ( ) . stream ( ) . map ( MgmtSystemManagementResource :: convertTenant ) . collect ( Collectors . toList ( ) ) ) ; return ResponseEntity . ok ( result ) ;
|
public class HttpServerExchange { /** * Adds a listener that will be invoked on response commit
* @ param listener The response listener */
public void addResponseCommitListener ( final ResponseCommitListener listener ) { } }
|
// technically it is possible to modify the exchange after the response conduit has been created
// as the response channel should not be retrieved until it is about to be written to
// if we get complaints about this we can add support for it , however it makes the exchange bigger and the connectors more complex
addResponseWrapper ( new ConduitWrapper < StreamSinkConduit > ( ) { @ Override public StreamSinkConduit wrap ( ConduitFactory < StreamSinkConduit > factory , HttpServerExchange exchange ) { listener . beforeCommit ( exchange ) ; return factory . create ( ) ; } } ) ;
|
public class ReflectionUtil { /** * Returns an arbitrary object instance based on a class name .
* @ param className The name of a desired class to instantiate . */
@ SuppressWarnings ( "unchecked" ) public static < T > T getObjectInstance ( String className ) { } }
|
try { Class clazz = Class . forName ( className ) ; return ( T ) clazz . newInstance ( ) ; } catch ( Exception e ) { throw new Error ( e ) ; }
|
public class syslog_generic { /** * < pre >
* Report for generic syslog message received by this collector . .
* < / pre > */
public static syslog_generic [ ] get ( nitro_service client ) throws Exception { } }
|
syslog_generic resource = new syslog_generic ( ) ; resource . validate ( "get" ) ; return ( syslog_generic [ ] ) resource . get_resources ( client ) ;
|
public class MessagingService { /** * Send a non - mutation message to a given endpoint . This method specifies a callback
* which is invoked with the actual response .
* @ param message message to be sent .
* @ param to endpoint to which the message needs to be sent
* @ param cb callback interface which is used to pass the responses or
* suggest that a timeout occurred to the invoker of the send ( ) .
* @ param timeout the timeout used for expiration
* @ return an reference to message id used to match with the result */
public int sendRR ( MessageOut message , InetAddress to , IAsyncCallback cb , long timeout , boolean failureCallback ) { } }
|
int id = addCallback ( cb , message , to , timeout , failureCallback ) ; sendOneWay ( failureCallback ? message . withParameter ( FAILURE_CALLBACK_PARAM , ONE_BYTE ) : message , id , to ) ; return id ;
|
public class BsonFactory { /** * Method for enabling / disabling specified generator features
* ( check { @ link BsonGenerator . Feature } for list of features )
* @ param f the feature to enable or disable
* @ param state true if the feature should be enabled , false otherwise
* @ return this BsonFactory */
public final BsonFactory configure ( BsonGenerator . Feature f , boolean state ) { } }
|
if ( state ) { return enable ( f ) ; } return disable ( f ) ;
|
public class EDBConverter { /** * Filters the reference prefix values added in the model to EDBObject conversion out of the EDBObject */
private void filterEngineeringObjectInformation ( EDBObject object , Class < ? > model ) { } }
|
if ( ! AdvancedModelWrapper . isEngineeringObjectClass ( model ) ) { return ; } Iterator < String > keys = object . keySet ( ) . iterator ( ) ; while ( keys . hasNext ( ) ) { if ( keys . next ( ) . startsWith ( REFERENCE_PREFIX ) ) { keys . remove ( ) ; } }
|
public class TransparentDataEncryptionsInner { /** * Creates or updates a database ' s transparent data encryption configuration .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ param databaseName The name of the database for which setting the transparent data encryption applies .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the TransparentDataEncryptionInner object */
public Observable < ServiceResponse < TransparentDataEncryptionInner > > createOrUpdateWithServiceResponseAsync ( String resourceGroupName , String serverName , String databaseName ) { } }
|
if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( serverName == null ) { throw new IllegalArgumentException ( "Parameter serverName is required and cannot be null." ) ; } if ( databaseName == null ) { throw new IllegalArgumentException ( "Parameter databaseName is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } final String transparentDataEncryptionName = "current" ; final TransparentDataEncryptionStatus status = null ; TransparentDataEncryptionInner parameters = new TransparentDataEncryptionInner ( ) ; parameters . withStatus ( null ) ; return service . createOrUpdate ( this . client . subscriptionId ( ) , resourceGroupName , serverName , databaseName , transparentDataEncryptionName , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , parameters , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < TransparentDataEncryptionInner > > > ( ) { @ Override public Observable < ServiceResponse < TransparentDataEncryptionInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < TransparentDataEncryptionInner > clientResponse = createOrUpdateDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
|
public class CommonOps_DDF5 { /** * Returns the absolute value of the element in the matrix that has the smallest absolute value . < br >
* < br >
* Min { | a < sub > ij < / sub > | } for all i and j < br >
* @ param a A matrix . Not modified .
* @ return The max element value of the matrix . */
public static double elementMinAbs ( DMatrix5x5 a ) { } }
|
double min = Math . abs ( a . a11 ) ; double tmp = Math . abs ( a . a12 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a13 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a14 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a15 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a21 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a22 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a23 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a24 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a25 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a31 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a32 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a33 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a34 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a35 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a41 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a42 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a43 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a44 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a45 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a51 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a52 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a53 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a54 ) ; if ( tmp < min ) min = tmp ; tmp = Math . abs ( a . a55 ) ; if ( tmp < min ) min = tmp ; return min ;
|
public class GuildAction { /** * Adds a { @ link net . dv8tion . jda . core . entities . Channel Channel } to the resulting
* Guild . This cannot be of type { @ link net . dv8tion . jda . core . entities . ChannelType # CATEGORY CATEGORY } !
* @ param channel
* The { @ link net . dv8tion . jda . core . requests . restaction . GuildAction . ChannelData ChannelData }
* to use for the construction of the Channel
* @ throws java . lang . IllegalArgumentException
* If the provided channel is { @ code null } !
* @ return The current GuildAction for chaining convenience */
@ CheckReturnValue public GuildAction addChannel ( ChannelData channel ) { } }
|
Checks . notNull ( channel , "Channel" ) ; this . channels . add ( channel ) ; return this ;
|
public class IfcDocumentInformationImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcRelAssociatesDocument > getDocumentInfoForObjects ( ) { } }
|
return ( EList < IfcRelAssociatesDocument > ) eGet ( Ifc4Package . Literals . IFC_DOCUMENT_INFORMATION__DOCUMENT_INFO_FOR_OBJECTS , true ) ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.