本文整理汇总了Java中org.javarosa.core.model.condition.pivot.CmpPivot类的典型用法代码示例。如果您正苦于以下问题:Java CmpPivot类的具体用法?Java CmpPivot怎么用?Java CmpPivot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CmpPivot类属于org.javarosa.core.model.condition.pivot包,在下文中一共展示了CmpPivot类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handled
import org.javarosa.core.model.condition.pivot.CmpPivot; //导入依赖的package包/类
private boolean handled(Object a, Object b, Object sentinal, List<Object> pivots) throws UnpivotableExpressionException {
if(sentinal == a) {
if(b == null) {
//Can't pivot on an expression which is derived from pivoted expressions
throw new UnpivotableExpressionException();
} else if(sentinal == b) {
//WTF?
throw new UnpivotableExpressionException();
} else {
Double val = null;
//either of
if(b instanceof Double) {
val = (Double)b;
} else {
//These are probably the
if(b instanceof Integer) {
val = new Double(((Integer) b).doubleValue());
} else if(b instanceof Long) {
val = new Double(((Long) b).doubleValue());
} else if(b instanceof Float) {
val = new Double(((Float) b).doubleValue());
} else if(b instanceof Short) {
val = new Double(((Short) b).shortValue());
} else if(b instanceof Byte) {
val = new Double(((Byte) b).byteValue());
} else {
if(b instanceof String) {
try {
//TODO: Too expensive?
val = (Double)new DecimalData().cast(new UncastData((String)b)).getValue();
} catch(Exception e) {
throw new UnpivotableExpressionException("Unrecognized numeric data in cmp expression: " + b);
}
} else {
throw new UnpivotableExpressionException("Unrecognized numeric data in cmp expression: " + b);
}
}
}
pivots.add(new CmpPivot(val.doubleValue(), op));
return true;
}
}
return false;
}
示例2: handled
import org.javarosa.core.model.condition.pivot.CmpPivot; //导入依赖的package包/类
private boolean handled(Object a, Object b, Object sentinal, Vector<Object> pivots) throws UnpivotableExpressionException {
if (sentinal == a) {
if (b == null) {
//Can't pivot on an expression which is derived from pivoted expressions
throw new UnpivotableExpressionException();
} else if (sentinal == b) {
//WTF?
throw new UnpivotableExpressionException();
} else {
Double val = null;
//either of
if (b instanceof Double) {
val = (Double)b;
} else {
//These are probably the
if (b instanceof Integer) {
val = new Double(((Integer)b).doubleValue());
} else if (b instanceof Long) {
val = new Double(((Long)b).doubleValue());
} else if (b instanceof Float) {
val = new Double(((Float)b).doubleValue());
} else if (b instanceof Short) {
val = new Double(((Short)b).shortValue());
} else if (b instanceof Byte) {
val = new Double(((Byte)b).byteValue());
} else {
if (b instanceof String) {
try {
//TODO: Too expensive?
val = (Double)new DecimalData().cast(new UncastData((String)b)).getValue();
} catch (Exception e) {
throw new UnpivotableExpressionException("Unrecognized numeric data in cmp expression: " + b);
}
} else {
throw new UnpivotableExpressionException("Unrecognized numeric data in cmp expression: " + b);
}
}
}
pivots.addElement(new CmpPivot(val.doubleValue(), op));
return true;
}
}
return false;
}
示例3: handled
import org.javarosa.core.model.condition.pivot.CmpPivot; //导入依赖的package包/类
private boolean handled(Object a, Object b, Object sentinal, Vector<Object> pivots) throws UnpivotableExpressionException {
if (sentinal == a) {
if (b == null) {
//Can't pivot on an expression which is derived from pivoted expressions
throw new UnpivotableExpressionException();
} else if (sentinal == b) {
//WTF?
throw new UnpivotableExpressionException();
} else {
Double val = null;
//either of
if (b instanceof Double) {
val = (Double)b;
} else {
//These are probably the
if (b instanceof Integer) {
val = ((Integer)b).doubleValue();
} else if (b instanceof Long) {
val = ((Long)b).doubleValue();
} else if (b instanceof Float) {
val = ((Float)b).doubleValue();
} else if (b instanceof Short) {
val = new Double((Short)b);
} else if (b instanceof Byte) {
val = new Double((Byte)b);
} else {
if (b instanceof String) {
try {
//TODO: Too expensive?
val = (Double)new DecimalData().cast(new UncastData((String)b)).getValue();
} catch (Exception e) {
throw new UnpivotableExpressionException("Unrecognized numeric data in cmp expression: " + b);
}
} else {
throw new UnpivotableExpressionException("Unrecognized numeric data in cmp expression: " + b);
}
}
}
pivots.addElement(new CmpPivot(val, op));
return true;
}
}
return false;
}