signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ExtendedProperties { /** * Created an instance from the specified { @ link java . util . Properties } instance .
* @ param props
* The properties instance
* @ return The { @ link ExtendedProperties } instance */
public static ExtendedProperties fromProperties ( final Properties props ) { } } | ExtendedProperties result = new ExtendedProperties ( ) ; for ( Enumeration < ? > en = props . propertyNames ( ) ; en . hasMoreElements ( ) ; ) { String key = ( String ) en . nextElement ( ) ; String value = props . getProperty ( key ) ; result . put ( key , value ) ; } return result ; |
public class InstallToRemoteAccessSessionRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( InstallToRemoteAccessSessionRequest installToRemoteAccessSessionRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( installToRemoteAccessSessionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( installToRemoteAccessSessionRequest . getRemoteAccessSessionArn ( ) , REMOTEACCESSSESSIONARN_BINDING ) ; protocolMarshaller . marshall ( installToRemoteAccessSessionRequest . getAppArn ( ) , APPARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class RegularEnumSet { /** * Adds all of the elements in the specified collection to this set .
* @ param c collection whose elements are to be added to this set
* @ return < tt > true < / tt > if this set changed as a result of the call
* @ throws NullPointerException if the specified collection or any
* of its elements are null */
public boolean addAll ( Collection < ? extends E > c ) { } } | if ( ! ( c instanceof RegularEnumSet ) ) return super . addAll ( c ) ; RegularEnumSet < ? > es = ( RegularEnumSet < ? > ) c ; if ( es . elementType != elementType ) { if ( es . isEmpty ( ) ) return false ; else throw new ClassCastException ( es . elementType + " != " + elementType ) ; } long oldElements = elements ; elements |= es . elements ; return elements != oldElements ; |
public class Fetcher { /** * Adds the element and all its children
* ( found via traversing into object properties that
* pass all the filters defined in the Constructor , and
* also taking # isSkipSubPathways into account )
* to the target model .
* This method fails if there are different child objects
* with the same ID , because normally a good ( self - consistent )
* model does not contain duplicate BioPAX elements . Consider
* using { @ link # fetch ( BioPAXElement ) } method instead if you
* want to get all the child elements anyway .
* @ param element the BioPAX element to be added into the model
* @ param model model into which elements will be added */
public void fetch ( final BioPAXElement element , final Model model ) { } } | if ( ! model . containsID ( element . getUri ( ) ) ) model . add ( element ) ; Set < BioPAXElement > children = fetch ( element ) ; for ( BioPAXElement e : children ) { if ( ! model . containsID ( e . getUri ( ) ) ) { model . add ( e ) ; } else if ( ! model . contains ( e ) ) { throw new AssertionError ( "fetch(bioPAXElement, model): found different child objects " + "with the same URI: " + e . getUri ( ) + "(replace/merge, or use fetch(bioPAXElement) instead!)" ) ; } } |
public class StreamableTuple { /** * Creates a tuple with the specified two objects . */
public static < L , R > StreamableTuple < L , R > newTuple ( L left , R right ) { } } | return new StreamableTuple < L , R > ( left , right ) ; |
public class JKObjectUtil { /** * Checks if is boolean .
* @ param type the type
* @ return true , if is boolean */
public static boolean isBoolean ( final Class type ) { } } | if ( Boolean . class . isAssignableFrom ( type ) ) { return true ; } return type . getName ( ) . equals ( "boolean" ) ; |
public class ZipArchive { /** * Adds a file to a ZIP archive , given its path .
* @ param zipEntry
* the name of the entry in the archive ; if null , the name of the original
* file is used .
* @ param filename
* The path of a file to be added to the ZIP archive . */
public void addFile ( String zipEntry , String filename ) throws IOException { } } | addFile ( zipEntry , new File ( filename ) ) ; |
public class MatrixVectorReader { /** * Reads a coordinate vector . First data array contains real entries , and
* the second contains imaginary entries */
public void readCoordinate ( int [ ] index , float [ ] dataR , float [ ] dataI ) throws IOException { } } | int size = index . length ; if ( size != dataR . length || size != dataI . length ) throw new IllegalArgumentException ( "All arrays must be of the same size" ) ; for ( int i = 0 ; i < size ; ++ i ) { index [ i ] = getInt ( ) ; dataR [ i ] = getFloat ( ) ; dataI [ i ] = getFloat ( ) ; } |
public class SystemUtil { /** * Tries to get the current version of MacOS / MacOS X .
* The version usually looks like ' 10.13.4 ' , where the part behind the last dot represents the patchlevel .
* The major version in this case would be ' 10.13 ' .
* @ return version without patchlevel or null */
public static String getMacOsMajorVersion ( ) { } } | if ( ! isMacOs ( ) ) { return null ; } String osVersion = System . getProperty ( "os.version" ) ; if ( osVersion != null ) { String [ ] split = osVersion . split ( "\\." ) ; if ( split . length >= 2 ) { return split [ 0 ] + "." + split [ 1 ] ; } else { return osVersion ; } } return null ; |
public class ContactsApi { /** * Get a list of contacts for the calling user .
* < br >
* This method requires authentication with ' read ' permission .
* @ param filter Optional . Filter the results that are returned .
* @ param page Optional . The page of results to return . If this argument is zero , it defaults to 1.
* @ param perPage Optional . Number of photos to return per page . If this argument is zero , it defaults to 1000 . The maximum allowed value is 1000.
* @ param contactSort Optional . The order in which to sort the returned contacts . If this argument is null , defaults to name .
* @ return object containing contacts matching the parameters .
* @ throws JinxException if there are any errors .
* @ see < a href = " https : / / www . flickr . com / services / api / flickr . contacts . getList . html " > flickr . contacts . getList < / a > */
public Contacts getList ( JinxConstants . ContactFilter filter , int page , int perPage , JinxConstants . ContactSort contactSort ) throws JinxException { } } | Map < String , String > params = new TreeMap < > ( ) ; params . put ( "method" , "flickr.contacts.getList" ) ; if ( filter != null ) { params . put ( "filter" , filter . toString ( ) ) ; } if ( page > 0 ) { params . put ( "page" , Integer . toString ( page ) ) ; } if ( perPage > 0 ) { params . put ( "per_page" , Integer . toString ( perPage ) ) ; } if ( contactSort != null ) { params . put ( "sort" , contactSort . toString ( ) ) ; } return jinx . flickrGet ( params , Contacts . class ) ; |
public class MediaStoreServiceImpl { /** * Extract a list of imageDTO from current cursor with the given offset and limit .
* @ param cursor
* @ param offset
* @ param limit
* @ return */
protected List < ImageDTO > extractImagesFromCursor ( Cursor cursor , int offset , int limit ) { } } | List < ImageDTO > images = new ArrayList < > ( ) ; int count = 0 ; int begin = offset > 0 ? offset : 0 ; if ( cursor . moveToPosition ( begin ) ) { do { ImageDTO image = extractOneImageFromCurrentCursor ( cursor ) ; images . add ( image ) ; count ++ ; if ( limit > 0 && count > limit ) { break ; } } while ( cursor . moveToNext ( ) ) ; } cursor . close ( ) ; return images ; |
public class AbstractXtypeSemanticSequencer { /** * Contexts :
* JvmTypeReference returns JvmGenericArrayTypeReference
* JvmTypeReference . JvmGenericArrayTypeReference _ 0_1_0_0 returns JvmGenericArrayTypeReference
* JvmArgumentTypeReference returns JvmGenericArrayTypeReference
* Constraint :
* componentType = JvmTypeReference _ JvmGenericArrayTypeReference _ 0_1_0_0 */
protected void sequence_JvmTypeReference ( ISerializationContext context , JvmGenericArrayTypeReference semanticObject ) { } } | if ( errorAcceptor != null ) { if ( transientValues . isValueTransient ( semanticObject , TypesPackage . Literals . JVM_GENERIC_ARRAY_TYPE_REFERENCE__COMPONENT_TYPE ) == ValueTransient . YES ) errorAcceptor . accept ( diagnosticProvider . createFeatureValueMissing ( semanticObject , TypesPackage . Literals . JVM_GENERIC_ARRAY_TYPE_REFERENCE__COMPONENT_TYPE ) ) ; } SequenceFeeder feeder = createSequencerFeeder ( context , semanticObject ) ; feeder . accept ( grammarAccess . getJvmTypeReferenceAccess ( ) . getJvmGenericArrayTypeReferenceComponentTypeAction_0_1_0_0 ( ) , semanticObject . getComponentType ( ) ) ; feeder . finish ( ) ; |
public class SchemaTypeResource { /** * - - - - - public static methods - - - - - */
public static ResultStream getSchemaTypeResult ( final SecurityContext securityContext , final Class type , final String propertyView ) throws FrameworkException { } } | return new PagingIterable < > ( SchemaHelper . getSchemaTypeInfo ( securityContext , rawType , type , propertyView ) ) ; |
public class DeviceAttributeDAODefaultImpl { public void insert_ul ( final long [ ] argIn ) { } } | attributeValue_5 . data_format = AttrDataFormat . FMT_UNKNOWN ; final int [ ] values = new int [ argIn . length ] ; for ( int i = 0 ; i < argIn . length ; i ++ ) { values [ i ] = ( int ) argIn [ i ] ; } attributeValue_5 . w_dim . dim_x = argIn . length ; attributeValue_5 . w_dim . dim_y = 0 ; if ( use_union ) { attributeValue_5 . value . ulong_att_value ( values ) ; } else { deviceAttribute_3 . insert_ul ( argIn ) ; } |
public class Cookie { /** * Equivalent to { @ link # builder ( String , String ) } .
* @ param name the cookie ' s name
* @ param value the cookie ' s value
* @ return the new builder */
public static Builder cookie ( String name , String value ) { } } | return builder ( name , value ) // Populate default :
. setPath ( "/" ) . setHttpOnly ( true ) . setSecure ( false ) . setMaxAge ( 3600 ) ; |
public class StaticCalendarDetector { /** * Remembers the class name and resets temporary fields . */
@ Override public void visit ( JavaClass someObj ) { } } | currentClass = someObj . getClassName ( ) ; currentMethod = null ; currentCFG = null ; currentLockDataFlow = null ; sawDateClass = false ; |
public class RecyclerAdapterHelper { /** * Calls adapter ' s notify * methods when items are added / removed / moved / updated . */
public static < T > void notifyChanges ( RecyclerView . Adapter < ? > adapter , final List < T > oldList , final List < T > newList ) { } } | DiffUtil . calculateDiff ( new DiffUtil . Callback ( ) { @ Override public int getOldListSize ( ) { return oldList == null ? 0 : oldList . size ( ) ; } @ Override public int getNewListSize ( ) { return newList == null ? 0 : newList . size ( ) ; } @ Override public boolean areItemsTheSame ( int oldItemPosition , int newItemPosition ) { return oldList . get ( oldItemPosition ) . equals ( newList . get ( newItemPosition ) ) ; } @ Override public boolean areContentsTheSame ( int oldItemPosition , int newItemPosition ) { return areItemsTheSame ( oldItemPosition , newItemPosition ) ; } } ) . dispatchUpdatesTo ( adapter ) ; |
public class AiMaterial { /** * Returns the texture mapping mode for the v axis . < p >
* If missing , defaults to { @ link AiTextureMapMode # CLAMP }
* @ param type the texture type
* @ param index the index in the texture stack
* @ return the texture mapping mode */
public AiTextureMapMode getTextureMapModeV ( AiTextureType type , int index ) { } } | checkTexRange ( type , index ) ; Property p = getProperty ( PropertyKey . TEX_MAP_MODE_V . m_key ) ; if ( null == p || null == p . getData ( ) ) { return ( AiTextureMapMode ) m_defaults . get ( PropertyKey . TEX_MAP_MODE_V ) ; } return AiTextureMapMode . fromRawValue ( p . getData ( ) ) ; |
public class LdapIdentityStoreDefinitionWrapper { /** * Evaluate and return the groupSearchFilter .
* @ param immediateOnly If true , only return a non - null value if the setting is either an
* immediate EL expression or not set by an EL expression . If false , return the
* value regardless of where it is evaluated .
* @ return The groupSearchFilter or null if immediateOnly = = true AND the value is not evaluated
* from a deferred EL expression . */
@ FFDCIgnore ( IllegalArgumentException . class ) private String evaluateGroupSearchFilter ( boolean immediateOnly ) { } } | try { return elHelper . processString ( "groupSearchFilter" , this . idStoreDefinition . groupSearchFilter ( ) , immediateOnly ) ; } catch ( IllegalArgumentException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isWarningEnabled ( ) ) { Tr . warning ( tc , "There was an error resolving the '{1}' configuration object. Ensure any EL expressions are resolveable. The value will be defaulted to '{2}'" , new Object [ ] { "groupSearchFilter" , "" } ) ; } return "" ; /* Default value from spec . */
} |
public class QuickSelect { /** * Sort a small array using repetitive insertion sort .
* @ param data Data to sort
* @ param start Interval start
* @ param end Interval end */
private static void insertionSort ( double [ ] data , int start , int end ) { } } | for ( int i = start + 1 ; i < end ; i ++ ) { for ( int j = i ; j > start && data [ j - 1 ] > data [ j ] ; j -- ) { swap ( data , j , j - 1 ) ; } } |
public class Num { /** * Return count of number in reminder .
* @ return */
public int remainderSize ( ) { } } | BigDecimal fraction = remainder ( ) ; String tmp = fraction . toString ( ) ; int n = tmp . indexOf ( Properties . DEFAULT_DECIMAL_SEPARATOR ) ; if ( n != - 1 ) { return tmp . length ( ) - n - 1 ; } else return 0 ; |
public class MapboxNavigation { /** * Calling this method with { @ link DirectionsRouteType # NEW _ ROUTE } begins a new navigation session using the
* provided directions route . If called with { @ link DirectionsRouteType # FRESH _ ROUTE } , only leg annotation data
* will be update - can be used with { @ link RouteRefresh } .
* @ param directionsRoute a { @ link DirectionsRoute } that makes up the path your user should
* traverse along
* @ param routeType either new or fresh to determine what data navigation should consider
* @ see MapboxNavigation # startNavigation ( DirectionsRoute ) */
public void startNavigation ( @ NonNull DirectionsRoute directionsRoute , @ NonNull DirectionsRouteType routeType ) { } } | startNavigationWith ( directionsRoute , routeType ) ; |
public class PerformanceMonitorBeanFactory { /** * Find an existing { @ link PerformanceMonitorBean }
* @ param name the value for the { @ link PerformanceMonitorBean }
* @ return the found { @ link PerformanceMonitorBean } , or null if it is not
* found . */
public PerformanceMonitorBean findPerformanceMonitorBean ( String name ) { } } | PerformanceMonitor performanceMonitor = findPerformanceMonitor ( name ) ; if ( performanceMonitor instanceof PerformanceMonitorBean ) { return ( PerformanceMonitorBean ) performanceMonitor ; } return null ; |
public class SARLRuntime { /** * Replies if the given SRE is provided by the Eclipse platform
* through an extension point .
* @ param sre the sre .
* @ return < code > true < / code > if the SRE was provided through an extension
* point . */
public static boolean isPlatformSRE ( ISREInstall sre ) { } } | if ( sre != null ) { LOCK . lock ( ) ; try { return platformSREInstalls . contains ( sre . getId ( ) ) ; } finally { LOCK . unlock ( ) ; } } return false ; |
public class BinaryJedis { /** * SETNX works exactly like { @ link # set ( byte [ ] , byte [ ] ) SET } with the only difference that if the
* key already exists no operation is performed . SETNX actually means " SET if Not eXists " .
* Time complexity : O ( 1)
* @ param key
* @ param value
* @ return Integer reply , specifically : 1 if the key was set 0 if the key was not set */
@ Override public Long setnx ( final byte [ ] key , final byte [ ] value ) { } } | checkIsInMultiOrPipeline ( ) ; client . setnx ( key , value ) ; return client . getIntegerReply ( ) ; |
public class LongSequenceIDSource { /** * { @ inheritDoc } */
public Long nextID ( ) { } } | lock . lock ( ) ; try { if ( lastID == Long . MAX_VALUE ) { long days = ( System . currentTimeMillis ( ) - startTime ) / SECONDS_IN_DAY ; throw new IDSourceExhaustedException ( "64-bit ID source exhausted after " + days + " days." ) ; } ++ lastID ; return lastID ; } finally { lock . unlock ( ) ; } |
public class AptControlImplementation { /** * Initializes the list of EventAdaptors for this ControlImpl */
protected void initEventAdaptors ( ) { } } | if ( _implDecl == null || _implDecl . getMethods ( ) == null ) return ; for ( MethodDeclaration implMethod : _implDecl . getMethods ( ) ) { // Do a quick check for the presence of the EventHandler annotation on methods
if ( implMethod . getAnnotation ( EventHandler . class ) == null || implMethod . toString ( ) . equals ( "<clinit>()" ) ) continue ; // EventHandler annotations on private methods cause compilation error .
if ( isPrivateMethod ( implMethod ) ) { _ap . printError ( implMethod , "eventhandler.method.is.private" ) ; continue ; } // If found , we must actually read the value using an AnnotationMirror , since it
// contains a Class element ( eventSet ) that cannot be loaded
AnnotationMirror handlerMirror = null ; for ( AnnotationMirror annot : implMethod . getAnnotationMirrors ( ) ) { if ( annot == null || annot . getAnnotationType ( ) == null || annot . getAnnotationType ( ) . getDeclaration ( ) == null || annot . getAnnotationType ( ) . getDeclaration ( ) . getQualifiedName ( ) == null ) return ; if ( annot . getAnnotationType ( ) . getDeclaration ( ) . getQualifiedName ( ) . equals ( "org.apache.beehive.controls.api.events.EventHandler" ) ) { handlerMirror = annot ; break ; } } if ( handlerMirror == null ) { throw new CodeGenerationException ( "Unable to find EventHandler annotation on " + implMethod ) ; } AptAnnotationHelper handlerAnnot = new AptAnnotationHelper ( handlerMirror ) ; // Locate the EventField based upon the field element value
String fieldName = ( String ) handlerAnnot . getObjectValue ( "field" ) ; AptEventField eventField = ( AptEventField ) getField ( fieldName ) ; if ( eventField == null ) { // eventField = = null means this field isn ' t interesting for the purposes
// of this processor ( control impls ) . However , only emit an error message
// if the field isn ' t on a nested control
if ( getControlField ( fieldName ) == null ) _ap . printError ( implMethod , "eventhandler.field.not.found" , fieldName ) ; continue ; } // Locate the EventSet based upon the eventSet element value
TypeMirror tm = ( TypeMirror ) ( handlerAnnot . getObjectValue ( "eventSet" ) ) ; if ( tm == null ) continue ; String setName = tm . toString ( ) ; AptControlInterface controlIntf = eventField . getControlInterface ( ) ; // todo : remove workaround once bug has been resolved .
/* Workaround for JIRA issue BEEHIVE - 1143 , eventset name may
contain a ' $ ' seperator between the outer class and inner class .
Should be a ' . ' seperator . Only applies to Eclipse APT . This
workaround is also present in AptControlClient . initEventAdapters */
if ( tm . getClass ( ) . getName ( ) . startsWith ( "org.eclipse." ) ) { setName = setName . replace ( '$' , '.' ) ; } // end of workaround
AptEventSet eventSet = controlIntf . getEventSet ( setName ) ; if ( eventSet == null ) { _ap . printError ( implMethod , "eventhandler.eventset.not.found" , setName ) ; continue ; } // Register a new EventAdaptor for the EventSet , if none exists already
EventAdaptor adaptor = eventField . getEventAdaptor ( eventSet ) ; if ( adaptor == null ) { adaptor = new EventAdaptor ( eventField , eventSet ) ; eventField . addEventAdaptor ( eventSet , adaptor ) ; } // Locate the EventSet method based upon the eventName element value . Once
// found , add a new AptEventHandler to the adaptor for this event .
boolean found = false ; String eventName = ( String ) handlerAnnot . getObjectValue ( "eventName" ) ; AptMethod handlerMethod = new AptMethod ( implMethod , _ap ) ; for ( AptEvent controlEvent : eventSet . getEvents ( ) ) { if ( controlEvent == null || controlEvent . getName ( ) == null || ! controlEvent . getName ( ) . equals ( eventName ) ) continue ; if ( controlEvent . getArgTypes ( ) == null ) continue ; // BUGBUG : If the arguments are parameterized , then the event handler
// might declare a specific bound version of the type , so a direct
// comparison will fail . If parameterized , we don ' t validate .
if ( controlEvent . hasParameterizedArguments ( ) || controlEvent . getArgTypes ( ) . equals ( handlerMethod . getArgTypes ( ) ) ) { adaptor . addHandler ( controlEvent , new AptEventHandler ( controlEvent , implMethod , _ap ) ) ; found = true ; break ; } } if ( ! found ) { _ap . printError ( implMethod , "eventhandler.method.not.found" , setName ) ; } } |
public class ReferenceSoapRequestHandler { /** * { @ inheritDoc } */
@ WebMethod @ Override public void addAttack ( Attack attack ) throws NotAuthorizedException { } } | checkAuthorization ( Action . ADD_ATTACK ) ; attack . setDetectionSystem ( new DetectionSystem ( getClientApplicationName ( ) ) ) ; appSensorServer . getAttackStore ( ) . addAttack ( attack ) ; |
public class MapElementGroup { /** * Add the given element into the group .
* @ param element the element to add . */
void add ( MapElement element ) { } } | final Rectangle2d r = element . getBoundingBox ( ) ; if ( r != null ) { if ( Double . isNaN ( this . minx ) || this . minx > r . getMinX ( ) ) { this . minx = r . getMinX ( ) ; } if ( Double . isNaN ( this . maxx ) || this . maxx < r . getMaxX ( ) ) { this . maxx = r . getMaxX ( ) ; } if ( Double . isNaN ( this . miny ) || this . miny > r . getMinY ( ) ) { this . miny = r . getMinY ( ) ; } if ( Double . isNaN ( this . maxy ) || this . maxy < r . getMaxY ( ) ) { this . maxy = r . getMaxY ( ) ; } } this . elements . add ( element ) ; |
public class LongTermRetentionBackupsInner { /** * Deletes a long term retention backup .
* @ param locationName The location of the database
* @ param longTermRetentionServerName the String value
* @ param longTermRetentionDatabaseName the String value
* @ param backupName The backup name .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < Void > deleteAsync ( String locationName , String longTermRetentionServerName , String longTermRetentionDatabaseName , String backupName , final ServiceCallback < Void > serviceCallback ) { } } | return ServiceFuture . fromResponse ( deleteWithServiceResponseAsync ( locationName , longTermRetentionServerName , longTermRetentionDatabaseName , backupName ) , serviceCallback ) ; |
public class RestoreTableToPointInTimeRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( RestoreTableToPointInTimeRequest restoreTableToPointInTimeRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( restoreTableToPointInTimeRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( restoreTableToPointInTimeRequest . getSourceTableName ( ) , SOURCETABLENAME_BINDING ) ; protocolMarshaller . marshall ( restoreTableToPointInTimeRequest . getTargetTableName ( ) , TARGETTABLENAME_BINDING ) ; protocolMarshaller . marshall ( restoreTableToPointInTimeRequest . getUseLatestRestorableTime ( ) , USELATESTRESTORABLETIME_BINDING ) ; protocolMarshaller . marshall ( restoreTableToPointInTimeRequest . getRestoreDateTime ( ) , RESTOREDATETIME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ST_Split { /** * Split a geometry a according a geometry b using a snapping tolerance .
* This function support only the operations :
* - split a line or a multiline with a point .
* @ param geomA the geometry to be splited
* @ param geomB the geometry used to split
* @ param tolerance a distance tolerance to snap the split geometry
* @ return
* @ throws java . sql . SQLException */
public static Geometry split ( Geometry geomA , Geometry geomB , double tolerance ) throws SQLException { } } | if ( geomA instanceof Polygon ) { throw new SQLException ( "Split a Polygon by a line is not supported using a tolerance. \n" + "Please used ST_Split(geom1, geom2)" ) ; } else if ( geomA instanceof LineString ) { if ( geomB instanceof LineString ) { throw new SQLException ( "Split a line by a line is not supported using a tolerance. \n" + "Please used ST_Split(geom1, geom2)" ) ; } else if ( geomB instanceof Point ) { return splitLineWithPoint ( ( LineString ) geomA , ( Point ) geomB , tolerance ) ; } } else if ( geomA instanceof MultiLineString ) { if ( geomB instanceof LineString ) { throw new SQLException ( "Split a multiline by a line is not supported using a tolerance. \n" + "Please used ST_Split(geom1, geom2)" ) ; } else if ( geomB instanceof Point ) { return splitMultiLineStringWithPoint ( ( MultiLineString ) geomA , ( Point ) geomB , tolerance ) ; } } throw new SQLException ( "Split a " + geomA . getGeometryType ( ) + " by a " + geomB . getGeometryType ( ) + " is not supported." ) ; |
public class IntStreamEx { /** * Returns an effectively unlimited stream of pseudorandom { @ code int }
* values , each conforming to the given origin ( inclusive ) and bound
* ( exclusive ) .
* @ param random a { @ link Random } object to produce the stream from
* @ param randomNumberOrigin the origin ( inclusive ) of each random value
* @ param randomNumberBound the bound ( exclusive ) of each random value
* @ return a stream of pseudorandom { @ code int } values
* @ see Random # ints ( long , int , int ) */
public static IntStreamEx of ( Random random , int randomNumberOrigin , int randomNumberBound ) { } } | return seq ( random . ints ( randomNumberOrigin , randomNumberBound ) ) ; |
public class DFSContentProvider { /** * / * @ inheritDoc */
public boolean hasChildren ( Object element ) { } } | if ( element instanceof DFSContent ) { DFSContent content = ( DFSContent ) element ; return content . hasChildren ( ) ; } return false ; |
public class Matrix4f { /** * Apply a symmetric perspective projection frustum transformation for a left - handed coordinate system
* using the given NDC z range to this matrix and store the result in < code > dest < / code > .
* If < code > M < / code > is < code > this < / code > matrix and < code > P < / code > the perspective projection matrix ,
* then the new matrix will be < code > M * P < / code > . So when transforming a
* vector < code > v < / code > with the new matrix by using < code > M * P * v < / code > ,
* the perspective projection will be applied first !
* In order to set the matrix to a perspective frustum transformation without post - multiplying ,
* use { @ link # setPerspectiveLH ( float , float , float , float , boolean ) setPerspectiveLH } .
* @ see # setPerspectiveLH ( float , float , float , float , boolean )
* @ param fovy
* the vertical field of view in radians ( must be greater than zero and less than { @ link Math # PI PI } )
* @ param aspect
* the aspect ratio ( i . e . width / height ; must be greater than zero )
* @ param zNear
* near clipping plane distance . If the special value { @ link Float # POSITIVE _ INFINITY } is used , the near clipping plane will be at positive infinity .
* In that case , < code > zFar < / code > may not also be { @ link Float # POSITIVE _ INFINITY } .
* @ param zFar
* far clipping plane distance . If the special value { @ link Float # POSITIVE _ INFINITY } is used , the far clipping plane will be at positive infinity .
* In that case , < code > zNear < / code > may not also be { @ link Float # POSITIVE _ INFINITY } .
* @ param zZeroToOne
* whether to use Vulkan ' s and Direct3D ' s NDC z range of < code > [ 0 . . + 1 ] < / code > when < code > true < / code >
* or whether to use OpenGL ' s NDC z range of < code > [ - 1 . . + 1 ] < / code > when < code > false < / code >
* @ param dest
* will hold the result
* @ return dest */
public Matrix4f perspectiveLH ( float fovy , float aspect , float zNear , float zFar , boolean zZeroToOne , Matrix4f dest ) { } } | if ( ( properties & PROPERTY_IDENTITY ) != 0 ) return dest . setPerspectiveLH ( fovy , aspect , zNear , zFar , zZeroToOne ) ; return perspectiveLHGeneric ( fovy , aspect , zNear , zFar , zZeroToOne , dest ) ; |
public class GridFilesystem { /** * Opens an InputStream for reading from the file denoted by pathname .
* @ param pathname the full path of the file to read from
* @ return an InputStream for reading from the file
* @ throws FileNotFoundException if the file does not exist or is a directory */
public InputStream getInput ( String pathname ) throws FileNotFoundException { } } | GridFile file = ( GridFile ) getFile ( pathname ) ; checkFileIsReadable ( file ) ; return new GridInputStream ( file , data ) ; |
public class OfflineDownloadService { /** * When a particular download has been completed , this method ' s called which handles removing the
* notification and setting the download state .
* @ param offlineRegion the region which has finished being downloaded
* @ param offlineDownload the corresponding options used to define the offline region
* @ since 0.1.0 */
void finishDownload ( OfflineDownloadOptions offlineDownload , OfflineRegion offlineRegion ) { } } | OfflineDownloadStateReceiver . dispatchSuccessBroadcast ( this , offlineDownload ) ; offlineRegion . setDownloadState ( OfflineRegion . STATE_INACTIVE ) ; offlineRegion . setObserver ( null ) ; removeOfflineRegion ( offlineDownload . uuid ( ) . intValue ( ) ) ; |
public class SplitPaneLayout { /** * Sets the current position of the splitter as a percentage of the layout .
* @ param position the desired position of the splitter */
public void setSplitterPositionPercent ( float position ) { } } | mSplitterPosition = Integer . MIN_VALUE ; mSplitterPositionPercent = clamp ( position , 0 , 1 ) ; remeasure ( ) ; notifySplitterPositionChanged ( false ) ; |
public class JavacFiler { /** * Upon close , register files opened by create { Source , Class } File
* for annotation processing . */
private void closeFileObject ( String typeName , FileObject fileObject ) { } } | /* * If typeName is non - null , the file object was opened as a
* source or class file by the user . If a file was opened as
* a resource , typeName will be null and the file is * not *
* subject to annotation processing . */
if ( ( typeName != null ) ) { if ( ! ( fileObject instanceof JavaFileObject ) ) throw new AssertionError ( "JavaFileOject not found for " + fileObject ) ; JavaFileObject javaFileObject = ( JavaFileObject ) fileObject ; switch ( javaFileObject . getKind ( ) ) { case SOURCE : generatedSourceNames . add ( typeName ) ; generatedSourceFileObjects . add ( javaFileObject ) ; openTypeNames . remove ( typeName ) ; break ; case CLASS : generatedClasses . put ( typeName , javaFileObject ) ; openTypeNames . remove ( typeName ) ; break ; default : break ; } } |
public class HttpHealthCheck { /** * Adds a HTTP header , which will be sent with the HTTP request to the health check URL .
* @ param name the name of the header
* @ param value the value of the header */
public void addHeader ( String name , String value ) { } } | if ( name == null || name . trim ( ) . length ( ) == 0 ) { throw new IllegalArgumentException ( "The header name must not be null or empty." ) ; } if ( value == null ) { throw new IllegalArgumentException ( "The header value must not be null." ) ; } this . headers . put ( name , value ) ; |
public class Postcard { /** * Inserts a long value into the mapping of this Bundle , replacing
* any existing value for the given key .
* @ param key a String , or null
* @ param value a long
* @ return current */
public Postcard withLong ( @ Nullable String key , long value ) { } } | mBundle . putLong ( key , value ) ; return this ; |
public class RubyIO { /** * Returns a { @ link RubyEnumerator } of lines in given file .
* @ param file
* a File
* @ return { @ link RubyEnumerator } */
public static RubyEnumerator < String > foreach ( File file ) { } } | return Ruby . Enumerator . of ( new EachLineIterable ( file ) ) ; |
public class IntStream { /** * Applies custom operator on stream .
* Transforming function can return { @ code IntStream } for intermediate operations ,
* or any value for terminal operation .
* < p > Operator examples :
* < pre > < code >
* / / Intermediate operator
* public class Zip & lt ; T & gt ; implements Function & lt ; IntStream , IntStream & gt ; {
* & # 64 ; Override
* public IntStream apply ( IntStream firstStream ) {
* final PrimitiveIterator . OfInt it1 = firstStream . iterator ( ) ;
* final PrimitiveIterator . OfInt it2 = secondStream . iterator ( ) ;
* return IntStream . of ( new PrimitiveIterator . OfInt ( ) {
* & # 64 ; Override
* public boolean hasNext ( ) {
* return it1 . hasNext ( ) & amp ; & amp ; it2 . hasNext ( ) ;
* & # 64 ; Override
* public int nextInt ( ) {
* return combiner . applyAsInt ( it1 . nextInt ( ) , it2 . nextInt ( ) ) ;
* / / Intermediate operator based on existing stream operators
* public class SkipAndLimit implements UnaryOperator & lt ; IntStream & gt ; {
* private final int skip , limit ;
* public SkipAndLimit ( int skip , int limit ) {
* this . skip = skip ;
* this . limit = limit ;
* & # 64 ; Override
* public IntStream apply ( IntStream stream ) {
* return stream . skip ( skip ) . limit ( limit ) ;
* / / Terminal operator
* public class Average implements Function & lt ; IntStream , Double & gt ; {
* long count = 0 , sum = 0;
* & # 64 ; Override
* public Double apply ( IntStream stream ) {
* final PrimitiveIterator . OfInt it = stream . iterator ( ) ;
* while ( it . hasNext ( ) ) {
* count + + ;
* sum + = it . nextInt ( ) ;
* return ( count = = 0 ) ? 0 : sum / ( double ) count ;
* < / code > < / pre >
* @ param < R > the type of the result
* @ param function a transforming function
* @ return a result of the transforming function
* @ see Stream # custom ( com . annimon . stream . function . Function )
* @ throws NullPointerException if { @ code function } is null */
@ Nullable public < R > R custom ( @ NotNull final Function < IntStream , R > function ) { } } | Objects . requireNonNull ( function ) ; return function . apply ( this ) ; |
public class ServerRedirectService { /** * Add server redirect to a profile
* @ param region region
* @ param srcUrl source URL
* @ param destUrl destination URL
* @ param hostHeader host header
* @ param profileId profile ID
* @ param groupId group ID
* @ return ID of added ServerRedirect
* @ throws Exception exception */
public int addServerRedirect ( String region , String srcUrl , String destUrl , String hostHeader , int profileId , int groupId ) throws Exception { } } | int serverId = - 1 ; PreparedStatement statement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "INSERT INTO " + Constants . DB_TABLE_SERVERS + "(" + Constants . SERVER_REDIRECT_REGION + "," + Constants . SERVER_REDIRECT_SRC_URL + "," + Constants . SERVER_REDIRECT_DEST_URL + "," + Constants . SERVER_REDIRECT_HOST_HEADER + "," + Constants . SERVER_REDIRECT_PROFILE_ID + "," + Constants . SERVER_REDIRECT_GROUP_ID + ")" + " VALUES (?, ?, ?, ?, ?, ?);" , PreparedStatement . RETURN_GENERATED_KEYS ) ; statement . setString ( 1 , region ) ; statement . setString ( 2 , srcUrl ) ; statement . setString ( 3 , destUrl ) ; statement . setString ( 4 , hostHeader ) ; statement . setInt ( 5 , profileId ) ; statement . setInt ( 6 , groupId ) ; statement . executeUpdate ( ) ; results = statement . getGeneratedKeys ( ) ; if ( results . next ( ) ) { serverId = results . getInt ( 1 ) ; } else { // something went wrong
throw new Exception ( "Could not add path" ) ; } } catch ( SQLException e ) { e . printStackTrace ( ) ; } finally { try { if ( results != null ) { results . close ( ) ; } } catch ( Exception e ) { } try { if ( statement != null ) { statement . close ( ) ; } } catch ( Exception e ) { } } return serverId ; |
public class LineItemSummary { /** * Gets the lineItemType value for this LineItemSummary .
* @ return lineItemType * Indicates the line item type of a { @ code LineItem } . This attribute
* is required .
* The line item type determines the default priority
* of the line item . More information can be
* found on the < a href = " https : / / support . google . com / dfp _ premium / answer / 177279 " >
* Ad Manager Help Center < / a > . */
public com . google . api . ads . admanager . axis . v201811 . LineItemType getLineItemType ( ) { } } | return lineItemType ; |
public class DatanodeDescriptor { /** * Store block replication work . */
void addBlockToBeReplicated ( Block block , DatanodeDescriptor [ ] targets ) { } } | assert ( block != null && targets != null && targets . length > 0 ) ; replicateBlocks . offer ( block , targets ) ; |
public class SyncGroupsInner { /** * Gets a collection of hub database schemas .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; SyncFullSchemaPropertiesInner & gt ; object */
public Observable < Page < SyncFullSchemaPropertiesInner > > listHubSchemasNextAsync ( final String nextPageLink ) { } } | return listHubSchemasNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < SyncFullSchemaPropertiesInner > > , Page < SyncFullSchemaPropertiesInner > > ( ) { @ Override public Page < SyncFullSchemaPropertiesInner > call ( ServiceResponse < Page < SyncFullSchemaPropertiesInner > > response ) { return response . body ( ) ; } } ) ; |
public class AbstractTypeComputer { /** * / * @ Nullable */
protected < Type extends JvmType > Type findDeclaredType ( Class < ? > clazz , ITypeReferenceOwner owner ) { } } | @ SuppressWarnings ( "unchecked" ) Type result = ( Type ) services . getTypeReferences ( ) . findDeclaredType ( clazz , owner . getContextResourceSet ( ) ) ; return result ; |
public class HttpsURLConnection { /** * Sets the default < code > SSLSocketFactory < / code > inherited by new
* instances of this class .
* The socket factories are used when creating sockets for secure
* https URL connections .
* @ param sf the default SSL socket factory
* @ throws IllegalArgumentException if the SSLSocketFactory
* parameter is null .
* @ throws SecurityException if a security manager exists and its
* < code > checkSetFactory < / code > method does not allow
* a socket factory to be specified .
* @ see # getDefaultSSLSocketFactory ( ) */
public static void setDefaultSSLSocketFactory ( SSLSocketFactory sf ) { } } | if ( sf == null ) { throw new IllegalArgumentException ( "no default SSLSocketFactory specified" ) ; } SecurityManager sm = System . getSecurityManager ( ) ; if ( sm != null ) { sm . checkSetFactory ( ) ; } defaultSSLSocketFactory = sf ; |
public class CheckDomainTransferabilityRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CheckDomainTransferabilityRequest checkDomainTransferabilityRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( checkDomainTransferabilityRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( checkDomainTransferabilityRequest . getDomainName ( ) , DOMAINNAME_BINDING ) ; protocolMarshaller . marshall ( checkDomainTransferabilityRequest . getAuthCode ( ) , AUTHCODE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class SignatureUtils { /** * returns a List of parameter signatures
* @ param methodSignature
* the signature of the method to parse
* @ return a list of parameter signatures */
public static List < String > getParameterSignatures ( String methodSignature ) { } } | int start = methodSignature . indexOf ( '(' ) + 1 ; int limit = methodSignature . lastIndexOf ( ')' ) ; if ( ( limit - start ) == 0 ) { return Collections . emptyList ( ) ; } List < String > parmSignatures = new ArrayList < > ( ) ; int sigStart = start ; for ( int i = start ; i < limit ; i ++ ) { if ( ! methodSignature . startsWith ( Values . SIG_ARRAY_PREFIX , i ) ) { if ( methodSignature . startsWith ( Values . SIG_QUALIFIED_CLASS_PREFIX , i ) ) { int semiPos = methodSignature . indexOf ( Values . SIG_QUALIFIED_CLASS_SUFFIX_CHAR , i + 1 ) ; parmSignatures . add ( methodSignature . substring ( sigStart , semiPos + 1 ) ) ; i = semiPos ; } else if ( ! isWonkyEclipseSignature ( methodSignature , i ) ) { parmSignatures . add ( methodSignature . substring ( sigStart , i + 1 ) ) ; } sigStart = i + 1 ; } } return parmSignatures ; |
public class Functions { /** * Returns a function that computes the age in seconds . The value passed into the function
* should be a timestamp in milliseconds since the epoch . Typically this will be the return
* value from calling { @ link java . lang . System # currentTimeMillis ( ) } .
* @ param clock
* Clock used to get the current time for comparing with the passed in value .
* @ return
* Function that computes the age . */
public static DoubleFunction < AtomicLong > age ( final Clock clock ) { } } | return new DoubleFunction < AtomicLong > ( ) { @ Override public double apply ( double t ) { return ( clock . wallTime ( ) - t ) / 1000.0 ; } } ; |
public class Long { /** * Returns the value obtained by reversing the order of the bytes in the
* two ' s complement representation of the specified { @ code long } value .
* @ param i the value whose bytes are to be reversed
* @ return the value obtained by reversing the bytes in the specified
* { @ code long } value .
* @ since 1.5 */
public static long reverseBytes ( long i ) { } } | i = ( i & 0x00ff00ff00ff00ffL ) << 8 | ( i >>> 8 ) & 0x00ff00ff00ff00ffL ; return ( i << 48 ) | ( ( i & 0xffff0000L ) << 16 ) | ( ( i >>> 16 ) & 0xffff0000L ) | ( i >>> 48 ) ; |
public class AudioWife { /** * Initialize and prepare the audio player */
private void initPlayer ( Context ctx ) { } } | mMediaPlayer = new MediaPlayer ( ) ; mMediaPlayer . setAudioStreamType ( AudioManager . STREAM_MUSIC ) ; try { mMediaPlayer . setDataSource ( ctx , mUri ) ; } catch ( IllegalArgumentException e ) { e . printStackTrace ( ) ; } catch ( SecurityException e ) { e . printStackTrace ( ) ; } catch ( IllegalStateException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } try { mMediaPlayer . prepare ( ) ; } catch ( IllegalStateException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } mMediaPlayer . setOnCompletionListener ( mOnCompletion ) ; |
public class PermissionTemplateService { /** * Return the permission template for the given component . If no template key pattern match then consider default
* template for the component qualifier . */
@ CheckForNull private PermissionTemplateDto findTemplate ( DbSession dbSession , ComponentDto component ) { } } | String organizationUuid = component . getOrganizationUuid ( ) ; List < PermissionTemplateDto > allPermissionTemplates = dbClient . permissionTemplateDao ( ) . selectAll ( dbSession , organizationUuid , null ) ; List < PermissionTemplateDto > matchingTemplates = new ArrayList < > ( ) ; for ( PermissionTemplateDto permissionTemplateDto : allPermissionTemplates ) { String keyPattern = permissionTemplateDto . getKeyPattern ( ) ; if ( StringUtils . isNotBlank ( keyPattern ) && component . getDbKey ( ) . matches ( keyPattern ) ) { matchingTemplates . add ( permissionTemplateDto ) ; } } checkAtMostOneMatchForComponentKey ( component . getDbKey ( ) , matchingTemplates ) ; if ( matchingTemplates . size ( ) == 1 ) { return matchingTemplates . get ( 0 ) ; } DefaultTemplates defaultTemplates = dbClient . organizationDao ( ) . getDefaultTemplates ( dbSession , organizationUuid ) . orElseThrow ( ( ) -> new IllegalStateException ( format ( "No Default templates defined for organization with uuid '%s'" , organizationUuid ) ) ) ; String qualifier = component . qualifier ( ) ; DefaultTemplatesResolverImpl . ResolvedDefaultTemplates resolvedDefaultTemplates = defaultTemplatesResolver . resolve ( defaultTemplates ) ; switch ( qualifier ) { case Qualifiers . PROJECT : return dbClient . permissionTemplateDao ( ) . selectByUuid ( dbSession , resolvedDefaultTemplates . getProject ( ) ) ; case Qualifiers . VIEW : String portDefaultTemplateUuid = resolvedDefaultTemplates . getPortfolio ( ) . orElseThrow ( ( ) -> new IllegalStateException ( "Attempt to create a view when Governance plugin is not installed" ) ) ; return dbClient . permissionTemplateDao ( ) . selectByUuid ( dbSession , portDefaultTemplateUuid ) ; case Qualifiers . APP : String appDefaultTemplateUuid = resolvedDefaultTemplates . getApplication ( ) . orElseThrow ( ( ) -> new IllegalStateException ( "Attempt to create a view when Governance plugin is not installed" ) ) ; return dbClient . permissionTemplateDao ( ) . selectByUuid ( dbSession , appDefaultTemplateUuid ) ; default : throw new IllegalArgumentException ( format ( "Qualifier '%s' is not supported" , qualifier ) ) ; } |
public class Mnemonic { /** * / * Converts a String to the correct case . */
private String sanitize ( String str ) { } } | if ( wordcase == CASE_UPPER ) return str . toUpperCase ( ) ; else if ( wordcase == CASE_LOWER ) return str . toLowerCase ( ) ; return str ; |
public class CorcInputFormat { /** * This is to work around an issue reading from ORC transactional data sets that contain only deltas . These contain
* synthesised column names that are not usable to us . */
private Path getSplitPath ( FileSplit inputSplit , JobConf conf ) throws IOException { } } | Path path = inputSplit . getPath ( ) ; if ( inputSplit instanceof OrcSplit ) { OrcSplit orcSplit = ( OrcSplit ) inputSplit ; List < Long > deltas = orcSplit . getDeltas ( ) ; if ( ! orcSplit . hasBase ( ) && deltas . size ( ) >= 2 ) { throw new IOException ( "Cannot read valid StructTypeInfo from delta only file: " + path ) ; } } LOG . debug ( "Input split path: {}" , path ) ; return path ; |
public class TorqueModelDef { /** * Tries to return the single target table to which the given foreign key columns map in
* all m : n collections that target this indirection table .
* @ param targetClassDef The original target class
* @ param indirectionTable The indirection table
* @ param foreignKeys The foreign keys columns in the indirection table pointing back to the
* class ' table
* @ return The table name or < code > null < / code > if there is not exactly one table */
private String getTargetTable ( ClassDescriptorDef targetClassDef , String indirectionTable , String foreignKeys ) { } } | ModelDef modelDef = ( ModelDef ) targetClassDef . getOwner ( ) ; String tableName = null ; for ( Iterator classIt = modelDef . getClasses ( ) ; classIt . hasNext ( ) ; ) { ClassDescriptorDef curClassDef = ( ClassDescriptorDef ) classIt . next ( ) ; if ( ! curClassDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_GENERATE_TABLE_INFO , true ) ) { continue ; } for ( Iterator collIt = curClassDef . getCollections ( ) ; collIt . hasNext ( ) ; ) { CollectionDescriptorDef curCollDef = ( CollectionDescriptorDef ) collIt . next ( ) ; if ( ! indirectionTable . equals ( curCollDef . getProperty ( PropertyHelper . OJB_PROPERTY_INDIRECTION_TABLE ) ) || ! CommaListIterator . sameLists ( foreignKeys , curCollDef . getProperty ( PropertyHelper . OJB_PROPERTY_FOREIGNKEY ) ) ) { continue ; } // ok , collection fits
if ( tableName != null ) { if ( ! tableName . equals ( curClassDef . getProperty ( PropertyHelper . OJB_PROPERTY_TABLE ) ) ) { // maps to a different table
return null ; } } else { tableName = curClassDef . getProperty ( PropertyHelper . OJB_PROPERTY_TABLE ) ; } } } if ( tableName == null ) { // no fitting collection found - > indirection table with only one collection
// we have to check whether the hierarchy of the target class maps to one table only
return getHierarchyTable ( targetClassDef ) ; } else { return tableName ; } |
public class A_CmsImport { /** * Imports a single group . < p >
* @ param name the name of the group
* @ param description group description
* @ param flags group flags
* @ param parentgroupName name of the parent group
* @ throws CmsImportExportException if something goes wrong */
protected void importGroup ( String name , String description , String flags , String parentgroupName ) throws CmsImportExportException { } } | if ( description == null ) { description = "" ; } CmsGroup parentGroup = null ; try { if ( CmsStringUtil . isNotEmpty ( parentgroupName ) ) { try { parentGroup = m_cms . readGroup ( parentgroupName ) ; } catch ( CmsException exc ) { // parentGroup will be null
} } if ( CmsStringUtil . isNotEmpty ( parentgroupName ) && ( parentGroup == null ) ) { // cannot create group , put on stack and try to create later
Map < String , String > groupData = new HashMap < String , String > ( ) ; groupData . put ( A_CmsImport . N_NAME , name ) ; groupData . put ( A_CmsImport . N_DESCRIPTION , description ) ; groupData . put ( A_CmsImport . N_FLAGS , flags ) ; groupData . put ( A_CmsImport . N_PARENTGROUP , parentgroupName ) ; m_groupsToCreate . push ( groupData ) ; } else { try { m_report . print ( Messages . get ( ) . container ( Messages . RPT_IMPORT_GROUP_0 ) , I_CmsReport . FORMAT_NOTE ) ; m_report . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_ARGUMENT_1 , name ) ) ; m_report . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_DOTS_0 ) ) ; m_cms . createGroup ( name , description , Integer . parseInt ( flags ) , parentgroupName ) ; m_report . println ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_OK_0 ) , I_CmsReport . FORMAT_OK ) ; } catch ( CmsException exc ) { m_report . println ( Messages . get ( ) . container ( Messages . RPT_NOT_CREATED_0 ) , I_CmsReport . FORMAT_OK ) ; } } } catch ( Exception e ) { m_report . println ( e ) ; CmsMessageContainer message = Messages . get ( ) . container ( Messages . ERR_IMPORTEXPORT_ERROR_IMPORTING_GROUP_1 , name ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( message . key ( ) , e ) ; } throw new CmsImportExportException ( message , e ) ; } |
public class DistributedObjectUtil { /** * Gets the name of the given distributed object .
* @ param distributedObject the { @ link DistributedObject } instance whose name is requested
* @ return name of the given distributed object */
public static String getName ( DistributedObject distributedObject ) { } } | /* * The motivation of this behaviour is that some distributed objects ( ` ICache ` ) can have prefixed name .
* For example , for the point of view of cache ,
* it has pure name and full name which contains prefixes also .
* However both of our ` DistributedObject ` and ` javax . cache . Cache ` ( from JCache spec ) interfaces
* have same method name with same signature . It is ` String getName ( ) ` .
* From the distributed object side , name must be fully qualified name of object ,
* but from the JCache spec side ( also for backward compatibility ) ,
* it must be pure cache name without any prefix .
* So there is same method name with same signature for different purposes .
* Therefore , ` PrefixedDistributedObject ` has been introduced to retrieve the
* fully qualified name of distributed object when it is needed .
* For cache case , the fully qualified name is full cache name contains Hazelcast prefix ( ` / hz ` ) ,
* cache name prefix regarding to URI and / or classloader if specified and pure cache name . */
if ( distributedObject instanceof PrefixedDistributedObject ) { return ( ( PrefixedDistributedObject ) distributedObject ) . getPrefixedName ( ) ; } else { return distributedObject . getName ( ) ; } |
public class LocalXAResourceImpl { /** * { @ inheritDoc } */
public int prepare ( Xid xid ) throws XAException { } } | if ( ! warned ) { log . prepareCalledOnLocaltx ( ) ; } warned = true ; return XAResource . XA_OK ; |
public class FinalHyperParameterTuningJobObjectiveMetricMarshaller { /** * Marshall the given parameter object . */
public void marshall ( FinalHyperParameterTuningJobObjectiveMetric finalHyperParameterTuningJobObjectiveMetric , ProtocolMarshaller protocolMarshaller ) { } } | if ( finalHyperParameterTuningJobObjectiveMetric == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( finalHyperParameterTuningJobObjectiveMetric . getType ( ) , TYPE_BINDING ) ; protocolMarshaller . marshall ( finalHyperParameterTuningJobObjectiveMetric . getMetricName ( ) , METRICNAME_BINDING ) ; protocolMarshaller . marshall ( finalHyperParameterTuningJobObjectiveMetric . getValue ( ) , VALUE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class EvaluatorImpl { /** * Get Truth Table index */
public static int ttIndex ( Boolean bVal ) { } } | int idx = 2 ; if ( bVal != null ) { if ( bVal . booleanValue ( ) ) { idx = 0 ; } else if ( ! bVal . booleanValue ( ) ) { idx = 1 ; } } return idx ; |
public class ReflectionUtils { /** * Finds a method on the given type for the given name .
* @ param type The type
* @ param name The name
* @ return An { @ link Optional } contains the method or empty */
public static Stream < Method > findMethodsByName ( Class type , String name ) { } } | Class currentType = type ; Set < Method > methodSet = new HashSet < > ( ) ; while ( currentType != null ) { Method [ ] methods = currentType . isInterface ( ) ? currentType . getMethods ( ) : currentType . getDeclaredMethods ( ) ; for ( Method method : methods ) { if ( name . equals ( method . getName ( ) ) ) { methodSet . add ( method ) ; } } currentType = currentType . getSuperclass ( ) ; } return methodSet . stream ( ) ; |
public class RSAUtils { /** * Verify a signature with RSA public key , using { @ link # DEFAULT _ SIGNATURE _ ALGORITHM } .
* @ param key
* @ param message
* @ param signature
* @ return
* @ throws InvalidKeyException
* @ throws NoSuchAlgorithmException
* @ throws SignatureException */
public static boolean verifySignature ( RSAPublicKey key , byte [ ] message , byte [ ] signature ) throws InvalidKeyException , NoSuchAlgorithmException , SignatureException { } } | return verifySignature ( key , message , signature , DEFAULT_SIGNATURE_ALGORITHM ) ; |
public class License { /** * Returns true if the license is signed and the authenticity of the signature can be checked successfully
* using the key .
* @ param key encryption key to check the authenticity of the license signature
* @ return { @ code true } if the license was properly signed and is intact . In any other cases it returns
* { @ code false } . */
public boolean isOK ( PublicKey key ) { } } | try { final var digester = MessageDigest . getInstance ( get ( DIGEST_KEY ) . getString ( ) ) ; final var ser = unsigned ( ) ; final var digestValue = digester . digest ( ser ) ; final var cipher = Cipher . getInstance ( key . getAlgorithm ( ) ) ; cipher . init ( Cipher . DECRYPT_MODE , key ) ; final var sigDigest = cipher . doFinal ( getSignature ( ) ) ; return Arrays . equals ( digestValue , sigDigest ) ; } catch ( Exception e ) { return false ; } |
public class HttpFields { /** * Format a set cookie value
* @ param cookie The cookie . */
public void addSetCookie ( Cookie cookie ) { } } | String name = cookie . getName ( ) ; String value = cookie . getValue ( ) ; int version = cookie . getVersion ( ) ; // Check arguments
if ( name == null || name . length ( ) == 0 ) throw new IllegalArgumentException ( "Bad cookie name" ) ; // Format value and params
StringBuffer buf = new StringBuffer ( 128 ) ; String name_value_params = null ; synchronized ( buf ) { buf . append ( name ) ; buf . append ( '=' ) ; if ( value != null && value . length ( ) > 0 ) { if ( version == 0 ) URI . encodeString ( buf , value , "\";, '" ) ; else buf . append ( QuotedStringTokenizer . quote ( value , "\";, '" ) ) ; } if ( version > 0 ) { buf . append ( ";Version=" ) ; buf . append ( version ) ; String comment = cookie . getComment ( ) ; if ( comment != null && comment . length ( ) > 0 ) { buf . append ( ";Comment=" ) ; QuotedStringTokenizer . quote ( buf , comment ) ; } } String path = cookie . getPath ( ) ; if ( path != null && path . length ( ) > 0 ) { buf . append ( ";Path=" ) ; buf . append ( path ) ; } String domain = cookie . getDomain ( ) ; if ( domain != null && domain . length ( ) > 0 ) { buf . append ( ";Domain=" ) ; buf . append ( domain . toLowerCase ( ) ) ; // lowercase for IE
} long maxAge = cookie . getMaxAge ( ) ; if ( maxAge >= 0 ) { if ( version == 0 ) { buf . append ( ";Expires=" ) ; if ( maxAge == 0 ) buf . append ( __01Jan1970 ) ; else formatDate ( buf , System . currentTimeMillis ( ) + 1000L * maxAge , true ) ; } else { buf . append ( ";Max-Age=" ) ; buf . append ( cookie . getMaxAge ( ) ) ; } } else if ( version > 0 ) { buf . append ( ";Discard" ) ; } if ( cookie . getSecure ( ) ) { buf . append ( ";Secure" ) ; } if ( cookie instanceof HttpOnlyCookie ) buf . append ( ";HttpOnly" ) ; name_value_params = buf . toString ( ) ; } put ( __Expires , __01Jan1970 ) ; add ( __SetCookie , name_value_params ) ; |
public class TargetsApi { /** * Get the agent ' s personal favorites .
* @ param limit Number of results to return . The default value is 50 . ( optional )
* @ return SearchResult < Target > */
public SearchResult < Target > getPersonalFavorites ( int limit ) throws WorkspaceApiException { } } | try { TargetsResponse resp = targetsApi . getPersonalFavorites ( limit > 0 ? new BigDecimal ( limit ) : null ) ; Util . throwIfNotOk ( resp . getStatus ( ) ) ; TargetsResponseData data = resp . getData ( ) ; int total = 0 ; List < Target > list = new ArrayList < > ( ) ; if ( data != null ) { total = data . getTotalMatches ( ) ; if ( data . getTargets ( ) != null ) { for ( com . genesys . internal . workspace . model . Target t : data . getTargets ( ) ) { Target target = Target . fromTarget ( t ) ; list . add ( target ) ; } } } return new SearchResult < > ( total , list ) ; } catch ( ApiException ex ) { throw new WorkspaceApiException ( "Cannot personal favorites" , ex ) ; } |
public class RESTRegistry { /** * Get the method - > command map for the given owner . */
private Map < String , RESTCommand > getCmdNameMap ( String cmdOwner ) { } } | SortedMap < String , RESTCommand > cmdNameMap = m_cmdsByOwnerMap . get ( cmdOwner ) ; if ( cmdNameMap == null ) { cmdNameMap = new TreeMap < > ( ) ; m_cmdsByOwnerMap . put ( cmdOwner , cmdNameMap ) ; } return cmdNameMap ; |
public class VNode { /** * Sets the bound of this VNode by given width and height
* @ param w new width
* @ param h new height */
public void setBounds ( float w , float h ) { } } | this . glyph . getBbox ( ) . setW ( w ) ; this . glyph . getBbox ( ) . setH ( h ) ; |
public class HibernateMetrics { /** * Create { @ code HibernateMetrics } and bind to the specified meter registry .
* @ param registry meter registry to use
* @ param entityManagerFactory entity manager factory to use
* @ param entityManagerFactoryName entity manager factory name as a tag value
* @ param tags additional tags
* @ deprecated since 1.1.2 in favor of { @ link # monitor ( MeterRegistry , SessionFactory , String , String . . . ) } */
@ Deprecated public static void monitor ( MeterRegistry registry , EntityManagerFactory entityManagerFactory , String entityManagerFactoryName , String ... tags ) { } } | monitor ( registry , entityManagerFactory , entityManagerFactoryName , Tags . of ( tags ) ) ; |
public class UselessSubclassMethod { /** * TODO awaiting https : / / github . com / spotbugs / spotbugs / issues / 626 */
@ SuppressWarnings ( "PMD.SimplifyBooleanReturns" ) private boolean differentAttributes ( Method m1 , Method m2 ) { } } | if ( m1 . getAnnotationEntries ( ) . length > 0 || m2 . getAnnotationEntries ( ) . length > 0 ) { return true ; } int access1 = m1 . getAccessFlags ( ) & ( Const . ACC_PRIVATE | Const . ACC_PROTECTED | Const . ACC_PUBLIC | Const . ACC_FINAL ) ; int access2 = m2 . getAccessFlags ( ) & ( Const . ACC_PRIVATE | Const . ACC_PROTECTED | Const . ACC_PUBLIC | Const . ACC_FINAL ) ; m1 . getAnnotationEntries ( ) ; if ( access1 != access2 ) { return true ; } if ( ! thrownExceptions ( m1 ) . equals ( thrownExceptions ( m2 ) ) ) { return false ; } return false ; |
public class AmazonApiGatewayClient { /** * Gets a < a > RequestValidator < / a > of a given < a > RestApi < / a > .
* @ param getRequestValidatorRequest
* Gets a < a > RequestValidator < / a > of a given < a > RestApi < / a > .
* @ return Result of the GetRequestValidator operation returned by the service .
* @ throws UnauthorizedException
* The request is denied because the caller has insufficient permissions .
* @ throws NotFoundException
* The requested resource is not found . Make sure that the request URI is correct .
* @ throws TooManyRequestsException
* The request has reached its throttling limit . Retry after the specified time period .
* @ sample AmazonApiGateway . GetRequestValidator */
@ Override public GetRequestValidatorResult getRequestValidator ( GetRequestValidatorRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetRequestValidator ( request ) ; |
public class PutFileEntryMarshaller { /** * Marshall the given parameter object . */
public void marshall ( PutFileEntry putFileEntry , ProtocolMarshaller protocolMarshaller ) { } } | if ( putFileEntry == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( putFileEntry . getFilePath ( ) , FILEPATH_BINDING ) ; protocolMarshaller . marshall ( putFileEntry . getFileMode ( ) , FILEMODE_BINDING ) ; protocolMarshaller . marshall ( putFileEntry . getFileContent ( ) , FILECONTENT_BINDING ) ; protocolMarshaller . marshall ( putFileEntry . getSourceFile ( ) , SOURCEFILE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CertPath { /** * Replaces the { @ code CertPath } to be serialized with a
* { @ code CertPathRep } object .
* @ return the { @ code CertPathRep } to be serialized
* @ throws ObjectStreamException if a { @ code CertPathRep } object
* representing this certification path could not be created */
protected Object writeReplace ( ) throws ObjectStreamException { } } | try { return new CertPathRep ( type , getEncoded ( ) ) ; } catch ( CertificateException ce ) { NotSerializableException nse = new NotSerializableException ( "java.security.cert.CertPath: " + type ) ; nse . initCause ( ce ) ; throw nse ; } |
public class PiwikRequest { /** * Set a visit custom variable with the specified key and value at the first available index .
* All visit custom variables with this key will be overwritten or deleted
* @ param key the key of the variable to set
* @ param value the value of the variable to set at the specified key . A null value will remove this parameter
* @ deprecated Use the { @ link # setVisitCustomVariable ( CustomVariable , int ) } method instead . */
@ Deprecated public void setUserCustomVariable ( String key , String value ) { } } | if ( value == null ) { removeCustomVariable ( VISIT_CUSTOM_VARIABLE , key ) ; } else { setCustomVariable ( VISIT_CUSTOM_VARIABLE , new CustomVariable ( key , value ) , null ) ; } |
public class BaseApplet { /** * Link this record to the remote Ejb Table .
* This method , gets the remote database and makes a remote table , the creates a
* RemoteFieldTable for this record and ( optionally ) wraps a CacheRemoteFieldTable .
* Used ONLY for thin tables .
* @ param database ( optional ) remote database that this table is in .
* @ param record The fieldlist to create a remote peer for .
* @ param bUseCache Add a CacheRemoteFieldTable to this table ?
* @ return The new fieldtable for this fieldlist . */
public FieldTable linkNewRemoteTable ( FieldList record , boolean bUseCache ) { } } | FieldTable table = record . getTable ( ) ; if ( table == null ) { RemoteTable remoteTable = null ; try { synchronized ( this . getRemoteTask ( ) ) { // In case this is called from another task
RemoteTask server = ( RemoteTask ) this . getRemoteTask ( ) ; Map < String , Object > dbProperties = this . getApplication ( ) . getProperties ( ) ; remoteTable = server . makeRemoteTable ( record . getRemoteClassName ( ) , null , null , dbProperties ) ; } } catch ( RemoteException ex ) { ex . printStackTrace ( ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; } if ( bUseCache ) remoteTable = new CachedRemoteTable ( remoteTable ) ; table = new RemoteFieldTable ( record , remoteTable , this . getRemoteTask ( ) ) ; } else { // Table exists , make sure cache is correct .
CachedRemoteTable cachedFieldTable = ( CachedRemoteTable ) table . getRemoteTableType ( CachedRemoteTable . class ) ; SyncRemoteTable syncRemoteTable = ( SyncRemoteTable ) table . getRemoteTableType ( SyncRemoteTable . class ) ; RemoteTable remoteTable = ( RemoteTable ) table . getRemoteTableType ( TableProxy . class ) ; if ( cachedFieldTable != null ) { cachedFieldTable . setCacheMode ( bUseCache ? CacheMode . CACHE_ON_WRITE : CacheMode . PASSIVE_CACHE , record ) ; // Turn cache on or off
} else if ( bUseCache ) { // Add cache to chain
if ( ( remoteTable != null ) && ( syncRemoteTable != null ) && ( syncRemoteTable . getRemoteTable ( ) == remoteTable ) ) { remoteTable = new CachedRemoteTable ( remoteTable ) ; syncRemoteTable . setRemoteTable ( remoteTable ) ; } else Util . getLogger ( ) . severe ( "Can't add cache, Remote table chain is not as expected." ) ; } } return table ; |
public class MultiIndex { /** * Attempts to delete all files recorded in { @ link # deletable } . */
private void attemptDelete ( ) { } } | synchronized ( deletable ) { for ( Iterator < String > it = deletable . iterator ( ) ; it . hasNext ( ) ; ) { String indexName = it . next ( ) ; if ( directoryManager . delete ( indexName ) ) { it . remove ( ) ; } else { LOG . info ( "Unable to delete obsolete index: " + indexName ) ; } } } |
public class VTensor { /** * Adds a factor elementwise to this one .
* @ param other The addend .
* @ throws IllegalArgumentException If the two tensors have different sizes . */
public void elemAdd ( VTensor other ) { } } | checkEqualSize ( this , other ) ; for ( int c = 0 ; c < this . size ( ) ; c ++ ) { addValue ( c , other . getValue ( c ) ) ; } |
public class Geomem { /** * Adds a record to the in - memory store with the given position and time and
* id .
* @ param lat
* latitude
* @ param lon
* longitude
* @ param time
* time in epoch ms
* @ param t
* object
* @ param id
* identifier */
public void add ( double lat , double lon , long time , T t , Optional < R > id ) { } } | Info < T , R > info = new Info < T , R > ( lat , lon , time , t , id ) ; add ( info ) ; |
public class appfw_stats { /** * < pre >
* converts nitro response into object and returns the object array in case of get request .
* < / pre > */
protected base_resource [ ] get_nitro_response ( nitro_service service , String response ) throws Exception { } } | appfw_stats [ ] resources = new appfw_stats [ 1 ] ; appfw_response result = ( appfw_response ) service . get_payload_formatter ( ) . string_to_resource ( appfw_response . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == 444 ) { service . clear_session ( ) ; } if ( result . severity != null ) { if ( result . severity . equals ( "ERROR" ) ) throw new nitro_exception ( result . message , result . errorcode ) ; } else { throw new nitro_exception ( result . message , result . errorcode ) ; } } resources [ 0 ] = result . appfw ; return resources ; |
public class DitaWriterFilter { /** * Relativize absolute references if possible .
* @ param attName attribute name
* @ param atts attributes
* @ return attribute value , may be { @ code null } */
private URI replaceHREF ( final QName attName , final Attributes atts ) { } } | URI attValue = toURI ( atts . getValue ( attName . getNamespaceURI ( ) , attName . getLocalPart ( ) ) ) ; if ( attValue != null ) { final String fragment = attValue . getFragment ( ) ; if ( fragment != null ) { attValue = stripFragment ( attValue ) ; } if ( attValue . toString ( ) . length ( ) != 0 ) { final URI current = currentFile . resolve ( attValue ) ; final FileInfo f = job . getFileInfo ( current ) ; if ( f != null ) { final FileInfo cfi = job . getFileInfo ( currentFile ) ; final URI currrentFileTemp = job . tempDirURI . resolve ( cfi . uri ) ; final URI targetTemp = job . tempDirURI . resolve ( f . uri ) ; attValue = getRelativePath ( currrentFileTemp , targetTemp ) ; } else if ( tempFileNameScheme != null ) { final URI currrentFileTemp = job . tempDirURI . resolve ( tempFileNameScheme . generateTempFileName ( currentFile ) ) ; final URI targetTemp = job . tempDirURI . resolve ( tempFileNameScheme . generateTempFileName ( current ) ) ; final URI relativePath = getRelativePath ( currrentFileTemp , targetTemp ) ; attValue = relativePath ; } else { attValue = getRelativePath ( currentFile , current ) ; } } if ( fragment != null ) { attValue = setFragment ( attValue , fragment ) ; } } else { return null ; } return attValue ; |
public class CmsPublishManager { /** * Sets the publish list remove mode . < p >
* @ param publishListRemoveMode the publish list remove mode */
public void setPublishListRemoveMode ( CmsPublishManager . PublishListRemoveMode publishListRemoveMode ) { } } | if ( m_frozen ) { throw new CmsRuntimeException ( Messages . get ( ) . container ( Messages . ERR_CONFIG_FROZEN_0 ) ) ; } m_publishListRemoveMode = publishListRemoveMode ; |
public class RemoteAccessSessionMarshaller { /** * Marshall the given parameter object . */
public void marshall ( RemoteAccessSession remoteAccessSession , ProtocolMarshaller protocolMarshaller ) { } } | if ( remoteAccessSession == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( remoteAccessSession . getArn ( ) , ARN_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getCreated ( ) , CREATED_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getResult ( ) , RESULT_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getMessage ( ) , MESSAGE_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getStarted ( ) , STARTED_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getStopped ( ) , STOPPED_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getDevice ( ) , DEVICE_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getInstanceArn ( ) , INSTANCEARN_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getRemoteDebugEnabled ( ) , REMOTEDEBUGENABLED_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getRemoteRecordEnabled ( ) , REMOTERECORDENABLED_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getRemoteRecordAppArn ( ) , REMOTERECORDAPPARN_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getHostAddress ( ) , HOSTADDRESS_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getClientId ( ) , CLIENTID_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getBillingMethod ( ) , BILLINGMETHOD_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getDeviceMinutes ( ) , DEVICEMINUTES_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getEndpoint ( ) , ENDPOINT_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getDeviceUdid ( ) , DEVICEUDID_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getInteractionMode ( ) , INTERACTIONMODE_BINDING ) ; protocolMarshaller . marshall ( remoteAccessSession . getSkipAppResign ( ) , SKIPAPPRESIGN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class TopologyBuilder { /** * Define a new bolt in this topology . This defines a stateful bolt , that requires its
* state ( of computation ) to be saved . When this bolt is initialized , the { @ link IStatefulBolt # initState ( State ) } method
* is invoked after { @ link IStatefulBolt # prepare ( Map , TopologyContext , OutputCollector ) } but before { @ link IStatefulBolt # execute ( Tuple ) }
* with its previously saved state .
* The framework provides at - least once guarantee for the state updates . Bolts ( both stateful and non - stateful ) in a stateful topology
* are expected to anchor the tuples while emitting and ack the input tuples once its processed .
* @ param id the id of this component . This id is referenced by other components that want to consume this bolt ' s outputs .
* @ param bolt the stateful bolt
* @ param parallelism _ hint the number of tasks that should be assigned to execute this bolt . Each task will run on a thread in a process somwehere around the cluster .
* @ return use the returned object to declare the inputs to this component
* @ throws IllegalArgumentException if { @ code parallelism _ hint } is not positive */
public < T extends State > BoltDeclarer setBolt ( String id , IStatefulBolt < T > bolt , Number parallelism_hint ) throws IllegalArgumentException { } } | hasStatefulBolt = true ; return setBolt ( id , new StatefulBoltExecutor < T > ( bolt ) , parallelism_hint ) ; |
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 .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < Void > beginExecuteScriptActionsAsync ( String resourceGroupName , String clusterName , ExecuteScriptActionParameters parameters , final ServiceCallback < Void > serviceCallback ) { } } | return ServiceFuture . fromResponse ( beginExecuteScriptActionsWithServiceResponseAsync ( resourceGroupName , clusterName , parameters ) , serviceCallback ) ; |
public class VariantToVcfSliceConverter { /** * With test visibility */
static VcfSliceProtos . Fields buildDefaultFields ( List < Variant > variants ) { } } | return buildDefaultFields ( variants , null , null ) ; |
public class GetAccountChanges { /** * Runs the example .
* @ param adWordsServices the services factory .
* @ param session the session .
* @ throws ApiException if the API request failed with one or more service errors .
* @ throws RemoteException if the API request failed due to other errors . */
public static void runExample ( AdWordsServicesInterface adWordsServices , AdWordsSession session ) throws RemoteException { } } | // Get the CampaignService .
CampaignServiceInterface campaignService = adWordsServices . get ( session , CampaignServiceInterface . class ) ; // Get the CustomerSyncService .
CustomerSyncServiceInterface customerSyncService = adWordsServices . get ( session , CustomerSyncServiceInterface . class ) ; // Get a list of all campaign IDs .
List < Long > campaignIds = new ArrayList < > ( ) ; Selector selector = new SelectorBuilder ( ) . fields ( CampaignField . Id ) . build ( ) ; CampaignPage campaigns = campaignService . get ( selector ) ; if ( campaigns . getEntries ( ) != null ) { Arrays . stream ( campaigns . getEntries ( ) ) . forEach ( campaign -> campaignIds . add ( campaign . getId ( ) ) ) ; } // Create date time range for the past 24 hours .
DateTimeRange dateTimeRange = new DateTimeRange ( ) ; dateTimeRange . setMin ( new SimpleDateFormat ( "yyyyMMdd HHmmss" ) . format ( new Date ( System . currentTimeMillis ( ) - 1000L * 60 * 60 * 24 ) ) ) ; dateTimeRange . setMax ( new SimpleDateFormat ( "yyyyMMdd HHmmss" ) . format ( new Date ( ) ) ) ; // Create selector .
CustomerSyncSelector customerSyncSelector = new CustomerSyncSelector ( ) ; customerSyncSelector . setDateTimeRange ( dateTimeRange ) ; customerSyncSelector . setCampaignIds ( ArrayUtils . toPrimitive ( campaignIds . toArray ( new Long [ ] { } ) ) ) ; // Get all account changes for campaign .
CustomerChangeData accountChanges = customerSyncService . get ( customerSyncSelector ) ; // Display changes .
if ( accountChanges != null && accountChanges . getChangedCampaigns ( ) != null ) { System . out . printf ( "Most recent change: %s%n" , accountChanges . getLastChangeTimestamp ( ) ) ; for ( CampaignChangeData campaignChanges : accountChanges . getChangedCampaigns ( ) ) { System . out . printf ( "Campaign with ID %d was changed:%n" , campaignChanges . getCampaignId ( ) ) ; System . out . printf ( "\tCampaign changed status: '%s'%n" , campaignChanges . getCampaignChangeStatus ( ) ) ; if ( ! ChangeStatus . NEW . equals ( campaignChanges . getCampaignChangeStatus ( ) ) ) { System . out . printf ( "\tAdded campaign criteria: %s%n" , getFormattedList ( campaignChanges . getAddedCampaignCriteria ( ) ) ) ; System . out . printf ( "\tRemoved campaign criteria: %s%n" , getFormattedList ( campaignChanges . getRemovedCampaignCriteria ( ) ) ) ; if ( campaignChanges . getChangedAdGroups ( ) != null ) { for ( AdGroupChangeData adGroupChanges : campaignChanges . getChangedAdGroups ( ) ) { System . out . printf ( "\tAd group with ID %d was changed:%n" , adGroupChanges . getAdGroupId ( ) ) ; System . out . printf ( "\t\tAd group changed status: %s%n" , adGroupChanges . getAdGroupChangeStatus ( ) ) ; if ( ! ChangeStatus . NEW . equals ( adGroupChanges . getAdGroupChangeStatus ( ) ) ) { System . out . printf ( "\t\tAds changed: %s%n" , getFormattedList ( adGroupChanges . getChangedAds ( ) ) ) ; System . out . printf ( "\t\tCriteria changed: %s%n" , getFormattedList ( adGroupChanges . getChangedCriteria ( ) ) ) ; System . out . printf ( "\t\tCriteria removed: %s%n" , getFormattedList ( adGroupChanges . getRemovedCriteria ( ) ) ) ; } } } } System . out . println ( "" ) ; } } else { System . out . println ( "No account changes were found." ) ; } |
public class TaskManagerService { /** * Delet all task status rows , if any , related to the given application from the Tasks
* table . NOTE : This method can be called even if the TaskManagerService has not been
* initialized so that we can always cleanup deleted applications .
* @ param appDef { @ link ApplicationDefinition } of application being deleted . */
public void deleteApplicationTasks ( ApplicationDefinition appDef ) { } } | String prefixName = appDef . getAppName ( ) + "/" ; String claimPrefixName = "_claim/" + prefixName ; Tenant tenant = Tenant . getTenant ( appDef ) ; DBTransaction dbTran = DBService . instance ( tenant ) . startTransaction ( ) ; for ( DRow row : DBService . instance ( tenant ) . getAllRows ( TaskManagerService . TASKS_STORE_NAME ) ) { if ( row . getKey ( ) . startsWith ( prefixName ) || row . getKey ( ) . startsWith ( claimPrefixName ) ) { dbTran . deleteRow ( TASKS_STORE_NAME , row . getKey ( ) ) ; } } if ( dbTran . getMutationsCount ( ) > 0 ) { m_logger . info ( "Deleting {} task status rows for application {}" , dbTran . getMutationsCount ( ) , appDef . getAppName ( ) ) ; DBService . instance ( tenant ) . commit ( dbTran ) ; } |
public class DFSContentProvider { /** * / * @ inheritDoc */
public void inputChanged ( Viewer viewer , Object oldInput , Object newInput ) { } } | this . viewer = viewer ; if ( ( viewer != null ) && ( viewer instanceof StructuredViewer ) ) this . sviewer = ( StructuredViewer ) viewer ; else this . sviewer = null ; |
public class FailedWorkspaceChangeRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( FailedWorkspaceChangeRequest failedWorkspaceChangeRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( failedWorkspaceChangeRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( failedWorkspaceChangeRequest . getWorkspaceId ( ) , WORKSPACEID_BINDING ) ; protocolMarshaller . marshall ( failedWorkspaceChangeRequest . getErrorCode ( ) , ERRORCODE_BINDING ) ; protocolMarshaller . marshall ( failedWorkspaceChangeRequest . getErrorMessage ( ) , ERRORMESSAGE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class StatefulPassivator { /** * d430549.10 */
private EJBObjectInfo createSerializableObjectInfo ( Object parentObj ) { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "createSerializableObjectInfo" , parentObj ) ; EJBObjectInfo objectInfo = new EJBObjectInfo ( ) ; objectInfo . setSerializable ( true ) ; objectInfo . setSerializableObject ( parentObj ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "createSerializableObjectInfo" , objectInfo ) ; return objectInfo ; |
public class FindingFilter { /** * For a record to match a filter , one of the values that is specified for this data type property must be the exact
* match of the value of the < b > autoScalingGroup < / b > property of the < a > Finding < / a > data type .
* @ param autoScalingGroups
* For a record to match a filter , one of the values that is specified for this data type property must be
* the exact match of the value of the < b > autoScalingGroup < / b > property of the < a > Finding < / a > data type . */
public void setAutoScalingGroups ( java . util . Collection < String > autoScalingGroups ) { } } | if ( autoScalingGroups == null ) { this . autoScalingGroups = null ; return ; } this . autoScalingGroups = new java . util . ArrayList < String > ( autoScalingGroups ) ; |
public class TileSparklineSkin { /** * * * * * * Methods * * * * * */
@ Override protected void handleEvents ( final String EVENT_TYPE ) { } } | super . handleEvents ( EVENT_TYPE ) ; if ( "RECALC" . equals ( EVENT_TYPE ) ) { minValue = gauge . getMinValue ( ) ; maxValue = gauge . getMaxValue ( ) ; range = gauge . getRange ( ) ; redraw ( ) ; } else if ( "VISIBILITY" . equals ( EVENT_TYPE ) ) { Helper . enableNode ( titleText , ! gauge . getTitle ( ) . isEmpty ( ) ) ; Helper . enableNode ( valueText , gauge . isValueVisible ( ) ) ; Helper . enableNode ( unitText , ! gauge . getUnit ( ) . isEmpty ( ) ) ; Helper . enableNode ( subTitleText , ! gauge . getSubTitle ( ) . isEmpty ( ) ) ; Helper . enableNode ( averageLine , gauge . isAverageVisible ( ) ) ; Helper . enableNode ( averageText , gauge . isAverageVisible ( ) ) ; Helper . enableNode ( stdDeviationArea , gauge . isAverageVisible ( ) ) ; redraw ( ) ; } else if ( "SECTION" . equals ( EVENT_TYPE ) ) { } else if ( "ALERT" . equals ( EVENT_TYPE ) ) { } else if ( "VALUE" . equals ( EVENT_TYPE ) ) { if ( gauge . isAnimated ( ) ) { gauge . setAnimated ( false ) ; } if ( ! gauge . isAveragingEnabled ( ) ) { gauge . setAveragingEnabled ( true ) ; } double value = clamp ( minValue , maxValue , gauge . getValue ( ) ) ; addData ( value ) ; drawChart ( value ) ; } else if ( "AVERAGING_PERIOD" . equals ( EVENT_TYPE ) ) { noOfDatapoints = gauge . getAveragingPeriod ( ) ; // To get smooth lines in the chart we need at least 4 values
if ( noOfDatapoints < 4 ) throw new IllegalArgumentException ( "Please increase the averaging period to a value larger than 3." ) ; for ( int i = 0 ; i < noOfDatapoints ; i ++ ) { dataList . add ( minValue ) ; } pathElements . clear ( ) ; pathElements . add ( 0 , new MoveTo ( ) ) ; for ( int i = 1 ; i < noOfDatapoints ; i ++ ) { pathElements . add ( i , new LineTo ( ) ) ; } sparkLine . getElements ( ) . setAll ( pathElements ) ; redraw ( ) ; } |
public class AiMaterial { /** * Helper method . Returns typed property data .
* @ param < T > type
* @ param key the key
* @ param type the texture type
* @ param index the texture index
* @ param clazz type
* @ return the data */
private < T > T getTyped ( PropertyKey key , AiTextureType type , int index , Class < T > clazz ) { } } | Property p = getProperty ( key . m_key , AiTextureType . toRawValue ( type ) , index ) ; if ( null == p || null == p . getData ( ) ) { return clazz . cast ( m_defaults . get ( key ) ) ; } return clazz . cast ( p . getData ( ) ) ; |
public class MockArtifactStore { /** * { @ inheritDoc } */
public synchronized long getMetadataLastModified ( String path ) throws IOException , MetadataNotFoundException { } } | boolean haveResult = false ; long result = 0 ; path = StringUtils . stripEnd ( StringUtils . stripStart ( path , "/" ) , "/" ) ; String groupId = path . replace ( '/' , '.' ) ; Map < String , Map < String , Map < Artifact , Content > > > artifactMap = contents . get ( groupId ) ; if ( artifactMap != null ) { for ( Map < String , Map < Artifact , Content > > versionMap : artifactMap . values ( ) ) { for ( Map < Artifact , Content > filesMap : versionMap . values ( ) ) { for ( Content content : filesMap . values ( ) ) { haveResult = true ; result = Math . max ( result , content . getLastModified ( ) ) ; } } } } int index = path . lastIndexOf ( '/' ) ; groupId = index == - 1 ? groupId : groupId . substring ( 0 , index ) . replace ( '/' , '.' ) ; String artifactId = ( index == - 1 ? null : path . substring ( index + 1 ) ) ; if ( artifactId != null ) { artifactMap = contents . get ( groupId ) ; Map < String , Map < Artifact , Content > > versionMap = ( artifactMap == null ? null : artifactMap . get ( artifactId ) ) ; if ( versionMap != null ) { for ( Map < Artifact , Content > filesMap : versionMap . values ( ) ) { for ( Content content : filesMap . values ( ) ) { haveResult = true ; result = Math . max ( result , content . getLastModified ( ) ) ; } } } } int index2 = index == - 1 ? - 1 : path . lastIndexOf ( '/' , index - 1 ) ; groupId = index2 == - 1 ? groupId : groupId . substring ( 0 , index2 ) . replace ( '/' , '.' ) ; artifactId = index2 == - 1 ? artifactId : path . substring ( index2 + 1 , index ) ; String version = index2 == - 1 ? null : path . substring ( index + 1 ) ; if ( version != null && version . endsWith ( "-SNAPSHOT" ) ) { artifactMap = contents . get ( groupId ) ; Map < String , Map < Artifact , Content > > versionMap = ( artifactMap == null ? null : artifactMap . get ( artifactId ) ) ; Map < Artifact , Content > filesMap = ( versionMap == null ? null : versionMap . get ( version ) ) ; if ( filesMap != null ) { for ( Content content : filesMap . values ( ) ) { haveResult = true ; result = Math . max ( result , content . getLastModified ( ) ) ; } } } if ( haveResult ) { return result ; } throw new MetadataNotFoundException ( path ) ; |
public class LiveEventsInner { /** * Get Live Event .
* Gets a Live Event .
* @ param resourceGroupName The name of the resource group within the Azure subscription .
* @ param accountName The Media Services account name .
* @ param liveEventName The name of the Live Event .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the LiveEventInner object */
public Observable < LiveEventInner > getAsync ( String resourceGroupName , String accountName , String liveEventName ) { } } | return getWithServiceResponseAsync ( resourceGroupName , accountName , liveEventName ) . map ( new Func1 < ServiceResponse < LiveEventInner > , LiveEventInner > ( ) { @ Override public LiveEventInner call ( ServiceResponse < LiveEventInner > response ) { return response . body ( ) ; } } ) ; |
public class CertificatesImpl { /** * Deletes a certificate from the specified account .
* You cannot delete a certificate if a resource ( pool or compute node ) is using it . Before you can delete a certificate , you must therefore make sure that the certificate is not associated with any existing pools , the certificate is not installed on any compute nodes ( even if you remove a certificate from a pool , it is not removed from existing compute nodes in that pool until they restart ) , and no running tasks depend on the certificate . If you try to delete a certificate that is in use , the deletion fails . The certificate status changes to deleteFailed . You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate .
* @ param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter . This must be sha1.
* @ param thumbprint The thumbprint of the certificate to be deleted .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws BatchErrorException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */
public void delete ( String thumbprintAlgorithm , String thumbprint ) { } } | deleteWithServiceResponseAsync ( thumbprintAlgorithm , thumbprint ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class OperatorForEachFuture { /** * Subscribes to the given source and calls the callback for each emitted item ,
* and surfaces the completion or error through a Future .
* @ param < T > the element type of the Observable
* @ param source the source Observable
* @ param onNext the action to call with each emitted element
* @ param onError the action to call when an exception is emitted
* @ return the Future representing the entire for - each operation */
public static < T > FutureTask < Void > forEachFuture ( Observable < ? extends T > source , Action1 < ? super T > onNext , Action1 < ? super Throwable > onError ) { } } | return forEachFuture ( source , onNext , onError , Functionals . empty ( ) ) ; |
public class GeneratorRegistry { /** * Initializes the generator properties .
* @ param generator
* the generator */
private void initializeGeneratorProperties ( ResourceGenerator generator ) { } } | // Initialize the generator
if ( generator instanceof InitializingResourceGenerator ) { if ( generator instanceof ConfigurationAwareResourceGenerator ) { ( ( ConfigurationAwareResourceGenerator ) generator ) . setConfig ( config ) ; } if ( generator instanceof TypeAwareResourceGenerator ) { ( ( TypeAwareResourceGenerator ) generator ) . setResourceType ( resourceType ) ; } if ( generator instanceof ResourceReaderHandlerAwareResourceGenerator ) { ( ( ResourceReaderHandlerAwareResourceGenerator ) generator ) . setResourceReaderHandler ( rsHandler ) ; } if ( generator instanceof WorkingDirectoryLocationAware ) { ( ( WorkingDirectoryLocationAware ) generator ) . setWorkingDirectory ( rsHandler . getWorkingDirectory ( ) ) ; } if ( generator instanceof PostInitializationAwareResourceGenerator ) { ( ( PostInitializationAwareResourceGenerator ) generator ) . afterPropertiesSet ( ) ; } } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.