private static void generateNameByString(
      Set<String> possibleNames,
      String value,
      NameValidator validator,
      boolean forStaticVariable,
      Project project) {
    if (!JavaPsiFacade.getInstance(project).getNameHelper().isIdentifier(value)) return;
    if (forStaticVariable) {
      StringBuilder buffer = new StringBuilder(value.length() + 10);
      char[] chars = new char[value.length()];
      value.getChars(0, value.length(), chars, 0);
      boolean wasLow = Character.isLowerCase(chars[0]);

      buffer.append(Character.toUpperCase(chars[0]));
      for (int i = 1; i < chars.length; i++) {
        if (Character.isUpperCase(chars[i])) {
          if (wasLow) {
            buffer.append('_');
            wasLow = false;
          }
        } else {
          wasLow = true;
        }

        buffer.append(Character.toUpperCase(chars[i]));
      }
      possibleNames.add(validator.validateName(buffer.toString(), true));
    } else {
      possibleNames.add(validator.validateName(value, true));
    }
  }
Пример #2
0
  /**
   * Encodes an array of bytes into an array of URL safe 7-bit characters. Unsafe characters are
   * escaped.
   *
   * @param urlsafe bitset of characters deemed URL safe
   * @param bytes array of bytes to convert to URL safe characters
   * @return array of bytes containing URL safe characters
   */
  public static final byte[] encodeUrl(BitSet urlsafe, byte[] bytes) {
    if (bytes == null) {
      return null;
    }
    if (urlsafe == null) {
      urlsafe = WWW_FORM_URL;
    }

    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    for (int i = 0; i < bytes.length; i++) {
      int b = bytes[i];
      if (b < 0) {
        b = 256 + b;
      }
      if (urlsafe.get(b)) {
        if (b == ' ') {
          b = '+';
        }
        buffer.write(b);
      } else {
        buffer.write('%');
        char hex1 = Character.toUpperCase(Character.forDigit((b >> 4) & 0xF, 16));
        char hex2 = Character.toUpperCase(Character.forDigit(b & 0xF, 16));
        buffer.write(hex1);
        buffer.write(hex2);
      }
    }
    return buffer.toByteArray();
  }
Пример #3
0
  /**
   * ******************************************************************** Method: compareTwoNames
   * Description: Prompts user for two names and the decade to compare Input: array of Names, user
   * entered values for requestName, searchName, getDecade method calls Output: Displays histogram
   * line comparison between two names user selects
   * -------------------------------------------------------------- Pseudocode for this solution:
   * Begin Set name1 equal to value returned from requestName Set name1Idx equal to value returned
   * from searchName Reset name1 equal to self with first letter capitalized If name1Idx is equal to
   * -1 Begin Display "The name " + name1 + ", was not found!" End Else Begin Set name2 equal to
   * value returned from requestName Set namd2Idx equal to value returned from searchName Reset
   * name2 equal to self with first letter capitalized If name2Idx is equal to -1 Begin Display "The
   * second name, " + name2 + ", was not found!" End Else Begin Set decade equal to value returned
   * from getDecade Display comparison of name1 and name2 histogram lines for the selected decade
   * End if condition End if condition End
   * ********************************************************************
   */
  public static void compareTwoNames(Name[] list) {
    int name1Idx;
    int name2Idx;
    int decade;
    String name1;
    String name2;

    name1 = requestName();
    name1Idx = searchName(name1, list);
    name1 = Character.toUpperCase(name1.charAt(0)) + name1.substring(1);
    if (name1Idx == -1) {
      System.out.println("\nThe name, " + name1 + ", was not found!");
    } else {
      name2 = requestName();
      name2Idx = searchName(name2, list);
      name2 = Character.toUpperCase(name2.charAt(0)) + name2.substring(1);
      if (name2Idx == -1) {
        System.out.println("\nThe second name, " + name2 + ", was not found!");
      } else {
        decade = getDecade(list);
        System.out.println(
            "\nData for "
                + name1
                + "\n"
                + list[name1Idx].getHistoLine(decade)
                + "\nData for "
                + name2
                + "\n"
                + list[name2Idx].getHistoLine(decade));
      }
    }
  }
