本文整理匯總了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;
}