|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectchordDiagrams.diagram
public class diagram
This class implements a chord diagram: stores it and has methods to compare it to other diagrams.
Field Summary | |
---|---|
(package private) int[] |
chords
data structure to store the chords in the "coloring" format |
(package private) boolean[][] |
connected
stores connectivity graph between links |
(package private) java.lang.String |
diagID
Diagram's unique string ID obtained from its canonical form |
(package private) boolean |
isConnected
is the link graph connected ? |
(package private) int |
k
number of links |
(package private) int[] |
linkcolors
same as above; stores links by coloring chord endpoints |
(package private) int[] |
links
data structure to store links configuration; stores indices of endpoints of links in the chords array |
(package private) int |
n
number of chord endpoints |
(package private) int[] |
ringsizes
sort of same as links: stores the link configuration by storing the number of entries each ring occupies |
(package private) static long |
serialVersionUID
Version number, needed for serialization |
(package private) int[] |
skipdiag
data structure to hold chords in "skip" format |
Constructor Summary | |
---|---|
diagram(int[] chordcolors,
int[] linksdel)
Constructs an instance of the digram from chord colors description and link delimiter descripion |
|
diagram(int[] dchords,
int[] dlinks,
int[] dlinkcolors)
Creates an instance of the diagram class |
|
diagram(java.lang.String S)
Constructs an instance of the diagram from standard string representation |
Method Summary | |
---|---|
static int[] |
arrcopy(int[] a)
returns a copy of the integer array a |
private void |
checkConnected()
calls the corresponding recursive method to set the isConnected field. |
private void |
checkConnected(boolean[] visited,
int t)
recursive function to check connectivity of the link graph vertices = links edges = "connectivity" matrix |
static int[] |
ColoringToSkip(int[] chords)
Converts a chord diagram description from coloring to skip |
static int[] |
colorsFromString(java.lang.String Str)
Returns a color band for the diagram (chord endpoint colors array) that can be passed to the contructor. |
int |
compareTo(diagram g)
Compares this diagram to another one by comparing the diagID strings |
void |
copyArray(int[] a,
int[] b)
Copies the content of array a into array b |
boolean |
eqials(diagram g)
Returns whether this diagram is equivalent to another one. |
boolean |
equals_ex(diagram g)
returns whether two diagrams are equivalent under link rotation Obsolete with introduction of canonical form |
private boolean |
EqualsTo(diagram g,
int link)
Recursive function to check whether this diagram is equivalent to some other diagram g. |
void |
fillConnectivity()
Fills the connectivity graph |
void |
getCanonicalForm()
Converts the diagram into its canonical form by rotating and recoloring links in the chords array |
void |
getCanonicalForm(int[] best,
int link)
|
static java.lang.String |
getString(int[] a)
Converts an array into string |
java.lang.String |
getStringRepresentation()
Converts a diagram into a string form. |
static java.lang.String |
getSubstring(int[] a,
int start,
int end)
Takes the numbers in the subarray from start to end and puts them into comma-separated string |
void |
initialize()
Initializes |
diagram |
insertKinkAt(int linknumber)
Returns a new diagram with a kink inserted into link referenced by linknumber |
diagram |
insertKinksAt(int[] presc)
Inserts kinks into the diagram according to the prescription in presc: presc[# of link] = # of kinks to insert into that link |
static int[] |
linksFromString(java.lang.String Str)
Takes a standard string representation of a string S and returns the links delimiter array |
static int[] |
LinksToColors(int[] linksdel)
Converts links config from delimiter index to coloring format |
int |
linkStringStart(int link)
Returns the position of the link start in the string representation of the diagram NOTE: the implementation must be consistent with getStringRepresentation() method. |
int |
posInRing(int t)
Returns the position of the endpoint in its ring Used for diagram drawing |
void |
print()
Prints the diagram' string form |
static void |
PrintArray(int[] a)
Prints array to the console |
static int[] |
recolorCanonically(int[] chordcol)
Recolors the chord diagram canonically (colors in the recoloring start from 0 and go to [number of colors]-1 in the order of occurence) |
boolean |
recolored(int[] a,
int[] b)
returns whether a and b are same by recoloring |
boolean |
recolorexists(int[] a,
int[] b)
returns whether there exists a recoloring map from a to b |
static java.lang.String |
removeChar(java.lang.String S,
char c)
Removes all occurrences of a character from a string |
void |
rotatering(int ring)
Rotates a ring to the right; only affects the coloring format |
boolean |
same(int[] a,
int[] b)
returns whether two arrays have the same data |
static int[] |
SkipToColoring(int[] a)
Converts a chord diagram description from skip format to coloring |
java.lang.String |
toString()
Provides a string representations of the diagram in a human-readable way |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static final long serialVersionUID
int[] skipdiag
int[] chords
int[] links
int[] linkcolors
int[] ringsizes
int n
int k
boolean[][] connected
boolean isConnected
java.lang.String diagID
Constructor Detail |
---|
public diagram(int[] dchords, int[] dlinks, int[] dlinkcolors)
dchords
- chords in the "skip" formatdlinks
- links in regular formatpublic diagram(java.lang.String S)
S
- standard string representation of the diagram. Ex:
a|bcd|ef|dec|bf
Pipes ('|') denote link delimiters; any characters are OK as long as
distinct characters denote distinct colors.public diagram(int[] chordcolors, int[] linksdel)
chordcolors
- chords in coloring formatlinks
- links in link delimiter formatMethod Detail |
---|
public void initialize()
public void rotatering(int ring)
ring
- The ring indexpublic boolean recolorexists(int[] a, int[] b)
a
- one diagram coloringb
- another diagram coloring
public boolean recolored(int[] a, int[] b)
a
- b
-
public static int[] arrcopy(int[] a)
a
-
public static void PrintArray(int[] a)
a
- the array to printpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getStringRepresentation()
public void print()
private boolean EqualsTo(diagram g, int link)
g
- The other diagramlink
- link number to check all rotations
public boolean equals_ex(diagram g)
g
-
public boolean eqials(diagram g)
g
- other diagram
public boolean same(int[] a, int[] b)
a
- b
-
public static int[] SkipToColoring(int[] a)
a
- the chord diagram description in skip format
public static int[] ColoringToSkip(int[] chords)
a
- the chord diagram description in coloring format
public void fillConnectivity()
private void checkConnected(boolean[] visited, int t)
visited
- array of booleans to mark visited verticest
- current vertexprivate void checkConnected()
public int posInRing(int t)
t
- the index of the endpoint
public diagram insertKinkAt(int linknumber)
linknumber
- the index of the link to insert the kink into
public diagram insertKinksAt(int[] presc)
presc
- kink insertion prescription
public static int[] LinksToColors(int[] linksdel)
linksdel
- links in link delimiter format
public void getCanonicalForm()
public void getCanonicalForm(int[] best, int link)
public static int[] recolorCanonically(int[] chordcol)
chorcol
- the color diagram to recolor (the colors can be any numbers in range 0..255)
public static java.lang.String getSubstring(int[] a, int start, int end)
a
- the arraystart
- index of the beginning of the subarrayend
- index of the end of the subarray
public static java.lang.String getString(int[] a)
a
- array
public int compareTo(diagram g)
compareTo
in interface java.lang.Comparable<diagram>
g
- the diagram to compare to
public void copyArray(int[] a, int[] b)
a
- array to copy FROMb
- array to copy TOpublic static int[] linksFromString(java.lang.String Str)
S
- the standard string representation of S
public static int[] colorsFromString(java.lang.String Str)
S
- the standard string representation of S
public static java.lang.String removeChar(java.lang.String S, char c)
S
- the string to remove the character fromc
- the character to be removed from a string
public int linkStringStart(int link)
link
- the index of the link
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |