Package edu.jas.poly
Class IndexFactory
- java.lang.Object
-
- edu.jas.poly.IndexFactory
-
- All Implemented Interfaces:
ElemFactory<IndexList>
,MonoidFactory<IndexList>
,java.io.Serializable
public class IndexFactory extends java.lang.Object implements MonoidFactory<IndexList>
IndexList factory implements a factory for index lists for exterior polynomials. Objects of this class are intended to be immutable. If in doubt usevalueOf
to get a conformant index list.- Author:
- Heinz Kredel
- See Also:
- "masnc.DIPE.mi#ILEXPR from SAC2/MAS", Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IndexFactory.IndexListComparator
Comparator for IndexLists.
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_SIZE
The default imaxlength for this index lists.static java.lang.String
DEFAULT_VNAME
The default coordinate variable name.IndexList
imax
The maximal index list for this factory.int
imaxlength
The maximal length index list for this factory.IndexList
ONE
The one element index list.java.lang.String
vname
The coordinate variable name.
-
Constructor Summary
Constructors Constructor Description IndexFactory()
Constructor for IndexFactory.IndexFactory(int r)
Constructor for IndexFactory.IndexFactory(int r, boolean w)
Constructor for IndexFactory.IndexFactory(int s, int t)
Constructor for IndexFactory.IndexFactory(int s, int t, java.lang.String v, boolean w)
Constructor for IndexFactory.IndexFactory(int r, java.lang.String v)
Constructor for IndexFactory.IndexFactory(int r, java.lang.String v, boolean w)
Constructor for IndexFactory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IndexList
copy(IndexList o)
Clone IndexList.boolean
equals(java.lang.Object B)
Comparison with any other object.IndexList
fromInteger(long a)
Get the Element for a.IndexList
fromInteger(java.math.BigInteger a)
Get the Element for a.java.util.List<IndexList>
generators()
Generators.IndexFactory.IndexListComparator
getAscendComparator()
Get the ascending order comparator.IndexFactory.IndexListComparator
getDescendComparator()
Get the descending order comparator.IndexList
getONE()
Get IndexList one.IndexList
getZERO()
Get IndexList zero.int
hashCode()
hashCode.boolean
isAssociative()
Query if this monoid is associative.boolean
isCommutative()
Query if this monoid is commutative.boolean
isFinite()
Is this structure finite or infinite.int
length()
Get the maximal length of index lists of this factory.IndexList
parse(java.io.Reader r)
Parse from Reader.IndexList
parse(java.lang.String s)
Parser for IndexList.IndexList
random(int r)
Generate a random IndexList.IndexList
random(int r, float q)
Generate a random IndexList.IndexList
random(int r, float q, java.util.Random rnd)
Generate a random IndexList.IndexList
random(int r, java.util.Random rnd)
Generate a random IndexList.IndexList
sequence(int s, int r)
Generate a sequence IndexList.static int[]
sequenceArray(int s, int r)
Generate a sequence array.java.lang.String
toScript()
Get a scripting compatible string representation.java.lang.String
toString()
Get the string representation.IndexList
valueOf(int[] e)
Value of other.IndexList
valueOf(ExpVector e)
Value of other.IndexList
valueOf(IndexList e)
Value of other.IndexList
valueOf(java.lang.String var)
Value of other.IndexList
valueOf(java.util.Collection<java.lang.Integer> e)
Value of other.
-
-
-
Field Detail
-
imaxlength
public final int imaxlength
The maximal length index list for this factory.
-
vname
public final java.lang.String vname
The coordinate variable name.
-
DEFAULT_VNAME
public static final java.lang.String DEFAULT_VNAME
The default coordinate variable name.- See Also:
- Constant Field Values
-
DEFAULT_SIZE
public static final int DEFAULT_SIZE
The default imaxlength for this index lists.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
IndexFactory
public IndexFactory()
Constructor for IndexFactory. No argument constructor .
-
IndexFactory
public IndexFactory(int r)
Constructor for IndexFactory.- Parameters:
r
- length of index lists, starting with index 1.
-
IndexFactory
public IndexFactory(int r, boolean w)
Constructor for IndexFactory.- Parameters:
r
- length of index lists, starting with index 1.w
- termorder for index lists: true for weak, false for strong.
-
IndexFactory
public IndexFactory(int r, java.lang.String v)
Constructor for IndexFactory.- Parameters:
r
- length of index lists, starting with index 1.v
- coordinate vname.
-
IndexFactory
public IndexFactory(int r, java.lang.String v, boolean w)
Constructor for IndexFactory.- Parameters:
r
- length of index lists, starting with index 1.v
- coordinate vname.w
- termorder for index lists: true for weak, false for strong.
-
IndexFactory
public IndexFactory(int s, int t)
Constructor for IndexFactory.- Parameters:
s
- start index.t
- length of index lists.
-
IndexFactory
public IndexFactory(int s, int t, java.lang.String v, boolean w)
Constructor for IndexFactory.- Parameters:
s
- start index.t
- length of index lists.v
- coordinate vname.w
- termorder for index lists: true for weak, false for strong.
-
-
Method Detail
-
isFinite
public boolean isFinite()
Is this structure finite or infinite.- Specified by:
isFinite
in interfaceElemFactory<IndexList>
- Returns:
- true if this structure is finite, else false.
- See Also:
Note: returns true because of finite set of values in each index.
-
isCommutative
public boolean isCommutative()
Query if this monoid is commutative.- Specified by:
isCommutative
in interfaceMonoidFactory<IndexList>
- Returns:
- true if this monoid is commutative, else false.
-
isAssociative
public boolean isAssociative()
Query if this monoid is associative.- Specified by:
isAssociative
in interfaceMonoidFactory<IndexList>
- Returns:
- true if this monoid is associative, else false.
-
fromInteger
public IndexList fromInteger(long a)
Get the Element for a.- Specified by:
fromInteger
in interfaceElemFactory<IndexList>
- Parameters:
a
- long- Returns:
- element corresponding to a.
-
fromInteger
public IndexList fromInteger(java.math.BigInteger a)
Get the Element for a.- Specified by:
fromInteger
in interfaceElemFactory<IndexList>
- Parameters:
a
- java.math.BigInteger.- Returns:
- element corresponding to a.
-
valueOf
public IndexList valueOf(ExpVector e)
Value of other.- Parameters:
e
- other ExpVector.- Returns:
- value as IndexList.
-
valueOf
public IndexList valueOf(java.lang.String var)
Value of other.- Specified by:
valueOf
in interfaceElemFactory<IndexList>
- Parameters:
var
- String of index names.- Returns:
- value as IndexList.
-
valueOf
public IndexList valueOf(java.util.Collection<java.lang.Integer> e)
Value of other.- Parameters:
e
- other Collection of Integer indexes.- Returns:
- value as IndexList.
-
valueOf
public IndexList valueOf(int[] e)
Value of other.- Parameters:
e
- other int[] of indexes, may not be conform to IndexList specification.- Returns:
- value as IndexList.
-
valueOf
public IndexList valueOf(IndexList e)
Value of other.- Parameters:
e
- other IndexList, may not be conform to IndexList specification.- Returns:
- value as IndexList.
-
generators
public java.util.List<IndexList> generators()
Generators.- Specified by:
generators
in interfaceElemFactory<IndexList>
- Returns:
- list of generators for this index list.
-
copy
public IndexList copy(IndexList o)
Clone IndexList.- Specified by:
copy
in interfaceElemFactory<IndexList>
- Returns:
- a copy of c.
- See Also:
Object.clone()
-
length
public int length()
Get the maximal length of index lists of this factory.- Returns:
- imaxlength.
-
toString
public java.lang.String toString()
Get the string representation.- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.- Specified by:
toScript
in interfaceElemFactory<IndexList>
- Returns:
- script compatible representation for this Element.
- See Also:
Element.toScript()
-
parse
public IndexList parse(java.lang.String s) throws java.lang.NumberFormatException
Parser for IndexList. Converts a String representation to an IndexList. Accepted format = E(1,2,3,4,5,6,7).- Specified by:
parse
in interfaceElemFactory<IndexList>
- Parameters:
s
- String representation.- Returns:
- parsed IndexList
- Throws:
java.lang.NumberFormatException
-
parse
public IndexList parse(java.io.Reader r)
Parse from Reader. White space is delimiter for index list.- Specified by:
parse
in interfaceElemFactory<IndexList>
- Parameters:
r
- Reader.- Returns:
- the next Element found on r.
-
equals
public boolean equals(java.lang.Object B)
Comparison with any other object.- Overrides:
equals
in classjava.lang.Object
- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
hashCode. Optimized for small indexes, i.e. ≤ 24 and small number of variables, i.e. ≤ 8.- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
getONE
public IndexList getONE()
Get IndexList one.- Specified by:
getONE
in interfaceMonoidFactory<IndexList>
- Returns:
- 1 IndexList.
-
random
public final IndexList random(int r)
Generate a random IndexList.- Specified by:
random
in interfaceElemFactory<IndexList>
- Parameters:
r
- length of new IndexList.- Returns:
- random IndexList.
-
random
public final IndexList random(int r, java.util.Random rnd)
Generate a random IndexList.- Specified by:
random
in interfaceElemFactory<IndexList>
- Parameters:
r
- length of new IndexList.rnd
- is a source for random bits.- Returns:
- random IndexList.
-
random
public final IndexList random(int r, float q)
Generate a random IndexList.- Parameters:
r
- length of new IndexList.q
- density of nozero indexes.- Returns:
- random IndexList.
-
random
public final IndexList random(int r, float q, java.util.Random rnd)
Generate a random IndexList.- Parameters:
r
- length of new IndexList.q
- density of nozero indexes.rnd
- is a source for random bits.- Returns:
- random IndexList.
-
sequence
public final IndexList sequence(int s, int r)
Generate a sequence IndexList.- Parameters:
s
- starting index.r
- length of new IndexList.- Returns:
- sequence (s, s+1, ..., s+r-1) IndexList.
-
sequenceArray
public static int[] sequenceArray(int s, int r)
Generate a sequence array.- Parameters:
s
- starting index.r
- length of array.- Returns:
- sequence (s, s+1, ..., s+r-1) array.
-
getDescendComparator
public IndexFactory.IndexListComparator getDescendComparator()
Get the descending order comparator. Sorts the highest terms first.- Returns:
- horder.
-
getAscendComparator
public IndexFactory.IndexListComparator getAscendComparator()
Get the ascending order comparator. Sorts the lowest terms first.- Returns:
- lorder.
-
-