## devisor2.foundation.elements
Class Edge

    java.lang.Object
      devisor2.foundation.GridItem
          devisor2.foundation.elements.Edge

All Implemented Interfaces:
  java.io.Serializable

public class Edge
extends GridItem
implements java.io.Serializable

This class represents the GridItem extension for edges. Edges are defined via two nodes and can carry additional properties such as edge stati etc. Edges form the top-level elements.

See Also:
  Serialized Form

Field Summary
`static int` `BC_DIRICHLET` Constant for boundary condition DIRICHLET
`static int` `BC_NEUMANN` Constant for boundary condition NEUMANN
`static int` `BC_NONE` Constant for boundary condition NONE
`protected Boundary` `boundary` if boundary Edge then contains the boundary of the edge
`protected boolean` `boundaryEdge` Boundary Edge or not
`protected int` `edgebc` boundary condition of the edge (use constants provided)
`protected int` `edgestatus` Status of the edge (use constants provided)
`int` `level` the hierarchical level of this edge (yet not implemented)
`int` `marker` marker of this edge
`protected int` `number` the number of this edge, updated by updateEdgeNumbers()
`protected Node[]` `p` the nodes of this edge
`protected java.util.Vector` `parents` The Cell2D Objects which contain this edge
`static int` `STATUS_INNER` Constant for edge status INNER
`static int` `STATUS_MIRRORB` Constant for edge status MIRROR BOUNDARY
`static int` `STATUS_NONE` Constant for edge status NONE
`static int` `STATUS_REAL` Constant for edge status REAL

Fields inherited from class devisor2.foundation.GridItem
`cc, marked, transformed, xmax, xmin, ymax, ymin`

Constructor Summary
`Edge(Node n1, Node n2)` creates an edge from node a to b
`Edge(Node n1, Node n2, int es)`
`Edge(Node n1, Node n2, int es, int bc)`

