net.sf.jaxodraw.io.imports
Class JaxoAxodraw

java.lang.Object
  extended by net.sf.jaxodraw.io.imports.JaxoAxodraw
Direct Known Subclasses:
JaxoAxodraw4J

public class JaxoAxodraw
extends Object

Defines a number of axodraw LaTeX commands and all the methods to convert them into JaxoObjects. This is responsible for the import option.

Since:
2.0

Field Summary
protected static String AMP
           
protected static String COLOR
           
protected static String DASH
           
protected static String DL_SEP
           
protected static String DOUBLE_LINE
           
protected static String FREQ_FROM_WIGGLES
           
protected static String LINE
           
protected static String PAINT_ARROW
           
protected static String REL_HEIGHT
           
protected static String REL_WIDTH
           
protected static String STROKE_WIDTH
           
 
Constructor Summary
JaxoAxodraw()
          Constructor: Initializes the list of Latex packages (axodraw and color).
 
Method Summary
 void addPackage(String pack)
          Adds a latex package if it is not already contained in the package list.
 void checkRequired(String newString)
          Checks whether the given string starts with one of "\documentclass", "\begin{document}" or "\begin{picture}".
protected  String[] getArcBrackets(String str)
          Returns the five strings s1 - s5 contained in a string of the form " # (s1, s2) (s3, s4, s5) * " where * can be anything and # doesn't contain any parenthesis.
protected  Point2D[] getArcPoints(String[] st, boolean clock)
           
protected  float getBBoxHeight()
          Return the current bounding box height.
protected  Color getColor()
          Return the current color.
 String getComment()
          Returns the comment (description) of this axodraw object.
protected  int[] getFourInts(String str)
          Returns the four integers xi,yi,xf,yf contained in a string of the form " # (xi,yi) (xf,yf) * " where * can be anything and # doesn't contain any parenthesis.
protected  int[] getFourInts(String str, int fromIndex)
          Returns the four integers xi,yi,xf,yf contained in a string of the form " # (xi,yi) (xf,yf) * " where * can be anything and # doesn't contain any parenthesis.
 JaxoObject getJaxoObject(String newString)
          Returns a JaxoObject corresponding to a axodraw command.
protected  int[] getLineParams(int[] in, String st)
           
protected  int[] getLoopPars(String[] st, String st1, boolean cntrclk)
           
protected  String getOneBrace(String str)
          Returns the four integers xi,yi,xf,yf contained in a string of the form " # [String] * " where * can be anything and # doesn't contain any braces.
protected  String[] getOneBracket(String str)
          Returns the two integers xi,yi contained in a string of the form " # (xi,yi) * " where * can be anything and # doesn't contain any parenthesis.
protected  String getOneCurl(String str)
          Returns the string "String" contained in a string of the form " # {String} * " where * can be anything and # doesn't contain any curly brackets.
 List<String> getPackages()
          Returns the current list of LaTeX packages included in the graph.
 float getScaleFactor()
          Returns the scale factor of this axodraw object.
protected  int[] getSixInts(String str)
          Returns the six integers x1, y1,x2,y2,x3,y3 contained in a string of the form " # (x1, y1) (x2,y2) (x3,y3) * " where * can be anything and # doesn't contain any parenthesis.
protected  float getStroke()
          Return the current stroke (line width).
protected  int[] getT4Params(int[] firstl, int[] secondl)
           
protected  String[] getThreeCurls(String str)
          Returns the three strings s1, s2, s3 contained in a string of the form " # {s1}{s2}{s3} * " where * can be anything and # doesn't contain any curly brackets.
protected  String[] getTwoCurls(String str)
          Returns the two strings s1, s2 contained in a string of the form " # {s1}{s2} * " where * can be anything and # doesn't contain any curly brackets.
protected  int[] getTwoInts(String str)
          Returns the two integers xi,yi contained in a string of the form " # (xi,yi) * " where * can be anything and # doesn't contain any parenthesis.
 boolean[] getValid()
          Returns an array that indicates which required LaTeX commands were found.
protected  JaxoObject newPLine()
           
 boolean removePackage(String pack)
          Removes a latex package if it is contained in the package list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINE

protected static final String LINE
See Also:
Constant Field Values

COLOR

protected static final String COLOR
See Also:
Constant Field Values

REL_WIDTH

protected static final String REL_WIDTH
See Also:
Constant Field Values

REL_HEIGHT

protected static final String REL_HEIGHT
See Also:
Constant Field Values

PAINT_ARROW

protected static final String PAINT_ARROW
See Also:
Constant Field Values

STROKE_WIDTH

protected static final String STROKE_WIDTH
See Also:
Constant Field Values

FREQ_FROM_WIGGLES

protected static final String FREQ_FROM_WIGGLES
See Also:
Constant Field Values

DOUBLE_LINE

protected static final String DOUBLE_LINE
See Also:
Constant Field Values

DL_SEP

protected static final String DL_SEP
See Also:
Constant Field Values

AMP

protected static final String AMP
See Also:
Constant Field Values

DASH

protected static final String DASH
See Also:
Constant Field Values
Constructor Detail

