Appendix B. Useful Tables

 

How many seconds are there in a year? If I tell you there are 3.155×107 you won't even try to remember it. On the other hand, who could forget that, to within half a percent, π seconds is a nanocentury?

 
 --Tom Duff, Bell Labs

Table 1. Keywords

NOTE: Keywords marked with † are unused

abstract

continue

for

new

switch

assert

default

goto

package

synchronized

boolean

do

if

private

this

break

double

implements

protected

throw

byte

else

import

public

throws

case

enum

instanceof

return

transient

catch

extends

int

short

try

char

final

interface

static

void

class

finally

long

strictfp

volatile

const

float

native

super

while

Table 2. Operator Precedence

Operator Type

Operator

Postfix operators

[] . (params) expr++ expr--

Unary operators

++expr --expr +expr -expr ~ !

Creation or cast

new (type)expr

Multiplicative

* / %

Additive

+ -

Shift

<< >> >>>

Relational

< > >= <= instanceof

Equality

== !=

AND

&

Exclusive OR

^

Inclusive OR

|

Conditional AND

&&

Conditional OR

||

Conditional

?:

Assignment

= += -= *= /= %= >>= <<= >>>= &= ^= |=

Table 3. Special Characters Using

Sequence

Meaning

Newline (u000A)

Tab (u0009)



Backspace (u0008)

Return (u000D)

f

Form feed (u000C)

\

Backslash itself (u005C)

'

Single quote (u0027)

"

Double quote (u0022)

ddd

An octal char, with each d being an octal digit (07)

uxxxx

A Unicode char, with each x being a hex digit (09, af, AF)

Table 4. Regular Expression Special Characters

Construct

Matches

CHARACTERS

x

The character x

\

backslash

n

character with octal value 0n

nn

character with octal value 0nn

nnn

character with octal value 0nnn (nnn ≤ 377)

xhh

character with hexadecimal 0xhh

uhhhh

character with hexadecimal value 0xhhhh

tab character ('u0009')

newline character ('u000A')

carriage-return character ('u000D')

f

form-feed character ('u000C')

a

alert (bell) character ('u0007')

e

escape character ('u001B')

cx

control character corresponding to x

CHARACTER CLASSES

[abc]

a, b, or c (simple class)

[^abc]

any character except a, b, or c (negation)

[a-zA-Z]

a through z or A through Z, inclusive (range)

[a-d[m-p]]

a through d or m through p; [a-dm-p] (union)

[a-z&[def]]

d, e, or f; [def] (intersection)

[a-z&[^bc]]

a through z, except b or c; [ad-z] (subtraction)

[a-z&[^m-p]]

a through z, except m through p; [a-lq-z]

PREDEFINED CHARACTER CLASSES

.

any character (might match line terminators)

d

digit; [0-9]

D

non-digit; [^0-9]

s

whitespace character; [ x0Bf ]

S

non-whitespace character; [^s]

w

word character; [a-zA-Z_0-9]

W

non-word character; [^w]

JAVA CHARACTER CLASSES

p{javaLowerCase}

as defined by Character.isLowerCase

p{javaUpperCase}

as defined by Character.isUpperCase

p{javaWhitespace}

as defined by Character.isWhitespace

p{javaMirrored}

as defined by Character.isMirrored

POSIX CHARACTER CLASSES (US-ASCII ONLY)

p{Lower}

lowercase alphabetic character; [a-z]

p{Upper}

uppercase alphabetic character; [A-Z]

p{ASCII}

ASCII character; [x00-x7F]

p{Alpha}

alphabetic character; [p{Lower}p{Upper}]

p{Digit}

decimal digit; [0-9]

p{Alnum}

alphanumeric character; [p{Alpha}p{Digit}]

p{Punct}

punctuation; one of !"#$%&'()*+,-./:;<=>?@[]^_'{|}~

p{Graph}

visible character; [p{Alnum}p{Punct}]

p{Print}

printable character; [p{Graph}]

p{Blank}

space or a tab; [ ]

p{Cntrl}

