signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class XmlReader { /** * httpContentType is NULL */ private static String getContentTypeEncoding ( final String httpContentType ) { } }
String encoding = null ; if ( httpContentType != null ) { final int i = httpContentType . indexOf ( ";" ) ; if ( i > - 1 ) { final String postMime = httpContentType . substring ( i + 1 ) ; final Matcher m = CHARSET_PATTERN . matcher ( postMime ) ; if ( m . find ( ) ) { encoding = m . group ( 1 ) ; } if ( encoding != null ) { encoding = encoding . toUpperCase ( Locale . ENGLISH ) ; } } if ( encoding != null && ( encoding . startsWith ( "\"" ) && encoding . endsWith ( "\"" ) || encoding . startsWith ( "'" ) && encoding . endsWith ( "'" ) ) ) { encoding = encoding . substring ( 1 , encoding . length ( ) - 1 ) ; } } return encoding ;
public class ColumnBlob { /** * Copies the inline blob from a source block to a destination block . * If the inline blob is too large for the target block , return - 1, * otherwise return the new blobTail . */ @ Override int insertBlob ( byte [ ] srcBuffer , int srcRowOffset , byte [ ] dstBuffer , int dstRowOffset , int dstBlobTail ) { } }
int srcColumnOffset = srcRowOffset + offset ( ) ; int dstColumnOffset = dstRowOffset + offset ( ) ; int blobLen = BitsUtil . readInt16 ( srcBuffer , srcColumnOffset + 2 ) ; if ( blobLen == 0 ) { return dstBlobTail ; } blobLen &= ~ LARGE_BLOB_MASK ; if ( dstRowOffset < dstBlobTail + blobLen ) { return - 1 ; } int blobOffset = BitsUtil . readInt16 ( srcBuffer , srcColumnOffset ) ; try { System . arraycopy ( srcBuffer , blobOffset , dstBuffer , dstBlobTail , blobLen ) ; } catch ( ArrayIndexOutOfBoundsException e ) { throw new ArrayIndexOutOfBoundsException ( "srcOff: " + blobOffset + " dstOff: " + dstBlobTail + " len: " + blobLen + " " + this ) ; } BitsUtil . writeInt16 ( dstBuffer , dstColumnOffset , dstBlobTail ) ; /* System . out . println ( " SET : " + Hex . toHex ( dstBuffer , dstRowOffset , 5) + " " + Hex . toHex ( dstBuffer , dstBlobTail , 4 ) ) ; */ return dstBlobTail + blobLen ;
public class RemoteQueueBrowserEnumeration { /** * / * ( non - Javadoc ) * @ see net . timewalker . ffmq4 . common . session . AbstractQueueBrowserEnumeration # onQueueBrowserEnumerationClose ( ) */ @ Override protected void onQueueBrowserEnumerationClose ( ) { } }
try { CloseBrowserEnumerationQuery query = new CloseBrowserEnumerationQuery ( ) ; query . setSessionId ( session . getId ( ) ) ; query . setBrowserId ( browser . getId ( ) ) ; query . setEnumId ( id ) ; transportEndpoint . blockingRequest ( query ) ; } catch ( JMSException e ) { ErrorTools . log ( e , log ) ; }
public class LogFactory { /** * 决定日志实现 * 依次按照顺序检查日志库的jar是否被引入 , 如果未引入任何日志库 , 则检查ClassPath下的logging . properties , 存在则使用JdkLogFactory , 否则使用ConsoleLogFactory * @ see Slf4jLogFactory * @ see Log4j2LogFactory * @ see Log4jLogFactory * @ see ApacheCommonsLogFactory * @ see TinyLogFactory * @ see JbossLogFactory * @ see ConsoleLogFactory * @ see JdkLogFactory * @ return 日志实现类 */ public static LogFactory create ( ) { } }
final LogFactory factory = doCreate ( ) ; factory . getLog ( LogFactory . class ) . debug ( "Use [{}] Logger As Default." , factory . name ) ; return factory ;
public class AptUtils { /** * Returns the values of an annotation ' s attributes , including defaults . * The method with the same name in JavacElements cannot be used directly , * because it includes a cast to Attribute . Compound , which doesn ' t hold * for annotations generated by the Checker Framework . * @ param annotMirror annotation to examine * @ return the values of the annotation ' s elements , including defaults * @ see AnnotationMirror # getElementValues ( ) * @ see JavacElements # getElementValuesWithDefaults ( AnnotationMirror ) */ public static Map < ExecutableElement , AnnotationValue > getElementValuesWithDefaults ( AnnotationMirror annotMirror ) { } }
Map < ExecutableElement , AnnotationValue > valMap = Optional . ofNullable ( ( Map < ExecutableElement , AnnotationValue > ) annotMirror . getElementValues ( ) ) . map ( x -> new HashMap < > ( x ) ) . orElse ( new HashMap < > ( ) ) ; ElementFilter . methodsIn ( annotMirror . getAnnotationType ( ) . asElement ( ) . getEnclosedElements ( ) ) . stream ( ) . map ( annot -> Tuple2 . of ( annot , annot . getDefaultValue ( ) ) ) . filter ( tuple2 -> tuple2 . _2 ( ) != null && ! valMap . containsKey ( tuple2 . _1 ( ) ) ) . forEach ( tuple2 -> valMap . put ( tuple2 . _1 ( ) , tuple2 . _2 ( ) ) ) ; return valMap ;
public class StaxUtils { /** * Return a new factory so that the caller can set sticky parameters . * @ param nsAware * @ throws XMLStreamException */ @ FFDCIgnore ( Throwable . class ) public static XMLInputFactory createXMLInputFactory ( boolean nsAware ) { } }
XMLInputFactory factory = null ; try { factory = XMLInputFactory . newInstance ( ) ; } catch ( Throwable t ) { if ( LOG . isLoggable ( Level . FINE ) ) { LOG . log ( Level . FINE , "XMLInputFactory.newInstance() failed with: " , t ) ; } factory = null ; } if ( factory == null || ! setRestrictionProperties ( factory ) ) { try { factory = createWoodstoxFactory ( ) ; } catch ( Throwable t ) { if ( LOG . isLoggable ( Level . FINE ) ) { LOG . log ( Level . FINE , "Cannot create Woodstox XMLInputFactory: " , t ) ; } } if ( factory == null ) { throw new RuntimeException ( "Failed to create XMLInputFactory." ) ; } if ( ! setRestrictionProperties ( factory ) ) { if ( allowInsecureParser ) { // Liberty change start // defect 165502 : comment out the warning // LOG . log ( Level . WARNING , " INSECURE _ PARSER _ DETECTED " , factory . getClass ( ) . getName ( ) ) ; // Liberty change end } else { throw new RuntimeException ( "Cannot create a secure XMLInputFactory" ) ; } } } setProperty ( factory , XMLInputFactory . IS_NAMESPACE_AWARE , nsAware ) ; setProperty ( factory , XMLInputFactory . SUPPORT_DTD , Boolean . FALSE ) ; setProperty ( factory , XMLInputFactory . IS_REPLACING_ENTITY_REFERENCES , Boolean . FALSE ) ; setProperty ( factory , XMLInputFactory . IS_SUPPORTING_EXTERNAL_ENTITIES , Boolean . FALSE ) ; factory . setXMLResolver ( new XMLResolver ( ) { @ Override public Object resolveEntity ( String publicID , String systemID , String baseURI , String namespace ) throws XMLStreamException { throw new XMLStreamException ( "Reading external entities is disabled" ) ; } } ) ; return factory ;
public class ChangelogUtil { /** * Add an index on the given collection and field * @ param collection the collection to use for the index * @ param field the field to use for the index * @ param asc the sorting direction . < code > true < / code > to sort ascending ; < code > false < / code > to sort descending * @ param background iff < code > true < / code > the index is created in the background */ public static void addIndex ( DBCollection collection , String field , boolean asc , boolean background ) { } }
int dir = ( asc ) ? 1 : - 1 ; collection . createIndex ( new BasicDBObject ( field , dir ) , new BasicDBObject ( "background" , background ) ) ;
public class GalleryImagesInner { /** * List gallery images in a given lab account . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; GalleryImageInner & gt ; object */ public Observable < Page < GalleryImageInner > > listNextAsync ( final String nextPageLink ) { } }
return listNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < GalleryImageInner > > , Page < GalleryImageInner > > ( ) { @ Override public Page < GalleryImageInner > call ( ServiceResponse < Page < GalleryImageInner > > response ) { return response . body ( ) ; } } ) ;
public class CQLTransaction { /** * Execute a batch statement that applies all updates in this transaction . */ private void applyUpdates ( DBTransaction transaction ) { } }
if ( transaction . getMutationsCount ( ) == 0 ) { m_logger . debug ( "Skipping commit with no updates" ) ; } else if ( m_dbservice . getParamBoolean ( "async_updates" ) ) { executeUpdatesAsynchronous ( transaction ) ; } else { executeUpdatesSynchronous ( transaction ) ; }
public class RealWebSocket { /** * For testing : force this web socket to release its threads . */ void tearDown ( ) throws InterruptedException { } }
if ( cancelFuture != null ) { cancelFuture . cancel ( false ) ; } executor . shutdown ( ) ; executor . awaitTermination ( 10 , TimeUnit . SECONDS ) ;
public class XmlUtils { /** * Format an XML { @ link Source } to a pretty - printable { @ link StreamResult } . * @ param input * The ( unformatted ) input XML { @ link Source } . * @ return The formatted { @ link StreamResult } . */ public static void format ( final Source input , final Result output ) { } }
try { // Use an identity transformation to write the source to the result . final Transformer transformer = createTransformer ( null ) ; transformer . setOutputProperty ( OutputKeys . INDENT , "yes" ) ; transformer . transform ( input , output ) ; } catch ( final Exception ex ) { LOGGER . error ( "Problem formatting DOM representation." , ex ) ; }
public class ReferencePrefetcher { /** * Associate the batched Children with their owner object . * Loop over owners */ protected void associateBatched ( Collection owners , Collection children ) { } }
ObjectReferenceDescriptor ord = getObjectReferenceDescriptor ( ) ; ClassDescriptor cld = getOwnerClassDescriptor ( ) ; Object owner ; Object relatedObject ; Object fkValues [ ] ; Identity id ; PersistenceBroker pb = getBroker ( ) ; PersistentField field = ord . getPersistentField ( ) ; Class topLevelClass = pb . getTopLevelClass ( ord . getItemClass ( ) ) ; HashMap childrenMap = new HashMap ( children . size ( ) ) ; for ( Iterator it = children . iterator ( ) ; it . hasNext ( ) ; ) { relatedObject = it . next ( ) ; childrenMap . put ( pb . serviceIdentity ( ) . buildIdentity ( relatedObject ) , relatedObject ) ; } for ( Iterator it = owners . iterator ( ) ; it . hasNext ( ) ; ) { owner = it . next ( ) ; fkValues = ord . getForeignKeyValues ( owner , cld ) ; if ( isNull ( fkValues ) ) { field . set ( owner , null ) ; continue ; } id = pb . serviceIdentity ( ) . buildIdentity ( null , topLevelClass , fkValues ) ; relatedObject = childrenMap . get ( id ) ; field . set ( owner , relatedObject ) ; }
public class BasicBinder { /** * Resolve an UnMarshaller with the given source and target class . * The unmarshaller is used as follows : Instances of the source can be marshalled into the target class . * @ param key The key to look up */ public < S , T > FromUnmarshaller < S , T > findUnmarshaller ( ConverterKey < S , T > key ) { } }
Converter < T , S > converter = findConverter ( key . invert ( ) ) ; if ( converter == null ) { return null ; } if ( FromUnmarshallerConverter . class . isAssignableFrom ( converter . getClass ( ) ) ) { return ( ( FromUnmarshallerConverter < S , T > ) converter ) . getUnmarshaller ( ) ; } else { return new ConverterFromUnmarshaller < S , T > ( converter ) ; }
public class ExtensionLoader { /** * 返回缺省的扩展 , 如果没有设置则返回 < code > null < / code > */ public T getDefaultExtension ( ) { } }
getExtensionClasses ( ) ; if ( null == cachedDefaultName || cachedDefaultName . length ( ) == 0 || "true" . equals ( cachedDefaultName ) ) { return null ; } return getExtension ( cachedDefaultName ) ;
public class Util { /** * # ifdef JAVA6 */ public static final SQLException sqlException ( String msg , String sqlstate , int code , Throwable cause ) { } }
if ( sqlstate . startsWith ( "08" ) ) { if ( ! sqlstate . endsWith ( "003" ) ) { // then , e . g . - the database may spuriously cease to be " in use " // upon retry // - the network configuration , server availability // may change spuriously // - keystore location / content may change spuriously return new SQLTransientConnectionException ( msg , sqlstate , code , cause ) ; } else { // the database is ( permanently ) shut down or the connection is // ( permanently ) closed or broken return new SQLNonTransientConnectionException ( msg , sqlstate , code , cause ) ; } } else if ( sqlstate . startsWith ( "22" ) ) { return new SQLDataException ( msg , sqlstate , code , cause ) ; } else if ( sqlstate . startsWith ( "23" ) ) { return new SQLIntegrityConstraintViolationException ( msg , sqlstate , code , cause ) ; } else if ( sqlstate . startsWith ( "28" ) ) { return new SQLInvalidAuthorizationSpecException ( msg , sqlstate , code , cause ) ; } else if ( sqlstate . startsWith ( "42" ) || sqlstate . startsWith ( "37" ) || sqlstate . startsWith ( "2A" ) ) { // TODO : // First , the overview section of java . sql . SQLSyntaxErrorException // " . . . thrown when the SQLState class value is ' < i > 42 < / i > ' " // appears to be inaccurate or not in sync with the // SQL 2003 standard , 02 Foundation , Table 32 , which states : // Condition Class SubClass // syntax error or access rule violation - 42 ( no subclass ) 000 // SQL 2003 describes an Access Rule Violation as refering to // the case where , in the course of preparing or executing // an SQL statement , an Access Rule section pertaining // to one of the elements of the statement is violated . // Further , section 13.4 Calls to an < externally - invoked - procedure > // lists : // SYNTAX _ ERROR _ OR _ ACCESS _ RULE _ VIOLATION _ NO _ SUBCLASS : // constant SQLSTATE _ TYPE : = " 42000 " ; // SYNTAX _ ERROR _ OR _ ACCESS _ RULE _ VIOLATION _ IN _ DIRECT _ STATEMENT _ NO _ SUBCLASS : // constant SQLSTATE _ TYPE : = " 2A000 " ; // SYNTAX _ ERROR _ OR _ ACCESS _ RULE _ VIOLATION _ IN _ DYNAMIC _ STATEMENT _ NO _ SUBCLASS : // constant SQLSTATE _ TYPE : = " 37000 " ; // Strangely , SQLSTATEs " 37000 " and 2A000 " are not mentioned // anywhere else in any of the SQL 2003 parts and are // conspicuously missing from 02 - Foundation , Table 32. // Our only Access Violation SQLSTATE so far is : // Error . NOT _ AUTHORIZED 255 = 42000 User not authorized for action ' $ $ ' // Our syntax exceptions are apparently all sqlstate " 37000" // Clearly , we should differentiate between DIRECT and DYNAMIC // SQL forms . And clearly , our current " 37000 " is " wrong " in // that we do not actually support dynamic SQL syntax , but // rather implement similar behaviour only through JDBC // Prepared and Callable statements . return new SQLSyntaxErrorException ( msg , sqlstate , code , cause ) ; } else if ( sqlstate . startsWith ( "40" ) ) { // TODO : our 40xxx exceptions are not currently used ( correctly ) // for transaction rollback exceptions : // 018 = 40001 Serialization failure // - currently used to indicate Java object serialization // failures , which is just plain wrong . // 019 = 40001 Transfer corrupted // - currently used to indicate IOExceptions related to // PreparedStatement XXXStreamYYY operations and Result // construction using RowInputBinary ( e . g . when reading // a result transmitted over the network ) , which is // probably also just plain wrong . // SQL 2003 02 - Foundation , Table 32 states : // 40000 transaction rollback - no subclass // 40001 transaction rollback - ( transaction ) serialization failure // 40002 transaction rollback - integrity constraint violation // 40003 transaction rollback - statement completion unknown // 40004 transaction rollback - triggered action exception return new SQLTransactionRollbackException ( msg , sqlstate , code , cause ) ; } else if ( sqlstate . startsWith ( "0A" ) ) { // JSR 221 2005-12-14 prd return new SQLFeatureNotSupportedException ( msg , sqlstate , code , cause ) ; } else { // TODO resolved : // JSR 221 2005-12-14 prd // " Any SQLState class values which are currently not mapped to // either a SQLNonTransientException or a SQLTransientException // will result in a java . sql . SQLException being thrown . " return new SQLException ( msg , sqlstate , code , cause ) ; }
public class ElementsExceptionsFactory { /** * Constructs and initializes a new { @ link SystemException } with the given { @ link Throwable cause } * and { @ link String message } formatted with the given { @ link Object [ ] arguments } . * @ param cause { @ link Throwable } identified as the reason this { @ link SystemException } was thrown . * @ param message { @ link String } describing the { @ link SystemException exception } . * @ param args { @ link Object [ ] arguments } used to replace format placeholders in the { @ link String message } . * @ return a new { @ link SystemException } with the given { @ link Throwable cause } and { @ link String message } . * @ see org . cp . elements . util . SystemException */ public static SystemException newSystemException ( Throwable cause , String message , Object ... args ) { } }
return new SystemException ( format ( message , args ) , cause ) ;
public class BatchKernelImpl { /** * If jobs are still running ( i . e executingWorkUnitSets is not empty ) , * then wait a second or two to allow them to finish before shutting down the * component . If after the wait the jobs are still running , then issue a message * indicating as such and allow the component to shutdown . * We cannot hold up component shutdown because of outstanding jobs . And we * cannot forcibly stop a job thread . If the component is deactivating because * of a config change ( e . g . to the persistence service ) , then you could have problems * with jobs that " straddle " the update - - i . e . the job starts with one persistence config * and ends with another . But there ' s not much we can do here , other than warn the user * with a message . */ protected void waitForActiveJobsAndSubJobsToStop ( ) { } }
// Don ' t wait if nothing to wait for . . . if ( executingSubWorkUnits . isEmpty ( ) && executingJobs . isEmpty ( ) ) { return ; } try { // Hard - coded 2 seconds , until we have a config property Thread . sleep ( 2 * 1000 ) ; } catch ( InterruptedException ie ) { // Let it interrupt } if ( ! executingJobs . isEmpty ( ) ) { logger . log ( Level . INFO , "jobs.running.at.shutdown" , executingJobs . keySet ( ) ) ; } if ( ! executingSubWorkUnits . isEmpty ( ) ) { logger . fine ( "The following job executions were still running at the time of deactivation: " + executingSubWorkUnits . keySet ( ) . toString ( ) ) ; }
public class Cursor { /** * Perform all Cursor cleanup here . */ void close ( ) { } }
mIODevice = null ; GVRSceneObject owner = getOwnerObject ( ) ; if ( owner . getParent ( ) != null ) { owner . getParent ( ) . removeChildObject ( owner ) ; }
public class MSSQLSingleDbJDBCConnection { /** * { @ inheritDoc } */ @ Override protected void prepareQueries ( ) throws SQLException { } }
super . prepareQueries ( ) ; FIND_PROPERTY_BY_ID = "select len(DATA), I.P_TYPE, V.STORAGE_DESC from JCR_SITEM I, JCR_SVALUE V where I.ID = ? and V.PROPERTY_ID = I.ID" ; FIND_WORKSPACE_DATA_SIZE = "select sum(len(DATA)) from JCR_SITEM I, JCR_SVALUE V where I.I_CLASS=2 and I.CONTAINER_NAME=?" + " and I.ID=V.PROPERTY_ID" ; FIND_NODE_DATA_SIZE = "select sum(len(DATA)) from JCR_SITEM I, JCR_SVALUE V where I.PARENT_ID=? and I.I_CLASS=2" + " and I.CONTAINER_NAME=? and I.ID=V.PROPERTY_ID" ; FIND_VALUE_STORAGE_DESC_AND_SIZE = "select len(DATA), STORAGE_DESC from JCR_SVALUE where PROPERTY_ID=?" ; if ( containerConfig . useSequenceForOrderNumber ) { FIND_LAST_ORDER_NUMBER = "exec " + JCR_ITEM_NEXT_VAL + " 'LAST_N_ORDER_NUM' , ? , ?" ; FIND_NODES_BY_PARENTID_LAZILY_CQ = "select I.*, P.NAME AS PROP_NAME, V.ORDER_NUM, V.DATA from JCR_SVALUE V, JCR_SITEM P " + " join (select TOP ${TOP} J.* from JCR_SITEM J where J.CONTAINER_NAME=? AND J.I_CLASS=1 and J.PARENT_ID=?" + " AND J.N_ORDER_NUM >= ? order by J.N_ORDER_NUM, J.ID ) I on P.PARENT_ID = I.ID" + " where P.I_CLASS=2 and P.CONTAINER_NAME=? and P.PARENT_ID=I.ID and" + " (P.NAME='[http://www.jcp.org/jcr/1.0]primaryType' or" + " P.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes' or" + " P.NAME='[http://www.exoplatform.com/jcr/exo/1.0]owner' or" + " P.NAME='[http://www.exoplatform.com/jcr/exo/1.0]permissions')" + " and V.PROPERTY_ID=P.ID order by I.N_ORDER_NUM, I.ID" ; }
public class ObjectArrayTypeInfo { public static < T , C > ObjectArrayTypeInfo < T , C > getInfoFor ( Type type , TypeInformation < C > componentInfo ) { } }
// generic array type e . g . for Tuples if ( type instanceof GenericArrayType ) { GenericArrayType genericArray = ( GenericArrayType ) type ; return new ObjectArrayTypeInfo < T , C > ( type , genericArray . getGenericComponentType ( ) , componentInfo ) ; } // for tuples without generics ( e . g . generated by the TypeInformation parser ) else if ( type instanceof Class < ? > && ( ( Class < ? > ) type ) . isArray ( ) && Tuple . class . isAssignableFrom ( ( ( Class < ? > ) type ) . getComponentType ( ) ) && type != Tuple . class ) { return new ObjectArrayTypeInfo < T , C > ( type , ( ( Class < ? > ) type ) . getComponentType ( ) , componentInfo ) ; } return getInfoFor ( type ) ;
public class CmsGwtActionElement { /** * Exports a dictionary by the given name as the content attribute of a meta tag . < p > * @ param name the dictionary name * @ param data the data * @ return the meta tag */ public static String exportDictionary ( String name , String data ) { } }
StringBuffer sb = new StringBuffer ( ) ; sb . append ( "<meta name=\"" ) . append ( name ) . append ( "\" content=\"" ) . append ( data ) . append ( "\" />" ) ; return sb . toString ( ) ;
public class JSONWriter { /** * Push an array or object scope . * @ param options settings to control prefix output and * optional key tracking for object vs . array scopes . * @ throws JSONException If nesting is too deep . */ private void push ( ScopeOptions options ) throws JSONException { } }
m_top += 1 ; if ( m_top >= MAX_DEPTH ) { throw new JSONException ( "Nesting too deep." ) ; } try { m_writer . write ( options . m_prefix ) ; } catch ( IOException e ) { throw new JSONException ( e ) ; } HashSetOfString keyTracker = options . createKeyTracker ( ) ; m_scopeStack [ m_top ] = keyTracker ; m_mode = ( keyTracker == null ) ? 'a' : 'k' ; m_expectingComma = false ;
public class SparkLine { /** * Sets the colordefinition of the area below the sparkline * @ param AREA _ FILL _ COLOR */ public void setAreaFill ( final ColorDef AREA_FILL_COLOR ) { } }
this . areaFill = AREA_FILL_COLOR ; init ( INNER_BOUNDS . width , INNER_BOUNDS . height ) ; repaint ( INNER_BOUNDS ) ;
public class GeometryServiceImpl { /** * Return the bounding box that defines the outer most border of a geometry . * @ param geometry * The geometry for which to calculate the bounding box . * @ return The outer bounds for the given geometry . */ public Bbox getBounds ( Geometry geometry ) { } }
org . geomajas . gwt . client . spatial . geometry . Geometry geom = GeometryConverter . toGwt ( geometry ) ; return GeometryConverter . toDto ( geom . getBounds ( ) ) ;
public class RecordingService { /** * Update and overwrites metadata recording file with final values on recording * stop ( " . recording . RECORDING _ ID " JSON file to store Recording entity ) . * @ return updated Recording object */ protected Recording sealRecordingMetadataFile ( Recording recording , long size , double duration , String metadataFilePath ) { } }
recording . setSize ( size ) ; // Size in bytes recording . setDuration ( duration > 0 ? duration : 0 ) ; // Duration in seconds if ( ! io . openvidu . java . client . Recording . Status . failed . equals ( recording . getStatus ( ) ) ) { recording . setStatus ( io . openvidu . java . client . Recording . Status . stopped ) ; } this . fileWriter . overwriteFile ( metadataFilePath , recording . toJson ( ) . toString ( ) ) ; recording = this . recordingManager . updateRecordingUrl ( recording ) ; log . info ( "Sealed recording metadata file at {}" , metadataFilePath ) ; return recording ;
public class WebSockets { /** * Sends a complete text message , invoking the callback when complete * @ param message The text to send * @ param wsChannel The web socket channel */ public static void sendTextBlocking ( final ByteBuffer message , final WebSocketChannel wsChannel ) throws IOException { } }
sendBlockingInternal ( message , WebSocketFrameType . TEXT , wsChannel ) ;
public class ModelParameterSchemaV3 { /** * ModelParameterSchema has its own serializer so that default _ value and actual _ value * get serialized as their native types . Autobuffer assumes all classes that have their * own serializers should be serialized as JSON objects , and wraps them in { } , so this * can ' t just be handled by a customer serializer in IcedWrapper . * @ param ab * @ return */ public final AutoBuffer writeJSON_impl ( AutoBuffer ab ) { } }
ab . putJSONStr ( "name" , name ) ; ab . put1 ( ',' ) ; ab . putJSONStr ( "label" , name ) ; ab . put1 ( ',' ) ; ab . putJSONStr ( "help" , help ) ; ab . put1 ( ',' ) ; ab . putJSONStrUnquoted ( "required" , required ? "true" : "false" ) ; ab . put1 ( ',' ) ; ab . putJSONStr ( "type" , type ) ; ab . put1 ( ',' ) ; if ( default_value instanceof IcedWrapper ) { ab . putJSONStr ( "default_value" ) . put1 ( ':' ) ; ( ( IcedWrapper ) default_value ) . writeUnwrappedJSON ( ab ) ; ab . put1 ( ',' ) ; } else { ab . putJSONStr ( "default_value" ) . put1 ( ':' ) . putJSON ( default_value ) ; ab . put1 ( ',' ) ; } if ( actual_value instanceof IcedWrapper ) { ab . putJSONStr ( "actual_value" ) . put1 ( ':' ) ; ( ( IcedWrapper ) actual_value ) . writeUnwrappedJSON ( ab ) ; ab . put1 ( ',' ) ; } else { ab . putJSONStr ( "actual_value" ) . put1 ( ':' ) . putJSON ( actual_value ) ; ab . put1 ( ',' ) ; } ab . putJSONStr ( "level" , level ) ; ab . put1 ( ',' ) ; ab . putJSONAStr ( "values" , values ) ; ab . put1 ( ',' ) ; ab . putJSONAStr ( "is_member_of_frames" , is_member_of_frames ) ; ab . put1 ( ',' ) ; ab . putJSONAStr ( "is_mutually_exclusive_with" , is_mutually_exclusive_with ) ; ab . put1 ( ',' ) ; ab . putJSONStrUnquoted ( "gridable" , gridable ? "true" : "false" ) ; return ab ;
public class SearchParamExtractorDstu2 { /** * ( non - Javadoc ) * @ see ca . uhn . fhir . jpa . dao . ISearchParamExtractor # extractSearchParamTokens ( ca . uhn . fhir . jpa . entity . ResourceTable , * ca . uhn . fhir . model . api . IResource ) */ @ Override public Set < BaseResourceIndexedSearchParam > extractSearchParamTokens ( ResourceTable theEntity , IBaseResource theResource ) { } }
HashSet < BaseResourceIndexedSearchParam > retVal = new HashSet < BaseResourceIndexedSearchParam > ( ) ; String useSystem = null ; if ( theResource instanceof ValueSet ) { ValueSet vs = ( ValueSet ) theResource ; useSystem = vs . getCodeSystem ( ) . getSystem ( ) ; } Collection < RuntimeSearchParam > searchParams = getSearchParams ( theResource ) ; for ( RuntimeSearchParam nextSpDef : searchParams ) { if ( nextSpDef . getParamType ( ) != RestSearchParameterTypeEnum . TOKEN ) { continue ; } String nextPath = nextSpDef . getPath ( ) ; if ( isBlank ( nextPath ) ) { continue ; } boolean multiType = false ; if ( nextPath . endsWith ( "[x]" ) ) { multiType = true ; } List < String > systems = new ArrayList < String > ( ) ; List < String > codes = new ArrayList < String > ( ) ; String needContactPointSystem = null ; if ( nextPath . endsWith ( "(system=phone)" ) ) { nextPath = nextPath . substring ( 0 , nextPath . length ( ) - "(system=phone)" . length ( ) ) ; needContactPointSystem = "phone" ; } if ( nextPath . endsWith ( "(system=email)" ) ) { nextPath = nextPath . substring ( 0 , nextPath . length ( ) - "(system=email)" . length ( ) ) ; needContactPointSystem = "email" ; } for ( Object nextObject : extractValues ( nextPath , theResource ) ) { // Patient : language if ( nextObject instanceof Patient . Communication ) { Communication nextValue = ( Patient . Communication ) nextObject ; nextObject = nextValue . getLanguage ( ) ; } if ( nextObject instanceof IdentifierDt ) { IdentifierDt nextValue = ( IdentifierDt ) nextObject ; if ( nextValue . isEmpty ( ) ) { continue ; } String system = StringUtils . defaultIfBlank ( nextValue . getSystemElement ( ) . getValueAsString ( ) , null ) ; String value = nextValue . getValueElement ( ) . getValue ( ) ; if ( isNotBlank ( value ) ) { systems . add ( system ) ; codes . add ( value ) ; } if ( isNotBlank ( nextValue . getType ( ) . getText ( ) ) ) { addStringParam ( theEntity , retVal , nextSpDef , nextValue . getType ( ) . getText ( ) ) ; } } else if ( nextObject instanceof ContactPointDt ) { ContactPointDt nextValue = ( ContactPointDt ) nextObject ; if ( nextValue . isEmpty ( ) ) { continue ; } if ( isNotBlank ( needContactPointSystem ) ) { if ( ! needContactPointSystem . equals ( nextValue . getSystemElement ( ) . getValueAsString ( ) ) ) { continue ; } } systems . add ( nextValue . getSystemElement ( ) . getValueAsString ( ) ) ; codes . add ( nextValue . getValueElement ( ) . getValue ( ) ) ; } else if ( nextObject instanceof BoundCodeDt ) { BoundCodeDt < ? > obj = ( BoundCodeDt < ? > ) nextObject ; String system = extractSystem ( obj ) ; String code = obj . getValue ( ) ; if ( isNotBlank ( code ) ) { systems . add ( system ) ; codes . add ( code ) ; } } else if ( nextObject instanceof IPrimitiveDatatype < ? > ) { IPrimitiveDatatype < ? > nextValue = ( IPrimitiveDatatype < ? > ) nextObject ; if ( nextValue . isEmpty ( ) ) { continue ; } if ( "ValueSet.codeSystem.concept.code" . equals ( nextPath ) ) { systems . add ( useSystem ) ; } else { systems . add ( null ) ; } codes . add ( nextValue . getValueAsString ( ) ) ; } else if ( nextObject instanceof CodingDt ) { CodingDt nextValue = ( CodingDt ) nextObject ; extractTokensFromCoding ( systems , codes , theEntity , retVal , nextSpDef , nextValue ) ; } else if ( nextObject instanceof CodeableConceptDt ) { CodeableConceptDt nextCC = ( CodeableConceptDt ) nextObject ; if ( ! nextCC . getTextElement ( ) . isEmpty ( ) ) { addStringParam ( theEntity , retVal , nextSpDef , nextCC . getTextElement ( ) . getValue ( ) ) ; } extractTokensFromCodeableConcept ( systems , codes , nextCC , theEntity , retVal , nextSpDef ) ; } else if ( nextObject instanceof RestSecurity ) { // Conformance . security search param points to something kind of useless right now - This should probably // be fixed . RestSecurity sec = ( RestSecurity ) nextObject ; for ( BoundCodeableConceptDt < RestfulSecurityServiceEnum > nextCC : sec . getService ( ) ) { extractTokensFromCodeableConcept ( systems , codes , nextCC , theEntity , retVal , nextSpDef ) ; } } else if ( nextObject instanceof Location . Position ) { ourLog . warn ( "Position search not currently supported, not indexing location" ) ; continue ; } else { if ( ! multiType ) { throw new ConfigurationException ( "Search param " + nextSpDef . getName ( ) + " is of unexpected datatype: " + nextObject . getClass ( ) ) ; } else { continue ; } } } assert systems . size ( ) == codes . size ( ) : "Systems contains " + systems + ", codes contains: " + codes ; Set < Pair < String , String > > haveValues = new HashSet < Pair < String , String > > ( ) ; for ( int i = 0 ; i < systems . size ( ) ; i ++ ) { String system = systems . get ( i ) ; String code = codes . get ( i ) ; if ( isBlank ( system ) && isBlank ( code ) ) { continue ; } if ( system != null && system . length ( ) > ResourceIndexedSearchParamToken . MAX_LENGTH ) { system = system . substring ( 0 , ResourceIndexedSearchParamToken . MAX_LENGTH ) ; } if ( code != null && code . length ( ) > ResourceIndexedSearchParamToken . MAX_LENGTH ) { code = code . substring ( 0 , ResourceIndexedSearchParamToken . MAX_LENGTH ) ; } Pair < String , String > nextPair = Pair . of ( system , code ) ; if ( haveValues . contains ( nextPair ) ) { continue ; } haveValues . add ( nextPair ) ; ResourceIndexedSearchParamToken nextEntity ; nextEntity = new ResourceIndexedSearchParamToken ( nextSpDef . getName ( ) , system , code ) ; nextEntity . setResource ( theEntity ) ; retVal . add ( nextEntity ) ; } } return retVal ;
public class AbstractBean { /** * Creates a mapping from the specified property on this Bean class to one of the Bean object ' s fields . * @ param propertyName a String value specifying the name of a property on this Bean class . * @ param fieldName a String value specifying the name of the Bean object ' s field . * @ return a boolean value indicating whether the mapping between the property and field was successfully * created . */ protected boolean mapPropertyNameToFieldName ( final String propertyName , final String fieldName ) { } }
// TODO add possible validation for the property name and field name of this Bean class . propertyNameToFieldNameMapping . put ( propertyName , fieldName ) ; return propertyNameToFieldNameMapping . containsKey ( propertyName ) ;
public class HttpClientManager { /** * Execute the provided request without any special context . Caller is * responsible for consuming the response correctly ! * @ param aRequest * The request to be executed . May not be < code > null < / code > . * @ return The response to be evaluated . Never < code > null < / code > . * @ throws IOException * In case of error * @ throws IllegalStateException * If this manager was already closed ! */ @ Nonnull public CloseableHttpResponse execute ( @ Nonnull final HttpUriRequest aRequest ) throws IOException { } }
return execute ( aRequest , ( HttpContext ) null ) ;
public class FTPConnection { /** * Processes commands * @ param cmd The command and its arguments */ protected void process ( String cmd ) { } }
int firstSpace = cmd . indexOf ( ' ' ) ; if ( firstSpace < 0 ) firstSpace = cmd . length ( ) ; CommandInfo info = commands . get ( cmd . substring ( 0 , firstSpace ) . toUpperCase ( ) ) ; if ( info == null ) { sendResponse ( 502 , "Unknown command" ) ; return ; } processCommand ( info , firstSpace != cmd . length ( ) ? cmd . substring ( firstSpace + 1 ) : "" ) ;
public class ClassUtils { /** * Gets the field value for the specified qualified field name . */ public static Object getFieldValue ( String qualifiedFieldName ) { } }
Class clazz ; try { clazz = classForName ( ClassUtils . qualifier ( qualifiedFieldName ) ) ; } catch ( ClassNotFoundException cnfe ) { return null ; } try { return clazz . getField ( ClassUtils . unqualify ( qualifiedFieldName ) ) . get ( null ) ; } catch ( Exception e ) { return null ; }
public class ParserBase { /** * Convert a comma separated list String of editions into the required * format e . g . " ; productEdition = \ " BASE , DEVELOPERS , EXPRESS , ND , zOS \ " * @ param editions * @ return String the product edition supported */ private static String convertCommaSeparatedListToEditionString ( String csList ) throws RepositoryException { } }
if ( csList == null ) { return null ; } // Split the comma separated list into an array csList = csList . trim ( ) ; List < Edition > editions = new ArrayList < Edition > ( ) ; if ( csList . length ( ) > 0 ) { String [ ] sArray = csList . split ( "," ) ; for ( String s : sArray ) { if ( s . length ( ) != 0 ) { try { editions . add ( Edition . valueOf ( s ) ) ; } catch ( IllegalArgumentException e ) { throw new RepositoryException ( "The list of editions '" + s + "' contained an invalid edition" , e ) ; } } } } // convert the editions into a string String editionString = null ; for ( Edition ed : editions ) { if ( editionString == null ) { editionString = "; productEdition=\"" ; editionString = editionString + ed . getProductEdition ( ) ; } else { editionString = editionString + "," + ed . getProductEdition ( ) ; } } if ( editionString == null ) { editionString = "" ; } else { editionString = editionString + "\"" ; } return editionString ;
public class HighTideNode { /** * Wait for service to finish . * ( Normally , it runs forever . ) */ public void join ( ) { } }
try { if ( server != null ) server . join ( ) ; if ( triggerThread != null ) triggerThread . join ( ) ; if ( fileFixerThread != null ) fileFixerThread . join ( ) ; } catch ( InterruptedException ie ) { // do nothing }
public class Vue { /** * Register a { @ link IsVueComponent } globally * @ param id Id for our component in the templates * @ param vueFactory The factory of the Component to create * @ param < T > { @ link IsVueComponent } we want to attach */ @ JsOverlay public static < T extends IsVueComponent > void component ( String id , VueComponentFactory < T > vueFactory ) { } }
component ( id , vueFactory . getJsConstructor ( ) ) ;
public class XMLDatabase { /** * Creates a < code > Document < / code > object for the current state of * this xml database . * @ return a < code > Document < / code > object . */ private Document getDocument ( ) { } }
Document document = new Document ( ) ; Comment comment = new Comment ( " generated on " + new Date ( ) + " " ) ; document . addContent ( comment ) ; Element rootElement = new Element ( ROOT_ELEMENT_NAME ) ; rootElement . setAttribute ( MASTER_LANGUAGE_ATTRIBUTE_NAME , getMasterLanguage ( ) ) ; for ( Attribute attribute : additionalRootAttrs ) { // need to set the attribute like a new attribute , // as the original one stored the parent element and cannot be set to a new parent rootElement . setAttribute ( attribute . getName ( ) , attribute . getValue ( ) , attribute . getNamespace ( ) ) ; } // set the namespace , this makes sure that it is written into the trema node for ( Namespace namespace : additionalNamespaces ) { rootElement . addNamespaceDeclaration ( namespace ) ; } for ( ITextNode textNode : textNodeList ) { String key = textNode . getKey ( ) ; Element textElement = new Element ( TEXT_ELEMENT_NAME ) ; textElement . setAttribute ( KEY_ATTRIBUTE_NAME , key ) ; String context = textNode . getContext ( ) ; Element contextElement = new Element ( CONTEXT_ELEMENT_NAME ) ; contextElement . setText ( context ) ; textElement . addContent ( contextElement ) ; IValueNode [ ] valueNodes = textNode . getValueNodes ( ) ; for ( IValueNode valueNode : valueNodes ) { Element valueElement = new Element ( VALUE_ELEMENT_NAME ) ; valueElement . setAttribute ( LANGUAGE_ATTRIBUTE_NAME , valueNode . getLanguage ( ) ) ; valueElement . setAttribute ( STATUS_ATTRIBUTE_NAME , valueNode . getStatus ( ) . getName ( ) ) ; valueElement . setText ( valueNode . getValue ( ) ) ; textElement . addContent ( valueElement ) ; } rootElement . addContent ( textElement ) ; } document . setRootElement ( rootElement ) ; return document ;
public class XMLResourceBundle { /** * Return a message value with the supplied string integrated into it . * @ param aMessage A message in which to include the supplied string value * @ param aDetail A string value to be included into the supplied message * @ return A message with the supplied string value integrated into it */ public String get ( final String aMessage , final String aDetail ) { } }
return StringUtils . format ( super . getString ( aMessage ) , aDetail ) ;
public class CellMaskedMatrix { /** * { @ inheritDoc } */ public double [ ] getColumn ( int column ) { } }
column = getIndexFromMap ( colMaskMap , column ) ; double [ ] values = new double [ rows ( ) ] ; for ( int r = 0 ; r < rows ( ) ; ++ r ) values [ r ] = matrix . get ( getIndexFromMap ( rowMaskMap , r ) , column ) ; return values ;
public class Interval { /** * Create an interval with the specified endpoints , reordering them as needed , * using the specified flags * @ param a one of the endpoints * @ param b the other endpoint * @ param flags flags characterizing the interval * @ param < E > type of the interval endpoints * @ return Interval with endpoints re - ordered as needed */ public static < E extends Comparable < E > > Interval < E > toValidInterval ( E a , E b , int flags ) { } }
int comp = a . compareTo ( b ) ; if ( comp <= 0 ) { return new Interval ( a , b , flags ) ; } else { return new Interval ( b , a , flags ) ; }
public class CommandDetailParser { /** * Parse the output of the Redis COMMAND / COMMAND INFO command and convert to a list of { @ link CommandDetail } . * @ param commandOutput the command output , must not be { @ literal null } * @ return RedisInstance */ public static List < CommandDetail > parse ( List < ? > commandOutput ) { } }
LettuceAssert . notNull ( commandOutput , "CommandOutput must not be null" ) ; List < CommandDetail > result = new ArrayList < > ( ) ; for ( Object o : commandOutput ) { if ( ! ( o instanceof Collection < ? > ) ) { continue ; } Collection < ? > collection = ( Collection < ? > ) o ; if ( collection . size ( ) != COMMAND_INFO_SIZE ) { continue ; } CommandDetail commandDetail = parseCommandDetail ( collection ) ; result . add ( commandDetail ) ; } return Collections . unmodifiableList ( result ) ;
public class PeriodValueImpl { /** * returns a period with the given start date and duration . * @ param start non null . * @ param dur a positive duration represented as a DateValue . */ public static PeriodValue createFromDuration ( DateValue start , DateValue dur ) { } }
DateValue end = TimeUtils . add ( start , dur ) ; if ( end instanceof TimeValue && ! ( start instanceof TimeValue ) ) { start = TimeUtils . dayStart ( start ) ; } return new PeriodValueImpl ( start , end ) ;
public class HttpEncodingSupport { /** * Encodes a String in format suitable for use in URL ' s * @ param input * @ return */ public static String urlEncode ( String input ) { } }
if ( input == null ) { return "" ; } try { return URLEncoder . encode ( input , "UTF-8" ) ; } catch ( UnsupportedEncodingException uee ) { String result = StringSupport . replaceAll ( input , "&" , "%26" ) ; result = StringSupport . replaceAll ( result , "<" , "%3c" ) ; result = StringSupport . replaceAll ( result , ">" , "%3e" ) ; result = StringSupport . replaceAll ( result , "\"" , "%22" ) ; result = StringSupport . replaceAll ( result , " " , "+" ) ; return result ; }
public class Stream { /** * Concatenates two streams . * < p > Example : * < pre > * stream 1 : [ 1 , 2 , 3 , 4] * stream 2 : [ 5 , 6] * result : [ 1 , 2 , 3 , 4 , 5 , 6] * < / pre > * @ param < T > The type of stream elements * @ param stream1 the first stream * @ param stream2 the second stream * @ return the new concatenated stream * @ throws NullPointerException if { @ code stream1 } or { @ code stream2 } is null */ @ NotNull public static < T > Stream < T > concat ( @ NotNull Stream < ? extends T > stream1 , @ NotNull Stream < ? extends T > stream2 ) { } }
Objects . requireNonNull ( stream1 ) ; Objects . requireNonNull ( stream2 ) ; Stream < T > result = new Stream < T > ( new ObjConcat < T > ( stream1 . iterator , stream2 . iterator ) ) ; return result . onClose ( Compose . closeables ( stream1 , stream2 ) ) ;
public class WebFacesConfigDescriptorImpl { /** * Returns all < code > application < / code > elements * @ return list of < code > application < / code > */ public List < FacesConfigApplicationType < WebFacesConfigDescriptor > > getAllApplication ( ) { } }
List < FacesConfigApplicationType < WebFacesConfigDescriptor > > list = new ArrayList < FacesConfigApplicationType < WebFacesConfigDescriptor > > ( ) ; List < Node > nodeList = model . get ( "application" ) ; for ( Node node : nodeList ) { FacesConfigApplicationType < WebFacesConfigDescriptor > type = new FacesConfigApplicationTypeImpl < WebFacesConfigDescriptor > ( this , "application" , model , node ) ; list . add ( type ) ; } return list ;
public class Cards { /** * 创建团购券 * @ param groupon * @ return */ public String groupon ( Groupon groupon ) { } }
Card card = new Card ( ) ; card . setCardType ( "GROUPON" ) ; card . setGroupon ( groupon ) ; return createCard ( card ) ;
public class Messages { /** * Create button message key . * @ param gallery name * @ return Button message key as String */ public static String getButtonName ( String gallery ) { } }
StringBuffer sb = new StringBuffer ( GUI_BUTTON_PREF ) ; sb . append ( gallery . toUpperCase ( ) ) ; sb . append ( GUI_BUTTON_SUF ) ; return sb . toString ( ) ;
public class Patterns { /** * Returns a { @ link Pattern } object that matches if the input has at least { @ code n } characters left . Match length is * { @ code n } if succeed . */ public static Pattern hasAtLeast ( final int n ) { } }
return new Pattern ( ) { @ Override public int match ( CharSequence src , int begin , int end ) { if ( ( begin + n ) > end ) return MISMATCH ; else return n ; } @ Override public String toString ( ) { return ".{" + n + ",}" ; } } ;
public class CmsDefaultResourceCollector { /** * Returns a List of all resources in the folder pointed to by the parameter * sorted by the release date , descending . < p > * @ param cms the current CmsObject * @ param param the folder name to use * @ param tree if true , look in folder and all child folders , if false , look only in given folder * @ param numResults the number of results * @ return a List of all resources in the folder pointed to by the parameter * sorted by the release date , descending * @ throws CmsException if something goes wrong */ protected List < CmsResource > allInFolderDateReleasedDesc ( CmsObject cms , String param , boolean tree , int numResults ) throws CmsException { } }
CmsCollectorData data = new CmsCollectorData ( param ) ; String foldername = CmsResource . getFolderPath ( data . getFileName ( ) ) ; CmsResourceFilter filter = CmsResourceFilter . DEFAULT_FILES . addRequireType ( data . getType ( ) ) . addExcludeFlags ( CmsResource . FLAG_TEMPFILE ) ; if ( data . isExcludeTimerange ( ) && ! cms . getRequestContext ( ) . getCurrentProject ( ) . isOnlineProject ( ) ) { // include all not yet released and expired resources in an offline project filter = filter . addExcludeTimerange ( ) ; } List < CmsResource > result = cms . readResources ( foldername , filter , tree ) ; Collections . sort ( result , I_CmsResource . COMPARE_DATE_RELEASED ) ; return shrinkToFit ( result , data . getCount ( ) , numResults ) ;
public class ByteBuffer { /** * Append byte to this buffer . */ public void appendByte ( int b ) { } }
elems = ArrayUtils . ensureCapacity ( elems , length ) ; elems [ length ++ ] = ( byte ) b ;
public class PartialResponseWriter { /** * < p class = " changed _ added _ 2_0 " > Write a delete operation . < / p > * @ param targetId ID of the node to be deleted * @ throws IOException if an input / output error occurs * @ since 2.0 */ public void delete ( String targetId ) throws IOException { } }
startChangesIfNecessary ( ) ; ResponseWriter writer = getWrapped ( ) ; writer . startElement ( "delete" , null ) ; writer . writeAttribute ( "id" , targetId , null ) ; writer . endElement ( "delete" ) ;
public class YamlBuilder { /** * A method call on the YAML builder instance will create a root object with only one key * whose name is the name of the method being called . * This method takes as arguments : * < ul > * < li > a closure < / li > * < li > a map ( ie . named arguments ) < / li > * < li > a map and a closure < / li > * < li > or no argument at all < / li > * < / ul > * Example with a classical builder - style : * < pre > < code class = " groovyTestCase " > * def yaml = new groovy . yaml . YamlBuilder ( ) * def result = yaml . person { * name " Guillaume " * age 33 * assert result instanceof Map * assert yaml . toString ( ) = = ' ' ' - - - * person : * name : " Guillaume " * age : 33 * < / code > < / pre > * Or alternatively with a method call taking named arguments : * < pre > < code class = " groovyTestCase " > * def yaml = new groovy . yaml . YamlBuilder ( ) * yaml . person name : " Guillaume " , age : 33 * assert yaml . toString ( ) = = ' ' ' - - - * person : * name : " Guillaume " * age : 33 * < / code > < / pre > * If you use named arguments and a closure as last argument , * the key / value pairs of the map ( as named arguments ) * and the key / value pairs represented in the closure * will be merged together & mdash ; * the closure properties overriding the map key / values * in case the same key is used . * < pre > < code class = " groovyTestCase " > * def yaml = new groovy . yaml . YamlBuilder ( ) * yaml . person ( name : " Guillaume " , age : 33 ) { town " Paris " } * assert yaml . toString ( ) = = ' ' ' - - - * person : * name : " Guillaume " * age : 33 * town : " Paris " * < / code > < / pre > * The empty args call will create a key whose value will be an empty YAML object : * < pre > < code class = " groovyTestCase " > * def yaml = new groovy . yaml . YamlBuilder ( ) * yaml . person ( ) * assert yaml . toString ( ) = = ' ' ' - - - * person : { } * < / code > < / pre > * @ param name the single key * @ param args the value associated with the key * @ return a map with a single key */ @ Override public Object invokeMethod ( String name , Object args ) { } }
return jsonBuilder . invokeMethod ( name , args ) ;
public class GetGlue { /** * Build an OAuth authorization request . * @ param clientId The OAuth client id obtained from tvtag . * @ param redirectUri The URI to redirect to with appended auth code query parameter . * @ throws OAuthSystemException */ public static OAuthClientRequest getAuthorizationRequest ( String clientId , String redirectUri ) throws OAuthSystemException { } }
return OAuthClientRequest . authorizationLocation ( OAUTH2_AUTHORIZATION_URL ) . setScope ( "public read write" ) . setResponseType ( ResponseType . CODE . toString ( ) ) . setClientId ( clientId ) . setRedirectURI ( redirectUri ) . buildQueryMessage ( ) ;
public class CacheProxy { /** * Enables or disables the configuration management JMX bean . */ void enableManagement ( boolean enabled ) { } }
requireNotClosed ( ) ; synchronized ( configuration ) { if ( enabled ) { JmxRegistration . registerMXBean ( this , cacheMXBean , MBeanType . Configuration ) ; } else { JmxRegistration . unregisterMXBean ( this , MBeanType . Configuration ) ; } configuration . setManagementEnabled ( enabled ) ; }
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link ArithType } { @ code > } } */ @ XmlElementDecl ( namespace = "http://www.w3.org/1998/Math/MathML" , name = "times" ) public JAXBElement < ArithType > createTimes ( ArithType value ) { } }
return new JAXBElement < ArithType > ( _Times_QNAME , ArithType . class , null , value ) ;
public class HtmlOutcomeTargetLink { /** * < p > Set the value of the < code > target < / code > property . < / p > */ public void setTarget ( java . lang . String target ) { } }
getStateHelper ( ) . put ( PropertyKeys . target , target ) ;
public class AmbiguateProperties { /** * Adds subtypes - and implementors , in the case of interfaces - of the type to its JSTypeBitSet * of related types . * < p > The ' is related to ' relationship is best understood graphically . Draw an arrow from each * instance type to the prototype of each of its subclass . Draw an arrow from each prototype to * its instance type . Draw an arrow from each interface to its implementors . A type is related to * another if there is a directed path in the graph from the type to other . Thus , the ' is related * to ' relationship is reflexive and transitive . * < p > Example with Foo extends Bar which extends Baz and Bar implements I : * < pre > { @ code * Foo - > Bar . prototype - > Bar - > Baz . prototype - > Baz * } < / pre > * < p > We also need to handle relationships between functions because of ES6 class - side inheritance * although the top Function type itself is invalidating . */ @ SuppressWarnings ( "ReferenceEquality" ) private void computeRelatedTypesForNonUnionType ( JSType type ) { } }
// This method could be expanded to handle union types if necessary , but currently no union // types are ever passed as input so the method doesn ' t have logic for union types checkState ( ! type . isUnionType ( ) , type ) ; if ( relatedBitsets . containsKey ( type ) ) { // We only need to generate the bit set once . return ; } JSTypeBitSet related = new JSTypeBitSet ( intForType . size ( ) ) ; relatedBitsets . put ( type , related ) ; related . set ( getIntForType ( type ) ) ; // A prototype is related to its instance . if ( type . isFunctionPrototypeType ( ) ) { FunctionType maybeCtor = type . toMaybeObjectType ( ) . getOwnerFunction ( ) ; if ( maybeCtor . isConstructor ( ) || maybeCtor . isInterface ( ) ) { addRelatedInstance ( maybeCtor , related ) ; } return ; } // A class / interface is related to its subclasses / implementors . FunctionType constructor = type . toMaybeObjectType ( ) . getConstructor ( ) ; if ( constructor != null ) { for ( FunctionType subType : constructor . getDirectSubTypes ( ) ) { addRelatedInstance ( subType , related ) ; } } // We only specifically handle implicit prototypes of functions in the case of ES6 classes // For regular functions , the implicit prototype being Function . prototype does not matter // because the type ` Function ` is invalidating . // This may cause unexpected behavior for code that manually sets a prototype , e . g . // Object . setPrototypeOf ( myFunction , prototypeObj ) ; // but code like that should not be used with - - ambiguate _ properties or type - based optimizations FunctionType fnType = type . toMaybeFunctionType ( ) ; if ( fnType != null ) { for ( FunctionType subType : fnType . getDirectSubTypes ( ) ) { // We record all subtypes of constructors , but don ' t care about old ' ES5 - style ' subtyping , // just ES6 - style . This is equivalent to saying that the subtype constructor ' s implicit // prototype is the given type if ( fnType == subType . getImplicitPrototype ( ) ) { addRelatedType ( subType , related ) ; } } }
public class CalendarRecordItem { /** * Constructor . * @ param gridScreen The screen . * @ param iIconField The location of the icon field . * @ param iStartDateTimeField The location of the start time . * @ param iEndDateTimeField The location of the end time . * @ param iDescriptionField The location of the description . * @ param iStatusField The location of the status . */ public void init ( BaseScreen gridScreen , int iIconField , int iStartDateTimeField , int iEndDateTimeField , int iDescriptionField , int iStatusField ) { } }
m_gridScreen = gridScreen ; m_iDescriptionField = iDescriptionField ; m_iStartDateTimeField = iStartDateTimeField ; m_iEndDateTimeField = iEndDateTimeField ; m_iStatusField = iStatusField ; m_iIconField = iIconField ;
public class Classes { /** * Get the underlying class for a type , or null if the type is a variable type . * @ param type the type * @ return the underlying class */ public static Class < ? > forType ( Type type ) { } }
if ( type instanceof Class ) { return ( Class < ? > ) type ; } if ( type instanceof ParameterizedType ) { return forType ( ( ( ParameterizedType ) type ) . getRawType ( ) ) ; } if ( ! ( type instanceof GenericArrayType ) ) { return null ; } Type componentType = ( ( GenericArrayType ) type ) . getGenericComponentType ( ) ; Class < ? > componentClass = forType ( componentType ) ; return componentClass != null ? Array . newInstance ( componentClass , 0 ) . getClass ( ) : null ;
public class CmsPropertyEditorHelper { /** * Returns whether the current user has write permissions , the resource is lockable or already locked by the current user and is in the current project . < p > * @ param cms the cms context * @ param resource the resource * @ return < code > true < / code > if the resource is writable * @ throws CmsException in case checking the permissions fails */ protected boolean isWritable ( CmsObject cms , CmsResource resource ) throws CmsException { } }
boolean writable = cms . hasPermissions ( resource , CmsPermissionSet . ACCESS_WRITE , false , CmsResourceFilter . IGNORE_EXPIRATION ) ; if ( writable ) { CmsLock lock = cms . getLock ( resource ) ; writable = lock . isUnlocked ( ) || lock . isOwnedBy ( cms . getRequestContext ( ) . getCurrentUser ( ) ) ; if ( writable ) { CmsResourceUtil resUtil = new CmsResourceUtil ( cms , resource ) ; writable = resUtil . isInsideProject ( ) && ! resUtil . getProjectState ( ) . isLockedForPublishing ( ) ; } } return writable ;
public class Matrix3d { /** * Set this matrix to a rotation transformation to make < code > - z < / code > * point along < code > dir < / code > . * In order to apply the lookalong transformation to any previous existing transformation , * use { @ link # lookAlong ( double , double , double , double , double , double ) lookAlong ( ) } * @ see # setLookAlong ( double , double , double , double , double , double ) * @ see # lookAlong ( double , double , double , double , double , double ) * @ param dirX * the x - coordinate of the direction to look along * @ param dirY * the y - coordinate of the direction to look along * @ param dirZ * the z - coordinate of the direction to look along * @ param upX * the x - coordinate of the up vector * @ param upY * the y - coordinate of the up vector * @ param upZ * the z - coordinate of the up vector * @ return this */ public Matrix3d setLookAlong ( double dirX , double dirY , double dirZ , double upX , double upY , double upZ ) { } }
// Normalize direction double invDirLength = 1.0 / Math . sqrt ( dirX * dirX + dirY * dirY + dirZ * dirZ ) ; dirX *= - invDirLength ; dirY *= - invDirLength ; dirZ *= - invDirLength ; // left = up x direction double leftX , leftY , leftZ ; leftX = upY * dirZ - upZ * dirY ; leftY = upZ * dirX - upX * dirZ ; leftZ = upX * dirY - upY * dirX ; // normalize left double invLeftLength = 1.0 / Math . sqrt ( leftX * leftX + leftY * leftY + leftZ * leftZ ) ; leftX *= invLeftLength ; leftY *= invLeftLength ; leftZ *= invLeftLength ; // up = direction x left double upnX = dirY * leftZ - dirZ * leftY ; double upnY = dirZ * leftX - dirX * leftZ ; double upnZ = dirX * leftY - dirY * leftX ; m00 = leftX ; m01 = upnX ; m02 = dirX ; m10 = leftY ; m11 = upnY ; m12 = dirY ; m20 = leftZ ; m21 = upnZ ; m22 = dirZ ; return this ;
public class ForkJoinTask { /** * Reconstitutes this task from a stream ( that is , deserializes it ) . */ private void readObject ( java . io . ObjectInputStream s ) throws java . io . IOException , ClassNotFoundException { } }
s . defaultReadObject ( ) ; Object ex = s . readObject ( ) ; if ( ex != null ) setExceptionalCompletion ( ( Throwable ) ex ) ;
public class CcgParse { /** * Gets the logical forms for every subspan of this parse tree . * Many of the returned logical forms combine with each other * during the parse of the sentence . * @ return */ public List < SpannedExpression > getSpannedLogicalForms ( ) { } }
List < SpannedExpression > spannedExpressions = Lists . newArrayList ( ) ; getSpannedLogicalFormsHelper ( spannedExpressions ) ; return spannedExpressions ;
public class SpelExpression { /** * { @ inheritDoc } */ public T evaluate ( Object target , Map < String , Object > variables ) { } }
Expression expression = getParsedExpression ( ) ; context . setRootObject ( target ) ; if ( variables != null ) { context . setVariables ( variables ) ; } try { return ( T ) expression . getValue ( context ) ; } catch ( EvaluationException e ) { throw new RuntimeException ( e ) ; }
public class DirectionUtil { /** * Returns which of the sixteen compass directions that point < code > b < / code > lies in from * point < code > a < / code > as one of the { @ link DirectionCodes } direction constants . * < em > Note : < / em > that the coordinates supplied are assumed to be logical ( screen ) rather than * cartesian coordinates and < code > NORTH < / code > is considered to point toward the top of the * screen . */ public static int getFineDirection ( int ax , int ay , int bx , int by ) { } }
return getFineDirection ( Math . atan2 ( by - ay , bx - ax ) ) ;
public class NonRecycleableTaglibs { /** * implements the visitor to record storing of fields , and where they occur * @ param seen * the currently parsed opcode */ @ Override public void sawOpcode ( int seen ) { } }
if ( seen == Const . PUTFIELD ) { QMethod methodInfo = new QMethod ( getMethodName ( ) , getMethodSig ( ) ) ; Map < Map . Entry < String , String > , SourceLineAnnotation > fields = methodWrites . get ( methodInfo ) ; if ( fields == null ) { fields = new HashMap < > ( ) ; methodWrites . put ( methodInfo , fields ) ; } String fieldName = getNameConstantOperand ( ) ; String fieldSig = getSigConstantOperand ( ) ; FieldAnnotation fa = new FieldAnnotation ( getDottedClassName ( ) , fieldName , fieldSig , false ) ; fieldAnnotations . put ( fieldName , fa ) ; fields . put ( new AbstractMap . SimpleImmutableEntry ( fieldName , fieldSig ) , SourceLineAnnotation . fromVisitedInstruction ( this ) ) ; }
public class ApiOvhEmaildomain { /** * Create new filter for account * REST : POST / email / domain / delegatedAccount / { email } / filter * @ param value [ required ] Rule parameter of filter * @ param action [ required ] Action of filter * @ param actionParam [ required ] Action parameter of filter * @ param priority [ required ] Priority of filter * @ param operand [ required ] Rule of filter * @ param header [ required ] Header to be filtered * @ param active [ required ] If true filter is active * @ param name [ required ] Filter name * @ param email [ required ] Email */ public OvhTaskFilter delegatedAccount_email_filter_POST ( String email , OvhDomainFilterActionEnum action , String actionParam , Boolean active , String header , String name , OvhDomainFilterOperandEnum operand , Long priority , String value ) throws IOException { } }
String qPath = "/email/domain/delegatedAccount/{email}/filter" ; StringBuilder sb = path ( qPath , email ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "action" , action ) ; addBody ( o , "actionParam" , actionParam ) ; addBody ( o , "active" , active ) ; addBody ( o , "header" , header ) ; addBody ( o , "name" , name ) ; addBody ( o , "operand" , operand ) ; addBody ( o , "priority" , priority ) ; addBody ( o , "value" , value ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhTaskFilter . class ) ;
public class ManagementModule { /** * { @ inheritDoc } */ @ Override public Datastream getDatastream ( Context context , String pid , String datastreamID , Date asOfDateTime ) throws ServerException { } }
return mgmt . getDatastream ( context , pid , datastreamID , asOfDateTime ) ;
public class MongoDBCollection { /** * Bulk remove */ public QueryResult < BulkWriteResult > remove ( List < ? extends Bson > query , QueryOptions options ) { } }
long start = startQuery ( ) ; boolean multi = false ; if ( options != null ) { multi = options . getBoolean ( MULTI ) ; } com . mongodb . bulk . BulkWriteResult wr = mongoDBNativeQuery . remove ( query , multi ) ; QueryResult < BulkWriteResult > queryResult = endQuery ( Arrays . asList ( wr ) , start ) ; return queryResult ;
public class CmsVfsDriver { /** * Updates the offline version numbers . < p > * @ param dbc the current database context * @ param resource the resource to update the version number for * @ throws CmsDataAccessException if something goes wrong */ protected void internalUpdateVersions ( CmsDbContext dbc , CmsResource resource ) throws CmsDataAccessException { } }
if ( dbc . getRequestContext ( ) == null ) { // no needed during initialization return ; } if ( dbc . currentProject ( ) . isOnlineProject ( ) ) { // this method is supposed to be used only in the offline project return ; } // read the online version numbers Map < String , Integer > onlineVersions = readVersions ( dbc , CmsProject . ONLINE_PROJECT_ID , resource . getResourceId ( ) , resource . getStructureId ( ) ) ; int onlineStructureVersion = onlineVersions . get ( "structure" ) . intValue ( ) ; int onlineResourceVersion = onlineVersions . get ( "resource" ) . intValue ( ) ; Connection conn = null ; PreparedStatement stmt = null ; ResultSet res = null ; try { conn = m_sqlManager . getConnection ( dbc ) ; // update the resource version stmt = m_sqlManager . getPreparedStatement ( conn , dbc . currentProject ( ) , "C_RESOURCES_UPDATE_RESOURCE_VERSION" ) ; stmt . setInt ( 1 , onlineResourceVersion ) ; stmt . setString ( 2 , resource . getResourceId ( ) . toString ( ) ) ; stmt . executeUpdate ( ) ; m_sqlManager . closeAll ( dbc , null , stmt , null ) ; // update the structure version stmt = m_sqlManager . getPreparedStatement ( conn , dbc . currentProject ( ) , "C_RESOURCES_UPDATE_STRUCTURE_VERSION" ) ; stmt . setInt ( 1 , onlineStructureVersion ) ; stmt . setString ( 2 , resource . getStructureId ( ) . toString ( ) ) ; stmt . executeUpdate ( ) ; m_sqlManager . closeAll ( dbc , null , stmt , null ) ; } catch ( SQLException e ) { throw new CmsDbSqlException ( Messages . get ( ) . container ( Messages . ERR_GENERIC_SQL_1 , CmsDbSqlException . getErrorQuery ( stmt ) ) , e ) ; } finally { m_sqlManager . closeAll ( dbc , conn , stmt , res ) ; }
public class Stream { /** * Collects elements to { @ code supplier } provided container by applying the given accumulation function . * < p > This is a terminal operation . * @ param < R > the type of the result * @ param supplier the supplier function that provides container * @ param accumulator the accumulation function * @ return the result of collect elements * @ see # collect ( com . annimon . stream . Collector ) */ @ Nullable public < R > R collect ( @ NotNull Supplier < R > supplier , @ NotNull BiConsumer < R , ? super T > accumulator ) { } }
final R result = supplier . get ( ) ; while ( iterator . hasNext ( ) ) { final T value = iterator . next ( ) ; accumulator . accept ( result , value ) ; } return result ;
public class Excel07SaxReader { /** * s标签结束的回调处理方法 */ @ Override public void characters ( char [ ] ch , int start , int length ) throws SAXException { } }
// 得到单元格内容的值 lastContent = lastContent . concat ( new String ( ch , start , length ) ) ;
public class ProjectTask { /** * GetDetailChildren Method . */ public ProjectTask getDetailChildren ( ) { } }
if ( m_recDetailChildren == null ) { RecordOwner recordOwner = this . getRecordOwner ( ) ; m_recDetailChildren = new ProjectTask ( recordOwner ) ; if ( recordOwner != null ) recordOwner . removeRecord ( m_recDetailChildren ) ; m_recDetailChildren . addListener ( new SubFileFilter ( this , true ) ) ; } return m_recDetailChildren ;
public class BoxWebHookSignatureVerifier { /** * Calculates signature for a provided information . * @ param algorithm * for which algorithm * @ param key * used by signing * @ param webHookPayload * for singing * @ param deliveryTimestamp * for signing * @ return calculated signature */ public String sign ( BoxSignatureAlgorithm algorithm , String key , String webHookPayload , String deliveryTimestamp ) { } }
return Base64 . encode ( this . signRaw ( algorithm , key , webHookPayload , deliveryTimestamp ) ) ;
public class EnableStreamingTaskParameters { /** * Parses properties from task parameter string * @ param taskParameters - JSON formatted set of parameters */ public static EnableStreamingTaskParameters deserialize ( String taskParameters ) { } }
JaxbJsonSerializer < EnableStreamingTaskParameters > serializer = new JaxbJsonSerializer < > ( EnableStreamingTaskParameters . class ) ; try { EnableStreamingTaskParameters params = serializer . deserialize ( taskParameters ) ; // Verify expected parameters if ( null == params . getSpaceId ( ) || params . getSpaceId ( ) . isEmpty ( ) ) { throw new TaskDataException ( "Task parameter values may not be empty" ) ; } return params ; } catch ( IOException e ) { throw new TaskDataException ( "Unable to parse task parameters due to: " + e . getMessage ( ) ) ; }
public class Buckets { /** * For each value , search the appropriate bucket and add the value in it . */ public void addValues ( Collection < Long > values ) { } }
synchronized ( buckets ) { for ( Long value : values ) { addValue ( value ) ; } }
public class MetaDataWriteOperation { /** * / * ( non - Javadoc ) * @ see net . timewalker . ffmq4 . storage . data . impl . journal . AbstractJournalOperation # writeTo ( net . timewalker . ffmq4 . storage . data . impl . journal . JournalFile ) */ @ Override protected void writeTo ( JournalFile journalFile ) throws JournalException { } }
super . writeTo ( journalFile ) ; journalFile . writeInt ( metaData ) ;
public class AbstractCommand { /** * Returns an iterator over < em > all < / em > buttons by traversing * < em > each < / em > { @ link CommandFaceButtonManager } . */ protected final Iterator buttonIterator ( ) { } }
if ( this . faceButtonManagers == null ) return Collections . EMPTY_SET . iterator ( ) ; return new NestedButtonIterator ( this . faceButtonManagers . values ( ) . iterator ( ) ) ;
public class LObjFltFunctionBuilder { /** * One of ways of creating builder . This might be the only way ( considering all _ functional _ builders ) that might be utilize to specify generic params only once . */ @ Nonnull public static < T , R > LObjFltFunctionBuilder < T , R > objFltFunction ( Consumer < LObjFltFunction < T , R > > consumer ) { } }
return new LObjFltFunctionBuilder ( consumer ) ;
public class ComponentFactoryDecorator { /** * { @ inheritDoc } */ @ Override public JLabel createLabel ( String labelKey , ValueModel [ ] argumentValueHolders ) { } }
return this . getDecoratedComponentFactory ( ) . createLabel ( labelKey , argumentValueHolders ) ;
public class PullerInternal { /** * Fetches the contents of a revision from the remote db , including its parent revision ID . * The contents are stored into rev . properties . */ @ InterfaceAudience . Private public void pullRemoteRevision ( final RevisionInternal rev ) { } }
Log . d ( TAG , "%s: pullRemoteRevision with rev: %s" , this , rev ) ; ++ httpConnectionCount ; // Construct a query . We want the revision history , and the bodies of attachments that have // been added since the latest revisions we have locally . // See : http : / / wiki . apache . org / couchdb / HTTP _ Document _ API # Getting _ Attachments _ With _ a _ Document StringBuilder path = new StringBuilder ( encodeDocumentId ( rev . getDocID ( ) ) ) ; path . append ( "?rev=" ) . append ( URIUtils . encode ( rev . getRevID ( ) ) ) ; path . append ( "&revs=true" ) ; // TODO : CBL Java does not have implementation of _ settings yet . Till then , attachments always true boolean attachments = true ; if ( attachments ) path . append ( "&attachments=true" ) ; // Include atts _ since with a list of possible ancestor revisions of rev . If getting attachments , // this allows the server to skip the bodies of attachments that have not changed since the // local ancestor . The server can also trim the revision history it returns , to not extend past // the local ancestor ( not implemented yet in SG but will be soon . ) AtomicBoolean haveBodies = new AtomicBoolean ( false ) ; List < String > possibleAncestors = null ; possibleAncestors = db . getPossibleAncestorRevisionIDs ( rev , PullerInternal . MAX_NUMBER_OF_ATTS_SINCE , attachments ? haveBodies : null , true ) ; if ( possibleAncestors != null ) { path . append ( haveBodies . get ( ) ? "&atts_since=" : "&revs_from=" ) ; path . append ( joinQuotedEscaped ( possibleAncestors ) ) ; } else { int maxRevTreeDepth = getLocalDatabase ( ) . getMaxRevTreeDepth ( ) ; if ( rev . getGeneration ( ) > maxRevTreeDepth ) { path . append ( "&revs_limit=" ) ; path . append ( maxRevTreeDepth ) ; } } // create a final version of this variable for the log statement inside // FIXME find a way to avoid this final String pathInside = path . toString ( ) ; CustomFuture future = sendAsyncMultipartDownloaderRequest ( "GET" , pathInside , null , db , new RemoteRequestCompletion ( ) { @ Override public void onCompletion ( RemoteRequest remoteRequest , Response httpResponse , Object result , Throwable e ) { if ( e != null ) { Log . w ( TAG , "Error pulling remote revision: %s" , e , this ) ; if ( Utils . isDocumentError ( e ) ) { // Revision is missing or not accessible : revisionFailed ( rev , e ) ; } else { // Request failed : setError ( e ) ; } } else { Map < String , Object > properties = ( Map < String , Object > ) result ; long size = 0 ; if ( httpResponse != null && httpResponse . body ( ) != null ) size = httpResponse . body ( ) . contentLength ( ) ; PulledRevision gotRev = new PulledRevision ( properties , size ) ; gotRev . setSequence ( rev . getSequence ( ) ) ; Log . d ( TAG , "%s: pullRemoteRevision add rev: %s to batcher: %s" , PullerInternal . this , gotRev , downloadsToInsert ) ; // NOTE : should not / not necessary to call Body . compact ( ) // new PulledRevision ( Map < string , Object > ) creates Body instance only // with ` object ` . Serializing object to json causes two unnecessary // JSON serializations . if ( gotRev . getBody ( ) != null ) queuedMemorySize . addAndGet ( gotRev . getBody ( ) . getSize ( ) ) ; // Add to batcher . . . eventually it will be fed to - insertRevisions : . downloadsToInsert . queueObject ( gotRev ) ; // if queue memory size is more than maximum , force flush the queue . if ( queuedMemorySize . get ( ) > MAX_QUEUE_MEMORY_SIZE ) { Log . d ( TAG , "Flushing queued memory size at: " + queuedMemorySize ) ; downloadsToInsert . flushAllAndWait ( ) ; } } // Note that we ' ve finished this task : -- httpConnectionCount ; // Start another task if there are still revisions waiting to be pulled : pullRemoteRevisions ( ) ; } } ) ; future . setQueue ( pendingFutures ) ; pendingFutures . add ( future ) ;
public class UrlEncoded { /** * Encode MultiMap with % encoding . * @ param map the map to encode * @ param charset the charset to use for encoding ( uses default encoding if null ) * @ param equalsForNullValue if True , then an ' = ' is always used , even * for parameters without a value . e . g . < code > " blah ? a = & amp ; b = & amp ; c = " < / code > . * @ return the MultiMap as a string encoded with % encodings . */ public static String encode ( MultiMap < String > map , Charset charset , boolean equalsForNullValue ) { } }
if ( charset == null ) charset = ENCODING ; StringBuilder result = new StringBuilder ( 128 ) ; boolean delim = false ; for ( Map . Entry < String , List < String > > entry : map . entrySet ( ) ) { String key = entry . getKey ( ) ; List < String > list = entry . getValue ( ) ; int s = list . size ( ) ; if ( delim ) { result . append ( '&' ) ; } if ( s == 0 ) { result . append ( encodeString ( key , charset ) ) ; if ( equalsForNullValue ) result . append ( '=' ) ; } else { for ( int i = 0 ; i < s ; i ++ ) { if ( i > 0 ) result . append ( '&' ) ; String val = list . get ( i ) ; result . append ( encodeString ( key , charset ) ) ; if ( val != null ) { if ( val . length ( ) > 0 ) { result . append ( '=' ) ; result . append ( encodeString ( val , charset ) ) ; } else if ( equalsForNullValue ) result . append ( '=' ) ; } else if ( equalsForNullValue ) result . append ( '=' ) ; } } delim = true ; } return result . toString ( ) ;
public class AwsSecurityFindingFilters { /** * An ISO8601 - formatted timestamp that indicates when the potential security issue captured by a finding was most * recently observed by the security findings provider . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setLastObservedAt ( java . util . Collection ) } or { @ link # withLastObservedAt ( java . util . Collection ) } if you want * to override the existing values . * @ param lastObservedAt * An ISO8601 - formatted timestamp that indicates when the potential security issue captured by a finding was * most recently observed by the security findings provider . * @ return Returns a reference to this object so that method calls can be chained together . */ public AwsSecurityFindingFilters withLastObservedAt ( DateFilter ... lastObservedAt ) { } }
if ( this . lastObservedAt == null ) { setLastObservedAt ( new java . util . ArrayList < DateFilter > ( lastObservedAt . length ) ) ; } for ( DateFilter ele : lastObservedAt ) { this . lastObservedAt . add ( ele ) ; } return this ;
public class FileTag { /** * read source file * @ throws PageException */ private void actionRead ( boolean isBinary ) throws PageException { } }
if ( variable == null ) throw new ApplicationException ( "attribute variable is not defined for tag file" ) ; // check if we can use cache if ( StringUtil . isEmpty ( cachedWithin ) ) { Object tmp = ( ( PageContextImpl ) pageContext ) . getCachedWithin ( ConfigWeb . CACHEDWITHIN_FILE ) ; if ( tmp != null ) setCachedwithin ( tmp ) ; } String cacheId = createCacheId ( isBinary ) ; CacheHandler cacheHandler = null ; if ( cachedWithin != null ) { cacheHandler = pageContext . getConfig ( ) . getCacheHandlerCollection ( Config . CACHE_TYPE_FILE , null ) . getInstanceMatchingObject ( cachedWithin , null ) ; if ( cacheHandler instanceof CacheHandlerPro ) { CacheItem cacheItem = ( ( CacheHandlerPro ) cacheHandler ) . get ( pageContext , cacheId , cachedWithin ) ; if ( cacheItem instanceof FileCacheItem ) { pageContext . setVariable ( variable , ( ( FileCacheItem ) cacheItem ) . getData ( ) ) ; return ; } } else if ( cacheHandler != null ) { // TODO this else block can be removed when all cache handlers implement CacheHandlerPro CacheItem cacheItem = cacheHandler . get ( pageContext , cacheId ) ; if ( cacheItem instanceof FileCacheItem ) { pageContext . setVariable ( variable , ( ( FileCacheItem ) cacheItem ) . getData ( ) ) ; return ; } } } // cache not found , process and cache result if needed checkFile ( pageContext , securityManager , file , serverPassword , false , false , true , false ) ; try { long start = System . nanoTime ( ) ; Object data = isBinary ? IOUtil . toBytes ( file ) : IOUtil . toString ( file , CharsetUtil . toCharset ( charset ) ) ; pageContext . setVariable ( variable , data ) ; if ( cacheHandler != null ) cacheHandler . set ( pageContext , cacheId , cachedWithin , FileCacheItem . getInstance ( file . getAbsolutePath ( ) , data , System . nanoTime ( ) - start ) ) ; } catch ( IOException e ) { throw new ApplicationException ( "can't read file [" + file . toString ( ) + "]" , e . getMessage ( ) ) ; }
public class SegmentedJournal { /** * Resets the current segment , creating a new segment if necessary . */ private synchronized void resetCurrentSegment ( ) { } }
JournalSegment < E > lastSegment = getLastSegment ( ) ; if ( lastSegment != null ) { currentSegment = lastSegment ; } else { JournalSegmentDescriptor descriptor = JournalSegmentDescriptor . builder ( ) . withId ( 1 ) . withIndex ( 1 ) . withMaxSegmentSize ( maxSegmentSize ) . withMaxEntries ( maxEntriesPerSegment ) . build ( ) ; currentSegment = createSegment ( descriptor ) ; segments . put ( 1L , currentSegment ) ; }
public class CmsDialog { /** * Builds the necessary button row . < p > * @ return the button row */ public String dialogLockButtons ( ) { } }
StringBuffer html = new StringBuffer ( 512 ) ; html . append ( "<div id='butClose' >\n" ) ; html . append ( dialogButtonsClose ( ) ) ; html . append ( "</div>\n" ) ; html . append ( "<div id='butContinue' class='hide' >\n" ) ; html . append ( dialogButtons ( new int [ ] { BUTTON_CONTINUE , BUTTON_CANCEL } , new String [ ] { " onclick=\"submitAction('" + DIALOG_OK + "', form); form.submit();\"" , "" } ) ) ; html . append ( "</div>\n" ) ; return html . toString ( ) ;
public class ZoneOffset { /** * Obtains an instance of { @ code ZoneOffset } using the ID . * This method parses the string ID of a { @ code ZoneOffset } to * return an instance . The parsing accepts all the formats generated by * { @ link # getId ( ) } , plus some additional formats : * < ul > * < li > { @ code Z } - for UTC * < li > { @ code + h } * < li > { @ code + hh } * < li > { @ code + hh : mm } * < li > { @ code - hh : mm } * < li > { @ code + hhmm } * < li > { @ code - hhmm } * < li > { @ code + hh : mm : ss } * < li > { @ code - hh : mm : ss } * < li > { @ code + hhmmss } * < li > { @ code - hhmmss } * < / ul > * Note that & plusmn ; means either the plus or minus symbol . * The ID of the returned offset will be normalized to one of the formats * described by { @ link # getId ( ) } . * The maximum supported range is from + 18:00 to - 18:00 inclusive . * @ param offsetId the offset ID , not null * @ return the zone - offset , not null * @ throws DateTimeException if the offset ID is invalid */ @ SuppressWarnings ( "fallthrough" ) public static ZoneOffset of ( String offsetId ) { } }
Objects . requireNonNull ( offsetId , "offsetId" ) ; // " Z " is always in the cache ZoneOffset offset = ID_CACHE . get ( offsetId ) ; if ( offset != null ) { return offset ; } // parse - + h , + hh , + hhmm , + hh : mm , + hhmmss , + hh : mm : ss final int hours , minutes , seconds ; switch ( offsetId . length ( ) ) { case 2 : offsetId = offsetId . charAt ( 0 ) + "0" + offsetId . charAt ( 1 ) ; // fallthru case 3 : hours = parseNumber ( offsetId , 1 , false ) ; minutes = 0 ; seconds = 0 ; break ; case 5 : hours = parseNumber ( offsetId , 1 , false ) ; minutes = parseNumber ( offsetId , 3 , false ) ; seconds = 0 ; break ; case 6 : hours = parseNumber ( offsetId , 1 , false ) ; minutes = parseNumber ( offsetId , 4 , true ) ; seconds = 0 ; break ; case 7 : hours = parseNumber ( offsetId , 1 , false ) ; minutes = parseNumber ( offsetId , 3 , false ) ; seconds = parseNumber ( offsetId , 5 , false ) ; break ; case 9 : hours = parseNumber ( offsetId , 1 , false ) ; minutes = parseNumber ( offsetId , 4 , true ) ; seconds = parseNumber ( offsetId , 7 , true ) ; break ; default : throw new DateTimeException ( "Invalid ID for ZoneOffset, invalid format: " + offsetId ) ; } char first = offsetId . charAt ( 0 ) ; if ( first != '+' && first != '-' ) { throw new DateTimeException ( "Invalid ID for ZoneOffset, plus/minus not found when expected: " + offsetId ) ; } if ( first == '-' ) { return ofHoursMinutesSeconds ( - hours , - minutes , - seconds ) ; } else { return ofHoursMinutesSeconds ( hours , minutes , seconds ) ; }
public class HtmlElementUtils { /** * Parses locator string to identify the proper By subclass before calling Selenium * { @ link WebElement # findElements ( By ) } to locate the web elements nested within the parent web . * @ param locator * String that represents the means to locate this element ( could be id / name / xpath / css locator ) . * @ param parent * { @ link ParentTraits } object that represents the parent element for this element . * @ return { @ link WebElement } list that represents the html elements that was located using the locator provided . */ public static List < WebElement > locateElements ( String locator , ParentTraits parent ) { } }
logger . entering ( new Object [ ] { locator , parent } ) ; Preconditions . checkArgument ( StringUtils . isNotBlank ( locator ) , INVALID_LOCATOR_ERR_MSG ) ; Preconditions . checkArgument ( parent != null , INVALID_PARENT_ERR_MSG ) ; List < WebElement > webElementsFound = parent . locateChildElements ( locator ) ; // if element is empty list then throw exception since unlike // findElement ( ) findElements ( ) always returns a list // irrespective of whether an element was found or not if ( webElementsFound . isEmpty ( ) ) { throw new NoSuchElementException ( "Cannot locate any element using [" + locator + "]" ) ; } logger . exiting ( webElementsFound ) ; return webElementsFound ;
public class IdResource { /** * Get a new ID and handle any thrown exceptions * @ param agent * User Agent * @ return generated ID * @ throws SnowizardException */ public long getId ( final String agent ) { } }
try { return worker . getId ( agent ) ; } catch ( final InvalidUserAgentError e ) { LOGGER . error ( "Invalid user agent ({})" , agent ) ; throw new SnowizardException ( Response . Status . BAD_REQUEST , "Invalid User-Agent header" , e ) ; } catch ( final InvalidSystemClock e ) { LOGGER . error ( "Invalid system clock" , e ) ; throw new SnowizardException ( Response . Status . INTERNAL_SERVER_ERROR , e . getMessage ( ) , e ) ; }
public class CFFFontSubset { /** * Read the FDArray count , offsize and Offset array * @ param Font */ protected void ReadFDArray ( int Font ) { } }
seek ( fonts [ Font ] . fdarrayOffset ) ; fonts [ Font ] . FDArrayCount = getCard16 ( ) ; fonts [ Font ] . FDArrayOffsize = getCard8 ( ) ; // Since we will change values inside the FDArray objects // We increase its offsize to prevent errors if ( fonts [ Font ] . FDArrayOffsize < 4 ) fonts [ Font ] . FDArrayOffsize ++ ; fonts [ Font ] . FDArrayOffsets = getIndex ( fonts [ Font ] . fdarrayOffset ) ;
public class WorkbinsApi { /** * Unsubscribe to the notifications of changes of the content of a Workbin . * @ param workbinId Id of the Workbin ( required ) * @ param unsubscribeToWorkbinNotificationsData ( required ) * @ return ApiResponse & lt ; ApiSuccessResponse & gt ; * @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */ public ApiResponse < ApiSuccessResponse > unsubscribeToWorkbinNotificationsWithHttpInfo ( String workbinId , UnsubscribeToWorkbinNotificationsData unsubscribeToWorkbinNotificationsData ) throws ApiException { } }
com . squareup . okhttp . Call call = unsubscribeToWorkbinNotificationsValidateBeforeCall ( workbinId , unsubscribeToWorkbinNotificationsData , null , null ) ; Type localVarReturnType = new TypeToken < ApiSuccessResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ;
public class AmazonElasticLoadBalancingClient { /** * Creates a rule for the specified listener . The listener must be associated with an Application Load Balancer . * Rules are evaluated in priority order , from the lowest value to the highest value . When the conditions for a rule * are met , its actions are performed . If the conditions for no rules are met , the actions for the default rule are * performed . For more information , see < a href = * " https : / / docs . aws . amazon . com / elasticloadbalancing / latest / application / load - balancer - listeners . html # listener - rules " * > Listener Rules < / a > in the < i > Application Load Balancers Guide < / i > . * To view your current rules , use < a > DescribeRules < / a > . To update a rule , use < a > ModifyRule < / a > . To set the * priorities of your rules , use < a > SetRulePriorities < / a > . To delete a rule , use < a > DeleteRule < / a > . * @ param createRuleRequest * @ return Result of the CreateRule operation returned by the service . * @ throws PriorityInUseException * The specified priority is in use . * @ throws TooManyTargetGroupsException * You ' ve reached the limit on the number of target groups for your AWS account . * @ throws TooManyRulesException * You ' ve reached the limit on the number of rules per load balancer . * @ throws TargetGroupAssociationLimitException * You ' ve reached the limit on the number of load balancers per target group . * @ throws IncompatibleProtocolsException * The specified configuration is not valid with this protocol . * @ throws ListenerNotFoundException * The specified listener does not exist . * @ throws TargetGroupNotFoundException * The specified target group does not exist . * @ throws InvalidConfigurationRequestException * The requested configuration is not valid . * @ throws TooManyRegistrationsForTargetIdException * You ' ve reached the limit on the number of times a target can be registered with a load balancer . * @ throws TooManyTargetsException * You ' ve reached the limit on the number of targets . * @ throws UnsupportedProtocolException * The specified protocol is not supported . * @ throws TooManyActionsException * You ' ve reached the limit on the number of actions per rule . * @ throws InvalidLoadBalancerActionException * The requested action is not valid . * @ sample AmazonElasticLoadBalancing . CreateRule * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / elasticloadbalancingv2-2015-12-01 / CreateRule " * target = " _ top " > AWS API Documentation < / a > */ @ Override public CreateRuleResult createRule ( CreateRuleRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeCreateRule ( request ) ;
public class MaterialCheckBox { /** * Setting the type of Checkbox . */ public void setType ( CheckBoxType type ) { } }
this . type = type ; switch ( type ) { case FILLED : Element input = DOM . getChild ( getElement ( ) , 0 ) ; input . setAttribute ( "class" , CssName . FILLED_IN ) ; break ; case INTERMEDIATE : addStyleName ( type . getCssName ( ) + "-checkbox" ) ; break ; default : addStyleName ( type . getCssName ( ) ) ; break ; }
public class GeoInterface { /** * Return a list of photos for a user at a specific latitude , longitude and accuracy . * @ param location * @ param extras * @ param perPage * @ param page * @ return The collection of Photo objects * @ throws FlickrException * @ see com . flickr4java . flickr . photos . Extras */ public PhotoList < Photo > photosForLocation ( GeoData location , Set < String > extras , int perPage , int page ) throws FlickrException { } }
Map < String , Object > parameters = new HashMap < String , Object > ( ) ; PhotoList < Photo > photos = new PhotoList < Photo > ( ) ; parameters . put ( "method" , METHOD_PHOTOS_FOR_LOCATION ) ; if ( extras . size ( ) > 0 ) { parameters . put ( "extras" , StringUtilities . join ( extras , "," ) ) ; } if ( perPage > 0 ) { parameters . put ( "per_page" , Integer . toString ( perPage ) ) ; } if ( page > 0 ) { parameters . put ( "page" , Integer . toString ( page ) ) ; } parameters . put ( "lat" , Float . toString ( location . getLatitude ( ) ) ) ; parameters . put ( "lon" , Float . toString ( location . getLongitude ( ) ) ) ; parameters . put ( "accuracy" , Integer . toString ( location . getAccuracy ( ) ) ) ; Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photosElement = response . getPayload ( ) ; photos . setPage ( photosElement . getAttribute ( "page" ) ) ; photos . setPages ( photosElement . getAttribute ( "pages" ) ) ; photos . setPerPage ( photosElement . getAttribute ( "perpage" ) ) ; photos . setTotal ( photosElement . getAttribute ( "total" ) ) ; NodeList photoElements = photosElement . getElementsByTagName ( "photo" ) ; for ( int i = 0 ; i < photoElements . getLength ( ) ; i ++ ) { Element photoElement = ( Element ) photoElements . item ( i ) ; photos . add ( PhotoUtils . createPhoto ( photoElement ) ) ; } return photos ;
public class StringUtils { /** * Convert all the first letter of the words of target to uppercase * ( title - case , in fact ) , using the specified delimiter chars for determining * word ends / starts . * @ param target the String to be capitalized . If non - String object , toString ( ) * will be called . * @ param delimiters delimiters of the words . If non - String object , toString ( ) * will be called . * @ return String the result of capitalizing the target . * @ since 1.1.2 */ public static String capitalizeWords ( final Object target , final Object delimiters ) { } }
if ( target == null ) { return null ; } final char [ ] buffer = target . toString ( ) . toCharArray ( ) ; final char [ ] delimiterChars = ( delimiters == null ? null : delimiters . toString ( ) . toCharArray ( ) ) ; if ( delimiterChars != null ) { // needed in order to use binarySearch Arrays . sort ( delimiterChars ) ; } int idx = 0 ; idx = findNextWord ( buffer , idx , delimiterChars ) ; while ( idx != - 1 ) { buffer [ idx ] = Character . toTitleCase ( buffer [ idx ] ) ; idx ++ ; idx = findNextWord ( buffer , idx , delimiterChars ) ; } return new String ( buffer ) ;
public class Index { /** * Adds a new { @ link Analyzer } . * @ param name the name of the { @ link Analyzer } to be added * @ param analyzer the { @ link Analyzer } to be added * @ return this with the specified analyzer */ public Index analyzer ( String name , Analyzer analyzer ) { } }
schema . analyzer ( name , analyzer ) ; return this ;
public class ScheduledExecutorContainer { /** * State is published after every run . * When replicas get promoted , they start with the latest state . */ void publishTaskState ( String taskName , Map stateSnapshot , ScheduledTaskStatisticsImpl statsSnapshot , ScheduledTaskResult result ) { } }
if ( logger . isFinestEnabled ( ) ) { log ( FINEST , "Publishing state, to replicas. State: " + stateSnapshot ) ; } Operation op = new SyncStateOperation ( getName ( ) , taskName , stateSnapshot , statsSnapshot , result ) ; createInvocationBuilder ( op ) . invoke ( ) . join ( ) ;
public class MessageRetriever { /** * Print a message . * @ param pos the position of the source * @ param key selects message from resource * @ param args arguments to be replaced in the message . */ public void notice ( SourcePosition pos , String key , Object ... args ) { } }
printNotice ( pos , getText ( key , args ) ) ;
public class MockAgentPlan { /** * Method to send Request messages to a specific df _ service * @ param df _ service * The name of the df _ service * @ param msgContent * The content of the message to be sent * @ return Message sent to + the name of the df _ service */ protected String sendRequestToDF ( String df_service , Object msgContent ) { } }
IDFComponentDescription [ ] receivers = getReceivers ( df_service ) ; if ( receivers . length > 0 ) { IMessageEvent mevent = createMessageEvent ( "send_request" ) ; mevent . getParameter ( SFipa . CONTENT ) . setValue ( msgContent ) ; for ( int i = 0 ; i < receivers . length ; i ++ ) { mevent . getParameterSet ( SFipa . RECEIVERS ) . addValue ( receivers [ i ] . getName ( ) ) ; logger . info ( "The receiver is " + receivers [ i ] . getName ( ) ) ; } sendMessage ( mevent ) ; } logger . info ( "Message sended to " + df_service + " to " + receivers . length + " receivers" ) ; return ( "Message sended to " + df_service ) ;
public class FacebookRestClient { /** * Sets the FBML for a profile box on the logged - in user ' s profile . * @ param fbmlMarkup refer to the FBML documentation for a description of the markup and its role in various contexts * @ return a boolean indicating whether the FBML was successfully set * @ see < a href = " http : / / wiki . developers . facebook . com / index . php / Profile . setFBML " > * Developers wiki : Profile . setFbml < / a > */ public boolean profile_setProfileFBML ( CharSequence fbmlMarkup ) throws FacebookException , IOException { } }
return profile_setFBML ( fbmlMarkup , /* profileActionFbmlMarkup */ null , /* mobileFbmlMarkup */ null , /* profileId */ null ) ;
public class AstyanaxEventId { /** * Computes a 16 - bit checksum of the contents of the specific ByteBuffer and channel name . */ private static int computeChecksum ( byte [ ] buf , int offset , int length , String channel ) { } }
Hasher hasher = Hashing . murmur3_32 ( ) . newHasher ( ) ; hasher . putBytes ( buf , offset , length ) ; hasher . putUnencodedChars ( channel ) ; return hasher . hash ( ) . asInt ( ) & 0xffff ;