当前位置: 首页>>代码示例>>Java>>正文


Java CmpPivot类代码示例

本文整理汇总了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;
}
 
开发者ID:medic,项目名称:javarosa,代码行数:47,代码来源:XPathCmpExpr.java

示例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;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:47,代码来源:XPathCmpExpr.java

示例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;
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:47,代码来源:XPathCmpExpr.java


注:本文中的org.javarosa.core.model.condition.pivot.CmpPivot类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。