idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
25,400
public static Function < RequestEnvelope , String > userId ( ) { return r -> Optional . ofNullable ( r ) . map ( RequestEnvelope :: getContext ) . map ( Context :: getSystem ) . map ( SystemState :: getUser ) . map ( User :: getUserId ) . orElseThrow ( ( ) -> new PersistenceException ( "Could not retrieve user ID from ...
Produces a partition key from the user ID contained in an incoming request .
25,401
public static Function < RequestEnvelope , String > deviceId ( ) { return r -> Optional . ofNullable ( r ) . map ( RequestEnvelope :: getContext ) . map ( Context :: getSystem ) . map ( SystemState :: getDevice ) . map ( Device :: getDeviceId ) . orElseThrow ( ( ) -> new PersistenceException ( "Could not retrieve devic...
Produces a partition key from the device ID contained in an incoming request .
25,402
public Plugin create ( final PluginWrapper pluginWrapper ) { String pluginClassName = pluginWrapper . getDescriptor ( ) . getPluginClass ( ) ; log . debug ( "Create instance for plugin '{}'" , pluginClassName ) ; Class < ? > pluginClass ; try { pluginClass = pluginWrapper . getPluginClassLoader ( ) . loadClass ( plugin...
Creates a plugin instance . If an error occurs than that error is logged and the method returns null .
25,403
public void addVertex ( V vertex ) { if ( containsVertex ( vertex ) ) { return ; } neighbors . put ( vertex , new ArrayList < V > ( ) ) ; }
Add a vertex to the graph . Nothing happens if vertex is already in graph .
25,404
public void addEdge ( V from , V to ) { addVertex ( from ) ; addVertex ( to ) ; neighbors . get ( from ) . add ( to ) ; }
Add an edge to the graph ; if either vertex does not exist it s added . This implementation allows the creation of multi - edges and self - loops .
25,405
public void removeEdge ( V from , V to ) { if ( ! containsVertex ( from ) ) { throw new IllegalArgumentException ( "Nonexistent vertex " + from ) ; } if ( ! containsVertex ( to ) ) { throw new IllegalArgumentException ( "Nonexistent vertex " + to ) ; } neighbors . get ( from ) . remove ( to ) ; }
Remove an edge from the graph . Nothing happens if no such edge .
25,406
public List < PluginWrapper > getPlugins ( PluginState pluginState ) { List < PluginWrapper > plugins = new ArrayList < > ( ) ; for ( PluginWrapper plugin : getPlugins ( ) ) { if ( pluginState . equals ( plugin . getPluginState ( ) ) ) { plugins . add ( plugin ) ; } } return plugins ; }
Returns a copy of plugins with that state .
25,407
public void loadPlugins ( ) { log . debug ( "Lookup plugins in '{}'" , pluginsRoot ) ; if ( Files . notExists ( pluginsRoot ) || ! Files . isDirectory ( pluginsRoot ) ) { log . warn ( "No '{}' root" , pluginsRoot ) ; return ; } List < Path > pluginPaths = pluginRepository . getPluginPaths ( ) ; if ( pluginPaths . isEmp...
Load plugins .
25,408
public void startPlugins ( ) { for ( PluginWrapper pluginWrapper : resolvedPlugins ) { PluginState pluginState = pluginWrapper . getPluginState ( ) ; if ( ( PluginState . DISABLED != pluginState ) && ( PluginState . STARTED != pluginState ) ) { try { log . info ( "Start plugin '{}'" , getPluginLabel ( pluginWrapper . g...
Start all active plugins .
25,409
public PluginState startPlugin ( String pluginId ) { checkPluginId ( pluginId ) ; PluginWrapper pluginWrapper = getPlugin ( pluginId ) ; PluginDescriptor pluginDescriptor = pluginWrapper . getDescriptor ( ) ; PluginState pluginState = pluginWrapper . getPluginState ( ) ; if ( PluginState . STARTED == pluginState ) { lo...
Start the specified plugin and its dependencies .
25,410
public void stopPlugins ( ) { Collections . reverse ( startedPlugins ) ; Iterator < PluginWrapper > itr = startedPlugins . iterator ( ) ; while ( itr . hasNext ( ) ) { PluginWrapper pluginWrapper = itr . next ( ) ; PluginState pluginState = pluginWrapper . getPluginState ( ) ; if ( PluginState . STARTED == pluginState ...
Stop all active plugins .
25,411
protected String idForPath ( Path pluginPath ) { for ( PluginWrapper plugin : plugins . values ( ) ) { if ( plugin . getPluginPath ( ) . equals ( pluginPath ) ) { return plugin . getPluginId ( ) ; } } return null ; }
Tests for already loaded plugins on given path .
25,412
protected void validatePluginDescriptor ( PluginDescriptor descriptor ) throws PluginException { if ( StringUtils . isNullOrEmpty ( descriptor . getPluginId ( ) ) ) { throw new PluginException ( "Field 'id' cannot be empty" ) ; } if ( descriptor . getVersion ( ) == null ) { throw new PluginException ( "Field 'version' ...
Override this to change the validation criteria .
25,413
public static Path findWithEnding ( Path basePath , String ... endings ) { for ( String ending : endings ) { Path newPath = basePath . resolveSibling ( basePath . getFileName ( ) + ending ) ; if ( Files . exists ( newPath ) ) { return newPath ; } } return null ; }
Finds a path with various endings or null if not found .
25,414
public static boolean isZipFile ( Path path ) { return Files . isRegularFile ( path ) && path . toString ( ) . toLowerCase ( ) . endsWith ( ".zip" ) ; }
Return true only if path is a zip file .
25,415
public static boolean isJarFile ( Path path ) { return Files . isRegularFile ( path ) && path . toString ( ) . toLowerCase ( ) . endsWith ( ".jar" ) ; }
Return true only if path is a jar file .
25,416
protected PluginWrapper loadPluginFromPath ( Path pluginPath ) throws PluginException { try { pluginPath = FileUtils . expandIfZip ( pluginPath ) ; } catch ( Exception e ) { log . warn ( "Failed to unzip " + pluginPath , e ) ; return null ; } return super . loadPluginFromPath ( pluginPath ) ; }
Load a plugin from disk . If the path is a zip file first unpack
25,417
protected SSLParameters engineGetSupportedSSLParameters ( ) { SSLSocket socket = getDefaultSocket ( ) ; SSLParameters params = new SSLParameters ( ) ; params . setCipherSuites ( socket . getSupportedCipherSuites ( ) ) ; params . setProtocols ( socket . getSupportedProtocols ( ) ) ; return params ; }
Returns a copy of the SSLParameters indicating the maximum supported settings for this SSL context .
25,418
private static < A , B > Entry < A , B > createEntry ( A text , B field ) { return new SimpleImmutableEntry < > ( text , field ) ; }
Helper method to create an immutable entry .
25,419
private void construct ( DerValue derVal ) throws IOException { if ( derVal . isConstructed ( ) && derVal . isContextSpecific ( ) ) { derVal = derVal . data . getDerValue ( ) ; version = derVal . getInteger ( ) ; if ( derVal . data . available ( ) != 0 ) { throw new IOException ( "X.509 version, bad format" ) ; } } }
Construct the class from the passed DerValue
25,420
public void encode ( OutputStream out ) throws IOException { if ( version == V1 ) { return ; } DerOutputStream tmp = new DerOutputStream ( ) ; tmp . putInteger ( version ) ; DerOutputStream seq = new DerOutputStream ( ) ; seq . write ( DerValue . createTag ( DerValue . TAG_CONTEXT , true , ( byte ) 0 ) , tmp ) ; out . ...
Encode the CertificateVersion period in DER form to the stream .
25,421
public int getIndex ( String uri , String localName ) { int max = length * 5 ; for ( int i = 0 ; i < max ; i += 5 ) { if ( data [ i ] . equals ( uri ) && data [ i + 1 ] . equals ( localName ) ) { return i / 5 ; } } return - 1 ; }
Look up an attribute s index by Namespace name .
25,422
public String getType ( String uri , String localName ) { int max = length * 5 ; for ( int i = 0 ; i < max ; i += 5 ) { if ( data [ i ] . equals ( uri ) && data [ i + 1 ] . equals ( localName ) ) { return data [ i + 3 ] ; } } return null ; }
Look up an attribute s type by Namespace - qualified name .
25,423
public void clear ( ) { if ( data != null ) { for ( int i = 0 ; i < ( length * 5 ) ; i ++ ) data [ i ] = null ; } length = 0 ; }
Clear the attribute list for reuse .
25,424
public void setAttributes ( Attributes atts ) { clear ( ) ; length = atts . getLength ( ) ; if ( length > 0 ) { data = new String [ length * 5 ] ; for ( int i = 0 ; i < length ; i ++ ) { data [ i * 5 ] = atts . getURI ( i ) ; data [ i * 5 + 1 ] = atts . getLocalName ( i ) ; data [ i * 5 + 2 ] = atts . getQName ( i ) ; ...
Copy an entire Attributes object .
25,425
public void addAttribute ( String uri , String localName , String qName , String type , String value ) { ensureCapacity ( length + 1 ) ; data [ length * 5 ] = uri ; data [ length * 5 + 1 ] = localName ; data [ length * 5 + 2 ] = qName ; data [ length * 5 + 3 ] = type ; data [ length * 5 + 4 ] = value ; length ++ ; }
Add an attribute to the end of the list .
25,426
public void setAttribute ( int index , String uri , String localName , String qName , String type , String value ) { if ( index >= 0 && index < length ) { data [ index * 5 ] = uri ; data [ index * 5 + 1 ] = localName ; data [ index * 5 + 2 ] = qName ; data [ index * 5 + 3 ] = type ; data [ index * 5 + 4 ] = value ; } e...
Set an attribute in the list .
25,427
public void setURI ( int index , String uri ) { if ( index >= 0 && index < length ) { data [ index * 5 ] = uri ; } else { badIndex ( index ) ; } }
Set the Namespace URI of a specific attribute .
25,428
public void setLocalName ( int index , String localName ) { if ( index >= 0 && index < length ) { data [ index * 5 + 1 ] = localName ; } else { badIndex ( index ) ; } }
Set the local name of a specific attribute .
25,429
public void setQName ( int index , String qName ) { if ( index >= 0 && index < length ) { data [ index * 5 + 2 ] = qName ; } else { badIndex ( index ) ; } }
Set the qualified name of a specific attribute .
25,430
public void setType ( int index , String type ) { if ( index >= 0 && index < length ) { data [ index * 5 + 3 ] = type ; } else { badIndex ( index ) ; } }
Set the type of a specific attribute .
25,431
public void setValue ( int index , String value ) { if ( index >= 0 && index < length ) { data [ index * 5 + 4 ] = value ; } else { badIndex ( index ) ; } }
Set the value of a specific attribute .
25,432
private void ensureCapacity ( int n ) { if ( n <= 0 ) { return ; } int max ; if ( data == null || data . length == 0 ) { max = 25 ; } else if ( data . length >= n * 5 ) { return ; } else { max = data . length ; } while ( max < n * 5 ) { max *= 2 ; } String newData [ ] = new String [ max ] ; if ( length > 0 ) { System ....
Ensure the internal array s capacity .
25,433
protected void read ( UCharacterName data ) throws IOException { m_tokenstringindex_ = m_byteBuffer_ . getInt ( ) ; m_groupindex_ = m_byteBuffer_ . getInt ( ) ; m_groupstringindex_ = m_byteBuffer_ . getInt ( ) ; m_algnamesindex_ = m_byteBuffer_ . getInt ( ) ; int count = m_byteBuffer_ . getChar ( ) ; char token [ ] = I...
Read and break up the stream of data passed in as arguments and fills up UCharacterName . If unsuccessful false will be returned .
25,434
private UCharacterName . AlgorithmName readAlg ( ) throws IOException { UCharacterName . AlgorithmName result = new UCharacterName . AlgorithmName ( ) ; int rangestart = m_byteBuffer_ . getInt ( ) ; int rangeend = m_byteBuffer_ . getInt ( ) ; byte type = m_byteBuffer_ . get ( ) ; byte variant = m_byteBuffer_ . get ( ) ...
Reads an individual record of AlgorithmNames
25,435
protected String getMethodSignature ( MethodDeclaration m ) { StringBuilder sb = new StringBuilder ( ) ; ExecutableElement element = m . getExecutableElement ( ) ; char prefix = Modifier . isStatic ( m . getModifiers ( ) ) ? '+' : '-' ; String returnType = nameTable . getObjCType ( element . getReturnType ( ) ) ; Strin...
Create an Objective - C method signature string .
25,436
public static < K , V > Cache < K , V > newSoftMemoryCache ( int size ) { return new MemoryCache < > ( true , size ) ; }
Return a new memory cache with the specified maximum size unlimited lifetime for entries with the values held by SoftReferences .
25,437
public static < K , V > Cache < K , V > newHardMemoryCache ( int size ) { return new MemoryCache < > ( false , size ) ; }
Return a new memory cache with the specified maximum size unlimited lifetime for entries with the values held by standard references .
25,438
@ SuppressWarnings ( "unchecked" ) public static < K , V > Cache < K , V > newNullCache ( ) { return ( Cache < K , V > ) NullCache . INSTANCE ; }
Return a dummy cache that does nothing .
25,439
private void emptyQueue ( ) { if ( queue == null ) { return ; } int startSize = cacheMap . size ( ) ; while ( true ) { @ SuppressWarnings ( "unchecked" ) CacheEntry < K , V > entry = ( CacheEntry < K , V > ) queue . poll ( ) ; if ( entry == null ) { break ; } K key = entry . getKey ( ) ; if ( key == null ) { continue ;...
Empty the reference queue and remove all corresponding entries from the cache .
25,440
private void expungeExpiredEntries ( ) { emptyQueue ( ) ; if ( lifetime == 0 ) { return ; } int cnt = 0 ; long time = System . currentTimeMillis ( ) ; for ( Iterator < CacheEntry < K , V > > t = cacheMap . values ( ) . iterator ( ) ; t . hasNext ( ) ; ) { CacheEntry < K , V > entry = t . next ( ) ; if ( entry . isValid...
Scan all entries and remove all expired ones .
25,441
public synchronized void accept ( CacheVisitor < K , V > visitor ) { expungeExpiredEntries ( ) ; Map < K , V > cached = getCachedEntries ( ) ; visitor . visit ( cached ) ; }
it is a heavyweight method .
25,442
public int currentCodePoint ( ) { int ch = current ( ) ; if ( UTF16 . isLeadSurrogate ( ( char ) ch ) ) { next ( ) ; int ch2 = current ( ) ; previous ( ) ; if ( UTF16 . isTrailSurrogate ( ( char ) ch2 ) ) { return Character . toCodePoint ( ( char ) ch , ( char ) ch2 ) ; } } return ch ; }
Returns the codepoint at the current index . If the current index is invalid DONE is returned . If the current index points to a lead surrogate and there is a following trail surrogate then the code point is returned . Otherwise the code unit at index is returned . Index is not changed .
25,443
protected final int getSurrogateOffset ( char lead , char trail ) { if ( m_dataManipulate_ == null ) { throw new NullPointerException ( "The field DataManipulate in this Trie is null" ) ; } int offset = m_dataManipulate_ . getFoldingOffset ( getLeadValue ( lead ) ) ; if ( offset > 0 ) { return getRawOffset ( offset , (...
Gets the offset to the data which the surrogate pair points to .
25,444
public void write ( byte [ ] b , int off , int len ) throws IOException { out . write ( b , off , len ) ; cksum . update ( b , off , len ) ; }
Writes an array of bytes . Will block until the bytes are actually written .
25,445
void addEntry ( SelChImpl sc ) { putDescriptor ( totalChannels , IOUtil . fdVal ( sc . getFD ( ) ) ) ; putEventOps ( totalChannels , 0 ) ; putReventOps ( totalChannels , 0 ) ; totalChannels ++ ; }
Prepare another pollfd struct for use .
25,446
static void replaceEntry ( PollArrayWrapper source , int sindex , PollArrayWrapper target , int tindex ) { target . putDescriptor ( tindex , source . getDescriptor ( sindex ) ) ; target . putEventOps ( tindex , source . getEventOps ( sindex ) ) ; target . putReventOps ( tindex , source . getReventOps ( sindex ) ) ; }
Writes the pollfd entry from the source wrapper at the source index over the entry in the target wrapper at the target index . The source array remains unchanged unless the source array and the target are the same array .
25,447
private final boolean breakExceptionAt ( int n ) { int bestPosn = - 1 ; int bestValue = - 1 ; text . setIndex ( n ) ; backwardsTrie . reset ( ) ; int uch ; if ( ( uch = text . previousCodePoint ( ) ) == ' ' ) { } else { uch = text . nextCodePoint ( ) ; } BytesTrie . Result r = BytesTrie . Result . INTERMEDIATE_VALUE ; ...
Is there an exception at this point?
25,448
public static TerribleFailureHandler setWtfHandler ( TerribleFailureHandler handler ) { if ( handler == null ) { throw new NullPointerException ( "handler == null" ) ; } TerribleFailureHandler oldHandler = sWtfHandler ; sWtfHandler = handler ; return oldHandler ; }
Sets the terrible failure handler for testing .
25,449
public final void init ( AlgorithmParameterSpec params , SecureRandom random ) throws InvalidAlgorithmParameterException { if ( serviceIterator == null ) { spi . engineInit ( params , random ) ; return ; } Exception failure = null ; KeyGeneratorSpi mySpi = spi ; do { try { mySpi . engineInit ( params , random ) ; initT...
Initializes this key generator with the specified parameter set and a user - provided source of randomness .
25,450
public final void init ( int keysize , SecureRandom random ) { if ( serviceIterator == null ) { spi . engineInit ( keysize , random ) ; return ; } RuntimeException failure = null ; KeyGeneratorSpi mySpi = spi ; do { try { mySpi . engineInit ( keysize , random ) ; initType = I_SIZE ; initKeySize = keysize ; initParams =...
Initializes this key generator for a certain keysize using a user - provided source of randomness .
25,451
public void reset ( ) { contexts = new Context [ 32 ] ; namespaceDeclUris = false ; contextPos = 0 ; contexts [ contextPos ] = currentContext = new Context ( ) ; currentContext . declarePrefix ( "xml" , XMLNS ) ; }
Reset this Namespace support object for reuse .
25,452
public void pushContext ( ) { int max = contexts . length ; contexts [ contextPos ] . declsOK = false ; contextPos ++ ; if ( contextPos >= max ) { Context newContexts [ ] = new Context [ max * 2 ] ; System . arraycopy ( contexts , 0 , newContexts , 0 , max ) ; max *= 2 ; contexts = newContexts ; } currentContext = cont...
Start a new Namespace context . The new context will automatically inherit the declarations of its parent context but it will also keep track of which declarations were made within this context .
25,453
public Enumeration getPrefixes ( String uri ) { ArrayList < String > prefixes = new ArrayList < String > ( ) ; Enumeration allPrefixes = getPrefixes ( ) ; while ( allPrefixes . hasMoreElements ( ) ) { String prefix = ( String ) allPrefixes . nextElement ( ) ; if ( uri . equals ( getURI ( prefix ) ) ) { prefixes . add (...
Return an enumeration of all prefixes for a given URI whose declarations are active in the current context . This includes declarations from parent contexts that have not been overridden .
25,454
public synchronized static Set < MeasureUnit > getAvailable ( String type ) { populateCache ( ) ; Map < String , MeasureUnit > units = cache . get ( type ) ; return units == null ? Collections . < MeasureUnit > emptySet ( ) : Collections . unmodifiableSet ( new HashSet < MeasureUnit > ( units . values ( ) ) ) ; }
For the given type return the available units .
25,455
public synchronized static Set < MeasureUnit > getAvailable ( ) { Set < MeasureUnit > result = new HashSet < MeasureUnit > ( ) ; for ( String type : new HashSet < String > ( MeasureUnit . getAvailableTypes ( ) ) ) { for ( MeasureUnit unit : MeasureUnit . getAvailable ( type ) ) { result . add ( unit ) ; } } return Coll...
Get all of the available units . Returned set is unmodifiable .
25,456
public static MeasureUnit resolveUnitPerUnit ( MeasureUnit unit , MeasureUnit perUnit ) { return unitPerUnitToSingleUnit . get ( Pair . of ( unit , perUnit ) ) ; }
For ICU use only .
25,457
public static < T > TerminalOp < T , Boolean > makeRef ( Predicate < ? super T > predicate , MatchKind matchKind ) { Objects . requireNonNull ( predicate ) ; Objects . requireNonNull ( matchKind ) ; class MatchSink extends BooleanTerminalSink < T > { MatchSink ( ) { super ( matchKind ) ; } public void accept ( T t ) { ...
Constructs a quantified predicate matcher for a Stream .
25,458
private static double floorOrCeil ( double a , double negativeBoundary , double positiveBoundary , double sign ) { int exponent = Math . getExponent ( a ) ; if ( exponent < 0 ) { return ( ( a == 0.0 ) ? a : ( ( a < 0.0 ) ? negativeBoundary : positiveBoundary ) ) ; } else if ( exponent >= 52 ) { return a ; } assert expo...
Internal method to share logic between floor and ceil .
25,459
void dumpAssociationTables ( ) { Enumeration associations = m_patternTable . elements ( ) ; while ( associations . hasMoreElements ( ) ) { TemplateSubPatternAssociation head = ( TemplateSubPatternAssociation ) associations . nextElement ( ) ; while ( null != head ) { System . out . print ( "(" + head . getTargetString ...
Dump all patterns and elements that match those patterns
25,460
public void compose ( StylesheetRoot sroot ) { if ( DEBUG ) { System . out . println ( "Before wildcard insert..." ) ; dumpAssociationTables ( ) ; } if ( null != m_wildCardPatterns ) { Enumeration associations = m_patternTable . elements ( ) ; while ( associations . hasMoreElements ( ) ) { TemplateSubPatternAssociation...
After all templates have been added this function should be called .
25,461
private TemplateSubPatternAssociation insertAssociationIntoList ( TemplateSubPatternAssociation head , TemplateSubPatternAssociation item , boolean isWildCardInsert ) { double priority = getPriorityOrScore ( item ) ; double workPriority ; int importLevel = item . getImportLevel ( ) ; int docOrder = item . getDocOrderPo...
Insert the given TemplateSubPatternAssociation into the the linked list . Sort by import precedence then priority then by document order .
25,462
private void insertPatternInTable ( StepPattern pattern , ElemTemplate template ) { String target = pattern . getTargetString ( ) ; if ( null != target ) { String pstring = template . getMatch ( ) . getPatternString ( ) ; TemplateSubPatternAssociation association = new TemplateSubPatternAssociation ( template , pattern...
Add a template to the template list .
25,463
private double getPriorityOrScore ( TemplateSubPatternAssociation matchPat ) { double priority = matchPat . getTemplate ( ) . getPriority ( ) ; if ( priority == XPath . MATCH_SCORE_NONE ) { Expression ex = matchPat . getStepPattern ( ) ; if ( ex instanceof NodeTest ) { return ( ( NodeTest ) ex ) . getDefaultScore ( ) ;...
Given a match pattern and template association return the score of that match . This score or priority can always be statically calculated .
25,464
public TemplateSubPatternAssociation getHead ( XPathContext xctxt , int targetNode , DTM dtm ) { short targetNodeType = dtm . getNodeType ( targetNode ) ; TemplateSubPatternAssociation head ; switch ( targetNodeType ) { case DTM . ELEMENT_NODE : case DTM . ATTRIBUTE_NODE : head = ( TemplateSubPatternAssociation ) m_pat...
Get the head of the most likely list of associations to check based on the name and type of the targetNode argument .
25,465
public ElemTemplate getTemplateFast ( XPathContext xctxt , int targetNode , int expTypeID , QName mode , int maxImportLevel , boolean quietConflictWarnings , DTM dtm ) throws TransformerException { TemplateSubPatternAssociation head ; switch ( dtm . getNodeType ( targetNode ) ) { case DTM . ELEMENT_NODE : case DTM . AT...
Given a target element find the template that best matches in the given XSL document according to the rules specified in the xsl draft . This variation of getTemplate assumes the current node and current expression node have already been pushed .
25,466
public ElemTemplate getTemplate ( XPathContext xctxt , int targetNode , QName mode , boolean quietConflictWarnings , DTM dtm ) throws TransformerException { TemplateSubPatternAssociation head = getHead ( xctxt , targetNode , dtm ) ; if ( null != head ) { xctxt . pushNamespaceContextNull ( ) ; xctxt . pushCurrentNodeAnd...
Given a target element find the template that best matches in the given XSL document according to the rules specified in the xsl draft .
25,467
private void addObjectIfNotFound ( Object obj , Vector v ) { int n = v . size ( ) ; boolean addIt = true ; for ( int i = 0 ; i < n ; i ++ ) { if ( v . elementAt ( i ) == obj ) { addIt = false ; break ; } } if ( addIt ) { v . addElement ( obj ) ; } }
Add object to vector if not already there .
25,468
private void putHead ( String key , TemplateSubPatternAssociation assoc ) { if ( key . equals ( PsuedoNames . PSEUDONAME_TEXT ) ) m_textPatterns = assoc ; else if ( key . equals ( PsuedoNames . PSEUDONAME_ROOT ) ) m_docPatterns = assoc ; else if ( key . equals ( PsuedoNames . PSEUDONAME_COMMENT ) ) m_commentPatterns = ...
Get the head of the assocation list that is keyed by target .
25,469
public Date firstBetween ( Date start , Date end ) { return rule . firstBetween ( start , end ) ; }
Return the first occurrence of this holiday that is on or after the given start date and before the given end date .
25,470
public boolean isBetween ( Date start , Date end ) { return rule . isBetween ( start , end ) ; }
Check whether this holiday occurs at least once between the two dates given .
25,471
private void setup ( XMLReader xmlReader ) { if ( xmlReader == null ) { throw new NullPointerException ( "XMLReader must not be null" ) ; } this . xmlReader = xmlReader ; qAtts = new AttributesAdapter ( ) ; }
Internal setup .
25,472
private void setupXMLReader ( ) throws SAXException { xmlReader . setFeature ( "http://xml.org/sax/features/namespace-prefixes" , true ) ; try { xmlReader . setFeature ( "http://xml.org/sax/features/namespaces" , false ) ; } catch ( SAXException e ) { } xmlReader . setContentHandler ( this ) ; }
Set up the XML reader .
25,473
public void startElement ( String uri , String localName , String qName , Attributes atts ) throws SAXException { if ( documentHandler != null ) { qAtts . setAttributes ( atts ) ; documentHandler . startElement ( qName , qAtts ) ; } }
Adapt a SAX2 start element event .
25,474
public void endElement ( String uri , String localName , String qName ) throws SAXException { if ( documentHandler != null ) documentHandler . endElement ( qName ) ; }
Adapt a SAX2 end element event .
25,475
public void processingInstruction ( String target , String data ) throws SAXException { if ( documentHandler != null ) documentHandler . processingInstruction ( target , data ) ; }
Adapt a SAX2 processing instruction event .
25,476
public static < F , S > Pair < F , S > of ( F first , S second ) { if ( first == null || second == null ) { throw new IllegalArgumentException ( "Pair.of requires non null values." ) ; } return new Pair < F , S > ( first , second ) ; }
Creates a pair object
25,477
protected boolean sameFile ( URL u1 , URL u2 ) { if ( ! ( ( u1 . getProtocol ( ) == u2 . getProtocol ( ) ) || ( u1 . getProtocol ( ) != null && u1 . getProtocol ( ) . equalsIgnoreCase ( u2 . getProtocol ( ) ) ) ) ) return false ; if ( ! ( u1 . getFile ( ) == u2 . getFile ( ) || ( u1 . getFile ( ) != null && u1 . getFil...
Compare two urls to see whether they refer to the same file i . e . having the same protocol host port and path . This method requires that none of its arguments is null . This is guaranteed by the fact that it is only called indirectly by java . net . URL class .
25,478
protected synchronized InetAddress getHostAddress ( URL u ) { if ( u . hostAddress != null ) return ( InetAddress ) u . hostAddress ; String host = u . getHost ( ) ; if ( host == null || host . equals ( "" ) ) { return null ; } else { try { u . hostAddress = InetAddress . getByName ( host ) ; } catch ( UnknownHostExcep...
Get the IP address of our host . An empty host field or a DNS failure will result in a null return .
25,479
private static void _smartAppend ( StringBuilder buf , char c ) { if ( buf . length ( ) != 0 && buf . charAt ( buf . length ( ) - 1 ) != c ) { buf . append ( c ) ; } }
Append c to buf unless buf is empty or buf already ends in c .
25,480
public Node selectSingleNode ( Node contextNode , String str , Node namespaceNode ) throws TransformerException { NodeIterator nl = selectNodeIterator ( contextNode , str , namespaceNode ) ; return nl . nextNode ( ) ; }
Use an XPath string to select a single node . XPath namespace prefixes are resolved from the namespaceNode .
25,481
public SSLParameters getSSLParameters ( ) { SSLParameters parameters = new SSLParameters ( ) ; parameters . setCipherSuites ( getEnabledCipherSuites ( ) ) ; parameters . setProtocols ( getEnabledProtocols ( ) ) ; if ( getNeedClientAuth ( ) ) { parameters . setNeedClientAuth ( true ) ; } else if ( getWantClientAuth ( ) ...
Returns the SSLParameters in effect for newly accepted connections . The ciphersuites and protocols of the returned SSLParameters are always non - null .
25,482
public void setSSLParameters ( SSLParameters params ) { String [ ] s ; s = params . getCipherSuites ( ) ; if ( s != null ) { setEnabledCipherSuites ( s ) ; } s = params . getProtocols ( ) ; if ( s != null ) { setEnabledProtocols ( s ) ; } if ( params . getNeedClientAuth ( ) ) { setNeedClientAuth ( true ) ; } else if ( ...
Applies SSLParameters to newly accepted connections .
25,483
public void encode ( DerOutputStream out ) throws IOException { DerOutputStream tmp = new DerOutputStream ( ) ; hashAlgId . encode ( tmp ) ; tmp . putOctetString ( issuerNameHash ) ; tmp . putOctetString ( issuerKeyHash ) ; certSerialNumber . encode ( tmp ) ; out . write ( DerValue . tag_Sequence , tmp ) ; if ( debug )...
Encode the CertId using ASN . 1 DER . The hash algorithm used is SHA - 1 .
25,484
public final void init ( Key key , SecureRandom random ) throws InvalidKeyException { if ( spi != null && ( key == null || lock == null ) ) { spi . engineInit ( key , random ) ; } else { try { chooseProvider ( I_NO_PARAMS , key , null , random ) ; } catch ( InvalidAlgorithmParameterException e ) { throw new InvalidKeyE...
Initializes this key agreement with the given key and source of randomness . The given key is required to contain all the algorithm parameters required for this key agreement .
25,485
public final void init ( Key key , AlgorithmParameterSpec params ) throws InvalidKeyException , InvalidAlgorithmParameterException { init ( key , params , JceSecurity . RANDOM ) ; }
Initializes this key agreement with the given key and set of algorithm parameters .
25,486
public final void init ( Key key , AlgorithmParameterSpec params , SecureRandom random ) throws InvalidKeyException , InvalidAlgorithmParameterException { if ( spi != null ) { spi . engineInit ( key , params , random ) ; } else { chooseProvider ( I_PARAMS , key , params , random ) ; } }
Initializes this key agreement with the given key set of algorithm parameters and source of randomness .
25,487
public final Key doPhase ( Key key , boolean lastPhase ) throws InvalidKeyException , IllegalStateException { chooseFirstProvider ( ) ; return spi . engineDoPhase ( key , lastPhase ) ; }
Executes the next phase of this key agreement with the given key that was received from one of the other parties involved in this key agreement .
25,488
public static DTMIterator newDTMIterator ( Compiler compiler , int opPos , boolean isTopLevel ) throws javax . xml . transform . TransformerException { int firstStepPos = OpMap . getFirstChildPos ( opPos ) ; int analysis = analyze ( compiler , firstStepPos , 0 ) ; boolean isOneStep = isOneStep ( analysis ) ; DTMIterato...
Create a new LocPathIterator iterator . The exact type of iterator returned is based on an analysis of the XPath operations .
25,489
static public int getAnalysisBitFromAxes ( int axis ) { switch ( axis ) { case Axis . ANCESTOR : return BIT_ANCESTOR ; case Axis . ANCESTORORSELF : return BIT_ANCESTOR_OR_SELF ; case Axis . ATTRIBUTE : return BIT_ATTRIBUTE ; case Axis . CHILD : return BIT_CHILD ; case Axis . DESCENDANT : return BIT_DESCENDANT ; case Ax...
Get a corresponding BIT_XXX from an axis .
25,490
public static boolean mightBeProximate ( Compiler compiler , int opPos , int stepType ) throws javax . xml . transform . TransformerException { boolean mightBeProximate = false ; int argLen ; switch ( stepType ) { case OpCodes . OP_VARIABLE : case OpCodes . OP_EXTFUNCTION : case OpCodes . OP_FUNCTION : case OpCodes . O...
Tell if the predicates need to have proximity knowledge .
25,491
private static int analyze ( Compiler compiler , int stepOpCodePos , int stepIndex ) throws javax . xml . transform . TransformerException { int stepType ; int stepCount = 0 ; int analysisResult = 0x00000000 ; while ( OpCodes . ENDOP != ( stepType = compiler . getOp ( stepOpCodePos ) ) ) { stepCount ++ ; boolean predAn...
Analyze the location path and return 32 bits that give information about the location path as a whole . See the BIT_XXX constants for meaning about each of the bits .
25,492
public static boolean isDownwardAxisOfMany ( int axis ) { return ( ( Axis . DESCENDANTORSELF == axis ) || ( Axis . DESCENDANT == axis ) || ( Axis . FOLLOWING == axis ) || ( Axis . PRECEDING == axis ) ) ; }
Tell if the given axis goes downword . Bogus name if you can think of a better one please do tell . This really has to do with inverting attribute axis .
25,493
static boolean analyzePredicate ( Compiler compiler , int opPos , int stepType ) throws javax . xml . transform . TransformerException { int argLen ; switch ( stepType ) { case OpCodes . OP_VARIABLE : case OpCodes . OP_EXTFUNCTION : case OpCodes . OP_FUNCTION : case OpCodes . OP_GROUP : argLen = compiler . getArgLength...
Analyze a step and give information about it s predicates . Right now this just returns true or false if the step has a predicate .
25,494
public void setCurrency ( Currency currency ) { if ( currency == null ) { throw new NullPointerException ( ) ; } this . currency = currency ; intlCurrencySymbol = currency . getCurrencyCode ( ) ; currencySymbol = currency . getSymbol ( locale ) ; }
Sets the currency of these DecimalFormatSymbols . This also sets the currency symbol attribute to the currency s symbol in the DecimalFormatSymbols locale and the international currency symbol attribute to the currency s ISO 4217 currency code .
25,495
protected void initializeData ( ULocale desiredLocale , String type ) { String key = desiredLocale . getBaseName ( ) + '+' + type ; String ns = desiredLocale . getKeywordValue ( "numbers" ) ; if ( ns != null && ns . length ( ) > 0 ) { key += '+' + ns ; } DateFormatSymbols dfs = DFSCACHE . getInstance ( key , desiredLoc...
We may need to deescalate this API to
25,496
void initializeData ( DateFormatSymbols dfs ) { this . eras = dfs . eras ; this . eraNames = dfs . eraNames ; this . narrowEras = dfs . narrowEras ; this . months = dfs . months ; this . shortMonths = dfs . shortMonths ; this . narrowMonths = dfs . narrowMonths ; this . standaloneMonths = dfs . standaloneMonths ; this ...
Initializes format symbols using another instance .
25,497
private String [ ] loadDayPeriodStrings ( Map < String , String > resourceMap ) { String strings [ ] = new String [ DAY_PERIOD_KEYS . length ] ; if ( resourceMap != null ) { for ( int i = 0 ; i < DAY_PERIOD_KEYS . length ; ++ i ) { strings [ i ] = resourceMap . get ( DAY_PERIOD_KEYS [ i ] ) ; } } return strings ; }
Loads localized names for day periods in the requested format .
25,498
final void setLocale ( ULocale valid , ULocale actual ) { if ( ( valid == null ) != ( actual == null ) ) { throw new IllegalArgumentException ( ) ; } this . validLocale = valid ; this . actualLocale = actual ; }
Sets information about the locales that were used to create this object . If the object was not constructed from locale data both arguments should be set to null . Otherwise neither should be null . The actual locale must be at the same level or less specific than the valid locale . This method is intended for use by f...
25,499
private void checkVariableRange ( int ch , String rule , int start ) { if ( ch >= curData . variablesBase && ch < variableLimit ) { syntaxError ( "Variable range character in rule" , rule , start ) ; } }
Assert that the given character is NOT within the variable range . If it is signal an error . This is neccesary to ensure that the variable range does not overlap characters used in a rule .