drvgraph.j2d
Class Naf

java.lang.Object
  extended by java.awt.Polygon
      extended by drvgraph.j2d.Naf
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable

public class Naf
extends java.awt.Polygon

Represents the negation-as-failure.
It is represented by a triangular graph element, which accepts "incoming" and "outgoing" connections. The former are always (positive) class patterns and the latter are always rule circles.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.awt.Polygon
bounds, npoints, xpoints, ypoints
 
Constructor Summary
Naf()
          Constructs a new Naf element.
 
Method Summary
 java.awt.Point getEastPoint()
          Gets the outgoing connection point.
 java.awt.Point getWestPoint()
          Gets the incoming connection point.
 int getX()
          Gets the x coordinate of the naf triangle.
 int getY()
          Gets the y coordinate of the naf triangle.
 boolean isSelected()
          Checks if the naf triangle is selected.
 void paint(java.awt.Graphics g)
          Draws the naf triangle.
 void setEastPoint(java.awt.Point eastPoint)
          Sets the outgoing connection point.
 void setSelected(boolean b)
          Sets the "selected" status of the naf triangle.
 void setWestPoint(java.awt.Point westPoint)
          Sets the incoming connection point.
 void setX(int x)
          Sets the x coordinate of the naf triangle.
 void setY(int y)
          Sets the y coordinate of the naf triangle.
 void translate(int dx, int dy)
          Moves the naf triangle by dx pixels in the x-axis and dy pixels in the y-axis.
 
Methods inherited from class java.awt.Polygon
addPoint, contains, contains, contains, contains, contains, contains, getBoundingBox, getBounds, getBounds2D, getPathIterator, getPathIterator, inside, intersects, intersects, invalidate, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Naf

public Naf()
Constructs a new Naf element.

Method Detail

setSelected

public void setSelected(boolean b)
Sets the "selected" status of the naf triangle. Its value can either be "true" or "false".

Parameters:
b - the "selected" status flag (true|false)

isSelected

public boolean isSelected()
Checks if the naf triangle is selected.

Returns:
the naf triangle "selected" status

translate

public void translate(int dx,
                      int dy)
Moves the naf triangle by dx pixels in the x-axis and dy pixels in the y-axis.

Overrides:
translate in class java.awt.Polygon
Parameters:
dx - the number of pixels to move the triangle in the x-axis
dy - the number of pixels to move the triangle in the y-axis

paint

public void paint(java.awt.Graphics g)
Draws the naf triangle.

Parameters:
g - the Graphics component that draws the element
See Also:
Graphics

getEastPoint

public java.awt.Point getEastPoint()
Gets the outgoing connection point.

Returns:
the outgoing connection point

setEastPoint

public void setEastPoint(java.awt.Point eastPoint)
Sets the outgoing connection point.

Parameters:
eastPoint - the designated outgoing connection point

getWestPoint

public java.awt.Point getWestPoint()
Gets the incoming connection point.

Returns:
the incoming connection point

setWestPoint

public void setWestPoint(java.awt.Point westPoint)
Sets the incoming connection point.

Parameters:
westPoint - the designated incoming connection point

getX

public int getX()
Gets the x coordinate of the naf triangle.

Returns:
the x coordinate of the naf triangle

setX

public void setX(int x)
Sets the x coordinate of the naf triangle.

Parameters:
x - the specified x coordinate of the naf triangle

getY

public int getY()
Gets the y coordinate of the naf triangle.

Returns:
the y coordinate of the naf triangle

setY

public void setY(int y)
Sets the y coordinate of the naf triangle.

Parameters:
y - the specified y coordinate of the naf triangle.