Пример #4
0
 /**
  * Search for string in ring.
  *
  * @param str string to search for
  * @param lastIdx last index at which to search for string
  * @param ignoreCase
  * @return index of string if found, else -1
  */
 public int indexOf(String str, int lastIdx, boolean ignoreCase) {
   int strlen = str.length();
   int lastPossible = size - strlen;
   if (lastPossible < 0) return -1;
   lastIdx = (lastIdx < 0 || lastIdx > lastPossible) ? lastPossible : lastIdx;
   int pos = 0;
   // find position of first char of string
   l1:
   while ((pos = indexOf(str.charAt(0), pos, lastIdx, ignoreCase)) >= 0) {
     int ringpos = head + pos;
     for (int ix = 1; ix < strlen; ix++) {
       char ch = str.charAt(ix);
       char rch = chars[(ringpos + ix) % capacity];
       if (ignoreCase) {
         ch = Character.toUpperCase(ch);
         rch = Character.toUpperCase(rch);
       }
       if (ch != rch) {
         pos++;
         continue l1;
       }
     }
     return pos;
   }
   return -1;
 }
Пример #5
0
  public static String getSentencecaseString(String name) {
    String titleCaseValue = null;
    try {

      String[] words = name.split(" ");
      StringBuilder sb = new StringBuilder();
      if (words[0].length() > 0) {
        sb.append(
            Character.toUpperCase(words[0].charAt(0))
                + words[0].subSequence(1, words[0].length()).toString().toLowerCase());
        for (int i = 1; i < words.length; i++) {
          sb.append(" ");
          sb.append(
              Character.toUpperCase(words[i].charAt(0))
                  + words[i].subSequence(1, words[i].length()).toString().toLowerCase());
        }
      }
      titleCaseValue = sb.toString();

      // Log.i("STAG",titleCaseValue);

    } catch (StringIndexOutOfBoundsException e) {
      titleCaseValue = name;
      e.printStackTrace();
    } catch (Exception e) {
      titleCaseValue = name;
      e.printStackTrace();
    }
    return titleCaseValue;
  }
Пример #6
0
 /** Get an Identifier */
 private String GetName() {
   StringBuffer Token = new StringBuffer();
   if (!IsAlpha(look) && look != '\'') {
     Expected("Name");
   }
   if (look == '\'') {
     Match('\'');
     boolean done = look == '\'';
     while (!done) {
       Token.append(Character.toUpperCase(look));
       GetChar();
       if (look == '\'') {
         Match('\'');
         done = look != '\'';
       }
     }
   } else {
     while (IsAlNum(look)) {
       Token.append(Character.toUpperCase(look));
       GetChar();
     }
   }
   SkipWhite();
   return Token.toString();
 }
Пример #7
0
 /**
  * Encodes byte into its quoted-printable representation.
  *
  * @param b byte to encode
  * @param buffer the buffer to write to
  */
 private static final void encodeQuotedPrintable(int b, ByteArrayOutputStream buffer) {
   buffer.write(ESCAPE_CHAR);
   char hex1 = Character.toUpperCase(Character.forDigit((b >> 4) & 0xF, 16));
   char hex2 = Character.toUpperCase(Character.forDigit(b & 0xF, 16));
   buffer.write(hex1);
   buffer.write(hex2);
 }
Пример #8
0
  public static String URLEncode(String original, String charset)
      throws UnsupportedEncodingException {
    if (original == null) return null;
    byte octets[];
    try {
      octets = original.getBytes(charset);
    } catch (UnsupportedEncodingException error) {
      throw new UnsupportedEncodingException();
    }
    StringBuffer buf = new StringBuffer(octets.length);
    for (int i = 0; i < octets.length; i++) {
      char c = (char) octets[i];
      if (allowed_query.get(c)) {
        buf.append(c);
      } else {
        buf.append('%');
        byte b = octets[i];
        char hexadecimal = Character.forDigit(b >> 4 & 0xf, 16);
        buf.append(Character.toUpperCase(hexadecimal));
        hexadecimal = Character.forDigit(b & 0xf, 16);
        buf.append(Character.toUpperCase(hexadecimal));
      }
    }

    return buf.toString();
  }
