signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class TransactionRepository { /** * Find transactions by transaction id ( not the auto - increment transaction . id ) */
public Transaction findByTransactionId ( String transactionId ) { } } | EntityManager entityManager = getEntityManager ( ) ; try { return entityManager . createQuery ( "SELECT t FROM io.motown.operatorapi.viewmodel.persistence.entities.Transaction AS t WHERE t.transactionId = :transactionId" , Transaction . class ) . setParameter ( "transactionId" , transactionId ) . getSingleResult ( ) ; } finally { entityManager . close ( ) ; } |
public class GrammarFactory { /** * Schema information is generated for processing the EXI body .
* @ param xsdLocation
* file location
* @ param entityResolver
* application can register XSD resolver
* @ return schema - informed EXI grammars
* @ throws EXIException
* EXI exception */
public Grammars createGrammars ( String xsdLocation , XMLEntityResolver entityResolver ) throws EXIException { } } | if ( xsdLocation == null || xsdLocation . equals ( "" ) ) { throw new EXIException ( "SchemaLocation not specified correctly!" ) ; } else { // System . out . println ( " Grammar for : " + xsdLocation ) ;
grammarBuilder . loadGrammars ( xsdLocation , entityResolver ) ; SchemaInformedGrammars g = grammarBuilder . toGrammars ( ) ; g . setSchemaId ( xsdLocation ) ; return g ; } |
public class LittleEndianDataOutputStream { /** * / * ( non - Javadoc )
* @ see java . io . DataOutput # writeLong ( long ) */
@ Override public void writeLong ( long v ) throws IOException { } } | work [ 0 ] = ( byte ) ( 0xffL & v ) ; work [ 1 ] = ( byte ) ( 0xffL & ( v >> 8 ) ) ; work [ 2 ] = ( byte ) ( 0xffL & ( v >> 16 ) ) ; work [ 3 ] = ( byte ) ( 0xffL & ( v >> 24 ) ) ; work [ 4 ] = ( byte ) ( 0xffL & ( v >> 32 ) ) ; work [ 5 ] = ( byte ) ( 0xffL & ( v >> 40 ) ) ; work [ 6 ] = ( byte ) ( 0xffL & ( v >> 48 ) ) ; work [ 7 ] = ( byte ) ( 0xffL & ( v >> 56 ) ) ; write ( work , 0 , 8 ) ; |
public class HandlerEntityRequest { /** * < p > Handle request without changing transaction isolation . < / p >
* @ param pRqVs Request scoped variables
* @ param pRqDt Request Data
* @ param pEntityClass Entity Class
* @ param pActionsArr Actions Array
* @ param pIsShowDebMsg Is Show Debug Messages
* @ param pNmEnt entity name
* @ throws Exception - an exception */
public final void handleNoChangeIsolation ( final Map < String , Object > pRqVs , final IRequestData pRqDt , final Class < ? > pEntityClass , final String [ ] pActionsArr , final boolean pIsShowDebMsg , final String pNmEnt ) throws Exception { } } | Class < ? > entityClass = pEntityClass ; try { this . srvDatabase . setIsAutocommit ( false ) ; this . srvDatabase . setTransactionIsolation ( this . writeReTi ) ; this . srvDatabase . beginTransaction ( ) ; IHasId < ? > entity = null ; if ( pActionsArr [ 0 ] . startsWith ( "entity" ) ) { // actions like " save " , " delete "
@ SuppressWarnings ( "unchecked" ) IFactorySimple < IHasId < ? > > entFac = ( IFactorySimple < IHasId < ? > > ) this . entitiesFactoriesFatory . lazyGet ( pRqVs , entityClass ) ; entity = entFac . create ( pRqVs ) ; this . fillEntityFromReq . fill ( pRqVs , entity , pRqDt ) ; } for ( String actionNm : pActionsArr ) { if ( actionNm . startsWith ( "entity" ) ) { if ( entity == null ) { // it ' s may be change entity to owner :
entity = ( IHasId < ? > ) pRqVs . get ( "nextEntity" ) ; if ( entity == null ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "wrong_request_entity_not_filled" ) ; } entityClass = entity . getClass ( ) ; } String entProcNm = this . entitiesProcessorsNamesHolder . getFor ( entityClass , actionNm ) ; if ( entProcNm == null ) { this . secureLogger . error ( null , HandlerEntityRequest . class , "Trying to work with forbidden entity/action/user: " + pNmEnt + "/" + actionNm + "/" + pRqDt . getUserName ( ) ) ; throw new ExceptionWithCode ( ExceptionWithCode . FORBIDDEN , "Forbidden!" ) ; } @ SuppressWarnings ( "unchecked" ) IEntityProcessor < IHasId < ? > , ? > ep = ( IEntityProcessor < IHasId < ? > , ? > ) this . entitiesProcessorsFactory . lazyGet ( pRqVs , entProcNm ) ; if ( pIsShowDebMsg ) { this . logger . debug ( pRqVs , HandlerEntityRequest . class , "It's used entProcNm/IEntityProcessor: " + entProcNm + "/" + ep . getClass ( ) ) ; } entity = ep . process ( pRqVs , entity , pRqDt ) ; } else { // else actions like " list " ( page )
String procNm = this . processorsNamesHolder . getFor ( entityClass , actionNm ) ; if ( procNm == null ) { this . secureLogger . error ( null , HandlerEntityRequest . class , "Trying to work with forbidden entity/action/user: " + pNmEnt + "/" + actionNm + "/" + pRqDt . getUserName ( ) ) ; throw new ExceptionWithCode ( ExceptionWithCode . FORBIDDEN , "Forbidden!" ) ; } IProcessor proc = this . processorsFactory . lazyGet ( pRqVs , procNm ) ; if ( pIsShowDebMsg ) { this . logger . debug ( pRqVs , HandlerEntityRequest . class , "It's used procNm/IProcessor: " + procNm + "/" + proc . getClass ( ) ) ; } proc . process ( pRqVs , pRqDt ) ; } } this . srvDatabase . commitTransaction ( ) ; } catch ( Exception ex ) { this . srvDatabase . rollBackTransaction ( ) ; throw ex ; } finally { this . srvDatabase . releaseResources ( ) ; } |
public class LoadBalancerFilter { /** * Method allow to find load balancers that contains { @ code substring } in description
* Filtering is case insensitive .
* @ param subStrings is a set of descriptions
* @ return { @ link LoadBalancerFilter } */
public LoadBalancerFilter descriptionContains ( String ... subStrings ) { } } | allItemsNotNull ( subStrings , "Load balancer description subStrings" ) ; predicate = predicate . and ( combine ( LoadBalancerMetadata :: getDescription , in ( asList ( subStrings ) , Predicates :: containsIgnoreCase ) ) ) ; return this ; |
public class BoxApiBookmark { /** * Gets a request that deletes a bookmark
* @ param id id of bookmark to delete
* @ return request to delete a bookmark */
public BoxRequestsBookmark . DeleteBookmark getDeleteRequest ( String id ) { } } | BoxRequestsBookmark . DeleteBookmark request = new BoxRequestsBookmark . DeleteBookmark ( id , getBookmarkInfoUrl ( id ) , mSession ) ; return request ; |
public class EventFilterLexer { /** * $ ANTLR start " TIME _ MILLIS _ FUN _ NAME " */
public final void mTIME_MILLIS_FUN_NAME ( ) throws RecognitionException { } } | try { int _type = TIME_MILLIS_FUN_NAME ; int _channel = DEFAULT_TOKEN_CHANNEL ; // EventFilter . g : 49:22 : ( ' time - millis ' )
// EventFilter . g : 49:24 : ' time - millis '
{ match ( "time-millis" ) ; } state . type = _type ; state . channel = _channel ; } finally { // do for sure before leaving
} |
public class KamImpl { /** * { @ inheritDoc } */
@ Override public KamNode createNode ( Integer id , FunctionEnum functionType , String label ) throws InvalidArgument { } } | // See if the node already exists
KamNode kamNode = findNode ( id ) ; if ( null == kamNode ) { kamNode = new KamNodeImpl ( this , id , functionType , label ) ; // add this node into the graph
addNode ( kamNode ) ; } else { throw new InvalidArgument ( "node with id " + id + " already exists in the graph." ) ; } return kamNode ; |
public class LinkedList { /** * Returns the last element in this list .
* @ return the last element in this list
* @ throws NoSuchElementException if this list is empty */
public E getLast ( ) { } } | final Node < E > l = last ; if ( l == null ) throw new NoSuchElementException ( ) ; return l . item ; |
public class AbstractSamlProfileHandlerController { /** * Construct service url string .
* @ param request the request
* @ param response the response
* @ param pair the pair
* @ return the string
* @ throws SamlException the saml exception */
@ SneakyThrows protected String constructServiceUrl ( final HttpServletRequest request , final HttpServletResponse response , final Pair < ? extends SignableSAMLObject , MessageContext > pair ) throws SamlException { } } | val authnRequest = ( AuthnRequest ) pair . getLeft ( ) ; val messageContext = pair . getRight ( ) ; try ( val writer = SamlUtils . transformSamlObject ( samlProfileHandlerConfigurationContext . getOpenSamlConfigBean ( ) , authnRequest ) ) { val builder = new URLBuilder ( samlProfileHandlerConfigurationContext . getCallbackService ( ) . getId ( ) ) ; builder . getQueryParams ( ) . add ( new net . shibboleth . utilities . java . support . collection . Pair < > ( SamlProtocolConstants . PARAMETER_ENTITY_ID , SamlIdPUtils . getIssuerFromSamlObject ( authnRequest ) ) ) ; val samlRequest = EncodingUtils . encodeBase64 ( writer . toString ( ) . getBytes ( StandardCharsets . UTF_8 ) ) ; builder . getQueryParams ( ) . add ( new net . shibboleth . utilities . java . support . collection . Pair < > ( SamlProtocolConstants . PARAMETER_SAML_REQUEST , samlRequest ) ) ; builder . getQueryParams ( ) . add ( new net . shibboleth . utilities . java . support . collection . Pair < > ( SamlProtocolConstants . PARAMETER_SAML_RELAY_STATE , SAMLBindingSupport . getRelayState ( messageContext ) ) ) ; val url = builder . buildURL ( ) ; LOGGER . trace ( "Built service callback url [{}]" , url ) ; return CommonUtils . constructServiceUrl ( request , response , url , samlProfileHandlerConfigurationContext . getCasProperties ( ) . getServer ( ) . getName ( ) , CasProtocolConstants . PARAMETER_SERVICE , CasProtocolConstants . PARAMETER_TICKET , false ) ; } |
public class InternalXbaseParser { /** * $ ANTLR start synpred25 _ InternalXbase */
public final void synpred25_InternalXbase_fragment ( ) throws RecognitionException { } } | // InternalXbase . g : 2195:2 : ( ( ( rule _ _ OpOther _ _ Group _ 6_1_0 _ _ 0 ) ) )
// InternalXbase . g : 2195:2 : ( ( rule _ _ OpOther _ _ Group _ 6_1_0 _ _ 0 ) )
{ // InternalXbase . g : 2195:2 : ( ( rule _ _ OpOther _ _ Group _ 6_1_0 _ _ 0 ) )
// InternalXbase . g : 2196:3 : ( rule _ _ OpOther _ _ Group _ 6_1_0 _ _ 0 )
{ if ( state . backtracking == 0 ) { before ( grammarAccess . getOpOtherAccess ( ) . getGroup_6_1_0 ( ) ) ; } // InternalXbase . g : 2197:3 : ( rule _ _ OpOther _ _ Group _ 6_1_0 _ _ 0 )
// InternalXbase . g : 2197:4 : rule _ _ OpOther _ _ Group _ 6_1_0 _ _ 0
{ pushFollow ( FOLLOW_2 ) ; rule__OpOther__Group_6_1_0__0 ( ) ; state . _fsp -- ; if ( state . failed ) return ; } } } |
import java . io . * ; import java . lang . * ; import java . util . * ; import java . math . * ; class FindLastCharacterInstance { /** * Function to locate the last instance of a character in a string .
* Example :
* findLastCharacterInstance ( ' hello world ' , ' l ' ) - > 10
* findLastCharacterInstance ( ' language ' , ' g ' ) - > 7
* findLastCharacterInstance ( ' little ' , ' y ' ) - > None
* Parameters :
* sentence : The string in which to search for the character .
* character : The character to be located .
* Returns :
* int : The index at which the character was last found , - 1 if not found . */
public static Integer findLastCharacterInstance ( String sentence , char character ) { } } | int lastSeen = - 1 ; for ( int idx = 0 ; idx < sentence . length ( ) ; idx ++ ) { if ( sentence . charAt ( idx ) == character ) { lastSeen = idx ; } } return lastSeen == - 1 ? null : ( lastSeen + 1 ) ; |
public class ClassDefiner { /** * Return { @ link ClassLoader # defineClass } with a PermissionCollection containing AllPermission .
* This method searches for a class and returns it . If it ' s not found , it ' s defined .
* @ param classLoader the class loader
* @ param className the class name
* @ param classbytes the class bytes
* @ return the class
* @ throws LinkageError if a class is defined twice within the given class loader
* @ throws ClassFormatError if the bytes passed in are invalid */
public Class < ? > findLoadedOrDefineClass ( ClassLoader classLoader , String className , byte [ ] classbytes ) { } } | Class < ? > klass = findLoadedClass ( classLoader , className ) ; if ( klass == null ) { try { klass = defineClass ( classLoader , className , classbytes ) ; } catch ( LinkageError ex ) { klass = findLoadedClass ( classLoader , className ) ; if ( klass == null ) { throw ex ; } } } return klass ; |
public class Workgroup { /** * Asks the workgroup for it ' s Properties .
* @ return the WorkgroupProperties for the specified workgroup .
* @ throws XMPPErrorException
* @ throws NoResponseException
* @ throws NotConnectedException
* @ throws InterruptedException */
public WorkgroupProperties getWorkgroupProperties ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } } | WorkgroupProperties request = new WorkgroupProperties ( ) ; request . setType ( IQ . Type . get ) ; request . setTo ( workgroupJID ) ; return connection . createStanzaCollectorAndSend ( request ) . nextResultOrThrow ( ) ; |
public class Date { /** * getter for year - gets full year ( e . g . 2006 and NOT 06 ) , C
* @ generated
* @ return value of the feature */
public int getYear ( ) { } } | if ( Date_Type . featOkTst && ( ( Date_Type ) jcasType ) . casFeat_year == null ) jcasType . jcas . throwFeatMissing ( "year" , "de.julielab.jules.types.Date" ) ; return jcasType . ll_cas . ll_getIntValue ( addr , ( ( Date_Type ) jcasType ) . casFeatCode_year ) ; |
public class MgcpCall { /** * Registers a connection in the call .
* @ param endpointId The identifier of the endpoint that owns the connection .
* @ param connectionId The connection identifier .
* @ return Returns < code > true < / code > if connection was successfully registered . Returns < code > false < / code > otherwise . */
public boolean addConnection ( String endpointId , int connectionId ) { } } | boolean added = this . entries . put ( endpointId , connectionId ) ; if ( added && log . isDebugEnabled ( ) ) { int left = this . entries . get ( endpointId ) . size ( ) ; log . debug ( "Call " + getCallIdHex ( ) + " registered connection " + Integer . toHexString ( connectionId ) + " at endpoint " + endpointId + ". Connection count: " + left ) ; } return added ; |
public class MapOutputFile { /** * Return the path to local map output file created earlier
* @ param mapTaskId a map task id */
public Path getOutputFile ( TaskAttemptID mapTaskId ) throws IOException { } } | return lDirAlloc . getLocalPathToRead ( TaskTracker . getIntermediateOutputDir ( jobId . toString ( ) , mapTaskId . toString ( ) ) + "/file.out" , conf ) ; |
public class LoggingEventFieldResolver { /** * Apply fields .
* @ param replaceText replacement text .
* @ param event logging event .
* @ return evaluted expression */
public String applyFields ( final String replaceText , final LoggingEvent event ) { } } | if ( replaceText == null ) { return null ; } InFixToPostFix . CustomTokenizer tokenizer = new InFixToPostFix . CustomTokenizer ( replaceText ) ; StringBuffer result = new StringBuffer ( ) ; boolean found = false ; while ( tokenizer . hasMoreTokens ( ) ) { String token = tokenizer . nextToken ( ) ; if ( isField ( token ) || token . toUpperCase ( Locale . US ) . startsWith ( PROP_FIELD ) ) { result . append ( getValue ( token , event ) . toString ( ) ) ; found = true ; } else { result . append ( token ) ; } } if ( found ) { return result . toString ( ) ; } return null ; |
public class Image { /** * Returns a future which will deliver the default texture for this image once its loading has
* completed . Uses { @ link # texture } to create the texture . */
public RFuture < Texture > textureAsync ( ) { } } | return state . map ( new Function < Image , Texture > ( ) { public Texture apply ( Image image ) { return texture ( ) ; } } ) ; |
public class UpdateMaintenanceWindowRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdateMaintenanceWindowRequest updateMaintenanceWindowRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updateMaintenanceWindowRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateMaintenanceWindowRequest . getWindowId ( ) , WINDOWID_BINDING ) ; protocolMarshaller . marshall ( updateMaintenanceWindowRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( updateMaintenanceWindowRequest . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( updateMaintenanceWindowRequest . getStartDate ( ) , STARTDATE_BINDING ) ; protocolMarshaller . marshall ( updateMaintenanceWindowRequest . getEndDate ( ) , ENDDATE_BINDING ) ; protocolMarshaller . marshall ( updateMaintenanceWindowRequest . getSchedule ( ) , SCHEDULE_BINDING ) ; protocolMarshaller . marshall ( updateMaintenanceWindowRequest . getScheduleTimezone ( ) , SCHEDULETIMEZONE_BINDING ) ; protocolMarshaller . marshall ( updateMaintenanceWindowRequest . getDuration ( ) , DURATION_BINDING ) ; protocolMarshaller . marshall ( updateMaintenanceWindowRequest . getCutoff ( ) , CUTOFF_BINDING ) ; protocolMarshaller . marshall ( updateMaintenanceWindowRequest . getAllowUnassociatedTargets ( ) , ALLOWUNASSOCIATEDTARGETS_BINDING ) ; protocolMarshaller . marshall ( updateMaintenanceWindowRequest . getEnabled ( ) , ENABLED_BINDING ) ; protocolMarshaller . marshall ( updateMaintenanceWindowRequest . getReplace ( ) , REPLACE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ResultPartition { /** * Pins the result partition .
* < p > The partition can only be released after each subpartition has been consumed once per pin
* operation . */
void pin ( ) { } } | while ( true ) { int refCnt = pendingReferences . get ( ) ; if ( refCnt >= 0 ) { if ( pendingReferences . compareAndSet ( refCnt , refCnt + subpartitions . length ) ) { break ; } } else { throw new IllegalStateException ( "Released." ) ; } } |
public class JvmUnknownTypeReferenceImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case TypesPackage . JVM_UNKNOWN_TYPE_REFERENCE__QUALIFIED_NAME : setQualifiedName ( QUALIFIED_NAME_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class ValueUtils { /** * Convert a { @ link JsonNode } to { @ link List & lt ; JsonNode & gt ; } .
* @ param node
* @ return */
public static List < ? > convertArrayOrList ( JsonNode node ) { } } | if ( node instanceof POJONode ) { return convertArrayOrList ( DPathUtils . extractValue ( ( POJONode ) node ) ) ; } if ( node instanceof ArrayNode ) { List < JsonNode > result = new ArrayList < > ( ) ; ArrayNode arrNode = ( ArrayNode ) node ; for ( JsonNode jNode : arrNode ) { result . add ( jNode ) ; } return result ; } return null ; |
public class DefaultMaven2OsgiConverter { /** * Computes the file name of the bundle used in Wisdom distribution for the given Maven artifact .
* This convention is based on the uniqueness at runtime of ' bsn - version ' ( bsn is the bundle symbolic name ) .
* @ param artifact the Maven artifact
* @ return the computed name , composed by the symbolic name and the version : { @ code bsn - version . jar } */
public static String getBundleFileName ( Artifact artifact ) { } } | return getBundleFileName ( artifact . getGroupId ( ) , artifact . getArtifactId ( ) , artifact . getVersion ( ) ) ; |
public class OggStreamDecoder { /** * Reads in a chunk of data from the underlying input stream .
* @ return true if a chunk was read , false if we ' ve reached the end of the stream . */
protected boolean readChunk ( ) throws IOException { } } | int offset = _sync . buffer ( BUFFER_SIZE ) ; int bytes = _in . read ( _sync . data , offset , BUFFER_SIZE ) ; if ( bytes > 0 ) { _sync . wrote ( bytes ) ; return true ; } return false ; |
public class Slf4jLoggerFactory { /** * Wraps the specified { @ linkplain # getImplementation implementation } in a Java logger . */
protected Logger wrap ( String name , org . slf4j . Logger implementation ) { } } | return new Slf4jLogger ( name , implementation ) ; |
public class SpatialAnchorsAccountsInner { /** * Creating or Updating a Spatial Anchors Account .
* @ param resourceGroupName Name of an Azure resource group .
* @ param spatialAnchorsAccountName Name of an Mixed Reality Spatial Anchors Account .
* @ param spatialAnchorsAccount Spatial Anchors Account parameter .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the SpatialAnchorsAccountInner object */
public Observable < SpatialAnchorsAccountInner > createAsync ( String resourceGroupName , String spatialAnchorsAccountName , SpatialAnchorsAccountInner spatialAnchorsAccount ) { } } | return createWithServiceResponseAsync ( resourceGroupName , spatialAnchorsAccountName , spatialAnchorsAccount ) . map ( new Func1 < ServiceResponse < SpatialAnchorsAccountInner > , SpatialAnchorsAccountInner > ( ) { @ Override public SpatialAnchorsAccountInner call ( ServiceResponse < SpatialAnchorsAccountInner > response ) { return response . body ( ) ; } } ) ; |
public class BsfUtils { /** * Pass facesContext . getViewRoot ( ) . getLocale ( ) and attrs locale value */
public static Locale selectLocale ( Locale vrloc , Object loc , UIComponent comp ) { } } | java . util . Locale selLocale = vrloc ; if ( loc != null ) { if ( loc instanceof String ) { selLocale = BsfUtils . toLocale ( ( String ) loc ) ; } else if ( loc instanceof java . util . Locale ) { selLocale = ( java . util . Locale ) loc ; } else { throw new IllegalArgumentException ( "Type:" + loc . getClass ( ) + " is not a valid locale type for " + comp . getFamily ( ) + ":" + comp . getClientId ( ) ) ; } } return selLocale ; |
public class ConfluenceGreenPepper { /** * < p > Getter for the field < code > userAccessor < / code > . < / p >
* @ return a { @ link com . atlassian . confluence . user . UserAccessor } object . */
public UserAccessor getUserAccessor ( ) { } } | if ( userAccessor != null ) { return userAccessor ; } userAccessor = ( UserAccessor ) ContainerManager . getComponent ( "userAccessor" ) ; return userAccessor ; |
public class ExecutionEntityManagerImpl { /** * Processes a collection of { @ link ExecutionEntity } instances , which form on execution tree .
* All the executions share the same rootProcessInstanceId ( which is provided ) .
* The return value will be the root { @ link ExecutionEntity } instance , with all child { @ link ExecutionEntity }
* instances populated and set using the { @ link ExecutionEntity } instances from the provided collections */
protected ExecutionEntity processExecutionTree ( String rootProcessInstanceId , List < ExecutionEntity > executions ) { } } | ExecutionEntity rootExecution = null ; // Collect executions
Map < String , ExecutionEntity > executionMap = new HashMap < String , ExecutionEntity > ( executions . size ( ) ) ; for ( ExecutionEntity executionEntity : executions ) { if ( executionEntity . getId ( ) . equals ( rootProcessInstanceId ) ) { rootExecution = executionEntity ; } executionMap . put ( executionEntity . getId ( ) , executionEntity ) ; } // Set relationships
for ( ExecutionEntity executionEntity : executions ) { // Root process instance relationship
if ( executionEntity . getRootProcessInstanceId ( ) != null ) { executionEntity . setRootProcessInstance ( executionMap . get ( executionEntity . getRootProcessInstanceId ( ) ) ) ; } // Process instance relationship
if ( executionEntity . getProcessInstanceId ( ) != null ) { executionEntity . setProcessInstance ( executionMap . get ( executionEntity . getProcessInstanceId ( ) ) ) ; } // Parent - child relationship
if ( executionEntity . getParentId ( ) != null ) { ExecutionEntity parentExecutionEntity = executionMap . get ( executionEntity . getParentId ( ) ) ; executionEntity . setParent ( parentExecutionEntity ) ; parentExecutionEntity . addChildExecution ( executionEntity ) ; } // Super - sub execution relationship
if ( executionEntity . getSuperExecution ( ) != null ) { ExecutionEntity superExecutionEntity = executionMap . get ( executionEntity . getSuperExecutionId ( ) ) ; executionEntity . setSuperExecution ( superExecutionEntity ) ; superExecutionEntity . setSubProcessInstance ( executionEntity ) ; } } return rootExecution ; |
public class Sketch { /** * Gets the approximate lower error bound given the specified number of Standard Deviations .
* This will return getEstimate ( ) if isEmpty ( ) is true .
* @ param numStdDev
* < a href = " { @ docRoot } / resources / dictionary . html # numStdDev " > See Number of Standard Deviations < / a >
* @ return the lower bound . */
public double getLowerBound ( final int numStdDev ) { } } | return ( isEstimationMode ( ) ) ? lowerBound ( getRetainedEntries ( true ) , getThetaLong ( ) , numStdDev , isEmpty ( ) ) : getRetainedEntries ( true ) ; |
public class RestUriVariablesFactory { /** * Returns the uri variables needed for a meta call .
* @ param entityInfo
* @ param metaParameter
* @ param fieldSet
* @ return */
public Map < String , String > getUriVariablesForMeta ( BullhornEntityInfo entityInfo , MetaParameter metaParameter , Set < String > fieldSet , Integer privateLabelId ) { } } | return getUriVariablesForMeta ( entityInfo . getName ( ) , metaParameter , fieldSet , privateLabelId ) ; |
public class InheritedChannel { /** * Returns a Channel representing the inherited channel if the
* inherited channel is a stream connected to a network socket . */
public static synchronized Channel getChannel ( ) throws IOException { } } | if ( devnull < 0 ) { devnull = open0 ( "/dev/null" , O_RDWR ) ; } // If we don ' t have the channel try to create it
if ( ! haveChannel ) { channel = createChannel ( ) ; haveChannel = true ; } // if there is a channel then do the security check before
// returning it .
if ( channel != null ) { checkAccess ( channel ) ; } return channel ; |
public class DisableEnhancedMonitoringResult { /** * Represents the list of all the metrics that would be in the enhanced state after the operation .
* @ param desiredShardLevelMetrics
* Represents the list of all the metrics that would be in the enhanced state after the operation .
* @ see MetricsName */
public void setDesiredShardLevelMetrics ( java . util . Collection < String > desiredShardLevelMetrics ) { } } | if ( desiredShardLevelMetrics == null ) { this . desiredShardLevelMetrics = null ; return ; } this . desiredShardLevelMetrics = new com . amazonaws . internal . SdkInternalList < String > ( desiredShardLevelMetrics ) ; |
public class UTEHelperFactory { /** * This method is used to return an instance of the UTEHelper .
* @ return UTEHelper
* @ throws IllegalStateException if called when the JMS Test environment is not enabled . */
public static synchronized UTEHelper getHelperInstance ( ) throws java . lang . IllegalStateException { } } | if ( tcInt . isEntryEnabled ( ) ) SibTr . entry ( tcInt , "getHelperInstance" ) ; // * * * * * CHECK TO SEE IF IT IS ENABLED * * * * *
try { // Initialise the test env flag from a system property if it has been set .
String prop = System . getProperty ( "com.ibm.ws.sib.api.testenv" ) ; // Check that the text reads " enabled " .
if ( ( prop != null ) && ( "enabled" . equals ( prop . toLowerCase ( ) ) ) ) { if ( tcInt . isDebugEnabled ( ) ) SibTr . debug ( tcInt , "TestEnv flag enabled by system property." ) ; UTEHelperFactory . jmsTestEnvironmentEnabled = true ; } else { if ( tcInt . isDebugEnabled ( ) ) SibTr . debug ( tcInt , "testenv system property was present but did not enable testenv - " + prop ) ; } // if
} catch ( SecurityException sce ) { // No FFDC code needed
if ( tcInt . isDebugEnabled ( ) ) SibTr . debug ( tcInt , "Could not read system property due to SecurityException" , sce ) ; } // try
// d250397 IGH it is valid to use a UTEHelper with UTE disabled
// when running unit tests in remote client mode ( see JMSTestCase )
// so don ' t throw an exception here
/* if ( ! UTEHelperFactory . jmsTestEnvironmentEnabled )
/ / NB . This is for unit test only and so need not be NLS ' d .
throw new java . lang . IllegalStateException ( " JMS Test Environment is not enabled . " ) ;
} / / if */
if ( instance == null ) { try { instance = ( UTEHelper ) Class . forName ( "com.ibm.ws.sib.api.jms.impl.ute.UTEHelperImpl" ) . newInstance ( ) ; } catch ( Exception e ) { // No FFDC code needed
if ( tcInt . isDebugEnabled ( ) ) SibTr . debug ( tcInt , "Couldn't find impl class" , e ) ; RuntimeException f = new java . lang . IllegalStateException ( "UTEHelperFactory.getHelperInstance()" ) ; f . initCause ( e ) ; if ( tcInt . isEntryEnabled ( ) ) SibTr . exit ( tcInt , "getHelperInstance" ) ; throw f ; } } if ( tcInt . isEntryEnabled ( ) ) SibTr . exit ( tcInt , "getHelperInstance" ) ; return instance ; |
public class QRExampleOperations { /** * Returns the Q matrix . */
public DMatrixRMaj getQ ( ) { } } | DMatrixRMaj Q = CommonOps_DDRM . identity ( QR . numRows ) ; DMatrixRMaj Q_k = new DMatrixRMaj ( QR . numRows , QR . numRows ) ; DMatrixRMaj u = new DMatrixRMaj ( QR . numRows , 1 ) ; DMatrixRMaj temp = new DMatrixRMaj ( 1 , 1 ) ; int N = Math . min ( QR . numCols , QR . numRows ) ; // compute Q by first extracting the householder vectors from the columns of QR and then applying it to Q
for ( int j = N - 1 ; j >= 0 ; j -- ) { CommonOps_DDRM . extract ( QR , j , QR . numRows , j , j + 1 , u , j , 0 ) ; u . set ( j , 1.0 ) ; // A = ( I - & gamma ; * u * u < sup > T < / sup > ) * A < br >
CommonOps_DDRM . setIdentity ( Q_k ) ; CommonOps_DDRM . multAddTransB ( - gammas [ j ] , u , u , Q_k ) ; CommonOps_DDRM . mult ( Q_k , Q , temp ) ; Q . set ( temp ) ; } return Q ; |
public class BaseTemplateFactory { /** * Process template and data using provided { @ link TemplateLoader } and { @ link TemplateRenderer } to generate skill response output .
* @ param responseTemplateName name of response template
* @ param dataMap map contains injecting data
* @ param input skill input
* @ return Output skill response output if loading and rendering successfully
* @ throws TemplateFactoryException if fail to load or render template */
@ Override public Output processTemplate ( String responseTemplateName , Map < String , Object > dataMap , Input input ) throws TemplateFactoryException { } } | if ( templateLoaders == null || templateLoaders . isEmpty ( ) || templateRenderer == null ) { String message = "Template Loader list is null or empty, or Template Renderer is null." ; LOGGER . error ( message ) ; throw new TemplateFactoryException ( message ) ; } TemplateContentData templateContentData = loadTemplate ( responseTemplateName , input ) ; Output response = renderResponse ( templateContentData , dataMap ) ; return response ; |
public class TabbedPaneBottomTabState { /** * { @ inheritDoc } */
public boolean isInState ( JComponent c ) { } } | return ( c instanceof JTabbedPane && ( ( JTabbedPane ) c ) . getTabPlacement ( ) == JTabbedPane . BOTTOM ) ; |
public class MolgenisDateFormat { /** * Tries to parse a value representing a LocalDate . Tries many formats , but does require that the
* date month and year are provided in yyyy - mm - dd form . If too much information is provided , such
* as time and / or time zone , will simply truncate those away .
* @ param value the value to parse .
* @ return the parsed { @ link LocalDate }
* @ throws DateTimeParseException if parsing fails */
public static LocalDate parseLocalDate ( String value ) { } } | TemporalAccessor temporalAccessor = DateTimeFormatter . ofPattern ( LOOSE_PARSER_FORMAT ) . parseBest ( value , ZonedDateTime :: from , LocalDate :: from ) ; if ( temporalAccessor instanceof ZonedDateTime ) { return ( ( ZonedDateTime ) temporalAccessor ) . toLocalDate ( ) ; } return ( LocalDate ) temporalAccessor ; |
public class Vector3d { /** * Reflect this vector about the given normal vector .
* @ param x
* the x component of the normal
* @ param y
* the y component of the normal
* @ param z
* the z component of the normal
* @ return a vector holding the result */
public Vector3d reflect ( double x , double y , double z ) { } } | return reflect ( x , y , z , thisOrNew ( ) ) ; |
public class RowKey { /** * Check if a column is part of the row key columns .
* @ param column the name of the column to check
* @ return true if the column is one of the row key columns , false otherwise */
public boolean contains ( String column ) { } } | for ( String columnName : columnNames ) { if ( columnName . equals ( column ) ) { return true ; } } return false ; |
public class PlatformDependent { /** * Determine if a subsection of an array is zero .
* @ param bytes The byte array .
* @ param startPos The starting index ( inclusive ) in { @ code bytes } .
* @ param length The amount of bytes to check for zero .
* @ return { @ code false } if { @ code bytes [ startPos : startsPos + length ) } contains a value other than zero . */
public static boolean isZero ( byte [ ] bytes , int startPos , int length ) { } } | return ! hasUnsafe ( ) || ! unalignedAccess ( ) ? isZeroSafe ( bytes , startPos , length ) : PlatformDependent0 . isZero ( bytes , startPos , length ) ; |
public class Files { /** * Given a directory , removes all the content found in the directory .
* @ param dir The directory to be emptied
* @ throws Exception */
static public void emptyDirectory ( File dir ) throws Exception { } } | String [ ] fileNames = dir . list ( ) ; if ( null != fileNames ) { for ( String fileName : fileNames ) { File file = new File ( dir , fileName ) ; if ( file . isDirectory ( ) ) { emptyDirectory ( file ) ; } boolean deleted = false ; try { deleted = file . delete ( ) ; } catch ( Exception e ) { throw new Exception ( "Unable to delete: " + file . getAbsolutePath ( ) , e ) ; } if ( ! deleted ) { throw new Exception ( "Unable to delete: " + file . getAbsolutePath ( ) ) ; } } } |
public class AppIdentityService { /** * getAppIdentity
* @ return The application identity */
public AppIdentity getAppIdentity ( ) { } } | if ( isCached ( defaultApiConfig . getApplication ( ) ) ) return applicationIdentityCache . get ( defaultApiConfig . getApplication ( ) ) . getAppIdentity ( ) ; else return getAppIdentity ( defaultApiConfig ) ; |
public class OmemoStore { /** * Return the fingerprint of the identityKey belonging to contactsDevice .
* @ param userDevice our OmemoDevice .
* @ param contactsDevice OmemoDevice we want to have the fingerprint for .
* @ return fingerprint of the userDevices IdentityKey .
* @ throws CorruptedOmemoKeyException if the IdentityKey is corrupted .
* @ throws NoIdentityKeyException if no IdentityKey for contactsDevice has been found locally . */
public OmemoFingerprint getFingerprint ( OmemoDevice userDevice , OmemoDevice contactsDevice ) throws CorruptedOmemoKeyException , NoIdentityKeyException { } } | T_IdKey identityKey = loadOmemoIdentityKey ( userDevice , contactsDevice ) ; if ( identityKey == null ) { throw new NoIdentityKeyException ( contactsDevice ) ; } return keyUtil ( ) . getFingerprintOfIdentityKey ( identityKey ) ; |
public class SingleThreadedOperation { /** * Starts the one and only job instance in a separate Thread . Should be called exactly one time before
* the operation is stopped .
* @ param arguments { @ inheritDoc } */
@ Override public void start ( String [ ] arguments ) { } } | boolean notStarted = ! started . getAndSet ( true ) ; if ( notStarted ) { start ( new SingleInstanceWorkloadStrategy ( job , name , arguments , endpointRegistry , execService ) ) ; } |
public class SqlgUtil { /** * Loads all labeled or emitted elements .
* @ param sqlgGraph
* @ param resultSet
* @ param subQueryStack
* @ param lastQueryStack
* @ param idColumnCountMap
* @ return
* @ throws SQLException */
@ SuppressWarnings ( "unchecked" ) private static < E extends SqlgElement > List < Emit < E > > loadLabeledElements ( SqlgGraph sqlgGraph , final ResultSet resultSet , LinkedList < SchemaTableTree > subQueryStack , boolean lastQueryStack , Map < String , Integer > idColumnCountMap , boolean forParent ) throws SQLException { } } | List < Emit < E > > result = new ArrayList < > ( ) ; int count = 1 ; for ( SchemaTableTree schemaTableTree : subQueryStack ) { if ( ! schemaTableTree . getLabels ( ) . isEmpty ( ) ) { E sqlgElement = null ; boolean resultSetWasNull ; if ( schemaTableTree . isHasIDPrimaryKey ( ) ) { String idProperty = schemaTableTree . labeledAliasId ( ) ; Integer columnCount = idColumnCountMap . get ( idProperty ) ; Long id = resultSet . getLong ( columnCount ) ; resultSetWasNull = resultSet . wasNull ( ) ; if ( ! resultSetWasNull ) { if ( schemaTableTree . getSchemaTable ( ) . isVertexTable ( ) ) { String rawLabel = schemaTableTree . getSchemaTable ( ) . getTable ( ) . substring ( VERTEX_PREFIX . length ( ) ) ; sqlgElement = ( E ) SqlgVertex . of ( sqlgGraph , id , schemaTableTree . getSchemaTable ( ) . getSchema ( ) , rawLabel ) ; schemaTableTree . loadProperty ( resultSet , sqlgElement ) ; } else { String rawLabel = schemaTableTree . getSchemaTable ( ) . getTable ( ) . substring ( EDGE_PREFIX . length ( ) ) ; sqlgElement = ( E ) new SqlgEdge ( sqlgGraph , id , schemaTableTree . getSchemaTable ( ) . getSchema ( ) , rawLabel ) ; schemaTableTree . loadProperty ( resultSet , sqlgElement ) ; schemaTableTree . loadEdgeInOutVertices ( resultSet , ( SqlgEdge ) sqlgElement ) ; } } } else { List < Comparable > identifierObjects = schemaTableTree . loadIdentifierObjects ( idColumnCountMap , resultSet ) ; resultSetWasNull = resultSet . wasNull ( ) ; if ( ! resultSetWasNull ) { if ( schemaTableTree . getSchemaTable ( ) . isVertexTable ( ) ) { String rawLabel = schemaTableTree . getSchemaTable ( ) . getTable ( ) . substring ( VERTEX_PREFIX . length ( ) ) ; sqlgElement = ( E ) SqlgVertex . of ( sqlgGraph , identifierObjects , schemaTableTree . getSchemaTable ( ) . getSchema ( ) , rawLabel ) ; schemaTableTree . loadProperty ( resultSet , sqlgElement ) ; } else { String rawLabel = schemaTableTree . getSchemaTable ( ) . getTable ( ) . substring ( EDGE_PREFIX . length ( ) ) ; sqlgElement = ( E ) new SqlgEdge ( sqlgGraph , identifierObjects , schemaTableTree . getSchemaTable ( ) . getSchema ( ) , rawLabel ) ; schemaTableTree . loadProperty ( resultSet , sqlgElement ) ; schemaTableTree . loadEdgeInOutVertices ( resultSet , ( SqlgEdge ) sqlgElement ) ; } } } if ( ! resultSetWasNull ) { // The following if statement is for for " repeat ( traversal ( ) ) . emit ( ) . as ( ' label ' ) "
// i . e . for emit queries with labels
// Only the last node in the subQueryStacks ' subQueryStack must get the labels as the label only apply to the exiting element that gets emitted .
// Elements that come before the last element in the path must not get the labels .
Emit < E > emit ; if ( schemaTableTree . isEmit ( ) && ! lastQueryStack ) { if ( forParent ) { // 1 is the parentIndex . This is the id of the incoming parent .
emit = new Emit < > ( resultSet . getLong ( 1 ) , sqlgElement , Collections . emptySet ( ) , schemaTableTree . getStepDepth ( ) , schemaTableTree . getSqlgComparatorHolder ( ) ) ; } else { emit = new Emit < > ( sqlgElement , Collections . emptySet ( ) , schemaTableTree . getStepDepth ( ) , schemaTableTree . getSqlgComparatorHolder ( ) ) ; } } else if ( schemaTableTree . isEmit ( ) && lastQueryStack && ( count != subQueryStack . size ( ) ) ) { if ( forParent ) { emit = new Emit < > ( resultSet . getLong ( 1 ) , sqlgElement , Collections . emptySet ( ) , schemaTableTree . getStepDepth ( ) , schemaTableTree . getSqlgComparatorHolder ( ) ) ; } else { emit = new Emit < > ( sqlgElement , Collections . emptySet ( ) , schemaTableTree . getStepDepth ( ) , schemaTableTree . getSqlgComparatorHolder ( ) ) ; } } else { if ( forParent ) { emit = new Emit < > ( resultSet . getLong ( 1 ) , sqlgElement , schemaTableTree . getRealLabels ( ) , schemaTableTree . getStepDepth ( ) , schemaTableTree . getSqlgComparatorHolder ( ) ) ; } else { emit = new Emit < > ( sqlgElement , schemaTableTree . getRealLabels ( ) , schemaTableTree . getStepDepth ( ) , schemaTableTree . getSqlgComparatorHolder ( ) ) ; } } SchemaTableTree lastSchemaTableTree = subQueryStack . getLast ( ) ; if ( lastSchemaTableTree . isLocalStep ( ) && lastSchemaTableTree . isOptionalLeftJoin ( ) ) { emit . setIncomingOnlyLocalOptionalStep ( true ) ; } result . add ( emit ) ; } } count ++ ; } return result ; |
public class CSSCompiler { /** * { @ inheritDoc } */
@ Override public OneCSS getNewSource ( final String _name , final Instance _instance ) { } } | return new OneCSS ( _name , _instance ) ; |
public class DbSessionImpl { /** * We only care about the the commit section .
* The rest is simply passed to its parent . */
@ Override public < T > Cursor < T > selectCursor ( String statement ) { } } | return session . selectCursor ( statement ) ; |
public class DeviceDataDAODefaultImpl { public void insert_ul ( final DeviceData deviceData , final long argin ) { } } | final int val = ( int ) ( argin & 0xFFFFFFFF ) ; DevULongHelper . insert ( deviceData . getAny ( ) , val ) ; |
public class Gen { /** * Visitor method : generate code for a definition , catching and reporting
* any completion failures .
* @ param tree The definition to be visited .
* @ param env The environment current at the definition . */
public void genDef ( JCTree tree , Env < GenContext > env ) { } } | Env < GenContext > prevEnv = this . env ; try { this . env = env ; tree . accept ( this ) ; } catch ( CompletionFailure ex ) { chk . completionError ( tree . pos ( ) , ex ) ; } finally { this . env = prevEnv ; } |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcStructuralLoadSingleDisplacement ( ) { } } | if ( ifcStructuralLoadSingleDisplacementEClass == null ) { ifcStructuralLoadSingleDisplacementEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 549 ) ; } return ifcStructuralLoadSingleDisplacementEClass ; |
public class InternalJSONUtil { /** * 按照给定格式格式化日期 , 格式为空时返回时间戳字符串
* @ param dateObj Date或者Calendar对象
* @ param format 格式
* @ return 日期字符串 */
private static String formatDate ( Object dateObj , String format ) { } } | if ( StrUtil . isNotBlank ( format ) ) { final Date date = ( dateObj instanceof Date ) ? ( Date ) dateObj : ( ( Calendar ) dateObj ) . getTime ( ) ; // 用户定义了日期格式
return DateUtil . format ( date , format ) ; } // 默认使用时间戳
return String . valueOf ( ( dateObj instanceof Date ) ? ( ( Date ) dateObj ) . getTime ( ) : ( ( Calendar ) dateObj ) . getTimeInMillis ( ) ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcCooledBeamType ( ) { } } | if ( ifcCooledBeamTypeEClass == null ) { ifcCooledBeamTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 119 ) ; } return ifcCooledBeamTypeEClass ; |
public class SleeSipProviderImpl { /** * Creates a new { @ link ClientTransactionWrapper } bound to a
* { @ link DialogWrapper } , which is not an activity in SLEE .
* @ param dialogWrapper
* @ param request
* @ return
* @ throws TransactionUnavailableException */
public ClientTransactionWrapper getNewDialogActivityClientTransaction ( DialogWrapper dialogWrapper , Request request ) throws TransactionUnavailableException { } } | final SIPClientTransaction ct = ( SIPClientTransaction ) provider . getNewClientTransaction ( request ) ; final ClientTransactionWrapper ctw = new ClientTransactionWrapper ( ct , ra ) ; dialogWrapper . addOngoingTransaction ( ctw ) ; return ctw ; |
public class Caster { /** * cast a Object to a byte value ( primitive value type )
* @ param o Object to cast
* @ return casted byte value
* @ throws PageException
* @ throws CasterException */
public static byte toByteValue ( Object o ) throws PageException { } } | if ( o instanceof Byte ) return ( ( Byte ) o ) . byteValue ( ) ; if ( o instanceof Character ) return ( byte ) ( ( ( Character ) o ) . charValue ( ) ) ; else if ( o instanceof Boolean ) return ( byte ) ( ( ( ( Boolean ) o ) . booleanValue ( ) ) ? 1 : 0 ) ; else if ( o instanceof Number ) return ( ( ( Number ) o ) . byteValue ( ) ) ; else if ( o instanceof String ) return ( byte ) toDoubleValue ( o . toString ( ) ) ; else if ( o instanceof ObjectWrap ) { return toByteValue ( ( ( ObjectWrap ) o ) . getEmbededObject ( ) ) ; } throw new CasterException ( o , "byte" ) ; |
public class CommerceRegionPersistenceImpl { /** * Returns the first commerce region in the ordered set where commerceCountryId = & # 63 ; .
* @ param commerceCountryId the commerce country ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce region
* @ throws NoSuchRegionException if a matching commerce region could not be found */
@ Override public CommerceRegion findByCommerceCountryId_First ( long commerceCountryId , OrderByComparator < CommerceRegion > orderByComparator ) throws NoSuchRegionException { } } | CommerceRegion commerceRegion = fetchByCommerceCountryId_First ( commerceCountryId , orderByComparator ) ; if ( commerceRegion != null ) { return commerceRegion ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "commerceCountryId=" ) ; msg . append ( commerceCountryId ) ; msg . append ( "}" ) ; throw new NoSuchRegionException ( msg . toString ( ) ) ; |
public class cachecontentgroup { /** * Use this API to add cachecontentgroup . */
public static base_response add ( nitro_service client , cachecontentgroup resource ) throws Exception { } } | cachecontentgroup addresource = new cachecontentgroup ( ) ; addresource . name = resource . name ; addresource . weakposrelexpiry = resource . weakposrelexpiry ; addresource . heurexpiryparam = resource . heurexpiryparam ; addresource . relexpiry = resource . relexpiry ; addresource . relexpirymillisec = resource . relexpirymillisec ; addresource . absexpiry = resource . absexpiry ; addresource . absexpirygmt = resource . absexpirygmt ; addresource . weaknegrelexpiry = resource . weaknegrelexpiry ; addresource . hitparams = resource . hitparams ; addresource . invalparams = resource . invalparams ; addresource . ignoreparamvaluecase = resource . ignoreparamvaluecase ; addresource . matchcookies = resource . matchcookies ; addresource . invalrestrictedtohost = resource . invalrestrictedtohost ; addresource . polleverytime = resource . polleverytime ; addresource . ignorereloadreq = resource . ignorereloadreq ; addresource . removecookies = resource . removecookies ; addresource . prefetch = resource . prefetch ; addresource . prefetchperiod = resource . prefetchperiod ; addresource . prefetchperiodmillisec = resource . prefetchperiodmillisec ; addresource . prefetchmaxpending = resource . prefetchmaxpending ; addresource . flashcache = resource . flashcache ; addresource . expireatlastbyte = resource . expireatlastbyte ; addresource . insertvia = resource . insertvia ; addresource . insertage = resource . insertage ; addresource . insertetag = resource . insertetag ; addresource . cachecontrol = resource . cachecontrol ; addresource . quickabortsize = resource . quickabortsize ; addresource . minressize = resource . minressize ; addresource . maxressize = resource . maxressize ; addresource . memlimit = resource . memlimit ; addresource . ignorereqcachinghdrs = resource . ignorereqcachinghdrs ; addresource . minhits = resource . minhits ; addresource . alwaysevalpolicies = resource . alwaysevalpolicies ; addresource . persist = resource . persist ; addresource . pinned = resource . pinned ; addresource . lazydnsresolve = resource . lazydnsresolve ; addresource . hitselector = resource . hitselector ; addresource . invalselector = resource . invalselector ; addresource . type = resource . type ; return addresource . add_resource ( client ) ; |
public class PrivateZonesInner { /** * Creates or updates a Private DNS zone . Does not modify Links to virtual networks or DNS records within the zone .
* @ param resourceGroupName The name of the resource group .
* @ param privateZoneName The name of the Private DNS zone ( without a terminating dot ) .
* @ param parameters Parameters supplied to the CreateOrUpdate operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the PrivateZoneInner object if successful . */
public PrivateZoneInner createOrUpdate ( String resourceGroupName , String privateZoneName , PrivateZoneInner parameters ) { } } | return createOrUpdateWithServiceResponseAsync ( resourceGroupName , privateZoneName , parameters ) . toBlocking ( ) . last ( ) . body ( ) ; |
public class CmsSystemConfiguration { /** * Sets the locale manager for multi language support . < p >
* @ param localeManager the locale manager to set */
public void setLocaleManager ( CmsLocaleManager localeManager ) { } } | m_localeManager = localeManager ; if ( CmsLog . INIT . isInfoEnabled ( ) ) { CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_CONFIG_I18N_FINISHED_0 ) ) ; } |
public class Duration { /** * / * [ deutsch ]
* < p > Liefert eine Kopie dieser Instanz , in der der angegebene Betrag zum
* mit der angegebenen Zeiteinheit assoziierten Feldwert addiert wird . < / p >
* < p > Die Methode ber & uuml ; cksichtigt auch das Vorzeichen der Zeitspanne .
* Beispiel : < / p >
* < pre >
* System . out . println ( Duration . of ( 5 , MONTHS ) . plus ( - 6 , MONTHS ) ) ;
* / / output : - P1M
* < / pre >
* < p > Notiz : Ist der zu addierende Betrag gleich { @ code 0 } , liefert die
* Methode einfach diese Instanz selbst zur & uuml ; ck . Gemischte Vorzeichen
* im Ergebnis sind nicht zul & auml ; ssig und werden mit einem Abbruch
* quittiert : < / p >
* < pre >
* Duration . of ( - 1 , MONTHS ) . plus ( 30 , DAYS ) ; / / throws IllegalStateException
* < / pre >
* @ param amount temporal amount to be added ( maybe negative )
* @ param unit associated time unit
* @ return new changed duration while this duration remains unaffected
* @ throws IllegalStateException if the result gets mixed signs by adding the partial amounts
* @ throws IllegalArgumentException if different units of same length exist
* @ throws ArithmeticException in case of long overflow
* @ see # with ( long , IsoUnit ) with ( long , U ) */
public Duration < U > plus ( long amount , U unit ) { } } | if ( unit == null ) { throw new NullPointerException ( "Missing chronological unit." ) ; } long originalAmount = amount ; U originalUnit = unit ; boolean negatedValue = false ; if ( amount == 0 ) { return this ; } else if ( amount < 0 ) { amount = MathUtils . safeNegate ( amount ) ; negatedValue = true ; } // Millis und Micros ersetzen
List < Item < U > > temp = new ArrayList < > ( this . getTotalLength ( ) ) ; Item < U > item = replaceFraction ( amount , unit ) ; if ( item != null ) { amount = item . getAmount ( ) ; unit = item . getUnit ( ) ; } if ( this . isEmpty ( ) ) { temp . add ( ( item == null ) ? Item . of ( amount , unit ) : item ) ; return new Duration < > ( temp , negatedValue ) ; } // Items aktualisieren
int index = this . getIndex ( unit ) ; boolean resultNegative = this . isNegative ( ) ; if ( index < 0 ) { // Einheit nicht vorhanden
if ( this . isNegative ( ) == negatedValue ) { temp . add ( Item . of ( amount , unit ) ) ; } else { // mixed signs possible = > last try
return this . plus ( Duration . of ( originalAmount , originalUnit ) ) ; } } else { long sum = MathUtils . safeAdd ( MathUtils . safeMultiply ( temp . get ( index ) . getAmount ( ) , ( this . isNegative ( ) ? - 1 : 1 ) ) , MathUtils . safeMultiply ( amount , ( negatedValue ? - 1 : 1 ) ) ) ; if ( sum == 0 ) { temp . remove ( index ) ; } else if ( ( this . count ( ) == 1 ) || ( this . isNegative ( ) == ( sum < 0 ) ) ) { long absSum = ( ( sum < 0 ) ? MathUtils . safeNegate ( sum ) : sum ) ; temp . set ( index , Item . of ( absSum , unit ) ) ; resultNegative = ( sum < 0 ) ; } else { // mixed signs possible = > last try
return this . plus ( Duration . of ( originalAmount , originalUnit ) ) ; } } return new Duration < > ( temp , resultNegative ) ; |
public class AFactoryAppBeans { /** * < p > Get FctBnCnvBnFromRs in lazy mode . < / p >
* @ return FctBnCnvBnFromRs - FctBnCnvBnFromRs
* @ throws Exception - an exception */
public final FctBnCnvBnFromRs < RS > lazyGetFctBnCnvBnFromRs ( ) throws Exception { } } | String beanName = getFctBnCnvBnFromRsName ( ) ; @ SuppressWarnings ( "unchecked" ) FctBnCnvBnFromRs < RS > fctBnCnvBnFromRs = ( FctBnCnvBnFromRs < RS > ) this . beansMap . get ( beanName ) ; if ( fctBnCnvBnFromRs == null ) { fctBnCnvBnFromRs = new FctBnCnvBnFromRs < RS > ( ) ; fctBnCnvBnFromRs . setEntitiesFactoriesFatory ( this . factoryBldServices . lazyGetFctBcFctSimpleEntities ( ) ) ; fctBnCnvBnFromRs . setFillersFieldsFactory ( lazyGetFctFillersObjectFields ( ) ) ; fctBnCnvBnFromRs . setFieldsRapiHolder ( lazyGetHolderRapiFields ( ) ) ; this . beansMap . put ( beanName , fctBnCnvBnFromRs ) ; lazyGetLogger ( ) . info ( null , AFactoryAppBeans . class , beanName + " has been created." ) ; } return fctBnCnvBnFromRs ; |
public class PDBFileParser { /** * Process the disulfide bond info provided by an SSBOND record
* < pre >
* COLUMNS DATA TYPE FIELD DEFINITION
* 1 - 6 Record name " SSBOND "
* 8 - 10 Integer serNum Serial number .
* 12 - 14 LString ( 3 ) " CYS " Residue name .
* 16 Character chainID1 Chain identifier .
* 18 - 21 Integer seqNum1 Residue sequence number .
* 22 AChar icode1 Insertion code .
* 26 - 28 LString ( 3 ) " CYS " Residue name .
* 30 Character chainID2 Chain identifier .
* 32 - 35 Integer seqNum2 Residue sequence number .
* 36 AChar icode2 Insertion code .
* 60 - 65 SymOP sym1 Symmetry oper for 1st resid
* 67 - 72 SymOP sym2 Symmetry oper for 2nd resid
* < / pre > */
private void pdb_SSBOND_Handler ( String line ) { } } | if ( params . isHeaderOnly ( ) ) return ; if ( line . length ( ) < 36 ) { logger . info ( "SSBOND line has length under 36. Ignoring it." ) ; return ; } String chain1 = line . substring ( 15 , 16 ) ; String seqNum1 = line . substring ( 17 , 21 ) . trim ( ) ; String icode1 = line . substring ( 21 , 22 ) ; String chain2 = line . substring ( 29 , 30 ) ; String seqNum2 = line . substring ( 31 , 35 ) . trim ( ) ; String icode2 = line . substring ( 35 , 36 ) ; if ( line . length ( ) >= 72 ) { String symop1 = line . substring ( 59 , 65 ) . trim ( ) ; String symop2 = line . substring ( 66 , 72 ) . trim ( ) ; // until we implement proper treatment of symmetry in biojava # 220 , we can ' t deal with sym - related parteners properly , skipping them
if ( ! symop1 . equals ( "" ) && ! symop2 . equals ( "" ) && // in case the field is missing
( ! symop1 . equals ( "1555" ) || ! symop2 . equals ( "1555" ) ) ) { logger . info ( "Skipping ss bond between groups {} and {} belonging to different symmetry partners, because it is not supported yet" , seqNum1 + icode1 , seqNum2 + icode2 ) ; return ; } } if ( icode1 . equals ( " " ) ) icode1 = "" ; if ( icode2 . equals ( " " ) ) icode2 = "" ; SSBondImpl ssbond = new SSBondImpl ( ) ; ssbond . setChainID1 ( chain1 ) ; ssbond . setResnum1 ( seqNum1 ) ; ssbond . setChainID2 ( chain2 ) ; ssbond . setResnum2 ( seqNum2 ) ; ssbond . setInsCode1 ( icode1 ) ; ssbond . setInsCode2 ( icode2 ) ; ssbonds . add ( ssbond ) ; |
public class WhileyFileParser { /** * Parse a < i > property declaration < / i > which has the form :
* < pre >
* ProeprtyDeclaration : : = " property " Parameters " - > " Parameters ( WhereClause ) *
* PropertyClause : : = " where " Expr
* < / pre > */
private Decl . Property parsePropertyDeclaration ( Tuple < Modifier > modifiers ) { } } | EnclosingScope scope = new EnclosingScope ( ) ; int start = index ; match ( Property ) ; Identifier name = parseIdentifier ( ) ; Tuple < Template . Variable > template = parseOptionalTemplate ( scope ) ; Tuple < Decl . Variable > parameters = parseParameters ( scope , RightBrace ) ; Tuple < Expr > invariant = parseInvariant ( scope , Where ) ; int end = index ; matchEndLine ( ) ; return annotateSourceLocation ( new Decl . Property ( modifiers , name , template , parameters , invariant ) , start ) ; |
public class StorageUpdate21 { /** * Deserialize an object from a byte array . */
private Object deserialize ( InputStream byteStream ) throws IOException , ClassNotFoundException { } } | ObjectInputStream in = new ObjectInputStream ( byteStream ) ; try { return in . readObject ( ) ; } finally { in . close ( ) ; } |
public class NetworkMonitor { /** * Reads all options in the specified array , and puts relevant options into the
* supplied options map .
* On options not relevant for doing network monitoring ( like < code > help < / code > ) ,
* this method will take appropriate action ( like showing usage information ) . On
* occurrence of such an option , other options will be ignored . On unknown options , an
* IllegalArgumentException is thrown .
* @ param args array with command line options
* @ param options map to store options , optionally with its associated value
* @ return < code > true < / code > if the supplied provide enough information to continue
* with monitoring , < code > false < / code > otherwise or if the options were
* handled by this method */
private static boolean parseOptions ( String [ ] args , Map options ) { } } | if ( args . length == 0 ) { System . out . println ( "A tool for monitoring a KNX network" ) ; showVersion ( ) ; System . out . println ( "type -help for help message" ) ; return false ; } // add defaults
options . put ( "port" , new Integer ( KNXnetIPConnection . IP_PORT ) ) ; options . put ( "medium" , TPSettings . TP1 ) ; int i = 0 ; for ( ; i < args . length ; i ++ ) { final String arg = args [ i ] ; if ( isOption ( arg , "-help" , "-h" ) ) { showUsage ( ) ; return false ; } if ( isOption ( arg , "-version" , null ) ) { showVersion ( ) ; return false ; } if ( isOption ( arg , "-verbose" , "-v" ) ) options . put ( "verbose" , null ) ; else if ( isOption ( arg , "-localhost" , null ) ) parseHost ( args [ ++ i ] , true , options ) ; else if ( isOption ( arg , "-localport" , null ) ) options . put ( "localport" , Integer . decode ( args [ ++ i ] ) ) ; else if ( isOption ( arg , "-port" , "-p" ) ) options . put ( "port" , Integer . decode ( args [ ++ i ] ) ) ; else if ( isOption ( arg , "-nat" , "-n" ) ) options . put ( "nat" , null ) ; else if ( isOption ( arg , "-serial" , "-s" ) ) options . put ( "serial" , null ) ; else if ( isOption ( arg , "-medium" , "-m" ) ) options . put ( "medium" , getMedium ( args [ ++ i ] ) ) ; else if ( options . containsKey ( "serial" ) ) // add port number / identifier to serial option
options . put ( "serial" , arg ) ; else if ( ! options . containsKey ( "host" ) ) parseHost ( arg , false , options ) ; else throw new IllegalArgumentException ( "unknown option " + arg ) ; } return true ; |
public class StatementManager { /** * returns an array containing values for all the Objects attribute
* @ throws PersistenceBrokerException if there is an erros accessing obj field values */
protected ValueContainer [ ] getAllValues ( ClassDescriptor cld , Object obj ) throws PersistenceBrokerException { } } | return m_broker . serviceBrokerHelper ( ) . getAllRwValues ( cld , obj ) ; |
public class CacheImpl { /** * The asynchronous method of { @ link # executeCommandWithInjectedTx ( InvocationContext , VisitableCommand ) } */
private < T > CompletableFuture < T > executeCommandAsyncWithInjectedTx ( InvocationContext ctx , VisitableCommand command ) { } } | CompletableFuture < T > cf ; final Transaction implicitTransaction ; try { // interceptors must not access thread - local transaction anyway
implicitTransaction = transactionManager . suspend ( ) ; assert implicitTransaction != null ; // noinspection unchecked
cf = ( CompletableFuture < T > ) invoker . invokeAsync ( ctx , command ) ; } catch ( SystemException e ) { throw new CacheException ( "Cannot suspend implicit transaction" , e ) ; } catch ( Throwable e ) { tryRollback ( ) ; throw e ; } return cf . handle ( ( result , throwable ) -> { if ( throwable != null ) { try { implicitTransaction . rollback ( ) ; } catch ( SystemException e ) { log . trace ( "Could not rollback" , e ) ; throwable . addSuppressed ( e ) ; } throw CompletableFutures . asCompletionException ( throwable ) ; } try { implicitTransaction . commit ( ) ; } catch ( Exception e ) { log . couldNotCompleteInjectedTransaction ( e ) ; throw CompletableFutures . asCompletionException ( e ) ; } return result ; } ) ; |
public class ObjectArrayList { /** * Removes from the receiver all elements that are contained in the specified list .
* Tests for equality or identity as specified by < code > testForEquality < / code > .
* @ param other the other list .
* @ param testForEquality if < code > true < / code > - > test for equality , otherwise for identity .
* @ return < code > true < / code > if the receiver changed as a result of the call . */
public boolean removeAll ( ObjectArrayList other , boolean testForEquality ) { } } | if ( other . size == 0 ) return false ; // nothing to do
int limit = other . size - 1 ; int j = 0 ; Object [ ] theElements = elements ; for ( int i = 0 ; i < size ; i ++ ) { if ( other . indexOfFromTo ( theElements [ i ] , 0 , limit , testForEquality ) < 0 ) theElements [ j ++ ] = theElements [ i ] ; } boolean modified = ( j != size ) ; setSize ( j ) ; return modified ; |
public class ServletTypeImpl { /** * If not already created , a new < code > run - as < / code > element with the given value will be created .
* Otherwise , the existing < code > run - as < / code > element will be returned .
* @ return a new or existing instance of < code > RunAsType < ServletType < T > > < / code > */
public RunAsType < ServletType < T > > getOrCreateRunAs ( ) { } } | Node node = childNode . getOrCreate ( "run-as" ) ; RunAsType < ServletType < T > > runAs = new RunAsTypeImpl < ServletType < T > > ( this , "run-as" , childNode , node ) ; return runAs ; |
public class ClassFeatureSet { /** * Figure out if a class member ( field or method ) is synthetic .
* @ param member
* a field or method
* @ return true if the member is synthetic */
private boolean isSynthetic ( FieldOrMethod member ) { } } | if ( BCELUtil . isSynthetic ( member ) ) { return true ; } String name = member . getName ( ) ; return name . startsWith ( "class$" ) || name . startsWith ( "access$" ) ; |
public class ImageLoading { /** * Calculating scale factor with limit of pixel amount
* @ param metadata image metadata
* @ param maxPixels limit for pixels
* @ return scale factor */
private static int getScaleFactor ( ImageMetadata metadata , int maxPixels ) { } } | int scale = 1 ; int scaledW = metadata . getW ( ) ; int scaledH = metadata . getH ( ) ; while ( scaledW * scaledH > maxPixels ) { scale *= 2 ; scaledH /= 2 ; scaledW /= 2 ; } return scale ; |
public class ASN1Set { /** * return true if a < = b ( arrays are assumed padded with zeros ) . */
private boolean lessThanOrEqual ( byte [ ] a , byte [ ] b ) { } } | if ( a . length <= b . length ) { for ( int i = 0 ; i != a . length ; i ++ ) { int l = a [ i ] & 0xff ; int r = b [ i ] & 0xff ; if ( r > l ) { return true ; } else if ( l > r ) { return false ; } } return true ; } else { for ( int i = 0 ; i != b . length ; i ++ ) { int l = a [ i ] & 0xff ; int r = b [ i ] & 0xff ; if ( r > l ) { return true ; } else if ( l > r ) { return false ; } } return false ; } |
public class JobTargetGroupsInner { /** * Gets all target groups in an agent .
* @ 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 ; JobTargetGroupInner & gt ; object */
public Observable < Page < JobTargetGroupInner > > listByAgentNextAsync ( final String nextPageLink ) { } } | return listByAgentNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < JobTargetGroupInner > > , Page < JobTargetGroupInner > > ( ) { @ Override public Page < JobTargetGroupInner > call ( ServiceResponse < Page < JobTargetGroupInner > > response ) { return response . body ( ) ; } } ) ; |
public class ResourcesInner { /** * Updates a resource .
* @ param resourceGroupName The name of the resource group for the resource . The name is case insensitive .
* @ param resourceProviderNamespace The namespace of the resource provider .
* @ param parentResourcePath The parent resource identity .
* @ param resourceType The resource type of the resource to update .
* @ param resourceName The name of the resource to update .
* @ param apiVersion The API version to use for the operation .
* @ param parameters Parameters for updating the resource .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the GenericResourceInner object if successful . */
public GenericResourceInner update ( String resourceGroupName , String resourceProviderNamespace , String parentResourcePath , String resourceType , String resourceName , String apiVersion , GenericResourceInner parameters ) { } } | return updateWithServiceResponseAsync ( resourceGroupName , resourceProviderNamespace , parentResourcePath , resourceType , resourceName , apiVersion , parameters ) . toBlocking ( ) . last ( ) . body ( ) ; |
public class ReplicaReader { /** * Perform replica reads to as many nodes a possible based on the given { @ link ReplicaMode } .
* Individual errors are swallowed , but logged .
* @ param core the core reference .
* @ param id the id of the document to load from the replicas .
* @ param type the replica mode type .
* @ param bucket the name of the bucket to load it from .
* @ return a potentially empty observable with the returned raw responses . */
public static < D extends Document < ? > > Observable < D > read ( final ClusterFacade core , final String id , final ReplicaMode type , final String bucket , final Map < Class < ? extends Document > , Transcoder < ? extends Document , ? > > transcoders , final Class < D > target , final CouchbaseEnvironment environment , final long timeout , final TimeUnit timeUnit ) { } } | return Observable . defer ( new Func0 < Observable < D > > ( ) { @ Override public Observable < D > call ( ) { final Span parentSpan ; if ( environment . operationTracingEnabled ( ) ) { Scope scope = environment . tracer ( ) . buildSpan ( "get_from_replica" ) . startActive ( false ) ; parentSpan = scope . span ( ) ; scope . close ( ) ; } else { parentSpan = null ; } Observable < D > result = assembleRequests ( core , id , type , bucket ) . flatMap ( new Func1 < BinaryRequest , Observable < D > > ( ) { @ Override public Observable < D > call ( final BinaryRequest request ) { String name = request instanceof ReplicaGetRequest ? "get_replica" : "get" ; addRequestSpanWithParent ( environment , parentSpan , request , name ) ; Observable < GetResponse > result = deferAndWatch ( new Func1 < Subscriber , Observable < GetResponse > > ( ) { @ Override public Observable < GetResponse > call ( Subscriber subscriber ) { request . subscriber ( subscriber ) ; return core . send ( request ) ; } } ) . filter ( new Get . GetFilter ( environment ) ) ; if ( timeout > 0 ) { // individual timeout to clean out ops at some point
result = result . timeout ( timeout , timeUnit , environment . scheduler ( ) ) ; } return result . onErrorResumeNext ( GetResponseErrorHandler . INSTANCE ) . map ( new Get . GetMap ( environment , transcoders , target , id ) ) ; } } ) ; if ( timeout > 0 ) { result = result . timeout ( timeout , timeUnit , environment . scheduler ( ) ) ; } return result . doOnTerminate ( new Action0 ( ) { @ Override public void call ( ) { if ( environment . operationTracingEnabled ( ) && parentSpan != null ) { environment . tracer ( ) . scopeManager ( ) . activate ( parentSpan , true ) . close ( ) ; } } } ) . cacheWithInitialCapacity ( type . maxAffectedNodes ( ) ) ; } } ) ; |
public class Int2ObjectHashMap { /** * Get a value for a given key , or if it does ot exist then default the value via a { @ link IntFunction }
* and put it in the map .
* @ param key to search on .
* @ param mappingFunction to provide a value if the get returns null .
* @ return the value if found otherwise the default . */
public V computeIfAbsent ( final int key , final IntFunction < ? extends V > mappingFunction ) { } } | checkNotNull ( mappingFunction , "mappingFunction cannot be null" ) ; V value = get ( key ) ; if ( value == null ) { value = mappingFunction . apply ( key ) ; if ( value != null ) { put ( key , value ) ; } } return value ; |
public class ImmutableGrid { /** * Obtains an empty immutable grid of the specified row - column count .
* @ param < R > the type of the value
* @ param rowCount the number of rows , zero or greater
* @ param columnCount the number of columns , zero or greater
* @ return the empty immutable grid , not null */
public static < R > ImmutableGrid < R > of ( int rowCount , int columnCount ) { } } | return new EmptyGrid < R > ( rowCount , columnCount ) ; |
public class N { /** * Returns an immutable empty < code > Iterator < / code > if the specified Iterator is < code > null < / code > , otherwise itself is returned .
* @ param iter
* @ return */
public static < T > Iterator < T > nullToEmpty ( final Iterator < T > iter ) { } } | return iter == null ? N . < T > emptyIterator ( ) : iter ; |
public class WildcardPattern { /** * Creates array of patterns with " / " as a directory separator .
* @ see # create ( String , String ) */
public static WildcardPattern [ ] create ( @ Nullable String [ ] patterns ) { } } | if ( patterns == null ) { return new WildcardPattern [ 0 ] ; } WildcardPattern [ ] exclusionPAtterns = new WildcardPattern [ patterns . length ] ; for ( int i = 0 ; i < patterns . length ; i ++ ) { exclusionPAtterns [ i ] = create ( patterns [ i ] ) ; } return exclusionPAtterns ; |
public class ObjectAnimator { /** * Constructs and returns an ObjectAnimator that animates between int values . A single
* value implies that that value is the one being animated to . Two values imply a starting
* and ending values . More than two values imply a starting value , values to animate through
* along the way , and an ending value ( these values will be distributed evenly across
* the duration of the animation ) .
* @ param target The object whose property is to be animated . This object should
* have a public method on it called < code > setName ( ) < / code > , where < code > name < / code > is
* the value of the < code > propertyName < / code > parameter .
* @ param propertyName The name of the property being animated .
* @ param values A set of values that the animation will animate between over time .
* @ return An ObjectAnimator object that is set up to animate between the given values . */
public static ObjectAnimator ofInt ( Object target , String propertyName , int ... values ) { } } | ObjectAnimator anim = new ObjectAnimator ( target , propertyName ) ; anim . setIntValues ( values ) ; return anim ; |
public class TypeDeclarationGenerator { /** * Prints the list of instance variables in a type . */
protected void printInstanceVariables ( ) { } } | Iterable < VariableDeclarationFragment > fields = getInstanceFields ( ) ; if ( Iterables . isEmpty ( fields ) ) { newline ( ) ; return ; } // Need direct access to fields possibly from inner classes that are
// promoted to top level classes , so must make all visible fields public .
println ( " {" ) ; println ( " @public" ) ; indent ( ) ; FieldDeclaration lastDeclaration = null ; boolean needsAsterisk = false ; for ( VariableDeclarationFragment fragment : fields ) { VariableElement varElement = fragment . getVariableElement ( ) ; FieldDeclaration declaration = ( FieldDeclaration ) fragment . getParent ( ) ; if ( declaration != lastDeclaration ) { if ( lastDeclaration != null ) { println ( ";" ) ; } lastDeclaration = declaration ; JavadocGenerator . printDocComment ( getBuilder ( ) , declaration . getJavadoc ( ) ) ; printIndent ( ) ; if ( ElementUtil . isWeakReference ( varElement ) && ! ElementUtil . isVolatile ( varElement ) ) { // We must add this even without - use - arc because the header may be
// included by a file compiled with ARC .
print ( "__unsafe_unretained " ) ; } String objcType = getDeclarationType ( varElement ) ; needsAsterisk = objcType . endsWith ( "*" ) ; if ( needsAsterisk ) { // Strip pointer from type , as it will be added when appending fragment .
// This is necessary to create " Foo * one , * two ; " declarations .
objcType = objcType . substring ( 0 , objcType . length ( ) - 2 ) ; } print ( objcType ) ; print ( ' ' ) ; } else { print ( ", " ) ; } if ( needsAsterisk ) { print ( '*' ) ; } print ( nameTable . getVariableShortName ( varElement ) ) ; } println ( ";" ) ; unindent ( ) ; println ( "}" ) ; |
public class AbstractSingleFileObjectStore { /** * Sets the size of the store file to the new values .
* At least the minimum space is reserved in the file system .
* No more than the maximum number of bytes will be used .
* Blocks until this has completed .
* The initial values used by the ObjecStore are 0 and Long . MAX _ VAULE .
* The store will attempt to release space as ManagedObjects are deleted to reach the
* minimum size .
* @ param newMinimumStoreFileSize the new minimum store file size in bytes .
* @ param newMaximumStoreFileSize the new maximum store file size in bytes .
* @ throws IllegalArgumentException if minimum > maximum .
* @ throws StoreFileSizeTooSmallException if the maximum is smaller than the current usage .
* @ throws PermanentIOException if the disk space cannot be expanded to the new minimum size .
* @ throws ObjectManagerException */
public synchronized void setStoreFileSize ( long newMinimumStoreFileSize , long newMaximumStoreFileSize ) throws ObjectManagerException { } } | if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "setStoreFileSize" , new Object [ ] { new Long ( newMinimumStoreFileSize ) , new Long ( newMaximumStoreFileSize ) } ) ; // Synchronized so we have locked out flush ( ) ;
if ( newMinimumStoreFileSize > newMaximumStoreFileSize ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "setStoreFileSize" ) ; throw new IllegalArgumentException ( newMinimumStoreFileSize + ">" + newMaximumStoreFileSize ) ; } // if ( newStoreFileSize . . .
// Check that the new MaximumStoreFileSize is still bigger than the existing
// contents if the ObjectStore .
if ( newMaximumStoreFileSize < storeFileSizeUsed ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "setStoreFileSize" , new Object [ ] { new Long ( newMaximumStoreFileSize ) , new Long ( storeFileSizeAllocated ) , new Long ( storeFileSizeUsed ) } ) ; throw new StoreFileSizeTooSmallException ( this , newMaximumStoreFileSize , storeFileSizeAllocated , storeFileSizeUsed ) ; } // if ( newStoreFileSize . . .
// If we are expanding the minimum file size grab the disk space now .
// If we fail before storing the new administered values the space will be release next time
// we open ( ) .
if ( newMinimumStoreFileSize > storeFileSizeAllocated ) { try { setStoreFileSizeInternalWithException ( newMinimumStoreFileSize ) ; } catch ( java . io . IOException exception ) { // No FFDC Code Needed .
ObjectManager . ffdc . processException ( this , cclass , "setStoreFileSize" , exception , "1:349:1.57" ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "setStoreFileSize" ) ; throw new PermanentIOException ( this , exception ) ; } } // if ( newMinimumStoreFileSize > storeFileSizeAllocated ) .
minimumStoreFileSize = newMinimumStoreFileSize ; maximumStoreFileSize = newMaximumStoreFileSize ; writeHeader ( ) ; force ( ) ; setAllocationAllowed ( ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "setStoreFileSize" ) ; |
public class QueryParserKraken { /** * Parses the update .
* UPDATE table _ name SET a = ? , b = ? WHERE expr */
private QueryBuilderKraken parseUpdate ( ) { } } | Token token ; UpdateQueryBuilder query = new UpdateQueryBuilder ( _tableManager , _sql ) ; String tableName = parseTableName ( ) ; query . setTableName ( tableName ) ; _query = query ; if ( ( token = scanToken ( ) ) != Token . SET ) { throw error ( L . l ( "expected SET at {0}" , token ) ) ; } do { parseSetItem ( query ) ; } while ( ( token = scanToken ( ) ) == Token . COMMA ) ; _token = token ; // query . setUpdateBuilder ( new SetUpdateBuilder ( setItems ) ) ;
ExprKraken whereExpr = null ; token = scanToken ( ) ; if ( token == Token . WHERE ) { whereExpr = parseExpr ( ) ; } else if ( token != null && token != Token . EOF ) { throw error ( "expected WHERE at '{0}'" , token ) ; } ParamExpr [ ] params = _params . toArray ( new ParamExpr [ _params . size ( ) ] ) ; query . setParams ( params ) ; query . setWhereExpr ( whereExpr ) ; return query ; |
public class CamelModelHelper { /** * Returns the summary label of a node for visualisation purposes */
public static String getDisplayText ( OptionalIdentifiedDefinition camelNode ) { } } | String id = camelNode . getId ( ) ; if ( ! Strings2 . isEmpty ( id ) ) { return id ; } if ( camelNode instanceof FromDefinition ) { FromDefinition node = ( FromDefinition ) camelNode ; return getUri ( node ) ; } else if ( camelNode instanceof ToDefinition ) { ToDefinition node = ( ToDefinition ) camelNode ; return getUri ( node ) ; } else if ( camelNode instanceof BeanDefinition ) { BeanDefinition node = ( BeanDefinition ) camelNode ; return "bean " + getOrBlank ( node . getRef ( ) ) ; } else if ( camelNode instanceof CatchDefinition ) { CatchDefinition node = ( CatchDefinition ) camelNode ; List exceptions = node . getExceptions ( ) ; if ( exceptions != null && exceptions . size ( ) > 0 ) { return "catch " + exceptions ; } else { return "catch " + Expressions . getExpressionOrElse ( node . getHandled ( ) ) ; } } else if ( camelNode instanceof ChoiceDefinition ) { return "choice" ; } else if ( camelNode instanceof ConvertBodyDefinition ) { ConvertBodyDefinition node = ( ConvertBodyDefinition ) camelNode ; return "convertBodyTo " + getOrBlank ( node . getType ( ) ) ; } else if ( camelNode instanceof EnrichDefinition ) { EnrichDefinition node = ( EnrichDefinition ) camelNode ; // return " enrich " + getOrBlank ( node . getResourceUri ( ) ) ;
return "enrich " + Expressions . getExpressionOrElse ( node . getExpression ( ) ) ; } else if ( camelNode instanceof FinallyDefinition ) { return "finally" ; } else if ( camelNode instanceof InOnlyDefinition ) { InOnlyDefinition node = ( InOnlyDefinition ) camelNode ; return "inOnly " + getOrBlank ( node . getUri ( ) ) ; } else if ( camelNode instanceof InOutDefinition ) { InOutDefinition node = ( InOutDefinition ) camelNode ; return "inOut " + getOrBlank ( node . getUri ( ) ) ; } else if ( camelNode instanceof InterceptSendToEndpointDefinition ) { InterceptSendToEndpointDefinition node = ( InterceptSendToEndpointDefinition ) camelNode ; return "intercept " + getOrBlank ( node . getUri ( ) ) ; } else if ( camelNode instanceof LogDefinition ) { LogDefinition node = ( LogDefinition ) camelNode ; return "log " + getOrBlank ( node . getLogName ( ) ) ; } else if ( camelNode instanceof MarshalDefinition ) { return "marshal" ; } else if ( camelNode instanceof OnExceptionDefinition ) { OnExceptionDefinition node = ( OnExceptionDefinition ) camelNode ; return "on exception " + getOrBlank ( node . getExceptions ( ) ) ; } else if ( camelNode instanceof OtherwiseDefinition ) { return "otherwise" ; } else if ( camelNode instanceof PollEnrichDefinition ) { PollEnrichDefinition node = ( PollEnrichDefinition ) camelNode ; // TODO
// return " poll enrich " + getOrBlank ( node . getResourceUri ( ) ) ;
return "poll enrich " + Expressions . getExpressionOrElse ( node . getExpression ( ) ) ; } else if ( camelNode instanceof RemoveHeaderDefinition ) { RemoveHeaderDefinition node = ( RemoveHeaderDefinition ) camelNode ; return "remove header " + getOrBlank ( node . getHeaderName ( ) ) ; } else if ( camelNode instanceof RemovePropertyDefinition ) { RemovePropertyDefinition node = ( RemovePropertyDefinition ) camelNode ; return "remove property " + getOrBlank ( node . getPropertyName ( ) ) ; } else if ( camelNode instanceof RollbackDefinition ) { RollbackDefinition node = ( RollbackDefinition ) camelNode ; return "rollback " + getOrBlank ( node . getMessage ( ) ) ; } else if ( camelNode instanceof SetExchangePatternDefinition ) { SetExchangePatternDefinition node = ( SetExchangePatternDefinition ) camelNode ; ExchangePattern pattern = node . getPattern ( ) ; if ( pattern == null ) { return "setExchangePattern" ; } else { return "set " + pattern ; } } else if ( camelNode instanceof SortDefinition ) { SortDefinition node = ( SortDefinition ) camelNode ; return "sort " + Expressions . getExpressionOrElse ( node . getExpression ( ) ) ; } else if ( camelNode instanceof WhenDefinition ) { WhenDefinition node = ( WhenDefinition ) camelNode ; return "when " + Expressions . getExpressionOrElse ( node . getExpression ( ) ) ; } else if ( camelNode instanceof UnmarshalDefinition ) { return "unmarshal" ; } else if ( camelNode instanceof TryDefinition ) { return "try" ; } else if ( camelNode instanceof LoadBalanceDefinition ) { LoadBalanceDefinition load = ( LoadBalanceDefinition ) camelNode ; return load . getShortName ( ) ; /* TODO
if ( load . getRef ( ) ! = null ) {
return " custom " + getOrBlank ( load . getRef ( ) ) ;
} else if ( load . getLoadBalancerType ( ) ! = null ) {
if ( load . getLoadBalancerType ( ) . getClass ( ) . isAssignableFrom ( CustomLoadBalancerDefinition . class ) ) {
CustomLoadBalancerDefinition custom = ( CustomLoadBalancerDefinition ) load . getLoadBalancerType ( ) ;
return " custom " + getOrBlank ( custom . getRef ( ) ) ;
} else if ( load . getLoadBalancerType ( ) . getClass ( ) . isAssignableFrom ( FailoverLoadBalancerDefinition . class ) ) {
return " failover " ;
} else if ( load . getLoadBalancerType ( ) . getClass ( ) . isAssignableFrom ( RandomLoadBalancerDefinition . class ) ) {
return " random " ;
} else if ( load . getLoadBalancerType ( ) . getClass ( ) . isAssignableFrom ( RoundRobinLoadBalancerDefinition . class ) ) {
return " round robin " ;
} else if ( load . getLoadBalancerType ( ) . getClass ( ) . isAssignableFrom ( StickyLoadBalancerDefinition . class ) ) {
return " sticky " ;
} else if ( load . getLoadBalancerType ( ) . getClass ( ) . isAssignableFrom ( TopicLoadBalancerDefinition . class ) ) {
return " topic " ;
} else if ( load . getLoadBalancerType ( ) . getClass ( ) . isAssignableFrom ( WeightedLoadBalancerDefinition . class ) ) {
return " weighted " ;
} else {
return " load balance " ; */
} String answer = null ; try { answer = camelNode . getLabel ( ) ; } catch ( Exception e ) { // ignore errors in Camel
} if ( Strings2 . isBlank ( answer ) ) { answer = getPatternName ( camelNode ) ; } return answer ; |
public class BaseLayoutManager { /** * Used for debugging .
* Validates that child views are laid out in correct order . This is important because rest of
* the algorithm relies on this constraint .
* In default layout , child 0 should be closest to screen position 0 and last child should be
* closest to position WIDTH or HEIGHT .
* In reverse layout , last child should be closes to screen position 0 and first child should
* be closest to position WIDTH or HEIGHT */
protected void validateChildOrder ( ) { } } | Log . d ( TAG , "validating child count " + getChildCount ( ) ) ; if ( getChildCount ( ) < 1 ) { return ; } int lastPos = getPosition ( getChildAt ( 0 ) ) ; int lastScreenLoc = mOrientationHelper . getDecoratedStart ( getChildAt ( 0 ) ) ; if ( mShouldReverseLayout ) { for ( int i = 1 ; i < getChildCount ( ) ; i ++ ) { View child = getChildAt ( i ) ; int pos = getPosition ( child ) ; int screenLoc = mOrientationHelper . getDecoratedStart ( child ) ; if ( pos < lastPos ) { logChildren ( ) ; throw new RuntimeException ( "detected invalid position. loc invalid? " + ( screenLoc < lastScreenLoc ) ) ; } if ( screenLoc > lastScreenLoc ) { logChildren ( ) ; throw new RuntimeException ( "detected invalid location" ) ; } } } else { for ( int i = 1 ; i < getChildCount ( ) ; i ++ ) { View child = getChildAt ( i ) ; int pos = getPosition ( child ) ; int screenLoc = mOrientationHelper . getDecoratedStart ( child ) ; if ( pos < lastPos ) { logChildren ( ) ; throw new RuntimeException ( "detected invalid position. loc invalid? " + ( screenLoc < lastScreenLoc ) ) ; } if ( screenLoc < lastScreenLoc ) { logChildren ( ) ; throw new RuntimeException ( "detected invalid location" ) ; } } } |
public class StreamletImpl { /** * Same as filter ( Identity ) . setNumPartitions ( nPartitions ) */
@ Override public Streamlet < R > repartition ( int numPartitions ) { } } | return this . map ( ( a ) -> a ) . setNumPartitions ( numPartitions ) ; |
public class QueryLexer { /** * $ ANTLR end " HexDigit " */
public void mTokens ( ) throws RecognitionException { } } | // src / riemann / Query . g : 1:8 : ( AND | OR | NOT | APPROXIMATELY | REGEX _ MATCH | NOT _ EQUAL | EQUAL | LESSER | LESSER _ EQUAL | GREATER | GREATER _ EQUAL | TAGGED | T _ _ 25 | T _ _ 26 | T _ _ 27 | T _ _ 28 | T _ _ 29 | T _ _ 30 | T _ _ 31 | T _ _ 32 | T _ _ 33 | T _ _ 34 | T _ _ 35 | T _ _ 36 | T _ _ 37 | T _ _ 38 | ID | INT | FLOAT | WS | String )
int alt13 = 31 ; alt13 = dfa13 . predict ( input ) ; switch ( alt13 ) { case 1 : // src / riemann / Query . g : 1:10 : AND
{ mAND ( ) ; } break ; case 2 : // src / riemann / Query . g : 1:14 : OR
{ mOR ( ) ; } break ; case 3 : // src / riemann / Query . g : 1:17 : NOT
{ mNOT ( ) ; } break ; case 4 : // src / riemann / Query . g : 1:21 : APPROXIMATELY
{ mAPPROXIMATELY ( ) ; } break ; case 5 : // src / riemann / Query . g : 1:35 : REGEX _ MATCH
{ mREGEX_MATCH ( ) ; } break ; case 6 : // src / riemann / Query . g : 1:47 : NOT _ EQUAL
{ mNOT_EQUAL ( ) ; } break ; case 7 : // src / riemann / Query . g : 1:57 : EQUAL
{ mEQUAL ( ) ; } break ; case 8 : // src / riemann / Query . g : 1:63 : LESSER
{ mLESSER ( ) ; } break ; case 9 : // src / riemann / Query . g : 1:70 : LESSER _ EQUAL
{ mLESSER_EQUAL ( ) ; } break ; case 10 : // src / riemann / Query . g : 1:83 : GREATER
{ mGREATER ( ) ; } break ; case 11 : // src / riemann / Query . g : 1:91 : GREATER _ EQUAL
{ mGREATER_EQUAL ( ) ; } break ; case 12 : // src / riemann / Query . g : 1:105 : TAGGED
{ mTAGGED ( ) ; } break ; case 13 : // src / riemann / Query . g : 1:112 : T _ _ 25
{ mT__25 ( ) ; } break ; case 14 : // src / riemann / Query . g : 1:118 : T _ _ 26
{ mT__26 ( ) ; } break ; case 15 : // src / riemann / Query . g : 1:124 : T _ _ 27
{ mT__27 ( ) ; } break ; case 16 : // src / riemann / Query . g : 1:130 : T _ _ 28
{ mT__28 ( ) ; } break ; case 17 : // src / riemann / Query . g : 1:136 : T _ _ 29
{ mT__29 ( ) ; } break ; case 18 : // src / riemann / Query . g : 1:142 : T _ _ 30
{ mT__30 ( ) ; } break ; case 19 : // src / riemann / Query . g : 1:148 : T _ _ 31
{ mT__31 ( ) ; } break ; case 20 : // src / riemann / Query . g : 1:154 : T _ _ 32
{ mT__32 ( ) ; } break ; case 21 : // src / riemann / Query . g : 1:160 : T _ _ 33
{ mT__33 ( ) ; } break ; case 22 : // src / riemann / Query . g : 1:166 : T _ _ 34
{ mT__34 ( ) ; } break ; case 23 : // src / riemann / Query . g : 1:172 : T _ _ 35
{ mT__35 ( ) ; } break ; case 24 : // src / riemann / Query . g : 1:178 : T _ _ 36
{ mT__36 ( ) ; } break ; case 25 : // src / riemann / Query . g : 1:184 : T _ _ 37
{ mT__37 ( ) ; } break ; case 26 : // src / riemann / Query . g : 1:190 : T _ _ 38
{ mT__38 ( ) ; } break ; case 27 : // src / riemann / Query . g : 1:196 : ID
{ mID ( ) ; } break ; case 28 : // src / riemann / Query . g : 1:199 : INT
{ mINT ( ) ; } break ; case 29 : // src / riemann / Query . g : 1:203 : FLOAT
{ mFLOAT ( ) ; } break ; case 30 : // src / riemann / Query . g : 1:209 : WS
{ mWS ( ) ; } break ; case 31 : // src / riemann / Query . g : 1:212 : String
{ mString ( ) ; } break ; } |
public class JmsJcaManagedConnectionFactoryImpl { /** * Creates a managed connection .
* @ param subject
* the subject
* @ param requestInfo
* the request information
* @ return the managed connection
* @ throws ResourceException
* generic exception */
@ Override final public ManagedConnection createManagedConnection ( final Subject subject , final ConnectionRequestInfo requestInfo ) throws ResourceException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "createManagedConnection" , new Object [ ] { JmsJcaManagedConnection . subjectToString ( subject ) , requestInfo } ) ; } // If we have some request information then see if it already has a core
// connection associated with it
JmsJcaConnectionRequestInfo jmsJcaRequestInfo = null ; SICoreConnection requestCoreConnection = null ; SICoreConnection coreConnection = null ; if ( requestInfo != null ) { // Check we have the right type of request information
if ( ! ( requestInfo instanceof JmsJcaConnectionRequestInfo ) ) { throw new ResourceAdapterInternalException ( NLS . getFormattedMessage ( ( "EXCEPTION_RECEIVED_CWSJR1022" ) , new Object [ ] { "createManagedConnection" , JmsJcaConnectionRequestInfo . class . getName ( ) , requestInfo . getClass ( ) . getName ( ) } , null ) ) ; } jmsJcaRequestInfo = ( JmsJcaConnectionRequestInfo ) requestInfo ; requestCoreConnection = jmsJcaRequestInfo . getSICoreConnection ( ) ; if ( requestCoreConnection != null ) { // Check that the core connection is still available , ie hasn ' t been closed . If the
// core connection is no longer available , null it out and continue without it .
try { // There is no isAvailable ( ) method on a core connection we use getConnectionListeners ( )
// which is believed to be the cheapest alternative method .
requestCoreConnection . getConnectionListeners ( ) ; } catch ( final SIException e ) { // No FFDC code needed
if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) SibTr . debug ( TRACE , "Connection Request Info core connection no longer available" ) ; jmsJcaRequestInfo . setSICoreConnection ( null ) ; requestCoreConnection = null ; } catch ( final SIErrorException e ) { // No FFDC code needed
if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) SibTr . debug ( TRACE , "Connection Request Info core connection no longer available" ) ; jmsJcaRequestInfo . setSICoreConnection ( null ) ; requestCoreConnection = null ; } } } // See if we can get a user name and password from the subject or
// request information
final JmsJcaUserDetails userDetails = getUserDetails ( subject , requestInfo ) ; // If we didn ' t get any request information or we did but it didn ' t
// contain a core connection , create a new one
if ( requestCoreConnection == null ) { // Obtain a core connection factory
final SICoreConnectionFactory coreConnectionFactory ; if ( ! UTEHelperFactory . jmsTestEnvironmentEnabled ) { try { coreConnectionFactory = SICoreConnectionFactorySelector . getSICoreConnectionFactory ( FactoryType . TRM_CONNECTION ) ; } catch ( final SIException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + ".createManagedConnection" , FFDC_PROBE_5 , this ) ; throw new ResourceException ( NLS . getFormattedMessage ( "EXCEPTION_RECEIVED_CWSJR1021" , new Object [ ] { exception , "getSICoreConnectionFactory" } , null ) , exception ) ; } } else { coreConnectionFactory = UTEHelperFactory . getHelperInstance ( ) . setupJmsTestEnvironment ( ) ; } // Check we have obtained a core connection factory successfully
if ( coreConnectionFactory == null ) { throw new ResourceAdapterInternalException ( NLS . getFormattedMessage ( ( "SICORECONNECTION_ERROR_CWSJR1023" ) , new Object [ ] { "createManagedConnection" } , null ) ) ; } // Create a connection
try { final Map trmProperties = getTrmProperties ( ) ; if ( userDetails == null ) { requestCoreConnection = coreConnectionFactory . createConnection ( subject , trmProperties ) ; } else { requestCoreConnection = coreConnectionFactory . createConnection ( userDetails . getUserName ( ) , userDetails . getPassword ( ) , trmProperties ) ; } } catch ( final SIException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + ".createManagedConnection" , FFDC_PROBE_1 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw new ResourceException ( NLS . getFormattedMessage ( "EXCEPTION_RECEIVED_CWSJR1028" , new Object [ ] { exception , "createManagedConnection" } , null ) , exception ) ; } catch ( final SIErrorException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + ".createManagedConnection" , FFDC_PROBE_2 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw new ResourceException ( NLS . getFormattedMessage ( "EXCEPTION_RECEIVED_CWSJR1028" , new Object [ ] { exception , "createManagedConnection" } , null ) , exception ) ; } // If we have some request information , set the core connection back
// into it
if ( jmsJcaRequestInfo != null ) { jmsJcaRequestInfo . setSICoreConnection ( requestCoreConnection ) ; } // This is a new coreConnection so set this parent coreConnection in
// the managedConnection by assigning it to the coreConnection here .
// The managedconnection will now have full control over the parent
// coreconnection .
coreConnection = requestCoreConnection ; } else { try { // We are here as we already have a valid coreconnection in our requestInfo , this
// means we already have a managedConnection that is looking at the parent , so we
// need to create a clone of that coreConnection to pass into our new managedConnection .
// Create a clone to give to the managed connection object which will be stored in the
// J2C connection pool .
coreConnection = requestCoreConnection . cloneConnection ( ) ; } catch ( final SIException e ) { FFDCFilter . processException ( e , CLASS_NAME + ".createManagedConnection" , FFDC_PROBE_7 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) SibTr . exception ( this , TRACE , e ) ; throw new ResourceException ( NLS . getFormattedMessage ( "EXCEPTION_RECEIVED_CWSJR1028" , new Object [ ] { e , "createManagedConnection" } , null ) , e ) ; } catch ( final SIErrorException e ) { FFDCFilter . processException ( e , CLASS_NAME + ".createManagedConnection" , FFDC_PROBE_8 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) SibTr . exception ( this , TRACE , e ) ; throw new ResourceException ( NLS . getFormattedMessage ( "EXCEPTION_RECEIVED_CWSJR1028" , new Object [ ] { e , "createManagedConnection" } , null ) , e ) ; } } final JmsJcaManagedConnection managedConnection ; try { // Create a managed connection
if ( ( getShareDataSourceWithCMP ( ) != null ) && ( getShareDataSourceWithCMP ( ) . booleanValue ( ) ) ) { // ShareDataSourceWithCMP is set - return a managed connection
// implementing SynchronizationProvider
managedConnection = new JmsJcaManagedConnectionSynchronizationProvider ( this , coreConnection , userDetails , subject ) ; } else { // ShareDataSourceWithCMP is not set - return a normal managed
// connection
managedConnection = new JmsJcaManagedConnection ( this , coreConnection , userDetails , subject ) ; } } catch ( final SIException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + ".createManagedConnection" , FFDC_PROBE_3 , this ) ; throw new ResourceException ( NLS . getFormattedMessage ( "EXCEPTION_RECEIVED_CWSJR1026" , new Object [ ] { exception , "createManagedConnection" } , null ) , exception ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "createManagedConnection" , managedConnection ) ; } return managedConnection ; |
public class PerformanceMetricsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( PerformanceMetrics performanceMetrics , ProtocolMarshaller protocolMarshaller ) { } } | if ( performanceMetrics == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( performanceMetrics . getProperties ( ) , PROPERTIES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Bits { /** * Reads a string from buf . The length is read first , followed by the chars . Each char is a single byte
* @ param buf the buffer
* @ return the string read from buf */
public static String readString ( ByteBuffer buf ) { } } | if ( buf . get ( ) == 0 ) return null ; int len = readInt ( buf ) ; if ( buf . isDirect ( ) ) { byte [ ] bytes = new byte [ len ] ; buf . get ( bytes ) ; return new String ( bytes ) ; } else { byte [ ] bytes = buf . array ( ) ; return new String ( bytes , buf . arrayOffset ( ) + buf . position ( ) , len ) ; } |
public class ChunkAnnotationUtils { /** * Create a new chunk Annotation with basic chunk information
* CharacterOffsetBeginAnnotation - set to CharacterOffsetBeginAnnotation of first token in chunk
* CharacterOffsetEndAnnotation - set to CharacterOffsetEndAnnotation of last token in chunk
* TokensAnnotation - List of tokens in this chunk
* TokenBeginAnnotation - Index of first token in chunk ( index in original list of tokens )
* tokenStartIndex + annotation ' s TokenBeginAnnotation
* TokenEndAnnotation - Index of last token in chunk ( index in original list of tokens )
* tokenEndIndex + annotation ' s TokenBeginAnnotation
* TextAnnotation - String extracted from the origAnnotation using character offset information for this chunk
* @ param annotation - Annotation from which to extract the text for this chunk
* @ param tokenStartIndex - Index ( relative to current list of tokens ) at which this chunk starts
* @ param tokenEndIndex - Index ( relative to current list of tokens ) at which this chunk ends ( not inclusive )
* @ param tokenChunkKey - If not null , each token is annotated with the chunk using this key
* @ param tokenLabelKey - If not null , each token is annotated with the text associated with the chunk using this key
* @ return Annotation representing new chunk */
public static Annotation getAnnotatedChunk ( CoreMap annotation , int tokenStartIndex , int tokenEndIndex , Class tokenChunkKey , Class tokenLabelKey ) { } } | Annotation chunk = getAnnotatedChunk ( annotation , tokenStartIndex , tokenEndIndex ) ; annotateChunkTokens ( chunk , tokenChunkKey , tokenLabelKey ) ; return chunk ; |
public class Transaction { /** * < p > Puts the given block in the internal set of blocks in which this transaction appears . This is
* used by the wallet to ensure transactions that appear on side chains are recorded properly even though the
* block stores do not save the transaction data at all . < / p >
* < p > If there is a re - org this will be called once for each block that was previously seen , to update which block
* is the best chain . The best chain block is guaranteed to be called last . So this must be idempotent . < / p >
* < p > Sets updatedAt to be the earliest valid block time where this tx was seen . < / p >
* @ param block The { @ link StoredBlock } in which the transaction has appeared .
* @ param bestChain whether to set the updatedAt timestamp from the block header ( only if not already set )
* @ param relativityOffset A number that disambiguates the order of transactions within a block . */
public void setBlockAppearance ( StoredBlock block , boolean bestChain , int relativityOffset ) { } } | long blockTime = block . getHeader ( ) . getTimeSeconds ( ) * 1000 ; if ( bestChain && ( updatedAt == null || updatedAt . getTime ( ) == 0 || updatedAt . getTime ( ) > blockTime ) ) { updatedAt = new Date ( blockTime ) ; } addBlockAppearance ( block . getHeader ( ) . getHash ( ) , relativityOffset ) ; if ( bestChain ) { TransactionConfidence transactionConfidence = getConfidence ( ) ; // This sets type to BUILDING and depth to one .
transactionConfidence . setAppearedAtChainHeight ( block . getHeight ( ) ) ; } |
public class FieldValueMappingCallback { /** * Resolves a field ' s value via the { @ link FieldValueMappingCallback . FieldData # path field path } .
* Supports conversion from array properties ( such as String [ ] ) to the desired collection type of the field .
* @ return the resolved value , or < code > null < / code > . */
private Object resolvePropertyTypedValue ( FieldData field ) { } } | Object value ; if ( field . metaData . isInstantiableCollectionType ( ) ) { value = getArrayPropertyAsCollection ( field ) ; } else { value = resolvePropertyTypedValue ( field , field . metaData . getType ( ) ) ; } return value ; |
public class NetUtil { /** * Gets the InputStream from a given URL , with the given timeout .
* The timeout must be > 0 . A timeout of zero is interpreted as an
* infinite timeout . Supports basic HTTP
* authentication , using a URL string similar to most browsers .
* < SMALL > Implementation note : If the timeout parameter is greater than 0,
* this method uses my own implementation of
* java . net . HttpURLConnection , that uses plain sockets , to create an
* HTTP connection to the given URL . The { @ code read } methods called
* on the returned InputStream , will block only for the specified timeout .
* If the timeout expires , a java . io . InterruptedIOException is raised . This
* might happen BEFORE OR AFTER this method returns , as the HTTP headers
* will be read and parsed from the InputStream before this method returns ,
* while further read operations on the returned InputStream might be
* performed at a later stage .
* < BR / >
* < / SMALL >
* @ param pURL the URL to get .
* @ param pPostData the post data .
* @ param pProperties the request header properties .
* @ param pFollowRedirects specifying wether redirects should be followed .
* @ param pTimeout the specified timeout , in milliseconds .
* @ return an input stream that reads from the socket connection , created
* from the given URL .
* @ throws MalformedURLException if the url parameter specifies an
* unknown protocol , or does not form a valid URL .
* @ throws UnknownHostException if the IP address for the given URL cannot
* be resolved .
* @ throws FileNotFoundException if there is no file at the given URL .
* @ throws IOException if an error occurs during transfer . */
public static InputStream getInputStreamHttpPost ( String pURL , Map pPostData , Properties pProperties , boolean pFollowRedirects , int pTimeout ) throws IOException { } } | pProperties = pProperties != null ? pProperties : new Properties ( ) ; // URL url = getURLAndRegisterPassword ( pURL ) ;
URL url = getURLAndSetAuthorization ( pURL , pProperties ) ; // unregisterPassword ( url ) ;
return getInputStreamHttpPost ( url , pPostData , pProperties , pFollowRedirects , pTimeout ) ; |
public class OptionsBuilder { /** * Adds a step to the steps .
* @ param name { @ link String } name of the step
* @ param robot { @ link String } name of the robot used by the step .
* @ param options { @ link Map } extra options required for the step . */
public void addStep ( String name , String robot , Map < String , Object > options ) { } } | steps . addStep ( name , robot , options ) ; |
public class Roster { /** * Ignore ItemTypes as of RFC 6121 , 2.1.2.5.
* This is used by { @ link RosterPushListener } and { @ link RosterResultListener } . */
private static boolean hasValidSubscriptionType ( RosterPacket . Item item ) { } } | switch ( item . getItemType ( ) ) { case none : case from : case to : case both : return true ; default : return false ; } |
public class CsvReader { public void sortRowsForIndexByType ( int index , DataType dataType ) { } } | Comparator < List < String > > comparator = null ; switch ( dataType ) { case Long : { comparator = ( list1 , list2 ) -> Long . valueOf ( list1 . get ( 0 ) ) . compareTo ( Long . valueOf ( list2 . get ( 0 ) ) ) ; } break ; default : comparator = ( list1 , list2 ) -> list1 . get ( 0 ) . compareTo ( list2 . get ( 0 ) ) ; } sortRows ( comparator ) ; |
public class RatingInputWidget { /** * Checks if a error belongs to this widget .
* @ param perror editor error to check
* @ return true if the error belongs to this widget */
protected boolean editorErrorMatches ( final EditorError perror ) { } } | return perror != null && perror . getEditor ( ) != null && ( equals ( perror . getEditor ( ) ) || perror . getEditor ( ) . equals ( asEditor ( ) ) ) ; |
public class CmsRemoveOldDbLogEntriesJob { /** * Parses the ' max - age ' parameter and returns a value in hours . < p >
* @ param maxAgeStr the value of the ' max - age ' parameter
* @ return the maximum age in hours */
public int parseMaxAge ( String maxAgeStr ) { } } | if ( maxAgeStr == null ) { showFormatError ( maxAgeStr ) ; return - 1 ; } maxAgeStr = maxAgeStr . toLowerCase ( ) . trim ( ) ; String [ ] tokens = maxAgeStr . split ( " +" ) ; if ( ( tokens . length != 2 ) ) { showFormatError ( maxAgeStr ) ; return - 1 ; } int number = 0 ; try { number = Integer . parseInt ( tokens [ 0 ] ) ; } catch ( NumberFormatException e ) { showFormatError ( maxAgeStr ) ; return - 1 ; } String unit = tokens [ 1 ] ; if ( "d" . equals ( unit ) || unit . startsWith ( "day" ) ) { return 24 * number ; } else if ( "h" . equals ( unit ) || unit . startsWith ( "hour" ) ) { return number ; } else if ( "w" . equals ( unit ) || unit . startsWith ( "week" ) ) { return 7 * 24 * number ; } else { showFormatError ( maxAgeStr ) ; return - 1 ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.