public class PrimeFactors extends Object
Map
from bases to exponents.
Bases with exponent==0 are removed from the maps.Modifier and Type | Field and Description |
---|---|
static Comparator<PrimeFactors> |
byIntValue |
static Comparator<PrimeFactors> |
byRatValue |
protected static Map<Integer,PrimeFactors> |
cache_int |
protected static Map<Rational,PrimeFactors> |
cache_rat |
static PrimeFactors |
ONE |
static PrimeFactors |
TWO |
Modifier and Type | Method and Description |
---|---|
void |
add(int p)
Add 1(one) to the currently present exponent (maybe ==0) of p.
|
void |
add(int p,
int v)
Add exponent v to the currently present exponent (maybe ==0) of p.
|
void |
clear()
Clear all exponents to zero(0).
|
int |
cmp(PrimeFactors other)
Returns -1/0/+1 for inclusion or equality, negative exponents are smaller
than positives, and returns a different int (here: -100) iff not comparable.
|
boolean |
containsAsFactor(PrimeFactors b)
Returns whether arg is a factor of this
|
int |
count(int p) |
int |
countBases() |
int |
countFactors() |
PrimeFactors |
denominator() |
SortedSet<Integer> |
domain()
Only those bases with exp!=0
|
PrimeFactors |
enumerator() |
boolean |
equals(Object b) |
boolean |
equals(PrimeFactors b) |
static PrimeFactors |
get(BigInteger bi) |
static PrimeFactors |
get(int value) |
static PrimeFactors |
get(Rational rat) |
int |
hashCode() |
int |
intValue()
Return the integer value.
|
boolean |
isInteger() |
boolean |
isOne() |
boolean |
isPowerOf(int b)
Whether this is a power (with an exponent !=0) of the one single basis.
|
static boolean |
isPrime(int i)
Whether the argument is a prim number >=1.
|
static boolean |
isSingleBased(int i)
Whether the argument is a power of only one single basis.
|
PrimeFactors |
max(PrimeFactors b)
Return an instance with the more positive exponents of both arguments.
|
PrimeFactors |
min(PrimeFactors b)
Return an instance with the more negative exponents of both arguments.
|
PrimeFactors |
minus(PrimeFactors b)
Subtract exponents, ie.
|
PrimeFactors |
modifiable()
Always makes a new copy, which is modifiable.
|
PrimeFactors |
plus(PrimeFactors b)
Add exponents, ie.
|
Rational |
ratValue()
Return the rational value.
|
void |
removeDomain(int p)
Remove basis from domain.
|
List<Integer> |
simpleFactors(boolean reverse)
Iterate over identic factors seperated, like "2, 2, 3, 5, 5", not "4,3,25".
|
String |
toString() |
PrimeFactors |
unmodifiable()
Make a new unmodifiable version, iff not already unmodifiable.
|
protected static Map<Integer,PrimeFactors> cache_int
protected static Map<Rational,PrimeFactors> cache_rat
public static final PrimeFactors ONE
public static final PrimeFactors TWO
public static Comparator<PrimeFactors> byRatValue
public static Comparator<PrimeFactors> byIntValue
public PrimeFactors modifiable()
public PrimeFactors unmodifiable()
public static PrimeFactors get(BigInteger bi)
public static PrimeFactors get(int value)
public static PrimeFactors get(Rational rat)
public static boolean isPrime(int i)
public static boolean isSingleBased(int i)
public boolean isOne()
public boolean isInteger()
public int count(int p)
public int countBases()
public int countFactors()
public int intValue()
public Rational ratValue()
public boolean isPowerOf(int b)
public List<Integer> simpleFactors(boolean reverse)
public void add(int p)
public void add(int p, int v)
public void removeDomain(int p)
public void clear()
public int cmp(PrimeFactors other)
public boolean containsAsFactor(PrimeFactors b)
public PrimeFactors max(PrimeFactors b)
public PrimeFactors min(PrimeFactors b)
public PrimeFactors minus(PrimeFactors b)
public PrimeFactors plus(PrimeFactors b)
public boolean equals(PrimeFactors b)
public PrimeFactors denominator()
public PrimeFactors enumerator()
see also the complete user documentation .