Tabnine Logo
Long.signum
Code IndexAdd Tabnine to your IDE (free)

How to use
signum
method
in
java.lang.Long

Best Java code snippets using java.lang.Long.signum (Showing top 20 results out of 1,827)

origin: com.h2database/h2

  @Override
  public int compare(Chunk o1, Chunk o2) {
    return Long.signum(o1.block - o2.block);
  }
});
origin: com.h2database/h2

@Override
public int getSignum() {
  return Long.signum(value);
}
origin: com.h2database/h2

@Override
public int getSignum() {
  return Long.signum(nanos);
}
origin: iSoron/uhabits

/**
 * Returns -1 if this timestamp is older than the given timestamp, 1 if this
 * timestamp is newer, or zero if they are equal.
 */
public int compare(Timestamp other)
{
  return Long.signum(this.unixTime - other.unixTime);
}
origin: wildfly/wildfly

  public int compareTo(final TimeKey o) {
    int r = Long.signum(deadline - o.deadline);
    if (r == 0) r = Long.signum(seq - o.seq);
    return r;
  }
}
origin: stackoverflow.com

 long maximum = Long.signum(a) == Long.signum(b) ? Long.MAX_VALUE : Long.MIN_VALUE;

if (a != 0 && (b > 0 && b > maximum / a ||
        b < 0 && b < maximum / a))
{
  // Overflow
}
origin: robovm/robovm

private void checkedAddExponent(long offset) {
  long result = exponent + offset;
  int expSign = Long.signum(exponent);
  if (expSign * Long.signum(offset) > 0 && expSign * Long.signum(result) < 0) {
    exponent = expSign * Long.MAX_VALUE;
  } else {
    exponent = result;
  }
}
origin: apache/geode

@Override
public int compareTo(DiskPosition o) {
 int result = Long.signum(this.oplogId - o.oplogId);
 if (result == 0) {
  result = Long.signum(this.offset - o.offset);
 }
 return result;
}
origin: apache/geode

 @Override
 public int compareTo(EdgePattern o) {
  int timeDifference = Long.signum(timestamp - o.timestamp);
  if (timeDifference != 0) {
   return timeDifference;
  } else {
   // don't really care about the order, but want to make them unique in the set.
   return System.identityHashCode(this) - System.identityHashCode(o);
  }
 }
}
origin: com.h2database/h2

@Override
public Value add(Value v) {
  ValueLong other = (ValueLong) v;
  long result = value + other.value;
  int sv = Long.signum(value);
  int so = Long.signum(other.value);
  int sr = Long.signum(result);
  // if the operands have different signs overflow can not occur
  // if the operands have the same sign,
  // and the result has a different sign, then it is an overflow
  // it can not be an overflow when one of the operands is 0
  if (sv != so || sr == so || sv == 0 || so == 0) {
    return ValueLong.get(result);
  }
  throw getOverflow();
}
origin: com.h2database/h2

@Override
public int compare(Object aObj, Object bObj) {
  if (aObj == bObj) {
    return 0;
  }
  VersionedValue a = (VersionedValue) aObj;
  VersionedValue b = (VersionedValue) bObj;
  long comp = a.operationId - b.operationId;
  if (comp == 0) {
    return valueType.compare(a.value, b.value);
  }
  return Long.signum(comp);
}
origin: org.apache.logging.log4j/log4j-core

@Override
public int compareTo(final Setup other) {
  // largest ops/sec first
  return Long.signum(other.stats.averageOpsPerSec - stats.averageOpsPerSec);
}
origin: wildfly/wildfly

public int compareTo(final XidKey o) {
  final int res = signum(expiration - o.expiration);
  return res == 0 ? gtid.compareTo(o.gtid) : res;
}
origin: com.h2database/h2

