signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ExtendedObservation { /** * Resets the moment observations . < br >
* If there are no observations yet , new observations are created and added to the map . < br >
* Otherwise existing observations are reset . */
private void resetMomentObservation ( ) { } } | if ( momentObservation . isEmpty ( ) ) { Observation o ; for ( int i : momentDegrees ) { o = new Observation ( "moment " + i , true ) ; o . setStandardPrecision ( momentPrecision ) ; momentObservation . put ( i , o ) ; } } else { for ( Observation o : momentObservation . values ( ) ) o . reset ( ) ; } |
public class ConnectionPoolSegment { /** * Determine if this segment is currently idle .
* @ return Is the segment idle ? */
final boolean isIdle ( ) { } } | for ( ConnectionPoolConnection conn : connections ) { if ( conn . state . get ( ) == ConnectionPoolConnection . STATE_OPEN ) { return false ; } } return true ; |
public class RandomAccessReader { /** * Get a 32 - bit unsigned integer from the buffer , returning it as a long .
* @ param index position within the data buffer to read first byte
* @ return the unsigned 32 - bit int value as a long , between 0x00000 and 0xFFFFF
* @ throws IOException the buffer does not contain enough bytes to service the request , or index is negative */
public long getUInt32 ( int index ) throws IOException { } } | validateIndex ( index , 4 ) ; if ( _isMotorolaByteOrder ) { // Motorola - MSB first ( big endian )
return ( ( ( long ) getByte ( index ) ) << 24 & 0xFF000000L ) | ( ( ( long ) getByte ( index + 1 ) ) << 16 & 0xFF0000L ) | ( ( ( long ) getByte ( index + 2 ) ) << 8 & 0xFF00L ) | ( ( ( long ) getByte ( index + 3 ) ) & 0xFFL ) ; } else { // Intel ordering - LSB first ( little endian )
return ( ( ( long ) getByte ( index + 3 ) ) << 24 & 0xFF000000L ) | ( ( ( long ) getByte ( index + 2 ) ) << 16 & 0xFF0000L ) | ( ( ( long ) getByte ( index + 1 ) ) << 8 & 0xFF00L ) | ( ( ( long ) getByte ( index ) ) & 0xFFL ) ; } |
public class Wro4jAutoConfiguration { /** * This cache strategy will be configured if there ' s not already a cache
* strategy , a { @ link CacheManager } is present and the name of the cache to
* use is configured .
* @ param < K > Type of the cache keys
* @ param < V > Type of the cache values
* @ param cacheManager The cache manager to use
* @ param wro4jProperties The properties ( needed for the cache name )
* @ return The Spring backed cache strategy */
@ Bean @ ConditionalOnBean ( CacheManager . class ) @ ConditionalOnProperty ( "wro4j.cacheName" ) @ ConditionalOnMissingBean ( CacheStrategy . class ) @ Order ( - 100 ) < K , V > CacheStrategy < K , V > springCacheStrategy ( CacheManager cacheManager , Wro4jProperties wro4jProperties ) { } } | LOGGER . debug ( "Creating cache strategy 'SpringCacheStrategy'" ) ; return new SpringCacheStrategy < > ( cacheManager , wro4jProperties . getCacheName ( ) ) ; |
public class Arguments { /** * Initializes this Args instance with a set of command line args .
* The args will be processed in conjunction with the full set of
* command line options , including - help , - version etc .
* The args may also contain class names and filenames .
* Any errors during this call , and later during validate , will be reported
* to the log .
* @ param ownName the name of this tool ; used to prefix messages
* @ param args the args to be processed */
public void init ( String ownName , String ... args ) { } } | this . ownName = ownName ; errorMode = ErrorMode . LOG ; files = new LinkedHashSet < > ( ) ; deferredFileManagerOptions = new LinkedHashMap < > ( ) ; fileObjects = null ; classNames = new LinkedHashSet < > ( ) ; processArgs ( List . from ( args ) , Option . getJavaCompilerOptions ( ) , cmdLineHelper , true , false ) ; if ( errors ) { log . printLines ( PrefixKind . JAVAC , "msg.usage" , ownName ) ; } |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcMassFlowRateMeasure ( ) { } } | if ( ifcMassFlowRateMeasureEClass == null ) { ifcMassFlowRateMeasureEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 706 ) ; } return ifcMassFlowRateMeasureEClass ; |
public class UserPage { /** * Returns an iterator over this page ' s { @ code results } that :
* < ul >
* < li > Will not be { @ code null } . < / li >
* < li > Will not support { @ link java . util . Iterator # remove ( ) } . < / li >
* < / ul >
* @ return a non - null iterator . */
@ Override public java . util . Iterator < com . google . api . ads . admanager . axis . v201805 . User > iterator ( ) { } } | if ( results == null ) { return java . util . Collections . < com . google . api . ads . admanager . axis . v201805 . User > emptyIterator ( ) ; } return java . util . Arrays . < com . google . api . ads . admanager . axis . v201805 . User > asList ( results ) . iterator ( ) ; |
public class Procedure { /** * syntactic sugar */
public Reference addReport ( ) { } } | Reference t = new Reference ( ) ; if ( this . report == null ) this . report = new ArrayList < Reference > ( ) ; this . report . add ( t ) ; return t ; |
public class AioTCPChannel { /** * @ see
* com . ibm . ws . tcpchannel . internal . TCPChannel # createInboundSocketIOChannel (
* java . nio . channels . SocketChannel ) */
public SocketIOChannel createInboundSocketIOChannel ( SocketChannel sc ) throws IOException { } } | AsyncSocketChannel asc = new AsyncSocketChannel ( sc , getAsyncChannelGroup ( ) ) ; return AioSocketIOChannel . createIOChannel ( sc . socket ( ) , asc , this ) ; |
public class JavacProcessingEnvironment { /** * Convert import - style string for supported annotations into a
* regex matching that string . If the string is a valid
* import - style string , return a regex that won ' t match anything . */
private static Pattern importStringToPattern ( String s , Processor p , Log log ) { } } | if ( isValidImportString ( s ) ) { return validImportStringToPattern ( s ) ; } else { log . warning ( "proc.malformed.supported.string" , s , p . getClass ( ) . getName ( ) ) ; return noMatches ; // won ' t match any valid identifier
} |
public class PiBondingMovementReaction { /** * Initiate process .
* It is needed to call the addExplicitHydrogensToSatisfyValency
* from the class tools . HydrogenAdder .
* @ exception CDKException Description of the Exception
* @ param reactants reactants of the reaction .
* @ param agents agents of the reaction ( Must be in this case null ) . */
@ Override public IReactionSet initiate ( IAtomContainerSet reactants , IAtomContainerSet agents ) throws CDKException { } } | logger . debug ( "initiate reaction: PiBondingMovementReaction" ) ; if ( reactants . getAtomContainerCount ( ) != 1 ) { throw new CDKException ( "PiBondingMovementReaction only expects one reactant" ) ; } if ( agents != null ) { throw new CDKException ( "PiBondingMovementReaction don't expects agents" ) ; } IReactionSet setOfReactions = reactants . getBuilder ( ) . newInstance ( IReactionSet . class ) ; IAtomContainer reactant = reactants . getAtomContainer ( 0 ) ; AtomContainerManipulator . percieveAtomTypesAndConfigureAtoms ( reactant ) ; /* * if the parameter hasActiveCenter is not fixed yet , set the active
* centers */
IParameterReact ipr = super . getParameterClass ( SetReactionCenter . class ) ; if ( ipr != null && ! ipr . isSetParameter ( ) ) setActiveCenters ( reactant ) ; // if ( ( Boolean ) paramsMap . get ( " lookingSymmetry " ) ) {
// Aromaticity . cdkLegacy ( ) . apply ( reactant ) ;
AllRingsFinder arf = new AllRingsFinder ( ) ; IRingSet ringSet = arf . findAllRings ( reactant ) ; for ( int ir = 0 ; ir < ringSet . getAtomContainerCount ( ) ; ir ++ ) { IRing ring = ( IRing ) ringSet . getAtomContainer ( ir ) ; // only rings with even number of atoms
int nrAtoms = ring . getAtomCount ( ) ; if ( nrAtoms % 2 == 0 ) { int nrSingleBonds = 0 ; for ( IBond iBond : ring . bonds ( ) ) { if ( iBond . getOrder ( ) == IBond . Order . SINGLE ) nrSingleBonds ++ ; } // if exactly half ( nrAtoms / 2 = = nrSingleBonds )
if ( nrSingleBonds != 0 && nrAtoms / 2 == nrSingleBonds ) { Iterator < IBond > bondfs = ring . bonds ( ) . iterator ( ) ; boolean ringCompletActive = false ; while ( bondfs . hasNext ( ) ) { if ( bondfs . next ( ) . getFlag ( CDKConstants . REACTIVE_CENTER ) ) ringCompletActive = true ; else { ringCompletActive = false ; break ; } } if ( ! ringCompletActive ) continue ; IReaction reaction = reactants . getBuilder ( ) . newInstance ( IReaction . class ) ; reaction . addReactant ( reactant ) ; IAtomContainer reactantCloned ; try { reactantCloned = reactant . clone ( ) ; } catch ( CloneNotSupportedException e ) { throw new CDKException ( "Could not clone IAtomContainer!" , e ) ; } for ( IBond bondi : ring . bonds ( ) ) { int bondiP = reactant . indexOf ( bondi ) ; if ( bondi . getOrder ( ) == IBond . Order . SINGLE ) BondManipulator . increaseBondOrder ( reactantCloned . getBond ( bondiP ) ) ; else BondManipulator . decreaseBondOrder ( reactantCloned . getBond ( bondiP ) ) ; } reaction . addProduct ( reactantCloned ) ; setOfReactions . addReaction ( reaction ) ; } } } return setOfReactions ; |
public class StoreImpl { /** * / * ( non - Javadoc )
* @ see com . att . env . Store # get ( com . att . env . StaticSlot T defaultObject ) */
@ SuppressWarnings ( "unchecked" ) public < T > T get ( StaticSlot sslot , T dflt ) { } } | T t = ( T ) staticState [ sslot . slot ] ; return t == null ? dflt : t ; |
public class IterableExtensions { /** * Concatenates two iterables into a single iterable . The returned iterable has an iterator that traverses the
* elements in { @ code a } , followed by the elements in { @ code b } . The resulting iterable is effectivly a view on the
* source iterables . That is , the source iterators are not polled until necessary and the result will reflect
* changes in the sources .
* The returned iterable ' s iterator supports { @ code remove ( ) } when the corresponding input iterator supports it .
* @ param a
* the first iterable . May not be < code > null < / code > .
* @ param b
* the second iterable . May not be < code > null < / code > .
* @ return a combined iterable . Never < code > null < / code > . */
@ Pure @ Inline ( value = "$3.$4concat($1, $2)" , imported = Iterables . class ) public static < T > Iterable < T > operator_plus ( Iterable < ? extends T > a , Iterable < ? extends T > b ) { } } | return Iterables . concat ( a , b ) ; |
public class Graphics { /** * Get the current graphics context background color
* @ return The background color of this graphics context */
public Color getBackground ( ) { } } | predraw ( ) ; FloatBuffer buffer = BufferUtils . createFloatBuffer ( 16 ) ; GL . glGetFloat ( SGL . GL_COLOR_CLEAR_VALUE , buffer ) ; postdraw ( ) ; return new Color ( buffer ) ; |
public class SingleNumericalValue { /** * Parses an integer value from a { @ link String } encoded in Base64 format .
* This method does not check the passed { @ link String } before parsing , so this method should only be used on string
* which are certain to match the required format .
* @ param value a { @ link String } containing ( only ) an integer encoded in Base64 format
* @ return the parsed integer */
private static final int parseBase64ConstantString ( final String value ) { } } | final String s = value . substring ( 2 ) ; // crop " 0b " / " 0B " at the beginning
final int length = s . length ( ) ; int result = 0 ; for ( int i = 0 ; i < length ; ++ i ) { final char c = s . charAt ( length - 1 - i ) ; result += base64ValueOf ( c ) * Math . pow ( 64 , i ) ; } return result ; |
public class CmsPrincipalSelectDialog { /** * Init table . < p >
* @ param type WidgetType to initialize */
void initTable ( WidgetType type ) { } } | IndexedContainer data ; try { data = getContainerForType ( type , m_realOnly , ( String ) m_ouCombo . getValue ( ) ) ; m_table . updateContainer ( data ) ; m_tableFilter . setValue ( "" ) ; } catch ( CmsException e ) { LOG . error ( "Can't read principals" , e ) ; } |
public class GRPCUtils { /** * Create exception info from exception object .
* @ param exceptionCodec to encode exception into bytes
* @ param ex exception object
* @ return ExceptionInfo */
public static ExceptionInfo createExceptionInfo ( final ExceptionCodec exceptionCodec , final Throwable ex ) { } } | return ExceptionInfo . newBuilder ( ) . setName ( ex . getCause ( ) != null ? ex . getCause ( ) . toString ( ) : ex . toString ( ) ) . setMessage ( StringUtils . isNotEmpty ( ex . getMessage ( ) ) ? ex . getMessage ( ) : ex . toString ( ) ) . setData ( ByteString . copyFrom ( exceptionCodec . toBytes ( ex ) ) ) . build ( ) ; |
public class ClientPropertiesResultMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ClientPropertiesResult clientPropertiesResult , ProtocolMarshaller protocolMarshaller ) { } } | if ( clientPropertiesResult == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( clientPropertiesResult . getResourceId ( ) , RESOURCEID_BINDING ) ; protocolMarshaller . marshall ( clientPropertiesResult . getClientProperties ( ) , CLIENTPROPERTIES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Mode { /** * Compute the display output given full context and values */
String format ( String field , FormatCase fc , FormatAction fa , FormatWhen fw , FormatResolve fr , FormatUnresolved fu , FormatErrors fe , String name , String type , String value , String unresolved , List < String > errorLines ) { } } | // Convert the context into a bit representation used as selectors for store field formats
long bits = bits ( fc , fa , fw , fr , fu , fe ) ; String fname = name == null ? "" : name ; String ftype = type == null ? "" : type ; // Compute the representation of value
String fvalue = truncateValue ( value , bits ) ; String funresolved = unresolved == null ? "" : unresolved ; String errors = errorLines . stream ( ) . map ( el -> String . format ( format ( "errorline" , bits ) , fname , ftype , fvalue , funresolved , "*cannot-use-errors-here*" , el ) ) . collect ( joining ( ) ) ; return String . format ( format ( field , bits ) , fname , ftype , fvalue , funresolved , errors , "*cannot-use-err-here*" ) ; |
public class WbsRowComparatorXER { /** * { @ inheritDoc } */
@ Override public int compare ( Row o1 , Row o2 ) { } } | Integer parent1 = o1 . getInteger ( "parent_wbs_id" ) ; Integer parent2 = o2 . getInteger ( "parent_wbs_id" ) ; int result = NumberHelper . compare ( parent1 , parent2 ) ; if ( result == 0 ) { Integer seq1 = o1 . getInteger ( "seq_num" ) ; Integer seq2 = o2 . getInteger ( "seq_num" ) ; result = NumberHelper . compare ( seq1 , seq2 ) ; } return result ; |
public class Options { /** * Adds an YAxis to the chart . You can use { @ link # setyAxis ( Axis ) } if you want
* to define a single axis only .
* @ param yAxis the YAxis to add .
* @ return the { @ link Options } object for chaining . */
public Options addyAxis ( final Axis yAxis ) { } } | if ( this . getyAxis ( ) == null ) { this . setyAxis ( new ArrayList < Axis > ( ) ) ; } this . getyAxis ( ) . add ( yAxis ) ; return this ; |
public class Datatype_Builder { /** * Resets the state of this builder .
* @ return this { @ code Builder } object */
public Datatype . Builder clear ( ) { } } | Datatype_Builder defaults = new Datatype . Builder ( ) ; type = defaults . type ; interfaceType = defaults . interfaceType ; builder = defaults . builder ; extensible = defaults . extensible ; builderFactory = defaults . builderFactory ; generatedBuilder = defaults . generatedBuilder ; valueType = defaults . valueType ; partialType = defaults . partialType ; rebuildableType = defaults . rebuildableType ; propertyEnum = defaults . propertyEnum ; standardMethodUnderrides . clear ( ) ; builderSerializable = defaults . builderSerializable ; hasToBuilderMethod = defaults . hasToBuilderMethod ; clearGeneratedBuilderAnnotations ( ) ; clearValueTypeAnnotations ( ) ; valueTypeVisibility = defaults . valueTypeVisibility ; clearNestedClasses ( ) ; _unsetProperties . clear ( ) ; _unsetProperties . addAll ( defaults . _unsetProperties ) ; return ( Datatype . Builder ) this ; |
public class HashUtilities { /** * Generates a MD5 Hash for a specific string
* @ param input The string to be converted into an MD5 hash .
* @ return The MD5 Hash string of the input string . */
public static String generateMD5 ( final String input ) { } } | try { return generateMD5 ( input . getBytes ( "UTF-8" ) ) ; } catch ( UnsupportedEncodingException e ) { LOG . debug ( "An error occurred generating the MD5 Hash of the input string" , e ) ; return null ; } |
public class StatusDots { /** * Adding Dot objects to layout
* @ param length Length of PIN entered so far */
private void addDots ( int length ) { } } | removeAllViews ( ) ; final int pinLength = styledAttributes . getInt ( R . styleable . PinLock_pinLength , 4 ) ; for ( int i = 0 ; i < pinLength ; i ++ ) { Dot dot = new Dot ( context , styledAttributes , i < length ) ; addView ( dot ) ; } |
public class RootDocImpl { /** * Classes and interfaces specified on the command line . */
public ClassDoc [ ] specifiedClasses ( ) { } } | ListBuffer < ClassDocImpl > classesToDocument = new ListBuffer < ClassDocImpl > ( ) ; for ( ClassDocImpl cd : cmdLineClasses ) { cd . addAllClasses ( classesToDocument , true ) ; } return ( ClassDoc [ ] ) classesToDocument . toArray ( new ClassDocImpl [ classesToDocument . length ( ) ] ) ; |
public class CensusTracingModule { /** * Creates a { @ link ClientCallTracer } for a new call . */
@ VisibleForTesting ClientCallTracer newClientCallTracer ( @ Nullable Span parentSpan , MethodDescriptor < ? , ? > method ) { } } | return new ClientCallTracer ( parentSpan , method ) ; |
public class A_CmsHtmlIconButton { /** * Generates a default html code for icon buttons . < p >
* @ param style the style of the button
* @ param id the id
* @ param name the name
* @ param helpText the help text
* @ param enabled if enabled or not
* @ param iconPath the path to the icon
* @ param confirmationMessage the optional confirmation message
* @ param onClick the js code to execute
* @ return html code */
public static String defaultButtonHtml ( CmsHtmlIconButtonStyleEnum style , String id , String name , String helpText , boolean enabled , String iconPath , String confirmationMessage , String onClick ) { } } | return defaultButtonHtml ( style , id , id , name , helpText , enabled , iconPath , confirmationMessage , onClick , false , null ) ; |
public class VJournalUserAgent { /** * < pre >
* 3.5.1 . PUBLISH
* The " PUBLISH " method in a " VJOURNAL " calendar component has no
* associated response . It is simply a posting of an iCalendar object
* that may be added to a calendar . It MUST have an " Organizer " . It
* MUST NOT have " Attendees " . The expected usage is for encapsulating
* an arbitrary journal entry as an iCalendar object . The " Organizer "
* MAY subsequently update ( with another " PUBLISH " method ) or cancel
* ( with a " CANCEL " method ) a previously published journal entry .
* < / pre > */
@ Override public Calendar publish ( VJournal ... component ) { } } | Calendar published = wrap ( Method . PUBLISH , component ) ; published . validate ( ) ; return published ; |
public class policyhttpcallout { /** * Use this API to update policyhttpcallout . */
public static base_response update ( nitro_service client , policyhttpcallout resource ) throws Exception { } } | policyhttpcallout updateresource = new policyhttpcallout ( ) ; updateresource . name = resource . name ; updateresource . ipaddress = resource . ipaddress ; updateresource . port = resource . port ; updateresource . vserver = resource . vserver ; updateresource . returntype = resource . returntype ; updateresource . httpmethod = resource . httpmethod ; updateresource . hostexpr = resource . hostexpr ; updateresource . urlstemexpr = resource . urlstemexpr ; updateresource . headers = resource . headers ; updateresource . parameters = resource . parameters ; updateresource . bodyexpr = resource . bodyexpr ; updateresource . fullreqexpr = resource . fullreqexpr ; updateresource . scheme = resource . scheme ; updateresource . resultexpr = resource . resultexpr ; updateresource . cacheforsecs = resource . cacheforsecs ; return updateresource . update_resource ( client ) ; |
public class IteratorExtensions { /** * Finds the first element in the given iterator that fulfills the predicate . If none is found or the iterator is
* empty , < code > null < / code > is returned .
* @ param iterator
* the iterator . May not be < code > null < / code > .
* @ param predicate
* the predicate . May not be < code > null < / code > .
* @ return the first element in the iterator for which the given predicate returns < code > true < / code > , returns
* < code > null < / code > if no element matches the predicate or the iterator is empty . */
public static < T > T findFirst ( Iterator < T > iterator , Function1 < ? super T , Boolean > predicate ) { } } | if ( predicate == null ) throw new NullPointerException ( "predicate" ) ; while ( iterator . hasNext ( ) ) { T t = iterator . next ( ) ; if ( predicate . apply ( t ) ) return t ; } return null ; |
public class MultiLayerNetwork { /** * Compute activations from input to output of the output layer .
* As per { @ link # feedForward ( INDArray , boolean ) } but using the inputs that have previously been set using { @ link # setInput ( INDArray ) }
* @ return the list of activations for each layer */
public List < INDArray > feedForward ( boolean train ) { } } | try { return ffToLayerActivationsDetached ( train , FwdPassType . STANDARD , false , layers . length - 1 , input , mask , null , true ) ; } catch ( OutOfMemoryError e ) { CrashReportingUtil . writeMemoryCrashDump ( this , e ) ; throw e ; } |
public class BeansDescriptorImpl { /** * If not already created , a new < code > interceptors < / code > element will be created and returned . Otherwise , the first
* existing < code > interceptors < / code > element will be returned .
* @ return the instance defined for the element < code > interceptors < / code > */
public Interceptors < BeansDescriptor > getOrCreateInterceptors ( ) { } } | List < Node > nodeList = model . get ( "interceptors" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new InterceptorsImpl < BeansDescriptor > ( this , "interceptors" , model , nodeList . get ( 0 ) ) ; } return createInterceptors ( ) ; |
public class CmsDriverManager { /** * Gets the correct driver interface to use for proxying a specific driver instance . < p >
* @ param obj the driver instance
* @ return the interface to use for proxying */
private Class < ? > getDriverInterfaceForProxy ( Object obj ) { } } | for ( Class < ? > interfaceClass : new Class [ ] { I_CmsUserDriver . class , I_CmsVfsDriver . class , I_CmsProjectDriver . class , I_CmsHistoryDriver . class , I_CmsSubscriptionDriver . class } ) { if ( interfaceClass . isAssignableFrom ( obj . getClass ( ) ) ) { return interfaceClass ; } } return null ; |
public class GeoPackageCoreImpl { /** * { @ inheritDoc } */
@ Override public boolean isFeatureOrTileTable ( String table ) { } } | boolean isType = false ; Contents contents = getTableContents ( table ) ; if ( contents != null ) { ContentsDataType dataType = contents . getDataType ( ) ; isType = dataType != null && ( dataType == ContentsDataType . FEATURES || dataType == ContentsDataType . TILES ) ; } return isType ; |
public class OnlineAccuracyUpdatedEnsemble { /** * Computes the weight of a learner before training a given example .
* @ param i the identifier ( in terms of array learners )
* of the classifier for which the weight is supposed to be computed
* @ param example the newest example
* @ return the computed weight . */
protected double computeWeight ( int i , Instance example ) { } } | int d = this . windowSize ; int t = this . processedInstances - this . ensemble [ i ] . birthday ; double e_it = 0 ; double mse_it = 0 ; double voteSum = 0 ; try { double [ ] votes = this . ensemble [ i ] . classifier . getVotesForInstance ( example ) ; for ( double element : votes ) { voteSum += element ; } if ( voteSum > 0 ) { double f_it = 1 - ( votes [ ( int ) example . classValue ( ) ] / voteSum ) ; e_it = f_it * f_it ; } else { e_it = 1 ; } } catch ( Exception e ) { e_it = 1 ; } if ( t > d ) { mse_it = this . ensemble [ i ] . mse_it + e_it / ( double ) d - this . ensemble [ i ] . squareErrors [ t % d ] / ( double ) d ; } else { mse_it = this . ensemble [ i ] . mse_it * ( t - 1 ) / t + e_it / ( double ) t ; } this . ensemble [ i ] . squareErrors [ t % d ] = e_it ; this . ensemble [ i ] . mse_it = mse_it ; if ( linearOption . isSet ( ) ) { return java . lang . Math . max ( mse_r - mse_it , Double . MIN_VALUE ) ; } else { return 1.0 / ( this . mse_r + mse_it + Double . MIN_VALUE ) ; } |
public class IFD { /** * Gets the metadata .
* @ param name the name
* @ return the metadata */
public TagValue getTag ( String name ) { } } | TagValue tv = null ; int id = TiffTags . getTagId ( name ) ; if ( tags . containsTagId ( id ) ) tv = tags . get ( id ) ; return tv ; |
public class MPPUtility { /** * Reads a color value represented by three bytes , for R , G , and B
* components , plus a flag byte indicating if this is an automatic color .
* Returns null if the color type is " Automatic " .
* @ param data byte array of data
* @ param offset offset into array
* @ return new Color instance */
public static final Color getColor ( byte [ ] data , int offset ) { } } | Color result = null ; if ( getByte ( data , offset + 3 ) == 0 ) { int r = getByte ( data , offset ) ; int g = getByte ( data , offset + 1 ) ; int b = getByte ( data , offset + 2 ) ; result = new Color ( r , g , b ) ; } return result ; |
public class Either { /** * Create a Left value of Either */
public static < L , R > Either < L , R > Left ( L value ) { } } | return new Left < L , R > ( value ) ; |
public class GeometryEngine { /** * Constructs a new geometry by union an array of geometries . All inputs
* must be of the same type of geometries and share one spatial reference .
* See OperatorUnion .
* @ param geometries
* The geometries to union .
* @ param spatialReference
* The spatial reference of the geometries .
* @ return The geometry object representing the resultant union . */
public static Geometry union ( Geometry [ ] geometries , SpatialReference spatialReference ) { } } | OperatorUnion op = ( OperatorUnion ) factory . getOperator ( Operator . Type . Union ) ; SimpleGeometryCursor inputGeometries = new SimpleGeometryCursor ( geometries ) ; GeometryCursor result = op . execute ( inputGeometries , spatialReference , null ) ; return result . next ( ) ; |
public class AVObject { /** * judge operations ' value include circle reference or not .
* notice : internal used , pls not invoke it .
* @ param markMap
* @ return */
public boolean hasCircleReference ( Map < AVObject , Boolean > markMap ) { } } | if ( null == markMap ) { return false ; } markMap . put ( this , true ) ; boolean rst = false ; for ( ObjectFieldOperation op : operations . values ( ) ) { rst = rst || op . checkCircleReference ( markMap ) ; } return rst ; |
public class QuadPoseEstimator { /** * Given the found solution , compute the the observed pixel would appear on the marker ' s surface .
* pixel - > normalized pixel - > rotated - > projected on to plane
* @ param pixelX ( Input ) pixel coordinate
* @ param pixelY ( Input ) pixel coordinate
* @ param marker ( Output ) location on the marker */
public void pixelToMarker ( double pixelX , double pixelY , Point2D_F64 marker ) { } } | // find pointing vector in camera reference frame
pixelToNorm . compute ( pixelX , pixelY , marker ) ; cameraP3 . set ( marker . x , marker . y , 1 ) ; // rotate into marker reference frame
GeometryMath_F64 . multTran ( outputFiducialToCamera . R , cameraP3 , ray . slope ) ; GeometryMath_F64 . multTran ( outputFiducialToCamera . R , outputFiducialToCamera . T , ray . p ) ; ray . p . scale ( - 1 ) ; double t = - ray . p . z / ray . slope . z ; marker . x = ray . p . x + ray . slope . x * t ; marker . y = ray . p . y + ray . slope . y * t ; |
public class DefaultCassandraSessionFactory { /** * Destroy . */
@ Override public void destroy ( ) { } } | try { LOGGER . debug ( "Closing Cassandra session" ) ; session . close ( ) ; } catch ( final Exception e ) { LOGGER . warn ( e . getMessage ( ) , e ) ; } try { LOGGER . debug ( "Closing Cassandra cluster" ) ; cluster . close ( ) ; } catch ( final Exception e ) { LOGGER . warn ( e . getMessage ( ) , e ) ; } |
public class IndexTermReader { /** * Update the target name of each IndexTerm , recursively . */
private void updateIndexTermTargetName ( final IndexTerm indexterm ) { } } | final int targetSize = indexterm . getTargetList ( ) . size ( ) ; final int subtermSize = indexterm . getSubTerms ( ) . size ( ) ; for ( int i = 0 ; i < targetSize ; i ++ ) { final IndexTermTarget target = indexterm . getTargetList ( ) . get ( i ) ; final String uri = target . getTargetURI ( ) ; final int indexOfSharp = uri . lastIndexOf ( SHARP ) ; final String fragment = ( indexOfSharp == - 1 || uri . endsWith ( SHARP ) ) ? null : uri . substring ( indexOfSharp + 1 ) ; if ( fragment != null && titleMap . containsKey ( fragment ) ) { target . setTargetName ( titleMap . get ( fragment ) ) ; } else { target . setTargetName ( defaultTitle ) ; } } for ( int i = 0 ; i < subtermSize ; i ++ ) { final IndexTerm subterm = indexterm . getSubTerms ( ) . get ( i ) ; updateIndexTermTargetName ( subterm ) ; } |
public class JaxbPortalDataHandlerService { /** * Ant path matching patterns that files must match to be included */
@ javax . annotation . Resource ( name = "dataFileIncludes" ) public void setDataFileIncludes ( Set < String > dataFileIncludes ) { } } | this . dataFileIncludes = dataFileIncludes ; |
public class IntrospectionLevelMember { /** * Return either null ( if the value doesn ' t need further introspection ) or
* the object reference if it does require further introspection
* @ param value
* The object that might require further introspection
* @ return null if the object doesn ' t require further introspection , value
* if it does */
private Object makeMember ( Object value ) { } } | Object answer = null ; // Assume we don ' t require further introspection
// until proved otherwise
if ( value != null ) { Class < ? > objClass = value . getClass ( ) ; if ( objClass . isArray ( ) ) { // Array ' s need further introspection if they ' re bigger than
// length 0
// AND of non - primitive type
if ( Array . getLength ( value ) > 0 && ! ( objClass . getComponentType ( ) . isPrimitive ( ) ) ) { answer = value ; } } else if ( ( objClass != String . class ) && ( objClass != Boolean . class ) && ( objClass != Character . class ) && ( objClass != Byte . class ) && ( objClass != Short . class ) && ( objClass != Integer . class ) && ( objClass != Long . class ) && ( objClass != Float . class ) && ( objClass != Double . class ) && ( objClass != String . class ) ) { answer = value ; } } return answer ; |
public class JKFormatUtil { /** * Format double .
* @ param amount the amount
* @ param pattern the pattern
* @ return the string */
public static String formatDouble ( final Double amount , String pattern ) { } } | if ( pattern == null || pattern . equals ( "" ) ) { pattern = JKFormatUtil . DEFAULT_DOUBLE_FORMAT ; } return JKFormatUtil . getNumberFormatter ( pattern ) . format ( amount ) ; |
public class WebcamComponent { /** * Returns the first webcam . */
public Webcam getWebcam ( Dimension dimension ) { } } | if ( webcams . size ( ) == 0 ) { throw new IllegalStateException ( "No webcams found" ) ; } Webcam webcam = webcams . values ( ) . iterator ( ) . next ( ) ; openWebcam ( webcam , dimension ) ; return webcam ; |
public class RandomVariableUniqueVariable { /** * Apply the AAD algorithm to this very variable
* NOTE : in this case it is indeed correct to assume that the output dimension is " one "
* meaning that there is only one { @ link RandomVariableUniqueVariable } as an output .
* @ return gradient for the built up function */
public RandomVariable [ ] getGradient ( ) { } } | // for now let us take the case for output - dimension equal to one !
int numberOfVariables = getNumberOfVariablesInList ( ) ; int numberOfCalculationSteps = factory . getNumberOfEntriesInList ( ) ; RandomVariable [ ] omega_hat = new RandomVariable [ numberOfCalculationSteps ] ; // first entry gets initialized
omega_hat [ numberOfCalculationSteps - 1 ] = new RandomVariableFromDoubleArray ( 1.0 ) ; /* * TODO : Find way that calculations form here on are not ' recorded ' by the factory
* IDEA : Let the calculation below run on { @ link RandomVariableFromDoubleArray } , ie cast everything down ! */
for ( int functionIndex = numberOfCalculationSteps - 2 ; functionIndex > 0 ; functionIndex -- ) { // apply chain rule
omega_hat [ functionIndex ] = new RandomVariableFromDoubleArray ( 0.0 ) ; /* TODO : save all D _ { i , j } * \ omega _ j in vector and sum up later */
for ( RandomVariableUniqueVariable parent : parentsVariables ) { int variableIndex = parent . getVariableID ( ) ; omega_hat [ functionIndex ] = omega_hat [ functionIndex ] . add ( getPartialDerivative ( functionIndex , variableIndex ) . mult ( omega_hat [ variableIndex ] ) ) ; } } /* Due to the fact that we can still introduce ' new ' true variables on the fly they are NOT the last couple of indices !
* Thus save the indices of the true variables and recover them after finalizing all the calculations
* IDEA : quit calculation after minimal true variable index is reached */
RandomVariable [ ] gradient = new RandomVariable [ numberOfVariables ] ; /* TODO : sort array in correct manner ! */
int [ ] indicesOfVariables = getIDsOfVariablesInList ( ) ; for ( int i = 0 ; i < numberOfVariables ; i ++ ) { gradient [ i ] = omega_hat [ numberOfCalculationSteps - numberOfVariables + indicesOfVariables [ i ] ] ; } return gradient ; |
public class LdapHelper { /** * Returns a new Instance of LdapHelper .
* @ param instance the identifyer of the LDAP Instance ( e . g . ldap1)
* @ return a new Instance . */
public static LdapHelper getInstance ( String instance ) { } } | if ( ! helpers . containsKey ( instance ) ) { helpers . put ( instance , new LdapHelper ( instance ) ) ; } LdapHelper helper = helpers . get ( instance ) ; if ( ! helper . online ) { helper . loadProperties ( ) ; } return helper ; |
public class CmsPropertyviewDialog { /** * Initializes the dialog object . */
private void initDialogObject ( ) { } } | Object o = getDialogObject ( ) ; if ( o != null ) { m_settings = ( CmsPropertyviewDialogSettings ) o ; } else { m_settings = new CmsPropertyviewDialogSettings ( ) ; setDialogObject ( m_settings ) ; } |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link UserDefinedCSRefType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link UserDefinedCSRefType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "userDefinedCSRef" ) public JAXBElement < UserDefinedCSRefType > createUserDefinedCSRef ( UserDefinedCSRefType value ) { } } | return new JAXBElement < UserDefinedCSRefType > ( _UserDefinedCSRef_QNAME , UserDefinedCSRefType . class , null , value ) ; |
public class UriComponentsBuilder { /** * Creates a new { @ code UriComponents } object from the string HTTP URL .
* < p > < strong > Note : < / strong > The presence of reserved characters can prevent
* correct parsing of the URI string . For example if a query parameter
* contains { @ code ' = ' } or { @ code ' & ' } characters , the query string cannot
* be parsed unambiguously . Such values should be substituted for URI
* variables to enable correct parsing :
* < pre class = " code " >
* String uriString = & quot ; / hotels / 42 ? filter = { value } & quot ; ;
* UriComponentsBuilder . fromUriString ( uriString ) . buildAndExpand ( & quot ; hot & amp ; cold & quot ; ) ;
* < / pre >
* @ param httpUrl the source URI
* @ return the URI components of the URI */
public static UriComponentsBuilder fromHttpUrl ( String httpUrl ) { } } | Assert . notNull ( httpUrl , "'httpUrl' must not be null" ) ; Matcher matcher = HTTP_URL_PATTERN . matcher ( httpUrl ) ; if ( matcher . matches ( ) ) { UriComponentsBuilder builder = new UriComponentsBuilder ( ) ; String scheme = matcher . group ( 1 ) ; builder . scheme ( scheme != null ? scheme . toLowerCase ( ) : null ) ; builder . userInfo ( matcher . group ( 4 ) ) ; String host = matcher . group ( 5 ) ; if ( StringUtils . hasLength ( scheme ) && ! StringUtils . hasLength ( host ) ) { throw new IllegalArgumentException ( "[" + httpUrl + "] is not a valid HTTP URL" ) ; } builder . host ( host ) ; String port = matcher . group ( 7 ) ; if ( StringUtils . hasLength ( port ) ) { builder . port ( port ) ; } builder . path ( matcher . group ( 8 ) ) ; builder . query ( matcher . group ( 10 ) ) ; return builder ; } else { throw new IllegalArgumentException ( "[" + httpUrl + "] is not a valid HTTP URL" ) ; } |
public class Searches { /** * Given a number of search fields , compute the SQL fragment
* used to order the searched / found rows
* ORDER BY least ( coalesce ( nullif ( position ( lower ( ? ) IN lower ( title ) ) , 0 ) , 9999 ) ,
* coalesce ( nullif ( position ( lower ( ? ) IN lower ( notes ) ) , 0 ) , 9999 ) . . .
* @ param searchFields Columns to search
* @ return
* @ throws Exception */
private String computeOrderFragment ( List < String > searchFields ) throws Exception { } } | if ( 0 == searchFields . size ( ) ) { return "" ; } return " ORDER BY " + computeSelectScore ( searchFields ) ; |
public class Controller { /** * This method returns a host name of a web server if this container is fronted by one , such that
* it sets a header < code > X - Forwarded - Host < / code > on the request and forwards it to the Java container .
* If such header is not present , than the { @ link # host ( ) } method is used .
* @ return host name of web server if < code > X - Forwarded - Host < / code > header is found , otherwise local host name . */
protected String getRequestHost ( ) { } } | String forwarded = header ( "X-Forwarded-Host" ) ; if ( StringUtil . blank ( forwarded ) ) { return host ( ) ; } String [ ] forwards = forwarded . split ( "," ) ; return forwards [ 0 ] . trim ( ) ; |
public class HibernateObjStore { /** * protected Logger log = LoggerFactory . getLogger ( HibernateDataObjectStore . class ) ; */
public Obj get ( String type , String id ) throws Exception { } } | return get ( type , id , type ) ; |
public class AcroFields { /** * Replaces the designated field with a new pushbutton . The pushbutton can be created with
* { @ link # getNewPushbuttonFromField ( String , int ) } from the same document or it can be a
* generic PdfFormField of the type pushbutton .
* @ param field the field name
* @ param button the < CODE > PdfFormField < / CODE > representing the pushbutton
* @ param order the field order in fields with same name
* @ return < CODE > true < / CODE > if the field was replaced , < CODE > false < / CODE > if the field
* was not a pushbutton
* @ since 2.0.7 */
public boolean replacePushbuttonField ( String field , PdfFormField button , int order ) { } } | if ( getFieldType ( field ) != FIELD_TYPE_PUSHBUTTON ) return false ; Item item = getFieldItem ( field ) ; if ( order >= item . size ( ) ) return false ; PdfDictionary merged = item . getMerged ( order ) ; PdfDictionary values = item . getValue ( order ) ; PdfDictionary widgets = item . getWidget ( order ) ; for ( int k = 0 ; k < buttonRemove . length ; ++ k ) { merged . remove ( buttonRemove [ k ] ) ; values . remove ( buttonRemove [ k ] ) ; widgets . remove ( buttonRemove [ k ] ) ; } for ( Iterator it = button . getKeys ( ) . iterator ( ) ; it . hasNext ( ) ; ) { PdfName key = ( PdfName ) it . next ( ) ; if ( key . equals ( PdfName . T ) || key . equals ( PdfName . RECT ) ) continue ; if ( key . equals ( PdfName . FF ) ) values . put ( key , button . get ( key ) ) ; else widgets . put ( key , button . get ( key ) ) ; merged . put ( key , button . get ( key ) ) ; } return true ; |
public class NetUtils { /** * This is used to get all the resolutions that were added using
* { @ link NetUtils # addStaticResolution ( String , String ) } . The return
* value is a List each element of which contains an array of String
* of the form String [ 0 ] = hostname , String [ 1 ] = resolved - hostname
* @ return the list of resolutions */
public static List < String [ ] > getAllStaticResolutions ( ) { } } | synchronized ( hostToResolved ) { Set < Entry < String , String > > entries = hostToResolved . entrySet ( ) ; if ( entries . size ( ) == 0 ) { return null ; } List < String [ ] > l = new ArrayList < String [ ] > ( entries . size ( ) ) ; for ( Entry < String , String > e : entries ) { l . add ( new String [ ] { e . getKey ( ) , e . getValue ( ) } ) ; } return l ; } |
public class MessageProcessorMatching { /** * Method addConsumerDispatcherMatchTarget
* Used to add a ConsumerDispatcher to the MatchSpace .
* @ param handler The consumer to add
* @ param topicSpace The name of the topic space to add against
* @ param discriminator The topic name
* @ param selector The filter for the consumer */
public void addConsumerDispatcherMatchTarget ( ConsumerDispatcher consumerDispatcher , SIBUuid12 topicSpace , SelectionCriteria criteria ) throws SIDiscriminatorSyntaxException , SISelectorSyntaxException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addConsumerDispatcherMatchTarget" , new Object [ ] { consumerDispatcher , topicSpace , criteria } ) ; // Combine the topicSpace and topic
String topicSpaceStr = topicSpace . toString ( ) ; String theTopic = buildAddTopicExpression ( topicSpaceStr , ( criteria == null ) ? null : criteria . getDiscriminator ( ) ) ; // Store the CD in the MatchSpace
try { // Set up the other parameters for addTarget
String selectorString = null ; SelectorDomain selectorDomain = SelectorDomain . SIMESSAGE ; Map < String , Object > selectorProperties = null ; Resolver resolver = null ; if ( criteria != null ) { selectorString = criteria . getSelectorString ( ) ; selectorDomain = criteria . getSelectorDomain ( ) ; // See if these criteria have any selector properties . They might if they are MPSelectionCriteria
if ( criteria instanceof MPSelectionCriteria ) { MPSelectionCriteria mpCriteria = ( MPSelectionCriteria ) criteria ; selectorProperties = mpCriteria . getSelectorProperties ( ) ; } if ( selectorString != null && selectorString . trim ( ) . length ( ) != 0 ) { if ( selectorDomain . equals ( SelectorDomain . JMS ) ) { resolver = _jmsResolver ; } else if ( selectorDomain . equals ( SelectorDomain . SIMESSAGE ) ) { resolver = _simessageResolver ; } else // In the XPath1.0 case we use the default resolver
{ resolver = _defaultResolver ; } } } // Set the CD and selection criteria into a wrapper that extends MatchTarget
MatchingConsumerDispatcher Matchkey = new MatchingConsumerDispatcher ( consumerDispatcher ) ; MatchingConsumerDispatcherWithCriteira key = new MatchingConsumerDispatcherWithCriteira ( consumerDispatcher , criteria ) ; addTarget ( key , // Use the CD and selection criteria as key
theTopic , selectorString , selectorDomain , resolver , // null will pick up the default resolver
Matchkey , // Use the wrapped cd as the Match key
null , selectorProperties ) ; // Now that this subscription is in the MatchSpace , let the subscription know .
consumerDispatcher . setIsInMatchSpace ( true ) ; } catch ( QuerySyntaxException e ) { // No FFDC code needed
SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addConsumerDispatcherMatchTarget" , "SISelectorSyntaxException" ) ; throw new SISelectorSyntaxException ( nls . getFormattedMessage ( "INVALID_SELECTOR_ERROR_CWSIP0371" , new Object [ ] { criteria } , null ) ) ; } catch ( InvalidTopicSyntaxException e ) { // No FFDC code needed
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addConsumerDispatcherMatchTarget" , e ) ; throw new SIDiscriminatorSyntaxException ( nls . getFormattedMessage ( "INVALID_TOPIC_ERROR_CWSIP0372" , new Object [ ] { ( criteria == null ) ? null : criteria . getDiscriminator ( ) } , null ) ) ; } catch ( MatchingException e ) { // FFDC
FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.matching.MessageProcessorMatching.addConsumerDispatcherMatchTarget" , "1:981:1.117.1.11" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addConsumerDispatcherMatchTarget" , "SIErrorException" ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.matching.MessageProcessorMatching" , "1:990:1.117.1.11" , e } ) ; throw new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.matching.MessageProcessorMatching" , "1:998:1.117.1.11" , e } , null ) , e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addConsumerDispatcherMatchTarget" ) ; |
public class AbstractSequenceClassifier { /** * Load a classifier from the specified InputStream . The classifier is
* reinitialized from the flags serialized in the classifier . This does not
* close the InputStream .
* @ param in
* The InputStream to load the serialized classifier from
* @ param props
* This Properties object will be used to update the
* SeqClassifierFlags which are read from the serialized classifier
* @ throws IOException
* If there are problems accessing the input stream
* @ throws ClassCastException
* If there are problems interpreting the serialized data
* @ throws ClassNotFoundException
* If there are problems interpreting the serialized data */
public void loadClassifier ( InputStream in , Properties props ) throws IOException , ClassCastException , ClassNotFoundException { } } | loadClassifier ( new ObjectInputStream ( in ) , props ) ; |
public class OutParameter { /** * ステートメントに出力パラメータを登録 。
* @ param callableStatement コーラブルステートメント
* @ param index パラメータインデックス
* @ return 次のパラメータインデックス
* @ throws SQLException SQL例外 */
protected int setOutParameter ( final CallableStatement callableStatement , int index ) throws SQLException { } } | callableStatement . registerOutParameter ( index , sqlType . getVendorTypeNumber ( ) ) ; parameterLog ( index ) ; index ++ ; return index ; |
public class GeneratorsGenerator { /** * / * ( non - Javadoc )
* @ see org . opoo . press . Generator # generate ( org . opoo . press . Site ) */
@ Override public void generate ( Site site ) { } } | if ( generators != null ) { for ( Generator g : generators ) { g . generate ( site ) ; } } |
public class CursorLoader { /** * Get a cursor based on a image reference on the classpath
* @ param ref The reference to the image to be loaded
* @ param x The x - coordinate of the cursor hotspot ( left - > right )
* @ param y The y - coordinate of the cursor hotspot ( bottom - > top )
* @ return The create cursor
* @ throws IOException Indicates a failure to load the image
* @ throws LWJGLException Indicates a failure to create the hardware cursor */
public Cursor getCursor ( String ref , int x , int y ) throws IOException , LWJGLException { } } | LoadableImageData imageData = null ; imageData = ImageDataFactory . getImageDataFor ( ref ) ; imageData . configureEdging ( false ) ; ByteBuffer buf = imageData . loadImage ( ResourceLoader . getResourceAsStream ( ref ) , true , true , null ) ; for ( int i = 0 ; i < buf . limit ( ) ; i += 4 ) { byte red = buf . get ( i ) ; byte green = buf . get ( i + 1 ) ; byte blue = buf . get ( i + 2 ) ; byte alpha = buf . get ( i + 3 ) ; buf . put ( i + 2 , red ) ; buf . put ( i + 1 , green ) ; buf . put ( i , blue ) ; buf . put ( i + 3 , alpha ) ; } try { int yspot = imageData . getHeight ( ) - y - 1 ; if ( yspot < 0 ) { yspot = 0 ; } return new Cursor ( imageData . getTexWidth ( ) , imageData . getTexHeight ( ) , x , yspot , 1 , buf . asIntBuffer ( ) , null ) ; } catch ( Throwable e ) { Log . info ( "Chances are you cursor is too small for this platform" ) ; throw new LWJGLException ( e ) ; } |
public class LogFileHeader { /** * Calculate the length in byte of this header . This method may be used by the
* log file handle to determine the size of the header when writing all pending
* records during a force .
* @ exception LogIncompatibleException The target object represents an incompatible
* header .
* @ exception InternalLogException The target object represents an invalid header . */
public int length ( ) throws InternalLogException , LogIncompatibleException { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "length" ) ; if ( ! _compatible ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "length" , "LogIncompatibleException" ) ; throw new LogIncompatibleException ( ) ; } if ( _status == STATUS_INVALID ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "length" , "LogHeaderInvalid - throwing InternalLogException" ) ; throw new InternalLogException ( null ) ; } // Calculate the length based on fixed and variable length data .
// Include the 4 bytes that are used to store the header ' s length
final int length = RLSUtils . INT_SIZE + headerSize ( ) + _serverNameBytes . length + _serviceNameBytes . length + _logNameBytes . length + ( _variableFieldData != null ? _variableFieldData . length : 0 ) + // " VARFIELD " included in HEADER _ SIZE even if _ variableFieldData is null
( _serviceData != null ? _serviceData . length : 0 ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "length" , new Integer ( length ) ) ; return length ; |
public class GoogleWebmasterExtractor { /** * Currently , the filter group is just one filter at a time , there is no cross - dimension filters combination .
* TODO : May need to implement this feature in the future based on use cases . */
private Iterable < Map < GoogleWebmasterFilter . Dimension , ApiDimensionFilter > > getFilterGroups ( WorkUnitState wuState ) { } } | List < Map < GoogleWebmasterFilter . Dimension , ApiDimensionFilter > > filters = new ArrayList < > ( ) ; for ( String filter : splitter . split ( wuState . getProp ( GoogleWebMasterSource . KEY_REQUEST_FILTERS ) ) ) { String [ ] parts = Iterables . toArray ( Splitter . on ( "." ) . split ( filter ) , String . class ) ; String dimString = parts [ 0 ] . toUpperCase ( ) ; String valueString = parts [ 1 ] . toUpperCase ( ) ; GoogleWebmasterFilter . Dimension dimension = GoogleWebmasterFilter . Dimension . valueOf ( dimString ) ; Map < GoogleWebmasterFilter . Dimension , ApiDimensionFilter > map = new HashMap < > ( ) ; if ( dimension == GoogleWebmasterFilter . Dimension . COUNTRY ) { map . put ( GoogleWebmasterFilter . Dimension . COUNTRY , GoogleWebmasterFilter . countryEqFilter ( valueString ) ) ; } else { throw new UnsupportedOperationException ( "Only country filter is supported for now" ) ; } filters . add ( map ) ; } return filters ; |
public class SeleniumElementSteps { /** * When */
@ When ( "^I drag the \"([^\"]*)\" onto the \"([^\"]*)\"$" ) public void I_drag_the_onto_the ( String draggableLocator , String dragReceiverLocator ) throws Throwable { } } | seleniumElementService . waitForLoaders ( ) ; seleniumElementService . dragElementTo ( draggableLocator , dragReceiverLocator , 5000 ) ; |
public class LogServlet { /** * This method get the Logs file directory
* @ return A { @ link File } that represents the location where the logs can be found . */
private File getLogsDirectory ( ) { } } | if ( logsDirectory != null ) { return logsDirectory ; } logsDirectory = new File ( SeLionGridConstants . LOGS_DIR ) ; if ( ! logsDirectory . exists ( ) ) { logsDirectory . mkdirs ( ) ; } return logsDirectory ; |
public class SharedPreferenceUtils { /** * Checks if debug menu item clicked or not .
* @ param context
* : context to start activity if debug item handled .
* @ param item
* : Menu item whose click is to be checked .
* @ return : < code > true < / code > if debug menu item is clicked , it will automatically Start the SharedPrefsBrowser activity . If debug menu item is
* not clicked , you can handle rest menu items in onOptionsItemSelcted code . */
public boolean isDebugHandled ( Context context , MenuItem item ) { } } | int id = item . getItemId ( ) ; if ( id == R . id . action_debug ) { startActivity ( context ) ; return true ; } return false ; |
public class OutputChannel { public void requestClose ( ) throws IOException , InterruptedException { } } | if ( this . senderCloseRequested ) { return ; } this . senderCloseRequested = true ; Envelope envelope = createNextEnvelope ( ) ; envelope . serializeEventList ( Arrays . asList ( new ChannelCloseEvent ( ) ) ) ; this . envelopeDispatcher . dispatchFromOutputChannel ( envelope ) ; |
public class J2CSecurityHelper { /** * Method to handle the GroupPrincipalCallback thereby establishing group principals within the argument subject .
* This callback is passed in by the Resource Adapter and handled by the J2CSecurityCallbackHandler that the
* Application Server implements .
* @ param callback The GroupPrincipalCallback instance that is passed in by the Resource Adapter .
* @ param executionSubject The Subject from the CallbackHandler under which the work will be executed .
* @ param addedCred The custom hashtable that will be used to create the credentials during login .
* @ param appRealm The name of the application realm .
* @ param invocations An array denoting the callbacks that have been invoked
* @ throws RemoteException This exception can be thrown by any operation on the UserRegistry as it extends java . rmi . Remote
* @ throws WSSecurityException Thrown when user registry operations fail . */
public static void handleGroupPrincipalCallback ( GroupPrincipalCallback callback , Subject executionSubject , Hashtable < String , Object > addedCred , String appRealm , Invocation [ ] invocations ) throws RemoteException , WSSecurityException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "handleGroupPrincipalCallback" , objectId ( callback ) ) ; } invocations [ 1 ] = Invocation . GROUPPRINCIPALCALLBACK ; Subject callSubject = callback . getSubject ( ) ; if ( ! executionSubject . equals ( callSubject ) ) { Tr . warning ( tc , "EXECUTION_CALLBACK_SUBJECT_MISMATCH_J2CA0673" , new Object [ ] { "GroupPrincipalCallback" } ) ; // callSubject = executionSubject ; / / Change from twas - jms - TODO - Not used , may need to look at this some more .
} String [ ] groups = callback . getGroups ( ) ; if ( groups != null && groups . length > 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Group names in Callback: " , Arrays . asList ( groups ) ) ; } List < String > groupNames = ( List < String > ) addedCred . get ( AttributeNameConstants . WSCREDENTIAL_GROUPS ) ; if ( groupNames == null ) { groupNames = new ArrayList < String > ( ) ; addedCred . put ( AttributeNameConstants . WSCREDENTIAL_GROUPS , groupNames ) ; } GetRegistry action = new GetRegistry ( appRealm ) ; UserRegistry registry = null ; try { registry = AccessController . doPrivileged ( action ) ; } catch ( PrivilegedActionException pae ) { Exception ex = pae . getException ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "handleGroupPrincipalCallback" ) ; } if ( ex instanceof WSSecurityException ) { throw ( WSSecurityException ) ex ; } else { // This means an unexpected runtime exception is wrapped in the PrivilegedActionException
throw new WSSecurityException ( ex ) ; } } for ( int i = 0 ; i < groups . length ; i ++ ) { String group = groups [ i ] ; if ( group == null || group . isEmpty ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Group is null or an empty string, it has been ignored." ) ; } continue ; } if ( registry . isValidGroup ( group ) ) { String groupName = registry . getUniqueGroupId ( group ) ; if ( ! groupNames . contains ( groupName ) ) { groupNames . add ( groupName ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Added groupId: " + groupName ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , groupName + " already exists in custom credential data, avoid duplicates." ) ; } } } else { Tr . warning ( tc , "INVALID_GROUP_ENCOUNTERED_J2CA0678" , group ) ; } } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Callback has no groups." ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Added Credentials" , addedCred ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "handleGroupPrincipalCallback" ) ; } |
public class SpringContainerHelper { /** * adds hooks to capture autowired constructor args and add them as dependencies
* @ return */
private static DefaultListableBeanFactory createBeanFactory ( ) { } } | return new DefaultListableBeanFactory ( ) { { final InstantiationStrategy is = getInstantiationStrategy ( ) ; setInstantiationStrategy ( new InstantiationStrategy ( ) { @ Override public Object instantiate ( RootBeanDefinition beanDefinition , String beanName , BeanFactory owner ) throws BeansException { return is . instantiate ( beanDefinition , beanName , owner ) ; } @ Override public Object instantiate ( RootBeanDefinition beanDefinition , String beanName , BeanFactory owner , Constructor < ? > ctor , Object [ ] args ) throws BeansException { final Object bean = is . instantiate ( beanDefinition , beanName , owner , ctor , args ) ; addDependencies ( bean , args ) ; return bean ; } @ Override public Object instantiate ( RootBeanDefinition beanDefinition , String beanName , BeanFactory owner , Object factoryBean , Method factoryMethod , Object [ ] args ) throws BeansException { final Object bean = is . instantiate ( beanDefinition , beanName , owner , factoryBean , factoryMethod , args ) ; addDependencies ( bean , args ) ; return bean ; } } ) ; } private void addDependencies ( Object bean , Object [ ] args ) { if ( bean instanceof Service ) { for ( Object arg : args ) { if ( arg instanceof Service ) { ( ( Service ) arg ) . addDependedBy ( ( Service ) bean ) ; ( ( Service ) bean ) . addDependsOn ( ( Service ) arg ) ; } } } } } ; |
public class CmsTwoListsDialog { /** * Returns the html code for the default action content . < p >
* @ return html code */
protected String defaultActionHtmlContent ( ) { } } | StringBuffer result = new StringBuffer ( 2048 ) ; result . append ( "<table id='twolists' cellpadding='0' cellspacing='0' align='center' width='100%'>\n" ) ; result . append ( "\t<tr>\n" ) ; result . append ( "\t\t<td width='50%' valign='top'>\n" ) ; result . append ( "\t\t\t" ) . append ( m_firstWp . defaultActionHtmlContent ( ) ) . append ( "\n" ) ; result . append ( "\t\t</td>\n" ) ; result . append ( "\t\t<td width='20'> </td>" ) ; result . append ( "\t\t<td width='50%' valign='top'>\n" ) ; result . append ( "\t\t\t" ) . append ( m_secondWp . defaultActionHtmlContent ( ) ) . append ( "\n" ) ; result . append ( "\t\t</td>\n" ) ; result . append ( "\t</tr>\n" ) ; result . append ( "</table>\n" ) ; return result . toString ( ) ; |
public class PresenterManager { /** * Get the Activity of a context . This is typically used to determine the hosting activity of a
* { @ link View }
* @ param context The context
* @ return The Activity or throws an Exception if Activity couldnt be determined */
@ NonNull public static Activity getActivity ( @ NonNull Context context ) { } } | if ( context == null ) { throw new NullPointerException ( "context == null" ) ; } if ( context instanceof Activity ) { return ( Activity ) context ; } while ( context instanceof ContextWrapper ) { if ( context instanceof Activity ) { return ( Activity ) context ; } context = ( ( ContextWrapper ) context ) . getBaseContext ( ) ; } throw new IllegalStateException ( "Could not find the surrounding Activity" ) ; |
public class SecurityController { /** * Create { @ link GeneratedClassLoader } with restrictions imposed by
* staticDomain and all current stack frames .
* The method uses the SecurityController instance associated with the
* current { @ link Context } to construct proper dynamic domain and create
* corresponding class loader .
* If no SecurityController is associated with the current { @ link Context } ,
* the method calls { @ link Context # createClassLoader ( ClassLoader parent ) } .
* @ param parent parent class loader . If null ,
* { @ link Context # getApplicationClassLoader ( ) } will be used .
* @ param staticDomain static security domain . */
public static GeneratedClassLoader createLoader ( ClassLoader parent , Object staticDomain ) { } } | Context cx = Context . getContext ( ) ; if ( parent == null ) { parent = cx . getApplicationClassLoader ( ) ; } SecurityController sc = cx . getSecurityController ( ) ; GeneratedClassLoader loader ; if ( sc == null ) { loader = cx . createClassLoader ( parent ) ; } else { Object dynamicDomain = sc . getDynamicSecurityDomain ( staticDomain ) ; loader = sc . createClassLoader ( parent , dynamicDomain ) ; } return loader ; |
public class TheMovieDbApi { /** * This method is used to retrieve all of the basic movie information .
* It will return the single highest rated poster and backdrop .
* ApiExceptionType . MOVIE _ ID _ NOT _ FOUND will be thrown if there are no movies
* found .
* @ param movieId movieId
* @ param language language
* @ param appendToResponse appendToResponse
* @ return
* @ throws MovieDbException exception */
public MovieInfo getMovieInfo ( int movieId , String language , String ... appendToResponse ) throws MovieDbException { } } | return tmdbMovies . getMovieInfo ( movieId , language , appendToResponse ) ; |
public class SVGPlot { /** * Clone the SVGPlot document for transcoding .
* This will usually be necessary for exporting the SVG document if it is
* currently being displayed : otherwise , we break the Batik rendering trees .
* ( Discovered by Simon ) .
* @ return cloned document */
protected SVGDocument cloneDocument ( ) { } } | return ( SVGDocument ) new CloneInlineImages ( ) { @ Override public Node cloneNode ( Document doc , Node eold ) { // Skip elements with noexport attribute set
if ( eold instanceof Element ) { Element eeold = ( Element ) eold ; String vis = eeold . getAttribute ( NO_EXPORT_ATTRIBUTE ) ; if ( vis != null && vis . length ( ) > 0 ) { return null ; } } return super . cloneNode ( doc , eold ) ; } } . cloneDocument ( getDomImpl ( ) , document ) ; |
public class SqlGeneratorDefaultImpl { /** * Answer the SQL - Clause for a NullCriteria
* @ param c NullCriteria */
private String toSQLClause ( NullCriteria c ) { } } | String colName = ( String ) c . getAttribute ( ) ; return colName + c . getClause ( ) ; |
public class LogHelper { /** * Configures JUL ( java . util . logging ) using the logging . properties file located in this package .
* Only use this method for testing purposes , clients should configure logging themselves - that
* is you need to provide a logging bridge for SLF4J compatible to your logging infrastructure , or
* use SLF4J no - op logger . */
public static final void configureJavaUtilLogging ( ) { } } | try ( InputStream is = LogHelper . class . getResourceAsStream ( "logging.properties" ) ) { if ( is == null ) { throw new IOException ( "Can't find/open logging.properties" ) ; } LogManager logMan = LogManager . getLogManager ( ) ; logMan . readConfiguration ( is ) ; } catch ( final IOException e ) { java . util . logging . Logger . getAnonymousLogger ( ) . severe ( "Could not load development logging.properties file using " + "LogHelper.class.getResourceAsStream(\"/logging.properties\")" ) ; java . util . logging . Logger . getAnonymousLogger ( ) . severe ( e . getMessage ( ) ) ; } |
public class TypeUtil { /** * Get the super type for a type in its super type chain , which has
* a raw class that matches the specified class .
* @ param subType the sub type to find super type for
* @ param rawSuperType the raw class for the super type
* @ return the super type that matches the requirement */
public static Type getSuperType ( Type subType , Class < ? > rawSuperType ) { } } | while ( subType != null && getRawClass ( subType ) != rawSuperType ) { subType = getSuperType ( subType ) ; } return subType ; |
public class DisableEnhancedMonitoringResult { /** * Represents the list of all the metrics that would be in the enhanced state after the operation .
* @ return Represents the list of all the metrics that would be in the enhanced state after the operation .
* @ see MetricsName */
public java . util . List < String > getDesiredShardLevelMetrics ( ) { } } | if ( desiredShardLevelMetrics == null ) { desiredShardLevelMetrics = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return desiredShardLevelMetrics ; |
public class hqlLexer { /** * $ ANTLR start " WS " */
public final void mWS ( ) throws RecognitionException { } } | try { int _type = WS ; int _channel = DEFAULT_TOKEN_CHANNEL ; // hql . g : 791:5 : ( ( ' ' | ' \ \ t ' | ' \ \ r ' ' \ \ n ' | ' \ \ n ' | ' \ \ r ' ) )
// hql . g : 791:9 : ( ' ' | ' \ \ t ' | ' \ \ r ' ' \ \ n ' | ' \ \ n ' | ' \ \ r ' )
{ // hql . g : 791:9 : ( ' ' | ' \ \ t ' | ' \ \ r ' ' \ \ n ' | ' \ \ n ' | ' \ \ r ' )
int alt4 = 5 ; switch ( input . LA ( 1 ) ) { case ' ' : { alt4 = 1 ; } break ; case '\t' : { alt4 = 2 ; } break ; case '\r' : { int LA4_3 = input . LA ( 2 ) ; if ( ( LA4_3 == '\n' ) ) { alt4 = 3 ; } else { alt4 = 5 ; } } break ; case '\n' : { alt4 = 4 ; } break ; default : if ( state . backtracking > 0 ) { state . failed = true ; return ; } NoViableAltException nvae = new NoViableAltException ( "" , 4 , 0 , input ) ; throw nvae ; } switch ( alt4 ) { case 1 : // hql . g : 791:13 : ' '
{ match ( ' ' ) ; if ( state . failed ) return ; } break ; case 2 : // hql . g : 792:7 : ' \ \ t '
{ match ( '\t' ) ; if ( state . failed ) return ; } break ; case 3 : // hql . g : 793:7 : ' \ \ r ' ' \ \ n '
{ match ( '\r' ) ; if ( state . failed ) return ; match ( '\n' ) ; if ( state . failed ) return ; } break ; case 4 : // hql . g : 794:7 : ' \ \ n '
{ match ( '\n' ) ; if ( state . failed ) return ; } break ; case 5 : // hql . g : 795:7 : ' \ \ r '
{ match ( '\r' ) ; if ( state . failed ) return ; } break ; } if ( state . backtracking == 0 ) { skip ( ) ; } } state . type = _type ; state . channel = _channel ; } finally { // do for sure before leaving
} |
public class TechnologyTargeting { /** * Gets the mobileDeviceTargeting value for this TechnologyTargeting .
* @ return mobileDeviceTargeting * The mobile devices being targeted by the { @ link LineItem } . */
public com . google . api . ads . admanager . axis . v201808 . MobileDeviceTargeting getMobileDeviceTargeting ( ) { } } | return mobileDeviceTargeting ; |
public class MPXWriter { /** * This method formats a time unit .
* @ param timeUnit time unit instance
* @ return formatted time unit instance */
private String formatTimeUnit ( TimeUnit timeUnit ) { } } | int units = timeUnit . getValue ( ) ; String result ; String [ ] [ ] unitNames = LocaleData . getStringArrays ( m_locale , LocaleData . TIME_UNITS_ARRAY ) ; if ( units < 0 || units >= unitNames . length ) { result = "" ; } else { result = unitNames [ units ] [ 0 ] ; } return ( result ) ; |
public class TransformFilter { /** * Initializes the filter . */
protected void initializeFilter ( InputStream filterInput , OutputStream filterOutput ) { } } | try { // Create Transformer object .
Source transform = getTransform ( ) ; if ( transform == null ) { throw new IllegalStateException ( "No XSLT transform specified" ) ; } TransformerFactory factory = TransformerFactory . newInstance ( ) ; factory . setErrorListener ( this ) ; transformer_ = factory . newTransformer ( transform ) ; transformer_ . setErrorListener ( this ) ; if ( transformParams_ != null ) { for ( String paramName : transformParams_ . keySet ( ) ) { transformer_ . setParameter ( paramName , transformParams_ . get ( paramName ) ) ; } } transformSource_ = new StreamSource ( filterInput ) ; transformResult_ = new StreamResult ( filterOutput ) ; } catch ( Exception e ) { throw new RuntimeException ( "Can't initialize filter" , e ) ; } |
public class DateUtils { /** * Parses the specified date string as a compressedIso8601DateFormat ( " yyyyMMdd ' T ' HHmmss ' Z ' " ) and returns the Date
* object .
* @ param dateString
* The date string to parse .
* @ return The parsed Date object . */
public static Date parseCompressedISO8601Date ( String dateString ) { } } | try { return new Date ( compressedIso8601DateFormat . parseMillis ( dateString ) ) ; } catch ( RuntimeException ex ) { throw handleException ( ex ) ; } |
public class AssociationExecutionMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AssociationExecution associationExecution , ProtocolMarshaller protocolMarshaller ) { } } | if ( associationExecution == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( associationExecution . getAssociationId ( ) , ASSOCIATIONID_BINDING ) ; protocolMarshaller . marshall ( associationExecution . getAssociationVersion ( ) , ASSOCIATIONVERSION_BINDING ) ; protocolMarshaller . marshall ( associationExecution . getExecutionId ( ) , EXECUTIONID_BINDING ) ; protocolMarshaller . marshall ( associationExecution . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( associationExecution . getDetailedStatus ( ) , DETAILEDSTATUS_BINDING ) ; protocolMarshaller . marshall ( associationExecution . getCreatedTime ( ) , CREATEDTIME_BINDING ) ; protocolMarshaller . marshall ( associationExecution . getLastExecutionDate ( ) , LASTEXECUTIONDATE_BINDING ) ; protocolMarshaller . marshall ( associationExecution . getResourceCountByStatus ( ) , RESOURCECOUNTBYSTATUS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MainForm { /** * set the selected look and feel
* @ since 01.07.2006
* @ param lookAndFeelClassName
* @ return */
private void setLookAndFeel ( String lookAndFeelClassName ) { } } | try { javax . swing . UIManager . setLookAndFeel ( lookAndFeelClassName ) ; } catch ( Throwable e ) { showMessage ( "The selected Look&Feel is not supported or not reachable through the classpath. Switching to system default..." ) ; try { lookAndFeelClassName = javax . swing . UIManager . getSystemLookAndFeelClassName ( ) ; javax . swing . UIManager . setLookAndFeel ( lookAndFeelClassName ) ; } catch ( Throwable e1 ) { Log . error ( "[MainForm]" , e1 ) ; } } |
public class TmdbPeople { /** * Get the images that have been tagged with a specific person id .
* We return all of the image results with a media object mapped for each
* image .
* @ param personId
* @ param page
* @ param language
* @ return
* @ throws com . omertron . themoviedbapi . MovieDbException */
public ResultList < ArtworkMedia > getPersonTaggedImages ( int personId , Integer page , String language ) throws MovieDbException { } } | TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . ID , personId ) ; parameters . add ( Param . PAGE , page ) ; parameters . add ( Param . LANGUAGE , language ) ; URL url = new ApiUrl ( apiKey , MethodBase . PERSON ) . subMethod ( MethodSub . TAGGED_IMAGES ) . buildUrl ( parameters ) ; WrapperGenericList < ArtworkMedia > wrapper = processWrapper ( getTypeReference ( ArtworkMedia . class ) , url , "tagged images" ) ; return wrapper . getResultsList ( ) ; |
public class StringUtils { /** * Constructs and returns a string object that is the result of interposing a separator between the elements of the list */
public static < T > String join ( List < T > list , String separator ) { } } | StringBuilder builder = new StringBuilder ( ) ; int i = 0 ; for ( T t : list ) { builder . append ( t ) ; if ( ++ i < list . size ( ) ) builder . append ( separator ) ; } return builder . toString ( ) ; |
public class DefaultGroovyMethods { /** * Iterates through the map transforming items using the supplied closure
* and collecting any non - null results .
* If the closure takes two parameters , the entry key and value are passed .
* If the closure takes one parameter , the Map . Entry object is passed .
* Example :
* < pre class = " groovyTestCase " >
* def map = [ a : 1 , b : 2 , hi : 2 , cat : 3 , dog : 2]
* def result = map . findResults { k , v { @ code - > } k . size ( ) = = v ? " Found $ k : $ v " : null }
* assert result = = [ " Found a : 1 " , " Found hi : 2 " , " Found cat : 3 " ]
* < / pre >
* @ param self a Map
* @ param filteringTransform a 1 or 2 arg Closure that should return either a non - null transformed value or null for items which should be discarded
* @ return the list of non - null transformed values
* @ since 1.8.1 */
public static < T , K , V > Collection < T > findResults ( Map < K , V > self , @ ClosureParams ( MapEntryOrKeyValue . class ) Closure < T > filteringTransform ) { } } | List < T > result = new ArrayList < T > ( ) ; for ( Map . Entry < K , V > entry : self . entrySet ( ) ) { T transformed = callClosureForMapEntry ( filteringTransform , entry ) ; if ( transformed != null ) { result . add ( transformed ) ; } } return result ; |
public class LineDrawer { /** * Draws line ( p1 , p2 ) by plotting points using plot
* @ param p1
* @ param p2
* @ param plot
* @ param color */
public static void drawLine ( Point p1 , Point p2 , PlotOperator plot ) { } } | drawLine ( p1 . x , p1 . y , p2 . x , p2 . y , plot ) ; |
public class ScoreTemplate { /** * Returns position of a field
* @ param field
* one of { @ link ScoreElements } constants
* @ return an array of 2 bytes : [ VerticalPosition . xxx , HorizontalAlign . xxx ]
* < TT > null < / TT > if position has not been defined */
public byte [ ] getPosition ( byte field ) { } } | Iterator it = m_fieldsPosition . keySet ( ) . iterator ( ) ; Byte B = field ; while ( it . hasNext ( ) ) { Position p = ( Position ) it . next ( ) ; if ( ( ( Vector ) m_fieldsPosition . get ( p ) ) . contains ( B ) ) { return new byte [ ] { p . m_vertical , p . m_horizontal } ; } } if ( field != ScoreElements . _DEFAULT ) { return getPosition ( ScoreElements . _DEFAULT ) ; } return null ; |
public class Variable { /** * Add a fuzzy member to this variable .
* @ param memberName member name
* @ param functionCall the function call
* @ return the member */
public Member addMember ( String memberName , FunctionCall functionCall ) { } } | if ( haveMember ( memberName ) ) { throw new FuzzerException ( memberName + ": member already exists of variable '" + name + "'" ) ; } Member member = new Member ( memberName , functionCall ) ; members . add ( member ) ; return member ; |
public class CalendarSystem { /** * Returns a < code > CalendarSystem < / code > specified by the calendar
* name . The calendar name has to be one of the supported calendar
* names .
* @ param calendarName the calendar name
* @ return the < code > CalendarSystem < / code > specified by
* < code > calendarName < / code > , or null if there is no
* < code > CalendarSystem < / code > associated with the given calendar name . */
public static CalendarSystem forName ( String calendarName ) { } } | if ( "gregorian" . equals ( calendarName ) ) { return GregorianHolder . INSTANCE ; } else if ( "julian" . equals ( calendarName ) ) { return JulianHolder . INSTANCE ; } return null ; /* J2ObjC changed : Only " gregorian " and " julian " calendars are supported .
CalendarSystem cal = calendars . get ( calendarName ) ;
if ( cal ! = null ) {
return cal ;
Class < ? > calendarClass = names . get ( calendarName ) ;
if ( calendarClass = = null ) {
return null ; / / Unknown calendar name
if ( calendarClass . isAssignableFrom ( LocalGregorianCalendar . class ) ) {
/ / Create the specific kind of local Gregorian calendar system
cal = LocalGregorianCalendar . getLocalGregorianCalendar ( calendarName ) ;
} else {
try {
cal = ( CalendarSystem ) calendarClass . newInstance ( ) ;
} catch ( Exception e ) {
throw new RuntimeException ( " internal error " , e ) ;
if ( cal = = null ) {
return null ;
CalendarSystem cs = calendars . putIfAbsent ( calendarName , cal ) ;
return ( cs = = null ) ? cal : cs ; */ |
public class SpringUtils { /** * Extracts all routes from the annotated class
* @ param controllerClazz
* Instrospected class
* @ return At least 1 route value ( empty string ) */
public static String [ ] getControllerResquestMapping ( Class < ? > controllerClazz ) { } } | String [ ] controllerRequestMappingValues = { } ; // Determine if we will use class - level requestmapping or dummy string
RequestMapping classRequestMapping = AnnotationUtils . findAnnotation ( controllerClazz , RequestMapping . class ) ; if ( classRequestMapping != null ) { controllerRequestMappingValues = classRequestMapping . value ( ) ; } if ( controllerRequestMappingValues . length == 0 ) { controllerRequestMappingValues = new String [ 1 ] ; controllerRequestMappingValues [ 0 ] = "" ; } return controllerRequestMappingValues ; |
public class Queue { /** * Instantiate the Queues BatchProcessServer . Will ask the parent Queue
* to instantiate its BatchProcessServer if this Queue doesn ' t have one . */
public BatchProcessServer getBatchProcessServer ( ) { } } | if ( process_server_class != null ) { try { return process_server_class . newInstance ( ) ; } catch ( Exception e ) { throw new QueujException ( e ) ; } } if ( parent_queue != null ) return parent_queue . getBatchProcessServer ( ) ; // else
throw new QueujException ( "No BatchProcessServer exists for Queue" ) ; |
public class IabHelper { /** * Workaround to bug where sometimes response codes come as Long instead of Integer */
int getResponseCodeFromBundle ( Bundle b ) { } } | Object o = b . get ( RESPONSE_CODE ) ; if ( o == null ) { logDebug ( "Bundle with null response code, assuming OK (known issue)" ) ; return BILLING_RESPONSE_RESULT_OK ; } else if ( o instanceof Integer ) return ( ( Integer ) o ) . intValue ( ) ; else if ( o instanceof Long ) return ( int ) ( ( Long ) o ) . longValue ( ) ; else { logError ( "Unexpected type for bundle response code." ) ; logError ( o . getClass ( ) . getName ( ) ) ; throw new RuntimeException ( "Unexpected type for bundle response code: " + o . getClass ( ) . getName ( ) ) ; } |
public class InfluxDBEventReporter { /** * Extracts the event and its metadata from { @ link GobblinTrackingEvent } and creates
* timestamped name value pairs
* @ param event { @ link GobblinTrackingEvent } to be reported
* @ throws IOException */
private void pushEvent ( GobblinTrackingEvent event ) throws IOException { } } | Map < String , String > metadata = event . getMetadata ( ) ; String name = getMetricName ( metadata , event . getName ( ) ) ; long timestamp = event . getTimestamp ( ) ; MultiPartEvent multiPartEvent = MultiPartEvent . getEvent ( metadata . get ( EventSubmitter . EVENT_TYPE ) ) ; if ( multiPartEvent == null ) { influxDBPusher . push ( buildEventAsPoint ( name , EMTPY_VALUE , timestamp ) ) ; } else { List < Point > points = Lists . newArrayList ( ) ; for ( String field : multiPartEvent . getMetadataFields ( ) ) { Point point = buildEventAsPoint ( JOINER . join ( name , field ) , convertValue ( field , metadata . get ( field ) ) , timestamp ) ; points . add ( point ) ; } influxDBPusher . push ( points ) ; } |
public class CollaboratorHelperImpl { /** * Returns true / false to indicate whether there is a ' real ' collaborator registered for the current application ( based on the SecurityDomain
* specified by the application ) . */
public static boolean getCurrentSecurityEnabled ( ) { } } | boolean enabled = false ; ICollaboratorHelper instance = getCurrentInstance ( ) ; if ( instance != null ) enabled = ( ( CollaboratorHelperImpl ) instance ) . isSecurityEnabled ( ) ; return enabled ; |
public class MemoryStorage { /** * { @ inheritDoc } */
@ Override public Collection < ? extends SagaState > load ( final String type , final Object instanceKey ) { } } | Collection < ? extends SagaState > items ; synchronized ( sync ) { items = new ArrayList < > ( instanceKeyMap . get ( SagaMultiKey . create ( type , instanceKey ) ) ) ; } return items ; |
public class SailthruClient { /** * get information about a blast
* @ param blastId
* @ return JsonResponse
* @ throws IOException */
public JsonResponse getBlast ( Integer blastId ) throws IOException { } } | Blast blast = new Blast ( ) ; blast . setBlastId ( blastId ) ; return apiGet ( blast ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.