Пример #9
0
  public void activeHighlight(Xmas xnet, VisualXmas vnet) {
    QueueComponent qc;
    SyncComponent sc;
    VisualQueueComponent vqc;
    VisualSyncComponent vsc;

    for (Qslist ql : qslist) {
      if (ql.chk == 0) {
        for (Node node : vnet.getNodes()) {
          if (node instanceof VisualQueueComponent) {
            vqc = (VisualQueueComponent) node;
            qc = vqc.getReferencedQueueComponent();
            String rstr;
            rstr = xnet.getName(qc);
            rstr = rstr.replace(rstr.charAt(0), Character.toUpperCase(rstr.charAt(0)));
            if (rstr.equals(ql.name)) {
              vqc.setForegroundColor(Color.green);
            }
          } else if (node instanceof VisualSyncComponent) {
            vsc = (VisualSyncComponent) node;
            sc = vsc.getReferencedSyncComponent();
            String rstr;
            rstr = xnet.getName(sc);
            rstr = rstr.replace(rstr.charAt(0), Character.toUpperCase(rstr.charAt(0)));
            if (rstr.equals(ql.name)) {
              vsc.setForegroundColor(Color.green);
            }
          }
        }
      }
    }
  }
Пример #10
0
  /**
   * Convert a string to title case, where an initial alpha character, and any alpha character
   * following whitespace, is upper case. As the title of a book.
   */
  public static final String toTitleCase(String s) {
    if (null == s) return null;
    else {
      char[] cary = s.toCharArray();

      int len = cary.length;

      if (0 < len) {

        cary[0] = Character.toUpperCase(cary[0]);

        boolean next = false;

        for (int cc = 1; cc < len; cc++) {

          if (next) {
            if (!Character.isWhitespace(cary[cc])) {

              cary[cc] = Character.toUpperCase(cary[cc]);

              next = false;
            }
          } else if (Character.isWhitespace(cary[cc])) next = true;
          else continue;
        }
        return new String(cary);
      } else return s;
    }
  }
  protected Symbol[] getTokenTable() {
    if (tokenTable == null) {
      int maxChar = 0;
      for (Iterator i = charactersToSymbols.keySet().iterator(); i.hasNext(); ) {
        Character c = (Character) i.next();
        char cv = c.charValue();
        if (caseSensitive) {
          maxChar = Math.max(maxChar, cv);
        } else {
          maxChar = Math.max(maxChar, Character.toUpperCase(cv));
          maxChar = Math.max(maxChar, Character.toLowerCase(cv));
        }
      }

      tokenTable = new Symbol[maxChar + 1];

      for (Iterator i = charactersToSymbols.entrySet().iterator(); i.hasNext(); ) {
        Map.Entry me = (Map.Entry) i.next();
        Symbol sym = (Symbol) me.getValue();
        Character c = (Character) me.getKey();
        char cv = c.charValue();
        if (caseSensitive) {
          tokenTable[cv] = sym;
        } else {
          tokenTable[Character.toUpperCase(cv)] = sym;
          tokenTable[Character.toLowerCase(cv)] = sym;
        }
      }
    }

    return tokenTable;
  }
Пример #12
0
 public static String makePretty(String str) {
   char lastChar = ' ';
   StringBuilder sb = new StringBuilder(str);
   int whitespaceDist = 0;
   for (int i = 0; i < sb.length(); i++) {
     char nowChar = sb.charAt(i);
     if (nowChar != ' ' && nowChar != '.') {
       whitespaceDist += 1;
     } else {
       if (whitespaceDist == 2) {
         char b = sb.charAt(i - 1);
         char a = sb.charAt(i - 2);
         sb.setCharAt(i - 1, Character.toUpperCase(b));
         sb.setCharAt(i - 2, Character.toUpperCase(a));
       }
     }
     if (lastChar == ' ' || lastChar == '/') {
       sb.setCharAt(i, Character.toUpperCase(nowChar));
     } else {
       sb.setCharAt(i, Character.toLowerCase(nowChar));
     }
     lastChar = nowChar;
   }
   return sb.toString();
 }
