signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class DeIdentifyUtil { /** * Deidentify middle . * @ param str the str * @ param start the start * @ param end the end * @ return the string * @ since 2.0.0 */ public static String deidentifyMiddle ( String str , int start , int end ) { } }
int repeat ; if ( end - start > str . length ( ) ) { repeat = str . length ( ) ; } else { repeat = ( str . length ( ) - end ) - start ; } return StringUtils . overlay ( str , StringUtils . repeat ( '*' , repeat ) , start , str . length ( ) - end ) ;
public class JobDetailImpl { /** * Set the instance of < code > Job < / code > that will be executed . * @ exception IllegalArgumentException if jobClass is null or the class is not a < code > Job < / code > . */ public void setJobClass ( Class < ? extends Job > jobClass ) { } }
if ( jobClass == null ) { throw new IllegalArgumentException ( "Job class cannot be null." ) ; } if ( ! Job . class . isAssignableFrom ( jobClass ) ) { throw new IllegalArgumentException ( "Job class must implement the Job interface." ) ; } this . jobClass = jobClass ;
public class PennTreebankHeadRules { /** * Writes the head rules to the writer in a format suitable for loading the * head rules again with the constructor . The encoding must be taken into * account while working with the writer and reader . * After the entries have been written , the writer is flushed . The writer * remains open after this method returns . * @ param writer * the writer * @ throws IOException * if io exception */ public void serialize ( final Writer writer ) throws IOException { } }
for ( final String type : this . headRules . keySet ( ) ) { final HeadRule headRule = this . headRules . get ( type ) ; // write num of tags writer . write ( Integer . toString ( headRule . getTags ( ) . length + 2 ) ) ; writer . write ( ' ' ) ; // write type writer . write ( type ) ; writer . write ( ' ' ) ; // write l2r true = = 1 if ( headRule . isLeftToRight ( ) ) { writer . write ( "1" ) ; } else { writer . write ( "0" ) ; } // write tags for ( final String tag : headRule . getTags ( ) ) { writer . write ( ' ' ) ; writer . write ( tag ) ; } writer . write ( '\n' ) ; } writer . flush ( ) ;
public class FctBnTradeEntitiesProcessors { /** * < p > Get PrcSettingsAddSave ( create and put into map ) . < / p > * @ param pAddParam additional param * @ return requested PrcSettingsAddSave * @ throws Exception - an exception */ protected final PrcSettingsAddSave < RS > lazyGetPrcSettingsAddSave ( final Map < String , Object > pAddParam ) throws Exception { } }
String beanName = PrcSettingsAddSave . class . getSimpleName ( ) ; @ SuppressWarnings ( "unchecked" ) PrcSettingsAddSave < RS > proc = ( PrcSettingsAddSave < RS > ) this . processorsMap . get ( beanName ) ; if ( proc == null ) { proc = new PrcSettingsAddSave < RS > ( ) ; proc . setSrvSettingsAdd ( getSrvSettingsAdd ( ) ) ; // assigning fully initialized object : this . processorsMap . put ( beanName , proc ) ; this . logger . info ( null , FctBnTradeEntitiesProcessors . class , beanName + " has been created." ) ; } return proc ;
public class CommerceTierPriceEntryPersistenceImpl { /** * Returns the commerce tier price entry where companyId = & # 63 ; and externalReferenceCode = & # 63 ; or returns < code > null < / code > if it could not be found . Uses the finder cache . * @ param companyId the company ID * @ param externalReferenceCode the external reference code * @ return the matching commerce tier price entry , or < code > null < / code > if a matching commerce tier price entry could not be found */ @ Override public CommerceTierPriceEntry fetchByC_ERC ( long companyId , String externalReferenceCode ) { } }
return fetchByC_ERC ( companyId , externalReferenceCode , true ) ;
public class OpenAPIModelFilterAdapter { /** * { @ inheritDoc } */ @ Override public PathItem visitPathItem ( Context context , String key , PathItem item ) { } }
visitor . visitPathItem ( context , key , item ) ; return item ;
public class BundleInstanceRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional * parameters to enable operation dry - run . */ @ Override public Request < BundleInstanceRequest > getDryRunRequest ( ) { } }
Request < BundleInstanceRequest > request = new BundleInstanceRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ;
public class PageFlowController { /** * Get a legacy PreviousPageInfo . * @ deprecated This method will be removed without replacement in the next release . */ public final PreviousPageInfo getPreviousPageInfoLegacy ( PageFlowController curJpf , HttpServletRequest request ) { } }
if ( PageFlowRequestWrapper . get ( request ) . isReturningFromNesting ( ) ) { return getCurrentPageInfo ( ) ; } else { return getPreviousPageInfo ( ) ; }
public class ProxyFilter { /** * Actually write data . Queues the data up unless it relates to the handshake or the * handshake is done . * @ param nextFilter the next filter in filter chain * @ param session the session object * @ param writeRequest the data to write * @ param isHandshakeData true if writeRequest is written by the proxy classes . */ public void writeData ( final NextFilter nextFilter , final IoSession session , final WriteRequest writeRequest , final boolean isHandshakeData ) { } }
ProxyLogicHandler handler = getProxyHandler ( session ) ; synchronized ( handler ) { if ( handler . isHandshakeComplete ( ) ) { // Handshake is done - write data as normal nextFilter . filterWrite ( session , writeRequest ) ; } else if ( isHandshakeData ) { LOGGER . debug ( " handshake data: {}" , writeRequest . getMessage ( ) ) ; // Writing handshake data nextFilter . filterWrite ( session , writeRequest ) ; } else { // Writing non - handshake data before the handshake finished if ( ! session . isConnected ( ) ) { // Not even connected - ignore LOGGER . debug ( " Write request on closed session. Request ignored." ) ; } else { // Queue the data to be sent as soon as the handshake completes LOGGER . debug ( " Handshaking is not complete yet. Buffering write request." ) ; handler . enqueueWriteRequest ( nextFilter , writeRequest ) ; } } }
public class ThymeleafHtmlRenderer { protected void checkFormPropertyUsingReservedWord ( ActionRuntime runtime , VirtualForm virtualForm , final String propertyName ) { } }
if ( isSuppressFormPropertyUsingReservedWordCheck ( ) ) { return ; } if ( reservedWordSet . contains ( propertyName ) ) { throwThymeleafFormPropertyUsingReservedWordException ( runtime , virtualForm , propertyName ) ; }
public class PtoPInputHandler { /** * See if the condition that led to the link being blocked has been resolved . The block could have been * caused by a number of factors , such as the routing destination being full or put - disabled or the * link exception destination being full , etc , etc . * This code is called by the processAckExpected code in the target stream * in order to determine whether NACKs can be sent . * WARNING - specific to stream full case * Once a stream is full it should not be considered not _ full until the stream has reduced the * backlog a bit . Therefore there is some hysteresis in the switching of destinations from full * to not _ full . * @ return true if the destination or link is unable to accept messages . */ @ Override public int checkStillBlocked ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "checkStillBlocked" ) ; // For safety , we assume that the destination is blocked ( def 244425 and 464463) int blockingReason = DestinationHandler . OUTPUT_HANDLER_NOT_FOUND ; if ( ! _isLink ) { // For non - links we want to process ackExpecteds as normal blockingReason = DestinationHandler . OUTPUT_HANDLER_FOUND ; } else { // If this is a link then we are potentially interested in a number of destinations : the destination // currently blocking the link , its exception destination , the link ' s exception destination and maybe // the system exception destination . For example , if no link exception destination is defined and a // message could not be delivered on either the target destination or the target ' s exception destination , // then the entire link will be blocked until that message can be delivered or has been deleted at the // source end . // If a link does have an exception destination defined then there are situations where that exception // destination itself may be unable to accept messages and will therefore lead to the link being blocked . // If the condition that led to the blocking of the link no longer applies and if no other blocking // condition has arisen then we can start sending NACKs to the source as there will be space for what // might be returned . If it still cannot accept messages then we are still not able to send NACKs . // If the link was blocked because the routing destination or the configured exception destinations // were full , then check that they now have room boolean checkedTarget = false ; try { // Do a general message acceptance test on the link blocking destination and any associated // exception destination if the link is still marked as blocked . blockingReason = checkTargetAbleToAcceptOrExceptionMessage ( _linkBlockingDestination ) ; // We ' ve checked the target and have a return code checkedTarget = true ; } catch ( SIMPNotPossibleInCurrentConfigurationException e ) { // No FFDC code needed // There ' s a problem with the configuration of the target destination - so set checkedTarget to // true , retain the OUTPUT _ HANDLER _ NOT _ FOUND return code and continue processing . If we find that // the link exception destination is also unable to accept the message then we want to report // the target blocking reason rather than the link blocking reason , which may be different . checkedTarget = true ; // Log the exception if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . exception ( tc , e ) ; } catch ( SIException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.PtoPInputHandler.checkStillBlocked" , "1:3720:1.323" , this ) ; } // If still blocked , then are we able to exploit the link exception destination try { if ( blockingReason != DestinationHandler . OUTPUT_HANDLER_FOUND ) { int linkBlockingReason = checkLinkAbleToExceptionMessage ( ) ; // If we can exception the message then reset the blockingReason return code if ( linkBlockingReason == DestinationHandler . OUTPUT_HANDLER_FOUND ) blockingReason = DestinationHandler . OUTPUT_HANDLER_FOUND ; // If we didn ' t get a reason code from checking the target or its exception destination // then use the link ' s . else if ( ! checkedTarget ) blockingReason = linkBlockingReason ; } } catch ( SIException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.PtoPInputHandler.checkStillBlocked" , "1:3745:1.323" , this ) ; } // If the link is no longer blocked , clear out the blocking destination if ( blockingReason == DestinationHandler . OUTPUT_HANDLER_FOUND ) _linkBlockingDestination = null ; } // eof processing specific to link if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkStillBlocked" , new Integer ( blockingReason ) ) ; return blockingReason ;
public class URIBuilder { /** * Sets URI host . */ public URIBuilder setHost ( final String host ) { } }
this . host = host ; this . encodedSchemeSpecificPart = null ; this . encodedAuthority = null ; return this ;
public class HadoopKerberosKeytabAuthenticationPlugin { /** * { @ inheritDoc } */ @ Override protected void startUp ( ) throws Exception { } }
try { UserGroupInformation . setConfiguration ( _hadoopConf ) ; if ( UserGroupInformation . isSecurityEnabled ( ) ) { UserGroupInformation . loginUserFromKeytab ( _loginUser , _loginUserKeytabFile ) ; } } catch ( Throwable t ) { log . error ( "Failed to start up HadoopKerberosKeytabAuthenticationPlugin" , t ) ; throw t ; }
public class PathsValidator { /** * { @ inheritDoc } */ @ Override public void validate ( ValidationHelper helper , Context context , String key , Paths t ) { } }
if ( t != null ) { boolean mapContainsInvalidKey = false ; for ( String path : t . keySet ( ) ) { if ( path != null && ! path . isEmpty ( ) ) { if ( ! path . startsWith ( "/" ) ) { final String message = Tr . formatMessage ( tc , "pathsRequiresSlash" , path ) ; helper . addValidationEvent ( new ValidationEvent ( ValidationEvent . Severity . ERROR , context . getLocation ( path ) , message ) ) ; } // Ensure map doesn ' t contain null value if ( t . get ( path ) == null ) { final String message = Tr . formatMessage ( tc , "nullValueInMap" , path ) ; helper . addValidationEvent ( new ValidationEvent ( ValidationEvent . Severity . ERROR , context . getLocation ( path ) , message ) ) ; } } else { mapContainsInvalidKey = true ; } } // Ensure map doesn ' t contain an invalid key if ( mapContainsInvalidKey ) { final String message = Tr . formatMessage ( tc , "nullOrEmptyKeyInMap" ) ; helper . addValidationEvent ( new ValidationEvent ( ValidationEvent . Severity . ERROR , context . getLocation ( ) , message ) ) ; } }
public class ResourceLimiter { /** * Waits for a completion and then marks it as complete . * @ throws InterruptedException */ private void waitForCompletions ( long timeoutMs ) throws InterruptedException { } }
Long completedOperation = this . completedOperationIds . pollFirst ( timeoutMs , TimeUnit . MILLISECONDS ) ; if ( completedOperation != null ) { markOperationComplete ( completedOperation ) ; }
public class ZxingKit { /** * Zxing图形码生成工具 * @ param contents * 内容 * @ param barcodeFormat * BarcodeFormat对象 * @ param format * 图片格式 , 可选 [ png , jpg , bmp ] * @ param width * @ param height * @ param margin * 边框间距px * @ param saveImgFilePath * 存储图片的完整位置 , 包含文件名 * @ return { boolean } */ public static boolean encode ( String contents , BarcodeFormat barcodeFormat , Integer margin , ErrorCorrectionLevel errorLevel , String format , int width , int height , String saveImgFilePath ) { } }
Boolean bool = false ; BufferedImage bufImg ; Map < EncodeHintType , Object > hints = new HashMap < EncodeHintType , Object > ( ) ; // 指定纠错等级 hints . put ( EncodeHintType . ERROR_CORRECTION , errorLevel ) ; hints . put ( EncodeHintType . MARGIN , margin ) ; hints . put ( EncodeHintType . CHARACTER_SET , "UTF-8" ) ; try { // contents = new String ( contents . getBytes ( " UTF - 8 " ) , " ISO - 8859-1 " ) ; BitMatrix bitMatrix = new MultiFormatWriter ( ) . encode ( contents , barcodeFormat , width , height , hints ) ; MatrixToImageConfig config = new MatrixToImageConfig ( 0xFF000001 , 0xFFFFFFFF ) ; bufImg = MatrixToImageWriter . toBufferedImage ( bitMatrix , config ) ; bool = writeToFile ( bufImg , format , saveImgFilePath ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return bool ;
public class TypeConverters { /** * Create a internal { @ link TypeInformation } from a { @ link InternalType } . * < p > eg : * { @ link InternalTypes # STRING } = > { @ link BinaryStringTypeInfo } . * { @ link RowType } = > { @ link BaseRowTypeInfo } . */ public static TypeInformation createInternalTypeInfoFromInternalType ( InternalType type ) { } }
TypeInformation typeInfo = INTERNAL_TYPE_TO_INTERNAL_TYPE_INFO . get ( type ) ; if ( typeInfo != null ) { return typeInfo ; } if ( type instanceof RowType ) { RowType rowType = ( RowType ) type ; return new BaseRowTypeInfo ( rowType . getFieldTypes ( ) , rowType . getFieldNames ( ) ) ; } else if ( type instanceof ArrayType ) { return new BinaryArrayTypeInfo ( ( ( ArrayType ) type ) . getElementType ( ) ) ; } else if ( type instanceof MapType ) { MapType mapType = ( MapType ) type ; return new BinaryMapTypeInfo ( mapType . getKeyType ( ) , mapType . getValueType ( ) ) ; } else if ( type instanceof DecimalType ) { DecimalType decimalType = ( DecimalType ) type ; return new DecimalTypeInfo ( decimalType . precision ( ) , decimalType . scale ( ) ) ; } else if ( type instanceof GenericType ) { GenericType < ? > genericType = ( GenericType < ? > ) type ; return new BinaryGenericTypeInfo < > ( genericType ) ; } else { throw new UnsupportedOperationException ( "Not support yet: " + type ) ; }
public class Require { /** * Calling this method establishes a module as being the main module of the * program to which this require ( ) instance belongs . The module will be * loaded as if require ( ) ' d and its " module " property will be set as the * " main " property of this require ( ) instance . You have to call this method * before the module has been loaded ( that is , the call to this method must * be the first to require the module and thus trigger its loading ) . Note * that the main module will execute in its own scope and not in the global * scope . Since all other modules see the global scope , executing the main * module in the global scope would open it for tampering by other modules . * @ param cx the current context * @ param mainModuleId the ID of the main module * @ return the " exports " property of the main module * @ throws IllegalStateException if the main module is already loaded when * required , or if this require ( ) instance already has a different main * module set . */ public Scriptable requireMain ( Context cx , String mainModuleId ) { } }
if ( this . mainModuleId != null ) { if ( ! this . mainModuleId . equals ( mainModuleId ) ) { throw new IllegalStateException ( "Main module already set to " + this . mainModuleId ) ; } return mainExports ; } ModuleScript moduleScript ; try { // try to get the module script to see if it is on the module path moduleScript = moduleScriptProvider . getModuleScript ( cx , mainModuleId , null , null , paths ) ; } catch ( RuntimeException x ) { throw x ; } catch ( Exception x ) { throw new RuntimeException ( x ) ; } if ( moduleScript != null ) { mainExports = getExportedModuleInterface ( cx , mainModuleId , null , null , true ) ; } else if ( ! sandboxed ) { URI mainUri = null ; // try to resolve to an absolute URI or file path try { mainUri = new URI ( mainModuleId ) ; } catch ( URISyntaxException usx ) { // fall through } // if not an absolute uri resolve to a file path if ( mainUri == null || ! mainUri . isAbsolute ( ) ) { File file = new File ( mainModuleId ) ; if ( ! file . isFile ( ) ) { throw ScriptRuntime . throwError ( cx , nativeScope , "Module \"" + mainModuleId + "\" not found." ) ; } mainUri = file . toURI ( ) ; } mainExports = getExportedModuleInterface ( cx , mainUri . toString ( ) , mainUri , null , true ) ; } this . mainModuleId = mainModuleId ; return mainExports ;
public class ProcessStore { /** * Retrieves a stored process , when found . * @ return The process */ public static synchronized Process getProcess ( String applicationName , String scopedInstancePath ) { } }
return PROCESS_MAP . get ( toAgentId ( applicationName , scopedInstancePath ) ) ;
public class CarmenFeature { /** * A { @ link Point } object which represents the center point inside the { @ link # bbox ( ) } if one is * provided . * @ return a GeoJson { @ link Point } which defines the center location of this feature * @ since 1.0.0 */ @ Nullable public Point center ( ) { } }
// Store locally since rawCenter ( ) is mutable double [ ] center = rawCenter ( ) ; if ( center != null && center . length == 2 ) { return Point . fromLngLat ( center [ 0 ] , center [ 1 ] ) ; } return null ;
public class DecisionTree { /** * / * CREATE ROOT NODE */ public void createRoot ( int newNodeID , String newQuestAns , Decision decision ) { } }
rootNode = new BinTree ( newNodeID , newQuestAns , decision ) ;
public class LangProfileReader { /** * Reads a { @ link LangProfile } from a File in UTF - 8. */ public LangProfile read ( File profileFile ) throws IOException { } }
if ( ! profileFile . exists ( ) ) { throw new IOException ( "No such file: " + profileFile ) ; } else if ( ! profileFile . canRead ( ) ) { throw new IOException ( "Cannot read file: " + profileFile ) ; } try ( FileInputStream input = new FileInputStream ( profileFile ) ) { return read ( input ) ; }
public class ActionExecutionInput { /** * Configuration data for an action execution . * @ param configuration * Configuration data for an action execution . * @ return Returns a reference to this object so that method calls can be chained together . */ public ActionExecutionInput withConfiguration ( java . util . Map < String , String > configuration ) { } }
setConfiguration ( configuration ) ; return this ;
public class GetDevicePoolCompatibilityResult { /** * Information about incompatible devices . * @ param incompatibleDevices * Information about incompatible devices . */ public void setIncompatibleDevices ( java . util . Collection < DevicePoolCompatibilityResult > incompatibleDevices ) { } }
if ( incompatibleDevices == null ) { this . incompatibleDevices = null ; return ; } this . incompatibleDevices = new java . util . ArrayList < DevicePoolCompatibilityResult > ( incompatibleDevices ) ;
public class Label { /** * Add any attributes to the text . */ protected void addAttributes ( AttributedString text ) { } }
// add any color attributes for specific segments if ( _rawText != null ) { Matcher m = COLOR_PATTERN . matcher ( _rawText ) ; int startSeg = 0 , endSeg = 0 ; Color lastColor = null ; while ( m . find ( ) ) { // color the segment just passed endSeg += m . start ( ) ; if ( lastColor != null ) { text . addAttribute ( TextAttribute . FOREGROUND , lastColor , startSeg , endSeg ) ; } // parse the tag : start or end a color String group = m . group ( 1 ) ; if ( "x" . equalsIgnoreCase ( group ) ) { lastColor = null ; } else { lastColor = new Color ( Integer . parseInt ( group , 16 ) ) ; } // prepare for the next segment startSeg = endSeg ; // Subtract the end of the segment from endSeg so that when we add the start of the // next match we have actually added the length of the characters in between . endSeg -= m . end ( ) ; } // apply any final color to the tail segment if ( lastColor != null ) { text . addAttribute ( TextAttribute . FOREGROUND , lastColor , startSeg , _text . length ( ) ) ; } }
public class BoUtils { /** * De - serialize a BO from JSON string . * @ param json * the JSON string obtained from { @ link # toJson ( BaseBo ) } * @ param classLoader * @ return * @ since 0.6.0.3 */ public static BaseBo fromJson ( String json , ClassLoader classLoader ) { } }
return fromJson ( json , BaseBo . class , classLoader ) ;
public class StackDumper { /** * Dumps the given message and exception stack to the system error console */ public static void dump ( String message , Throwable exception ) { } }
printEmphasized ( StringPrinter . buildString ( printer -> { printer . println ( message ) ; exception . printStackTrace ( printer . toPrintWriter ( ) ) ; } ) ) ;
public class DefaultJerseyServer { /** * Shutdown jersey server and release resources */ @ Override public void stop ( ) { } }
// Run jersey shutdown lifecycle if ( container != null ) { container . stop ( ) ; container = null ; } // Destroy the jersey service locator if ( jerseyHandler != null && jerseyHandler . getDelegate ( ) != null ) { ServiceLocatorFactory . getInstance ( ) . destroy ( jerseyHandler . getDelegate ( ) . getServiceLocator ( ) ) ; jerseyHandler = null ; } if ( server != null ) { server . close ( ) ; server = null ; }
public class TranscoderService { /** * Serialize the given session to a byte array . This is a shortcut for * < code > < pre > * final byte [ ] attributesData = serializeAttributes ( session , session . getAttributes ( ) ) ; * serialize ( session , attributesData ) ; * < / pre > < / code > * The returned byte array can be deserialized using { @ link # deserialize ( byte [ ] , SessionManager ) } . * @ see # serializeAttributes ( MemcachedBackupSession , ConcurrentMap ) * @ see # serialize ( MemcachedBackupSession , byte [ ] ) * @ see # deserialize ( byte [ ] , SessionManager ) * @ param session the session to serialize . * @ return the serialized session data . */ public byte [ ] serialize ( final MemcachedBackupSession session ) { } }
final byte [ ] attributesData = serializeAttributes ( session , session . getAttributesInternal ( ) ) ; return serialize ( session , attributesData ) ;
public class SAIS { /** * / * byte */ public static int bwtransform ( byte [ ] T , byte [ ] U , int [ ] A , int n ) { } }
int i , pidx ; if ( ( T == null ) || ( U == null ) || ( A == null ) || ( T . length < n ) || ( U . length < n ) || ( A . length < n ) ) { return - 1 ; } if ( n <= 1 ) { if ( n == 1 ) { U [ 0 ] = T [ 0 ] ; } return n ; } pidx = SA_IS ( new ByteArray ( T , 0 ) , A , 0 , n , 256 , true ) ; U [ 0 ] = T [ n - 1 ] ; for ( i = 0 ; i < pidx ; ++ i ) { U [ i + 1 ] = ( byte ) ( A [ i ] & 0xff ) ; } for ( i += 1 ; i < n ; ++ i ) { U [ i ] = ( byte ) ( A [ i ] & 0xff ) ; } return pidx + 1 ;
public class ChatLinearLayoutManager { /** * Finds an anchor child from existing Views . Most of the time , this is the view closest to * start or end that has a valid position ( e . g . not removed ) . * If a child has focus , it is given priority . */ private boolean updateAnchorFromChildren ( RecyclerView . State state , AnchorInfo anchorInfo ) { } }
if ( getChildCount ( ) == 0 ) { return false ; } final View focused = getFocusedChild ( ) ; if ( focused != null && anchorInfo . isViewValidAsAnchor ( focused , state ) ) { anchorInfo . assignFromViewAndKeepVisibleRect ( focused ) ; return true ; } /* if ( mLastStackFromEnd ! = mStackFromEnd ) { return false ; */ View referenceChild = anchorInfo . mLayoutFromEnd ? findReferenceChildClosestToEnd ( state ) : findReferenceChildClosestToStart ( state ) ; if ( referenceChild != null ) { anchorInfo . assignFromView ( referenceChild ) ; // If all visible views are removed in 1 pass , reference child might be out of bounds . // If that is the case , offset it back to 0 so that we use these pre - layout children . if ( ! state . isPreLayout ( ) && supportsPredictiveItemAnimations ( ) ) { // validate this child is at least partially visible . if not , offset it to start final boolean notVisible = mOrientationHelper . getDecoratedStart ( referenceChild ) >= mOrientationHelper . getEndAfterPadding ( ) || mOrientationHelper . getDecoratedEnd ( referenceChild ) < mOrientationHelper . getStartAfterPadding ( ) ; if ( notVisible ) { anchorInfo . mCoordinate = anchorInfo . mLayoutFromEnd ? mOrientationHelper . getEndAfterPadding ( ) : mOrientationHelper . getStartAfterPadding ( ) ; } } return true ; } return false ;
public class ChannelWrapper { /** * Initialize a signature on this channel . * @ param key the private key to use in signing this data stream . * @ return reference to the new key added to the consumers * @ throws NoSuchAlgorithmException if the key algorithm is not supported * @ throws InvalidKeyException if the key provided is invalid for signing */ public Key < byte [ ] > start ( final PrivateKey key ) throws NoSuchAlgorithmException , InvalidKeyException { } }
final Signature signature = Signature . getInstance ( key . getAlgorithm ( ) ) ; signature . initSign ( key ) ; final Key < byte [ ] > object = new Key < byte [ ] > ( ) ; consumers . put ( object , new Consumer < byte [ ] > ( ) { public void consume ( final ByteBuffer buffer ) { try { signature . update ( buffer ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } public byte [ ] finish ( ) { try { return signature . sign ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } } ) ; return object ;
public class RTreeIndexCoreExtension { /** * Create update 3 trigger * < pre > * Conditions : Update of any column * Row ID change * Non - empty geometry * Actions : Remove record from rtree for old { @ literal < i > } * Insert record into rtree for new { @ literal < i > } * < / pre > * @ param tableName * table name * @ param geometryColumnName * geometry column name * @ param idColumnName * id column name */ public void createUpdate3Trigger ( String tableName , String geometryColumnName , String idColumnName ) { } }
String sqlName = GeoPackageProperties . getProperty ( TRIGGER_PROPERTY , TRIGGER_UPDATE3_NAME ) ; executeSQL ( sqlName , tableName , geometryColumnName , idColumnName ) ;
public class SarlCompiler { /** * Replies if the given feature call has an implicit reference to the { @ code it } variable . * @ param featureCall the feature call to test . * @ return { @ code true } if the given feature call has an implicit reference to the * { @ code it } variable . * @ since 0.9 */ @ SuppressWarnings ( "static-method" ) protected boolean isReferenceToIt ( XFeatureCall featureCall ) { } }
assert featureCall != null ; if ( ! featureCall . isTypeLiteral ( ) && ! featureCall . isPackageFragment ( ) ) { final String itKeyword = IFeatureNames . IT . getFirstSegment ( ) ; XFeatureCall theFeatureCall = featureCall ; do { final String name = theFeatureCall . getFeature ( ) . getSimpleName ( ) ; if ( Strings . equal ( itKeyword , name ) ) { return true ; } final XExpression expr = theFeatureCall . getImplicitReceiver ( ) ; if ( expr instanceof XFeatureCall ) { theFeatureCall = ( XFeatureCall ) expr ; } else { theFeatureCall = null ; } } while ( theFeatureCall != null ) ; } return false ;
public class Channel { /** * Sends a message to a destination . * @ param dst * The destination address . If null , the message will be sent to all cluster nodes ( = * group members ) * @ param buf * The buffer to be sent * @ param offset * The offset into the buffer * @ param length * The length of the data to be sent . Has to be < = buf . length - offset . This will send * < code > length < / code > bytes starting at < code > offset < / code > * @ throws Exception * If send ( ) failed */ public void send ( Address dst , byte [ ] buf , int offset , int length ) throws Exception { } }
ch . send ( dst , buf , offset , length ) ;
public class MwsConnection { /** * Set the default user agent string . Called when connection first opened if * user agent is not set explicitly . */ private void setDefaultUserAgent ( ) { } }
setUserAgent ( MwsUtl . escapeAppName ( applicationName ) , MwsUtl . escapeAppVersion ( applicationVersion ) , MwsUtl . escapeAttributeValue ( "Java/" + System . getProperty ( "java.version" ) + "/" + System . getProperty ( "java.class.version" ) + "/" + System . getProperty ( "java.vendor" ) ) , MwsUtl . escapeAttributeName ( "Platform" ) , MwsUtl . escapeAttributeValue ( "" + System . getProperty ( "os.name" ) + "/" + System . getProperty ( "os.arch" ) + "/" + System . getProperty ( "os.version" ) ) , MwsUtl . escapeAttributeName ( "MWSClientVersion" ) , MwsUtl . escapeAttributeValue ( libraryVersion ) ) ;
public class RosterExchangeProvider { /** * Parses a RosterExchange stanza ( extension sub - packet ) . * @ param parser the XML parser , positioned at the starting element of the extension . * @ return a PacketExtension . * @ throws IOException * @ throws XmlPullParserException */ @ Override public RosterExchange parse ( XmlPullParser parser , int initialDepth , XmlEnvironment xmlEnvironment ) throws XmlPullParserException , IOException { } }
// CHECKSTYLE : OFF RosterExchange rosterExchange = new RosterExchange ( ) ; boolean done = false ; RemoteRosterEntry remoteRosterEntry ; Jid jid = null ; String name = "" ; ArrayList < String > groupsName = new ArrayList < > ( ) ; while ( ! done ) { int eventType = parser . next ( ) ; if ( eventType == XmlPullParser . START_TAG ) { if ( parser . getName ( ) . equals ( "item" ) ) { // Reset this variable since they are optional for each item groupsName = new ArrayList < > ( ) ; // Initialize the variables from the parsed XML jid = ParserUtils . getJidAttribute ( parser ) ; name = parser . getAttributeValue ( "" , "name" ) ; } if ( parser . getName ( ) . equals ( "group" ) ) { groupsName . add ( parser . nextText ( ) ) ; } } else if ( eventType == XmlPullParser . END_TAG ) { if ( parser . getName ( ) . equals ( "item" ) ) { // Create packet . remoteRosterEntry = new RemoteRosterEntry ( jid , name , groupsName . toArray ( new String [ groupsName . size ( ) ] ) ) ; rosterExchange . addRosterEntry ( remoteRosterEntry ) ; } if ( parser . getName ( ) . equals ( "x" ) ) { done = true ; } } } // CHECKSTYLE : ON return rosterExchange ;
public class JTSDrawingPanel { public static void drawVariables ( String title , boolean [ ] empty , GeometricShapeVariable [ ] vars ) { } }
JTSDrawingPanel panel = new JTSDrawingPanel ( ) ; JFrame frame = new JFrame ( title ) ; frame . setDefaultCloseOperation ( JFrame . EXIT_ON_CLOSE ) ; frame . add ( panel ) ; frame . setSize ( 500 , 500 ) ; for ( int i = 0 ; i < vars . length ; i ++ ) { panel . emptyGeoms . put ( vars [ i ] . getID ( ) + "" , empty [ i ] ) ; panel . addGeometry ( vars [ i ] . getID ( ) + "" , ( ( GeometricShapeDomain ) vars [ i ] . getDomain ( ) ) . getGeometry ( ) ) ; } frame . setVisible ( true ) ;
public class CommerceOrderItemLocalServiceBaseImpl { /** * Creates a new commerce order item with the primary key . Does not add the commerce order item to the database . * @ param commerceOrderItemId the primary key for the new commerce order item * @ return the new commerce order item */ @ Override @ Transactional ( enabled = false ) public CommerceOrderItem createCommerceOrderItem ( long commerceOrderItemId ) { } }
return commerceOrderItemPersistence . create ( commerceOrderItemId ) ;
public class DataRecordList { /** * This method was created by a SmartGuide . * @ return int index in table ; or - 1 if not found . * @ param bookmark java . lang . Object */ public int bookmarkToIndex ( Object bookmark , int iHandleType ) { } }
int iTargetPosition ; DataRecord thisBookmark = null ; if ( bookmark == null ) return - 1 ; // + Not found , look through the recordlist for ( iTargetPosition = 0 ; iTargetPosition < m_iRecordListEnd ; iTargetPosition += m_iRecordListStep ) { thisBookmark = ( DataRecord ) this . elementAt ( iTargetPosition ) ; if ( bookmark . equals ( thisBookmark . getHandle ( iHandleType ) ) ) return iTargetPosition ; } // + Still not found , do a binary search through the recordlist for a matching key return - 1 ; // Not found
public class DeleteQueryBase { /** * Execute the delete statement and optionally update the entity id to null . Updating the id requires a select * query of the rows to delete so if speed is a concern use execute ( false ) instead of execute ( ) . * @ param update Whether to update the entity id . */ public void execute ( boolean update ) { } }
if ( update ) { final String sql = getSql ( ) . replace ( "DELETE" , "SELECT " + Model . _ID ) ; final List < T > results = QueryUtils . rawQuery ( mTable , sql , getArgs ( ) ) ; for ( T result : results ) { result . id = null ; } } super . execute ( ) ;
public class FacebookSettings { /** * Creates a { @ link Bundle } from the { @ link FacebookSettings } . * @ return the { @ link Bundle } . */ Bundle toBundle ( ) { } }
Bundle bundle = new Bundle ( ) ; bundle . putInt ( BUNDLE_KEY_DESTINATION_ID , mDestinationId ) ; bundle . putString ( BUNDLE_KEY_ACCOUNT_NAME , mAccountName ) ; bundle . putString ( BUNDLE_KEY_ALBUM_NAME , mAlbumName ) ; bundle . putString ( BUNDLE_KEY_ALBUM_GRAPH_PATH , mAlbumGraphPath ) ; if ( ! TextUtils . isEmpty ( mPageAccessToken ) ) { bundle . putString ( BUNDLE_KEY_PAGE_ACCESS_TOKEN , mPageAccessToken ) ; } if ( ! TextUtils . isEmpty ( mPhotoPrivacy ) ) { bundle . putString ( BUNDLE_KEY_PHOTO_PRIVACY , mPhotoPrivacy ) ; } return bundle ;
public class ExtensionHttpSessions { /** * Gets the http sessions for a particular site . The behaviour when a { @ link HttpSessionsSite } * does not exist is defined by the { @ code createIfNeeded } parameter . * @ param site the site . This parameter has to be formed as defined in the * { @ link ExtensionHttpSessions } class documentation . However , if the protocol is * missing , a default protocol of 80 is used . * @ param createIfNeeded whether a new { @ link HttpSessionsSite } object is created if one does * not exist * @ return the http sessions site container , or null one does not exist and createIfNeeded is * false */ public HttpSessionsSite getHttpSessionsSite ( String site , boolean createIfNeeded ) { } }
// Add a default port if ( ! site . contains ( ":" ) ) { site = site + ( ":80" ) ; } synchronized ( sessionLock ) { if ( sessions == null ) { if ( ! createIfNeeded ) { return null ; } sessions = new HashMap < > ( ) ; } HttpSessionsSite hss = sessions . get ( site ) ; if ( hss == null ) { if ( ! createIfNeeded ) return null ; hss = new HttpSessionsSite ( this , site ) ; sessions . put ( site , hss ) ; } return hss ; }
public class Regions { /** * Gets a list of { @ link Region } s excluding the given { @ link Region } s . * Tolerant of repeated inputs as well as < code > null < / code > items . * @ param excludedRegions { @ link Region } s to exclude * @ return list of all { @ link Region } s excluding the given list */ public static Region [ ] getExcluding ( Region ... excludedRegions ) { } }
Region [ ] regions = Regions . getRegions ( ) ; if ( excludedRegions == null || excludedRegions . length == 0 ) { return regions ; } excludedRegions = removeDuplicates ( excludedRegions ) ; int excludedLength = 0 ; for ( Region r : excludedRegions ) { if ( r != null ) { excludedLength ++ ; } } int outputLength = regions . length - excludedLength ; if ( outputLength < 1 ) { return new Region [ 0 ] ; } Region [ ] outputRegions = new Region [ outputLength ] ; int i = 0 ; for ( Region r : regions ) { boolean excluded = r == null || contains ( excludedRegions , r ) ; if ( ! excluded ) { outputRegions [ i ] = r ; i ++ ; } } return outputRegions ;
public class MuxInputStream { /** * Reads a UTF - 8 string . * @ return the utf - 8 encoded string */ protected String readUTF ( ) throws IOException { } }
int len = ( is . read ( ) << 8 ) + is . read ( ) ; StringBuffer sb = new StringBuffer ( ) ; while ( len > 0 ) { int d1 = is . read ( ) ; if ( d1 < 0 ) return sb . toString ( ) ; else if ( d1 < 0x80 ) { len -- ; sb . append ( ( char ) d1 ) ; } else if ( ( d1 & 0xe0 ) == 0xc0 ) { len -= 2 ; sb . append ( ( ( d1 & 0x1f ) << 6 ) + ( is . read ( ) & 0x3f ) ) ; } else if ( ( d1 & 0xf0 ) == 0xe0 ) { len -= 3 ; sb . append ( ( ( d1 & 0x0f ) << 12 ) + ( ( is . read ( ) & 0x3f ) << 6 ) + ( is . read ( ) & 0x3f ) ) ; } else throw new IOException ( "utf-8 encoding error" ) ; } return sb . toString ( ) ;
public class UserManager { /** * Checks if user exists . * @ param userId the user id , which can be an email or the login . * @ return true , if user exists . */ public boolean hasUser ( String userId ) { } }
String normalized = normalizerUserName ( userId ) ; return loginToUser . containsKey ( normalized ) || emailToUser . containsKey ( normalized ) ;
public class BinaryJedis { /** * Return true if member is a member of the set stored at key , otherwise false is returned . * Time complexity O ( 1) * @ param key * @ param member * @ return Boolean reply , specifically : true if the element is a member of the set false if the element * is not a member of the set OR if the key does not exist */ @ Override public Boolean sismember ( final byte [ ] key , final byte [ ] member ) { } }
checkIsInMultiOrPipeline ( ) ; client . sismember ( key , member ) ; return client . getIntegerReply ( ) == 1 ;
public class CommonUtils { /** * 将指定的图片字节数组进行Base64编码并返回 * @ param imageBytes 指定的图片字节数组 * @ param formatName 图片格式名 , 如gif , png , jpg , jpeg等 , 默认为jpeg * @ return 编码后的Base64字符串 */ public static String imgToBase64StrWithPrefix ( byte [ ] imageBytes , String formatName ) { } }
formatName = formatName != null ? formatName : "jpeg" ; return String . format ( "data:image/%s;base64,%s" , formatName , CommonUtils . bytesToBase64Str ( imageBytes ) ) ;
public class WriteQueue { /** * Gets a snapshot of the queue internals . * @ return The snapshot , including Queue Size , Item Fill Rate and elapsed time of the oldest item . */ synchronized QueueStats getStatistics ( ) { } }
int size = this . writes . size ( ) ; double fillRatio = calculateFillRatio ( this . totalLength , size ) ; int processingTime = this . lastDurationMillis ; if ( processingTime == 0 && size > 0 ) { // We get in here when this method is invoked prior to any operation being completed . Since lastDurationMillis // is only set when an item is completed , in this special case we just estimate based on the amount of time // the first item in the queue has been added . processingTime = ( int ) ( ( this . timeSupplier . get ( ) - this . writes . peekFirst ( ) . getQueueAddedTimestamp ( ) ) / AbstractTimer . NANOS_TO_MILLIS ) ; } return new QueueStats ( size , fillRatio , processingTime ) ;
public class JcrResultSetMetaData { /** * { @ inheritDoc } * This method returns the number of digits behind the decimal point , which is assumed to be 3 if the type is * { @ link PropertyType # DOUBLE } or 0 otherwise . * @ see java . sql . ResultSetMetaData # getScale ( int ) */ @ Override public int getScale ( int column ) { } }
JcrType typeInfo = getJcrType ( column ) ; if ( typeInfo . getJcrType ( ) == PropertyType . DOUBLE ) { return 3 ; // pulled from thin air } return 0 ;
public class AWSCertificateManagerWaiters { /** * Builds a CertificateValidated waiter by using custom parameters waiterParameters and other parameters defined in * the waiters specification , and then polls until it determines whether the resource entered the desired state or * not , where polling criteria is bound by either default polling strategy or custom polling strategy . */ public Waiter < DescribeCertificateRequest > certificateValidated ( ) { } }
return new WaiterBuilder < DescribeCertificateRequest , DescribeCertificateResult > ( ) . withSdkFunction ( new DescribeCertificateFunction ( client ) ) . withAcceptors ( new CertificateValidated . IsSUCCESSMatcher ( ) , new CertificateValidated . IsPENDING_VALIDATIONMatcher ( ) , new CertificateValidated . IsFAILEDMatcher ( ) , new CertificateValidated . IsResourceNotFoundExceptionMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 60 ) ) ) . withExecutorService ( executorService ) . build ( ) ;
public class CacheUnitImpl { /** * This implements the method in the CacheUnit interface . * This is called by DRSNotificationService and DRSMessageListener . * A returned null indicates that the local cache should * execute it and return the result to the coordinating CacheUnit . * @ param cacheName The cache name * @ param id The cache id for the entry . The id cannot be null . * @ param ignoreCounting true to ignore statistics counting * @ return The entry indentified by the cache id . */ public CacheEntry getEntry ( String cacheName , Object id , boolean ignoreCounting ) { } }
if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getEntry: {0}" , id ) ; DCache cache = ServerCache . getCache ( cacheName ) ; CacheEntry cacheEntry = null ; if ( cache != null ) { cacheEntry = ( CacheEntry ) cache . getEntry ( id , CachePerf . REMOTE , ignoreCounting , DCacheBase . INCREMENT_REFF_COUNT ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getEntry: {0}" , id ) ; return cacheEntry ;
public class GraphicsDeviceExtensions { /** * Gets the available screens . * @ return the available screens */ public static GraphicsDevice [ ] getAvailableScreens ( ) { } }
final GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment . getLocalGraphicsEnvironment ( ) ; final GraphicsDevice [ ] graphicsDevices = graphicsEnvironment . getScreenDevices ( ) ; return graphicsDevices ;
public class WebAppDescriptorImpl { /** * If not already created , a new < code > error - page < / code > element will be created and returned . * Otherwise , the first existing < code > error - page < / code > element will be returned . * @ return the instance defined for the element < code > error - page < / code > */ public ErrorPageType < WebAppDescriptor > getOrCreateErrorPage ( ) { } }
List < Node > nodeList = model . get ( "error-page" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new ErrorPageTypeImpl < WebAppDescriptor > ( this , "error-page" , model , nodeList . get ( 0 ) ) ; } return createErrorPage ( ) ;
public class SolutionUtils { /** * It returns the normalized solution given the minimum and maximum values for * each objective * @ param solution to be normalized * @ param minValues minimum values for each objective * @ param maxValues maximum value for each objective * @ return normalized solution */ public static Solution < ? > normalize ( Solution < ? > solution , double [ ] minValues , double [ ] maxValues ) { } }
if ( solution == null ) { throw new JMetalException ( "The solution should not be null" ) ; } if ( minValues == null || maxValues == null ) { throw new JMetalException ( "The minValues and maxValues should not be null" ) ; } if ( minValues . length == 0 || maxValues . length == 0 ) { throw new JMetalException ( "The minValues and maxValues should not be empty" ) ; } if ( minValues . length != maxValues . length ) { throw new JMetalException ( "The minValues and maxValues should have the same length" ) ; } if ( solution . getNumberOfObjectives ( ) != minValues . length ) { throw new JMetalException ( "The number of objectives should be the same to min and max length" ) ; } Solution < ? > copy = ( Solution < ? > ) solution . copy ( ) ; for ( int i = 0 ; i < copy . getNumberOfObjectives ( ) ; i ++ ) { copy . setObjective ( i , NormalizeUtils . normalize ( solution . getObjective ( i ) , minValues [ i ] , maxValues [ i ] ) ) ; } return copy ;
public class GenericGradient { /** * Loads the color stops from the gunction arguments . * @ param args the comma - separated function arguments * @ param firstStop the first argument to start with * @ return the list of color stops or { @ code null } when the arguments are invalid or missing */ protected List < TermFunction . Gradient . ColorStop > decodeColorStops ( List < List < Term < ? > > > args , int firstStop ) { } }
boolean valid = true ; List < TermFunction . Gradient . ColorStop > colorStops = null ; if ( args . size ( ) > firstStop ) { colorStops = new ArrayList < > ( ) ; for ( int i = firstStop ; valid && i < args . size ( ) ; i ++ ) { List < Term < ? > > sarg = args . get ( i ) ; if ( sarg . size ( ) == 1 || sarg . size ( ) == 2 ) { Term < ? > tclr = sarg . get ( 0 ) ; Term < ? > tlen = ( sarg . size ( ) == 2 ) ? sarg . get ( 1 ) : null ; if ( tclr instanceof TermColor && ( tlen == null || tlen instanceof TermLengthOrPercent ) ) { TermFunction . Gradient . ColorStop newStop = new ColorStopImpl ( ( TermColor ) tclr , ( TermLengthOrPercent ) tlen ) ; colorStops . add ( newStop ) ; } else { valid = false ; } } else { valid = false ; } } } if ( valid && colorStops != null && ! colorStops . isEmpty ( ) ) return colorStops ; else return null ;
public class SendLogActivityBase { /** * The log format to use . Default is " time " . Override to use a different format . * Return null to prompt for format . */ protected String getLogFormat ( ) { } }
final String [ ] formats = getResources ( ) . getStringArray ( R . array . format_list ) ; if ( mFormat >= 0 && mFormat < formats . length ) { return formats [ mFormat ] ; } return formats [ FORMAT_DEFAULT ] ;
public class ThriftCodecByteCodeGenerator { /** * Defines the constructor with a parameter for the ThriftType and the delegate codecs . The * constructor simply assigns these parameters to the class fields . */ private void defineConstructor ( ) { } }
// declare the constructor MethodDefinition constructor = new MethodDefinition ( a ( PUBLIC ) , "<init>" , type ( void . class ) , parameters . getParameters ( ) ) ; // invoke super ( Object ) constructor constructor . loadThis ( ) . invokeConstructor ( type ( Object . class ) ) ; // this . foo = foo ; for ( FieldDefinition fieldDefinition : parameters . getFields ( ) ) { constructor . loadThis ( ) . loadVariable ( fieldDefinition . getName ( ) ) . putField ( codecType , fieldDefinition ) ; } // return ; ( implicit ) constructor . ret ( ) ; classDefinition . addMethod ( constructor ) ;
public class RESTMBeanServerConnection { /** * { @ inheritDoc } */ @ Override public MBeanInfo getMBeanInfo ( ObjectName name ) throws InstanceNotFoundException , IntrospectionException , ReflectionException , IOException { } }
final String sourceMethod = "getMBeanInfo" ; checkConnection ( ) ; URL mbeanURL = null ; HttpsURLConnection connection = null ; try { // Get URL for MBean mbeanURL = getMBeanURL ( name ) ; // Get connection to server connection = getConnection ( mbeanURL , HttpMethod . GET ) ; } catch ( IOException io ) { throw getRequestErrorException ( sourceMethod , io , mbeanURL ) ; } // Check response code from server int responseCode = 0 ; try { responseCode = connection . getResponseCode ( ) ; } catch ( ConnectException ce ) { recoverConnection ( ce ) ; // Server is down ; not a client bug throw ce ; } switch ( responseCode ) { case HttpURLConnection . HTTP_OK : JSONConverter converter = JSONConverter . getConverter ( ) ; try { // Process and return server response , which should be an MBeanInfoWrapper MBeanInfoWrapper wrapper = converter . readMBeanInfo ( connection . getInputStream ( ) ) ; mbeanAttributesURLMap . put ( name , new DynamicURL ( connector , wrapper . attributesURL ) ) ; // Attributes Map < String , DynamicURL > attributeURLsMap = mbeanAttributeURLsMap . get ( name ) ; final boolean updateAttributes = attributeURLsMap != null ; if ( ! updateAttributes ) { // Create a new Map - this map is used for future requests and must be thread safe attributeURLsMap = new ConcurrentHashMap < String , DynamicURL > ( ) ; } processAttributeOrOperationURLs ( attributeURLsMap , wrapper . attributeURLs , updateAttributes ) ; if ( ! updateAttributes ) { // Another thread might have created / set this Map already and is about to use it , which is why // we wait until * after * we have a valid Map and are ready to push that in . mbeanAttributeURLsMap . putIfAbsent ( name , attributeURLsMap ) ; } // Operations Map < String , DynamicURL > operationURLsMap = mbeanOperationURLsMap . get ( name ) ; final boolean updateOperations = operationURLsMap != null ; if ( ! updateOperations ) { // Create a new Map - this map is used for future requests and must be thread safe operationURLsMap = new ConcurrentHashMap < String , DynamicURL > ( ) ; } processAttributeOrOperationURLs ( operationURLsMap , wrapper . operationURLs , updateOperations ) ; if ( ! updateOperations ) { // Another thread might have created / set this Map already and is about to use it , which is why // we wait until * after * we have a valid Map and are ready to push that in . mbeanOperationURLsMap . putIfAbsent ( name , operationURLsMap ) ; } return wrapper . mbeanInfo ; } catch ( ClassNotFoundException cnf ) { // Not a REST connector bug per se ; not need to log this case throw new IOException ( RESTClientMessagesUtil . getMessage ( RESTClientMessagesUtil . SERVER_RESULT_EXCEPTION ) , cnf ) ; } catch ( Exception e ) { throw getResponseErrorException ( sourceMethod , e , mbeanURL ) ; } finally { JSONConverter . returnConverter ( converter ) ; } case HttpURLConnection . HTTP_BAD_REQUEST : case HttpURLConnection . HTTP_INTERNAL_ERROR : try { // Server response should be a serialized Throwable throw getServerThrowable ( sourceMethod , connection ) ; } catch ( IntrospectionException ie ) { throw ie ; } catch ( InstanceNotFoundException inf ) { throw inf ; } catch ( ReflectionException re ) { throw re ; } catch ( IOException io ) { throw io ; } catch ( Throwable t ) { throw new IOException ( RESTClientMessagesUtil . getMessage ( RESTClientMessagesUtil . UNEXPECTED_SERVER_THROWABLE ) , t ) ; } case HttpURLConnection . HTTP_UNAUTHORIZED : case HttpURLConnection . HTTP_FORBIDDEN : throw getBadCredentialsException ( responseCode , connection ) ; case HttpURLConnection . HTTP_GONE : case HttpURLConnection . HTTP_NOT_FOUND : IOException ioe = getResponseCodeErrorException ( sourceMethod , responseCode , connection ) ; recoverConnection ( ioe ) ; throw ioe ; default : throw getResponseCodeErrorException ( sourceMethod , responseCode , connection ) ; }
public class ContainerNamingUtil { private static String replacePlaceholders ( String containerNamePattern , String imageName , String nameAlias , Date buildTimestamp ) { } }
Map < String , FormatParameterReplacer . Lookup > lookups = new HashMap < > ( ) ; lookups . put ( "a" , ( ) -> nameAlias ) ; lookups . put ( "n" , ( ) -> cleanImageName ( imageName ) ) ; lookups . put ( "t" , ( ) -> String . valueOf ( buildTimestamp . getTime ( ) ) ) ; lookups . put ( "i" , ( ) -> INDEX_PLACEHOLDER ) ; return new FormatParameterReplacer ( lookups ) . replace ( containerNamePattern ) ;
public class PathOverrideService { /** * Set the groups assigned to a path * @ param groups group IDs to set * @ param pathId ID of path */ public void setGroupsForPath ( Integer [ ] groups , int pathId ) { } }
String newGroups = Arrays . toString ( groups ) ; newGroups = newGroups . substring ( 1 , newGroups . length ( ) - 1 ) . replaceAll ( "\\s" , "" ) ; logger . info ( "adding groups={}, to pathId={}" , newGroups , pathId ) ; EditService . updatePathTable ( Constants . PATH_PROFILE_GROUP_IDS , newGroups , pathId ) ;
public class JsonUtils { /** * The method reads a field from the JSON stream , and checks if the * field read is the same as the expect field . * @ param jsonParser The JsonParser instance to be used * @ param expectedFieldName The field name which is expected next * @ throws IOException */ public static void readField ( JsonParser jsonParser , String expectedFieldName ) throws IOException { } }
readToken ( jsonParser , expectedFieldName , JsonToken . FIELD_NAME ) ; String fieldName = jsonParser . getCurrentName ( ) ; if ( ! fieldName . equals ( expectedFieldName ) ) { foundUnknownField ( fieldName , expectedFieldName ) ; }
public class CmsImageInfoDisplay { /** * Sets the focal point . < p > * @ param focalPoint the focal point */ public void setFocalPoint ( String focalPoint ) { } }
boolean visible = ( focalPoint != null ) ; if ( focalPoint == null ) { focalPoint = "" ; } m_labelPoint . setVisible ( visible ) ; m_removePoint . setVisible ( visible ) ; m_displayPoint . setText ( focalPoint ) ;
public class CompactNsContext { /** * Method called by { @ link com . ctc . wstx . evt . CompactStartElement } * to output all ' local ' namespace declarations active in current * namespace scope , if any . Local means that declaration was done in * scope of current element , not in a parent element . */ @ Override public void outputNamespaceDeclarations ( Writer w ) throws IOException { } }
String [ ] ns = mNamespaces ; for ( int i = mFirstLocalNs , len = mNsLength ; i < len ; i += 2 ) { w . write ( ' ' ) ; w . write ( XMLConstants . XMLNS_ATTRIBUTE ) ; String prefix = ns [ i ] ; if ( prefix != null && prefix . length ( ) > 0 ) { w . write ( ':' ) ; w . write ( prefix ) ; } w . write ( "=\"" ) ; w . write ( ns [ i + 1 ] ) ; w . write ( '"' ) ; }
public class ModuleWebhooks { /** * Get more information about one specific call to one specific webhook , hosted by one specific * space . * @ param call A call to be get more information about . * @ return A Call Detail to be used to gather more information about this call . * @ throws IllegalArgumentException if spaceId is null . * @ throws IllegalArgumentException if webhook is null . * @ throws IllegalArgumentException if callId is null . */ public CMAWebhookCallDetail callDetails ( CMAWebhookCall call ) { } }
final String spaceId = getSpaceIdOrThrow ( call , "call" ) ; final String callId = getResourceIdOrThrow ( call , "call" ) ; assertNotNull ( call . getSystem ( ) . getCreatedBy ( ) . getId ( ) , "webhook.sys.createdBy" ) ; final String webhookId = call . getSystem ( ) . getCreatedBy ( ) . getId ( ) ; return service . callDetails ( spaceId , webhookId , callId ) . blockingFirst ( ) ;
public class CompanyMgrImpl { /** * update */ public void update ( Company company ) { } }
if ( company . getId ( ) <= 0 || company . getId ( ) <= 0 ) { throw new RuntimeException ( "Company id invliad" ) ; } if ( ! companyMap . containsKey ( company . getId ( ) ) ) { throw new RuntimeException ( "Company id not exist" ) ; } companyMap . put ( company . getId ( ) , company ) ;
public class BeanDescriptor { /** * Gets the type for a property getter . * @ param name the name of the property * @ return the Class of the property getter * @ throws NoSuchMethodException when a getter method cannot be found */ public Class < ? > getGetterType ( String name ) throws NoSuchMethodException { } }
Class < ? > type = getterTypes . get ( name ) ; if ( type == null ) { throw new NoSuchMethodException ( "There is no READABLE property named '" + name + "' in class '" + className + "'" ) ; } return type ;
public class SystemInputs { /** * Returns the IConditional instances defined by the given function input definition . */ private static Stream < IConditional > conditionals ( FunctionInputDef function ) { } }
return toStream ( function . getVarDefs ( ) ) . flatMap ( var -> conditionals ( var ) ) ;
public class CfgParseChart { /** * Compute the expected * unnormalized * probability of every rule . */ public Factor getBinaryRuleExpectations ( ) { } }
Tensor binaryRuleWeights = binaryRuleDistribution . coerceToDiscrete ( ) . getWeights ( ) ; SparseTensor tensor = SparseTensor . copyRemovingZeros ( binaryRuleWeights , binaryRuleExpectations ) ; return new TableFactor ( binaryRuleDistribution . getVars ( ) , tensor ) ;
public class MessageFactory { /** * Create an entity scoped error message */ public static Message error ( Entity entity , String key , String ... args ) { } }
return message ( MessageType . ERROR , entity , key , args ) ;
public class PopupMenu { /** * Shows menu as given stage coordinates * @ param stage stage instance that this menu is being added to * @ param x stage x position * @ param y stage y position */ public void showMenu ( Stage stage , float x , float y ) { } }
setPosition ( x , y - getHeight ( ) ) ; if ( stage . getHeight ( ) - getY ( ) > stage . getHeight ( ) ) setY ( getY ( ) + getHeight ( ) ) ; ActorUtils . keepWithinStage ( stage , this ) ; stage . addActor ( this ) ;
public class MavenJDOMWriter { /** * Method findAndReplaceProperties . * @ param counter * @ param props * @ param name * @ param parent */ @ SuppressWarnings ( "unchecked" ) protected Element findAndReplaceProperties ( Counter counter , Element parent , String name , Map props ) { } }
boolean shouldExist = ( props != null ) && ! props . isEmpty ( ) ; Element element = updateElement ( counter , parent , name , shouldExist ) ; if ( shouldExist ) { Iterator it = props . keySet ( ) . iterator ( ) ; Counter innerCounter = new Counter ( counter . getDepth ( ) + 1 ) ; while ( it . hasNext ( ) ) { String key = ( String ) it . next ( ) ; findAndReplaceSimpleElement ( innerCounter , element , key , ( String ) props . get ( key ) , null ) ; } List < String > lst = new ArrayList < String > ( props . keySet ( ) ) ; it = element . getChildren ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Element elem = ( Element ) it . next ( ) ; String key = elem . getName ( ) ; if ( ! lst . contains ( key ) ) { it . remove ( ) ; } } } return element ;
public class DirectoryServiceClient { /** * Set user password . * @ param userName * the user name . * @ param password * the user password . */ public void setUserPassword ( String userName , String password ) { } }
ProtocolHeader header = new ProtocolHeader ( ) ; header . setType ( ProtocolType . SetUserPassword ) ; byte [ ] secret = null ; if ( password != null && ! password . isEmpty ( ) ) { secret = ObfuscatUtil . base64Encode ( password . getBytes ( ) ) ; } SetUserPasswordProtocol p = new SetUserPasswordProtocol ( userName , secret ) ; connection . submitRequest ( header , p , null ) ;
public class CrossDomainRpcLoader { /** * Parses the request for a CrossDomainRpc . * @ param request The request to parse . * @ return The parsed RPC . * @ throws IOException If an error occurs reading from the request . * @ throws IllegalArgumentException If an occurs while parsing the request * data . */ public CrossDomainRpc loadRpc ( HttpServletRequest request ) throws IOException { } }
Charset encoding ; try { String enc = request . getCharacterEncoding ( ) ; encoding = Charset . forName ( enc ) ; } catch ( IllegalArgumentException | NullPointerException e ) { encoding = UTF_8 ; } // We tend to look at the input stream , rather than the reader . try ( InputStream in = request . getInputStream ( ) ; Reader reader = new InputStreamReader ( in , encoding ) ; JsonInput jsonInput = json . newInput ( reader ) ) { Map < String , Object > read = jsonInput . read ( MAP_TYPE ) ; return new CrossDomainRpc ( getField ( read , Field . METHOD ) , getField ( read , Field . PATH ) , getField ( read , Field . DATA ) ) ; } catch ( JsonException e ) { throw new IllegalArgumentException ( "Failed to parse JSON request: " + e . getMessage ( ) , e ) ; }
public class ConcurrentIdentityHashMap { /** * { @ inheritDoc } * @ throws NullPointerException * if any of the arguments are null */ public boolean replace ( K key , V oldValue , V newValue ) { } }
if ( oldValue == null || newValue == null ) { throw new NullPointerException ( ) ; } int hash = this . hashOf ( key ) ; return this . segmentFor ( hash ) . replace ( key , hash , oldValue , newValue ) ;
public class DefaultSortStrategy { /** * Given a sort direction , get the next sort direction . This implements a simple sort machine * that cycles through the sort directions in the following order : * < pre > * SortDirection . NONE > SortDirection . ASCENDING > SortDirection . DESCENDING > repeat * < / pre > * @ param direction the current { @ link SortDirection } * @ return the next { @ link SortDirection } */ public SortDirection nextDirection ( SortDirection direction ) { } }
if ( direction == SortDirection . NONE ) return SortDirection . ASCENDING ; else if ( direction == SortDirection . ASCENDING ) return SortDirection . DESCENDING ; else if ( direction == SortDirection . DESCENDING ) return SortDirection . NONE ; else throw new IllegalStateException ( Bundle . getErrorString ( "SortStrategy_InvalidSortDirection" , new Object [ ] { direction } ) ) ;
public class VasConversionService { /** * Creates { @ code Wgs84Coordinates } based on the charging station coordinates . * @ param chargingStation charging station * @ return { @ code Wgs84Coordinates } based on the charging station coordinates . */ public Wgs84Coordinates getCoordinates ( ChargingStation chargingStation ) { } }
Wgs84Coordinates wgs84Coordinates = new Wgs84Coordinates ( ) ; wgs84Coordinates . setLatitude ( chargingStation . getLatitude ( ) ) ; wgs84Coordinates . setLongitude ( chargingStation . getLongitude ( ) ) ; return wgs84Coordinates ;
public class OpenCmsCore { /** * Destroys this OpenCms instance , called if the servlet ( or shell ) is shut down . < p > */ protected void shutDown ( ) { } }
synchronized ( LOCK ) { if ( getRunLevel ( ) > OpenCms . RUNLEVEL_0_OFFLINE ) { System . err . println ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_SHUTDOWN_CONSOLE_NOTE_2 , getSystemInfo ( ) . getVersionNumber ( ) , getSystemInfo ( ) . getWebApplicationName ( ) ) ) ; if ( CmsLog . INIT . isInfoEnabled ( ) ) { CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_DOT_0 ) ) ; CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_DOT_0 ) ) ; CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_LINE_0 ) ) ; CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_SHUTDOWN_START_1 , getSystemInfo ( ) . getVersionNumber ( ) + " [" + getSystemInfo ( ) . getVersionId ( ) + "]" ) ) ; CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_CURRENT_RUNLEVEL_1 , new Integer ( getRunLevel ( ) ) ) ) ; CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_SHUTDOWN_TIME_1 , new Date ( System . currentTimeMillis ( ) ) ) ) ; } // take the system offline setRunLevel ( OpenCms . RUNLEVEL_0_OFFLINE ) ; if ( LOG . isDebugEnabled ( ) ) { // log exception to see which method did call the shutdown LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_SHUTDOWN_TRACE_0 ) , new Exception ( ) ) ; } try { // the first thing we have to do is to wait until the current publish process finishes if ( null != m_publishEngine ) { m_publishEngine . shutDown ( ) ; } } catch ( Throwable e ) { CmsLog . INIT . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ERROR_PUBLISH_SHUTDOWN_1 , e . getMessage ( ) ) , e ) ; } try { // search manager must be shut down early since there may be background indexing still ongoing if ( m_searchManager != null ) { m_searchManager . shutDown ( ) ; } } catch ( Throwable e ) { CmsLog . INIT . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ERROR_SEARCH_MANAGER_SHUTDOWN_1 , e . getMessage ( ) ) , e ) ; } try { // remote shell server must be shut down early since there is a background thread ongoing that reloads from the VFS if ( m_remoteShellServer != null ) { m_remoteShellServer . shutDown ( ) ; } } catch ( Throwable e ) { CmsLog . INIT . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ERROR_REMOTESHELL_SHUTDOWN_1 , e . getMessage ( ) ) , e ) ; } try { // VFS bundle manager must be shut down early since there is a background thread ongoing that reloads from the VFS if ( m_vfsBundleManager != null ) { m_vfsBundleManager . shutDown ( ) ; } } catch ( Throwable e ) { CmsLog . INIT . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ERROR_VFSBUNDLE_MANAGER_SHUTDOWN_1 , e . getMessage ( ) ) , e ) ; } try { if ( m_staticExportManager != null ) { m_staticExportManager . shutDown ( ) ; } } catch ( Throwable e ) { CmsLog . INIT . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ERROR_EXPORT_SHUTDOWN_1 , e . getMessage ( ) ) , e ) ; } try { if ( m_moduleManager != null ) { m_moduleManager . shutDown ( ) ; } } catch ( Throwable e ) { CmsLog . INIT . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ERROR_MODULE_SHUTDOWN_1 , e . getMessage ( ) ) , e ) ; } try { if ( m_executor != null ) { m_executor . shutdownNow ( ) ; m_executor . awaitTermination ( 30 , TimeUnit . SECONDS ) ; } } catch ( Throwable e ) { CmsLog . INIT . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ERROR_MODULE_SHUTDOWN_1 , e . getMessage ( ) ) , e ) ; } try { if ( m_scheduleManager != null ) { m_scheduleManager . shutDown ( ) ; } } catch ( Throwable e ) { CmsLog . INIT . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ERROR_SCHEDULE_SHUTDOWN_1 , e . getMessage ( ) ) , e ) ; } try { if ( m_resourceManager != null ) { m_resourceManager . shutDown ( ) ; } } catch ( Throwable e ) { CmsLog . INIT . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ERROR_RESOURCE_SHUTDOWN_1 , e . getMessage ( ) ) , e ) ; } try { if ( m_repositoryManager != null ) { m_repositoryManager . shutDown ( ) ; } } catch ( Throwable e ) { CmsLog . INIT . error ( e . getLocalizedMessage ( ) , e ) ; } try { // has to be stopped before the security manager , since this thread uses it if ( m_threadStore != null ) { m_threadStore . shutDown ( ) ; } } catch ( Throwable e ) { CmsLog . INIT . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ERROR_THREAD_SHUTDOWN_1 , e . getMessage ( ) ) , e ) ; } try { if ( m_securityManager != null ) { m_securityManager . destroy ( ) ; } } catch ( Throwable e ) { CmsLog . INIT . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ERROR_SECURITY_SHUTDOWN_1 , e . getMessage ( ) ) , e ) ; } try { if ( m_sessionManager != null ) { m_sessionManager . shutdown ( ) ; } } catch ( Throwable e ) { CmsLog . INIT . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ERROR_SESSION_MANAGER_SHUTDOWN_1 , e . getMessage ( ) ) , e ) ; } try { if ( m_memoryMonitor != null ) { m_memoryMonitor . shutdown ( ) ; } } catch ( Throwable e ) { CmsLog . INIT . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ERROR_MEMORY_MONITOR_SHUTDOWN_1 , e . getMessage ( ) ) , e ) ; } try { if ( m_adeManager != null ) { m_adeManager . shutdown ( ) ; } } catch ( Throwable e ) { CmsLog . INIT . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_ERROR_ADE_MANAGER_SHUTDOWN_1 , e . getMessage ( ) ) , e ) ; } String runtime = CmsStringUtil . formatRuntime ( getSystemInfo ( ) . getRuntime ( ) ) ; if ( CmsLog . INIT . isInfoEnabled ( ) ) { CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_OPENCMS_STOPPED_1 , runtime ) ) ; CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_LINE_0 ) ) ; CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_DOT_0 ) ) ; CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_DOT_0 ) ) ; } System . err . println ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_CONSOLE_TOTAL_RUNTIME_1 , runtime ) ) ; } m_instance = null ; }
public class DatabaseMetaDataTreeModel { /** * Method for reporting SQLException . This is used by * the treenodes if retrieving information for a node * is not successful . * @ param message The message describing where the error occurred * @ param sqlEx The exception to be reported . */ public void reportSqlError ( String message , java . sql . SQLException sqlEx ) { } }
StringBuffer strBufMessages = new StringBuffer ( ) ; java . sql . SQLException currentSqlEx = sqlEx ; do { strBufMessages . append ( "\n" + sqlEx . getErrorCode ( ) + ":" + sqlEx . getMessage ( ) ) ; currentSqlEx = currentSqlEx . getNextException ( ) ; } while ( currentSqlEx != null ) ; System . err . println ( message + strBufMessages . toString ( ) ) ; sqlEx . printStackTrace ( ) ;
public class BatchDeleteImportDataResult { /** * Error messages returned for each import task that you deleted as a response for this command . * @ param errors * Error messages returned for each import task that you deleted as a response for this command . */ public void setErrors ( java . util . Collection < BatchDeleteImportDataError > errors ) { } }
if ( errors == null ) { this . errors = null ; return ; } this . errors = new java . util . ArrayList < BatchDeleteImportDataError > ( errors ) ;
public class Compiler { /** * Ensures that the number of threads in the build pool is at least as large as the number given . Because object * templates can have dependencies on each other , it is possible to deadlock the compilation with a rigidly fixed * build queue . To avoid this , allow the build queue limit to be increased . * @ param minLimit minimum build queue limit */ public void ensureMinimumBuildThreadLimit ( int minLimit ) { } }
if ( buildThreadLimit . get ( ) < minLimit ) { synchronized ( buildThreadLock ) { buildThreadLimit . set ( minLimit ) ; ThreadPoolExecutor buildExecutor = executors . get ( TaskResult . ResultType . BUILD ) ; // Must set both the maximum and the core limits . If the core is // not set , then the thread pool will not be forced to expand to // the minimum number of threads required . buildExecutor . setMaximumPoolSize ( minLimit ) ; buildExecutor . setCorePoolSize ( minLimit ) ; } }
public class LTernaryOperatorBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */ @ Nonnull public static < T > LTernaryOperator < T > ternaryOperatorFrom ( Consumer < LTernaryOperatorBuilder < T > > buildingFunction ) { } }
LTernaryOperatorBuilder builder = new LTernaryOperatorBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ;
public class PredictionsImpl { /** * Gets predictions for a given utterance , in the form of intents and entities . The current maximum query size is 500 characters . * @ param appId The LUIS application ID ( Guid ) . * @ param query The utterance to predict . * @ param resolveOptionalParameter the object representing the optional parameters to be set before calling this API * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < LuisResult > resolveAsync ( String appId , String query , ResolveOptionalParameter resolveOptionalParameter , final ServiceCallback < LuisResult > serviceCallback ) { } }
return ServiceFuture . fromResponse ( resolveWithServiceResponseAsync ( appId , query , resolveOptionalParameter ) , serviceCallback ) ;
public class FormalParameterBuilderImpl { /** * Replies the default value of the parameter . * @ return the default value builder . */ @ Pure public IExpressionBuilder getDefaultValue ( ) { } }
if ( this . defaultValue == null ) { this . defaultValue = this . expressionProvider . get ( ) ; this . defaultValue . eInit ( this . parameter , new Procedures . Procedure1 < XExpression > ( ) { public void apply ( XExpression it ) { getSarlFormalParameter ( ) . setDefaultValue ( it ) ; } } , getTypeResolutionContext ( ) ) ; } return this . defaultValue ;
public class PathDescriptorHelper { /** * Clean the provided path and split it into parts , separated by slashes . * @ param sPath * Source path . May not be < code > null < / code > . * @ return The list with all path parts . Never < code > null < / code > . */ @ Nonnull @ ReturnsMutableCopy public static ICommonsList < String > getCleanPathParts ( @ Nonnull final String sPath ) { } }
// Remove leading and trailing whitespaces and slashes String sRealPath = StringHelper . trimStartAndEnd ( sPath . trim ( ) , "/" , "/" ) ; // Remove obscure path parts sRealPath = FilenameHelper . getCleanPath ( sRealPath ) ; // Split into pieces final ICommonsList < String > aPathParts = StringHelper . getExploded ( '/' , sRealPath ) ; return aPathParts ;
public class BaseDfuImpl { /** * Removes the bond information for the given device . * @ return < code > true < / code > if operation succeeded , < code > false < / code > otherwise */ @ SuppressWarnings ( "UnusedReturnValue" ) boolean removeBond ( ) { } }
final BluetoothDevice device = mGatt . getDevice ( ) ; if ( device . getBondState ( ) == BluetoothDevice . BOND_NONE ) return true ; mService . sendLogBroadcast ( DfuBaseService . LOG_LEVEL_VERBOSE , "Removing bond information..." ) ; boolean result = false ; /* * There is a removeBond ( ) method in BluetoothDevice class but for now it ' s hidden . We will call it using reflections . */ try { // noinspection JavaReflectionMemberAccess final Method removeBond = device . getClass ( ) . getMethod ( "removeBond" ) ; mRequestCompleted = false ; mService . sendLogBroadcast ( DfuBaseService . LOG_LEVEL_DEBUG , "gatt.getDevice().removeBond() (hidden)" ) ; result = ( Boolean ) removeBond . invoke ( device ) ; // We have to wait until device is unbounded try { synchronized ( mLock ) { while ( ! mRequestCompleted && ! mAborted ) mLock . wait ( ) ; } } catch ( final InterruptedException e ) { loge ( "Sleeping interrupted" , e ) ; } } catch ( final Exception e ) { Log . w ( TAG , "An exception occurred while removing bond information" , e ) ; } return result ;
public class CmsObject { /** * Returns all file resources contained in a folder . < p > * The result is filtered according to the rules of * the < code > { @ link CmsResourceFilter # DEFAULT } < / code > filter . < p > * @ param resourcename the full current site relative path of the resource to return the child resources for * @ return a list of all child files as < code > { @ link CmsResource } < / code > objects * @ throws CmsException if something goes wrong * @ see # getFilesInFolder ( String , CmsResourceFilter ) */ public List < CmsResource > getFilesInFolder ( String resourcename ) throws CmsException { } }
return getFilesInFolder ( resourcename , CmsResourceFilter . DEFAULT ) ;
public class Int2ObjectCache { /** * { @ inheritDoc } */ public boolean containsValue ( final Object value ) { } }
boolean found = false ; if ( null != value ) { for ( final Object v : values ) { if ( value . equals ( v ) ) { found = true ; break ; } } } return found ;
public class FormatCache { /** * This must remain private , see LANG - 884 */ private F getDateTimeInstance ( final Integer dateStyle , final Integer timeStyle , final TimeZone timeZone , Locale locale ) { } }
if ( locale == null ) { locale = Locale . getDefault ( ) ; } final String pattern = getPatternForStyle ( dateStyle , timeStyle , locale ) ; return getInstance ( pattern , timeZone , locale ) ;
public class S3ProxyHandler { /** * it has unwanted millisecond precision */ private static String formatDate ( Date date ) { } }
SimpleDateFormat formatter = new SimpleDateFormat ( "yyyy-MM-dd'T'HH:mm:ss'Z'" ) ; formatter . setTimeZone ( TimeZone . getTimeZone ( "GMT" ) ) ; return formatter . format ( date ) ;
public class PackageSummaryBuilder { /** * Build the summary for the enums in this package . * @ param node the XML element that specifies which components to document * @ param summaryContentTree the summary tree to which the enum summary will * be added */ public void buildEnumSummary ( XMLNode node , Content summaryContentTree ) { } }
String enumTableSummary = configuration . getText ( "doclet.Member_Table_Summary" , configuration . getText ( "doclet.Enum_Summary" ) , configuration . getText ( "doclet.enums" ) ) ; String [ ] enumTableHeader = new String [ ] { configuration . getText ( "doclet.Enum" ) , configuration . getText ( "doclet.Description" ) } ; ClassDoc [ ] enums = packageDoc . isIncluded ( ) ? packageDoc . enums ( ) : configuration . classDocCatalog . enums ( utils . getPackageName ( packageDoc ) ) ; enums = utils . filterOutPrivateClasses ( enums , configuration . javafx ) ; if ( enums . length > 0 ) { packageWriter . addClassesSummary ( enums , configuration . getText ( "doclet.Enum_Summary" ) , enumTableSummary , enumTableHeader , summaryContentTree ) ; }
public class DescribeBrokerResult { /** * A list of information about allocated brokers . * @ param brokerInstances * A list of information about allocated brokers . */ public void setBrokerInstances ( java . util . Collection < BrokerInstance > brokerInstances ) { } }
if ( brokerInstances == null ) { this . brokerInstances = null ; return ; } this . brokerInstances = new java . util . ArrayList < BrokerInstance > ( brokerInstances ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link DirectionPropertyType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link DirectionPropertyType } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "direction" ) public JAXBElement < DirectionPropertyType > createDirection ( DirectionPropertyType value ) { } }
return new JAXBElement < DirectionPropertyType > ( _Direction_QNAME , DirectionPropertyType . class , null , value ) ;
public class HessianURLConnection { /** * Sends the request */ public void sendRequest ( ) throws IOException { } }
if ( _conn instanceof HttpURLConnection ) { HttpURLConnection httpConn = ( HttpURLConnection ) _conn ; _statusCode = 500 ; try { _statusCode = httpConn . getResponseCode ( ) ; } catch ( Exception e ) { } parseResponseHeaders ( httpConn ) ; InputStream is = null ; if ( _statusCode != 200 ) { StringBuffer sb = new StringBuffer ( ) ; int ch ; try { is = httpConn . getInputStream ( ) ; if ( is != null ) { while ( ( ch = is . read ( ) ) >= 0 ) sb . append ( ( char ) ch ) ; is . close ( ) ; } is = httpConn . getErrorStream ( ) ; if ( is != null ) { while ( ( ch = is . read ( ) ) >= 0 ) sb . append ( ( char ) ch ) ; } _statusMessage = sb . toString ( ) ; } catch ( FileNotFoundException e ) { throw new HessianConnectionException ( "HessianProxy cannot connect to '" + _url , e ) ; } catch ( IOException e ) { if ( is == null ) throw new HessianConnectionException ( _statusCode + ": " + e , e ) ; else throw new HessianConnectionException ( _statusCode + ": " + sb , e ) ; } if ( is != null ) is . close ( ) ; throw new HessianConnectionException ( _statusCode + ": " + sb . toString ( ) ) ; } }
public class CmsAliasList { /** * Creates a text box for entering an alias path . < p > * @ return the new text box */ protected CmsTextBox createTextBox ( ) { } }
CmsTextBox textbox = new CmsTextBox ( ) ; textbox . getElement ( ) . getStyle ( ) . setWidth ( 325 , Unit . PX ) ; textbox . getElement ( ) . getStyle ( ) . setMarginRight ( 5 , Unit . PX ) ; return textbox ;
public class ColtUtils { /** * Returns a lower and an upper bound for the condition number * < br > kp ( A ) = Norm [ A , p ] / Norm [ A ^ - 1 , p ] * < br > where * < br > Norm [ A , p ] = sup ( Norm [ A . x , p ] / Norm [ x , p ] , x ! = 0 ) * < br > for a matrix and * < br > Norm [ x , 1 ] : = Sum [ Math . abs ( x [ i ] ) , i ] * < br > Norm [ x , 2 ] : = Math . sqrt ( Sum [ Math . pow ( x [ i ] , 2 ) , i ] ) * < br > Norm [ x , 00 ] : = Max [ Math . abs ( x [ i ] ) , i ] * < br > for a vector . * @ param A matrix you want the condition number of * @ param p norm order ( 2 or Integer . MAX _ VALUE ) * @ return an array with the two bounds ( lower and upper bound ) * @ see Ravindra S . Gajulapalli , Leon S . Lasdon " Scaling Sparse Matrices for Optimization Algorithms " */ public static double [ ] getConditionNumberRange ( RealMatrix A , int p ) { } }
double infLimit = Double . NEGATIVE_INFINITY ; double supLimit = Double . POSITIVE_INFINITY ; List < Double > columnNormsList = new ArrayList < Double > ( ) ; switch ( p ) { case 2 : for ( int j = 0 ; j < A . getColumnDimension ( ) ; j ++ ) { columnNormsList . add ( A . getColumnVector ( j ) . getL1Norm ( ) ) ; } Collections . sort ( columnNormsList ) ; // kp > = Norm [ Ai , p ] / Norm [ Aj , p ] , for each i , j = 0,1 , . . . , n , Ak columns of A infLimit = columnNormsList . get ( columnNormsList . size ( ) - 1 ) / columnNormsList . get ( 0 ) ; break ; case Integer . MAX_VALUE : double normAInf = A . getNorm ( ) ; for ( int j = 0 ; j < A . getColumnDimension ( ) ; j ++ ) { columnNormsList . add ( A . getColumnVector ( j ) . getLInfNorm ( ) ) ; } Collections . sort ( columnNormsList ) ; // k1 > = Norm [ A , + oo ] / min { Norm [ Aj , + oo ] , for each j = 0,1 , . . . , n } , Ak columns of A infLimit = normAInf / columnNormsList . get ( 0 ) ; break ; default : throw new IllegalArgumentException ( "p must be 2 or Integer.MAX_VALUE" ) ; } return new double [ ] { infLimit , supLimit } ;
public class JDialogFactory { /** * Factory method for create a { @ link JDialog } object over the given { @ link JOptionPane } . * @ param parentComponent * the parent component * @ param pane * the pane * @ param title * the title * @ return the new { @ link JDialog } */ public static JDialog newJDialog ( Component parentComponent , @ NonNull JOptionPane pane , String title ) { } }
return parentComponent == null ? pane . createDialog ( parentComponent , title ) : pane . createDialog ( title ) ;
public class LocalDateTime { /** * Obtains an instance of { @ code LocalDateTime } from a date and time . * @ param date the local date , not null * @ param time the local time , not null * @ return the local date - time , not null */ public static LocalDateTime of ( LocalDate date , LocalTime time ) { } }
Objects . requireNonNull ( date , "date" ) ; Objects . requireNonNull ( time , "time" ) ; return new LocalDateTime ( date , time ) ;
public class CollationBuilder { /** * Counts the tailored nodes of the given strength up to the next node * which is either stronger or has an explicit weight of this strength . */ private static int countTailoredNodes ( long [ ] nodesArray , int i , int strength ) { } }
int count = 0 ; for ( ; ; ) { if ( i == 0 ) { break ; } long node = nodesArray [ i ] ; if ( strengthFromNode ( node ) < strength ) { break ; } if ( strengthFromNode ( node ) == strength ) { if ( isTailoredNode ( node ) ) { ++ count ; } else { break ; } } i = nextIndexFromNode ( node ) ; } return count ;
public class TriggerUpdateMarshaller { /** * Marshall the given parameter object . */ public void marshall ( TriggerUpdate triggerUpdate , ProtocolMarshaller protocolMarshaller ) { } }
if ( triggerUpdate == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( triggerUpdate . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( triggerUpdate . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( triggerUpdate . getSchedule ( ) , SCHEDULE_BINDING ) ; protocolMarshaller . marshall ( triggerUpdate . getActions ( ) , ACTIONS_BINDING ) ; protocolMarshaller . marshall ( triggerUpdate . getPredicate ( ) , PREDICATE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }