summaryrefslogtreecommitdiff
path: root/java/EAC/Primitive.java
diff options
context:
space:
mode:
authorcdgill <cdgill@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-01-07 22:46:07 +0000
committercdgill <cdgill@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-01-07 22:46:07 +0000
commit78552d9795151a325fe0d5701c2ea28c256ecdfb (patch)
tree286780950a8cedb569ecf57846b511c114e9bf14 /java/EAC/Primitive.java
parent57e792805e7e43fbc649cc7efddbeff61f9aed87 (diff)
downloadATCD-78552d9795151a325fe0d5701c2ea28c256ecdfb.tar.gz
moved EAC from ACE_wrappers to ACE_wrappers/java
Diffstat (limited to 'java/EAC/Primitive.java')
-rw-r--r--java/EAC/Primitive.java121
1 files changed, 121 insertions, 0 deletions
diff --git a/java/EAC/Primitive.java b/java/EAC/Primitive.java
new file mode 100644
index 00000000000..a0532a9731b
--- /dev/null
+++ b/java/EAC/Primitive.java
@@ -0,0 +1,121 @@
+/**
+ * Title: Primitive
+ * Description: An abstract class for Event Analysis Configurator graphical
+ * primitives
+ */
+package EAC;
+import java.awt.*;
+import java.io.*;
+
+public abstract class Primitive {
+
+ // maximum number of outputs from any primitive
+ public final int MAX_OUTPUTS = 8;
+
+ // maximum number of inputs to a sink
+ public final int MAX_INPUTS = 8;
+
+ // where the primitive will be drawn
+ protected EACPanel canvas;
+
+ // anchor point of the graphical shape
+ protected Point anchor;
+
+ // associated label
+ protected EACLabel label;
+
+ public Primitive(EACPanel p) {
+ canvas = p;
+ } /* constructor */
+
+ public void setAnchor(Point p) {
+ anchor = p;
+ } /* setAnchor */
+
+ public Point getAnchor() {
+ return anchor;
+ } /* getAnchor */
+
+ public void setLabel(EACLabel l) {
+ label = l;
+ } /* setLabel */
+
+ public EACLabel getLabel() {
+ return label;
+ } /* getLabel */
+
+ public void restart() {
+ // no-op for most primitives
+ // overload as needed
+ } /* restart */
+
+ public void specialDraw() {
+ // no-op for some primitives
+ // overload as needed
+ } /* specialDraw */
+
+ public void specialUndraw() {
+ // no-op for some primitives
+ // overload as needed
+ } /* specialUndraw */
+
+ public void reconnect() {
+ // no-op for some primitives
+ // overload as needed
+ } /* reconnect */
+
+ public void selectedDraw() {
+ final int d = 4; // dimension of hotspot
+ Graphics g = canvas.getGraphics();
+
+ g.setColor(java.awt.Color.darkGray);
+ g.drawRect(upperLeft().x - (d/2),upperLeft().y - (d/2), d, d);
+ g.drawRect(lowerLeft().x - (d/2),lowerLeft().y - (d/2), d, d);
+ g.drawRect(upperRight().x - (d/2),upperRight().y - (d/2), d, d);
+ g.drawRect(lowerRight().x - (d/2),lowerRight().y - (d/2), d, d);
+ } /* selectedDraw */
+
+ // establish the top center point of the graphical shape
+ public abstract void setTop(Point p);
+
+ public abstract Point getTop();
+
+ public abstract boolean inBounds();
+
+ public abstract int addInput(Connector c) throws ConnectionException;
+
+ public abstract int addOutput(Connector c) throws ConnectionException;
+
+ public abstract Connector getInput(int i) throws ConnectionException;
+
+ public abstract Connector getOutput(int i) throws ConnectionException;
+
+ public abstract void removeInput(int i) throws ConnectionException;
+
+ public abstract void removeOutput(int i) throws ConnectionException;
+
+ public abstract int getInputCount() throws ConnectionException;
+
+ public abstract int getOutputCount() throws ConnectionException;
+
+ public abstract void event(Source s) throws ConnectionException;
+
+ public abstract void wakeup(long t) throws ConnectionException;
+
+ public abstract void draw() throws BoundsException;
+
+ public abstract void write(File f) throws java.io.IOException;
+
+ public abstract void read(File f) throws java.io.IOException;
+
+ public abstract boolean contains(Point p);
+
+ public abstract Point upperLeft();
+
+ public abstract Point lowerRight();
+
+ public abstract Point upperRight();
+
+ public abstract Point lowerLeft();
+
+} \ No newline at end of file