idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
12,400
public static NodeImpl createMethodNode ( final String name , final NodeImpl parent , final Class < ? > [ ] parameterTypes ) { return new NodeImpl ( name , parent , false , null , null , ElementKind . METHOD , parameterTypes , null , null , null , null ) ; }
create method node .
12,401
public static NodeImpl createConstructorNode ( final String name , final NodeImpl parent , final Class < ? > [ ] parameterTypes ) { return new NodeImpl ( name , parent , false , null , null , ElementKind . CONSTRUCTOR , parameterTypes , null , null , null , null ) ; }
create constructor node .
12,402
public static NodeImpl createBeanNode ( final NodeImpl parent ) { return new NodeImpl ( null , parent , false , null , null , ElementKind . BEAN , EMPTY_CLASS_ARRAY , null , null , null , null ) ; }
create bean node .
12,403
public static NodeImpl createReturnValue ( final NodeImpl parent ) { return new NodeImpl ( RETURN_VALUE_NODE_NAME , parent , false , null , null , ElementKind . RETURN_VALUE , EMPTY_CLASS_ARRAY , null , null , null , null ) ; }
create return node .
12,404
public static NodeImpl makeIterable ( final NodeImpl node ) { return new NodeImpl ( node . name , node . parent , true , null , null , node . kind , node . parameterTypes , node . parameterIndex , node . value , node . containerClass , node . typeArgumentIndex ) ; }
make it iterable .
12,405
public static NodeImpl makeIterableAndSetIndex ( final NodeImpl node , final Integer index ) { return new NodeImpl ( node . name , node . parent , true , index , null , node . kind , node . parameterTypes , node . parameterIndex , node . value , node . containerClass , node . typeArgumentIndex ) ; }
make it iterable and set index .
12,406
public static NodeImpl makeIterableAndSetMapKey ( final NodeImpl node , final Object key ) { return new NodeImpl ( node . name , node . parent , true , null , key , node . kind , node . parameterTypes , node . parameterIndex , node . value , node . containerClass , node . typeArgumentIndex ) ; }
make it iterable and set map key .
12,407
public static NodeImpl setPropertyValue ( final NodeImpl node , final Object value ) { return new NodeImpl ( node . name , node . parent , node . isIterableValue , node . index , node . key , node . kind , node . parameterTypes , node . parameterIndex , value , node . containerClass , node . typeArgumentIndex ) ; }
set property value to a copied node .
12,408
public static NodeImpl setTypeParameter ( final NodeImpl node , final Class < ? > containerClass , final Integer typeArgumentIndex ) { return new NodeImpl ( node . name , node . parent , node . isIterableValue , node . index , node . key , node . kind , node . parameterTypes , node . parameterIndex , node . value , con...
set type parameter to a copied node .
12,409
public final int buildHashCode ( ) { return Objects . hash ( this . index , this . isIterableValue , this . key , this . kind , this . name , this . parameterIndex , this . parameterTypes , this . parent , this . containerClass , this . typeArgumentIndex ) ; }
build hash code .
12,410
public static void addToHeader ( final String scriptname ) { if ( ! CssResources . isInHeader ( scriptname ) ) { final LinkElement styleLinkElement = Browser . getDocument ( ) . createLinkElement ( ) ; styleLinkElement . setRel ( CssResources . REL_TYPE ) ; styleLinkElement . setType ( CssResources . SCRIPT_TYPE ) ; st...
add css script to header .
12,411
public boolean isValid ( final CharSequence value , final ConstraintValidatorContext context ) { if ( value == null ) { return true ; } final String valueAsString = value . toString ( ) ; String digitsAsString ; char checkDigit ; try { digitsAsString = this . extractVerificationString ( valueAsString ) ; checkDigit = t...
valid check .
12,412
public void clearErrors ( ) { errorLabel . setText ( StringUtils . EMPTY ) ; errorLabel . getElement ( ) . getStyle ( ) . setDisplay ( Display . NONE ) ; if ( contents . getWidget ( ) != null ) { contents . getWidget ( ) . removeStyleName ( decoratorStyle . errorInputStyle ( ) ) ; contents . getWidget ( ) . removeStyle...
clear errors .
12,413
public final String get ( final String pkey ) { try { return pkey == null ? null : messages . getString ( pkey . replace ( "." , "_" ) ) ; } catch ( final MissingResourceException e ) { return null ; } }
get localized message for key .
12,414
@ SuppressWarnings ( "unchecked" ) public static < T > List < T > getInstanceList ( Class < T > type ) { if ( type == null ) { throw new IllegalArgumentException ( "Type should not be empty" ) ; } List < T > loader = ( List < T > ) EXTENSION_LOCATOR . get ( type ) ; if ( loader == null ) { try { lock . lock ( ) ; List ...
Get instances dynamically for a class type
12,415
protected void initialize ( DDFManager manager , Object data , Class < ? > [ ] typeSpecs , String name , Schema schema ) throws DDFException { this . validateSchema ( schema ) ; this . setManager ( manager ) ; if ( typeSpecs != null ) { this . getRepresentationHandler ( ) . set ( data , typeSpecs ) ; } this . getSchema...
Initialization to be done after constructor assignments such as setting of the all - important DDFManager .
12,416
private void validateName ( String name ) throws DDFException { Boolean isNameExisted ; try { this . getManager ( ) . getDDFByName ( name ) ; isNameExisted = true ; } catch ( DDFException e ) { isNameExisted = false ; } if ( isNameExisted ) { throw new DDFException ( String . format ( "DDF with name %s already exists" ...
Also only allow alphanumberic and dash - and underscore _
12,417
public final void init ( final ConfigurationState configState ) { final ConstraintValidatorFactory configConstraintValidatorFactory = configState . getConstraintValidatorFactory ( ) ; constraintValidatorFactory = configConstraintValidatorFactory == null ? GWT . < ConstraintValidatorFactory > create ( ConstraintValidato...
initialize factory .
12,418
public static SafeHtml messagesToList ( final Set < String > messages ) { final SafeHtmlBuilder sbList = new SafeHtmlBuilder ( ) ; sbList . appendHtmlConstant ( "<ul>" ) ; for ( final String message : messages ) { sbList . appendHtmlConstant ( "<li>" ) ; sbList . appendEscaped ( message ) ; sbList . appendHtmlConstant ...
build a html list out of given message set .
12,419
public static String messagesToString ( final Set < String > messages ) { final SafeHtmlBuilder sb = new SafeHtmlBuilder ( ) ; for ( final String message : messages ) { sb . appendEscaped ( message ) ; sb . appendEscaped ( "\n" ) ; } return sb . toSafeHtml ( ) . asString ( ) ; }
build a linefeed separated String with all messages out of given set .
12,420
public JClassType getAssociationType ( final PropertyDescriptor ppropertyDescriptor , final boolean puseField ) { final JType type = getElementType ( ppropertyDescriptor , puseField ) ; if ( type == null ) { return null ; } final JArrayType jarray = type . isArray ( ) ; if ( jarray != null ) { return jarray . getCompon...
get association type .
12,421
public void checkDefaultGroupSequenceIsExpandable ( final List < Class < ? > > defaultGroupSequence ) throws GroupDefinitionException { for ( final Map . Entry < Class < ? > , List < Group > > entry : sequenceMap . entrySet ( ) ) { final Class < ? > sequence = entry . getKey ( ) ; final List < Group > groups = entry . ...
check if default group sequence is expandable .
12,422
public static ConstraintViolationImpl < Object > instantiate ( final SerializationStreamReader streamReader ) throws SerializationException { final String messageTemplate = null ; final String interpolatedMessage = streamReader . readString ( ) ; final Class < Object > rootBeanClass = null ; final Object rootBean = nul...
instantiate a ConstraintViolationImpl .
12,423
public static void checkOffsetAndCount ( final byte [ ] buffer , final int byteOffset , final int byteCount ) { if ( buffer == null ) { throw new NullPointerException ( ) ; } checkOffsetAndCount ( buffer . length , byteOffset , byteCount ) ; }
Validates the offset and the byte count for the given array of bytes .
12,424
public static void checkOffsetAndCount ( final char [ ] buffer , final int charOffset , final int charCount ) { if ( buffer == null ) { throw new NullPointerException ( ) ; } checkOffsetAndCount ( buffer . length , charOffset , charCount ) ; }
Validates the offset and the byte count for the given array of characters .
12,425
private static void checkOffsetAndCount ( final int length , final int offset , final int count ) { if ( offset < 0 || count < 0 || offset + count > length ) { throw new IndexOutOfBoundsException ( ) ; } }
Validates the offset and the byte count for the given array length .
12,426
public static void doesNotContain ( final String textToSearch , final String substring , final Supplier < String > messageSupplier ) { if ( StringUtils . hasLength ( textToSearch ) && StringUtils . hasLength ( substring ) && textToSearch . contains ( substring ) ) { throw new IllegalArgumentException ( Assert . nullSaf...
Assert that the given text does not contain the given substring .
12,427
protected static Resources getDefaultResources ( ) { if ( SelectBoxWithIconInputWidget . defaultResource == null ) { synchronized ( Resources . class ) { if ( SelectBoxWithIconInputWidget . defaultResource == null ) { SelectBoxWithIconInputWidget . defaultResource = GWT . create ( Resources . class ) ; } } } return Sel...
get default resource if not set create one .
12,428
public void fillEntries ( final List < IdAndNamePlusIconBean < T > > pentries ) { this . entries . clear ( ) ; this . radioButtons . clear ( ) ; this . entries . addAll ( pentries ) ; boolean selected = false ; for ( final IdAndNamePlusIconBean < T > entry : this . entries ) { final FlowPanel option = new FlowPanel ( )...
fill entries for the select box .
12,429
public RocMetric addIn ( RocMetric other ) { int i = 0 ; int j = 1 ; while ( i < this . pred . length ) { if ( this . pred [ i ] != null ) { if ( other . pred [ i ] != null ) { j = 1 ; while ( j < this . pred [ i ] . length ) { this . pred [ i ] [ j ] = this . pred [ i ] [ j ] + other . pred [ i ] [ j ] ; j ++ ; } } } ...
Sum in - place to avoid new object alloc
12,430
public void addSourceActiveParticipant ( String userId , String altUserId , String userName , String networkId , boolean isRequestor ) { addActiveParticipant ( userId , altUserId , userName , isRequestor , Collections . singletonList ( new DICOMActiveParticipantRoleIdCodes . Source ( ) ) , networkId ) ; }
Adds an Active Participant block representing the source participant
12,431
public void addDestinationActiveParticipant ( String userId , String altUserId , String userName , String networkId , boolean isRequestor ) { addActiveParticipant ( userId , altUserId , userName , isRequestor , Collections . singletonList ( new DICOMActiveParticipantRoleIdCodes . Destination ( ) ) , networkId ) ; }
Adds an Active Participant block representing the destination participant
12,432
public void addSubmissionSetParticipantObject ( String submissionSetUniqueId ) { addParticipantObjectIdentification ( new IHETransactionParticipantObjectIDTypeCodes . SubmissionSet ( ) , null , null , null , submissionSetUniqueId , RFC3881ParticipantObjectTypeCodes . SYSTEM , RFC3881ParticipantObjectTypeRoleCodes . JOB...
Adds a Participant Object representing an XDS Submission Set
12,433
public void addDocumentUriParticipantObject ( String documentRetrieveUri , String documentUniqueId ) { List < TypeValuePairType > tvp = new LinkedList < > ( ) ; if ( documentUniqueId != null ) { tvp . add ( getTypeValuePair ( "XDSDocumentEntry.uniqueId" , documentUniqueId . getBytes ( ) ) ) ; } addParticipantObjectIden...
Adds a Participant Object representing a URI
12,434
public void addDocumentParticipantObject ( String documentUniqueId , String repositoryUniqueId , String homeCommunityId ) { List < TypeValuePairType > tvp = new LinkedList < > ( ) ; if ( ! EventUtils . isEmptyOrNull ( repositoryUniqueId ) ) { tvp . add ( getTypeValuePair ( "Repository Unique Id" , repositoryUniqueId . ...
Adds a Participant Object representing a document for XDS Exports
12,435
public void addValueSetParticipantObject ( String valueSetUniqueId , String valueSetName , String valueSetVersion ) { if ( valueSetName == null ) { valueSetName = "" ; } if ( valueSetVersion == null ) { valueSetVersion = "" ; } List < TypeValuePairType > tvp = new LinkedList < > ( ) ; tvp . add ( getTypeValuePair ( "Va...
Adds a Participant Object representing a value set for SVS Exports
12,436
public static XCARespondingGatewayAuditor getAuditor ( ) { AuditorModuleContext ctx = AuditorModuleContext . getContext ( ) ; return ( XCARespondingGatewayAuditor ) ctx . getAuditor ( XCARespondingGatewayAuditor . class ) ; }
Get an instance of the XCA Responding Gateway Auditor from the global context
12,437
public void auditCrossGatewayQueryEvent ( RFC3881EventOutcomeCodes eventOutcome , String initiatingGatewayUserId , String initiatingGatewayUserName , String initiatingGatewayIpAddress , String respondingGatewayEndpointUri , String storedQueryUUID , String adhocQueryRequestPayload , String homeCommunityId , String patie...
Audits an ITI - 38 Cross Gateway Query event for XCA Responding Gateway actors .
12,438
public void auditCrossGatewayRetrieveEvent ( RFC3881EventOutcomeCodes eventOutcome , String initiatingGatewayUserId , String initiatingGatewayIpAddress , String respondingGatewayEndpointUri , String initiatingGatewayUserName , String [ ] documentUniqueIds , String [ ] repositoryUniqueIds , String homeCommunityIds [ ] ,...
Audits an ITI - 39 Cross Gateway Retrieve event for XCA Responding Gateway actors .
12,439
public void auditRetrieveDocumentSetEvent ( RFC3881EventOutcomeCodes eventOutcome , String repositoryEndpointUri , String userName , String [ ] documentUniqueIds , String [ ] repositoryUniqueIds , String homeCommunityIds [ ] , List < CodedValueType > purposesOfUse , List < CodedValueType > userRoles ) { if ( ! isAudito...
Audits an ITI - 43 Retrieve Document Set event for XCA Responding Gateway actors .
12,440
public void auditRegistryStoredQueryEvent ( RFC3881EventOutcomeCodes eventOutcome , String registryEndpointUri , String consumerUserName , String storedQueryUUID , String adhocQueryRequestPayload , String homeCommunityId , String patientId , List < CodedValueType > purposesOfUse , List < CodedValueType > userRoles ) { ...
Audits an ITI - 18 Registry Stored Query event for XCA Responding Gateway actors .
12,441
public void write ( DataWriter writer ) throws IOException { writer . writeInt ( pos ) ; writer . writeInt ( val ) ; writer . writeLong ( scn ) ; }
Writes this EntryValue to entry log file via a data writer .
12,442
public synchronized byte [ ] getBuf ( int len ) { for ( int i = 0 ; i < mBuffersBySize . size ( ) ; i ++ ) { byte [ ] buf = mBuffersBySize . get ( i ) ; if ( buf . length >= len ) { mCurrentSize -= buf . length ; mBuffersBySize . remove ( i ) ; mBuffersByLastUse . remove ( buf ) ; return buf ; } } return new byte [ len...
Returns a buffer from the pool if one is available in the requested size or allocates a new one if a pooled one is not available .
12,443
public synchronized void returnBuf ( byte [ ] buf ) { if ( buf == null || buf . length > mSizeLimit ) { return ; } mBuffersByLastUse . add ( buf ) ; int pos = Collections . binarySearch ( mBuffersBySize , buf , BUF_COMPARATOR ) ; if ( pos < 0 ) { pos = - pos - 1 ; } mBuffersBySize . add ( pos , buf ) ; mCurrentSize += ...
Returns a buffer to the pool throwing away old buffers if the pool would exceed its allotted size .
12,444
protected byte [ ] ensure128BitMD5 ( byte [ ] digest ) { if ( digest . length == MD5_LENGTH ) { return digest ; } else if ( digest . length > MD5_LENGTH ) { byte [ ] b = new byte [ MD5_LENGTH ] ; System . arraycopy ( digest , 0 , b , 0 , MD5_LENGTH ) ; return b ; } else { byte [ ] b = new byte [ MD5_LENGTH ] ; System ....
Ensure that the specified MD5 digest has 128 bits .
12,445
protected void ensureCapacity ( ) { if ( _buffer . remaining ( ) < 8 ) { ByteBuffer b = ByteBuffer . allocate ( _buffer . capacity ( ) << 1 ) ; _buffer . flip ( ) ; b . put ( _buffer ) ; _buffer = b ; } }
Ensure that the internal backing buffer has enough capacity for a new pair of index and offset .
12,446
public Position get ( Position pos , List < Event < T > > list ) { EventBatch < T > b ; if ( pos . getOffset ( ) < getOrigin ( ) || pos . isIndexed ( ) ) { return null ; } b = _batch ; if ( b . getOrigin ( ) <= pos . getOffset ( ) ) { long newOffset = b . get ( pos . getOffset ( ) , list ) ; Clock clock = pos . getOffs...
Gets a number of events starting from a given position in the Retention . The number of events is determined internally by the Retention and it is up to the batch size .
12,447
protected boolean mergeEventsToLastBatch ( ) throws IOException { if ( _lastBatch != null && _eventBatchSize >= ( _lastBatch . getSize ( ) + _batch . getSize ( ) ) ) { _batch . setCompletionTime ( System . currentTimeMillis ( ) ) ; if ( _flushListener != null ) { _flushListener . beforeFlush ( _batch ) ; } SimpleEventB...
Try to merge events from the current batch to the last persisted batch in order to reduce the number of smaller batches in the retention .
12,448
static Schema createPersonSchema ( ) { List < Field > fields = new ArrayList < Field > ( ) ; fields . add ( new Field ( "id" , Schema . create ( Type . INT ) , null , null ) ) ; fields . add ( new Field ( "age" , Schema . create ( Type . INT ) , null , null ) ) ; fields . add ( new Field ( "fname" , Schema . create ( T...
Creates the Avro schema for the Person store .
12,449
public CountDownLatch get ( States . GenericState state ) throws Exception { CountDownLatch latch = new CountDownLatch ( state . targetBacklog ) ; if ( state . pipeline == Pipeline . JusDef ) { Request < NetworkResponse > request ; for ( int i = 0 ; i < state . targetBacklog ; i ++ ) { request = state . jusRequests . g...
This is a dummy benchmark showing the time it takes for a complete async request - response round trip considering no or negligible network latency
12,450
public void remap ( ) throws IOException { if ( _mmapArray == null ) { open ( ) ; return ; } long length = _raf . length ( ) ; long mappedLength = getMappedLength ( ) ; if ( length != mappedLength ) { int cnt = 0 ; long position = 0 ; cnt = ( int ) ( length >> BUFFER_BITS ) ; cnt += ( length & BUFFER_MASK ) > 0 ? 1 : 0...
Performs re - mapping operation to synchronize with the underling file .
12,451
public final long getMappedLength ( ) { MappedByteBuffer [ ] mmapArray = _mmapArray ; long length = 0 ; if ( mmapArray != null ) { for ( MappedByteBuffer mmap : mmapArray ) { length += mmap . capacity ( ) ; } } return length ; }
Gets the total number of bytes of all mapped buffers .
12,452
public static < T > Response < T > success ( T result , Cache . Entry cacheEntry ) { return new Response < T > ( result , cacheEntry ) ; }
Returns a successful response containing the parsed result .
12,453
public synchronized void setOption ( String key , String value ) { if ( key == null || value == null ) { return ; } config . put ( key , value ) ; }
Set a value to the backed properties in this module config .
12,454
protected void auditQueryEvent ( boolean systemIsSource , IHETransactionEventTypeCodes transaction , RFC3881EventOutcomeCodes eventOutcome , String auditSourceId , String auditSourceEnterpriseSiteId , String sourceUserId , String sourceAltUserId , String sourceUserName , String sourceNetworkId , String humanRequestor ,...
Audits a QUERY event for IHE XDS transactions notably XDS Registry Query and XDS Registry Stored Query transactions .
12,455
static Set < String > parsePathParameters ( String path ) { Matcher m = PARAM_URL_REGEX . matcher ( path ) ; Set < String > patterns = new LinkedHashSet < > ( ) ; while ( m . find ( ) ) { patterns . add ( m . group ( 1 ) ) ; } return patterns ; }
Gets the set of unique path parameters used in the given URI . If a parameter is used twice in the URI it will only show up once in the set .
12,456
public byte [ ] getPostBody ( ) throws AuthFailureError { Map < String , String > postParams = getPostParams ( ) ; if ( postParams != null && postParams . size ( ) > 0 ) { return encodeParameters ( postParams , getPostParamsEncoding ( ) ) ; } return null ; }
Returns the raw POST body to be sent .
12,457
public byte [ ] getBody ( ) throws AuthFailureError { Map < String , String > params = getParams ( ) ; if ( params != null && params . size ( ) > 0 ) { return encodeParameters ( params , getParamsEncoding ( ) ) ; } return null ; }
Returns the raw POST or PUT body to be sent .
12,458
protected DataStore < byte [ ] , byte [ ] > createDataStore ( File homeDir , int initialCapacity ) throws Exception { StoreConfig config = new StoreConfig ( homeDir , initialCapacity ) ; config . setBatchSize ( 10000 ) ; config . setNumSyncBatches ( 100 ) ; config . setSegmentFactory ( new WriteBufferSegmentFactory ( )...
Creates a DataStore instance .
12,459
public void populate ( ) throws Exception { for ( int i = 0 ; i < _initialCapacity ; i ++ ) { String str = "key." + i ; byte [ ] key = str . getBytes ( ) ; byte [ ] value = createDataForKey ( str ) ; _store . put ( key , value ) ; } _store . sync ( ) ; }
Populates the underlying data store .
12,460
public void doRandomReads ( int readCnt ) { Random rand = new Random ( ) ; for ( int i = 0 ; i < readCnt ; i ++ ) { int keyId = rand . nextInt ( _initialCapacity ) ; String str = "key." + keyId ; byte [ ] key = str . getBytes ( ) ; byte [ ] value = _store . get ( key ) ; System . out . printf ( "Key=%s\tValue=%s%n" , s...
Perform a number of random reads from the underlying data store .
12,461
public void init ( ServletConfig config ) throws ServletException { super . init ( config ) ; this . expiresMinutes = readLong ( config . getInitParameter ( INIT_PARAM_EXPIRES_MINUTES ) , this . expiresMinutes ) ; this . cacheControl = config . getInitParameter ( INIT_PARAM_CACHE_CONTROL ) != null ? config . getInitPar...
default enabled fingerprinting
12,462
public void addApplicationParticipant ( String userId , String altUserId , String userName , String networkId ) { addActiveParticipant ( userId , altUserId , userName , false , Collections . singletonList ( new DICOMActiveParticipantRoleIdCodes . Application ( ) ) , networkId ) ; }
Add an Application Active Participant to this message
12,463
public void addApplicationStarterParticipant ( String userId , String altUserId , String userName , String networkId ) { addActiveParticipant ( userId , altUserId , userName , true , Collections . singletonList ( new DICOMActiveParticipantRoleIdCodes . ApplicationLauncher ( ) ) , networkId ) ; }
Add an Application Starter Active Participant to this message
12,464
public synchronized void invalidate ( String key , boolean fullExpire ) { Entry entry = get ( key ) ; if ( entry != null ) { entry . softTtl = 0 ; if ( fullExpire ) { entry . ttl = 0 ; } put ( key , entry ) ; } }
Invalidates an entry in the cache .
12,465
private String getFilenameForKey ( String key ) { int firstHalfLength = key . length ( ) / 2 ; String localFilename = String . valueOf ( key . substring ( 0 , firstHalfLength ) . hashCode ( ) ) ; localFilename += String . valueOf ( key . substring ( firstHalfLength ) . hashCode ( ) ) ; return localFilename ; }
Creates a pseudo - unique filename for the specified cache key .
12,466
private void removeEntry ( String key ) { CacheHeader entry = mEntries . get ( key ) ; if ( entry != null ) { mTotalSize -= entry . size ; mEntries . remove ( key ) ; } }
Removes the entry identified by key from the cache .
12,467
public synchronized void wrap ( List < Segment > segments ) throws IOException { int newWorkingGeneration = ( _workingGeneration + 1 ) % Integer . MAX_VALUE ; int newWorkingSectionOffset = ( _workingSectionOffset + _bytesPerSection ) % _bytesPerSegment ; int cnt = segments . size ( ) ; int pos = _segmentDataStart + new...
Wrap a list of segments and persist meta data into the . meta file .
12,468
public static Document createDomDocument ( ) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( true ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; return builder . newDocument ( ) ; }
Simple method to create an empty well - formed DOM Document
12,469
public FormEncodingBuilder add ( String name , String value ) { if ( content . size ( ) > 0 ) { content . writeByte ( '&' ) ; } HttpUrl . canonicalize ( content , name , 0 , name . length ( ) , HttpUrl . FORM_ENCODE_SET , false , false , true , true ) ; content . writeByte ( '=' ) ; HttpUrl . canonicalize ( content , v...
Add new key - value pair .
12,470
public static String toPackageName ( String nsUri ) { if ( nsUri == null || nsUri . length ( ) == 0 ) { return null ; } int idx = nsUri . indexOf ( ':' ) ; String scheme = "" ; if ( idx >= 0 ) { scheme = nsUri . substring ( 0 , idx ) ; if ( scheme . equalsIgnoreCase ( "http" ) || scheme . equalsIgnoreCase ( "urn" ) ) n...
Create a java package name out of an XML namespace .
12,471
public static String toNamespace ( String packageName ) { if ( packageName == null || packageName . length ( ) == 0 ) { return null ; } List < String > tokens = reverse ( tokenize ( packageName , "." ) ) ; StringBuilder buf = new StringBuilder ( "http://" ) ; for ( int i = 1 ; i < tokens . size ( ) ; i ++ ) { buf . app...
Create an XML namespace out of a java package name .
12,472
public static XCAInitiatingGatewayAuditor getAuditor ( ) { AuditorModuleContext ctx = AuditorModuleContext . getContext ( ) ; return ( XCAInitiatingGatewayAuditor ) ctx . getAuditor ( XCAInitiatingGatewayAuditor . class ) ; }
Get an instance of the XCA Initiating Gateway from the global context
12,473
public void auditRetrieveDocumentSetEvent ( RFC3881EventOutcomeCodes eventOutcome , String consumerUserId , String consumerUserName , String consumerIpAddress , String repositoryEndpointUri , String [ ] documentUniqueIds , String [ ] repositoryUniqueIds , String [ ] homeCommunityIds , List < CodedValueType > purposesOf...
Audits an ITI - 43 Retrieve Document Set - b event for XCA Initiating Gateway actors . Audits as a XDS Document Registry .
12,474
public Position get ( Position pos , Map < K , Event < V > > map ) { ArrayList < Event < K > > list = new ArrayList < Event < K > > ( 1000 ) ; Position nextPos = get ( pos , list ) ; for ( Event < K > evt : list ) { K key = evt . getValue ( ) ; if ( key != null ) { try { V value = get ( key ) ; map . put ( key , new Si...
Gets a number of value events starting from a give position in the Retention . The number of events is determined internally by the Retention and it is up to the batch size .
12,475
public boolean isValid ( CobolContext cobolContext , byte [ ] hostData , int start ) { return isValid ( javaClass , cobolContext , hostData , start ) ; }
Check if a byte array contains valid mainframe data for this type characteristics .
12,476
public FromHostPrimitiveResult < T > fromHost ( CobolContext cobolContext , byte [ ] hostData , int start ) { return fromHost ( javaClass , cobolContext , hostData , start ) ; }
Convert mainframe data into a Java object .
12,477
protected static String formatMessage ( String message , byte [ ] hostData , int start , int curPos , int bytesLen ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( message ) ; if ( hostData != null && hostData . length > 0 && curPos < hostData . length && curPos >= start && bytesLen > 0 && start + bytesLen ...
Format the data to make it easy to locate the error in the incoming byte stream .
12,478
public static IHEAuditor getAuditor ( Class < ? extends IHEAuditor > clazz , AuditorModuleConfig configToUse , AuditorModuleContext contextToUse ) { IHEAuditor auditor = AuditorFactory . getAuditorForClass ( clazz ) ; if ( auditor != null ) { auditor . setConfig ( configToUse ) ; auditor . setContext ( contextToUse ) ;...
Get an auditor instance for the specified auditor class auditor configuration and auditor context .
12,479
public static IHEAuditor getAuditor ( Class < ? extends IHEAuditor > clazz , AuditorModuleConfig config , boolean useGlobalContext ) { AuditorModuleContext context ; if ( ! useGlobalContext ) { context = ( AuditorModuleContext ) ContextInitializer . initialize ( config ) ; } else { context = AuditorModuleContext . getC...
Get an auditor instance for the specified auditor class module configuration . Auditor will use a standalone context if a non - global context is requested .
12,480
public static IHEAuditor getAuditor ( String className , AuditorModuleConfig config , AuditorModuleContext context ) { Class < ? extends IHEAuditor > clazz = AuditorFactory . getAuditorClassForClassName ( className ) ; return getAuditor ( clazz , config , context ) ; }
Get an auditor instance for the specified auditor class name auditor configuration and auditor context .
12,481
public static IHEAuditor getAuditor ( String className , AuditorModuleConfig config , boolean useGlobalContext ) { Class < ? extends IHEAuditor > clazz = AuditorFactory . getAuditorClassForClassName ( className ) ; return getAuditor ( clazz , config , useGlobalContext ) ; }
Get an auditor instance for the specified auditor class name module configuration . Auditor will use a standalone context if a non - global context is requested
12,482
@ SuppressWarnings ( "unchecked" ) public static Class < ? extends IHEAuditor > getAuditorClassForClassName ( String className ) { try { Class < ? > clazz = Class . forName ( className ) ; return ( Class < ? extends IHEAuditor > ) clazz ; } catch ( ClassCastException e ) { LOGGER . error ( "The requested class " + clas...
Get a Class instance for the fully - qualified class name specified . The specified class should have IHEAuditor as a superclass and implement the necessary methods to be an IHE Auditor .
12,483
private static IHEAuditor getAuditorForClass ( Class < ? extends IHEAuditor > clazz ) { if ( null == clazz ) { LOGGER . error ( "Error - Cannot specify a null auditor class" ) ; } else { try { return clazz . newInstance ( ) ; } catch ( ClassCastException e ) { LOGGER . error ( "The requested class " + clazz . getName (...
Create a new instance of the specified IHE Auditor non - abstract subclass that implements the auditor API .
12,484
public String encodedUsername ( ) { if ( username . isEmpty ( ) ) return "" ; int usernameStart = scheme . length ( ) + 3 ; int usernameEnd = delimiterOffset ( url , usernameStart , url . length ( ) , ":@" ) ; return url . substring ( usernameStart , usernameEnd ) ; }
Returns the username or an empty string if none is set .
12,485
public String encodedPassword ( ) { if ( password . isEmpty ( ) ) return "" ; int passwordStart = url . indexOf ( ':' , scheme . length ( ) + 3 ) + 1 ; int passwordEnd = url . indexOf ( '@' ) ; return url . substring ( passwordStart , passwordEnd ) ; }
Returns the password or an empty string if none is set .
12,486
public synchronized Bitmap getBitmap ( BitmapFactory . Options options ) { Bitmap bitmap = null ; synchronized ( bitmapsBySize ) { final Iterator < Bitmap > iterator = bitmapsBySize . iterator ( ) ; Bitmap item ; while ( iterator . hasNext ( ) ) { item = iterator . next ( ) ; if ( null != item && canBePooled ( item ) )...
Returns a bitmap from the pool if one is available in the requested size or allocates a new one if a pooled one is not available .
12,487
public synchronized void returnBitmap ( Bitmap bitmap ) { if ( bitmap == null || bitmapsBySize . contains ( bitmap ) ) { return ; } else if ( getBitmapSize ( bitmap ) > sizeLimit || ! canBePooled ( bitmap ) ) { return ; } bitmapsByLastUse . add ( bitmap ) ; int pos = Collections . binarySearch ( bitmapsBySize , bitmap ...
Returns a bitmap to the pool throwing away old bitmaps if the pool would exceed its allotted size .
12,488
protected static int getBytesPerPixel ( Bitmap . Config config ) { if ( config == Bitmap . Config . ARGB_8888 ) { return 4 ; } else if ( config == Bitmap . Config . RGB_565 ) { return 2 ; } else if ( config == Bitmap . Config . ARGB_4444 ) { return 2 ; } else if ( config == Bitmap . Config . ALPHA_8 ) { return 1 ; } re...
Return the byte usage per pixel of a bitmap based on its configuration .
12,489
public static String parseCharset ( Map < String , String > headers , String defaultCharset ) { String contentType = headers . get ( HTTP . CONTENT_TYPE ) ; if ( contentType != null ) { String [ ] params = contentType . split ( ";" ) ; for ( int i = 1 ; i < params . length ; i ++ ) { String [ ] pair = params [ i ] . tr...
Retrieve a charset from headers
12,490
public void stopWhenDone ( ) { Thread t = new Thread ( new Runnable ( ) { public void run ( ) { while ( getCurrentRequests ( ) > 0 ) { try { Thread . sleep ( 33 ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } } } ) ; t . start ( ) ; try { t . join ( ) ; } catch ( InterruptedException e ) { e . pr...
Stops the queue when all requests are finished
12,491
public < R extends RequestQueue > R addQueueMarkerListener ( RequestListener . MarkerListener markerListener ) { if ( markerListener != null ) { synchronized ( markerListeners ) { this . markerListeners . add ( markerListener ) ; } } return ( R ) this ; }
Add marker listener for RequestQueue related events
12,492
public < R extends RequestQueue > R removeQueueMarkerListener ( RequestListener . MarkerListener markerListener ) { synchronized ( markerListeners ) { this . markerListeners . remove ( markerListener ) ; } return ( R ) this ; }
Remove marker listener for RequestQueue related events
12,493
public void cancelAll ( final Object tag ) { if ( tag == null ) { throw new IllegalArgumentException ( "Cannot cancelAll with a null tag" ) ; } cancelAll ( new RequestFilter ( ) { public boolean apply ( Request < ? > request ) { return request . getTag ( ) == tag ; } } ) ; }
Cancels all requests in this queue with the given tag . Tag must be non - null and equality is by identity .
12,494
public static Clock parseClock ( String str ) { if ( str == null || str . length ( ) == 0 ) { return Clock . ZERO ; } String [ ] parts = str . split ( ":" ) ; long [ ] values = new long [ parts . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) { values [ i ] = Long . parseLong ( parts [ i ] ) ; } return new C...
Parses a Clock value from its string representation .
12,495
public static Clock parseClock ( byte [ ] raw ) { if ( raw == null || raw . length < 8 ) { return Clock . ZERO ; } int cnt = raw . length >> 3 ; long [ ] values = new long [ cnt ] ; ByteBuffer bb = ByteBuffer . wrap ( raw ) ; for ( int i = 0 ; i < values . length ; i ++ ) { values [ i ] = bb . getLong ( ) ; } return ne...
Parses a Clock value from its raw bytes .
12,496
public Occurred compareTo ( Clock c ) { if ( this == c ) return Occurred . EQUICONCURRENTLY ; if ( ZERO == c ) return Occurred . AFTER ; if ( this == ZERO ) return Occurred . BEFORE ; int neg = 0 , pos = 0 , eq = 0 ; try { final long [ ] dst = c . values ( ) ; final int len = dst . length ; if ( _values . length == len...
Compares this clock with the specified clock for ordering .
12,497
public static String resolveFigurative ( final String value , final int length , final boolean quoteIsQuote ) { if ( value == null || value . length ( ) == 0 ) { return value ; } String ucValue = value . toUpperCase ( Locale . getDefault ( ) ) ; if ( ucValue . matches ( "^ZERO(S|ES)?$" ) ) { return "0" ; } if ( ucValue...
Translate individual figurative constants .
12,498
public static String fill ( final String prefix , final String charSequence , final int times ) { if ( times < 1 ) { return "" ; } StringBuilder sb = new StringBuilder ( ) ; if ( prefix != null ) { sb . append ( prefix ) ; } for ( int i = 0 ; i < times ; i ++ ) { sb . append ( charSequence ) ; } return sb . toString ( ...
Create a string representation repeating a character sequence the requested number of times .
12,499
public static String stripDelimiters ( final String value ) { if ( value != null && value . length ( ) > 1 ) { if ( value . charAt ( 0 ) == value . charAt ( value . length ( ) - 1 ) && ( value . charAt ( 0 ) == '\'' ) ) { return value . substring ( 1 , value . length ( ) - 1 ) ; } if ( value . charAt ( 0 ) == value . c...
The parser does not strip delimiters from literal strings so we do it here if necessary .