org.infai.emo.matcher.editor.util
Class Line

java.lang.Object
  extended by org.infai.emo.matcher.editor.util.Line

public class Line
extends java.lang.Object

Class caches all necessary informations for a line which is needed to visualize a matching between two Elements of the Comparison.

Version:
1.0.0
Author:
Stanley Hillner

Field Summary
private  org.eclipse.swt.graphics.Color color
          The color of the line.
private  boolean leftToRight
          This flag indicates whether the line was drawn from the leftTree to the right or the other way.
private  int lineStyle
          The SWT-lineStyle for this line.
private  int lineWidth
          The width of the line.
private  java.util.Hashtable<java.lang.String,java.lang.Double> matchingDetails
          This Hashtable caches the atomic matching-values for this tuple.
private  double matchingValue
          The value of the matching for this tuple.
private  org.eclipse.swt.events.PaintListener paintListener
          The PaintListener that was used to draw this line.
private  boolean selected
          This flag shows if the user selected this line on the canvas.
private  Tuple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> tuple
          The tuple of elements which is connected by this line.
private  int xl
          The x-coordinate of the left end of the line.
private  int xr
          The x-coordinate of the right end of the line.
private  int yl
          The y-coordinate of the left end of the line.
private  int yr
          The y-coordinate of the right end of the line.
 
Constructor Summary
Line(int xl, int yl, int xr, int yr, int red, int green, int blue)
          Constructor to draw a line without a tuple.
Line(int xl, int yl, int xr, int yr, int red, int green, int blue, Tuple tuple, double value, boolean leftToRight)
          Constructor to draw a line with an attached tuple.
 
Method Summary
 org.eclipse.swt.graphics.Color getColor()
           
 int getLineStyle()
           
 int getLineWidth()
           
 java.util.Hashtable<java.lang.String,java.lang.Double> getMatchingDetails()
           
 double getMatchingValue()
           
 org.eclipse.swt.events.PaintListener getPaintListener()
           
 Tuple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> getTuple()
           
 int getXl()
           
 int getXr()
           
 int getYl()
           
 int getYr()
           
 boolean isLeftToRight()
           
 boolean isSelected()
           
 void setColor(org.eclipse.swt.graphics.Color color)
           
 void setMatchingDetails(java.util.Vector<Matching> matchings)
           
 void setPaintListener(org.eclipse.swt.events.PaintListener paintListener)
           
 void setSelected(boolean selected)
          Sets the parameter selected and changes the lineStyle and lineWidth.
 void setTuple(Tuple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> tuple)
           
 void setXl(int xl)
           
 void setXr(int xr)
           
 void setYl(int yl)
           
 void setYr(int yr)
           
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

xl

private int xl
The x-coordinate of the left end of the line.


yl

private int yl
The y-coordinate of the left end of the line.


xr

private int xr
The x-coordinate of the right end of the line.


yr

private int yr
The y-coordinate of the right end of the line.


color

private org.eclipse.swt.graphics.Color color
The color of the line.

See Also:
Color

selected

private boolean selected
This flag shows if the user selected this line on the canvas.


lineStyle

private int lineStyle
The SWT-lineStyle for this line.
default is SWT.LINE_SOLID.

See Also:
SWT

lineWidth

private int lineWidth
The width of the line.


tuple

private Tuple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> tuple
The tuple of elements which is connected by this line.

See Also:
Tuple

matchingValue

private double matchingValue
The value of the matching for this tuple.


matchingDetails

private java.util.Hashtable<java.lang.String,java.lang.Double> matchingDetails
This Hashtable caches the atomic matching-values for this tuple.
The name of the comparator is the key of the hash and the value is the comparison-value for this tuple.

See Also:
Hashtable, Constants

paintListener

private org.eclipse.swt.events.PaintListener paintListener
The PaintListener that was used to draw this line.

See Also:
PaintListener

leftToRight

private boolean leftToRight
This flag indicates whether the line was drawn from the leftTree to the right or the other way.

Constructor Detail

Line

public Line(int xl,
            int yl,
            int xr,
            int yr,
            int red,
            int green,
            int blue,
            Tuple tuple,
            double value,
            boolean leftToRight)
Constructor to draw a line with an attached tuple.

Parameters:
xl - the left x-coordinate.
yl - the left y-coordinate.
xr - the right x-coordinate.
yr - the right y-coordinate.
red - the red-value of the line-color.
green - the green-value of the line-color.
blue - the blue-value of the line-color.
tuple - the tuple that is represented by this line.
value - the matching-value for this tuple.
See Also:
Tuple

Line

public Line(int xl,
            int yl,
            int xr,
            int yr,
            int red,
            int green,
            int blue)
Constructor to draw a line without a tuple.

Parameters:
xl - the left x-coordinate.
yl - the left y-coordinate.
xr - the right x-coordinate.
yr - the right y-coordinate.
red - the red-value of the line-color.
green - the green-value of the line-color.
blue - the blue-value of the line-color.
Method Detail

getXl

public int getXl()
Returns:
the left x-coordinate of the line

setXl

public void setXl(int xl)
Parameters:
xl - the left x-coordinate of the line

getYl

public int getYl()
Returns:
the left y-coordinate of the line

setYl

public void setYl(int yl)
Parameters:
yl - the left y-coordinate of the line

getXr

public int getXr()
Returns:
the right x-coordinate of the line

setXr

public void setXr(int xr)
Parameters:
xr - the right x-coordinate of the line

getYr

public int getYr()
Returns:
the right y-coordinate of the line

setYr

public void setYr(int yr)
Parameters:
yr - the right y-coordinate of the line

getColor

public org.eclipse.swt.graphics.Color getColor()
Returns:
the color of the line

isSelected

public boolean isSelected()
Returns:
true if the line is selected.

setSelected

public void setSelected(boolean selected)
Sets the parameter selected and changes the lineStyle and lineWidth.

Parameters:
selected - true to select the line.

getLineStyle

public int getLineStyle()
Returns:
the lineStyle

getLineWidth

public int getLineWidth()
Returns:
the lineWidth

getTuple

public Tuple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> getTuple()
Returns:
the tuple that is represented by this line.

getMatchingValue

public double getMatchingValue()
Returns:
the matchingValue for this line.

getMatchingDetails

public java.util.Hashtable<java.lang.String,java.lang.Double> getMatchingDetails()
Returns:
the matchingDetails (comparator-name with value of comparison).

setMatchingDetails

public void setMatchingDetails(java.util.Vector<Matching> matchings)
Parameters:
matchingDetails - a whole set of matching-details for all lines or a single line (the method filters out the right one).

getPaintListener

public org.eclipse.swt.events.PaintListener getPaintListener()
Returns:
the paintListener

setPaintListener

public void setPaintListener(org.eclipse.swt.events.PaintListener paintListener)
Parameters:
paintListener - the paintListener to set

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

isLeftToRight

public boolean isLeftToRight()
Returns:
the leftToRight

setTuple

public void setTuple(Tuple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> tuple)
Parameters:
tuple - the tuple to set

setColor

public void setColor(org.eclipse.swt.graphics.Color color)