List of usage examples for java.lang Double compare
public static int compare(double d1, double d2)
From source file:it_minds.dk.eindberetningmobil_android.models.DrivingReport.java
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DrivingReport that = (DrivingReport) o; if (haveEditedDistance != that.haveEditedDistance) return false; if (startedAtHome != that.startedAtHome) return false; if (endedAtHome != that.endedAtHome) return false; if (fourKMRule != that.fourKMRule) return false; if (Double.compare(that.distanceInMeters, distanceInMeters) != 0) return false; if (purpose != null ? !purpose.equals(that.purpose) : that.purpose != null) return false; if (orgLocation != null ? !orgLocation.equals(that.orgLocation) : that.orgLocation != null) return false; if (Rate != null ? !Rate.equals(that.Rate) : that.Rate != null) return false; if (extraDescription != null ? !extraDescription.equals(that.extraDescription) : that.extraDescription != null) return false; if (startTime != null ? !startTime.equals(that.startTime) : that.startTime != null) return false; if (endTime != null ? !endTime.equals(that.endTime) : that.endTime != null) return false; return !(gpsPoints != null ? !gpsPoints.equals(that.gpsPoints) : that.gpsPoints != null); }
From source file:Main.java
/** * Finds the first occurrence in <code>double</code> array from specified given position and upto given length. *///from w w w. j av a 2 s. co m public static int indexOf(double[] array, double value, int startIndex, int endIndex) { for (int i = startIndex; i < endIndex; i++) { if (Double.compare(array[i], value) == 0) { return i; } } return -1; }
From source file:com.opengamma.analytics.financial.equity.option.EquityIndexOptionDefinition.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }//from ww w . j a v a 2 s .c o m if (!(obj instanceof EquityIndexOptionDefinition)) { return false; } final EquityIndexOptionDefinition other = (EquityIndexOptionDefinition) obj; if (Double.compare(_strike, other._strike) != 0) { return false; } if (_isCall != other._isCall) { return false; } if (_exerciseType != other._exerciseType) { return false; } if (_settlementType != other._settlementType) { return false; } if (Double.compare(_pointValue, other._pointValue) != 0) { return false; } if (!ObjectUtils.equals(_expiryDT, other._expiryDT)) { return false; } if (!ObjectUtils.equals(_currency, other._currency)) { return false; } if (!ObjectUtils.equals(_settlementDate, other._settlementDate)) { return false; } return true; }
From source file:br.com.OCTur.view.ContigenteController.java
@FXML public void carregarDados(ActionEvent ae) { inicio = 0;//from w w w . ja v a2 s .com aeroportos = new ArrayList<>(); companhias = new ArrayList<>(); aviaos = new ArrayList<>(); if (rbAeroporto.isSelected()) { for (Aeroporto aeroporto : new AeroportoDAO().pegarTodos()) { if (rbTudo.isSelected()) { aeroportos.add(new EntidadeGrafico<>(aeroporto, new PassagemDAO().pegarPorDestino(aeroporto) .stream().mapToInt(Passagem::getNumeropessoas).sum())); } else { aeroportos.add(new EntidadeGrafico<>(aeroporto, new PassagemDAO() .pegarPorDestinoInicioFim(aeroporto, DateFormatter.toDate(dpInicio.getValue()), DateFormatter.toDate(dpFim.getValue())) .stream().mapToInt(Passagem::getNumeropessoas).sum())); } } MAX = aeroportos.stream().mapToDouble(EntidadeGrafico::getValue).max().orElse(0); MIN = aeroportos.stream().mapToDouble(EntidadeGrafico::getValue).min().orElse(0); aeroportos.sort((EntidadeGrafico<Aeroporto> o1, EntidadeGrafico<Aeroporto> o2) -> Double .compare(o1.getValue(), o2.getValue())); } else if (rbAviao.isSelected()) { for (Aviao aviao : new AviaoDAO().pegarPorCompanhia(companhia)) { double total = 0; if (rbTudo.isSelected()) { total = (new PassagemDAO().pegarPorAviao(aviao).stream().mapToDouble(Passagem::getNumeropessoas) .sum() / new VooDAO().pegarPorAviao(aviao).size()) * 100 / aviao.getCapacidade(); } else { total = (new PassagemDAO() .pegarPorAviao(aviao, DateFormatter.toDate(dpInicio.getValue()), DateFormatter.toDate(dpFim.getValue())) .stream().mapToDouble(Passagem::getNumeropessoas).sum() / new VooDAO().pegarPorAviao(aviao, DateFormatter.toDate(dpInicio.getValue()), DateFormatter.toDate(dpFim.getValue())).size()) * 100 / aviao.getCapacidade(); } aviaos.add(new EntidadeGrafico<>(aviao, total)); } MAX = aviaos.stream().mapToDouble(EntidadeGrafico::getValue).max().orElse(0); MIN = aviaos.stream().mapToDouble(EntidadeGrafico::getValue).min().orElse(0); aviaos.sort((EntidadeGrafico<Aviao> o1, EntidadeGrafico<Aviao> o2) -> Double.compare(o1.getValue(), o2.getValue())); } else { for (Companhia companhia : new CompanhiaDAO().pegarTodos()) { if (rbTudo.isSelected()) { companhias.add(new EntidadeGrafico<>(companhia, new PassagemDAO().pegarPorCompanhia(companhia) .stream().mapToInt(Passagem::getNumeropessoas).sum())); } else { companhias.add(new EntidadeGrafico<>(companhia, new PassagemDAO() .pegarPorCompanhia(companhia, DateFormatter.toDate(dpInicio.getValue()), DateFormatter.toDate(dpFim.getValue())) .stream().mapToInt(Passagem::getNumeropessoas).sum())); } } MAX = companhias.stream().mapToDouble(EntidadeGrafico::getValue).max().orElse(0); MIN = companhias.stream().mapToDouble(EntidadeGrafico::getValue).min().orElse(0); companhias.sort((EntidadeGrafico<Companhia> o1, EntidadeGrafico<Companhia> o2) -> Double .compare(o1.getValue(), o2.getValue())); } eCarregarGraficosActionEvent(ae); }
From source file:io.horizondb.model.core.fields.DecimalField.java
/** * {@inheritDoc} */ @Override public int compareTo(Field other) { return Double.compare(getDouble(), other.getDouble()); }
From source file:org.stockchart.core.AxisRange.java
/** * Expands range's auto values //from w w w.j ava 2 s .c o m * *<p> *If auto values are not set, then they will be set; otherwise *minimum value will be set only if minValue is less than min auto value, *and maximum only if maxValue is greater than max auto value * * @param maxValue new maximum value * @param minValue new minimum value */ public void expandAutoValues(double maxValue, double minValue) { if (0 == Double.compare(fMinAutoValue, Double.NaN)) fMinAutoValue = minValue; else if (minValue < fMinAutoValue) fMinAutoValue = minValue; if (0 == Double.compare(fMaxAutoValue, Double.NaN)) fMaxAutoValue = maxValue; else if (maxValue > fMaxAutoValue) fMaxAutoValue = maxValue; }
From source file:org.openmrs.ConceptWord.java
/** * @see java.lang.Comparable#compareTo(java.lang.Object) */ public int compareTo(ConceptWord word) { return Double.compare(word.getWeight(), weight); }
From source file:org.openiot.gsn.http.rest.WPPushDelivery.java
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; WPPushDelivery that = (WPPushDelivery) o; if (Double.compare(that.notificationId, notificationId) != 0) return false; if (httpPost != null ? !httpPost.getURI().equals(that.httpPost.getURI()) : that.httpPost != null) return false; return true;/* ww w . ja v a 2 s .c o m*/ }
From source file:org.talend.dataquality.record.linkage.grouping.callback.MultiPassGroupingCallBack.java
@Override public void onNewMerge(Record record) { // record must be RichRecord from DQ grouping implementation. RichRecord richRecord = (RichRecord) record; richRecord.setMaster(true);/* w w w. j a v a 2 s. c om*/ richRecord.setScore(1.0); if (record.getGroupId() != null) { richRecord.setMerged(true); richRecord.setGrpSize(richRecord.getRelatedIds().size()); if (Double.compare(richRecord.getGroupQuality(), 0.0d) == 0) { // group quality will be the confidence (score) or old group quality decide that by who is minimum. Double oldGrpQuality = getOldGrpQuality(richRecord); richRecord.setGroupQuality(getMergeGQ(oldGrpQuality, record.getConfidence())); } } }
From source file:org.diorite.TeleportData.java
@Override public boolean equals(final Object o) { if (this == o) { return true; }/* w ww .ja v a 2s . c o m*/ if (!(o instanceof TeleportData)) { return false; } final TeleportData that = (TeleportData) o; return (this.isPitchRelatvie == that.isPitchRelatvie) && (this.isXRelatvie == that.isXRelatvie) && (this.isYRelatvie == that.isYRelatvie) && (this.isYawRelatvie == that.isYawRelatvie) && (this.isZRelatvie == that.isZRelatvie) && (Float.compare(that.pitch, this.pitch) == 0) && (Double.compare(that.x, this.x) == 0) && (Double.compare(that.y, this.y) == 0) && (Float.compare(that.yaw, this.yaw) == 0) && (Double.compare(that.z, this.z) == 0); }