signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class MainScene { /** * Scale all widgets in Main Scene hierarchy
* @ param scale */
public void setScale ( final float scale ) { } }
|
if ( equal ( mScale , scale ) != true ) { Log . d ( TAG , "setScale(): old: %.2f, new: %.2f" , mScale , scale ) ; mScale = scale ; setScale ( mSceneRootObject , scale ) ; setScale ( mMainCameraRootObject , scale ) ; setScale ( mLeftCameraRootObject , scale ) ; setScale ( mRightCameraRootObject , scale ) ; for ( OnScaledListener listener : mOnScaledListeners ) { try { listener . onScaled ( scale ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; Log . e ( TAG , e , "setScale()" ) ; } } }
|
public class ControlMessageFactoryImpl { /** * Create a new , empty ControlNotFlushed Message
* @ return The new ControlNotFlushed
* @ exception MessageCreateFailedException Thrown if such a message can not be created */
public final ControlNotFlushed createNewControlNotFlushed ( ) throws MessageCreateFailedException { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createNewControlNotFlushed" ) ; ControlNotFlushed msg = null ; try { msg = new ControlNotFlushedImpl ( MfpConstants . CONSTRUCTOR_NO_OP ) ; } catch ( MessageDecodeFailedException e ) { /* No need to FFDC this as JsMsgObject will already have done so */
// No FFDC code needed
throw new MessageCreateFailedException ( e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createNewControlNotFlushed" ) ; return msg ;
|
public class DefaultCloseUpAlgorithm { /** * { @ inheritDoc } */
@ Override public int getFlingFinalY ( ScrollableLayout layout , boolean isScrollingBottom , int nowY , int suggestedY , int maxY ) { } }
|
return isScrollingBottom ? 0 : maxY ;
|
public class AmazonLightsailClient { /** * Deletes a specific static IP from your account .
* @ param releaseStaticIpRequest
* @ return Result of the ReleaseStaticIp operation returned by the service .
* @ throws ServiceException
* A general service exception .
* @ throws InvalidInputException
* Lightsail throws this exception when user input does not conform to the validation rules of an input
* field . < / p > < note >
* Domain - related APIs are only available in the N . Virginia ( us - east - 1 ) Region . Please set your AWS Region
* configuration to us - east - 1 to create , view , or edit these resources .
* @ throws NotFoundException
* Lightsail throws this exception when it cannot find a resource .
* @ throws OperationFailureException
* Lightsail throws this exception when an operation fails to execute .
* @ throws AccessDeniedException
* Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to
* access a resource .
* @ throws AccountSetupInProgressException
* Lightsail throws this exception when an account is still in the setup in progress state .
* @ throws UnauthenticatedException
* Lightsail throws this exception when the user has not been authenticated .
* @ sample AmazonLightsail . ReleaseStaticIp
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / lightsail - 2016-11-28 / ReleaseStaticIp " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public ReleaseStaticIpResult releaseStaticIp ( ReleaseStaticIpRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executeReleaseStaticIp ( request ) ;
|
public class PipeInterceptor { /** * 对于jsp , 则这个代码不会生效 ( isStarted会返回true ) */
@ Override public void afterCompletion ( Invocation inv , Throwable ex ) throws Exception { } }
|
if ( ex != null ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "close the pipe and returen because of exception previous." ) ; } return ; } PipeImpl pipe = ( PipeImpl ) PortalUtils . getPipe ( inv ) ; if ( pipe == null ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "there's no pipe windows." ) ; } return ; } if ( inv != inv . getHeadInvocation ( ) ) { return ; } if ( ! pipe . isStarted ( ) ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "writing " + pipe + "..." ) ; } pipe . write ( inv . getResponse ( ) . getWriter ( ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "writing " + pipe + "... done" ) ; } } else { if ( logger . isDebugEnabled ( ) ) { logger . debug ( pipe + " has been started yet." ) ; } }
|
public class Project { /** * Retrieves the total done for all workitems in this project optionally
* filtered .
* @ param filter Criteria to filter workitems on .
* @ param includeChildProjects If true , include open sub projects , otherwise
* only include this project .
* @ return total done for selected workitems . */
public Double getTotalDone ( WorkitemFilter filter , boolean includeChildProjects ) { } }
|
filter = ( filter != null ) ? filter : new WorkitemFilter ( ) ; return getRollup ( "Workitems" , "Actuals.Value" , filter , includeChildProjects ) ;
|
public class JsonSerializationContext { /** * Trace the current writer state
* @ param value current value */
private void traceWriterInfo ( Object value , JsonWriter writer ) { } }
|
if ( getLogger ( ) . isLoggable ( Level . INFO ) ) { getLogger ( ) . log ( Level . INFO , "Error on value <" + value + ">. Current output : <" + writer . getOutput ( ) + ">" ) ; }
|
public class FileUtilities { /** * Write text to a file in one line .
* @ param text the text to write .
* @ param file the file to write to .
* @ throws IOException */
public static void writeFile ( String text , File file ) throws IOException { } }
|
try ( BufferedWriter bw = new BufferedWriter ( new FileWriter ( file ) ) ) { bw . write ( text ) ; }
|
public class Timestamp { /** * Prints to an { @ code Appendable } the string representation ( in Ion format )
* of this Timestamp in UTC .
* This method produces the same output as { @ link # toZString ( ) } .
* @ param out not { @ code null }
* @ throws IOException propagated when the { @ code Appendable } throws it .
* @ see # print ( Appendable ) */
public void printZ ( Appendable out ) throws IOException { } }
|
switch ( _precision ) { case YEAR : case MONTH : case DAY : { assert _offset == UNKNOWN_OFFSET ; // No need to adjust offset , we won ' t be using it .
print ( out ) ; break ; } case MINUTE : case SECOND : case FRACTION : { Timestamp ztime = this . clone ( ) ; ztime . _offset = UTC_OFFSET ; ztime . print ( out ) ; break ; } }
|
public class SAMInputFormat { /** * Returns a { @ link SAMRecordReader } initialized with the parameters . */
@ Override public RecordReader < LongWritable , SAMRecordWritable > createRecordReader ( InputSplit split , TaskAttemptContext ctx ) throws InterruptedException , IOException { } }
|
final RecordReader < LongWritable , SAMRecordWritable > rr = new SAMRecordReader ( ) ; rr . initialize ( split , ctx ) ; return rr ;
|
public class CmsSearchDialog { /** * Creates the select widget configuration for the index names . < p >
* @ return the select widget configuration for the index names */
private List < CmsSelectWidgetOption > getSortNamesIndex ( ) { } }
|
List < CmsSelectWidgetOption > retVal = new ArrayList < CmsSelectWidgetOption > ( ) ; try { List < String > names = OpenCms . getSearchManager ( ) . getIndexNames ( ) ; for ( int i = 0 ; i < names . size ( ) ; i ++ ) { String indexName = names . get ( i ) ; String wpIndexName = getSettings ( ) . getUserSettings ( ) . getWorkplaceSearchIndexName ( ) ; boolean isDefault = indexName . toLowerCase ( ) . equals ( wpIndexName . toLowerCase ( ) ) ; retVal . add ( new CmsSelectWidgetOption ( names . get ( i ) , isDefault , names . get ( i ) ) ) ; } } catch ( Exception e ) { // noop
} return retVal ;
|
public class CmsMultiListDialog { /** * Display method for two list dialogs , executes actions , but only displays if needed . < p >
* @ param writeLater if < code > true < / code > no output is written ,
* you have to call manually the < code > { @ link # defaultActionHtml ( ) } < / code > method .
* @ throws JspException if dialog actions fail
* @ throws IOException if writing to the JSP out fails , or in case of errros forwarding to the required result page
* @ throws ServletException in case of errros forwarding to the required result page */
public void displayDialog ( boolean writeLater ) throws JspException , IOException , ServletException { } }
|
// perform the active list actions
m_activeWp . actionDialog ( ) ; if ( m_activeWp . isForwarded ( ) ) { return ; } Iterator < A_CmsListDialog > i = m_wps . iterator ( ) ; while ( i . hasNext ( ) ) { A_CmsListDialog wp = i . next ( ) ; wp . refreshList ( ) ; } if ( writeLater ) { return ; } writeDialog ( ) ;
|
public class ContainerDefImpl { /** * / * ( non - Javadoc )
* @ see org . jboss . arquillian . impl . configuration . api . ContainerDef # getProtcols ( ) */
@ Override public List < ProtocolDef > getProtocols ( ) { } }
|
List < ProtocolDef > protocols = new ArrayList < ProtocolDef > ( ) ; for ( Node proto : container . get ( "protocol" ) ) { protocols . add ( new ProtocolDefImpl ( getDescriptorName ( ) , getRootNode ( ) , container , proto ) ) ; } return protocols ;
|
public class ParameterAveragingTrainingMaster { /** * Create a ParameterAveragingTrainingMaster instance by deserializing a YAML string that has been serialized with
* { @ link # toYaml ( ) }
* @ param yamlStr ParameterAveragingTrainingMaster configuration serialized as YAML */
public static ParameterAveragingTrainingMaster fromYaml ( String yamlStr ) { } }
|
ObjectMapper om = getYamlMapper ( ) ; try { return om . readValue ( yamlStr , ParameterAveragingTrainingMaster . class ) ; } catch ( IOException e ) { throw new RuntimeException ( "Could not parse YAML" , e ) ; }
|
public class SequenceFile { /** * Construct the preferred type of ' raw ' SequenceFile Writer .
* @ param conf The configuration .
* @ param out The stream on top which the writer is to be constructed .
* @ param keyClass The ' key ' type .
* @ param valClass The ' value ' type .
* @ param compressionType The compression type .
* @ param codec The compression codec .
* @ param metadata The metadata of the file .
* @ return Returns the handle to the constructed SequenceFile Writer .
* @ throws IOException */
public static Writer createWriter ( Configuration conf , FSDataOutputStream out , Class keyClass , Class valClass , CompressionType compressionType , CompressionCodec codec , Metadata metadata ) throws IOException { } }
|
if ( ( codec instanceof GzipCodec ) && ! NativeCodeLoader . isNativeCodeLoaded ( ) && ! ZlibFactory . isNativeZlibLoaded ( conf ) ) { throw new IllegalArgumentException ( "SequenceFile doesn't work with " + "GzipCodec without native-hadoop code!" ) ; } Writer writer = null ; if ( compressionType == CompressionType . NONE ) { writer = new Writer ( conf , out , keyClass , valClass , metadata ) ; } else if ( compressionType == CompressionType . RECORD ) { writer = new RecordCompressWriter ( conf , out , keyClass , valClass , codec , metadata ) ; } else if ( compressionType == CompressionType . BLOCK ) { writer = new BlockCompressWriter ( conf , out , keyClass , valClass , codec , metadata ) ; } return writer ;
|
public class DispatcherServlet { /** * Handles all requests ( by default ) .
* @ param request HttpServletRequest object containing client request .
* @ param response HttpServletResponse object for the response . */
protected void doRequest ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { } }
|
InvocationContext context = null ; try { context = new InvocationContext ( request , response ) ; setContentType ( request , response ) ; Template template = handleRequest ( request , response , context ) ; if ( template != null ) { mergeTemplate ( template , context ) ; } } catch ( Exception e ) { log . warning ( "doRequest failed" , "uri" , request . getRequestURI ( ) , e ) ; response . sendError ( HttpServletResponse . SC_INTERNAL_SERVER_ERROR , e . getMessage ( ) ) ; }
|
public class SocketChannelListener { /** * @ see org . browsermob . proxy . jetty . http . HttpListener # getHost ( ) */
public String getHost ( ) { } }
|
if ( _address == null || _address . getAddress ( ) == null ) return null ; return _address . getHostName ( ) ;
|
public class FreeMarkerTag { /** * Gets an object from context - by name .
* @ param name name of object
* @ return object or null if not found . */
protected Object getUnwrapped ( Object name ) { } }
|
try { return DeepUnwrap . unwrap ( get ( name ) ) ; } catch ( TemplateException e ) { throw new ViewException ( e ) ; }
|
public class XPathUtils { /** * Creates a new { @ link XPathUtils } instance .
* @ param is The { @ link InputStream } with XML data .
* @ return A new { @ link XPathUtils } instance .
* @ throws SAXException If there ' s a SAX error in the XML .
* @ throws IOException If there ' s an IO error reading the stream . */
public static XPathUtils newXPath ( final InputStream is ) throws SAXException , IOException { } }
|
final XPathFactory xpfactory = XPathFactory . newInstance ( ) ; final XPath xPath = xpfactory . newXPath ( ) ; final Document doc = XmlUtils . toDoc ( is ) ; return new XPathUtils ( xPath , doc ) ;
|
public class DRL5Expressions { /** * src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 614:1 : innerCreator : { . . . } ? = > ID classCreatorRest ; */
public final void innerCreator ( ) throws RecognitionException { } }
|
try { // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 615:5 : ( { . . . } ? = > ID classCreatorRest )
// src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 615:7 : { . . . } ? = > ID classCreatorRest
{ if ( ! ( ( ! ( helper . validateIdentifierKey ( DroolsSoftKeywords . INSTANCEOF ) ) ) ) ) { if ( state . backtracking > 0 ) { state . failed = true ; return ; } throw new FailedPredicateException ( input , "innerCreator" , "!(helper.validateIdentifierKey(DroolsSoftKeywords.INSTANCEOF))" ) ; } match ( input , ID , FOLLOW_ID_in_innerCreator3530 ) ; if ( state . failed ) return ; pushFollow ( FOLLOW_classCreatorRest_in_innerCreator3532 ) ; classCreatorRest ( ) ; state . _fsp -- ; if ( state . failed ) return ; } } catch ( RecognitionException re ) { throw re ; } finally { // do for sure before leaving
}
|
public class DualInputSemanticProperties { /** * Adds , to the existing information , field ( s ) that are read in
* the source record ( s ) from the first input .
* @ param input the input of the read fields
* @ param readFields the position ( s ) in the source record ( s ) */
public void addReadFields ( int input , FieldSet readFields ) { } }
|
if ( input != 0 && input != 1 ) { throw new IndexOutOfBoundsException ( ) ; } else if ( input == 0 ) { this . readFields1 = ( this . readFields1 == null ) ? readFields . clone ( ) : this . readFields1 . addFields ( readFields ) ; } else { this . readFields2 = ( this . readFields2 == null ) ? readFields . clone ( ) : this . readFields2 . addFields ( readFields ) ; }
|
public class MaterialRippleLayout { /** * Drawing */
@ Override public void draw ( @ NonNull Canvas canvas ) { } }
|
final boolean positionChanged = adapterPositionChanged ( ) ; if ( rippleOverlay ) { super . draw ( canvas ) ; if ( ! positionChanged ) { if ( rippleRoundedCornersPx != 0 ) { Path clipPath = new Path ( ) ; RectF rect = new RectF ( 0 , 0 , canvas . getWidth ( ) , canvas . getHeight ( ) ) ; clipPath . addRoundRect ( rect , rippleRoundedCornersPx , rippleRoundedCornersPx , Path . Direction . CW ) ; canvas . clipPath ( clipPath ) ; } canvas . drawCircle ( currentCoordinates . x , currentCoordinates . y , radius , paint ) ; } } else { if ( ! positionChanged ) { canvas . drawCircle ( currentCoordinates . x , currentCoordinates . y , radius , paint ) ; } super . draw ( canvas ) ; }
|
public class CEMIFactory { /** * Creates a new cEMI message with information provided by < code > original < / code > , and adjusts it
* to match the supplied < code > msgCode < / code > and < code > data < / code > .
* The message code has to correspond to the type of cEMI frame supplied with
* < code > original < / code > . The byte length of data has to fit the cEMI frame type supplied with
* < code > original < / code > . < br >
* The < code > data < / code > argument varies according to the supplied message code . For L - Data
* frames , this is the tpdu , for busmonitor frames , this is the raw frame , for device management
* frames , this is the data part or error information .
* @ param msgCode the message code for the new cEMI frame
* @ param data the data for the frame
* @ param original the original frame providing all necessary information for the new frame
* @ return the new cEMI frame adjusted with message code and data
* @ throws KNXFormatException if cEMI message code is unsupported or frame creation failed */
public static CEMI create ( final int msgCode , final byte [ ] data , final CEMI original ) throws KNXFormatException { } }
|
switch ( msgCode ) { case CEMILData . MC_LDATA_REQ : case CEMILData . MC_LDATA_CON : case CEMILData . MC_LDATA_IND : return create ( msgCode , null , null , data , ( CEMILData ) original , false , ( ( CEMILData ) original ) . isRepetition ( ) ) ; case CEMIDevMgmt . MC_PROPREAD_REQ : case CEMIDevMgmt . MC_PROPREAD_CON : case CEMIDevMgmt . MC_PROPWRITE_REQ : case CEMIDevMgmt . MC_PROPWRITE_CON : case CEMIDevMgmt . MC_PROPINFO_IND : case CEMIDevMgmt . MC_RESET_REQ : case CEMIDevMgmt . MC_RESET_IND : { final CEMIDevMgmt f = ( CEMIDevMgmt ) original ; return new CEMIDevMgmt ( msgCode , f . getObjectType ( ) , f . getObjectInstance ( ) , f . getPID ( ) , f . getStartIndex ( ) , f . getElementCount ( ) , data ) ; } case CEMIBusMon . MC_BUSMON_IND : final CEMIBusMon f = ( CEMIBusMon ) original ; return CEMIBusMon . newWithStatus ( f . getStatus ( ) , f . getTimestamp ( ) , f . getTimestampType ( ) == CEMIBusMon . TYPEID_TIMESTAMP_EXT , data ) ; default : throw new KNXFormatException ( "unsupported cEMI msg code" , msgCode ) ; }
|
public class CompressionUtil { /** * Compress a file using the given { @ link CompressionMethod } .
* @ param _ method
* @ param _ sourceFile
* @ param _ outputFileName
* @ return file object which represents the compressed file or null on error */
public static File compress ( CompressionMethod _method , String _sourceFile , String _outputFileName ) { } }
|
if ( _method == null || _sourceFile == null ) { return null ; } File inputFile = new File ( _sourceFile ) ; if ( ! inputFile . exists ( ) ) { return null ; } byte [ ] buffer = new byte [ 1024 ] ; try { Constructor < ? extends DeflaterOutputStream > constructor = _method . getOutputStreamClass ( ) . getConstructor ( OutputStream . class ) ; if ( constructor != null ) { DeflaterOutputStream compressOutputStream = constructor . newInstance ( new FileOutputStream ( _outputFileName ) ) ; try ( FileInputStream in = new FileInputStream ( _sourceFile ) ) { int len ; while ( ( len = in . read ( buffer ) ) > 0 ) { compressOutputStream . write ( buffer , 0 , len ) ; } in . close ( ) ; compressOutputStream . finish ( ) ; compressOutputStream . close ( ) ; return new File ( _outputFileName ) ; } } } catch ( IOException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException _ex ) { LOGGER . error ( "Cannot uncompress file: " , _ex ) ; } return null ;
|
public class AmqpMessageDispatcherService { /** * Method to send a message to a RabbitMQ Exchange after a Target was
* deleted .
* @ param deleteEvent
* the TargetDeletedEvent which holds the necessary data for
* sending a target delete message . */
@ EventListener ( classes = TargetDeletedEvent . class ) protected void targetDelete ( final TargetDeletedEvent deleteEvent ) { } }
|
if ( isNotFromSelf ( deleteEvent ) ) { return ; } sendDeleteMessage ( deleteEvent . getTenant ( ) , deleteEvent . getControllerId ( ) , deleteEvent . getTargetAddress ( ) ) ;
|
public class MiscUtil { /** * Can be used to append a String to a formatter .
* @ param formatter
* The { @ link java . util . Formatter Formatter }
* @ param width
* Minimum width to meet , filled with space if needed
* @ param precision
* Maximum amount of characters to append
* @ param leftJustified
* Whether or not to left - justify the value
* @ param out
* The String to append */
public static void appendTo ( Formatter formatter , int width , int precision , boolean leftJustified , String out ) { } }
|
try { Appendable appendable = formatter . out ( ) ; if ( precision > - 1 && out . length ( ) > precision ) { appendable . append ( Helpers . truncate ( out , precision ) ) ; return ; } if ( leftJustified ) appendable . append ( Helpers . rightPad ( out , width ) ) ; else appendable . append ( Helpers . leftPad ( out , width ) ) ; } catch ( IOException e ) { throw new AssertionError ( e ) ; }
|
public class HSBColor { /** * Convert HSB ( Hue , Saturation , Brightness ) to RGB values .
* @ param hue
* @ param saturation
* @ param brightness
* @ return
* RGB values . */
private static final double [ ] getRGB ( double hue , double saturation , double brightness ) { } }
|
double [ ] rgb = { 0.0 , 0.0 , 0.0 } ; double tmpHue = hue * 360.0 ; int hi ; double f ; double p , q , t ; hi = ( int ) Math . floor ( tmpHue / 60.0 ) % 6 ; f = tmpHue / 60.0 - hi ; p = ( brightness * ( 1.0 - saturation ) ) ; q = ( brightness * ( 1.0 - saturation * f ) ) ; t = ( brightness * ( 1.0 - saturation * ( 1.0 - f ) ) ) ; switch ( hi ) { case 0 : rgb [ 0 ] = brightness ; rgb [ 1 ] = t ; rgb [ 2 ] = p ; break ; case 1 : rgb [ 0 ] = q ; rgb [ 1 ] = brightness ; rgb [ 2 ] = p ; break ; case 2 : rgb [ 0 ] = p ; rgb [ 1 ] = brightness ; rgb [ 2 ] = t ; break ; case 3 : rgb [ 0 ] = p ; rgb [ 1 ] = q ; rgb [ 2 ] = brightness ; break ; case 4 : rgb [ 0 ] = t ; rgb [ 1 ] = p ; rgb [ 2 ] = brightness ; break ; case 5 : rgb [ 0 ] = brightness ; rgb [ 1 ] = p ; rgb [ 2 ] = q ; break ; default : break ; } return rgb ;
|
public class WeekResultsPartitioner { /** * / * ( non - Javadoc )
* @ see org . archive . wayback . resultspartitioner . ResultsPartitioner # alignStart ( java . util . Calendar ) */
protected void alignStart ( Calendar start ) { } }
|
start . set ( Calendar . HOUR_OF_DAY , 1 ) ; start . set ( Calendar . MINUTE , 1 ) ; start . set ( Calendar . SECOND , 1 ) ;
|
public class RedisCache { /** * Replaces the entry for a key only if currently mapped to some value .
* This is equivalent to
* < pre >
* if ( map . containsKey ( key ) ) {
* return map . put ( key , value ) ;
* } else return null ; < / pre >
* except that the action is performed atomically .
* @ param key key with which the specified value is associated
* @ param value value to be associated with the specified key
* @ return the previous value associated with the specified key , or
* < tt > null < / tt > if there was no mapping for the key .
* ( A < tt > null < / tt > return can also indicate that the map
* previously associated < tt > null < / tt > with the key ,
* if the implementation supports null values . )
* @ throws UnsupportedOperationException if the < tt > put < / tt > operation
* is not supported by this map
* @ throws ClassCastException if the class of the specified key or value
* prevents it from being stored in this map
* @ throws NullPointerException if the specified key or value is null ,
* and this map does not permit null keys or values
* @ throws IllegalArgumentException if some property of the specified key
* or value prevents it from being stored in this map */
@ Override public V replace ( K key , V value ) { } }
|
return rMap . replace ( key , value ) ;
|
public class BinarySet { /** * { @ inheritDoc }
* @ param e
* @ return */
@ Override public E lower ( E e ) { } }
|
int idx = indexOf ( e ) ; if ( idx >= 1 ) { return list . get ( idx - 1 ) ; } else { int ip = insertPoint ( idx ) ; if ( ip >= 1 ) { return list . get ( ip - 1 ) ; } else { return null ; } }
|
public class CmsGalleryField { /** * Sets the image preview . < p >
* @ param realPath the actual image path
* @ param imagePath the image path */
protected void setImagePreview ( String realPath , String imagePath ) { } }
|
if ( ( m_croppingParam == null ) || ! getFormValueAsString ( ) . contains ( m_croppingParam . toString ( ) ) ) { m_croppingParam = CmsCroppingParamBean . parseImagePath ( getFormValueAsString ( ) ) ; } CmsCroppingParamBean restricted ; int marginTop = 0 ; if ( m_croppingParam . getScaleParam ( ) . isEmpty ( ) ) { imagePath += "?__scale=w:165,h:114,t:1,c:white,r:0" ; } else { restricted = m_croppingParam . getRestrictedSizeParam ( 114 , 165 ) ; imagePath += "?" + restricted . toString ( ) ; marginTop = ( 114 - restricted . getResultingHeight ( ) ) / 2 ; } Element image = DOM . createImg ( ) ; image . setAttribute ( "src" , imagePath ) ; image . getStyle ( ) . setMarginTop ( marginTop , Unit . PX ) ; if ( CmsClientStringUtil . checkIsPathOrLinkToSvg ( realPath ) ) { image . getStyle ( ) . setWidth ( 100 , Unit . PCT ) ; image . getStyle ( ) . setHeight ( 100 , Unit . PCT ) ; } m_imagePreview . setInnerHTML ( "" ) ; m_imagePreview . appendChild ( image ) ;
|
public class UpgradeProcess { /** * Deploys a bundle .
* @ param bundleLocation
* Location of a jar file or a maven project where target / classes contains every necessary entries .
* @ param startBundle
* Whether to try calling start on the installed bundle or not . If the bundle is a fragment bundle , start
* will not be called .
* @ param startLevel
* The new start level of the bundle . If null , the startlevel of the original bundle will be used or the
* startLevel of the framework when the process was started .
* @ return The deployed bundle . */
public synchronized Bundle deployBundle ( final URI bundleLocation , final boolean startBundle , final Integer startLevel ) { } }
|
stateChanged = true ; if ( startLevel != null && startLevel < currentFrameworkStartLevelValue ) { setFrameworkStartLevel ( startLevel ) ; } File bundleFile = convertURIToFile ( bundleLocation ) ; String bundleLocationString = bundleLocation . toString ( ) ; Bundle installedBundle = null ; BundleData bundleData = getBundleData ( bundleFile ) ; if ( bundleData == null ) { return null ; } URI realBundleLocation = bundleLocation ; if ( ! bundleData . getEvaluatedLocationFile ( ) . getAbsoluteFile ( ) . equals ( bundleFile . getAbsoluteFile ( ) ) ) { String newRealBundleLocationStr = "reference:" + bundleData . getEvaluatedLocationFile ( ) . toURI ( ) . toString ( ) ; try { realBundleLocation = new URI ( newRealBundleLocationStr ) ; } catch ( URISyntaxException e ) { Logger . error ( "Real bundle location canno be parsed as an URI: " + newRealBundleLocationStr , e ) ; } } Bundle originalBundle = bundleDeployerService . getExistingBundleBySymbolicName ( bundleData . getSymbolicName ( ) , bundleData . getVersion ( ) , bundleLocation ) ; if ( originalBundle != null ) { installedBundlesWithStartFlag . remove ( originalBundle ) ; BundleStartLevel originalBundleStartLevel = originalBundle . adapt ( BundleStartLevel . class ) ; int originalBundleStartLevelValue = originalBundleStartLevel . getStartLevel ( ) ; if ( originalBundleStartLevelValue < currentFrameworkStartLevelValue ) { setFrameworkStartLevel ( originalBundleStartLevelValue ) ; } if ( originalBundle . getLocation ( ) . equals ( bundleLocation ) ) { try { if ( originalBundle . getState ( ) == Bundle . ACTIVE ) { Logger . info ( "Stopping already existing bundle " + originalBundle . toString ( ) ) ; originalBundle . stop ( ) ; } Logger . info ( "Calling update on bundle " + originalBundle . toString ( ) ) ; originalBundle . update ( ) ; installedBundle = originalBundle ; BundleStartLevel installedBundleStartLevel = installedBundle . adapt ( BundleStartLevel . class ) ; if ( startLevel != null && ! startLevel . equals ( installedBundleStartLevel . getStartLevel ( ) ) ) { installedBundleStartLevel . setStartLevel ( startLevel ) ; } } catch ( BundleException e ) { Logger . error ( "Error during deploying bundle: " + bundleLocationString , e ) ; } } else { try { Logger . info ( "Uninstalling Bundle " + originalBundle . getSymbolicName ( ) + ":" + originalBundle . getVersion ( ) . toString ( ) ) ; originalBundle . uninstall ( ) ; Logger . info ( "Installing bundle from '" + bundleLocationString + "'" ) ; installedBundle = systemBundleContext . installBundle ( realBundleLocation . toString ( ) ) ; BundleStartLevel newBundleStartLevel = installedBundle . adapt ( BundleStartLevel . class ) ; if ( startLevel == null ) { newBundleStartLevel . setStartLevel ( originalBundleStartLevelValue ) ; } else { newBundleStartLevel . setStartLevel ( startLevel ) ; } } catch ( BundleException e ) { Logger . error ( "Error during deploying bundle: " + bundleLocationString , e ) ; } } } else { try { Integer startLevelToUse = startLevel ; if ( startLevelToUse == null ) { startLevelToUse = originalFrameworkStartLevelValue ; } Logger . info ( "Installing new bundle from folder '" + bundleLocationString + "' with startLevel " + startLevelToUse ) ; installedBundle = systemBundleContext . installBundle ( realBundleLocation . toString ( ) ) ; BundleStartLevel bundleStartLevel = installedBundle . adapt ( BundleStartLevel . class ) ; bundleStartLevel . setStartLevel ( startLevelToUse ) ; } catch ( BundleException e ) { Logger . error ( "Error during deploying bundle: " + bundleLocationString , e ) ; } } if ( startBundle && installedBundle != null ) { installedBundlesWithStartFlag . add ( installedBundle ) ; } return installedBundle ;
|
public class TrailingHeaders { /** * Adds an HTTP trailing header with the passed { @ code name } and { @ code value } to this request .
* @ param name Name of the header .
* @ param value Value for the header .
* @ return { @ code this } . */
public TrailingHeaders addHeader ( CharSequence name , Object value ) { } }
|
lastHttpContent . trailingHeaders ( ) . add ( name , value ) ; return this ;
|
public class WebStatFilter { /** * < p > isExclusion . < / p >
* @ param requestURI a { @ link java . lang . String } object .
* @ return a boolean . */
public boolean isExclusion ( String requestURI ) { } }
|
if ( excludesPattern == null ) { return false ; } if ( contextPath != null && requestURI . startsWith ( contextPath ) ) { requestURI = requestURI . substring ( contextPath . length ( ) ) ; if ( ! requestURI . startsWith ( "/" ) ) { requestURI = "/" + requestURI ; } } for ( String pattern : excludesPattern ) { if ( pathMatcher . matches ( pattern , requestURI ) ) { return true ; } } return false ;
|
public class ImgUtil { /** * 给图片添加文字水印 < br >
* 此方法并不关闭流
* @ param srcImage 源图像
* @ param destFile 目标流
* @ param pressText 水印文字
* @ param color 水印的字体颜色
* @ param font { @ link Font } 字体相关信息 , 如果默认则为 { @ code null }
* @ param x 修正值 。 默认在中间 , 偏移量相对于中间偏移
* @ param y 修正值 。 默认在中间 , 偏移量相对于中间偏移
* @ param alpha 透明度 : alpha 必须是范围 [ 0.0 , 1.0 ] 之内 ( 包含边界值 ) 的一个浮点数字
* @ throws IORuntimeException IO异常
* @ since 3.2.2 */
public static void pressText ( Image srcImage , File destFile , String pressText , Color color , Font font , int x , int y , float alpha ) throws IORuntimeException { } }
|
write ( pressText ( srcImage , pressText , color , font , x , y , alpha ) , destFile ) ;
|
public class mps_network_config { /** * Use this API to fetch filtered set of mps _ network _ config resources .
* filter string should be in JSON format . eg : " vm _ state : DOWN , name : [ a - z ] + " */
public static mps_network_config [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } }
|
mps_network_config obj = new mps_network_config ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; mps_network_config [ ] response = ( mps_network_config [ ] ) obj . getfiltered ( service , option ) ; return response ;
|
public class Base64Serializer { /** * Serialize object to an encoded base64 string . */
public String serialize ( Object object ) { } }
|
ObjectOutputStream oos = null ; ByteArrayOutputStream bos = null ; try { bos = new ByteArrayOutputStream ( ) ; oos = new ObjectOutputStream ( bos ) ; oos . writeObject ( object ) ; return new String ( Base64 . encodeBase64 ( bos . toByteArray ( ) ) ) ; } catch ( IOException e ) { LOGGER . error ( "Can't serialize data on Base 64" , e ) ; throw new IllegalArgumentException ( e ) ; } catch ( Exception e ) { LOGGER . error ( "Can't serialize data on Base 64" , e ) ; throw new IllegalArgumentException ( e ) ; } finally { try { if ( bos != null ) { bos . close ( ) ; } } catch ( Exception e ) { LOGGER . error ( "Can't close ObjetInputStream used for serialize data on Base 64" , e ) ; } }
|
public class ClassBuilder { /** * Add the static inner Binder wrapper */
private TypeSpec getBinderWrapper ( ) { } }
|
TypeSpec . Builder staticBinderWrapperClassBuilder = TypeSpec . classBuilder ( "BinderWrapper" ) . addModifiers ( Modifier . PRIVATE ) . addModifiers ( Modifier . STATIC ) . addField ( ClassName . get ( "android.os" , "IBinder" ) , "binder" , Modifier . PRIVATE ) . addMethod ( MethodSpec . constructorBuilder ( ) . addParameter ( ClassName . get ( "android.os" , "IBinder" ) , "binder" ) . addStatement ( "this.binder = binder" ) . build ( ) ) . addMethod ( MethodSpec . methodBuilder ( "asBinder" ) . addModifiers ( Modifier . PUBLIC ) . addAnnotation ( Override . class ) . returns ( ClassName . get ( "android.os" , "IBinder" ) ) . addStatement ( "return binder" ) . build ( ) ) . addSuperinterface ( ClassName . get ( "android.os" , "IInterface" ) ) ; return staticBinderWrapperClassBuilder . build ( ) ;
|
public class CmsCoreService { /** * Returns the workplace link . < p >
* @ param cms the cms context
* @ param structureId the structure id of the current resource
* @ return the workplace link */
public static String getVaadinWorkplaceLink ( CmsObject cms , CmsUUID structureId ) { } }
|
String resourceRootFolder = null ; if ( structureId != null ) { try { resourceRootFolder = CmsResource . getFolderPath ( cms . readResource ( structureId , CmsResourceFilter . ONLY_VISIBLE_NO_DELETED ) . getRootPath ( ) ) ; } catch ( CmsException e ) { LOG . debug ( "Error reading resource for workplace link." , e ) ; } } if ( resourceRootFolder == null ) { resourceRootFolder = cms . getRequestContext ( ) . getSiteRoot ( ) ; } return getVaadinWorkplaceLink ( cms , resourceRootFolder ) ;
|
public class ParadataManager { /** * Return all paradata for a resource of all types from all submitters for the resource
* @ param resourceUrl
* @ return
* @ throws Exception */
public List < ISubmission > getSubmissions ( String resourceUrl ) throws Exception { } }
|
ParadataFetcher fetcher = new ParadataFetcher ( node , resourceUrl ) ; return fetcher . getSubmissions ( ) ;
|
public class CodedInputStream { /** * Reads a varint from the input one byte at a time , so that it does not
* read any bytes after the end of the varint . If you simply wrapped the
* stream in a CodedInputStream and used { @ link # readRawVarint32 ( InputStream ) }
* then you would probably end up reading past the end of the varint since
* CodedInputStream buffers its input . */
static int readRawVarint32 ( final InputStream input ) throws IOException { } }
|
final int firstByte = input . read ( ) ; if ( firstByte == - 1 ) { throw InvalidProtocolBufferException . truncatedMessage ( ) ; } return readRawVarint32 ( firstByte , input ) ;
|
public class JCudnn { /** * < pre >
* Retrieve the settings currently stored in an LRN layer descriptor
* Any of the provided pointers can be NULL ( no corresponding value will be returned )
* < / pre > */
public static int cudnnGetLRNDescriptor ( cudnnLRNDescriptor normDesc , int [ ] lrnN , double [ ] lrnAlpha , double [ ] lrnBeta , double [ ] lrnK ) { } }
|
return checkResult ( cudnnGetLRNDescriptorNative ( normDesc , lrnN , lrnAlpha , lrnBeta , lrnK ) ) ;
|
public class SameDiff { /** * Update the opName for the variable
* with the given vertex id
* @ param varName the vertex id to update
* @ param withName thew new opName */
public void updateVariableName ( String varName , String withName ) { } }
|
SDVariable oldVarNameRef = getVariable ( varName ) ; Variable v = variables . remove ( varName ) ; String oldVarName = varName ; oldVarNameRef . setVarName ( withName ) ; v . setName ( withName ) ; variables . put ( withName , v ) ; for ( SameDiffOp op : ops . values ( ) ) { List < String > outputsOfOp = op . getOutputsOfOp ( ) ; if ( outputsOfOp != null && ! outputsOfOp . isEmpty ( ) ) { for ( int i = 0 ; i < outputsOfOp . size ( ) ; i ++ ) { if ( outputsOfOp . get ( i ) . equals ( oldVarName ) ) { outputsOfOp . set ( i , withName ) ; } } } List < String > inputsToOp = op . getInputsToOp ( ) ; if ( inputsToOp != null && ! inputsToOp . isEmpty ( ) ) { for ( int i = 0 ; i < inputsToOp . size ( ) ; i ++ ) { if ( inputsToOp . get ( i ) . equals ( oldVarName ) ) { inputsToOp . set ( i , withName ) ; } } } } // if ( variableNameToArr . containsKey ( oldVarName ) ) {
// val arr = variableNameToArr . remove ( oldVarName ) ;
// variableNameToArr . put ( withName , arr ) ;
if ( variableNameToShape . containsKey ( oldVarName ) ) { val shape = variableNameToShape . remove ( oldVarName ) ; variableNameToShape . put ( withName , shape ) ; } if ( forwardVarForGrad . containsKey ( oldVarName ) ) { val forwardGrad = forwardVarForGrad . remove ( oldVarName ) ; forwardVarForGrad . put ( withName , forwardGrad ) ; } if ( v . getInputsForOp ( ) != null ) { List < String > funcNames = v . getInputsForOp ( ) ; for ( String s : funcNames ) { DifferentialFunction func = ops . get ( s ) . getOp ( ) ; if ( func instanceof BaseOp ) { BaseOp baseOp = ( BaseOp ) func ; if ( baseOp . getXVertexId ( ) != null && baseOp . getXVertexId ( ) . equals ( oldVarName ) ) { baseOp . setXVertexId ( withName ) ; } if ( baseOp . getYVertexId ( ) != null && baseOp . getYVertexId ( ) . equals ( oldVarName ) ) { baseOp . setYVertexId ( withName ) ; } if ( baseOp . getZVertexId ( ) != null && baseOp . getZVertexId ( ) . equals ( oldVarName ) ) { baseOp . setZVertexId ( withName ) ; } } } } if ( v . getOutputOfOp ( ) != null ) { DifferentialFunction func = ops . get ( v . getOutputOfOp ( ) ) . getOp ( ) ; if ( func instanceof BaseOp ) { BaseOp baseOp = ( BaseOp ) func ; if ( baseOp . getXVertexId ( ) != null && baseOp . getXVertexId ( ) . equals ( oldVarName ) ) { baseOp . setXVertexId ( withName ) ; } if ( baseOp . getYVertexId ( ) != null && baseOp . getYVertexId ( ) . equals ( oldVarName ) ) { baseOp . setYVertexId ( withName ) ; } if ( baseOp . getZVertexId ( ) != null && baseOp . getZVertexId ( ) . equals ( oldVarName ) ) { baseOp . setZVertexId ( withName ) ; } } }
|
public class JdkLog { /** * 打印对应等级的日志
* @ param callerFQCN
* @ param level 等级
* @ param throwable 异常对象
* @ param format 消息模板
* @ param arguments 参数 */
private void logIfEnabled ( String callerFQCN , Level level , Throwable throwable , String format , Object [ ] arguments ) { } }
|
if ( logger . isLoggable ( level ) ) { LogRecord record = new LogRecord ( level , StrUtil . format ( format , arguments ) ) ; record . setLoggerName ( getName ( ) ) ; record . setThrown ( throwable ) ; fillCallerData ( callerFQCN , record ) ; logger . log ( record ) ; }
|
public class NoxItemCatalog { /** * Returns the ImageLoader . Listener associated to a NoxItem given a position . If the
* ImageLoader . Listener wasn ' t previously created , creates a new instance . */
private ImageLoader . Listener getImageLoaderListener ( final int position ) { } }
|
if ( listeners [ position ] == null ) { listeners [ position ] = new NoxItemCatalogImageLoaderListener ( position , this ) ; } return listeners [ position ] ;
|
public class FileSystem { /** * Returns a reference to the { @ link FileSystem } instance for accessing the
* file system identified by the given { @ link URI } .
* @ param uri
* the { @ link URI } identifying the file system
* @ return a reference to the { @ link FileSystem } instance for accessing the file system identified by the given
* { @ link URI } .
* @ throws IOException
* thrown if a reference to the file system instance could not be obtained */
public static FileSystem get ( URI uri ) throws IOException { } }
|
FileSystem fs = null ; synchronized ( SYNCHRONIZATION_OBJECT ) { if ( uri . getScheme ( ) == null ) { try { uri = new URI ( "file" , null , uri . getPath ( ) , null ) ; } catch ( URISyntaxException e ) { // we tried to repair it , but could not . report the scheme error
throw new IOException ( "FileSystem: Scheme is null. file:// or hdfs:// are example schemes." ) ; } } final FSKey key = new FSKey ( uri . getScheme ( ) , uri . getAuthority ( ) ) ; // See if there is a file system object in the cache
if ( CACHE . containsKey ( key ) ) { return CACHE . get ( key ) ; } // Try to create a new file system
if ( ! FSDIRECTORY . containsKey ( uri . getScheme ( ) ) ) { throw new IOException ( "No file system found with scheme " + uri . getScheme ( ) ) ; } Class < ? extends FileSystem > fsClass = null ; try { fsClass = ClassUtils . getFileSystemByName ( FSDIRECTORY . get ( uri . getScheme ( ) ) ) ; } catch ( ClassNotFoundException e1 ) { throw new IOException ( StringUtils . stringifyException ( e1 ) ) ; } try { fs = fsClass . newInstance ( ) ; } catch ( InstantiationException e ) { throw new IOException ( "Could not instantiate file system class: " + e . getMessage ( ) , e ) ; } catch ( IllegalAccessException e ) { throw new IOException ( "Could not instantiate file system class: " + e . getMessage ( ) , e ) ; } // Initialize new file system object
fs . initialize ( uri ) ; // Add new file system object to cache
CACHE . put ( key , fs ) ; } return fs ;
|
public class Interval { /** * Return the number of semitones between 2 notes spaced by
* this Interval */
public int getSemitones ( ) { } }
|
int semitones = 0 ; switch ( getLabel ( ) % OCTAVE ) { case UNISON : semitones = 0 ; break ; // unison
case SECOND : semitones = 2 ; break ; // major 2nd
case THIRD : semitones = 4 ; break ; // major 3rd
case FOURTH : semitones = 5 ; break ; // perfect 4th
case FIFTH : semitones = 7 ; break ; // perfect 5th
case SIXTH : semitones = 9 ; break ; // major 6th
case SEVENTH : semitones = 11 ; break ; // major 7th
} switch ( getQuality ( ) ) { case QUADRUPLE_DIMINISHED : case TRIPLE_DIMINISHED : case DOUBLE_DIMINISHED : case DIMINISHED : if ( allowPerfectQuality ( ) ) semitones += getQuality ( ) + 1 ; else semitones += getQuality ( ) ; break ; case MINOR : semitones -= 1 ; break ; case PERFECT : case MAJOR : break ; // do not change pitch for major and perfect
case AUGMENTED : case DOUBLE_AUGMENTED : case TRIPLE_AUGMENTED : case QUADRUPLE_AUGMENTED : semitones += getQuality ( ) - 1 ; break ; } semitones += 12 * getOctaveNumber ( ) ; return semitones ;
|
public class ClientExecutorServiceProxy { /** * submit to key */
@ Override public < T > Future < T > submitToKeyOwner ( Callable < T > task , Object key ) { } }
|
return submitToKeyOwnerInternal ( task , key , null , false ) ;
|
public class AutomationExecutionMetadata { /** * The specified key - value mapping of document parameters to target resources .
* @ param targetMaps
* The specified key - value mapping of document parameters to target resources .
* @ return Returns a reference to this object so that method calls can be chained together . */
public AutomationExecutionMetadata withTargetMaps ( java . util . Collection < java . util . Map < String , java . util . List < String > > > targetMaps ) { } }
|
setTargetMaps ( targetMaps ) ; return this ;
|
public class WaCkypediaDocumentIterator { /** * Returns the next document from the file . */
public synchronized Document next ( ) { } }
|
Document next = new StringDocument ( nextLine ) ; try { nextLine = advance ( ) ; } catch ( IOException ioe ) { throw new IOError ( ioe ) ; } return next ;
|
public class ScreenshotUtils { /** * Returns a double between 0 and 1.0 */
private static double similarity ( BufferedImage var , BufferedImage cont ) { } }
|
double [ ] varArr = new double [ var . getWidth ( ) * var . getHeight ( ) * 3 ] ; double [ ] contArr = new double [ cont . getWidth ( ) * cont . getHeight ( ) * 3 ] ; if ( varArr . length != contArr . length ) throw new IllegalStateException ( "The pictures are different sizes!" ) ; // unroll pixels
for ( int i = 0 ; i < var . getHeight ( ) ; i ++ ) { for ( int j = 0 ; j < var . getWidth ( ) ; j ++ ) { varArr [ i * var . getWidth ( ) + j + 0 ] = new Color ( var . getRGB ( j , i ) ) . getRed ( ) ; contArr [ i * cont . getWidth ( ) + j + 0 ] = new Color ( cont . getRGB ( j , i ) ) . getRed ( ) ; varArr [ i * var . getWidth ( ) + j + 1 ] = new Color ( var . getRGB ( j , i ) ) . getGreen ( ) ; contArr [ i * cont . getWidth ( ) + j + 1 ] = new Color ( cont . getRGB ( j , i ) ) . getGreen ( ) ; varArr [ i * var . getWidth ( ) + j + 2 ] = new Color ( var . getRGB ( j , i ) ) . getBlue ( ) ; contArr [ i * cont . getWidth ( ) + j + 2 ] = new Color ( cont . getRGB ( j , i ) ) . getBlue ( ) ; } } double mins = 0 ; double maxs = 0 ; for ( int i = 0 ; i != varArr . length ; i ++ ) { if ( varArr [ i ] > contArr [ i ] ) { mins += contArr [ i ] ; maxs += varArr [ i ] ; } else { mins += varArr [ i ] ; maxs += contArr [ i ] ; } } return mins / maxs ;
|
public class BunyanLayout { /** * Format the event as a Bunyan style JSON object . */
private String format ( LogEvent event ) { } }
|
JsonObject jsonEvent = new JsonObject ( ) ; jsonEvent . addProperty ( "v" , 0 ) ; jsonEvent . addProperty ( "level" , BUNYAN_LEVEL . get ( event . getLevel ( ) ) ) ; jsonEvent . addProperty ( "levelStr" , event . getLevel ( ) . toString ( ) ) ; jsonEvent . addProperty ( "name" , event . getLoggerName ( ) ) ; try { jsonEvent . addProperty ( "hostname" , InetAddress . getLocalHost ( ) . getHostName ( ) ) ; } catch ( UnknownHostException e ) { jsonEvent . addProperty ( "hostname" , "unkown" ) ; } jsonEvent . addProperty ( "pid" , event . getThreadId ( ) ) ; jsonEvent . addProperty ( "time" , formatAsIsoUTCDateTime ( event . getTimeMillis ( ) ) ) ; jsonEvent . addProperty ( "msg" , event . getMessage ( ) . getFormattedMessage ( ) ) ; jsonEvent . addProperty ( "src" , event . getSource ( ) . getClassName ( ) ) ; if ( event . getLevel ( ) . isMoreSpecificThan ( Level . WARN ) && event . getThrown ( ) != null ) { JsonObject jsonError = new JsonObject ( ) ; Throwable e = event . getThrown ( ) ; jsonError . addProperty ( "message" , e . getMessage ( ) ) ; jsonError . addProperty ( "name" , e . getClass ( ) . getSimpleName ( ) ) ; StringWriter sw = new StringWriter ( ) ; PrintWriter pw = new PrintWriter ( sw ) ; e . printStackTrace ( pw ) ; jsonError . addProperty ( "stack" , sw . toString ( ) ) ; jsonEvent . add ( "err" , jsonError ) ; } return GSON . toJson ( jsonEvent ) + "\n" ;
|
public class FunctionExpression { /** * Function range . Generate a list spanning a range of values
* @ param formatter
* current CSS output
* @ return The operation representing a list of values */
private Operation range ( CssFormatter formatter ) { } }
|
type = LIST ; double start = get ( 0 ) . doubleValue ( formatter ) ; double end ; if ( parameters . size ( ) >= 2 ) { end = get ( 1 ) . doubleValue ( formatter ) ; } else { end = start ; start = 1 ; } double step ; if ( parameters . size ( ) >= 3 ) { step = get ( 2 ) . doubleValue ( formatter ) ; } else { step = 1 ; } String unit = get ( 0 ) . unit ( formatter ) ; Operation op = new Operation ( this , ' ' ) ; while ( start <= end ) { op . addOperand ( new ValueExpression ( this , start + unit ) ) ; start += step ; } return op ;
|
public class ChineseUtils { /** * 转换成中文拼音字符串 。
* @ param str
* 输入的字符串 。
* @ param format
* 输出拼音的格式 。
* @ return 转换后的中文拼音字符串 。 */
public static String toPinyin ( String str , PinyinFormat format ) { } }
|
return Pinyin . INSTANCE . convert ( str , format ) ;
|
public class Months { /** * Subtracts this amount from the specified temporal object .
* This returns a temporal object of the same observable type as the input
* with this amount subtracted .
* In most cases , it is clearer to reverse the calling pattern by using
* { @ link Temporal # minus ( TemporalAmount ) } .
* < pre >
* / / these two lines are equivalent , but the second approach is recommended
* dateTime = thisAmount . subtractFrom ( dateTime ) ;
* dateTime = dateTime . minus ( thisAmount ) ;
* < / pre >
* Only non - zero amounts will be subtracted .
* This instance is immutable and unaffected by this method call .
* @ param temporal the temporal object to adjust , not null
* @ return an object of the same type with the adjustment made , not null
* @ throws DateTimeException if unable to subtract
* @ throws UnsupportedTemporalTypeException if the MONTHS unit is not supported
* @ throws ArithmeticException if numeric overflow occurs */
@ Override public Temporal subtractFrom ( Temporal temporal ) { } }
|
if ( months != 0 ) { temporal = temporal . minus ( months , MONTHS ) ; } return temporal ;
|
public class Scanners { /** * A scanner that matches the input against the specified string case insensitively .
* @ param str the string to match
* @ return the scanner . */
public static Parser < Void > stringCaseInsensitive ( String str ) { } }
|
return Patterns . stringCaseInsensitive ( str ) . toScanner ( str ) ;
|
public class KeyVaultClientBaseImpl { /** * Permanently deletes the specified storage account .
* The purge deleted storage account operation removes the secret permanently , without the possibility of recovery . This operation can only be performed on a soft - delete enabled vault . This operation requires the storage / purge permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param storageAccountName The name of the storage account .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponse } object if successful . */
public Observable < ServiceResponse < Void > > purgeDeletedStorageAccountWithServiceResponseAsync ( String vaultBaseUrl , String storageAccountName ) { } }
|
if ( vaultBaseUrl == null ) { throw new IllegalArgumentException ( "Parameter vaultBaseUrl is required and cannot be null." ) ; } if ( storageAccountName == null ) { throw new IllegalArgumentException ( "Parameter storageAccountName is required and cannot be null." ) ; } if ( this . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.apiVersion() is required and cannot be null." ) ; } String parameterizedHost = Joiner . on ( ", " ) . join ( "{vaultBaseUrl}" , vaultBaseUrl ) ; return service . purgeDeletedStorageAccount ( storageAccountName , this . apiVersion ( ) , this . acceptLanguage ( ) , parameterizedHost , this . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Void > > > ( ) { @ Override public Observable < ServiceResponse < Void > > call ( Response < ResponseBody > response ) { try { ServiceResponse < Void > clientResponse = purgeDeletedStorageAccountDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
|
public class ImportOrderParser { /** * Parse import order string and create appropriate { @ link ImportOrganizer } .
* @ param importOrder the import order , either static - first or static - last .
* @ return the { @ link ImportOrganizer } */
public static ImportOrganizer getImportOrganizer ( String importOrder ) { } }
|
switch ( importOrder ) { case "static-first" : return ImportOrganizer . STATIC_FIRST_ORGANIZER ; case "static-last" : return ImportOrganizer . STATIC_LAST_ORGANIZER ; case "android-static-first" : return ImportOrganizer . ANDROID_STATIC_FIRST_ORGANIZER ; case "android-static-last" : return ImportOrganizer . ANDROID_STATIC_LAST_ORGANIZER ; default : throw new IllegalStateException ( "Unknown import order: '" + importOrder + "'" ) ; }
|
public class EmailData { /** * Utility method for converting different fields to a single
* { @ link IMutableEmailData } .
* @ param eEmailType
* The type of the email .
* @ param aSender
* The sender address .
* @ param aReceiver
* The receiver address .
* @ param sSubject
* The subject line .
* @ param sBody
* The mail body text .
* @ param aAttachments
* Any attachments to use . May be < code > null < / code > .
* @ return The created { @ link EmailData } and never < code > null < / code > . */
@ Nonnull public static EmailData createEmailData ( @ Nonnull final EEmailType eEmailType , @ Nullable final IEmailAddress aSender , @ Nullable final IEmailAddress aReceiver , @ Nullable final String sSubject , @ Nullable final String sBody , @ Nullable final IMutableEmailAttachmentList aAttachments ) { } }
|
final EmailData aEmailData = new EmailData ( eEmailType ) ; aEmailData . setFrom ( aSender ) ; aEmailData . setTo ( aReceiver ) ; aEmailData . setSubject ( sSubject ) ; aEmailData . setBody ( sBody ) ; aEmailData . setAttachments ( aAttachments ) ; return aEmailData ;
|
public class VocabularyHolder { /** * This methods reset counters for all words in vocabulary */
public void resetWordCounters ( ) { } }
|
for ( VocabularyWord word : getVocabulary ( ) ) { word . setHuffmanNode ( null ) ; word . setFrequencyShift ( null ) ; word . setCount ( 0 ) ; }
|
public class StatementDMQL { /** * For the creation of the statement */
@ Override public void setGeneratedColumnInfo ( int generate , ResultMetaData meta ) { } }
|
// can support INSERT _ SELECT also
if ( type != StatementTypes . INSERT ) { return ; } int colIndex = baseTable . getIdentityColumnIndex ( ) ; if ( colIndex == - 1 ) { return ; } switch ( generate ) { case ResultConstants . RETURN_NO_GENERATED_KEYS : return ; case ResultConstants . RETURN_GENERATED_KEYS_COL_INDEXES : int [ ] columnIndexes = meta . getGeneratedColumnIndexes ( ) ; if ( columnIndexes . length != 1 ) { return ; } if ( columnIndexes [ 0 ] != colIndex ) { return ; } // $ FALL - THROUGH $
case ResultConstants . RETURN_GENERATED_KEYS : generatedIndexes = new int [ ] { colIndex } ; break ; case ResultConstants . RETURN_GENERATED_KEYS_COL_NAMES : String [ ] columnNames = meta . getGeneratedColumnNames ( ) ; if ( columnNames . length != 1 ) { return ; } if ( baseTable . findColumn ( columnNames [ 0 ] ) != colIndex ) { return ; } generatedIndexes = new int [ ] { colIndex } ; break ; } generatedResultMetaData = ResultMetaData . newResultMetaData ( generatedIndexes . length ) ; for ( int i = 0 ; i < generatedIndexes . length ; i ++ ) { ColumnSchema column = baseTable . getColumn ( generatedIndexes [ i ] ) ; generatedResultMetaData . columns [ i ] = column ; } generatedResultMetaData . prepareData ( ) ;
|
public class ServerFactory { /** * Create a Server configured for Grakn Core .
* @ return a Server instance configured for Grakn Core */
public static Server createServer ( boolean benchmark ) { } }
|
// Grakn Server configuration
ServerID serverID = ServerID . me ( ) ; Config config = Config . create ( ) ; JanusGraphFactory janusGraphFactory = new JanusGraphFactory ( config ) ; // locks
LockManager lockManager = new ServerLockManager ( ) ; KeyspaceManager keyspaceStore = new KeyspaceManager ( janusGraphFactory , config ) ; // session factory
SessionFactory sessionFactory = new SessionFactory ( lockManager , janusGraphFactory , keyspaceStore , config ) ; // post - processing
AttributeDeduplicatorDaemon attributeDeduplicatorDaemon = new AttributeDeduplicatorDaemon ( sessionFactory ) ; // Enable server tracing
if ( benchmark ) { ServerTracing . initInstrumentation ( "server-instrumentation" ) ; } // create gRPC server
io . grpc . Server serverRPC = createServerRPC ( config , sessionFactory , attributeDeduplicatorDaemon , keyspaceStore , janusGraphFactory ) ; return createServer ( serverID , serverRPC , lockManager , attributeDeduplicatorDaemon , keyspaceStore ) ;
|
public class BaseMenuParser { /** * Process this XML Tag . */
public boolean parseHtmlTag ( PrintWriter out , String strTag , String strParams , String strData ) { } }
|
strTag = strTag . toUpperCase ( ) ; if ( strTag . equalsIgnoreCase ( "MENUTITLE" ) ) this . printHtmlTitle ( out , strTag , strParams , strData ) ; else if ( strTag . equalsIgnoreCase ( "MENUDESC" ) ) this . printHtmlMenuDesc ( out , strTag , strParams , strData ) ; else if ( strTag . equalsIgnoreCase ( "ITEMS" ) ) this . printHtmlItems ( out , strTag , strParams , strData ) ; else if ( strTag . equalsIgnoreCase ( "TYPE" ) ) this . printHtmlType ( out , strTag , strParams , strData ) ; else if ( strTag . equalsIgnoreCase ( "SUBMENU" ) ) this . printHtmlSubmenu ( out , strTag , strParams , strData ) ; else if ( strTag . equalsIgnoreCase ( "ICON" ) ) this . printHtmlIcon ( out , strTag , strParams , strData ) ; else if ( strTag . equalsIgnoreCase ( "LINK" ) ) this . printHtmlLink ( out , strTag , strParams , strData ) ; else if ( strTag . equalsIgnoreCase ( "JAVALOGO" ) ) this . printHtmlJavaLogo ( out , strTag , strParams , strData ) ; else return super . parseHtmlTag ( out , strTag , strParams , strData ) ; // Tag not found , just print the tag !
return true ; // Tag processed
|
public class ModelsImpl { /** * Creates a single child in an existing hierarchical entity model .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param hEntityId The hierarchical entity extractor ID .
* @ param addHierarchicalEntityChildOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the UUID object if successful . */
public UUID addHierarchicalEntityChild ( UUID appId , String versionId , UUID hEntityId , AddHierarchicalEntityChildOptionalParameter addHierarchicalEntityChildOptionalParameter ) { } }
|
return addHierarchicalEntityChildWithServiceResponseAsync ( appId , versionId , hEntityId , addHierarchicalEntityChildOptionalParameter ) . toBlocking ( ) . single ( ) . body ( ) ;
|
public class AbstractStreamEx { /** * Returns an immutable { @ link List } containing the elements of this stream .
* There ' s no guarantees on exact type of the returned { @ code List } . The
* returned { @ code List } is guaranteed to be serializable if all its
* elements are serializable .
* This is a terminal operation .
* @ return a { @ code List } containing the elements of this stream
* @ see # toList ( )
* @ since 0.6.3 */
@ SuppressWarnings ( "unchecked" ) public List < T > toImmutableList ( ) { } }
|
Object [ ] array = toArray ( Object [ ] :: new ) ; switch ( array . length ) { case 0 : return Collections . emptyList ( ) ; case 1 : return Collections . singletonList ( ( T ) array [ 0 ] ) ; default : return Collections . unmodifiableList ( Arrays . asList ( ( T [ ] ) array ) ) ; }
|
public class LoadBalancingRxClient { /** * Resolve the final property value from ,
* 1 . Request specific configuration
* 2 . Default configuration
* 3 . Default value
* @ param key
* @ param requestConfig
* @ param defaultValue
* @ return */
protected < S > S getProperty ( IClientConfigKey < S > key , @ Nullable IClientConfig requestConfig , S defaultValue ) { } }
|
if ( requestConfig != null && requestConfig . get ( key ) != null ) { return requestConfig . get ( key ) ; } else { return clientConfig . get ( key , defaultValue ) ; }
|
public class BinaryTreeNode { /** * Replies the child node at the specified position .
* @ param index is the position of the child to reply .
* @ return the child or < code > null < / code > */
@ Pure public final N getChildAt ( BinaryTreeZone index ) { } }
|
switch ( index ) { case LEFT : return this . left ; case RIGHT : return this . right ; default : throw new IndexOutOfBoundsException ( ) ; }
|
public class BitMatrix { /** * Exclusive - or ( XOR ) : Flip the bit in this { @ code BitMatrix } if the corresponding
* mask bit is set .
* @ param mask XOR mask */
public void xor ( BitMatrix mask ) { } }
|
if ( width != mask . getWidth ( ) || height != mask . getHeight ( ) || rowSize != mask . getRowSize ( ) ) { throw new IllegalArgumentException ( "input matrix dimensions do not match" ) ; } BitArray rowArray = new BitArray ( width ) ; for ( int y = 0 ; y < height ; y ++ ) { int offset = y * rowSize ; int [ ] row = mask . getRow ( y , rowArray ) . getBitArray ( ) ; for ( int x = 0 ; x < rowSize ; x ++ ) { bits [ offset + x ] ^= row [ x ] ; } }
|
public class MediaTable { /** * Get the required columns
* @ param idColumnName
* id column name
* @ return required columns */
public static List < String > requiredColumns ( String idColumnName ) { } }
|
if ( idColumnName == null ) { idColumnName = COLUMN_ID ; } List < String > requiredColumns = new ArrayList < > ( ) ; requiredColumns . add ( idColumnName ) ; requiredColumns . add ( COLUMN_DATA ) ; requiredColumns . add ( COLUMN_CONTENT_TYPE ) ; return requiredColumns ;
|
public class PHPSud { /** * { @ inheritDoc } */
@ Override public void onStartDocument ( Document document ) { } }
|
LOGGER . info ( "Start document" ) ; super . onStartDocument ( document ) ; LOGGER . debug ( "Create new PHP SUD" ) ; try { container = PHPContainerFactory . createContainer ( phpExec , workingDirectory , phpInitFile ) ; } catch ( PHPException e ) { LOGGER . error ( "Unable to create PHPContainer " + e . toString ( ) ) ; throw ExceptionImposter . imposterize ( e ) ; }
|
public class BufferedWriter { /** * Writes a portion of a String .
* < p > If the value of the < tt > len < / tt > parameter is negative then no
* characters are written . This is contrary to the specification of this
* method in the { @ linkplain java . io . Writer # write ( java . lang . String , int , int )
* superclass } , which requires that an { @ link IndexOutOfBoundsException } be
* thrown .
* @ param s String to be written
* @ param off Offset from which to start reading characters
* @ param len Number of characters to be written
* @ exception IOException If an I / O error occurs */
public void write ( String s , int off , int len ) throws IOException { } }
|
synchronized ( lock ) { ensureOpen ( ) ; int b = off , t = off + len ; while ( b < t ) { int d = min ( nChars - nextChar , t - b ) ; s . getChars ( b , b + d , cb , nextChar ) ; b += d ; nextChar += d ; if ( nextChar >= nChars ) flushBuffer ( ) ; } }
|
public class Rule { /** * / * - - - - - [ String Related ] - - - - - */
public void insertStringBefore ( Node node , String str ) { } }
|
boolean startingNode = this . node == node ; int cp [ ] = StringUtil . toCodePoints ( str ) ; for ( int i = cp . length - 1 ; i >= 0 ; i -- ) { Node newNode = new Node ( ) ; for ( Edge edge : node . incoming ( ) ) { if ( ! edge . loop ( ) ) edge . setTarget ( newNode ) ; } newNode . addEdgeTo ( node ) . matcher = new Any ( cp [ i ] ) ; node = newNode ; } if ( startingNode ) this . node = node ;
|
public class FacesConfigType { /** * This method is only called from jsf 2.2 */
@ Override public List < String > getManagedObjects ( ) { } }
|
ArrayList < String > managedObjects = new ArrayList < String > ( ) ; if ( this . application != null ) { managedObjects . addAll ( application . getManagedObjects ( ) ) ; } if ( this . factory != null ) { managedObjects . addAll ( factory . getManagedObjects ( ) ) ; } if ( this . lifecycle != null ) { managedObjects . addAll ( lifecycle . getManagedObjects ( ) ) ; } return managedObjects ;
|
public class Cache { /** * Cache a value for the given hostname that will automatically expire once the TTL is reached . */
final void cache ( String hostname , E value , int ttl , EventLoop loop ) { } }
|
Entries entries = resolveCache . get ( hostname ) ; if ( entries == null ) { entries = new Entries ( hostname ) ; Entries oldEntries = resolveCache . putIfAbsent ( hostname , entries ) ; if ( oldEntries != null ) { entries = oldEntries ; } } entries . add ( value , ttl , loop ) ;
|
public class OrderedTaskQueue { /** * Retrieves the task with earliest dead line and removes it from queue .
* @ return task which has earliest dead line */
public Task poll ( ) { } }
|
Task result = null ; if ( activeIndex == 0 ) { result = taskList [ 0 ] . poll ( ) ; if ( result != null ) result . removeFromQueue0 ( ) ; } else { result = taskList [ 1 ] . poll ( ) ; if ( result != null ) result . removeFromQueue1 ( ) ; } return result ;
|
public class AmazonEC2Client { /** * Describes the running instances for the specified EC2 Fleet .
* @ param describeFleetInstancesRequest
* @ return Result of the DescribeFleetInstances operation returned by the service .
* @ sample AmazonEC2 . DescribeFleetInstances
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / DescribeFleetInstances " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DescribeFleetInstancesResult describeFleetInstances ( DescribeFleetInstancesRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executeDescribeFleetInstances ( request ) ;
|
public class InvocationException { /** * Requires that the specified client have the specified permissions .
* @ throws InvocationException if they do not . */
public static void requireAccess ( ClientObject clobj , Permission perm , Object context ) throws InvocationException { } }
|
String errmsg = clobj . checkAccess ( perm , context ) ; if ( errmsg != null ) { throw new InvocationException ( errmsg ) ; }
|
public class DeletePipelineRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeletePipelineRequest deletePipelineRequest , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( deletePipelineRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deletePipelineRequest . getPipelineId ( ) , PIPELINEID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class AbstractCrosstabResultReducer { /** * Helper method to get the minimum of all values ( must be numbers )
* @ param slaveValues
* @ return */
protected static Number minimum ( List < ? > slaveValues ) { } }
|
Number min = null ; for ( Object slaveValue : slaveValues ) { if ( min == null ) { min = ( Number ) slaveValue ; } else { Comparable < Object > comparable = NumberComparator . getComparable ( min ) ; if ( comparable . compareTo ( slaveValue ) > 0 ) { min = ( Number ) slaveValue ; } } } return min ;
|
public class CmsInternalLinkValidationDialog { /** * Initializes the session object to work with depending on the dialog state and request parameters . < p > */
protected void initSessionObject ( ) { } }
|
try { if ( ! CmsStringUtil . isEmpty ( getParamAction ( ) ) && ! CmsDialog . DIALOG_INITIAL . equals ( getParamAction ( ) ) ) { m_resources = ( List ) getDialogObject ( ) ; // test
m_resources . size ( ) ; } } catch ( Exception e ) { // ignore
} if ( m_resources == null ) { // create a new project object
m_resources = new ArrayList ( ) ; try { Iterator it = OpenCms . getOrgUnitManager ( ) . getResourcesForOrganizationalUnit ( getCms ( ) , getCms ( ) . getRequestContext ( ) . getOuFqn ( ) ) . iterator ( ) ; while ( it . hasNext ( ) ) { CmsResource res = ( CmsResource ) it . next ( ) ; m_resources . add ( getCms ( ) . getSitePath ( res ) ) ; } } catch ( CmsException e1 ) { // should never happen
} }
|
public class MakeUniqueClassName { /** * When the class name is not unique we will use two underscore ' _ _ ' and a digit representing the number of time
* this class was found */
public static String makeUnique ( String className ) { } }
|
final Matcher m = UNIQUE_NAMING_PATTERN . matcher ( className ) ; if ( m . matches ( ) ) { // get the current number
final Integer number = Integer . parseInt ( m . group ( 2 ) ) ; // replace the current number in the string with the number + 1
return m . group ( 1 ) + ( number + 1 ) ; } else { return className + "__1" ; }
|
public class BaseSimpleReact { /** * Start a reactive dataflow from a stream .
* @ param stream that will be used to drive the reactive dataflow
* @ return Next stage in the reactive flow */
public < U > BaseSimpleReactStream < U > from ( final IntStream stream ) { } }
|
return ( BaseSimpleReactStream < U > ) from ( stream . boxed ( ) ) ;
|
public class CmsXMLSearchConfigurationParser { /** * Returns the configured sort options , or the empty list if no such options are configured .
* @ return The configured sort options , or the empty list if no such options are configured . */
private List < I_CmsSearchConfigurationSortOption > getSortOptions ( ) { } }
|
final List < I_CmsSearchConfigurationSortOption > options = new ArrayList < I_CmsSearchConfigurationSortOption > ( ) ; final CmsXmlContentValueSequence sortOptions = m_xml . getValueSequence ( XML_ELEMENT_SORTOPTIONS , m_locale ) ; if ( sortOptions == null ) { return null ; } else { for ( int i = 0 ; i < sortOptions . getElementCount ( ) ; i ++ ) { final I_CmsSearchConfigurationSortOption option = parseSortOption ( sortOptions . getValue ( i ) . getPath ( ) + "/" ) ; if ( option != null ) { options . add ( option ) ; } } return options ; }
|
public class CasWebApplication { /** * Main entry point of the CAS web application .
* @ param args the args */
public static void main ( final String [ ] args ) { } }
|
val properties = CasEmbeddedContainerUtils . getRuntimeProperties ( Boolean . TRUE ) ; val banner = CasEmbeddedContainerUtils . getCasBannerInstance ( ) ; new SpringApplicationBuilder ( CasWebApplication . class ) . banner ( banner ) . web ( WebApplicationType . SERVLET ) . properties ( properties ) . logStartupInfo ( true ) . contextClass ( CasWebApplicationContext . class ) . run ( args ) ;
|
public class Converters { /** * Uses buffer . flip ( ) and then buffer . clear ( )
* @ param sendingNodeId short
* @ param buffer ByteBuffer
* @ return RawMessage */
public static RawMessage toRawMessage ( final short sendingNodeId , final ByteBuffer buffer ) { } }
|
buffer . flip ( ) ; final RawMessage message = new RawMessage ( buffer . limit ( ) ) ; message . put ( buffer , false ) ; buffer . clear ( ) ; final RawMessageHeader header = new RawMessageHeader ( sendingNodeId , ( short ) 0 , ( short ) message . length ( ) ) ; message . header ( header ) ; return message ;
|
public class UserProfile { /** * Returns extra information of the profile that is not part of the normalized profile
* @ return a map with user ' s extra information found in the profile */
public Map < String , Object > getExtraInfo ( ) { } }
|
return extraInfo != null ? new HashMap < > ( extraInfo ) : Collections . < String , Object > emptyMap ( ) ;
|
public class SignatureEncoding { /** * Converts an ASN . 1 DER encoded ECDSA signature to a raw signature in the form R | S
* @ param asn1DerSignature An ASN . 1 DER encoded signature
* @ param algorithm The algorithm used to produce the given ASN . 1 DER encoded signature
* @ return The raw format of the given ASN . 1 DER encoded signature in the form R | S */
public static byte [ ] fromAsn1Der ( byte [ ] asn1DerSignature , Ecdsa algorithm ) { } }
|
try { return Asn1DerSignatureEncoding . decode ( asn1DerSignature , algorithm ) ; } catch ( IllegalArgumentException ex ) { throw ( IllegalArgumentException ) new IllegalArgumentException ( ex . getMessage ( ) + " " + Hex . encodeHexString ( asn1DerSignature ) ) . initCause ( ex ) ; }
|
public class RequestParam { /** * Returns a request parameter as double .
* @ param request Request .
* @ param param Parameter name .
* @ return Parameter value or 0 if it does not exist or is not a number . */
public static double getDouble ( @ NotNull ServletRequest request , @ NotNull String param ) { } }
|
return getDouble ( request , param , 0d ) ;
|
public class BinaryReader { /** * Read binary data from stream .
* @ param out The output buffer to read into .
* @ throws IOException if unable to read from stream . */
public void expect ( byte [ ] out ) throws IOException { } }
|
int i , off = 0 ; while ( off < out . length && ( i = in . read ( out , off , out . length - off ) ) > 0 ) { off += i ; } if ( off < out . length ) { throw new IOException ( "Not enough data available on stream: " + off + " < " + out . length ) ; }
|
public class MappedField { /** * Adds the annotation , if it exists on the field .
* @ param clazz type of the annotation
* @ param ann the annotation */
public void addAnnotation ( final Class < ? extends Annotation > clazz , final Annotation ann ) { } }
|
foundAnnotations . put ( clazz , ann ) ; discoverNames ( ) ;
|
public class ValueExpressionHelper { /** * return the type for the " value " attribute of the given component , if it exists . Return null otherwise .
* @ param context
* @ param comp
* @ return */
public static Class < ? > getValueType ( FacesContext context , UIComponent comp ) { } }
|
ValueExpression expr = comp . getValueExpression ( "value" ) ; Class < ? > valueType = expr == null ? null : expr . getType ( context . getELContext ( ) ) ; return valueType ;
|
public class DownloadProperties { /** * Builds a new DownloadProperties for downloading Galaxy at the given revision .
* @ param destination The destination directory to store Galaxy , null if a directory
* should be chosen by default .
* @ return A new DownloadProperties for downloading Galaxy at the given revision . */
@ Deprecated public static DownloadProperties forStableAtRevision ( final File destination , String revision ) { } }
|
return new DownloadProperties ( GALAXY_CENTRAL_REPOSITORY_URL , BRANCH_STABLE , revision , destination ) ;
|
public class BaseFont { /** * Creates a new font . This font can be one of the 14 built in types ,
* a Type1 font referred to by an AFM or PFM file , a TrueType font ( simple or collection ) or a CJK font from the
* Adobe Asian Font Pack . TrueType fonts and CJK fonts can have an optional style modifier
* appended to the name . These modifiers are : Bold , Italic and BoldItalic . An
* example would be " STSong - Light , Bold " . Note that this modifiers do not work if
* the font is embedded . Fonts in TrueType collections are addressed by index such as " msgothic . ttc , 1 " .
* This would get the second font ( indexes start at 0 ) , in this case " MS PGothic " .
* The fonts may or may not be cached depending on the flag < CODE > cached < / CODE > .
* If the < CODE > byte < / CODE > arrays are present the font will be
* read from them instead of the name . A name is still required to identify
* the font type .
* Besides the common encodings described by name , custom encodings
* can also be made . These encodings will only work for the single byte fonts
* Type1 and TrueType . The encoding string starts with a ' # '
* followed by " simple " or " full " . If " simple " there is a decimal for the first character position and then a list
* of hex values representing the Unicode codes that compose that encoding . < br >
* The " simple " encoding is recommended for TrueType fonts
* as the " full " encoding risks not matching the character with the right glyph
* if not done with care . < br >
* The " full " encoding is specially aimed at Type1 fonts where the glyphs have to be
* described by non standard names like the Tex math fonts . Each group of three elements
* compose a code position : the one byte code order in decimal or as ' x ' ( x cannot be the space ) , the name and the Unicode character
* used to access the glyph . The space must be assigned to character position 32 otherwise
* text justification will not work .
* Example for a " simple " encoding that includes the Unicode
* character space , A , B and ecyrillic :
* < PRE >
* " # simple 32 0020 0041 0042 0454"
* < / PRE >
* Example for a " full " encoding for a Type1 Tex font :
* < PRE >
* " # full ' A ' nottriangeqlleft 0041 ' B ' dividemultiply 0042 32 space 0020"
* < / PRE >
* @ param name the name of the font or its location on file
* @ param encoding the encoding to be applied to this font
* @ param embedded true if the font is to be embedded in the PDF
* @ param cached true if the font comes from the cache or is added to
* the cache if new , false if the font is always created new
* @ param ttfAfm the true type font or the afm in a byte array
* @ param pfb the pfb in a byte array
* @ param noThrow if true will not throw an exception if the font is not recognized and will return null , if false will throw
* an exception if the font is not recognized . Note that even if true an exception may be thrown in some circumstances .
* This parameter is useful for FontFactory that may have to check many invalid font names before finding the right one
* @ paramforceReadin some cases ( TrueTypeFont , Type1Font ) , the full font file will be read and kept in memory if forceRead is true
* @ return returns a new font . This font may come from the cache but only if cached
* is true , otherwise it will always be created new
* @ throws DocumentException the font is invalid
* @ throws IOException the font file could not be read
* @ since2.1.5 */
public static BaseFont createFont ( String name , String encoding , boolean embedded , boolean cached , byte ttfAfm [ ] , byte pfb [ ] , boolean noThrow , boolean forceRead ) throws DocumentException , IOException { } }
|
String nameBase = getBaseName ( name ) ; encoding = normalizeEncoding ( encoding ) ; boolean isBuiltinFonts14 = BuiltinFonts14 . containsKey ( name ) ; boolean isCJKFont = isBuiltinFonts14 ? false : CJKFont . isCJKFont ( nameBase , encoding ) ; if ( isBuiltinFonts14 || isCJKFont ) embedded = false ; else if ( encoding . equals ( IDENTITY_H ) || encoding . equals ( IDENTITY_V ) ) embedded = true ; BaseFont fontFound = null ; BaseFont fontBuilt = null ; String key = name + "\n" + encoding + "\n" + embedded ; if ( cached ) { synchronized ( fontCache ) { fontFound = ( BaseFont ) fontCache . get ( key ) ; } if ( fontFound != null ) return fontFound ; } if ( isBuiltinFonts14 || name . toLowerCase ( ) . endsWith ( ".afm" ) || name . toLowerCase ( ) . endsWith ( ".pfm" ) ) { fontBuilt = new Type1Font ( name , encoding , embedded , ttfAfm , pfb , forceRead ) ; fontBuilt . fastWinansi = encoding . equals ( CP1252 ) ; } else if ( nameBase . toLowerCase ( ) . endsWith ( ".ttf" ) || nameBase . toLowerCase ( ) . endsWith ( ".otf" ) || nameBase . toLowerCase ( ) . indexOf ( ".ttc," ) > 0 ) { if ( encoding . equals ( IDENTITY_H ) || encoding . equals ( IDENTITY_V ) ) fontBuilt = new TrueTypeFontUnicode ( name , encoding , embedded , ttfAfm , forceRead ) ; else { fontBuilt = new TrueTypeFont ( name , encoding , embedded , ttfAfm , false , forceRead ) ; fontBuilt . fastWinansi = encoding . equals ( CP1252 ) ; } } else if ( isCJKFont ) fontBuilt = new CJKFont ( name , encoding , embedded ) ; else if ( noThrow ) return null ; else throw new DocumentException ( "Font '" + name + "' with '" + encoding + "' is not recognized." ) ; if ( cached ) { synchronized ( fontCache ) { fontFound = ( BaseFont ) fontCache . get ( key ) ; if ( fontFound != null ) return fontFound ; fontCache . put ( key , fontBuilt ) ; } } return fontBuilt ;
|
public class UpdateUsageResult { /** * The usage data , as daily logs of used and remaining quotas , over the specified time interval indexed over the API
* keys in a usage plan . For example ,
* < code > { . . . , " values " : { " { api _ key } " : [ [ 0 , 100 ] , [ 10 , 90 ] , [ 100 , 10 ] ] } < / code > , where < code > { api _ key } < / code >
* stands for an API key value and the daily log entry is of the format < code > [ used quota , remaining quota ] < / code > .
* @ return The usage data , as daily logs of used and remaining quotas , over the specified time interval indexed over
* the API keys in a usage plan . For example ,
* < code > { . . . , " values " : { " { api _ key } " : [ [ 0 , 100 ] , [ 10 , 90 ] , [ 100 , 10 ] ] } < / code > , where
* < code > { api _ key } < / code > stands for an API key value and the daily log entry is of the format
* < code > [ used quota , remaining quota ] < / code > . */
public java . util . Map < String , java . util . List < java . util . List < Long > > > getItems ( ) { } }
|
return items ;
|
public class KeyRange { /** * Returns a key range from { @ code start } inclusive to { @ code end } inclusive . */
public static KeyRange closedClosed ( Key start , Key end ) { } }
|
return new KeyRange ( checkNotNull ( start ) , Endpoint . CLOSED , checkNotNull ( end ) , Endpoint . CLOSED ) ;
|
public class RelatedTablesCoreExtension { /** * Get or create the extension
* @ param mappingTable
* mapping table name
* @ return extension */
private Extensions getOrCreate ( String mappingTable ) { } }
|
getOrCreate ( ) ; Extensions extension = getOrCreate ( EXTENSION_NAME , mappingTable , null , EXTENSION_DEFINITION , ExtensionScopeType . READ_WRITE ) ; return extension ;
|
public class ClustersInner { /** * Executes script actions on the specified HDInsight cluster .
* @ param resourceGroupName The name of the resource group .
* @ param clusterName The name of the cluster .
* @ param parameters The parameters for executing script actions .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < Void > executeScriptActionsAsync ( String resourceGroupName , String clusterName , ExecuteScriptActionParameters parameters ) { } }
|
return executeScriptActionsWithServiceResponseAsync ( resourceGroupName , clusterName , parameters ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ;
|
public class Get { /** * Executes a provided script on the element , and returns the output of that
* script . If the element doesn ' t exist , or there is an error executing this
* script , a null value will be returned .
* @ param javascriptFunction - the javascript function that is going to be executed
* @ return Object : any resultant output from the javascript command */
public Object eval ( String javascriptFunction ) { } }
|
if ( ! element . is ( ) . present ( ) ) { return null ; } try { WebElement webElement = element . getWebElement ( ) ; JavascriptExecutor js = ( JavascriptExecutor ) driver ; return js . executeScript ( javascriptFunction , webElement ) ; } catch ( NoSuchMethodError | Exception e ) { log . warn ( e ) ; return null ; }
|
public class GraphComparator { /** * Apply the Delta commands to the source object graph , making
* the requested changes to the source graph . The source of the
* commands is typically generated from the output of the ' compare ( ) '
* API , where this source graph was compared to another target
* graph , and the delta commands were generated from that comparison .
* @ param source Source object graph
* @ param commands List of Delta commands . These commands carry the
* information required to identify the nodes to be modified , as well
* as the values to modify them to ( including commands to resize arrays ,
* set values into arrays , set fields to specific values , put new entries
* into Maps , etc .
* @ return List < DeltaError > which contains the String error message
* describing why the Delta could not be applied , and a reference to the
* Delta that was attempted to be applied . */
public static List < DeltaError > applyDelta ( Object source , List < Delta > commands , final ID idFetcher , DeltaProcessor deltaProcessor , boolean ... failFast ) { } }
|
// Index all objects in source graph
final Map srcMap = new HashMap ( ) ; Traverser . traverse ( source , new Traverser . Visitor ( ) { public void process ( Object o ) { if ( isIdObject ( o , idFetcher ) ) { srcMap . put ( idFetcher . getId ( o ) , o ) ; } } } ) ; List < DeltaError > errors = new ArrayList < > ( ) ; boolean failQuick = failFast != null && failFast . length == 1 && failFast [ 0 ] ; for ( Delta delta : commands ) { if ( failQuick && errors . size ( ) == 1 ) { return errors ; } Object srcValue = srcMap . get ( delta . id ) ; if ( srcValue == null ) { errors . add ( new DeltaError ( delta . cmd + " failed, source object not found, obj id: " + delta . id , delta ) ) ; continue ; } Map < String , Field > fields = ReflectionUtils . getDeepDeclaredFieldMap ( srcValue . getClass ( ) ) ; Field field = fields . get ( delta . fieldName ) ; if ( field == null && OBJECT_ORPHAN != delta . cmd ) { errors . add ( new DeltaError ( delta . cmd + " failed, field name missing: " + delta . fieldName + ", obj id: " + delta . id , delta ) ) ; continue ; } // if ( LOG . isDebugEnabled ( ) )
// LOG . debug ( delta . toString ( ) ) ;
try { switch ( delta . cmd ) { case ARRAY_SET_ELEMENT : deltaProcessor . processArraySetElement ( srcValue , field , delta ) ; break ; case ARRAY_RESIZE : deltaProcessor . processArrayResize ( srcValue , field , delta ) ; break ; case OBJECT_ASSIGN_FIELD : deltaProcessor . processObjectAssignField ( srcValue , field , delta ) ; break ; case OBJECT_ORPHAN : deltaProcessor . processObjectOrphan ( srcValue , field , delta ) ; break ; case OBJECT_FIELD_TYPE_CHANGED : deltaProcessor . processObjectTypeChanged ( srcValue , field , delta ) ; break ; case SET_ADD : deltaProcessor . processSetAdd ( srcValue , field , delta ) ; break ; case SET_REMOVE : deltaProcessor . processSetRemove ( srcValue , field , delta ) ; break ; case MAP_PUT : deltaProcessor . processMapPut ( srcValue , field , delta ) ; break ; case MAP_REMOVE : deltaProcessor . processMapRemove ( srcValue , field , delta ) ; break ; case LIST_RESIZE : deltaProcessor . processListResize ( srcValue , field , delta ) ; break ; case LIST_SET_ELEMENT : deltaProcessor . processListSetElement ( srcValue , field , delta ) ; break ; default : errors . add ( new DeltaError ( "Unknown command: " + delta . cmd , delta ) ) ; break ; } } catch ( Exception e ) { StringBuilder str = new StringBuilder ( ) ; Throwable t = e ; do { str . append ( t . getMessage ( ) ) ; t = t . getCause ( ) ; if ( t != null ) { str . append ( ", caused by: " ) ; } } while ( t != null ) ; errors . add ( new DeltaError ( str . toString ( ) , delta ) ) ; } } return errors ;
|
public class StreamingSheetReader { /** * Read through a number of rows equal to the rowCacheSize field or until there is no more data to read
* @ return true if data was read */
private boolean getRow ( ) { } }
|
try { rowCache . clear ( ) ; while ( rowCache . size ( ) < rowCacheSize && parser . hasNext ( ) ) { handleEvent ( parser . nextEvent ( ) ) ; } rowCacheIterator = rowCache . iterator ( ) ; return rowCacheIterator . hasNext ( ) ; } catch ( XMLStreamException e ) { throw new ParseException ( "Error reading XML stream" , e ) ; }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.