|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--quoggles.auxiliary.Util
A set of public static auxialiary methods.
| Nested Class Summary | |
(package private) static class |
Util.Unique
|
| Field Summary | |
static double |
CLICK_TOLERANCE
|
static java.lang.Object |
UNIQUE
|
| Constructor Summary | |
Util()
|
|
| Method Summary | |
static void |
addLabel(IBox iBox,
org.graffiti.graph.Node node)
Adds the name (id) of the given box as a label to the given node. |
static OptionParameter |
buildAttrPath()
Builds an OptionParameter using paths of the default node
and edge graphics attributes as options. |
static java.lang.Object |
convertFromParameter(org.graffiti.plugin.parameter.Parameter param)
Converts the given Parameter to an object. |
static org.graffiti.plugin.parameter.Parameter |
convertToParameter(java.lang.Object obj,
java.lang.String parType)
Converts the given object to a parameter. |
static org.graffiti.plugin.parameter.Parameter[] |
convertToParameters(java.lang.Object[] in)
Converts an array of objects to an array of parameters. |
static java.util.Collection |
ensureSize(java.util.Collection col,
int minSize)
Adds null values to the end of the given collection until the size of the collection is at least as large as the second parameter. |
static org.graffiti.graph.Node |
findMaybeNestedPredicateEnd(org.graffiti.graph.Node node,
boolean foundOne)
Find a BoolPredicateEnd_Box that may be hidden in a
SubQuery_Box. |
static java.util.Set |
gatherPaths(org.graffiti.attributes.Attribute attr,
java.util.Set set)
Recursively adds attribute paths to the given set. |
static java.awt.Point[] |
getAbsoluteInputPos(IBoxRepresentation iBoxRep)
Calculate the absolute positions from the relative positions given by the box representation. |
static java.awt.Point[] |
getAbsoluteOutputPos(IBoxRepresentation iBoxRep)
Calculate the absolute positions from the relative positions given by the box representation. |
static java.awt.Point |
getAbsPos(IBoxRepresentation iBoxRep,
boolean isInput,
int index)
Calculate the absolute position from the relative position of the given input / output (via index) of the given box representation. |
static IBox |
getBox(org.graffiti.graph.Node n)
Returns the box that is saved via a BoxAttribute in the
given Node. |
static javax.swing.JComponent |
getCorrectSource(java.awt.event.MouseEvent e)
Used by the MouseListener methods. |
static org.graffiti.attributes.Attribute |
getFreshAttribute(java.lang.String id,
java.lang.Object value,
org.graffiti.attributes.Attributable attbl,
java.lang.String type)
According to the type specified by first (0) parameter, create a new instance of an attribute. |
static int |
getIOIndex(org.graffiti.graph.Edge e,
boolean out)
Returns index of the input / putput (depending on the value of the second parameter) of the given edge. |
static java.awt.geom.Point2D |
getNextFreeConnection(org.graffiti.graph.Graph graph,
java.awt.geom.Point2D mousePos,
boolean lookForFreeOutput,
java.awt.Component dComp)
Get position of a free IO connection next to the given position. |
static java.util.Collection |
getSourcesFrom(org.graffiti.graph.Node endNode,
java.util.Collection preNodes)
See the QPreNodesAlgorithm. |
static boolean |
interpretAsBoolean(java.lang.Object obj)
An object evaluates to false, if one of the following holds
(tried in the given order; if the class pattern matches, but the rest
of the condition fails, the initial object is considered to evaluate to
true):
it is an empty Collection
it is a non-empty Collection and one of its elements
evaluates to false
it is a Boolean and its value is false
it is a Number and its value is 0d or NaN
it is null
it is the special value quoggles.constants.QConstants.EMPTY
its value as a string (what a call to toString()
yields) is equal to "false" (ignoring case)
|
static boolean |
isControlDown(java.awt.event.MouseEvent me)
Returns true iff the MouseEvent indicates that the control
or the shift key has been pressed while generating the event. |
static boolean |
lineContains(java.awt.geom.Line2D line,
double x,
double y)
Checks whether or not a point is said to be located on a line. |
static java.lang.Boolean |
match(java.lang.Object compObject,
org.graffiti.plugin.parameter.Parameter[] parameters)
Checks whether compObject matches the value given by the
parameters. |
static int |
max(int a,
int b,
int c)
|
static int |
max(int a,
int b,
int c,
int d)
|
static int |
min(int a,
int b,
int c)
|
static int |
min(int a,
int b,
int c,
int d)
|
static void |
pushOutputs(org.graffiti.graph.Node node,
IBox box)
Set output from the given node/box, as input to its successors. |
static void |
pushOutputs(org.graffiti.graph.Node node,
IBox box,
int notIndex)
Set output from the given node/box, as input to its successors. |
static void |
resetAllBoxes(org.graffiti.graph.Graph qGraph)
Calls reset() for all boxes in the given graph. |
static void |
resetAllBoxesFrom(org.graffiti.graph.Graph qGraph,
java.util.Collection startNodes)
Calls reset(int) for all boxes where there exists a path
from one of the nodes in the collection startNodes.
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.Object UNIQUE
public static final double CLICK_TOLERANCE
| Constructor Detail |
public Util()
| Method Detail |
public static int max(int a,
int b,
int c,
int d)
public static int min(int a,
int b,
int c,
int d)
public static int max(int a,
int b,
int c)
public static int min(int a,
int b,
int c)
public static IBox getBox(org.graffiti.graph.Node n)
BoxAttribute in the
given Node.
n -
public static boolean isControlDown(java.awt.event.MouseEvent me)
MouseEvent indicates that the control
or the shift key has been pressed while generating the event.
me - mouse event
public static int getIOIndex(org.graffiti.graph.Edge e,
boolean out)
false means that the index is returned that indicates into
which input (number) the edge's output (target) leads.
true means that the index is returned that indicates from
which output (number) the edge's input (source) comes from.
e - out -
public static boolean interpretAsBoolean(java.lang.Object obj)
false, if one of the following holds
(tried in the given order; if the class pattern matches, but the rest
of the condition fails, the initial object is considered to evaluate to
true):
Collection
Collection and one of its elements
evaluates to falseBoolean and its value is falseNumber and its value is 0d or NaNnullquoggles.constants.QConstants.EMPTYtoString()
yields) is equal to "false" (ignoring case)
public static java.lang.Boolean match(java.lang.Object compObject,
org.graffiti.plugin.parameter.Parameter[] parameters)
throws InvalidInputException,
InvalidParameterException
compObject matches the value given by the
parameters.It uses conversions to the format specified via the parameters.
A null value always leads to false except when string
comparison is applied. In this case, the object is converted to the
string "null" prior to testing.
compObject - the object to check
compObject matches the value given by the
parameters
InvalidInputException
InvalidParameterException
public static java.awt.Point getAbsPos(IBoxRepresentation iBoxRep,
boolean isInput,
int index)
iBoxRep -
public static boolean lineContains(java.awt.geom.Line2D line,
double x,
double y)
CLICK_TOLERANCE as a certain tolerance, i.e. it
really checks whether or not the point lies on a thicker line.
line - x - y -
public static OptionParameter buildAttrPath()
OptionParameter using paths of the default node
and edge graphics attributes as options.
OptionParameter holding paths of the default
node and edge graphics attributes as options.
public static java.util.Set gatherPaths(org.graffiti.attributes.Attribute attr,
java.util.Set set)
attr - the attribute that is added / searchedset - the set to which paths are added
public static org.graffiti.graph.Node findMaybeNestedPredicateEnd(org.graffiti.graph.Node node,
boolean foundOne)
throws QueryExecutionException
BoolPredicateEnd_Box that may be hidden in a
SubQuery_Box.
node - the associated box must be a sink; find a predicate end box
(maybe hidden in nested sub query boxes)
QueryExecutionException
public static java.util.Collection ensureSize(java.util.Collection col,
int minSize)
col - the collection the size of which should be ensuredminSize - the minimum size the collection must have
public static void pushOutputs(org.graffiti.graph.Node node,
IBox box)
throws QueryExecutionException
node - box -
QueryExecutionException
public static void pushOutputs(org.graffiti.graph.Node node,
IBox box,
int notIndex)
throws QueryExecutionException
node - box -
QueryExecutionExceptionpublic static javax.swing.JComponent getCorrectSource(java.awt.event.MouseEvent e)
MouseListener methods. Find the
IBoxIcon or BoxRepresentation at the point
from the given MouseEvent. If no such component can be
found, returns the source saved in the MouseEvent.
e - mouse event
public static java.awt.geom.Point2D getNextFreeConnection(org.graffiti.graph.Graph graph,
java.awt.geom.Point2D mousePos,
boolean lookForFreeOutput,
java.awt.Component dComp)
graph - the graph whose node contain the boxes to be searchedmousePos - lookForFreeOutput - true if the box we work for has a free input
i.e. only outputs from other boxes need to be searched
public static java.awt.Point[] getAbsoluteInputPos(IBoxRepresentation iBoxRep)
iBoxRep -
public static java.awt.Point[] getAbsoluteOutputPos(IBoxRepresentation iBoxRep)
iBoxRep -
public static java.util.Collection getSourcesFrom(org.graffiti.graph.Node endNode,
java.util.Collection preNodes)
endNode -
QPreNodesAlgorithm
public static void resetAllBoxesFrom(org.graffiti.graph.Graph qGraph,
java.util.Collection startNodes)
reset(int) for all boxes where there exists a path
from one of the nodes in the collection startNodes.
That does not include the nodes contained in startNodes.
It only resets those inputs that can be reached, not the whole box.
qGraph - startNodes - nodes that should not be reset but where the search
startspublic static void resetAllBoxes(org.graffiti.graph.Graph qGraph)
reset() for all boxes in the given graph.
qGraph -
public static void addLabel(IBox iBox,
org.graffiti.graph.Node node)
iBox - node -
public static org.graffiti.plugin.parameter.Parameter[] convertToParameters(java.lang.Object[] in)
throws java.lang.Exception
in -
Parameter[] version of the given object array
java.lang.Exception
public static org.graffiti.plugin.parameter.Parameter convertToParameter(java.lang.Object obj,
java.lang.String parType)
throws java.lang.Exception
null, it should contain a (fully-quantified) class name of
the parameter to which the given object should be converted.
If the string is null, the best fitting parameter type
is automatically deduced.
obj - parType -
Parameter holding the given object as value
java.lang.Exception - if the object cannot be convertedpublic static java.lang.Object convertFromParameter(org.graffiti.plugin.parameter.Parameter param)
Parameter to an object.
param -
public static org.graffiti.attributes.Attribute getFreshAttribute(java.lang.String id,
java.lang.Object value,
org.graffiti.attributes.Attributable attbl,
java.lang.String type)
throws InvalidInputException
value as its initial value.
id - id of the new attributevalue - value of the new attributeattbl - Attributable; used to further distinguish type
of attribute (e.g. labels: node label / edge label)
InvalidInputException - if type and value do not correspond
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||