Module logicng
Class GraphicalGeneratorBuilder<T extends GraphicalGenerator<C>,C>
- java.lang.Object
-
- org.logicng.io.graphical.generators.GraphicalGeneratorBuilder<T,C>
-
- Type Parameters:
T- the type of the generator which is built at the endC- the type of content from which the nodes are generated
- Direct Known Subclasses:
BddGraphicalGenerator.BddGraphicalGeneratorBuilder
public class GraphicalGeneratorBuilder<T extends GraphicalGenerator<C>,C> extends Object
A builder for graphical generators with some common options.- Since:
- 2.4.0
- Version:
- 2.4.0
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanalignTerminalsprotected GraphicalColorbackgroundColorprotected Function<GraphicalGeneratorBuilder<T,C>,T>constructorprotected GraphicalEdgeStyledefaultEdgeStyleprotected GraphicalNodeStyledefaultNodeStyleprotected EdgeStyleMapper<C>edgeMapperprotected LabelMapper<C>labelMapperprotected NodeStyleMapper<C>nodeStyleMapper
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GraphicalGeneratorBuilder<T,C>alignTerminals(boolean alignTerminals)Sets whether all terminal nodes of the graph should be aligned on the same level.GraphicalGeneratorBuilder<T,C>backgroundColor(int red, int green, int blue)Sets the background color for the graph as RGB value.GraphicalGeneratorBuilder<T,C>backgroundColor(String hexColor)Sets the background color for the graph as hex color value.GraphicalGeneratorBuilder<T,C>backgroundColor(GraphicalColor color)Sets the background color for the graph.Tbuild()Returns the graphical generator with this builder's configuration.GraphicalGeneratorBuilder<T,C>defaultEdgeStyle(GraphicalEdgeStyle edgeStyle)Sets the default edge style for all edges in the graph.GraphicalGeneratorBuilder<T,C>defaultNodeStyle(GraphicalNodeStyle nodeStyle)Sets the default node style for all nodes in the graph.GraphicalGeneratorBuilder<T,C>edgeMapper(EdgeStyleMapper<C> edgeMapper)Sets the edge mapper for dynamically styling edges in the graph.GraphicalGeneratorBuilder<T,C>labelMapper(LabelMapper<C> labelMapper)Sets the label mapper for dynamically computing labels for nodes in the graph.GraphicalGeneratorBuilder<T,C>nodeStyleMapper(NodeStyleMapper<C> nodeStyleMapper)Sets the node style mapper for dynamically styling nodes in the graph.
-
-
-
Field Detail
-
backgroundColor
protected GraphicalColor backgroundColor
-
alignTerminals
protected boolean alignTerminals
-
defaultEdgeStyle
protected GraphicalEdgeStyle defaultEdgeStyle
-
defaultNodeStyle
protected GraphicalNodeStyle defaultNodeStyle
-
nodeStyleMapper
protected NodeStyleMapper<C> nodeStyleMapper
-
labelMapper
protected LabelMapper<C> labelMapper
-
edgeMapper
protected EdgeStyleMapper<C> edgeMapper
-
constructor
protected final Function<GraphicalGeneratorBuilder<T extends GraphicalGenerator<C>,C>,T extends GraphicalGenerator<C>> constructor
-
-
Method Detail
-
backgroundColor
public GraphicalGeneratorBuilder<T,C> backgroundColor(GraphicalColor color)
Sets the background color for the graph.- Parameters:
color- the color- Returns:
- the current builder
-
backgroundColor
public GraphicalGeneratorBuilder<T,C> backgroundColor(String hexColor)
Sets the background color for the graph as hex color value.- Parameters:
hexColor- the hex color value in the format "#aabbcc"- Returns:
- the current builder
-
backgroundColor
public GraphicalGeneratorBuilder<T,C> backgroundColor(int red, int green, int blue)
Sets the background color for the graph as RGB value.- Parameters:
red- the red valuegreen- the green valueblue- the blue value- Returns:
- the current builder
-
alignTerminals
public GraphicalGeneratorBuilder<T,C> alignTerminals(boolean alignTerminals)
Sets whether all terminal nodes of the graph should be aligned on the same level.This flag is only applied to BDD and formula DAG and AST graphs. It can only be applied by DOT, not by Mermaid.js.
- Parameters:
alignTerminals- whether the terminal nodes should be on the same level- Returns:
- the current builder
-
defaultEdgeStyle
public GraphicalGeneratorBuilder<T,C> defaultEdgeStyle(GraphicalEdgeStyle edgeStyle)
Sets the default edge style for all edges in the graph. In a BDD graph this is the style of the positive (high) edges. If no dynamic edge styling is configured viaedgeMapper(EdgeStyleMapper), this style will be applied to all edges.- Parameters:
edgeStyle- the edge style- Returns:
- the current builder
-
defaultNodeStyle
public GraphicalGeneratorBuilder<T,C> defaultNodeStyle(GraphicalNodeStyle nodeStyle)
Sets the default node style for all nodes in the graph. If no dynamic node styling is configured vianodeStyleMapper(NodeStyleMapper))}, this style will be applied to all nodes.- Parameters:
nodeStyle- the node style- Returns:
- the current builder
-
nodeStyleMapper
public GraphicalGeneratorBuilder<T,C> nodeStyleMapper(NodeStyleMapper<C> nodeStyleMapper)
Sets the node style mapper for dynamically styling nodes in the graph. If this mapper is configured, the default node style is ignored and each node is styled by the computed style ofNodeStyleMapper.computeStyle(Object).- Parameters:
nodeStyleMapper- the node style mapper- Returns:
- the current builder
-
labelMapper
public GraphicalGeneratorBuilder<T,C> labelMapper(LabelMapper<C> labelMapper)
Sets the label mapper for dynamically computing labels for nodes in the graph.- Parameters:
labelMapper- the label mapper- Returns:
- the current builder
-
edgeMapper
public GraphicalGeneratorBuilder<T,C> edgeMapper(EdgeStyleMapper<C> edgeMapper)
Sets the edge mapper for dynamically styling edges in the graph. If this mapper is configured, the default edge style is ignored and each edge is styled by the computed style ofEdgeStyleMapper.computeStyle(Object, Object). For BDDs this mapper is only used for positive (high) edges.- Parameters:
edgeMapper- the edge mapper- Returns:
- the current builder
-
build
public T build()
Returns the graphical generator with this builder's configuration.- Returns:
- the graphical generator
-
-