idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
25,500
static boolean resemblesPragma ( String rule , int pos , int limit ) { return Utility . parsePattern ( rule , pos , limit , "use " , null ) >= 0 ; }
Return true if the given rule looks like a pragma .
25,501
static final void syntaxError ( String msg , String rule , int start ) { int end = ruleEnd ( rule , start , rule . length ( ) ) ; throw new IllegalIcuArgumentException ( msg + " in \"" + Utility . escape ( rule . substring ( start , end ) ) + '"' ) ; }
Throw an exception indicating a syntax error . Search the rule string for the probable end of the rule . Of course if the error is that the end of rule marker is missing then the rule end will not be found . In any case the rule start will be correctly reported .
25,502
private final char parseSet ( String rule , ParsePosition pos ) { UnicodeSet set = new UnicodeSet ( rule , pos , parseData ) ; if ( variableNext >= variableLimit ) { throw new RuntimeException ( "Private use variables exhausted" ) ; } set . compact ( ) ; return generateStandInFor ( set ) ; }
Parse a UnicodeSet out store it and return the stand - in character used to represent it .
25,503
char generateStandInFor ( Object obj ) { for ( int i = 0 ; i < variablesVector . size ( ) ; ++ i ) { if ( variablesVector . get ( i ) == obj ) { return ( char ) ( curData . variablesBase + i ) ; } } if ( variableNext >= variableLimit ) { throw new RuntimeException ( "Variable range exhausted" ) ; } variablesVector . add ( obj ) ; return variableNext ++ ; }
Generate and return a stand - in for a new UnicodeMatcher or UnicodeReplacer . Store the object .
25,504
private void appendVariableDef ( String name , StringBuffer buf ) { char [ ] ch = variableNames . get ( name ) ; if ( ch == null ) { if ( undefinedVariableName == null ) { undefinedVariableName = name ; if ( variableNext >= variableLimit ) { throw new RuntimeException ( "Private use variables exhausted" ) ; } buf . append ( -- variableLimit ) ; } else { throw new IllegalIcuArgumentException ( "Undefined variable $" + name ) ; } } else { buf . append ( ch ) ; } }
Append the value of the given variable name to the given StringBuffer .
25,505
public void clearPassword ( ) { if ( inputPassword != null ) { for ( int i = 0 ; i < inputPassword . length ; i ++ ) inputPassword [ i ] = ' ' ; } }
Clear the retrieved password .
25,506
public boolean translateReadyOps ( int ops , int initialOps , SelectionKeyImpl sk ) { int intOps = sk . nioInterestOps ( ) ; int oldOps = sk . nioReadyOps ( ) ; int newOps = initialOps ; if ( ( ops & PollArrayWrapper . POLLNVAL ) != 0 ) { return false ; } if ( ( ops & ( PollArrayWrapper . POLLERR | PollArrayWrapper . POLLHUP ) ) != 0 ) { newOps = intOps ; sk . nioReadyOps ( newOps ) ; return ( newOps & ~ oldOps ) != 0 ; } if ( ( ( ops & PollArrayWrapper . POLLIN ) != 0 ) && ( ( intOps & SelectionKey . OP_ACCEPT ) != 0 ) ) newOps |= SelectionKey . OP_ACCEPT ; sk . nioReadyOps ( newOps ) ; return ( newOps & ~ oldOps ) != 0 ; }
Translates native poll revent set into a ready operation set
25,507
public static final String [ ] getKeywordValues ( String baseName , String keyword ) { Set < String > keywords = new HashSet < String > ( ) ; ULocale locales [ ] = getAvailEntry ( baseName , ICU_DATA_CLASS_LOADER ) . getULocaleList ( ) ; int i ; for ( i = 0 ; i < locales . length ; i ++ ) { try { UResourceBundle b = UResourceBundle . getBundleInstance ( baseName , locales [ i ] ) ; ICUResourceBundle irb = ( ICUResourceBundle ) ( b . getObject ( keyword ) ) ; Enumeration < String > e = irb . getKeys ( ) ; while ( e . hasMoreElements ( ) ) { String s = e . nextElement ( ) ; if ( ! DEFAULT_TAG . equals ( s ) && ! s . startsWith ( "private-" ) ) { keywords . add ( s ) ; } } } catch ( Throwable t ) { } } return keywords . toArray ( new String [ 0 ] ) ; }
Given a tree path and keyword return a string enumeration of all possible values for that keyword .
25,508
public String getStringWithFallback ( String path ) throws MissingResourceException { ICUResourceBundle actualBundle = this ; String result = findStringWithFallback ( path , actualBundle , null ) ; if ( result == null ) { throw new MissingResourceException ( "Can't find resource for bundle " + this . getClass ( ) . getName ( ) + ", key " + getType ( ) , path , getKey ( ) ) ; } if ( result . equals ( NO_INHERITANCE_MARKER ) ) { throw new MissingResourceException ( "Encountered NO_INHERITANCE_MARKER" , path , getKey ( ) ) ; } return result ; }
will throw type mismatch exception if the resource is not a string
25,509
public static Set < String > getAvailableLocaleNameSet ( String bundlePrefix , ClassLoader loader ) { return getAvailEntry ( bundlePrefix , loader ) . getLocaleNameSet ( ) ; }
Return a set of the locale names supported by a collection of resource bundles .
25,510
public static Set < String > getFullLocaleNameSet ( String bundlePrefix , ClassLoader loader ) { return getAvailEntry ( bundlePrefix , loader ) . getFullLocaleNameSet ( ) ; }
Return a set of all the locale names supported by a collection of resource bundles .
25,511
private static final void addLocaleIDsFromIndexBundle ( String baseName , ClassLoader root , Set < String > locales ) { ICUResourceBundle bundle ; try { bundle = ( ICUResourceBundle ) UResourceBundle . instantiateBundle ( baseName , ICU_RESOURCE_INDEX , root , true ) ; bundle = ( ICUResourceBundle ) bundle . get ( INSTALLED_LOCALES ) ; } catch ( MissingResourceException e ) { if ( DEBUG ) { System . out . println ( "couldn't find " + baseName + '/' + ICU_RESOURCE_INDEX + ".res" ) ; Thread . dumpStack ( ) ; } return ; } UResourceBundleIterator iter = bundle . getIterator ( ) ; iter . reset ( ) ; while ( iter . hasNext ( ) ) { String locstr = iter . next ( ) . getKey ( ) ; locales . add ( locstr ) ; } }
and returns the data in a different form .
25,512
private void getResPathKeys ( String [ ] keys , int depth ) { ICUResourceBundle b = this ; while ( depth > 0 ) { keys [ -- depth ] = b . key ; b = b . container ; assert ( depth == 0 ) == ( b . container == null ) ; } }
Fills some of the keys array with the keys on the path to this resource object . Writes the top - level key into index 0 and increments from there .
25,513
public static ICUResourceBundle createBundle ( String baseName , String localeID , ClassLoader root ) { ICUResourceBundleReader reader = ICUResourceBundleReader . getReader ( baseName , localeID , root ) ; if ( reader == null ) { return null ; } return getBundle ( reader , baseName , localeID , root ) ; }
Create a bundle using a reader .
25,514
public void reset ( ) { done = false ; for ( int i = 0 ; i < current . length ; ++ i ) { current [ i ] = 0 ; } }
Resets the iterator so that one can start again from the beginning .
25,515
public void setSource ( String newSource ) { source = nfd . normalize ( newSource ) ; done = false ; if ( newSource . length ( ) == 0 ) { pieces = new String [ 1 ] [ ] ; current = new int [ 1 ] ; pieces [ 0 ] = new String [ ] { "" } ; return ; } List < String > segmentList = new ArrayList < String > ( ) ; int cp ; int start = 0 ; int i = UTF16 . findOffsetFromCodePoint ( source , 1 ) ; for ( ; i < source . length ( ) ; i += Character . charCount ( cp ) ) { cp = source . codePointAt ( i ) ; if ( nfcImpl . isCanonSegmentStarter ( cp ) ) { segmentList . add ( source . substring ( start , i ) ) ; start = i ; } } segmentList . add ( source . substring ( start , i ) ) ; pieces = new String [ segmentList . size ( ) ] [ ] ; current = new int [ segmentList . size ( ) ] ; for ( i = 0 ; i < pieces . length ; ++ i ) { if ( PROGRESS ) System . out . println ( "SEGMENT" ) ; pieces [ i ] = getEquivalents ( segmentList . get ( i ) ) ; } }
Set a new source for this iterator . Allows object reuse .
25,516
private String [ ] getEquivalents ( String segment ) { Set < String > result = new HashSet < String > ( ) ; Set < String > basic = getEquivalents2 ( segment ) ; Set < String > permutations = new HashSet < String > ( ) ; Iterator < String > it = basic . iterator ( ) ; while ( it . hasNext ( ) ) { String item = it . next ( ) ; permutations . clear ( ) ; permute ( item , SKIP_ZEROS , permutations ) ; Iterator < String > it2 = permutations . iterator ( ) ; while ( it2 . hasNext ( ) ) { String possible = it2 . next ( ) ; if ( Normalizer . compare ( possible , segment , 0 ) == 0 ) { if ( PROGRESS ) System . out . println ( "Adding Permutation: " + Utility . hex ( possible ) ) ; result . add ( possible ) ; } else { if ( PROGRESS ) System . out . println ( "-Skipping Permutation: " + Utility . hex ( possible ) ) ; } } } String [ ] finalResult = new String [ result . size ( ) ] ; result . toArray ( finalResult ) ; return finalResult ; }
we have a segment in NFD . Find all the strings that are canonically equivalent to it .
25,517
@ SuppressWarnings ( "fallthrough" ) protected int handleGetLimit ( int field , int limitType ) { switch ( field ) { case ERA : if ( limitType == MINIMUM || limitType == GREATEST_MINIMUM ) { return 0 ; } return CURRENT_ERA ; case YEAR : { switch ( limitType ) { case MINIMUM : case GREATEST_MINIMUM : return 1 ; case LEAST_MAXIMUM : return 1 ; case MAXIMUM : return super . handleGetLimit ( field , MAXIMUM ) - ERAS [ CURRENT_ERA * 3 ] ; } } default : return super . handleGetLimit ( field , limitType ) ; } }
Override GregorianCalendar . We should really handle YEAR_WOY and EXTENDED_YEAR here too to implement the 1 .. 5000000 range but it s not critical .
25,518
public static Provider getSunProvider ( ) { try { Class < ? > clazz = Class . forName ( jarVerificationProviders [ 0 ] ) ; return ( Provider ) clazz . newInstance ( ) ; } catch ( Exception e ) { try { Class < ? > clazz = Class . forName ( BACKUP_PROVIDER_CLASSNAME ) ; return ( Provider ) clazz . newInstance ( ) ; } catch ( Exception ee ) { throw new RuntimeException ( "Sun provider not found" , e ) ; } } }
sun . security . util . ManifestEntryVerifier and java . security . SecureRandom .
25,519
public static ProviderList getProviderList ( ) { ProviderList list = getThreadProviderList ( ) ; if ( list == null ) { list = getSystemProviderList ( ) ; } return list ; }
Return the current ProviderList . If the thread - local list is set it is returned . Otherwise the system wide list is returned .
25,520
public void write ( final int c ) throws IOException { if ( count >= BYTES_MAX ) flushBuffer ( ) ; if ( c < 0x80 ) { m_outputBytes [ count ++ ] = ( byte ) ( c ) ; } else if ( c < 0x800 ) { m_outputBytes [ count ++ ] = ( byte ) ( 0xc0 + ( c >> 6 ) ) ; m_outputBytes [ count ++ ] = ( byte ) ( 0x80 + ( c & 0x3f ) ) ; } else if ( c < 0x10000 ) { m_outputBytes [ count ++ ] = ( byte ) ( 0xe0 + ( c >> 12 ) ) ; m_outputBytes [ count ++ ] = ( byte ) ( 0x80 + ( ( c >> 6 ) & 0x3f ) ) ; m_outputBytes [ count ++ ] = ( byte ) ( 0x80 + ( c & 0x3f ) ) ; } else { m_outputBytes [ count ++ ] = ( byte ) ( 0xf0 + ( c >> 18 ) ) ; m_outputBytes [ count ++ ] = ( byte ) ( 0x80 + ( ( c >> 12 ) & 0x3f ) ) ; m_outputBytes [ count ++ ] = ( byte ) ( 0x80 + ( ( c >> 6 ) & 0x3f ) ) ; m_outputBytes [ count ++ ] = ( byte ) ( 0x80 + ( c & 0x3f ) ) ; } }
Write a single character . The character to be written is contained in the 16 low - order bits of the given integer value ; the 16 high - order bits are ignored .
25,521
private void readObject ( java . io . ObjectInputStream stream ) throws java . io . IOException , javax . xml . transform . TransformerException { try { stream . defaultReadObject ( ) ; m_clones = new IteratorPool ( this ) ; } catch ( ClassNotFoundException cnfe ) { throw new javax . xml . transform . TransformerException ( cnfe ) ; } }
Read the object from a serialization stream .
25,522
public XObject execute ( XPathContext xctxt ) throws javax . xml . transform . TransformerException { XNodeSet iter = new XNodeSet ( ( LocPathIterator ) m_clones . getInstance ( ) ) ; iter . setRoot ( xctxt . getCurrentNode ( ) , xctxt ) ; return iter ; }
Execute this iterator meaning create a clone that can store state and initialize it for fast execution from the current runtime state . When this is called no actual query from the current context node is performed .
25,523
public int asNode ( XPathContext xctxt ) throws javax . xml . transform . TransformerException { DTMIterator iter = ( DTMIterator ) m_clones . getInstance ( ) ; int current = xctxt . getCurrentNode ( ) ; iter . setRoot ( current , xctxt ) ; int next = iter . nextNode ( ) ; iter . detach ( ) ; return next ; }
Return the first node out of the nodeset if this expression is a nodeset expression . This is the default implementation for nodesets . Derived classes should try and override this and return a value without having to do a clone operation .
25,524
public void runTo ( int index ) { if ( m_foundLast || ( ( index >= 0 ) && ( index <= getCurrentPos ( ) ) ) ) return ; int n ; if ( - 1 == index ) { while ( DTM . NULL != ( n = nextNode ( ) ) ) ; } else { while ( DTM . NULL != ( n = nextNode ( ) ) ) { if ( getCurrentPos ( ) >= index ) break ; } } }
If an index is requested NodeSetDTM will call this method to run the iterator to the index . By default this sets m_next to the index . If the index argument is - 1 this signals that the iterator should be run to the end .
25,525
private String getOverrideSignature ( ExecutablePair method ) { StringBuilder sb = new StringBuilder ( ElementUtil . getName ( method . element ( ) ) ) ; sb . append ( '(' ) ; for ( TypeMirror pType : method . type ( ) . getParameterTypes ( ) ) { sb . append ( typeUtil . getSignatureName ( pType ) ) ; } sb . append ( ')' ) ; return sb . toString ( ) ; }
otherwise . Used as a key to group inherited methods together .
25,526
public final int compareTo ( E o ) { Enum < ? > other = ( Enum < ? > ) o ; Enum < E > self = this ; if ( self . getClass ( ) != other . getClass ( ) && self . getDeclaringClass ( ) != other . getDeclaringClass ( ) ) throw new ClassCastException ( ) ; return self . ordinal - other . ordinal ; }
Compares this enum with the specified object for order . Returns a negative integer zero or a positive integer as this object is less than equal to or greater than the specified object .
25,527
@ SuppressWarnings ( "unchecked" ) public static < T extends Enum < T > > T [ ] getSharedConstants ( Class < T > enumType ) { return ( T [ ] ) sharedConstantsCache . get ( enumType ) ; }
Returns a shared mutable array containing the constants of this enum . It is an error to modify the returned array .
25,528
public DerInputStream subStream ( int len , boolean do_skip ) throws IOException { DerInputBuffer newbuf = buffer . dup ( ) ; newbuf . truncate ( len ) ; if ( do_skip ) { buffer . skip ( len ) ; } return new DerInputStream ( newbuf ) ; }
Creates a new DER input stream from part of this input stream .
25,529
public int getInteger ( ) throws IOException { if ( buffer . read ( ) != DerValue . tag_Integer ) { throw new IOException ( "DER input, Integer tag error" ) ; } return buffer . getInteger ( getLength ( buffer ) ) ; }
Get an integer from the input stream as an integer .
25,530
public BigInteger getBigInteger ( ) throws IOException { if ( buffer . read ( ) != DerValue . tag_Integer ) { throw new IOException ( "DER input, Integer tag error" ) ; } return buffer . getBigInteger ( getLength ( buffer ) , false ) ; }
Get a integer from the input stream as a BigInteger object .
25,531
public int getEnumerated ( ) throws IOException { if ( buffer . read ( ) != DerValue . tag_Enumerated ) { throw new IOException ( "DER input, Enumerated tag error" ) ; } return buffer . getInteger ( getLength ( buffer ) ) ; }
Get an enumerated from the input stream .
25,532
public BitArray getUnalignedBitString ( ) throws IOException { if ( buffer . read ( ) != DerValue . tag_BitString ) throw new IOException ( "DER input not a bit string" ) ; int length = getLength ( buffer ) - 1 ; int validBits = length * 8 - buffer . read ( ) ; byte [ ] repn = new byte [ length ] ; if ( ( length != 0 ) && ( buffer . read ( repn ) != length ) ) throw new IOException ( "short read of DER bit string" ) ; return new BitArray ( validBits , repn ) ; }
Get a bit string from the input stream . The bit string need not be byte - aligned .
25,533
public byte [ ] getOctetString ( ) throws IOException { if ( buffer . read ( ) != DerValue . tag_OctetString ) throw new IOException ( "DER input not an octet string" ) ; int length = getLength ( buffer ) ; byte [ ] retval = new byte [ length ] ; if ( ( length != 0 ) && ( buffer . read ( retval ) != length ) ) throw new IOException ( "short read of DER octet string" ) ; return retval ; }
Returns an ASN . 1 OCTET STRING from the input stream .
25,534
public void getBytes ( byte [ ] val ) throws IOException { if ( ( val . length != 0 ) && ( buffer . read ( val ) != val . length ) ) { throw new IOException ( "short read of DER octet string" ) ; } }
Returns the asked number of bytes from the input stream .
25,535
public DerValue [ ] getSequence ( int startLen , boolean originalEncodedFormRetained ) throws IOException { tag = ( byte ) buffer . read ( ) ; if ( tag != DerValue . tag_Sequence ) throw new IOException ( "Sequence tag error" ) ; return readVector ( startLen , originalEncodedFormRetained ) ; }
Return a sequence of encoded entities . ASN . 1 sequences are ordered and they are often used like a struct in C or C ++ to group data values . They may have optional or context specific values .
25,536
private String readString ( byte stringTag , String stringName , String enc ) throws IOException { if ( buffer . read ( ) != stringTag ) throw new IOException ( "DER input not a " + stringName + " string" ) ; int length = getLength ( buffer ) ; byte [ ] retval = new byte [ length ] ; if ( ( length != 0 ) && ( buffer . read ( retval ) != length ) ) throw new IOException ( "short read of DER " + stringName + " string" ) ; return new String ( retval , enc ) ; }
Private helper routine to read an encoded string from the input stream .
25,537
public Date getUTCTime ( ) throws IOException { if ( buffer . read ( ) != DerValue . tag_UtcTime ) throw new IOException ( "DER input, UTCtime tag invalid " ) ; return buffer . getUTCTime ( getLength ( buffer ) ) ; }
Get a UTC encoded time value from the input stream .
25,538
public Date getGeneralizedTime ( ) throws IOException { if ( buffer . read ( ) != DerValue . tag_GeneralizedTime ) throw new IOException ( "DER input, GeneralizedTime tag invalid " ) ; return buffer . getGeneralizedTime ( getLength ( buffer ) ) ; }
Get a Generalized encoded time value from the input stream .
25,539
public static int getReorderCode ( String word ) { for ( int i = 0 ; i < gSpecialReorderCodes . length ; ++ i ) { if ( word . equalsIgnoreCase ( gSpecialReorderCodes [ i ] ) ) { return Collator . ReorderCodes . FIRST + i ; } } try { int script = UCharacter . getPropertyValueEnum ( UProperty . SCRIPT , word ) ; if ( script >= 0 ) { return script ; } } catch ( IllegalIcuArgumentException e ) { } if ( word . equalsIgnoreCase ( "others" ) ) { return Collator . ReorderCodes . OTHERS ; } return - 1 ; }
Gets a script or reorder code from its string representation .
25,540
static Javadoc convertJavadoc ( TreePath path , String source , JavacEnvironment env , boolean reportWarnings ) { DocTrees docTrees = DocTrees . instance ( env . task ( ) ) ; DocCommentTree docComment = docTrees . getDocCommentTree ( path ) ; if ( docComment == null ) { return null ; } JavadocConverter converter = new JavadocConverter ( env . treeUtilities ( ) . getElement ( path ) , docComment , source , docTrees , path . getCompilationUnit ( ) , reportWarnings ) ; Javadoc result = new Javadoc ( ) ; TagElement newTag = new TagElement ( ) . setTagKind ( TagElement . TagKind . DESCRIPTION ) ; converter . scan ( docComment . getFirstSentence ( ) , newTag ) ; converter . scan ( docComment . getBody ( ) , newTag ) ; if ( ! newTag . getFragments ( ) . isEmpty ( ) ) { List < TreeNode > fragments = newTag . getFragments ( ) ; int start = fragments . get ( 0 ) . getStartPosition ( ) ; TreeNode lastFragment = fragments . get ( fragments . size ( ) - 1 ) ; int end = start + lastFragment . getLength ( ) ; converter . setPos ( newTag , start , end ) ; result . addTag ( newTag ) ; } for ( DocTree tag : docComment . getBlockTags ( ) ) { if ( tag . getKind ( ) != DocTree . Kind . ERRONEOUS ) { newTag = new TagElement ( ) ; converter . scan ( tag , newTag ) ; result . addTag ( newTag ) ; } } return result ; }
Returns an AST node for the javadoc comment of a specified class method or field element .
25,541
private TagElement setTagValues ( TagElement tag , TagKind tagKind , DocTree javadocNode , DocTree body ) { tag . setTagKind ( tagKind ) ; setPos ( javadocNode , tag ) ; scan ( body , tag ) ; return tag ; }
Updates a tag element with values from the javadoc node .
25,542
private TreeNode setPos ( DocTree node , TreeNode newNode ) { int pos = pos ( node ) ; return newNode . setPosition ( new SourcePosition ( pos , length ( node ) , lineNumber ( pos ) ) ) ; }
Set a TreeNode s position using the original DocTree .
25,543
private TreeNode setPos ( TreeNode newNode , int pos , int endPos ) { return newNode . setPosition ( new SourcePosition ( pos , endPos - pos , lineNumber ( pos ) ) ) ; }
Set a TreeNode s position using begin and end source offsets . Its line number is unchanged .
25,544
public final int transliterate ( Replaceable text , int start , int limit ) { if ( start < 0 || limit < start || text . length ( ) < limit ) { return - 1 ; } Position pos = new Position ( start , limit , start ) ; filteredTransliterate ( text , pos , false , true ) ; return pos . limit ; }
Transliterates a segment of a string with optional filtering .
25,545
public final String transliterate ( String text ) { ReplaceableString result = new ReplaceableString ( text ) ; transliterate ( result ) ; return result . toString ( ) ; }
Transliterate an entire string and returns the result . Convenience method .
25,546
public void filteredTransliterate ( Replaceable text , Position index , boolean incremental ) { filteredTransliterate ( text , index , incremental , false ) ; }
Transliterate a substring of text as specified by index taking filters into account . This method is for subclasses that need to delegate to another transliterator such as CompoundTransliterator .
25,547
static Transliterator getBasicInstance ( String id , String canonID ) { StringBuffer s = new StringBuffer ( ) ; Transliterator t = registry . get ( id , s ) ; if ( s . length ( ) != 0 ) { t = getInstance ( s . toString ( ) , FORWARD ) ; } if ( t != null && canonID != null ) { t . setID ( canonID ) ; } return t ; }
Create a transliterator from a basic ID . This is an ID containing only the forward direction source target and variant .
25,548
public static void registerFactory ( String ID , Factory factory ) { registry . put ( ID , factory , true ) ; }
Register a factory object with the given ID . The factory method should return a new instance of the given transliterator .
25,549
static void registerInstance ( Transliterator trans , boolean visible ) { registry . put ( trans . getID ( ) , trans , visible ) ; }
Register a Transliterator object .
25,550
public static void registerAlias ( String aliasID , String realID ) { registry . put ( aliasID , realID , true ) ; }
Register an ID as an alias of another ID . Instantiating alias ID produces the same result as instantiating the original ID . This is generally used to create short aliases of compound IDs .
25,551
public static void unregister ( String ID ) { displayNameCache . remove ( new CaseInsensitiveString ( ID ) ) ; registry . remove ( ID ) ; }
Unregisters a transliterator or class . This may be either a system transliterator or a user transliterator or class .
25,552
public static final Enumeration < String > getAvailableVariants ( String source , String target ) { return registry . getAvailableVariants ( source , target ) ; }
Returns an enumeration over the variant names of registered transliterators having a given source name and target name .
25,553
public static DateTimePatternGenerator getFrozenInstance ( ULocale uLocale ) { String localeKey = uLocale . toString ( ) ; DateTimePatternGenerator result = DTPNG_CACHE . get ( localeKey ) ; if ( result != null ) { return result ; } result = new DateTimePatternGenerator ( ) ; result . initData ( uLocale ) ; result . freeze ( ) ; DTPNG_CACHE . put ( localeKey , result ) ; return result ; }
Construct a frozen instance of DateTimePatternGenerator for a given locale . This method returns a cached frozen instance of DateTimePatternGenerator so less expensive than the regular factory method .
25,554
public String getSkeletonAllowingDuplicates ( String pattern ) { synchronized ( this ) { current . set ( pattern , fp , true ) ; return current . toString ( ) ; } }
Same as getSkeleton but allows duplicates
25,555
public String getCanonicalSkeletonAllowingDuplicates ( String pattern ) { synchronized ( this ) { current . set ( pattern , fp , true ) ; return current . toCanonicalString ( ) ; } }
Same as getSkeleton but allows duplicates and returns a string using canonical pattern chars
25,556
public Collection < String > getRedundants ( Collection < String > output ) { synchronized ( this ) { if ( output == null ) { output = new LinkedHashSet < String > ( ) ; } for ( DateTimeMatcher cur : skeleton2pattern . keySet ( ) ) { PatternWithSkeletonFlag patternWithSkelFlag = skeleton2pattern . get ( cur ) ; String pattern = patternWithSkelFlag . pattern ; if ( CANONICAL_SET . contains ( pattern ) ) { continue ; } String trial = getBestPattern ( cur . toString ( ) , cur , MATCH_NO_OPTIONS ) ; if ( trial . equals ( pattern ) ) { output . add ( pattern ) ; } } return output ; } }
Redundant patterns are those which if removed make no difference in the resulting getBestPattern values . This method returns a list of them to help check the consistency of the patterns used to build this generator .
25,557
public static boolean isSingleField ( String skeleton ) { char first = skeleton . charAt ( 0 ) ; for ( int i = 1 ; i < skeleton . length ( ) ; ++ i ) { if ( skeleton . charAt ( i ) != first ) return false ; } return true ; }
Determines whether a skeleton contains a single field
25,558
private String getBestAppending ( DateTimeMatcher source , int missingFields , DistanceInfo distInfo , DateTimeMatcher skipMatcher , EnumSet < DTPGflags > flags , int options ) { String resultPattern = null ; if ( missingFields != 0 ) { PatternWithMatcher resultPatternWithMatcher = getBestRaw ( source , missingFields , distInfo , skipMatcher ) ; resultPattern = adjustFieldTypes ( resultPatternWithMatcher , source , flags , options ) ; while ( distInfo . missingFieldMask != 0 ) { if ( ( distInfo . missingFieldMask & SECOND_AND_FRACTIONAL_MASK ) == FRACTIONAL_MASK && ( missingFields & SECOND_AND_FRACTIONAL_MASK ) == SECOND_AND_FRACTIONAL_MASK ) { resultPatternWithMatcher . pattern = resultPattern ; flags = EnumSet . copyOf ( flags ) ; flags . add ( DTPGflags . FIX_FRACTIONAL_SECONDS ) ; resultPattern = adjustFieldTypes ( resultPatternWithMatcher , source , flags , options ) ; distInfo . missingFieldMask &= ~ FRACTIONAL_MASK ; continue ; } int startingMask = distInfo . missingFieldMask ; PatternWithMatcher tempWithMatcher = getBestRaw ( source , distInfo . missingFieldMask , distInfo , skipMatcher ) ; String temp = adjustFieldTypes ( tempWithMatcher , source , flags , options ) ; int foundMask = startingMask & ~ distInfo . missingFieldMask ; int topField = getTopBitNumber ( foundMask ) ; resultPattern = SimpleFormatterImpl . formatRawPattern ( getAppendFormat ( topField ) , 2 , 3 , resultPattern , temp , getAppendName ( topField ) ) ; } } return resultPattern ; }
We only get called here if we failed to find an exact skeleton . We have broken it into date + time and look for the pieces . If we fail to find a complete skeleton we compose in a loop until we have all the fields .
25,559
private static int getCanonicalIndex ( String s , boolean strict ) { int len = s . length ( ) ; if ( len == 0 ) { return - 1 ; } int ch = s . charAt ( 0 ) ; for ( int i = 1 ; i < len ; ++ i ) { if ( s . charAt ( i ) != ch ) { return - 1 ; } } int bestRow = - 1 ; for ( int i = 0 ; i < types . length ; ++ i ) { int [ ] row = types [ i ] ; if ( row [ 0 ] != ch ) continue ; bestRow = i ; if ( row [ 3 ] > len ) continue ; if ( row [ row . length - 1 ] < len ) continue ; return i ; } return strict ? - 1 : bestRow ; }
Get the canonical index or return - 1 if illegal .
25,560
private static JavaFileObject filterJavaFileObject ( JavaFileObject fobj ) { String path = fobj . getName ( ) ; if ( path . endsWith ( "module-info.java" ) ) { String pkgName = null ; try { pkgName = moduleName ( fobj . getCharContent ( true ) . toString ( ) ) ; String source = "package " + pkgName + ";" ; return new MemoryFileObject ( path , JavaFileObject . Kind . SOURCE , source ) ; } catch ( IOException e ) { } } return fobj ; }
To allow Java 9 libraries like GSON to be transpiled using - source 1 . 8 stub out the module - info source . This creates an empty . o file like package - info . java files without annotations . Skipping the file isn t feasible because of build tool output file expectations .
25,561
private JavacEnvironment createEnvironment ( String path , String source ) throws IOException { List < JavaFileObject > inputFiles = new ArrayList < > ( ) ; inputFiles . add ( filterJavaFileObject ( MemoryFileObject . createJavaFile ( path , source ) ) ) ; return createEnvironment ( Collections . emptyList ( ) , inputFiles , false ) ; }
Creates a javac environment from a memory source .
25,562
static String packageName ( String source ) { try ( StringReader r = new StringReader ( source ) ) { StreamTokenizer tokenizer = new StreamTokenizer ( r ) ; tokenizer . slashSlashComments ( true ) ; tokenizer . slashStarComments ( true ) ; StringBuilder sb = new StringBuilder ( ) ; boolean inName = false ; while ( tokenizer . nextToken ( ) != StreamTokenizer . TT_EOF ) { if ( inName ) { switch ( tokenizer . ttype ) { case ';' : return sb . length ( ) > 0 ? sb . toString ( ) : null ; case '.' : sb . append ( '.' ) ; break ; case StreamTokenizer . TT_WORD : sb . append ( tokenizer . sval ) ; break ; default : inName = false ; break ; } } else if ( tokenizer . ttype == StreamTokenizer . TT_WORD && tokenizer . sval . equals ( "package" ) ) { inName = true ; } } return null ; } catch ( IOException e ) { throw new AssertionError ( "Exception reading string: " + e ) ; } }
Extract the name of a Java source s package or null if not found . This method is only used before javac parsing to determine the main type name .
25,563
public void encode ( DerOutputStream out ) throws IOException { DerOutputStream tagged = new DerOutputStream ( ) ; if ( ( fullName != null ) || ( relativeName != null ) ) { DerOutputStream distributionPoint = new DerOutputStream ( ) ; if ( fullName != null ) { DerOutputStream derOut = new DerOutputStream ( ) ; fullName . encode ( derOut ) ; distributionPoint . writeImplicit ( DerValue . createTag ( DerValue . TAG_CONTEXT , true , TAG_FULL_NAME ) , derOut ) ; } else if ( relativeName != null ) { DerOutputStream derOut = new DerOutputStream ( ) ; relativeName . encode ( derOut ) ; distributionPoint . writeImplicit ( DerValue . createTag ( DerValue . TAG_CONTEXT , true , TAG_REL_NAME ) , derOut ) ; } tagged . write ( DerValue . createTag ( DerValue . TAG_CONTEXT , true , TAG_DIST_PT ) , distributionPoint ) ; } if ( reasonFlags != null ) { DerOutputStream reasons = new DerOutputStream ( ) ; BitArray rf = new BitArray ( reasonFlags ) ; reasons . putTruncatedUnalignedBitString ( rf ) ; tagged . writeImplicit ( DerValue . createTag ( DerValue . TAG_CONTEXT , false , TAG_REASONS ) , reasons ) ; } if ( crlIssuer != null ) { DerOutputStream issuer = new DerOutputStream ( ) ; crlIssuer . encode ( issuer ) ; tagged . writeImplicit ( DerValue . createTag ( DerValue . TAG_CONTEXT , true , TAG_ISSUER ) , issuer ) ; } out . write ( DerValue . tag_Sequence , tagged ) ; }
Write the DistributionPoint value to the DerOutputStream .
25,564
private static String reasonToString ( int reason ) { if ( ( reason > 0 ) && ( reason < REASON_STRINGS . length ) ) { return REASON_STRINGS [ reason ] ; } return "Unknown reason " + reason ; }
Return a string representation for reasonFlag bit reason .
25,565
public void compose ( StylesheetRoot sroot ) throws TransformerException { super . compose ( sroot ) ; String namespace = getName ( ) . getNamespace ( ) ; String handlerClass = sroot . getExtensionHandlerClass ( ) ; Object [ ] args = { namespace , sroot } ; ExtensionNamespaceSupport extNsSpt = new ExtensionNamespaceSupport ( namespace , handlerClass , args ) ; sroot . getExtensionNamespacesManager ( ) . registerExtension ( extNsSpt ) ; if ( ! ( namespace . equals ( Constants . S_EXSLT_FUNCTIONS_URL ) ) ) { namespace = Constants . S_EXSLT_FUNCTIONS_URL ; args = new Object [ ] { namespace , sroot } ; extNsSpt = new ExtensionNamespaceSupport ( namespace , handlerClass , args ) ; sroot . getExtensionNamespacesManager ( ) . registerExtension ( extNsSpt ) ; } }
Called after everything else has been recomposed and allows the function to set remaining values that may be based on some other property that depends on recomposition .
25,566
private static int getContextKey ( char c ) { if ( c < contexts [ ctCache ] ) { while ( ctCache > 0 && c < contexts [ ctCache ] ) -- ctCache ; } else if ( c >= contexts [ ctCache + 1 ] ) { while ( ctCache < ctCacheLimit && c >= contexts [ ctCache + 1 ] ) ++ ctCache ; } return ( ctCache & 0x1 ) == 0 ? ( ctCache / 2 ) : EUROPEAN_KEY ; }
warning synchronize access to this as it modifies state
25,567
public void shape ( char [ ] text , int start , int count ) { checkParams ( text , start , count ) ; if ( isContextual ( ) ) { if ( rangeSet == null ) { shapeContextually ( text , start , count , key ) ; } else { shapeContextually ( text , start , count , shapingRange ) ; } } else { shapeNonContextually ( text , start , count ) ; } }
Converts the digits in the text that occur between start and start + count .
25,568
public void shape ( char [ ] text , int start , int count , int context ) { checkParams ( text , start , count ) ; if ( isContextual ( ) ) { int ctxKey = getKeyFromMask ( context ) ; if ( rangeSet == null ) { shapeContextually ( text , start , count , ctxKey ) ; } else { shapeContextually ( text , start , count , Range . values ( ) [ ctxKey ] ) ; } } else { shapeNonContextually ( text , start , count ) ; } }
Converts the digits in the text that occur between start and start + count using the provided context . Context is ignored if the shaper is not a contextual shaper .
25,569
private void shapeNonContextually ( char [ ] text , int start , int count ) { int base ; char minDigit = '0' ; if ( shapingRange != null ) { base = shapingRange . getDigitBase ( ) ; minDigit += shapingRange . getNumericBase ( ) ; } else { base = bases [ key ] ; if ( key == ETHIOPIC_KEY ) { minDigit ++ ; } } for ( int i = start , e = start + count ; i < e ; ++ i ) { char c = text [ i ] ; if ( c >= minDigit && c <= '\u0039' ) { text [ i ] = ( char ) ( c + base ) ; } } }
Perform non - contextual shaping .
25,570
private synchronized void shapeContextually ( char [ ] text , int start , int count , int ctxKey ) { if ( ( mask & ( 1 << ctxKey ) ) == 0 ) { ctxKey = EUROPEAN_KEY ; } int lastkey = ctxKey ; int base = bases [ ctxKey ] ; char minDigit = ctxKey == ETHIOPIC_KEY ? '1' : '0' ; synchronized ( NumericShaper . class ) { for ( int i = start , e = start + count ; i < e ; ++ i ) { char c = text [ i ] ; if ( c >= minDigit && c <= '\u0039' ) { text [ i ] = ( char ) ( c + base ) ; } if ( isStrongDirectional ( c ) ) { int newkey = getContextKey ( c ) ; if ( newkey != lastkey ) { lastkey = newkey ; ctxKey = newkey ; if ( ( ( mask & EASTERN_ARABIC ) != 0 ) && ( ctxKey == ARABIC_KEY || ctxKey == EASTERN_ARABIC_KEY ) ) { ctxKey = EASTERN_ARABIC_KEY ; } else if ( ( ( mask & ARABIC ) != 0 ) && ( ctxKey == ARABIC_KEY || ctxKey == EASTERN_ARABIC_KEY ) ) { ctxKey = ARABIC_KEY ; } else if ( ( mask & ( 1 << ctxKey ) ) == 0 ) { ctxKey = EUROPEAN_KEY ; } base = bases [ ctxKey ] ; minDigit = ctxKey == ETHIOPIC_KEY ? '1' : '0' ; } } } } }
Perform contextual shaping . Synchronized to protect caches used in getContextKey .
25,571
private static int search ( int value , int [ ] array , int start , int length ) { int power = 1 << getHighBit ( length ) ; int extra = length - power ; int probe = power ; int index = start ; if ( value >= array [ index + extra ] ) { index += extra ; } while ( probe > 1 ) { probe >>= 1 ; if ( value >= array [ index + probe ] ) { index += probe ; } } return index ; }
fast binary search over subrange of array .
25,572
public UnicodeMatcher lookupMatcher ( int ch ) { UnicodeSet retVal = null ; if ( ch == 0xffff ) { retVal = fCachedSetLookup ; fCachedSetLookup = null ; } return retVal ; }
and we just need to remember what set to return between these two calls .
25,573
public static final CertificateFactory getInstance ( String type ) throws CertificateException { try { Instance instance = GetInstance . getInstance ( "CertificateFactory" , CertificateFactorySpi . class , type ) ; return new CertificateFactory ( ( CertificateFactorySpi ) instance . impl , instance . provider , type ) ; } catch ( NoSuchAlgorithmException e ) { throw new CertificateException ( type + " not found" , e ) ; } }
Returns a certificate factory object that implements the specified certificate type .
25,574
void add ( TimerTask task ) { if ( size + 1 == queue . length ) queue = Arrays . copyOf ( queue , 2 * queue . length ) ; queue [ ++ size ] = task ; fixUp ( size ) ; }
Adds a new task to the priority queue .
25,575
void quickRemove ( int i ) { assert i <= size ; queue [ i ] = queue [ size ] ; queue [ size -- ] = null ; }
Removes the ith element from queue without regard for maintaining the heap invariant . Recall that queue is one - based so 1 < = i < = size .
25,576
public void setID ( String ID ) { if ( ID == null ) { throw new NullPointerException ( ) ; } if ( isFrozen ( ) ) { throw new UnsupportedOperationException ( "Attempt to modify a frozen TimeZone instance." ) ; } this . ID = ID ; }
Sets the time zone ID . This does not change any other data in the time zone object .
25,577
public final String getDisplayName ( Locale locale ) { return _getDisplayName ( LONG_GENERIC , false , ULocale . forLocale ( locale ) ) ; }
Returns a name of this time zone suitable for presentation to the user in the specified locale . This method returns the long generic name . If the display name is not available for the locale a fallback based on the country city or time zone id will be used .
25,578
static BasicTimeZone getFrozenICUTimeZone ( String id , boolean trySystem ) { BasicTimeZone result = null ; if ( trySystem ) { result = ZoneMeta . getSystemTimeZone ( id ) ; } if ( result == null ) { result = ZoneMeta . getCustomTimeZone ( id ) ; } return result ; }
Returns a frozen ICU type TimeZone object given a time zone ID .
25,579
public boolean hasSameRules ( TimeZone other ) { return other != null && getRawOffset ( ) == other . getRawOffset ( ) && useDaylightTime ( ) == other . useDaylightTime ( ) ; }
Returns true if this zone has the same rule and offset as another zone . That is if this zone differs only in ID if at all . Returns false if the other zone is null .
25,580
void parseAuthorityKeyIdentifierExtension ( AuthorityKeyIdentifierExtension akidext ) throws IOException { if ( akidext != null ) { KeyIdentifier akid = ( KeyIdentifier ) akidext . get ( AuthorityKeyIdentifierExtension . KEY_ID ) ; if ( akid != null ) { if ( isSKIDSensitive || getSubjectKeyIdentifier ( ) == null ) { DerOutputStream derout = new DerOutputStream ( ) ; derout . putOctetString ( akid . getIdentifier ( ) ) ; super . setSubjectKeyIdentifier ( derout . toByteArray ( ) ) ; isSKIDSensitive = true ; } } SerialNumber asn = ( SerialNumber ) akidext . get ( AuthorityKeyIdentifierExtension . SERIAL_NUMBER ) ; if ( asn != null ) { if ( isSNSensitive || getSerialNumber ( ) == null ) { super . setSerialNumber ( asn . getNumber ( ) ) ; isSNSensitive = true ; } } } }
Parse the authority key identifier extension .
25,581
public String getHostName ( ) { if ( holder ( ) . getHostName ( ) == null ) { holder ( ) . hostName = InetAddress . getHostFromNameService ( this ) ; } return holder ( ) . getHostName ( ) ; }
Gets the host name for this IP address .
25,582
private static String getHostFromNameService ( InetAddress addr ) { String host = null ; try { host = nameService . getHostByAddr ( addr . getAddress ( ) ) ; InetAddress [ ] arr = nameService . lookupAllHostAddr ( host , NETID_UNSET ) ; boolean ok = false ; if ( arr != null ) { for ( int i = 0 ; ! ok && i < arr . length ; i ++ ) { ok = addr . equals ( arr [ i ] ) ; } } if ( ! ok ) { host = addr . getHostAddress ( ) ; return host ; } } catch ( UnknownHostException e ) { host = addr . getHostAddress ( ) ; } return host ; }
Returns the hostname for this address .
25,583
public static InetAddress getByAddress ( String host , byte [ ] addr , int scopeId ) throws UnknownHostException { if ( host != null && host . length ( ) > 0 && host . charAt ( 0 ) == '[' ) { if ( host . charAt ( host . length ( ) - 1 ) == ']' ) { host = host . substring ( 1 , host . length ( ) - 1 ) ; } } if ( addr != null ) { if ( addr . length == Inet4Address . INADDRSZ ) { return new Inet4Address ( host , addr ) ; } else if ( addr . length == Inet6Address . INADDRSZ ) { byte [ ] newAddr = IPAddressUtil . convertFromIPv4MappedAddress ( addr ) ; if ( newAddr != null ) { return new Inet4Address ( host , newAddr ) ; } else { return new Inet6Address ( host , addr , scopeId ) ; } } } throw new UnknownHostException ( "addr is of illegal length" ) ; }
Do not delete . Called from native code .
25,584
public static InetAddress [ ] getAllByName ( String host ) throws UnknownHostException { return impl . lookupAllHostAddr ( host , NETID_UNSET ) . clone ( ) ; }
Given the name of a host returns an array of its IP addresses based on the configured name service on the system .
25,585
public void write ( OutputStream out ) throws IOException { DataOutputStream dos = new DataOutputStream ( out ) ; attr . writeMain ( dos ) ; Iterator < Map . Entry < String , Attributes > > it = entries . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Map . Entry < String , Attributes > e = it . next ( ) ; StringBuffer buffer = new StringBuffer ( "Name: " ) ; String value = e . getKey ( ) ; if ( value != null ) { byte [ ] vb = value . getBytes ( "UTF8" ) ; value = new String ( vb , 0 , 0 , vb . length ) ; } buffer . append ( value ) ; buffer . append ( "\r\n" ) ; make72Safe ( buffer ) ; dos . writeBytes ( buffer . toString ( ) ) ; e . getValue ( ) . write ( dos ) ; } dos . flush ( ) ; }
Writes the Manifest to the specified OutputStream . Attributes . Name . MANIFEST_VERSION must be set in MainAttributes prior to invoking this method .
25,586
static void make72Safe ( StringBuffer line ) { int length = line . length ( ) ; if ( length > 72 ) { int index = 70 ; while ( index < length - 2 ) { line . insert ( index , "\r\n " ) ; index += 72 ; length += 3 ; } } return ; }
Adds line breaks to enforce a maximum 72 bytes per line .
25,587
public void read ( InputStream is ) throws IOException { FastInputStream fis = new FastInputStream ( is ) ; byte [ ] lbuf = new byte [ 512 ] ; attr . read ( fis , lbuf ) ; int ecount = 0 , acount = 0 ; int asize = 2 ; int len ; String name = null ; boolean skipEmptyLines = true ; byte [ ] lastline = null ; while ( ( len = fis . readLine ( lbuf ) ) != - 1 ) { if ( lbuf [ -- len ] != '\n' ) { throw new IOException ( "manifest line too long" ) ; } if ( len > 0 && lbuf [ len - 1 ] == '\r' ) { -- len ; } if ( len == 0 && skipEmptyLines ) { continue ; } skipEmptyLines = false ; if ( name == null ) { name = parseName ( lbuf , len ) ; if ( name == null ) { throw new IOException ( "invalid manifest format" ) ; } if ( fis . peek ( ) == ' ' ) { lastline = new byte [ len - 6 ] ; System . arraycopy ( lbuf , 6 , lastline , 0 , len - 6 ) ; continue ; } } else { byte [ ] buf = new byte [ lastline . length + len - 1 ] ; System . arraycopy ( lastline , 0 , buf , 0 , lastline . length ) ; System . arraycopy ( lbuf , 1 , buf , lastline . length , len - 1 ) ; if ( fis . peek ( ) == ' ' ) { lastline = buf ; continue ; } name = new String ( buf , 0 , buf . length , "UTF8" ) ; lastline = null ; } Attributes attr = getAttributes ( name ) ; if ( attr == null ) { attr = new Attributes ( asize ) ; entries . put ( name , attr ) ; } attr . read ( fis , lbuf ) ; ecount ++ ; acount += attr . size ( ) ; asize = Math . max ( 2 , acount / ecount ) ; name = null ; skipEmptyLines = true ; } }
Reads the Manifest from the specified InputStream . The entry names and attributes read will be merged in with the current manifest entries .
25,588
private boolean isValidKey ( Object key ) { if ( key == null ) return false ; Class < ? > keyClass = key . getClass ( ) ; return keyClass == keyType || keyClass . getSuperclass ( ) == keyType ; }
Returns true if key is of the proper type to be a key in this enum map .
25,589
private static < K extends Enum < K > > K [ ] getKeyUniverse ( Class < K > keyType ) { return JavaLangAccess . getEnumConstantsShared ( keyType ) ; }
Returns all of the values comprising K . The result is uncloned cached and shared by all callers .
25,590
public String getVariableShortName ( VariableElement var ) { String baseName = getVariableBaseName ( var ) ; if ( var . getKind ( ) . isField ( ) && ! ElementUtil . isGlobalVar ( var ) ) { return baseName + '_' ; } return baseName ; }
Gets the non - qualified variable name with underscore suffix .
25,591
public String getVariableQualifiedName ( VariableElement var ) { String shortName = getVariableShortName ( var ) ; if ( ElementUtil . isGlobalVar ( var ) ) { String className = getFullName ( ElementUtil . getDeclaringClass ( var ) ) ; if ( ElementUtil . isEnumConstant ( var ) ) { return "JreEnum(" + className + ", " + shortName + ")" ; } return className + '_' + shortName ; } return shortName ; }
Gets the name of the variable as it is declared in ObjC fully qualified .
25,592
public static String camelCaseQualifiedName ( String fqn ) { StringBuilder sb = new StringBuilder ( ) ; for ( String part : fqn . split ( "\\." ) ) { sb . append ( capitalize ( part ) ) ; } return sb . toString ( ) ; }
Given a period - separated name return as a camel - cased type name . For example java . util . logging . Level is returned as JavaUtilLoggingLevel .
25,593
public static String camelCasePath ( String fqn ) { StringBuilder sb = new StringBuilder ( ) ; for ( String part : fqn . split ( Pattern . quote ( File . separator ) ) ) { sb . append ( capitalize ( part ) ) ; } return sb . toString ( ) ; }
Given a path return as a camel - cased name . Used for example in header guards .
25,594
public String getFullFunctionName ( ExecutableElement method ) { return getFullName ( ElementUtil . getDeclaringClass ( method ) ) + '_' + getFunctionName ( method ) ; }
Returns a Type_method function name for static methods such as from enum types . A combination of classname plus modified selector is guaranteed to be unique within the app .
25,595
public String getFunctionName ( ExecutableElement method ) { String name = ElementUtil . getSelector ( method ) ; if ( name == null ) { name = getRenamedMethodName ( method ) ; } if ( name != null ) { return name . replaceAll ( ":" , "_" ) ; } else { return addParamNames ( method , getMethodName ( method ) , '_' ) ; } }
Returns an appropriate name to use for this method as a function . This name is guaranteed to be unique within the declaring class if no methods in the class have a renaming . The returned name should be given an appropriate prefix to avoid collisions with methods from other classes .
25,596
public static String getPrimitiveObjCType ( TypeMirror type ) { return TypeUtil . isVoid ( type ) ? "void" : type . getKind ( ) . isPrimitive ( ) ? "j" + TypeUtil . getName ( type ) : "id" ; }
Converts a Java type to an equivalent Objective - C type returning id for an object type .
25,597
public String getJniType ( TypeMirror type ) { if ( TypeUtil . isPrimitiveOrVoid ( type ) ) { return getPrimitiveObjCType ( type ) ; } else if ( TypeUtil . isArray ( type ) ) { return "jarray" ; } else if ( typeUtil . isString ( type ) ) { return "jstring" ; } else if ( typeUtil . isClassType ( type ) ) { return "jclass" ; } return "jobject" ; }
Convert a Java type into the equivalent JNI type .
25,598
public String getFullName ( TypeElement element ) { element = typeUtil . getObjcClass ( element ) ; String fullName = fullNameCache . get ( element ) ; if ( fullName == null ) { fullName = getFullNameImpl ( element ) ; fullNameCache . put ( element , fullName ) ; } return fullName ; }
Return the full name of a type including its package . For outer types is the type s full name ; for example java . lang . Object s full name is JavaLangObject . For inner classes the full name is their outer class name plus the inner class name ; for example java . util . ArrayList . ListItr s name is JavaUtilArrayList_ListItr .
25,599
private String getDefaultObjectiveCName ( TypeElement element ) { String binaryName = elementUtil . getBinaryName ( element ) ; return camelCaseQualifiedName ( binaryName ) . replace ( '$' , '_' ) ; }
Ignores the ObjectiveCName annotation .