gpt4 book ai didi

org.apache.sis.internal.util.X364.sequence()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 13:44:40 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.sis.internal.util.X364.sequence()方法的一些代码示例,展示了X364.sequence()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。X364.sequence()方法的具体详情如下:
包路径:org.apache.sis.internal.util.X364
类名称:X364
方法名:sequence

X364.sequence介绍

[英]The X3.64 escape sequence, built when first needed.
[中]X3。64个转义序列,第一次需要时构建。

代码示例

代码示例来源:origin: org.apache.sis.core/sis-referencing

/**
 * Writes the given color if {@code colorEnabled} is {@code true}.
 */
private static void writeColor(final Appendable out, final X364 color, final boolean colorEnabled)
    throws IOException
{
  if (colorEnabled) {
    out.append(color.sequence());
  }
}

代码示例来源:origin: org.apache.sis.core/sis-metadata

/**
 * Returns the ANSI sequence for the given syntactic element, or {@code null} if none.
 */
final String getAnsiSequence(final ElementKind key) {
  final X364 color = map.get(key);
  return (color != null) ? color.sequence() : null;
}

代码示例来源:origin: apache/sis

/**
 * Returns the ANSI sequence for the given syntactic element, or {@code null} if none.
 */
final String getAnsiSequence(final ElementKind key) {
  final X364 color = map.get(key);
  return (color != null) ? color.sequence() : null;
}

代码示例来源:origin: apache/sis

/**
 * Writes the given color if {@code colorEnabled} is {@code true}.
 */
private static void writeColor(final Appendable out, final X364 color, final boolean colorEnabled)
    throws IOException
{
  if (colorEnabled) {
    out.append(color.sequence());
  }
}

代码示例来源:origin: apache/sis

/**
 * Prints a quoted text in the given color.
 * If the given text contains the quote character, it will be escaped.
 */
private void printQuotedText(String text, int fieldWidth, final X364 color) {
  final boolean quoted;
  if (text.indexOf('"') >= 0) {
    text = text.replace("\"", "\"\"");
    quoted = true;
  } else {
    quoted = (text.indexOf(',') >= 0);
  }
  if (quoted) fieldWidth -= 2;
  out.print(CharSequences.spaces(fieldWidth - text.length()));
  if (colors) out.print(color.sequence());
  if (quoted) out.print('"');
  out.print(text);
  if (quoted) out.print('"');
  if (colors) out.print(X364.FOREGROUND_DEFAULT.sequence());
}

代码示例来源:origin: apache/sis

/**
 * Gets the color for the given level. If there is no explicit color for the given level,
 * returns the color of the first level below the given one for which a color is specified.
 */
private String colorAt(final Level level) {
  if (colorSequences == null) {
    colorSequences = new String[colors.size()];
    colorLevels = new int[colorSequences.length];
    int i = 0;
    for (final SortedMap.Entry<Level,X364> entry : colors.entrySet()) {
      colorSequences[i] = entry.getValue().background().sequence();
      colorLevels[i++]  = entry.getKey().intValue();
    }
  }
  int i = Arrays.binarySearch(colorLevels, level.intValue());
  if (i < 0) {
    i = Math.max((~i)-1, 0);                    // Really tild, not minus sign.
  }
  return colorSequences[i];
}

代码示例来源:origin: apache/sis

/**
 * Prints the character for commented lines.
 */
private void printCommentLinePrefix() {
  if (colors) {
    outHeader.append(X364.FOREGROUND_GRAY.sequence());
  }
  outHeader.append("# ");
  if (colors) {
    outHeader.append(X364.FOREGROUND_DEFAULT.sequence());
  }
}

代码示例来源:origin: org.apache.sis.core/sis-utility

/**
 * Gets the color for the given level. If there is no explicit color for the given level,
 * returns the color of the first level below the given one for which a color is specified.
 */
private String colorAt(final Level level) {
  if (colorSequences == null) {
    colorSequences = new String[colors.size()];
    colorLevels = new int[colorSequences.length];
    int i = 0;
    for (final SortedMap.Entry<Level,X364> entry : colors.entrySet()) {
      colorSequences[i] = entry.getValue().background().sequence();
      colorLevels[i++]  = entry.getKey().intValue();
    }
  }
  int i = Arrays.binarySearch(colorLevels, level.intValue());
  if (i < 0) {
    i = Math.max((~i)-1, 0);                    // Really tild, not minus sign.
  }
  return colorSequences[i];
}

代码示例来源:origin: apache/sis

/**
 * Writes the color for the given type if {@code colors} is non-null.
 */
private static void writeColor(final Appendable out, final Colors colors, final ElementKind type)
    throws IOException
{
  if (colors != null) {
    final String name = colors.getName(type);
    if (name != null) {
      out.append(X364.forColorName(name).sequence());
    }
  }
}

代码示例来源:origin: org.apache.sis.core/sis-referencing

/**
 * Writes the color for the given type if {@code colors} is non-null.
 */
private static void writeColor(final Appendable out, final Colors colors, final ElementKind type)
    throws IOException
{
  if (colors != null) {
    final String name = colors.getName(type);
    if (name != null) {
      out.append(X364.forColorName(name).sequence());
    }
  }
}

代码示例来源:origin: apache/sis

