Package eu.bandm.tools.d2d2.base
Class SyntaxGraph.Layouter
java.lang.Object
eu.bandm.tools.d2d2.model.MATCH_ONLY_00
eu.bandm.tools.d2d2.model.SinglePhase
eu.bandm.tools.d2d2.base.SyntaxGraph.Layouter
- Enclosing class:
- SyntaxGraph
First phase which calculates the sizes of all sub-terms and their
positions relative to the containing term.
Every action method returns a SizeInfo object in the register
sizeInfo
.
Each graph has one y-value as its entry and exit height, and an
entry and exit x-pos. These are stored in SyntaxGraph.y
,
SyntaxGraph.inX
and SyntaxGraph.outX
and are all relative
to the containing graph.
The action method for a combinator shifts the SizeInfo areas relative to its origin (0,0), and stores the resulting co-ordinates.
In the second phase (the drawing process) these shifts are respected by concatenating affine transformations.
The y-coordinate grows downward. The code for {@link Layouter#(eu.bandm.tools.d2d2.model.Opt)} is commented in detail to demonstrate this strategy.
-
Field Summary
Modifier and TypeFieldDescription(package private) SyntaxGraph.SizeInfo
Current visitor register holding the return value of the last visit.Fields inherited from class eu.bandm.tools.d2d2.model.MATCH_ONLY_00
_visitor_debug_stream, partial
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Calculate graphic size and position of an Alt-Expressin.void
action
(CharBinary exp) Caculates the size of the sub-expressions, shifts them to some co-ordinates relative to the binary operator expression, and calculates the resultingsizeInfo
.void
action
(CharSetConst cs) Calculate the size of the visual representation of a character set const.void
action
(CharsRegExp def) void
void
void
Caculates the size of the sub-expression, shifts the sub-expression to some co-ordinates relative to the Opt-expression, and calculates the resultingsizeInfo
:void
action
(ParseParticle pp) Caculates the size of the sub-expressions, shifts them to some co-ordinates relative to the operator expression, and calculates the resultingsizeInfo
.void
Calculate size for the standard constant "#PCDATA" sub-expression.void
Calculate graphic size and position of a Perm Alt-Expressin.void
Caculates the size of the sub-expression, shifts the sub-expression to some co-ordinates relative to the Plus-expression, and calculates the resultingsizeInfo
.void
void
Caculates the size of the sub-expression, shifts the sub-expression to some co-ordinates relative to the Seq-expression, and calculates the resultingsizeInfo
.void
Caculates the size of the sub-expression, shifts the sub-expression to some co-ordinates relative to the Star-expression, and calculates the resultingsizeInfo
.void
action
(StringConst sc) Calculate the size of the visual representation of a String const.void
void
action
(TagsRegExp def) void
(package private) void
calculateMetaBox
(Expression exp, Expression sub) Make room for a dashed box around an expression.Service Access Point: calculate layout coordinates (in/out y, xIn, xOut) for all sub-exprssions in an expression tree.protected void
processAltOrInnerPerm
(Iterator<Expression> subs, int outerW) Caculates the size of the sub-expression, shifts the sub-expression to some co-ordinates relative to the Alt- or Perm-expression, and calculates the resultingsizeInfo
.protected SyntaxGraph.SizeInfo
Calculate according to the dimensions of the text to print.Methods inherited from class eu.bandm.tools.d2d2.model.SinglePhase
action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, follow_definitions, follow_defInstances, follow_docu, follow_firsts, follow_globalSubsts, follow_imports, follow_itemDocu, follow_localdefs, follow_localSubsts, follow_modules, follow_namespaces, follow_obligates, follow_on, follow_rawModules, follow_text, follow_weakfirsts, follow_xattributes
Methods inherited from class eu.bandm.tools.d2d2.model.MATCH_ONLY_00
_visitor_trace, action, action, action, action, compile, followAll_definitions, followAll_defInstances, followAll_docu, followAll_firsts, followAll_globalSubsts, followAll_imports, followAll_itemDocu, followAll_localdefs, followAll_localSubsts, followAll_modules, followAll_namespaces, followAll_obligates, followAll_on, followAll_rawModules, followAll_text, followAll_weakfirsts, followAll_xattributes, foreignObject, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, nomatch
-
Field Details
-
sizeInfo
SyntaxGraph.SizeInfo sizeInfoCurrent visitor register holding the return value of the last visit.
-
-
Constructor Details
-
Layouter
public Layouter()
-
-
Method Details
-
layout
Service Access Point: calculate layout coordinates (in/out y, xIn, xOut) for all sub-exprssions in an expression tree. -
action
- Overrides:
action
in classSinglePhase
-
action
- Overrides:
action
in classSinglePhase
-
action
- Overrides:
action
in classSinglePhase
-
sizeInfoByNormalText
Calculate according to the dimensions of the text to print. UsesSyntaxGraph.mainFont
. -
action
Calculate size for the standard constant "#PCDATA" sub-expression.- Overrides:
action
in classSinglePhase
-
calculateMetaBox
Make room for a dashed box around an expression. -
action
- Overrides:
action
in classSinglePhase
-
action
- Overrides:
action
in classSinglePhase
-
action
- Overrides:
action
in classSinglePhase
-
action
- Overrides:
action
in classSinglePhase
-
action
Caculates the size of the sub-expression, shifts the sub-expression to some co-ordinates relative to the Opt-expression, and calculates the resultingsizeInfo
:--------------------------- passline \__xxxxxxxx__/ __ y xxxxxxxx xxxxxxxx = relative co-ordinates of the sub-expr. ^xin ^xout
- Overrides:
action
in classSinglePhase
-
action
Caculates the size of the sub-expression, shifts the sub-expression to some co-ordinates relative to the Star-expression, and calculates the resultingsizeInfo
. For details seeaction(eu.bandm.tools.d2d2.model.Opt)
.- Overrides:
action
in classSinglePhase
-
action
Caculates the size of the sub-expression, shifts the sub-expression to some co-ordinates relative to the Plus-expression, and calculates the resultingsizeInfo
. For details seeaction(eu.bandm.tools.d2d2.model.Opt)
.- Overrides:
action
in classSinglePhase
-
processAltOrInnerPerm
Caculates the size of the sub-expression, shifts the sub-expression to some co-ordinates relative to the Alt- or Perm-expression, and calculates the resultingsizeInfo
. For details seeaction(eu.bandm.tools.d2d2.model.Opt)
. -
action
Calculate graphic size and position of an Alt-Expressin.- Overrides:
action
in classSinglePhase
- See Also:
-
action
Calculate graphic size and position of a Perm Alt-Expressin.- Overrides:
action
in classSinglePhase
- See Also:
-
action
Caculates the size of the sub-expression, shifts the sub-expression to some co-ordinates relative to the Seq-expression, and calculates the resultingsizeInfo
. For details seeaction(eu.bandm.tools.d2d2.model.Opt)
.- Overrides:
action
in classSinglePhase
-
action
Calculate the size of the visual representation of a character set const.- Overrides:
action
in classSinglePhase
-
action
Caculates the size of the sub-expressions, shifts them to some co-ordinates relative to the binary operator expression, and calculates the resultingsizeInfo
. For details seeaction(eu.bandm.tools.d2d2.model.Opt)
.- Overrides:
action
in classSinglePhase
-
action
Caculates the size of the sub-expressions, shifts them to some co-ordinates relative to the operator expression, and calculates the resultingsizeInfo
. For details seeaction(eu.bandm.tools.d2d2.model.Opt)
.- Overrides:
action
in classSinglePhase
-
action
Calculate the size of the visual representation of a String const.- Overrides:
action
in classSinglePhase
-