test_class.declarator: logger = LoggerFactory.getLogger(TMobileNlGSMCharsetTest.class)
test_class.modifier: private static final
test_class.original_string: private static final Logger logger = LoggerFactory.getLogger(TMobileNlGSMCharsetTest.class);
test_class.type: Logger
test_class.var_name: logger
test_class.file: ch-commons-charset/src/test/java/com/cloudhopper/commons/charset/TMobileNlGSMCharsetTest.java
test_class.identifier: TMobileNlGSMCharsetTest
test_case.body: @Test
      public void canRepresent() throws Exception {
          // nulls are always ok
          Assert.assertEquals(true, TMobileNlGSMCharset.canRepresent(null));
          Assert.assertEquals(true, TMobileNlGSMCharset.canRepresent(" "));
          Assert.assertEquals(true, TMobileNlGSMCharset.canRepresent("\n\r"));
          Assert.assertEquals(true, TMobileNlGSMCharset.canRepresent("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"));
          Assert.assertEquals(true, TMobileNlGSMCharset.canRepresent("Hello @ World"));
          Assert.assertEquals(true, TMobileNlGSMCharset.canRepresent("$_"));
          // euro currency symbol is good
          Assert.assertEquals(true, TMobileNlGSMCharset.canRepresent("\u20ac"));
          // arabic char is not valid TMobileNlGSM char
          Assert.assertEquals(false, TMobileNlGSMCharset.canRepresent("\u0623"));
          // '`' char is NOT in the TMobileNlGSM charset
          Assert.assertEquals(false, TMobileNlGSMCharset.canRepresent("`"));
          // []{}^~|\ GSM extended table chars are not supported by T-Mo NL
          Assert.assertEquals(false, TMobileNlGSMCharset.canRepresent("{}[\\]^~|"));
          
          // create a fully correct string from lookup table
          // strings to decode/encode to/from UTF-8
          // build a string of every GSM base-table char
          StringBuilder s = new StringBuilder();
          for (int i = 0; i < GSMCharset.CHAR_TABLE.length; i++) {
              char c = GSMCharset.CHAR_TABLE[i];
              if (c > 0) {
                  s.append(c);
              }
          }
          s.append("\u20ac");  // and the euro-mark
          
          Assert.assertEquals(true, TMobileNlGSMCharset.canRepresent(s.toString()));
      }
test_case.class_method_signature: TMobileNlGSMCharsetTest.canRepresent()
test_case.full_signature: @Test public void canRepresent()
test_case.identifier: canRepresent
test_case.invocations: assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent append append assertEquals canRepresent toString
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void canRepresent()
focal_class.declarator: TMO_EURO_BYTE = 0x80
focal_class.modifier: static final
focal_class.original_string: static final int TMO_EURO_BYTE = 0x80;
focal_class.type: int
focal_class.var_name: TMO_EURO_BYTE
focal_class.declarator: EURO_MARK = '\u20AC'
focal_class.modifier: static final
focal_class.original_string: static final char EURO_MARK = '\u20AC';
focal_class.type: char
focal_class.var_name: EURO_MARK
focal_class.file: ch-commons-charset/src/main/java/com/cloudhopper/commons/charset/TMobileNlGSMCharset.java
focal_class.identifier: TMobileNlGSMCharset
focal_class.class_method_signature: TMobileNlGSMCharset.canRepresent(CharSequence str0)
focal_class.full_signature: static public boolean canRepresent(CharSequence str0)
focal_class.identifier: canRepresent
focal_class.modifiers: static public
focal_class.parameters: (CharSequence str0)
focal_class.return: boolean
focal_class.signature: boolean canRepresent(CharSequence str0)
focal_class.class_method_signature: TMobileNlGSMCharset.encode(CharSequence str0)
focal_class.full_signature: @Override public byte[] encode(CharSequence str0)
focal_class.identifier: encode
focal_class.modifiers: @Override public
focal_class.parameters: (CharSequence str0)
focal_class.return: byte[]
focal_class.signature: byte[] encode(CharSequence str0)
focal_class.class_method_signature: TMobileNlGSMCharset.decode(byte[] bytes, StringBuilder buffer)
focal_class.full_signature: @Override public void decode(byte[] bytes, StringBuilder buffer)
focal_class.identifier: decode
focal_class.modifiers: @Override public
focal_class.parameters: (byte[] bytes, StringBuilder buffer)
focal_class.return: void
focal_class.signature: void decode(byte[] bytes, StringBuilder buffer)
focal_class.superclass: extends GSMCharset
focal_method.body: static public boolean canRepresent(CharSequence str0) {
          if (str0 == null) {
              return true;
          }
  
          int len = str0.length();
          for (int i = 0; i < len; i++) {
              // get the char in this string
              char c = str0.charAt(i);
              // simple range checks for most common characters (0x20 -> 0x5A) or (0x61 -> 0x7A)
              if ((c >= ' ' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
                  continue;
              } else {
                  // 10X more efficient using a switch statement vs. a lookup table search
                  switch (c) {
                      case '_':	
                      case '\u00A3':	// £
                      case '\u00A5':	// ¥
                      case '\u00E8':	// è
                      case '\u00E9':	// é
                      case '\u00F9':	// ù
                      case '\u00EC':	// ì
                      case '\u00F2':	// ò
                      case '\u00C7':	// Ç
                      case '\n':          // newline
                      case '\u00D8':	// Ø
                      case '\u00F8':	// ø
                      case '\r':          // carriage return
                      case '\u00C5':	// Å
                      case '\u00E5':	// å
                      case '\u0394':	// Δ
                      case '\u03A6':	// Φ
                      case '\u0393':	// Γ
                      case '\u039B':	// Λ
                      case '\u03A9':	// Ω
                      case '\u03A0':	// Π
                      case '\u03A8':	// Ψ
                      case '\u03A3':	// Σ
                      case '\u0398':	// Θ
                      case '\u039E':	// Ξ
                      case '\u00C6':	// Æ
                      case '\u00E6':	// æ
                      case '\u00DF':	// ß
                      case '\u00C9':	// É
                      case '\u00A4':	// ¤
                      case '\u00A1':	// ¡
                      case '\u00C4':	// Ä
                      case '\u00D6':	// Ö
                      case '\u00D1':	// Ñ
                      case '\u00DC':	// Ü
                      case '\u00A7':	// §
                      case '\u00BF':	// ¿
                      case '\u00E4':	// ä
                      case '\u00F6':	// ö
                      case '\u00F1':	// ñ
                      case '\u00FC':	// ü
                      case '\u00E0':	// à
                      case '\u20AC':	// €
                          continue;
                      default:
                          return false;
                  }
              }
          }
          return true;
      }
focal_method.class_method_signature: TMobileNlGSMCharset.canRepresent(CharSequence str0)
focal_method.full_signature: static public boolean canRepresent(CharSequence str0)
focal_method.identifier: canRepresent
focal_method.invocations: length charAt
focal_method.modifiers: static public
focal_method.parameters: (CharSequence str0)
focal_method.return: boolean
focal_method.signature: boolean canRepresent(CharSequence str0)