Class JaxoSaveGraph

java.lang.Object
net.sf.jaxodraw.graph.JaxoSaveGraph
All Implemented Interfaces:
Serializable

public class JaxoSaveGraph extends Object implements Serializable
A JaxoSaveGraph is the skeleton of a JaxoGraph: it contains just a list of JaxoObjects, a list of latex packages and a description of the graph. The default list of latex packages currently contains "axodraw4j", "pstricks" and "color".
Since:
2.0
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The default initial size for array lists.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new JaxoSaveGraph with empty list of JaxoObjects, empty description and default package list.
    Creates a new JaxoSaveGraph with the given list of JaxoObjects empty description and default package list.
    Creates a new JaxoSaveGraph with the given list of objects, description and default package list.
    JaxoSaveGraph(JaxoList<JaxoObject> list, String describe, List<String> packages)
    Creates a new JaxoSaveGraph with the given list of objects, description and package list.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    addObject(int index, JaxoObject object)
    Inserts a JaxoObject into the list of objects at a given position.
    final boolean
    Adds the specified JaxoObject to the list of objects by appending it.
    final void
    Adds a latex package to the list of packages by appending it.
    final boolean
    Puts the specified JaxoObject into the background, i.e., to the first position in the object list.
    final boolean
    Removes all JaxoObjects from the list of objects.
    final boolean
    Removes all JaxoObjects from the list of objects and sets the description to a string of size zero.
    Returns a copy of this JaxoSaveGraph.
    final boolean
    Removes the specified JaxoObject from the list of objects.
    final boolean
    Removes the specified objects from the list of objects.
    final boolean
    Removes all marked JaxoObjects from the list of objects.
    final boolean
    Puts the specified JaxoObject into the foreground, i.e., to the last position in the object list.
    final Rectangle
    Returns the smallest bounding box that contains all the JaxoObjects of this JaxoSaveGraph.
    final Rectangle
    Intersection of bounding box with given Rectangle.
    final Rectangle
    Returns the smallest bounding box that contains all the JaxoObjects of this JaxoSaveGraph except the one given in 'except'.
    final String
    Returns the description text of this JaxoSaveGraph.
    final String
    Returns the JaxoDraw version that this JaxoSaveGraph was created with.
    Returns the JaxoList holding the list of JaxoObjects.
    final List<String>
    Returns the List of Latex packages.
    boolean
    Determines if this JaxoSaveGraph is a copy of the specified one.
    Returns the JaxoObject at position i of the object list.
    final int
    Returns the size of the current object list, i.e., the number of objects it contains.
    final void
    move(int index, int newIndex)
    Move the object at 'index' to 'newIndex', leaving all other elements in order.
    final void
    Sets the description text of this JaxoSaveGraph.
    final void
    Set the JaxoDraw version that this JaxoSaveGraph was created with.
    final void
    Sets the list of JaxoObjects of this JaxoSaveGraph to list.
    final void
    Sets the list of Latex packages of this JaxoSaveGraph.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LIST_INIT_SIZE

      public static final int LIST_INIT_SIZE
      The default initial size for array lists.
      See Also:
  • Constructor Details

    • JaxoSaveGraph

      public JaxoSaveGraph()
      Creates a new JaxoSaveGraph with empty list of JaxoObjects, empty description and default package list.
    • JaxoSaveGraph

      public JaxoSaveGraph(JaxoList<JaxoObject> list)
      Creates a new JaxoSaveGraph with the given list of JaxoObjects empty description and default package list.
      Parameters:
      list - The new list of objects. Not null.
    • JaxoSaveGraph

      public JaxoSaveGraph(JaxoList<JaxoObject> list, String describe)
      Creates a new JaxoSaveGraph with the given list of objects, description and default package list.
      Parameters:
      list - List of JaxoObjects. Not null.
      describe - String which decsribes this JaxoSaveGraph. May be null.
    • JaxoSaveGraph

      public JaxoSaveGraph(JaxoList<JaxoObject> list, String describe, List<String> packages)
      Creates a new JaxoSaveGraph with the given list of objects, description and package list. If the default latex packages are not contained in the package list, they are added.
      Parameters:
      list - JaxoList that holds the JaxoObjects. Not null.
      describe - String which describes this JaxoSaveGraph. May be null.
      packages - List that holds the latex packages. Not null.
  • Method Details

    • getObjectList

      public final JaxoList<JaxoObject> getObjectList()
      Returns the JaxoList holding the list of JaxoObjects.
      Returns:
      The list of JaxoObjects. Not null.
    • setObjectList

      public final void setObjectList(JaxoList<JaxoObject> list)
      Sets the list of JaxoObjects of this JaxoSaveGraph to list.
      Parameters:
      list - The list holding the new list of JaxoObjects. Not null.
    • getPackageList

      public final List<String> getPackageList()
      Returns the List of Latex packages.
      Returns:
      The List of Latex packages. Not null.
    • setPackageList

      public final void setPackageList(List<String> list)
      Sets the list of Latex packages of this JaxoSaveGraph. If the default latex packages are not contained in the given list, they are added.
      Parameters:
      list - The list of Latex packages. Not null.
    • setDescription

      public final void setDescription(String describe)
      Sets the description text of this JaxoSaveGraph.
      Parameters:
      describe - The description of this JaxoSaveGraph. May be null.
    • getDescription

      public final String getDescription()
      Returns the description text of this JaxoSaveGraph.
      Returns:
      The decription of this JaxoSaveGraph. May be null.
    • getJaxoDrawVersion

      public final String getJaxoDrawVersion()
      Returns the JaxoDraw version that this JaxoSaveGraph was created with.
      Returns:
      the JaxoDraw version. May be null for graphs that were created with JaxoDraw versions earlier than 2.0.
    • setJaxoDrawVersion

      public final void setJaxoDrawVersion(String version)
      Set the JaxoDraw version that this JaxoSaveGraph was created with.
      Parameters:
      version - the JaxoDraw version. Not null.
    • listElementAt

      public final JaxoObject listElementAt(int i)
      Returns the JaxoObject at position i of the object list.
      Parameters:
      i - The index of the JaxoObject to be returned.
      Returns:
      The JaxoObject at position i of the object list. May be null if the index is out of range.
    • listSize

      public final int listSize()
      Returns the size of the current object list, i.e., the number of objects it contains.
      Returns:
      The number of objects currently in the object list.
    • foreground

      public final boolean foreground(JaxoObject object)
      Puts the specified JaxoObject into the foreground, i.e., to the last position in the object list.
      Parameters:
      object - The JaxoObject to be put into the foreground.
      Returns:
      True if the object was already in the foreground, i.e., the JaxoSaveGraph has not been modified.
    • background

      public final boolean background(JaxoObject object)
      Puts the specified JaxoObject into the background, i.e., to the first position in the object list.
      Parameters:
      object - The JaxoObject to be put into the background.
      Returns:
      True if the JaxoObject was already in the background, i.e., the JaxoSaveGraph has not been modified.
    • move

      public final void move(int index, int newIndex)
      Move the object at 'index' to 'newIndex', leaving all other elements in order.
      Parameters:
      index - The index of the object to move.
      newIndex - The new index of the object.
    • delete

      public final boolean delete(JaxoObject object)
      Removes the specified JaxoObject from the list of objects.
      Parameters:
      object - The JaxoObject to be removed from the list.
      Returns:
      True if the SaveGraph contained the specified object, ie, the SaveGraph was modified.
    • deleteMarkedObjects

      public final boolean deleteMarkedObjects()
      Removes all marked JaxoObjects from the list of objects.
      Returns:
      True if the SaveGraph was modified.
    • deleteAll

      public final boolean deleteAll(Collection<JaxoObject> objects)
      Removes the specified objects from the list of objects.
      Parameters:
      objects - Collection of JaxoObjects to be removed from the list.
      Returns:
      True if the SaveGraph was modified.
    • addObject

      public final boolean addObject(JaxoObject object)
      Adds the specified JaxoObject to the list of objects by appending it.
      Parameters:
      object - The JaxoObject to be added to the list. May be null in which case no action is taken.
      Returns:
      True if the SaveGraph was modified, ie object was not null.
    • addObject

      public final boolean addObject(int index, JaxoObject object)
      Inserts a JaxoObject into the list of objects at a given position.
      Parameters:
      index - The position where the object has to be inserted.
      object - The JaxoObject to be added to the list. May be null in which case no action is taken.
      Returns:
      True if the SaveGraph was modified, ie object was not null.
    • addPackage

      public final void addPackage(String pack)
      Adds a latex package to the list of packages by appending it.
      Parameters:
      pack - The name of the latex package to be added to the list. Not null.
    • clear

      public final boolean clear()
      Removes all JaxoObjects from the list of objects.
      Returns:
      True if the list was already empty before, i.e., the JaxoSaveGraph has not been modified.
    • clearAll

      public final boolean clearAll()
      Removes all JaxoObjects from the list of objects and sets the description to a string of size zero.
      Returns:
      True if the list of objects and the string holding the description were already empty, i.e., the JaxoSaveGraph has not been modified.
    • getBounds

      public final Rectangle getBounds()
      Returns the smallest bounding box that contains all the JaxoObjects of this JaxoSaveGraph.
      Returns:
      A Rectangle holding the bounds of the current JaxoSaveGraph, or null if the graph is empty (ie contains no objects).
    • getBoundsExcept

      public final Rectangle getBoundsExcept(Collection<JaxoObject> except)
      Returns the smallest bounding box that contains all the JaxoObjects of this JaxoSaveGraph except the one given in 'except'.
      Parameters:
      except - objects to exclude.
      Returns:
      A Rectangle holding the bounds of the current JaxoSaveGraph, or null if the graph is (effectively) empty (ie contains no objects).
    • getBounds

      public final Rectangle getBounds(Rectangle inside)
      Intersection of bounding box with given Rectangle. This returns null if either any of the two rectangles are null, or if they do not intersect.
      Parameters:
      inside - The Rectangle to intersect with.
      Returns:
      The intersection.
      See Also:
    • copyOf

      public JaxoSaveGraph copyOf()
      Returns a copy of this JaxoSaveGraph.
      Returns:
      A copy of this JaxoSaveGraph.
    • isCopy

      public boolean isCopy(JaxoSaveGraph graph)
      Determines if this JaxoSaveGraph is a copy of the specified one.
      Parameters:
      graph - the JaxoSaveGraph to compare with. Not null.
      Returns:
      true if the two graphs are equal.