signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class WApplication { /** * Add custom CSS held as an internal resource to be used by the Application .
* @ param fileName the CSS file name
* @ return the application resource in which the resource details are held */
public ApplicationResource addCssFile ( final String fileName ) { } }
|
if ( Util . empty ( fileName ) ) { throw new IllegalArgumentException ( "A file name must be provided." ) ; } InternalResource resource = new InternalResource ( fileName , fileName ) ; ApplicationResource res = new ApplicationResource ( resource ) ; addCssResource ( res ) ; return res ;
|
public class TargetMethodAnalyzer { /** * If more than one possibility found , filter methods using repository method name ( if exact method name wasn ' t
* specified ) . If only one method has extended parameters it will be chosen , otherwise filtering
* possibilities by most specific type and look after that for single method with extended params .
* @ param name repository method name if exact method hint wasn ' t specified in annotation or null
* @ param params repository method parameters
* @ param possibilities all found methods
* @ return descriptor if guessing was successful
* @ throws ru . vyarus . guice . persist . orient . repository . core . MethodDefinitionException if method guess fails */
@ SuppressWarnings ( "PMD.AvoidLiteralsInIfCondition" ) private static Method resolveMethod ( final String name , final List < Class < ? > > params , final List < MatchedMethod > possibilities ) { } }
|
MatchedMethod result ; if ( possibilities . size ( ) == 1 ) { result = possibilities . get ( 0 ) ; } else { // using repository method name to reduce possibilities
Collection < MatchedMethod > filtered = MethodFilters . filterByMethodName ( possibilities , name ) ; checkGuessSuccess ( ! filtered . isEmpty ( ) , filtered ) ; if ( filtered . size ( ) == 1 ) { result = filtered . iterator ( ) . next ( ) ; } else { // extended method has higher priority
result = MethodFilters . findSingleExtended ( filtered ) ; if ( result == null ) { // try to filter using most closest parameters
filtered = MethodFilters . filterByClosestParams ( filtered , params . size ( ) ) ; if ( filtered . size ( ) == 1 ) { result = filtered . iterator ( ) . next ( ) ; } else { result = MethodFilters . findSingleExtended ( filtered ) ; } } checkGuessSuccess ( result != null , filtered ) ; } } return result == null ? null : result . method ;
|
public class Node { /** * Fails if the file already exists . Features define whether this operation is atomic .
* This default implementation is not atomic .
* @ return this */
public T mkfile ( ) throws MkfileException { } }
|
try { if ( exists ( ) ) { throw new MkfileException ( this ) ; } return writeBytes ( ) ; } catch ( IOException e ) { throw new MkfileException ( this , e ) ; }
|
public class LanguageResolver { /** * Supported languages for templates are resolved from arquillian _ reporter _ templates / _ language _ directory which is bundled
* in jar of reporter api . In order to be able to support languages when you run your test from IDE as Eclipse , in order to
* be able to scan it , you have to put it on build path ( project - > Propeties - > Java Build Path - > Add External JARs ) . When you
* test with Maven , it behaves ok .
* @ return */
protected List < String > resolveSupportedLanguages ( ) { } }
|
List < String > supportedLanguages = new ArrayList < String > ( ) ; final File jarFile = new File ( getClass ( ) . getProtectionDomain ( ) . getCodeSource ( ) . getLocation ( ) . getPath ( ) ) ; if ( jarFile . isFile ( ) ) { // Run with JAR file
try { JarFile jar = new JarFile ( jarFile ) ; final Enumeration < JarEntry > entries = jar . entries ( ) ; JarEntry entry ; while ( entries . hasMoreElements ( ) ) { entry = entries . nextElement ( ) ; if ( ( entry . getName ( ) . startsWith ( DEFAULT_TEMPLATE_DIR ) || entry . getName ( ) . startsWith ( DEFAULT_TEMPLATE_BASE_DIR ) ) && entry . getName ( ) . endsWith ( DEFAULT_TEMPLATE_EXTENSION ) ) { supportedLanguages . add ( parseLanguage ( entry . getName ( ) ) ) ; } } jar . close ( ) ; } catch ( IOException e ) { // left intentionally empty
} } return supportedLanguages ;
|
public class SharedObject { /** * Return attribute by name and set if it doesn ' t exist yet .
* @ param name
* Attribute name
* @ param value
* Value to set if attribute doesn ' t exist
* @ return Attribute value */
@ Override public Object getAttribute ( String name , Object value ) { } }
|
log . debug ( "getAttribute - name: {} value: {}" , name , value ) ; Object result = null ; if ( name != null ) { result = attributes . putIfAbsent ( name , value ) ; if ( result == null ) { // no previous value
modified . set ( true ) ; final SharedObjectEvent event = new SharedObjectEvent ( Type . CLIENT_UPDATE_DATA , name , value ) ; if ( ownerMessage . addEvent ( event ) && syncEvents . add ( event ) ) { notifyModified ( ) ; changeStats . incrementAndGet ( ) ; } result = value ; } } return result ;
|
public class SerialMessage { /** * Gets the SerialMessage as a byte array .
* @ return the message */
public byte [ ] getMessageBuffer ( ) { } }
|
ByteArrayOutputStream resultByteBuffer = new ByteArrayOutputStream ( ) ; byte [ ] result ; resultByteBuffer . write ( ( byte ) 0x01 ) ; int messageLength = messagePayload . length + ( this . messageClass == SerialMessageClass . SendData && this . messageType == SerialMessageType . Request ? 5 : 3 ) ; // calculate and set length
resultByteBuffer . write ( ( byte ) messageLength ) ; resultByteBuffer . write ( ( byte ) messageType . ordinal ( ) ) ; resultByteBuffer . write ( ( byte ) messageClass . getKey ( ) ) ; try { resultByteBuffer . write ( messagePayload ) ; } catch ( IOException e ) { } // callback ID and transmit options for a Send Data message .
if ( this . messageClass == SerialMessageClass . SendData && this . messageType == SerialMessageType . Request ) { resultByteBuffer . write ( transmitOptions ) ; resultByteBuffer . write ( callbackId ) ; } resultByteBuffer . write ( ( byte ) 0x00 ) ; result = resultByteBuffer . toByteArray ( ) ; result [ result . length - 1 ] = 0x01 ; result [ result . length - 1 ] = calculateChecksum ( result ) ; logger . debug ( "Assembled message buffer = " + SerialMessage . bb2hex ( result ) ) ; return result ;
|
public class CommerceOrderNotePersistenceImpl { /** * Returns the first commerce order note in the ordered set where commerceOrderId = & # 63 ; .
* @ param commerceOrderId the commerce order ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce order note
* @ throws NoSuchOrderNoteException if a matching commerce order note could not be found */
@ Override public CommerceOrderNote findByCommerceOrderId_First ( long commerceOrderId , OrderByComparator < CommerceOrderNote > orderByComparator ) throws NoSuchOrderNoteException { } }
|
CommerceOrderNote commerceOrderNote = fetchByCommerceOrderId_First ( commerceOrderId , orderByComparator ) ; if ( commerceOrderNote != null ) { return commerceOrderNote ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "commerceOrderId=" ) ; msg . append ( commerceOrderId ) ; msg . append ( "}" ) ; throw new NoSuchOrderNoteException ( msg . toString ( ) ) ;
|
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link DirectedNodePropertyType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link DirectedNodePropertyType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "directedNode" ) public JAXBElement < DirectedNodePropertyType > createDirectedNode ( DirectedNodePropertyType value ) { } }
|
return new JAXBElement < DirectedNodePropertyType > ( _DirectedNode_QNAME , DirectedNodePropertyType . class , null , value ) ;
|
public class BasicModelUtils { /** * Get the top n words most similar to the given word
* @ param word the word to compare
* @ param n the n to get
* @ return the top n words */
@ Override public Collection < String > wordsNearestSum ( String word , int n ) { } }
|
// INDArray vec = Transforms . unitVec ( this . lookupTable . vector ( word ) ) ;
INDArray vec = this . lookupTable . vector ( word ) ; return wordsNearestSum ( vec , n ) ;
|
public class KeyTransformationHandler { /** * Converts a Lucene document id from string form back to the original object .
* @ param s the string form of the key
* @ return the key object */
public Object stringToKey ( String s ) { } }
|
char type = s . charAt ( 0 ) ; switch ( type ) { case 'S' : // this is a String , NOT a Short . For Short see case ' X ' .
return s . substring ( 2 ) ; case 'I' : // This is an Integer
return Integer . valueOf ( s . substring ( 2 ) ) ; case 'Y' : // This is a BYTE
return Byte . valueOf ( s . substring ( 2 ) ) ; case 'L' : // This is a Long
return Long . valueOf ( s . substring ( 2 ) ) ; case 'X' : // This is a SHORT
return Short . valueOf ( s . substring ( 2 ) ) ; case 'D' : // This is a Double
return Double . valueOf ( s . substring ( 2 ) ) ; case 'F' : // This is a Float
return Float . valueOf ( s . substring ( 2 ) ) ; case 'B' : // This is a Boolean , NOT a Byte . For Byte see case ' Y ' .
return Boolean . valueOf ( s . substring ( 2 ) ) ; case 'C' : // This is a Character
return Character . valueOf ( s . charAt ( 2 ) ) ; case 'U' : // This is a java . util . UUID
return UUID . fromString ( s . substring ( 2 ) ) ; case 'A' : // This is an array of bytes encoded as a Base64 string
return Base64 . getDecoder ( ) . decode ( s . substring ( 2 ) ) ; case 'T' : // this is a custom Transformable or a type with a registered Transformer
int indexOfSecondDelimiter = s . indexOf ( ':' , 2 ) ; String keyClassName = s . substring ( 2 , indexOfSecondDelimiter ) ; String keyAsString = s . substring ( indexOfSecondDelimiter + 1 ) ; Transformer t = getTransformer ( keyClassName ) ; if ( t != null ) { return t . fromString ( keyAsString ) ; } else { throw log . noTransformerForKey ( keyClassName ) ; } } throw new CacheException ( "Unknown key type metadata: " + type ) ;
|
public class ToStream { /** * This helper method to writes out " ] ] > " when closing a CDATA section .
* @ throws org . xml . sax . SAXException */
protected void closeCDATA ( ) throws org . xml . sax . SAXException { } }
|
try { m_writer . write ( CDATA_DELIMITER_CLOSE ) ; // write out a CDATA section closing " ] ] > "
m_cdataTagOpen = false ; // Remember that we have done so .
} catch ( IOException e ) { throw new SAXException ( e ) ; }
|
public class CFGBuilderFactory { /** * Create a CFGBuilder to build a CFG for given method .
* @ param methodGen
* the method
* @ return a CFGBuilder for the method */
public static CFGBuilder create ( @ Nonnull MethodDescriptor descriptor , @ Nonnull MethodGen methodGen ) { } }
|
return new BetterCFGBuilder2 ( descriptor , methodGen ) ;
|
public class SharedPreferencesFactory { /** * Check if the application default shared preferences contains true for the
* key " acra . disable " , do not activate ACRA . Also checks the alternative
* opposite setting " acra . enable " if " acra . disable " is not found .
* @ param prefs SharedPreferences to check to see whether ACRA should be
* disabled .
* @ return true if prefs indicate that ACRA should be enabled . */
public static boolean shouldEnableACRA ( @ NonNull SharedPreferences prefs ) { } }
|
boolean enableAcra = true ; try { final boolean disableAcra = prefs . getBoolean ( ACRA . PREF_DISABLE_ACRA , false ) ; enableAcra = prefs . getBoolean ( ACRA . PREF_ENABLE_ACRA , ! disableAcra ) ; } catch ( Exception e ) { // In case of a ClassCastException
} return enableAcra ;
|
public class AbstractByteBean { /** * Method to parse byte data
* @ param pData
* byte to parse
* @ param pTags */
@ Override public void parse ( final byte [ ] pData , final Collection < TagAndLength > pTags ) { } }
|
Collection < AnnotationData > set = getAnnotationSet ( pTags ) ; BitUtils bit = new BitUtils ( pData ) ; Iterator < AnnotationData > it = set . iterator ( ) ; while ( it . hasNext ( ) ) { AnnotationData data = it . next ( ) ; if ( data . isSkip ( ) ) { bit . addCurrentBitIndex ( data . getSize ( ) ) ; } else { Object obj = DataFactory . getObject ( data , bit ) ; setField ( data . getField ( ) , this , obj ) ; } }
|
public class MediaClient { /** * Gets a pipeline with the specified pipeline name .
* @ param pipelineName The name of your pipeline .
* @ return The information of your pipeline . */
public GetPipelineResponse getPipeline ( String pipelineName ) { } }
|
GetPipelineRequest request = new GetPipelineRequest ( ) ; request . setPipelineName ( pipelineName ) ; return getPipeline ( request ) ;
|
public class JsonNominatimClient { /** * { @ inheritDoc }
* @ see fr . dudie . nominatim . client . NominatimClient # getAddress ( fr . dudie . nominatim . client . request . NominatimReverseRequest ) */
@ Override public Address getAddress ( final NominatimReverseRequest reverse ) throws IOException { } }
|
final String apiCall = String . format ( "%s&%s" , reverseUrl , reverse . getQueryString ( ) ) ; LOGGER . debug ( "reverse geocoding url: {}" , apiCall ) ; final HttpGet req = new HttpGet ( apiCall ) ; return httpClient . execute ( req , defaultReverseGeocodingHandler ) ;
|
public class RequestFactory { /** * Create new Inventory Update request .
* @ param orgToken WhiteSource organization token .
* @ param projects Projects status statement to update .
* @ param product Name or WhiteSource service token of the product to update .
* @ param productVersion Version of the product to update .
* @ param userKey user key uniquely identifying the account at white source .
* @ param requesterEmail Email of the WhiteSource user that requests to update WhiteSource .
* @ return Newly created request to update organization inventory . */
@ Deprecated public SummaryScanRequest newSummaryScanRequest ( String orgToken , String product , String productVersion , Collection < AgentProjectInfo > projects , String userKey , String requesterEmail , String productToken ) { } }
|
return ( SummaryScanRequest ) prepareRequest ( new SummaryScanRequest ( projects ) , orgToken , requesterEmail , product , productVersion , userKey , false , false , null , null , null , null , productToken , null ) ;
|
public class XMLAssert { /** * Assert that a specific XPath exists in some given XML
* @ param xPathExpression
* @ param inXMLString
* @ see XpathEngine which provides the underlying evaluation mechanism */
public static void assertXpathExists ( String xPathExpression , String inXMLString ) throws IOException , SAXException , XpathException { } }
|
Document inDocument = XMLUnit . buildControlDocument ( inXMLString ) ; assertXpathExists ( xPathExpression , inDocument ) ;
|
public class EsriJsonFactory { /** * Construct an { @ link com . esri . json . EsriFeature } from JSON
* @ param jsonInputStream JSON input stream
* @ return EsriFeature instance that describes the fully parsed JSON representation
* @ throws JsonParseException
* @ throws IOException */
public static EsriFeature FeatureFromJson ( InputStream jsonInputStream ) throws JsonParseException , IOException { } }
|
JsonParser parser = jsonFactory . createJsonParser ( jsonInputStream ) ; return FeatureFromJson ( parser ) ;
|
public class TemplateElasticsearchUpdater { /** * Remove a template
* @ param client Elasticsearch client
* @ param template template name
* @ deprecated Will be removed when we don ' t support TransportClient anymore */
@ Deprecated public static void removeTemplate ( Client client , String template ) { } }
|
logger . trace ( "removeTemplate({})" , template ) ; client . admin ( ) . indices ( ) . prepareDeleteTemplate ( template ) . get ( ) ; logger . trace ( "/removeTemplate({})" , template ) ;
|
public class GuidanceUtils { /** * ガイダンスファイルを指定のディレクトリに展開します 。
* @ param resources
* ガイダンスの表示に必要なファイル
* @ param destDir
* 展開先のディレクトリ */
public static void retrieve ( String [ ] resources , File destDir ) { } }
|
for ( String res : resources ) { try { URL resUrl = ResourceUtils . getURL ( "classpath:" + res ) ; File destFile = new File ( destDir , res ) ; if ( destFile . exists ( ) ) { continue ; } LOG . info ( "guidance.file.open" , destFile . getAbsolutePath ( ) ) ; FileUtils . copyURLToFile ( resUrl , destFile ) ; } catch ( IOException e ) { LOG . warn ( "guidance.file.open.error" , e ) ; } catch ( Exception exp ) { LOG . warn ( "proxy.error" , exp ) ; } }
|
public class Strman { /** * Test if value ends with search .
* @ param value input string
* @ param search string to search
* @ param position position till which you want to search .
* @ param caseSensitive true or false
* @ return true or false */
public static boolean endsWith ( final String value , final String search , final int position , final boolean caseSensitive ) { } }
|
validate ( value , NULL_STRING_PREDICATE , NULL_STRING_MSG_SUPPLIER ) ; int remainingLength = position - search . length ( ) ; if ( caseSensitive ) { return value . indexOf ( search , remainingLength ) > - 1 ; } return value . toLowerCase ( ) . indexOf ( search . toLowerCase ( ) , remainingLength ) > - 1 ;
|
public class ReportRunner { /** * Set next report object
* @ param report
* next report object */
public void setReport ( Report report ) { } }
|
this . report = report ; if ( this . report . getQuery ( ) != null ) { this . report . getQuery ( ) . setDialect ( dialect ) ; }
|
public class VueGWTTools { /** * Init instance properties for the given VueComponent instance . The Constructor for VueComponent
* is provided by Vue and doesn ' t extend the { @ link IsVueComponent } constructor . This method get
* an instance of the Java class for the VueComponent and copy properties to the
* VueComponentInstance . This will initialise properties that are initialised inline in the class .
* For example : List & lt ; String & gt ; myList = new LinkedList & lt ; String & gt ; ( ) ;
* @ param vueComponentInstance An instance of VueComponent to initialize
* @ param javaComponentClassInstance An instance of the Component class */
public static void initComponentInstanceFields ( IsVueComponent vueComponentInstance , IsVueComponent javaComponentClassInstance ) { } }
|
JsPropertyMap < Object > vueComponentInstancePropertyMap = Js . cast ( vueComponentInstance ) ; JsPropertyMap < Object > javaComponentClassInstancePropertyMap = Js . cast ( javaComponentClassInstance ) ; javaComponentClassInstancePropertyMap . forEach ( key -> { try { if ( ! javaComponentClassInstancePropertyMap . has ( key ) || vueComponentInstancePropertyMap . get ( key ) != null ) { return ; } vueComponentInstancePropertyMap . set ( key , javaComponentClassInstancePropertyMap . get ( key ) ) ; } catch ( Exception e ) { } } ) ;
|
public class ChatLinearLayoutManager { /** * Convenience method to find the visible child closes to end . Caller should check if it has
* enough children .
* @ param completelyVisible Whether child should be completely visible or not
* @ return The first visible child closest to end of the layout from user ' s perspective . */
private View findFirstVisibleChildClosestToEnd ( boolean completelyVisible , boolean acceptPartiallyVisible ) { } }
|
if ( mShouldReverseLayout ) { return findOneVisibleChild ( 0 , getChildCount ( ) , completelyVisible , acceptPartiallyVisible ) ; } else { return findOneVisibleChild ( getChildCount ( ) - 1 , - 1 , completelyVisible , acceptPartiallyVisible ) ; }
|
public class ExecutableFinder { /** * Find the executable by scanning the file system and the PATH . In the case of Windows this
* method allows common executable endings ( " . com " , " . bat " and " . exe " ) to be omitted .
* @ param named The name of the executable to find
* @ return The absolute path to the executable , or null if no match is made . */
public String find ( String named ) { } }
|
File file = new File ( named ) ; if ( canExecute ( file ) ) { return named ; } if ( Platform . getCurrent ( ) . is ( Platform . WINDOWS ) ) { file = new File ( named + ".exe" ) ; if ( canExecute ( file ) ) { return named + ".exe" ; } } addPathFromEnvironment ( ) ; if ( Platform . getCurrent ( ) . is ( Platform . MAC ) ) { addMacSpecificPath ( ) ; } for ( String pathSegment : pathSegmentBuilder . build ( ) ) { for ( String ending : ENDINGS ) { file = new File ( pathSegment , named + ending ) ; if ( canExecute ( file ) ) { return file . getAbsolutePath ( ) ; } } } return null ;
|
public class WebInterfaceUtils { /** * Sends an instruction to ChromeVox to navigate by DOM object in
* the given direction within a node .
* @ param node The node containing web content with ChromeVox to which the
* message should be sent
* @ param direction { @ link # DIRECTION _ FORWARD } or
* { @ link # DIRECTION _ BACKWARD }
* @ return { @ code true } if the action was performed , { @ code false }
* otherwise . */
public static boolean performNavigationByDOMObject ( AccessibilityNodeInfoCompat node , int direction ) { } }
|
final int action = ( direction == DIRECTION_FORWARD ) ? AccessibilityNodeInfoCompat . ACTION_NEXT_HTML_ELEMENT : AccessibilityNodeInfoCompat . ACTION_PREVIOUS_HTML_ELEMENT ; return node . performAction ( action ) ;
|
public class Operator { /** * Creates a new Operator instance for the given parameters ,
* adds it to the registry and return it
* @ param operatorId the identification symbol of the operator
* @ param isNegated true if it is negated
* @ return the newly created operator */
public static Operator addOperatorToRegistry ( final String operatorId , final boolean isNegated ) { } }
|
Operator op = new Operator ( operatorId , isNegated ) ; CACHE . put ( getKey ( operatorId , isNegated ) , op ) ; return op ;
|
public class RegExHelper { /** * A shortcut helper method to determine whether a string matches a certain
* regular expression or not .
* @ param sRegEx
* The regular expression to be used . The compiled regular expression
* pattern is cached . May neither be < code > null < / code > nor empty .
* @ param sValue
* The string value to compare against the regular expression .
* @ return < code > true < / code > if the string matches the regular expression ,
* < code > false < / code > otherwise . */
public static boolean stringMatchesPattern ( @ Nonnull @ RegEx final String sRegEx , @ Nonnull final String sValue ) { } }
|
return getMatcher ( sRegEx , sValue ) . matches ( ) ;
|
public class Script { /** * Indicates whether a namespace can import an exported variable or not .
* To be imported , the label must point to an exported variable , with no import restrictions
* or with a given namespace compatible with the restrictions .
* @ param label the label to import
* @ param namespace the namespace of the script asking for the variable
* @ return { @ code true } if the variable can be imported . { @ code false } otherwise } */
public boolean canImport ( String label , String namespace ) { } }
|
if ( ! exported . containsKey ( label ) ) { return false ; } Set < String > scopes = exportScopes . get ( label ) ; for ( String scope : scopes ) { if ( scope . equals ( namespace ) ) { return true ; } else if ( scope . endsWith ( "*" ) && namespace . startsWith ( scope . substring ( 0 , scope . length ( ) - 1 ) ) ) { return true ; } } return false ;
|
public class AuthRegistrationsCredentialListMapping { /** * Create a AuthRegistrationsCredentialListMappingDeleter to execute delete .
* @ param pathAccountSid The SID of the Account that created the resources to
* delete
* @ param pathDomainSid The SID of the SIP domain that contains the resources
* to delete
* @ param pathSid The unique string that identifies the resource
* @ return AuthRegistrationsCredentialListMappingDeleter capable of executing
* the delete */
public static AuthRegistrationsCredentialListMappingDeleter deleter ( final String pathAccountSid , final String pathDomainSid , final String pathSid ) { } }
|
return new AuthRegistrationsCredentialListMappingDeleter ( pathAccountSid , pathDomainSid , pathSid ) ;
|
public class LinkGenerator { /** * Returns the root value .
* @ param rootName root item name .
* @ return root item value
* @ throws IOException { @ link IOException } */
private byte [ ] getRootValue ( String rootName ) throws IOException { } }
|
ByteArrayOutputStream outStream = new ByteArrayOutputStream ( ) ; simpleWriteString ( rootName , outStream ) ; int [ ] rootVal = { 0x20 , 0x00 , 0x3D , 0x04 , 0x30 , 0x04 , 0x20 , 0x00 } ; writeInts ( rootVal , outStream ) ; simpleWriteString ( hostName , outStream ) ; return outStream . toByteArray ( ) ;
|
public class WebSocketHelper { /** * Delegates to either { @ link # sendBasicMessageSync ( Session , BasicMessage ) } or
* { @ link # sendBinarySync ( Session , InputStream ) } based on { @ code message . getBinaryData ( ) = = null } .
* @ param session the session to send to
* @ param message the message to send
* @ throws IOException */
public void sendSync ( Session session , BasicMessageWithExtraData < ? extends BasicMessage > message ) throws IOException { } }
|
BinaryData binary = message . getBinaryData ( ) ; if ( binary == null ) { sendBasicMessageSync ( session , message . getBasicMessage ( ) ) ; } else { // there is binary data to stream back - do it ourselves and don ' t return anything
BinaryData serialized = ApiDeserializer . toHawkularFormat ( message . getBasicMessage ( ) , message . getBinaryData ( ) ) ; sendBinarySync ( session , serialized ) ; }
|
public class ManipulationUtils { /** * Adds the toOpenEngSBModelValues method to the class . */
private static void addToOpenEngSBModelValues ( CtClass clazz ) throws NotFoundException , CannotCompileException , ClassNotFoundException { } }
|
StringBuilder builder = new StringBuilder ( ) ; CtClass [ ] params = generateClassField ( ) ; CtMethod m = new CtMethod ( cp . get ( List . class . getName ( ) ) , "toOpenEngSBModelValues" , params , clazz ) ; builder . append ( createTrace ( "Add elements of the model tail" ) ) . append ( "List elements = new ArrayList();\n" ) . append ( createTrace ( "Add properties of the model" ) ) . append ( createModelEntryList ( clazz ) ) . append ( "return elements;" ) ; m . setBody ( createMethodBody ( builder . toString ( ) ) ) ; clazz . addMethod ( m ) ;
|
public class CommerceDiscountRulePersistenceImpl { /** * Removes all the commerce discount rules where commerceDiscountId = & # 63 ; from the database .
* @ param commerceDiscountId the commerce discount ID */
@ Override public void removeByCommerceDiscountId ( long commerceDiscountId ) { } }
|
for ( CommerceDiscountRule commerceDiscountRule : findByCommerceDiscountId ( commerceDiscountId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( commerceDiscountRule ) ; }
|
public class DfuServiceInitiator { /** * Sets the URI or path to the Init file . The init file for DFU Bootloader version pre - 0.5
* ( SDK 4.3 , 6.0 , 6.1 ) contains only the CRC - 16 of the firmware . Bootloader version 0.5 or newer
* requires the Extended Init Packet . If the URI and path are not null the URI will be used .
* @ param initFileUri the URI of the init file
* @ param initFilePath the path of the init file
* @ return the builder */
@ Deprecated public DfuServiceInitiator setInitFile ( @ Nullable final Uri initFileUri , @ Nullable final String initFilePath ) { } }
|
return init ( initFileUri , initFilePath , 0 ) ;
|
public class JFapByteBuffer { /** * This static method can be used to dump out the contents of the specified byte buffer to
* SibTr . debug . The number of bytes dumped can be specified in the second parameter . To dump
* out the entire contents of the buffer , a value of JFapByteBuffer . ENTIRE _ BUFFER can be passed
* in .
* < p > Note this method should be guarded with an if ( isxxxEnabled ( ) ) to ensure that it is not
* executed when tracing is turned off .
* @ param buffer The buffer to dump
* @ param bytesToDump The number of bytes to dump out */
public static void dump ( Object _this , TraceComponent _tc , WsByteBuffer buffer , int bytesToDump , boolean rewind ) { } }
|
StringBuffer sb = new StringBuffer ( ) ; sb . append ( "\nBuffer hashcode: " ) ; sb . append ( Integer . toHexString ( System . identityHashCode ( buffer ) ) ) ; sb . append ( "\nBuffer position: " ) ; sb . append ( buffer . position ( ) ) ; sb . append ( "\nBuffer remaining: " ) ; sb . append ( buffer . remaining ( ) ) ; sb . append ( "\n" ) ; SibTr . debug ( _this , _tc , sb . toString ( ) ) ; SibTr . debug ( _this , _tc , getDumpBytes ( buffer , bytesToDump , rewind ) ) ;
|
public class RiemannParser { /** * This method is called to provide the parser with data .
* @ param buffer */
public void handle ( Buffer buffer ) { } }
|
if ( buff == null ) { buff = buffer ; } else { buff . appendBuffer ( buffer ) ; } if ( recordSize == - 1 ) { fixedSizeMode ( buff . getInt ( 0 ) + 4 ) ; } handleParsing ( ) ;
|
public class BandwidthSchedulesInner { /** * Creates or updates a bandwidth schedule .
* @ param deviceName The device name .
* @ param name The bandwidth schedule name which needs to be added / updated .
* @ param resourceGroupName The resource group name .
* @ param parameters The bandwidth schedule to be added or updated .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the BandwidthScheduleInner object if successful . */
public BandwidthScheduleInner beginCreateOrUpdate ( String deviceName , String name , String resourceGroupName , BandwidthScheduleInner parameters ) { } }
|
return beginCreateOrUpdateWithServiceResponseAsync ( deviceName , name , resourceGroupName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ;
|
public class SfsParameters { /** * / * ( non - Javadoc )
* @ see com . tvd12 . ezyfox . core . transport . Parameters # setAll ( java . util . Map ) */
@ Override public void setAll ( Map < Object , Object > values ) { } }
|
for ( Object key : values . keySet ( ) ) set ( key , values . get ( key ) ) ; } /* ( non - Javadoc )
* @ see com . tvd12 . ezyfox . core . transport . Parameters # set ( java . lang . Object , java . lang . Object ) */
@ Override public Object set ( Object key , Object value ) { data . put ( key . toString ( ) , TRANSFORMER . transform ( value ) ) ; return value ; } /* ( non - Javadoc )
* @ see com . tvd12 . ezyfox . core . transport . Parameters # get ( java . lang . Object ) */
@ SuppressWarnings ( "unchecked" ) @ Override public < T > T get ( Object key ) { return ( T ) data . get ( key . toString ( ) ) . getObject ( ) ; } /* ( non - Javadoc )
* @ see com . tvd12 . ezyfox . core . transport . Parameters # get ( java . lang . Object , java . lang . Class ) */
@ SuppressWarnings ( "unchecked" ) @ Override public < T > T get ( Object key , Class < T > clazz ) { return ( T ) doGet ( ( String ) key , clazz ) ; } private Object doGet ( String key , Class < ? > clazz ) { if ( FETCHERS . containsKey ( clazz ) ) return FETCHERS . get ( clazz ) . get ( key , data ) ; throw new IllegalArgumentException ( "has no value with " + clazz + " and key " + key ) ; } /* ( non - Javadoc )
* @ see com . tvd12 . ezyfox . core . transport . Parameters # keys ( ) */
@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) @ Override public Set < Object > keys ( ) { return ( Set ) data . getKeys ( ) ; } /* ( non - Javadoc )
* @ see com . tvd12 . ezyfox . core . transport . Parameters # values ( ) */
@ Override public List < Object > values ( ) { throw new UnsupportedOperationException ( ) ; } /* ( non - Javadoc )
* @ see com . tvd12 . ezyfox . core . transport . Parameters # toMap ( ) */
@ Override public Map < Object , Object > toMap ( ) { throw new UnsupportedOperationException ( ) ; } public static interface ValueFetcher { Object get ( String key , ISFSObject data ) ; } public static Map < Class < ? > , ValueFetcher > defaultFetchers ( ) { Map < Class < ? > , ValueFetcher > answer = new HashMap < > ( ) ; answer . put ( boolean . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return data . getBool ( key ) ; } } ) ; answer . put ( byte . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return data . getByte ( key ) ; } } ) ; answer . put ( char . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return ( char ) data . getByte ( key ) . byteValue ( ) ; } } ) ; answer . put ( double . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return data . getDouble ( key ) ; } } ) ; answer . put ( float . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return data . getFloat ( key ) ; } } ) ; answer . put ( int . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return data . getInt ( key ) ; } } ) ; answer . put ( long . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return data . getLong ( key ) ; } } ) ; answer . put ( short . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return data . getShort ( key ) ; } } ) ; answer . put ( Boolean . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return data . getBool ( key ) ; } } ) ; answer . put ( Byte . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return data . getByte ( key ) ; } } ) ; answer . put ( Character . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return ( char ) data . getByte ( key ) . byteValue ( ) ; } } ) ; answer . put ( Double . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return data . getDouble ( key ) ; } } ) ; answer . put ( Float . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return data . getFloat ( key ) ; } } ) ; answer . put ( Integer . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return data . getInt ( key ) ; } } ) ; answer . put ( Long . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return data . getLong ( key ) ; } } ) ; answer . put ( Short . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return data . getShort ( key ) ; } } ) ; answer . put ( String . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return data . getUtfString ( key ) ; } } ) ; answer . put ( Boolean [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return collectionToWrapperBoolArray ( data . getBoolArray ( key ) ) ; } } ) ; answer . put ( Byte [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return toByteWrapperArray ( data . getByteArray ( key ) ) ; } } ) ; answer . put ( Character [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return toCharWrapperArray ( data . getByteArray ( key ) ) ; } } ) ; answer . put ( Double [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return collectionToWrapperDoubleArray ( data . getDoubleArray ( key ) ) ; } } ) ; answer . put ( Float [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return collectionToWrapperFloatArray ( data . getFloatArray ( key ) ) ; } } ) ; answer . put ( Integer [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return collectionToWrapperIntArray ( data . getIntArray ( key ) ) ; } } ) ; answer . put ( Long [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return collectionToWrapperLongArray ( data . getLongArray ( key ) ) ; } } ) ; answer . put ( Short [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return collectionToWrapperShortArray ( data . getShortArray ( key ) ) ; } } ) ; answer . put ( String [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return collectionToStringArray ( data . getUtfStringArray ( key ) ) ; } } ) ; answer . put ( boolean [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return collectionToPrimitiveBoolArray ( data . getBoolArray ( key ) ) ; } } ) ; answer . put ( byte [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return data . getByteArray ( key ) ; } } ) ; answer . put ( char [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return byteArrayToCharArray ( data . getByteArray ( key ) ) ; } } ) ; answer . put ( double [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return collectionToPrimitiveDoubleArray ( data . getDoubleArray ( key ) ) ; } } ) ; answer . put ( float [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return collectionToPrimitiveFloatArray ( data . getFloatArray ( key ) ) ; } } ) ; answer . put ( int [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return collectionToPrimitiveIntArray ( data . getIntArray ( key ) ) ; } } ) ; answer . put ( long [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return collectionToPrimitiveLongArray ( data . getLongArray ( key ) ) ; } } ) ; answer . put ( short [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return collectionToPrimitiveShortArray ( data . getShortArray ( key ) ) ; } } ) ; answer . put ( Parameters . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return new SfsParameters ( data . getSFSObject ( key ) ) ; } } ) ; answer . put ( Parameters [ ] . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { ISFSArray array = data . getSFSArray ( key ) ; Parameters [ ] answer = new SfsParameters [ array . size ( ) ] ; for ( int i = 0 ; i < array . size ( ) ; i ++ ) answer [ i ] = new SfsParameters ( array . getSFSObject ( i ) ) ; return answer ; } } ) ; answer . put ( Arraymeters . class , new ValueFetcher ( ) { public Object get ( String key , ISFSObject data ) { return new SfsArrayParameters ( data . getSFSArray ( key ) ) ; } } ) ; return answer ; }
|
public class CmsPublishList { /** * Reads a sequence of UUIDs from an object input and builds a list of < code > CmsResource < / code > instances from it . < p >
* @ param in the object input
* @ return a list of < code > { @ link CmsResource } < / code > instances
* @ throws IOException if something goes wrong */
private List < CmsUUID > internalReadUUIDList ( ObjectInput in ) throws IOException { } }
|
List < CmsUUID > result = null ; int i = in . readInt ( ) ; if ( i >= 0 ) { result = new ArrayList < CmsUUID > ( ) ; while ( i > 0 ) { result . add ( internalReadUUID ( in ) ) ; i -- ; } } return result ;
|
public class UkDictComparator { /** * Used by key - based sorting ( like in python ' s sorted ( ) with key = parameter )
* @ param str
* @ return */
public static String getSortKey ( String str ) { } }
|
StringBuilder ignoreChars = new StringBuilder ( ) ; StringBuilder tailCaps = new StringBuilder ( str . length ( ) + 1 ) ; StringBuilder normChars = new StringBuilder ( str . length ( ) + 1 + tailCaps . capacity ( ) + ignoreChars . capacity ( ) ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { char ch = str . charAt ( i ) ; if ( isIgnoredChar ( ch ) ) { if ( ch == 0x02BC ) { ch = 0x2020 ; } ignoreChars . append ( ch ) ; continue ; } char lowerCh = Character . toLowerCase ( ch ) ; Character sortValue = UK_ALPHABET_MAP . get ( lowerCh ) ; if ( sortValue != null ) { normChars . append ( sortValue ) ; tailCaps . append ( ch ) ; } else { tailCaps . append ( ch ) ; } } normChars . append ( " " ) ; tailCaps . append ( " " ) ; ignoreChars . append ( " " ) ; normChars . append ( tailCaps ) ; normChars . append ( ignoreChars ) ; return normChars . toString ( ) ;
|
public class AbstractSequence { /** * Very important method that allows external mappings of sequence data and features . This method
* will gain additional interface inspection that allows external data sources with knowledge
* of features for a sequence to be supported .
* @ param proxyLoader */
public void setProxySequenceReader ( SequenceReader < C > proxyLoader ) { } }
|
this . sequenceStorage = proxyLoader ; if ( proxyLoader instanceof FeaturesKeyWordInterface ) { this . setFeaturesKeyWord ( ( FeaturesKeyWordInterface ) sequenceStorage ) ; } if ( proxyLoader instanceof DatabaseReferenceInterface ) { this . setDatabaseReferences ( ( DatabaseReferenceInterface ) sequenceStorage ) ; } if ( proxyLoader instanceof FeatureRetriever ) { this . setFeatureRetriever ( ( FeatureRetriever ) sequenceStorage ) ; HashMap < String , ArrayList < AbstractFeature > > ff = getFeatureRetriever ( ) . getFeatures ( ) ; for ( String k : ff . keySet ( ) ) { for ( AbstractFeature f : ff . get ( k ) ) { this . addFeature ( f ) ; } } // success of next statement guaranteed because source is a compulsory field
// DBReferenceInfo dbQualifier = ( DBReferenceInfo ) ff . get ( " source " ) . get ( 0 ) . getQualifiers ( ) . get ( " db _ xref " ) ;
ArrayList < DBReferenceInfo > dbQualifiers = ( ArrayList ) ff . get ( "source" ) . get ( 0 ) . getQualifiers ( ) . get ( "db_xref" ) ; DBReferenceInfo dbQualifier = dbQualifiers . get ( 0 ) ; if ( dbQualifier != null ) this . setTaxonomy ( new TaxonomyID ( dbQualifier . getDatabase ( ) + ":" + dbQualifier . getId ( ) , DataSource . UNKNOWN ) ) ; } if ( getAccession ( ) == null && proxyLoader instanceof UniprotProxySequenceReader ) { // we have lots of unsupported operations for this call so quick fix to allow this tow rork
this . setAccession ( proxyLoader . getAccession ( ) ) ; }
|
public class CProductUtil { /** * Returns the last c product in the ordered set where uuid = & # 63 ; .
* @ param uuid the uuid
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching c product , or < code > null < / code > if a matching c product could not be found */
public static CProduct fetchByUuid_Last ( String uuid , OrderByComparator < CProduct > orderByComparator ) { } }
|
return getPersistence ( ) . fetchByUuid_Last ( uuid , orderByComparator ) ;
|
public class PatternDecorator { /** * Modifies the original entry set such that the value for the ' regexp ' attribute is a JavaScript regexp pattern .
* The following transformations are applied :
* < ul >
* < li > adding ' / ' prefix and suffix turning a Java pattern like " abc " into " / abc / " for JavaScript < / li >
* < / ul >
* Furthermore , the ' regexp ' attribute is renamed to ' value ' because that ' s what valdr expects .
* @ return the modified entry set */
@ Override public Set < Map . Entry < String , Object > > entrySet ( ) { } }
|
Set < Map . Entry < String , Object > > entrySet = getDecoratee ( ) . entrySet ( ) ; Map < String , Object > result = new HashMap < > ( ) ; for ( Map . Entry < String , Object > entry : entrySet ) { if ( "regexp" . equals ( entry . getKey ( ) ) ) { result . put ( "value" , javaToJavaScriptRegexpPattern ( entry ) ) ; } else { result . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } } return result . entrySet ( ) ;
|
public class ClassDocImpl { /** * where */
private boolean hasTypeName ( Type t , String name ) { } }
|
return name . equals ( TypeMaker . getTypeName ( t , true ) ) || name . equals ( TypeMaker . getTypeName ( t , false ) ) || ( qualifiedName ( ) + "." + name ) . equals ( TypeMaker . getTypeName ( t , true ) ) ;
|
public class TheMovieDbApi { /** * Get a list of Movie IDs that have been edited .
* You can then use the movie changes API to get the actual data that has
* been changed .
* @ param page page
* @ param startDate the start date of the changes , optional
* @ param endDate the end date of the changes , optional
* @ return List of changed movie
* @ throws MovieDbException exception */
public ResultList < ChangeListItem > getMovieChangeList ( Integer page , String startDate , String endDate ) throws MovieDbException { } }
|
return tmdbChanges . getChangeList ( MethodBase . MOVIE , page , startDate , endDate ) ;
|
public class BatchGetNamedQueryRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( BatchGetNamedQueryRequest batchGetNamedQueryRequest , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( batchGetNamedQueryRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( batchGetNamedQueryRequest . getNamedQueryIds ( ) , NAMEDQUERYIDS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class WaltzUtil { /** * This function is passed two points and calculates the angle between the
* line defined by these points and the x - axis . */
private static double get_angle ( final int p1 , final int p2 ) { } }
|
int delta_x , delta_y ; double ret = 0.0 ; /* * Calculate ( x2 - x1 ) and ( y2 - y1 ) . The points are passed in the form
* x1y1 and x2y2 . get _ x ( ) and get _ y ( ) are passed these points and return
* the x and y values respectively . For example , get _ x ( 1020 ) returns 10. */
delta_x = get_x ( p2 ) - get_x ( p1 ) ; delta_y = get_y ( p2 ) - get_y ( p1 ) ; if ( delta_x == 0 ) { if ( delta_y > 0 ) { ret = WaltzUtil . PI / 2 ; } else if ( delta_y < 0 ) { ret = - WaltzUtil . PI / 2 ; } } else if ( delta_y == 0 ) { if ( delta_x > 0 ) { ret = 0.0 ; } else if ( delta_x < 0 ) { ret = WaltzUtil . PI ; } } else { ret = Math . atan2 ( delta_y , delta_x ) ; } return ret ;
|
public class SessionState { /** * Current route values */
public int currentStepCount ( ) { } }
|
if ( currentDirectionRoute ( ) == null ) { return 0 ; } int stepCount = 0 ; for ( RouteLeg leg : currentDirectionRoute ( ) . legs ( ) ) { stepCount += leg . steps ( ) . size ( ) ; } return stepCount ;
|
public class Version { /** * ( non - Javadoc )
* @ see java . lang . Comparable # compareTo ( java . lang . Object ) */
public int compareTo ( Version that ) { } }
|
if ( that == null ) { return 1 ; } if ( major != that . major ) { return major - that . major ; } if ( minor != that . minor ) { return minor - that . minor ; } if ( bugfix != that . bugfix ) { return bugfix - that . bugfix ; } if ( build != that . build ) { return build - that . build ; } return 0 ;
|
public class RouteHandler { /** * Adds the specified context handler meta
* @ param contextHandlerMeta the specified context handler meta */
public static void addContextHandlerMeta ( final ContextHandlerMeta contextHandlerMeta ) { } }
|
final Method invokeHolder = contextHandlerMeta . getInvokeHolder ( ) ; final Class < ? > returnType = invokeHolder . getReturnType ( ) ; final String methodName = invokeHolder . getDeclaringClass ( ) . getName ( ) + "#" + invokeHolder . getName ( ) ; if ( ! void . class . equals ( returnType ) ) { LOGGER . error ( "Handler method [" + methodName + "] must return void" ) ; System . exit ( - 1 ) ; } final Class < ? > [ ] exceptionTypes = invokeHolder . getExceptionTypes ( ) ; if ( 0 < exceptionTypes . length ) { LOGGER . error ( "Handler method [" + methodName + "] can not throw exceptions" ) ; System . exit ( - 1 ) ; } final Class < ? > [ ] parameterTypes = invokeHolder . getParameterTypes ( ) ; if ( 1 != parameterTypes . length ) { LOGGER . error ( "Handler method [" + methodName + "] must have one parameter with type [RequestContext]" ) ; System . exit ( - 1 ) ; } final Class < ? > parameterType = parameterTypes [ 0 ] ; if ( ! RequestContext . class . equals ( parameterType ) ) { LOGGER . error ( "Handler method [" + methodName + "] must have one parameter with type [RequestContext]" ) ; System . exit ( - 1 ) ; } final HttpMethod [ ] httpMethods = contextHandlerMeta . getHttpMethods ( ) ; for ( int i = 0 ; i < httpMethods . length ; i ++ ) { final String httpMethod = httpMethods [ i ] . name ( ) ; final String [ ] uriTemplates = contextHandlerMeta . getUriTemplates ( ) ; for ( int j = 0 ; j < uriTemplates . length ; j ++ ) { final String uriTemplate = uriTemplates [ j ] ; final String key = httpMethod + "." + uriTemplate ; final int segs = StringUtils . countMatches ( uriTemplate , "/" ) ; if ( ! StringUtils . contains ( uriTemplate , "{" ) ) { switch ( segs ) { case 1 : ONE_SEG_CONCRETE_CTX_HANDLER_METAS . put ( key , contextHandlerMeta ) ; break ; case 2 : TWO_SEG_CONCRETE_CTX_HANDLER_METAS . put ( key , contextHandlerMeta ) ; break ; case 3 : THREE_SEG_CONCRETE_CTX_HANDLER_METAS . put ( key , contextHandlerMeta ) ; break ; default : FOUR_MORE_SEG_CONCRETE_CTX_HANDLER_METAS . put ( key , contextHandlerMeta ) ; } } else { // URI templates contain path vars
switch ( segs ) { case 1 : switch ( httpMethod ) { case "GET" : ONE_SEG_GET_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; break ; case "POST" : ONE_SEG_POST_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; break ; case "PUT" : ONE_SEG_PUT_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; break ; case "DELETE" : ONE_SEG_DELETE_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; break ; default : ONE_SEG_OTHER_METHOD_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; } break ; case 2 : switch ( httpMethod ) { case "GET" : TWO_SEG_GET_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; break ; case "POST" : TWO_SEG_POST_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; break ; case "PUT" : TWO_SEG_PUT_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; break ; case "DELETE" : TWO_SEG_DELETE_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; break ; default : TWO_SEG_OTHER_METHOD_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; } break ; case 3 : switch ( httpMethod ) { case "GET" : THREE_SEG_GET_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; break ; case "POST" : THREE_SEG_POST_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; break ; case "PUT" : THREE_SEG_PUT_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; break ; case "DELETE" : THREE_SEG_DELETE_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; break ; default : THREE_SEG_OTHER_METHOD_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; } break ; default : switch ( httpMethod ) { case "GET" : FOUR_MORE_SEG_GET_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; break ; case "POST" : FOUR_MORE_SEG_POST_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; break ; case "PUT" : FOUR_MORE_SEG_PUT_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; break ; case "DELETE" : FOUR_MORE_SEG_DELETE_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; break ; default : FOUR_MORE_SEG_OTHER_METHOD_VAR_CTX_HANDLER_METAS . put ( uriTemplate , contextHandlerMeta ) ; } } } } } LOGGER . log ( Level . DEBUG , "Added a processor method [" + methodName + "]" ) ;
|
public class IntColumnSpecWrapper { /** * Returns whether the given column specification has the same schema and
* table as this one .
* @ param tableSpec
* a { @ link TableSpec } .
* @ return < code > true < / code > if the given table specification has the same
* schema and table as this one , < code > false < / code > if not . */
boolean isSameSchemaAndTable ( TableSpec tableSpec ) { } }
|
return StringUtil . equals ( tableSpec . getSchema ( ) , getSchema ( ) ) && StringUtil . equals ( tableSpec . getTable ( ) , getTable ( ) ) ;
|
public class AstInspector { /** * Sets the compile phase up to which compilation should proceed . Defaults to
* CompilePhase . CONVERSION ( the phase in which the AST is first constructed ) .
* @ param phase the compile phase up to which compilation should proceed
* @ throws IllegalArgumentException if a compile phase before
* CompilePhase . CONVERSION is specified */
public void setCompilePhase ( CompilePhase phase ) { } }
|
if ( phase . getPhaseNumber ( ) < CompilePhase . CONVERSION . getPhaseNumber ( ) ) throw new IllegalArgumentException ( "AST is only available from phase CONVERSION onwards" ) ; compilePhase = phase ;
|
public class HadoopUtils { /** * Reads maps of integer - > integer */
public static HashMap < Integer , Integer > readIntIntMap ( Path path , FileSystem fs ) throws IOException { } }
|
SequenceFile . Reader reader = new SequenceFile . Reader ( fs , path , fs . getConf ( ) ) ; IntWritable topic = new IntWritable ( ) ; IntWritable value = new IntWritable ( ) ; HashMap < Integer , Integer > ret = new HashMap < Integer , Integer > ( ) ; while ( reader . next ( topic ) ) { reader . getCurrentValue ( value ) ; ret . put ( topic . get ( ) , value . get ( ) ) ; } reader . close ( ) ; return ret ;
|
public class ClientOption { /** * Returns the { @ link ClientOption } of the specified name . */
@ SuppressWarnings ( "unchecked" ) public static < T > ClientOption < T > valueOf ( String name ) { } }
|
return ( ClientOption < T > ) pool . valueOf ( name ) ;
|
public class JaxRsClientFactory { /** * Create a new { @ link ClientBuilder } instance with the given name and groups .
* You own the returned client and are responsible for managing its cleanup . */
public synchronized ClientBuilder newBuilder ( String clientName , JaxRsFeatureGroup feature , JaxRsFeatureGroup ... moreFeatures ) { } }
|
return newBuilder ( clientName , ImmutableList . < JaxRsFeatureGroup > builder ( ) . add ( feature ) . addAll ( Arrays . asList ( moreFeatures ) ) . build ( ) ) ;
|
public class RetryPolicy { /** * Retry policy that provides exponentially increasing retry intervals with each successive failure . This policy is suitable for use by use most client applications and is also the default policy
* if no retry policy is specified .
* @ return a retry policy that provides exponentially increasing retry intervals */
public static RetryPolicy getDefault ( ) { } }
|
return new RetryExponential ( ClientConstants . DEFAULT_RERTRY_MIN_BACKOFF , ClientConstants . DEFAULT_RERTRY_MAX_BACKOFF , ClientConstants . DEFAULT_MAX_RETRY_COUNT , ClientConstants . DEFAULT_RETRY ) ;
|
public class DirectoryScanner { /** * Go back to the hardwired default exclude patterns .
* @ since Ant 1.6 */
public static void resetDefaultExcludes ( ) { } }
|
defaultExcludes = new Vector ( ) ; for ( int i = 0 ; i < DEFAULTEXCLUDES . length ; i ++ ) { defaultExcludes . add ( DEFAULTEXCLUDES [ i ] ) ; }
|
public class AbstractCentralAuthenticationService { /** * Gets the authentication satisfied by policy .
* @ param authentication the authentication
* @ param context the context
* @ return the authentication satisfied by policy
* @ throws AbstractTicketException the ticket exception */
protected Authentication getAuthenticationSatisfiedByPolicy ( final Authentication authentication , final ServiceContext context ) throws AbstractTicketException { } }
|
val policy = this . serviceContextAuthenticationPolicyFactory . createPolicy ( context ) ; try { if ( policy . isSatisfiedBy ( authentication ) ) { return authentication ; } } catch ( final Exception e ) { LOGGER . error ( e . getMessage ( ) , e ) ; } throw new UnsatisfiedAuthenticationPolicyException ( policy ) ;
|
public class ScheduleGenerator { /** * Simple schedule generation where startDate and maturityDate are calculated based on referenceDate , spotOffsetDays , startOffsetString and maturityString .
* The schedule generation considers short periods . Date rolling is ignored .
* @ param referenceDate The date which is used in the schedule to internally convert dates to doubles , i . e . , the date where t = 0.
* @ param spotOffsetDays Number of business days to be added to the trade date to obtain the spot date .
* @ param startOffsetString The start date as an offset from the spotDate ( build from tradeDate and spotOffsetDays ) entered as a code like 1D , 1W , 1M , 2M , 3M , 1Y , etc .
* @ param maturityString The end date of the last period entered as a code like 1D , 1W , 1M , 2M , 3M , 1Y , etc .
* @ param frequency The frequency ( as String ) .
* @ param daycountConvention The daycount convention ( as String ) .
* @ param shortPeriodConvention If short period exists , have it first or last ( as String ) .
* @ param dateRollConvention Adjustment to be applied to the all dates ( as String ) .
* @ param businessdayCalendar Business day calendar ( holiday calendar ) to be used for date roll adjustment .
* @ param fixingOffsetDays Number of business days to be added to period start to get the fixing date .
* @ param paymentOffsetDays Number of business days to be added to period end to get the payment date .
* @ return The corresponding schedule */
public static Schedule createScheduleFromConventions ( LocalDate referenceDate , int spotOffsetDays , String startOffsetString , String maturityString , String frequency , String daycountConvention , String shortPeriodConvention , String dateRollConvention , BusinessdayCalendar businessdayCalendar , int fixingOffsetDays , int paymentOffsetDays ) { } }
|
// tradeDate = referenceDate
return createScheduleFromConventions ( referenceDate , referenceDate , spotOffsetDays , startOffsetString , maturityString , frequency , daycountConvention , shortPeriodConvention , dateRollConvention , businessdayCalendar , fixingOffsetDays , paymentOffsetDays ) ;
|
public class Index { /** * Update an api key
* @ param acls the list of ACL for this key . Defined by an array of strings that
* can contains the following values :
* - search : allow to search ( https and http )
* - addObject : allows to add / update an object in the index ( https only )
* - deleteObject : allows to delete an existing object ( https only )
* - deleteIndex : allows to delete index content ( https only )
* - settings : allows to get index settings ( https only )
* - editSettings : allows to change index settings ( https only ) */
public JSONObject updateApiKey ( String key , List < String > acls ) throws AlgoliaException { } }
|
return updateApiKey ( key , acls , 0 , 0 , 0 ) ;
|
public class ContentLengthHandler { /** * Cut the message content to the configured length .
* @ param event the event */
public void handleEvent ( Event event ) { } }
|
LOG . fine ( "ContentLengthHandler called" ) ; // if maximum length is shorter then < cut > < ! [ CDATA [ ] ] > < / cut > it ' s not possible to cut the content
if ( CUT_START_TAG . length ( ) + CUT_END_TAG . length ( ) > length ) { LOG . warning ( "Trying to cut content. But length is shorter then needed for " + CUT_START_TAG + CUT_END_TAG + ". So content is skipped." ) ; event . setContent ( "" ) ; return ; } int currentLength = length - CUT_START_TAG . length ( ) - CUT_END_TAG . length ( ) ; if ( event . getContent ( ) != null && event . getContent ( ) . length ( ) > length ) { LOG . fine ( "cutting content to " + currentLength + " characters. Original length was " + event . getContent ( ) . length ( ) ) ; LOG . fine ( "Content before cutting: " + event . getContent ( ) ) ; event . setContent ( CUT_START_TAG + event . getContent ( ) . substring ( 0 , currentLength ) + CUT_END_TAG ) ; LOG . fine ( "Content after cutting: " + event . getContent ( ) ) ; }
|
public class MoneyUtil { /** * 分析格式为 # , # # 0.00格式的字符串 */
public static BigDecimal parsePrettyString ( String numberStr ) throws ParseException { } }
|
return new BigDecimal ( PRETTY_FORMAT . get ( ) . parse ( numberStr ) . doubleValue ( ) ) ;
|
public class BiStream { /** * Factory method { @ link BiStream } class
* @ param stream stream objects
* @ param obj object which is compared to objects from stream
* @ param < T > type of the objects in stream
* @ param < U > type of the compared object
* @ return BiStream object */
public static < T , U > BiStream < T , U > of ( Stream < T > stream , U obj ) { } }
|
return new BiStream < > ( stream , obj ) ;
|
public class CoreOptions { /** * Creates a { @ link org . ops4j . pax . exam . options . MavenPluginGeneratedConfigOption } .
* @ return Args option with file written from paxexam plugin */
public static MavenPluginGeneratedConfigOption mavenConfiguration ( ) { } }
|
URL url = CoreOptions . class . getClassLoader ( ) . getResource ( DEFAULT_CONFIGURATION ) ; if ( url != null ) { return mavenConfiguration ( url ) ; } else { throw new IllegalArgumentException ( "Maven PaxExam Plugin does not look like being configured or run properly. " + "File (usually produced by the plugin upfront) " + DEFAULT_CONFIGURATION + " has not been found." ) ; }
|
public class WListRenderer { /** * Paints the rows .
* @ param list the WList to paint the rows for .
* @ param renderContext the RenderContext to paint to . */
protected void paintRows ( final WList list , final WebXmlRenderContext renderContext ) { } }
|
List < ? > beanList = list . getBeanList ( ) ; WComponent row = list . getRepeatedComponent ( ) ; XmlStringBuilder xml = renderContext . getWriter ( ) ; for ( int i = 0 ; i < beanList . size ( ) ; i ++ ) { Object rowData = beanList . get ( i ) ; // Each row has its own context . This is why we can reuse the same
// WComponent instance for each row .
UIContext rowContext = list . getRowContext ( rowData , i ) ; UIContextHolder . pushContext ( rowContext ) ; try { xml . appendTag ( "ui:cell" ) ; row . paint ( renderContext ) ; xml . appendEndTag ( "ui:cell" ) ; } finally { UIContextHolder . popContext ( ) ; } }
|
public class OffsetDateTime { /** * Returns a copy of this date - time with the specified field set to a new value .
* This returns an { @ code OffsetDateTime } , based on this one , with the value
* for the specified field changed .
* This can be used to change any supported field , such as the year , month or day - of - month .
* If it is not possible to set the value , because the field is not supported or for
* some other reason , an exception is thrown .
* In some cases , changing the specified field can cause the resulting date - time to become invalid ,
* such as changing the month from 31st January to February would make the day - of - month invalid .
* In cases like this , the field is responsible for resolving the date . Typically it will choose
* the previous valid date , which would be the last valid day of February in this example .
* If the field is a { @ link ChronoField } then the adjustment is implemented here .
* The { @ code INSTANT _ SECONDS } field will return a date - time with the specified instant .
* The offset and nano - of - second are unchanged .
* If the new instant value is outside the valid range then a { @ code DateTimeException } will be thrown .
* The { @ code OFFSET _ SECONDS } field will return a date - time with the specified offset .
* The local date - time is unaltered . If the new offset value is outside the valid range
* then a { @ code DateTimeException } will be thrown .
* The other { @ link # isSupported ( TemporalField ) supported fields } will behave as per
* the matching method on { @ link LocalDateTime # with ( TemporalField , long ) LocalDateTime } .
* In this case , the offset is not part of the calculation and will be unchanged .
* All other { @ code ChronoField } instances will throw an { @ code UnsupportedTemporalTypeException } .
* If the field is not a { @ code ChronoField } , then the result of this method
* is obtained by invoking { @ code TemporalField . adjustInto ( Temporal , long ) }
* passing { @ code this } as the argument . In this case , the field determines
* whether and how to adjust the instant .
* This instance is immutable and unaffected by this method call .
* @ param field the field to set in the result , not null
* @ param newValue the new value of the field in the result
* @ return an { @ code OffsetDateTime } based on { @ code this } with the specified field set , not null
* @ throws DateTimeException if the field cannot be set
* @ throws UnsupportedTemporalTypeException if the field is not supported
* @ throws ArithmeticException if numeric overflow occurs */
@ Override public OffsetDateTime with ( TemporalField field , long newValue ) { } }
|
if ( field instanceof ChronoField ) { ChronoField f = ( ChronoField ) field ; switch ( f ) { case INSTANT_SECONDS : return ofInstant ( Instant . ofEpochSecond ( newValue , getNano ( ) ) , offset ) ; case OFFSET_SECONDS : { return with ( dateTime , ZoneOffset . ofTotalSeconds ( f . checkValidIntValue ( newValue ) ) ) ; } } return with ( dateTime . with ( field , newValue ) , offset ) ; } return field . adjustInto ( this , newValue ) ;
|
public class Merge { /** * Merge two sorted arrays into a bigger array in ascending order . This routine runs in O ( n ) time .
* @ param < E > the type of elements in this array .
* @ param array array with two sorted sub arrays that will be merged
* @ param start index of the starting point of the left array
* @ param middle index that splits the array in two sub arrays
* @ param end index of the end point of the right array */
private static < E extends Comparable < E > > void merge ( E [ ] array , int start , int middle , int end ) { } }
|
List < E > temp = new LinkedList < > ( ) ; for ( int i = 0 ; i < array . length ; i ++ ) { temp . add ( array [ i ] ) ; } int left = start ; int right = middle + 1 ; int current = start ; while ( left <= middle && right <= end ) { if ( temp . get ( left ) . compareTo ( temp . get ( right ) ) <= 0 ) { array [ current ] = temp . get ( left ) ; left ++ ; } else { array [ current ] = temp . get ( right ) ; right ++ ; } current ++ ; } while ( left <= middle ) { array [ current ] = temp . get ( left ) ; left ++ ; current ++ ; }
|
public class AtomicLongFieldUpdater { /** * Atomically increments by one the current value of the field of the
* given object managed by this updater .
* @ param obj An object whose field to get and set
* @ return the previous value */
public long getAndIncrement ( T obj ) { } }
|
long prev , next ; do { prev = get ( obj ) ; next = prev + 1 ; } while ( ! compareAndSet ( obj , prev , next ) ) ; return prev ;
|
public class ReflectionUtils { /** * 调用静态方法 。 无视private / protected修饰符 . < br >
* 调用 某类 < tt > clazz < / tt > 的某方法 < tt > methodName < / tt > , 参数类型 < tt > parameterTypes < / tt > 对应参数值 < tt > args < / tt >
* @ since 2.0.2 */
public static Object invokeStaticMethod ( final Class < ? > clazz , final String methodName , final Class < ? > [ ] parameterTypes , final Object [ ] parameterValues ) { } }
|
Method method = getStaticMethod ( clazz , methodName , parameterTypes ) ; if ( method == null ) { throw new IllegalArgumentException ( "Could not find method [" + methodName + "] on target [" + clazz + "]" ) ; } try { return method . invoke ( clazz , parameterValues ) ; } catch ( Exception e ) { throw convertReflectionExceptionToUnchecked ( e ) ; }
|
public class CharSet { /** * < p > Add a set definition string to the { @ code CharSet } . < / p >
* @ param str set definition string */
protected void add ( final String str ) { } }
|
if ( str == null ) { return ; } final int len = str . length ( ) ; int pos = 0 ; while ( pos < len ) { final int remainder = len - pos ; if ( remainder >= 4 && str . charAt ( pos ) == '^' && str . charAt ( pos + 2 ) == '-' ) { // negated range
set . add ( CharRange . isNotIn ( str . charAt ( pos + 1 ) , str . charAt ( pos + 3 ) ) ) ; pos += 4 ; } else if ( remainder >= 3 && str . charAt ( pos + 1 ) == '-' ) { // range
set . add ( CharRange . isIn ( str . charAt ( pos ) , str . charAt ( pos + 2 ) ) ) ; pos += 3 ; } else if ( remainder >= 2 && str . charAt ( pos ) == '^' ) { // negated char
set . add ( CharRange . isNot ( str . charAt ( pos + 1 ) ) ) ; pos += 2 ; } else { // char
set . add ( CharRange . is ( str . charAt ( pos ) ) ) ; pos += 1 ; } }
|
public class Services { /** * Asynchronously starts a Service and returns a CompletableFuture that will indicate when it is running .
* @ param service The Service to start .
* @ param executor An Executor to use for callback invocations .
* @ return A CompletableFuture that will be completed when the service enters a RUNNING state , or completed
* exceptionally if the service failed to start . */
public static CompletableFuture < Void > startAsync ( Service service , Executor executor ) { } }
|
// Service . startAsync ( ) will fail if the service is not in a NEW state . That is , if it is already RUNNING or
// STARTED , then the method will fail synchronously , hence we are not in danger of not invoking our callbacks ,
// as long as we register the Listener before we attempt to start .
// Nevertheless , do make a sanity check since once added , a Listener cannot be removed .
Preconditions . checkState ( service . state ( ) == Service . State . NEW , "Service expected to be %s but was %s." , Service . State . NEW , service . state ( ) ) ; Preconditions . checkNotNull ( executor , "executor" ) ; CompletableFuture < Void > result = new CompletableFuture < > ( ) ; service . addListener ( new StartupListener ( result ) , executor ) ; service . startAsync ( ) ; return result ;
|
public class FrustumIntersection { /** * Determine whether the given sphere is partly or completely within or outside of the frustum defined by < code > this < / code > frustum culler .
* The algorithm implemented by this method is conservative . This means that in certain circumstances a < i > false positive < / i >
* can occur , when the method returns < code > true < / code > for spheres that are actually not visible .
* See < a href = " http : / / iquilezles . org / www / articles / frustumcorrect / frustumcorrect . htm " > iquilezles . org < / a > for an examination of this problem .
* @ param center
* the sphere ' s center
* @ param radius
* the sphere ' s radius
* @ return { @ link # INSIDE } if the given sphere is completely inside the frustum , or { @ link # INTERSECT } if the sphere intersects
* the frustum , or { @ link # OUTSIDE } if the sphere is outside of the frustum */
public int intersectSphere ( Vector3fc center , float radius ) { } }
|
return intersectSphere ( center . x ( ) , center . y ( ) , center . z ( ) , radius ) ;
|
public class UCharacterProperty { /** * Returns the digit values of characters like ' A ' - ' Z ' , normal ,
* half - width and full - width . This method assumes that the other digit
* characters are checked by the calling method .
* @ param ch character to test
* @ return - 1 if ch is not a character of the form ' A ' - ' Z ' , otherwise
* its corresponding digit will be returned . */
public static int getEuropeanDigit ( int ch ) { } }
|
if ( ( ch > 0x7a && ch < 0xff21 ) || ch < 0x41 || ( ch > 0x5a && ch < 0x61 ) || ch > 0xff5a || ( ch > 0xff3a && ch < 0xff41 ) ) { return - 1 ; } if ( ch <= 0x7a ) { // ch > = 0x41 or ch < 0x61
return ch + 10 - ( ( ch <= 0x5a ) ? 0x41 : 0x61 ) ; } // ch > = 0xff21
if ( ch <= 0xff3a ) { return ch + 10 - 0xff21 ; } // ch > = 0xff41 & & ch < = 0xff5a
return ch + 10 - 0xff41 ;
|
public class AbstractHeaderFile { /** * this method will be called to init the database - file */
protected void createFile ( ) throws FileLockException , IOException { } }
|
openChannel ( ) ; filledUpTo = 0 ; accessFile . setLength ( DEFAULT_SIZE ) ; size = DEFAULT_SIZE ; filledUpTo = HEADER_SIZE ; writeHeader ( ) ;
|
public class ElemCallTemplate { /** * This after the template ' s children have been composed . */
public void endCompose ( StylesheetRoot sroot ) throws TransformerException { } }
|
int length = getParamElemCount ( ) ; for ( int i = 0 ; i < length ; i ++ ) { ElemWithParam ewp = getParamElem ( i ) ; ewp . endCompose ( sroot ) ; } super . endCompose ( sroot ) ;
|
public class Util { /** * Releases a temporary buffer by returning to the cache or freeing it . If
* returning to the cache then insert it at the end . This makes it
* suitable for scatter / gather operations where the buffers are returned to
* cache in same order that they were obtained . */
static void offerLastTemporaryDirectBuffer ( ByteBuffer buf ) { } }
|
assert buf != null ; BufferCache cache = bufferCache . get ( ) ; if ( ! cache . offerLast ( buf ) ) { // cache is full
free ( buf ) ; }
|
public class RatingAPI { /** * Add a new rating of the user to the object . The rating can be one of many
* different types . For more details see the area .
* Ratings can be changed by posting a new rating , and deleted by doing a
* DELETE .
* @ param reference
* The reference to the object the rating should be created on
* @ param type
* The type of the rating
* @ param value
* The value for the rating
* @ return The id of the newly created rating
* @ see RatingValue */
public int createRating ( Reference reference , RatingType type , int value ) { } }
|
return getResourceFactory ( ) . getApiResource ( "/rating/" + reference . toURLFragment ( ) + type ) . entity ( Collections . singletonMap ( "value" , value ) , MediaType . APPLICATION_JSON_TYPE ) . post ( RatingCreateResponse . class ) . getId ( ) ;
|
public class LottieCompositionFactory { /** * Parse an animation from src / main / assets . It is recommended to use { @ link # fromRawRes ( Context , int ) } instead .
* The asset file name will be used as a cache key so future usages won ' t have to parse the json again .
* However , if your animation has images , you may package the json and images as a single flattened zip file in assets .
* @ see # fromZipStream ( ZipInputStream , String ) */
public static LottieTask < LottieComposition > fromAsset ( Context context , final String fileName ) { } }
|
// Prevent accidentally leaking an Activity .
final Context appContext = context . getApplicationContext ( ) ; return cache ( fileName , new Callable < LottieResult < LottieComposition > > ( ) { @ Override public LottieResult < LottieComposition > call ( ) { return fromAssetSync ( appContext , fileName ) ; } } ) ;
|
public class CmsListMetadata { /** * Returns the html code for the action bar . < p >
* @ return html code */
public String htmlActionBar ( ) { } }
|
StringBuffer html = new StringBuffer ( 1024 ) ; html . append ( "<td class='misc'>\n" ) ; html . append ( "\t<div>\n" ) ; Iterator < CmsListItemDetails > itDetails = m_itemDetails . elementList ( ) . iterator ( ) ; while ( itDetails . hasNext ( ) ) { I_CmsListAction detailAction = itDetails . next ( ) . getAction ( ) ; html . append ( "\t\t" ) ; html . append ( detailAction . buttonHtml ( ) ) ; if ( itDetails . hasNext ( ) ) { html . append ( " " ) ; } html . append ( "\n" ) ; } Iterator < I_CmsListAction > itActions = m_indepActions . elementList ( ) . iterator ( ) ; while ( itActions . hasNext ( ) ) { I_CmsListAction indepAction = itActions . next ( ) ; html . append ( "\t\t" ) ; html . append ( " " ) ; html . append ( indepAction . buttonHtml ( ) ) ; html . append ( "\n" ) ; } html . append ( "\t</div>\n" ) ; html . append ( "</td>\n" ) ; return html . toString ( ) ;
|
public class JwkVerifyingJwtAccessTokenConverter { /** * Decodes and validates the supplied JWT followed by signature verification
* before returning the Claims from the JWT Payload .
* @ param token the JSON Web Token
* @ return a < code > Map < / code > of the JWT Claims
* @ throws JwkException if the JWT is invalid or if the JWS could not be verified */
@ Override protected Map < String , Object > decode ( String token ) { } }
|
Map < String , String > headers = this . jwtHeaderConverter . convert ( token ) ; // Validate " kid " header
String keyIdHeader = headers . get ( KEY_ID ) ; if ( keyIdHeader == null ) { throw new InvalidTokenException ( "Invalid JWT/JWS: " + KEY_ID + " is a required JOSE Header" ) ; } JwkDefinitionSource . JwkDefinitionHolder jwkDefinitionHolder = this . jwkDefinitionSource . getDefinitionLoadIfNecessary ( keyIdHeader ) ; if ( jwkDefinitionHolder == null ) { throw new InvalidTokenException ( "Invalid JOSE Header " + KEY_ID + " (" + keyIdHeader + ")" ) ; } JwkDefinition jwkDefinition = jwkDefinitionHolder . getJwkDefinition ( ) ; // Validate " alg " header
String algorithmHeader = headers . get ( ALGORITHM ) ; if ( algorithmHeader == null ) { throw new InvalidTokenException ( "Invalid JWT/JWS: " + ALGORITHM + " is a required JOSE Header" ) ; } if ( jwkDefinition . getAlgorithm ( ) != null && ! algorithmHeader . equals ( jwkDefinition . getAlgorithm ( ) . headerParamValue ( ) ) ) { throw new InvalidTokenException ( "Invalid JOSE Header " + ALGORITHM + " (" + algorithmHeader + ")" + " does not match algorithm associated to JWK with " + KEY_ID + " (" + keyIdHeader + ")" ) ; } // Verify signature
SignatureVerifier verifier = jwkDefinitionHolder . getSignatureVerifier ( ) ; Jwt jwt = JwtHelper . decode ( token ) ; jwt . verifySignature ( verifier ) ; Map < String , Object > claims = this . jsonParser . parseMap ( jwt . getClaims ( ) ) ; if ( claims . containsKey ( EXP ) && claims . get ( EXP ) instanceof Integer ) { Integer expiryInt = ( Integer ) claims . get ( EXP ) ; claims . put ( EXP , new Long ( expiryInt ) ) ; } this . getJwtClaimsSetVerifier ( ) . verify ( claims ) ; return claims ;
|
public class CompiledFEELSemanticMappings { /** * to ground to null if right = 0 */
public static Object div ( Object left , BigDecimal right ) { } }
|
return right == null || right . signum ( ) == 0 ? null : InfixOpNode . div ( left , right , null ) ;
|
public class ReservoirLongsUnion { /** * This either merges sketchIn into gadget _ or gadget _ into sketchIn . If merging into sketchIn
* with isModifiable set to false , copies elements from sketchIn first , leaving original
* unchanged .
* @ param sketchIn Sketch with new samples from which to draw
* @ param isModifiable Flag indicating whether sketchIn can be modified ( e . g . if it was rebuild
* from Memory ) */
private void twoWayMergeInternal ( final ReservoirLongsSketch sketchIn , final boolean isModifiable ) { } }
|
if ( sketchIn . getN ( ) <= sketchIn . getK ( ) ) { twoWayMergeInternalStandard ( sketchIn ) ; } else if ( gadget_ . getN ( ) < gadget_ . getK ( ) ) { // merge into sketchIn , so swap first
final ReservoirLongsSketch tmpSketch = gadget_ ; gadget_ = ( isModifiable ? sketchIn : sketchIn . copy ( ) ) ; twoWayMergeInternalStandard ( tmpSketch ) ; } else if ( sketchIn . getImplicitSampleWeight ( ) < ( gadget_ . getN ( ) / ( ( double ) ( gadget_ . getK ( ) - 1 ) ) ) ) { // implicit weights in sketchIn are light enough to merge into gadget
twoWayMergeInternalWeighted ( sketchIn ) ; } else { // Use next next line for an assert / exception ?
// gadget _ . getImplicitSampleWeight ( ) < sketchIn . getN ( ) / ( ( double ) ( sketchIn . getK ( ) - 1 ) ) )
// implicit weights in gadget are light enough to merge into sketchIn , so swap first
final ReservoirLongsSketch tmpSketch = gadget_ ; gadget_ = ( isModifiable ? sketchIn : sketchIn . copy ( ) ) ; twoWayMergeInternalWeighted ( tmpSketch ) ; }
|
public class DispatchHttpChallengeFactory { /** * public until unit test is moved */
public HttpChallengeFactory lookup ( String authScheme ) { } }
|
HttpChallengeFactory result ; if ( authScheme == null ) return null ; result = challengeFactoriesByAuthScheme . get ( authScheme ) ; if ( result == null ) { if ( authScheme . startsWith ( AUTH_SCHEME_APPLICATION_PREFIX ) ) { authScheme = authScheme . replaceFirst ( AUTH_SCHEME_APPLICATION_PREFIX , "" ) ; } result = challengeFactoriesByAuthScheme . get ( authScheme ) ; } return result ;
|
public class EquivalencerServiceImpl { /** * { @ inheritDoc } */
@ Override public List < NamespaceValue > findEquivalences ( NamespaceValue sourceNamespaceValue ) throws EquivalencerException { } }
|
Map < org . openbel . framework . common . model . Namespace , String > equivalenceMap ; SkinnyUUID uuid ; if ( sourceNamespaceValue . getEquivalence ( ) != null ) { uuid = convert ( sourceNamespaceValue . getEquivalence ( ) ) ; equivalenceMap = equivalencer . equivalence ( uuid ) ; } else { final Namespace sourceNs = sourceNamespaceValue . getNamespace ( ) ; final String sourceValue = sourceNamespaceValue . getValue ( ) ; final org . openbel . framework . common . model . Namespace sns = convert ( sourceNs ) ; equivalenceMap = equivalencer . equivalence ( sns , sourceValue ) ; uuid = equivalencer . getUUID ( sns , sourceValue ) ; } EquivalenceId eq = convert ( uuid ) ; final List < NamespaceValue > equivalentNsValues = sizedArrayList ( equivalenceMap . size ( ) ) ; for ( Map . Entry < org . openbel . framework . common . model . Namespace , String > equivalence : equivalenceMap . entrySet ( ) ) { final NamespaceValue equivalentNsValue = new NamespaceValue ( ) ; equivalentNsValue . setNamespace ( convert ( equivalence . getKey ( ) ) ) ; equivalentNsValue . setValue ( equivalence . getValue ( ) ) ; equivalentNsValue . setEquivalence ( eq ) ; equivalentNsValues . add ( equivalentNsValue ) ; } return equivalentNsValues ;
|
public class PlannerWriter { /** * This method writes resource data to a Planner file . */
private void writeResources ( ) { } }
|
Resources resources = m_factory . createResources ( ) ; m_plannerProject . setResources ( resources ) ; List < net . sf . mpxj . planner . schema . Resource > resourceList = resources . getResource ( ) ; for ( Resource mpxjResource : m_projectFile . getResources ( ) ) { net . sf . mpxj . planner . schema . Resource plannerResource = m_factory . createResource ( ) ; resourceList . add ( plannerResource ) ; writeResource ( mpxjResource , plannerResource ) ; }
|
public class SipCall { /** * This basic method is used to initiate an outgoing call . That is , it applies to the scenario
* where a UAC is originating a call to the network . There are two ways to make an outgoing call :
* 1 ) Use SipPhone . createSipCall ( ) and then call this method , when you need to see
* intermediate / provisional responses received - you will have to handle each yourself . Or , 2 ) use
* one of the SipPhone . makeCall ( ) methods when you want to establish an outgoing call without
* worrying about the call establishment details ( TRYING , authentication challenge , etc . ) .
* Regardless , all received responses are collected , so you will be able to see
* intermediate / provisional responses received ( albeit after the fact , with makeCall ( ) ) .
* This method returns when the request message has been sent out . Your calling program must
* subsequently call the waitOutgoingCallResponse ( ) method ( one or more times ) to get the
* result ( s ) , and optionally at some point , waitForAnswer ( ) if you ' re no longer interested in
* processing intermediate responses .
* @ param fromUri An URI string ( ex : sip : bob @ 192.0.2.4 ) , or null to use the default ' from ' address
* ( me ) specified when the SipPhone object was created ( SipStack . createSipPhone ( ) ) .
* @ param toUri The URI ( sip : bob @ nist . gov ) to which the call should be directed
* @ param viaNonProxyRoute Indicates whether to route the INVITE via Proxy or some other route . If
* null , route the call to the Proxy that was specified when the SipPhone object was
* created ( SipStack . createSipPhone ( ) ) . Else route it to the given node , which is specified
* as " hostaddress : port ; parms / transport " i . e . 129.1.22.333:5060 ; lr / UDP .
* @ return true if the message was successfully sent , false otherwise . */
public boolean initiateOutgoingCall ( String fromUri , String toUri , String viaNonProxyRoute ) { } }
|
return initiateOutgoingCall ( fromUri , toUri , viaNonProxyRoute , null ) ;
|
public class ECDSAAlgorithm { /** * Visible for testing */
byte [ ] JOSEToDER ( byte [ ] joseSignature ) throws SignatureException { } }
|
if ( joseSignature . length != ecNumberSize * 2 ) { throw new SignatureException ( "Invalid JOSE signature format." ) ; } // Retrieve R and S number ' s length and padding .
int rPadding = countPadding ( joseSignature , 0 , ecNumberSize ) ; int sPadding = countPadding ( joseSignature , ecNumberSize , joseSignature . length ) ; int rLength = ecNumberSize - rPadding ; int sLength = ecNumberSize - sPadding ; int length = 2 + rLength + 2 + sLength ; if ( length > 255 ) { throw new SignatureException ( "Invalid JOSE signature format." ) ; } final byte [ ] derSignature ; int offset ; if ( length > 0x7f ) { derSignature = new byte [ 3 + length ] ; derSignature [ 1 ] = ( byte ) 0x81 ; offset = 2 ; } else { derSignature = new byte [ 2 + length ] ; offset = 1 ; } // DER Structure : http : / / crypto . stackexchange . com / a / 1797
// Header with signature length info
derSignature [ 0 ] = ( byte ) 0x30 ; derSignature [ offset ++ ] = ( byte ) ( length & 0xff ) ; // Header with " min R " number length
derSignature [ offset ++ ] = ( byte ) 0x02 ; derSignature [ offset ++ ] = ( byte ) rLength ; // R number
if ( rPadding < 0 ) { // Sign
derSignature [ offset ++ ] = ( byte ) 0x00 ; System . arraycopy ( joseSignature , 0 , derSignature , offset , ecNumberSize ) ; offset += ecNumberSize ; } else { int copyLength = Math . min ( ecNumberSize , rLength ) ; System . arraycopy ( joseSignature , rPadding , derSignature , offset , copyLength ) ; offset += copyLength ; } // Header with " min S " number length
derSignature [ offset ++ ] = ( byte ) 0x02 ; derSignature [ offset ++ ] = ( byte ) sLength ; // S number
if ( sPadding < 0 ) { // Sign
derSignature [ offset ++ ] = ( byte ) 0x00 ; System . arraycopy ( joseSignature , ecNumberSize , derSignature , offset , ecNumberSize ) ; } else { System . arraycopy ( joseSignature , ecNumberSize + sPadding , derSignature , offset , Math . min ( ecNumberSize , sLength ) ) ; } return derSignature ;
|
public class Index { /** * Update a new api key
* @ param params the list of parameters for this key . Defined by a JSONObject that
* can contains the following values :
* - acl : array of string
* - indices : array of string
* - validity : int
* - referers : array of string
* - description : string
* - maxHitsPerQuery : integer
* - queryParameters : string
* - maxQueriesPerIPPerHour : integer */
public JSONObject updateApiKey ( String key , JSONObject params ) throws AlgoliaException { } }
|
return this . updateApiKey ( key , params , RequestOptions . empty ) ;
|
public class GetIntegrationsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetIntegrationsRequest getIntegrationsRequest , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( getIntegrationsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getIntegrationsRequest . getApiId ( ) , APIID_BINDING ) ; protocolMarshaller . marshall ( getIntegrationsRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( getIntegrationsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class AbstractPicker { /** * Convert text of textfield to Date
* @ return Date shown at textfield or new Date if failed to parse */
public Date getDate ( ) { } }
|
Date date = new Date ( ) ; try { String dateText = field . getText ( ) ; SimpleDateFormat fmt = new SimpleDateFormat ( format ) ; date = fmt . parse ( dateText ) ; } catch ( Exception e ) { } return date ;
|
public class FileUtils { /** * Returns the ( lowercase ) file extension for a specified file .
* @ param fileName the file name to retrieve the file extension from .
* @ return the file extension . */
@ Nullable public static String getFileExtension ( @ NotNull String fileName ) { } }
|
@ Nullable final String fileExt = FilenameUtils . getExtension ( fileName ) ; return StringUtils . isNoneEmpty ( fileExt ) ? StringUtils . lowerCase ( fileExt ) : null ;
|
public class Overrider { /** * Return override value
* @ param operation name of the operation
* @ return override value */
public Object getOverride ( String operation ) { } }
|
Object result = null ; if ( this . overrideOnce . containsKey ( operation ) == true ) { result = this . overrideOnce . get ( operation ) ; this . overrideOnce . remove ( operation ) ; } else if ( this . override . containsKey ( operation ) == true ) { result = this . override . get ( operation ) ; } return result ;
|
public class AbstractClassFileWriter { /** * Generates a service discovery for the given class name and file .
* @ param className The class name
* @ param generatedFile The generated file
* @ throws IOException An exception if an error occurs */
protected void generateServiceDescriptor ( String className , GeneratedFile generatedFile ) throws IOException { } }
|
CharSequence contents = generatedFile . getTextContent ( ) ; if ( contents != null ) { String [ ] entries = contents . toString ( ) . split ( "\\n" ) ; if ( ! Arrays . asList ( entries ) . contains ( className ) ) { try ( BufferedWriter w = new BufferedWriter ( generatedFile . openWriter ( ) ) ) { w . newLine ( ) ; w . write ( className ) ; } } } else { try ( BufferedWriter w = new BufferedWriter ( generatedFile . openWriter ( ) ) ) { w . write ( className ) ; } }
|
public class CKMSQuantiles { /** * Try to remove extraneous items from the set of sampled items . This checks
* if an item is unnecessary based on the desired error bounds , and merges
* it with the adjacent item if it is . */
private void compress ( ) { } }
|
if ( sample . size ( ) < 2 ) { return ; } ListIterator < Item > it = sample . listIterator ( ) ; int removed = 0 ; Item prev = null ; Item next = it . next ( ) ; while ( it . hasNext ( ) ) { prev = next ; next = it . next ( ) ; if ( prev . g + next . g + next . delta <= allowableError ( it . previousIndex ( ) ) ) { next . g += prev . g ; // Remove prev . it . remove ( ) kills the last thing returned .
it . previous ( ) ; it . previous ( ) ; it . remove ( ) ; // it . next ( ) is now equal to next , skip it back forward again
it . next ( ) ; removed ++ ; } }
|
public class ShanksAgentBayesianReasoningCapability { /** * To know the full status of a node
* @ param bn
* @ param nodeName
* @ return hashmap in format [ status , hypothesis ]
* @ throws ShanksException */
public static HashMap < String , Float > getNodeStatesHypotheses ( ProbabilisticNetwork bn , String nodeName ) throws ShanksException { } }
|
ProbabilisticNode node = ShanksAgentBayesianReasoningCapability . getNode ( bn , nodeName ) ; HashMap < String , Float > result = new HashMap < String , Float > ( ) ; int statesNum = node . getStatesSize ( ) ; for ( int i = 0 ; i < statesNum ; i ++ ) { String status = node . getStateAt ( i ) ; Float hypothesis = node . getMarginalAt ( i ) ; result . put ( status , hypothesis ) ; } return result ;
|
public class SolverAggregatorInterface { /** * Disconnects from the aggregator , destroying any sessions and executor
* filters that are already created . Resets the connection state . */
protected void _disconnect ( ) { } }
|
this . connected = false ; IoSession currentSession = this . session ; if ( currentSession != null ) { if ( ! currentSession . isClosing ( ) ) { log . info ( "Closing connection to aggregator at {} (waiting {}ms)." , currentSession . getRemoteAddress ( ) , Long . valueOf ( this . connectionTimeout ) ) ; currentSession . close ( true ) ; } this . session = null ; this . sentHandshake = null ; this . receivedHandshake = null ; this . sentSubscription = null ; this . receivedSubscription = null ; for ( ConnectionListener listener : this . connectionListeners ) { listener . connectionInterrupted ( this ) ; } }
|
public class ParserOption { /** * { @ inheritDoc } */
public Statement generateSetupStatement ( ) { } }
|
return new Statement ( ) { @ Override public void evaluate ( ) throws Throwable { AunitRuntime . setParserFactory ( new ParserFactory ( parserClass , failOnError , parserSetup ) ) ; } } ;
|
public class PlatformUtils { /** * True if this JVM is running on a Mac .
* @ return true if this JVM is running on a Mac . */
public static boolean isMac ( ) { } }
|
if ( System . getProperty ( SEA_GLASS_OVERRIDE_OS_NAME ) != null ) { return System . getProperty ( SEA_GLASS_OVERRIDE_OS_NAME ) . startsWith ( "Mac OS" ) ; } return System . getProperty ( "os.name" ) . startsWith ( "Mac OS" ) ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.