本文整理汇总了Java中com.trollworks.toolkit.utility.text.Numbers.getInteger方法的典型用法代码示例。如果您正苦于以下问题:Java Numbers.getInteger方法的具体用法?Java Numbers.getInteger怎么用?Java Numbers.getInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.trollworks.toolkit.utility.text.Numbers
的用法示例。
在下文中一共展示了Numbers.getInteger方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractFromResolutionString
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
private static PrinterResolution extractFromResolutionString(String buffer) {
if (buffer != null && buffer.length() > 0) {
int sep = buffer.indexOf('x');
int x;
int y;
if (sep != -1 && sep < buffer.length() - 1) {
x = Numbers.getInteger(buffer.substring(0, sep), 0);
y = Numbers.getInteger(buffer.substring(sep + 1), 0);
} else {
x = Numbers.getInteger(buffer, 0);
y = x;
}
if (x < 1 || y < 1) {
return null;
}
return new PrinterResolution(x, y, 1);
}
return null;
}
示例2: applySortConfigInternal
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
private int applySortConfigInternal(String config) {
int result = -1;
if (config != null && config.startsWith("S")) { //$NON-NLS-1$
try {
StringTokenizer tokenizer = new StringTokenizer(config, "\t"); //$NON-NLS-1$
if (Numbers.getInteger(tokenizer.nextToken().substring(1), 0) == CONFIG_VERSION) {
int count = Numbers.getInteger(tokenizer.nextToken(), 0);
if (clearSortInternal()) {
result = 0;
}
for (int i = 0; i < count; i++) {
Column column = getColumnWithID(Numbers.getInteger(tokenizer.nextToken(), 0));
if (column == null) {
throw new Exception();
}
column.setSortCriteria(Numbers.getInteger(tokenizer.nextToken(), -1), Numbers.getBoolean(tokenizer.nextToken()));
if (column.getSortSequence() != -1) {
result = 1;
}
}
}
} catch (Exception exception) {
// It's a bad config... ignore it.
}
}
return result;
}
示例3: readInteger
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
/**
* @param defValue The default value to return if the text cannot be converted to an integer.
* @return The integer value of a call to {@link #readText()}.
*/
public int readInteger(int defValue) throws IOException {
return Numbers.getInteger(readText(), defValue);
}
示例4: getAttributeAsInteger
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
/**
* @param name The attribute name.
* @param defValue The default value to use if the attribute value can't be converted to an
* integer.
* @return The value of the tag.
*/
public int getAttributeAsInteger(String name, int defValue) {
return Numbers.getInteger(mAttributeMap.get(name), defValue);
}