Пример #13
0
    private boolean compare_Character(int operation, char charval, Object value2) {
      if (operation == SUBSTRING) {
        return false;
      }
      char charval2;
      try {
        charval2 = ((String) value2).charAt(0);
      } catch (IndexOutOfBoundsException e) {
        return false;
      }

      switch (operation) {
        case EQUAL:
          {
            return charval == charval2;
          }
        case APPROX:
          {
            return (charval == charval2)
                || (Character.toUpperCase(charval) == Character.toUpperCase(charval2))
                || (Character.toLowerCase(charval) == Character.toLowerCase(charval2));
          }
        case GREATER:
          {
            return charval >= charval2;
          }
        case LESS:
          {
            return charval <= charval2;
          }
      }
      return false;
    }
Пример #14
0
 /**
  * Escapes all illegal JCR name characters of a string. The encoding is loosely modeled after URI
  * encoding, but only encodes the characters it absolutely needs to in order to make the resulting
  * string a valid JCR name. Use {@link #unescapeIllegalJcrChars(String)} for decoding.
  *
  * <p>QName EBNF:<br>
  * <xmp> simplename ::= onecharsimplename | twocharsimplename | threeormorecharname
  * onecharsimplename ::= (* Any Unicode character except: '.', '/', ':', '[', ']', '*', ''', '"',
  * '|' or any whitespace character *) twocharsimplename ::= '.' onecharsimplename |
  * onecharsimplename '.' | onecharsimplename onecharsimplename threeormorecharname ::= nonspace
  * string nonspace string ::= char | string char char ::= nonspace | ' ' nonspace ::= (* Any
  * Unicode character except: '/', ':', '[', ']', '*', ''', '"', '|' or any whitespace character *)
  * </xmp>
  *
  * @param name the name to escape
  * @return the escaped name
  */
 public static String escapeIllegalJcrChars(String name) {
   StringBuffer buffer = new StringBuffer(name.length() * 2);
   for (int i = 0; i < name.length(); i++) {
     char ch = name.charAt(i);
     if (ch == '%'
         || ch == '/'
         || ch == ':'
         || ch == '['
         || ch == ']'
         || ch == '*'
         || ch == '\''
         || ch == '"'
         || ch == '|'
         || (ch == '.' && name.length() < 3)
         || (ch == ' ' && (i == 0 || i == name.length() - 1))
         || ch == '\t'
         || ch == '\r'
         || ch == '\n') {
       buffer.append('%');
       buffer.append(Character.toUpperCase(Character.forDigit(ch / 16, 16)));
       buffer.append(Character.toUpperCase(Character.forDigit(ch % 16, 16)));
     } else {
       buffer.append(ch);
     }
   }
   return buffer.toString();
 }
