signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class GoogleAuthenticatorTokenCouchDbRepository { /** * Token count for a user . * @ param userId user to count tokens for * @ return count of the user ' s tokens */ @ View ( name = "count_by_userId" , map = "function(doc) { if(doc.token && doc.userId) { emit(doc.userId, doc) } }" , reduce = "_count" ) publi...
val view = createQuery ( "count_by_userId" ) . key ( userId ) ; val rows = db . queryView ( view ) . getRows ( ) ; if ( rows . isEmpty ( ) ) { return 0 ; } return rows . get ( 0 ) . getValueAsInt ( ) ;
public class StringObservable { /** * Encodes a possibly infinite stream of strings into an Observable of byte arrays . * This method allows for more control over how malformed and unmappable characters are handled . * < img width = " 640 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images...
return src . map ( new Func1 < String , byte [ ] > ( ) { @ Override public byte [ ] call ( String str ) { CharBuffer cb = CharBuffer . wrap ( str ) ; ByteBuffer bb ; try { bb = charsetEncoder . encode ( cb ) ; } catch ( CharacterCodingException e ) { throw new RuntimeException ( e ) ; } return Arrays . copyOfRange ( bb...
public class MesosEntrypointUtils { /** * Loads and validates the Mesos scheduler configuration . * @ param flinkConfig the global configuration . * @ param hostname the hostname to advertise to the Mesos master . */ public static MesosConfiguration createMesosSchedulerConfiguration ( Configuration flinkConfig , St...
Protos . FrameworkInfo . Builder frameworkInfo = Protos . FrameworkInfo . newBuilder ( ) . setHostname ( hostname ) ; Protos . Credential . Builder credential = null ; if ( ! flinkConfig . contains ( MesosOptions . MASTER_URL ) ) { throw new IllegalConfigurationException ( MesosOptions . MASTER_URL . key ( ) + " must b...
public class PersistenceBrokerImpl { /** * Store / Link 1 : n collection references . * @ param obj real object the reference starts * @ param linkOnly if true the referenced objects will only be linked ( FK set , no reference store ) . * Reference store setting in descriptor will be ignored in this case * @ pa...
if ( referencedObjects == null ) { return ; } /* Only make sense to perform ( link or / and store ) real referenced objects or materialized collection proxy objects , because on unmaterialized collection nothing has changed . - if the collection is a collectionproxy and it ' s not already loaded no need to perf...
public class Gauge { /** * Defines the graphical representation of the needle that will be used . * Values are ANGLED , ROUND and FLAT * In principle it defines how the needle will be filled ( gradient , color ) * @ param SHAPE */ public void setNeedleShape ( final NeedleShape SHAPE ) { } }
if ( null == needleShape ) { _needleShape = null == SHAPE ? NeedleShape . ANGLED : SHAPE ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { needleShape . set ( SHAPE ) ; }
public class CmsDomUtil { /** * Utility method to determine the effective background color . < p > * @ param element the element * @ return the background color */ public static String getEffectiveBackgroundColor ( Element element ) { } }
String backgroundColor = CmsDomUtil . getCurrentStyle ( element , Style . backgroundColor ) ; if ( ( CmsStringUtil . isEmptyOrWhitespaceOnly ( backgroundColor ) || isTransparent ( backgroundColor ) || backgroundColor . equals ( StyleValue . inherit . toString ( ) ) ) ) { if ( ( Document . get ( ) . getBody ( ) != eleme...
public class DatabaseInfo { /** * Returns the date of the database . * @ return the date of the database . */ public Date getDate ( ) { } }
for ( int i = 0 ; i < info . length ( ) - 9 ; i ++ ) { if ( Character . isWhitespace ( info . charAt ( i ) ) ) { String dateString = info . substring ( i + 1 , i + 9 ) ; try { synchronized ( formatter ) { return formatter . parse ( dateString ) ; } } catch ( ParseException pe ) { } break ; } } return null ;
public class RestartingS3InputStream { /** * Re - opens the input stream , starting at the first unread byte . */ private void reopenS3InputStream ( ) throws IOException { } }
// First attempt to close the existing input stream try { closeS3InputStream ( ) ; } catch ( IOException ignore ) { // Ignore this exception ; we ' re re - opening because there was in issue with the existing stream // in the first place . } InputStream remainingIn = null ; int attempt = 0 ; while ( remainingIn == null...
public class ChronoFormatter { /** * / * [ deutsch ] * < p > Konstruiert einen Formatierer f & uuml ; r einfache Zeitstempelobjekte . < / p > * @ param pattern format pattern * @ param type the type of the pattern to be used * @ param locale format locale * @ return new { @ code ChronoFormatter } - instance ...
Builder < PlainTimestamp > builder = new Builder < > ( PlainTimestamp . axis ( ) , locale ) ; addPattern ( builder , pattern , type ) ; try { return builder . build ( ) ; } catch ( IllegalStateException ise ) { throw new IllegalArgumentException ( ise ) ; }
public class Radial1Vertical { /** * < editor - fold defaultstate = " collapsed " desc = " Image related " > */ @ Override protected BufferedImage create_THRESHOLD_Image ( final int WIDTH ) { } }
if ( WIDTH <= 0 ) { return null ; } final BufferedImage IMAGE = UTIL . createImage ( WIDTH , WIDTH , Transparency . TRANSLUCENT ) ; final Graphics2D G2 = IMAGE . createGraphics ( ) ; G2 . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ; G2 . setRenderingHint ( RenderingHint...
public class ScriptPluginFileCopier { /** * Copy existing file */ public String copyFile ( final ExecutionContext executionContext , final File file , final INodeEntry node , final String destination ) throws FileCopierException { } }
return copyFile ( executionContext , file , null , null , node , destination ) ;
public class UllmannState { /** * Check if there are any feasible mappings left for the query vertex n . We * scan the compatibility matrix to see if any value is > 0. * @ param n query vertex * @ return a candidate is present */ private boolean hasCandidate ( int n ) { } }
for ( int j = ( n * matrix . mCols ) , end = ( j + matrix . mCols ) ; j < end ; j ++ ) if ( matrix . get ( j ) ) return true ; return false ;
public class PrcMatchForeignLineCreate { /** * < p > Process entity request . < / p > * @ param pAddParam additional param , e . g . return this line ' s * document in " nextEntity " for farther process * @ param pRequestData Request Data * @ param pEntity Entity to process * @ return Entity processed for far...
MatchForeignLine entity = this . prcEntityCreate . process ( pAddParam , pEntityPb , pRequestData ) ; entity . setItsOwner ( this . prcEntityCreate . getSrvOrm ( ) . retrieveEntity ( pAddParam , entity . getItsOwner ( ) ) ) ; return entity ;
public class DateParser { /** * Parses the given year and month to a { @ link CSLDate } object . Does not * handle ranges . * @ param year the year to parse . Should be a four - digit number or a String * whose last four characters are digits . * @ param month the month to parse . May be a number ( < code > 1-1...
int m = toMonth ( month ) ; // parse year int y = - 1 ; Boolean circa = null ; if ( year != null && year . length ( ) >= 4 ) { if ( StringUtils . isNumeric ( year ) ) { y = Integer . parseInt ( year ) ; } else { String fourDigit = year . substring ( year . length ( ) - 4 ) ; if ( StringUtils . isNumeric ( fourDigit ) )...
public class NameSimilarityEdgeFilter { /** * Removes any characters in the String that we don ' t care about in the matching procedure * TODO Currently limited to certain ' western ' languages */ private String prepareName ( String name ) { } }
// \ s = A whitespace character : [ \ t \ n \ x0B \ f \ r ] String [ ] arr = name . split ( "\\s" ) ; List < String > list = new ArrayList < > ( arr . length ) ; for ( int i = 0 ; i < arr . length ; i ++ ) { String rewrite = NON_WORD_CHAR . matcher ( toLowerCase ( arr [ i ] ) ) . replaceAll ( "" ) ; String tmp = rewrit...
public class HtmlBuilder { /** * Build a String containing a HTML opening tag with given CSS style attribute ( s ) and concatenates the given * content . Content should contain no HTML , because it is prepared with { @ link # htmlEncode ( String ) } . * @ param tag String name of HTML tag * @ param style style fo...
return openTag ( tag , null , style , content ) ;
public class JmsTransporter { /** * - - - CONNECT - - - */ @ Override public void connect ( ) { } }
try { // Create JMS client and session disconnect ( ) ; if ( factory == null ) { try { Context ctx = new InitialContext ( ) ; factory = ( TopicConnectionFactory ) ctx . lookup ( connectionFactoryJndiName ) ; } catch ( Exception cause ) { logger . error ( "TopicConnectionFactory is undefined and \"" + connectionFactoryJ...
public class TreeNode { /** * Remove the { @ code child } from { @ code this } node ' s child array , giving it * a { @ code null } parent . * @ param child the child of this node to remove * @ throws NullPointerException if the given { @ code child } is { @ code null } * @ throws IllegalArgumentException if th...
requireNonNull ( child ) ; if ( ! isChild ( child ) ) { throw new IllegalArgumentException ( "The given child is not a child." ) ; } remove ( getIndex ( child ) ) ;
public class Utils { /** * Null enabled equals ( ) . * @ param a the first object * @ param b the second object * @ return true if both are null or both are equal */ public static < T > boolean equal ( T a , T b ) { } }
return a != null ? a . equals ( b ) : b == null ;
public class Client { /** * Starts processing . * Calling this method * starts the thread that regularly flushes all enabled caches . enables the other methods on the * instance to be called successfully * I . e , even when the configuration disables aggregation , it is invalid to access the other * methods o...
if ( running ) { log . atInfo ( ) . log ( "%s is already started" , this ) ; return ; } log . atInfo ( ) . log ( "starting %s" , this ) ; this . stopped = false ; this . running = true ; this . reportStopwatch . reset ( ) . start ( ) ; try { schedulerThread = threads . newThread ( new Runnable ( ) { @ Override public v...
public class Utils { /** * Get contents from an URL . * @ param url * The url * @ return - * @ throws IOException */ public static String getUrl ( final String url ) throws Exception { } }
return getUrl ( new URL ( url ) , null , null ) ;
public class UserAttachedFormGenerator { /** * This method creates { @ link XmlObject } of type { @ link BudgetNarrativeAttachmentsDocument } by populating data from the given * { @ link ProposalDevelopmentDocumentContract } * @ param proposalDevelopmentDocument for which the { @ link XmlObject } needs to be create...
this . pdDoc = proposalDevelopmentDocument ; S2sUserAttachedFormFileContract userAttachedFormFile = findUserAttachedFormFile ( ) ; if ( userAttachedFormFile == null ) { throw new RuntimeException ( "Cannot find XML Data" ) ; } String formXml = userAttachedFormFile . getXmlFile ( ) ; XmlObject xmlObject ; try { xmlObjec...
public class CrystalTransform { /** * Tells whether this transformation is a pure translation : * either a pure crystal ( lattice ) translation or a fractional ( within * unit cell ) translation : space groups Ixxx , Cxxx , Fxxx have operators * with fractional translations within the unit cell . * @ return */ ...
if ( isPureCrystalTranslation ( ) ) return true ; if ( SpaceGroup . deltaComp ( matTransform . m00 , 1 , SpaceGroup . DELTA ) && SpaceGroup . deltaComp ( matTransform . m01 , 0 , SpaceGroup . DELTA ) && SpaceGroup . deltaComp ( matTransform . m02 , 0 , SpaceGroup . DELTA ) && SpaceGroup . deltaComp ( matTransform . m10...
public class InsnList { /** * Returns the instruction whose index is given . This method builds a cache * of the instructions in this list to avoid scanning the whole list each * time it is called . Once the cache is built , this method run in constant * time . This cache is invalidated by all the methods that mo...
if ( index < 0 || index >= size ) { throw new IndexOutOfBoundsException ( ) ; } if ( cache == null ) { cache = toArray ( ) ; } return cache [ index ] ;
public class Strings { /** * Convenience method to return a String array as a delimited ( e . g . CSV ) * String . E . g . useful for < code > toString ( ) < / code > implementations . * @ param arr the array to display * @ param delim the delimiter to use ( probably a " , " ) * @ return the delimited String */...
if ( Objects . isEmpty ( arr ) ) { return "" ; } if ( arr . length == 1 ) { return Objects . nullSafeToString ( arr [ 0 ] ) ; } StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < arr . length ; i ++ ) { if ( i > 0 ) { sb . append ( delim ) ; } sb . append ( arr [ i ] ) ; } return sb . toString ( ) ;
public class S3RecoverableWriter { /** * - - - - - Static Constructor - - - - - */ public static S3RecoverableWriter writer ( final FileSystem fs , final FunctionWithException < File , RefCountedFile , IOException > tempFileCreator , final S3AccessHelper s3AccessHelper , final Executor uploadThreadPool , final long use...
checkArgument ( userDefinedMinPartSize >= S3_MULTIPART_MIN_PART_SIZE ) ; final S3RecoverableMultipartUploadFactory uploadFactory = new S3RecoverableMultipartUploadFactory ( fs , s3AccessHelper , maxConcurrentUploadsPerStream , uploadThreadPool , tempFileCreator ) ; return new S3RecoverableWriter ( s3AccessHelper , uplo...
public class AptControlInterface { /** * Does the method have a Java Beans setter method signature ( is varient ) . * @ param method AptMethod instance . * @ return true if setter . */ private boolean isSetter ( AptMethod method ) { } }
String methodName = method . getName ( ) ; if ( methodName . length ( ) < 4 ) return false ; if ( ! methodName . startsWith ( "set" ) ) return false ; String argList = method . getArgList ( ) ; if ( argList . length ( ) == 0 ) return false ; if ( argList . indexOf ( ',' ) > - 1 ) return false ; if ( ! "void" . equals (...
public class FBOGraphics { /** * Initialise the GL context */ protected void initGL ( ) { } }
GL11 . glEnable ( GL11 . GL_TEXTURE_2D ) ; GL11 . glShadeModel ( GL11 . GL_SMOOTH ) ; GL11 . glDisable ( GL11 . GL_DEPTH_TEST ) ; GL11 . glDisable ( GL11 . GL_LIGHTING ) ; GL11 . glClearColor ( 0.0f , 0.0f , 0.0f , 0.0f ) ; GL11 . glClearDepth ( 1 ) ; GL11 . glEnable ( GL11 . GL_BLEND ) ; GL11 . glBlendFunc ( GL11 . GL...
public class SignUtils { /** * 生成密码 , 使用shaHex加密 * @ return */ public static String createPassword ( String password ) { } }
String data = DigestUtils . shaHex ( password ) ; return data ;
public class FeaturesImpl { /** * Gets all the phraselist features . * @ param appId The application ID . * @ param versionId The version ID . * @ param listPhraseListsOptionalParameter the object representing the optional parameters to be set before calling this API * @ throws IllegalArgumentException thrown i...
return listPhraseListsWithServiceResponseAsync ( appId , versionId , listPhraseListsOptionalParameter ) . toBlocking ( ) . single ( ) . body ( ) ;
public class ResourcesInner { /** * Gets a resource by ID . * @ param resourceId The fully qualified ID of the resource , including the resource name and resource type . Use the format , / subscriptions / { guid } / resourceGroups / { resource - group - name } / { resource - provider - namespace } / { resource - type...
return ServiceFuture . fromResponse ( getByIdWithServiceResponseAsync ( resourceId , apiVersion ) , serviceCallback ) ;
public class CMLCoreModule { /** * Clean all data about read atoms . */ protected void newAtomData ( ) { } }
atomCounter = 0 ; elsym = new ArrayList < String > ( ) ; elid = new ArrayList < String > ( ) ; eltitles = new ArrayList < String > ( ) ; formalCharges = new ArrayList < String > ( ) ; partialCharges = new ArrayList < String > ( ) ; isotope = new ArrayList < String > ( ) ; atomicNumbers = new ArrayList < String > ( ) ; ...
public class XGMMLUtility { /** * Returns a shape for the supplied { @ link FunctionEnum } . * @ param fe { @ link FunctionEnum } * @ return Non - null { @ link String } * @ see # DFLT _ NODE _ SHAPE */ public static String type ( FunctionEnum fe ) { } }
if ( fe == null ) { return DFLT_NODE_SHAPE ; } switch ( fe ) { case ABUNDANCE : return "ver_ellipsis" ; case BIOLOGICAL_PROCESS : return "rhombus" ; case CATALYTIC_ACTIVITY : return "hexagon" ; case CELL_SECRETION : return "arc" ; case CELL_SURFACE_EXPRESSION : return "arc" ; case CHAPERONE_ACTIVITY : return "hexagon" ...
public class GradleDependencyResolutionHelper { /** * Resolve the given artifact specifications . * @ param project the Gradle project reference . * @ param specs the specifications that need to be resolved . * @ param transitive should the artifacts be resolved transitively ? * @ param excludeDefaults should w...
if ( project == null ) { throw new IllegalArgumentException ( "Gradle project reference cannot be null." ) ; } if ( specs == null ) { project . getLogger ( ) . warn ( "Artifact specification collection is null." ) ; return Collections . emptySet ( ) ; } final Configuration config = project . getConfigurations ( ) . det...
public class CPOptionCategoryLocalServiceWrapper { /** * Returns all the cp option categories matching the UUID and company . * @ param uuid the UUID of the cp option categories * @ param companyId the primary key of the company * @ return the matching cp option categories , or an empty list if no matches were fo...
return _cpOptionCategoryLocalService . getCPOptionCategoriesByUuidAndCompanyId ( uuid , companyId ) ;
public class clusternodegroup { /** * Use this API to unset the properties of clusternodegroup resources . * Properties that need to be unset are specified in args array . */ public static base_responses unset ( nitro_service client , String name [ ] , String args [ ] ) throws Exception { } }
base_responses result = null ; if ( name != null && name . length > 0 ) { clusternodegroup unsetresources [ ] = new clusternodegroup [ name . length ] ; for ( int i = 0 ; i < name . length ; i ++ ) { unsetresources [ i ] = new clusternodegroup ( ) ; unsetresources [ i ] . name = name [ i ] ; } result = unset_bulk_reque...
public class ArrayRankDouble { /** * Get the index position of minimum value in the given array * @ param array an array * @ returnindex of the min value in array */ public int getMinValueIndex ( double [ ] array ) { } }
int index = 0 ; double min = Integer . MAX_VALUE ; for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] < min ) { min = array [ i ] ; index = i ; } } return index ;
public class Timebase { /** * Parses an encoded timebase . < br * < p > The following textual representations are valid for time bases : < / p > * < ul > * Its inverse as a rational number . The syntax is < i > { denominator } [ : { numerator } ] < / i > , where numerator can be omitted if its * value is 1. *...
if ( rate . equalsIgnoreCase ( "PAL" ) ) { return HZ_25 ; } else if ( rate . equals ( "23.976" ) ) { return NTSC_24 ; } else if ( rate . equalsIgnoreCase ( "NTSC" ) || rate . equals ( "29.97" ) ) { return NTSC ; } else if ( rate . equals ( "59.94" ) ) { return NTSC_60 ; } else if ( rate . equalsIgnoreCase ( "NTSC30" ) ...
public class JavaCCParserImpl { /** * look ahead n tokens . 0 is the current token , 1 is the next token , 2 the * one after that , etc * @ param n * @ return */ private Token lookahead ( int n ) { } }
Token current = token ; for ( int i = 0 ; i < n ; i ++ ) { if ( current . next == null ) { current . next = token_source . getNextToken ( ) ; } current = current . next ; } return current ;
public class MybatisUsageDao { /** * @ Override * public List < Usage > getUsageToday ( final Sid accountSid , Usage . Category category , DateTime startDate , DateTime endDate ) { * return getUsageCalls ( accountSid , category , startDate , endDate , " getTodayCalls " ) ; * @ Override * public List < Usage > g...
return getUsageCalls ( accountSid , category , startDate , endDate , "" , queryName ) ;
public class JShellToolProvider { /** * Run the jshell tool . The streams { @ code out } and { @ code err } are * converted to { @ code PrintStream } if they are not already . * Any { @ code Exception } is caught , printed and results in a non - zero return . * @ param in command line input ( snippets and command...
InputStream xin = ( in == null ) ? System . in : in ; PrintStream xout = ( out == null ) ? System . out : ( out instanceof PrintStream ) ? ( PrintStream ) out : new PrintStream ( out ) ; PrintStream xerr = ( err == null ) ? System . err : ( err instanceof PrintStream ) ? ( PrintStream ) err : new PrintStream ( err ) ; ...
public class LocalWorkspaceDataManagerStub { /** * { @ inheritDoc } */ @ Override public List < PropertyData > listChildPropertiesData ( final NodeData parent ) throws RepositoryException { } }
return Collections . unmodifiableList ( super . listChildPropertiesData ( parent ) ) ;
public class XLogPDescriptor { /** * Gets the doubleBondedCarbonsCount attribute of the XLogPDescriptor object . * @ param ac Description of the Parameter * @ param atom Description of the Parameter * @ return The doubleBondedCarbonsCount value */ private int getDoubleBondedCarbonsCount ( IAtomContainer ac , IAto...
List < IAtom > neighbours = ac . getConnectedAtomsList ( atom ) ; IBond bond ; int cdbcounter = 0 ; for ( IAtom neighbour : neighbours ) { if ( neighbour . getSymbol ( ) . equals ( "C" ) ) { bond = ac . getBond ( neighbour , atom ) ; if ( bond . getOrder ( ) == IBond . Order . DOUBLE ) { cdbcounter += 1 ; } } } return ...
public class AmazonSNSClient { /** * Deletes a platform application object for one of the supported push notification services , such as APNS and GCM . * For more information , see < a href = " https : / / docs . aws . amazon . com / sns / latest / dg / SNSMobilePush . html " > Using Amazon SNS * Mobile Push Notifi...
request = beforeClientExecution ( request ) ; return executeDeletePlatformApplication ( request ) ;
public class IfcFaceBasedSurfaceModelImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) public EList < IfcConnectedFaceSet > getFbsmFaces ( ) { } }
return ( EList < IfcConnectedFaceSet > ) eGet ( Ifc2x3tc1Package . Literals . IFC_FACE_BASED_SURFACE_MODEL__FBSM_FACES , true ) ;
import java . util . * ; class SumAsciiUppercaseCharacters { /** * Function to calculate the sum of the ASCII values of uppercase characters in a input string . * Args : * input _ string ( str ) : The string from which to calculate sum of the ASCII values . * Returns : * int : The sum of ASCII values of the upp...
int sum = 0 ; for ( int i = 0 ; i < inputString . length ( ) ; i ++ ) { char c = inputString . charAt ( i ) ; if ( Character . isUpperCase ( c ) ) { sum += ( int ) c ; } } return sum ;
public class CouchbaseManifestComparator { /** * Save provided data with the key this ManifestComparator manages bump the * versioned key version . * NB : To avoid race conditions - make sure only one service ( an elected * leader ) can write at a time ( see micro - mysql for a mysql distributed * lock , or mic...
Either < Void , T > oldData = this . data ; VersionedKey newVersionedKey = increment ( ) ; logger . info ( "Saving data with key {}, new version is {}" , key , newVersionedKey . toJson ( ) ) ; connection . put ( newVersionedKey . toJson ( ) , new Data ( data , new Date ( ) , newVersionedKey . toJson ( ) ) ) ; connectio...
public class LogInterceptor { /** * 取得list的string , 自定义的主要目的 : 针对value中数组数据的toString处理 , copy from { @ link AbstractCollection } * @ param result * @ return */ private String getListResultString ( List result ) { } }
StringBuilder sb = new StringBuilder ( ) ; Iterator i = result . iterator ( ) ; if ( ! i . hasNext ( ) ) { return "[]" ; } sb . append ( '[' ) ; for ( ; ; ) { Object e = i . next ( ) ; // 注意 : 修改为getResultString ( e ) 进行递归处理 sb . append ( e == this ? "(this Collection)" : getResultString ( e ) ) ; if ( ! i . hasNext ( ...
public class RandomBiomorphMutation { /** * Mutates a single biomorph . * @ param biomorph The biomorph to mutate . * @ param rng The source of randomness to use for mutation . * @ return A mutated version of the biomorph . */ private Biomorph mutateBiomorph ( Biomorph biomorph , Random rng ) { } }
int [ ] genes = biomorph . getGenotype ( ) ; assert genes . length == Biomorph . GENE_COUNT : "Biomorphs must have " + Biomorph . GENE_COUNT + " genes." ; for ( int i = 0 ; i < Biomorph . GENE_COUNT - 1 ; i ++ ) { if ( mutationProbability . nextEvent ( rng ) ) { boolean increase = rng . nextBoolean ( ) ; genes [ i ] +=...
public class UnixCrypt { /** * / * * * * Methods start here * * * */ private static void transpose ( byte [ ] data , byte [ ] t , int n ) { } }
byte [ ] x = new byte [ 64 ] ; System . arraycopy ( data , 0 , x , 0 , x . length ) ; while ( n -- > 0 ) { data [ n ] = x [ t [ n ] - 1 ] ; }
public class WSJdbcResultSet { /** * See JDBC 4.0 JavaDoc API for details . */ public SQLXML getSQLXML ( int columnIndex ) throws SQLException { } }
try { SQLXML xml = rsetImpl . getSQLXML ( columnIndex ) ; if ( xml != null && freeResourcesOnClose ) xmls . add ( xml ) ; return xml ; } catch ( SQLException sqlX ) { FFDCFilter . processException ( sqlX , getClass ( ) . getName ( ) + ".getSQLXML" , "2115" , this ) ; throw WSJdbcUtil . mapException ( this , sqlX ) ; } ...
public class AptType { /** * Helper method to return type parameter information */ private String getFormalTypeParameters ( boolean namesOnly ) { } }
Collection < TypeParameterDeclaration > ftColl = _typeDecl . getFormalTypeParameters ( ) ; if ( ftColl . size ( ) == 0 ) return "" ; StringBuffer sb = new StringBuffer ( "<" ) ; boolean isFirst = true ; for ( TypeParameterDeclaration tpDecl : ftColl ) { if ( ! isFirst ) sb . append ( "," ) ; else isFirst = false ; if (...
public class HTODInvalidationBuffer { /** * returnToPool boolean is used by GC buffer only */ protected synchronized void remove ( Object id , int bufferType , boolean returnToPool ) { } }
// final String methodName = " remove ( Object , bufferType ) " ; if ( id == null ) { return ; } if ( bufferType == this . EXPLICIT_BUFFER ) { this . explicitBuffer . remove ( id ) ; } else if ( bufferType == this . SCAN_BUFFER ) { this . scanBuffer . remove ( id ) ; } else if ( bufferType == this . GC_BUFFER ) { if ( ...
public class Charset { /** * Returns an immutable case - insensitive map from canonical names to { @ code Charset } instances . * If multiple charsets have the same canonical name , it is unspecified which is returned in * the map . This method may be slow . If you know which charset you ' re looking for , use * ...
// Start with a copy of the built - in charsets . . . @ SuppressWarnings ( "unchecked" ) TreeMap < String , Charset > charsets = new TreeMap < String , Charset > ( String . CASE_INSENSITIVE_ORDER ) ; for ( String charsetName : IOSCharset . getAvailableCharsetNames ( ) ) { Charset charset = IOSCharset . charsetForName (...
public class JMFileAppender { /** * Append and close path . * @ param filePath the file path * @ param charset the charset * @ param writingString the writing string * @ return the path */ public static Path appendAndClose ( String filePath , Charset charset , String writingString ) { } }
return new JMFileAppender ( filePath , charset ) . append ( writingString ) . closeAndGetFilePath ( ) ;
public class ComponentTag { /** * each attribute set by a tag should use this method for attribute declaration ; * an existing value with the same key is registered and restored if the tag rendering ends */ protected void setAttribute ( String key , Object value , int scope ) { } }
Map < String , Object > replacedInScope = getReplacedAttributes ( scope ) ; if ( ! replacedInScope . containsKey ( key ) ) { Object current = pageContext . getAttribute ( key , scope ) ; replacedInScope . put ( key , current ) ; } pageContext . setAttribute ( key , value , scope ) ;
public class YarnSubmissionHelper { /** * Add a file to be localized on the driver . * @ param resourceName * @ param resource * @ return */ public YarnSubmissionHelper addLocalResource ( final String resourceName , final LocalResource resource ) { } }
resources . put ( resourceName , resource ) ; return this ;
public class EscapeXML { /** * Emit the supplied String to the specified writer , escaping characters if needed . * @ param src the String to write * @ param escapeXml if true , escape unsafe characters before writing * @ param out the JspWriter to emit to * @ throws IOException if there was a problem emitting ...
if ( escapeXml ) { emit ( src , out ) ; } else { out . write ( src ) ; }
public class Recast { /** * / @ see rcAllocCompactHeightfield , rcHeightfield , rcCompactHeightfield , rcConfig */ public static CompactHeightfield buildCompactHeightfield ( Context ctx , int walkableHeight , int walkableClimb , Heightfield hf ) { } }
ctx . startTimer ( "BUILD_COMPACTHEIGHTFIELD" ) ; CompactHeightfield chf = new CompactHeightfield ( ) ; int w = hf . width ; int h = hf . height ; int spanCount = getHeightFieldSpanCount ( ctx , hf ) ; // Fill in header . chf . width = w ; chf . height = h ; chf . spanCount = spanCount ; chf . walkableHeight = walkable...
public class Node { /** * Merge the two entries at the given position . The entries are reordered in * the < code > entries < / code > array so that the non - empty entries are still * at the beginning . * @ param pos1 The position of the first entry to be merged . This position * has to be smaller than the the...
assert ( this . numFreeEntries ( ) == 0 ) ; assert ( pos1 < pos2 ) ; this . entries [ pos1 ] . mergeWith ( this . entries [ pos2 ] ) ; for ( int i = pos2 ; i < entries . length - 1 ; i ++ ) { entries [ i ] = entries [ i + 1 ] ; } entries [ entries . length - 1 ] . clear ( ) ;
public class PostResponseUnmarshaller { /** * { @ inheritDoc } */ @ Override protected void onString ( String text , String fieldName , JsonParser jp ) { } }
log . trace ( fieldName + " " + text ) ; if ( "_id" . equals ( fieldName ) ) { List < java . lang . reflect . Field > fields = ClassUtil . getAnnotatedFields ( entity . getClass ( ) , Id . class ) ; if ( fields . isEmpty ( ) || fields . size ( ) > 1 ) { throw new ApitraryOrmIdException ( "Illegal amount of annotated id...
public class Configuration { /** * Set the given property to < code > Pattern < / code > . * If the pattern is passed as null , sets the empty pattern which results in * further calls to getPattern ( . . . ) returning the default value . * @ param name property name * @ param pattern new value */ public void se...
if ( null == pattern ) { set ( name , null ) ; } else { set ( name , pattern . pattern ( ) ) ; }
public class VirtualNetworkGatewaysInner { /** * Resets the primary of the virtual network gateway in the specified resource group . * @ param resourceGroupName The name of the resource group . * @ param virtualNetworkGatewayName The name of the virtual network gateway . * @ param serviceCallback the async Servic...
return ServiceFuture . fromResponse ( beginResetWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayName ) , serviceCallback ) ;
public class BlockNameSpace { /** * We have the variable : either it was declared here with a type , giving * it block local scope or an untyped var was explicitly set here via * setBlockVariable ( ) . */ private boolean weHaveVar ( String name ) { } }
// super . variables . containsKey ( name ) not any faster , I checked try { return super . getVariableImpl ( name , false ) != null ; } catch ( UtilEvalError e ) { return false ; }
public class ConfiguredModule { /** * Put a value in the module configuration map . * @ param key the key . * @ param value the value . */ @ JsonAnySetter public void putConfigurationValue ( String key , Object value ) { } }
this . configuration . put ( key , value ) ;
public class SearchHelper { /** * Set the filter to a list of attributes . * @ param attributes a collection of attribute names */ public void setAttributes ( final Collection < String > attributes ) { } }
this . attributes = attributes == null ? null : Collections . unmodifiableSet ( new HashSet < String > ( attributes ) ) ;
public class StatFsHelper { /** * Gets the information about the available storage space * either internal or external depends on the give input * @ param storageType Internal or external storage type * @ return available space in bytes , 0 if no information is available */ @ SuppressLint ( "DeprecatedMethod" ) p...
ensureInitialized ( ) ; maybeUpdateStats ( ) ; StatFs statFS = storageType == StorageType . INTERNAL ? mInternalStatFs : mExternalStatFs ; if ( statFS != null ) { long blockSize , availableBlocks ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN_MR2 ) { blockSize = statFS . getBlockSizeLong ( ) ; a...
public class ScriptableObject { /** * Another version of Get that supports Symbol keyed properties . */ @ Override public Object get ( Symbol key , Scriptable start ) { } }
Slot slot = slotMap . query ( key , 0 ) ; if ( slot == null ) { return Scriptable . NOT_FOUND ; } return slot . getValue ( start ) ;
public class ImmutableMultisetJsonDeserializer { /** * @ param deserializer { @ link JsonDeserializer } used to deserialize the objects inside the { @ link ImmutableMultiset } . * @ param < T > Type of the elements inside the { @ link ImmutableMultiset } * @ return a new instance of { @ link ImmutableMultisetJsonDe...
return new ImmutableMultisetJsonDeserializer < T > ( deserializer ) ;
public class AssemblyFiles { /** * Get the list of all updated entries i . e . all entries which have modification date * which is newer than the last time check . ATTENTION : As a side effect this method also * updates the timestamp of entries . * @ return list of all entries which has been updated since the las...
List < Entry > ret = new ArrayList < > ( ) ; for ( Entry entry : entries ) { if ( entry . isUpdated ( ) ) { ret . add ( entry ) ; } } return ret ;
public class ImageDownloader { /** * Submits a new hadoop image download task . * @ param URL * The url of the image * @ param id * The id of the image ( used to name the image file after download ) */ public void submitHadoopDownloadTask ( String URL , String id ) { } }
Callable < ImageDownloadResult > call = new HadoopImageDownload ( URL , id , followRedirects ) ; pool . submit ( call ) ; numPendingTasks ++ ;
public class GetRelationalDatabaseLogStreamsResult { /** * An object describing the result of your get relational database log streams request . * @ param logStreams * An object describing the result of your get relational database log streams request . */ public void setLogStreams ( java . util . Collection < Stri...
if ( logStreams == null ) { this . logStreams = null ; return ; } this . logStreams = new java . util . ArrayList < String > ( logStreams ) ;
public class PeerEurekaNodes { /** * Checks if the given service url contains the current host which is trying * to replicate . Only after the EIP binding is done the host has a chance to * identify itself in the list of replica nodes and needs to take itself out * of replication traffic . * @ param url the ser...
final String myUrlConfigured = serverConfig . getMyUrl ( ) ; if ( myUrlConfigured != null ) { return myUrlConfigured . equals ( url ) ; } return isInstanceURL ( url , applicationInfoManager . getInfo ( ) ) ;
public class MSNumpress { public static double optimalSlofFixedPoint ( double [ ] data , int dataSize ) { } }
if ( dataSize == 0 ) { return 0 ; } double maxDouble = 1 ; double x ; double fp ; for ( int i = 0 ; i < dataSize ; i ++ ) { x = Math . log ( data [ i ] + 1 ) ; maxDouble = Math . max ( maxDouble , x ) ; } fp = Math . floor ( 0xFFFF / maxDouble ) ; return fp ;
public class LogInFormView { /** * Triggers the back action on the form . * @ return true if it was handled , false otherwise */ public boolean onBackPressed ( ) { } }
if ( corporateSSO ) { Log . d ( TAG , "Removing the SSO Login Form, going back to the Username/Password Form." ) ; resetDomain ( ) ; showSSOMessage ( true ) ; return true ; } return false ;
public class TaskDeleteOptions { /** * Set a timestamp indicating the last modified time of the resource known to the client . The operation will be performed only if the resource on the service has been modified since the specified time . * @ param ifModifiedSince the ifModifiedSince value to set * @ return the Ta...
if ( ifModifiedSince == null ) { this . ifModifiedSince = null ; } else { this . ifModifiedSince = new DateTimeRfc1123 ( ifModifiedSince ) ; } return this ;
public class ns_ns_savedconfig { /** * Use this API to fetch filtered set of ns _ ns _ savedconfig resources . * filter string should be in JSON format . eg : " vm _ state : DOWN , name : [ a - z ] + " */ public static ns_ns_savedconfig [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } }
ns_ns_savedconfig obj = new ns_ns_savedconfig ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; ns_ns_savedconfig [ ] response = ( ns_ns_savedconfig [ ] ) obj . getfiltered ( service , option ) ; return response ;
public class JmxClient { /** * Return a set of the various bean ObjectName objects associated with the Jmx server . */ public Set < ObjectName > getBeanNames ( ) throws JMException { } }
checkClientConnected ( ) ; try { return mbeanConn . queryNames ( null , null ) ; } catch ( IOException e ) { throw createJmException ( "Problems querying for jmx bean names: " + e , e ) ; }
public class Chunk { /** * Set the element in a chunk as missing given a 0 - based chunk local index . */ public final boolean setNA0 ( int idx ) { } }
setWrite ( ) ; if ( _chk2 . setNA_impl ( idx ) ) return true ; ( _chk2 = inflate_impl ( new NewChunk ( this ) ) ) . setNA_impl ( idx ) ; return true ;
public class NotesApi { /** * Gets a Stream of all notes for a single merge request * < pre > < code > GitLab Endpoint : GET / projects / : id / merge _ requests / : merge _ request _ iid / notes < / code > < / pre > * @ param projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Proje...
return ( getMergeRequestNotes ( projectIdOrPath , mergeRequestIid , null , null , getDefaultPerPage ( ) ) . stream ( ) ) ;
public class ReplicationInstanceMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ReplicationInstance replicationInstance , ProtocolMarshaller protocolMarshaller ) { } }
if ( replicationInstance == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( replicationInstance . getReplicationInstanceIdentifier ( ) , REPLICATIONINSTANCEIDENTIFIER_BINDING ) ; protocolMarshaller . marshall ( replicationInstance . getRepli...
public class TransactionInterceptor { /** * The interception method . The method should call { @ link org . wisdom . api . interception . RequestContext # proceed ( ) } * to call the next interception . Without this call it cuts the chain . * @ param configuration the interception configuration * @ param context ...
propagation . onEntry ( configuration . propagation ( ) , configuration . timeout ( ) , context . route ( ) . getControllerMethod ( ) . getName ( ) ) ; try { Result result = context . proceed ( ) ; propagation . onExit ( configuration . propagation ( ) , context . route ( ) . getControllerMethod ( ) . getName ( ) , nul...
public class JMElasticsearchIndex { /** * Send data with object mapper string . * @ param sourceObject the source object * @ param index the index * @ param type the type * @ return the string */ public String sendDataWithObjectMapper ( Object sourceObject , String index , String type ) { } }
return sendDataWithObjectMapper ( sourceObject , index , type , null ) . getId ( ) ;
import java . util . * ; class RabbitFeed { /** * This function calculates the total number of carrots a rabbit consumes , * and the remaining carrots left if the rabbit is hungry . * Example : * rabbit _ feed ( 5 , 6 , 10 ) - > [ 11 , 4] * rabbit _ feed ( 4 , 8 , 9 ) - > [ 12 , 1] * rabbit _ feed ( 1 , 10 , ...
if ( required <= available ) { return Arrays . asList ( consumed + required , available - required ) ; } else { return Arrays . asList ( consumed + available , 0 ) ; }
public class Logger { /** * verbose . * @ param msg the msg * @ param args the args */ public static void verbose ( String msg , Object ... args ) { } }
String tag = generateTag ( ) ; if ( ! "" . equals ( tag ) ) { if ( args . length > 0 ) { Log . v ( tag , String . format ( msg , args ) ) ; } else { Log . v ( tag , msg ) ; } }
public class Compiler { /** * Execute the XPath object from a given opcode position . * @ param opPos The current position in the xpath . m _ opMap array . * @ return The result of the XPath . * @ throws TransformerException if there is a syntax or other error . * @ xsl . usage advanced */ public Expression com...
int op = getOp ( opPos ) ; Expression expr = null ; // System . out . println ( getPatternString ( ) + " op : " + op ) ; switch ( op ) { case OpCodes . OP_XPATH : expr = compile ( opPos + 2 ) ; break ; case OpCodes . OP_OR : expr = or ( opPos ) ; break ; case OpCodes . OP_AND : expr = and ( opPos ) ; break ; case OpCod...
public class Log { /** * Send a { @ link # VERBOSE } log message . * @ param msg * The message you would like logged . */ public static int v ( String msg ) { } }
// This is a quick check to avoid the expensive stack trace reflection . if ( ! activated ) { return 0 ; } String caller = LogHelper . getCaller ( ) ; if ( caller != null ) { return v ( caller , msg ) ; } return 0 ;
public class ClassReader { /** * Read name . */ Name readName ( int i ) { } }
Object obj = readPool ( i ) ; if ( obj != null && ! ( obj instanceof Name ) ) throw badClassFile ( "bad.const.pool.entry" , currentClassFile . toString ( ) , "CONSTANT_Utf8_info or CONSTANT_String_info" , i ) ; return ( Name ) obj ;
public class ValidatingStreamReader { /** * This method gets called to handle remainder of DOCTYPE declaration , * essentially the optional internal subset . Internal subset , if such * exists , is always read , but whether its contents are added to the * read buffer depend on passed - in argument . * NOTE : Si...
if ( ! hasConfigFlags ( CFG_SUPPORT_DTD ) ) { super . finishDTD ( copyContents ) ; return ; } /* We know there are no spaces , as this char was read and pushed * back earlier . . . */ char c = getNextChar ( SUFFIX_IN_DTD ) ; DTDSubset intSubset = null ; /* Do we have an internal subset ? Note that we have earlier che...
public class StrBuilder { /** * If possible , reads chars from the provided { @ link Readable } directly into underlying * character buffer without making extra copies . * @ param readable object to read from * @ return the number of characters read * @ throws IOException if an I / O error occurs * @ since 3....
final int oldSize = size ; if ( readable instanceof Reader ) { final Reader r = ( Reader ) readable ; ensureCapacity ( size + 1 ) ; int read ; while ( ( read = r . read ( buffer , size , buffer . length - size ) ) != - 1 ) { size += read ; ensureCapacity ( size + 1 ) ; } } else if ( readable instanceof CharBuffer ) { f...
public class AbstractRequestContext { /** * Make an EntityProxy immutable . */ private void makeImmutable ( final AutoBean < ? extends BaseProxy > toMutate ) { } }
// Always diff ' ed against itself , producing a no - op toMutate . setTag ( Constants . PARENT_OBJECT , toMutate ) ; // Act with entity - identity semantics toMutate . setTag ( REQUEST_CONTEXT_STATE , null ) ; toMutate . setFrozen ( true ) ;
public class GlobalUsersInner { /** * Starts an environment by starting all resources inside the environment . This operation can take a while to complete . * @ param userName The name of the user . * @ param environmentId The resourceId of the environment * @ throws IllegalArgumentException thrown if parameters ...
if ( userName == null ) { throw new IllegalArgumentException ( "Parameter userName is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } if ( environmentId == null ) { throw n...
public class HourRanges { /** * Returns a compressed version of the * @ return */ public final HourRanges compress ( ) { } }
final List < HourRanges > normalized = normalize ( ) ; if ( normalized . size ( ) == 1 ) { return valueOf ( normalized . get ( 0 ) . toMinutes ( ) ) ; } else if ( normalized . size ( ) == 2 ) { final HourRanges firstDay = valueOf ( normalized . get ( 0 ) . toMinutes ( ) ) ; final HourRanges secondDay = normalized . get...
public class ZipUtil { /** * Unpacks a ZIP file to the given directory using a specific Charset * for the input file . * The output directory must not be a file . * @ param zip * input ZIP file . * @ param outputDir * output directory ( created automatically if not found ) . * @ param charset * charset ...
unpack ( zip , outputDir , IdentityNameMapper . INSTANCE , charset ) ;
public class Serializer { /** * deserializes DBBinary / byte [ ] to object * @ param data the data to read * @ param zipped true if the data is compressed * @ return the deserialized object * @ throws IOException thrown when an error is encountered reading the data * @ throws ClassNotFoundException thrown if ...
final ByteArrayInputStream bais ; if ( data instanceof Binary ) { bais = new ByteArrayInputStream ( ( ( Binary ) data ) . getData ( ) ) ; } else { bais = new ByteArrayInputStream ( ( byte [ ] ) data ) ; } InputStream is = bais ; try { if ( zipped ) { is = new GZIPInputStream ( is ) ; } final ObjectInputStream ois = new...
public class Comparables { /** * Safely compares two values that might be null . Null value is considered lower than non - null , even if the * non - null value is minimal in its range . * @ return comparison result of first and second value . */ public static < Value extends Comparable < Value > > int nullSafeComp...
if ( first == null ) { return second == null ? EQUAL_COMPARE_RESULT : LOWER_THAN_COMPARE_RESULT ; } return second == null ? GREATER_THAN_COMPARE_RESULT : first . compareTo ( second ) ;
public class SVGBuilder { /** * Parse SVG data from an Android application asset . * @ param assetMngr the Android asset manager . * @ param svgPath the path to the SVG file in the application ' s assets . * @ throws IOException if there was a problem reading the file . */ public SVGBuilder readFromAsset ( AssetM...
this . data = assetMngr . open ( svgPath ) ; return this ;
public class Packer { /** * Add fill = VERTICAL , weighty = wty to the constraints for the current * component . */ public Packer filly ( final double wty ) { } }
gc . fill = GridBagConstraints . VERTICAL ; gc . weighty = wty ; setConstraints ( comp , gc ) ; return this ;
public class SQLiteModelMethod { /** * Gets the adapter for param . * @ param paramName * the param name * @ return the adapter for param */ public TypeName getAdapterForParam ( String paramName ) { } }
if ( this . hasAdapterForParam ( paramName ) ) { return TypeUtility . typeName ( this . parameterName2Adapter . get ( paramName ) ) ; } else { return null ; }
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link MeasureAttributeType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link MeasureAttributeType } { @ ...
return new JAXBElement < MeasureAttributeType > ( _MeasureAttribute_QNAME , MeasureAttributeType . class , null , value ) ;