signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ElementHelper { /** * This is essentially an adjusted copy & paste from TinkerPop ' s ElementHelper class .
* The reason for copying it is so that we can determine the cardinality of a property key based on
* Titan ' s schema which is tied to this particular transaction and not the graph .
* @ param vertex
* @ param propertyKeyValues */
public static void attachProperties ( final TitanVertex vertex , final Object ... propertyKeyValues ) { } } | if ( null == vertex ) throw Graph . Exceptions . argumentCanNotBeNull ( "vertex" ) ; for ( int i = 0 ; i < propertyKeyValues . length ; i = i + 2 ) { if ( ! propertyKeyValues [ i ] . equals ( T . id ) && ! propertyKeyValues [ i ] . equals ( T . label ) ) vertex . property ( ( String ) propertyKeyValues [ i ] , propertyKeyValues [ i + 1 ] ) ; } |
public class BeanPathProperties { /** * Each these path properties as fetch paths to the query .
* @ param each each process */
public void each ( Each < Props > each ) { } } | for ( Map . Entry < String , Props > entry : pathMap . entrySet ( ) ) { Props props = entry . getValue ( ) ; each . execute ( props ) ; } |
public class Utils { /** * Randomly chooses elements from the collection .
* @ param collection The collection .
* @ param n The number of elements to choose .
* @ param < T > The type of the elements .
* @ return A list with the chosen elements . */
public static < T > List < T > randomSample ( Collection < T > collection , int n ) { } } | List < T > list = new ArrayList < T > ( collection ) ; List < T > sample = new ArrayList < T > ( n ) ; Random random = new Random ( ) ; while ( n > 0 && ! list . isEmpty ( ) ) { int index = random . nextInt ( list . size ( ) ) ; sample . add ( list . get ( index ) ) ; int indexLast = list . size ( ) - 1 ; T last = list . remove ( indexLast ) ; if ( index < indexLast ) { list . set ( index , last ) ; } n -- ; } return sample ; |
public class ExamplePnP { /** * Adds some really bad observations to the mix */
public void addOutliers ( List < Point2D3D > observations , int total ) { } } | int size = observations . size ( ) ; for ( int i = 0 ; i < total ; i ++ ) { // outliers will be created by adding lots of noise to real observations
Point2D3D p = observations . get ( rand . nextInt ( size ) ) ; Point2D3D o = new Point2D3D ( ) ; o . observation . set ( p . observation ) ; o . location . x = p . location . x + rand . nextGaussian ( ) * 5 ; o . location . y = p . location . y + rand . nextGaussian ( ) * 5 ; o . location . z = p . location . z + rand . nextGaussian ( ) * 5 ; observations . add ( o ) ; } // randomize the order
Collections . shuffle ( observations , rand ) ; |
public class ExpandableRecyclerAdapter { /** * Notify any registered observers that the currently reflected { @ code itemCount }
* parents starting at { @ code parentPositionStart } have been newly inserted .
* The parents previously located at { @ code parentPositionStart } and beyond
* can now be found starting at position { @ code parentPositionStart + itemCount } .
* This is a structural change event . Representations of other existing items in the
* data set are still considered up to date and will not be rebound , though their positions
* may be altered .
* @ param parentPositionStart Position of the first parent that was inserted , relative
* to the list of parents only .
* @ param itemCount Number of items inserted
* @ see # notifyParentInserted ( int ) */
@ UiThread public void notifyParentRangeInserted ( int parentPositionStart , int itemCount ) { } } | int initialFlatParentPosition ; if ( parentPositionStart < mParentList . size ( ) - itemCount ) { initialFlatParentPosition = getFlatParentPosition ( parentPositionStart ) ; } else { initialFlatParentPosition = mFlatItemList . size ( ) ; } int sizeChanged = 0 ; int flatParentPosition = initialFlatParentPosition ; int changed ; int parentPositionEnd = parentPositionStart + itemCount ; for ( int i = parentPositionStart ; i < parentPositionEnd ; i ++ ) { P parent = mParentList . get ( i ) ; changed = addParentWrapper ( flatParentPosition , parent ) ; flatParentPosition += changed ; sizeChanged += changed ; } notifyItemRangeInserted ( initialFlatParentPosition , sizeChanged ) ; |
public class NewJFrame { /** * < / editor - fold > / / GEN - END : initComponents */
private void dateTimeFocusLost ( java . awt . event . FocusEvent evt ) { } } | // GEN - FIRST : event _ dateTimeFocusLost
String dateTime = jTextField4 . getText ( ) ; setDateTime ( dateTime ) ; |
public class Functions { /** * Runs encode base 64 function with arguments .
* @ return */
public static String encodeBase64 ( String content , Charset charset , TestContext context ) { } } | return new EncodeBase64Function ( ) . execute ( Arrays . asList ( content , charset . displayName ( ) ) , context ) ; |
public class AbstractCasWebflowEventResolver { /** * Resolve service from authentication request service .
* @ param context the context
* @ return the service */
protected Service resolveServiceFromAuthenticationRequest ( final RequestContext context ) { } } | val ctxService = WebUtils . getService ( context ) ; return resolveServiceFromAuthenticationRequest ( ctxService ) ; |
public class AbstractJpaStorage { /** * Get object of type T
* @ param organizationId org id
* @ param id identity
* @ param type class of type T
* @ return Instance of type T
* @ throws StorageException if a storage problem occurs while storing a bean */
public < T > T get ( String organizationId , String id , Class < T > type ) throws StorageException { } } | T rval ; EntityManager entityManager = getActiveEntityManager ( ) ; try { OrganizationBean orgBean = entityManager . find ( OrganizationBean . class , organizationId ) ; Object key = new OrganizationBasedCompositeId ( orgBean , id ) ; rval = entityManager . find ( type , key ) ; } catch ( Throwable t ) { logger . error ( t . getMessage ( ) , t ) ; throw new StorageException ( t ) ; } return rval ; |
public class FacetOptions { /** * Append { @ code facet . query }
* @ param query
* @ return */
public final FacetOptions addFacetQuery ( SolrDataQuery query ) { } } | Assert . notNull ( query , "Facet Query must not be null." ) ; this . facetQueries . add ( query ) ; return this ; |
public class MarvinImage { /** * Fills a rectangle in the image .
* @ param x rect � s start position in x - axis
* @ param y rect � s start positioj in y - axis
* @ param w rect � s width
* @ param h rect � s height
* @ param c rect � s color */
public void fillRect ( int x , int y , int w , int h , Color c ) { } } | int color = c . getRGB ( ) ; for ( int i = x ; i < x + w ; i ++ ) { for ( int j = y ; j < y + h ; j ++ ) { setIntColor ( i , j , color ) ; } } |
public class ExecutionEngineJNI { /** * Delete the block with the given id from disk .
* @ param siteId The originating site id of the block to release
* @ param blockCounter The serial number of the block to release
* @ return True if the operation succeeded , and false otherwise */
public boolean releaseLargeTempTableBlock ( long siteId , long blockCounter ) { } } | LargeBlockTask task = LargeBlockTask . getReleaseTask ( new BlockId ( siteId , blockCounter ) ) ; return executeLargeBlockTaskSynchronously ( task ) ; |
public class LinearSearch { /** * Search for the maximum element in the array .
* @ param byteArray array that we are searching in .
* @ return the maximum element in the array . */
public static byte searchMax ( byte [ ] byteArray ) { } } | if ( byteArray . length == 0 ) { throw new IllegalArgumentException ( "The array you provided does not have any elements" ) ; } byte max = byteArray [ 0 ] ; for ( int i = 1 ; i < byteArray . length ; i ++ ) { if ( byteArray [ i ] > max ) { max = byteArray [ i ] ; } } return max ; |
public class ComputeRegionMeanColor { /** * Compute the average color for each region
* @ param image Input image
* @ param pixelToRegion Conversion between pixel to region index
* @ param regionMemberCount List which stores the number of members for each region
* @ param regionColor ( Output ) Storage for mean color throughout the region . Internal array must be fully
* declared . */
public void process ( T image , GrayS32 pixelToRegion , GrowQueue_I32 regionMemberCount , FastQueue < float [ ] > regionColor ) { } } | this . image = image ; // Initialize data structures
regionSums . resize ( regionColor . size ) ; for ( int i = 0 ; i < regionSums . size ; i ++ ) { float v [ ] = regionSums . get ( i ) ; for ( int j = 0 ; j < v . length ; j ++ ) { v [ j ] = 0 ; } } // Sum up the pixel values for each region
for ( int y = 0 ; y < image . height ; y ++ ) { int indexImg = image . startIndex + y * image . stride ; int indexRgn = pixelToRegion . startIndex + y * pixelToRegion . stride ; for ( int x = 0 ; x < image . width ; x ++ , indexRgn ++ , indexImg ++ ) { int region = pixelToRegion . data [ indexRgn ] ; float [ ] sum = regionSums . get ( region ) ; addPixelValue ( indexImg , sum ) ; } } // Compute the average using the sum and update the region color
for ( int i = 0 ; i < regionSums . size ; i ++ ) { float N = regionMemberCount . get ( i ) ; float [ ] sum = regionSums . get ( i ) ; float [ ] average = regionColor . get ( i ) ; for ( int j = 0 ; j < numBands ; j ++ ) { average [ j ] = sum [ j ] / N ; } } |
public class ServiceRefType { /** * parse the name and address attributes defined in the element . */
@ Override public boolean handleAttribute ( DDParser parser , String nsURI , String localName , int index ) throws ParseException { } } | boolean result = false ; if ( nsURI != null ) { return result ; } if ( NAME_ATTRIBUTE_NAME . equals ( localName ) ) { name = parser . parseStringAttributeValue ( index ) ; result = true ; } else if ( COMPONENT_NAME_ATTRIBUTE_NAME . equals ( localName ) ) { componentName = parser . parseStringAttributeValue ( index ) ; result = true ; } else if ( PORT_ADDRESS_ATTRIBUTE_NAME . equals ( localName ) ) { portAddress = parser . parseStringAttributeValue ( index ) ; result = true ; } else if ( WSDL_LOCATION_ATTRIBUTE_NAME . equals ( localName ) ) { wsdlLocation = parser . parseStringAttributeValue ( index ) ; result = true ; } return result ; |
public class FileHandlerUtil { /** * Converts all separators to the system separator .
* @ param path
* the path to be changed , null ignored
* @ return the updated path */
public static String separatorsToSystem ( String path ) { } } | if ( path == null ) { return null ; } if ( EnvUtil . isWindows ( ) ) { return separatorsToWindows ( path ) ; } else { return separatorsToUnix ( path ) ; } |
public class DatumWriterGenerator { /** * Generates method body for encoding simple schema type by calling corresponding write method in Encoder .
* @ param mg Method body generator
* @ param type Data type to encode
* @ param encodeMethod Name of the encode method to invoke on the given encoder .
* @ param value Argument index of the value to encode .
* @ param encoder Method argument index of the encoder */
private void encodeSimple ( GeneratorAdapter mg , TypeToken < ? > type , Schema schema , String encodeMethod , int value , int encoder ) { } } | // encoder . writeXXX ( value ) ;
TypeToken < ? > encodeType = type ; mg . loadArg ( encoder ) ; mg . loadArg ( value ) ; if ( Primitives . isWrapperType ( encodeType . getRawType ( ) ) ) { encodeType = TypeToken . of ( Primitives . unwrap ( encodeType . getRawType ( ) ) ) ; mg . unbox ( Type . getType ( encodeType . getRawType ( ) ) ) ; // A special case since INT type represents ( byte , char , short and int ) .
if ( schema . getType ( ) == Schema . Type . INT && ! int . class . equals ( encodeType . getRawType ( ) ) ) { encodeType = TypeToken . of ( int . class ) ; } } else if ( schema . getType ( ) == Schema . Type . STRING && ! String . class . equals ( encodeType . getRawType ( ) ) ) { // For non - string object that has a String schema , invoke toString ( ) .
mg . invokeVirtual ( Type . getType ( encodeType . getRawType ( ) ) , getMethod ( String . class , "toString" ) ) ; encodeType = TypeToken . of ( String . class ) ; } else if ( schema . getType ( ) == Schema . Type . BYTES && UUID . class . equals ( encodeType . getRawType ( ) ) ) { // Special case UUID , encode as byte array
// ByteBuffer buf = ByteBuffer . allocate ( Longs . BYTES * 2)
// . putLong ( uuid . getMostSignificantBits ( ) )
// . putLong ( uuid . getLeastSignificantBits ( ) ) ;
// encoder . writeBytes ( ( ByteBuffer ) buf . flip ( ) ) ;
Type byteBufferType = Type . getType ( ByteBuffer . class ) ; Type uuidType = Type . getType ( UUID . class ) ; mg . push ( Longs . BYTES * 2 ) ; mg . invokeStatic ( byteBufferType , getMethod ( ByteBuffer . class , "allocate" , int . class ) ) ; mg . swap ( ) ; mg . invokeVirtual ( uuidType , getMethod ( long . class , "getMostSignificantBits" ) ) ; mg . invokeVirtual ( byteBufferType , getMethod ( ByteBuffer . class , "putLong" , long . class ) ) ; mg . loadArg ( value ) ; mg . invokeVirtual ( uuidType , getMethod ( long . class , "getLeastSignificantBits" ) ) ; mg . invokeVirtual ( byteBufferType , getMethod ( ByteBuffer . class , "putLong" , long . class ) ) ; mg . invokeVirtual ( Type . getType ( Buffer . class ) , getMethod ( Buffer . class , "flip" ) ) ; mg . checkCast ( byteBufferType ) ; encodeType = TypeToken . of ( ByteBuffer . class ) ; } mg . invokeInterface ( Type . getType ( Encoder . class ) , getMethod ( Encoder . class , encodeMethod , encodeType . getRawType ( ) ) ) ; mg . pop ( ) ; |
public class CxxPlugin { /** * { @ inheritDoc } */
@ Override public void define ( Context context ) { } } | List < Object > l = new ArrayList < > ( ) ; // plugin elements
l . add ( CppLanguage . class ) ; l . add ( CxxDefaultProfile . class ) ; l . add ( CxxRuleRepository . class ) ; // reusable elements
l . addAll ( getSensorsImpl ( ) ) ; // properties elements
l . addAll ( generalProperties ( ) ) ; l . addAll ( codeAnalysisProperties ( ) ) ; l . addAll ( testingAndCoverageProperties ( ) ) ; l . addAll ( compilerWarningsProperties ( ) ) ; l . addAll ( duplicationsProperties ( ) ) ; context . addExtensions ( l ) ; |
public class DefaultBeanPropertyNameRenderer { /** * Renders a unqualified bean property string in the format :
* " parentProperty . myBeanProperty " like " ParentProperty . MyBeanProperty " .
* @ param qualifiedName
* @ return the formatted string */
public String renderQualifiedName ( String qualifiedName ) { } } | Assert . notNull ( qualifiedName , "No qualified name specified" ) ; StringBuffer sb = new StringBuffer ( qualifiedName . length ( ) + 5 ) ; char [ ] chars = qualifiedName . toCharArray ( ) ; sb . append ( Character . toUpperCase ( chars [ 0 ] ) ) ; boolean foundDot = false ; for ( int i = 1 ; i < chars . length ; i ++ ) { char c = chars [ i ] ; if ( Character . isLetter ( c ) ) { if ( Character . isLowerCase ( c ) ) { if ( foundDot ) { sb . append ( Character . toUpperCase ( c ) ) ; foundDot = false ; } else { sb . append ( c ) ; } } else { sb . append ( c ) ; } } else if ( c == '.' ) { sb . append ( c ) ; foundDot = true ; } } return sb . toString ( ) ; |
public class PseudoClassSpecifierChecker { /** * { @ inheritDoc } */
@ Override public Collection < Node > check ( final Collection < Node > nodes ) { } } | Assert . notNull ( nodes , "nodes is null!" ) ; this . nodes = nodes ; this . result = new LinkedHashSet < Node > ( ) ; String value = specifier . getValue ( ) ; if ( "empty" . equals ( value ) ) addEmptyElements ( ) ; else if ( "first-child" . equals ( value ) ) addFirstChildElements ( ) ; else if ( "first-of-type" . equals ( value ) ) addFirstOfType ( ) ; else if ( "last-child" . equals ( value ) ) addLastChildElements ( ) ; else if ( "last-of-type" . equals ( value ) ) addLastOfType ( ) ; else if ( "only-child" . equals ( value ) ) addOnlyChildElements ( ) ; else if ( "only-of-type" . equals ( value ) ) addOnlyOfTypeElements ( ) ; else if ( "root" . equals ( value ) ) addRootElement ( ) ; else throw new RuntimeException ( "Unknown pseudo class: " + value ) ; return result ; |
public class GroupImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public NotificationChain eInverseRemove ( InternalEObject otherEnd , int featureID , NotificationChain msgs ) { } } | switch ( featureID ) { case XtextPackage . GROUP__GUARD_CONDITION : return basicSetGuardCondition ( null , msgs ) ; } return super . eInverseRemove ( otherEnd , featureID , msgs ) ; |
public class FatFile { /** * Sets the size ( in bytes ) of this file . Because
* { @ link # write ( long , java . nio . ByteBuffer ) writing } to the file will grow
* it automatically if needed , this method is mainly usefull for truncating
* a file .
* @ param length the new length of the file in bytes
* @ throws ReadOnlyException if this file is read - only
* @ throws IOException on error updating the file size */
@ Override public void setLength ( long length ) throws ReadOnlyException , IOException { } } | checkWritable ( ) ; if ( getLength ( ) == length ) return ; updateTimeStamps ( true ) ; chain . setSize ( length ) ; this . entry . setStartCluster ( chain . getStartCluster ( ) ) ; this . entry . setLength ( length ) ; |
public class XeGithubLink { /** * Ctor .
* @ param req Request
* @ param app Github application ID
* @ param rel Related
* @ param flag Flag to add
* @ return Source
* @ throws IOException If fails
* @ checkstyle ParameterNumberCheck ( 4 lines ) */
private static XeSource make ( final Request req , final CharSequence app , final CharSequence rel , final CharSequence flag ) throws IOException { } } | return new XeLink ( rel , new Href ( "https://github.com/login/oauth/authorize" ) . with ( "client_id" , app ) . with ( "redirect_uri" , new RqHref . Base ( req ) . href ( ) . with ( flag , PsGithub . class . getSimpleName ( ) ) ) ) ; |
public class JMResources { /** * Read lines with classpath or file path list .
* @ param classpathOrFilePath the classpath or file path
* @ return the list */
public static List < String > readLinesWithClasspathOrFilePath ( String classpathOrFilePath ) { } } | return getStringListAsOptWithClasspath ( classpathOrFilePath ) . filter ( JMPredicate . getGreaterSize ( 0 ) ) . orElseGet ( ( ) -> JMFiles . readLines ( classpathOrFilePath ) ) ; |
public class DoPropfind { /** * Propfind helper method .
* @ param transaction
* @ param req The servlet request
* @ param generatedXML XML response to the Propfind request
* @ param path Path of the current resource
* @ param type Propfind type
* @ param propertiesVector If the propfind type is find properties by name , then this Vector contains those properties
* @ param mimeType
* @ throws WebdavException */
private void parseProperties ( ITransaction transaction , HttpServletRequest req , XMLWriter generatedXML , String path , int type , Vector < String > propertiesVector , String mimeType ) throws WebdavException { } } | StoredObject so = store . getStoredObject ( transaction , path ) ; if ( so == null ) return ; boolean isFolder = so . isFolder ( ) ; final String creationdate = creationDateFormat ( so . getCreationDate ( ) ) ; final String lastModified = lastModifiedDateFormat ( so . getLastModified ( ) ) ; String resourceLength = String . valueOf ( so . getResourceLength ( ) ) ; // ResourceInfo resourceInfo = new ResourceInfo ( path , resources ) ;
generatedXML . writeElement ( "DAV::response" , XMLWriter . OPENING ) ; String status = "HTTP/1.1 " + WebdavStatus . SC_OK + " " + WebdavStatus . getStatusText ( WebdavStatus . SC_OK ) ; // Generating href element
generatedXML . writeElement ( "DAV::href" , XMLWriter . OPENING ) ; String href = req . getContextPath ( ) ; String servletPath = req . getServletPath ( ) ; if ( servletPath != null ) { if ( ( href . endsWith ( "/" ) ) && ( servletPath . startsWith ( "/" ) ) ) { href += servletPath . substring ( 1 ) ; } else { href += servletPath ; } } if ( ( href . endsWith ( "/" ) ) && ( path . startsWith ( "/" ) ) ) { href += path . substring ( 1 ) ; } else { href += path ; } if ( ( isFolder ) && ( ! href . endsWith ( "/" ) ) ) { href += "/" ; } generatedXML . writeText ( rewriteUrl ( href ) ) ; generatedXML . writeElement ( "DAV::href" , XMLWriter . CLOSING ) ; String resourceName = path ; int lastSlash = path . lastIndexOf ( '/' ) ; if ( lastSlash != - 1 ) { resourceName = resourceName . substring ( lastSlash + 1 ) ; } switch ( type ) { case FIND_ALL_PROP : generatedXML . writeElement ( "DAV::propstat" , XMLWriter . OPENING ) ; generatedXML . writeElement ( "DAV::prop" , XMLWriter . OPENING ) ; writeCustomProperties ( transaction , generatedXML , path , true , propertiesVector ) ; generatedXML . writeProperty ( "DAV::creationdate" , creationdate ) ; generatedXML . writeElement ( "DAV::displayname" , XMLWriter . OPENING ) ; generatedXML . writeData ( resourceName ) ; generatedXML . writeElement ( "DAV::displayname" , XMLWriter . CLOSING ) ; if ( ! isFolder ) { generatedXML . writeProperty ( "DAV::getlastmodified" , lastModified ) ; generatedXML . writeProperty ( "DAV::getcontentlength" , resourceLength ) ; if ( mimeType != null ) { generatedXML . writeProperty ( "DAV::getcontenttype" , mimeType ) ; } generatedXML . writeProperty ( "DAV::getetag" , getETag ( so ) ) ; generatedXML . writeElement ( "DAV::resourcetype" , XMLWriter . NO_CONTENT ) ; } else { generatedXML . writeElement ( "DAV::resourcetype" , XMLWriter . OPENING ) ; generatedXML . writeElement ( "DAV::collection" , XMLWriter . NO_CONTENT ) ; generatedXML . writeElement ( "DAV::resourcetype" , XMLWriter . CLOSING ) ; } writeSupportedLockElements ( transaction , generatedXML , path ) ; writeLockDiscoveryElements ( transaction , generatedXML , path ) ; generatedXML . writeProperty ( "DAV::source" , "" ) ; generatedXML . writeElement ( "DAV::prop" , XMLWriter . CLOSING ) ; generatedXML . writeElement ( "DAV::status" , XMLWriter . OPENING ) ; generatedXML . writeText ( status ) ; generatedXML . writeElement ( "DAV::status" , XMLWriter . CLOSING ) ; generatedXML . writeElement ( "DAV::propstat" , XMLWriter . CLOSING ) ; break ; case FIND_PROPERTY_NAMES : generatedXML . writeElement ( "DAV::propstat" , XMLWriter . OPENING ) ; generatedXML . writeElement ( "DAV::prop" , XMLWriter . OPENING ) ; writeCustomProperties ( transaction , generatedXML , path , false , propertiesVector ) ; generatedXML . writeElement ( "DAV::creationdate" , XMLWriter . NO_CONTENT ) ; generatedXML . writeElement ( "DAV::displayname" , XMLWriter . NO_CONTENT ) ; if ( ! isFolder ) { generatedXML . writeElement ( "DAV::getcontentlanguage" , XMLWriter . NO_CONTENT ) ; generatedXML . writeElement ( "DAV::getcontentlength" , XMLWriter . NO_CONTENT ) ; generatedXML . writeElement ( "DAV::getcontenttype" , XMLWriter . NO_CONTENT ) ; generatedXML . writeElement ( "DAV::getetag" , XMLWriter . NO_CONTENT ) ; generatedXML . writeElement ( "DAV::getlastmodified" , XMLWriter . NO_CONTENT ) ; } generatedXML . writeElement ( "DAV::resourcetype" , XMLWriter . NO_CONTENT ) ; generatedXML . writeElement ( "DAV::supportedlock" , XMLWriter . NO_CONTENT ) ; generatedXML . writeElement ( "DAV::source" , XMLWriter . NO_CONTENT ) ; generatedXML . writeElement ( "DAV::prop" , XMLWriter . CLOSING ) ; generatedXML . writeElement ( "DAV::status" , XMLWriter . OPENING ) ; generatedXML . writeText ( status ) ; generatedXML . writeElement ( "DAV::status" , XMLWriter . CLOSING ) ; generatedXML . writeElement ( "DAV::propstat" , XMLWriter . CLOSING ) ; break ; case FIND_BY_PROPERTY : Vector < String > propertiesNotFound = new Vector < String > ( ) ; // Parse the list of properties
generatedXML . writeElement ( "DAV::propstat" , XMLWriter . OPENING ) ; generatedXML . writeElement ( "DAV::prop" , XMLWriter . OPENING ) ; writeCustomProperties ( transaction , generatedXML , path , true , propertiesVector ) ; Enumeration < String > properties = propertiesVector . elements ( ) ; while ( properties . hasMoreElements ( ) ) { String property = properties . nextElement ( ) ; if ( property . equals ( "DAV::creationdate" ) ) { generatedXML . writeProperty ( "DAV::creationdate" , creationdate ) ; } else if ( property . equals ( "DAV::displayname" ) ) { generatedXML . writeElement ( "DAV::displayname" , XMLWriter . OPENING ) ; generatedXML . writeData ( resourceName ) ; generatedXML . writeElement ( "DAV::displayname" , XMLWriter . CLOSING ) ; } else if ( property . equals ( "DAV::getcontentlanguage" ) ) { if ( isFolder ) { propertiesNotFound . addElement ( property ) ; } else { generatedXML . writeElement ( "DAV::getcontentlanguage" , XMLWriter . NO_CONTENT ) ; } } else if ( property . equals ( "DAV::getcontentlength" ) ) { if ( isFolder ) { propertiesNotFound . addElement ( property ) ; } else { generatedXML . writeProperty ( "DAV::getcontentlength" , resourceLength ) ; } } else if ( property . equals ( "DAV::getcontenttype" ) ) { if ( isFolder ) { propertiesNotFound . addElement ( property ) ; } else { generatedXML . writeProperty ( "DAV::getcontenttype" , mimeType ) ; } } else if ( property . equals ( "DAV::getetag" ) ) { if ( isFolder || so . isNullResource ( ) ) { propertiesNotFound . addElement ( property ) ; } else { generatedXML . writeProperty ( "DAV::getetag" , getETag ( so ) ) ; } } else if ( property . equals ( "DAV::getlastmodified" ) ) { if ( isFolder ) { propertiesNotFound . addElement ( property ) ; } else { generatedXML . writeProperty ( "DAV::getlastmodified" , lastModified ) ; } } else if ( property . equals ( "DAV::resourcetype" ) ) { if ( isFolder ) { generatedXML . writeElement ( "DAV::resourcetype" , XMLWriter . OPENING ) ; generatedXML . writeElement ( "DAV::collection" , XMLWriter . NO_CONTENT ) ; generatedXML . writeElement ( "DAV::resourcetype" , XMLWriter . CLOSING ) ; } else { generatedXML . writeElement ( "DAV::resourcetype" , XMLWriter . NO_CONTENT ) ; } } else if ( property . equals ( "DAV::source" ) ) { generatedXML . writeProperty ( "DAV::source" , "" ) ; } else if ( property . equals ( "DAV::supportedlock" ) ) { writeSupportedLockElements ( transaction , generatedXML , path ) ; } else if ( property . equals ( "DAV::lockdiscovery" ) ) { writeLockDiscoveryElements ( transaction , generatedXML , path ) ; } else { propertiesNotFound . addElement ( property ) ; } } generatedXML . writeElement ( "DAV::prop" , XMLWriter . CLOSING ) ; generatedXML . writeElement ( "DAV::status" , XMLWriter . OPENING ) ; generatedXML . writeText ( status ) ; generatedXML . writeElement ( "DAV::status" , XMLWriter . CLOSING ) ; generatedXML . writeElement ( "DAV::propstat" , XMLWriter . CLOSING ) ; Enumeration < String > propertiesNotFoundList = propertiesNotFound . elements ( ) ; if ( propertiesNotFoundList . hasMoreElements ( ) ) { status = "HTTP/1.1 " + WebdavStatus . SC_NOT_FOUND + " " + WebdavStatus . getStatusText ( WebdavStatus . SC_NOT_FOUND ) ; generatedXML . writeElement ( "DAV::propstat" , XMLWriter . OPENING ) ; generatedXML . writeElement ( "DAV::prop" , XMLWriter . OPENING ) ; while ( propertiesNotFoundList . hasMoreElements ( ) ) { generatedXML . writeElement ( propertiesNotFoundList . nextElement ( ) , XMLWriter . NO_CONTENT ) ; } generatedXML . writeElement ( "DAV::prop" , XMLWriter . CLOSING ) ; generatedXML . writeElement ( "DAV::status" , XMLWriter . OPENING ) ; generatedXML . writeText ( status ) ; generatedXML . writeElement ( "DAV::status" , XMLWriter . CLOSING ) ; generatedXML . writeElement ( "DAV::propstat" , XMLWriter . CLOSING ) ; } break ; } generatedXML . writeElement ( "DAV::response" , XMLWriter . CLOSING ) ; so = null ; |
public class CopyToModule { /** * Process start map to read copy - to map and write unique topic references . */
private void processMap ( ) throws DITAOTException { } } | final URI in = job . tempDirURI . resolve ( job . getFileInfo ( fi -> fi . isInput ) . iterator ( ) . next ( ) . uri ) ; final List < XMLFilter > pipe = getProcessingPipe ( in ) ; xmlUtils . transform ( in , pipe ) ; |
public class Sift { /** * Call Sift . collect ( ) after the Sift . open ( ) call in each Activity .
* Collect SDK events for Device Properties and Application State . */
public static void collect ( ) { } } | AsyncTask . execute ( new Runnable ( ) { @ Override public void run ( ) { devicePropertiesCollector . collect ( ) ; appStateCollector . collect ( ) ; } } ) ; |
public class CommerceTaxMethodUtil { /** * Returns the commerce tax methods before and after the current commerce tax method in the ordered set where groupId = & # 63 ; and active = & # 63 ; .
* @ param commerceTaxMethodId the primary key of the current commerce tax method
* @ param groupId the group ID
* @ param active the active
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the previous , current , and next commerce tax method
* @ throws NoSuchTaxMethodException if a commerce tax method with the primary key could not be found */
public static CommerceTaxMethod [ ] findByG_A_PrevAndNext ( long commerceTaxMethodId , long groupId , boolean active , OrderByComparator < CommerceTaxMethod > orderByComparator ) throws com . liferay . commerce . tax . exception . NoSuchTaxMethodException { } } | return getPersistence ( ) . findByG_A_PrevAndNext ( commerceTaxMethodId , groupId , active , orderByComparator ) ; |
public class GetDiskSnapshotsResult { /** * An array of objects containing information about all block storage disk snapshots .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setDiskSnapshots ( java . util . Collection ) } or { @ link # withDiskSnapshots ( java . util . Collection ) } if you want
* to override the existing values .
* @ param diskSnapshots
* An array of objects containing information about all block storage disk snapshots .
* @ return Returns a reference to this object so that method calls can be chained together . */
public GetDiskSnapshotsResult withDiskSnapshots ( DiskSnapshot ... diskSnapshots ) { } } | if ( this . diskSnapshots == null ) { setDiskSnapshots ( new java . util . ArrayList < DiskSnapshot > ( diskSnapshots . length ) ) ; } for ( DiskSnapshot ele : diskSnapshots ) { this . diskSnapshots . add ( ele ) ; } return this ; |
public class SparseIntHashArray { /** * { @ inheritDoc } */
public void set ( int index , Integer value ) { } } | if ( value == 0 ) indexToValue . remove ( index ) ; else indexToValue . put ( index , value ) ; |
public class GeoQuery { /** * Removes an event listener .
* @ throws IllegalArgumentException If the listener was removed already or never added
* @ param listener The listener to remove */
public synchronized void removeGeoQueryEventListener ( final GeoQueryDataEventListener listener ) { } } | if ( ! eventListeners . contains ( listener ) ) { throw new IllegalArgumentException ( "Trying to remove listener that was removed or not added!" ) ; } eventListeners . remove ( listener ) ; if ( ! this . hasListeners ( ) ) { reset ( ) ; } |
public class DiffusionFilter { /** * Set the dither matrix .
* @ param matrix the dither matrix
* @ see # getMatrix */
public void setMatrix ( int [ ] matrix ) { } } | this . matrix = matrix ; sum = 0 ; for ( int i = 0 ; i < matrix . length ; i ++ ) sum += matrix [ i ] ; |
public class WebAppDescriptorImpl { /** * If not already created , a new < code > mime - mapping < / code > element will be created and returned .
* Otherwise , the first existing < code > mime - mapping < / code > element will be returned .
* @ return the instance defined for the element < code > mime - mapping < / code > */
public MimeMappingType < WebAppDescriptor > getOrCreateMimeMapping ( ) { } } | List < Node > nodeList = model . get ( "mime-mapping" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new MimeMappingTypeImpl < WebAppDescriptor > ( this , "mime-mapping" , model , nodeList . get ( 0 ) ) ; } return createMimeMapping ( ) ; |
public class SmoothieMap { /** * Returns { @ code true } if the two given key objects should be considered equal for this { @ code
* SmoothieMap } .
* < p > This method should obey general equivalence relation rules ( see { @ link
* Object # equals ( Object ) } documentation for details ) , and also should be consistent with { @ link
* # keyHashCode ( Object ) } method in this class ( i . e . these methods should overridden together ) .
* < p > It is guaranteed that the first specified key is non - null and the arguments are not
* identical ( ! = ) , in particular this means that to get { @ link IdentityHashMap } behaviour it ' s
* OK to override this method just returning { @ code false } : < pre > < code >
* class IdentitySmoothieMap & lt ; K , V & gt ; extends SmoothieMap & lt ; K , V & gt ; {
* & # 064 ; Override
* protected boolean keysEqual ( & # 064 ; NotNull Object queriedKey , & # 064 ; Nullable K keyInMap ) {
* return false ;
* & # 064 ; Override
* protected long keyHashCode ( & # 064 ; Nullable Object key ) {
* return System . identityHashCode ( key ) * LONG _ PHI _ MAGIC ;
* } < / code > < / pre >
* < p > This method accepts raw { @ code Object } argument , because { @ link Map } interface allows
* to check presence of raw key , e . g . { @ link # get ( Object ) } without { @ link ClassCastException } .
* If you want to subclass parameterized { @ code SmoothieMap } , you should cast the arguments to
* the key parameter class yourself , e . g . : < pre > < code >
* class DomainToIpMap extends SmoothieMap & lt ; String , Integer & gt ; {
* & # 064 ; Override
* protected boolean keysEqual ( & # 064 ; NotNull Object queriedDomain ,
* & # 064 ; Nullable String domainInMap ) {
* return ( ( String ) queriedDomain ) . equalsIgnoreCase ( domainInMap ) ) ;
* & # 064 ; Override
* protected long keyHashCode ( & # 064 ; Nullable Object domain ) {
* return LongHashFunction . xx _ r39 ( ) . hashChars ( ( ( String ) domain ) . toLowerCase ( ) ) ;
* } < / code > < / pre >
* < p > Default implementation is { @ code queriedKey . equals ( keyInMap ) } .
* @ param queriedKey the first key to compare , that is passed to queries like { @ link # get } ,
* but might also be a key , that is already stored in the map
* @ param keyInMap the second key to compare , guaranteed that this key is already stored
* in the map
* @ return { @ code true } if the given keys should be considered equal for this map , { @ code false }
* otherwise
* @ see # keyHashCode ( Object ) */
protected boolean keysEqual ( @ NotNull Object queriedKey , @ Nullable K keyInMap ) { } } | return queriedKey . equals ( keyInMap ) ; |
public class CorporationApi { /** * Get starbase ( POS ) detail Returns various settings and fuels of a
* starbase ( POS ) - - - This route is cached for up to 3600 seconds - - -
* Requires one of the following EVE corporation role ( s ) : Director SSO
* Scope : esi - corporations . read _ starbases . v1
* @ param corporationId
* An EVE corporation ID ( required )
* @ param starbaseId
* An EVE starbase ( POS ) ID ( required )
* @ param systemId
* The solar system this starbase ( POS ) is located in , ( required )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param ifNoneMatch
* ETag from a previous request . A 304 will be returned if this
* matches the current ETag ( optional )
* @ param token
* Access token to use if unable to set a header ( optional )
* @ return ApiResponse & lt ; CorporationStarbaseResponse & gt ;
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public ApiResponse < CorporationStarbaseResponse > getCorporationsCorporationIdStarbasesStarbaseIdWithHttpInfo ( Integer corporationId , Long starbaseId , Integer systemId , String datasource , String ifNoneMatch , String token ) throws ApiException { } } | com . squareup . okhttp . Call call = getCorporationsCorporationIdStarbasesStarbaseIdValidateBeforeCall ( corporationId , starbaseId , systemId , datasource , ifNoneMatch , token , null ) ; Type localVarReturnType = new TypeToken < CorporationStarbaseResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class VectorTileObject { /** * Similar method to the " setInnerHTML " , but specified for setting SVG . Using the regular setInnerHTML , it is not
* possible to set a string of SVG on an object . This method can do that . On the other hand , this method is better
* not used for setting normal HTML as an element ' s innerHTML .
* @ param element
* The element onto which to set the SVG string .
* @ param svg
* The string of SVG to set on the element . */
public static void setInnerSvg ( Element element , String svg ) { } } | if ( Dom . isFireFox ( ) ) { setFireFoxInnerHTML ( element , "<g xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">" + svg + "</g>" ) ; } else if ( Dom . isWebkit ( ) ) { setWebkitInnerHTML ( element , "<g xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">" + svg + "</g>" ) ; } |
public class CommerceWishListLocalServiceBaseImpl { /** * Returns all the commerce wish lists matching the UUID and company .
* @ param uuid the UUID of the commerce wish lists
* @ param companyId the primary key of the company
* @ return the matching commerce wish lists , or an empty list if no matches were found */
@ Override public List < CommerceWishList > getCommerceWishListsByUuidAndCompanyId ( String uuid , long companyId ) { } } | return commerceWishListPersistence . findByUuid_C ( uuid , companyId ) ; |
public class EventUtils { /** * Binds an event listener to a specific method on a specific object .
* @ param < L > the event listener type
* @ param target the target object
* @ param methodName the name of the method to be called
* @ param eventSource the object which is generating events ( JButton , JList , etc . )
* @ param listenerType the listener interface ( ActionListener . class , SelectionListener . class , etc . )
* @ param eventTypes the event types ( method names ) from the listener interface ( if none specified , all will be
* supported ) */
public static < L > void bindEventsToMethod ( final Object target , final String methodName , final Object eventSource , final Class < L > listenerType , final String ... eventTypes ) { } } | final L listener = listenerType . cast ( Proxy . newProxyInstance ( target . getClass ( ) . getClassLoader ( ) , new Class [ ] { listenerType } , new EventBindingInvocationHandler ( target , methodName , eventTypes ) ) ) ; addEventListener ( eventSource , listenerType , listener ) ; |
public class TypeParameter { /** * Parse a list of type parameters into { @ link TypeParameter } objects .
* @ param parser
* the parser
* @ param definingClassName
* the defining class name
* @ return the list of { @ link TypeParameter } objects .
* @ throws ParseException
* if parsing fails */
static List < TypeParameter > parseList ( final Parser parser , final String definingClassName ) throws ParseException { } } | if ( parser . peek ( ) != '<' ) { return Collections . emptyList ( ) ; } parser . expect ( '<' ) ; final List < TypeParameter > typeParams = new ArrayList < > ( 1 ) ; while ( parser . peek ( ) != '>' ) { if ( ! parser . hasMore ( ) ) { throw new ParseException ( parser , "Missing '>'" ) ; } if ( ! TypeUtils . getIdentifierToken ( parser ) ) { throw new ParseException ( parser , "Could not parse identifier token" ) ; } final String identifier = parser . currToken ( ) ; // classBound may be null
final ReferenceTypeSignature classBound = ReferenceTypeSignature . parseClassBound ( parser , definingClassName ) ; List < ReferenceTypeSignature > interfaceBounds ; if ( parser . peek ( ) == ':' ) { interfaceBounds = new ArrayList < > ( ) ; while ( parser . peek ( ) == ':' ) { parser . expect ( ':' ) ; final ReferenceTypeSignature interfaceTypeSignature = ReferenceTypeSignature . parseReferenceTypeSignature ( parser , definingClassName ) ; if ( interfaceTypeSignature == null ) { throw new ParseException ( parser , "Missing interface type signature" ) ; } interfaceBounds . add ( interfaceTypeSignature ) ; } } else { interfaceBounds = Collections . emptyList ( ) ; } typeParams . add ( new TypeParameter ( identifier , classBound , interfaceBounds ) ) ; } parser . expect ( '>' ) ; return typeParams ; |
public class FileChannelDataLogger { /** * the records a recovered from the format described in
* { @ link # write ( short , byte [ ] [ ] ) }
* @ param replay
* replayListener
* @ throws IOException */
public void replay ( IDataLoggerReplay replay ) throws IOException { } } | maybeRead ( ) ; this . randomAccess . rewind ( ) ; while ( this . randomAccess . available ( ) > ( Integer . SIZE / Byte . SIZE ) ) { int length = this . randomAccess . readInt ( ) ; short type = this . randomAccess . readShort ( ) ; XALogRecordType recordType = XALogRecordType . resolve ( type ) ; byte [ ] [ ] data = new byte [ length ] [ ] ; for ( int i = 0 ; i < length ; i ++ ) { int recordSize = this . randomAccess . readInt ( ) ; data [ i ] = this . randomAccess . read ( recordSize ) ; } replay . onRecord ( recordType , data ) ; } |
public class EvictDefinition { /** * { @ inheritDoc }
* This task will evict the given block . */
@ Override public SerializableVoid runTask ( EvictConfig config , SerializableVoid args , RunTaskContext context ) throws Exception { } } | AlluxioBlockStore blockStore = AlluxioBlockStore . create ( context . getFsContext ( ) ) ; long blockId = config . getBlockId ( ) ; String localHostName = NetworkAddressUtils . getConnectHost ( ServiceType . WORKER_RPC , ServerConfiguration . global ( ) ) ; List < BlockWorkerInfo > workerInfoList = blockStore . getAllWorkers ( ) ; WorkerNetAddress localNetAddress = null ; for ( BlockWorkerInfo workerInfo : workerInfoList ) { if ( workerInfo . getNetAddress ( ) . getHost ( ) . equals ( localHostName ) ) { localNetAddress = workerInfo . getNetAddress ( ) ; break ; } } if ( localNetAddress == null ) { String message = String . format ( "Cannot find a local block worker to evict block %d" , blockId ) ; throw new NotFoundException ( message ) ; } RemoveBlockRequest request = RemoveBlockRequest . newBuilder ( ) . setBlockId ( blockId ) . build ( ) ; BlockWorkerClient blockWorker = null ; try { blockWorker = context . getFsContext ( ) . acquireBlockWorkerClient ( localNetAddress ) ; blockWorker . removeBlock ( request ) ; } catch ( NotFoundException e ) { // Instead of throwing this exception , we continue here because the block to evict does not
// exist on this worker anyway .
LOG . warn ( "Failed to delete block {} on {}: block does not exist" , blockId , localNetAddress ) ; } finally { if ( blockWorker != null ) { context . getFsContext ( ) . releaseBlockWorkerClient ( localNetAddress , blockWorker ) ; } } return null ; |
public class YearQuarter { /** * Returns a copy of this year - quarter with the specified field set to a new value .
* This returns a { @ code YearQuarter } , based on this one , with the value
* for the specified field changed .
* This can be used to change any supported field , such as the year or quarter .
* If it is not possible to set the value , because the field is not supported or for
* some other reason , an exception is thrown .
* If the field is a { @ link ChronoField } then the adjustment is implemented here .
* The supported fields behave as follows :
* < ul >
* < li > { @ code QUARTER _ OF _ YEAR } -
* Returns a { @ code YearQuarter } with the specified quarter - of - year .
* The year will be unchanged .
* < li > { @ code YEAR _ OF _ ERA } -
* Returns a { @ code YearQuarter } with the specified year - of - era
* The quarter and era will be unchanged .
* < li > { @ code YEAR } -
* Returns a { @ code YearQuarter } with the specified year .
* The quarter will be unchanged .
* < li > { @ code ERA } -
* Returns a { @ code YearQuarter } with the specified era .
* The quarter and year - of - era will be unchanged .
* < / ul >
* In all cases , if the new value is outside the valid range of values for the field
* then a { @ code DateTimeException } will be thrown .
* All other { @ code ChronoField } instances will throw an { @ code UnsupportedTemporalTypeException } .
* If the field is not a { @ code ChronoField } , then the result of this method
* is obtained by invoking { @ code TemporalField . adjustInto ( Temporal , long ) }
* passing { @ code this } as the argument . In this case , the field determines
* whether and how to adjust the instant .
* This instance is immutable and unaffected by this method call .
* @ param field the field to set in the result , not null
* @ param newValue the new value of the field in the result
* @ return a { @ code YearQuarter } based on { @ code this } with the specified field set , not null
* @ throws DateTimeException if the field cannot be set
* @ throws UnsupportedTemporalTypeException if the field is not supported
* @ throws ArithmeticException if numeric overflow occurs */
@ Override public YearQuarter with ( TemporalField field , long newValue ) { } } | if ( field == QUARTER_OF_YEAR ) { return withQuarter ( QUARTER_OF_YEAR . range ( ) . checkValidIntValue ( newValue , QUARTER_OF_YEAR ) ) ; } else if ( field instanceof ChronoField ) { ChronoField f = ( ChronoField ) field ; f . checkValidValue ( newValue ) ; switch ( f ) { case YEAR_OF_ERA : return withYear ( ( int ) ( year < 1 ? 1 - newValue : newValue ) ) ; case YEAR : return withYear ( ( int ) newValue ) ; case ERA : return ( getLong ( ERA ) == newValue ? this : withYear ( 1 - year ) ) ; default : throw new UnsupportedTemporalTypeException ( "Unsupported field: " + field ) ; } } return field . adjustInto ( this , newValue ) ; |
public class BusItineraryHalt { /** * Replies the position of the bus halt on the road .
* The replied position may differ from the
* position of the associated bus stop because the
* position on the road is a projection of the stop ' s position
* on the road .
* @ return the 1.5D position or < code > null < / code > if
* the halt is not associated to a road segment . */
@ Pure public Point1d getPosition1D ( ) { } } | if ( this . bufferPosition1D == null ) { final RoadSegment segment = getRoadSegment ( ) ; if ( segment != null && ! Double . isNaN ( this . curvilineDistance ) ) { final RoadNetwork network = segment . getRoadNetwork ( ) ; assert network != null ; double lateral = segment . getRoadBorderDistance ( ) ; if ( lateral < 0. ) { lateral -= DISTANCE_BETWEEN_HALT_AND_ROAD_BORDER ; } else { lateral += DISTANCE_BETWEEN_HALT_AND_ROAD_BORDER ; } final boolean isSegmentDirection = getRoadSegmentDirection ( ) . isSegmentDirection ( ) ; if ( ! isSegmentDirection ) { lateral = - lateral ; } this . bufferPosition1D = new Point1d ( segment , this . curvilineDistance , lateral ) ; } } return this . bufferPosition1D ; |
public class XElement { /** * Save this XML into the supplied output stream .
* @ param stream the output stream
* @ param header write the header ?
* @ param flush flush after the save ?
* @ throws IOException on error */
public void save ( OutputStream stream , boolean header , boolean flush ) throws IOException { } } | OutputStreamWriter out = new OutputStreamWriter ( stream , "UTF-8" ) ; save ( out , header , flush ) ; |
public class TdeCertificatesInner { /** * Creates a TDE certificate for a given server .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ param parameters The requested TDE certificate to be created or updated .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < Void > createAsync ( String resourceGroupName , String serverName , TdeCertificateInner parameters ) { } } | return createWithServiceResponseAsync ( resourceGroupName , serverName , parameters ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class GenericTemplateElementBuilder { /** * Adds a login button on a generic template .
* @ param url
* the url
* @ return this builder . */
public GenericTemplateElementBuilder addLoginButton ( String url ) { } } | Button button = ButtonFactory . createLoginButton ( url ) ; this . element . addButton ( button ) ; return this ; |
public class ConfigMapper { /** * Applies the given configuration to the given type .
* @ param config the configuration to apply
* @ param clazz the class to which to apply the configuration */
@ SuppressWarnings ( "unchecked" ) protected < T > T map ( Config config , String path , String name , Class < T > clazz ) { } } | T instance = newInstance ( config , name , clazz ) ; // Map config property names to bean properties .
Map < String , String > propertyNames = new HashMap < > ( ) ; for ( Map . Entry < String , ConfigValue > configProp : config . root ( ) . entrySet ( ) ) { String originalName = configProp . getKey ( ) ; String camelName = toCamelCase ( originalName ) ; // if a setting is in there both as some hyphen name and the camel name ,
// the camel one wins
if ( ! propertyNames . containsKey ( camelName ) || originalName . equals ( camelName ) ) { propertyNames . put ( camelName , originalName ) ; } } // First use setters and then fall back to fields .
mapSetters ( instance , clazz , path , name , propertyNames , config ) ; mapFields ( instance , clazz , path , name , propertyNames , config ) ; // If any properties present in the configuration were not found on config beans , throw an exception .
if ( ! propertyNames . isEmpty ( ) ) { checkRemainingProperties ( propertyNames . keySet ( ) , describeProperties ( instance ) , toPath ( path , name ) , clazz ) ; } return instance ; |
public class StringUtils { /** * Check if a given key is valid to transmit .
* @ param key the key to check .
* @ param binary if binary protocol is used . */
public static void validateKey ( final String key , final boolean binary ) { } } | byte [ ] keyBytes = KeyUtil . getKeyBytes ( key ) ; int keyLength = keyBytes . length ; if ( keyLength > MAX_KEY_LENGTH ) { throw KEY_TOO_LONG_EXCEPTION ; } if ( keyLength == 0 ) { throw KEY_EMPTY_EXCEPTION ; } if ( ! binary ) { for ( byte b : keyBytes ) { if ( b == ' ' || b == '\n' || b == '\r' || b == 0 ) { throw new IllegalArgumentException ( "Key contains invalid characters: ``" + key + "''" ) ; } } } |
public class DatabasesInner { /** * Returns a list of databases inside a recommented elastic pool .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the List & lt ; DatabaseInner & gt ; object */
public Observable < List < DatabaseInner > > listByRecommendedElasticPoolAsync ( String resourceGroupName , String serverName , String recommendedElasticPoolName ) { } } | return listByRecommendedElasticPoolWithServiceResponseAsync ( resourceGroupName , serverName , recommendedElasticPoolName ) . map ( new Func1 < ServiceResponse < List < DatabaseInner > > , List < DatabaseInner > > ( ) { @ Override public List < DatabaseInner > call ( ServiceResponse < List < DatabaseInner > > response ) { return response . body ( ) ; } } ) ; |
public class RslNode { /** * Removes a relation for the specified attribute .
* @ param attribute the attribute name for the
* relation to remove .
* @ return the relation that was removed . */
public NameOpValue removeParam ( String attribute ) { } } | if ( _relations == null || attribute == null ) return null ; return ( NameOpValue ) _relations . remove ( canonicalize ( attribute ) ) ; |
public class FailoverWatcher { /** * Deal with delete node event , just call the leader election .
* @ param path which znode is deleted */
protected void processNodeDeleted ( String path ) { } } | if ( path . equals ( masterZnode ) ) { LOG . info ( masterZnode + " deleted and try to become active master" ) ; handleMasterNodeChange ( ) ; } |
public class RespokeClient { /** * Initiate a call to a conference .
* @ param callListener A listener to receive notifications about the new call
* @ param context An application context with which to access system resources
* @ param conferenceID The ID of the conference to call
* @ return A reference to the new RespokeCall object representing this call */
public RespokeCall joinConference ( RespokeCall . Listener callListener , Context context , String conferenceID ) { } } | RespokeCall call = null ; if ( ( null != signalingChannel ) && ( signalingChannel . connected ) ) { call = new RespokeCall ( signalingChannel , conferenceID , "conference" ) ; call . setListener ( callListener ) ; call . startCall ( context , null , true ) ; } return call ; |
public class GroovyClassLoader { /** * ( Re ) Compiles the given source .
* This method starts the compilation of a given source , if
* the source has changed since the class was created . For
* this isSourceNewer is called .
* @ param source the source pointer for the compilation
* @ param className the name of the class to be generated
* @ param oldClass a possible former class
* @ return the old class if the source wasn ' t new enough , the new class else
* @ throws CompilationFailedException if the compilation failed
* @ throws IOException if the source is not readable
* @ see # isSourceNewer ( URL , Class ) */
protected Class recompile ( URL source , String className , Class oldClass ) throws CompilationFailedException , IOException { } } | if ( source != null ) { // found a source , compile it if newer
if ( ( oldClass != null && isSourceNewer ( source , oldClass ) ) || ( oldClass == null ) ) { synchronized ( sourceCache ) { String name = source . toExternalForm ( ) ; sourceCache . remove ( name ) ; if ( isFile ( source ) ) { try { return parseClass ( new GroovyCodeSource ( new File ( source . toURI ( ) ) , config . getSourceEncoding ( ) ) ) ; } catch ( URISyntaxException e ) { // do nothing and fall back to the other version
} } return parseClass ( source . openStream ( ) , name ) ; } } } return oldClass ; |
public class LssClient { /** * Get your live security policy by live security policy name .
* @ param request The request object containing all parameters for getting live security policy .
* @ return Your live security policy . */
public GetSecurityPolicyResponse getSecurityPolicy ( GetSecurityPolicyRequest request ) { } } | checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getName ( ) , "The parameter name should NOT be null or empty string." ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . GET , request , LIVE_SECURITY_POLICY , request . getName ( ) ) ; return invokeHttpClient ( internalRequest , GetSecurityPolicyResponse . class ) ; |
public class ApptentiveInternal { /** * Create a new or return a existing thread - safe instance of the Apptentive SDK . If this
* or any other { @ link # getInstance ( ) } has already been called in the application ' s lifecycle , the
* App key will be ignored and the current instance will be returned .
* This will be called from the application ' s onCreate ( ) , before any other application objects have been
* created . Since the time spent in this function directly impacts the performance of starting the first activity ,
* service , or receiver in the hosting app ' s process , the initialization of Apptentive is deferred to the first time
* { @ link # getInstance ( ) } is called .
* @ param application the context of the app that is creating the instance */
static void createInstance ( @ NonNull Application application , @ NonNull ApptentiveConfiguration configuration ) { } } | final String apptentiveKey = configuration . getApptentiveKey ( ) ; final String apptentiveSignature = configuration . getApptentiveSignature ( ) ; final String baseURL = configuration . getBaseURL ( ) ; final boolean shouldEncryptStorage = configuration . shouldEncryptStorage ( ) ; // set log message sanitizing
ApptentiveLog . setShouldSanitizeLogMessages ( configuration . shouldSanitizeLogMessages ( ) ) ; // set log level before we initialize log monitor since log monitor can override it as well
ApptentiveLog . overrideLogLevel ( configuration . getLogLevel ( ) ) ; // troubleshooting mode
if ( configuration . isTroubleshootingModeEnabled ( ) ) { // initialize log writer
ApptentiveLog . initializeLogWriter ( application . getApplicationContext ( ) , LOG_HISTORY_SIZE ) ; // try initializing log monitor
LogMonitor . startSession ( application . getApplicationContext ( ) , apptentiveKey , apptentiveSignature ) ; } else { ApptentiveLog . i ( TROUBLESHOOT , "Troubleshooting is disabled in the app configuration" ) ; } synchronized ( ApptentiveInternal . class ) { if ( sApptentiveInternal == null ) { try { ApptentiveLog . i ( "Registering Apptentive Android SDK %s" , Constants . getApptentiveSdkVersion ( ) ) ; ApptentiveLog . v ( "ApptentiveKey=%s ApptentiveSignature=%s" , apptentiveKey , apptentiveSignature ) ; sApptentiveInternal = new ApptentiveInternal ( application , apptentiveKey , apptentiveSignature , baseURL , shouldEncryptStorage ) ; dispatchOnConversationQueue ( new DispatchTask ( ) { @ Override protected void execute ( ) { sApptentiveInternal . start ( ) ; } } ) ; ApptentiveActivityLifecycleCallbacks . register ( application ) ; } catch ( Exception e ) { ApptentiveLog . e ( e , "Exception while initializing ApptentiveInternal instance" ) ; logException ( e ) ; } } else { ApptentiveLog . w ( "Apptentive instance is already initialized" ) ; } } |
public class NamingCodecFactory { /** * Creates a codec only for lookup .
* @ param factory an identifier factory
* @ return a codec */
static Codec < NamingMessage > createLookupCodec ( final IdentifierFactory factory ) { } } | final Map < Class < ? extends NamingMessage > , Codec < ? extends NamingMessage > > clazzToCodecMap = new HashMap < > ( ) ; clazzToCodecMap . put ( NamingLookupRequest . class , new NamingLookupRequestCodec ( factory ) ) ; clazzToCodecMap . put ( NamingLookupResponse . class , new NamingLookupResponseCodec ( factory ) ) ; final Codec < NamingMessage > codec = new MultiCodec < > ( clazzToCodecMap ) ; return codec ; |
public class af_config_info { /** * < pre >
* Converts API response of bulk operation into object and returns the object array in case of get request .
* < / pre > */
protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } } | af_config_info_responses result = ( af_config_info_responses ) service . get_payload_formatter ( ) . string_to_resource ( af_config_info_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro_exception ( result . message , result . errorcode , ( base_response [ ] ) result . af_config_info_response_array ) ; } af_config_info [ ] result_af_config_info = new af_config_info [ result . af_config_info_response_array . length ] ; for ( int i = 0 ; i < result . af_config_info_response_array . length ; i ++ ) { result_af_config_info [ i ] = result . af_config_info_response_array [ i ] . af_config_info [ 0 ] ; } return result_af_config_info ; |
public class CmsBroadcastTimer { /** * Starts the timer . < p > */
public static void start ( ) { } } | if ( ! CmsCoreProvider . get ( ) . isKeepAlive ( ) ) { return ; } if ( INSTANCE == null ) { m_keepRunning = true ; CmsBroadcastTimer timer = new CmsBroadcastTimer ( ) ; timer . getBroadcast ( ) ; timer . run ( ) ; INSTANCE = timer ; } |
public class OtpConnection { /** * Send an RPC request to the remote Erlang node . This convenience function
* creates the following message and sends it to ' rex ' on the remote node :
* < pre >
* { self , { call , Mod , Fun , Args , user } }
* < / pre >
* Note that this method has unpredicatble results if the remote node is not
* an Erlang node .
* @ param mod
* the name of the Erlang module containing the function to be
* called .
* @ param fun
* the name of the function to call .
* @ param args
* a list of Erlang terms , to be used as arguments to the
* function .
* @ exception java . io . IOException
* if the connection is not active or a communication error
* occurs . */
public void sendRPC ( final String mod , final String fun , final OtpErlangList args ) throws IOException { } } | final OtpErlangObject [ ] rpc = new OtpErlangObject [ 2 ] ; final OtpErlangObject [ ] call = new OtpErlangObject [ 5 ] ; /* { self , { call , Mod , Fun , Args , user } } */
call [ 0 ] = new OtpErlangAtom ( "call" ) ; call [ 1 ] = new OtpErlangAtom ( mod ) ; call [ 2 ] = new OtpErlangAtom ( fun ) ; call [ 3 ] = args ; call [ 4 ] = new OtpErlangAtom ( "user" ) ; rpc [ 0 ] = self . pid ( ) ; rpc [ 1 ] = new OtpErlangTuple ( call ) ; send ( "rex" , new OtpErlangTuple ( rpc ) ) ; |
public class CPDefinitionVirtualSettingModelImpl { /** * Converts the soap model instance into a normal model instance .
* @ param soapModel the soap model instance to convert
* @ return the normal model instance */
public static CPDefinitionVirtualSetting toModel ( CPDefinitionVirtualSettingSoap soapModel ) { } } | if ( soapModel == null ) { return null ; } CPDefinitionVirtualSetting model = new CPDefinitionVirtualSettingImpl ( ) ; model . setUuid ( soapModel . getUuid ( ) ) ; model . setCPDefinitionVirtualSettingId ( soapModel . getCPDefinitionVirtualSettingId ( ) ) ; model . setGroupId ( soapModel . getGroupId ( ) ) ; model . setCompanyId ( soapModel . getCompanyId ( ) ) ; model . setUserId ( soapModel . getUserId ( ) ) ; model . setUserName ( soapModel . getUserName ( ) ) ; model . setCreateDate ( soapModel . getCreateDate ( ) ) ; model . setModifiedDate ( soapModel . getModifiedDate ( ) ) ; model . setClassNameId ( soapModel . getClassNameId ( ) ) ; model . setClassPK ( soapModel . getClassPK ( ) ) ; model . setFileEntryId ( soapModel . getFileEntryId ( ) ) ; model . setUrl ( soapModel . getUrl ( ) ) ; model . setActivationStatus ( soapModel . getActivationStatus ( ) ) ; model . setDuration ( soapModel . getDuration ( ) ) ; model . setMaxUsages ( soapModel . getMaxUsages ( ) ) ; model . setUseSample ( soapModel . isUseSample ( ) ) ; model . setSampleFileEntryId ( soapModel . getSampleFileEntryId ( ) ) ; model . setSampleUrl ( soapModel . getSampleUrl ( ) ) ; model . setTermsOfUseRequired ( soapModel . isTermsOfUseRequired ( ) ) ; model . setTermsOfUseContent ( soapModel . getTermsOfUseContent ( ) ) ; model . setTermsOfUseJournalArticleResourcePrimKey ( soapModel . getTermsOfUseJournalArticleResourcePrimKey ( ) ) ; model . setOverride ( soapModel . isOverride ( ) ) ; model . setLastPublishDate ( soapModel . getLastPublishDate ( ) ) ; return model ; |
public class AbstractSlideModel { /** * Build a scaling animation .
* @ param from scale ratio used as from value
* @ param to scale ratio used as to value
* @ param show if true a fade in transition will be performed , otherwise fade out
* @ return a scale animation */
private Animation buildScaleAnimation ( final double from , final double to , final boolean show ) { } } | return ParallelTransitionBuilder . create ( ) . children ( ScaleTransitionBuilder . create ( ) . node ( node ( ) ) . fromX ( from ) . toX ( to ) . fromY ( from ) . toY ( to ) . duration ( Duration . seconds ( 1 ) ) . build ( ) , FadeTransitionBuilder . create ( ) . node ( node ( ) ) . fromValue ( show ? 0.0 : 1.0 ) . toValue ( show ? 1.0 : 0.0 ) . duration ( Duration . seconds ( 1 ) ) . build ( ) ) . build ( ) ; |
public class SingletonBeanO { /** * ( non - Javadoc )
* @ see com . ibm . ejs . container . BeanO # discard ( ) */
@ Override public void discard ( ) { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "discard: " + getStateName ( state ) ) ; // d639281 - Singleton instances are never actually discarded unless a
// failure occurs during initialize ( ) .
if ( state == PRE_CREATE || state == CREATING ) { setState ( DESTROYED ) ; // Release any JCDI creational contexts that may exist . F743-29174
this . releaseManagedObjectContext ( ) ; if ( pmiBean != null ) { pmiBean . discardCount ( ) ; // F743-27070
pmiBean . beanDestroyed ( ) ; } } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "discard" ) ; |
public class Statement { /** * VoltDB added method to get a non - catalog - dependent
* representation of this HSQLDB object .
* @ param session The current Session object may be needed to resolve
* some names .
* @ return XML , correctly indented , representing this object .
* @ throws HSQLParseException */
VoltXMLElement voltGetStatementXML ( Session session ) throws org . hsqldb_voltpatches . HSQLInterface . HSQLParseException { } } | throw new org . hsqldb_voltpatches . HSQLInterface . HSQLParseException ( "this type of sql statement is not supported or is not allowed in this context" ) ; |
public class Surrogate { /** * Return a new token , unique for the current Surrogate - Capability header .
* Uses " esigate " and appends a number if necessary .
* @ param currentCapabilitiesHeader
* existing header which may contains tokens of other proxies ( including other esigate instances ) .
* @ return unique token */
private static String getUniqueToken ( String currentCapabilitiesHeader ) { } } | String token = "esigate" ; if ( currentCapabilitiesHeader != null && currentCapabilitiesHeader . contains ( token + "=\"" ) ) { int id = 2 ; while ( currentCapabilitiesHeader . contains ( token + id + "=\"" ) ) { id ++ ; } token = token + id ; } return token ; |
public class BaseSerializer { /** * Serialize a list of SequenceComparators */
public String serializeSequenceComparatorList ( List < SequenceComparator > list ) { } } | ObjectMapper om = getObjectMapper ( ) ; try { return om . writeValueAsString ( new ListWrappers . SequenceComparatorList ( list ) ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } |
public class HttpUtils { /** * Method which creates string with parameters and its value in format URL
* @ param q map in which keys if name of parameters , value - value of parameters .
* @ param enc encoding of this string
* @ return string with parameters and its value in format URL */
public static String renderQueryString ( Map < String , String > q , String enc ) { } } | StringBuilder sb = new StringBuilder ( ) ; for ( Map . Entry < String , String > e : q . entrySet ( ) ) { String name = urlEncode ( e . getKey ( ) , enc ) ; sb . append ( name ) ; if ( e . getValue ( ) != null ) { sb . append ( '=' ) ; sb . append ( urlEncode ( e . getValue ( ) , enc ) ) ; } sb . append ( '&' ) ; } if ( sb . length ( ) > 0 ) sb . setLength ( sb . length ( ) - 1 ) ; return sb . toString ( ) ; |
public class AssignedAddOn { /** * Create a AssignedAddOnFetcher to execute fetch .
* @ param pathAccountSid The SID of the Account that created the resource to
* fetch
* @ param pathResourceSid The SID of the Phone Number that installed this Add - on
* @ param pathSid The unique string that identifies the resource
* @ return AssignedAddOnFetcher capable of executing the fetch */
public static AssignedAddOnFetcher fetcher ( final String pathAccountSid , final String pathResourceSid , final String pathSid ) { } } | return new AssignedAddOnFetcher ( pathAccountSid , pathResourceSid , pathSid ) ; |
public class techsupport { /** * < pre >
* Converts API response of bulk operation into object and returns the object array in case of get request .
* < / pre > */
protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } } | techsupport_responses result = ( techsupport_responses ) service . get_payload_formatter ( ) . string_to_resource ( techsupport_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro_exception ( result . message , result . errorcode , ( base_response [ ] ) result . techsupport_response_array ) ; } techsupport [ ] result_techsupport = new techsupport [ result . techsupport_response_array . length ] ; for ( int i = 0 ; i < result . techsupport_response_array . length ; i ++ ) { result_techsupport [ i ] = result . techsupport_response_array [ i ] . techsupport [ 0 ] ; } return result_techsupport ; |
public class CmsRepositoryFilter { /** * Initializes a configuration after all parameters have been added . < p >
* @ throws CmsConfigurationException if something goes wrong */
public void initConfiguration ( ) throws CmsConfigurationException { } } | if ( ( ! TYPE_INCLUDE . equals ( m_type ) ) && ( ! TYPE_EXCLUDE . equals ( m_type ) ) ) { throw new CmsConfigurationException ( Messages . get ( ) . container ( Messages . ERR_INVALID_FILTER_TYPE_1 , m_type ) ) ; } if ( CmsLog . INIT . isInfoEnabled ( ) ) { Iterator < Pattern > iter = m_filterRules . iterator ( ) ; while ( iter . hasNext ( ) ) { Pattern rule = iter . next ( ) ; CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_ADD_FILTER_RULE_2 , m_type , rule . pattern ( ) ) ) ; } } m_filterRules = Collections . unmodifiableList ( m_filterRules ) ; |
public class LRResult { /** * Returns documents from obtain request
* @ return documents from obtain request */
public List < JSONObject > getDocuments ( ) { } } | List < JSONObject > documents = new ArrayList < JSONObject > ( ) ; try { if ( data != null && data . has ( documentsParam ) ) { JSONArray jsonDocuments = data . getJSONArray ( documentsParam ) ; for ( int i = 0 ; i < jsonDocuments . length ( ) ; i ++ ) { JSONObject document = jsonDocuments . getJSONObject ( i ) ; documents . add ( document ) ; } } } catch ( JSONException e ) { // This is already handled by the enclosing " has " checks
} return documents ; |
public class Csv { /** * Sets the null literal string that is interpreted as a null value ( disabled by default ) .
* @ param nullLiteral null literal ( e . g . " null " or " n / a " ) */
public Csv nullLiteral ( String nullLiteral ) { } } | Preconditions . checkNotNull ( nullLiteral ) ; internalProperties . putString ( FORMAT_NULL_LITERAL , nullLiteral ) ; return this ; |
public class FedoraTimeMapImpl { /** * Check if the JCR node has a fedora : TimeMap mixin
* @ param node the JCR node
* @ return true if the JCR node has the fedora : TimeMap mixin */
public static boolean hasMixin ( final Node node ) { } } | try { return node . isNodeType ( FEDORA_TIME_MAP ) ; } catch ( final RepositoryException e ) { throw new RepositoryRuntimeException ( e ) ; } |
public class ImagePolylineAnnotation { /** * < code > . google . cloud . datalabeling . v1beta1 . NormalizedPolyline normalized _ polyline = 3 ; < / code > */
public com . google . cloud . datalabeling . v1beta1 . NormalizedPolyline getNormalizedPolyline ( ) { } } | if ( polyCase_ == 3 ) { return ( com . google . cloud . datalabeling . v1beta1 . NormalizedPolyline ) poly_ ; } return com . google . cloud . datalabeling . v1beta1 . NormalizedPolyline . getDefaultInstance ( ) ; |
public class vpntrafficaction { /** * Use this API to add vpntrafficaction resources . */
public static base_responses add ( nitro_service client , vpntrafficaction resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { vpntrafficaction addresources [ ] = new vpntrafficaction [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { addresources [ i ] = new vpntrafficaction ( ) ; addresources [ i ] . name = resources [ i ] . name ; addresources [ i ] . qual = resources [ i ] . qual ; addresources [ i ] . apptimeout = resources [ i ] . apptimeout ; addresources [ i ] . sso = resources [ i ] . sso ; addresources [ i ] . formssoaction = resources [ i ] . formssoaction ; addresources [ i ] . fta = resources [ i ] . fta ; addresources [ i ] . wanscaler = resources [ i ] . wanscaler ; addresources [ i ] . kcdaccount = resources [ i ] . kcdaccount ; addresources [ i ] . samlssoprofile = resources [ i ] . samlssoprofile ; } result = add_bulk_request ( client , addresources ) ; } return result ; |
public class ApptentiveActivityLifecycleCallbacks { /** * Decrements the count of running Activities . If it is now 0 , start a task that will check again
* after a small delay . If that task still finds 0 running Activities , it will trigger an < code > appEnteredBackground ( ) < / code >
* @ param activity */
@ Override public void onActivityStopped ( final Activity activity ) { } } | if ( foregroundActivities . decrementAndGet ( ) < 0 ) { ApptentiveLog . e ( "Incorrect number of foreground Activities encountered. Resetting to 0." ) ; foregroundActivities . set ( 0 ) ; } if ( checkFgBgRoutine != null ) { delayedChecker . removeCallbacks ( checkFgBgRoutine ) ; } /* When one activity transits to another one , there is a brief period during which the former
* is paused but the latter has not yet resumed . To prevent false negative , check routine is
* delayed */
delayedChecker . postDelayed ( checkFgBgRoutine = new Runnable ( ) { @ Override public void run ( ) { try { if ( foregroundActivities . get ( ) == 0 && isAppForeground ) { appEnteredBackground ( ) ; isAppForeground = false ; } } catch ( Exception e ) { ApptentiveLog . e ( e , "Exception in delayed checking" ) ; ErrorMetrics . logException ( e ) ; } } } , CHECK_DELAY_SHORT ) ; dispatchOnConversationQueue ( new DispatchTask ( ) { @ Override protected void execute ( ) { ApptentiveNotificationCenter . defaultCenter ( ) . postNotification ( NOTIFICATION_ACTIVITY_STOPPED , NOTIFICATION_KEY_ACTIVITY , activity ) ; } } ) ; |
public class PropertiesBasedStyleLibrary { /** * Get a value from the cache ( to avoid repeated parsing )
* @ param < T > Type
* @ param prefix Tree name
* @ param postfix Property name
* @ param cls Class restriction
* @ return Resulting value */
private < T > T getCached ( String prefix , String postfix , Class < T > cls ) { } } | return cls . cast ( cache . get ( prefix + '.' + postfix ) ) ; |
public class SystemConfiguration { /** * { @ inheritDoc } */
@ Override protected Map < String , String > defaults ( ) { } } | Map < String , String > ret = new HashMap < String , String > ( ) ; String value = getProperty ( "java.io.tmpdir" ) ; value = asPath ( value , DEFAULT_OUTPUT_DIRECTORY ) ; ret . put ( FRAMEWORK_WORKING_AREA_DESC , value ) ; value = getProperty ( "user.home" ) ; value = asPath ( value , DEFAULT_CACHE_DIRECTORY ) ; ret . put ( FRAMEWORK_CACHE_DIRECTORY_DESC , value ) ; value = getProperty ( "java.io.tmpdir" ) ; value = asPath ( value , DEFAULT_OUTPUT_DIRECTORY ) ; ret . put ( APPLICATION_LOG_PATH_DESC , value ) ; return ret ; |
public class DirectMappingAxiomProducer { /** * Definition row graph : an RDF graph consisting of the following triples :
* - the row type triple .
* - a literal triple for each column in a table where the column value is non - NULL . */
public ImmutableList < TargetAtom > getCQ ( DatabaseRelationDefinition table ) { } } | ImmutableList . Builder < TargetAtom > atoms = ImmutableList . builder ( ) ; // Class Atom
ImmutableTerm sub = generateSubject ( table , false ) ; atoms . add ( getAtom ( getTableIRI ( table . getID ( ) ) , sub ) ) ; // DataType Atoms
for ( Attribute att : table . getAttributes ( ) ) { // TODO : revisit this
RDFDatatype type = ( RDFDatatype ) att . getTermType ( ) ; Variable objV = termFactory . getVariable ( att . getID ( ) . getName ( ) ) ; ImmutableTerm obj = termFactory . getImmutableTypedTerm ( objV , type ) ; atoms . add ( getAtom ( getLiteralPropertyIRI ( att ) , sub , obj ) ) ; } return atoms . build ( ) ; |
public class CmsAutoSetupProperties { /** * Adds and returns the property for the given key . < p >
* @ param key the key to add the property
* @ return the value of that property */
private String addProperty ( String key ) { } } | if ( System . getProperty ( key ) != null ) { m_configuration . put ( key , System . getProperty ( key ) ) ; } return m_configuration . get ( key ) ; |
public class BsFileConfigCB { public FileConfigCB acceptPK ( String id ) { } } | assertObjectNotNull ( "id" , id ) ; BsFileConfigCB cb = this ; cb . query ( ) . docMeta ( ) . setId_Equal ( id ) ; return ( FileConfigCB ) this ; |
public class BaseDestinationHandler { /** * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . impl . interfaces . DestinationHandler # getPubSubOutputHandler ( com . ibm . ws . sib . utils . SIBUuid8) */
@ Override public PubSubOutputHandler getPubSubOutputHandler ( SIBUuid8 neighbourUUID ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getPubSubOutputHandler" , neighbourUUID ) ; PubSubOutputHandler handler = _pubSubRealization . getPubSubOutputHandler ( neighbourUUID ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getPubSubOutputHandler" , handler ) ; return handler ; |
public class BiConsumerCallbackManager { /** * Process a list with event
* @ param symbol
* @ param ticksArray */
public void handleEventsCollection ( final S symbol , final Collection < T > elements ) { } } | final List < BiConsumer < S , T > > callbackList = callbacks . get ( symbol ) ; if ( callbackList == null ) { return ; } if ( callbackList . isEmpty ( ) ) { return ; } // Notify callbacks synchronously , to preserve the order of events
for ( final T element : elements ) { callbackList . forEach ( ( c ) -> { c . accept ( symbol , element ) ; } ) ; |
public class RampImport { /** * Marshal from an array of source types to an array of dest types . */
public ModuleMarshal [ ] marshalArgs ( ParameterAmp [ ] sourceTypes ) { } } | if ( sourceTypes == null ) { return new ModuleMarshal [ 0 ] ; } ModuleMarshal [ ] marshal = new ModuleMarshal [ sourceTypes . length ] ; for ( int i = 0 ; i < marshal . length ; i ++ ) { marshal [ i ] = marshal ( sourceTypes [ i ] . rawClass ( ) ) ; } return marshal ; |
public class UrlUtils { /** * For the given { @ code url } , extract a mapping of query string parameter names to values .
* Adapted from an implementation by BalusC and dfrankow , available at
* http : / / stackoverflow . com / questions / 1667278 / parsing - query - strings - in - java .
* @ param url
* The URL from which parameters are extracted .
* @ return A mapping of query string parameter names to values . If { @ code url } is { @ code null } , an empty { @ code Map }
* is returned .
* @ throws IllegalStateException
* If unable to URL - decode because the JVM doesn ' t support { @ link StandardCharsets # UTF _ 8 } . */
public static Map < String , List < String > > extractParametersFromUrl ( String url ) { } } | if ( url == null ) { return emptyMap ( ) ; } Map < String , List < String > > parameters = new HashMap < > ( ) ; String [ ] urlParts = url . split ( "\\?" ) ; if ( urlParts . length > 1 ) { String query = urlParts [ 1 ] ; for ( String param : query . split ( "&" ) ) { String [ ] pair = param . split ( "=" ) ; String key = urlDecode ( pair [ 0 ] ) ; String value = "" ; if ( pair . length > 1 ) { value = urlDecode ( pair [ 1 ] ) ; } List < String > values = parameters . get ( key ) ; if ( values == null ) { values = new ArrayList < > ( ) ; parameters . put ( key , values ) ; } values . add ( value ) ; } } return parameters ; |
public class OperatingSystemConfigurationManagerMarshaller { /** * Marshall the given parameter object . */
public void marshall ( OperatingSystemConfigurationManager operatingSystemConfigurationManager , ProtocolMarshaller protocolMarshaller ) { } } | if ( operatingSystemConfigurationManager == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( operatingSystemConfigurationManager . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( operatingSystemConfigurationManager . getVersion ( ) , VERSION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ICUNotifier { /** * Stop notifying this listener . The listener must
* not be null . Attemps to remove a listener that is
* not registered will be silently ignored . */
public void removeListener ( EventListener l ) { } } | if ( l == null ) { throw new NullPointerException ( ) ; } synchronized ( notifyLock ) { if ( listeners != null ) { // identity equality check
Iterator < EventListener > iter = listeners . iterator ( ) ; while ( iter . hasNext ( ) ) { if ( iter . next ( ) == l ) { iter . remove ( ) ; if ( listeners . size ( ) == 0 ) { listeners = null ; } return ; } } } } |
public class JCRStatisticsManager { /** * Allows to reset all the statistics corresponding to the given category .
* @ param category */
@ Managed @ ManagedDescription ( "Reset all the statistics." ) public static void resetAll ( @ ManagedDescription ( "The name of the category of the statistics" ) @ ManagedName ( "categoryName" ) String category ) { } } | StatisticsContext context = getContext ( category ) ; if ( context != null ) { context . reset ( ) ; } |
public class SimulateCustomPolicyRequest { /** * A list of names of API operations to evaluate in the simulation . Each operation is evaluated against each
* resource . Each operation must include the service identifier , such as < code > iam : CreateUser < / code > . This operation
* does not support using wildcards ( * ) in an action name .
* @ param actionNames
* A list of names of API operations to evaluate in the simulation . Each operation is evaluated against each
* resource . Each operation must include the service identifier , such as < code > iam : CreateUser < / code > . This
* operation does not support using wildcards ( * ) in an action name . */
public void setActionNames ( java . util . Collection < String > actionNames ) { } } | if ( actionNames == null ) { this . actionNames = null ; return ; } this . actionNames = new com . amazonaws . internal . SdkInternalList < String > ( actionNames ) ; |
public class SeaGlassTableUI { /** * DOCUMENT ME !
* @ param rect DOCUMENT ME !
* @ param horizontal DOCUMENT ME !
* @ return DOCUMENT ME ! */
private Rectangle extendRect ( Rectangle rect , boolean horizontal ) { } } | if ( rect == null ) { return rect ; } if ( horizontal ) { rect . x = 0 ; rect . width = table . getWidth ( ) ; } else { rect . y = 0 ; if ( table . getRowCount ( ) != 0 ) { Rectangle lastRect = table . getCellRect ( table . getRowCount ( ) - 1 , 0 , true ) ; rect . height = lastRect . y + lastRect . height ; } else { rect . height = table . getHeight ( ) ; } } return rect ; |
public class AdminCommandStream { /** * Parses command - line input and prints help menu .
* @ throws Exception */
public static void executeHelp ( String [ ] args , PrintStream stream ) throws Exception { } } | String subCmd = ( args . length > 0 ) ? args [ 0 ] : "" ; if ( subCmd . equals ( "fetch-entries" ) ) { SubCommandStreamFetchEntries . printHelp ( stream ) ; } else if ( subCmd . equals ( "fetch-keys" ) ) { SubCommandStreamFetchKeys . printHelp ( stream ) ; } else if ( subCmd . equals ( "mirror" ) ) { SubCommandStreamMirror . printHelp ( stream ) ; } else if ( subCmd . equals ( "update-entries" ) ) { SubCommandStreamUpdateEntries . printHelp ( stream ) ; } else { printHelp ( stream ) ; } |
public class Vector3i { /** * / * ( non - Javadoc )
* @ see org . joml . Vector3ic # distance ( org . joml . Vector3ic ) */
public double distance ( Vector3ic v ) { } } | return distance ( v . x ( ) , v . y ( ) , v . z ( ) ) ; |
public class NFLockFreeLogger { /** * ( non - Javadoc )
* @ see org . apache . log4j . Category # removeAllAppenders ( ) */
@ Override public void removeAllAppenders ( ) { } } | if ( aai != null ) { Vector appenders = new Vector ( ) ; Enumeration iter = aai . getAllAppenders ( ) ; if ( iter == null ) { return ; } while ( iter . hasMoreElements ( ) ) { appenders . add ( iter . nextElement ( ) ) ; } aai . removeAllAppenders ( ) ; iter = appenders . elements ( ) ; while ( iter . hasMoreElements ( ) ) { fireRemoveAppenderEvent ( ( Appender ) iter . nextElement ( ) ) ; } } |
public class Sql { /** * A variant of { @ link # query ( String , java . util . List , groovy . lang . Closure ) }
* useful when providing the named parameters as a map .
* @ param sql the sql statement
* @ param map a map containing the named parameters
* @ param closure called for each row with a < code > ResultSet < / code >
* @ throws SQLException if a database access error occurs
* @ since 1.8.7 */
public void query ( String sql , Map map , @ ClosureParams ( value = SimpleType . class , options = "java.sql.ResultSet" ) Closure closure ) throws SQLException { } } | query ( sql , singletonList ( map ) , closure ) ; |
public class SQLExpressions { /** * NTH _ VALUE returns the expr value of the nth row in the window defined by the analytic clause .
* The returned value has the data type of the expr .
* @ param expr measure expression
* @ param n one based row index
* @ return nth _ value ( expr , n ) */
public static < T > WindowOver < T > nthValue ( Expression < T > expr , Number n ) { } } | return nthValue ( expr , ConstantImpl . create ( n ) ) ; |
public class PathMatchingResourcePatternResolver { /** * Determine the root directory for the given location .
* < p > Used for determining the starting point for file matching ,
* resolving the root directory location to a < code > java . io . File < / code >
* and passing it into < code > retrieveMatchingFiles < / code > , with the
* remainder of the location as pattern .
* < p > Will return " / WEB - INF / " for the pattern " / WEB - INF / * . xml " ,
* for example .
* @ param location the location to check
* @ return the part of the location that denotes the root directory
* @ see # retrieveMatchingFiles */
protected String determineRootDir ( String location ) { } } | int prefixEnd = location . indexOf ( ":" ) + 1 ; int rootDirEnd = location . length ( ) ; while ( rootDirEnd > prefixEnd && getPathMatcher ( ) . isPattern ( location . substring ( prefixEnd , rootDirEnd ) ) ) { rootDirEnd = location . lastIndexOf ( '/' , rootDirEnd - 2 ) + 1 ; } if ( rootDirEnd == 0 ) { rootDirEnd = prefixEnd ; } return location . substring ( 0 , rootDirEnd ) ; |
public class QueryCriteriaUtil { /** * Helper method for creating a ranged ( between , open - ended ) { @ link Predicate }
* @ param builder The { @ link CriteriaBuilder } , helpful when creating { @ link Predicate } s to add to the { @ link CriteriaQuery }
* @ param entityField The { @ link Expression } representing a field / column in an entity / table .
* @ param start The start value of the range , or null if open - ended ( on the lower end )
* @ param end The end value of the range , or null if open - ended ( on the upper end )
* @ param rangeType The { @ link Class } or the parameter values
* @ return The created { @ link Predicate } */
@ SuppressWarnings ( "unchecked" ) private static < Y extends Comparable < ? super Y > > Predicate createRangePredicate ( CriteriaBuilder builder , Expression field , Object start , Object end , Class < Y > rangeType ) { } } | if ( start != null && end != null ) { // TODO : asserts !
return builder . between ( field , ( Y ) start , ( Y ) end ) ; } else if ( start != null ) { return builder . greaterThanOrEqualTo ( field , ( Y ) start ) ; } else { return builder . lessThanOrEqualTo ( field , ( Y ) end ) ; } |
public class AmazonAutoScalingClient { /** * Creates or updates one or more scheduled scaling actions for an Auto Scaling group . If you leave a parameter
* unspecified when updating a scheduled scaling action , the corresponding value remains unchanged .
* @ param batchPutScheduledUpdateGroupActionRequest
* @ return Result of the BatchPutScheduledUpdateGroupAction operation returned by the service .
* @ throws AlreadyExistsException
* You already have an Auto Scaling group or launch configuration with this name .
* @ throws LimitExceededException
* You have already reached a limit for your Amazon EC2 Auto Scaling resources ( for example , Auto Scaling
* groups , launch configurations , or lifecycle hooks ) . For more information , see
* < a > DescribeAccountLimits < / a > .
* @ throws ResourceContentionException
* You already have a pending update to an Amazon EC2 Auto Scaling resource ( for example , an Auto Scaling
* group , instance , or load balancer ) .
* @ sample AmazonAutoScaling . BatchPutScheduledUpdateGroupAction
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / autoscaling - 2011-01-01 / BatchPutScheduledUpdateGroupAction "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public BatchPutScheduledUpdateGroupActionResult batchPutScheduledUpdateGroupAction ( BatchPutScheduledUpdateGroupActionRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeBatchPutScheduledUpdateGroupAction ( request ) ; |
public class WorkArounds { /** * TODO : jx . l . m ? */
public Location getLocationForModule ( ModuleElement mdle ) { } } | ModuleSymbol msym = ( ModuleSymbol ) mdle ; return msym . sourceLocation != null ? msym . sourceLocation : msym . classLocation ; |
public class DefaultGroovyMethods { /** * Iterates over the collection of items and returns each item that matches
* the given filter - calling the < code > { @ link # isCase ( java . lang . Object , java . lang . Object ) } < / code >
* method used by switch statements . This method can be used with different
* kinds of filters like regular expressions , classes , ranges etc .
* Example :
* < pre class = " groovyTestCase " >
* def list = [ ' a ' , ' b ' , ' aa ' , ' bc ' , 3 , 4.5]
* assert list . grep ( ~ / a + / ) = = [ ' a ' , ' aa ' ]
* assert list . grep ( ~ / . . / ) = = [ ' aa ' , ' bc ' ]
* assert list . grep ( Number ) = = [ 3 , 4.5 ]
* assert list . grep { it . toString ( ) . size ( ) = = 1 } = = [ ' a ' , ' b ' , 3 ]
* < / pre >
* @ param self a collection
* @ param filter the filter to perform on each element of the collection ( using the { @ link # isCase ( java . lang . Object , java . lang . Object ) } method )
* @ return a collection of objects which match the filter
* @ since 2.0 */
public static < T > Collection < T > grep ( Collection < T > self , Object filter ) { } } | Collection < T > answer = createSimilarCollection ( self ) ; BooleanReturningMethodInvoker bmi = new BooleanReturningMethodInvoker ( "isCase" ) ; for ( T element : self ) { if ( bmi . invoke ( filter , element ) ) { answer . add ( element ) ; } } return answer ; |
public class AWSDirectoryServiceClient { /** * Obtains information about the directories that belong to this account .
* You can retrieve information about specific directories by passing the directory identifiers in the
* < code > DirectoryIds < / code > parameter . Otherwise , all directories that belong to the current account are returned .
* This operation supports pagination with the use of the < code > NextToken < / code > request and response parameters . If
* more results are available , the < code > DescribeDirectoriesResult . NextToken < / code > member contains a token that you
* pass in the next call to < a > DescribeDirectories < / a > to retrieve the next set of items .
* You can also specify a maximum number of return results with the < code > Limit < / code > parameter .
* @ param describeDirectoriesRequest
* Contains the inputs for the < a > DescribeDirectories < / a > operation .
* @ return Result of the DescribeDirectories operation returned by the service .
* @ throws EntityDoesNotExistException
* The specified entity could not be found .
* @ throws InvalidParameterException
* One or more parameters are not valid .
* @ throws InvalidNextTokenException
* The < code > NextToken < / code > value is not valid .
* @ throws ClientException
* A client exception has occurred .
* @ throws ServiceException
* An exception has occurred in AWS Directory Service .
* @ sample AWSDirectoryService . DescribeDirectories
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ds - 2015-04-16 / DescribeDirectories " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DescribeDirectoriesResult describeDirectories ( DescribeDirectoriesRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeDirectories ( request ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.