Пример #15
0
  synchronized RangeToken getCaseInsensitiveToken() {
    if (this.icaseCache != null) return this.icaseCache;

    RangeToken uppers = this.type == Token.RANGE ? Token.createRange() : Token.createNRange();
    for (int i = 0; i < this.ranges.length; i += 2) {
      for (int ch = this.ranges[i]; ch <= this.ranges[i + 1]; ch++) {
        if (ch > 0xffff) uppers.addRange(ch, ch);
        else {
          char uch = Character.toUpperCase((char) ch);
          uppers.addRange(uch, uch);
        }
      }
    }
    RangeToken lowers = this.type == Token.RANGE ? Token.createRange() : Token.createNRange();
    for (int i = 0; i < uppers.ranges.length; i += 2) {
      for (int ch = uppers.ranges[i]; ch <= uppers.ranges[i + 1]; ch++) {
        if (ch > 0xffff) lowers.addRange(ch, ch);
        else {
          char uch = Character.toUpperCase((char) ch);
          lowers.addRange(uch, uch);
        }
      }
    }
    lowers.mergeRanges(uppers);
    lowers.mergeRanges(this);
    lowers.compactRanges();

    this.icaseCache = lowers;
    return lowers;
  }
  public String fieldDescription(Properties props) {
    StringBuffer buffer = new StringBuffer();
    boolean nextUpper = false;
    for (int i = 0; i < curFieldName.length(); i++) {
      char c = curFieldName.charAt(i);

      if (i == 0) {
        buffer.append(Character.toUpperCase(c));
        continue;
      }

      if (Character.isUpperCase(c)) {
        buffer.append(' ');
        buffer.append(c);
        continue;
      }

      if (c == '.') {
        buffer.delete(0, buffer.length());
        nextUpper = true;
        continue;
      }

      char x = nextUpper ? Character.toUpperCase(c) : c;
      buffer.append(x);
      nextUpper = false;
    }

    return buffer.toString();
  }
Пример #17
0
  /** Capitalizes the first letter of the string passed in */
  public static String capitalize(String string) {
    if (isBlank(string)) {
      return "";
    }

    char first = Character.toUpperCase(string.charAt(0));
    return Character.toUpperCase(first) + string.length() > 1 ? string.substring(1) : "";
  }
Пример #18
0
 public String getOperacion() {
   String strOperation = "";
   strOperation += Character.toUpperCase(this.getClase().charAt(0)) + this.getClase().substring(1);
   strOperation +=
       Character.toUpperCase(this.getMetodo().charAt(0)) + this.getMetodo().substring(1);
   strOperation += this.getFase();
   return strOperation;
 }
Пример #19
0
 /**
  * Interprets current Retain Case mode (all upper-case,all lower-case,capitalized or mixed) and
  * appends the character <code>ch</code> to <code>buf</code> after processing.
  *
  * @param buf the output buffer
  * @param ch the character to process
  * @since 3.4
  */
 private void interpretRetainCase(StringBuffer buf, char ch) {
   if (fRetainCaseMode == RC_UPPER) buf.append(Character.toUpperCase(ch));
   else if (fRetainCaseMode == RC_LOWER) buf.append(Character.toLowerCase(ch));
   else if (fRetainCaseMode == RC_FIRSTUPPER) {
     buf.append(Character.toUpperCase(ch));
     fRetainCaseMode = RC_MIXED;
   } else buf.append(ch);
 }
Пример #20
0
 private static boolean matchesIgnoreCase(String str, String query, int startingAt) {
   int len = query.length();
   for (int i = 0; i < len; i++) {
     if (Character.toUpperCase(query.charAt(i))
         != Character.toUpperCase(str.charAt(startingAt + i))) {
       return false;
     }
   }
   return true;
 }
