本文整理汇总了Java中java.util.DuplicateFormatFlagsException类的典型用法代码示例。如果您正苦于以下问题:Java DuplicateFormatFlagsException类的具体用法?Java DuplicateFormatFlagsException怎么用?Java DuplicateFormatFlagsException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DuplicateFormatFlagsException类属于java.util包,在下文中一共展示了DuplicateFormatFlagsException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parse
import java.util.DuplicateFormatFlagsException; //导入依赖的package包/类
public static Flags parse(String s) {
char[] ca = s.toCharArray();
Flags f = new Flags(0);
for (int i = 0; i < ca.length; i++) {
Flags v = parse(ca[i]);
if (f.contains(v))
throw new DuplicateFormatFlagsException(v.toString());
f.add(v);
}
return f;
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:12,代码来源:F3Formatter.java
示例2: test_duplicateFormatFlagsException
import java.util.DuplicateFormatFlagsException; //导入依赖的package包/类
/**
* @tests java.util.DuplicateFormatFlagsException#DuplicateFormatFlagsException(String)
*/
public void test_duplicateFormatFlagsException() {
try {
new DuplicateFormatFlagsException(null);
fail("should throw NullPointerException.");
} catch (NullPointerException e) {
// desired
}
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:12,代码来源:DuplicateFormatFlagsExceptionTest.java
示例3: test_getFlags
import java.util.DuplicateFormatFlagsException; //导入依赖的package包/类
/**
* @tests java.util.DuplicateFormatFlagsException#getFlags()
*/
public void test_getFlags() {
String strFlags = "MYTESTFLAGS";
DuplicateFormatFlagsException duplicateFormatException = new DuplicateFormatFlagsException(
strFlags);
assertEquals(strFlags, duplicateFormatException.getFlags());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:10,代码来源:DuplicateFormatFlagsExceptionTest.java
示例4: test_getMessage
import java.util.DuplicateFormatFlagsException; //导入依赖的package包/类
/**
* @tests java.util.DuplicateFormatFlagsException#getMessage()
*/
public void test_getMessage() {
String strFlags = "MYTESTFLAGS";
DuplicateFormatFlagsException duplicateFormatException = new DuplicateFormatFlagsException(
strFlags);
assertTrue(null != duplicateFormatException.getFlags());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:11,代码来源:DuplicateFormatFlagsExceptionTest.java
示例5: assertDeserialized
import java.util.DuplicateFormatFlagsException; //导入依赖的package包/类
public void assertDeserialized(Serializable initial,
Serializable deserialized) {
SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
deserialized);
DuplicateFormatFlagsException initEx = (DuplicateFormatFlagsException) initial;
DuplicateFormatFlagsException desrEx = (DuplicateFormatFlagsException) deserialized;
assertEquals("Flags", initEx.getFlags(), desrEx.getFlags());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:12,代码来源:DuplicateFormatFlagsExceptionTest.java
示例6: parse
import java.util.DuplicateFormatFlagsException; //导入依赖的package包/类
public static Flags parse(String s) {
char[] ca = s.toCharArray();
Flags f = new Flags(0);
for (int i = 0; i < ca.length; i++) {
Flags v = parse(ca[i]);
if (f.contains(v))
throw new DuplicateFormatFlagsException(v.toString());
f.add(v);
}
return f;
}
开发者ID:bazelbuild,项目名称:bazel,代码行数:12,代码来源:Flags.java
示例7: parseFlags
import java.util.DuplicateFormatFlagsException; //导入依赖的package包/类
private void parseFlags() {
while (index < format.length()) {
char c = format.charAt(index);
int flag;
switch (c) {
case '-':
flag = TFormattableFlags.LEFT_JUSTIFY;
break;
case '#':
flag = TFormattableFlags.ALTERNATE;
break;
case '+':
flag = TFormattableFlags.SIGNED;
break;
case ' ':
flag = TFormattableFlags.LEADING_SPACE;
break;
case '0':
flag = TFormattableFlags.ZERO_PADDED;
break;
case ',':
flag = TFormattableFlags.GROUPING_SEPARATOR;
break;
case '(':
flag = TFormattableFlags.PARENTHESIZED_NEGATIVE;
break;
case '<':
flag = TFormattableFlags.PREVIOUS_ARGUMENT;
break;
default:
return;
}
if ((flags & flag) != 0) {
throw new DuplicateFormatFlagsException(String.valueOf(c));
}
flags |= flag;
index++;
}
}
开发者ID:konsoletyper,项目名称:teavm,代码行数:40,代码来源:TFormatter.java
示例8: testSerializationSelf
import java.util.DuplicateFormatFlagsException; //导入依赖的package包/类
/**
* @tests serialization/deserialization.
*/
public void testSerializationSelf() throws Exception {
SerializationTest.verifySelf(new DuplicateFormatFlagsException(
"TESTDESC"), exComparator);
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:9,代码来源:DuplicateFormatFlagsExceptionTest.java
示例9: testSerializationCompatibility
import java.util.DuplicateFormatFlagsException; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility with RI.
*/
public void testSerializationCompatibility() throws Exception {
SerializationTest.verifyGolden(this, new DuplicateFormatFlagsException(
"TESTDESC"), exComparator);
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:9,代码来源:DuplicateFormatFlagsExceptionTest.java
示例10: setFlag
import java.util.DuplicateFormatFlagsException; //导入依赖的package包/类
boolean setFlag(int ch) {
boolean dupe;
switch (ch) {
case ',':
dupe = flagComma;
flagComma = true;
break;
case '-':
dupe = flagMinus;
flagMinus = true;
break;
case '(':
dupe = flagParenthesis;
flagParenthesis = true;
break;
case '+':
dupe = flagPlus;
flagPlus = true;
break;
case '#':
dupe = flagSharp;
flagSharp = true;
break;
case ' ':
dupe = flagSpace;
flagSpace = true;
break;
case '0':
dupe = flagZero;
flagZero = true;
break;
default:
return false;
}
if (dupe) {
// The RI documentation implies we're supposed to report all the flags, not just
// the first duplicate, but the RI behaves the same as we do.
throw new DuplicateFormatFlagsException(String.valueOf(ch));
}
if (strFlags == null) {
strFlags = new StringBuilder(7); // There are seven possible flags.
}
strFlags.append((char) ch);
return true;
}
开发者ID:tilal6991,项目名称:HoloIRC,代码行数:46,代码来源:Formatter.java
示例11: duplicateFlag
import java.util.DuplicateFormatFlagsException; //导入依赖的package包/类
@Test(expected = DuplicateFormatFlagsException.class)
public void duplicateFlag() {
new Formatter().format("%--s", "q");
}
开发者ID:konsoletyper,项目名称:teavm,代码行数:5,代码来源:FormatterTest.java
注:本文中的java.util.DuplicateFormatFlagsException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论