List of usage examples for java.lang Long compareTo
public int compareTo(Long anotherLong)
From source file:com.egt.core.util.STP.java
public static boolean esObjetoEnRango(Object objeto, Object minimo, Object maximo) { boolean es = true; EnumTipoDatoPar tipo;//w w w .j a v a2s. co m if (objeto == null) { return false; } else if (objeto instanceof String) { tipo = EnumTipoDatoPar.ALFANUMERICO; } else if (objeto instanceof BigDecimal) { tipo = EnumTipoDatoPar.NUMERICO; } else if (objeto instanceof Timestamp) { tipo = EnumTipoDatoPar.FECHA_HORA; } else if (objeto instanceof Integer) { tipo = EnumTipoDatoPar.ENTERO; } else if (objeto instanceof Long) { tipo = EnumTipoDatoPar.ENTERO_GRANDE; } else if (objeto instanceof BigInteger) { tipo = EnumTipoDatoPar.ENTERO_GRANDE; } else { return false; } switch (tipo) { case ALFANUMERICO: String val1 = (String) objeto; String min1 = (String) minimo; String max1 = (String) maximo; if (min1 != null && val1.compareTo(min1) < 0) { es = false; } if (max1 != null && val1.compareTo(max1) > 0) { es = false; } break; case NUMERICO: BigDecimal val2 = (BigDecimal) objeto; BigDecimal min2 = (BigDecimal) minimo; BigDecimal max2 = (BigDecimal) maximo; if (min2 != null && val2.compareTo(min2) < 0) { es = false; } if (max2 != null && val2.compareTo(max2) > 0) { es = false; } break; case FECHA_HORA: Timestamp val3 = (Timestamp) objeto; Timestamp min3 = (Timestamp) minimo; Timestamp max3 = (Timestamp) maximo; if (min3 != null && val3.compareTo(min3) < 0) { es = false; } if (max3 != null && val3.compareTo(max3) > 0) { es = false; } break; case ENTERO: Integer val4 = (Integer) objeto; Integer min4 = (Integer) minimo; Integer max4 = (Integer) maximo; if (min4 != null && val4.compareTo(min4) < 0) { es = false; } if (max4 != null && val4.compareTo(max4) > 0) { es = false; } break; case ENTERO_GRANDE: Long val5 = objeto instanceof BigInteger ? ((BigInteger) objeto).longValue() : (Long) objeto; Long min5 = (Long) minimo; Long max5 = (Long) maximo; if (min5 != null && val5.compareTo(min5) < 0) { es = false; } if (max5 != null && val5.compareTo(max5) > 0) { es = false; } break; } return es; }
From source file:org.ihtsdo.otf.snomed.loader.RF2ImportHelper.java
/** * @param millis/* w ww. j av a2s . c o m*/ * @return */ protected static boolean isHistoryEdge(TitanGraph g, Rf2Relationship rel) { //get the nearest existing effective time to current effective time Long currentEt = rel.getEffectiveTime().getMillis(); //check to if given sctid and effective time exist. Iterable<Edge> es = g.query().has(Properties.sctid.toString(), rel.getId()) .has(Properties.type.toString(), Types.relationship.toString()) .has(Properties.end.toString(), Long.MAX_VALUE).edges(); for (Edge edge : es) { Long existing = edge.getProperty(Properties.effectiveTime.toString()); if (currentEt.compareTo(existing) > 0) { return true; } } return false; }
From source file:de.hybris.platform.acceleratorservices.dataimport.batch.converter.SequenceIdTranslator.java
/** * Verify, if the sequence is valid// ww w .ja v a 2 s . co m * * @param sequenceId * @param curSeqId * @return true, if the sequenceId is invalid */ protected boolean isInValidSequenceId(final Long sequenceId, final Long curSeqId) { return curSeqId.compareTo(sequenceId) >= 0; }
From source file:gemlite.core.internal.index.compare.ComparatorImpl.java
private int compareLong(Long o1, Long o2) { return o1.compareTo(o2); }
From source file:com.flipkart.fdp.migration.distcp.config.ConnectionConfig.java
public int compareTo(ConnectionConfig o) { Long l = getFreeSpaceInBytes(); if (o == null) return l.compareTo(0L); return l.compareTo(o.getFreeSpaceInBytes()); }
From source file:ttworkbench.play.parameters.ipv6.editors.octet.OctetRangeVerifier.java
private boolean isOctetPresentable(final Long theValueOctets, final Long theMaxAcceptedOctets) { if (theMaxAcceptedOctets == null) return true; return theMaxAcceptedOctets.compareTo(theValueOctets) >= 0; }
From source file:org.apilytic.currency.service.impl.DefaultTwitterService.java
/** {@inheritDoc} */ @Override/*from www. ja va2s . c o m*/ public SortedSet<TwitterMessage> getTwitterMessages(Long tweetId, SortOrder sortOrder) { final TreeSet<TwitterMessage> tweets = new TreeSet<TwitterMessage>(); if (tweetId != null) { final Map<Long, TwitterMessage> twitterMessagesAsMap = twitterMessages.asMap(); for (Long id : twitterMessagesAsMap.keySet()) { if (id.compareTo(tweetId) > 0) { tweets.add(twitterMessages.getIfPresent(id)); } } } else { tweets.addAll(this.twitterMessages.asMap().values()); } if (SortOrder.DESCENDING.equals(sortOrder)) { return tweets.descendingSet(); } return tweets; }
From source file:org.apache.tajo.validation.MaxValidator.java
@Override protected <T> boolean validateInternal(T object) { boolean result = false; if (object != null) { if ((object instanceof Byte) || (object instanceof Short) || (object instanceof Integer)) { Integer objInteger = Integer.decode(object.toString()); Integer maxInteger = Integer.decode(maxValue); result = objInteger.compareTo(maxInteger) <= 0; } else if (object instanceof Long) { Long objLong = Long.decode(object.toString()); Long maxLong = Long.decode(maxValue); result = objLong.compareTo(maxLong) <= 0; } else if ((object instanceof Float) || (object instanceof Double)) { Double objDouble = Double.valueOf(object.toString()); Double maxDouble = Double.valueOf(maxValue); result = objDouble.compareTo(maxDouble) <= 0; } else if (object instanceof BigInteger) { BigInteger objInteger = (BigInteger) object; BigInteger maxInteger = new BigInteger(maxValue); result = objInteger.compareTo(maxInteger) <= 0; } else if (object instanceof BigDecimal) { BigDecimal objDecimal = (BigDecimal) object; BigDecimal maxDecimal = new BigDecimal(maxValue); result = objDecimal.compareTo(maxDecimal) <= 0; }// www . j ava 2s.c o m } else { result = true; } return result; }
From source file:org.apache.tajo.validation.MinValidator.java
@Override protected <T> boolean validateInternal(T object) { boolean result = false; if (object != null) { if ((object instanceof Byte) || (object instanceof Short) || (object instanceof Integer)) { Integer objInteger = Integer.decode(object.toString()); Integer minInteger = Integer.decode(minValue); result = objInteger.compareTo(minInteger) >= 0; } else if (object instanceof Long) { Long objLong = Long.decode(object.toString()); Long minLong = Long.decode(minValue); result = objLong.compareTo(minLong) >= 0; } else if ((object instanceof Float) || (object instanceof Double)) { Double objDouble = Double.valueOf(object.toString()); Double minDouble = Double.valueOf(minValue); result = objDouble.compareTo(minDouble) >= 0; } else if (object instanceof BigInteger) { BigInteger objInteger = (BigInteger) object; BigInteger minInteger = new BigInteger(minValue); result = objInteger.compareTo(minInteger) >= 0; } else if (object instanceof BigDecimal) { BigDecimal objDecimal = (BigDecimal) object; BigDecimal minDecimal = new BigDecimal(minValue); result = objDecimal.compareTo(minDecimal) >= 0; } else if (object instanceof String) { BigDecimal objDecimal = new BigDecimal((String) object); BigDecimal minDecimal = new BigDecimal(minValue); result = objDecimal.compareTo(minDecimal) >= 0; }/*from w ww . j a va 2 s .co m*/ } else { result = true; } return result; }
From source file:org.kie.io.Entry.java
@Override public int compareTo(final Object o) { final Entry entry = (Entry) o; final Long v1 = entry.getCreatedAt().getValue(); final Long v2 = getCreatedAt().getValue(); return v1.compareTo(v2); }