Пример #21
0
 @NotNull
 private static KeyStroke getTypedOrPressedKeyStroke(char c, int modifiers) {
   if (modifiers == 0) {
     return getKeyStroke(c);
   } else if (modifiers == SHIFT_MASK) {
     return getKeyStroke(Character.toUpperCase(c));
   } else {
     return getKeyStroke(Character.toUpperCase(c), modifiers);
   }
 }
    private String camelize(String name) {
      char[] chars = name.toCharArray();
      chars[0] = Character.toUpperCase(chars[0]);

      for (int i = 0; i < chars.length; ++i) {
        char c = chars[i];
        int j = i + 1;
        if (c == '-' && j < chars.length) chars[j] = Character.toUpperCase(chars[j]);
      }
      return new String(chars);
    }
 private static String getPropertyFromBeanConvention(CtMethod ctMethod) {
   String getterOrSetter = ctMethod.getName();
   if (getterOrSetter.startsWith("get") || getterOrSetter.startsWith("set")) {
     String withoutGet = getterOrSetter.substring(4);
     // not specifically Bean convention, but this is what is bound in JMX.
     return Character.toUpperCase(getterOrSetter.charAt(3)) + withoutGet;
   } else if (getterOrSetter.startsWith("is")) {
     String withoutIs = getterOrSetter.substring(3);
     return Character.toUpperCase(getterOrSetter.charAt(2)) + withoutIs;
   }
   return getterOrSetter;
 }
  /**
   * @param introspectedColumn
   * @param inMethod if true generates an "in" method, else generates a "not in" method
   * @return a generated method for the in or not in method
   */
  private Method getSetInOrNotInMethod(IntrospectedColumn introspectedColumn, boolean inMethod) {
    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    FullyQualifiedJavaType type = FullyQualifiedJavaType.getNewListInstance();
    if (introspectedColumn.getFullyQualifiedJavaType().isPrimitive()) {
      type.addTypeArgument(
          introspectedColumn.getFullyQualifiedJavaType().getPrimitiveTypeWrapper());
    } else {
      type.addTypeArgument(introspectedColumn.getFullyQualifiedJavaType());
    }

    method.addParameter(new Parameter(type, "values")); // $NON-NLS-1$
    StringBuilder sb = new StringBuilder();
    sb.append(introspectedColumn.getJavaProperty());
    sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
    sb.insert(0, "and"); // $NON-NLS-1$
    if (inMethod) {
      sb.append("In"); // $NON-NLS-1$
    } else {
      sb.append("NotIn"); // $NON-NLS-1$
    }
    method.setName(sb.toString());
    method.setReturnType(FullyQualifiedJavaType.getCriteriaInstance());
    sb.setLength(0);

    if (introspectedColumn.isJDBCDateColumn()) {
      sb.append("addCriterionForJDBCDate(\""); // $NON-NLS-1$
    } else if (introspectedColumn.isJDBCTimeColumn()) {
      sb.append("addCriterionForJDBCTime(\""); // $NON-NLS-1$
    } else if (stringHasValue(introspectedColumn.getTypeHandler())) {
      sb.append("add"); // $NON-NLS-1$
      sb.append(introspectedColumn.getJavaProperty());
      sb.setCharAt(3, Character.toUpperCase(sb.charAt(3)));
      sb.append("Criterion(\""); // $NON-NLS-1$
    } else {
      sb.append("addCriterion(\""); // $NON-NLS-1$
    }

    sb.append(MyBatis3FormattingUtilities.getAliasedActualColumnName(introspectedColumn));
    if (inMethod) {
      sb.append(" in"); // $NON-NLS-1$
    } else {
      sb.append(" not in"); // $NON-NLS-1$
    }
    sb.append("\", values, \""); // $NON-NLS-1$
    sb.append(introspectedColumn.getJavaProperty());
    sb.append("\");"); // $NON-NLS-1$
    method.addBodyLine(sb.toString());
    method.addBodyLine("return (Criteria) this;"); // $NON-NLS-1$

    return method;
  }
 // Public static utility methods
 public static boolean isAcronymImpl(String str, List<String> tokens) {
   str = discardPattern.matcher(str).replaceAll("");
   if (str.length() == tokens.size()) {
     for (int i = 0; i < str.length(); i++) {
       char ch = Character.toUpperCase(str.charAt(i));
       if (!tokens.get(i).isEmpty() && Character.toUpperCase(tokens.get(i).charAt(0)) != ch) {
         return false;
       }
     }
     return true;
   } else {
     return false;
   }
 }
