1 22 23 package cypress; 24 25 28 29 public class CssCharUtils 30 { 31 32 35 protected final static int[] HEXADECIMAL = {0, 67043328, 126, 126}; 36 39 protected final static int[] IDENTIFIER_START = {0, 0, 134217726, 134217726}; 40 41 44 protected final static int[] NAME = {0, 67051520, 134217726, 134217726}; 45 46 49 protected final static int[] STRING = {512, -133, -1, 2147483647}; 50 51 54 protected final static int[] URI = {0, -902, -1, 2147483647}; 55 56 59 protected CssCharUtils() { } 60 61 64 public static boolean isHexadecimal( char c ) 65 { 66 return c < 128 && ( ( HEXADECIMAL[c / 32] & ( 1 << ( c % 32 ) ) ) != 0 ); 67 } 68 69 72 public static boolean isIdentifierStart( char c ) 73 { 74 return c >= 128 || ( ( IDENTIFIER_START[c / 32] & ( 1 << ( c % 32 ) ) ) != 0 ); 75 } 76 77 80 public static boolean isName( char c ) 81 { 82 return c >= 128 || ( ( NAME[c / 32] & ( 1 << ( c % 32 ) ) ) != 0 ); 83 } 84 85 88 public static boolean isSpace( char c ) 89 { 90 return ( c <= 0x0020 ) && 91 ( ( ( ( ( 1L << '\t' ) | 92 ( 1L << '\n' ) | 93 ( 1L << '\r' ) | 94 ( 1L << '\f' ) | 95 ( 1L << 0x0020 ) ) >> c ) & 1L ) != 0 ); 96 } 97 98 101 public static boolean isString( char c ) 102 { 103 return c >= 128 || ( ( STRING[c / 32] & ( 1 << ( c % 32 ) ) ) != 0 ); 104 } 105 106 109 public static boolean isUri( char c ) 110 { 111 return c >= 128 || ( ( URI[c / 32] & ( 1 << ( c % 32 ) ) ) != 0 ); 112 } 113 } 114 | Popular Tags |