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 * of redundant clauses . * @ param clauses the collection of clauses * @ return a new CNF */ public Formula cnf ( final Collection < ? extends Formula > clauses ) { } }
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 ( vPCConfig . getAssignPublicIp ( ) , ASSIGNPUBLICIP_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
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 many of the other Beat Link subsystems , * and stopping any of them will stop us as well . * @ throws Exception if there is a problem starting the required components */ @ SuppressWarnings ( "WeakerAccess" ) public synchronized void start ( ) throws Exception { } }
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 ( details ) ; } MetadataFinder . getInstance ( ) . addMetadataProvider ( metadataProvider ) ; }
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 # exchangeForAccessToken ( org . springframework . social . oauth1 . AuthorizedRequestToken , org . springframework . util . MultiValueMap ) */ public Connection < A > createConnection ( OAuthToken accessToken ) { } }
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 ( otherLog , failAssociatedLog ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "associateLog" ) ;
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 any LOGGER . info ( "could not close writer" ) ; } } if ( connectionState != ConnectionState . SUCCESS ) { LOGGER . info ( "Connection to graphite Host {}" , ( ( connectionState == ConnectionState . UNKNOWN ) ? "established" : "recovered" ) ) ; connectionState = ConnectionState . SUCCESS ; } } catch ( IOException e ) { String action = "write" ; handleException ( e , action ) ; } finally { socket . close ( ) ; } } catch ( IOException e ) { String action = "connect" ; handleException ( e , action ) ; }
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 evaluate * @ param edgeCount < tt > int < / tt > , the number of adjacent edges to the * last visited { @ link KamNode } * @ return < tt > true < / tt > if this edge marks the end of a branch , * < tt > false < / tt > otherwise if it does not */ private boolean endOfBranch ( final SetStack < KamEdge > edgeStack , KamEdge edge , int edgeCount ) { } }
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 no need to load these classes until first // accessed , which might be never if there is a binding file , so just the // name will be set here . getInjectionClassType ( ) is then overridden to load // the class when needed . Prior to EJB 3.0 these interfaces were completely // ignored , so this behavior allows EJB 2.1 apps to continue to function // even if they had garbage in their deployment descriptor . d739281 if ( homeInterfaceName != null && homeInterfaceName . length ( ) != 0 ) // d668376 { ivHomeInterface = true ; setInjectionClassTypeName ( homeInterfaceName ) ; if ( isValidationLoggable ( ) ) { loadClass ( homeInterfaceName , isValidationFailable ( ) ) ; loadClass ( interfaceName , isValidationFailable ( ) ) ; } } else if ( interfaceName != null && interfaceName . length ( ) != 0 ) // d668376 { ivBeanInterface = true ; setInjectionClassTypeName ( interfaceName ) ; if ( isValidationLoggable ( ) ) { loadClass ( interfaceName , isValidationFailable ( ) ) ; } }
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 Setting . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; EnvironmentInner & gt ; object */ public Observable < Page < EnvironmentInner > > listAsync ( final String resourceGroupName , final String labAccountName , final String labName , final String environmentSettingName ) { } }
return listWithServiceResponseAsync ( resourceGroupName , labAccountName , labName , environmentSettingName ) . map ( new Func1 < ServiceResponse < Page < EnvironmentInner > > , Page < EnvironmentInner > > ( ) { @ Override public Page < EnvironmentInner > call ( ServiceResponse < Page < EnvironmentInner > > response ) { return response . body ( ) ; } } ) ;
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 ) ; protocolMarshaller . marshall ( listStreamsRequest . getStreamNameCondition ( ) , STREAMNAMECONDITION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
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 = gen ; } } } return max ;
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 the reading or the deserialization fails . */ public static @ Nullable String readNullableString ( DataInputView in ) throws IOException { } }
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 finally * clause . * @ throws IOException * thrown if an error occurred while writing to the output stream */ public static void copyBytes ( final InputStream in , final OutputStream out , final int buffSize , final boolean close ) throws IOException { } }
@ 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 new IOException ( "Unable to write to output stream." ) ; } bytesRead = in . read ( buf ) ; } } finally { if ( close ) { out . close ( ) ; in . close ( ) ; } }
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 * @ throws IOException */ public static TvListing parse ( InputStream inputStream ) throws IOException { } }
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 . readLine ( ) ) != null ) { if ( line . startsWith ( "#EXTINF:" ) ) { // # EXTINF : 0051 tvg - id = " blizz . de " group - title = " DE Spartensender " tvg - logo = " 897815 . png " , [ COLOR orangered ] blizz TV HD [ / COLOR ] String id = null ; String displayName = null ; String displayNumber = null ; int originalNetworkId = 0 ; String icon = null ; String [ ] parts = line . split ( "," , 2 ) ; if ( parts . length == 2 ) { for ( String part : parts [ 0 ] . split ( " " ) ) { if ( part . startsWith ( "#EXTINF:" ) ) { // Log . d ( TAG , " Part : " + part ) ; displayNumber = part . substring ( 8 ) . replaceAll ( "^0+" , "" ) ; // Log . d ( TAG , " Display Number : " + displayNumber ) ; if ( displayNumber . isEmpty ( ) ) displayNumber = defaultDisplayNumber + "" ; if ( displayNumber . equals ( "-1" ) ) displayNumber = defaultDisplayNumber + "" ; defaultDisplayNumber ++ ; originalNetworkId = Integer . parseInt ( displayNumber ) ; } else if ( part . startsWith ( "tvg-id=" ) ) { int end = part . indexOf ( "\"" , 8 ) ; if ( end > 8 ) { id = part . substring ( 8 , end ) ; } } else if ( part . startsWith ( "tvg-logo=" ) ) { int end = part . indexOf ( "\"" , 10 ) ; if ( end > 10 ) { icon = part . substring ( 10 , end ) ; } } } displayName = parts [ 1 ] . replaceAll ( "\\[\\/?(COLOR |)[^\\]]*\\]" , "" ) ; } if ( originalNetworkId != 0 && displayName != null ) { Channel channel = new Channel ( ) . setChannelId ( Integer . parseInt ( id ) ) . setName ( displayName ) . setNumber ( displayNumber ) . setLogoUrl ( icon ) . setOriginalNetworkId ( originalNetworkId ) ; if ( channelMap . containsKey ( originalNetworkId ) ) { int freeChannel = 1 ; while ( channelMap . containsKey ( new Integer ( freeChannel ) ) ) { freeChannel ++ ; } channelMap . put ( freeChannel , channels . size ( ) ) ; channel . setNumber ( freeChannel + "" ) ; channels . add ( channel ) ; } else { channelMap . put ( originalNetworkId , channels . size ( ) ) ; channels . add ( channel ) ; } } else { Log . d ( TAG , "Import failed: " + originalNetworkId + "= " + line ) ; } } else if ( line . startsWith ( "http" ) && channels . size ( ) > 0 ) { channels . get ( channels . size ( ) - 1 ) . setInternalProviderData ( line ) ; } else if ( line . startsWith ( "rtmp" ) && channels . size ( ) > 0 ) { channels . get ( channels . size ( ) - 1 ) . setInternalProviderData ( line ) ; } } TvListing tvl = new TvListing ( channels , programs ) ; Log . d ( TAG , "Done parsing" ) ; Log . d ( TAG , tvl . toString ( ) ) ; return new TvListing ( channels , programs ) ;
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 ( ) ) ) . collect ( Collectors . toSet ( ) ) ; Set < String > bodyNames = controllers . stream ( ) . flatMap ( resourceMetadata -> resourceMetadata . getDependencies ( ) . stream ( ) ) . map ( ApiBodyMetadata :: getName ) . collect ( Collectors . toSet ( ) ) ; bodyNames . addAll ( parametersNames ) ; return bodyNames ;
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 " + resolvers [ i ] . getClass ( ) . getName ( ) ) ; } parameters [ i ] = resolvers [ i ] . resolve ( inv , paramMetaDatas [ i ] ) ; // afterPropertiesSet if ( parameters [ i ] instanceof InitializingBean ) { ( ( InitializingBean ) parameters [ i ] ) . afterPropertiesSet ( ) ; } if ( parameters [ i ] == null ) { DefValue defValudeAnnotation = paramMetaDatas [ i ] . getAnnotation ( DefValue . class ) ; if ( defValudeAnnotation != null && paramMetaDatas [ i ] . getParamType ( ) == String . class ) { parameters [ i ] = defValudeAnnotation . value ( ) ; } } } catch ( TypeMismatchException e ) { // 出现这个错误肯定是解析一般参数失败导致的 , 而非bean里面的某个属性值的解析失败 logger . debug ( "" , e ) ; // 对简单类型的参数 , 设置一个默认值给它以支持对该方法的继续调用 if ( paramMetaDatas [ i ] . getParamType ( ) . isPrimitive ( ) ) { DefValue defValudeAnnotation = paramMetaDatas [ i ] . getAnnotation ( DefValue . class ) ; if ( defValudeAnnotation == null || DefValue . NATIVE_DEFAULT . equals ( defValudeAnnotation . value ( ) ) ) { // 对这最常用的类型做一下if - else判断 , 其他类型就简单使用converter来做吧 if ( paramMetaDatas [ i ] . getParamType ( ) == int . class ) { parameters [ i ] = Integer . valueOf ( 0 ) ; } else if ( paramMetaDatas [ i ] . getParamType ( ) == long . class ) { parameters [ i ] = Long . valueOf ( 0 ) ; } else if ( paramMetaDatas [ i ] . getParamType ( ) == boolean . class ) { parameters [ i ] = Boolean . FALSE ; } else if ( paramMetaDatas [ i ] . getParamType ( ) == double . class ) { parameters [ i ] = Double . valueOf ( 0 ) ; } else if ( paramMetaDatas [ i ] . getParamType ( ) == float . class ) { parameters [ i ] = Float . valueOf ( 0 ) ; } else { TypeConverter typeConverter = SafedTypeConverterFactory . getCurrentConverter ( ) ; parameters [ i ] = typeConverter . convertIfNecessary ( "0" , paramMetaDatas [ i ] . getParamType ( ) ) ; } } else { TypeConverter typeConverter = SafedTypeConverterFactory . getCurrentConverter ( ) ; parameters [ i ] = typeConverter . convertIfNecessary ( defValudeAnnotation . value ( ) , paramMetaDatas [ i ] . getParamType ( ) ) ; } } String paramName = parameterNames [ i ] ; if ( paramName == null ) { for ( String name : paramMetaDatas [ i ] . getParamNames ( ) ) { if ( ( paramName = name ) != null ) { break ; } } } Assert . isTrue ( paramName != null ) ; FieldError fieldError = new FieldError ( "method" , // 该出错字段所在的对象的名字 ; 对于这类异常我们统一规定名字为method paramName , // 出错的字段的名字 ; 取其参数名 inv . getParameter ( paramName ) , // 被拒绝的值 true , // whether this error represents a binding failure ( like a type mismatch ) ; else , it is a validation failure new String [ ] { e . getErrorCode ( ) } , // " typeMismatch " new String [ ] { inv . getParameter ( paramName ) } , // the array of arguments to be used to resolve this message null // the default message to be used to resolve this message ) ; parameterBindingResult . addError ( fieldError ) ; } catch ( Exception e ) { // 什么错误呢 ? 比如很有可能是构造对象不能成功导致的错误 , 没有默认构造函数 、 构造函数执行失败等等 logger . error ( "" , e ) ; throw e ; } } return parameters ;
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 ( int value ) { } }
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 (" + value + ')' ;
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 * OLAP browser command . */ public String browseOlapp ( Tenant tenant , Map < String , String > parameters ) { } }
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 handle escaped * characters . */ public static String patternToRegex ( String pattern ) { } }
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 . append ( c ) ; } else { if ( c == SEARCH_STRING_ESCAPE ) { escaped = true ; continue ; } else if ( c == '%' ) { result . append ( ".*" ) ; } else if ( c == '_' ) { result . append ( '.' ) ; } else { result . append ( Character . toLowerCase ( c ) ) ; } } } return result . toString ( ) ; }
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 Comparator < ? super MonetaryAmount > sortValuableDesc ( final ExchangeRateProvider provider ) { } }
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 ( ) ; // If the upload is done so fast that we did not receive any progress information , then // the content length is unknown . For that reason take the request size to show how // much bytes were uploaded . double size = jsonObject . get ( I_CmsUploadConstants . KEY_REQUEST_SIZE ) . isNumber ( ) . doubleValue ( ) ; long requestSize = new Double ( size ) . longValue ( ) ; if ( m_contentLength == 0 ) { m_contentLength = requestSize ; } if ( success ) { m_uploadedFiles = new ArrayList < String > ( ) ; List < String > uploadedFileIds = new ArrayList < String > ( ) ; displayDialogInfo ( org . opencms . gwt . client . Messages . get ( ) . key ( org . opencms . gwt . client . Messages . GUI_UPLOAD_INFO_FINISHING_0 ) , false ) ; JSONValue uploadedFilesVal = jsonObject . get ( I_CmsUploadConstants . KEY_UPLOADED_FILE_NAMES ) ; JSONValue uploadHook = jsonObject . get ( I_CmsUploadConstants . KEY_UPLOAD_HOOK ) ; String hookUri = null ; if ( ( uploadHook != null ) && ( uploadHook . isString ( ) != null ) ) { hookUri = uploadHook . isString ( ) . stringValue ( ) ; JSONValue uploadedFileIdsVal = jsonObject . get ( I_CmsUploadConstants . KEY_UPLOADED_FILES ) ; JSONArray uploadedFileIdsArray = uploadedFileIdsVal . isArray ( ) ; if ( uploadedFileIdsArray != null ) { for ( int i = 0 ; i < uploadedFileIdsArray . size ( ) ; i ++ ) { JSONString entry = uploadedFileIdsArray . get ( i ) . isString ( ) ; if ( entry != null ) { uploadedFileIds . add ( entry . stringValue ( ) ) ; } } } } JSONArray uploadedFilesArray = uploadedFilesVal . isArray ( ) ; if ( uploadedFilesArray != null ) { for ( int i = 0 ; i < uploadedFilesArray . size ( ) ; i ++ ) { JSONString entry = uploadedFilesArray . get ( i ) . isString ( ) ; if ( entry != null ) { m_uploadedFiles . add ( entry . stringValue ( ) ) ; } } } m_progressInfo . finish ( ) ; final I_CmsUploadContext context = m_context ; closeOnSuccess ( ) ; if ( hookUri != null ) { // Set the context to be null so that it isn ' t called when the upload dialog closed ; // we want it to be called when the upload property dialog is closed instead . < p > m_context = null ; CloseHandler < PopupPanel > closeHandler ; closeHandler = new CloseHandler < PopupPanel > ( ) { public void onClose ( CloseEvent < PopupPanel > event ) { if ( context != null ) { context . onUploadFinished ( m_uploadedFiles ) ; } } } ; String title = Messages . get ( ) . key ( Messages . GUI_UPLOAD_HOOK_DIALOG_TITLE_0 ) ; CmsUploadHookDialog . openDialog ( title , hookUri , uploadedFileIds , closeHandler ) ; } } else { String message = jsonObject . get ( I_CmsUploadConstants . KEY_MESSAGE ) . isString ( ) . stringValue ( ) ; String stacktrace = jsonObject . get ( I_CmsUploadConstants . KEY_STACKTRACE ) . isString ( ) . stringValue ( ) ; showErrorReport ( message , stacktrace ) ; } }
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 ClassNotFoundException ex ) { throw new RuntimeException ( LocalizationMessages . ERROR_SCANNING_CLASS_NOT_FOUND ( className ) , ex ) ; } catch ( final PrivilegedActionException pae ) { final Throwable cause = pae . getCause ( ) ; if ( cause instanceof ClassNotFoundException ) { throw new RuntimeException ( LocalizationMessages . ERROR_SCANNING_CLASS_NOT_FOUND ( className ) , cause ) ; } else if ( cause instanceof RuntimeException ) { throw ( RuntimeException ) cause ; } else { throw new RuntimeException ( cause ) ; } }
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 ( final Class < ? > type , final ProxyTargetLocator locator ) { } }
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 ( proxy ) ; if ( proxy instanceof ReleasableProxyTarget ) { // This is not so nice . . . but with a primitive this should ' nt matter at all . . . ( ( ReleasableProxyTarget ) proxy ) . releaseTarget ( ) ; } return realTarget ; } else if ( type . isInterface ( ) ) { JdkHandler handler = new JdkHandler ( type , locator ) ; try { return Proxy . newProxyInstance ( Thread . currentThread ( ) . getContextClassLoader ( ) , new Class [ ] { type , Serializable . class , ILazyInitProxy . class , IWriteReplace . class } , handler ) ; } catch ( IllegalArgumentException e ) { // While in the original Wicket Environment this is a failure of the context - classloader in PAX - WICKET // this is always an error of missing imports into the classloader . Right now we can do nothing here but // inform the user about the problem and throw an IllegalStateException instead wrapping up and // presenting the real problem . throw new IllegalStateException ( "The real problem is that the used wrapper classes are not imported " + "by the bundle using injection" , e ) ; } } else { CGLibInterceptor handler = new CGLibInterceptor ( type , locator ) ; Enhancer e = new Enhancer ( ) ; e . setInterfaces ( new Class [ ] { Serializable . class , ILazyInitProxy . class , IWriteReplace . class } ) ; e . setSuperclass ( type ) ; e . setCallback ( handler ) ; // e . setClassLoader ( LazyInitProxyFactory . class . getClassLoader ( ) ) ; e . setNamingPolicy ( new DefaultNamingPolicy ( ) { @ Override public String getClassName ( final String prefix , final String source , final Object key , final Predicate names ) { return super . getClassName ( "WICKET_" + prefix , source , key , names ) ; } } ) ; return e . create ( ) ; }
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 = " Generated Code " > / / GEN - BEGIN : initComponents private void initComponents ( ) { } }
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 ( ) ; jTextField4 = new javax . swing . JTextField ( ) ; jCalendarButton1 = new JCalendarButton ( ) ; jTimeButton1 = new JTimeButton ( ) ; jCalendarButton2 = new JCalendarButton ( ) ; jTimeButton2 = new JTimeButton ( ) ; setDefaultCloseOperation ( javax . swing . WindowConstants . EXIT_ON_CLOSE ) ; jLabel1 . setText ( "Name:" ) ; jLabel2 . setText ( "Date:" ) ; jTextField2 . addFocusListener ( new java . awt . event . FocusAdapter ( ) { public void focusLost ( java . awt . event . FocusEvent evt ) { dateFocusLost ( evt ) ; } } ) ; jLabel3 . setText ( "Time:" ) ; jTextField3 . addFocusListener ( new java . awt . event . FocusAdapter ( ) { public void focusLost ( java . awt . event . FocusEvent evt ) { timeFocusLost ( evt ) ; } } ) ; jLabel4 . setText ( "Date and Time:" ) ; jTextField4 . addFocusListener ( new java . awt . event . FocusAdapter ( ) { public void focusLost ( java . awt . event . FocusEvent evt ) { dateTimeFocusLost ( evt ) ; } } ) ; jCalendarButton1 . addPropertyChangeListener ( new java . beans . PropertyChangeListener ( ) { public void propertyChange ( java . beans . PropertyChangeEvent evt ) { dateOnlyPopupChanged ( evt ) ; } } ) ; jTimeButton1 . addPropertyChangeListener ( new java . beans . PropertyChangeListener ( ) { public void propertyChange ( java . beans . PropertyChangeEvent evt ) { timeOnlyPopupChanged ( evt ) ; } } ) ; jCalendarButton2 . addPropertyChangeListener ( new java . beans . PropertyChangeListener ( ) { public void propertyChange ( java . beans . PropertyChangeEvent evt ) { datePopupChanged ( evt ) ; } } ) ; jTimeButton2 . addPropertyChangeListener ( new java . beans . PropertyChangeListener ( ) { public void propertyChange ( java . beans . PropertyChangeEvent evt ) { timePopupChanged ( evt ) ; } } ) ; javax . swing . GroupLayout layout = new javax . swing . GroupLayout ( getContentPane ( ) ) ; getContentPane ( ) . setLayout ( layout ) ; layout . setHorizontalGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING ) . addGroup ( layout . createSequentialGroup ( ) . addGap ( 26 , 26 , 26 ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING ) . addComponent ( jLabel2 ) . addComponent ( jLabel1 ) . addComponent ( jLabel3 ) . addComponent ( jLabel4 ) ) . addGap ( 107 , 107 , 107 ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING , false ) . addComponent ( jTextField1 , javax . swing . GroupLayout . DEFAULT_SIZE , 226 , Short . MAX_VALUE ) . addComponent ( jTextField4 ) . addComponent ( jTextField3 ) . addComponent ( jTextField2 , javax . swing . GroupLayout . DEFAULT_SIZE , 130 , Short . MAX_VALUE ) ) . addPreferredGap ( javax . swing . LayoutStyle . ComponentPlacement . RELATED ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING ) . addComponent ( jCalendarButton1 , javax . swing . GroupLayout . PREFERRED_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . PREFERRED_SIZE ) . addComponent ( jTimeButton1 , javax . swing . GroupLayout . PREFERRED_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . PREFERRED_SIZE ) . addGroup ( layout . createSequentialGroup ( ) . addComponent ( jCalendarButton2 , javax . swing . GroupLayout . PREFERRED_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . PREFERRED_SIZE ) . addPreferredGap ( javax . swing . LayoutStyle . ComponentPlacement . RELATED ) . addComponent ( jTimeButton2 , javax . swing . GroupLayout . PREFERRED_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . PREFERRED_SIZE ) ) ) . addContainerGap ( javax . swing . GroupLayout . DEFAULT_SIZE , Short . MAX_VALUE ) ) ) ; layout . setVerticalGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING ) . addGroup ( layout . createSequentialGroup ( ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING ) . addGroup ( layout . createSequentialGroup ( ) . addGap ( 33 , 33 , 33 ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . BASELINE ) . addComponent ( jLabel1 ) . addComponent ( jTextField1 , javax . swing . GroupLayout . PREFERRED_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . PREFERRED_SIZE ) ) . addPreferredGap ( javax . swing . LayoutStyle . ComponentPlacement . RELATED ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . BASELINE ) . addComponent ( jLabel2 ) . addComponent ( jTextField2 , javax . swing . GroupLayout . PREFERRED_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . PREFERRED_SIZE ) ) . addPreferredGap ( javax . swing . LayoutStyle . ComponentPlacement . RELATED ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . BASELINE ) . addComponent ( jLabel3 ) . addComponent ( jTextField3 , javax . swing . GroupLayout . PREFERRED_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . PREFERRED_SIZE ) . addComponent ( jTimeButton1 , javax . swing . GroupLayout . PREFERRED_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . PREFERRED_SIZE ) ) . addPreferredGap ( javax . swing . LayoutStyle . ComponentPlacement . RELATED ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . BASELINE ) . addComponent ( jLabel4 ) . addComponent ( jTextField4 , javax . swing . GroupLayout . PREFERRED_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . PREFERRED_SIZE ) . addComponent ( jCalendarButton2 , javax . swing . GroupLayout . PREFERRED_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . PREFERRED_SIZE ) ) ) . addGroup ( layout . createSequentialGroup ( ) . addGap ( 60 , 60 , 60 ) . addComponent ( jCalendarButton1 , javax . swing . GroupLayout . PREFERRED_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . PREFERRED_SIZE ) . addGap ( 30 , 30 , 30 ) . addComponent ( jTimeButton2 , javax . swing . GroupLayout . PREFERRED_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . PREFERRED_SIZE ) ) ) . addContainerGap ( 53 , Short . MAX_VALUE ) ) ) ; pack ( ) ;
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 < code > false < / code > . = * @ since 0.7 * @ see # containsPackedBootstrap ( File ) */ public static boolean containsUnpackedBootstrap ( File directory ) { } }
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 FileInputStream ( serviceFile ) ) { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( is ) ) ) { String line = reader . readLine ( ) ; if ( line != null ) { line = line . trim ( ) ; if ( ! line . isEmpty ( ) ) { return true ; } } } } catch ( Throwable exception ) { } } return false ;
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 ( ) . getDimensionPixelSize ( R . dimen . bottom_sheet_grid_padding_top ) ; rootView . setPadding ( 0 , paddingTop , 0 , 0 ) ; } }
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 = oldpos ; return tree ;
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 encoding to use when interpreting the characters * in the InputStream . * @ return A JSON Object . * @ throws JsonParseException * If there was a JSON related error during parsing . * @ throws IOException * If there was an IO error during parsing . */ public static Object fromInputStream ( InputStream input , Charset enc ) throws IOException { } }
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 header with the Input Index , then add a new index with this header and value . so known header - index , but new header - index - value pair that can * be referenced later as INDEXED . * Literal Header Field without Indexing - - Indexed Name * 0 1 2 3 4 5 6 7 * | 0 | 0 | 0 | 0 | Index ( 4 + ) | * | H | Value Length ( 7 + ) | * | Value String ( Length octets ) | * Literal Header Field Never Indexed - Indexed Name * 0 1 2 3 4 5 6 7 * | 0 | 0 | 0 | 1 | Index ( 4 + ) | * | H | Value Length ( 7 + ) | * | Value String ( Length octets ) | * Literal Header Field with Incremental Indexing - - New Name * 0 1 2 3 4 5 6 7 * | 0 | 1 | 0 | * | H | Name Length ( 7 + ) | * | Name String ( Length octets ) | * | H | Value Length ( 7 + ) | * | Value String ( Length octets ) | * Literal Header Field without Indexing - - New Name * 0 1 2 3 4 5 6 7 * | 0 | 0 | 0 | 0 | 0 | * | H | Name Length ( 7 + ) | * | Name String ( Length octets ) | * | H | Value Length ( 7 + ) | * | Value String ( Length octets ) | * Literal Header Field Never Indexed - - New Name * 0 1 2 3 4 5 6 7 * | 0 | 0 | 0 | 1 | 0 | * | H | Name Length ( 7 + ) | * | Name String ( Length octets ) | * | H | Value Length ( 7 + ) | * | Value String ( Length octets ) | */ public byte [ ] buildHeader ( HeaderFieldType xIndexingType , String xHeaderName , String xHeaderValue , long xHeaderIndex ) { } }
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 static table retArray = new byte [ 1 ] ; retArray [ 0 ] = ( byte ) ( 0x80 | headerStaticIndex ) ; } else { // user passed in the headerIndex that we are to use retArray = enc . encode ( xHeaderIndex , 7 ) ; retArray [ 0 ] = ( byte ) ( 0x80 | retArray [ 0 ] ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Indexed header built array: " + utils . printArray ( retArray ) ) ; } return retArray ; } if ( ( xIndexingType == HeaderFieldType . LITERAL_INCREMENTAL_INDEXING ) || ( xIndexingType == HeaderFieldType . LITERAL_NEVER_INDEXED_INDEXED_NAME ) || ( xIndexingType == HeaderFieldType . LITERAL_WITHOUT_INDEXING_AND_INDEXED_NAME ) ) { byte [ ] idxArray = null ; if ( xHeaderName != null ) { headerStaticIndex = utils . getIndexNumber ( xHeaderName ) ; } // user passed in the headerIndex that we are to use if ( xIndexingType == HeaderFieldType . LITERAL_INCREMENTAL_INDEXING ) { idxArray = enc . encode ( headerStaticIndex , 6 ) ; // set first two bits to " 01" idxArray [ 0 ] = ( byte ) ( 0x40 | idxArray [ 0 ] ) ; idxArray [ 0 ] = ( byte ) ( 0x7F & idxArray [ 0 ] ) ; } else if ( xIndexingType == HeaderFieldType . LITERAL_NEVER_INDEXED_INDEXED_NAME ) { idxArray = enc . encode ( headerStaticIndex , 4 ) ; // set first four bits to " 0001" idxArray [ 0 ] = ( byte ) ( 0x10 | idxArray [ 0 ] ) ; idxArray [ 0 ] = ( byte ) ( 0x1F & idxArray [ 0 ] ) ; } else if ( ( xIndexingType == HeaderFieldType . LITERAL_WITHOUT_INDEXING_AND_INDEXED_NAME ) ) { idxArray = enc . encode ( headerStaticIndex , 4 ) ; // set first four bits to " 0000" idxArray [ 0 ] = ( byte ) ( 0x0F & idxArray [ 0 ] ) ; } byte [ ] ba = xHeaderValue . getBytes ( ) ; // may need to deal with string encoding later byte [ ] hArrayValue = HuffmanEncoder . convertAsciiToHuffman ( ba ) ; byte [ ] hArrayLength = enc . encode ( hArrayValue . length , 7 ) ; hArrayLength [ 0 ] = ( byte ) ( 0x80 | hArrayLength [ 0 ] ) ; int totalLength = idxArray . length + hArrayLength . length + hArrayValue . length ; retArray = new byte [ totalLength ] ; System . arraycopy ( idxArray , 0 , retArray , 0 , idxArray . length ) ; System . arraycopy ( hArrayLength , 0 , retArray , idxArray . length , hArrayLength . length ) ; System . arraycopy ( hArrayValue , 0 , retArray , idxArray . length + hArrayLength . length , hArrayValue . length ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Literal Header Field with Incremental Indexing built array: " + utils . printArray ( retArray ) ) ; } return retArray ; } if ( ( xIndexingType == HeaderFieldType . LITERAL_WITHOUT_INDEXING_AND_NEW_NAME ) || ( xIndexingType == HeaderFieldType . LITERAL_NEVER_INDEXED_NEW_NAME ) || ( xIndexingType == HeaderFieldType . LITERAL_INCREMENTAL_INDEXING_NEW_NAME ) ) { byte [ ] ba = xHeaderName . getBytes ( ) ; // may need to deal with string encoding later byte [ ] hName = HuffmanEncoder . convertAsciiToHuffman ( ba ) ; byte [ ] hNameLength = enc . encode ( hName . length , 7 ) ; hNameLength [ 0 ] = ( byte ) ( 0x80 | hNameLength [ 0 ] ) ; ba = xHeaderValue . getBytes ( ) ; // may need to deal with string encoding later byte [ ] hValue = HuffmanEncoder . convertAsciiToHuffman ( ba ) ; byte [ ] hValueLength = enc . encode ( hValue . length , 7 ) ; hValueLength [ 0 ] = ( byte ) ( 0x80 | hValueLength [ 0 ] ) ; int totalLength = 1 + hNameLength . length + hName . length + hValueLength . length + hValue . length ; retArray = new byte [ totalLength ] ; if ( xIndexingType == HeaderFieldType . LITERAL_WITHOUT_INDEXING_AND_NEW_NAME ) { retArray [ 0 ] = 0x00 ; } else if ( xIndexingType == HeaderFieldType . LITERAL_NEVER_INDEXED_NEW_NAME ) { retArray [ 0 ] = 0x10 ; } else if ( xIndexingType == HeaderFieldType . LITERAL_INCREMENTAL_INDEXING_NEW_NAME ) { retArray [ 0 ] = 0x40 ; } System . arraycopy ( hNameLength , 0 , retArray , 1 , hNameLength . length ) ; System . arraycopy ( hName , 0 , retArray , 1 + hNameLength . length , hName . length ) ; System . arraycopy ( hValueLength , 0 , retArray , 1 + hNameLength . length + hName . length , hValueLength . length ) ; System . arraycopy ( hValue , 0 , retArray , 1 + hNameLength . length + hName . length + hValueLength . length , hValue . length ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Literal Header Field without Indexing - new Name built array: " + utils . printArray ( retArray ) ) ; } return retArray ; } return null ;
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 ( XMLOutput out ) throws JellyTagException { } }
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 needed to do the bind call via jQuery // So to be on the safe side we include json2 . js . See https : / / github . com / douglascrockford / JSON - js include ( out , "org.kohsuke.stapler.json2" ) ; } else { // supply a missing dependency ( if we can ) include ( out , "org.kohsuke.stapler.framework.prototype.prototype" ) ; }
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 } . * @ return This instance for chaining . * @ see # setDefault ( AccessPredicate ) */ public ManualGrpcSecurityMetadataSource set ( final ServiceDescriptor service , final AccessPredicate predicate ) { } }
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 overridden and have different cost functions * inserted easily . */ public static void computeScoreRowSad ( GrayF32 left , GrayF32 right , int elementMax , int indexLeft , int indexRight , float elementScore [ ] ) { } }
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 ; * Matches . POSSIBLY if char sequence matches prefix of an emoji * & lt ; / li & gt ; * & lt ; li & gt ; * Matches . IMPOSSIBLE if char sequence matches no emoji or prefix of an * emoji * & lt ; / li & gt ; */ public Matches isEmoji ( char [ ] sequence ) { } }
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 . currBlkIdx = 0 ; this . currRecIdx = 0 ; }
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 ( jcrService_ . getCurrentRepository ( ) , groupId ) ;
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 ( clusterMutex ) ; try { entityManager . flush ( ) ; logger . trace ( "Created {}" , clusterMutex ) ; } catch ( PersistenceException e ) { if ( e . getCause ( ) instanceof ConstraintViolationException ) { // ignore , another thread beat us to creation logger . debug ( "Failed to create mutex, it was likely created concurrently by another thread: " + clusterMutex , e ) ; return ; } // re - throw exception with unhandled cause throw e ; } } } ) ;
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 ( ) . getVerticalLineVerticalLineKeyword ( ) ) ; } match ( input , 14 , FOLLOW_2 ) ; if ( state . failed ) return ; if ( state . backtracking == 0 ) { after ( grammarAccess . getOpOrAccess ( ) . getVerticalLineVerticalLineKeyword ( ) ) ; } } } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { restoreStackSize ( stackSize ) ; } return ;
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 d ;
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 NaN , or { @ code x } is * infinite */ @ SuppressWarnings ( "fallthrough" ) public static int log2 ( double x , RoundingMode mode ) { } }
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 ( mode ) { case UNNECESSARY : checkRoundingUnnecessary ( isPowerOfTwo ( x ) ) ; // fall through case FLOOR : increment = false ; break ; case CEILING : increment = ! isPowerOfTwo ( x ) ; break ; case DOWN : increment = exponent < 0 & ! isPowerOfTwo ( x ) ; break ; case UP : increment = exponent >= 0 & ! isPowerOfTwo ( x ) ; break ; case HALF_DOWN : case HALF_EVEN : case HALF_UP : double xScaled = scaleNormalize ( x ) ; // sqrt ( 2 ) is irrational , and the spec is relative to the " exact numerical result , " // so log2 ( x ) is never exactly exponent + 0.5. increment = ( xScaled * xScaled ) > 2.0 ; break ; default : throw new AssertionError ( ) ; } return increment ? exponent + 1 : exponent ;
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 setDateLastModifiedHeader ( HttpServletResponse res , long dateLastModified ) { } }
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 . setDateHeader ( CmsRequestUtil . HEADER_LAST_MODIFIED , System . currentTimeMillis ( ) ) ; // avoiding issues with IE8 + res . addHeader ( CmsRequestUtil . HEADER_CACHE_CONTROL , "public, max-age=0" ) ; }
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 string enum instance */ @ SuppressWarnings ( "unchecked" ) protected static < T extends ExpandableStringEnum < T > > T fromString ( String name , Class < T > clazz ) { } }
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 | IllegalAccessException e ) { return null ; }
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 sibAuthenticationService ;
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 , applet ) ; // Start the session for this user } m_application . addTask ( this , null ) ; // Add this session to the list m_recordOwnerCollection = new RecordOwnerCollection ( this ) ; try { // Add browser connection if running as an applet Class . forName ( "netscape.javascript.JSObject" ) ; // Test if this exists Map < String , Object > mapInitialCommand = new HashMap < String , Object > ( ) ; String strInitialCommand = this . getInitialCommand ( true ) ; if ( ( strInitialCommand != null ) && ( strInitialCommand . length ( ) > 0 ) ) Util . parseArgs ( mapInitialCommand , strInitialCommand ) ; BrowserManager bm = new BrowserManager ( this , mapInitialCommand ) ; // This will throw an exception if there is a no browser this . setBrowserManager ( bm ) ; } catch ( Exception ex ) { // Ignore if no browser } if ( m_application . getProperty ( "hash" ) != null ) { // Special case - html hash params get added ( and override ) initial params Map < String , Object > properties = this . getProperties ( ) ; if ( properties == null ) properties = new Hashtable < String , Object > ( ) ; Util . parseArgs ( properties , m_application . getProperty ( "hash" ) ) ; this . setProperties ( properties ) ; } m_parent = this . addBackground ( this ) ; this . addSubPanels ( m_parent , Constants . DONT_PUSH_TO_BROWSER ) ; // Add any sub - panels now this . setupLookAndFeel ( null ) ; if ( this . getBrowserManager ( ) != null ) if ( ( this . getClass ( ) . getName ( ) . indexOf ( ".thin." ) != - 1 ) || ( this . getClass ( ) . getName ( ) . indexOf ( ".Thin" ) != - 1 ) ) this . repaint ( ) ; // HACK - On thin if this is in an applet window , the paint sequence displays the overlays backward
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 * - AuthorizationException : if there is any problem with the REST API authorization ( access token ) * - ResourceNotFoundException : if the resource can not be found * - ServiceUnavailableException : if the REST API service is not available ( possibly due to rate limiting ) * - SmartsheetRestException : if there is any other REST API related error occurred during the operation * - SmartsheetException : if there is any other error occurred during the operation * @ param sheetId the sheet id * @ param rows the list of rows to create * @ return the created rows * @ throws SmartsheetException the smartsheet exception */ public List < Row > addRows ( long sheetId , List < Row > rows ) throws SmartsheetException { } }
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 DateTimeFormatterBuilder appendShortText ( DateTimeFieldType fieldType ) { } }
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 preserved . * @ param node to be added to the { @ link FlowGraph } * @ return true if node is successfully added to the { @ link FlowGraph } . */ @ Override public boolean addDataNode ( DataNode node ) { } }
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 ( ) . unlock ( ) ; } return true ;
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: {}" , formatAddress ( bestMacAddr ) ) ; } return bestMacAddr ;
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 ) ; } } ; _threadLocal . set ( pool ) ; } return pool ;
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 ( @ NonNull final PreviewShape previewShape ) { } }
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 edbService , EDBConverter edbConverter ) { } }
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 ( pathProperties ) ; Requests . setProperty ( PATH_PROPS_PARSED , properties ) ; } } else if ( properties . equals ( false ) ) { return null ; } return ( FetchPath ) properties ;
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 . server error or cannot deserialize the response body */ public ApiResponse < TaskEnvelope > getTaskByIDWithHttpInfo ( String tid ) throws ApiException { } }
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 . exit ( tc , "getTransmitMessageRequestIterator" , aoStreamIterator ) ; return aoStreamIterator ;
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 , because every lat / lon pair can be encoded . * The list is ordered in such a way that the last result is the international code . However , you cannot assume * that the first result is the shortest mapcode . If you want to use the shortest mapcode , use * { @ link # encodeToShortest ( double , double , Territory ) } . * The international code can be obtained from the list by using : " results . get ( results . size ( ) - 1 ) " , or * you can use { @ link # encodeToInternational ( double , double ) } , which is faster . * @ param latDeg Latitude , accepted range : - 90 . . 90. * @ param lonDeg Longitude , accepted range : - 180 . . 180. * @ return Non - empty , ordered list of mapcode information records , see { @ link Mapcode } . * @ throws IllegalArgumentException Thrown if latitude or longitude are out of range . */ @ Nonnull public static List < Mapcode > encode ( final double latDeg , final double lonDeg ) throws IllegalArgumentException { } }
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 . isDebugEnabled ( ) ) { log . debug ( "ALIAS abs=" + abs ) ; log . debug ( "ALIAS can=" + can ) ; } } catch ( Exception e ) { log . warn ( LogSupport . EXCEPTION , e ) ; return getURL ( ) ; } } return _alias ;
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 will set the current scene as the provided scene . If the provided * scene is same the currently set scene then this method will have no effect . Passing null * will remove any objects that are selectable and set the scene to null * @ param scene the { @ link GVRScene } to be made selectable or < code > null < / code > . */ public void makeSceneSelectable ( GVRScene scene ) { } }
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 object : scene . getSceneObjects ( ) ) { addSelectableObject ( object ) ; } // true to add updateCursorsInScene ( scene , true ) ;
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 mask region */ public void copyBits ( BufferedImage pSrcBitmap , Rectangle pSrcRect , Rectangle pDstRect , int pMode , Shape pMaskRgn ) { } }
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 . y + pSrcRect . height , null ) ; setClipRegion ( null ) ;
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 partner from the other input exists are joined with null . * The output of the < code > join ( ) < / code > method is forwarded . * @ throws Exception Forwards all exceptions from the user code and the I / O system . * @ see org . apache . flink . runtime . operators . util . JoinTaskIterator # callWithNextKey ( org . apache . flink . api . common . functions . FlatJoinFunction , org . apache . flink . util . Collector ) */ @ Override public boolean callWithNextKey ( final FlatJoinFunction < T1 , T2 , O > joinFunction , final Collector < O > collector ) throws Exception { } }
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 == OuterJoinType . FULL ) { joinLeftKeyValuesWithNull ( iterator1 . getValues ( ) , joinFunction , collector ) ; it1Empty = ! iterator1 . nextKey ( ) ; return true ; } else { // consume rest of left side while ( iterator1 . nextKey ( ) ) { } it1Empty = true ; return false ; } } else if ( it1Empty ) { if ( outerJoinType == OuterJoinType . RIGHT || outerJoinType == OuterJoinType . FULL ) { joinRightKeyValuesWithNull ( iterator2 . getValues ( ) , joinFunction , collector ) ; it2Empty = ! iterator2 . nextKey ( ) ; return true ; } else { // consume rest of right side while ( iterator2 . nextKey ( ) ) { } it2Empty = true ; return false ; } } else { final TypePairComparator < T1 , T2 > comparator = super . pairComparator ; comparator . setReference ( this . iterator1 . getCurrent ( ) ) ; T2 current2 = this . iterator2 . getCurrent ( ) ; // zig zag while ( true ) { // determine the relation between the ( possibly composite ) keys final int comp = comparator . compareToReference ( current2 ) ; if ( comp == 0 ) { break ; } if ( comp < 0 ) { // right key < left key if ( outerJoinType == OuterJoinType . RIGHT || outerJoinType == OuterJoinType . FULL ) { // join right key values with null in case of right or full outer join joinRightKeyValuesWithNull ( iterator2 . getValues ( ) , joinFunction , collector ) ; it2Empty = ! iterator2 . nextKey ( ) ; return true ; } else { // skip this right key if it is a left outer join if ( ! this . iterator2 . nextKey ( ) ) { // if right side is empty , join current left key values with null joinLeftKeyValuesWithNull ( iterator1 . getValues ( ) , joinFunction , collector ) ; it1Empty = ! iterator1 . nextKey ( ) ; it2Empty = true ; return true ; } current2 = this . iterator2 . getCurrent ( ) ; } } else { // right key > left key if ( outerJoinType == OuterJoinType . LEFT || outerJoinType == OuterJoinType . FULL ) { // join left key values with null in case of left or full outer join joinLeftKeyValuesWithNull ( iterator1 . getValues ( ) , joinFunction , collector ) ; it1Empty = ! iterator1 . nextKey ( ) ; return true ; } else { // skip this left key if it is a right outer join if ( ! this . iterator1 . nextKey ( ) ) { // if right side is empty , join current right key values with null joinRightKeyValuesWithNull ( iterator2 . getValues ( ) , joinFunction , collector ) ; it1Empty = true ; it2Empty = ! iterator2 . nextKey ( ) ; return true ; } comparator . setReference ( this . iterator1 . getCurrent ( ) ) ; } } } // here , we have a common key ! call the join function with the cross product of the // values final Iterator < T1 > values1 = this . iterator1 . getValues ( ) ; final Iterator < T2 > values2 = this . iterator2 . getValues ( ) ; crossMatchingGroup ( values1 , values2 , joinFunction , collector ) ; it1Empty = ! iterator1 . nextKey ( ) ; it2Empty = ! iterator2 . nextKey ( ) ; return true ; }
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 ( ( count < tabStop ) && ( Character . isWhitespace ( piece . charAt ( tabStop - ( count + 1 ) ) ) ) ) count ++ ; // replace if whitespace was found if ( count > 0 ) { piece = piece . substring ( 0 , tabStop - count ) + '\t' ; builder . replace ( index , index + tabStop , piece ) ; index = index + tabStop - ( count - 1 ) ; } else index = index + tabStop ; } return builder . toString ( ) ;
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 = new ArrayList < > ( ) ; for ( int j = minValue ; j <= maxValue ; j ++ ) { if ( j == currValue ) { oneHot . add ( 1 ) ; } else { oneHot . add ( 0 ) ; } } return 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 message ) { } }
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 . apache . hadoop . fs . Path # Path ( java . lang . String ) * Reads expression from the < tt > mapred . join . expr < / tt > property and * user - supplied join types from < tt > mapred . join . define . & lt ; ident & gt ; < / tt > * types . Paths supplied to < tt > tbl < / tt > are given as input paths to the * InputFormat class listed . * @ see # compose ( java . lang . String , java . lang . Class , java . lang . String . . . ) */ public void setFormat ( JobConf job ) throws IOException { } }
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 com . liferay . commerce . price . list . model . CommercePriceEntry updateCommercePriceEntry ( com . liferay . commerce . price . list . model . CommercePriceEntry commercePriceEntry ) { } }
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 * @ param uri * - String containing the uri for which a filter chain is * desired * @ return a WebAppFilterChain object corresponding to the passed in uri * @ throws ServletException */ public WebAppFilterChain getFilterChain ( String reqURI , ServletWrapper reqServlet ) throws ServletException { } }
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 . addPostParam ( "WorkflowSid" , workflowSid ) ; } if ( attributes != null ) { request . addPostParam ( "Attributes" , attributes ) ; }