com.cogpunk.math.IntegerOperator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cogpunk-math Show documentation
Show all versions of cogpunk-math Show documentation
A set of mathematical utilities
package com.cogpunk.math;
public class IntegerOperator implements NumberOperator {
@Override
public Integer add(Integer first, Integer second) {
return first + second;
}
@Override
public Integer subtract(Integer first, Integer second) {
return first - second;
}
@Override
public Integer multiply(Integer first, Integer second) {
return first * second;
}
@Override
public Integer divide(Integer first, Integer second) {
return first / second;
}
@Override
public Integer cast(Number i) {
return i.intValue();
}
/**
* {@inheritDoc}
*/
@Override
public boolean equals(final Object other) {
return (other instanceof IntegerOperator);
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return getClass().hashCode();
}
}