Example #1
1
 public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr)
     throws BadLocationException {
   StringBuilder builder = new StringBuilder(string);
   for (int i = builder.length() - 1; i >= 0; i--) {
     int cp = builder.codePointAt(i);
     if (!Character.isDigit(cp) && cp != '-') {
       builder.deleteCharAt(i);
       if (Character.isSupplementaryCodePoint(cp)) {
         i--;
         builder.deleteCharAt(i);
       }
     }
   }
   super.insertString(fb, offset, builder.toString(), attr);
 }
Example #2
1
File: Macro.java Project: bramk/bnd
  int process(CharSequence org, int index, char begin, char end, StringBuilder result, Link link) {
    StringBuilder line = new StringBuilder(org);
    int nesting = 1;

    StringBuilder variable = new StringBuilder();
    outer:
    while (index < line.length()) {
      char c1 = line.charAt(index++);
      if (c1 == end) {
        if (--nesting == 0) {
          result.append(replace(variable.toString(), link));
          return index;
        }
      } else if (c1 == begin) nesting++;
      else if (c1 == '\\' && index < line.length() - 1 && line.charAt(index) == '$') {
        // remove the escape backslash and interpret the dollar
        // as a
        // literal
        index++;
        variable.append('$');
        continue outer;
      } else if (c1 == '$' && index < line.length() - 2) {
        char c2 = line.charAt(index);
        char terminator = getTerminator(c2);
        if (terminator != 0) {
          index = process(line, index + 1, c2, terminator, variable, link);
          continue outer;
        }
      } else if (c1 == '.' && index < line.length() && line.charAt(index) == '/') {
        // Found the sequence ./
        if (index == 1 || Character.isWhitespace(line.charAt(index - 2))) {
          // make sure it is preceded by whitespace or starts at begin
          index++;
          variable.append(domain.getBase().getAbsolutePath());
          variable.append('/');
          continue outer;
        }
      }
      variable.append(c1);
    }
    result.append(variable);
    return index;
  }
Example #3
0
  public static void main(String[] args) throws Exception {
    int size = Util.getPropertyInt("size", 100);
    double min = Util.getPropertyDouble("min", 0.01);
    double max = Util.getPropertyDouble("max", 0.9);
    Font font = new Font("serif", Font.PLAIN, size);
    String fpath = Util.getProperty("font", null);
    if (fpath != null) {
      font = Font.createFont(Font.TRUETYPE_FONT, new FileInputStream(fpath));
    }

    for (char c = Character.MIN_VALUE + 1; c < Character.MAX_VALUE; ++c) {
      int type = Character.getType(c);
      if (type != Character.CONTROL
          && type != Character.FORMAT
          && type != Character.PRIVATE_USE
          && type != Character.SURROGATE
          && type != Character.UNASSIGNED
          && !Character.isMirrored(c)
          && !Character.isSpaceChar(c)) {
        String s = "" + c;
        if (Normalizer.normalize(s, NFKC).contains("\u0308")) continue; // TODO: adhoc
        UnigramMetrics m = new UnigramMetrics(s, size, false, true, font);
        if (min < m.getBlackness() && m.getBlackness() < max) {
          System.out.println("" + c + " " + (int) c);
        }
      }
    }
  }
Example #4
0
 /**
  * Converts a string to a UTF8 byte array.
  *
  * @param string string to be converted
  * @return byte array
  */
 private static byte[] utf8(final String string) {
   final char[] arr = string.toCharArray();
   final int al = arr.length;
   final TokenBuilder tb = new TokenBuilder(al << 1);
   for (int c = 0; c < al; ++c) {
     final char ch = arr[c];
     tb.add(
         Character.isHighSurrogate(ch) && c < al - 1 && Character.isLowSurrogate(arr[c + 1])
             ? Character.toCodePoint(ch, arr[++c])
             : ch);
   }
   return tb.finish();
 }
Example #5
0
    @Override
    public void insertString(final int offs, final String str, final AttributeSet a)
        throws BadLocationException {
      // NavigatorLogger.printMessage("Offset:"+offs+" STr:"+str+"L:"+getLength()+"attr:"+a);

      if ((getLength() + str.length()) <= maxLength) {
        final char[] source = str.toCharArray();
        final char[] result = new char[source.length];
        int j = 0;

        for (int i = 0; i < result.length; i++) {
          if (Character.isDigit(source[i])) {
            result[j++] = source[i];
          } else {
            toolkit.beep();
            if (log.isDebugEnabled()) {
              log.debug("insertString: " + source[i]); // NOI18N
            }
          }
        }
        super.insertString(offs, new String(result, 0, j), a);
        checked = false;
      } else {
        toolkit.beep();
      }
      if ((getLength()) == maxLength) { // getLength() ist schon aktualisiert
        if (bringFocus2Next == true) {
          checked = true;
          nextField.requestFocus();
        }
        // NavigatorLogger.printMessage("Sprung");
        // NavigatorLogger.printMessage(nextField);
      }
    }
Example #6
0
  private long parsePosition(Tokenizer st, String type) throws IOException {
    boolean isLatitude = type.equals("latitude");
    int deg = 0, min = 0;
    double sec = 0;
    long value;
    String s;

    deg = st.getUInt16();
    if (deg > 180 || (deg > 90 && isLatitude))
      throw st.exception("Invalid LOC " + type + " degrees");

    s = st.getString();
    try {
      min = Integer.parseInt(s);
      if (min < 0 || min > 59) throw st.exception("Invalid LOC " + type + " minutes");
      s = st.getString();
      sec = parseFixedPoint(s);
      if (sec < 0 || sec >= 60) throw st.exception("Invalid LOC " + type + " seconds");
      s = st.getString();
    } catch (NumberFormatException e) {
    }

    if (s.length() != 1) throw st.exception("Invalid LOC " + type);

    value = (long) (1000 * (sec + 60L * (min + 60L * deg)));

    char c = Character.toUpperCase(s.charAt(0));
    if ((isLatitude && c == 'S') || (!isLatitude && c == 'W')) value = -value;
    else if ((isLatitude && c != 'N') || (!isLatitude && c != 'E'))
      throw st.exception("Invalid LOC " + type);

    value += (1L << 31);

    return value;
  }
Example #7
0
  /**
   * This is the write() method of the stream. All Writer subclasses implement this. All other
   * versions of write() are variants of this one
   */
  public void write(char[] buffer, int index, int len) {
    synchronized (this.lock) {
      // Loop through all the characters passed to us
      for (int i = index; i < index + len; i++) {
        // If we haven't begun a page (or a new page), do that now.
        if (page == null) newpage();

        // If the character is a line terminator, then begin new line,
        // unless it is a \n immediately after a \r.
        if (buffer[i] == '\n') {
          if (!last_char_was_return) newline();
          continue;
        }
        if (buffer[i] == '\r') {
          newline();
          last_char_was_return = true;
          continue;
        } else last_char_was_return = false;

        // If it some other non-printing character, ignore it.
        if (Character.isWhitespace(buffer[i])
            && !Character.isSpaceChar(buffer[i])
            && (buffer[i] != '\t')) continue;

        // If no more characters will fit on the line, start a new line.
        if (charnum >= chars_per_line) {
          newline();
          if (page == null) newpage(); // and start a new page, if necessary
        }

        // Now print the character:
        // If it is a space, skip one space, without output.
        // If it is a tab, skip the necessary number of spaces.
        // Otherwise, print the character.
        // It is inefficient to draw only one character at a time, but
        // because our FontMetrics don't match up exactly to what the
        // printer uses we need to position each character individually.
        if (Character.isSpaceChar(buffer[i])) charnum++;
        else if (buffer[i] == '\t') charnum += 8 - (charnum % 8);
        else {
          page.drawChars(
              buffer, i, 1, x0 + charnum * charwidth, y0 + (linenum * lineheight) + lineascent);
          charnum++;
        }
      }
    }
  }
 /** This helper method will return the end of the next word in the buffer. */
 private static int getNextWordEnd(Segment text, int startPos) {
   for (char ch = text.setIndex(startPos); ch != Segment.DONE; ch = text.next()) {
     if (!Character.isLetterOrDigit(ch)) {
       return text.getIndex();
     }
   }
   return text.getEndIndex();
 }
Example #9
0
    public void checkLineOfAction(
        ArrayList<Cam> cameras, ArrayList<Character> characters, int selectedIdx) {
      if (cameras == null || cameras.isEmpty()) {
        println("No cameras in the scene!");
      }

      if (characters.size() != 2) {
        println("Only two characters supported for now");
        // TODO (sanjeet): Hack! Fix this once more characters are allowed
      }

      Cam selectedCamera = cameras.get(selectedIdx);

      // TODO The characters.get results in a runtime error because there aren't currently any
      // characters allocated in the input file.
      Character ch1 = characters.get(0);
      Character ch2 = characters.get(1);

      // Obtaining (x,y,z) for characters and selected camera
      PVector ch1Location = ch1.getTranslation();
      PVector ch2Location = ch2.getTranslation();

      line(
          ch1Location.x, ch1Location.y, ch1Location.z, ch2Location.x, ch2Location.y, ch2Location.z);

      PVector selectedCameraLocation = selectedCamera.getTranslation();

      // Iterate through other cameras in the scene and check for line of action rule
      for (int i = 0; i < cameras.size(); i++) {
        if (i == selectedIdx) {
          continue;
        }
        PVector currCamLocation = cameras.get(i).getTranslation();
        if (!isInSameHalfPlane(selectedCameraLocation, currCamLocation, ch1Location, ch2Location)) {
          // If the Selected Camera and current camera are not in the same half plane its a
          // violation
          cameras.get(i).setColor(255, 0, 0);
        } else {
          cameras.get(i).setColor(0, 0, 255);
        }
      }
    }
Example #10
0
  private static boolean go(int a, int b) {
    if (memo[a][b] >= 0) return memo[a][b] == 1;

    if (a == b) return true;
    if (b - a == 1) return str[a] == ' ' || str[a] == ':' || Character.isLetter(str[a]);

    boolean ok = false;
    if (b - a == 2) ok |= str[a] == ':' && (str[a + 1] == ')' || str[a + 1] == '(');
    if (b - a >= 2 && str[a] == '(' && str[b - 1] == ')') ok |= go(a + 1, b - 1);
    for (int x = a + 1; x < b && !ok; x++) ok |= go(a, x) && go(x, b);

    memo[a][b] = ok ? 1 : 0;
    return ok;
  }
Example #11
0
  /**
   * Returns true if two names match without regard to case or the presence of '-' or '_'
   * characters.
   *
   * @param beanName The name of the bean property to compare
   * @param elementName The name of the element to compare
   * @return True if the names match
   */
  public static boolean namesMatch(String beanName, String elementName) {
    int beanNameLen = beanName.length();
    int elementNameLen = elementName.length();

    int elementPos = 0;
    int beanPos = 0;

    // Keep looping until you hit the end of either of the strings
    while ((elementPos < elementNameLen) && (beanPos < beanNameLen)) {
      // If the next character in the bean name is a '-' or a '/', skip it
      char beanCh = Character.toLowerCase(beanName.charAt(beanPos));
      if ((beanCh == '-') || (beanCh == '_')) {
        beanPos++;
        continue;
      }

      // If the next character in the element name is a '-' or a '/', skip it
      char elementCh = Character.toLowerCase(elementName.charAt(elementPos));
      if ((elementCh == '-') || (elementCh == '_')) {
        elementPos++;
        continue;
      }

      // If the characters don't match, the names don't match
      if (elementCh != beanCh) return false;
      elementPos++;
      beanPos++;
    }

    // You hit the end of both names at the same time, the names match
    if ((elementPos == elementNameLen) && (beanPos == beanNameLen)) {
      return true;
    }

    return false;
  }
Example #12
0
 /**
  * Converts the given string to camel case.
  *
  * @param string string to convert
  * @return resulting string
  */
 public static String camelCase(final String string) {
   final StringBuilder sb = new StringBuilder(string.length());
   boolean dash = false;
   for (int p = 0; p < string.length(); p++) {
     final char ch = string.charAt(p);
     if (dash) {
       sb.append(Character.toUpperCase(ch));
       dash = false;
     } else {
       dash = ch == '-';
       if (!dash) sb.append(ch);
     }
   }
   return sb.toString();
 }
Example #13
0
File: Macro.java Project: bramk/bnd
  String version(Version version, String mask) {
    if (version == null) {
      String v = domain.getProperty("@");
      if (v == null) {
        domain.error(
            "No version specified for ${version} or ${range} and no implicit version ${@} either, mask=%s",
            mask);
        v = "0";
      }
      version = new Version(v);
    }

    StringBuilder sb = new StringBuilder();
    String del = "";

    for (int i = 0; i < mask.length(); i++) {
      char c = mask.charAt(i);
      String result = null;
      if (c != '~') {
        if (i == 3) {
          result = version.getQualifier();
        } else if (Character.isDigit(c)) {
          // Handle masks like +00, =+0
          result = String.valueOf(c);
        } else {
          int x = version.get(i);
          switch (c) {
            case '+':
              x++;
              break;
            case '-':
              x--;
              break;
            case '=':
              break;
          }
          result = Integer.toString(x);
        }
        if (result != null) {
          sb.append(del);
          del = ".";
          sb.append(result);
        }
      }
    }
    return sb.toString();
  }
Example #14
0
  public boolean readSrecCode(String fName) {

    FileInputStream fis = null;

    srec = new short[SREC_MAX_LINES][PKT_PAYLOAD_SIZE];
    numLines = 1;
    numPkts = 0;

    try {
      BufferedReader dis =
          new BufferedReader(new InputStreamReader(fis = new FileInputStream(fName)));
      System.out.println("--------------------------------------------------");
      System.out.println("Reading file: " + fName);
      // WARNING
      int curByte = 0; // 16; // account for S0 line which is not parsed

      while (true) {
        char bline[] = dis.readLine().toUpperCase().toCharArray();
        if (bline[1] == '1') {
          numLines++;
          if (bline.length > SREC_MAX_LINE_LEN) {
            System.out.println("ERROR: SREC Read: Too many byes on line: " + numLines);
            return false;
          }
          // srec length
          int length =
              Integer.parseInt(Character.toString(bline[2]) + Character.toString(bline[3]), 16) - 3;

          // data
          for (int i = 0, j = 8; i < length; i++, j += 2) {
            if (curByte >= PKT_PAYLOAD_SIZE) {
              numPkts++;
              curByte = 0;
            }
            srec[numPkts][curByte++] =
                (short)
                    Integer.parseInt(
                        Character.toString(bline[j]) + Character.toString(bline[j + 1]), 16);
            imgSize++;
          }
        } else if (bline[1] == '2') {
          numLines++;
          if (bline.length > SREC_MAX_LINE_LEN) {
            System.out.println("ERROR: SREC Read: Too many byes on line: " + numLines);
            return false;
          }
          // srec length
          int length =
              Integer.parseInt(Character.toString(bline[2]) + Character.toString(bline[3]), 16) - 4;

          // data
          for (int i = 0, j = 10; i < length; i++, j += 2) {
            if (curByte >= PKT_PAYLOAD_SIZE) {
              numPkts++;
              curByte = 0;
            }
            srec[numPkts][curByte++] =
                (short)
                    Integer.parseInt(
                        Character.toString(bline[j]) + Character.toString(bline[j + 1]), 16);
            imgSize++;
          }
        }
      }
    } catch (FileNotFoundException e) {
      System.out.println("ERROR: (SREC Read) " + e);
      return false;
    } catch (Exception e) {
      numPgs = (short) (((imgSize - 1) / BYTES_PER_PAGE) + 1);
      System.out.println(
          "Read END: (Lines="
              + numLines
              + ",Pages="
              + numPgs
              + ",Pkts="
              + numPkts
              + ",Size="
              + imgSize
              + ")");
      System.out.println("--------------------------------------------------");
    }

    try {
      if (fis != null) fis.close();
    } catch (Exception e) {
      e.printStackTrace();
    }

    return true;
  }
Example #15
0
 /**
  * Converts a character to lower case.
  *
  * @param ch character to be converted
  * @return resulting character
  */
 public static int lc(final int ch) {
   return ch >= 'A' && ch <= 'Z' ? ch | 0x20 : ch > 0x7F ? Character.toLowerCase(ch) : ch;
 }
Example #16
0
 /**
  * Converts a character to upper case.
  *
  * @param ch character to be converted
  * @return resulting character
  */
 public static int uc(final int ch) {
   return ch >= 'a' && ch <= 'z' ? ch - 0x20 : ch > 0x7F ? Character.toUpperCase(ch) : ch;
 }
Example #17
0
    public void checkThirtyDegreeRule(
        ArrayList<Cam> cameras, ArrayList<Character> characters, int selectedIdx) {
      if (cameras == null || cameras.isEmpty()) {
        println("No cameras in the scene!");
      }

      if (characters.size() != 2) {
        println("Only two characters supported for now");
        // TODO (sanjeet): Hack! Fix this once more characters are allowed
      }

      Cam selectedCamera = cameras.get(selectedIdx);

      // TODO The characters.get results in a runtime error because there aren't currently any
      // characters allocated in the input file.
      Character ch1 = characters.get(0);
      Character ch2 = characters.get(1);

      // Obtaining (x,y,z) for characters and selected camera
      PVector ch1Location = ch1.getTranslation();
      PVector ch2Location = ch2.getTranslation();
      PVector selectedCameraLocation = selectedCamera.getTranslation();

      PVector cameraPoint = new PVector();
      cameraPoint.add(selectedCameraLocation);
      for (int i = 0; i < 100; i++) {
        cameraPoint.add(selectedCamera.getZAxis());
      }
      PVector intersection =
          getTwoLinesIntersection(
              new PVector(ch1Location.x, ch1Location.z),
              new PVector(ch2Location.x, ch2Location.z),
              new PVector(selectedCameraLocation.x, selectedCameraLocation.z),
              new PVector(cameraPoint.x, cameraPoint.z));

      PVector diff = PVector.sub(selectedCameraLocation, intersection);
      diff.normalize();
      FloatBuffer fb = selectedCamera.modelViewMatrix;
      float[] mat = fb.array();
      float[] fbMatrix = new float[mat.length];
      for (int i = 0; i < fbMatrix.length; i++) {
        fbMatrix[i] = mat[i];
      }
      fbMatrix[0] = -diff.x;
      fbMatrix[1] = diff.y;
      fbMatrix[2] = -diff.z;
      fbMatrix[9] = diff.x;
      fbMatrix[10] = diff.y;
      fbMatrix[11] = diff.z;
      fbMatrix[13] = intersection.x;
      fbMatrix[14] = intersection.y;
      fbMatrix[15] = intersection.z;
      PMatrix3D matrix = new PMatrix3D();
      matrix.set(fbMatrix);
      matrix.transpose();
      pushMatrix();
      applyMatrix(matrix);
      rotateY(radians(30));
      line(0, 0, 0, 0, 0, 1000);
      rotateY(radians(-2 * 30));
      line(0, 0, 0, 0, 0, 1000);
      popMatrix();

      for (int i = 0; i < cameras.size(); i++) {
        if (i == selectedIdx) {
          continue;
        }

        if (!cameras.get(i).isInView(ch1Location) && !cameras.get(i).isInView(ch2Location)) {
          continue;
        }
        PVector currCamLocation = cameras.get(i).getTranslation();
        PVector vect1 = PVector.sub(currCamLocation, intersection);
        PVector vect2 = PVector.sub(selectedCameraLocation, intersection);
        float dotP = vect1.dot(vect2) / (vect1.mag() * vect2.mag());
        if (acos(dotP) <= PI / 6) {
          cameras.get(i).setColor(255, 0, 0);
        } else {
          cameras.get(i).setColor(0, 0, 255);
        }
      }
    }
  /**
   * Provides a way to determine the next visually represented model location that one might place a
   * caret. Some views may not be visible, they might not be in the same order found in the model,
   * or they just might not allow access to some of the locations in the model.
   *
   * @param v the view to use
   * @param pos the position to convert >= 0
   * @param a the allocated region to render into
   * @param direction the direction from the current position that can be thought of as the arrow
   *     keys typically found on a keyboard. This may be SwingConstants.WEST, SwingConstants.EAST,
   *     SwingConstants.NORTH, or SwingConstants.SOUTH.
   * @return the location within the model that best represents the next location visual position.
   * @exception BadLocationException
   * @exception IllegalArgumentException for an invalid direction
   */
  public int getNextVisualPositionFrom(
      GlyphView v, int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet)
      throws BadLocationException {

    int startOffset = v.getStartOffset();
    int endOffset = v.getEndOffset();
    Segment text;
    AbstractDocument doc;
    boolean viewIsLeftToRight;
    TextHitInfo currentHit, nextHit;

    switch (direction) {
      case View.NORTH:
        break;
      case View.SOUTH:
        break;
      case View.EAST:
        doc = (AbstractDocument) v.getDocument();
        viewIsLeftToRight = doc.isLeftToRight(startOffset, endOffset);

        if (startOffset == doc.getLength()) {
          if (pos == -1) {
            biasRet[0] = Position.Bias.Forward;
            return startOffset;
          }
          // End case for bidi text where newline is at beginning
          // of line.
          return -1;
        }
        if (pos == -1) {
          // Entering view from the left.
          if (viewIsLeftToRight) {
            biasRet[0] = Position.Bias.Forward;
            return startOffset;
          } else {
            text = v.getText(endOffset - 1, endOffset);
            char c = text.array[text.offset];
            SegmentCache.releaseSharedSegment(text);
            if (c == '\n') {
              biasRet[0] = Position.Bias.Forward;
              return endOffset - 1;
            }
            biasRet[0] = Position.Bias.Backward;
            return endOffset;
          }
        }
        if (b == Position.Bias.Forward) currentHit = TextHitInfo.afterOffset(pos - startOffset);
        else currentHit = TextHitInfo.beforeOffset(pos - startOffset);
        nextHit = layout.getNextRightHit(currentHit);
        if (nextHit == null) {
          return -1;
        }
        if (viewIsLeftToRight != layout.isLeftToRight()) {
          // If the layout's base direction is different from
          // this view's run direction, we need to use the weak
          // carrat.
          nextHit = layout.getVisualOtherHit(nextHit);
        }
        pos = nextHit.getInsertionIndex() + startOffset;

        if (pos == endOffset) {
          // A move to the right from an internal position will
          // only take us to the endOffset in a left to right run.
          text = v.getText(endOffset - 1, endOffset);
          char c = text.array[text.offset];
          SegmentCache.releaseSharedSegment(text);
          if (c == '\n') {
            return -1;
          }
          biasRet[0] = Position.Bias.Backward;
        } else {
          biasRet[0] = Position.Bias.Forward;
        }
        return pos;
      case View.WEST:
        doc = (AbstractDocument) v.getDocument();
        viewIsLeftToRight = doc.isLeftToRight(startOffset, endOffset);

        if (startOffset == doc.getLength()) {
          if (pos == -1) {
            biasRet[0] = Position.Bias.Forward;
            return startOffset;
          }
          // End case for bidi text where newline is at beginning
          // of line.
          return -1;
        }
        if (pos == -1) {
          // Entering view from the right
          if (viewIsLeftToRight) {
            text = v.getText(endOffset - 1, endOffset);
            char c = text.array[text.offset];
            SegmentCache.releaseSharedSegment(text);
            if ((c == '\n') || Character.isSpaceChar(c)) {
              biasRet[0] = Position.Bias.Forward;
              return endOffset - 1;
            }
            biasRet[0] = Position.Bias.Backward;
            return endOffset;
          } else {
            biasRet[0] = Position.Bias.Forward;
            return startOffset;
          }
        }
        if (b == Position.Bias.Forward) currentHit = TextHitInfo.afterOffset(pos - startOffset);
        else currentHit = TextHitInfo.beforeOffset(pos - startOffset);
        nextHit = layout.getNextLeftHit(currentHit);
        if (nextHit == null) {
          return -1;
        }
        if (viewIsLeftToRight != layout.isLeftToRight()) {
          // If the layout's base direction is different from
          // this view's run direction, we need to use the weak
          // carrat.
          nextHit = layout.getVisualOtherHit(nextHit);
        }
        pos = nextHit.getInsertionIndex() + startOffset;

        if (pos == endOffset) {
          // A move to the left from an internal position will
          // only take us to the endOffset in a right to left run.
          text = v.getText(endOffset - 1, endOffset);
          char c = text.array[text.offset];
          SegmentCache.releaseSharedSegment(text);
          if (c == '\n') {
            return -1;
          }
          biasRet[0] = Position.Bias.Backward;
        } else {
          biasRet[0] = Position.Bias.Forward;
        }
        return pos;
      default:
        throw new IllegalArgumentException("Bad direction: " + direction);
    }
    return pos;
  }
Example #19
0
 /**
  * Returns true if the specified character is a full-text letter or digit.
  *
  * @param ch character to be tested
  * @return result of check
  */
 public static boolean ftChar(final int ch) {
   return ch >= '0' && (ch < 0x80 ? LOD[ch - '0'] : Character.isLetterOrDigit(ch));
 }