org.latdraw.diagram
Class Diagram

java.lang.Object
  extended by org.latdraw.diagram.Diagram

public class Diagram
extends java.lang.Object

a class to represent diagrams of ordered sets.

Version:
$Id: Diagram.java,v 1.24 2008/08/01 19:30:57 ralph Exp $

Field Summary
static int ITERATIONS
           
 
Constructor Summary
Diagram(InputLattice in)
           
Diagram(OrderedSet set)
           
Diagram(java.lang.String n, java.util.List labels, java.util.List ucs)
          Construct a Diagram with name n from a List of Objects and a list of covers for each object.
Diagram(java.lang.String n, java.util.List labels, java.util.List ucs, java.util.HashMap edgeColors)
           
 
Method Summary
 void clearLabels()
          Sets all the labels to the empty string which prevents them from being drawn.
 java.util.List<Vertex> filter(Vertex v)
          A convenience method to get the vertices in the filter.
 boolean geq(Vertex v0, Vertex v1)
           
 double getAttractionFactor()
           
 java.util.HashMap getEdgeColors()
           
 int getImprovementCount()
           
 java.lang.String getName()
           
 OrderedSet getOrderedSet()
           
 double getRepulsionFactor()
           
 double getRotationAngle()
           
 double getScaleFactor()
           
 Vertex[] getVertices()
           
 boolean gt(Vertex v0, Vertex v1)
           
 void hideLabels()
          Hide the all vertex labels.
 java.util.List<Vertex> ideal(Vertex v)
          A convenience method to get the vertices in the ideal.
 void improve()
          Silently improve the diagram through all three stages.
 Diagram interval(java.lang.Object top, java.lang.Object bottom)
          Form a new Diagram representing the interval from botton to top.
 boolean isHorizontal()
           
 boolean isInterval()
          Was this diagram constructed as an interval of another diagram.
 boolean isPaintLabels()
          This globally controls if the labels are displayed.
 boolean leq(Vertex v0, Vertex v1)
           
 boolean lt(Vertex v0, Vertex v1)
           
static void main(java.lang.String[] args)
           
 void multipleUpdates(int k, double att, double repulsion)
           
 void normalizeCoords()
           
 void project2d(double angle)
           
 void resetVertices()
          Sets the Color of all vertices to null and filled to false.
 void setEdgeColors(java.util.HashMap ht)
           
 void setImprovementCount(int v)
           
 void setInterval(boolean v)
           
 void setName(java.lang.String s)
           
 void setPaintLabels(boolean v)
          This globally controls if the labels are displayed.
 void setRotationAngle(double angle)
           
 void setScaleFactor(double v)
           
 void showLabels()
          Set all vertex labels to be shown but if paintLabels is false they still will not be painted.
 int size()
           
 void update(double att, double repulsion)
          This does a single update using att and repulsion, improving the diagram.
 Vertex vertexForPOElem(POElem elt)
          Find the Vertex whose associated POElem is elt.
 void writeRSFDiagram(java.io.File f)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ITERATIONS

public static final int ITERATIONS
See Also:
Constant Field Values
Constructor Detail

Diagram

public Diagram(java.lang.String n,
               java.util.List labels,
               java.util.List ucs)
        throws NonOrderedSetException
Construct a Diagram with name n from a List of Objects and a list of covers for each object. An ordered set is constructed from the name, labels and ucs.

Parameters:
n - the name.
labels - the list of Objects representing the elements of the ordered set. Note any Object is allowed.
ucs - a list of lists so the kth list is the list of covers of the kth element of labels. It valid to include elements that are not upper covers as long as they are greater than the element.
Throws:
NonOrderedSetException

Diagram

public Diagram(java.lang.String n,
               java.util.List labels,
               java.util.List ucs,
               java.util.HashMap edgeColors)
        throws NonOrderedSetException
Throws:
NonOrderedSetException

Diagram

public Diagram(InputLattice in)
        throws NonOrderedSetException
Throws:
NonOrderedSetException

Diagram

public Diagram(OrderedSet set)
        throws NonOrderedSetException
Throws:
NonOrderedSetException
Method Detail

getScaleFactor

public double getScaleFactor()

setScaleFactor

public void setScaleFactor(double v)

getRotationAngle

public double getRotationAngle()

setRotationAngle

public void setRotationAngle(double angle)

getAttractionFactor

public double getAttractionFactor()

getRepulsionFactor

public double getRepulsionFactor()

isPaintLabels

public boolean isPaintLabels()
This globally controls if the labels are displayed. If it is false then they are not displayed even for vertices with labelPainted true.


setPaintLabels

public void setPaintLabels(boolean v)
This globally controls if the labels are displayed. If it is false then they are not displayed even for vertices with labelPainted true.


setImprovementCount

public void setImprovementCount(int v)

getImprovementCount

public int getImprovementCount()

isInterval

public boolean isInterval()
Was this diagram constructed as an interval of another diagram.


setInterval

public void setInterval(boolean v)

getName

public java.lang.String getName()

setName

public void setName(java.lang.String s)

improve

public void improve()
Silently improve the diagram through all three stages.


interval

public Diagram interval(java.lang.Object top,
                        java.lang.Object bottom)
                 throws NonOrderedSetException
Form a new Diagram representing the interval from botton to top. If bottom is null then use 0 (or the first element in the topological sort and similar for top.

Throws:
NonOrderedSetException

getOrderedSet

public OrderedSet getOrderedSet()

size

public int size()

getVertices

public Vertex[] getVertices()

vertexForPOElem

public Vertex vertexForPOElem(POElem elt)
Find the Vertex whose associated POElem is elt.


resetVertices

public void resetVertices()
Sets the Color of all vertices to null and filled to false.


getEdgeColors

public java.util.HashMap getEdgeColors()

setEdgeColors

public void setEdgeColors(java.util.HashMap ht)

isHorizontal

public boolean isHorizontal()

multipleUpdates

public void multipleUpdates(int k,
                            double att,
                            double repulsion)

update

public void update(double att,
                   double repulsion)
This does a single update using att and repulsion, improving the diagram.


normalizeCoords

public void normalizeCoords()

project2d

public void project2d(double angle)

writeRSFDiagram

public void writeRSFDiagram(java.io.File f)
                     throws java.io.IOException
Throws:
java.io.IOException

hideLabels

public void hideLabels()
Hide the all vertex labels.


showLabels

public void showLabels()
Set all vertex labels to be shown but if paintLabels is false they still will not be painted.


clearLabels

public void clearLabels()
Sets all the labels to the empty string which prevents them from being drawn.


leq

public boolean leq(Vertex v0,
                   Vertex v1)

lt

public boolean lt(Vertex v0,
                  Vertex v1)

geq

public boolean geq(Vertex v0,
                   Vertex v1)

gt

public boolean gt(Vertex v0,
                  Vertex v1)

filter

public java.util.List<Vertex> filter(Vertex v)
A convenience method to get the vertices in the filter.


ideal

public java.util.List<Vertex> ideal(Vertex v)
A convenience method to get the vertices in the ideal.


main

public static void main(java.lang.String[] args)
                 throws java.io.FileNotFoundException,
                        java.io.IOException,
                        NonOrderedSetException
Throws:
java.io.FileNotFoundException
java.io.IOException
NonOrderedSetException


Copyright 2003 Ralph Freese. All Rights Reserved.