states.add(row.state);
  final boolean warning = colors && row.state.text.startsWith("!");
  if (warning) out.print(X364.FOREGROUND_RED.sequence());
  out.print(row.state.text);
  out.print(' ');
  out.print(row.identifier);
  if (warning) out.print(X364.FOREGROUND_DEFAULT.sequence());
  if (colors)  out.print(X364.FOREGROUND_GRAY.sequence());
  out.print(CharSequences.spaces(width - row.identifier.length()));
  out.print("| ");
  out.println(row.description);
  if (colors) out.print(X364.FOREGROUND_DEFAULT.sequence());
for (final State state : states) {
  final boolean warning = colors && state.text.startsWith("!");
  if (warning) out.print(X364.FOREGROUND_RED.sequence());
  out.print(state.text);
  if (warning) out.print(X364.FOREGROUND_DEFAULT.sequence());
  out.print(' ');
  out.println(resources.getString(state.name()));

代码示例来源:origin: org.apache.sis.core/sis-metadata

buffer.append(ln).append(ln);
if (colors != null) {
  buffer.append(X364.BACKGROUND_RED.sequence()).append(X364.BOLD.sequence()).append(' ');
  buffer.append(' ').append(X364.RESET.sequence()).append(X364.FOREGROUND_RED.sequence());

代码示例来源:origin: apache/sis

buffer.append(ln).append(ln);
if (colors != null) {
  buffer.append(X364.BACKGROUND_RED.sequence()).append(X364.BOLD.sequence()).append(' ');
  buffer.append(' ').append(X364.RESET.sequence()).append(X364.FOREGROUND_RED.sequence());

代码示例来源:origin: apache/sis

/**
 * Prints the accuracy.
 */
private void printAccuracy(double accuracy) throws IOException {
  if (accuracy >= 0) {
    if (accuracy == 0) {
      accuracy = Formulas.LINEAR_TOLERANCE;
    }
    printHeader(Vocabulary.Keys.Accuracy);
    if (colors) {
      outHeader.append(X364.FOREGROUND_YELLOW.sequence());    // Same as Colors.DEFAULT for ElementKind.NUMBER
    }
    outHeader.append(Double.toString(accuracy));
    if (colors) {
      outHeader.append(X364.FOREGROUND_DEFAULT.sequence());
    }
    outHeader.append(" metres");
    outHeader.nextLine();
  }
}

代码示例来源:origin: apache/sis

/**
 * Verifies the ANSI escape sequences hard-coded in {@link Formatter}.
 */
@Test
public void testAnsiEscapeSequences() {
  assertEquals("FOREGROUND_DEFAULT", X364.FOREGROUND_DEFAULT.sequence(), Formatter.FOREGROUND_DEFAULT);
  assertEquals("BACKGROUND_DEFAULT", X364.BACKGROUND_DEFAULT.sequence(), Formatter.BACKGROUND_DEFAULT);
}

代码示例来源:origin: apache/sis

final boolean isAnsiSupported = X364.isAnsiSupported();
if (isAnsiSupported) {
  out.print(X364.FOREGROUND_CYAN.sequence());
  out.print(X364.FOREGROUND_DEFAULT.sequence());

代码示例来源:origin: apache/sis

/**
   * Tests the {@link X364#plain(CharSequence, int, int)} method.
   */
  @Test
  public void testPlain() {
    String colored, plain;
    colored = "Some plain text";
    plain   = "Some plain text";
    assertEquals(plain,          valueOf(plain(colored, 0, colored.length())));
    assertEquals(plain.length(), lengthOfPlain(colored, 0, colored.length()));

    plain   = "With blue in the middle";
    colored = "With " + FOREGROUND_BLUE.sequence() +
         "blue"  + FOREGROUND_DEFAULT.sequence() + " in the middle";
    assertEquals(plain,          valueOf(plain(colored, 0, colored.length())));
    assertEquals(plain.length(), lengthOfPlain(colored, 0, colored.length()));
  }
}

代码示例来源:origin: apache/sis

assertEquals("getMaximalLineLength", 10, ((LineAppender) f).getMaximalLineLength());
final String BLUE    = X364.FOREGROUND_BLUE   .sequence();
final String DEFAULT = X364.FOREGROUND_DEFAULT.sequence();
assertSame(f, f.append("Ah! comme la " + BLUE + "neige" + DEFAULT + " a neigé!" + lineSeparator));
assertSame(f, f.append("Ma vitre est un jar" + SOFT_HYPHEN + "din de givre."    + lineSeparator));

代码示例来源:origin: apache/sis

/**
 * Prints the name and authority code (if any) of the given object.
 *
 * @param  object      the object for which to print name and identifier.
 * @param  idRequired  {@code true} for printing the name only if an identifier is present.
 * @return whether this method has printed something.
 */
private boolean printNameAndIdentifier(final IdentifiedObject object, final boolean idRequired) {
  final String identifier = IdentifiedObjects.toString(IdentifiedObjects.getIdentifier(object, null));
  if (idRequired && identifier == null) {
    return false;
  }
  outHeader.append(object.getName().getCode());
  if (identifier != null) {
    outHeader.append(' ');
    if (colors) {
      outHeader.append(X364.FOREGROUND_CYAN.sequence());
    }
    outHeader.append('(');
    outHeader.append(identifier);
    outHeader.append(')');
    if (colors) {
      outHeader.append(X364.FOREGROUND_DEFAULT.sequence());
    }
  }
  if (!idRequired) {
    outHeader.nextLine();
  }
  return true;
}

代码示例来源:origin: apache/sis

isNext = false;
if (colors) {
  outHeader.append(X364.FOREGROUND_GREEN.sequence());
  outHeader.append(X364.FOREGROUND_DEFAULT.sequence());

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com