Method Summary
`void` `addParent(Cell2D c)` addParent adds the given Cell2D c to the parent vector
`java.lang.Object` `clone()` returns an exact copy of this edge, but not cloning recursively (i.e.
`void` `draw(java.awt.Graphics g)` draw this edge with respect to transformation and drawcontrol
`void` `fill(java.awt.Graphics g)` fill this edge with its color with respect to transformation and drawcontrol
`int` `getBC()` returns the boundarycondition of the edge
`java.util.Vector` `getFathers()`
`double` `getLength()` calculates the length of the edge (simple pythagoras) and returns it
`int` `getMarker()` returns the marker value of this edge
`Node` `getNode(int i)` returns the i-th Node (0 or 1) of this edge
`double` `getNodeAverageValue(int index)` Returns the average of the ith value of the nodes defining this cell.
`int` `getNumber()` returns the number of the edge
`double[]` `getParameters()` returns all parameters of the griditem in an int array
`java.lang.Object[]` `getParents()` getParents() returns the parent Cells(2D) as array of Objects
`java.awt.Rectangle` `getPerimeter()` returns the perimeter of the Edge element, that is the smallest bounding box completely containing the Edge
`int` `getStatus()` returns the status of the edge
`boolean` `isHit(int cx, int cy)` Determines if the item has been hit by a click on the grid ALL IN world COORDINATES to avoid the snap mechanism
`boolean` `isInside(int[] topleft, int[] bottomright)` Is the item inside a given rectangular area? All in WORLD COORDINATES!!!
`boolean` `isOnEdge(Node n, double eps)`
`void` `performMirror(double nx, double ny, double px, double py)` This method mirrors the edge at the given line (by mirroring its two nodes)
`void` `performTransformation(GridTransformation trafo)` applies the given AffineTransform instance on this edge
`void` `reinit(Node n1, Node n2, int es, int bc)` Pseudo constructor
`void` `removeParent(Cell c)`
`void` `removeParent(Cell2D c)` removeParent removes the given Cell2D c from the parent vector
`void` `setBC(int newbc)` sets the boundary condition
`void` `setMarker(int i)` sets the marker value to i
`void` `setNode(int i, Node n)` sets the i-th node of the edge to n
`void` `setNumber(int i)` defines the number of the edge
`void` `setParameters(double[] params)` sets all parameters of the GridItem according to the given int array
`void` `setStatus(int newstatus)` sets the status of the edge
`void` `swap()` changes the orientation of this edge
`void` `updateInnerData()` updates the inner variables of the edge used for picking and selecting

Methods inherited from class devisor2.foundation.GridItem
`clearTransformedFlag, isMarked, setMarker, setMarker, unsetMarker`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### p

    protected Node[] p

  the nodes of this edge

### number

    protected int number

  the number of this edge, updated by updateEdgeNumbers()

### level

    public int level

  the hierarchical level of this edge (yet not implemented)

### marker

    public int marker

  marker of this edge

### parents

    protected java.util.Vector parents

  The Cell2D Objects which contain this edge

### edgestatus

    protected int edgestatus

  Status of the edge (use constants provided)

### STATUS_NONE

    public static final int STATUS_NONE

  Constant for edge status NONE

  See Also:
    Constant Field Values

### STATUS_INNER

    public static final int STATUS_INNER

  Constant for edge status INNER

  See Also:
    Constant Field Values

### STATUS_REAL

    public static final int STATUS_REAL

  Constant for edge status REAL

  See Also:
    Constant Field Values

### STATUS_MIRRORB

    public static final int STATUS_MIRRORB

  Constant for edge status MIRROR BOUNDARY

  See Also:
    Constant Field Values

### edgebc

    protected int edgebc

  boundary condition of the edge (use constants provided)

### BC_NONE

    public static final int BC_NONE

  Constant for boundary condition NONE

  See Also:
    Constant Field Values

### BC_NEUMANN

    public static final int BC_NEUMANN

  Constant for boundary condition NEUMANN

  See Also:
    Constant Field Values

### BC_DIRICHLET

    public static final int BC_DIRICHLET

  Constant for boundary condition DIRICHLET

  See Also:
    Constant Field Values

### boundaryEdge

    protected boolean boundaryEdge

  Boundary Edge or not

### boundary

    protected Boundary boundary

  if boundary Edge then contains the boundary of the edge

Constructor Detail

### Edge

    public Edge(Node n1,
                Node n2)

  creates an edge from node a to b

### Edge

    public Edge(Node n1,
                Node n2,
                int es)

### Edge

    public Edge(Node n1,
                Node n2,
                int es,
                int bc)

Method Detail

### getParameters

    public double[] getParameters()

  Description copied from class: `GridItem`
  returns all parameters of the griditem in an int array

  Specified by:
    `getParameters` in class `GridItem`

### setParameters

    public void setParameters(double[] params)

  Description copied from class: `GridItem`
  sets all parameters of the GridItem according to the given int array

  Specified by:
    `setParameters` in class `GridItem`

### setNode

    public void setNode(int i,
                        Node n)

  sets the i-th node of the edge to n

### reinit

    public void reinit(Node n1,
                       Node n2,
                       int es,
                       int bc)

  Pseudo constructor

### swap

    public void swap()

  changes the orientation of this edge

### getStatus

    public int getStatus()

  returns the status of the edge

### setStatus

    public void setStatus(int newstatus)

  sets the status of the edge

### getBC

    public int getBC()

  returns the boundarycondition of the edge

### setBC

    public void setBC(int newbc)

  sets the boundary condition

### setMarker

    public void setMarker(int i)

  sets the marker value to i

### getMarker

    public int getMarker()

  returns the marker value of this edge

### getNode

    public Node getNode(int i)

  returns the i-th Node (0 or 1) of this edge

### setNumber

    public void setNumber(int i)

  defines the number of the edge

### getNumber

    public int getNumber()

  returns the number of the edge

### addParent

    public void addParent(Cell2D c)

  addParent adds the given Cell2D c to the parent vector

### removeParent

    public void removeParent(Cell2D c)

  removeParent removes the given Cell2D c from the parent vector

### removeParent

    public void removeParent(Cell c)

### getParents

    public java.lang.Object[] getParents()

  getParents() returns the parent Cells(2D) as array of Objects

  Returns:
    parent Object

### getFathers

    public java.util.Vector getFathers()

### getNodeAverageValue

    public double getNodeAverageValue(int index)

  Returns the average of the ith value of the nodes defining this cell.

### updateInnerData

    public void updateInnerData()

  updates the inner variables of the edge used for picking and selecting

### draw

    public void draw(java.awt.Graphics g)

  draw this edge with respect to transformation and drawcontrol

  Specified by:
    `draw` in class `GridItem`

### fill

    public void fill(java.awt.Graphics g)

  fill this edge with its color with respect to transformation and drawcontrol

### isOnEdge

    public boolean isOnEdge(Node n,
                            double eps)

### isInside

    public boolean isInside(int[] topleft,
                            int[] bottomright)

  Is the item inside a given rectangular area? All in WORLD COORDINATES!!!

  Specified by:
    `isInside` in class `GridItem`
  Parameters:
    `topleft` - - the topleft corner of the rectangle
    `bottomright` - - the bottom right corner of the rectangle
  Returns:
    true if the item is completely inside the rectangle

### isHit

    public boolean isHit(int cx,
                         int cy)

  Determines if the item has been hit by a click on the grid ALL IN world COORDINATES to avoid the snap mechanism

  Specified by:
    `isHit` in class `GridItem`
  Returns:
    true if the item has been hit

### getPerimeter

    public java.awt.Rectangle getPerimeter()

  returns the perimeter of the Edge element, that is the smallest bounding box completely containing the Edge

  Specified by:
    `getPerimeter` in class `GridItem`
  Returns:
    a Rectangle object defining the perimeter

### performTransformation

    public void performTransformation(GridTransformation trafo)

  applies the given AffineTransform instance on this edge

  Specified by:
    `performTransformation` in class `GridItem`
  Parameters:
    `trafo` - - the GridTransform instance representing the transformation

### performMirror

    public void performMirror(double nx,
                              double ny,
                              double px,
                              double py)

  This method mirrors the edge at the given line (by mirroring its two nodes)

  Specified by:
    `performMirror` in class `GridItem`

### clone

    public java.lang.Object clone()

  returns an exact copy of this edge, but not cloning recursively (i.e. all nodes part of this edge are not cloned

### getLength

    public double getLength()

  calculates the length of the edge (simple pythagoras) and returns it