当前位置: 首页>>代码示例>>Java>>正文


Java Signature.C_SEMICOLON属性代码示例

本文整理汇总了Java中org.eclipse.jdt.core.Signature.C_SEMICOLON属性的典型用法代码示例。如果您正苦于以下问题:Java Signature.C_SEMICOLON属性的具体用法?Java Signature.C_SEMICOLON怎么用?Java Signature.C_SEMICOLON使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.jdt.core.Signature的用法示例。


在下文中一共展示了Signature.C_SEMICOLON属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: typeEnd

private static int typeEnd(char[] signature, int pos) {
  int depth = 0;
  while (pos < signature.length) {
    switch (signature[pos]) {
      case Signature.C_GENERIC_START:
        depth++;
        break;
      case Signature.C_GENERIC_END:
        if (depth == 0) return pos;
        depth--;
        break;
      case Signature.C_SEMICOLON:
        if (depth == 0) return pos + 1;
        break;
    }
    pos++;
  }
  return pos + 1;
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:SignatureUtil.java

示例2: appendClassTypeSignature

private static void appendClassTypeSignature(
    char[] string, int start, StringBuffer buffer, boolean compact) {
  char c = string[start];
  if (c != Signature.C_RESOLVED) {
    return;
  }
  int p = start + 1;
  int checkpoint = buffer.length();
  while (true) {
    c = string[p];
    switch (c) {
      case Signature.C_SEMICOLON:
        // all done
        return;
      case Signature.C_DOT:
      case '/':
        // erase package prefix
        if (compact) {
          buffer.setLength(checkpoint);
        } else {
          buffer.append('.');
        }
        break;
      case Signature.C_DOLLAR:
        /**
         * Convert '$' in resolved type signatures into '.'. NOTE: This assumes that the type
         * signature is an inner type signature. This is true in most cases, but someone can
         * define a non-inner type name containing a '$'.
         */
        buffer.append('.');
        break;
      default:
        buffer.append(c);
    }
    p++;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:37,代码来源:Util.java

示例3: splitTypeLevelsSignature

/**
 * Split signatures of all levels from a type unique key.
 *
 * <p>Example: For following type X<Y<Z>,V<W>,U>.A<B>, unique key is:
 * "LX<LY<LZ;>;LV<LW;>;LU;>.LA<LB;>;"
 *
 * <p>The return splitted signatures array is: [ ['L','X','<','L','Y','<','L','Z'
 * ,';'>',';','L','V','<','L','W',';'>',';','L','U','>',';'], ['L','A','<','L','B',';','>',';']
 *
 * @param typeSignature ParameterizedSourceType type signature
 * @return char[][] Array of signatures for each level of given unique key
 */
public static final char[][] splitTypeLevelsSignature(String typeSignature) {
  // In case of IJavaElement signature, replace '$' by '.'
  char[] source = Signature.removeCapture(typeSignature.toCharArray());
  CharOperation.replace(source, '$', '.');

  // Init counters and arrays
  char[][] signatures = new char[10][];
  int signaturesCount = 0;
  // int[] lengthes = new int [10];
  int paramOpening = 0;

  // Scan each signature character
  for (int idx = 0, ln = source.length; idx < ln; idx++) {
    switch (source[idx]) {
      case '>':
        paramOpening--;
        if (paramOpening == 0) {
          if (signaturesCount == signatures.length) {
            System.arraycopy(
                signatures, 0, signatures = new char[signaturesCount + 10][], 0, signaturesCount);
          }
        }
        break;
      case '<':
        paramOpening++;
        break;
      case '.':
        if (paramOpening == 0) {
          if (signaturesCount == signatures.length) {
            System.arraycopy(
                signatures, 0, signatures = new char[signaturesCount + 10][], 0, signaturesCount);
          }
          signatures[signaturesCount] = new char[idx + 1];
          System.arraycopy(source, 0, signatures[signaturesCount], 0, idx);
          signatures[signaturesCount][idx] = Signature.C_SEMICOLON;
          signaturesCount++;
        }
        break;
      case '/':
        source[idx] = '.';
        break;
    }
  }

  // Resize signatures array
  char[][] typeSignatures = new char[signaturesCount + 1][];
  typeSignatures[0] = source;
  for (int i = 1, j = signaturesCount - 1; i <= signaturesCount; i++, j--) // NOSONAR
  {
    typeSignatures[i] = signatures[j];
  }
  return typeSignatures;
}
 
开发者ID:eclipse,项目名称:che,代码行数:65,代码来源:Util.java

示例4: appendClassTypeSignatureForAnchor

private static int appendClassTypeSignatureForAnchor(
    char[] string, int start, StringBuffer buffer) {
  // need a minimum 3 chars "Lx;"
  if (start >= string.length - 2) {
    throw new IllegalArgumentException();
  }
  // must start in "L" or "Q"
  char c = string[start];
  if (c != Signature.C_RESOLVED && c != Signature.C_UNRESOLVED) {
    throw new IllegalArgumentException();
  }
  int p = start + 1;
  while (true) {
    if (p >= string.length) {
      throw new IllegalArgumentException();
    }
    c = string[p];
    switch (c) {
      case Signature.C_SEMICOLON:
        // all done
        return p;
      case Signature.C_GENERIC_START:
        int e = scanGenericEnd(string, p + 1);
        // once we hit type arguments there are no more package prefixes
        p = e;
        break;
      case Signature.C_DOT:
        buffer.append('.');
        break;
      case '/':
        buffer.append('/');
        break;
      case Signature.C_DOLLAR:
        // once we hit "$" there are no more package prefixes
        /**
         * Convert '$' in resolved type signatures into '.'. NOTE: This assumes that the type
         * signature is an inner type signature. This is true in most cases, but someone can
         * define a non-inner type name containing a '$'.
         */
        buffer.append('.');
        break;
      default:
        buffer.append(c);
    }
    p++;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:47,代码来源:Util.java


注:本文中的org.eclipse.jdt.core.Signature.C_SEMICOLON属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。