Пример #26
0
 @Override
 boolean mnemonicMatch(char key) {
   char uckey = Character.toUpperCase(key);
   String parsedText = layout.getText();
   for (int i = 0; i < mnemonics.length - 1; i++) {
     if (mnemonics[i] != -1) {
       char mnemonic = parsedText.charAt(mnemonics[i]);
       if (uckey == Character.toUpperCase(mnemonic)) {
         return true;
       }
     }
   }
   return false;
 }
  private Method getSingleValueMethod(
      IntrospectedColumn introspectedColumn, String nameFragment, String operator) {
    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.addParameter(
        new Parameter(introspectedColumn.getFullyQualifiedJavaType(), "value")); // $NON-NLS-1$
    StringBuilder sb = new StringBuilder();
    sb.append(introspectedColumn.getJavaProperty());
    sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
    sb.insert(0, "and"); // $NON-NLS-1$
    sb.append(nameFragment);
    method.setName(sb.toString());
    method.setReturnType(FullyQualifiedJavaType.getCriteriaInstance());
    sb.setLength(0);

    if (introspectedColumn.isJDBCDateColumn()) {
      sb.append("addCriterionForJDBCDate(\""); // $NON-NLS-1$
    } else if (introspectedColumn.isJDBCTimeColumn()) {
      sb.append("addCriterionForJDBCTime(\""); // $NON-NLS-1$
    } else if (stringHasValue(introspectedColumn.getTypeHandler())) {
      sb.append("add"); // $NON-NLS-1$
      sb.append(introspectedColumn.getJavaProperty());
      sb.setCharAt(3, Character.toUpperCase(sb.charAt(3)));
      sb.append("Criterion(\""); // $NON-NLS-1$
    } else {
      sb.append("addCriterion(\""); // $NON-NLS-1$
    }

    sb.append(MyBatis3FormattingUtilities.getAliasedActualColumnName(introspectedColumn));
    sb.append(' ');
    sb.append(operator);
    sb.append("\", "); // $NON-NLS-1$

    if (introspectedColumn.getFullyQualifiedJavaType().isPrimitive()) {
      sb.append("new "); // $NON-NLS-1$
      sb.append(
          introspectedColumn.getFullyQualifiedJavaType().getPrimitiveTypeWrapper().getShortName());
      sb.append("(value)"); // $NON-NLS-1$
    } else {
      sb.append("value"); // $NON-NLS-1$
    }

    sb.append(", \""); // $NON-NLS-1$
    sb.append(introspectedColumn.getJavaProperty());
    sb.append("\");"); // $NON-NLS-1$
    method.addBodyLine(sb.toString());
    method.addBodyLine("return (Criteria) this;"); // $NON-NLS-1$

    return method;
  }
Пример #28
0
  private String camel(String name, boolean upperInitial) {
    char initial = name.charAt(0);
    StringBuilder converted =
        new StringBuilder().append(upperInitial ? Character.toUpperCase(initial) : initial);

    for (int i = 1; i < name.length(); i++) {
      char chr = name.charAt(i);
      if (chr == '_' && i + 1 < name.length()) {
        converted.append(Character.toUpperCase(name.charAt(++i)));
      } else {
        converted.append(chr);
      }
    }
    return converted.toString();
  }
Пример #29
0
 private org.nlogo.window.ButtonWidget findActionButton(char key) {
   java.awt.Component[] comps = getComponents();
   for (int i = 0; i < comps.length; i++) {
     if (comps[i] instanceof WidgetWrapper) {
       Widget widget = ((WidgetWrapper) comps[i]).widget();
       if (widget instanceof org.nlogo.window.ButtonWidget) {
         org.nlogo.window.ButtonWidget button = (org.nlogo.window.ButtonWidget) widget;
         if (Character.toUpperCase(button.actionKey()) == Character.toUpperCase(key)) {
           return button;
         }
       }
     }
   }
   return null;
 }
Пример #30
0
  /**
   * ************** 根据VO字段名得到记录中字段的名字
   *
   * @param voName
   * @return
   */
  public static String getRstFieldName_ByVoFldName(String voName) {
    StringBuffer sb = new StringBuffer();

    sb.append(Character.toUpperCase(voName.charAt(0)));
    for (int i = 1; i < voName.length(); i++) { // 遍历voName如果有大写字母则将大写字母转换为_加小写
      char cur = voName.charAt(i);
      if (Character.isUpperCase(cur) && i > 0) {
        sb.append("_");
        sb.append(Character.toUpperCase(cur));
      } else {
        sb.append(cur);
      }
    }
    return sb.toString();
  }