signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class HttpRequestUtils { /** * Check if a parameter exists . * @ param request the HTTP request * @ param name the parameter name * @ return whether the parameter exists */ public static boolean doesParameterExist ( final HttpServletRequest request , final String name ) { } }
val parameter = request . getParameter ( name ) ; if ( StringUtils . isBlank ( parameter ) ) { LOGGER . error ( "Missing request parameter: [{}]" , name ) ; return false ; } LOGGER . debug ( "Found provided request parameter [{}]" , name ) ; return true ;
public class AbstractGitFlowMojo { /** * Checks if branch name is acceptable . * @ param branchName * Branch name to check . * @ return < code > true < / code > when name is valid , < code > false < / code > * otherwise . * @ throws MojoFailureException * @ throws CommandLineException */ protected boolean v...
CommandResult r = executeGitCommandExitCode ( "check-ref-format" , "--allow-onelevel" , branchName ) ; return r . getExitCode ( ) == SUCCESS_EXIT_CODE ;
public class Main { /** * TODO : make level an enum */ public void find ( String level , String cp1 , String cp2 ) throws IOException { } }
if ( level == null || cp1 == null ) { throw new IllegalArgumentException ( "level and cp1 are required" ) ; } if ( cp2 == null ) { cp2 = cp1 ; } int levelFlag ; if ( "class" . equals ( level ) ) { levelFlag = DepHandler . LEVEL_CLASS ; } else if ( "jar" . equals ( level ) ) { levelFlag = DepHandler . LEVEL_JAR ; } else...
public class AbstractQueryPersonAttributeDao { /** * Configuration convenience same as passing the given { @ code Set } as the * keys in the { @ link # setCaseInsensitiveResultAttributes ( java . util . Map ) } * { @ code Map } and implicitly accepting the default canonicalization mode * for each . Note that this...
if ( caseInsensitiveResultAttributes == null || caseInsensitiveResultAttributes . isEmpty ( ) ) { setCaseInsensitiveResultAttributes ( null ) ; } else { final Map < String , CaseCanonicalizationMode > asMap = new HashMap < > ( ) ; for ( final String attrib : caseInsensitiveResultAttributes ) { asMap . put ( attrib , nu...
public class BaseBigtableTableAdminClient { /** * Lists all tables served from a specified instance . * < p > Sample code : * < pre > < code > * try ( BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient . create ( ) ) { * InstanceName parent = InstanceName . of ( " [ PROJECT...
ListTablesRequest request = ListTablesRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . build ( ) ; return listTables ( request ) ;
public class IdpMetadataGenerator { /** * List of bindings to be included in the generated metadata for Web Single Sign - On . Ordering of bindings affects * inclusion in the generated metadata . * Supported values are : " post " ( or * " urn : oasis : names : tc : SAML : 2.0 : bindings : HTTP - POST " ) . * Th...
if ( bindingsSSO == null ) { this . bindingsSSO = Collections . emptyList ( ) ; } else { this . bindingsSSO = bindingsSSO ; }
public class SoftCache { /** * Looks up and returns the value associated with the supplied key . */ public V get ( K key ) { } }
V value = null ; SoftReference < V > ref = _map . get ( key ) ; if ( ref != null ) { value = ref . get ( ) ; if ( value == null ) { _map . remove ( key ) ; } } return value ;
public class KinesisDataFetcher { /** * Updates the last discovered shard of a subscribed stream ; only updates if the update is valid . */ public void advanceLastDiscoveredShardOfStream ( String stream , String shardId ) { } }
String lastSeenShardIdOfStream = this . subscribedStreamsToLastDiscoveredShardIds . get ( stream ) ; // the update is valid only if the given shard id is greater // than the previous last seen shard id of the stream if ( lastSeenShardIdOfStream == null ) { // if not previously set , simply put as the last seen shard id...
public class Filters { /** * Specify one or more < a > KeyUsage < / a > extension values . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setKeyUsage ( java . util . Collection ) } or { @ link # withKeyUsage ( java . util . Collection ) } if you want to over...
if ( this . keyUsage == null ) { setKeyUsage ( new java . util . ArrayList < String > ( keyUsage . length ) ) ; } for ( String ele : keyUsage ) { this . keyUsage . add ( ele ) ; } return this ;
public class AccessControlClient { /** * Return the most specific matching rule for the requested document . * @ param url * URL of the requested document . * @ param captureDate * Date the document was archived . * @ param retrievalDate * Date of retrieval ( usually now ) . * @ param groups * Group nam...
Rule bestRule = null ; for ( String who : groups ) { Rule rule = getRule ( url , captureDate , retrievalDate , who ) ; /* We compare policies not the rules themselves as * a user should have full access to something one of their * groups has access to , even if another group they are * member of does not . */ if ...
public class DefaultValuePopulator { /** * Populates an entity with default values * @ param entity populated entity */ public void populate ( Entity entity ) { } }
stream ( entity . getEntityType ( ) . getAllAttributes ( ) ) . filter ( Attribute :: hasDefaultValue ) . forEach ( attr -> populateDefaultValues ( entity , attr ) ) ;
public class TimeZoneFormat { /** * Parses the localized GMT pattern string and initialize * localized gmt pattern fields including { { @ link # _ gmtPatternTokens } . * This method must be also called at deserialization time . * @ param gmtPattern the localized GMT pattern string such as " GMT { 0 } " * @ thro...
// This implementation not perfect , but sufficient practically . int idx = gmtPattern . indexOf ( "{0}" ) ; if ( idx < 0 ) { throw new IllegalArgumentException ( "Bad localized GMT pattern: " + gmtPattern ) ; } _gmtPattern = gmtPattern ; _gmtPatternPrefix = unquote ( gmtPattern . substring ( 0 , idx ) ) ; _gmtPatternS...
public class CassandraDataHandlerBase { /** * Builds the thrift super column . * @ param timestamp2 * the timestamp2 * @ param m * the m * @ param id * the id * @ param superColumn * the super column * @ param superColumnName * the super column name * @ param obj * the obj * @ return the map *...
Map < String , Object > thriftSuperColumns = null ; if ( m . isCounterColumnType ( ) ) { thriftSuperColumns = buildThriftCounterSuperColumn ( m . getTableName ( ) , superColumnName , superColumn , obj ) ; } else { thriftSuperColumns = buildThriftSuperColumn ( m . getTableName ( ) , superColumnName , timestamp2 , superC...
public class AbstractWComponent { /** * { @ inheritDoc } */ @ Override public String getBaseUrl ( ) { } }
Environment env = getEnvironment ( ) ; String baseUrl = null ; if ( env != null ) { baseUrl = env . getBaseUrl ( ) ; } return ( baseUrl == null ? "" : baseUrl ) ;
public class LogoController { /** * Get a file from the logo subdirectory of the filestore */ @ GetMapping ( "/logo/{name}.{extension}" ) public void getLogo ( OutputStream out , @ PathVariable ( "name" ) String name , @ PathVariable ( "extension" ) String extension , HttpServletResponse response ) throws IOException {...
File f = fileStore . getFileUnchecked ( "/logo/" + name + "." + extension ) ; if ( ! f . exists ( ) ) { response . sendError ( HttpServletResponse . SC_NOT_FOUND ) ; return ; } // Try to get contenttype from file String contentType = URLConnection . guessContentTypeFromName ( f . getName ( ) ) ; if ( contentType != nul...
public class Entity { /** * 获得字符串值 < br > * 支持Clob 、 Blob 、 RowId * @ param field 字段名 * @ param charset 编码 * @ return 字段对应值 * @ since 3.0.6 */ public String getStr ( String field , Charset charset ) { } }
final Object obj = get ( field ) ; if ( obj instanceof Clob ) { return SqlUtil . clobToStr ( ( Clob ) obj ) ; } else if ( obj instanceof Blob ) { return SqlUtil . blobToStr ( ( Blob ) obj , charset ) ; } else if ( obj instanceof RowId ) { final RowId rowId = ( RowId ) obj ; return StrUtil . str ( rowId . getBytes ( ) ,...
public class OmdbBuilder { /** * Limit the results to movies * @ return */ public OmdbBuilder setTypeMovie ( ) { } }
if ( ! ResultType . isDefault ( ResultType . MOVIE ) ) { params . add ( Param . RESULT , ResultType . MOVIE ) ; } return this ;
public class PseudoClassSpecifierChecker { /** * Add { @ code : last - child } elements . * @ see < a href = " http : / / www . w3 . org / TR / css3 - selectors / # last - child - pseudo " > < code > : last - child < / code > pseudo - class < / a > */ private void addLastChildElements ( ) { } }
for ( Node node : nodes ) { if ( DOMHelper . getNextSiblingElement ( node ) == null ) { result . add ( node ) ; } }
public class FilterModel { /** * Internal method used to lookup { @ link Filter } instances by < code > filterExpression < / code > . * @ param filterExpression the filter expression whose filters to find * @ return < code > null < / code > if no matching { @ link Filter } objects are found ; a { @ link List } of {...
assert filterExpression != null ; assert ! filterExpression . equals ( "" ) ; /* todo : perf . caching or abstraction to make this faster */ ArrayList /* < Filter > */ filters = new ArrayList /* < Filter > */ ( ) ; for ( int i = 0 ; i < _filters . size ( ) ; i ++ ) { assert _filters . get ( i ) instanceof Filter ; Filt...
public class SchemaStoreItemStream { /** * Add a new schema defintion to the store */ void addSchema ( JMFSchema schema , Transaction tran ) throws MessageStoreException { } }
addItem ( new SchemaStoreItem ( schema ) , tran ) ;
public class NetworkEntryEvent { /** * Add an Active Participant to this message representing the node doing * the network entry * @ param userId The Active Participant ' s User ID * @ param altUserId The Active Participant ' s Alternate UserID * @ param userName The Active Participant ' s UserName * @ param ...
addActiveParticipant ( userId , altUserId , userName , false , null , networkId ) ;
public class SharedPreferencesHelper { /** * Retrieve an Integer value from the preferences . * @ param key The name of the preference to retrieve * @ param defaultValue Value to return if this preference does not exist * @ return the preference value if it exists , or defaultValue . */ public Integer loadPrefere...
Integer value = defaultValue ; if ( hasPreference ( key ) ) { value = getSharedPreferences ( ) . getInt ( key , 0 ) ; } logLoad ( key , value ) ; return value ;
public class Request { /** * Send this resource request asynchronously , with the given JSON object as the request body . * If no Content - Type header was set , this method will set it to " application / json " . * @ param context The context that will be passed to authentication listener . * @ param json The JS...
setContext ( context ) ; super . send ( json , listener ) ;
public class ReportingController { /** * Report on the features of a layer with map image and legend , data coming from the cache . * @ param reportName name of the report * @ param format format for the report ( eg " pdf " ) * @ param layerId id of the layer * @ param key cache key for data * @ param request...
try { VectorLayer layer = configurationService . getVectorLayer ( layerId ) ; if ( null != layer ) { ReportingCacheContainer container = cacheManager . get ( layer , CacheCategory . RASTER , key , ReportingCacheContainer . class ) ; addParameters ( model , request ) ; if ( null != container ) { model . addAttribute ( "...
public class CRest { /** * < p > Adds given property to the { @ link org . codegist . crest . CRestConfig } that will be passed to all < b > CRest < / b > components . < / p > * @ param name property name * @ param value property value * @ return a CRestBuilder instance * @ see org . codegist . crest . CRestBui...
return new CRestBuilder ( ) . property ( name , value ) ;
public class FIODataPoint { /** * Return the data point field with the corresponding key * @ param key name of the field in the data point * @ return the field value */ public String getByKey ( String key ) { } }
String out = "" ; if ( key . equals ( "time" ) ) return time ( ) ; if ( key . contains ( "Time" ) ) { DateFormat dfm = new SimpleDateFormat ( "HH:mm:ss" ) ; dfm . setTimeZone ( TimeZone . getTimeZone ( timezone ) ) ; out = dfm . format ( Long . parseLong ( String . valueOf ( this . datapoint . get ( key ) ) ) * 1000 ) ...
public class AWSIoTAnalyticsClient { /** * Retrieves information about a data set . * @ param describeDatasetRequest * @ return Result of the DescribeDataset operation returned by the service . * @ throws InvalidRequestException * The request was not valid . * @ throws ResourceNotFoundException * A resource...
request = beforeClientExecution ( request ) ; return executeDescribeDataset ( request ) ;
public class SubsetVec { /** * Write out K / V pairs */ @ Override protected AutoBuffer writeAll_impl ( AutoBuffer ab ) { } }
ab . putKey ( _subsetRowsKey ) ; return super . writeAll_impl ( ab ) ;
public class DrawerUIUtils { /** * helper to set the vertical padding to the DrawerItems * this is required because on API Level 17 the padding is ignored which is set via the XML * @ param v */ public static void setDrawerVerticalPadding ( View v ) { } }
int verticalPadding = v . getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . material_drawer_vertical_padding ) ; v . setPadding ( verticalPadding , 0 , verticalPadding , 0 ) ;
public class Filtering { /** * Creates an iterator yielding values from the source array up until the * passed predicate doesn ' t match . E . g : * < code > dropWhile ( [ 2 , 4 , 3 , 6 ] , isOdd ) - > [ 2 , 4 ] < / code > * @ param < E > the array element type * @ param array the source array * @ param predi...
return new FilteringIterator < E > ( new ArrayIterator < E > ( array ) , new DropWhile < E > ( predicate ) ) ;
public class ManagedExecutorBuilderImpl { /** * Fail with error indentifying the overlap ( s ) in context types between : * cleared , propagated . * @ throws IllegalStateException identifying the overlap . */ private void failOnOverlapOfClearedPropagated ( ) { } }
HashSet < String > overlap = new HashSet < String > ( cleared ) ; overlap . retainAll ( propagated ) ; if ( overlap . isEmpty ( ) ) // only possible if builder is concurrently modified during build throw new ConcurrentModificationException ( ) ; throw new IllegalStateException ( Tr . formatMessage ( tc , "CWWKC1151.con...
public class JsGeometryMergeService { /** * Register a { @ link GeometryMergeStopHandler } to listen to events that signal the merging process has ended * ( either through stop or cancel ) . * @ param handler * The { @ link GeometryMergeStopHandler } to add as listener . * @ return The registration of the handl...
org . geomajas . plugin . editing . client . merge . event . GeometryMergeStopHandler h ; h = new org . geomajas . plugin . editing . client . merge . event . GeometryMergeStopHandler ( ) { public void onGeometryMergingStop ( GeometryMergeStopEvent event ) { org . geomajas . plugin . editing . jsapi . client . merge . ...
public class HttpClientResponseImpl { /** * Parses the timeout value from the HTTP keep alive header ( with name { @ link # KEEP _ ALIVE _ HEADER _ NAME } ) as described in * < a href = " http : / / tools . ietf . org / id / draft - thomson - hybi - http - timeout - 01 . html " > this spec < / a > * @ return The ke...
String keepAliveHeader = nettyResponse . headers ( ) . get ( KEEP_ALIVE_HEADER_NAME ) ; if ( null != keepAliveHeader && ! keepAliveHeader . isEmpty ( ) ) { String [ ] pairs = PATTERN_COMMA . split ( keepAliveHeader ) ; if ( pairs != null ) { for ( String pair : pairs ) { String [ ] nameValue = PATTERN_EQUALS . split ( ...
public class MapBindTransformation { /** * Generate serialize on jackson internal . * @ param context the context * @ param methodBuilder the method builder * @ param serializerName the serializer name * @ param beanClass the bean class * @ param beanName the bean name * @ param property the property * @ ...
// define key and value type ParameterizedTypeName mapTypeName = ( ParameterizedTypeName ) property . getPropertyType ( ) . getTypeName ( ) ; TypeName keyTypeName = mapTypeName . typeArguments . get ( 0 ) ; TypeName valueTypeName = mapTypeName . typeArguments . get ( 1 ) ; // @ formatter : off methodBuilder . beginCont...
public class InstanceChangeStreamListenerImpl { /** * Returns the latest change events for a given namespace . * @ param namespace the namespace to get events for . * @ return the latest change events for a given namespace . */ public Map < BsonValue , ChangeEvent < BsonDocument > > getEventsForNamespace ( final Mo...
this . instanceLock . readLock ( ) . lock ( ) ; final NamespaceChangeStreamListener streamer ; try { streamer = nsStreamers . get ( namespace ) ; } finally { this . instanceLock . readLock ( ) . unlock ( ) ; } if ( streamer == null ) { return new HashMap < > ( ) ; } return streamer . getEvents ( ) ;
public class AzureInstanceActionDaemon { /** * Start the instance */ private void start ( final ResourceInstanceEntity instance ) { } }
azure . start ( instance . getProviderInstanceId ( ) ) ; instance . setState ( ResourceInstanceState . PROVISIONING ) ;
public class SmileConverter { /** * Returns a dataset where the response column is nominal . E . g . to be used for a classification */ public AttributeDataset nominalDataset ( int responseColIndex , int ... variablesColIndices ) { } }
return dataset ( table . numberColumn ( responseColIndex ) , AttributeType . NOMINAL , table . columns ( variablesColIndices ) ) ;
public class MapUtils { /** * Returns a map where the ith element of keys maps to the ith element of * values . * @ param keys * @ param values * @ return */ public static < A , B > Map < A , B > fromLists ( List < A > keys , List < B > values ) { } }
Preconditions . checkArgument ( keys . size ( ) == values . size ( ) ) ; Map < A , B > map = Maps . newHashMap ( ) ; for ( int i = 0 ; i < keys . size ( ) ; i ++ ) { map . put ( keys . get ( i ) , values . get ( i ) ) ; } return map ;
public class ReservoirItemsSketch { /** * Thin wrapper around private constructor * @ param < T > data type * @ param data Reservoir items as ArrayList & lt ; T & gt ; * @ param itemsSeen Number of items presented to the sketch so far * @ param rf < a href = " { @ docRoot } / resources / dictionary . html # res...
return new ReservoirItemsSketch < > ( data , itemsSeen , rf , k ) ;
public class ExecutionEnvironment { /** * Creates a DataSet from the given iterator . Because the iterator will remain unmodified until * the actual execution happens , the type of data returned by the iterator must be given * explicitly in the form of the type information . This method is useful for cases where th...
if ( ! ( data instanceof Serializable ) ) { throw new IllegalArgumentException ( "The iterator must be serializable." ) ; } return new DataSource < X > ( this , new IteratorInputFormat < X > ( data ) , type ) ;
public class ImplicitObjectELResolver { /** * If the base object is < code > null < / code > , and the property matches * the name of a JSP implicit object , returns < code > null < / code > to * indicate that no types are ever accepted to < code > setValue ( ) < / code > . * < p > The < code > propertyResolved <...
if ( context == null ) { throw new NullPointerException ( ) ; } if ( ( base == null ) && ( "pageContext" . equals ( property ) || "pageScope" . equals ( property ) ) || "requestScope" . equals ( property ) || "sessionScope" . equals ( property ) || "applicationScope" . equals ( property ) || "param" . equals ( property...
public class Configuration { /** * Returns name of environment , such as " development " , " production " , etc . * This is a value that is usually setup with an environment variable < code > ACTIVE _ ENV < / code > . * @ return name of environment */ public static String getEnv ( ) { } }
if ( ENV == null ) { if ( ! blank ( System . getenv ( "ACTIVE_ENV" ) ) ) { ENV = System . getenv ( "ACTIVE_ENV" ) ; } if ( ! blank ( System . getProperty ( "ACTIVE_ENV" ) ) ) { ENV = System . getProperty ( "ACTIVE_ENV" ) ; } if ( ! blank ( System . getProperty ( "active_env" ) ) ) { ENV = System . getProperty ( "active...
public class Route { /** * Generate Markdown documentation for this Route . */ public StringBuffer markdown ( Schema sinput , Schema soutput ) { } }
MarkdownBuilder builder = new MarkdownBuilder ( ) ; builder . comment ( "Preview with http://jbt.github.io/markdown-editor" ) ; builder . heading1 ( _http_method , _url ) ; builder . hline ( ) ; builder . paragraph ( _summary ) ; // parameters and output tables builder . heading1 ( "Input schema: " ) ; builder . append...
public class FessMessages { /** * Add the created action message for the key ' errors . invalid _ query _ sort _ value ' with parameters . * < pre > * message : The given sort ( { 0 } ) is invalid . * < / pre > * @ param property The property name for the message . ( NotNull ) * @ param arg0 The parameter arg...
assertPropertyNotNull ( property ) ; add ( property , new UserMessage ( ERRORS_invalid_query_sort_value , arg0 ) ) ; return this ;
public class IfcRelConnectsPathElementsImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) @ Override public EList < Long > getRelatedPriorities ( ) { } }
return ( EList < Long > ) eGet ( Ifc4Package . Literals . IFC_REL_CONNECTS_PATH_ELEMENTS__RELATED_PRIORITIES , true ) ;
public class DockerContainerObjectBuilder { /** * Specifies the list of enrichers that will be used to enrich the container object . * @ param enrichers * list of enrichers that will be used to enrich the container object * @ return the current builder instance */ public DockerContainerObjectBuilder < T > withEnr...
if ( enrichers == null ) { throw new IllegalArgumentException ( "enrichers cannot be null" ) ; } this . enrichers = enrichers ; return this ;
public class FileSystemRecursiveIterator { /** * Override this method to manually filter the directories , which are recursed * into . * @ param aDirectory * The non - < code > null < / code > directory * @ return < code > true < / code > if all children of this directory should be * investigated */ @ Overrid...
return m_aRecursionFilter == null || m_aRecursionFilter . test ( aDirectory ) ;
public class JsonUnitResultMatchers { /** * Fails if selected JSON is null . */ public ResultMatcher isNotNull ( ) { } }
return new AbstractResultMatcher ( path , configuration ) { public void doMatch ( Object actual ) { isNotNull ( actual ) ; } } ;
public class DRL5Lexer { /** * $ ANTLR start " XOR _ ASSIGN " */ public final void mXOR_ASSIGN ( ) throws RecognitionException { } }
try { int _type = XOR_ASSIGN ; int _channel = DEFAULT_TOKEN_CHANNEL ; // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 180:5 : ( ' ^ = ' ) // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 180:7 : ' ^ = ' { match ( "^=" ) ; if ( state . failed ) return ; } state . ...
public class CmsDriverManager { /** * Unsubscribes all deleted resources that were deleted before the specified time stamp . < p > * @ param dbc the database context * @ param poolName the name of the database pool to use * @ param deletedTo the time stamp to which the resources have been deleted * @ throws Cms...
getSubscriptionDriver ( ) . unsubscribeAllDeletedResources ( dbc , poolName , deletedTo ) ;
public class IsaTranslations { /** * FIXME Unhack result name extraction for implicit functions */ public String hackResultName ( AFuncDeclIR func ) throws AnalysisException { } }
SourceNode x = func . getSourceNode ( ) ; if ( x . getVdmNode ( ) instanceof AImplicitFunctionDefinition ) { AImplicitFunctionDefinition iFunc = ( AImplicitFunctionDefinition ) x . getVdmNode ( ) ; return iFunc . getResult ( ) . getPattern ( ) . toString ( ) ; } throw new AnalysisException ( "Expected AFuncDeclIR in im...
public class SystemUtils { /** * Sets if wifi data should be turned on or off . Requires android . permission . CHANGE _ WIFI _ STATE in the AndroidManifest . xml of the application under test . * @ param turnedOn true if mobile wifi is to be turned on and false if not */ public void setWiFiData ( Boolean turnedOn ) ...
WifiManager wifiManager = ( WifiManager ) instrumentation . getTargetContext ( ) . getSystemService ( Context . WIFI_SERVICE ) ; try { wifiManager . setWifiEnabled ( turnedOn ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; }
public class IterableOfProtosSubject { /** * Excludes all message fields matching the given { @ link FieldDescriptor } s from the comparison . * < p > This method adds on any previous { @ link FieldScope } related settings , overriding previous * changes to ensure the specified fields are ignored recursively . All ...
return ignoringFieldDescriptors ( asList ( firstFieldDescriptor , rest ) ) ;
public class MenuDrawer { /** * Set the menu view to an explicit view . * @ param view The menu view . */ public void setMenuView ( View view ) { } }
setMenuView ( view , new LayoutParams ( LayoutParams . MATCH_PARENT , LayoutParams . MATCH_PARENT ) ) ;
public class XmlUtils { /** * Gets all the elements out of a { @ link NodeList } . * @ param nodeList the node list * @ return the elements */ public static List < Element > toElementList ( NodeList nodeList ) { } }
List < Element > elements = new ArrayList < Element > ( ) ; for ( int i = 0 ; i < nodeList . getLength ( ) ; i ++ ) { Node node = nodeList . item ( i ) ; if ( node instanceof Element ) { elements . add ( ( Element ) node ) ; } } return elements ;
public class BlackBox { public synchronized void insert_op ( int op ) { } }
// Insert elt in the box box [ insert_elt ] . req_type = Req_Operation ; box [ insert_elt ] . attr_type = Attr_Unknown ; box [ insert_elt ] . op_type = op ; box [ insert_elt ] . when = new Date ( ) ; // get client address get_client_host ( ) ; // manage insert and read indexes inc_indexes ( ) ;
public class LiveHelp { /** * The user has tabbed out * @ param id The id of the field that changed */ public void notifyBlur ( String id ) { } }
Util utilAll = new Util ( getUsersToAffect ( ) ) ; utilAll . removeClassName ( id , "disabled" ) ; utilAll . setValue ( id + "Tip" , "" ) ; // utilAll . addScript ( " $ ( ' " + id + " ' ) . disabled = false ; " ) ;
public class CognitiveServicesAccountsInner { /** * Returns all the resources of a particular type belonging to a subscription . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ return the { @ link ServiceFuture } object */ public ServiceFuture < List < CognitiveSe...
return ServiceFuture . fromResponse ( listWithServiceResponseAsync ( ) , serviceCallback ) ;
public class AudioRecorderImpl { /** * Fires specified event * @ param event the event to fire . */ private void fireEvent ( RecorderEventImpl event ) { } }
eventSender . event = event ; scheduler . submit ( eventSender , PriorityQueueScheduler . INPUT_QUEUE ) ;
public class IPAddressIntelligenceResponse { /** * Allowed ip address intelligence response . * @ return the ip address intelligence response */ public static IPAddressIntelligenceResponse allowed ( ) { } }
return builder ( ) . status ( IPAddressIntelligenceStatus . ALLOWED ) . score ( IPAddressIntelligenceStatus . ALLOWED . getScore ( ) ) . build ( ) ;
public class Inspector { /** * Get info about instance and class Methods that are dynamically added through Groovy . * @ return Array of StringArrays that can be indexed with the MEMBER _ xxx _ IDX constants */ public Object [ ] getMetaMethods ( ) { } }
MetaClass metaClass = InvokerHelper . getMetaClass ( objectUnderInspection ) ; List metaMethods = metaClass . getMetaMethods ( ) ; Object [ ] result = new Object [ metaMethods . size ( ) ] ; int i = 0 ; for ( Iterator iter = metaMethods . iterator ( ) ; iter . hasNext ( ) ; i ++ ) { MetaMethod metaMethod = ( MetaMethod...
public class Strings { /** * Returns index of searchChar in cs with begin index { @ code start } * @ param searchChar * @ param start */ private static int indexOf ( CharSequence cs , CharSequence searchChar , int start ) { } }
return cs . toString ( ) . indexOf ( searchChar . toString ( ) , start ) ;
public class ModelsImpl { /** * Gets information about the closedlist models . * @ param appId The application ID . * @ param versionId The version ID . * @ param listClosedListsOptionalParameter the object representing the optional parameters to be set before calling this API * @ throws IllegalArgumentExceptio...
return listClosedListsWithServiceResponseAsync ( appId , versionId , listClosedListsOptionalParameter ) . toBlocking ( ) . single ( ) . body ( ) ;
public class SAX2DTM2 { /** * The optimized version of DTMDefaultBase . getTypedAttribute ( int , int ) . * Given a node handle and an expanded type ID , get the index of the node ' s * attribute of that type , if any . * @ param nodeHandle int Handle of the node . * @ param attType int expanded type ID of the ...
int nodeID = makeNodeIdentity ( nodeHandle ) ; if ( nodeID == DTM . NULL ) return DTM . NULL ; int type = _type2 ( nodeID ) ; if ( DTM . ELEMENT_NODE == type ) { int expType ; while ( true ) { nodeID ++ ; expType = _exptype2 ( nodeID ) ; if ( expType != DTM . NULL ) type = m_extendedTypes [ expType ] . getNodeType ( ) ...
public class FieldTable { /** * Get the next record ( return a null at EOF ) . * @ param iRelPosition The relative records to move . * @ return next FieldList or null if EOF . */ public FieldList move ( int iRelPosition ) throws DBException { } }
if ( ! m_bIsOpen ) this . open ( ) ; // This will requery the table the first time this . getRecord ( ) . setEditMode ( Constants . EDIT_NONE ) ; int iRecordStatus = this . doMove ( iRelPosition ) ; if ( iRecordStatus == Constants . NORMAL_RETURN ) { this . dataToFields ( this . getRecord ( ) ) ; // Usually , you would...
public class BoxWebLink { /** * Updates the information about this weblink with any info fields that have been modified locally . * < p > The only fields that will be updated are the ones that have been modified locally . For example , the following * code won ' t update any information ( or even send a network req...
URL url = WEB_LINK_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( this . getAPI ( ) , url , "PUT" ) ; request . setBody ( info . getPendingChanges ( ) ) ; String body = info . getPendingChanges ( ) ; BoxJSONResponse response = ( BoxJSONResp...
public class EFMImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case AfplibPackage . EFM__FM_NAME : return getFMName ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
public class ScreenServiceImpl { /** * { @ inheritDoc } */ @ Override public void saveScreenshot ( String screenName ) throws IOException { } }
logger . debug ( "saveScreenshot with the scenario named [{}]" , screenName ) ; final byte [ ] screenshot = ( ( TakesScreenshot ) Context . getDriver ( ) ) . getScreenshotAs ( OutputType . BYTES ) ; FileUtils . forceMkdir ( new File ( System . getProperty ( USER_DIR ) + File . separator + DOWNLOADED_FILES_FOLDER ) ) ; ...
public class TreeUtil { /** * Retrieves the first WComponent by its path in the WComponent tree . See * { @ link # findWComponents ( WComponent , String [ ] ) } for a description of paths . * Searches only visible components . * @ param component the component to search from . * @ param path the path to the WCo...
return findWComponent ( component , path , true ) ;
public class Record { /** * Get value { @ link Byte } value * @ param label target label * @ return { @ link Byte } value of the label . If it is not null . */ public Byte getValueByte ( String label ) { } }
PrimitiveObject o = getPrimitiveObject ( VALUE , label , ObjectUtil . BYTE , "Byte" ) ; if ( o == null ) { return null ; } return ( Byte ) o . getObject ( ) ;
public class TupleGenerator { /** * Using selections from the given set of tuples , completes binding for all remaining variables . * Returns true if all variables have been bound . */ private boolean makeComplete ( TestCaseDef testCase , VarTupleSet tuples , List < VarDef > vars ) { } }
boolean complete ; // Test case still missing a required property ? if ( testCase . isSatisfied ( ) ) { // No , complete bindings for remaining variables complete = completeSatisfied ( testCase , tuples , vars ) ; } else { // Yes , find tuples that contain satisfying bindings . int prevBindings = testCase . getBindingC...
public class Assertions { /** * Assert that value is not null * @ param < T > type of the object to check * @ param failMessage the message to be provided as error description , can be null * @ param object the object to check * @ return the same input parameter if all is ok * @ throws AssertionError it will ...
if ( object == null ) { final String txt = failMessage == null ? "Object must not be NULL" : failMessage ; final AssertionError error = new AssertionError ( txt ) ; MetaErrorListeners . fireError ( txt , error ) ; throw error ; } return object ;
public class CmsSecureExportDialog { /** * Fills the selection widget with the options ' True ' , ' False ' and ' Not set ' . < p > * @ param optGroup the option group to initialize */ private void initOptionGroup ( OptionGroup optGroup ) { } }
optGroup . addStyleName ( ValoTheme . OPTIONGROUP_HORIZONTAL ) ; optGroup . setNullSelectionAllowed ( false ) ; optGroup . addItem ( "true" ) ; optGroup . addItem ( "false" ) ; optGroup . addItem ( "" ) ; CmsWorkplaceMessages wpMessages = OpenCms . getWorkplaceManager ( ) . getMessages ( A_CmsUI . get ( ) . getLocale (...
public class ApiOvhDbaaslogs { /** * Get a public temporary URL to access the archive * REST : POST / dbaas / logs / { serviceName } / output / graylog / stream / { streamId } / archive / { archiveId } / url * @ param serviceName [ required ] Service name * @ param streamId [ required ] Stream ID * @ param arch...
String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/archive/{archiveId}/url" ; StringBuilder sb = path ( qPath , serviceName , streamId , archiveId ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhArchiveUrl . class ) ;
public class TreeWriter { /** * Add the links to all the package tree files . * @ param contentTree the content tree to which the links will be added */ protected void addPackageTreeLinks ( Content contentTree ) { } }
// Do nothing if only unnamed package is used if ( isUnnamedPackage ( ) ) { return ; } if ( ! classesOnly ) { Content span = HtmlTree . SPAN ( HtmlStyle . packageHierarchyLabel , contents . packageHierarchies ) ; contentTree . addContent ( span ) ; HtmlTree ul = new HtmlTree ( HtmlTag . UL ) ; ul . addStyle ( HtmlStyle...
public class GroovyShell { /** * Runs the given script source with command line arguments * @ param source is the source content of the script * @ param args the command line arguments to pass in */ public Object run ( URI source , String [ ] args ) throws CompilationFailedException , IOException { } }
return run ( new GroovyCodeSource ( source ) , args ) ;
public class InstanceTemplateClient { /** * Returns the specified instance template . Gets a list of available instance templates by making * a list ( ) request . * < p > Sample code : * < pre > < code > * try ( InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient . create ( ) ) { * ProjectG...
GetInstanceTemplateHttpRequest request = GetInstanceTemplateHttpRequest . newBuilder ( ) . setInstanceTemplate ( instanceTemplate == null ? null : instanceTemplate . toString ( ) ) . build ( ) ; return getInstanceTemplate ( request ) ;
public class CameraUtil { /** * Calculate the FOV of camera , using focalLength and sensorWidth * @ param focalLength * @ param sensorWidth * @ return FOV */ public static float fieldOfView ( float focalLength , float sensorWidth ) { } }
double fov = 2 * Math . atan ( .5 * sensorWidth / focalLength ) ; return ( float ) Math . toDegrees ( fov ) ;
public class ByteArray { /** * Creates a { @ code ByteArray } object given a string . The string is encoded in { @ code UTF - 8 } . The * bytes are copied . */ public static final ByteArray copyFrom ( String string ) { } }
return new ByteArray ( ByteString . copyFrom ( string , StandardCharsets . UTF_8 ) ) ;
public class StandardAccessManager { /** * Creates and registers a session . * @ param defaultUserSettings * @ return */ public StandardSession createSession ( Properties defaultUserSettings ) { } }
StandardSession session = new StandardSession ( this , sessionTimeout , defaultUserSettings ) ; synchronized ( sessions ) { synchronized ( sessionsMirror ) { sessions . put ( session . getToken ( ) , session ) ; sessionsMirror . put ( session . getToken ( ) , session ) ; } } System . out . println ( new LogEntry ( "ses...
public class ListRateBasedRulesResult { /** * An array of < a > RuleSummary < / a > objects . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setRules ( java . util . Collection ) } or { @ link # withRules ( java . util . Collection ) } if you want to overrid...
if ( this . rules == null ) { setRules ( new java . util . ArrayList < RuleSummary > ( rules . length ) ) ; } for ( RuleSummary ele : rules ) { this . rules . add ( ele ) ; } return this ;
public class LongTuples { /** * Lexicographically increment the given tuple in the given range , and * store the result in the given result tuple . It is assumed that the * elements of the given tuple are * { @ link # areElementsGreaterThanOrEqual ( LongTuple , LongTuple ) greater than * or equal to } the value...
Utils . checkForEqualSize ( t , min ) ; Utils . checkForEqualSize ( t , max ) ; Utils . checkForEqualSize ( t , result ) ; if ( result != t ) { result . set ( t ) ; } return incrementLexicographically ( result , min , max , result . getSize ( ) - 1 ) ;
public class DirectoryWatcher { /** * 为指定目录注册监控事件 * @ param path */ private void registerDirectory ( Path path ) { } }
try { LOGGER . info ( "监控目录:" + path ) ; WatchKey key = path . register ( watchService , events ) ; directories . put ( key , path ) ; } catch ( IOException ex ) { LOGGER . error ( "监控目录失败:" + path . toAbsolutePath ( ) , ex ) ; }
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcShapeAspect ( ) { } }
if ( ifcShapeAspectEClass == null ) { ifcShapeAspectEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 595 ) ; } return ifcShapeAspectEClass ;
public class StringHelper { /** * Optimized remove method that removes a set of characters from an input * string ! * @ param sInputString * The input string . * @ param aRemoveChars * The characters to remove . May not be < code > null < / code > . * @ return The version of the string without the passed ch...
ValueEnforcer . notNull ( aRemoveChars , "RemoveChars" ) ; // Any input text ? if ( hasNoText ( sInputString ) ) return "" ; // Anything to remove ? if ( aRemoveChars . length == 0 ) return sInputString ; final StringBuilder aSB = new StringBuilder ( sInputString . length ( ) ) ; iterateChars ( sInputString , cInput ->...
public class DefaultGroovyMethods { /** * Iterates over the collection of items and returns each item that matches * the given filter - calling the < code > { @ link # isCase ( java . lang . Object , java . lang . Object ) } < / code > * method used by switch statements . This method can be used with different * ...
return ( Set < T > ) grep ( ( Collection < T > ) self , filter ) ;
public class PdfContentByte { /** * Changes the value of the < VAR > line dash pattern < / VAR > . * The line dash pattern controls the pattern of dashes and gaps used to stroke paths . * It is specified by an < I > array < / I > and a < I > phase < / I > . The array specifies the length * of the alternating dash...
content . append ( "[" ) . append ( unitsOn ) . append ( "] " ) . append ( phase ) . append ( " d" ) . append_i ( separator ) ;
public class HttpStatusCodeException { /** * Return the response body as a byte array . * @ since 3.0.5 */ public byte [ ] getResponseBodyAsByteArray ( ) { } }
final ByteBuf bodyByteBuf = httpInputMessage . getBody ( ) ; final byte [ ] bytes = new byte [ bodyByteBuf . readableBytes ( ) ] ; bodyByteBuf . readBytes ( bytes ) ; return bytes ;
public class MappedClass { /** * Returns the first found Annotation , or null . * @ param clazz The Annotation to find . * @ return First found Annotation or null of none found . */ public Annotation getFirstAnnotation ( final Class < ? extends Annotation > clazz ) { } }
final List < Annotation > found = foundAnnotations . get ( clazz ) ; return found == null || found . isEmpty ( ) ? null : found . get ( 0 ) ;
public class Command { /** * Build the body for request * @ param method * @ return */ private byte [ ] getBody ( String method ) { } }
byte [ ] body = null ; String methodsWithInputEntity = HttpMethod . POST . name ( ) + "|" + HttpMethod . PUT . name ( ) + "|" + HttpMethod . DELETE . name ( ) ; if ( method . matches ( methodsWithInputEntity ) ) { if ( isCompound ( ) ) { body = Utils . toBytes ( getQueryInputEntity ( ) ) ; } else { if ( metadataJson . ...
public class JToggle { /** * Set the up indicator to display when the drawer indicator is not * enabled . * If you pass 0 to this method , the default drawable from the theme will * be used . * @ param resId Resource ID of a drawable to use for the up indicator , or 0 * to use the theme ' s default * @ see ...
Drawable indicator = null ; if ( resId != 0 ) { indicator = mDrawerLayout . getResources ( ) . getDrawable ( resId ) ; } setHomeAsUpIndicator ( indicator ) ;
public class ResourceUtils { /** * Returns a string from the specified Reader object . * @ param reader the reader * @ return the string * @ throws IOException if an error occurred when reading resources using any I / O operations */ public static String read ( Reader reader ) throws IOException { } }
final char [ ] buffer = new char [ 1024 ] ; StringBuilder sb = new StringBuilder ( ) ; int len ; while ( ( len = reader . read ( buffer ) ) != - 1 ) { sb . append ( buffer , 0 , len ) ; } return sb . toString ( ) ;
public class FileExecutor { /** * 扫描文件夹下面所有文件 * @ param folder 文件夹 * @ return 文件路径列表 */ public static List < String > scanFolder ( File folder ) { } }
String parent = folder . getAbsolutePath ( ) + ValueConsts . SEPARATOR ; List < String > list = new ArrayList < > ( 16 ) ; if ( folder . isDirectory ( ) ) { String [ ] children = folder . list ( ) ; if ( Checker . isNotNull ( children ) ) { for ( String child : children ) { File file = new File ( parent + child ) ; if ...
public class SecurityContext { /** * Return the accessid of the current subject on the thread * @ return the access id , or null if there is no subject or no WSCredential */ public static String getUser ( ) { } }
String accessid = null ; WSCredential credential = getCallerWSCredential ( ) ; try { if ( credential != null && ! credential . isUnauthenticated ( ) ) accessid = credential . getAccessId ( ) ; } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Interna...
public class DerefQuery { /** * { @ inheritDoc } */ @ Override public Query rewrite ( IndexReader reader ) throws IOException { } }
Query cQuery = contextQuery . rewrite ( reader ) ; if ( cQuery == contextQuery ) // NOSONAR { return this ; } else { return new DerefQuery ( cQuery , refProperty , nameTest , version , nsMappings ) ; }
public class FaceletViewDeclarationLanguage { /** * In short words , this method take care of " target " an " attached object " . * < ul > * < li > The " attached object " is instantiated by a tag handler . < / li > * < li > The " target " is an object used as " marker " , that exposes a List < UIComponent > < / ...
checkNull ( context , "context" ) ; checkNull ( topLevelComponent , "topLevelComponent" ) ; checkNull ( handlerList , "handlerList" ) ; BeanInfo compositeComponentMetadata = ( BeanInfo ) topLevelComponent . getAttributes ( ) . get ( UIComponent . BEANINFO_KEY ) ; if ( compositeComponentMetadata == null ) { log . severe...
public class GetPendingJobExecutionsResult { /** * A list of JobExecutionSummary objects with status IN _ PROGRESS . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setInProgressJobs ( java . util . Collection ) } or { @ link # withInProgressJobs ( java . uti...
if ( this . inProgressJobs == null ) { setInProgressJobs ( new java . util . ArrayList < JobExecutionSummary > ( inProgressJobs . length ) ) ; } for ( JobExecutionSummary ele : inProgressJobs ) { this . inProgressJobs . add ( ele ) ; } return this ;
public class MultiDateFormat { /** * We have a non - null date , try each format in turn to see if it can be parsed . * @ param str date to parse * @ param pos position at which to start parsing * @ return Date instance */ protected Date parseNonNullDate ( String str , ParsePosition pos ) { } }
Date result = null ; for ( int index = 0 ; index < m_formats . length ; index ++ ) { result = m_formats [ index ] . parse ( str , pos ) ; if ( pos . getIndex ( ) != 0 ) { break ; } result = null ; } return result ;
public class RouteFilterRulesInner { /** * Creates or updates a route in the specified route filter . * @ param resourceGroupName The name of the resource group . * @ param routeFilterName The name of the route filter . * @ param ruleName The name of the route filter rule . * @ param routeFilterRuleParameters P...
return createOrUpdateWithServiceResponseAsync ( resourceGroupName , routeFilterName , ruleName , routeFilterRuleParameters ) . map ( new Func1 < ServiceResponse < RouteFilterRuleInner > , RouteFilterRuleInner > ( ) { @ Override public RouteFilterRuleInner call ( ServiceResponse < RouteFilterRuleInner > response ) { ret...
public class WebcamDefaultDevice { /** * Start underlying frames refresher . * @ return Refresher thread */ private Thread startFramesRefresher ( ) { } }
Thread refresher = new Thread ( this , String . format ( "frames-refresher-[%s]" , id ) ) ; refresher . setUncaughtExceptionHandler ( WebcamExceptionHandler . getInstance ( ) ) ; refresher . setDaemon ( true ) ; refresher . start ( ) ; return refresher ;