com.tensegrity.graph.layout
Class LayoutUtil

java.lang.Object
  extended bycom.tensegrity.graph.layout.LayoutUtil

public class LayoutUtil
extends java.lang.Object

This class provides a number of utility operations that might be used by a NodeLayout class.

Version:
$Id: LayoutUtil.java,v 1.28 2006/03/14 14:35:25 MichaelKegel Exp $
Author:
Sharokh Khani

Field Summary
static int EAST
          Segment direction specifier.
static int NONE
          The segment direction cannot be specified
static int NORTH
          Segment direction specifier.
static Constraint positiveMetricExpressionValue
          A metric expression for positive values
static int SOUTH
          Segment direction specifier .
static int WEST
          Segment direction specifier.
 
Method Summary
static boolean changeAttribute(AttributeSet attrSet, java.lang.String oldName, java.lang.String newName)
          Changes the name of an attribute within an specified attribute-set
static int convertMetricValue(MetricExpression mexp)
          This method converts a given MetricExpression to internal measuring unit.
static boolean getAttributeBooleanValue(AttributeSet attributeSet, java.lang.String attrName, boolean defaultValue)
          This method extracts a given AttributeSet and returns the contained boolean value, or the specified default value, in case of any failure.
static double getAttributeDoubleValue(AttributeSet attributeSet, java.lang.String attrName, double defaultValue)
          This method extracts a given AttributeSet and returns the contained double value, or the specified default value, in case of any failure.
static int getAttributeIntValue(AttributeSet attributeSet, java.lang.String attrName, int defaultValue)
          This method extracts a given AttributeSet and returns the contained int value, or the specified default value, in case of any failure.
static MetricExpression getAttributeMetricValue(AttributeSet attributeSet, java.lang.String attrName, MetricExpression defaultValue)
          This method extracts a given AttributeSet and returns the contained MetricExpression.
static java.lang.String getAttributeStrValue(AttributeSet attributeSet, java.lang.String attrName, java.lang.String defaultValue)
          This method extracts a given AttributeSet and returns the contained string, or the specified default value, in case of any failure.
static int getEdgeDirection(LayoutableEdge edge, boolean start)
          This method determines the hitting direction of an specified edge with its source or target node.
static java.lang.String nodelayoutDirection2String(int direction)
           
static Constraint parseConstraint(ConstraintParser cp, java.lang.String constraint)
           
static boolean setAttribute(AttributeSet attributeSet, java.lang.String attrName, java.lang.Object value)
          This method can be used to change the value of an specified Attribute within an AttributeSet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
The segment direction cannot be specified

See Also:
Constant Field Values

WEST

public static final int WEST
Segment direction specifier. The segment hits the connected node at the west side

See Also:
Constant Field Values

EAST

public static final int EAST
Segment direction specifier. The segment hits the connected node at the east side

See Also:
Constant Field Values

NORTH

public static final int NORTH
Segment direction specifier. The segment hits the connected node at the north side

See Also:
Constant Field Values

SOUTH

public static final int SOUTH
Segment direction specifier . The segment hits the connected node at the south side

See Also:
Constant Field Values

positiveMetricExpressionValue

public static final Constraint positiveMetricExpressionValue
A metric expression for positive values

Method Detail

parseConstraint

public static final Constraint parseConstraint(ConstraintParser cp,
                                               java.lang.String constraint)

getAttributeIntValue

public static int getAttributeIntValue(AttributeSet attributeSet,
                                       java.lang.String attrName,
                                       int defaultValue)
This method extracts a given AttributeSet and returns the contained int value, or the specified default value, in case of any failure.

Parameters:
attributeSet - the AttributeSet which wraps the int value specified by attrName.
attrName - the name of the attribute in the attribute set.
defaultValue - the value that should be returned in case the of any failure.
Returns:
the int value specified by attrName.

getAttributeDoubleValue

public static double getAttributeDoubleValue(AttributeSet attributeSet,
                                             java.lang.String attrName,
                                             double defaultValue)
This method extracts a given AttributeSet and returns the contained double value, or the specified default value, in case of any failure.

Parameters:
attributeSet - the AttributeSet which wraps the double value specified by attrName.
attrName - the name of the attribute in the attribute set.
defaultValue - the value that should be returned in case the of any failure.
Returns:
the double value specified by attrName.

getAttributeStrValue

public static java.lang.String getAttributeStrValue(AttributeSet attributeSet,
                                                    java.lang.String attrName,
                                                    java.lang.String defaultValue)
This method extracts a given AttributeSet and returns the contained string, or the specified default value, in case of any failure.

Parameters:
attributeSet - the AttributeSet which wraps the string specified by attrName.
attrName - the name of the attribute in the attribute set.
defaultValue - the value that should be returned in case the of any failure.
Returns:
the string specified by attrName.

getAttributeBooleanValue

public static boolean getAttributeBooleanValue(AttributeSet attributeSet,
                                               java.lang.String attrName,
                                               boolean defaultValue)
This method extracts a given AttributeSet and returns the contained boolean value, or the specified default value, in case of any failure.

Parameters:
attributeSet - the AttributeSet which wraps the boolean value specified by attrName.
attrName - the name of the attribute in the attribute set.
defaultValue - the value that should be returned in case the of any failure.
Returns:
the boolean value specified by attrName.

getAttributeMetricValue

public static final MetricExpression getAttributeMetricValue(AttributeSet attributeSet,
                                                             java.lang.String attrName,
                                                             MetricExpression defaultValue)
This method extracts a given AttributeSet and returns the contained MetricExpression.

Parameters:
attributeSet - attributeSet the AttributeSet which wraps the boolean value specified by attrName.
attrName - the name of the attribute in the attribute set.
defaultValue - the value that should be returned in case the of any failure.
Returns:
the boolean value specified by attrName.

setAttribute

public static boolean setAttribute(AttributeSet attributeSet,
                                   java.lang.String attrName,
                                   java.lang.Object value)
This method can be used to change the value of an specified Attribute within an AttributeSet.

Parameters:
attributeSet - the main attribute set of which an attribute is to be changed.
attrName - the name of the attribute withhin the attribute set
value - the new value for the attribute specified by attrName.
Returns:
true if the function was successful;

convertMetricValue

public static final int convertMetricValue(MetricExpression mexp)
This method converts a given MetricExpression to internal measuring unit.

Parameters:
mexp - the MetricExpression that is to be converted.
Returns:
value in the internal measuring unit.

getEdgeDirection

public static int getEdgeDirection(LayoutableEdge edge,
                                   boolean start)
This method determines the hitting direction of an specified edge with its source or target node.

Parameters:
edge - the edge of which die hitting direction is to be determined.
start - specified whether the hitting direction of the edge-start is to be determined, or the hitting direction of the edge-end.
Returns:
the hitting direction. It can be one of the following:

changeAttribute

public static boolean changeAttribute(AttributeSet attrSet,
                                      java.lang.String oldName,
                                      java.lang.String newName)
Changes the name of an attribute within an specified attribute-set

Parameters:
attrSet - the attribute-set
oldName - the old name of the attribute which is to be changed.
newName - the new name for the attribute.
Returns:
true if the specified attribute could found and changed successfully.

nodelayoutDirection2String

public static final java.lang.String nodelayoutDirection2String(int direction)


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.