JaxoAxodraw

public JaxoAxodraw()
Constructor: Initializes the list of Latex packages (axodraw and color).

Method Detail

getJaxoObject

public JaxoObject getJaxoObject(String newString)
Returns a JaxoObject corresponding to a axodraw command.

Parameters:
newString - One line of a latex file
Returns:
A JaxoObject the corresponds to the axodraw command of the input line, or null, if nothing corresponds

checkRequired

public final void checkRequired(String newString)
Checks whether the given string starts with one of "\documentclass", "\begin{document}" or "\begin{picture}".

Parameters:
newString - The input string.

getValid

public final boolean[] getValid()
Returns an array that indicates which required LaTeX commands were found.

Returns:
An array of three boolean variables, the first is true if "\documentclass" was found, the second is true if "\begin{document}" was found, the third is true if "\begin{picture}" was found

getPackages

public final List<String> getPackages()
Returns the current list of LaTeX packages included in the graph.

Returns:
A List that contains strings of latex packages.

addPackage

public final void addPackage(String pack)
Adds a latex package if it is not already contained in the package list.

Parameters:
pack - the package to add.

removePackage

public final boolean removePackage(String pack)
Removes a latex package if it is contained in the package list.

Parameters:
pack - the package to remove.
Returns:
true if the list contained the package, ie the list was modified.

getComment

public final String getComment()
Returns the comment (description) of this axodraw object.

Returns:
The axodraw comment

getScaleFactor

public final float getScaleFactor()
Returns the scale factor of this axodraw object.

Returns:
The axodraw scale factor.

getLineParams

protected int[] getLineParams(int[] in,
                              String st)

getT4Params

protected int[] getT4Params(int[] firstl,
                            int[] secondl)

getArcPoints

protected Point2D[] getArcPoints(String[] st,
                                 boolean clock)

getLoopPars

protected int[] getLoopPars(String[] st,
                            String st1,
                            boolean cntrclk)

getFourInts

protected int[] getFourInts(String str)
Returns the four integers xi,yi,xf,yf contained in a string of the form " # (xi,yi) (xf,yf) * " where * can be anything and # doesn't contain any parenthesis.

Parameters:
str - the string.
Returns:
the four ints.

getTwoInts

protected int[] getTwoInts(String str)
Returns the two integers xi,yi contained in a string of the form " # (xi,yi) * " where * can be anything and # doesn't contain any parenthesis.

Parameters:
str - the string.
Returns:
the two ints.

getFourInts

protected int[] getFourInts(String str,
                            int fromIndex)
Returns the four integers xi,yi,xf,yf contained in a string of the form " # (xi,yi) (xf,yf) * " where * can be anything and # doesn't contain any parenthesis.

Parameters:
str - the string.
fromIndex - the starting index.
Returns:
the four ints.

getSixInts

protected int[] getSixInts(String str)
Returns the six integers x1, y1,x2,y2,x3,y3 contained in a string of the form " # (x1, y1) (x2,y2) (x3,y3) * " where * can be anything and # doesn't contain any parenthesis.

Parameters:
str - the string.
Returns:
the six ints.

getOneBracket

protected String[] getOneBracket(String str)
Returns the two integers xi,yi contained in a string of the form " # (xi,yi) * " where * can be anything and # doesn't contain any parenthesis.

Parameters:
str - the String.
Returns:
the two ints.

getOneBrace

protected String getOneBrace(String str)
Returns the four integers xi,yi,xf,yf contained in a string of the form " # [String] * " where * can be anything and # doesn't contain any braces.

Parameters:
str - the String.
Returns:
the four ints.

getOneCurl

protected String getOneCurl(String str)
Returns the string "String" contained in a string of the form " # {String} * " where * can be anything and # doesn't contain any curly brackets.

Parameters:
str - the String.
Returns:
the String.

getTwoCurls

protected String[] getTwoCurls(String str)
Returns the two strings s1, s2 contained in a string of the form " # {s1}{s2} * " where * can be anything and # doesn't contain any curly brackets.

Parameters:
str - the String.
Returns:
the Strings.

getThreeCurls

protected String[] getThreeCurls(String str)
Returns the three strings s1, s2, s3 contained in a string of the form " # {s1}{s2}{s3} * " where * can be anything and # doesn't contain any curly brackets.

Parameters:
str - the String.
Returns:
the Strings.

getArcBrackets

protected String[] getArcBrackets(String str)
Returns the five strings s1 - s5 contained in a string of the form " # (s1, s2) (s3, s4, s5) * " where * can be anything and # doesn't contain any parenthesis.

Parameters:
str - the String.
Returns:
the Strings.

newPLine

protected JaxoObject newPLine()

getColor

protected Color getColor()
Return the current color.

Returns:
The current color.

getStroke

protected float getStroke()
Return the current stroke (line width).

Returns:
The current stroke.

getBBoxHeight

protected float getBBoxHeight()
Return the current bounding box height.

Returns:
The current bounding box height.


Copyright © 2003-2011 The JaxoDraw team. All Rights Reserved.