@Override
public Value subtract(Value v) {
  ValueLong other = (ValueLong) v;
  int sv = Long.signum(value);
  int so = Long.signum(other.value);
  // if the operands have the same sign, then overflow can not occur
  // if the second operand is 0, then overflow can not occur
  if (sv == so || so == 0) {
    return ValueLong.get(value - other.value);
  }
  // now, if the other value is Long.MIN_VALUE, it must be an overflow
  // x - Long.MIN_VALUE overflows for x>=0
  return add(other.negate());
}
origin: prestodb/presto

@UsedByGeneratedCode
public static long divideShortShortShort(long dividend, long divisor, int rescaleFactor)
{
  if (divisor == 0) {
    throw new PrestoException(DIVISION_BY_ZERO, "Division by zero");
  }
  if (dividend == 0) {
    return 0;
  }
  int resultSignum = signum(dividend) * signum(divisor);
  long unsignedDividend = abs(dividend);
  long unsignedDivisor = abs(divisor);
  long rescaledUnsignedDividend = unsignedDividend * longTenToNth(rescaleFactor);
  long quotient = rescaledUnsignedDividend / unsignedDivisor;
  long remainder = rescaledUnsignedDividend - (quotient * unsignedDivisor);
  if (Long.compareUnsigned(remainder * 2, unsignedDivisor) >= 0) {
    quotient++;
  }
  return resultSignum * quotient;
}
origin: wildfly/wildfly

  @Override
  public int compare(VirtualFile resource, VirtualFile resource1) {
    return Long.signum(resource.getLastModified() - resource1.getLastModified());
  }
};
origin: apache/geode

@Override
public int compareTo(OffHeapStoredObject o) {
 int result = Integer.signum(getSize() - o.getSize());
 if (result == 0) {
  // For the same sized chunks we really don't care about their order
  // but we need compareTo to only return 0 if the two chunks are identical
  result = Long.signum(getAddress() - o.getAddress());
 }
 return result;
}
origin: apache/geode

@Override
public int compare(VersionTag o1, VersionTag o2) {
 long result = o1.getRegionVersion() - o2.getRegionVersion();
 if (result == 0) {
  result = o1.getVersionTimeStamp() - o2.getVersionTimeStamp();
 }
 return Long.signum(result);
}
origin: apache/hive

 @Override
 public int compare(FetchInputFormatSplit a, FetchInputFormatSplit b) {
  final Path ap = a.getPath();
  final Path bp = b.getPath();
  if (ap != null) {
   return (ap.compareTo(bp));
  }
  return Long.signum(a.getLength() - b.getLength());
 }
}
origin: iSoron/uhabits

public int compareLonger(Streak other)
{
  if (this.getLength() != other.getLength())
    return Long.signum(this.getLength() - other.getLength());
  return compareNewer(other);
}
java.langLongsignum

Javadoc

Returns the value of the signum function for the specified long value.

Popular methods of Long

  • parseLong
    Parses the string argument as a signed long in the radix specified by the second argument. The chara
  • toString
    Returns a string representation of the first argument in the radix specified by the second argument.
  • valueOf
    Returns a Long object holding the value extracted from the specified String when parsed with the rad
  • longValue
    Returns the value of this Long as a long value.
  • <init>
    Constructs a newly allocated Long object that represents the long value indicated by the String para
  • intValue
    Returns the value of this Long as an int.
  • equals
    Compares this object to the specified object. The result is true if and only if the argument is not
  • hashCode
  • toHexString
    Returns a string representation of the longargument as an unsigned integer in base 16.The unsigned l
  • compareTo
    Compares this Long object to another object. If the object is a Long, this function behaves likecomp
  • compare
    Compares two long values numerically. The value returned is identical to what would be returned by:
  • doubleValue
    Returns the value of this Long as a double.
  • compare,
  • doubleValue,
  • decode,
  • numberOfLeadingZeros,
  • numberOfTrailingZeros,
  • bitCount,
  • reverseBytes,
  • toBinaryString,
  • shortValue

Popular in Java

  • Making http requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • putExtra (Intent)
  • setContentView (Activity)
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now