control character; [x00-x1Fx7F]

p{XDigit}

hexadecimal digit; [0-9a-fA-F]

p{Space}

whitespace character; [ x0Bf ]

CLASSES FOR UNICODE BLOCKS AND CATEGORIES

p{InGreek}

character in the Greek block (simple block)

p{Lu}

uppercase letter (simple category)

p{Sc}

currency symbol ($, ¥, £, etc.)

P{InGreek}

character except one in the Greek block (negation)

[p{L}&[^p{Lu}]]

any letter except an uppercase letter (subtraction)

BOUNDARY MATCHERS

^

beginning of a line (if in multiline mode)

$

end of a line (if in multiline mode)



word boundary

B

non-word boundary

A

beginning of input

G

end of previous match



end of input except any final terminator

z

end of input

GREEDY QUANTIFIERS

X?

X once or not at all

X*

X zero or more times

X+

X one or more times

X{n}

X exactly n times

X(n,}

X at least n times

X{n,m}

X at least n but not more than m times

RELUCTANT QUANTIFIERS

X??

X once or not at all

X*?

X zero or more times

X+?

X one or more times

X{n}?

X exactly n times

X(n,}?

X at least n times

X{n,m}?

X at least n but not more than m time

POSSESSIVE QUANTIFIERS

X?+

X once or not at all

X*+

X zero or more times

X++

X one or more times

X{n}+

X exactly n times

X(n,}+

X at least n times

X{n,m}+

X at least n but not more than m times

LOGICAL OPERATORS

XY

X followed by Y

X|Y

either X or Y

(X)

X as a capturing group

BACK REFERENCES

n

what the nth capturing group matched

QUOTATION

nothing, but quotes the following character

Q

nothing, but quotes all characters until E

E

nothing, but ends quoting started by Q

SPECIAL CONSTRUCTS (NON-CAPTURING)

(?:X)

X as a non-capturing group

(?idmsux-idmsux)

nothing, but turns match flags on/off

(?idmsux-idmsux:X)

X as a non-capturing group with the given flags on/off

(?=X)

X via zero-width positive lookahead

(?!X)

X via zero-width negative lookahead

(?<;=X)

X via zero-width positive lookbehind

(?<;!X)

X via zero-width negative lookbehind

(?>;X)

X as an independent, non-capturing group

Table 5. Documentation Comment Tags

Tag

Description

@see

Cross reference to another doc comment or URL

{@link}

In-line cross reference to another doc comment or URL

{@linkPlain}

Similar to {@link} but uses regular font not code font

@param p

Description of the single parameter p

@return

Description of the return value of a method

@throws E

Description of an exception E that the method may throw

@exception E

Older form of @throws E

@deprecated

Deprecate, describing any replacement; the compiler generates warnings on use of deprecated entities

@author

An author of the code

@version

A version string for the entity

@since

The version string for when this entity first appeared

{@literal text}

Includes the given text as-is without treating it as HTML

{@code text}

Similar to {@literal} but uses code font

{@value field}

The value of the named static constant field

@serial

Identifies a field serialized using default serialization

@serialField

A field created by GetField or PutField objects

@serialData

Documents additional data written during serialization

{@inheritDoc}

Copies document comments from the supertype

{@docRoot}

Expands to a relative path to the root of the documentation tree; for use within links

Table 6. Required Character Sets

Charset

Description

US-ASCII

7-bit ASCII, also known as ISO-646-US and as the Basic Latin block of the Unicode character set

ISO-8859-1

ISO Latin Alphabet No. 1, also known as ISO-LATIN-1

UTF-8

8-bit Unicode Transformation Format

UTF-16BE

16-bit Unicode Transformation Format, big-endian order

UTF-16LE

16-bit Unicode Transformation Format, little-endian order

UTF-16

16-bit Unicode Transformation Format, byte order specified by a mandatory initial byte-order mark (either order accepted on input, big-endian used on output)

 

Comparing information and knowledge is like asking whether the fatness of a pig is more or less green than the designated hitter rule.

 
 --David Guaspari
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.212.102