signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CmsEditablePositionCalculator { /** * Handles a collision by moving the lower position down . < p >
* @ param p1 the first position
* @ param p2 the second position */
protected void handleCollision ( CmsPositionBean p1 , CmsPositionBean p2 ) { } } | CmsPositionBean positionToChange = p1 ; if ( p1 . getTop ( ) <= p2 . getTop ( ) ) { positionToChange = p2 ; } positionToChange . setTop ( positionToChange . getTop ( ) + 25 ) ; |
public class MapMultiPoint { /** * Replies the distance between this MapElement and
* point .
* @ param point the point to compute the distance to .
* @ return the distance . Should be negative depending of the MapElement type . */
@ Override @ Pure public double getDistance ( Point2D < ? , ? > point ) { } } | double mind = Double . MAX_VALUE ; for ( final Point2d p : points ( ) ) { final double d = p . getDistance ( point ) ; if ( d < mind ) { mind = d ; } } return mind ; |
public class WebpTranscoderImpl { /** * Transcodes webp image given by input stream into jpeg . */
@ Override public void transcodeWebpToJpeg ( InputStream inputStream , OutputStream outputStream , int quality ) throws IOException { } } | StaticWebpNativeLoader . ensure ( ) ; nativeTranscodeWebpToJpeg ( Preconditions . checkNotNull ( inputStream ) , Preconditions . checkNotNull ( outputStream ) , quality ) ; |
public class FormulaFactory { /** * Creates a new CNF from a collection of clauses .
* ATTENTION : it is assumed that the operands are really clauses - this is not checked for performance reasons .
* Also no reduction of operands is performed - this method should only be used if you are sure that the CNF is free
... | final LinkedHashSet < ? extends Formula > ops = new LinkedHashSet < > ( clauses ) ; return this . constructCNF ( ops ) ; |
public class BeanUtil { /** * 判断Bean是否为空对象 , 空对象表示本身为 < code > null < / code > 或者所有属性都为 < code > null < / code >
* @ param bean Bean对象
* @ return 是否为空 , < code > true < / code > - 空 / < code > false < / code > - 非空
* @ since 4.1.10 */
public static boolean isEmpty ( Object bean ) { } } | if ( null != bean ) { for ( Field field : ReflectUtil . getFields ( bean . getClass ( ) ) ) { if ( null != ReflectUtil . getFieldValue ( bean , field ) ) { return false ; } } } return true ; |
public class VPCConfigMarshaller { /** * Marshall the given parameter object . */
public void marshall ( VPCConfig vPCConfig , ProtocolMarshaller protocolMarshaller ) { } } | if ( vPCConfig == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( vPCConfig . getSubnets ( ) , SUBNETS_BINDING ) ; protocolMarshaller . marshall ( vPCConfig . getSecurityGroups ( ) , SECURITYGROUPS_BINDING ) ; protocolMarshaller . marshall (... |
public class CrateDigger { /** * Start finding track metadata for all active players using the NFS server on the players to pull the exported
* database and track analysis files . Starts the { @ link MetadataFinder } if it is not already
* running , because we build on its features . This will transitively start ma... | if ( ! isRunning ( ) ) { MetadataFinder . getInstance ( ) . start ( ) ; running . set ( true ) ; // Try fetching the databases of anything that was already mounted before we started .
for ( MediaDetails details : MetadataFinder . getInstance ( ) . getMountedMediaDetails ( ) ) { mediaDetailsListener . detailsAvailable (... |
public class WritableUtils { /** * writes String value of enum to DataOutput .
* @ param out Dataoutput stream
* @ param enumVal enum value
* @ throws IOException */
public static void writeEnum ( DataOutput out , Enum < ? > enumVal ) throws IOException { } } | Text . writeString ( out , enumVal . name ( ) ) ; |
public class OAuth1ConnectionFactory { /** * Create a OAuth1 - based Connection from the access token response returned after { @ link # getOAuthOperations ( ) completing the OAuth1 flow } .
* @ param accessToken the access token
* @ return the new service provider connection
* @ see OAuth1Operations # exchangeFo... | String providerUserId = extractProviderUserId ( accessToken ) ; return new OAuth1Connection < A > ( getProviderId ( ) , providerUserId , accessToken . getValue ( ) , accessToken . getSecret ( ) , getOAuth1ServiceProvider ( ) , getApiAdapter ( ) ) ; |
public class RecoveryLogImpl { /** * Associates another log with this one . */
@ Override public void associateLog ( DistributedRecoveryLog otherLog , boolean failAssociatedLog ) { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "associateLog" , new Object [ ] { otherLog , failAssociatedLog , this } ) ; if ( otherLog instanceof RecoveryLogImpl ) _recoveryLog . associateLog ( ( ( RecoveryLogImpl ) otherLog ) . getMultiScopeLog ( ) , failAssociatedLog ) ; else _recoveryLog . associateLog ( otherLo... |
public class GraphiteConnection { /** * Part of this code taken from http : / / neopatel . blogspot . de / 2011/04 / logging - to - graphite - monitoring - tool . html */
public void send ( String msg ) { } } | try { Socket socket = new Socket ( graphiteHost , graphitePort ) ; try { Writer writer = new OutputStreamWriter ( socket . getOutputStream ( ) ) ; try { writer . write ( msg ) ; writer . flush ( ) ; } finally { try { writer . close ( ) ; } catch ( IOException ioe ) { // ignore , we want to see the outer exception if an... |
public class MongoAnnotationIntrospector { /** * Handling of ObjectId annotated properties */
@ Override public Object findSerializer ( Annotated am ) { } } | if ( am . hasAnnotation ( ObjectId . class ) ) { return ObjectIdSerializer . class ; } return null ; |
public class BasicPathFinder { /** * Determines whether the end of a branch was found . This can indicate
* that a path should be captures up to the leaf node .
* @ param edgeStack { @ link Stack } of { @ link KamEdge } that holds the edges
* on the current path
* @ param edge { @ link KamEdge } , the edge to e... | if ( edgeStack . contains ( edge ) && edgeCount == 1 ) { return true ; } return false ; |
public class EJBInjectionBinding { /** * Sets the beanInterface as specified by XML . */
private void setXMLBeanInterface ( String homeInterfaceName , String interfaceName ) // F743-32443
throws InjectionException { } } | // If a home or business interface was specified in XML , then set that as
// the injection type . Both may be null if the XML just provides an
// override of an annotation to add < ejb - link > . . . in which case the
// injection class type will be set when the annotation is processed .
// For performance , there is ... |
public class LoginActivity { /** * Callback received when a permissions request has been completed . */
@ Override public void onRequestPermissionsResult ( int requestCode , @ NonNull String [ ] permissions , @ NonNull int [ ] grantResults ) { } } | if ( requestCode == REQUEST_READ_CONTACTS ) { if ( grantResults . length == 1 && grantResults [ 0 ] == PackageManager . PERMISSION_GRANTED ) { populateAutoComplete ( ) ; } } |
public class IllegalStateAssertion { /** * Throws an IllegalStateException when the given value is not null .
* @ return the value */
public static < T > T assertNull ( T value , String message ) { } } | if ( value != null ) throw new IllegalStateException ( message ) ; return value ; |
public class EnvironmentsInner { /** * List environments in a given environment setting .
* @ param resourceGroupName The name of the resource group .
* @ param labAccountName The name of the lab Account .
* @ param labName The name of the lab .
* @ param environmentSettingName The name of the environment Setti... | return listWithServiceResponseAsync ( resourceGroupName , labAccountName , labName , environmentSettingName ) . map ( new Func1 < ServiceResponse < Page < EnvironmentInner > > , Page < EnvironmentInner > > ( ) { @ Override public Page < EnvironmentInner > call ( ServiceResponse < Page < EnvironmentInner > > response ) ... |
public class ListStreamsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListStreamsRequest listStreamsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listStreamsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listStreamsRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( listStreamsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocol... |
public class DescribeImageAttributeRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < DescribeImageAttributeRequest > getDryRunRequest ( ) { } } | Request < DescribeImageAttributeRequest > request = new DescribeImageAttributeRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class LuceneUtil { /** * Get the generation ( N ) of the current segments _ N file from a list of
* files .
* @ param files - - array of file names to check */
public static long getCurrentSegmentGeneration ( String [ ] files ) { } } | if ( files == null ) { return - 1 ; } long max = - 1 ; for ( int i = 0 ; i < files . length ; i ++ ) { String file = files [ i ] ; if ( file . startsWith ( IndexFileNames . SEGMENTS ) && ! file . equals ( IndexFileNames . SEGMENTS_GEN ) ) { long gen = generationFromSegmentsFileName ( file ) ; if ( gen > max ) { max = g... |
public class StringUtils { /** * Reads a String from the given input . The string may be null and must have been written with
* { @ link # writeNullableString ( String , DataOutputView ) } .
* @ param in The input to read from .
* @ return The deserialized string , or null .
* @ throws IOException Thrown , if t... | if ( in . readBoolean ( ) ) { return readString ( in ) ; } else { return null ; } |
public class BindTransformer { /** * Gets the sql transform .
* @ param typeName
* the type name
* @ return the sql transform */
static BindTransform getSqlTransform ( TypeName typeName ) { } } | if ( Time . class . getName ( ) . equals ( typeName . toString ( ) ) ) { return new SQLTimeBindTransform ( ) ; } if ( java . sql . Date . class . getName ( ) . equals ( typeName . toString ( ) ) ) { return new SQLDateBindTransform ( ) ; } return null ; |
public class IOUtils { /** * Copies from one stream to another .
* @ param in
* InputStream to read from
* @ param out
* OutputStream to write to
* @ param buffSize
* the size of the buffer
* @ param close
* whether or not close the InputStream and OutputStream at the end . The streams are closed in the... | @ SuppressWarnings ( "resource" ) final PrintStream ps = out instanceof PrintStream ? ( PrintStream ) out : null ; final byte [ ] buf = new byte [ buffSize ] ; try { int bytesRead = in . read ( buf ) ; while ( bytesRead >= 0 ) { out . write ( buf , 0 , bytesRead ) ; if ( ( ps != null ) && ps . checkError ( ) ) { throw ... |
public class M3UParser { /** * When you have an inputStream that is a valid M3U8 playlist , this function parses it into
* a model that can be applied to Live Channels
* @ param inputStream Valid M3U8 file , which can be found through any method
* @ return A TvListing object , which contains channels and programs... | BufferedReader in = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; String line ; List < Channel > channels = new ArrayList < > ( ) ; List < Program > programs = new ArrayList < > ( ) ; Map < Integer , Integer > channelMap = new HashMap < > ( ) ; int defaultDisplayNumber = 0 ; while ( ( line = in . readL... |
public class SpringMvcEndpointGeneratorMojo { /** * Fetches all referenced type names so as to not generate classes multiple
* times
* @ param controllers
* ApiResourceMetadata list
* @ return set of names */
private Set < String > getAllReferencedTypeNames ( Set < ApiResourceMetadata > controllers ) { } } | // TODO Add nested objects as well . For now only the top level objects
// are included
Set < String > parametersNames = controllers . stream ( ) . flatMap ( resourceMetadata -> resourceMetadata . getParameters ( ) . stream ( ) ) . map ( apiParameter -> StringUtils . capitalize ( apiParameter . getName ( ) ) ) . collec... |
public class MethodParameterResolver { public Object [ ] resolve ( final Invocation inv , final ParameterBindingResult parameterBindingResult ) throws Exception { } } | Object [ ] parameters = new Object [ paramMetaDatas . length ] ; for ( int i = 0 ; i < resolvers . length ; i ++ ) { if ( resolvers [ i ] == null ) { continue ; } try { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Resolves parameter " + paramMetaDatas [ i ] . getParamType ( ) . getSimpleName ( ) + " using " +... |
public class AdapterUtil { /** * Display the java . sql . Statement ResultSet close constant corresponding to the value
* supplied .
* @ param value a valid ResultSet close value
* @ return the name of the constant , or a string indicating the constant is unknown . */
public static String getResultSetCloseString ... | switch ( value ) { case Statement . CLOSE_ALL_RESULTS : return "CLOSE ALL RESULTS (" + value + ')' ; case Statement . CLOSE_CURRENT_RESULT : return "CLOSE CURRENT RESULT (" + value + ')' ; case Statement . KEEP_CURRENT_RESULT : return "KEEP CURRENT RESULT (" + value + ')' ; } return "UNKNOWN CLOSE RESULTSET CONSTANT ("... |
public class OLAPService { /** * Perform the given OLAP browser ( _ olapp ) command .
* @ param tenant Tenant context for command .
* @ param parameters OLAP browser parameters . Should be empty to start the browser
* at the home page .
* @ return An HTML - formatted page containing the results of the given
*... | checkServiceState ( ) ; return Olapp . process ( tenant , m_olap , parameters ) ; |
public class CLIServiceUtils { /** * Convert a SQL search pattern into an equivalent Java Regex .
* @ param pattern input which may contain ' % ' or ' _ ' wildcard characters , or
* these characters escaped using { @ code getSearchStringEscape ( ) } .
* @ return replace % / _ with regex search characters , also h... | if ( pattern == null ) { return ".*" ; } else { StringBuilder result = new StringBuilder ( pattern . length ( ) ) ; boolean escaped = false ; for ( int i = 0 , len = pattern . length ( ) ; i < len ; i ++ ) { char c = pattern . charAt ( i ) ; if ( escaped ) { if ( c != SEARCH_STRING_ESCAPE ) { escaped = false ; } result... |
public class PegasosK { /** * Sets the amount of regularization to apply . The regularization must be a
* positive value
* @ param regularization the amount of regularization to apply */
public void setRegularization ( double regularization ) { } } | if ( Double . isNaN ( regularization ) || Double . isInfinite ( regularization ) || regularization <= 0 ) throw new ArithmeticException ( "Regularization must be a positive constant, not " + regularization ) ; this . regularization = regularization ; |
public class MonetaryFunctions { /** * Descending order of
* { @ link MonetaryFunctions # sortValuable ( ExchangeRateProvider ) }
* @ param provider the rate provider to be used .
* @ return the Descending order of
* { @ link MonetaryFunctions # sortValuable ( ExchangeRateProvider ) } */
public static Comparato... | return new Comparator < MonetaryAmount > ( ) { @ Override public int compare ( MonetaryAmount o1 , MonetaryAmount o2 ) { return sortValuable ( provider ) . compare ( o1 , o2 ) * - 1 ; } } ; |
public class DefUtils { /** * Throws an exception if the given string is not a valid variable value . */
public static void assertVarValue ( Object val ) throws IllegalArgumentException { } } | if ( ! isVarValue ( val ) ) { throw new IllegalArgumentException ( "\"" + String . valueOf ( val ) + "\"" + " is not a valid variable value" ) ; } |
public class A_CmsUploadDialog { /** * Parses the upload response of the server and decides what to do . < p >
* @ param results a JSON Object */
public void parseResponse ( String results ) { } } | cancelUpdateProgress ( ) ; stopLoadingAnimation ( ) ; if ( ( ! m_canceled ) && CmsStringUtil . isNotEmptyOrWhitespaceOnly ( results ) ) { JSONObject jsonObject = JSONParser . parseStrict ( results ) . isObject ( ) ; boolean success = jsonObject . get ( I_CmsUploadConstants . KEY_SUCCESS ) . isBoolean ( ) . booleanValue... |
public class JavaSPIExtensionLoader { @ Override public Collection < LoadableExtension > load ( ) { } } | return all ( org . jboss . arquillian . core . impl . loadable . JavaSPIExtensionLoader . class . getClassLoader ( ) , LoadableExtension . class ) ; |
public class HadoopDFSRule { /** * Writes the following content to the Hadoop cluster .
* @ param filename File to be created
* @ param content The content to write
* @ throws IOException Anything . */
public void write ( String filename , String content ) throws IOException { } } | FSDataOutputStream s = getMfs ( ) . create ( new Path ( filename ) ) ; s . writeBytes ( content ) ; s . close ( ) ; |
public class ClassInfo { /** * < p > getClassForName . < / p >
* @ param className a { @ link java . lang . String } object .
* @ return a { @ link java . lang . Class } object . */
public Class getClassForName ( final String className ) { } } | try { final OsgiRegistry osgiRegistry = ReflectionHelper . getOsgiRegistryInstance ( ) ; if ( osgiRegistry != null ) { return osgiRegistry . classForNameWithException ( className ) ; } else { return AccessController . doPrivileged ( ReflectionHelper . classForNameWithExceptionPEA ( className ) ) ; } } catch ( final Cla... |
public class LazyInitProxyFactory { /** * < p > createProxy . < / p >
* @ param type a { @ link java . lang . Class } object .
* @ param locator a { @ link org . ops4j . pax . wicket . spi . ProxyTargetLocator } object .
* @ return a { @ link java . lang . Object } object . */
public static Object createProxy ( f... | if ( type . isPrimitive ( ) || BUILTINS . contains ( type ) || Enum . class . isAssignableFrom ( type ) ) { // We special - case primitives as sometimes people use these as
// SpringBeans ( WICKET - 603 , WICKET - 906 ) . Go figure .
Object proxy = locator . locateProxyTarget ( ) ; Object realTarget = getRealTarget ( p... |
public class NewJFrame { /** * This method is called from within the constructor to
* initialize the form .
* WARNING : Do NOT modify this code . The content of this method is
* always regenerated by the Form Editor . */
@ SuppressWarnings ( "unchecked" ) // < editor - fold defaultstate = " collapsed " desc = " G... | jLabel1 = new javax . swing . JLabel ( ) ; jTextField1 = new javax . swing . JTextField ( ) ; jLabel2 = new javax . swing . JLabel ( ) ; jTextField2 = new javax . swing . JTextField ( ) ; jLabel3 = new javax . swing . JLabel ( ) ; jTextField3 = new javax . swing . JTextField ( ) ; jLabel4 = new javax . swing . JLabel (... |
public class HylaFaxJob { /** * This function sets the fax job target address .
* @ param targetAddress
* The fax job target address */
public void setTargetAddress ( String targetAddress ) { } } | try { this . JOB . setDialstring ( targetAddress ) ; } catch ( Exception exception ) { throw new FaxException ( "Error while setting job target address." , exception ) ; } |
public class SARLRuntime { /** * Replies if the given directory contains a SRE bootstrap .
* < p > The SRE bootstrap detection is based on the service definition within META - INF folder .
* @ param directory the directory .
* @ return < code > true < / code > if the given directory contains a SRE . Otherwise < c... | final String [ ] elements = SREConstants . SERVICE_SRE_BOOTSTRAP . split ( "/" ) ; // $ NON - NLS - 1 $
File serviceFile = directory ; for ( final String element : elements ) { serviceFile = new File ( serviceFile , element ) ; } if ( serviceFile . isFile ( ) && serviceFile . canRead ( ) ) { try ( InputStream is = new ... |
public class BottomSheet { /** * Adapts the root view . */
private void adaptRootView ( ) { } } | if ( rootView != null ) { if ( getStyle ( ) == Style . LIST ) { int paddingTop = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . bottom_sheet_list_padding_top ) ; rootView . setPadding ( 0 , paddingTop , 0 , 0 ) ; } else { int paddingTop = getContext ( ) . getResources ( ) . getDimensionPixelSiz... |
public class TransTypes { /** * Construct an attributed tree for a cast of expression to target type ,
* unless it already has precisely that type .
* @ param tree The expression tree .
* @ param target The target type . */
JCExpression cast ( JCExpression tree , Type target ) { } } | int oldpos = make . pos ; make . at ( tree . pos ) ; if ( ! types . isSameType ( tree . type , target ) ) { if ( ! resolve . isAccessible ( env , target . tsym ) ) resolve . logAccessErrorInternal ( env , tree , target ) ; tree = make . TypeCast ( make . Type ( target ) , tree ) . setType ( target ) ; } make . pos = ol... |
public class JsonUtils { /** * Parses a JSON - LD document from the given { @ link InputStream } to an object
* that can be used as input for the { @ link JsonLdApi } and
* { @ link JsonLdProcessor } methods .
* @ param input
* The JSON - LD document in an InputStream .
* @ param enc
* The character encodin... | try ( InputStreamReader in = new InputStreamReader ( input , enc ) ; BufferedReader reader = new BufferedReader ( in ) ; ) { return fromReader ( reader ) ; } |
public class MarginViewMover { /** * Checks whether view is left aligned
* @ param layoutParams view ' s layout parameters
* @ return true if the view is left aligned , otherwise false */
private boolean isViewLeftAligned ( ViewGroup . MarginLayoutParams layoutParams ) { } } | final int left = getView ( ) . getLeft ( ) ; boolean viewLeftAligned = left == 0 || left == layoutParams . leftMargin ; LOGGER . trace ( "View is {} aligned" , viewLeftAligned ? "LEFT" : "RIGHT" ) ; return viewLeftAligned ; |
public class FrameHeaders { /** * Indexed Header Field Representation
* 0 1 2 3 4 5 6 7
* | 1 | Index ( 7 + ) |
* Literal Header Field with Incremental Indexing - Indexed Name
* 0 1 2 3 4 5 6 7
* | 0 | 1 | Index ( 6 + ) |
* | H | Value Length ( 7 + ) |
* | Value String ( Length octets ) |
* find the hea... | byte headerStaticIndex = - 1 ; byte [ ] retArray = null ; LongEncoder enc = new LongEncoder ( ) ; if ( xHeaderName != null ) { headerStaticIndex = utils . getIndexNumber ( xHeaderName ) ; } if ( xIndexingType == HeaderFieldType . INDEXED ) { if ( headerStaticIndex != - 1 ) { // one of the headers defined in the spec st... |
public class ProtobufProxy { /** * Compile .
* @ param cls target class to be compiled
* @ param outputPath compile byte files output stream */
public static void compile ( Class < ? > cls , File outputPath ) { } } | if ( outputPath == null ) { throw new NullPointerException ( "Param 'outputPath' is null." ) ; } if ( ! outputPath . isDirectory ( ) ) { throw new RuntimeException ( "Param 'outputPath' value should be a path directory. path=" + outputPath ) ; } |
public class BindTag { /** * Ensures that we have the dependencies properly available to run bind . js .
* bind . js requires either prototype or jQuery . If we use jQuery , we use
* { @ code JSON . stringify ( ) } , which isn ' t present in older browser , so we
* will add it . */
private void ensureDependencies... | AdjunctsInPage adjuncts = AdjunctsInPage . get ( ) ; if ( adjuncts . isIncluded ( "org.kohsuke.stapler.framework.prototype.prototype" ) ) return ; // all the dependencies met
if ( adjuncts . isIncluded ( "org.kohsuke.stapler.jquery" ) ) { // Old browsers ( like htmlunit or < = IE7 ) doesn ' t support JSON . stringify n... |
public class ManualGrpcSecurityMetadataSource { /** * Set the given access predicate for the all methods of the given service . This will replace previously set
* predicates .
* @ param service The service to protect with a custom check .
* @ param predicate The predicate used to check the { @ link Authentication... | requireNonNull ( service , "service" ) ; final Collection < ConfigAttribute > wrappedPredicate = wrap ( predicate ) ; for ( final MethodDescriptor < ? , ? > method : service . getMethods ( ) ) { this . accessMap . put ( method , wrappedPredicate ) ; } return this ; |
public class UtilDisparityScore { /** * compute the score for each element all at once to encourage the JVM to optimize and
* encourage the JVM to optimize this section of code .
* Was original inline , but was actually slightly slower by about 3 % consistently , It
* is in its own function so that it can be over... | for ( int rCol = 0 ; rCol < elementMax ; rCol ++ ) { float diff = ( left . data [ indexLeft ++ ] ) - ( right . data [ indexRight ++ ] ) ; elementScore [ rCol ] = Math . abs ( diff ) ; } |
public class EmojiTrie { /** * Checks if sequence of chars contain an emoji .
* @ param sequence Sequence of char that may contain emoji in full or
* partially .
* @ return
* & lt ; li & gt ;
* Matches . EXACTLY if char sequence in its entirety is an emoji
* & lt ; / li & gt ;
* & lt ; li & gt ;
* Match... | if ( sequence == null ) { return Matches . POSSIBLY ; } Node tree = root ; for ( char c : sequence ) { if ( ! tree . hasChild ( c ) ) { return Matches . IMPOSSIBLE ; } tree = tree . getChild ( c ) ; } return tree . isEndOfEmoji ( ) ? Matches . EXACTLY : Matches . POSSIBLY ; |
public class TarBuffer { /** * Initialization common to all constructors . */
private void initialize ( int blockSize , int recordSize ) { } } | this . debug = false ; this . blockSize = blockSize ; this . recordSize = recordSize ; this . recsPerBlock = ( this . blockSize / this . recordSize ) ; this . blockBuffer = new byte [ this . blockSize ] ; if ( this . inStream != null ) { this . currBlkIdx = - 1 ; this . currRecIdx = this . recsPerBlock ; } else { this ... |
public class NewGroupListener { /** * { @ inheritDoc } */
public void preDelete ( Group group ) throws Exception { } } | String groupId = null ; if ( group . getId ( ) != null ) { groupId = group . getId ( ) ; } else { String parentId = group . getParentId ( ) ; if ( parentId == null || parentId . length ( ) == 0 ) groupId = "/" + group . getGroupName ( ) ; else groupId = parentId + "/" + group . getGroupName ( ) ; } removeGroup ( jcrSer... |
public class JpaClusterLockDao { /** * Creates a new ClusterMutex with the specified name . Returns the created mutex or null if the
* mutex already exists . */
protected void createClusterMutex ( final String mutexName ) { } } | this . executeIgnoreRollback ( new TransactionCallbackWithoutResult ( ) { @ Override protected void doInTransactionWithoutResult ( TransactionStatus status ) { final EntityManager entityManager = getEntityManager ( ) ; final ClusterMutex clusterMutex = new ClusterMutex ( mutexName ) ; entityManager . persist ( clusterM... |
public class InternalXbaseParser { /** * InternalXbase . g : 192:1 : ruleOpOr : ( ' | | ' ) ; */
public final void ruleOpOr ( ) throws RecognitionException { } } | int stackSize = keepStackSize ( ) ; try { // InternalXbase . g : 196:2 : ( ( ' | | ' ) )
// InternalXbase . g : 197:2 : ( ' | | ' )
{ // InternalXbase . g : 197:2 : ( ' | | ' )
// InternalXbase . g : 198:3 : ' | | '
{ if ( state . backtracking == 0 ) { before ( grammarAccess . getOpOrAccess ( ) . getVerticalLineVertica... |
public class GeneratorXMLDatabaseConnection { /** * Parse a string into a vector .
* TODO : move this into utility package ?
* @ param s String to parse
* @ return Vector */
private double [ ] parseVector ( String s ) { } } | String [ ] entries = WHITESPACE_PATTERN . split ( s ) ; double [ ] d = new double [ entries . length ] ; for ( int i = 0 ; i < entries . length ; i ++ ) { try { d [ i ] = ParseUtil . parseDouble ( entries [ i ] ) ; } catch ( NumberFormatException e ) { throw new AbortException ( "Could not parse vector." ) ; } } return... |
public class Matth { /** * Returns the base 2 logarithm of a double value , rounded with the specified rounding mode to an
* { @ code int } .
* < p > Regardless of the rounding mode , this is faster than { @ code ( int ) log2 ( x ) } .
* @ throws IllegalArgumentException if { @ code x < = 0.0 } , { @ code x } is ... | N . checkArgument ( x > 0.0 && isFinite ( x ) , "x must be positive and finite" ) ; int exponent = getExponent ( x ) ; if ( ! isNormal ( x ) ) { return log2 ( x * IMPLICIT_BIT , mode ) - SIGNIFICAND_BITS ; // Do the calculation on a normal value .
} // x is positive , finite , and normal
boolean increment ; switch ( mo... |
public class CmsFlexController { /** * Sets the " last modified " date header for a given http request . < p >
* @ param res the response to set the " last modified " date header for
* @ param dateLastModified the date to set ( if this is lower then 0 , the current time is set ) */
public static void setDateLastMod... | if ( dateLastModified > - 1 ) { // set date last modified header ( precision is only second , not millisecond
res . setDateHeader ( CmsRequestUtil . HEADER_LAST_MODIFIED , ( dateLastModified / 1000 ) * 1000 ) ; } else { // this resource can not be optimized for " last modified " , use current time as header
res . setDa... |
public class ExpandableStringEnum { /** * Creates an instance of the specific expandable string enum from a String .
* @ param name the value to create the instance from
* @ param clazz the class of the expandable string enum
* @ param < T > the class of the expandable string enum
* @ return the expandable stri... | if ( name == null ) { return null ; } else if ( valuesByName != null ) { T value = ( T ) valuesByName . get ( uniqueKey ( clazz , name ) ) ; if ( value != null ) { return value ; } } try { T value = clazz . newInstance ( ) ; return value . withNameValue ( name , value , clazz ) ; } catch ( InstantiationException | Ille... |
public class MessagingSecurityServiceImpl { /** * Get Messaging Authentication Service */
@ Override public MessagingAuthenticationService getMessagingAuthenticationService ( ) { } } | SibTr . entry ( tc , CLASS_NAME + "getMessagingAuthenticationService" ) ; if ( sibAuthenticationService == null ) { sibAuthenticationService = new MessagingAuthenticationServiceImpl ( this ) ; } SibTr . exit ( tc , CLASS_NAME + "getMessagingAuthenticationService" , sibAuthenticationService ) ; return sibAuthenticationS... |
public class ImageParser { /** * Return true if at least one of the values is not null / empty .
* @ param imageKeyword the image keyword
* @ param score the score
* @ return true if at least one of the values is not null / empty */
private boolean isValidImage ( final String imageKeyword , final Double score ) {... | return ! StringUtils . isBlank ( imageKeyword ) || score != null ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcSpaceType ( ) { } } | if ( ifcSpaceTypeEClass == null ) { ifcSpaceTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 526 ) ; } return ifcSpaceTypeEClass ; |
public class BaseApplet { /** * Initializes the applet .
* @ param args Arguments in standalone pass - in format . */
public void init ( String [ ] args ) { } } | BaseApplet applet = null ; if ( ! gbStandAlone ) applet = this ; if ( m_application == null ) { Map < String , Object > properties = null ; if ( args != null ) { properties = new Hashtable < String , Object > ( ) ; Util . parseArgs ( properties , args ) ; } m_application = new ThinApplication ( null , properties , appl... |
public class MP3FileID3Controller { /** * Return a formatted version of the getPlayingTime method . The string
* will be formated " m : ss " where ' m ' is minutes and ' ss ' is seconds .
* @ return a formatted version of the getPlayingTime method */
public String getPlayingTimeString ( ) { } } | long time = getPlayingTime ( ) ; long mins = time / 60 ; long secs = time % 60 ; StringBuilder str = new StringBuilder ( ) ; if ( mins < 10 ) str . append ( '0' ) ; str . append ( mins ) . append ( ':' ) ; if ( secs < 10 ) str . append ( '0' ) ; str . append ( secs ) ; return str . toString ( ) ; |
public class SheetRowResourcesImpl { /** * Insert rows to a sheet .
* It mirrors to the following Smartsheet REST API method : POST / sheets / { sheetId } / rows
* Exceptions :
* - IllegalArgumentException : if any argument is null
* - InvalidRequestException : if there is any problem with the REST API request ... | return this . postAndReceiveList ( "sheets/" + sheetId + "/rows" , rows , Row . class ) ; |
public class TupleIndexer { /** * Index using the existing session without opening new transactions */
private void runIndexing ( Session upperSession , Tuple tuple ) { } } | initSession ( upperSession ) ; try { index ( upperSession , entity ( upperSession , tuple ) ) ; } catch ( Throwable e ) { errorHandler . handleException ( log . massIndexerUnexpectedErrorMessage ( ) , e ) ; } finally { log . debug ( "finished" ) ; } |
public class CompositeTagLibrary { /** * ( non - Javadoc )
* @ see org . apache . myfaces . view . facelets . tag . TagLibrary # containsNamespace ( java . lang . String ) */
public boolean containsNamespace ( String ns ) { } } | for ( int i = 0 ; i < this . libraries . length ; i ++ ) { if ( this . libraries [ i ] . containsNamespace ( ns ) ) { return true ; } } return false ; |
public class DateTimeFormatterBuilder { /** * Instructs the printer to emit a field value as short text , and the
* parser to expect text .
* @ param fieldType type of field to append
* @ return this DateTimeFormatterBuilder , for chaining
* @ throws IllegalArgumentException if field type is null */
public Date... | if ( fieldType == null ) { throw new IllegalArgumentException ( "Field type must not be null" ) ; } return append0 ( new TextField ( fieldType , true ) ) ; |
public class BaseFlowGraph { /** * Add a { @ link DataNode } to the { @ link FlowGraph } . If the node already " exists " in the { @ link FlowGraph } ( i . e . the
* FlowGraph already has another node with the same id ) , we remove the old node and add the new one . The
* edges incident on the old node are preserve... | try { rwLock . writeLock ( ) . lock ( ) ; // Get edges adjacent to the node if it already exists
Set < FlowEdge > edges = this . nodesToEdges . getOrDefault ( node , new HashSet < > ( ) ) ; this . nodesToEdges . put ( node , edges ) ; this . dataNodeMap . put ( node . getId ( ) , node ) ; } finally { rwLock . writeLock... |
public class MacAddressUtil { /** * Returns the result of { @ link # bestAvailableMac ( ) } if non - { @ code null } otherwise returns a random EUI - 64 MAC
* address . */
public static byte [ ] defaultMachineId ( ) { } } | byte [ ] bestMacAddr = bestAvailableMac ( ) ; if ( bestMacAddr == null ) { bestMacAddr = new byte [ EUI64_MAC_ADDRESS_LENGTH ] ; PlatformDependent . threadLocalRandom ( ) . nextBytes ( bestMacAddr ) ; logger . warn ( "Failed to find a usable hardware address from the network interfaces; using random bytes: {}" , format... |
public class MCAImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . MCA__RG : getRG ( ) . clear ( ) ; return ; } super . eUnset ( featureID ) ; |
public class JspFactoryImpl { /** * PI24001 end */
protected PageContextPool getPool ( ) { } } | PageContextPool pool = null ; if ( ( pool = ( PageContextPool ) _threadLocal . get ( ) ) == null ) { // pool = new PageContextPool ( 4 ) {
pool = new PageContextPool ( 8 ) { // PK25630
protected PageContext createPageContext ( ) { return new PageContextImpl ( JspFactoryImpl . this , bodyContentBufferSize ) ; } } ; _thr... |
public class ColorPalettePreference { /** * Sets the shape , which should be used to preview colors in the preference ' s dialog .
* @ param previewShape
* The shape , which should be set , as a value of the enum { @ link PreviewShape } . The
* shape may not be null */
public final void setDialogPreviewShape ( @ ... | Condition . INSTANCE . ensureNotNull ( previewShape , "The preview shape may not be null" ) ; this . dialogPreviewShape = previewShape ; |
public class ModelDiff { /** * Creates an instance of the ModelDiff class based on the given model . It loads the old status of the model and
* calculates the differences of this two models . */
public static ModelDiff createModelDiff ( OpenEngSBModel updated , String completeModelId , EngineeringDatabaseService edbS... | EDBObject queryResult = edbService . getObject ( completeModelId ) ; OpenEngSBModel old = edbConverter . convertEDBObjectToModel ( updated . getClass ( ) , queryResult ) ; ModelDiff diff = new ModelDiff ( old , updated ) ; calculateDifferences ( diff ) ; return diff ; |
public class EbeanUtils { /** * parse uri query param to BeanPathProperties for Ebean . json ( ) . toJson ( )
* @ return BeanPathProperties
* @ see CommonBeanSerializer # serialize ( Object , JsonGenerator , SerializerProvider ) */
public static FetchPath getRequestFetchPath ( ) { } } | Object properties = Requests . getProperty ( PATH_PROPS_PARSED ) ; if ( properties == null ) { BeanPathProperties pathProperties = EntityFieldsUtils . parsePathProperties ( ) ; if ( pathProperties == null ) { Requests . setProperty ( PATH_PROPS_PARSED , false ) ; } else { properties = EbeanPathProps . of ( pathProperti... |
public class AbstractIPListPolicy { /** * Gets the remote address for comparison .
* @ param request the request
* @ param config the config */
protected String getRemoteAddr ( ApiRequest request , IPListConfig config ) { } } | String httpHeader = config . getHttpHeader ( ) ; if ( httpHeader != null && httpHeader . trim ( ) . length ( ) > 0 ) { String value = ( String ) request . getHeaders ( ) . get ( httpHeader ) ; if ( value != null ) { return value ; } } return request . getRemoteAddr ( ) ; |
public class DevicesManagementApi { /** * Returns the details and global status of a specific task id .
* Returns the details and global status of a specific task id .
* @ param tid Task ID . ( required )
* @ return ApiResponse & lt ; TaskEnvelope & gt ;
* @ throws ApiException If fail to call the API , e . g .... | com . squareup . okhttp . Call call = getTaskByIDValidateBeforeCall ( tid , null , null ) ; Type localVarReturnType = new TypeToken < TaskEnvelope > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class RemoteConsumerTransmit { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . runtime . SIMPRemoteConsumerTransmitControllable # getTransmitMessageRequestIterator ( ) */
public SIMPIterator getTransmitMessageRequestIterator ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getTransmitMessageRequestIterator" ) ; AOStreamIterator aoStreamIterator = new AOStreamIterator ( _aoStream , _messageProcessor , _aoh ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . e... |
public class MapcodeCodec { /** * Encode a lat / lon pair to a mapcode with territory information . This produces a non - empty list of mapcode ,
* with at the very least 1 mapcodes for the lat / lon , which is the " International " mapcode .
* The returned result list will always contain at least 1 mapcode , becau... | return encode ( latDeg , lonDeg , null ) ; |
public class FileResource { public URL getAlias ( ) { } } | if ( __checkAliases && ! _aliasChecked ) { try { String abs = _file . getAbsolutePath ( ) ; String can = _file . getCanonicalPath ( ) ; if ( abs . length ( ) != can . length ( ) || ! abs . equals ( can ) ) _alias = new File ( can ) . toURI ( ) . toURL ( ) ; _aliasChecked = true ; if ( _alias != null && log . isDebugEna... |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcTableRow ( ) { } } | if ( ifcTableRowEClass == null ) { ifcTableRowEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 697 ) ; } return ifcTableRowEClass ; |
public class CursorManager { /** * Use this call to make all the { @ link GVRSceneObject } s in the provided GVRScene to be
* selectable .
* In order to have more control over objects that can be made selectable make use of the
* { @ link # addSelectableObject ( GVRSceneObject ) } method .
* Note that this call... | if ( this . scene == scene ) { // do nothing return
return ; } // cleanup on the currently set scene if there is one
if ( this . scene != null ) { // false to remove
updateCursorsInScene ( this . scene , false ) ; } this . scene = scene ; if ( scene == null ) { return ; } // process the new scene
for ( GVRSceneObject o... |
public class WApplication { /** * { @ inheritDoc } */
@ Override public String getIdName ( ) { } } | String name = super . getIdName ( ) ; return name == null ? DEFAULT_APPLICATION_ID : name ; |
public class QuickDrawContext { /** * CopyBits .
* Note that the destination is always { @ code this } .
* @ param pSrcBitmap the source bitmap to copy pixels from
* @ param pSrcRect the source rectangle
* @ param pDstRect the destination rectangle
* @ param pMode the blending mode
* @ param pMaskRgn the ma... | graphics . setComposite ( getCompositeFor ( pMode ) ) ; if ( pMaskRgn != null ) { setClipRegion ( pMaskRgn ) ; } graphics . drawImage ( pSrcBitmap , pDstRect . x , pDstRect . y , pDstRect . x + pDstRect . width , pDstRect . y + pDstRect . height , pSrcRect . x , pSrcRect . y , pSrcRect . x + pSrcRect . width , pSrcRect... |
public class AcpService { /** * 敏感信息解密 , 使用配置文件acp _ sdk . properties解密 < br >
* @ param base64EncryptedInfo 加密信息 < br >
* @ param encoding < br >
* @ return 解密后的明文 < br > */
public static String decryptData ( String base64EncryptedInfo , String encoding ) { } } | return SecureUtil . decryptData ( base64EncryptedInfo , encoding , CertUtil . getSignCertPrivateKey ( ) ) ; |
public class AbstractMergeOuterJoinIterator { /** * Calls the < code > JoinFunction # join ( ) < / code > method for all two key - value pairs that share the same key and come
* from different inputs . Furthermore , depending on the outer join type ( LEFT , RIGHT , FULL ) , all key - value pairs where no
* matching... | if ( ! initialized ) { // first run , set iterators to first elements
it1Empty = ! this . iterator1 . nextKey ( ) ; it2Empty = ! this . iterator2 . nextKey ( ) ; initialized = true ; } if ( it1Empty && it2Empty ) { return false ; } else if ( it2Empty ) { if ( outerJoinType == OuterJoinType . LEFT || outerJoinType == Ou... |
public class ChannelBuffer { /** * Adds provided item to the buffer and resets current { @ code take } . */
public void add ( @ Nullable T item ) throws Exception { } } | if ( exception == null ) { if ( take != null ) { assert isEmpty ( ) ; SettablePromise < T > take = this . take ; this . take = null ; take . set ( item ) ; if ( exception != null ) throw exception ; return ; } doAdd ( item ) ; } else { tryRecycle ( item ) ; throw exception ; } |
public class MemcachedClientBuilder { /** * Create a client builder for MessagePack values .
* @ return The builder */
public static < T > MemcachedClientBuilder < T > newMessagePackClient ( final Class < T > valueType ) { } } | return newMessagePackClient ( DefaultMessagePackHolder . INSTANCE , valueType ) ; |
public class StringGroovyMethods { /** * Replaces sequences of whitespaces with tabs within a line .
* @ param self A line to unexpand
* @ param tabStop The number of spaces a tab represents
* @ return an unexpanded String
* @ since 1.8.2 */
public static String unexpandLine ( CharSequence self , int tabStop ) ... | StringBuilder builder = new StringBuilder ( self . toString ( ) ) ; int index = 0 ; while ( index + tabStop < builder . length ( ) ) { // cut original string in tabstop - length pieces
String piece = builder . substring ( index , index + tabStop ) ; // count trailing whitespace characters
int count = 0 ; while ( ( coun... |
public class StringIterate { /** * Converts a string of tokens separated by the specified separator to a sorted { @ link MutableList } . */
public static MutableList < String > tokensToSortedList ( String string , String separator ) { } } | return StringIterate . tokensToList ( string , separator ) . sortThis ( ) ; |
public class CmsLink { /** * Return the site root if the target of this link is internal , or < code > null < / code > otherwise . < p >
* @ return the site root if the target of this link is internal , or < code > null < / code > otherwise */
public String getSiteRoot ( ) { } } | if ( m_internal && ( m_siteRoot == null ) ) { m_siteRoot = OpenCms . getSiteManager ( ) . getSiteRoot ( m_target ) ; if ( m_siteRoot == null ) { m_siteRoot = "" ; } } return m_siteRoot ; |
public class Mappings { /** * Retrieves the identity mapping , which maps each domain value to itself .
* @ param < T >
* domain / range class .
* @ return the identity mapping . */
@ SuppressWarnings ( "unchecked" ) public static < T > Mapping < T , T > identity ( ) { } } | return ( Mapping < T , T > ) IDENTITY_MAPPING ; |
public class IntegerToOneHotTransform { /** * Transform an object
* in to another object
* @ param input the record to transform
* @ return the transformed writable */
@ Override public Object map ( Object input ) { } } | int currValue = ( ( Number ) input ) . intValue ( ) ; if ( currValue < minValue || currValue > maxValue ) { throw new IllegalStateException ( "Invalid value: integer value (" + currValue + ") is outside of " + "valid range: must be between " + minValue + " and " + maxValue + " inclusive" ) ; } List < Integer > oneHot =... |
public class KxReactiveStreams { /** * warning : blocks the calling thread . Need to execute in a separate thread if called
* from within a callback */
public < T > Iterator < T > iterator ( Publisher < T > pub ) { } } | return iterator ( pub , batchSize ) ; |
public class Validator { /** * Validates a given object to be not null
* @ param object The object to check
* @ param name The name of the field to display the error message
* @ param message A custom error message instead of the default one */
public void validateNotNull ( Object object , String name , String me... | if ( object == null ) { addError ( name , Optional . ofNullable ( message ) . orElse ( messages . get ( Validation . NOTNULL_KEY . name ( ) , name ) ) ) ; } |
public class DeviceProxy { public void remove_logging_target ( String target_type , String target_name ) throws DevFailed { } } | deviceProxyDAO . remove_logging_target ( this , target_type , target_name ) ; |
public class CompositeInputFormat { /** * Interpret a given string as a composite expression .
* { @ code
* func : : = < ident > ( [ < func > , ] * < func > )
* func : : = tbl ( < class > , " < path > " )
* class : : = @ see java . lang . Class # forName ( java . lang . String )
* path : : = @ see org . apach... | addDefaults ( ) ; addUserIdentifiers ( job ) ; root = Parser . parse ( job . get ( "mapred.join.expr" , null ) , job ) ; |
public class ShanksAgentBayesianReasoningCapability { /** * Clear all evidences in the network
* @ param bn
* @ throws ShanksException */
@ SuppressWarnings ( "deprecation" ) public static void clearEvidences ( ProbabilisticNetwork bn ) throws ShanksException { } } | try { bn . compile ( ) ; } catch ( Exception e ) { throw new ShanksException ( e ) ; } |
public class CommercePriceEntryLocalServiceUtil { /** * Updates the commerce price entry in the database or adds it if it does not yet exist . Also notifies the appropriate model listeners .
* @ param commercePriceEntry the commerce price entry
* @ return the commerce price entry that was updated */
public static c... | return getService ( ) . updateCommercePriceEntry ( commercePriceEntry ) ; |
public class WebAppFilterManager { /** * Returns a WebAppFilterChain object corresponding to the passed in uri and
* servlet . If the filter chain has previously been created , return that
* instance . . . if not , then create a new filter chain instance , ensuring that
* all filters in the chain are loaded
* @... | return this . getFilterChain ( reqURI , reqServlet , DispatcherType . REQUEST ) ; |
public class TaskCreator { /** * Add the requested post parameters to the Request .
* @ param request Request to add post params to */
private void addPostParams ( final Request request ) { } } | if ( timeout != null ) { request . addPostParam ( "Timeout" , timeout . toString ( ) ) ; } if ( priority != null ) { request . addPostParam ( "Priority" , priority . toString ( ) ) ; } if ( taskChannel != null ) { request . addPostParam ( "TaskChannel" , taskChannel ) ; } if ( workflowSid != null ) { request . addPostP... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.