signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class SystemServlet { /** * setup of the servlet operation set for this servlet instance */ @ Override public void init ( ) throws ServletException { } }
super . init ( ) ; // GET operations . setOperation ( ServletOperationSet . Method . GET , Extension . json , Operation . propertyTypes , new GetPropertyTypes ( ) ) ; operations . setOperation ( ServletOperationSet . Method . GET , Extension . json , Operation . primaryTypes , new GetPrimaryTypes ( ) ) ; operations . s...
public class ApptentiveNestedScrollView { /** * < p > Scrolls the view to make the area defined by < code > top < / code > and * < code > bottom < / code > visible . This method attempts to give the focus * to a component visible in this area . If no component can be focused in * the new visible area , the focus ...
boolean handled = true ; int height = getHeight ( ) ; int containerTop = getScrollY ( ) ; int containerBottom = containerTop + height ; boolean up = direction == View . FOCUS_UP ; View newFocused = findFocusableViewInBounds ( up , top , bottom ) ; if ( newFocused == null ) { newFocused = this ; } if ( top >= containerT...
public class ServiceValidationViewFactory { /** * Register view . * @ param ownerClass the owner class * @ param view the view */ public void registerView ( final Class ownerClass , final Pair < View , View > view ) { } }
registerView ( ownerClass . getSimpleName ( ) , view ) ;
public class DefaultApplicationObjectConfigurer { /** * Sets the image of the given object . The image is loaded from this * instance ' s { @ link ImageSource } using a key in the format * < pre > * & lt ; objectName & gt ; . image * < / pre > * If the image source cannot find an image under that key , the ob...
Assert . notNull ( configurable , "configurable" ) ; Assert . notNull ( objectName , "objectName" ) ; Image image = loadImage ( objectName , IMAGE_KEY ) ; if ( image != null ) { configurable . setImage ( image ) ; }
public class BooleanUtils { /** * < p > Performs an xor on a set of booleans . < / p > * < pre > * BooleanUtils . xor ( true , true ) = false * BooleanUtils . xor ( false , false ) = false * BooleanUtils . xor ( true , false ) = true * < / pre > * @ param array an array of { @ code boolean } s * @ return ...
// Validates input if ( array == null ) { throw new IllegalArgumentException ( "The Array must not be null" ) ; } if ( array . length == 0 ) { throw new IllegalArgumentException ( "Array is empty" ) ; } // false if the neutral element of the xor operator boolean result = false ; for ( final boolean element : array ) { ...
public class Validate { /** * Checks if the given String is NOT a negative double value . < br > * This method tries to parse a double value and then checks if it is bigger or equal to 0. * @ param value The String value to validate . * @ return The parsed double value * @ throws ParameterException if the given...
Double doubleValue = Validate . isDouble ( value ) ; notNegative ( doubleValue ) ; return doubleValue ;
public class Options { /** * Populates data in this Options from the character stream . * @ param in The Reader * @ throws IOException If there is a problem reading data */ public void readData ( BufferedReader in ) throws IOException { } }
String line , value ; // skip old variables if still present lexOptions . readData ( in ) ; line = in . readLine ( ) ; value = line . substring ( line . indexOf ( ' ' ) + 1 ) ; try { tlpParams = ( TreebankLangParserParams ) Class . forName ( value ) . newInstance ( ) ; } catch ( Exception e ) { IOException ioe = new IO...
public class DifferenceEngine { /** * Tests whether a Node has children , taking ignoreComments * setting into account . */ private Boolean hasChildNodes ( Node n ) { } }
boolean flag = n . hasChildNodes ( ) ; if ( flag && XMLUnit . getIgnoreComments ( ) ) { List nl = nodeList2List ( n . getChildNodes ( ) ) ; flag = ! nl . isEmpty ( ) ; } return flag ? Boolean . TRUE : Boolean . FALSE ;
public class AbstractHttpTransport { /** * Returns the has conditions specified in the request as a base64 encoded * trit map of feature values where each trit ( three state value - 0 , 1 and * don ' t care ) represents the state of a feature in the list of * deendentFeatures that was sent to the client in the fe...
final String methodName = "getFeaturesFromRequestEncoded" ; // $ NON - NLS - 1 $ boolean traceLogging = log . isLoggable ( Level . FINER ) ; if ( traceLogging ) { log . entering ( sourceClass , methodName , new Object [ ] { request } ) ; } if ( depsInitialized == null ) { if ( traceLogging ) { log . finer ( "No initial...
public class FlowTypeCheck { /** * Check a given set of variable declarations are not " empty " . That is , their * declared type is not equivalent to void . * @ param decls */ private void checkNonEmpty ( Tuple < Decl . Variable > decls , LifetimeRelation lifetimes ) { } }
for ( int i = 0 ; i != decls . size ( ) ; ++ i ) { checkNonEmpty ( decls . get ( i ) , lifetimes ) ; }
public class CharacterClass { /** * / * Mmm . . what is it ? * static String stringValueC ( boolean [ ] categories ) { * StringBuffer sb = new StringBuffer ( ) ; * for ( int i = 0 ; i < categories . length ; i + + ) { * if ( ! categories [ i ] ) continue ; * String name = ( String ) unicodeCategoryNames . get...
b2 . setLength ( 0 ) ; int c = 0 ; loop : for ( ; ; ) { boolean marked = false ; for ( ; ; ) { IntBitSet marks = arr [ c >> 8 ] ; if ( marks != null && marks . get ( c & 255 ) ) break ; c ++ ; if ( c > 0xffff ) break loop ; } int first = c ; for ( ; c <= 0xffff ; ) { IntBitSet marks = arr [ c >> 8 ] ; if ( marks == nul...
public class CassandraDataHandlerBase { /** * To index thrift row . * @ param e * the e * @ param m * the m * @ param columnFamily * the column family * @ return the list */ public List < ThriftRow > toIndexThriftRow ( Object e , EntityMetadata m , String columnFamily ) { } }
List < ThriftRow > indexThriftRows = new ArrayList < ThriftRow > ( ) ; byte [ ] rowKey = getThriftColumnValue ( e , m . getIdAttribute ( ) ) ; MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( m . getPersistenceUnit ( ) ) ; // Add thrift rows for embeddables Map <...
public class AbstractSettings { /** * / * ( non - Javadoc ) * @ see nyla . solutions . core . util . Settings # getPropertyInteger ( java . lang . String ) */ @ Override public Integer getPropertyInteger ( String key ) { } }
Integer iVal = null ; String sVal = getProperty ( key ) ; if ( ( sVal != null ) && ( sVal . length ( ) > 0 ) ) { iVal = Integer . valueOf ( sVal ) ; } return iVal ;
public class DiscontinuousAnnotation { /** * setter for value - sets Annotations to be chained . * @ generated * @ param v value to set into the feature */ public void setValue ( FSArray v ) { } }
if ( DiscontinuousAnnotation_Type . featOkTst && ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeat_value == null ) jcasType . jcas . throwFeatMissing ( "value" , "de.julielab.jules.types.DiscontinuousAnnotation" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFea...
public class BundleMarshaller { /** * Marshall the given parameter object . */ public void marshall ( Bundle bundle , ProtocolMarshaller protocolMarshaller ) { } }
if ( bundle == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( bundle . getPrice ( ) , PRICE_BINDING ) ; protocolMarshaller . marshall ( bundle . getCpuCount ( ) , CPUCOUNT_BINDING ) ; protocolMarshaller . marshall ( bundle . getDiskSizeInGb...
public class EvaluatorIdlenessThreadPool { /** * Shutdown the thread pool of idleness checkers . */ @ Override public void close ( ) { } }
LOG . log ( Level . FINE , "EvaluatorIdlenessThreadPool shutdown: begin" ) ; this . executor . shutdown ( ) ; boolean isTerminated = false ; try { isTerminated = this . executor . awaitTermination ( this . waitInMillis , TimeUnit . MILLISECONDS ) ; } catch ( final InterruptedException ex ) { LOG . log ( Level . WARNING...
public class SchemaColumn { /** * Return a copy of this SchemaColumn , but with the input expression * replaced by an appropriate TupleValueExpression . * @ param colIndex */ public SchemaColumn copyAndReplaceWithTVE ( int colIndex ) { } }
TupleValueExpression newTve ; if ( m_expression instanceof TupleValueExpression ) { newTve = ( TupleValueExpression ) m_expression . clone ( ) ; newTve . setColumnIndex ( colIndex ) ; } else { newTve = new TupleValueExpression ( m_tableName , m_tableAlias , m_columnName , m_columnAlias , m_expression , colIndex ) ; } r...
public class MatFileInputStream { /** * Reads the data into a < code > { @ link ByteBuffer } < / code > . This method is * only supported for arrays with backing ByteBuffer ( < code > { @ link ByteStorageSupport } < / code > ) . * @ param dest * the destination < code > { @ link ByteBuffer } < / code > * @ para...
int bytesAllocated = storage . getBytesAllocated ( ) ; int size = elements * storage . getBytesAllocated ( ) ; // direct buffer copy if ( MatDataTypes . sizeOf ( type ) == bytesAllocated && buf . order ( ) . equals ( dest . order ( ) ) ) { int bufMaxSize = 1024 ; int bufSize = Math . min ( buf . remaining ( ) , bufMaxS...
public class GalleryImagesInner { /** * Modify properties of gallery images . * @ param resourceGroupName The name of the resource group . * @ param labAccountName The name of the lab Account . * @ param galleryImageName The name of the gallery Image . * @ param galleryImage Represents an image from the Azure M...
return ServiceFuture . fromResponse ( updateWithServiceResponseAsync ( resourceGroupName , labAccountName , galleryImageName , galleryImage ) , serviceCallback ) ;
public class DOM2DTM { /** * Return an DOM node for the given node . * @ param nodeHandle The node ID . * @ return A node representation of the DTM node . */ public Node getNode ( int nodeHandle ) { } }
int identity = makeNodeIdentity ( nodeHandle ) ; return ( Node ) m_nodes . elementAt ( identity ) ;
public class XAbstractAttributeMapBufferedImpl { /** * / * ( non - Javadoc ) * @ see java . util . Map # put ( java . lang . Object , java . lang . Object ) */ public synchronized XAttribute put ( String key , XAttribute value ) { } }
try { XAttributeMap map = deserialize ( ) ; map . put ( key , value ) ; serialize ( map ) ; return value ; } catch ( IOException e ) { e . printStackTrace ( ) ; return null ; }
public class PaginatedList { /** * Attempts to load the next batch of results , if there are any , into the * nextResults buffer . Returns whether there were any results to load . A * return value of true guarantees that nextResults had items added to it . */ private synchronized boolean loadNextResults ( ) { } }
if ( atEndOfResults ( ) ) return false ; do { nextResults . addAll ( fetchNextPage ( ) ) ; } while ( ! atEndOfResults ( ) && nextResults . isEmpty ( ) ) ; return ! nextResults . isEmpty ( ) ;
public class FieldSupport { /** * Returns this element ' s annotation for the specified type if such an * annotation is present , else null . < br > * Simply invokes { @ link Field # getAnnotation ( Class ) } * @ param annoCls the Class object corresponding to the annotation type * @ return this element ' s ann...
return f . getAnnotation ( annoCls ) ;
public class AWSWAFRegionalClient { /** * Creates a < code > WebACL < / code > , which contains the < code > Rules < / code > that identify the CloudFront web requests * that you want to allow , block , or count . AWS WAF evaluates < code > Rules < / code > in order based on the value of * < code > Priority < / cod...
request = beforeClientExecution ( request ) ; return executeCreateWebACL ( request ) ;
public class AbstractMongoSessionConverter { /** * Method ensures that there is a TTL index on { @ literal expireAt } field . It ' s has { @ literal expireAfterSeconds } set * to zero seconds , so the expiration time is controlled by the application . It can be extended in custom converters * when there is a need f...
for ( IndexInfo info : sessionCollectionIndexes . getIndexInfo ( ) ) { if ( EXPIRE_AT_FIELD_NAME . equals ( info . getName ( ) ) ) { LOG . debug ( "TTL index on field " + EXPIRE_AT_FIELD_NAME + " already exists" ) ; return ; } } LOG . info ( "Creating TTL index on field " + EXPIRE_AT_FIELD_NAME ) ; sessionCollectionInd...
public class GenericInMemoryCatalog { /** * - - - - - partitions - - - - - */ @ Override public void createPartition ( ObjectPath tablePath , CatalogPartitionSpec partitionSpec , CatalogPartition partition , boolean ignoreIfExists ) throws TableNotExistException , TableNotPartitionedException , PartitionSpecInvalidExce...
validatePartitionSpec ( tablePath , partitionSpec ) ; if ( partitionExists ( tablePath , partitionSpec ) ) { if ( ! ignoreIfExists ) { throw new PartitionAlreadyExistsException ( catalogName , tablePath , partitionSpec ) ; } } else { partitions . get ( tablePath ) . put ( partitionSpec , partition . copy ( ) ) ; }
public class mps_network_config { /** * < pre > * Converts API response of bulk operation into object and returns the object array in case of get request . * < / pre > */ protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } }
mps_network_config_responses result = ( mps_network_config_responses ) service . get_payload_formatter ( ) . string_to_resource ( mps_network_config_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro_exception (...
public class SQLExpressions { /** * PERCENTILE _ DISC is an inverse distribution function that assumes a discrete distribution model . * It takes a percentile value and a sort specification and returns an element from the set . * Nulls are ignored in the calculation . * < p > This function takes as an argument an...
return new WithinGroup < T > ( arg . getType ( ) , SQLOps . PERCENTILEDISC , arg ) ;
public class CmsGitToolOptionsPanel { /** * Updates the options panel for a special configuration . * @ param gitConfig the git configuration . */ protected void updateForNewConfiguration ( CmsGitConfiguration gitConfig ) { } }
if ( ! m_checkinBean . setCurrentConfiguration ( gitConfig ) ) { Notification . show ( CmsVaadinUtils . getMessageText ( Messages . GUI_GIT_CONFIGURATION_SWITCH_FAILED_0 ) , CmsVaadinUtils . getMessageText ( Messages . GUI_GIT_CONFIGURATION_SWITCH_FAILED_DESC_0 ) , Type . ERROR_MESSAGE ) ; m_configurationSelector . sel...
public class SmartFixManager { public static boolean isCaseParseIssue ( IParseIssue parseIssue ) { } }
boolean caseIssue = parseIssue . getMessageKey ( ) == Res . MSG_VAR_CASE_MISMATCH || parseIssue . getMessageKey ( ) == Res . MSG_PROPERTY_CASE_MISMATCH || parseIssue . getMessageKey ( ) == Res . MSG_TYPE_CASE_MISMATCH || parseIssue . getMessageKey ( ) == Res . MSG_FUNCTION_CASE_MISMATCH ; IParsedElement sourceOfIssue =...
public class Download { /** * Downloads the content into an ` OutputStream ` with the specified content type . * @ param config the ` HttpConfig ` instance * @ param ostream the ` OutputStream ` to contain the content . * @ param contentType the content type */ public static void toStream ( final HttpConfig confi...
config . context ( contentType , ID , ostream ) ; config . getResponse ( ) . parser ( contentType , Download :: streamParser ) ;
public class Equation { /** * Goes through the token lists and adds all the variables which can be used to define a sub - matrix . If anything * else is found an excpetion is thrown */ private void addSubMatrixVariables ( List < TokenList . Token > inputs , List < Variable > variables ) { } }
for ( int i = 0 ; i < inputs . size ( ) ; i ++ ) { TokenList . Token t = inputs . get ( i ) ; if ( t . getType ( ) != Type . VARIABLE ) throw new ParseError ( "Expected variables only in sub-matrix input, not " + t . getType ( ) ) ; Variable v = t . getVariable ( ) ; if ( v . getType ( ) == VariableType . INTEGER_SEQUE...
public class Ocpp12RequestHandler { /** * { @ inheritDoc } */ @ Override public void handle ( HardResetChargingStationRequestedEvent event , CorrelationToken correlationToken ) { } }
LOG . info ( "OCPP 1.2 HardResetChargingStationRequestedEvent" ) ; chargingStationOcpp12Client . hardReset ( event . getChargingStationId ( ) ) ;
public class ServiceBroker { /** * Set global JSON writer API ( Jackson , Gson , Boon , FastJson , etc . ) */ protected void initJsonWriter ( ) { } }
String writerList = config . getJsonWriters ( ) ; if ( writerList != null ) { String [ ] writers = writerList . split ( "," ) ; Set < String > supportedWriters = TreeWriterRegistry . getWritersByFormat ( "json" ) ; TreeWriter selectedWriter = null ; for ( String writer : writers ) { writer = writer . trim ( ) . toLower...
public class RestClient { /** * Updates an asset in Massive . The { @ link Asset # get _ id ( ) } must return the * correct ID for this asset . Note that Massive will set some fields ( such * as last update date ) so it is important to switch to the returned object * after calling this method . * @ param asset ...
HttpURLConnection connection = createHttpURLConnectionToMassive ( "/assets/" + asset . get_id ( ) ) ; connection . setRequestMethod ( "PUT" ) ; connection . setRequestProperty ( "Content-Type" , "application/json" ) ; connection . setDoOutput ( true ) ; JSONAssetConverter . writeValue ( connection . getOutputStream ( )...
public class WorldState { /** * Returns a collection containing the same Identifier Strings as this WorldState * object . Modifications to the returned Collection do not impact this * WorldState . * @ return a collection containing the same Identifier Strings as this WorldState . */ public Collection < String > g...
List < String > keys = new LinkedList < String > ( ) ; keys . addAll ( this . stateMap . keySet ( ) ) ; return keys ;
public class YamlProvider { /** * Source from a stream * @ param identity identity * @ param content yaml string * @ param modified date the content was last modified , for caching purposes * @ return source */ public static CacheableYamlSource sourceFromString ( final String identity , final String content , f...
return new CacheableYamlSource ( ) { @ Override public boolean isValid ( ) { return true ; } @ Override public Date getLastModified ( ) { return modified ; } @ Override public String getIdentity ( ) { return identity ; } @ Override public Iterable < ACLPolicyDoc > loadAll ( final Yaml yaml ) throws IOException { return...
public class PresentationManager { /** * Creates a new session with the given id . If null is used , an automatic * session id will be generated * @ param sessionId The new session id . Must be unique . * @ throws PMException on already defined session * @ return New session */ public PMSession registerSession ...
synchronized ( sessions ) { if ( sessionId != null ) { if ( ! sessions . containsKey ( sessionId ) ) { sessions . put ( sessionId , new PMSession ( sessionId ) ) ; } return getSession ( sessionId ) ; } else { return registerSession ( newSessionId ( ) ) ; } }
public class Singles { /** * Select the first Future to return with a successful result * < pre > * { @ code * Single < Integer > ft = Single . empty ( ) ; * Single < Integer > result = Singles . firstSuccess ( Single . deferred ( ( ) - > 1 ) , ft ) ; * ft . complete ( 10 ) ; * result . get ( ) / / 1 * < ...
return Single . fromPublisher ( Future . firstSuccess ( futures ( fts ) ) ) ;
public class Trees { /** * Builds the parents of node up to and including the root node , where the * original node is the last element in the returned array . The length of * the returned array gives the node ' s depth in the tree . * @ param node the node to get the path for * @ param depth an int giving the ...
final MSeq < T > path ; if ( node == null ) { path = MSeq . ofLength ( depth ) ; } else { path = pathToRoot ( node . getParent ( ) . orElse ( null ) , depth + 1 ) ; path . set ( path . length ( ) - depth - 1 , node ) ; } return path ;
public class CheckNonEmptyMsgNodesPass { /** * If the only children are empty raw text nodes , then the node is empty . * < p > Empty raw text nodes are inserted by the parser to keep track of trimmed whitespace for the * html parser and removed later in the compiler . */ private static boolean isEmpty ( MsgNode ms...
for ( SoyNode child : msg . getChildren ( ) ) { if ( child instanceof RawTextNode && ( ( RawTextNode ) child ) . getRawText ( ) . isEmpty ( ) ) { continue ; } return false ; } return true ;
public class AbstractManagedConnectionPool { /** * Destroy and remove a connection listener * @ param cl The connection listener * @ param listeners The listeners */ protected void destroyAndRemoveConnectionListener ( ConnectionListener cl , Collection < ConnectionListener > listeners ) { } }
try { pool . destroyConnectionListener ( cl ) ; } catch ( ResourceException e ) { // TODO : cl . setState ( ZOMBIE ) ; } finally { listeners . remove ( cl ) ; }
public class MapFileReader { /** * It a single record from the map file for the given index * @ param index Index , between 0 and numRecords ( ) - 1 * @ return Value from the MapFile * @ throws IOException If an error occurs during reading */ public V getRecord ( long index ) throws IOException { } }
// First : determine which reader to read from . . . int readerIdx = - 1 ; for ( int i = 0 ; i < recordIndexesEachReader . size ( ) ; i ++ ) { Pair < Long , Long > p = recordIndexesEachReader . get ( i ) ; if ( index >= p . getFirst ( ) && index <= p . getSecond ( ) ) { readerIdx = i ; break ; } } if ( readerIdx == - 1...
public class FileAppendWriter { /** * 追加写入字符串 * @ param content */ public FileAppendWriter write ( String content ) { } }
try { writer . write ( content ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return this ;
public class CommandListCreator { /** * Creates the list with command necessary to remove a mapping from a map . * @ param mapId * the map where the mapping should be removed . * @ param key * the key of the mapping that should be removed . * @ return the list with the commands . */ public List < Command > re...
final State state = createCommandList ( new WithCommandType ( ) { @ Override public void invoke ( final State state ) { createObservableObject ( key , state ) ; } } , false ) ; final boolean keyIsObservableObject = state . lastObjectWasObservable ; final RemoveFromMap msg = new RemoveFromMap ( ) ; msg . setMapId ( mapI...
public class IntArrayList { /** * 在数组尾部新增一个元素 * @ param element */ public void append ( int element ) { } }
if ( this . size == this . data . length ) { expand ( ) ; } this . data [ this . size ] = element ; this . size += 1 ;
public class Validators { /** * Creates and returns a validator , which allows to validate texts to ensure , that they * represent valid IRIs . IRIs are internationalized URLs according to RFC 3987 , which are for * example used as internet addresses . Empty texts are also accepted . * @ param context * The con...
return new IRIValidator ( context , R . string . default_error_message ) ;
public class Context { /** * Gets the child nodes of the given site node . * @ param siteNode the site node that will be used , must not be { @ code null } * @ return a { @ code List } with the child nodes , never { @ code null } */ private List < SiteNode > getChildren ( SiteNode siteNode ) { } }
int childCount = siteNode . getChildCount ( ) ; if ( childCount == 0 ) { return Collections . emptyList ( ) ; } List < SiteNode > children = new ArrayList < > ( childCount ) ; for ( int i = 0 ; i < childCount ; i ++ ) { children . add ( ( SiteNode ) siteNode . getChildAt ( i ) ) ; } return children ;
public class InheritanceTransformer { /** * Convenience method to reuse the super constructor . * @ param extendedComponent * @ return a non - null collection */ static Collection < AbstractType > asList ( Component extendedComponent ) { } }
Collection < AbstractType > result ; if ( extendedComponent == null ) { result = new ArrayList < AbstractType > ( 0 ) ; } else { result = new ArrayList < AbstractType > ( 1 ) ; result . add ( extendedComponent ) ; } return result ;
public class FailedRemediationBatchMarshaller { /** * Marshall the given parameter object . */ public void marshall ( FailedRemediationBatch failedRemediationBatch , ProtocolMarshaller protocolMarshaller ) { } }
if ( failedRemediationBatch == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( failedRemediationBatch . getFailureMessage ( ) , FAILUREMESSAGE_BINDING ) ; protocolMarshaller . marshall ( failedRemediationBatch . getFailedItems ( ) , FAILEDIT...
public class MongoPersister { /** * Set the current State . This method will ensure that the state in the db matches the expected current state . * If not , it will throw a StateStateException * @ param stateful Stateful Entity * @ param current Expected current State * @ param next The value of the next State ...
try { // Has this Entity been persisted to Mongo ? StateDocumentImpl stateDoc = this . getStateDocument ( stateful ) ; if ( stateDoc != null && stateDoc . isPersisted ( ) ) { // Update state in the DB updateStateInDB ( stateful , current , next , stateDoc ) ; } else { // The Entity hasn ' t been persisted to Mongo - so...
public class StackFinder { /** * Return the class if the given classname is found on the stack . * @ param fragment * @ return boolean */ @ SuppressWarnings ( "unchecked" ) public Class < Object > matchCaller ( String className ) { } }
// Walk the stack backwards to find the calling class : don ' t // want to use Class . forName , because we want the class as loaded // by it ' s original classloader Class < Object > stack [ ] = ( Class < Object > [ ] ) this . getClassContext ( ) ; for ( Class < Object > bClass : stack ) { // See if any class in the s...
public class Parser { /** * Parses response into { @ link List } * @ param jsonData * @ param maxResults * @ param parseAddressComponents * @ return { @ link Address } { @ link List } * @ throws GeocoderException if error occurs */ @ NonNull static List < Address > parseJson ( final byte [ ] jsonData , final ...
try { final String jsonString = new String ( jsonData , Charset . forName ( "UTF-8" ) ) ; final JSONObject jsonObject = new JSONObject ( jsonString ) ; if ( ! jsonObject . has ( STATUS ) ) { throw new GeocoderException ( new JSONException ( "No \"status\" field" ) ) ; } final Status status = Status . fromString ( jsonO...
public class AbstractSerialDataWriter { /** * < p > Sends an array of characters to the serial port / device identified by the given file descriptor . < / p > * @ param charset * The character set to use for encoding / decoding bytes to / from text characters * @ param data * An array of chars to be decoded int...
write ( charset , CharBuffer . wrap ( data , offset , length ) ) ;
public class TypeUtils { /** * < p > Tries to determine the type arguments of a class / interface based on a * super parameterized type ' s type arguments . This method is the inverse of * { @ link # getTypeArguments ( Type , Class ) } which gets a class / interface ' s * type arguments based on a subtype . It is...
Validate . notNull ( cls , "cls is null" ) ; Validate . notNull ( superType , "superType is null" ) ; final Class < ? > superClass = getRawType ( superType ) ; // compatibility check if ( ! isAssignable ( cls , superClass ) ) { return null ; } if ( cls . equals ( superClass ) ) { return getTypeArguments ( superType , s...
public class ListStreamsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ListStreamsRequest listStreamsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( listStreamsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listStreamsRequest . getLimit ( ) , LIMIT_BINDING ) ; protocolMarshaller . marshall ( listStreamsRequest . getExclusiveStartStreamName ( ) , EXCLUSIVESTARTSTREAMNAME_...
public class WorkspacePersistentDataManager { /** * Check if same - name sibling exists in persistence . */ private void checkPersistedSNS ( NodeData node , WorkspaceStorageConnection acon ) throws RepositoryException { } }
NodeData parent = ( NodeData ) acon . getItemData ( node . getParentIdentifier ( ) ) ; QPathEntry myName = node . getQPath ( ) . getEntries ( ) [ node . getQPath ( ) . getEntries ( ) . length - 1 ] ; ItemData sibling = acon . getItemData ( parent , new QPathEntry ( myName . getNamespace ( ) , myName . getName ( ) , myN...
public class U { /** * Documented , # all */ public static < E > boolean all ( final Iterable < E > iterable , final Predicate < E > pred ) { } }
return every ( iterable , pred ) ;
public class BeanDefinitionParser { /** * Validate that the specified bean name and aliases have not been used * already . * @ param beanName a { @ link java . lang . String } object . * @ param aliases a { @ link java . util . List } object . * @ param beanElement a { @ link org . w3c . dom . Element } object ...
String foundName = null ; if ( StringUtils . hasText ( beanName ) && this . usedNames . contains ( beanName ) ) foundName = beanName ; if ( foundName == null ) foundName = ( String ) CollectionUtils . findFirstMatch ( this . usedNames , aliases ) ; if ( foundName != null ) error ( "Bean name '" + foundName + "' is alre...
public class PinyinTokenFilter { /** * TODO refactor , merge code */ @ Override public final boolean incrementToken ( ) throws IOException { } }
if ( ! done ) { if ( readTerm ( ) ) return true ; } if ( done ) { resetVariable ( ) ; if ( ! input . incrementToken ( ) ) { return false ; } done = false ; } readTerm ( ) ; return true ;
public class ThrowsTaglet { /** * { @ inheritDoc } */ public Content getTagletOutput ( Element holder , TagletWriter writer ) { } }
Utils utils = writer . configuration ( ) . utils ; ExecutableElement execHolder = ( ExecutableElement ) holder ; Map < List < ? extends DocTree > , ExecutableElement > tagsMap = new LinkedHashMap < > ( ) ; tagsMap . put ( utils . getThrowsTrees ( execHolder ) , execHolder ) ; Content result = writer . getOutputInstance...
public class CombineRetentionPolicy { /** * Returns the most specific common superclass for the { @ link # versionClass } of each embedded policy . */ @ SuppressWarnings ( "unchecked" ) @ Override public Class < T > versionClass ( ) { } }
if ( this . retentionPolicies . size ( ) == 1 ) { return ( Class < T > ) this . retentionPolicies . get ( 0 ) . versionClass ( ) ; } Class < T > klazz = ( Class < T > ) this . retentionPolicies . get ( 0 ) . versionClass ( ) ; for ( RetentionPolicy < T > policy : this . retentionPolicies ) { klazz = commonSuperclass ( ...
public class MimeTypeDetectors { /** * Returns a new mime type detector implementation based on * the repository { @ link org . modeshape . jcr . RepositoryConfiguration . FieldName # MIMETYPE _ DETECTION } configuration * @ param mimeTypeDetectionConfig a { @ code String } , may not be null * @ param environment...
switch ( mimeTypeDetectionConfig . toLowerCase ( ) ) { case RepositoryConfiguration . FieldValue . MIMETYPE_DETECTION_CONTENT : { return TIKA_AVAILABLE ? new TikaContentDetector ( environment ) : new DefaultMimeTypeDetector ( ) ; } case RepositoryConfiguration . FieldValue . MIMETYPE_DETECTION_NAME : { return TIKA_AVAI...
public class VonNeumannIntTupleIterator { /** * Increment the current value starting at the given index , * and return whether this was possible * @ param index The index * @ return Whether the value could be incremented */ private boolean increment ( int index ) { } }
if ( index == - 1 ) { return false ; } int value = current . get ( index ) ; if ( value < max . get ( index ) ) { current . set ( index , value + 1 ) ; updateMinMax ( index + 1 ) ; return true ; } boolean hasNext = increment ( index - 1 ) ; if ( hasNext ) { current . set ( index , min . get ( index ) ) ; } return hasNe...
public class SteamNetworking { /** * Read incoming packet data into a direct { @ link ByteBuffer } . * On success , returns the number of bytes received , and the < code > steamIDRemote < / code > parameter contains the * sender ' s ID . */ public int readP2PPacket ( SteamID steamIDRemote , ByteBuffer dest , int ch...
if ( ! dest . isDirect ( ) ) { throw new SteamException ( "Direct buffer required!" ) ; } if ( readP2PPacket ( pointer , dest , dest . position ( ) , dest . remaining ( ) , tmpIntResult , tmpLongResult , channel ) ) { steamIDRemote . handle = tmpLongResult [ 0 ] ; return tmpIntResult [ 0 ] ; } return 0 ;
public class transformpolicy_lbvserver_binding { /** * Use this API to fetch transformpolicy _ lbvserver _ binding resources of given name . */ public static transformpolicy_lbvserver_binding [ ] get ( nitro_service service , String name ) throws Exception { } }
transformpolicy_lbvserver_binding obj = new transformpolicy_lbvserver_binding ( ) ; obj . set_name ( name ) ; transformpolicy_lbvserver_binding response [ ] = ( transformpolicy_lbvserver_binding [ ] ) obj . get_resources ( service ) ; return response ;
public class CSSColorHelper { /** * Check if the passed String is valid CSS hex color value . Example value : * < code > # ff0000 < / code > * @ param sValue * The value to check . May be < code > null < / code > . * @ return < code > true < / code > if it is a CSS hex color value , * < code > false < / code ...
final String sRealValue = StringHelper . trim ( sValue ) ; return StringHelper . hasText ( sRealValue ) && sRealValue . charAt ( 0 ) == CCSSValue . PREFIX_HEX && RegExHelper . stringMatchesPattern ( PATTERN_HEX , sRealValue ) ;
public class GlobalTransformerRegistry { /** * Discard an operation . * @ param address the operation handler address * @ param major the major version * @ param minor the minor version * @ param operationName the operation name */ public void discardOperation ( final PathAddress address , int major , int minor...
registerTransformer ( address . iterator ( ) , ModelVersion . create ( major , minor ) , operationName , OperationTransformerRegistry . DISCARD ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link String } { @ code > } */ @ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "orderBy" , scope = GetChildren . class ) public JAXBElement < String > createGetChildrenOrderBy (...
return new JAXBElement < String > ( _GetChildrenOrderBy_QNAME , String . class , GetChildren . class , value ) ;
public class DateUtil { /** * 计算arg0 - arg1的时间差 * @ param arg0 arg0 * @ param arg1 arg1 * @ param dateUnit 返回结果的单位 * @ return arg0 - arg1的时间差 , 精确到指定的单位 ( field ) */ public static long calc ( Date arg0 , Date arg1 , DateUnit dateUnit ) { } }
return calc ( arg0 . toInstant ( ) , arg1 . toInstant ( ) , dateUnit ) ;
public class ProviderList { /** * Construct a special ProviderList for JAR verification . It consists * of the providers specified via jarClassNames , which must be on the * bootclasspath and cannot be in signed JAR files . This is to avoid * possible recursion and deadlock during verification . */ ProviderList g...
List < ProviderConfig > newConfigs = new ArrayList < > ( ) ; for ( String className : jarClassNames ) { ProviderConfig newConfig = new ProviderConfig ( className ) ; for ( ProviderConfig config : configs ) { // if the equivalent object is present in this provider list , // use the old object rather than the new object ...
public class CommercePriceEntryUtil { /** * Returns the commerce price entry where uuid = & # 63 ; and groupId = & # 63 ; or returns < code > null < / code > if it could not be found , optionally using the finder cache . * @ param uuid the uuid * @ param groupId the group ID * @ param retrieveFromCache whether to...
return getPersistence ( ) . fetchByUUID_G ( uuid , groupId , retrieveFromCache ) ;
public class WindowManager { /** * Tracks a window event * @ param windowEvent the window event to track */ public void add ( Event < T > windowEvent ) { } }
// watermark events are not added to the queue . if ( windowEvent . isWatermark ( ) ) { LOG . fine ( String . format ( "Got watermark event with ts %d" , windowEvent . getTimestamp ( ) ) ) ; } else { queue . add ( windowEvent ) ; } track ( windowEvent ) ; compactWindow ( ) ;
public class PhoneUtils { /** * Checks to see if the user has rotation enabled / disabled in their phone settings . * @ param context The current Context or Activity that this method is called from * @ return true if rotation is enabled , otherwise false . */ public static boolean isRotationEnabled ( Context contex...
return android . provider . Settings . System . getInt ( context . getContentResolver ( ) , Settings . System . ACCELEROMETER_ROTATION , 0 ) == 1 ;
public class CmsAutoGrowingTextAreaConnector { /** * Resize the text area . < p > */ protected void handle ( ) { } }
Element e = m_widget . getElement ( ) ; if ( e instanceof TextAreaElement ) { TextAreaElement elem = ( TextAreaElement ) e ; int scrollHeight = elem . getScrollHeight ( ) ; // allow text area to shrink if ( m_lastValue . length ( ) > elem . getValue ( ) . length ( ) ) { elem . setRows ( getState ( ) . getMinRows ( ) ) ...
public class LineSegmentPath { /** * Populate the path with the path nodes that lead the pathable from its starting position to * the given destination coordinates following the given list of screen coordinates . */ protected void createPath ( List < Point > points ) { } }
Point last = null ; int size = points . size ( ) ; for ( int ii = 0 ; ii < size ; ii ++ ) { Point p = points . get ( ii ) ; int dir = ( ii == 0 ) ? NORTH : DirectionUtil . getDirection ( last , p ) ; addNode ( p . x , p . y , dir ) ; last = p ; }
public class Detector { /** * Gets the color of a segment * @ return 1 if segment more than 90 % black , - 1 if segment is more than 90 % white , 0 else */ private int getColor ( Point p1 , Point p2 ) { } }
float d = distance ( p1 , p2 ) ; float dx = ( p2 . getX ( ) - p1 . getX ( ) ) / d ; float dy = ( p2 . getY ( ) - p1 . getY ( ) ) / d ; int error = 0 ; float px = p1 . getX ( ) ; float py = p1 . getY ( ) ; boolean colorModel = image . get ( p1 . getX ( ) , p1 . getY ( ) ) ; int iMax = ( int ) Math . ceil ( d ) ; for ( i...
public class CheckArg { /** * Check that the object is an instance of the specified Class * @ param argument Value * @ param expectedClass Class * @ param name The name of the argument * @ throws IllegalArgumentException If value is null */ public static void isInstanceOf ( Object argument , Class < ? > expecte...
isNotNull ( argument , name ) ; if ( ! expectedClass . isInstance ( argument ) ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBeInstanceOf . text ( name , argument . getClass ( ) , expectedClass . getName ( ) ) ) ; }
public class ChatMessage { /** * Update status list with a new status . * @ param status New message status details . */ @ SuppressLint ( "UseSparseArrays" ) public void addStatusUpdate ( ChatMessageStatus status ) { } }
int unique = ( status . getMessageId ( ) + status . getProfileId ( ) + status . getMessageStatus ( ) . name ( ) ) . hashCode ( ) ; if ( statusUpdates == null ) { statusUpdates = new HashMap < > ( ) ; } statusUpdates . put ( unique , status ) ;
public class SharedStateRegistry { /** * Register given shared states in the registry . * @ param stateHandles The shared states to register . */ public void registerAll ( Iterable < ? extends CompositeStateHandle > stateHandles ) { } }
if ( stateHandles == null ) { return ; } synchronized ( registeredStates ) { for ( CompositeStateHandle stateHandle : stateHandles ) { stateHandle . registerSharedStates ( this ) ; } }
public class Postcard { /** * Inserts a CharSequence array value into the mapping of this Bundle , replacing * any existing value for the given key . Either key or value may be null . * @ param key a String , or null * @ param value a CharSequence array object , or null * @ return current */ public Postcard wit...
mBundle . putCharSequenceArray ( key , value ) ; return this ;
public class MBeanServerHandler { /** * Lookup all registered detectors + a default detector */ public static List < ServerDetector > lookupDetectors ( ) { } }
List < ServerDetector > detectors = ServiceObjectFactory . createServiceObjects ( "META-INF/detectors-default" , "META-INF/detectors" ) ; // An detector at the end of the chain in order to get a default handle detectors . add ( new FallbackServerDetector ( ) ) ; return detectors ;
public class RemoveUnusedCode { /** * Get the right { @ link VarInfo } object to use for the given { @ link Var } . * < p > This method is responsible for managing the entries in { @ link # varInfoMap } . * < p > Note : Several { @ link Var } s may share the same { @ link VarInfo } when they should be treated * t...
checkNotNull ( var ) ; boolean isGlobal = var . isGlobal ( ) ; if ( var . isExtern ( ) ) { return canonicalUnremovableVarInfo ; } else if ( isGlobal && ! removeGlobals ) { return canonicalUnremovableVarInfo ; } else if ( ! isGlobal && ! removeLocalVars ) { return canonicalUnremovableVarInfo ; } else if ( codingConventi...
public class MultiNote { /** * Returns < TT > true < / TT > if this multi note some accidentals ( for at least one * of its note ) . * @ return < TT > true < / TT > if this multi note some accidentals ( for at least one * of its note ) , < TT > false < / TT > otherwise . * @ see Note # hasAccidental ( ) */ publ...
for ( int i = 1 ; i < m_notes . size ( ) ; i ++ ) if ( ( ( Note ) ( m_notes . elementAt ( i ) ) ) . hasAccidental ( ) ) return true ; return false ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EEnum getIfcWallTypeEnum ( ) { } }
if ( ifcWallTypeEnumEEnum == null ) { ifcWallTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 927 ) ; } return ifcWallTypeEnumEEnum ;
public class WorkEvent { /** * Read object * @ param ois The object input stream * @ exception ClassNotFoundException If a class can not be found * @ exception IOException Thrown if an error occurs */ private void readObject ( ObjectInputStream ois ) throws ClassNotFoundException , IOException { } }
ObjectInputStream . GetField fields = ois . readFields ( ) ; String name = serialPersistentFields [ TYPE_IDX ] . getName ( ) ; this . type = fields . get ( name , 0 ) ; name = serialPersistentFields [ WORK_IDX ] . getName ( ) ; this . work = ( Work ) fields . get ( name , null ) ; name = serialPersistentFields [ EXCPEP...
public class CounterConfigurationManager { /** * Validates the counter ' s configuration . * @ param configuration the { @ link CounterConfiguration } to be validated . */ private void validateConfiguration ( CounterConfiguration configuration ) { } }
storage . validatePersistence ( configuration ) ; switch ( configuration . type ( ) ) { case BOUNDED_STRONG : validateStrongCounterBounds ( configuration . lowerBound ( ) , configuration . initialValue ( ) , configuration . upperBound ( ) ) ; break ; case WEAK : if ( configuration . concurrencyLevel ( ) < 1 ) { throw l...
public class IOUtils { /** * < p > write . < / p > * @ param in a { @ link java . io . InputStream } object . * @ param path a { @ link java . nio . file . Path } object . */ public static void write ( InputStream in , Path path ) { } }
write ( in , path , StandardCopyOption . REPLACE_EXISTING ) ;
public class BranchDeleteTask { /** * Sets the branches to delete ( comma - separated list ) * @ param branches comma - separated list of branches to delete */ public void setBranches ( String branches ) { } }
if ( ! GitTaskUtils . isNullOrBlankString ( branches ) ) { this . branchNames = branches . split ( "," ) ; } else { throw new GitBuildException ( "Cannot delete unspecified branches." ) ; }
public class PathNormalizer { /** * Normalizes two paths and joins them as a single path . * @ param prefix * @ param path * @ return the joined path */ public static String joinPaths ( String prefix , String path , boolean generatedPath ) { } }
String result = null ; if ( generatedPath ) { result = joinDomainToPath ( prefix , path ) ; } else { result = joinPaths ( prefix , path ) ; } return result ;
public class NewConnectionInitialReadCallback { /** * Tests if the request has space in its buffer ( s ) or not . * @ param req * @ return boolean */ private boolean requestFull ( TCPReadRequestContext req ) { } }
WsByteBuffer wsBuffArray [ ] = req . getBuffers ( ) ; boolean rc = ! wsBuffArray [ wsBuffArray . length - 1 ] . hasRemaining ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "requestFull: " + rc ) ; } return rc ;
public class FluentWait { /** * Repeatedly applies this instance ' s input value to the given function until one of the following * occurs : * < ol > * < li > the function returns neither null nor false < / li > * < li > the function throws an unignored exception < / li > * < li > the timeout expires < / li >...
Instant end = clock . instant ( ) . plus ( timeout ) ; Throwable lastException ; while ( true ) { try { V value = isTrue . apply ( input ) ; if ( value != null && ( Boolean . class != value . getClass ( ) || Boolean . TRUE . equals ( value ) ) ) { return value ; } // Clear the last exception ; if another retry or timeo...
public class CDocumentReconstructor { /** * return the itext security flags for encryption * @ param properties * the converter properties * @ return the itext security flags */ private static final int getSecurityFlags ( final Map properties ) { } }
int securityType = 0 ; securityType = "true" . equals ( properties . get ( IHtmlToPdfTransformer . PDF_ALLOW_PRINTING ) ) ? ( securityType | PdfWriter . ALLOW_PRINTING ) : securityType ; securityType = "true" . equals ( properties . get ( IHtmlToPdfTransformer . PDF_ALLOW_MODIFY_CONTENTS ) ) ? ( securityType | PdfWrite...
public class AbstractDataSource { /** * Builds the task list . * @ param previousVersion * the previous version * @ param currentVersion * the current version * @ return the list */ protected List < SQLiteUpdateTask > buildTaskList ( int previousVersion , int currentVersion ) { } }
List < SQLiteUpdateTask > result = new ArrayList < > ( ) ; for ( Pair < Integer , ? extends SQLiteUpdateTask > item : this . options . updateTasks ) { if ( item . value0 - 1 == previousVersion ) { result . add ( item . value1 ) ; previousVersion = item . value0 ; } if ( previousVersion == currentVersion ) break ; } if ...
public class MapRandomizer { /** * Create a new { @ link MapRandomizer } with a random number of entries . * @ param keyRandomizer the randomizer for keys * @ param valueRandomizer the randomizer for values * @ param < K > the type of key elements * @ param < V > the type of value elements * @ return a new { ...
return new MapRandomizer < > ( keyRandomizer , valueRandomizer , getRandomSize ( ) ) ;
public class IfcPortImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcRelConnectsPortToElement > getContainedIn ( ) { } }
return ( EList < IfcRelConnectsPortToElement > ) eGet ( Ifc4Package . Literals . IFC_PORT__CONTAINED_IN , true ) ;
public class AverageBondLengthCalculator { /** * Calculate the average bond length for the bonds in a molecule set . * @ param moleculeSet the molecule set to use * @ return the average bond length */ public static double calculateAverageBondLength ( IAtomContainerSet moleculeSet ) { } }
double averageBondModelLength = 0.0 ; for ( IAtomContainer atomContainer : moleculeSet . atomContainers ( ) ) { averageBondModelLength += GeometryUtil . getBondLengthAverage ( atomContainer ) ; } return averageBondModelLength / moleculeSet . getAtomContainerCount ( ) ;
public class ShapeGenerator { /** * Return a path for a simple bullet . * @ param x the X coordinate of the upper - left corner of the bullet * @ param y the Y coordinate of the upper - left corner of the bullet * @ param diameter the diameter of the bullet * @ return a path representing the shape . */ public S...
return createEllipseInternal ( x , y , diameter , diameter ) ;
public class OperationCodeImpl { /** * ( non - Javadoc ) * @ see org . restcomm . protocols . ss7 . tcap . asn . Encodable # encode ( org . mobicents . protocols . asn . AsnOutputStream ) */ public void encode ( AsnOutputStream aos ) throws EncodeException { } }
if ( this . nationalOperationCode == null && this . privateOperationCode == null ) throw new EncodeException ( "Operation code: No Operation code set!" ) ; try { if ( this . type == OperationCodeType . National && this . nationalOperationCode != null ) { aos . writeInteger ( Tag . CLASS_PRIVATE , OperationCode . _TAG_N...
public class CompressedArray { /** * Decompress the byte array previously returned by compress */ public static byte [ ] decompress ( byte [ ] value ) throws DataFormatException { } }
// Create an expandable byte array to hold the decompressed data ByteArrayOutputStream bos = new ByteArrayOutputStream ( value . length ) ; Inflater decompressor = new Inflater ( ) ; try { decompressor . setInput ( value ) ; final byte [ ] buf = new byte [ 1024 ] ; while ( ! decompressor . finished ( ) ) { int count = ...