|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectchordDiagrams.FourTGenerator
public class FourTGenerator
Generates all 4T relations for a list of diagrams
Field Summary | |
---|---|
int |
count
Stores the number of realtions found so far |
private Relation |
cur_row
Hashmap to store current row |
(package private) UnframedDiagramGenerator |
diag_gen
Diagram generator used to generate diagrams |
java.util.HashMap<java.lang.String,diagram> |
diags
Hashmap to store diagrams |
(package private) int |
k
Number of links |
java.util.ArrayList<java.lang.String> |
keys
The key set for the hash map |
(package private) int |
n
Number of chords |
java.util.TreeSet<Relation> |
relations
Data structure to store relations |
Constructor Summary | |
---|---|
FourTGenerator(int n,
int k,
UnframedDiagramGenerator gen)
Initializes an instance of 4T Generator |
Method Summary | |
---|---|
void |
account4Ts(java.lang.String[][] relation)
Finds out what diagrams are in the relation and stores their indixes (indicating their position in the keys list) in the matrix, with corresponding coefficients |
static boolean |
charMatch(java.lang.String S,
int index,
char[] a)
Tells whether a string contains a character belonging to a set at a position |
void |
DrawRelations(DiagramDrawer DDrawer)
Draws the set of 4T relations computed by this class with a DDRawer |
void |
DrawRelations(DiagramDrawer DDrawer,
java.util.Set<Relation> relSet)
Draws a set of relations with a DDrawer |
static java.lang.String[][] |
generate4Ts(diagram g,
int link)
Generates 4T relations for the first pair of feet in the current rotation of a linik |
static java.lang.String |
generateA(java.lang.String[] XY,
java.lang.String[] AB,
boolean reverse)
Makes a string out of two array by the rule result=wAxByCz |
void |
generateAll4Ts()
Generates and accounts for all the 4T realtions for all the diagrams stored in the list |
void |
generateAll4Ts(diagram g)
Generates and accounts for all 4T relations for a given diagram |
int[][] |
identify4Tdiagrams(java.lang.String[][] relation)
Identifies the diagrams in the 4T relation and returns their indices in the keys list |
boolean |
isNew(Relation r)
Tells whether a relation r is new to the list |
static java.lang.String[] |
JoinArrays(java.lang.String[] A,
java.lang.String[] B)
Concatenates two string arrays |
boolean |
loadRelations()
Load the relation data from file. |
static void |
printArray(java.lang.String[] a)
|
java.lang.String |
relationDataFname()
Generates a name of the file to save relations in. |
static java.lang.String |
reverseString(java.lang.String S)
Takes a string and reverses characters in it |
static void |
rotateStringArray(java.lang.String[] a)
Rotates string array clockwise |
boolean |
saveRelations()
Saves the relations to the file The name of the file depends on n and k ans is returned by relationDataFname() function |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.util.HashMap<java.lang.String,diagram> diags
public java.util.ArrayList<java.lang.String> keys
public java.util.TreeSet<Relation> relations
public int count
private Relation cur_row
int n
int k
UnframedDiagramGenerator diag_gen
Constructor Detail |
---|
public FourTGenerator(int n, int k, UnframedDiagramGenerator gen)
n
- number of chordsk
- number of linksgen
- diagram generator to useMethod Detail |
---|
public void generateAll4Ts()
public void generateAll4Ts(diagram g)
g
- the diagram to generate all 4T's forpublic void account4Ts(java.lang.String[][] relation)
relation
- the 4T relations: a-b=c-d=x-y stored as String[3][2] array.public int[][] identify4Tdiagrams(java.lang.String[][] relation)
relation
- the 4T relation, String[3][2] array that stores a-b=x-y=c-d
public static java.lang.String[][] generate4Ts(diagram g, int link)
g
- the diagram to generate 4T forlink
- the index of the link
public static void rotateStringArray(java.lang.String[] a)
a
- the string array to rotatepublic static java.lang.String reverseString(java.lang.String S)
S
- the string to reverse
public static java.lang.String generateA(java.lang.String[] XY, java.lang.String[] AB, boolean reverse)
XY
- array containing w,x,y,z (in this order)AB
- array containing A,B,C (in this order)reverse
- if set true, each of A,B,C is reversed
public static void printArray(java.lang.String[] a)
public static java.lang.String[] JoinArrays(java.lang.String[] A, java.lang.String[] B)
A
- B
-
public static boolean charMatch(java.lang.String S, int index, char[] a)
S
- index
- a
-
public java.lang.String relationDataFname()
public void DrawRelations(DiagramDrawer DDrawer, java.util.Set<Relation> relSet)
DDrawer
- an instance of the DiagramDrawer class to draw the relationsrelSet
- the set with relations to drawpublic void DrawRelations(DiagramDrawer DDrawer)
DDrawer
- DiagramDrawer to draw the relations withpublic boolean isNew(Relation r)
r
- relation to test
public boolean saveRelations()
public boolean loadRelations()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |