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 ...
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 ( ) , filtere...
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 , yo...
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...
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 ...
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 s...
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 fi...
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 ( comm...
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 DirectedNodePropertyTyp...
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...
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...
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 o...
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...
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 , S...
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...
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 ( ...
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 ...
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 * V...
JsPropertyMap < Object > vueComponentInstancePropertyMap = Js . cast ( vueComponentInstance ) ; JsPropertyMap < Object > javaComponentClassInstancePropertyMap = Js . cast ( javaComponentClassInstance ) ; javaComponentClassInstancePropertyMap . forEach ( key -> { try { if ( ! javaComponentClassInstancePropertyMap . has ...
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 pe...
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 ...
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 ) ...
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 # D...
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 addOperatorToR...
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 sVa...
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 ...
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 ) ) ) { ...
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 ...
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...
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 . getBasicMessag...
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 ArrayLis...
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 wi...
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 pas...
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 ( ...
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 add...
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 ( ) , TRAN...
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 *...
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...
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 set...
this . sequenceStorage = proxyLoader ; if ( proxyLoader instanceof FeaturesKeyWordInterface ) { this . setFeaturesKeyWord ( ( FeaturesKeyWordInterface ) sequenceStorage ) ; } if ( proxyLoader instanceof DatabaseReferenceInterface ) { this . setDatabaseReferences ( ( DatabaseReferenceInterface ) sequenceStorage ) ; } if...
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 ...
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...
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 ) ) ; } ...
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 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 reque...
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 ...
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 ( "Han...
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 > fals...
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 ...
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...
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 ... m...
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...
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 ...
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 u...
// 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 : a...
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_S...
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 > B...
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...
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 // WCo...
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 d...
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 ) ) ) ; ...
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 ...
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 ] ...
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 methodNam...
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 convertReflection...
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 ( ...
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 ent...
// 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 ma...
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 >...
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 f...
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 ...
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 offerLas...
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...
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 ...
// 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 ( ) ;...
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 ...
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 . JwkDefinitio...
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 ...
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 ( ) ) ; twoWayMergeInternal...
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 = cha...
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 = ...
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 pla...
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 * in...
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 . le...
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 * -...
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 ) ; prot...
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 , Gener...
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 ....
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 ( ) ) ) { nex...
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 nod...
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 ....
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 ...
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" ) ;