本文整理汇总了Java中com.trollworks.toolkit.utility.text.Numbers.extractInteger方法的典型用法代码示例。如果您正苦于以下问题:Java Numbers.extractInteger方法的具体用法?Java Numbers.extractInteger怎么用?Java Numbers.extractInteger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.trollworks.toolkit.utility.text.Numbers
的用法示例。
在下文中一共展示了Numbers.extractInteger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeBestWeaponDefense
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
private void writeBestWeaponDefense(BufferedWriter out, Function<MeleeWeaponStats, String> resolver) throws IOException {
String best = "-";
int bestValue = Integer.MIN_VALUE;
for (WeaponDisplayRow row : new FilteredIterator<>(mSheet.getMeleeWeaponOutline().getModel().getRows(), WeaponDisplayRow.class)) {
MeleeWeaponStats weapon = (MeleeWeaponStats) row.getWeapon();
String result = resolver.apply(weapon).trim();
if (result.length() > 0 && !"No".equals(result)) {
int value = Numbers.extractInteger(result, 0, false);
if (value > bestValue) {
bestValue = value;
best = result;
}
}
}
writeEncodedText(out, best);
}
示例2: getMinStrengthValue
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
/** @return The minimum ST to use this weapon, or -1 if there is none. */
public int getMinStrengthValue() {
StringBuilder builder = new StringBuilder();
int count = mStrength.length();
boolean started = false;
for (int i = 0; i < count; i++) {
char ch = mStrength.charAt(i);
if (Character.isDigit(ch)) {
builder.append(ch);
started = true;
} else if (started) {
break;
}
}
return started ? Numbers.extractInteger(builder.toString(), -1, false) : -1;
}
示例3: costTypeChanged
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
private void costTypeChanged() {
boolean hasLevels = hasLevels();
if (hasLevels) {
mLevelField.setText(Numbers.format(mLastLevel));
} else {
mLastLevel = Numbers.extractInteger(mLevelField.getText(), 0, true);
mLevelField.setText(EMPTY);
}
mLevelField.setEnabled(hasLevels);
updateCostField();
updateCostModifier();
}
示例4: getCurrentTechLevel
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
private static int getCurrentTechLevel(Equipment equipment) {
String tl = equipment.getTechLevel();
if (tl != null) {
tl = tl.trim();
if (!tl.isEmpty()) {
for (int i = tl.length(); --i >= 0;) {
if (!Character.isDigit(tl.charAt(i))) {
return -1;
}
}
return Numbers.extractInteger(tl, -1, 0, Integer.MAX_VALUE, false);
}
}
return -1;
}
示例5: getCurrentTechLevel
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
private static int getCurrentTechLevel(Skill skill) {
String tl = skill.getTechLevel();
if (tl != null) {
tl = tl.trim();
if (!tl.isEmpty()) {
for (int i = tl.length(); --i >= 0;) {
if (!Character.isDigit(tl.charAt(i))) {
return -1;
}
}
return Numbers.extractInteger(tl, -1, 0, Integer.MAX_VALUE, false);
}
}
return -1;
}
示例6: processStyleIndentWarning
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
private static boolean processStyleIndentWarning(String key, BufferedWriter out, ListRow row) throws IOException {
if (key.equals(KEY_STYLE_INDENT_WARNING)) {
StringBuilder style = new StringBuilder();
int depth = row.getDepth();
if (depth > 0) {
style.append(" style=\"padding-left: ");
style.append(depth * 12);
style.append("px;");
}
if (!row.isSatisfied()) {
if (style.length() == 0) {
style.append(" style=\"");
}
style.append(" color: red;");
}
if (style.length() > 0) {
style.append("\" ");
out.write(style.toString());
}
} else if (key.startsWith(KEY_PREFIX_DEPTH)) {
int amt = Numbers.extractInteger(key.substring(6), 1, false);
out.write("" + amt * row.getDepth());
} else if (key.equals(KEY_SATISFIED)) {
out.write(row.isSatisfied() ? "Y" : "N");
} else {
return false;
}
return true;
}
示例7: getCurrentTechLevel
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
private static int getCurrentTechLevel(Spell spell) {
String tl = spell.getTechLevel();
if (tl != null) {
tl = tl.trim();
if (!tl.isEmpty()) {
for (int i = tl.length(); --i >= 0;) {
if (!Character.isDigit(tl.charAt(i))) {
return -1;
}
}
return Numbers.extractInteger(tl, -1, 0, Integer.MAX_VALUE, false);
}
}
return -1;
}
示例8: getCost
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
private int getCost() {
return Numbers.extractInteger(mCostField.getText(), 0, true);
}
示例9: getLevels
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
private int getLevels() {
return Numbers.extractInteger(mLevelField.getText(), 0, true);
}
示例10: getQty
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
private int getQty() {
if (mQtyField != null) {
return Numbers.extractInteger(mQtyField.getText(), 0, true);
}
return 1;
}
示例11: getSkillPoints
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
private int getSkillPoints() {
return Numbers.extractInteger(mPointsField.getText(), 0, true);
}
示例12: getPoints
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
private int getPoints() {
return Numbers.extractInteger(mPointsField.getText(), 0, true);
}
示例13: getDefaultModifier
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
private int getDefaultModifier() {
return Numbers.extractInteger(mDefaultModifierField.getText(), 0, true);
}
示例14: getLimitModifier
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
private int getLimitModifier() {
return Numbers.extractInteger(mLimitField.getText(), 0, true);
}
示例15: getSpellPoints
import com.trollworks.toolkit.utility.text.Numbers; //导入方法依赖的package包/类
private int getSpellPoints() {
return Numbers.extractInteger(mPointsField.getText(), 0, true);
}