本文整理汇总了Java中org.javarosa.core.model.condition.pivot.IntegerRangeHint类的典型用法代码示例。如果您正苦于以下问题:Java IntegerRangeHint类的具体用法?Java IntegerRangeHint怎么用?Java IntegerRangeHint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IntegerRangeHint类属于org.javarosa.core.model.condition.pivot包,在下文中一共展示了IntegerRangeHint类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: guessMaxStringLength
import org.javarosa.core.model.condition.pivot.IntegerRangeHint; //导入依赖的package包/类
protected int guessMaxStringLength(FormEntryPrompt prompt) throws UnpivotableExpressionException{
//Awful. Need factory for this
//TODO: Negative numbers?
if(template instanceof IntegerData) {
IntegerRangeHint hint = new IntegerRangeHint();
prompt.requestConstraintHint(hint);
IntegerData maxexample = hint.getMax();
IntegerData minexample = hint.getMin();
if(minexample != null) {
if(((Integer)minexample.getValue()).intValue() < 0) {
throw new UnpivotableExpressionException();
}
}
if(maxexample != null) {
int max = ((Integer)maxexample.getValue()).intValue();
if(!hint.isMaxInclusive()) {
max -= 1;
}
return String.valueOf(max).length();
}
}
throw new UnpivotableExpressionException();
}
示例2: assertConstraintMaxMin
import org.javarosa.core.model.condition.pivot.IntegerRangeHint; //导入依赖的package包/类
private void assertConstraintMaxMin(Integer max, Integer min){
IntegerRangeHint hint = new IntegerRangeHint();
FormEntryPrompt prompt = fpi.getFormEntryModel().getQuestionPrompt();
try {
prompt.requestConstraintHint(hint);
if(max != null) {
assert (max.equals(hint.getMax().getValue()));
} else{
assert(hint.getMax() == null);
}
if(min != null) {
assert (min.equals(hint.getMin().getValue()));
} else{
assert(hint.getMin() == null);
}
} catch (UnpivotableExpressionException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
示例3: assertUnpivotable
import org.javarosa.core.model.condition.pivot.IntegerRangeHint; //导入依赖的package包/类
private void assertUnpivotable(){
IntegerRangeHint hint = new IntegerRangeHint();
FormEntryPrompt prompt = fpi.getFormEntryModel().getQuestionPrompt();
try {
prompt.requestConstraintHint(hint);
fail("Should have not been able to pivot with prompt: " + prompt);
} catch (UnpivotableExpressionException e) {
// good
}
}