javamath.util.math
Class Permutation

java.lang.Object
  |
  +--javamath.util.math.MathObject
        |
        +--javamath.util.math.Permutation
All Implemented Interfaces:
MathInterface

public class Permutation
extends MathObject

This class represents a permutation using GAP's permutation CD and PolyMath's OpenMath library. This object is immutable.


Constructor Summary
Permutation()
          Construct the identity permutation.
Permutation(int[] map)
          Construct the permutation where point i+1 goes to map[i].
Permutation(javamath.util.math.OMApplication app)
          Construct the permutation from an OpenMath application.
Permutation(java.lang.String perm)
          Construct a permutation from a string encoding cycle notation.
 
Method Summary
static boolean isValidCycleNotation(java.lang.String candidate)
          Verify that a given string encodes a permutation in cycle notation.
 javamath.util.math.OMObject toOMObject()
          Return an OpenMath object representing this permutation.
 java.lang.String toString()
          A simple string encoding for the permutation.
 
Methods inherited from class javamath.util.math.MathObject
asASCII, asHTML, asLaTeX, asMathML, asOpenMath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Permutation

public Permutation()
Construct the identity permutation.

Permutation

public Permutation(int[] map)
Construct the permutation where point i+1 goes to map[i]. The difference in indexing is due to Java's 0 indexed arrays.

Permutation

public Permutation(javamath.util.math.OMApplication app)
            throws java.lang.Exception
Construct the permutation from an OpenMath application.

Permutation

public Permutation(java.lang.String perm)
Construct a permutation from a string encoding cycle notation.
Method Detail

toString

public java.lang.String toString()
A simple string encoding for the permutation.
Overrides:
toString in class java.lang.Object

toOMObject

public javamath.util.math.OMObject toOMObject()
Return an OpenMath object representing this permutation.
Overrides:
toOMObject in class MathObject

isValidCycleNotation

public static boolean isValidCycleNotation(java.lang.String candidate)
Verify that a given string encodes a permutation in cycle notation. Valid cycles are (a1 a2 ... an), where each ai is a unique positive integer. A permutation is a concatenation of cycles such that each integer appears in one and only one cycle.