當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。