Commit 88b698b9 authored by Anthony Chan's avatar Anthony Chan
Browse files

[svn-r9050] Replaced built-in java map that uses int-int key-value by...

[svn-r9050] Replaced built-in java map that uses int-int key-value by cern.colt.OpenIntIntHashMap.  Checked in only the relevant java file for OpenIntIntHashMap from cern.colt and CERN's license.  Updated the slog2sdk's build system to include cern code.  Updated the jarfiles.  This improves the startup time for wide slog2 file, e.g. a 2K timelines slog2 file by 20%.  Overall everything in jumpshot seems much more responsive.
parent bf080ec6
......@@ -19,6 +19,8 @@ import java.util.TreeSet;
import java.util.Iterator;
import java.util.Arrays;
import cern.colt.map.OpenIntIntHashMap;
import base.io.MixedDataInput;
import base.io.MixedDataOutput;
import base.io.MixedDataIO;
......@@ -440,9 +442,11 @@ public class Composite extends Drawable
/*
0.0f < nesting_ftr <= 1.0f
*/
public int drawStateOnCanvas( Graphics2D g, CoordPixelXform coord_xform,
Map map_line2row, DrawnBoxSet drawn_boxes,
ColorAlpha color )
public int drawStateOnCanvas( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
DrawnBoxSet drawn_boxes,
ColorAlpha color )
{
Coord start_vtx, final_vtx;
start_vtx = this.getStartVertex();
......@@ -470,9 +474,11 @@ public class Composite extends Drawable
}
// assume this Primitive overlaps with coord_xform.TimeBoundingBox
public int drawArrowOnCanvas( Graphics2D g, CoordPixelXform coord_xform,
Map map_line2row, DrawnBoxSet drawn_boxes,
ColorAlpha color )
public int drawArrowOnCanvas( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
DrawnBoxSet drawn_boxes,
ColorAlpha color )
{
Coord start_vtx, final_vtx;
start_vtx = this.getStartVertex();
......@@ -483,21 +489,19 @@ public class Composite extends Drawable
tFinal = final_vtx.time;
int iStart, iFinal;
iStart = ( (Integer)
map_line2row.get( new Integer(start_vtx.lineID) )
).intValue();
iFinal = ( (Integer)
map_line2row.get( new Integer(final_vtx.lineID) )
).intValue();
iStart = map_line2row.get( start_vtx.lineID );
iFinal = map_line2row.get( final_vtx.lineID );
return Arrow.draw( g, color, null, coord_xform,
drawn_boxes.getLastArrowPos( iStart, iFinal ),
tStart, (float) iStart, tFinal, (float) iFinal );
}
public int drawEventOnCanvas( Graphics2D g, CoordPixelXform coord_xform,
Map map_line2row, DrawnBoxSet drawn_boxes,
ColorAlpha color )
public int drawEventOnCanvas( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
DrawnBoxSet drawn_boxes,
ColorAlpha color )
{
Coord vtx;
vtx = this.getStartVertex();
......@@ -507,9 +511,7 @@ public class Composite extends Drawable
int rowID;
float rPeak, rStart, rFinal;
rowID = ( (Integer)
map_line2row.get( new Integer(vtx.lineID) )
).intValue();
rowID = map_line2row.get( vtx.lineID );
// rPeak = (float) rowID + NestingStacks.getHalfInitialNestingHeight();
rPeak = (float) rowID - 0.25f;
rStart = (float) rowID - 0.5f;
......@@ -523,8 +525,9 @@ public class Composite extends Drawable
/*
0.0f < nesting_ftr <= 1.0f
*/
public boolean isPixelInState( CoordPixelXform coord_xform,
Map map_line2row, Point pix_pt )
public boolean isPixelInState( CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
Point pix_pt )
{
Coord start_vtx, final_vtx;
start_vtx = this.getStartVertex();
......@@ -537,9 +540,7 @@ public class Composite extends Drawable
int rowID;
float nesting_ftr;
/*
rowID = ( (Integer)
map_line2row.get( new Integer(start_vtx.lineID) )
).intValue();
rowID = map_line2row.get( start_vtx.lineID );
*/
/* assume RowID and NestingFactor have been calculated */
rowID = super.getRowID();
......@@ -556,8 +557,9 @@ public class Composite extends Drawable
}
// assume this Primitive overlaps with coord_xform.TimeBoundingBox
public boolean isPixelOnArrow( CoordPixelXform coord_xform,
Map map_line2row, Point pix_pt )
public boolean isPixelOnArrow( CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
Point pix_pt )
{
Coord start_vtx, final_vtx;
start_vtx = this.getStartVertex();
......@@ -568,19 +570,16 @@ public class Composite extends Drawable
tFinal = final_vtx.time;
float rStart, rFinal;
rStart = ( (Integer)
map_line2row.get( new Integer(start_vtx.lineID) )
).floatValue();
rFinal = ( (Integer)
map_line2row.get( new Integer(final_vtx.lineID) )
).floatValue();
rStart = (float) map_line2row.get( start_vtx.lineID );
rFinal = (float) map_line2row.get( final_vtx.lineID );
return Line.containsPixel( coord_xform, pix_pt,
tStart, rStart, tFinal, rFinal );
}
public boolean isPixelAtEvent( CoordPixelXform coord_xform,
Map map_line2row, Point pix_pt )
public boolean isPixelAtEvent( CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
Point pix_pt )
{
Coord vtx;
vtx = this.getStartVertex();
......@@ -590,9 +589,7 @@ public class Composite extends Drawable
int rowID;
float rStart, rFinal;
rowID = ( (Integer)
map_line2row.get( new Integer(vtx.lineID) )
).intValue();
rowID = map_line2row.get( vtx.lineID );
rStart = (float) rowID - 0.5f;
rFinal = rStart + 1.0f;
......@@ -600,10 +597,10 @@ public class Composite extends Drawable
tPoint, rStart, rFinal );
}
public int drawStateOnViewport( Graphics2D g,
CoordPixelXform coord_xform,
Map map_line2row,
ColorAlpha color )
public int drawStateOnViewport( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
ColorAlpha color )
{
Coord start_vtx, final_vtx;
start_vtx = this.getStartVertex();
......@@ -629,10 +626,10 @@ public class Composite extends Drawable
tStart, rStart, tFinal, rFinal );
}
public int drawArrowOnViewport( Graphics2D g,
CoordPixelXform coord_xform,
Map map_line2row,
ColorAlpha color )
public int drawArrowOnViewport( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
ColorAlpha color )
{
Coord start_vtx, final_vtx;
start_vtx = this.getStartVertex();
......@@ -643,22 +640,18 @@ public class Composite extends Drawable
tFinal = final_vtx.time;
int iStart, iFinal;
iStart = ( (Integer)
map_line2row.get( new Integer(start_vtx.lineID) )
).intValue();
iFinal = ( (Integer)
map_line2row.get( new Integer(final_vtx.lineID) )
).intValue();
iStart = map_line2row.get( start_vtx.lineID );
iFinal = map_line2row.get( final_vtx.lineID );
return MarkerArrow.draw( g, color, null, coord_xform,
tStart, (float) iStart,
tFinal, (float) iFinal );
}
public int drawEventOnViewport( Graphics2D g,
CoordPixelXform coord_xform,
Map map_line2row,
ColorAlpha color )
public int drawEventOnViewport( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
ColorAlpha color )
{
Coord vtx;
vtx = this.getStartVertex();
......@@ -668,9 +661,7 @@ public class Composite extends Drawable
int rowID;
float rPeak, rStart, rFinal;
rowID = ( (Integer)
map_line2row.get( new Integer(vtx.lineID) )
).intValue();
rowID = map_line2row.get( vtx.lineID );
rPeak = (float) rowID - 0.25f;
rStart = (float) rowID - 0.5f;
rFinal = rStart + 1.0f;
......
......@@ -10,11 +10,11 @@
package base.drawable;
// import java.util.Comparator;
import java.util.Map;
import java.awt.Graphics2D;
import java.awt.Color;
import java.awt.Point;
import cern.colt.map.OpenIntIntHashMap;
import base.topology.Pointer;
import base.topology.MarkerState;
......@@ -44,7 +44,7 @@ public abstract class Drawable extends InfoBox
private int row_ID; // For SLOG-2 Input API
// non-null parent => this Drawable is part of a Composite Drawable
private Drawable parent; // For SLOG-2 Input API
private Drawable parent; // For SLOG-2 Input API
public Drawable()
......@@ -175,59 +175,59 @@ public abstract class Drawable extends InfoBox
public abstract Coord getFinalVertex();
public abstract int drawStateOnCanvas( Graphics2D g,
CoordPixelXform coord_xform,
Map map_line2row,
DrawnBoxSet drawn_boxes,
ColorAlpha color );
public abstract int drawArrowOnCanvas( Graphics2D g,
CoordPixelXform coord_xform,
Map map_line2row,
DrawnBoxSet drawn_boxes,
ColorAlpha color );
public abstract int drawEventOnCanvas( Graphics2D g,
CoordPixelXform coord_xform,
Map map_line2row,
DrawnBoxSet drawn_boxes,
ColorAlpha color );
public abstract boolean isPixelInState( CoordPixelXform coord_xform,
Map map_line2row,
Point pix_pt );
public abstract boolean isPixelOnArrow( CoordPixelXform coord_xform,
Map map_line2row,
Point pix_pt );
public abstract boolean isPixelAtEvent( CoordPixelXform coord_xform,
Map map_line2row,
Point pix_pt );
public abstract int drawStateOnViewport( Graphics2D g,
CoordPixelXform coord_xform,
Map map_line2row,
ColorAlpha color );
public abstract int drawArrowOnViewport( Graphics2D g,
CoordPixelXform coord_xform,
Map map_line2row,
ColorAlpha color );
public abstract int drawEventOnViewport( Graphics2D g,
CoordPixelXform coord_xform,
Map map_line2row,
ColorAlpha color );
public abstract int drawStateOnCanvas( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
DrawnBoxSet drawn_boxes,
ColorAlpha color );
public abstract int drawArrowOnCanvas( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
DrawnBoxSet drawn_boxes,
ColorAlpha color );
public abstract int drawEventOnCanvas( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
DrawnBoxSet drawn_boxes,
ColorAlpha color );
public abstract boolean isPixelInState( CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
Point pix_pt );
public abstract boolean isPixelOnArrow( CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
Point pix_pt );
public abstract boolean isPixelAtEvent( CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
Point pix_pt );
public abstract int drawStateOnViewport( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
ColorAlpha color );
public abstract int drawArrowOnViewport( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
ColorAlpha color );
public abstract int drawEventOnViewport( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
ColorAlpha color );
public abstract boolean containSearchable();
// Since Searchable is assumed to be a State drawable,
// so no need to make drawSearchableOnViewport() as abstract interface.
// That will change if Searchable can be any Drawable.
public int drawSearchableOnViewport( Graphics2D g,
CoordPixelXform coord_xform,
Map map_line2row )
public int drawSearchableOnViewport( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row )
{
Coord start_vtx, final_vtx;
start_vtx = this.getStartVertex();
......@@ -260,25 +260,22 @@ public abstract class Drawable extends InfoBox
private float getRowIDAtTimeOnEvent( Map map_line2row, double marker_time )
private float getRowIDAtTimeOnEvent( OpenIntIntHashMap map_line2row,
double marker_time )
{
Coord vtx = this.getStartVertex();
int rowID = ( (Integer)
map_line2row.get( new Integer(vtx.lineID) )
).intValue();
return (float) rowID;
return (float) map_line2row.get( vtx.lineID );
}
private float getRowIDAtTimeOnState( Map map_line2row, double marker_time )
private float getRowIDAtTimeOnState( OpenIntIntHashMap map_line2row,
double marker_time )
{
Coord vtx = this.getStartVertex();
int rowID = ( (Integer)
map_line2row.get( new Integer(vtx.lineID) )
).intValue();
return (float) rowID;
return (float) map_line2row.get( vtx.lineID );
}
private float getRowIDAtTimeOnArrow( Map map_line2row, double marker_time )
private float getRowIDAtTimeOnArrow( OpenIntIntHashMap map_line2row,
double marker_time )
{
Coord start_vtx, final_vtx;
start_vtx = this.getStartVertex();
......@@ -289,12 +286,8 @@ public abstract class Drawable extends InfoBox
tFinal = final_vtx.time;
double rStart, rFinal;
rStart = ( (Integer)
map_line2row.get( new Integer(start_vtx.lineID) )
).doubleValue();
rFinal = ( (Integer)
map_line2row.get( new Integer(final_vtx.lineID) )
).doubleValue();
rStart = (double) map_line2row.get( start_vtx.lineID );
rFinal = (double) map_line2row.get( final_vtx.lineID );
boolean isSlopeNonComputable = false;
double slope = 0.0;
......@@ -321,7 +314,8 @@ public abstract class Drawable extends InfoBox
return (float) marker_rowID;
}
public float getRowIDAtTime( Map map_line2row, double marker_time )
public float getRowIDAtTime( OpenIntIntHashMap map_line2row,
double marker_time )
{
Category type = super.getCategory();
Topology topo = type.getTopology();
......@@ -420,9 +414,9 @@ public abstract class Drawable extends InfoBox
/* Caller needs to be sure that the Drawable displayed is a State */
public void setStateRowAndNesting( CoordPixelXform coord_xform,
Map map_line2row,
NestingStacks nesting_stacks )
public void setStateRowAndNesting( CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
NestingStacks nesting_stacks )
{
Coord start_vtx;
start_vtx = this.getStartVertex();
......@@ -431,19 +425,17 @@ public abstract class Drawable extends InfoBox
final_vtx = this.getFinalVertex();
*/
row_ID = ( (Integer)
map_line2row.get( new Integer(start_vtx.lineID) )
).intValue();
row_ID = map_line2row.get( start_vtx.lineID );
nesting_ftr = nesting_stacks.getNestingFactorFor( this );
}
/* return number of primitives drawn */
// drawOnCanvas() implementation DOES NOT check
// if drawable is completely out of image bound.
public int drawOnCanvas( Graphics2D g,
CoordPixelXform coord_xform,
Map map_line2row,
DrawnBoxSet drawn_boxes )
public int drawOnCanvas( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
DrawnBoxSet drawn_boxes )
{
Category type = super.getCategory();
Topology topo = type.getTopology();
......@@ -464,9 +456,9 @@ public abstract class Drawable extends InfoBox
return 0;
}
public Drawable getDrawableAt( CoordPixelXform coord_xform,
Map map_line2row,
Point pix_pt )
public Drawable getDrawableAt( CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
Point pix_pt )
{
Category type = super.getCategory();
Topology topo = type.getTopology();
......@@ -490,9 +482,9 @@ public abstract class Drawable extends InfoBox
/* return number of primitives drawn */
// drawOnViewport() implementation DOES check
// if drawable is completely out of image bound.
public int drawOnViewport( Graphics2D g,
CoordPixelXform coord_xform,
Map map_line2row )
public int drawOnViewport( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row )
{
Category type = super.getCategory();
Topology topo = type.getTopology();
......
......@@ -14,10 +14,11 @@ import java.awt.Stroke;
import java.awt.BasicStroke;
import java.awt.Graphics2D;
import java.awt.Point;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import cern.colt.map.OpenIntIntHashMap;
import base.io.MixedDataInput;
import base.io.MixedDataOutput;
import base.io.MixedDataIO;
......@@ -349,9 +350,11 @@ public class Primitive extends Drawable
/*
0.0f < nesting_ftr <= 1.0f
*/
public int drawStateOnCanvas( Graphics2D g, CoordPixelXform coord_xform,
Map map_line2row, DrawnBoxSet drawn_boxes,
ColorAlpha color )
public int drawStateOnCanvas( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
DrawnBoxSet drawn_boxes,
ColorAlpha color )
{
Coord start_vtx, final_vtx;
start_vtx = this.getStartVertex();
......@@ -379,9 +382,11 @@ public class Primitive extends Drawable
}
// assume this Primitive overlaps with coord_xform.TimeBoundingBox
public int drawArrowOnCanvas( Graphics2D g, CoordPixelXform coord_xform,
Map map_line2row, DrawnBoxSet drawn_boxes,
ColorAlpha color )
public int drawArrowOnCanvas( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
DrawnBoxSet drawn_boxes,
ColorAlpha color )
{
Coord start_vtx, final_vtx;
start_vtx = this.getStartVertex();
......@@ -392,21 +397,19 @@ public class Primitive extends Drawable
tFinal = final_vtx.time;
int iStart, iFinal;
iStart = ( (Integer)
map_line2row.get( new Integer(start_vtx.lineID) )
).intValue();
iFinal = ( (Integer)
map_line2row.get( new Integer(final_vtx.lineID) )
).intValue();
iStart = map_line2row.get( start_vtx.lineID );
iFinal = map_line2row.get( final_vtx.lineID );
return Arrow.draw( g, color, null, coord_xform,
drawn_boxes.getLastArrowPos( iStart, iFinal ),
tStart, (float) iStart, tFinal, (float) iFinal );
}
public int drawEventOnCanvas( Graphics2D g, CoordPixelXform coord_xform,
Map map_line2row, DrawnBoxSet drawn_boxes,
ColorAlpha color )
public int drawEventOnCanvas( Graphics2D g,
CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
DrawnBoxSet drawn_boxes,
ColorAlpha color )
{
Coord vtx;
vtx = this.getStartVertex();
......@@ -416,9 +419,7 @@ public class Primitive extends Drawable
int rowID;
float rPeak, rStart, rFinal;
rowID = ( (Integer)
map_line2row.get( new Integer(vtx.lineID) )
).intValue();
rowID = map_line2row.get( vtx.lineID );
// rPeak = (float) rowID + NestingStacks.getHalfInitialNestingHeight();
rPeak = (float) rowID - 0.25f;
rStart = (float) rowID - 0.5f;
......@@ -434,8 +435,9 @@ public class Primitive extends Drawable
/*
0.0f < nesting_ftr <= 1.0f
*/
public boolean isPixelInState( CoordPixelXform coord_xform,
Map map_line2row, Point pix_pt )
public boolean isPixelInState( CoordPixelXform coord_xform,
OpenIntIntHashMap map_line2row,
Point pix_pt )
{
Coord start_vtx, final_vtx;
start_vtx = this.getStartVertex();
......@@ -448,9 +450,7 @@ public class Primitive extends Drawable
int rowID;
float nesting_ftr;
/*
rowID = ( (Integer)
map_line2row.get( new Integer(start_vtx.lineID) )
).intValue();
rowID = map_line2row.get( start_vtx.lineID );
*/
/* assume RowID and NestingFactor have been calculated */
rowID = super.getRowID();
......@@ -467,8 +467,9 @@ public class Primitive extends Drawable
}
// assume this Primitive overlaps with coord_xform.TimeBoundingBox
public boolean isPixelOnArrow( CoordPixelXform coord_xform,
Map map_line2row, Point pix_pt )