public BigDecimal get_ymax() { BigDecimal ymax = values.get(0).gety(); for (ValuePair pair : values) { if (pair.gety().compareTo(ymax) > 0) { ymax = pair.gety(); } } return ymax; }
public BigDecimal get_ymin() { BigDecimal ymin = values.get(0).gety(); for (ValuePair pair : values) { if (pair.gety().compareTo(ymin) < 0) { ymin = pair.gety(); } } return ymin; }
public void x_truncate(BigDecimal xmin, BigDecimal xmax) { Iterator<ValuePair> iter = this.values.iterator(); while (iter.hasNext()) { ValuePair next = iter.next(); if (next.getx().compareTo(xmin) == -1 || next.getx().compareTo(xmax) == 1) { iter.remove(); } } }
@Override public void initialize(URL location, ResourceBundle resources) { // TODO 自動生成されたメソッド・スタブ addOption.setOnAction( event -> { for (int i = 0; i < cmb.size(); i++) { // System.out.println(cmb.get(i).getValue()); if (cmb.get(i).getValue() == null) { break; } else if (i == cmb.size() - 1) { addTask.setDisable(false); } } }); addTask.setOnAction( event -> { try { String url = webView.getEngine().getLocation(); System.out.println(url); Document document = Jsoup.connect(url).get(); Elements input = document.select("input"); Map params = new HashMap<String, String>(); for (ComboBox cmbx : cmb) { ValuePair vp = (ValuePair) cmbx.getValue(); params.put(vp.getName(), vp.getvalue()); } // System.out.println(input.select("[name=shop_bid]").first()); // System.out.println(input.select("[name=shop_bid]").first().val()); params.put("shop_bid", input.select("[name=shop_bid]").first().val()); params.put("item_id", input.select("[name=item_id]").first().val()); params.put("__event", input.select("[name=__event]").first().val()); params.put("units", "1"); Map map = new HashMap<String, Long>(); // System.out.println(document.select("#stime").size()); if (document.select("#stime").size() != 0) { System.out.println(document.select("#stime")); map.put("stime", Long.parseLong((input.select("#stime").first().val()))); map.put("etime", Long.parseLong((input.select("#etime").first().val()))); } else { map = null; } BuyTask task = new BuyTask(url, params, map); task.call(); this.getScene().getWindow().hide(); } catch (Exception e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } }); }
public void y_truncate(BigDecimal ymin, BigDecimal ymax) { Iterator<ValuePair> iter = this.values.iterator(); while (iter.hasNext()) { ValuePair next = iter.next(); if (next.gety().compareTo(ymin) == -1 || next.gety().compareTo(ymax) == 1) { System.out.println("asd: " + next.gety() + ymax); iter.remove(); } } }
@Override protected BindingSet getNextElement() throws QueryEvaluationException { again: while (true) { while (!currentIter.hasNext()) { Iterations.closeCloseable(currentIter); createIteration(); // stop condition: if the iter is an EmptyIteration if (currentIter instanceof EmptyIteration<?, ?>) { break; } } while (currentIter.hasNext()) { BindingSet nextElement = currentIter.next(); if (!startVarFixed && !endVarFixed && currentVp != null) { Value startValue = currentVp.getStartValue(); if (startValue != null) { nextElement = new QueryBindingSet(nextElement); ((QueryBindingSet) nextElement).addBinding(startVar.getName(), startValue); } } Value v1, v2; if (startVarFixed && endVarFixed && currentLength > 2) { v1 = getVarValue(startVar, startVarFixed, nextElement); v2 = nextElement.getValue("END_" + JOINVAR_PREFIX + pathExpression.hashCode()); } else if (startVarFixed && endVarFixed && currentLength == 2) { v1 = getVarValue(startVar, startVarFixed, nextElement); v2 = nextElement.getValue( JOINVAR_PREFIX + (currentLength - 1) + "-" + pathExpression.hashCode()); } else { v1 = getVarValue(startVar, startVarFixed, nextElement); v2 = getVarValue(endVar, endVarFixed, nextElement); } if (!isCyclicPath(v1, v2)) { ValuePair vp = new ValuePair(v1, v2); if (reportedValues.contains(vp)) { // new arbitrary-length path semantics: filter out // duplicates if (currentIter.hasNext()) { continue; } else { // if the current iter is exhausted, we need to check // that no further paths of greater length still exists. continue again; } } if (startVarFixed && endVarFixed) { Value endValue = getVarValue(endVar, endVarFixed, nextElement); if (endValue.equals(v2)) { add(reportedValues, vp); if (!v1.equals(v2)) { addToQueue(valueQueue, vp); } if (!nextElement.hasBinding(startVar.getName())) { ((QueryBindingSet) nextElement).addBinding(startVar.getName(), v1); } if (!nextElement.hasBinding(endVar.getName())) { ((QueryBindingSet) nextElement).addBinding(endVar.getName(), v2); } return nextElement; } else { if (add(unreportedValues, vp)) { if (!v1.equals(v2)) { addToQueue(valueQueue, vp); } } continue again; } } else { add(reportedValues, vp); if (!v1.equals(v2)) { addToQueue(valueQueue, vp); } if (!nextElement.hasBinding(startVar.getName())) { ((QueryBindingSet) nextElement).addBinding(startVar.getName(), v1); } if (!nextElement.hasBinding(endVar.getName())) { ((QueryBindingSet) nextElement).addBinding(endVar.getName(), v2); } return nextElement; } } else { continue again; } } // if we're done, throw away the cached lists of values to avoid // hogging resources reportedValues.clear(); unreportedValues.clear(); valueQueue.clear(); return null; } }
private void createIteration() throws QueryEvaluationException { if (currentLength == 0L) { ZeroLengthPath zlp = new ZeroLengthPath(scope, startVar, endVar, contextVar); currentIter = this.evaluationStrategyImpl.evaluate(zlp, bindings); currentLength++; } else if (currentLength == 1) { TupleExpr pathExprClone = pathExpression.clone(); if (startVarFixed && endVarFixed) { Var replacement = createAnonVar(JOINVAR_PREFIX + currentLength + "-" + pathExpression.hashCode()); VarReplacer replacer = new VarReplacer(endVar, replacement, 0, false); pathExprClone.visit(replacer); } currentIter = this.evaluationStrategyImpl.evaluate(pathExprClone, bindings); currentLength++; } else { currentVp = valueQueue.poll(); if (currentVp != null) { TupleExpr pathExprClone = pathExpression.clone(); if (startVarFixed && endVarFixed) { Var startReplacement = createAnonVar(JOINVAR_PREFIX + currentLength + "-" + pathExpression.hashCode()); Var endReplacement = createAnonVar("END_" + JOINVAR_PREFIX + pathExpression.hashCode()); startReplacement.setAnonymous(false); endReplacement.setAnonymous(false); Value v = currentVp.getEndValue(); startReplacement.setValue(v); VarReplacer replacer = new VarReplacer(startVar, startReplacement, 0, false); pathExprClone.visit(replacer); replacer = new VarReplacer(endVar, endReplacement, 0, false); pathExprClone.visit(replacer); } else { Var toBeReplaced; Value v; if (!endVarFixed) { toBeReplaced = startVar; v = currentVp.getEndValue(); } else { toBeReplaced = endVar; v = currentVp.getStartValue(); } Var replacement = createAnonVar(JOINVAR_PREFIX + currentLength + "-" + pathExpression.hashCode()); replacement.setValue(v); VarReplacer replacer = new VarReplacer(toBeReplaced, replacement, 0, false); pathExprClone.visit(replacer); } currentIter = this.evaluationStrategyImpl.evaluate(pathExprClone, bindings); } else { currentIter = new EmptyIteration<BindingSet, QueryEvaluationException>(); } currentLength++; } }