org.rosuda.ibase.toolkit
Class PPrimBase

java.lang.Object
  extended by org.rosuda.ibase.toolkit.PPrimBase
All Implemented Interfaces:
PlotPrimitive
Direct Known Subclasses:
Outlier, PPrimBox, PPrimCircle, PPrimPolygon, PPrimRectangle

public abstract class PPrimBase
extends java.lang.Object
implements PlotPrimitive

Very basic plot primitive without any graphical representation, but with case handling. This abstract class can be used as a base for any plot primitives that use ID reference lists. Methods concerning graphical representation (paint..., contains, intersects) are left abstract.


Field Summary
 java.awt.Color borderColor
           
 java.awt.Color borderColorSel
           
 java.awt.Color col
          Deprecated. Should be removed as it isn't used anymore. Left here for compatibility reasons.
 java.awt.Color COL_OUTLINE
           
protected  boolean dragging
           
 java.awt.Color fillColor
           
 java.awt.Color fillColorDrag
           
 java.awt.Color fillColorSel
           
 boolean performAlphaBlending
           
 boolean queryable
          whether this primitive can be queried
 int[] ref
          references (IDs) to cases represented by this primitive
protected  boolean visible
           
 
Constructor Summary
PPrimBase()
           
 
Method Summary
 int cases()
          returns the number of cases this primitive represents
 int[] getCaseIDs()
          returns the IDs of all cases represented by this primitive.
 java.awt.Color getColor()
          returns the main color of the primitive
 double getMarkedProportion(SMarker m, int mark)
          calculates the proportion of cases with the given mark in relation to total population of cases represented by this PlotPrimitive.
 double getMarkedProportion(SMarker m, int mark, boolean dropPrimary)
          calculates the proportion of cases with the given mark in relation to total population of cases represented by this PlotPrimitive.
 int getPrimaryCase()
          returns the case ID for 1:1 (or m:1) relationships
protected  int getPropSize(int totalSize, double proportion)
           
protected  double getRelativeMarkedProportion(SMarker m, int mark)
           
 boolean hilitcontains(int x, int y)
           
 boolean isDragging()
           
 boolean isPerformingAlphaBlending()
           
 boolean isQueryable()
          returns whether this primitive should respond to queries.
 boolean isVisible()
          returns whether this primitive is visible
 void move(int x, int y)
           
 void moveX(int x)
           
 void moveY(int y)
           
 boolean representsCase(int cid)
          checks whether the specified case is represented by this primitive.
 void setCaseIDs(double[] r)
           
 void setCaseIDs(int[] r)
           
 void setDragging(boolean b)
           
 void setMark(SMarker m, boolean setTo)
          sets mark for cases represented by this PlotPrimitive in following fashion: if the case is already marked then its mark is set to setTo, otherwise the mark is set to true.
 void setVisible(boolean b)
          sets visibility of this primitive
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.rosuda.ibase.toolkit.PlotPrimitive
contains, intersects, paint, paintSelected
 

Field Detail

col

public java.awt.Color col
Deprecated. Should be removed as it isn't used anymore. Left here for compatibility reasons.

COL_OUTLINE

public java.awt.Color COL_OUTLINE

ref

public int[] ref
references (IDs) to cases represented by this primitive


visible

protected boolean visible

dragging

protected boolean dragging

queryable

public boolean queryable
whether this primitive can be queried


fillColor

public java.awt.Color fillColor

borderColor

public java.awt.Color borderColor

fillColorSel

public java.awt.Color fillColorSel

borderColorSel

public java.awt.Color borderColorSel

fillColorDrag

public java.awt.Color fillColorDrag

performAlphaBlending

public boolean performAlphaBlending
Constructor Detail

PPrimBase

public PPrimBase()
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getCaseIDs

public int[] getCaseIDs()
Description copied from interface: PlotPrimitive
returns the IDs of all cases represented by this primitive. null is valid and means that this primitive represents no data

Specified by:
getCaseIDs in interface PlotPrimitive
Returns:
list of case IDs

setCaseIDs

public void setCaseIDs(int[] r)

setCaseIDs

public void setCaseIDs(double[] r)

getPrimaryCase

public int getPrimaryCase()
Description copied from interface: PlotPrimitive
returns the case ID for 1:1 (or m:1) relationships

Specified by:
getPrimaryCase in interface PlotPrimitive
Returns:
if exactly one case is associated with this primitive, then its case ID is returned. Otherwise -1 is returned.

representsCase

public boolean representsCase(int cid)
Description copied from interface: PlotPrimitive
checks whether the specified case is represented by this primitive.

Specified by:
representsCase in interface PlotPrimitive
Parameters:
cid - case ID to check for
Returns:
true if the case is represented by this primitive

cases

public int cases()
Description copied from interface: PlotPrimitive
returns the number of cases this primitive represents

Specified by:
cases in interface PlotPrimitive
Returns:
number of cases this primitive represents

setMark

public void setMark(SMarker m,
                    boolean setTo)
sets mark for cases represented by this PlotPrimitive in following fashion: if the case is already marked then its mark is set to setTo, otherwise the mark is set to true.

Specified by:
setMark in interface PlotPrimitive

getMarkedProportion

public double getMarkedProportion(SMarker m,
                                  int mark)
Description copied from interface: PlotPrimitive
calculates the proportion of cases with the given mark in relation to total population of cases represented by this PlotPrimitive. The value ranges between 0.0 (no cases with such mark or cases=0) to 1.0 (all cases with that mark)

Specified by:
getMarkedProportion in interface PlotPrimitive

getMarkedProportion

public double getMarkedProportion(SMarker m,
                                  int mark,
                                  boolean dropPrimary)
calculates the proportion of cases with the given mark in relation to total population of cases represented by this PlotPrimitive. The value ranges between 0.0 (no cases with such mark) to 1.0 (all cases with that mark)


getColor

public java.awt.Color getColor()
returns the main color of the primitive

Specified by:
getColor in interface PlotPrimitive

isQueryable

public boolean isQueryable()
Description copied from interface: PlotPrimitive
returns whether this primitive should respond to queries.

Specified by:
isQueryable in interface PlotPrimitive

getRelativeMarkedProportion

protected double getRelativeMarkedProportion(SMarker m,
                                             int mark)

getPropSize

protected int getPropSize(int totalSize,
                          double proportion)

setVisible

public void setVisible(boolean b)
Description copied from interface: PlotPrimitive
sets visibility of this primitive

Specified by:
setVisible in interface PlotPrimitive

isVisible

public boolean isVisible()
Description copied from interface: PlotPrimitive
returns whether this primitive is visible

Specified by:
isVisible in interface PlotPrimitive

setDragging

public void setDragging(boolean b)

isDragging

public boolean isDragging()

move

public void move(int x,
                 int y)

moveX

public void moveX(int x)

moveY

public void moveY(int y)

hilitcontains

public boolean hilitcontains(int x,
                             int y)
Specified by:
hilitcontains in interface PlotPrimitive

isPerformingAlphaBlending

public boolean isPerformingAlphaBlending()
Specified by:
isPerformingAlphaBlending in interface PlotPrimitive