signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class DevUtilsDemoObjects { /** * region > create ( action ) */
@ MemberOrder ( sequence = "2" ) public DevUtilsDemoObject create ( @ ParameterLayout ( named = "Name" ) final String name ) { } } | final DevUtilsDemoObject obj = container . newTransientInstance ( DevUtilsDemoObject . class ) ; obj . setName ( name ) ; container . persistIfNotAlready ( obj ) ; return obj ; |
public class XMLGregorianCalendar { /** * < p > Set time as one unit , including optional milliseconds . < / p >
* @ param hour value constraints are summarized in
* < a href = " # datetimefield - hour " > hour field of date / time field mapping table < / a > .
* @ param minute value constraints are summarized in... | setHour ( hour ) ; setMinute ( minute ) ; setSecond ( second ) ; setMillisecond ( millisecond ) ; |
public class SpringDataSourceFactoryBean { /** * { @ inheritDoc } */
@ Override protected DataSource createInstance ( ) { } } | if ( targetName == null ) { throw new IllegalStateException ( "targetName must not be null" ) ; } final DataSource dataSource = getBeanFactory ( ) . getBean ( targetName , DataSource . class ) ; JdbcWrapper . registerSpringDataSource ( targetName , dataSource ) ; final DataSource result = JdbcWrapper . SINGLETON . crea... |
public class RetryStageExecutionRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( RetryStageExecutionRequest retryStageExecutionRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( retryStageExecutionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( retryStageExecutionRequest . getPipelineName ( ) , PIPELINENAME_BINDING ) ; protocolMarshaller . marshall ( retryStageExecutionRequest . getStageName ( ) , ST... |
public class GDLLoader { /** * Returns a cache containing a mapping from variables to edges .
* @ param includeUserDefined include user - defined variables
* @ param includeAutoGenerated include auto - generated variables
* @ return immutable edge cache */
Map < String , Edge > getEdgeCache ( boolean includeUserD... | return getCache ( userEdgeCache , autoEdgeCache , includeUserDefined , includeAutoGenerated ) ; |
public class CommerceAccountUserRelServiceBaseImpl { /** * Sets the user group role remote service .
* @ param userGroupRoleService the user group role remote service */
public void setUserGroupRoleService ( com . liferay . portal . kernel . service . UserGroupRoleService userGroupRoleService ) { } } | this . userGroupRoleService = userGroupRoleService ; |
public class ApiOvhTelephony { /** * Get all available specific number from a country
* REST : GET / telephony / number / specificNumbers
* @ param type [ required ] The type of number
* @ param country [ required ] The country
* @ param zone [ required ] The zone ( geographic number )
* @ param range [ requi... | String qPath = "/telephony/number/specificNumbers" ; StringBuilder sb = path ( qPath ) ; query ( sb , "country" , country ) ; query ( sb , "range" , range ) ; query ( sb , "type" , type ) ; query ( sb , "zone" , zone ) ; String resp = execN ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t22 ) ... |
public class Stream { /** * Zip together the iterators until all of them runs out of values .
* Each array of values is combined into a single value using the supplied zipFunction function .
* @ param c
* @ param valuesForNone value to fill for any iterator runs out of values .
* @ param zipFunction
* @ retur... | if ( N . isNullOrEmpty ( c ) ) { return Stream . empty ( ) ; } final int len = c . size ( ) ; if ( len != valuesForNone . length ) { throw new IllegalArgumentException ( "The size of 'valuesForNone' must be same as the size of the collection of iterators" ) ; } final CharStream [ ] ss = c . toArray ( new CharStream [ l... |
public class Shape { /** * Iterate over 2
* coordinate spaces given 2 arrays
* @ param arr the first array
* @ param arr2 the second array
* @ param coordinateFunction the coordinate function to use */
public static void iterate ( INDArray arr , INDArray arr2 , CoordinateFunction coordinateFunction ) { } } | Shape . iterate ( 0 , arr . rank ( ) , arr . shape ( ) , new long [ arr . rank ( ) ] , 0 , arr2 . rank ( ) , arr2 . shape ( ) , new long [ arr2 . rank ( ) ] , coordinateFunction ) ; |
public class SearchViewFacade { /** * Sets a listener for user actions within the SearchView .
* @ param listener the listener object that receives callbacks when the user performs
* actions in the SearchView such as clicking on buttons or typing a query . */
public void setOnQueryTextListener ( @ NonNull final Sea... | if ( searchView != null ) { searchView . setOnQueryTextListener ( listener ) ; } else if ( supportView != null ) { supportView . setOnQueryTextListener ( new android . support . v7 . widget . SearchView . OnQueryTextListener ( ) { @ Override public boolean onQueryTextSubmit ( String query ) { return listener . onQueryT... |
public class BayesNetReader { /** * Reads a Bayesian Network from a network InputStream and a CPD InputStream , and returns
* a factor graph representation of it . */
public FactorGraph readBnAsFg ( InputStream networkIs , InputStream cpdIs ) throws IOException { } } | // Read network file .
BufferedReader networkReader = new BufferedReader ( new InputStreamReader ( networkIs ) ) ; // - - read the number of variables .
int numVars = Integer . parseInt ( networkReader . readLine ( ) . trim ( ) ) ; varMap = new HashMap < String , Var > ( ) ; VarSet allVars = new VarSet ( ) ; for ( int ... |
public class ELTools { /** * Yields the type of the variable displayed by a component .
* @ param p _ component
* the UIComponent
* @ return the type ( as class ) */
public static Class < ? > getType ( UIComponent p_component ) { } } | ValueExpression valueExpression = p_component . getValueExpression ( "value" ) ; if ( valueExpression != null ) { FacesContext context = FacesContext . getCurrentInstance ( ) ; ELContext elContext = context . getELContext ( ) ; return valueExpression . getType ( elContext ) ; } return null ; |
public class Utils { /** * Creates the launch context , which describes how to bring up a TaskExecutor / TaskManager process in
* an allocated YARN container .
* < p > This code is extremely YARN specific and registers all the resources that the TaskExecutor
* needs ( such as JAR file , config file , . . . ) and ... | // get and validate all relevant variables
String remoteFlinkJarPath = env . get ( YarnConfigKeys . FLINK_JAR_PATH ) ; require ( remoteFlinkJarPath != null , "Environment variable %s not set" , YarnConfigKeys . FLINK_JAR_PATH ) ; String appId = env . get ( YarnConfigKeys . ENV_APP_ID ) ; require ( appId != null , "Envi... |
public class dospolicy { /** * Use this API to fetch all the dospolicy resources that are configured on netscaler . */
public static dospolicy [ ] get ( nitro_service service ) throws Exception { } } | dospolicy obj = new dospolicy ( ) ; dospolicy [ ] response = ( dospolicy [ ] ) obj . get_resources ( service ) ; return response ; |
public class CachedRemoteTable { /** * Get / Make this remote database session for this table session .
* @ param properties The client database properties ( Typically for transaction support ) . */
public RemoteDatabase getRemoteDatabase ( Map < String , Object > properties ) throws RemoteException { } } | return m_tableRemote . getRemoteDatabase ( properties ) ; |
public class ChannelCreateHandler { /** * Handles server text channel creation .
* @ param channel The channel data . */
private void handleServerTextChannel ( JsonNode channel ) { } } | long serverId = channel . get ( "guild_id" ) . asLong ( ) ; api . getPossiblyUnreadyServerById ( serverId ) . ifPresent ( server -> { ServerTextChannel textChannel = ( ( ServerImpl ) server ) . getOrCreateServerTextChannel ( channel ) ; ServerChannelCreateEvent event = new ServerChannelCreateEventImpl ( textChannel ) ;... |
public class CompositeByteBuf { /** * Add the given { @ link ByteBuf } on the specific index and increase the { @ code writerIndex }
* if { @ code increaseWriterIndex } is { @ code true } .
* { @ link ByteBuf # release ( ) } ownership of { @ code buffer } is transferred to this { @ link CompositeByteBuf } .
* @ p... | checkNotNull ( buffer , "buffer" ) ; addComponent0 ( increaseWriterIndex , cIndex , buffer ) ; consolidateIfNeeded ( ) ; return this ; |
public class PropertyLoader { /** * Lookup object from JNDI
* @ param propertyKey property key
* @ param < T > JNDI object type
* @ return JNDI object */
@ SuppressWarnings ( "unchecked" ) private < T > T jndiLookup ( PropertyKey propertyKey ) { } } | String property = properties . getProperty ( propertyKey . getKey ( ) ) ; if ( property != null ) { return isJndiLazyLookup ( ) ? ( T ) LazyJndiResolver . newInstance ( property , DataSource . class ) : ( T ) JndiUtils . lookup ( property ) ; } return null ; |
public class Caster { /** * cast a Object to a int value ( primitive value type )
* @ param o Object to cast
* @ param defaultValue
* @ return casted int value */
public static int toIntValue ( Object o , int defaultValue ) { } } | if ( o instanceof Number ) return ( ( Number ) o ) . intValue ( ) ; else if ( o instanceof Boolean ) return ( ( Boolean ) o ) . booleanValue ( ) ? 1 : 0 ; else if ( o instanceof CharSequence ) return toIntValue ( o . toString ( ) . trim ( ) , defaultValue ) ; // else if ( o instanceof Clob ) return toIntValue ( toStrin... |
public class Pools { /** * Remove pool .
* @ param pool pool to remove */
public static void remove ( Pool pool ) { } } | if ( poolMap . containsKey ( pool . getUrlParser ( ) ) ) { synchronized ( poolMap ) { if ( poolMap . containsKey ( pool . getUrlParser ( ) ) ) { poolMap . remove ( pool . getUrlParser ( ) ) ; shutdownExecutor ( ) ; } } } |
public class AnnotatedString { /** * Return the appropriate mnemonic character for this string . If no mnemonic
* should be displayed , KeyEvent . VK _ UNDEFINED is returned .
* @ return the Mnemonic character , or VK _ UNDEFINED if no mnemonic should be
* set */
public int getMnemonic ( ) { } } | int mnemonic = KeyEvent . VK_UNDEFINED ; if ( ! MAC_OS_X ) { int index = getMnemonicIndex ( ) ; if ( ( index >= 0 ) && ( ( index + 1 ) < myAnnotatedString . length ( ) ) ) { mnemonic = Character . toUpperCase ( myAnnotatedString . charAt ( index + 1 ) ) ; } } return mnemonic ; |
public class ZipFile { /** * Closes the ZIP file .
* < p > Closing this ZIP file will close all of the input streams
* previously returned by invocations of the { @ link # getInputStream
* getInputStream } method .
* @ throws IOException if an I / O error has occurred */
public void close ( ) throws IOException... | if ( closeRequested ) return ; guard . close ( ) ; closeRequested = true ; synchronized ( this ) { // Close streams , release their inflaters
synchronized ( streams ) { if ( false == streams . isEmpty ( ) ) { Map < InputStream , Inflater > copy = new HashMap < > ( streams ) ; streams . clear ( ) ; for ( Map . Entry < I... |
public class VersionEdit { /** * REQUIRES : " smallest " and " largest " are smallest and largest keys in file */
public void addFile ( int level , long fileNumber , long fileSize , InternalKey smallest , InternalKey largest ) { } } | FileMetaData fileMetaData = new FileMetaData ( fileNumber , fileSize , smallest , largest ) ; addFile ( level , fileMetaData ) ; |
public class EmvParser { /** * Read public card data from parameter AID
* @ param pApplication
* application data
* @ return true if succeed false otherwise
* @ throws CommunicationException communication error */
protected boolean extractPublicData ( final Application pApplication ) throws CommunicationExcepti... | boolean ret = false ; // Select AID
byte [ ] data = selectAID ( pApplication . getAid ( ) ) ; // check response
// Add SW _ 6285 to fix Interact issue
if ( ResponseUtils . contains ( data , SwEnum . SW_9000 , SwEnum . SW_6285 ) ) { // Update reading state
pApplication . setReadingStep ( ApplicationStepEnum . SELECTED )... |
public class FileUtils { /** * 遍历指定文件夹下所有文件
* @ param file 文件夹
* @ return 指定文件夹下所有文件 ( 不包括文件夹 , 只有文件 , 如果给定的不是文件夹而是文件的话将会返回文件本身 ) */
public static List < File > findAllFile ( File file ) { } } | if ( file == null || ! file . exists ( ) ) { return Collections . emptyList ( ) ; } if ( file . isFile ( ) ) { return Collections . singletonList ( file ) ; } List < File > fileList = new ArrayList < > ( ) ; File [ ] files = file . listFiles ( ) ; for ( File f : files ) { fileList . addAll ( findAllFile ( f ) ) ; } ret... |
public class BaseMoskitoUIAction { /** * Sets an info message that can be shown on next screen . The info message is readable exactly once .
* @ param message the info message . */
protected void setInfoMessage ( String message ) { } } | try { APICallContext . getCallContext ( ) . getCurrentSession ( ) . setAttribute ( "infoMessage" , APISession . POLICY_FLASH , message ) ; } catch ( NullPointerException e ) { log . error ( "Can't set info message (flash) due" , e ) ; log . error ( "APICallContext: " + APICallContext . getCallContext ( ) ) ; if ( APICa... |
public class RedisTransporter { /** * - - - SUBSCRIBE - - - */
@ Override public Promise subscribe ( String channel ) { } } | if ( status . get ( ) == STATUS_CONNECTED ) { return clientSub . subscribe ( channel ) ; } return Promise . resolve ( ) ; |
public class PermitMonitor { private void initMainStemStatus ( ) { } } | String path = null ; try { path = StagePathUtils . getMainStem ( getPipelineId ( ) ) ; byte [ ] bytes = zookeeper . readData ( path ) ; initMainStemStatus ( bytes ) ; } catch ( ZkNoNodeException e ) { // mainstem节点挂了后 , 状态直接修改为taking
mainStemStatus = MainStemEventData . Status . TAKEING ; permitSem ( ) ; } catch ( ZkEx... |
public class DB_PostgreSQL { /** * Remapping json directly to object as opposed to traversing the tree
* @ param recordValue
* @ return
* @ throws JsonParseException
* @ throws JsonMappingException
* @ throws IOException */
private Object jsonToObject ( String recordValue ) throws JsonParseException , JsonMap... | ObjectMapper mapper = new ObjectMapper ( ) ; Object json = mapper . readValue ( recordValue , Object . class ) ; return json ; |
public class WsException { /** * Initialize the cause field for this WsException to the specified value .
* The cause is the Throwable that caused this WsException to get thrown .
* This method can be called at most once . It is generally called from within a constructor that takes a Throwable , or immediately afte... | super . initCause ( cause ) ; ivCause = cause ; causeInitialized = true ; return this ; |
public class Driver { /** * Unregisters specified handler .
* @ param id Handler ID
* @ return Handler , or null if none
* @ see # register */
public static ConnectionHandler unregister ( final String id ) { } } | if ( id == null || id . length ( ) == 0 ) { return null ; // Not possible
} // end of if
return handlers . remove ( id ) ; |
public class Template { /** * Debug this template .
* @ param vars
* @ param out
* @ param listener
* @ return Context
* @ throws ScriptRuntimeException
* @ throws ParseException */
public Context debug ( final Vars vars , final Out out , final BreakpointListener listener ) { } } | try { return Parser . parse ( this , listener ) . execute ( this , out , vars ) ; } catch ( Exception e ) { throw completeException ( e ) ; } |
public class ByteUtils { /** * Copy the specified bytes into a new array
* @ param array The array to copy from
* @ param from The index in the array to begin copying from
* @ param to The least index not copied
* @ return A new byte [ ] containing the copied bytes */
public static byte [ ] copy ( byte [ ] arra... | if ( to - from < 0 ) { return new byte [ 0 ] ; } else { byte [ ] a = new byte [ to - from ] ; System . arraycopy ( array , from , a , 0 , to - from ) ; return a ; } |
public class nstcpparam { /** * Use this API to fetch all the nstcpparam resources that are configured on netscaler . */
public static nstcpparam get ( nitro_service service ) throws Exception { } } | nstcpparam obj = new nstcpparam ( ) ; nstcpparam [ ] response = ( nstcpparam [ ] ) obj . get_resources ( service ) ; return response [ 0 ] ; |
public class RunWindupCommand { private String getOptionName ( String argument ) { } } | if ( argument == null ) return null ; else if ( argument . startsWith ( "--" ) ) return argument . substring ( 2 ) ; else if ( argument . startsWith ( "-" ) ) return argument . substring ( 1 ) ; else return null ; |
public class GvmCluster { /** * Sets this cluster equal to the specified cluster
* @ param cluster a cluster , not this or null */
void set ( GvmCluster < S , K > cluster ) { } } | if ( cluster == this ) throw new IllegalArgumentException ( "cannot set cluster to itself" ) ; m0 = cluster . m0 ; clusters . space . setTo ( m1 , cluster . m1 ) ; clusters . space . setTo ( m2 , cluster . m2 ) ; var = cluster . var ; |
public class EscapeTool { /** * We override the implementation so that we sync it with the encoding strategy we use for generating URLs . Namely
* we encode all characters and we encode space as { @ code % 20 } and not as { @ code + } in the query string .
* @ param string the url to encode
* @ return the encoded... | // TODO : Introduce a xwiki - commons - url module and move this code in it so that we can share it with
// platform ' s XWikiServletURLFactory and functional test TestUtils class .
String encodedURL = null ; if ( string != null ) { try { encodedURL = URLEncoder . encode ( String . valueOf ( string ) , "UTF-8" ) ; } ca... |
public class ClassIntrospectorImpl { /** * Returns the first constructor found that matches the filter parameter .
* @ param filter Filter to apply .
* @ return the first constructor found that matches the filter parameter .
* @ throws IllegalArgumentException if no constructor is found matching the filter . */
@... | return ConstructorUtils . getConstructors ( target , filter ) ; |
public class ClusterScanSupport { /** * Retrieve a list of node Ids to use for the SCAN operation .
* @ param connection
* @ return */
private static List < String > getNodeIds ( StatefulRedisClusterConnection < ? , ? > connection ) { } } | List < String > nodeIds = new ArrayList < > ( ) ; PartitionAccessor partitionAccessor = new PartitionAccessor ( connection . getPartitions ( ) ) ; for ( RedisClusterNode redisClusterNode : partitionAccessor . getMasters ( ) ) { if ( connection . getReadFrom ( ) != null ) { List < RedisNodeDescription > readCandidates =... |
public class NameNode { /** * The client needs to give up on the block . */
public void abandonBlock ( Block b , String src , String holder ) throws IOException { } } | abandonBlockInternal ( b , src , holder ) ; |
public class JSONUtil { /** * 设置表达式指定位置 ( 或filed对应 ) 的值 < br >
* 若表达式指向一个JSONArray则设置其坐标对应位置的值 , 若指向JSONObject则put对应key的值 < br >
* 注意 : 如果为JSONArray , 则设置值得下标不能大于已有JSONArray的长度 < br >
* < ol >
* < li > . 表达式 , 可以获取Bean对象中的属性 ( 字段 ) 值或者Map中key对应的值 < / li >
* < li > [ ] 表达式 , 可以获取集合等对象中对应index的值 < / li >
* < ... | json . putByPath ( expression , value ) ; |
public class AnonymousPersistentField { /** * Use ReferenceIdentityMap ( with weak key and hard value setting ) instead of
* WeakHashMap to hold anonymous field values . Here is an snip of the mail from Andy Malakov :
* < snip >
* I found that usage of database identity in Java produces quite interesting problem ... | if ( key != null ) { if ( fkCache == null ) { fkCache = new ReferenceIdentityMap ( ReferenceIdentityMap . WEAK , ReferenceIdentityMap . HARD , true ) ; } if ( value != null ) fkCache . put ( key , value ) ; else fkCache . remove ( key ) ; } |
public class DoubleBinaryMatrix { /** * Composes determinant by using permutations
* @ return */
public DoubleBinaryOperator determinant ( ) { } } | int sign = 1 ; SumBuilder sum = DoubleBinaryOperators . sumBuilder ( ) ; PermutationMatrix pm = PermutationMatrix . getInstance ( rows ) ; int perms = pm . rows ; for ( int p = 0 ; p < perms ; p ++ ) { MultiplyBuilder mul = DoubleBinaryOperators . multiplyBuilder ( ) ; for ( int i = 0 ; i < rows ; i ++ ) { mul . add ( ... |
public class JobInstanceSqlMapDao { /** * this will be called from Job Status Listener when Job is completed . */
public void deleteJobPlanAssociatedEntities ( JobInstance job ) { } } | JobPlan jobPlan = loadPlan ( job . getId ( ) ) ; environmentVariableDao . deleteAll ( jobPlan . getVariables ( ) ) ; artifactPlanRepository . deleteAll ( jobPlan . getArtifactPlansOfType ( ArtifactPlanType . file ) ) ; artifactPropertiesGeneratorRepository . deleteAll ( jobPlan . getPropertyGenerators ( ) ) ; resourceR... |
public class URLImageInputStream { /** * Get input stream for the image through http connection . */
private void setupInputStream ( ) throws IOException { } } | HttpURLConnection connection = ( HttpURLConnection ) url . openConnection ( ) ; // set timeout for connecting and reading
connection . setConnectTimeout ( httpTimeout ) ; connection . setReadTimeout ( httpTimeout ) ; if ( connection . getResponseCode ( ) != HttpURLConnection . HTTP_OK ) { throw new IOException ( "Fetch... |
public class CronSequenceGenerator { /** * Gets the range .
* @ param field the field
* @ param min the min
* @ param max the max
* @ return the range */
private int [ ] getRange ( String field , int min , int max ) { } } | int [ ] result = new int [ 2 ] ; if ( field . contains ( "*" ) ) { result [ 0 ] = min ; result [ 1 ] = max - 1 ; return result ; } if ( ! field . contains ( "-" ) ) { result [ 0 ] = result [ 1 ] = Integer . valueOf ( field ) ; } else { String [ ] split = StringUtils . delimitedListToStringArray ( field , "-" ) ; if ( s... |
public class ClassLoaderUtil { /** * Returns a fallback class loader .
* @ return A class loader */
public static ClassLoader getClassLoader ( ) { } } | ClassLoader cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( cl == null ) { cl = ClassLoader . getSystemClassLoader ( ) ; if ( cl == null ) { // When this method is called for initializing a ICU4J class
// during bootstrap , cl might be still null ( other than Android ? ) .
// In this case , we want t... |
public class MovingAverageIterable { /** * / * ( non - Javadoc )
* @ see java . lang . Iterable # iterator ( ) */
@ Override public Iterator < Row > iterator ( ) { } } | return new MovingAverageIterator ( seq , dims , factories , emptyEvents , aggMap ) ; |
public class InstrumentedScheduledExecutorService { /** * { @ inheritDoc } */
@ Override public void execute ( Runnable command ) { } } | submitted . mark ( ) ; delegate . execute ( new InstrumentedRunnable ( command ) ) ; |
public class BuilderDefaults { /** * Returns an empty map if the input is null
* @ param newValue - nullable map value
* @ param < K > - map key
* @ param < V > - map value
* @ return non - null Map */
public static < K , V > Map < K , V > nullToEmptyMap ( Map < K , V > newValue ) { } } | if ( newValue == null ) { return new HashMap < > ( ) ; } return newValue ; |
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIfcPileConstructionEnumToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class GeometryUtil { /** * Returns the geometric center of all the atoms in the atomContainer . See comment for
* center ( IAtomContainer atomCon , Dimension areaDim , HashMap renderingCoordinates ) for details
* on coordinate sets
* @ param container Description of the Parameter
* @ return the geometric... | double centerX = 0 ; double centerY = 0 ; double counter = 0 ; for ( IAtom atom : container . atoms ( ) ) { if ( atom . getPoint2d ( ) != null ) { centerX += atom . getPoint2d ( ) . x ; centerY += atom . getPoint2d ( ) . y ; counter ++ ; } } return new Point2d ( centerX / ( counter ) , centerY / ( counter ) ) ; |
public class NetworkFragment { /** * < p > Registers a { @ link BroadcastReceiver } to listen for changes in the data
* connection state and invoke the appropriate callbacks . */
@ Override public void onResume ( ) { } } | super . onResume ( ) ; if ( ProfileService . getInstance ( getActivity ( ) . getApplicationContext ( ) ) . isActive ( this , Profile . NETWORK ) ) { if ( ! PermissionUtils . isGranted ( this , Manifest . permission . ACCESS_NETWORK_STATE ) ) { Log . e ( getClass ( ) . getSimpleName ( ) , "Failed to register a receiver ... |
public class UserDataManager { /** * Get the file system resource of the passed UDO object .
* @ param aUDO
* The UDO object to get the resource from .
* @ return The matching file system resource . No check is performed , whether
* the resource exists or not ! */
@ Nonnull public static FileSystemResource getR... | ValueEnforcer . notNull ( aUDO , "UDO" ) ; return _getFileIO ( ) . getResource ( getUserDataPath ( ) + aUDO . getPath ( ) ) ; |
public class OSUtils { /** * Kill the process .
* @ param pid Process id
* @ throws IOException */
public static void kill ( final long pid ) throws IOException , InterruptedException { } } | if ( isUnix ( ) ) { final Process process = new ProcessBuilder ( ) . command ( "bash" , "-c" , "kill" , "-9" , String . valueOf ( pid ) ) . start ( ) ; final int returnCode = process . waitFor ( ) ; LOG . fine ( "Kill returned: " + returnCode ) ; } else if ( isWindows ( ) ) { final Process process = new ProcessBuilder ... |
public class MultiViewOps { /** * Creates a trifocal tensor from three camera matrices . The
* Page 415 in R . Hartley , and A . Zisserman , " Multiple View Geometry in Computer Vision " , 2nd Ed , Cambridge 2003
* @ param P2 Camera matrix for view 1 . 3x4 matrix
* @ param P2 Camera matrix for view 2 . 3x4 matrix... | if ( ret == null ) ret = new TrifocalTensor ( ) ; // invariant to scale . So pick something more reasonable and maybe reduce overflow
double scale = 0 ; scale = Math . max ( scale , CommonOps_DDRM . elementMaxAbs ( P1 ) ) ; scale = Math . max ( scale , CommonOps_DDRM . elementMaxAbs ( P2 ) ) ; scale = Math . max ( scal... |
public class DateTimeFormatter { /** * Prints a ReadableInstant to a String .
* This method will use the override zone and the override chronology if
* they are set . Otherwise it will use the chronology and zone of the instant .
* @ param instant instant to format , null means now
* @ return the printed result... | StringBuilder buf = new StringBuilder ( requirePrinter ( ) . estimatePrintedLength ( ) ) ; try { printTo ( ( Appendable ) buf , instant ) ; } catch ( IOException ex ) { // StringBuilder does not throw IOException
} return buf . toString ( ) ; |
public class Checker { /** * < editor - fold defaultstate = " collapsed " desc = " HTML elements " > */
@ Override @ DefinedBy ( Api . COMPILER_TREE ) public Void visitStartElement ( StartElementTree tree , Void ignore ) { } } | final Name treeName = tree . getName ( ) ; final HtmlTag t = HtmlTag . get ( treeName ) ; if ( t == null ) { env . messages . error ( HTML , tree , "dc.tag.unknown" , treeName ) ; } else if ( t . allowedVersion != HtmlVersion . ALL && t . allowedVersion != env . htmlVersion ) { env . messages . error ( HTML , tree , "d... |
public class InMemoryPartition { /** * UNSAFE ! ! overwrites record
* causes inconsistency or data loss for overwriting everything but records of the exact same size
* @ param pointer pointer to start of record
* @ param record record to overwrite old one with
* @ throws IOException
* @ deprecated Don ' t use... | long tmpPointer = this . writeView . getCurrentPointer ( ) ; this . writeView . resetTo ( pointer ) ; this . serializer . serialize ( record , this . writeView ) ; this . writeView . resetTo ( tmpPointer ) ; |
public class LessObject { /** * If cause is already a LessException then filename , line number and column of the current object are added to the less stacktrace .
* With any other type of exception a new LessException is created .
* @ param cause the cause
* @ return the exception */
@ Nonnull LessException crea... | LessException lessEx = cause . getClass ( ) == LessException . class ? ( LessException ) cause : new LessException ( cause ) ; lessEx . addPosition ( filename , line , column ) ; return lessEx ; |
public class ULocale { /** * < strong > [ icu ] < / strong > Returns a keyword value localized for display in the specified locale .
* This is a cover for the ICU4C API .
* @ param localeID the id of the locale whose keyword value is to be displayed .
* @ param keyword the keyword whose value is to be displayed .... | return getDisplayKeywordValueInternal ( new ULocale ( localeID ) , keyword , displayLocale ) ; |
public class HadoopLocationWizard { /** * Performs any actions appropriate in response to the user having pressed
* the Finish button , or refuse if finishing now is not permitted .
* @ return the created or updated Hadoop location */
public HadoopServer performFinish ( ) { } } | try { if ( this . original == null ) { // New location
Display . getDefault ( ) . syncExec ( new Runnable ( ) { public void run ( ) { ServerRegistry . getInstance ( ) . addServer ( HadoopLocationWizard . this . location ) ; } } ) ; return this . location ; } else { // Update location
final String originalName = this . ... |
public class Pipes { /** * Extact one value from the selected pipe or an error if it doesn ' t exist ( NoSuchElementException ) .
* < pre >
* { @ code
* Queue < String > q = new Queue < > ( ) ;
* pipes . register ( " hello " , q ) ;
* pipes . push ( " hello " , " world " ) ;
* pipes . push ( " hello " , " w... | final ValueSubscriber < V > sub = ValueSubscriber . subscriber ( ) ; return get ( key ) . peek ( a -> a . stream ( ) . subscribe ( sub ) ) . map ( a -> sub . toEither ( ) ) . orElse ( Either . left ( new NoSuchElementException ( "no adapter for key " + key ) ) ) ; |
public class AbstractIoService { /** * { @ inheritDoc } */
@ Override public final void setHandler ( org . apache . mina . core . service . IoHandler handler ) { } } | if ( handler == null ) { throw new NullPointerException ( "handler cannot be null" ) ; } if ( isActive ( ) ) { throw new IllegalStateException ( "handler cannot be set while the service is active." ) ; } this . handler = handler ; |
public class PasswordUtil { /** * Encode the provided password by using the default encoding algorithm . The encoded string consists of the algorithm of the encoding and the encoded value .
* For example , { xor } CDo9Hgw = .
* If the decoded _ string is already encoded , the string will be decoded and then encoded... | return encode ( decoded_string , PasswordCipherUtil . getSupportedCryptoAlgorithms ( ) [ 0 ] , ( String ) null ) ; |
public class RamlControllerVisitor { /** * A method normalizing " resource " path . In RAML resource path must neither be empty ( " / " is used in this case ) ,
* not ends with " / " ( as all uri must start with " / " ) .
* @ param uri the uri to normalized
* @ return the normalized path */
private String normali... | String relativeUri = extractRelativeUrl ( uri , null ) ; if ( relativeUri . endsWith ( "/" ) && relativeUri . length ( ) != 1 ) { relativeUri = StringUtils . removeEndIgnoreCase ( relativeUri , "/" ) ; } return relativeUri ; |
public class PrefsInterface { /** * Returns the default hidden preference for the user .
* @ return boolean hidden or not
* @ throws FlickrException */
public boolean getHidden ( ) throws FlickrException { } } | Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_HIDDEN ) ; Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ... |
public class SqlLoaderImpl { /** * キーが存在する場合は上書きを行わずに指定されたマップのすべてのマッピングをこのマップにコピーします
* @ param baseMap マージ先の対象データ ( マップの内容が更新されます )
* @ param map コピーの対象データ */
private void putAllIfAbsent ( final Map < String , String > baseMap , final Map < String , String > map ) { } } | for ( Map . Entry < String , String > entry : map . entrySet ( ) ) { if ( ! baseMap . containsKey ( entry . getKey ( ) ) ) { baseMap . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } } |
public class JodaBeanReferencingBinReader { /** * parses the references */
private void parseClassDescriptions ( ) throws Exception { } } | int refCount = acceptInteger ( input . readByte ( ) ) ; if ( refCount < 0 ) { throw new IllegalArgumentException ( "Invalid binary data: Expected count of references, but was: " + refCount ) ; } refs = new Object [ refCount ] ; int classMapSize = acceptMap ( input . readByte ( ) ) ; classes = new ClassInfo [ classMapSi... |
public class CmsContentService { /** * Returns the RDF annotations required for in line editing . < p >
* @ param document the parent XML document
* @ param contentLocale the content locale
* @ param elementPath the element xpath to get the RDF annotation for
* @ return the RDFA */
public static String getRdfaA... | I_CmsXmlSchemaType schemaType = document . getContentDefinition ( ) . getSchemaType ( elementPath ) ; if ( schemaType != null ) { String path = "" ; if ( elementPath . contains ( "/" ) ) { path += "/" + removePathIndexes ( elementPath . substring ( 0 , elementPath . lastIndexOf ( "/" ) ) + ":" ) ; } path += getTypeUri ... |
public class InterfaceEndpointsInner { /** * Deletes the specified interface endpoint .
* @ param resourceGroupName The name of the resource group .
* @ param interfaceEndpointName The name of the interface endpoint .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudE... | deleteWithServiceResponseAsync ( resourceGroupName , interfaceEndpointName ) . toBlocking ( ) . last ( ) . body ( ) ; |
public class AmazonCodeDeployClient { /** * Gets information about one or more on - premises instances .
* @ param batchGetOnPremisesInstancesRequest
* Represents the input of a BatchGetOnPremisesInstances operation .
* @ return Result of the BatchGetOnPremisesInstances operation returned by the service .
* @ t... | request = beforeClientExecution ( request ) ; return executeBatchGetOnPremisesInstances ( request ) ; |
public class Grammar { /** * Gets the precedence of the associated infix handler .
* @ param token The token whose handler we want precedence for
* @ return the precedence of the associated infix handler or 0 if there is none . */
public int precedence ( ParserToken token ) { } } | if ( isInfix ( token ) ) { return infixHandlers . get ( token . type ) . precedence ( ) ; } return 0 ; |
public class StartExportTaskRequest { /** * The file format for the returned export data . Default value is < code > CSV < / code > . < b > Note : < / b > < i > The < / i >
* < code > GRAPHML < / code > < i > option has been deprecated . < / i >
* < b > NOTE : < / b > This method appends the values to the existing ... | if ( this . exportDataFormat == null ) { setExportDataFormat ( new java . util . ArrayList < String > ( exportDataFormat . length ) ) ; } for ( String ele : exportDataFormat ) { this . exportDataFormat . add ( ele ) ; } return this ; |
public class BinaryJedis { /** * INCRBY work just like { @ link # incr ( byte [ ] ) INCR } but instead to increment by 1 the increment is
* integer .
* INCR commands are limited to 64 bit signed integers .
* Note : this is actually a string operation , that is , in Redis there are not " integer " types .
* Simp... | checkIsInMultiOrPipeline ( ) ; client . incrBy ( key , increment ) ; return client . getIntegerReply ( ) ; |
public class RoleDAO { /** * Add a single Permission to the Role ' s Permission Collection
* @ param trans
* @ param role
* @ param perm
* @ param type
* @ param action
* @ return */
public Result < Void > addPerm ( AuthzTrans trans , RoleDAO . Data role , PermDAO . Data perm ) { } } | // Note : Prepared Statements for Collection updates aren ' t supported
String pencode = perm . encode ( ) ; try { getSession ( trans ) . execute ( UPDATE_SP + TABLE + " SET perms = perms + {'" + pencode + "'} WHERE " + "ns = '" + role . ns + "' AND name = '" + role . name + "';" ) ; } catch ( DriverException | APIExce... |
public class AjaxAddableTabbedPanel { /** * On new tab .
* @ param target
* the target
* @ param tab
* the tab
* @ param index
* the index */
public void onNewTab ( final AjaxRequestTarget target , final T tab , final int index ) { } } | if ( ( index < 0 ) || ( index >= getTabs ( ) . size ( ) ) ) { throw new IndexOutOfBoundsException ( ) ; } getTabs ( ) . add ( index , tab ) ; setSelectedTab ( index ) ; target . add ( this ) ; |
public class EncryptedCachedDiskStringsTable { /** * Adds a string to the table on disk
* @ param str string to store
* @ param os OutputStream to use to write it
* @ throws IOException */
private void addString ( String str , OutputStream os ) throws IOException { } } | if ( this . cacheSize >= 0 ) { // add to disk
byte [ ] strbytes = str . getBytes ( EncryptedCachedDiskStringsTable . encoding ) ; byte [ ] sizeOfStr = ByteBuffer . allocate ( 4 ) . putInt ( strbytes . length ) . array ( ) ; this . stringPositionInFileList . add ( this . tempFileSize ) ; if ( os != null ) { os . write (... |
public class ObjectManager { /** * Locate a transaction registered with this ObjectManager .
* with the same XID as the one passed .
* If a null XID is passed this will return any registered transaction with a null XID .
* @ param XID Xopen identifier .
* @ return Transaction identified by the XID .
* @ throw... | if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "getTransactionByXID" , "XIDe=" + XID + "(byte[]" ) ; Transaction transaction = objectManagerState . getTransactionByXID ( XID ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( ... |
public class Minutes { /** * Subtracts this amount from the specified temporal object .
* This returns a temporal object of the same observable type as the input
* with this amount subtracted .
* In most cases , it is clearer to reverse the calling pattern by using
* { @ link Temporal # minus ( TemporalAmount )... | if ( minutes != 0 ) { temporal = temporal . minus ( minutes , MINUTES ) ; } return temporal ; |
public class Search { /** * Group results by the specified field .
* @ param fieldName by which to group results
* @ param isNumber whether field isNumeric .
* @ return this for additional parameter setting or to query */
public Search groupField ( String fieldName , boolean isNumber ) { } } | assertNotEmpty ( fieldName , "fieldName" ) ; if ( isNumber ) { databaseHelper . query ( "group_field" , fieldName + "<number>" ) ; } else { databaseHelper . query ( "group_field" , fieldName ) ; } return this ; |
public class ChronicleMapBuilder { /** * Configures the average number of bytes , taken by serialized form of values , put into maps ,
* created by this builder . However , in many cases { @ link # averageValue ( Object ) } might be easier
* to use and more reliable . If value size is always the same , call { @ lin... | checkSizeIsStaticallyKnown ( valueBuilder , "Value" ) ; checkAverageSize ( averageValueSize , "value" ) ; this . averageValueSize = averageValueSize ; averageValue = null ; sampleValue = null ; return this ; |
public class PrintStreamMonitor { /** * Notify the monitor of the an error during the download
* process .
* @ param resource the name of the remote resource .
* @ param message a non - localized message describing the problem in english . */
public void notifyError ( URL resource , String message ) { } } | m_out . println ( resource . toExternalForm ( ) + " : " + message ) ; |
public class StAXEncoder { /** * Writes a processing instruction
* ( non - Javadoc )
* @ see
* javax . xml . stream . XMLStreamWriter # writeProcessingInstruction ( java . lang
* . String , java . lang . String ) */
public void writeProcessingInstruction ( String target , String data ) throws XMLStreamException... | if ( preservePI ) { try { this . checkPendingATEvents ( ) ; encoder . encodeProcessingInstruction ( target , data ) ; } catch ( Exception e ) { throw new XMLStreamException ( e . getLocalizedMessage ( ) , e ) ; } } |
public class Skip32 { /** * Decrypts the provided value using the specified key
* The key should be a byte array of 10 elements .
* @ param value
* @ param key
* @ return The decrypted value */
public static int decrypt ( int value , byte [ ] key ) { } } | int [ ] buf = new int [ 4 ] ; buf [ 0 ] = ( ( value >> 24 ) & 0xff ) ; buf [ 1 ] = ( ( value >> 16 ) & 0xff ) ; buf [ 2 ] = ( ( value >> 8 ) & 0xff ) ; buf [ 3 ] = ( ( value >> 0 ) & 0xff ) ; skip32 ( key , buf , false ) ; int out = ( ( buf [ 0 ] ) << 24 ) | ( ( buf [ 1 ] ) << 16 ) | ( ( buf [ 2 ] ) << 8 ) | ( buf [ 3 ... |
public class DaVinci { /** * Try to load [ path ] image from cache
* @ param path Path or Url of the bitmap
* @ return Bitmap from cache if founded */
private Bitmap loadFromLruCache ( final String path , boolean tryFromDisk ) { } } | int key = getKey ( path ) ; Bitmap bitmap = mImagesCache . get ( key ) ; // try to retrieve from lruCache
Log . d ( TAG , "bitmap " + path + " from lruCache [" + key + "] " + bitmap ) ; if ( tryFromDisk && bitmap == null ) { bitmap = loadFromDiskLruCache ( key ) ; // try to retrieve from disk cache
Log . d ( TAG , "bit... |
public class DssatCommonOutput { /** * Get experiment name without any extention content after first underscore
* @ param result date holder for experiment data
* @ return experiment name */
protected String getExName ( Map result ) { } } | String ret = getValueOr ( result , "exname" , "" ) ; if ( ret . matches ( "\\w+\\.\\w{2}[Xx]" ) ) { ret = ret . substring ( 0 , ret . length ( ) - 1 ) . replace ( "." , "" ) ; } // TODO need to be updated with a translate rule for other models ' exname
if ( ret . matches ( ".+(_+\\d+)+$" ) ) { ret = ret . replaceAll ( ... |
public class AppBndAuthorizationTableService { /** * Register the webcontainer ' s default delegation provider .
* @ param cc */
private void registerDefaultDelegationProvider ( ComponentContext cc ) { } } | defaultDelegationProvider = new DefaultDelegationProvider ( ) ; defaultDelegationProvider . setSecurityService ( securityServiceRef . getService ( ) ) ; defaultDelegationProvider . setIdentityStoreHandlerService ( identityStoreHandlerServiceRef ) ; BundleContext bc = cc . getBundleContext ( ) ; Dictionary < String , Ob... |
public class LUDecomposition { /** * Return lower triangular factor
* @ return L */
public double [ ] [ ] getL ( ) { } } | double [ ] [ ] L = new double [ m ] [ n ] ; L [ 0 ] [ 0 ] = 1. ; for ( int i = 1 ; i < m ; i ++ ) { final double [ ] Li = L [ i ] ; System . arraycopy ( LU [ i ] , 0 , Li , 0 , Math . min ( i , n ) ) ; if ( i < n ) { Li [ i ] = 1. ; } } return L ; |
public class AuditUtil { /** * Transform map .
* @ param paramMap
* the param map
* @ return the map */
public static Map < String , String > transformMap ( final Map < String , Object > paramMap ) { } } | final Map < String , String > paramStrMap = new LinkedHashMap < String , String > ( ) ; for ( final Map . Entry < String , Object > entry : paramMap . entrySet ( ) ) { paramStrMap . put ( entry . getKey ( ) , entry . getValue ( ) . toString ( ) ) ; } return paramStrMap ; |
public class CommerceAddressLocalServiceUtil { /** * Updates the commerce address in the database or adds it if it does not yet exist . Also notifies the appropriate model listeners .
* @ param commerceAddress the commerce address
* @ return the commerce address that was updated */
public static com . liferay . com... | return getService ( ) . updateCommerceAddress ( commerceAddress ) ; |
public class XGenBuff { /** * Normal case of building up Cached HTML without transaction info
* @ param cache
* @ param code
* @ throws APIException
* @ throws IOException */
public void run ( Cache < G > cache , Code < G > code ) throws APIException , IOException { } } | code . code ( cache , xgen ) ; |
public class SntpMessage { /** * NTP - Timestamp aus byte - Array dekodieren */
private static double decode ( byte [ ] data , int pointer ) { } } | long ntp = 0L ; for ( int i = 0 ; i < 8 ; i ++ ) { long unsigned = ( data [ i + pointer ] & 0xFF ) ; ntp |= ( unsigned << ( 56 - i * 8 ) ) ; } // Festkomma vor Bit 32 , deshalb Bits nach rechts schieben
long integer = ( ( ntp >>> 32 ) & 0xFFFFFFFFL ) ; long fraction = ( ( ( ntp & 0xFFFFFFFFL ) * MIO ) >>> 32 ) ; long o... |
public class FlowLayoutA { /** * { @ inheritDoc } */
@ Override protected void onLayout ( boolean changed , int l , int t , int r , int b ) { } } | mLines . clear ( ) ; mLineHeights . clear ( ) ; mLineMargins . clear ( ) ; int width = getWidth ( ) ; int height = getHeight ( ) ; int linesSum = getPaddingTop ( ) ; int lineWidth = 0 ; int lineHeight = 0 ; List < View > lineViews = new ArrayList < View > ( ) ; float horizontalGravityFactor ; switch ( ( mGravity & Grav... |
public class SchemaBuilder { /** * Shortcut for { @ link # dropAggregate ( CqlIdentifier , CqlIdentifier )
* dropAggregate ( CqlIdentifier . fromCql ( keyspace ) , CqlIdentifier . fromCql ( aggregateName ) } . */
@ NonNull public static Drop dropAggregate ( @ Nullable String keyspace , @ NonNull String aggregateName ... | return new DefaultDrop ( keyspace == null ? null : CqlIdentifier . fromCql ( keyspace ) , CqlIdentifier . fromCql ( aggregateName ) , "AGGREGATE" ) ; |
public class ZipFileArtifactNotifier { /** * Update the monitor service according to whether any listeners
* are registered . That is , if any covering paths are present .
* When listeners are registered , register the file monitor as
* a service . When no listeners are registered , unregister the
* file monito... | if ( ! coveringPaths . isEmpty ( ) ) { if ( service == null ) { try { // If we are shutting down , we want to generate the exception quickly .
BundleContext bundleContext = getContainerFactoryHolder ( ) . getBundleContext ( ) ; // throws ' IllegalStateException '
setServiceProperties ( ) ; service = bundleContext . reg... |
public class GCCBEZImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . GCCBEZ__RG : return rg != null && ! rg . isEmpty ( ) ; } return super . eIsSet ( featureID ) ; |
public class ColumnCounts_DSCC { /** * Initializes class data structures and parameters */
void initialize ( DMatrixSparseCSC A ) { } } | m = A . numRows ; n = A . numCols ; int s = 4 * n + ( ata ? ( n + m + 1 ) : 0 ) ; gw . reshape ( s ) ; w = gw . data ; // compute the transpose of A
At . reshape ( A . numCols , A . numRows , A . nz_length ) ; CommonOps_DSCC . transpose ( A , At , gw ) ; // initialize w
Arrays . fill ( w , 0 , s , - 1 ) ; // assign all... |
public class FrameOutputWriter { /** * Construct FrameOutputWriter object and then use it to generate the Html
* file which will have the description of all the frames in the
* documentation . The name of the generated file is " index . html " which is
* the default first file for Html documents .
* @ throws Do... | FrameOutputWriter framegen ; DocPath filename = DocPath . empty ; try { filename = DocPaths . INDEX ; framegen = new FrameOutputWriter ( configuration , filename ) ; framegen . generateFrameFile ( ) ; framegen . close ( ) ; } catch ( IOException exc ) { configuration . standardmessage . error ( "doclet.exception_encoun... |
public class TraceNLSResolver { /** * Common method to use Tr to log that something above couldn ' t be resolved .
* This method further checks whether or not the
* < code > com . ibm . ejs . ras . debugTraceNLSResolver < / code > property has been set
* before calling Tr to log the event .
* @ param message
... | // if ( makeNoise & & tc . isEventEnabled ( ) )
// if ( args = = null )
// com . ibm . websphere . ras . Tr . event ( tc , message ) ;
// else
// com . ibm . websphere . ras . Tr . event ( tc , MessageFormat . format ( message ,
// args ) ) ;
System . err . println ( "com.ibm.ejs.ras.hpel.TraceNLSResolver: " + MessageF... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.