signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class ExampleHelpers { /** * Processes all entities in a Wikidata dump using the given entity * processor . By default , the most recent JSON dump will be used . In offline * mode , only the most recent previously downloaded file is considered . * @ param entityDocumentProcessor * the object to use for p...
// Controller object for processing dumps : DumpProcessingController dumpProcessingController = new DumpProcessingController ( "wikidatawiki" ) ; dumpProcessingController . setOfflineMode ( OFFLINE_MODE ) ; // / / Optional : Use another download directory : // dumpProcessingController . setDownloadDirectory ( System . ...
public class SystemPublicMetrics { /** * Add JVM non - heap metrics . * @ param result the result */ private static void addNonHeapMetrics ( Collection < Metric < ? > > result ) { } }
MemoryUsage memoryUsage = ManagementFactory . getMemoryMXBean ( ) . getNonHeapMemoryUsage ( ) ; result . add ( newMemoryMetric ( "nonheap.committed" , memoryUsage . getCommitted ( ) ) ) ; result . add ( newMemoryMetric ( "nonheap.init" , memoryUsage . getInit ( ) ) ) ; result . add ( newMemoryMetric ( "nonheap.used" , ...
public class MainFrame { /** * GEN - LAST : event _ settingsSaveMenuItemActionPerformed */ private void settingsSaveAsMenuItemActionPerformed ( java . awt . event . ActionEvent evt ) { } }
// GEN - FIRST : event _ settingsSaveAsMenuItemActionPerformed JFileChooser fc = new JFileChooser ( ) ; if ( settingsFile != null ) { fc . setSelectedFile ( settingsFile ) ; } else { fc . setSelectedFile ( DEFAULT_SETTINGS_FILE ) ; } int returnVal = fc . showSaveDialog ( this ) ; if ( returnVal == JFileChooser . APPROV...
public class AttributesHelper { /** * Binds the < code > attr < / code > statement . */ public static ChainableStatement attr ( String key , String value ) { } }
return new DefaultChainableStatement ( "attr" , JsUtils . quotes ( key ) , JsUtils . quotes ( value ) ) ;
public class ProducerProperties { /** * Sets the administrative override for priority . * @ param pri */ public void setInPriorityOverride ( Integer pri ) { } }
// Check whether changes have been made . if ( ( ( inPriOverride == null ) && ( pri != null ) ) || ( ( inPriOverride != null ) && ( ! inPriOverride . equals ( pri ) ) ) ) { inPriOverride = pri ; recalcOutPriority ( ) ; }
public class AnalyticFormulas { /** * Calculates the Black - Scholes option value of an atm call option . * @ param volatility The Black - Scholes volatility . * @ param optionMaturity The option maturity T . * @ param forward The forward , i . e . , the expectation of the index under the measure associated with ...
if ( optionMaturity < 0 ) { return 0.0 ; } // Calculate analytic value double dPlus = 0.5 * volatility * Math . sqrt ( optionMaturity ) ; double dMinus = - dPlus ; double valueAnalytic = ( NormalDistribution . cumulativeDistribution ( dPlus ) - NormalDistribution . cumulativeDistribution ( dMinus ) ) * forward * payoff...
public class JBBPFieldLong { /** * Get the reversed bit representation of the value . * @ param value the value to be reversed * @ return the reversed value */ public static long reverseBits ( final long value ) { } }
final long b0 = JBBPUtils . reverseBitsInByte ( ( byte ) value ) & 0xFFL ; final long b1 = JBBPUtils . reverseBitsInByte ( ( byte ) ( value >> 8 ) ) & 0xFFL ; final long b2 = JBBPUtils . reverseBitsInByte ( ( byte ) ( value >> 16 ) ) & 0xFFL ; final long b3 = JBBPUtils . reverseBitsInByte ( ( byte ) ( value >> 24 ) ) &...
public class ClassPathUtil { /** * Get all class path strings that is file system path , not jar file . * Uncertain is relative or absolute . < br > * @ return class paths that is file system path . */ public static String [ ] getAllClassPathNotInJar ( ) { } }
String [ ] allClassPath = getAllClassPaths ( ) ; List < String > allClassPathNotInJar = new ArrayList < String > ( ) ; for ( String classPath : allClassPath ) { if ( classPath . endsWith ( "jar" ) ) { continue ; } allClassPathNotInJar . add ( classPath ) ; } return allClassPathNotInJar . toArray ( new String [ allClass...
public class ErrorProneFlags { /** * Gets flag value for the given key as a String , wrapped in an { @ link Optional } , which is empty * if the flag is unset . */ public Optional < String > get ( String key ) { } }
return Optional . ofNullable ( flagsMap . get ( key ) ) ;
public class AvatarDataNode { /** * Instantiate a single datanode object . This must be run by invoking * { @ link DataNode # runDatanodeDaemon ( DataNode ) } subsequently . */ public static AvatarDataNode instantiateDataNode ( String args [ ] , Configuration conf ) throws IOException { } }
if ( conf == null ) conf = new Configuration ( ) ; if ( ! parseArguments ( args , conf ) ) { printUsage ( ) ; return null ; } if ( conf . get ( "dfs.network.script" ) != null ) { LOG . error ( "This configuration for rack identification is not supported" + " anymore. RackID resolution is handled by the NameNode." ) ; S...
public class hqlLexer { /** * $ ANTLR start " MIN " */ public final void mMIN ( ) throws RecognitionException { } }
try { int _type = MIN ; int _channel = DEFAULT_TOKEN_CHANNEL ; // hql . g : 46:5 : ( ' min ' ) // hql . g : 46:7 : ' min ' { match ( "min" ) ; if ( state . failed ) return ; } state . type = _type ; state . channel = _channel ; } finally { // do for sure before leaving }
public class Matrix4x3f { /** * Set the value of the matrix element at column 0 and row 2. * @ param m02 * the new value * @ return this */ public Matrix4x3f m02 ( float m02 ) { } }
this . m02 = m02 ; properties &= ~ PROPERTY_ORTHONORMAL ; if ( m02 != 0.0f ) properties &= ~ ( PROPERTY_IDENTITY | PROPERTY_TRANSLATION ) ; return this ;
public class ContentSpecUtilities { /** * Gets all the fixed urls from a content specification level . * @ param level A level to get the fixed urls for * @ return A set of fixed urls used in the level . */ public static Set < String > getFixedURLs ( final Level level ) { } }
final Set < String > fixedUrls = new HashSet < String > ( ) ; for ( final Node childNode : level . getChildNodes ( ) ) { if ( childNode instanceof SpecNode ) { final SpecNode specNode = ( ( SpecNode ) childNode ) ; if ( ! isNullOrEmpty ( specNode . getFixedUrl ( ) ) ) { fixedUrls . add ( specNode . getFixedUrl ( ) ) ; ...
public class SynchroReader { /** * Extract data for a single task . * @ param parent task parent * @ param row Synchro task data */ private void processTask ( ChildTaskContainer parent , MapRow row ) throws IOException { } }
Task task = parent . addTask ( ) ; task . setName ( row . getString ( "NAME" ) ) ; task . setGUID ( row . getUUID ( "UUID" ) ) ; task . setText ( 1 , row . getString ( "ID" ) ) ; task . setDuration ( row . getDuration ( "PLANNED_DURATION" ) ) ; task . setRemainingDuration ( row . getDuration ( "REMAINING_DURATION" ) ) ...
public class DescribeDenseHogFastAlg { /** * Compute the descriptor from the specified cells . ( row , col ) to ( row + w , col + w ) * @ param row Lower extent of cell rows * @ param col Lower extent of cell columns */ void computeDescriptor ( int row , int col ) { } }
// set location to top - left pixel locations . grow ( ) . set ( col * pixelsPerCell , row * pixelsPerCell ) ; TupleDesc_F64 d = descriptions . grow ( ) ; int indexDesc = 0 ; for ( int i = 0 ; i < cellsPerBlockY ; i ++ ) { for ( int j = 0 ; j < cellsPerBlockX ; j ++ ) { Cell c = cells [ ( row + i ) * cellCols + ( col +...
public class RevocationStatus { /** * Mark the owning item as revoked . * @ param sRevocationUserID * The ID of the user who revoked it . May neither be < code > null < / code > * nor empty . * @ param aRevocationDT * The date and time when the revocation took place . May not be * < code > null < / code > ....
ValueEnforcer . notEmpty ( sRevocationUserID , "RevocationUserID" ) ; ValueEnforcer . notNull ( aRevocationDT , "RevocationDT" ) ; ValueEnforcer . notEmpty ( sRevocationReason , "RevocationReason" ) ; if ( m_bRevoked ) throw new IllegalStateException ( "This object is already revoked!" ) ; m_bRevoked = true ; m_sRevoca...
public class MergingReader { /** * It is possible that a reducer does not iterate over all of the items given to it for a given * key . However on the next callback they expect to receive items for the following key . this * method skips over all the left over items from the previous key they did not read . */ priv...
if ( lastKey == null || lowestReaderQueue . isEmpty ( ) ) { return ; } boolean itemSkiped ; do { PeekingInputReader < KeyValue < ByteBuffer , ? extends Iterable < V > > > reader = lowestReaderQueue . remove ( ) ; itemSkiped = skipItemsOnReader ( reader ) ; addReaderToQueueIfNotEmpty ( reader ) ; } while ( itemSkiped ) ...
public class SpectralClustering { /** * Returns a { @ link ClusterResult } when { @ link matrix } is spectrally * clustered at a given { @ link depth } . This will recursively call itself * until the number of rows in { @ code matrix } is less than or equal to 1. */ private ClusterResult fullCluster ( Matrix matrix...
verbose ( "Clustering at depth " + depth ) ; // If the matrix has only one element or the depth is equal to the // maximum number of desired clusters then all items are in a single // cluster . if ( matrix . rows ( ) <= 1 ) return new ClusterResult ( new int [ matrix . rows ( ) ] , 1 ) ; // Get a fresh new eigen cutter...
public class HierarchicalConfigurationUtils { /** * 从多个配置对象中找出符合给定名字的配置对象 。 * @ param config * 配置对象 * @ param subKey * 子项配置键值 * @ param nameKey * 名字配置键值 * @ param nameValue * 属性值 * @ return 匹配的配置对象 * @ throws ConfigurationException * 找不到指定配置 */ public static HierarchicalConfiguration findForName (...
for ( HierarchicalConfiguration subConfig : config . configurationsAt ( subKey ) ) { String name = subConfig . getString ( nameKey ) ; if ( name . equals ( nameValue ) ) { return subConfig ; } } // 没有找到 throw new ConfigurationException ( MessageFormats . format ( ResourceBundles . getBundle ( RESOURCE_BASENAME ) , "sub...
public class PrecedingAxis { /** * { @ inheritDoc } */ @ Override public final void reset ( final long mNodeKey ) { } }
super . reset ( mNodeKey ) ; mIsFirst = true ; mStack = new Stack < Long > ( ) ;
public class OsmdroidShapeMarkers { /** * Polyline add a marker in the list of markers to where it is closest to * the the surrounding points * @ param marker * @ param markers */ public static void addMarkerAsPolyline ( Marker marker , List < Marker > markers ) { } }
GeoPoint position = marker . getPosition ( ) ; int insertLocation = markers . size ( ) ; if ( markers . size ( ) > 1 ) { double [ ] distances = new double [ markers . size ( ) ] ; insertLocation = 0 ; distances [ 0 ] = SphericalUtil . computeDistanceBetween ( position , markers . get ( 0 ) . getPosition ( ) ) ; for ( i...
public class DateTimeFormatter { /** * Prints a ReadablePartial . * Neither the override chronology nor the override zone are used * by this method . * @ param appendable the destination to format to , not null * @ param partial partial to format * @ since 2.0 */ public void printTo ( Appendable appendable , ...
InternalPrinter printer = requirePrinter ( ) ; if ( partial == null ) { throw new IllegalArgumentException ( "The partial must not be null" ) ; } printer . printTo ( appendable , partial , iLocale ) ;
public class BodyContentImpl { /** * Write a portion of a String . * @ param s String to be written * @ param off Offset from which to start reading characters * @ param len Number of characters to be written */ public void write ( String s , int off , int len ) throws IOException { } }
if ( writer != null ) { writer . write ( s , off , len ) ; } else { ensureOpen ( ) ; // PK33136 strBuffer . append ( s . substring ( off , off + len ) ) ; nextChar += len ; // PK33136 }
public class StitchAuthImpl { /** * Adds a listener for any important auth event . * @ see StitchAuthListener */ public void addAuthListener ( final StitchAuthListener listener ) { } }
listeners . put ( listener , Boolean . TRUE ) ; // Trigger the onUserLoggedIn event in case some event happens and // this caller would miss out on this event other wise . onAuthEvent ( listener ) ; dispatcher . dispatchTask ( new Callable < Void > ( ) { @ Override public Void call ( ) { listener . onListenerRegistered...
public class ModelItem { /** * Adds a perspective to this model item . * @ param name the name of the perspective ( e . g . " Security " , must be unique ) * @ param description a description of the perspective * @ return a Perspective object * @ throws IllegalArgumentException if perspective details are not sp...
if ( StringUtils . isNullOrEmpty ( name ) ) { throw new IllegalArgumentException ( "A name must be specified." ) ; } if ( StringUtils . isNullOrEmpty ( description ) ) { throw new IllegalArgumentException ( "A description must be specified." ) ; } if ( perspectives . stream ( ) . filter ( p -> p . getName ( ) . equals ...
public class ServiceDirectoryConfig { /** * Get the property object as Boolean , or return defaultVal if property is not defined . * @ param name * property name . * @ param defaultVal * default property value . * @ return * property value as boolean , return defaultVal if property is undefined . */ public ...
if ( this . configuration . containsKey ( name ) ) { return this . configuration . getBoolean ( name ) ; } else { return defaultVal ; }
public class BackendServiceClient { /** * Returns the specified BackendService resource . Gets a list of available backend services . * < p > Sample code : * < pre > < code > * try ( BackendServiceClient backendServiceClient = BackendServiceClient . create ( ) ) { * ProjectGlobalBackendServiceName backendServic...
GetBackendServiceHttpRequest request = GetBackendServiceHttpRequest . newBuilder ( ) . setBackendService ( backendService == null ? null : backendService . toString ( ) ) . build ( ) ; return getBackendService ( request ) ;
public class TwilioFactorProvider { /** * Setter for the Twilio From number . * @ param from the from number to set . * @ throws IllegalArgumentException when both ` from ` and ` messagingServiceSID ` are set * @ deprecated use the constructor instead */ @ Deprecated @ JsonProperty ( "from" ) public void setFrom ...
if ( messagingServiceSID != null ) { throw new IllegalArgumentException ( "You must specify either `from` or `messagingServiceSID`, but not both" ) ; } this . from = from ;
public class SimpleMapSerializer { /** * 写一个String * @ param out 输出流 * @ param str 字符串 * @ throws IOException 写入异常 */ protected void writeString ( OutputStream out , String str ) throws IOException { } }
if ( str == null ) { writeInt ( out , - 1 ) ; } else if ( str . isEmpty ( ) ) { writeInt ( out , 0 ) ; } else { byte [ ] bs = StringSerializer . encode ( str ) ; writeInt ( out , bs . length ) ; out . write ( bs ) ; }
public class HtmlPolicyBuilder { /** * Reverses a decision made by { @ link # allowUrlProtocols } . */ public HtmlPolicyBuilder disallowUrlProtocols ( String ... protocols ) { } }
invalidateCompiledState ( ) ; for ( String protocol : protocols ) { protocol = Strings . toLowerCase ( protocol ) ; allowedProtocols . remove ( protocol ) ; } return this ;
public class KAFDocument { /** * Creates a new opinion object . It assigns an appropriate ID to it . The opinion is added to the document . * @ return a new opinion . */ public Opinion newOpinion ( ) { } }
String newId = idManager . getNextId ( AnnotationType . OPINION ) ; Opinion newOpinion = new Opinion ( newId ) ; annotationContainer . add ( newOpinion , Layer . OPINIONS , AnnotationType . OPINION ) ; return newOpinion ;
public class SymmetryTools { /** * Given a symmetry result , it calculates the overall global symmetry , * factoring out the alignment and detection steps of * { @ link QuatSymmetryDetector } algorithm . * @ param result * symmetry result * @ return global symmetry results * @ throws StructureException */ p...
// Obtain the subunits of the repeats List < Atom [ ] > atoms = toRepeatsAlignment ( result ) . getAtomArrays ( ) ; List < Subunit > subunits = atoms . stream ( ) . map ( a -> new Subunit ( a , null , null , null ) ) . collect ( Collectors . toList ( ) ) ; // The clustering thresholds are set to 0 so that all always me...
public class MetricInstrumentedIterator { /** * If the iterator argument is non - null , then return a new * { @ code MetricInstrumentedIterator } wrapping it . Metrics for method calls * on the wrapped instance will be prefixed with the string { @ code prefix } * which must be non - null . If the iterator argume...
if ( keyIterator == null ) { return null ; } Preconditions . checkNotNull ( prefix ) ; return new MetricInstrumentedIterator ( keyIterator , StringUtils . join ( prefix , "." ) ) ;
public class ExecutorServiceFactories { /** * Returns a { @ link ExecutorServiceFactory } which creates threadpool executors with the given base * name and number of threads . Created threads will be daemonic . * @ param name the base name for executor thread names * @ param nThreads the number of threads to crea...
return ( ) -> Executors . newFixedThreadPool ( nThreads , ThreadFactoryUtils . build ( name + "-%d" , true ) ) ;
public class Utils4Swing { /** * Hides the glass pane and restores the saved state . * @ param state * State to restore - Cannot be < code > null < / code > . */ public static void hideGlassPane ( final GlassPaneState state ) { } }
Utils4J . checkNotNull ( "state" , state ) ; final Component glassPane = state . getGlassPane ( ) ; glassPane . removeMouseListener ( state . getMouseListener ( ) ) ; glassPane . setCursor ( state . getCursor ( ) ) ; glassPane . setVisible ( false ) ; if ( state . getFocusOwner ( ) != null ) { state . getFocusOwner ( )...
public class JCRAssert { /** * Asserts that a specific node with the given absolute path does not exist in the session * @ param session * the session to search for the node * @ param absPath * the absolute path to look for a node * @ throws RepositoryException * if the repository access failed */ public st...
try { session . getNode ( absPath ) ; fail ( "Node " + absPath + " does not exist" ) ; } catch ( final PathNotFoundException e ) { // NOSONAR // the exception is expected }
public class inat { /** * Use this API to fetch filtered set of inat resources . * filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */ public static inat [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } }
inat obj = new inat ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; inat [ ] response = ( inat [ ] ) obj . getfiltered ( service , option ) ; return response ;
public class BiddingStrategyConfiguration { /** * Gets the biddingScheme value for this BiddingStrategyConfiguration . * @ return biddingScheme * The bidding strategy metadata . Bidding strategy can be associated * using the { @ linkplain * BiddingStrategyConfiguration # biddingStrategyType } * or the bidding s...
return biddingScheme ;
public class SyncAgentsInner { /** * Lists databases linked to a sync agent . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; SyncAgentLinkedData...
return listLinkedDatabasesNextSinglePageAsync ( nextPageLink ) . concatMap ( new Func1 < ServiceResponse < Page < SyncAgentLinkedDatabaseInner > > , Observable < ServiceResponse < Page < SyncAgentLinkedDatabaseInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < SyncAgentLinkedDatabaseInner > > >...
public class Base64 { /** * Encodes a byte array into Base64 notation . * @ param source The data to convert * @ param off Offset in array where conversion should begin * @ param len Length of data to convert * @ since 1.4 */ public static String encodeBytes ( byte [ ] source , int off , int len ) { } }
return encodeBytes ( source , off , len , true ) ;
public class GroovyResultSetExtension { /** * Gets the value of the designated column in the current row * of as an < code > Object < / code > . * @ param columnName the SQL name of the column * @ return the returned column value * @ throws MissingPropertyException if an SQLException happens while getting the o...
try { return getResultSet ( ) . getObject ( columnName ) ; } catch ( SQLException e ) { throw new MissingPropertyException ( columnName , GroovyResultSetProxy . class , e ) ; }
public class Stax2DomBuilder { /** * This method takes a < code > XMLStreamReader < / code > and builds up a JDOM tree . Recursion has been eliminated by using nodes ' parent / child relationship ; this improves performance somewhat ( classic recursion - by - iteration - and - explicit stack transformation ) * @ para...
checkReaderSettings ( r ) ; Node current = doc ; // At top level main_loop : while ( true ) { int evtType = r . next ( ) ; Node child ; switch ( evtType ) { case XMLStreamConstants . CDATA : child = doc . createCDATASection ( r . getText ( ) ) ; break ; case XMLStreamConstants . SPACE : if ( mCfgIgnoreWs ) { continue m...
public class OAuth2Utils { /** * Extract a map from a query string . * @ param query a query ( or fragment ) string from a URI * @ return a Map of the values in the query */ public static Map < String , String > extractMap ( String query ) { } }
Map < String , String > map = new HashMap < String , String > ( ) ; Properties properties = StringUtils . splitArrayElementsIntoProperties ( StringUtils . delimitedListToStringArray ( query , "&" ) , "=" ) ; if ( properties != null ) { for ( Object key : properties . keySet ( ) ) { map . put ( key . toString ( ) , prop...
public class InfixOpNode { /** * Implements the ternary logic AND operation */ public static Object and ( Object left , Object right , EvaluationContext ctx ) { } }
Boolean l = EvalHelper . getBooleanOrNull ( left ) ; Boolean r = EvalHelper . getBooleanOrNull ( right ) ; // have to check for all nulls first to avoid NPE if ( ( l == null && r == null ) || ( l == null && r == true ) || ( r == null && l == true ) ) { return null ; } else if ( l == null || r == null ) { return false ;...
public class QueryConverter { /** * Retrieve ( in string format ) from this field . * @ return The display field of the grid record . */ public String getString ( ) { } }
FieldInfo field = this . getField ( ) ; if ( field instanceof StringField ) return field . toString ( ) ; if ( displayFieldName != null ) return m_record . getField ( displayFieldName ) . getString ( ) ; // Return the desc string else return m_record . getField ( m_iFieldSeq ) . getString ( ) ; // Return the desc strin...
public class CommerceWarehouseModelImpl { /** * Converts the soap model instance into a normal model instance . * @ param soapModel the soap model instance to convert * @ return the normal model instance */ public static CommerceWarehouse toModel ( CommerceWarehouseSoap soapModel ) { } }
if ( soapModel == null ) { return null ; } CommerceWarehouse model = new CommerceWarehouseImpl ( ) ; model . setCommerceWarehouseId ( soapModel . getCommerceWarehouseId ( ) ) ; model . setGroupId ( soapModel . getGroupId ( ) ) ; model . setCompanyId ( soapModel . getCompanyId ( ) ) ; model . setUserId ( soapModel . get...
public class GDiscreteFourierTransformOps { /** * Computes the phase of the complex image : < br > * phase = atan2 ( imaginary , real ) * @ param transform ( Input ) Complex interleaved image * @ param phase ( output ) Phase of image */ public static void phase ( ImageInterleaved transform , GrayF phase ) { } }
if ( transform instanceof InterleavedF32 ) { DiscreteFourierTransformOps . phase ( ( InterleavedF32 ) transform , ( GrayF32 ) phase ) ; } else if ( transform instanceof InterleavedF64 ) { DiscreteFourierTransformOps . phase ( ( InterleavedF64 ) transform , ( GrayF64 ) phase ) ; } else { throw new IllegalArgumentExcepti...
public class Client { /** * Creates a Series * @ param series The Series to create * @ return The created Series * @ since 1.0.0 * @ throws NullPointerException If the input Series is null . */ public Result < Series > createSeries ( Series series ) { } }
checkNotNull ( series ) ; URI uri = null ; try { URIBuilder builder = new URIBuilder ( String . format ( "/%s/series/" , API_VERSION ) ) ; uri = builder . build ( ) ; } catch ( URISyntaxException e ) { String message = "Could not build URI" ; throw new IllegalArgumentException ( message , e ) ; } Result < Series > resu...
public class UIUtils { /** * Get the selectableItemBackground attribute drawable * @ return */ public static Drawable getSelectableItemBackgroundBorderless ( Context ctx ) { } }
int [ ] attrs = new int [ ] { R . attr . selectableItemBackgroundBorderless /* index 0 */ } ; TypedArray ta = ctx . obtainStyledAttributes ( attrs ) ; Drawable drawableFromTheme = ta . getDrawable ( 0 /* index */ ) ; ta . recycle ( ) ; return drawableFromTheme ;
public class UmlGraphDoc { /** * Option check , forwards options to the standard doclet , if that one refuses them , * they are sent to UmlGraph */ public static int optionLength ( String option ) { } }
int result = Standard . optionLength ( option ) ; if ( result != 0 ) return result ; else return UmlGraph . optionLength ( option ) ;
public class AbstractFileStorageEngine { /** * Returns the location of the directory from the configuration or the temporary directory if not defined . * @ return */ protected String getDirectory ( ) { } }
// get the default filepath of the permanet storage file String directory = storageConfiguration . getDirectory ( ) ; if ( directory == null || directory . isEmpty ( ) ) { directory = System . getProperty ( "java.io.tmpdir" ) ; // write them to the tmp directory } return directory ;
public class SpringSecurityXmAuthenticationContext { /** * { @ inheritDoc } */ @ Override public Optional < String > getSessionId ( ) { } }
return getDetails ( ) . flatMap ( details -> { String sessionId ; if ( details instanceof OAuth2AuthenticationDetails ) { sessionId = OAuth2AuthenticationDetails . class . cast ( details ) . getSessionId ( ) ; } else if ( details instanceof WebAuthenticationDetails ) { sessionId = WebAuthenticationDetails . class . cas...
public class CPFriendlyURLEntryLocalServiceBaseImpl { /** * Returns all the cp friendly url entries matching the UUID and company . * @ param uuid the UUID of the cp friendly url entries * @ param companyId the primary key of the company * @ return the matching cp friendly url entries , or an empty list if no mat...
return cpFriendlyURLEntryPersistence . findByUuid_C ( uuid , companyId ) ;
public class ThrottledApiHandler { /** * Retrieve summoner ids for the specified names * @ param names The names of the users * @ return Their respective ids */ public Future < List < Long > > getSummonerIds ( String ... names ) { } }
return new ApiFuture < > ( ( ) -> handler . getSummonerIds ( names ) ) ;
public class PageFlowRequestProcessor { /** * Process any direct request for a page flow by forwarding to its " begin " action . * @ param request the current HttpServletRequest * @ param response the current HttpServletResponse * @ param uri the decoded request URI * @ return < code > true < / code > if the re...
// Forward requests for * . jpf to the " begin " action within the appropriate Struts module . if ( FileUtils . osSensitiveEndsWith ( uri , PageFlowConstants . PAGEFLOW_EXTENSION ) ) { // Make sure the current module config matches the request URI . If not , this could be an // EAR where the struts - config . xml wasn ...
public class DynamicEnum { /** * < p > Attempts to register a given { @ link EnumValue } instance to its associated class type . If an instance with the * same name has already been registered , that instance will be returned . < / p > * @ param < T > Specific type of EnumValue being registered * @ param enumValu...
return Cast . as ( GLOBAL_REPOSITORY . computeIfAbsent ( enumValue . canonicalName ( ) , s -> enumValue ) ) ;
public class Gen { /** * Derived visitor method : check whether CharacterRangeTable * should be emitted , if so , put a new entry into CRTable * and call method to generate bytecode . * If not , just call method to generate bytecode . * @ see # genStats ( List , Env ) * @ param trees The list of trees to be v...
if ( ! genCrt ) { genStats ( trees , env ) ; return ; } if ( trees . length ( ) == 1 ) { // mark one statement with the flags genStat ( trees . head , env , crtFlags | CRT_STATEMENT ) ; } else { int startpc = code . curCP ( ) ; genStats ( trees , env ) ; code . crt . put ( trees , crtFlags , startpc , code . curCP ( ) ...
public class StringParser { /** * Get the unified decimal string for parsing by the runtime library . This is * done by replacing ' , ' with ' . ' . * @ param sStr * The string to unified . Never < code > null < / code > . * @ return Never < code > null < / code > . */ @ Nonnull @ Nonempty private static String...
return StringHelper . replaceAll ( sStr , ',' , '.' ) ;
public class AbstractJsonDeserializer { /** * Convenience method for subclasses . * @ param paramName the name of the parameter * @ param errorMessage the errormessage to add to the exception if the param does not exist . * @ param clazz the class of the parameter that should be parsed . * @ param mapToUse the ...
Object o = mapToUse . get ( paramName ) ; if ( o != null && clazz . isAssignableFrom ( o . getClass ( ) ) ) { return ( A ) o ; } else { if ( errorMessage != null ) { throw new IOException ( errorMessage ) ; } else { return null ; } }
public class Page { /** * Returns a page that assures all data is in memory . * May return the same page if all page data is already in memory . * This allows streaming data sources to skip sections that are not * accessed in a query . */ public Page getLoadedPage ( ) { } }
boolean allLoaded = true ; Block [ ] loadedBlocks = new Block [ blocks . length ] ; for ( int i = 0 ; i < blocks . length ; i ++ ) { loadedBlocks [ i ] = blocks [ i ] . getLoadedBlock ( ) ; if ( loadedBlocks [ i ] != blocks [ i ] ) { allLoaded = false ; } } if ( allLoaded ) { return this ; } return new Page ( loadedBlo...
public class SpdLongAggregate { /** * Check data type and call super to remove data - synchronized in super */ public boolean remove ( SpdData data ) { } }
if ( data == null ) return false ; if ( data instanceof SpdLong ) { return super . remove ( data ) ; } else { return false ; }
public class User { /** * Changes the user password permanently . * @ param token the reset token . see { @ link # generatePasswordResetToken ( ) } * @ param newpass the new password * @ return true if successful */ public final boolean resetPassword ( String token , String newpass ) { } }
if ( StringUtils . isBlank ( newpass ) || StringUtils . isBlank ( token ) || newpass . length ( ) < Config . MIN_PASS_LENGTH ) { return false ; } Sysprop s = CoreUtils . getInstance ( ) . getDao ( ) . read ( getAppid ( ) , identifier ) ; if ( isValidToken ( s , Config . _RESET_TOKEN , token ) ) { s . removeProperty ( C...
public class DescribeComputeEnvironmentsRequest { /** * A list of up to 100 compute environment names or full Amazon Resource Name ( ARN ) entries . * @ param computeEnvironments * A list of up to 100 compute environment names or full Amazon Resource Name ( ARN ) entries . */ public void setComputeEnvironments ( ja...
if ( computeEnvironments == null ) { this . computeEnvironments = null ; return ; } this . computeEnvironments = new java . util . ArrayList < String > ( computeEnvironments ) ;
public class JSONWriter { /** * Append an array value based on a custom JSONString implementation . * @ param jss The JSONString array or container to append . * Its elements can be null or implement JSONString . * @ return this * @ throws JSONException if the value is out of sequence or if a * toJSONString m...
array ( ) ; for ( JSONString element : iter ) { value ( element ) ; } endArray ( ) ; return this ;
public class ClientInterceptors { /** * Create a new { @ link Channel } that will call { @ code interceptors } before starting a call on the * given channel . The first interceptor will have its { @ link ClientInterceptor # interceptCall } * called first . * @ param channel the underlying channel to intercept . ...
List < ? extends ClientInterceptor > copy = new ArrayList < > ( interceptors ) ; Collections . reverse ( copy ) ; return intercept ( channel , copy ) ;
public class OrganizationResource { /** * Handle organization posts when the server got a request POST < dm _ url > / organization & MIME that contains an organization . * @ param organization The organization to add to Grapes database * @ return Response An acknowledgment : < br / > - 400 if the artifact is MIME i...
if ( ! credential . getRoles ( ) . contains ( DbCredential . AvailableRoles . DATA_UPDATER ) ) { throw new WebApplicationException ( Response . status ( Response . Status . UNAUTHORIZED ) . build ( ) ) ; } LOG . info ( "Got a post organization request." ) ; // Checks if the data is corrupted DataValidator . validate ( ...
public class AutoCompleteEditText { /** * Replaces the current word with s . Used by Adapter to set the selected item as text . * @ param s text to replace with */ public void performCompletion ( String s ) { } }
int selStart = getSelectionStart ( ) ; int selEnd = getSelectionEnd ( ) ; if ( selStart != selEnd ) return ; Editable text = getText ( ) ; HintSpan [ ] spans = text . getSpans ( 0 , length ( ) , HintSpan . class ) ; if ( spans . length > 1 ) throw new IllegalStateException ( "more than one HintSpan" ) ; Word word = get...
public class TimelineModel { /** * Gets event by its index as String * @ param index index * @ return TimelineEvent found event or null */ public TimelineEvent getEvent ( String index ) { } }
return getEvent ( index != null ? Integer . valueOf ( index ) : - 1 ) ;
public class CmsModuleAddResourceTypeThread { /** * Locks the given resource temporarily . < p > * @ param resource the resource to lock * @ throws CmsException if locking fails */ private void lockTemporary ( CmsResource resource ) throws CmsException { } }
CmsObject cms = getCms ( ) ; CmsUser user = cms . getRequestContext ( ) . getCurrentUser ( ) ; CmsLock lock = cms . getLock ( resource ) ; if ( ! lock . isOwnedBy ( user ) ) { cms . lockResourceTemporary ( resource ) ; } else if ( ! lock . isOwnedInProjectBy ( user , cms . getRequestContext ( ) . getCurrentProject ( ) ...
public class MClipboardPrinter { /** * Copie la sélection d ' une table dans le presse - papiers ( au format html pour Excel par exemple ) . * @ param table * MBasicTable */ protected void copySelectionToClipboard ( final MBasicTable table ) { } }
if ( table . getSelectionModel ( ) . isSelectionEmpty ( ) ) { return ; } final Toolkit toolkit = table . getToolkit ( ) ; final Clipboard clipboard = toolkit . getSystemClipboard ( ) ; final ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream ( 2048 ) ; try { writeHtml ( table , byteArrayOut , true ) ; final...
public class HybridTreetankStorageModule { /** * Bootstrap a new device as a treetank storage using nodes to abstract the * device . * @ throws IOException * is thrown if a node couldn ' t be created due to errors in the * backend . */ private void createStorage ( ) throws TTException { } }
LOGGER . debug ( "Creating storage with " + mDataNumbers + " nodes containing " + BLOCKS_IN_DATA + " blocks with " + IStorageModule . VIRTUAL_BLOCK_SIZE + " bytes each." ) ; // Creating mirror jCloudsStorageModule = new JCloudsStorageModule ( BLOCKS_IN_DATA * VIRTUAL_BLOCK_SIZE , Files . createTempDir ( ) ) ; IData dat...
public class SnappyOutputStream { /** * / * ( non - Javadoc ) * @ see java . io . OutputStream # close ( ) */ @ Override public void close ( ) throws IOException { } }
if ( closed ) { return ; } try { flush ( ) ; out . close ( ) ; } finally { closed = true ; inputBufferAllocator . release ( inputBuffer ) ; outputBufferAllocator . release ( outputBuffer ) ; inputBuffer = null ; outputBuffer = null ; }
public class PatternUtils { /** * Get the suffix matcher . This is similar to { @ link # tail ( Matcher ) } except that it intended * to be used with { @ link # getPrefix ( Matcher ) } */ static Matcher getSuffix ( Matcher matcher ) { } }
if ( matcher instanceof SeqMatcher ) { List < Matcher > ms = matcher . < SeqMatcher > as ( ) . matchers ( ) ; return SeqMatcher . create ( ms . subList ( 1 , ms . size ( ) ) ) ; } else if ( matcher instanceof ZeroOrMoreMatcher ) { ZeroOrMoreMatcher zm = matcher . as ( ) ; return zm . next ( ) ; } else if ( matcher inst...
public class SimpleBlas { /** * Compute x ^ T * y ( dot product ) */ public static float dot ( FloatMatrix x , FloatMatrix y ) { } }
// return NativeBlas . sdot ( x . length , x . data , 0 , 1 , y . data , 0 , 1 ) ; return JavaBlas . rdot ( x . length , x . data , 0 , 1 , y . data , 0 , 1 ) ;
public class Validator { /** * Validate a set of properties for a description , and return a report . * @ param props the input properties * @ param desc the configuration description * @ return the validation report */ public static Report validate ( final Properties props , final Description desc ) { } }
final List < Property > properties = desc . getProperties ( ) ; return validate ( props , properties ) ;
public class RequestContextExportingAppender { /** * Adds the specified { @ link AttributeKey } to the export list . * @ param alias the alias of the attribute to export * @ param attrKey the key of the attribute to export * @ param stringifier the { @ link Function } that converts the attribute value into a { @ ...
ensureNotStarted ( ) ; builder . addAttribute ( alias , attrKey , stringifier ) ;
public class UIContextImpl { /** * Stores the extrinsic state information for the given component . * @ param component the component to set the model for . * @ param model the model to set . */ @ Override public void setModel ( final WebComponent component , final WebModel model ) { } }
map . put ( component , model ) ;
public class Sequencer { /** * See { @ link Sequencer # registerNodeTypes ( String , org . modeshape . jcr . api . nodetype . NodeTypeManager , boolean ) } * @ param cndStream the input stream containing the CND file ; may not be null * @ param nodeTypeManager the node type manager with which the node types in the ...
if ( cndStream == null ) { throw new IllegalArgumentException ( "The stream to the given cnd file is null" ) ; } nodeTypeManager . registerNodeTypes ( cndStream , allowUpdate ) ;
public class JQMCollapsible { /** * Sets the header button as inline block . */ @ Override public void setInline ( boolean value ) { } }
inline = value ; if ( headingToggle != null ) { JQMCommon . setInlineEx ( headingToggle , value , JQMCommon . STYLE_UI_BTN_INLINE ) ; }
public class WriterBasedGenerator { /** * / * Same as " _ writeString2 ( ) " , except needs additional escaping * for subset of characters */ private void _writeStringASCII ( final int len , final int maxNonEscaped ) throws IOException , JsonGenerationException { } }
// And then we ' ll need to verify need for escaping etc : int end = _outputTail + len ; final int [ ] escCodes = _outputEscapes ; final int escLimit = Math . min ( escCodes . length , maxNonEscaped + 1 ) ; int escCode = 0 ; output_loop : while ( _outputTail < end ) { char c ; // Fast loop for chars not needing escapin...
public class AngularPass { /** * Given a FUNCTION node returns array of STRING nodes representing function * parameters . * @ param n the FUNCTION node . * @ return STRING nodes . */ private List < Node > createDependenciesList ( Node n ) { } }
checkArgument ( n . isFunction ( ) ) ; Node params = NodeUtil . getFunctionParameters ( n ) ; if ( params != null ) { return createStringsFromParamList ( params ) ; } return new ArrayList < > ( ) ;
public class Vector3i { /** * / * ( non - Javadoc ) * @ see org . joml . Vector3ic # sub ( int , int , int , org . joml . Vector3i ) */ public Vector3i sub ( int x , int y , int z , Vector3i dest ) { } }
dest . x = this . x - x ; dest . y = this . y - y ; dest . z = this . z - z ; return dest ;
public class SimpleRetry { /** * Should a retry attempt occur . * @ return True if it should */ @ Override public boolean canRetry ( Throwable exception ) { } }
if ( exception == null ) { return false ; } Class < ? extends Throwable > exceptionClass = exception . getClass ( ) ; if ( hasIncludes && ! includes . contains ( exceptionClass ) ) { return false ; } else if ( hasExcludes && excludes . contains ( exceptionClass ) ) { return false ; } else { return this . attemptNumber ...
public class FileCopyProgressPanel { /** * Set the number of the current file . If called outside the EDT this method * will switch to the UI thread using * < code > SwingUtilities . invokeLater ( Runnable ) < / code > . * @ param n * The N value in " N of M " . */ public final void setCurrentFile ( final int n...
if ( SwingUtilities . isEventDispatchThread ( ) ) { setCurrentFileIntern ( n ) ; } else { try { SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { setCurrentFileIntern ( n ) ; } } ) ; } catch ( final Exception ex ) { ignore ( ) ; } }
public class ClassificationServiceCache { /** * Keep a cache of items files associated with classification in order to improve performance . */ @ SuppressWarnings ( "unchecked" ) private static synchronized Map < String , Boolean > getCache ( GraphRewrite event ) { } }
Map < String , Boolean > result = ( Map < String , Boolean > ) event . getRewriteContext ( ) . get ( ClassificationServiceCache . class ) ; if ( result == null ) { result = Collections . synchronizedMap ( new LRUMap ( 30000 ) ) ; event . getRewriteContext ( ) . put ( ClassificationServiceCache . class , result ) ; } re...
public class DateFormat { /** * Formats a time object into a time string . Examples of time objects * are a time value expressed in milliseconds and a Date object . * @ param obj must be a Number or a Date or a Calendar . * @ param toAppendTo the string buffer for the returning time string . * @ return the form...
if ( obj instanceof Calendar ) return format ( ( Calendar ) obj , toAppendTo , fieldPosition ) ; else if ( obj instanceof Date ) return format ( ( Date ) obj , toAppendTo , fieldPosition ) ; else if ( obj instanceof Number ) return format ( new Date ( ( ( Number ) obj ) . longValue ( ) ) , toAppendTo , fieldPosition ) ...
public class DBUpdate { /** * Perform a bit operation on the given field * @ param field The field to perform the operation on * @ param operation The operation to perform * @ param value The value * @ return this object */ public static Builder bit ( String field , String operation , int value ) { } }
return new Builder ( ) . bit ( field , operation , value ) ;
public class CLI { /** * Run the appropriate command based on the command line parameters . * @ param args * the arguments passed through the CLI * @ throws IOException * exception if problems with the incoming data * @ throws JDOMException * a xml exception */ public final void run ( final String [ ] args ...
try { Parameters parameters = cliArgumentsParser . parse ( args ) ; if ( parameters . getStrategy ( ) == Strategy . TOKENIZE ) { annotate ( parameters ) ; } else if ( parameters . getStrategy ( ) == Strategy . SERVER ) { server ( parameters ) ; } else if ( parameters . getStrategy ( ) == Strategy . CLIENT ) { client ( ...
public class MathUtils { /** * This returns the given column over an n arrays * @ param column the column to getFromOrigin values for * @ param nums the arrays to extract values from * @ return a double array containing all of the numbers in that column * for all of the arrays . * @ throws IllegalArgumentExce...
double [ ] ret = new double [ nums . length ] ; for ( int i = 0 ; i < nums . length ; i ++ ) { double [ ] curr = nums [ i ] ; ret [ i ] = curr [ column ] ; } return ret ;
public class AWSLicenseManagerClient { /** * Lists license configuration objects for an account , each containing the name , description , license type , and * other license terms modeled from a license agreement . * @ param listLicenseConfigurationsRequest * @ return Result of the ListLicenseConfigurations opera...
request = beforeClientExecution ( request ) ; return executeListLicenseConfigurations ( request ) ;
public class HttpJsonSerializer { /** * Parses a suggestion query * @ return a hash map of key / value pairs * @ throws JSONException if parsing failed * @ throws BadRequestException if the content was missing or parsing failed */ @ Override public HashMap < String , String > parseSuggestV1 ( ) { } }
final String json = query . getContent ( ) ; if ( json == null || json . isEmpty ( ) ) { throw new BadRequestException ( HttpResponseStatus . BAD_REQUEST , "Missing message content" , "Supply valid JSON formatted data in the body of your request" ) ; } try { return JSON . parseToObject ( query . getContent ( ) , new Ty...
public class MiniBatchGlobalGroupAggFunction { /** * The { @ code previousAcc } is accumulator , but input is a row in & lt ; key , accumulator & gt ; schema , * the specific generated { @ link # localAgg } will project the { @ code input } to accumulator * in merge method . */ @ Override public BaseRow addInput ( ...
BaseRow currentAcc ; if ( previousAcc == null ) { currentAcc = localAgg . createAccumulators ( ) ; } else { currentAcc = previousAcc ; } localAgg . setAccumulators ( currentAcc ) ; localAgg . merge ( input ) ; return localAgg . getAccumulators ( ) ;
public class WebServiceCommunication { /** * Gets the response headers of specified uri . * @ param uri http / https uri * @ return response headers * @ throws IOException in case of any IO related issue */ public static Header [ ] headUri ( String uri ) throws IOException { } }
CloseableHttpClient c = newHttpClient ( new URL ( uri ) ) ; HttpHead head = new HttpHead ( uri ) ; LOG . debug ( "HEAD {}" , uri ) ; CloseableHttpResponse res = c . execute ( head , HttpClientContext . create ( ) ) ; checkResponse ( res ) ; return res . getAllHeaders ( ) ;
public class HttpsHealthCheckClient { /** * Updates a HttpsHealthCheck resource in the specified project using the data included in the * request . * < p > Sample code : * < pre > < code > * try ( HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient . create ( ) ) { * ProjectGlobalHttpsHealt...
UpdateHttpsHealthCheckHttpRequest request = UpdateHttpsHealthCheckHttpRequest . newBuilder ( ) . setHttpsHealthCheck ( httpsHealthCheck == null ? null : httpsHealthCheck . toString ( ) ) . setHttpsHealthCheckResource ( httpsHealthCheckResource ) . addAllFieldMask ( fieldMask ) . build ( ) ; return updateHttpsHealthChec...
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EEnum getIfcServiceLifeFactorTypeEnum ( ) { } }
if ( ifcServiceLifeFactorTypeEnumEEnum == null ) { ifcServiceLifeFactorTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 896 ) ; } return ifcServiceLifeFactorTypeEnumEEnum ;
public class cuDoubleComplex { /** * Creates a new complex number consisting of the given real and * imaginary part . * @ param r The real part of the complex number * @ param i The imaginary part of the complex number * @ return A complex number with the given real and imaginary part */ public static cuDoubleC...
cuDoubleComplex res = new cuDoubleComplex ( ) ; res . x = r ; res . y = i ; return res ;
public class AccountingDate { /** * Creates an { @ code AccountingDate } validating the input . * @ param chronology the Accounting chronology to base the date on , not null * @ param prolepticYear the Accounting proleptic - year * @ return the date in Accounting calendar system , not null * @ throws DateTimeEx...
Objects . requireNonNull ( chronology , "A previously setup chronology is required." ) ; YEAR . checkValidValue ( prolepticYear ) ; chronology . range ( MONTH_OF_YEAR ) . checkValidValue ( month , MONTH_OF_YEAR ) ; if ( dayOfMonth < 1 || dayOfMonth > lengthOfMonth ( chronology , prolepticYear , month ) ) { if ( month =...
public class SimplePicker { /** * Retrieves the list of recently selected examples from a file on the file system . * @ return the list of recently used examples . */ private List loadRecentList ( ) { } }
try { InputStream in = new BufferedInputStream ( new FileInputStream ( RECENT_FILE_NAME ) ) ; XMLDecoder d = new XMLDecoder ( in ) ; Object result = d . readObject ( ) ; d . close ( ) ; return ( List ) result ; } catch ( FileNotFoundException ex ) { // This is ok , it ' s probably the first time the picker has been use...
public class CounterValue { /** * Creates a new { @ link CounterValue } with the value and state based on the boundaries . * @ param value the counter ' s value . * @ param lowerBound the counter ' s lower bound . * @ param upperBound the counter ' s upper bound . * @ return the { @ link CounterValue } . */ pub...
return new CounterValue ( value , calculateState ( value , lowerBound , upperBound ) ) ;
public class ForwardCloseRequest { /** * Encode the connection path . * { @ link PaddedEPath # encode ( EPath , ByteBuf ) } can ' t be used here because the { @ link ForwardCloseRequest } has an * extra reserved byte after the connection path size for some reason . * @ param path the { @ link PaddedEPath } to enc...
// length placeholder . . . int lengthStartIndex = buffer . writerIndex ( ) ; buffer . writeByte ( 0 ) ; // reserved buffer . writeZero ( 1 ) ; // encode the path segments . . . int dataStartIndex = buffer . writerIndex ( ) ; for ( EPathSegment segment : path . getSegments ( ) ) { if ( segment instanceof LogicalSegment...