diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..34d27f0 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..7b87cf9 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..67e1e61 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/java/org/jlab/groot/data/DataLine.java b/src/main/java/org/jlab/groot/data/DataLine.java index d84e807..b715c90 100644 --- a/src/main/java/org/jlab/groot/data/DataLine.java +++ b/src/main/java/org/jlab/groot/data/DataLine.java @@ -9,8 +9,8 @@ * * @author gavalian */ -public class DataLine { - +public class DataLine extends SetEndandOrigin{ + private double originX = 0.0; private double originY = 0.0; private double endX = 0.0; @@ -21,7 +21,7 @@ public class DataLine { private int lineWidth = 2; private int lineStyle = 1; private double arrowAngle = 30.0; - + SetEndandOrigin set = new SetEndandOrigin(); public DataLine(){} public DataLine(double o_x, double o_y, double e_x, double e_y) @@ -29,11 +29,11 @@ public DataLine(double o_x, double o_y, double e_x, double e_y) setOrigin(o_x,o_y); setEnd(e_x,e_y); } - public final DataLine setOrigin(double x, double y){ + public final DataLine setOrigin(double x, double y){ originX = x; originY = y; return this; } - + public final DataLine setEnd(double x, double y){ endX = x; endY = y; return this; @@ -49,12 +49,14 @@ public final DataLine setEnd(double x, double y){ public double getArrowSizeOrigin(){ return arrowSizeOrigin;} public double getArrowSizeEnd(){ return arrowSizeEnd;} - public DataLine setArrowSizeOrigin(double size){ - arrowSizeOrigin = size; return this; + public DataLine setArrowSizeOrigin(double size){ + arrowSizeOrigin = set.setOrigin(size); + return this; } public DataLine setArrowSizeEnd(double size){ - arrowSizeEnd = size; return this; + arrowSizeEnd = set.setOrigin(size); + return this; } public DataLine setLineColor(int color) { lineColor = color; return this;} diff --git a/src/main/java/org/jlab/groot/data/H1F.java b/src/main/java/org/jlab/groot/data/H1F.java index c760ef9..f0d763a 100755 --- a/src/main/java/org/jlab/groot/data/H1F.java +++ b/src/main/java/org/jlab/groot/data/H1F.java @@ -245,12 +245,7 @@ public static H1F create(String name, int bins, DataVector vec){ min = .9999*min; max = 1.0001*max; } - H1F h = new H1F(name,"",bins,min,max); - for(int i = 0; i < vec.getSize(); i++){ - h.fill(vec.getValue(i)); - } - h.setFillColor(43); - return h; + return getH1F(name, bins, min, max, vec); } public static H1F create(String name, int bins, DataVector vec, double min, double max){ @@ -260,13 +255,18 @@ public static H1F create(String name, int bins, DataVector vec, double min, dou min = .9999*min; max = 1.0001*max; } - H1F h = new H1F(name,"",bins,min,max); + return getH1F(name, bins, min, max, vec); + } + + private static H1F getH1F(String name, int bins, double min, double max, DataVector vec) { + H1F h = new H1F(name,"", bins, min, max); for(int i = 0; i < vec.getSize(); i++){ h.fill(vec.getValue(i)); } - h.setFillColor(43); + h.setFillColor(43); return h; } + /** * The getter for the histogram title. * @return Title of the histogram. diff --git a/src/main/java/org/jlab/groot/data/H2F.java b/src/main/java/org/jlab/groot/data/H2F.java index 036b1d1..396b6ff 100755 --- a/src/main/java/org/jlab/groot/data/H2F.java +++ b/src/main/java/org/jlab/groot/data/H2F.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.util.ArrayList; +//import com.sun.org.apache.xerces.internal.impl.xpath.XPath; import org.jlab.groot.base.DatasetAttributes; import org.jlab.groot.base.GStyle; import org.jlab.groot.math.Axis; @@ -18,7 +19,7 @@ * @author Erin Kirby * @version 061714 */ -public class H2F implements IDataSet { +public class H2F extends Axis implements IDataSet { private String hName = "basic2D"; private Axis xAxis = new Axis(); @@ -33,8 +34,6 @@ public class H2F implements IDataSet { private double maximumBinValue = 0.0; public H2F() { - offset = new MultiIndex(xAxis.getNBins(), yAxis.getNBins()); - hBuffer = new double[offset.getArraySize()]; initAttributes(); } @@ -48,8 +47,6 @@ public H2F() { */ public H2F(String name) { hName = name; - offset = new MultiIndex(xAxis.getNBins(), yAxis.getNBins()); - hBuffer = new double[offset.getArraySize()]; initAttributes(); } @@ -209,44 +206,7 @@ public double getMaximum(){ return maximum; } - /** - * Checks if that bin is valid (exists) - * - * @param bx - * The x coordinate of the bin - * @param by - * The y coordinate of the bin - * @return The truth value of the validity of that bin - */ - private boolean isValidBins(int bx, int by) { - if ((bx >= 0) && (bx <= xAxis.getNBins()) && (by >= 0) - && (by <= yAxis.getNBins())) { - return true; - } - return false; - } - - /** - * Finds the bin content at that bin - * - * @param bx - * The x coordinate of the bin - * @param by - * The y coordinate of the bin - * @return The content at that bin - */ - public double getBinContent(int bx, int by) { - if (this.isValidBins(bx, by)) { - int buff = offset.getArrayIndex(bx, by); - if(buff>=0&&buff=0) return bin; return ((-bin) - 2); } + + /** + * Checks if that bin is valid (exists) + * + * @param bx + * The x coordinate of the bin + * @param by + * The y coordinate of the bin + * @return The truth value of the validity of that bin + */ + protected boolean isValidBins(int bx, int by) { + if ((bx >= 0) && (bx <= xAxis.getNBins()) && (by >= 0) + && (by <= yAxis.getNBins())) { + return true; + } + return false; + } + + /** + * Finds the bin content at that bin + * + * @param bx + * The x coordinate of the bin + * @param by + * The y coordinate of the bin + * @return The content at that bin + */ + public double getBinContent(int bx, int by) { + if (this.isValidBins(bx, by)) { + int buff = offset.getArrayIndex(bx, by); + if(buff>=0&&buff branches){ final void init(){ String[] variables = new String[expVariables.size()]; - for(int i=0; i < variables.length; i++) variables[i] = expVariables.get(i); + for(int i=0; i < variables.length; i++) { + variables[i] = expVariables.get(i); + } ExpressionBuilder builder = new ExpressionBuilder(treeExpression) .function(funcVec3m).function(funcVec3p).function(funcVec3t); builder.variables(variables);