private void cargarVencidoVencer() { String sql = "Select\n" + " Sum(Case When vt_cuenta_corriente.FCHVNC <= NOW() Then vt_cuenta_corriente.IMPNAC Else 0 End) As VENCIDO,\n" + " Sum(Case When vt_cuenta_corriente.FCHVNC > NOW() Then vt_cuenta_corriente.IMPNAC Else 0 End) As VENCER,\n" + " Sum(vt_cuenta_corriente.IMPNAC) As SALDO\n" + "From\n" + " vt_cuenta_corriente Inner Join\n" + " en_entidad On vt_cuenta_corriente.NROCTA = en_entidad.NROCTA Inner Join\n" + " vt_movimiento vt_mov_apl On vt_cuenta_corriente.ID_APL = vt_mov_apl.ID\n" + "HAVING Sum(vt_cuenta_corriente.IMPNAC) <>0"; List<Number> intervals = new ArrayList<Number>(); List<Object[]> resultado = dashboardRN.executeSQL(sql); BigDecimal saldo = BigDecimal.ZERO; if (resultado != null && !resultado.isEmpty()) { for (Object[] r : resultado) { vencido = (Number) r[0]; vencer = (Number) r[1]; saldo = ((BigDecimal) r[2]).setScale(2); if (vencido.equals(0)) { vencido = 0.1; } if (vencer.equals(0)) { vencer = 0.1; } intervals.add(vencido); intervals.add(vencer); } } else { vencido = 1; vencer = 1; saldo = BigDecimal.ZERO; intervals.add(vencido); intervals.add(vencer); } vencidoVencer = new PieChartModel(); vencidoVencer.set("Vencido", vencido); vencidoVencer.set("Vencer", vencer); vencidoVencer.setLegendPosition("e"); vencidoVencer.setShowDataLabels(true); vencidoVencer.setSeriesColors("E53935,43A047"); vencidoVencer.setDiameter(150); vencidoVencer.setTitle("Saldo clientes $ " + saldo); // vencidoVencer.setGaugeLabel("Pendientes Cta. Cte."); }
/** * Tests if this object is equal to another * * @param a_obj the other object * @return true: this object is equal to the other one * @author Klaus Meffert * @since 2.3 */ public boolean equals(final Object a_obj) { if (a_obj == null) { return false; } if (a_obj == this) { return true; } if (!(a_obj instanceof KeyedValues)) { return false; } final KeyedValues kvs = (KeyedValues) a_obj; final int count = size(); if (count != kvs.size()) { return false; } for (int i = 0; i < count; i++) { final Comparable k1 = getKey(i); final Comparable k2 = kvs.getKey(i); if (!k1.equals(k2)) { return false; } final Number v1 = getValue(i); final Number v2 = kvs.getValue(i); if (v1 == null) { if (v2 != null) { return false; } } else { if (!v1.equals(v2)) { return false; } } } return true; }
/** * Create an interval. <code>null</code> should be used to indicate unbound (i.e., infinite * intervals). * * @param lower Interval lower bound * @param upper Interval upper bound * @param inclusiveLower <code>true</code> if lower bound is inclusive, <code>false</code> for * exclusive. Ignored if <code>lower == null</code>. * @param inclusiveUpper <code>true</code> if upper bound is inclusive, <code>false</code> for * exclusive. Ignored if <code>upper == null</code>. */ public ContinuousRealInterval( Number lower, Number upper, boolean inclusiveLower, boolean inclusiveUpper) { if (lower != null && upper != null) { final int cmp = OWLRealUtils.compare(lower, upper); if (cmp > 0) { final String msg = format( "Lower bound of interval (%s) should not be greater than upper bound of interval (%s)", lower, upper); log.severe(msg); throw new IllegalArgumentException(msg); } else if (cmp == 0) { if ((!inclusiveLower || !inclusiveUpper)) { final String msg = "Point intervals must be inclusive"; log.severe(msg); throw new IllegalArgumentException(msg); } } } this.lower = lower; this.upper = upper; this.inclusiveLower = (lower == null) ? false : inclusiveLower; this.inclusiveUpper = (upper == null) ? false : inclusiveUpper; this.point = (lower != null && upper != null && lower.equals(upper)); }
public RateResult calculate(Policy policy) { RateResult result = new RateResult(); EntityQuery query = new EntityQuery(PayTimeRate.class, "timerate"); query.add( new Condition( "timerate.product=:product and timerate.paytime=:paytime", policy.getProduct(), policy.getPaytime())); query.add( new Condition( "timerate.time=:time and timerate.gender=:gender", policy.getTime(), policy.getGender())); query.add(new Condition("timerate.paytype=:paytype", policy.getPaytype())); List<PayTimeRate> rates = entityService.search(query); if (rates.isEmpty()) { return result; } else { PayTimeRate timeRate = rates.get(0); Float rate = timeRate.getAgerates().get(policy.getAge()); result.setRate(rate); Number years = calcYears(policy.getAge(), policy.getPaytime().getDuration()); int countPerYear = policy.getPaytype().getCountPerYear(); if (years.equals(Double.NaN)) { result.setCount(Double.NaN); } else { result.setCount(years.intValue() * countPerYear); } } return result; }
/** * Tests this dataset for equality with an arbitrary object. * * @param obj the object (<code>null</code> permitted). * @return A boolean. */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TestIntervalCategoryDataset)) { return false; } TestIntervalCategoryDataset that = (TestIntervalCategoryDataset) obj; if (!getRowKeys().equals(that.getRowKeys())) { return false; } if (!getColumnKeys().equals(that.getColumnKeys())) { return false; } int rowCount = getRowCount(); int colCount = getColumnCount(); for (int r = 0; r < rowCount; r++) { for (int c = 0; c < colCount; c++) { Number v1 = getValue(r, c); Number v2 = that.getValue(r, c); if (v1 == null) { if (v2 != null) { return false; } } else if (!v1.equals(v2)) { return false; } } } return true; }
/** * determine if a field is not equal-valued, for non-array fields first checks if the OFMatch * wildcard is fully wildcarded for the field. If not, it checks the equality of the field value. * * @param match * @param field * @param equal * @param val1 * @param val2 * @return true if disjoint FlowEntries */ private boolean findDisjoint(int wcard, int field, int[] intersect, Number val1, Number val2) { if (((wcard & field) == field) || (val1.equals(val2))) { updateIntersect(intersect, field); return false; } return true; }
@Test public void testLogin() throws Exception { // Create the file name and hope it's the same as created in Register Account // DateFormat dateFormat = new SimpleDateFormat("YYYYMMDDhh"); // Date date = new Date(); // String date1 = dateFormat.format(date); // File OutputFile = new File("C:\\Temp\\" + date1 + "-outputdata.txt"); File OutputFile = new File("C:\\Users\\uqmpette\\Documents\\MatsTest-outputdata.txt"); String loginUsername = null, loginPwd = ""; if (OutputFile.exists()) { // File already exists, great, it should contain loginEmail // Create Object of java FileReader and BufferedReader class. FileReader FR = new FileReader(OutputFile); BufferedReader BR = new BufferedReader(FR); Number Row = 1; String Content = ""; try { // Loop to read all lines one by one from file and print It. while ((Content = BR.readLine()) != null) { if (Row.equals(1)) { loginUsername = Content; } if (Row.equals(2)) { loginPwd = Content; } Row = 2; } } catch (FileNotFoundException e) { // Display error message if File was not found System.err.println("Unable to find the file"); } catch (IOException e) { // Display error message if an exception is encountered while reading the file System.err.println("Unable to read the file"); } BR.close(); } // Applicant login (SSO) driver.findElement(By.id("userid1")).clear(); driver.findElement(By.id("userid1")).sendKeys(loginUsername); driver.findElement(By.id("pwd")).clear(); driver.findElement(By.id("pwd")).sendKeys(loginPwd); driver.findElement(By.xpath("//*[@id='login']/table/tbody/tr[6]/td[2]/input")).click(); // Thread.sleep(2000); fluentWaitSI.fluentWait(By.id("fldra_HCAD_STUDENT_ADMISSIONS")); }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case EssentialOCLCSPackage.NUMBER_LITERAL_EXP_CS__SYMBOL: return SYMBOL_EDEFAULT == null ? symbol != null : !SYMBOL_EDEFAULT.equals(symbol); } return super.eIsSet(featureID); }
/** * Verifica se um wrapper nao é nulo e diferente de zero. * * @param numero O objeto a ser verificado. * @return true se for válido, false caso contrário. */ public static boolean isNumeroWrapperValido(Number numero) { if (numero == null || numero.equals(0)) { return false; } return true; }
/** * Changes the size of the value change computed by the <code>getNextValue</code> and <code> * getPreviousValue</code> methods. An <code>IllegalArgumentException</code> is thrown if <code> * stepSize</code> is <code>null</code>. * * <p>This method fires a <code>ChangeEvent</code> if the <code>stepSize</code> has changed. * * @param stepSize the size of the value change computed by the <code>getNextValue</code> and * <code>getPreviousValue</code> methods * @see #getNextValue * @see #getPreviousValue * @see #getStepSize * @see SpinnerModel#addChangeListener */ public void setStepSize(Number stepSize) { if (stepSize == null) { throw new IllegalArgumentException("null stepSize"); } if (!stepSize.equals(this.stepSize)) { this.stepSize = stepSize; fireStateChanged(); } }
private static boolean _equalsForNumbers(Number a, Number b) { if ((a == null) || (b == null)) return (a == b); Class<?> ac = a.getClass(); Class<?> bc = b.getClass(); if (ac == bc) return a.equals(b); if ((ac == Long.class) || (ac == Integer.class) || (ac == Short.class) || (ac == Byte.class)) return _equalsForLong(a.longValue(), b, bc); if ((ac == Double.class) || (ac == Float.class)) return _equalsForDouble(a.doubleValue(), b, bc); if (ac == BigInteger.class) return _equalsForBigInteger((BigInteger) a, b, bc); if (ac == BigDecimal.class) return _equalsForBigDecimal((BigDecimal) a, b, bc); return a.equals(b); }
/** * Returns {@code true} if the two vectors are equal to one another. Two {@code Vector} insances * are considered equal if they contain the same number of elements and all corresponding pairs of * {@code Number} values are equal. Two values {@code n1} and {@code n2} are considered equal if * {@code n1.equals(n2)}. */ public static boolean equals(Vector v1, Vector v2) { if (v1.length() == v2.length()) { int length = v1.length(); for (int i = 0; i < length; ++i) { Number n1 = v1.getValue(i); Number n2 = v2.getValue(i); if (!n1.equals(n2)) return false; } return true; } return false; }
public FilterableConstraints union(FilterableConstraints other) { if (other instanceof NumericQueryConstraint && ((NumericQueryConstraint) other).fieldId.equals(this.fieldId)) { final NumericQueryConstraint otherNumeric = ((NumericQueryConstraint) other); final boolean lowEquals = lowerValue.equals(otherNumeric.lowerValue); final boolean upperEquals = upperValue.equals(otherNumeric.upperValue); final boolean replaceMin = (lowerValue.doubleValue() > otherNumeric.lowerValue.doubleValue()); final boolean replaceMax = (upperValue.doubleValue() < otherNumeric.upperValue.doubleValue()); return new NumericQueryConstraint( fieldId, Math.min(this.lowerValue.doubleValue(), otherNumeric.lowerValue.doubleValue()), Math.max(this.upperValue.doubleValue(), otherNumeric.upperValue.doubleValue()), lowEquals ? otherNumeric.inclusiveLow | inclusiveLow : (replaceMin ? otherNumeric.inclusiveLow : inclusiveLow), upperEquals ? otherNumeric.inclusiveHigh | inclusiveHigh : (replaceMax ? otherNumeric.inclusiveHigh : inclusiveHigh)); } return this; }
@Test public void testDropDownMenuOutput(Template template) { renderPage(template, RESET_METHOD); String parentId = getParentId() + "_form:"; String file = parentId + "file"; String filePath = "//div[@id='" + file + "']/div[1]"; String open = parentId + "open:anchor"; String saveAs = parentId + "saveAs:anchor"; String save = parentId + "save:anchor"; String saveAll = parentId + "saveAll:anchor"; String close = parentId + "close:anchor"; String exit = parentId + "exit:anchor"; String menu = file + "_menu"; String separator = parentId + "menuSeparator11"; selenium.mouseOver(filePath); pause(1000, menu); Number width = selenium.getElementWidth(menu); System.out.println(width); if (width.equals(0)) { Assert.fail("Drop down menu has null width"); } if (selenium.getElementPositionTop(menu).intValue() <= 0) { Assert.fail("Drop down menu should have top position more than 0"); } AssertVisible(open); AssertTextEquals(open, "Open", "Open menu Item was not rendered"); AssertVisible(saveAs); AssertTextEquals(saveAs, "Save As...", "Save As... menu Item was not rendered"); AssertVisible(close); AssertTextEquals(close, "Close", "Open menu Item was not rendered"); AssertVisible(exit); AssertTextEquals(exit, "Exit", "Exit menu Item was not rendered"); AssertVisible(parentId + "open:icon", "Icon for menu item was not rendered"); selenium.mouseOver(saveAs); pause(1000, menu); AssertVisible(save); AssertVisible(saveAll); AssertTextEquals(save, "Save", "Save menu Item was not rendered"); AssertTextEquals(saveAll, "Save All", "Save All menu Item was not rendered"); AssertVisible(parentId + "saveAs:folder", "Save as group was not rendered"); assertClassNames( separator, new String[] {"rich-menu-separator"}, "Separator has invalid css class names", true); AssertVisible(separator, "Separator was not output"); }
private boolean isSatisfiedCaseStatement( ICPPExecution stmtExec, IValue controllerValue, ActivationRecord record, ConstexprEvaluationContext context) { if (stmtExec instanceof ExecCase) { ExecCase caseStmtExec = (ExecCase) stmtExec; caseStmtExec = (ExecCase) caseStmtExec.executeForFunctionCall(record, context); Number caseVal = caseStmtExec.getCaseExpressionEvaluation().getValue(null).numberValue(); Number controllerVal = controllerValue.numberValue(); return caseVal.equals(controllerVal); } return stmtExec instanceof ExecDefault; }
private boolean differenceExists(final Number baseValue, final Number workingCopyValue) { boolean differenceExists = false; if (baseValue != null) { if (workingCopyValue != null) { differenceExists = !baseValue.equals(workingCopyValue); } else { differenceExists = true; } } else { differenceExists = workingCopyValue != null; } return differenceExists; }
/** * Tests if this object is equal to another. * * @param o the other object. * @return A boolean. */ public boolean equals(Object o) { if (o == null) { return false; } if (o == this) { return true; } if ((o instanceof KeyedValues2D) == false) { return false; } KeyedValues2D kv2D = (KeyedValues2D) o; if (getRowKeys().equals(kv2D.getRowKeys()) == false) { return false; } if (getColumnKeys().equals(kv2D.getColumnKeys()) == false) { return false; } final int rowCount = getRowCount(); if (rowCount != kv2D.getRowCount()) { return false; } final int colCount = getColumnCount(); if (colCount != kv2D.getColumnCount()) { return false; } for (int r = 0; r < rowCount; r++) { for (int c = 0; c < colCount; c++) { Number v1 = getValue(r, c); Number v2 = kv2D.getValue(r, c); if (v1 == null) { if (v2 != null) { return false; } } else { if (!v1.equals(v2)) { return false; } } } } return true; }
/** * Encodes the number as a JSON string. * * @param number a finite value. May not be {@link Double#isNaN() NaNs} or {@link * Double#isInfinite() infinities}. */ public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Number must be non-null"); } double doubleValue = number.doubleValue(); JSON.checkDouble(doubleValue); // the original returns "-0" instead of "-0.0" for negative zero if (number.equals(NEGATIVE_ZERO)) { return "-0"; } long longValue = number.longValue(); if (doubleValue == (double) longValue) { return Long.toString(longValue); } return number.toString(); }
public boolean getBoolean() throws SQLException { int type = JSONTypes.jsonTypes.get(field.getType()); switch (type) { case JSONTypes.JSON_BOOLEAN: return (boolean) jsonObject; case JSONTypes.JSON_NUMBER: Number number = (Number) jsonObject; return !number.equals((Number) 0); case JSONTypes.JSON_STRING: String string = (String) jsonObject; return !string.isEmpty(); case JSONTypes.JSON_MAP: case JSONTypes.JSON_OBJECT: Map map = (Map) jsonObject; return !map.isEmpty(); case JSONTypes.JSON_ARRAY: List list = (List) jsonObject; return !list.isEmpty(); default: return false; } }
/** * Tests if this object is equal to another. * * @param obj the object (<code>null</code> permitted). * @return A boolean. */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof KeyedValues)) { return false; } KeyedValues that = (KeyedValues) obj; int count = getItemCount(); if (count != that.getItemCount()) { return false; } for (int i = 0; i < count; i++) { Comparable k1 = getKey(i); Comparable k2 = that.getKey(i); if (!k1.equals(k2)) { return false; } Number v1 = getValue(i); Number v2 = that.getValue(i); if (v1 == null) { if (v2 != null) { return false; } } else { if (!v1.equals(v2)) { return false; } } } return true; }
@GET @Path("/process/{processDefId: [a-zA-Z0-9-:\\._]+}") public Response process_procDefId(@PathParam("processDefId") String processId) { Map<String, List<String>> params = getRequestParams(uriInfo); Number statusParam = getNumberParam("status", false, params, getRelativePath(uriInfo), false); String oper = getRelativePath(uriInfo); int[] pageInfo = getPageNumAndPageSize(params, oper); Object result; if (statusParam != null) { if (statusParam.intValue() == ProcessInstance.STATE_ACTIVE) { result = getAuditLogService().findActiveProcessInstances(processId); } else { result = getAuditLogService().findProcessInstances(processId); } } else { result = getAuditLogService().findProcessInstances(processId); } List<ProcessInstanceLog> procInstLogList = (List<ProcessInstanceLog>) result; if (statusParam != null && !statusParam.equals(ProcessInstance.STATE_ACTIVE)) { List<ProcessInstanceLog> filteredProcLogList = new ArrayList<ProcessInstanceLog>(); for (int i = 0; i < procInstLogList.size() && filteredProcLogList.size() < getMaxNumResultsNeeded(pageInfo); ++i) { ProcessInstanceLog procLog = procInstLogList.get(i); if (procLog.getStatus().equals(statusParam.intValue())) { filteredProcLogList.add(procLog); } } } procInstLogList = paginate(pageInfo, procInstLogList); return createCorrectVariant(new JaxbHistoryLogList(procInstLogList), headers); }
@Override public void readSequenceSource(SequenceDefinition def) { if (def == null) return; if (def.getSource() != null) return; StringBuilder result = new StringBuilder(100); String nl = Settings.getInstance().getInternalEditorLineEnding(); result.append("CREATE SEQUENCE "); result.append(def.getSequenceName()); Number minValue = getNumberValue(def, PROP_MIN_VALUE); Number maxValue = getNumberValue(def, PROP_MAX_VALUE); Number startValue = getNumberValue(def, PROP_START_VALUE); Number increment = getNumberValue(def, PROP_INCREMENT); Boolean cycle = (Boolean) def.getSequenceProperty(PROP_CYCLE); Boolean isCached = (Boolean) def.getSequenceProperty(PROP_IS_CACHED); Number cache = (Number) def.getSequenceProperty(PROP_CACHE_SIZE); Number precision = (Number) def.getSequenceProperty(PROP_PRECISION); String type = (String) def.getSequenceProperty(PROP_DATA_TYPE); String userType = (String) def.getSequenceProperty(PROP_USER_DATA_TYPE); String typeToUse = type; if (!type.equals(userType)) { typeToUse = userType; } result.append(nl).append(" AS "); result.append(typeToUse); if (needsPrecision(typeToUse) && precision != null) { result.append('('); result.append(precision.toString()); result.append(')'); } result.append(nl).append(" INCREMENT BY "); result.append(increment); if (minValue != null && !isMinValue(typeToUse, minValue)) { result.append(nl).append(" MINVALUE "); result.append(minValue); } else { result.append(nl).append(" NO MINVALUE"); } if (maxValue != null && !isMaxValue(typeToUse, maxValue)) { result.append(nl).append(" MAXVALUE "); result.append(maxValue); } else { result.append(nl).append(" NO MAXVALUE"); } if (startValue != null) { if (minValue != null && !startValue.equals(minValue) || minValue == null) { result.append(nl).append(" START WITH "); result.append(startValue); } } if (Boolean.TRUE.equals(isCached)) { result.append(nl).append(" CACHE "); if (cache != null && cache.longValue() > 0) result.append(cache); } else { result.append(nl).append(" NOCACHE"); } result.append(nl).append(" "); result.append(cycle ? "CYCLE" : "NOCYCLE"); result.append(';'); result.append(nl); def.setSource(result); }
public Object evaluate( EventBean[] eventsPerStream, boolean isNewData, Collection<EventBean> matchingEvents, ExprEvaluatorContext exprEvaluatorContext) { // Evaluate the child expression Object leftResult = valueExpr.evaluate(eventsPerStream, isNewData, exprEvaluatorContext); if ((matchingEvents == null) || (matchingEvents.size() == 0)) { return true; } // Evaluation event-per-stream EventBean[] events = new EventBean[eventsPerStream.length + 1]; System.arraycopy(eventsPerStream, 0, events, 1, eventsPerStream.length); if (isNot) { // Evaluate each select until we have a match boolean hasNonNullRow = false; boolean hasNullRow = false; for (EventBean theEvent : matchingEvents) { events[0] = theEvent; // Eval filter expression if (filterExpr != null) { Boolean pass = (Boolean) filterExpr.evaluate(events, true, exprEvaluatorContext); if ((pass == null) || (!pass)) { continue; } } if (leftResult == null) { return null; } Object rightResult; if (selectClauseExpr != null) { rightResult = selectClauseExpr.evaluate(events, true, exprEvaluatorContext); } else { rightResult = events[0].getUnderlying(); } if (rightResult != null) { hasNonNullRow = true; if (!mustCoerce) { if (leftResult.equals(rightResult)) { return false; } } else { Number left = coercer.coerceBoxed((Number) leftResult); Number right = coercer.coerceBoxed((Number) rightResult); if (left.equals(right)) { return false; } } } else { hasNullRow = true; } } if ((!hasNonNullRow) || (hasNullRow)) { return null; } return true; } else { // Evaluate each select until we have a match boolean hasNonNullRow = false; boolean hasNullRow = false; for (EventBean theEvent : matchingEvents) { events[0] = theEvent; // Eval filter expression if (filterExpr != null) { Boolean pass = (Boolean) filterExpr.evaluate(events, true, exprEvaluatorContext); if ((pass == null) || (!pass)) { continue; } } if (leftResult == null) { return null; } Object rightResult; if (selectClauseExpr != null) { rightResult = selectClauseExpr.evaluate(events, true, exprEvaluatorContext); } else { rightResult = events[0].getUnderlying(); } if (rightResult != null) { hasNonNullRow = true; if (!mustCoerce) { if (!leftResult.equals(rightResult)) { return false; } } else { Number left = coercer.coerceBoxed((Number) leftResult); Number right = coercer.coerceBoxed((Number) rightResult); if (!left.equals(right)) { return false; } } } else { hasNullRow = true; } } if ((!hasNonNullRow) || (hasNullRow)) { return null; } return true; } }
static boolean equalNumbers(Number arg1, Number arg2) { return arg1.equals(arg2); }