Package net.sf.jaxodraw.io.imports
Class JaxoAxodraw
- java.lang.Object
-
- net.sf.jaxodraw.io.imports.JaxoAxodraw
-
- Direct Known Subclasses:
JaxoAxodraw4J
public class JaxoAxodraw extends java.lang.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
Fields Modifier and Type Field Description protected static java.lang.String
AMP
protected static java.lang.String
COLOR
protected static java.lang.String
DASH
protected static java.lang.String
DL_SEP
protected static java.lang.String
DOUBLE_LINE
protected static java.lang.String
FREQ_FROM_WIGGLES
protected static java.lang.String
LINE
protected static java.lang.String
PAINT_ARROW
protected static java.lang.String
REL_HEIGHT
protected static java.lang.String
REL_WIDTH
protected static java.lang.String
STROKE_WIDTH
-
Constructor Summary
Constructors Constructor Description JaxoAxodraw()
Constructor: Initializes the list of Latex packages (axodraw and color).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPackage(java.lang.String pack)
Adds a latex package if it is not already contained in the package list.void
checkRequired(java.lang.String newString)
Checks whether the given string starts with one of "\documentclass", "\begin{document}" or "\begin{picture}".protected java.lang.String[]
getArcBrackets(java.lang.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 java.awt.geom.Point2D[]
getArcPoints(java.lang.String[] st, boolean clock)
protected float
getBBoxHeight()
Return the current bounding box height.protected java.awt.Color
getColor()
Return the current color.java.lang.String
getComment()
Returns the comment (description) of this axodraw object.protected int[]
getFourInts(java.lang.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(java.lang.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(java.lang.String newString)
Returns a JaxoObject corresponding to a axodraw command.protected int[]
getLineParams(int[] in, java.lang.String st)
protected int[]
getLoopPars(java.lang.String[] st, java.lang.String st1, boolean cntrclk)
protected java.lang.String
getOneBrace(java.lang.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 java.lang.String[]
getOneBracket(java.lang.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 java.lang.String
getOneCurl(java.lang.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.java.util.List<java.lang.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(java.lang.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 java.lang.String[]
getThreeCurls(java.lang.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 java.lang.String[]
getTwoCurls(java.lang.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(java.lang.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(java.lang.String pack)
Removes a latex package if it is contained in the package list.
-
-
-
Field Detail
-
LINE
protected static final java.lang.String LINE
- See Also:
- Constant Field Values
-
COLOR
protected static final java.lang.String COLOR
- See Also:
- Constant Field Values
-
REL_WIDTH
protected static final java.lang.String REL_WIDTH
- See Also:
- Constant Field Values
-
REL_HEIGHT
protected static final java.lang.String REL_HEIGHT
- See Also:
- Constant Field Values
-
PAINT_ARROW
protected static final java.lang.String PAINT_ARROW
- See Also:
- Constant Field Values
-
STROKE_WIDTH
protected static final java.lang.String STROKE_WIDTH
- See Also:
- Constant Field Values
-
FREQ_FROM_WIGGLES
protected static final java.lang.String FREQ_FROM_WIGGLES
- See Also:
- Constant Field Values
-
DOUBLE_LINE
protected static final java.lang.String DOUBLE_LINE
- See Also:
- Constant Field Values
-
DL_SEP
protected static final java.lang.String DL_SEP
- See Also:
- Constant Field Values
-
AMP
protected static final java.lang.String AMP
- See Also:
- Constant Field Values
-
DASH
protected static final java.lang.String DASH
- See Also:
- Constant Field Values
-
-
Method Detail
-
getJaxoObject
public JaxoObject getJaxoObject(java.lang.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(java.lang.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 java.util.List<java.lang.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(java.lang.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(java.lang.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 java.lang.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, java.lang.String st)
-
getT4Params
protected int[] getT4Params(int[] firstl, int[] secondl)
-
getArcPoints
protected java.awt.geom.Point2D[] getArcPoints(java.lang.String[] st, boolean clock)
-
getLoopPars
protected int[] getLoopPars(java.lang.String[] st, java.lang.String st1, boolean cntrclk)
-
getFourInts
protected int[] getFourInts(java.lang.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(java.lang.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(java.lang.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(java.lang.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 java.lang.String[] getOneBracket(java.lang.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 java.lang.String getOneBrace(java.lang.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 java.lang.String getOneCurl(java.lang.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 java.lang.String[] getTwoCurls(java.lang.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 java.lang.String[] getThreeCurls(java.lang.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 java.lang.String[] getArcBrackets(java.lang.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 java.awt.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.
-
-