YAxis Class Reference

A YAxis contains header information, a set of Points, a set of AxisErrors and a description, which includes AxisPropertys, a Reaction and an Observable. More...

Inheritance diagram for YAxis:

Inheritance graph
[legend]

Collaboration diagram for YAxis:

Collaboration graph
[legend]

List of all members.


Public Member Functions

 YAxis ()
 No-arg constructor.
 YAxis (Dataset dataset)
 YAxis (String header, String observable, Unit unit)
 YAxis (Dataset dataset, String header, String observable, Unit unit)
Paper getPaper ()
 Get the Paper that this axis belongs to.
List< String > getComments ()
YAxis setComments (List< String > comments)
YAxis addComment (String comment)
YAxis removeComment (String comment)
Integer getId ()
 Get y-axis ID code.
YAxis setId (Integer yAxisId)
 Set y-axis ID code.
Dataset getDataset ()
 Get the Dataset that this axis belongs to.
YAxis setDataset (Dataset dataset)
 Over-ride dataset assignment, to get null IDs right.
SortedSet< XAxisgetXAxes ()
 Get associated x-axes.
Set< AxisReactiongetReactions ()
 Get reactions.
YAxis setReactions (Set< AxisReaction > reactions)
 Set reactions.
YAxis addReaction (AxisReaction reaction)
 Add a reaction.
YAxis removeReaction (AxisReaction reaction)
 Remove a reaction.
String getObservable ()
 Get observable.
YAxis setObservable (String observable)
 Set observable.
SortedSet< PointgetPoints ()
 Get points.
Point getPoint (Integer pointId)
 Get a specific point from this axis by point ID code.
YAxis setPoints (SortedSet< Point > points)
 Explicit set-points-from-SortedSet to keep reflection apps happy.
YAxis setPoints (Collection< Point > points)
 Set points from a Collection.
YAxis setPoints (Point[] points)
 Set points from an array.
YAxis addPoint (Point point)
 Add a point.
YAxis removePoint (Point point)
 Remove a point.
YAxis setPoints (double[] pointvals)
 Set points from an array of doubles (for convenience).
YAxis addPoint (double pointval)
 Add a point as a double (for convenience).
YAxis removePoint (double pointval)
 Remove a point as a double (for convenience).
SortedSet< AxisErrorgetErrors ()
 Get the axis errors.
YAxis setErrors (SortedSet< AxisError > axisErrors)
 Set the axis errors.
YAxis setErrors (Collection< AxisError > axisErrors)
 Set the axis errors (from a generic collection).
YAxis addError (AxisError axisError)
 Add an axis error.
YAxis removeError (AxisError axisError)
 Remove an axis error.
SortedSet< UncertaintygetDatasetErrors ()
 Get the errors from the parent dataset.
SortedSet< UncertaintygetAllErrors ()
 Get all the errors, including those from the parent dataset.
Set< AxisPropertygetProperties ()
 Get the axis properties.
YAxis setProperties (Set< AxisProperty > properties)
 Set the axis properties.
YAxis addProperty (AxisProperty property)
 Add a property.
YAxis removeProperty (AxisProperty property)
 Remove a property.
int compareTo (YAxis other)
 Comparison operation.
String toString ()
 String representation.
String toString (Integer indentBy)
 String representation with indent.
boolean equals (Object other)
 Override equals comparison.
int hashCode ()
 Overriden hash code computation.
String getHeader ()
 Get the axis header.
Axis setHeader (String header)
 Set the axis header.
Unit getUnit ()
 Get the Unit in which values on this axis are measured.
Axis setUnit (Unit unit)
 Set the Unit in which values on this axis are measured.

Protected Attributes

Dataset _dataset
 Parent dataset.

Package Functions

.hibernate.annotations. Fetch (value=org.hibernate.annotations.FetchMode.JOIN)@org.hibernate.annotations.Cascade(value
 Collection of points.
.hibernate.annotations.CollectionOfElements.hibernate.annotations. CollectionId (columns=@Column(name="AxisErrorId"), type=@org.hibernate.annotations.Type(type="long"), generator="sequence")@org.hibernate.annotations.Sort(type
 Collection of axis-level errors.
.hibernate.annotations. Cascade (value={org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN}) private Set< AxisProperty > _properties
 Collection of properties, such as sqrt(s), Q^2 etc.
.hibernate.annotations. Cascade (value={org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN}) private Set< AxisReaction > _reactions
 The reaction being measured.
.hibernate.annotations.CollectionOfElements.hibernate.annotations. IndexColumn (name="Posn")@Column(name
 Collection of comments ie non-numerical properties.
.hibernate.annotations. Type (type="cedar.hepdata.db.UnitUserType") private Unit _unit
 Unit which the points on this axis are measured in.
Logger log ()
 Neat method to allow every class to get hold of a custom-named Logger.

Package Attributes

.hibernate.annotations.CollectionOfElements.hibernate.annotations. length

Detailed Description

A YAxis contains header information, a set of Points, a set of AxisErrors and a description, which includes AxisPropertys, a Reaction and an Observable.

A Dataset has one or more YAxes.

Author:
Andy Buckley
Version:
Date
2007-11-02 10:01:54 +0000 (Fri, 02 Nov 2007)
Revision
1120

Definition at line 19 of file YAxis.java.


Constructor & Destructor Documentation

YAxis (  ) 

No-arg constructor.

Definition at line 77 of file YAxis.java.

00077                    {
00078         super();
00079         log().debug("Making a YAxis (0 arg constructor)");
00080     }

YAxis ( Dataset  dataset  ) 

Definition at line 82 of file YAxis.java.

00082                                   {
00083         this();
00084         log().debug("Making a YAxis (1 arg constructor)");
00085         setDataset(dataset);
00086     }

YAxis ( String  header,
String  observable,
Unit  unit 
)

Definition at line 88 of file YAxis.java.

00088                                                               {
00089         this();
00090         log().debug("Making a YAxis (3 arg constructor)");
00091         setHeader(header);
00092         setObservable(observable);
00093         setUnit(unit);
00094     }

YAxis ( Dataset  dataset,
String  header,
String  observable,
Unit  unit 
)

Definition at line 96 of file YAxis.java.

00096                                                                                {
00097         this(header, observable, unit);
00098         log().debug("Making a YAxis (4 arg constructor)");
00099         setDataset(dataset);
00100     }


Member Function Documentation

.hibernate.annotations. Fetch ( value  = org.hibernate.annotations.FetchMode.JOIN  )  [package]

Collection of points.

.hibernate.annotations.CollectionOfElements.hibernate.annotations. CollectionId ( columns  = @Column(name="AxisErrorId"),
type  = @org.hibernate.annotations.Type(type="long"),
generator  = "sequence" 
) [package]

Collection of axis-level errors.

.hibernate.annotations. Cascade (  )  [package]

Collection of properties, such as sqrt(s), Q^2 etc.

ranges

.hibernate.annotations. Cascade (  )  [package]

The reaction being measured.

.hibernate.annotations.CollectionOfElements.hibernate.annotations. IndexColumn ( name  = "Posn"  )  [package]

Collection of comments ie non-numerical properties.

Paper getPaper (  ) 

Get the Paper that this axis belongs to.

Note two degrees of separation, since there's a dataset in-between: watch out for null returns during hierarchy construction, e.g. in unpersisting from XML or database.

Definition at line 109 of file YAxis.java.

00109                             {
00110         if (getDataset() != null) {
00111             return getDataset().getPaper();
00112         } else {
00113             return null;
00114         }
00115     }

List<String> getComments (  ) 

Definition at line 119 of file YAxis.java.

00119                                       {
00120         return _comments;
00121     }

YAxis setComments ( List< String >  comments  ) 

Definition at line 122 of file YAxis.java.

00122                                                     {
00123         _comments = comments;
00124         return this;
00125     }

YAxis addComment ( String  comment  ) 

Definition at line 126 of file YAxis.java.

00126                                             {
00127         _comments.add(comment);
00128         return this;
00129     }

YAxis removeComment ( String  comment  ) 

Definition at line 130 of file YAxis.java.

00130                                                {
00131         _comments.remove(comment);
00132         return this;
00133     }

Integer getId (  ) 

Get y-axis ID code.

Definition at line 140 of file YAxis.java.

Referenced by YAxis.compareTo(), and Point.setYAxis().

00140                            {
00141         return _localId;
00142     }

YAxis setId ( Integer  yAxisId  ) 

Set y-axis ID code.

Definition at line 144 of file YAxis.java.

00144                                         {
00145         _localId = yAxisId;
00146         return this;
00147     }

Dataset getDataset (  ) 

Get the Dataset that this axis belongs to.

Definition at line 151 of file YAxis.java.

Referenced by Point.getBins(), and Point.getPoints().

00151                                 {
00152         return _dataset;
00153     }

YAxis setDataset ( Dataset  dataset  ) 

Over-ride dataset assignment, to get null IDs right.

Definition at line 155 of file YAxis.java.

References Dataset.getYAxes().

Referenced by Dataset.addYAxis().

00155                                              {
00156         log().debug("Calling setDataset()");
00157         _dataset = dataset;
00158         if (dataset != null) {
00159             if (getId() == null) {
00160                 int highestId = 0;
00161                 if (dataset.getYAxes().size() > 0) {
00162                     highestId = dataset.getYAxes().last().getId();
00163                 }
00164                 log().debug("Incrementing y-axis ID: " + (highestId + 1));
00165                 setId(highestId + 1);
00166             }
00167             log().debug("Adding myself to a Dataset");
00168             dataset.getYAxes().add(this);
00169         }
00170         return this;
00171     }

SortedSet<XAxis> getXAxes (  ) 

Get associated x-axes.

Definition at line 175 of file YAxis.java.

00175                                        {
00176         if (getDataset() != null) {
00177             return getDataset().getXAxes();
00178         } else {
00179             return null;
00180         }
00181     }

Set<AxisReaction> getReactions (  ) 

Get reactions.

Definition at line 185 of file YAxis.java.

Referenced by AxisReaction.setYAxis().

00185                                             {
00186         return _reactions;
00187     }

YAxis setReactions ( Set< AxisReaction reactions  ) 

Set reactions.

Definition at line 189 of file YAxis.java.

00189                                                            {
00190         getReactions().clear();
00191         for (AxisReaction r : reactions) addReaction(r);
00192         return this;
00193     }

YAxis addReaction ( AxisReaction  reaction  ) 

Add a reaction.

Definition at line 195 of file YAxis.java.

References AxisReaction.setYAxis().

00195                                                     {
00196         if (reaction != null) {
00197             reaction.setYAxis(this);
00198         } else {
00199             log().warn("Tried to add a null reaction to a y-axis");
00200         }
00201         return this;
00202     }

YAxis removeReaction ( AxisReaction  reaction  ) 

Remove a reaction.

Definition at line 204 of file YAxis.java.

References AxisReaction.setYAxis().

00204                                                        {
00205         if (reaction != null) {
00206             reaction.setYAxis(null);
00207             _reactions.remove(reaction);
00208         } else {
00209             log().warn("Tried to remove a null reaction from a y-axis");
00210         }
00211         return this;
00212     }

String getObservable (  ) 

Get observable.

Definition at line 216 of file YAxis.java.

00216                                   {
00217         return _observable;
00218     }

YAxis setObservable ( String  observable  ) 

Set observable.

Definition at line 221 of file YAxis.java.

00221                                                   {
00222         _observable = observable;
00223         return this;
00224     }

SortedSet<Point> getPoints (  ) 

Get points.

Definition at line 229 of file YAxis.java.

Referenced by Data.makeExampleYAxes(), and Point.setYAxis().

00229                                         {
00230         return _points;
00231     }

Point getPoint ( Integer  pointId  ) 

Get a specific point from this axis by point ID code.

Definition at line 234 of file YAxis.java.

Referenced by Dataset.getPoints().

00234                                            {
00235         Point thePoint = null;
00236         for (Point p : getPoints()) {
00237             if (p.getId().equals(pointId)) {
00238                 thePoint = p;
00239                 break;
00240             }
00241         }
00242         return thePoint;
00243     }

YAxis setPoints ( SortedSet< Point points  ) 

Explicit set-points-from-SortedSet to keep reflection apps happy.

Definition at line 246 of file YAxis.java.

References Point.getPoints().

Referenced by Data.makeExampleYAxes().

00246                                                     {
00247         log().debug("Calling setPoints(SortedSet<Point>)");
00248         this.getPoints().clear();
00249         for (Point p : points) addPoint(p);
00250         return this;
00251     }

YAxis setPoints ( Collection< Point points  ) 

Set points from a Collection.

Definition at line 254 of file YAxis.java.

00254                                                      {
00255         log().debug("Calling setPoints(Collection<Point>)");
00256         this.getPoints().clear();
00257         for (Point p : points) addPoint(p);
00258         return this;
00259     }

YAxis setPoints ( Point[]  points  ) 

Set points from an array.

Definition at line 262 of file YAxis.java.

00262                                            {
00263         setPoints(Arrays.asList(points));
00264         return this;
00265     }

YAxis addPoint ( Point  point  ) 

Add a point.

Definition at line 268 of file YAxis.java.

References Point.setYAxis().

00268                                        {
00269         if (point != null) {
00270             point.setYAxis(this);
00271         } else {
00272             log().warn("Tried to add a null Point to a YAxis");
00273         }
00274         return this;
00275     }

YAxis removePoint ( Point  point  ) 

Remove a point.

Definition at line 278 of file YAxis.java.

00278                                           {
00279         log().debug("Removing point: " + point);
00280         if (point != null) {
00281             getPoints().remove(point);
00282         } else {
00283             log().warn("Tried to remove a null Point from a YAxis");
00284         }
00285         log().debug("Removing point: done");
00286         return this;
00287     }

YAxis setPoints ( double[]  pointvals  ) 

Set points from an array of doubles (for convenience).

Definition at line 290 of file YAxis.java.

References Point.getPoints().

00290                                                {
00291         this.getPoints().clear();
00292         for (Double pv : pointvals) addPoint(pv);
00293         return this;
00294     }

YAxis addPoint ( double  pointval  ) 

Add a point as a double (for convenience).

Definition at line 297 of file YAxis.java.

00297                                            {
00298         return addPoint(new Point(pointval));
00299     }

YAxis removePoint ( double  pointval  ) 

Remove a point as a double (for convenience).

Definition at line 302 of file YAxis.java.

00302                                               {
00303         return removePoint(new Point(pointval));
00304     }

SortedSet<AxisError> getErrors (  ) 

Get the axis errors.

Definition at line 308 of file YAxis.java.

Referenced by AxisError.setAxis().

00308                                             {
00309         return _errors;
00310     }

YAxis setErrors ( SortedSet< AxisError axisErrors  ) 

Set the axis errors.

Definition at line 312 of file YAxis.java.

00312                                                             {
00313         getErrors().clear();
00314         for (AxisError e : axisErrors) addError(e);
00315         return this;
00316     }

YAxis setErrors ( Collection< AxisError axisErrors  ) 

Set the axis errors (from a generic collection).

Definition at line 318 of file YAxis.java.

00318                                                              {
00319         getErrors().clear();
00320         for (AxisError e : axisErrors) addError(e);
00321         return this;
00322     }

YAxis addError ( AxisError  axisError  ) 

Add an axis error.

Definition at line 324 of file YAxis.java.

References AxisError.setAxis().

Referenced by Data.makeExampleYAxes().

00324                                                {
00325         if (axisError != null) {
00326             axisError.setAxis(this);
00327         } else {
00328             log().warn("Tried to add a null AxisError to a YAxis");
00329         }
00330         return this;
00331     }

YAxis removeError ( AxisError  axisError  ) 

Remove an axis error.

Definition at line 333 of file YAxis.java.

00333                                                   {
00334         if (axisError != null) {
00335             getErrors().remove(axisError);
00336         } else {
00337             log().warn("Tried to remove a null AxisError from a YAxis");
00338         }
00339         return this;
00340     }

SortedSet<Uncertainty> getDatasetErrors (  ) 

Get the errors from the parent dataset.

Definition at line 344 of file YAxis.java.

00344                                                      {
00345         SortedSet<Uncertainty> dsErrors = new TreeSet<Uncertainty>();
00346         if (getDataset() != null) {
00347             dsErrors.addAll( getDataset().getErrors() );
00348         }
00349         return dsErrors;
00350     }

SortedSet<Uncertainty> getAllErrors (  ) 

Get all the errors, including those from the parent dataset.

Definition at line 352 of file YAxis.java.

00352                                                  {
00353         SortedSet<Uncertainty> allErrors = new TreeSet<Uncertainty>();
00354         allErrors.addAll(getErrors());
00355         allErrors.addAll(getDatasetErrors());
00356         return allErrors;
00357     }

Set<AxisProperty> getProperties (  ) 

Get the axis properties.

Definition at line 361 of file YAxis.java.

00361                                              {
00362         return _properties;
00363     }

YAxis setProperties ( Set< AxisProperty properties  ) 

Set the axis properties.

Definition at line 365 of file YAxis.java.

00365                                                              {
00366         _properties = properties;
00367         return this;
00368     }

YAxis addProperty ( AxisProperty  property  ) 

Add a property.

Definition at line 370 of file YAxis.java.

00370                                                     {
00371         if (property != null) {
00372             property.setYAxis(this);
00373             _properties.add(property);
00374         } else {
00375             log().warn("Tried to add a null AxisProperty to a YAxis");
00376         }
00377         return this;
00378     }

YAxis removeProperty ( AxisProperty  property  ) 

Remove a property.

Definition at line 380 of file YAxis.java.

00380                                                        {
00381         if (property != null) {
00382             property.setYAxis(null);
00383             _properties.remove(property);
00384         } else {
00385             log().warn("Tried to remove a null AxisProperty from a YAxis");
00386         }
00387         return this;
00388     }

int compareTo ( YAxis  other  ) 

Comparison operation.

Definition at line 395 of file YAxis.java.

References YAxis.getId().

00395                                       {
00396         log().debug("Comparing y-axes...");
00397         if (getId() == null) {
00398             log().debug("Null YAxis ID");
00399             return 1; // Sort null y-axes at the end
00400         } else if (getId() > other.getId()) {
00401             log().debug("Greater than");
00402             return 1;
00403         } else if (getId() < other.getId()) {
00404             log().debug("Less than");
00405             return -1;
00406         } else {
00407             log().debug("Equal to");
00408             return 0;
00409         }
00410     }

String toString (  ) 

String representation.

Reimplemented from Axis.

Definition at line 417 of file YAxis.java.

00417                              {
00418         return toString(0);
00419     }

String toString ( Integer  indentBy  ) 

String representation with indent.

Definition at line 422 of file YAxis.java.

00422                                              {
00423         log().debug("Writing out y-axis as a string");
00424         StringBuffer s = new StringBuffer();
00425         String indent = "";
00426         for (int i  = 0; i < indentBy; ++i) indent += " ";
00427 
00428         s.append(indent + "Y-axis ID: " + getId() + "\n");
00429         s.append(indent + "Header: " + getHeader());
00430         s.append(indent + "Observable: " + getObservable());
00431         for (Point point : getPoints()) {
00432             s.append("\n" + point.toString(indentBy + 2));
00433         }
00434         return s.toString();
00435     }

boolean equals ( Object  other  ) 

Override equals comparison.

Definition at line 442 of file YAxis.java.

00442                                         {
00443         if (this == other) return true;
00444         if (! (other instanceof YAxis)) return false;
00445         return hashCode() == other.hashCode();
00446     }

int hashCode (  ) 

Overriden hash code computation.

Definition at line 450 of file YAxis.java.

Referenced by AxisError.hashCode().

00450                           {
00451         int code = 31;
00452         if (getDataset() != null) code ^= getDataset().hashCode();
00453         if (getHeader()  != null) code ^= getHeader().hashCode();
00454         if (getUnit()    != null) code ^= getUnit().hashCode();
00455         return code;
00456     }

.hibernate.annotations. Type ( type  = "cedar.hepdata.db.UnitUserType"  )  [package, inherited]

Unit which the points on this axis are measured in.

String getHeader (  )  [inherited]

Get the axis header.

Definition at line 55 of file Axis.java.

00055                               {
00056         return _header;
00057     }

Axis setHeader ( String  header  )  [inherited]

Set the axis header.

Definition at line 59 of file Axis.java.

00059                                          {
00060         _header = header;
00061         return this;
00062     }

Unit getUnit (  )  [inherited]

Get the Unit in which values on this axis are measured.

Definition at line 66 of file Axis.java.

00066                           {
00067         return _unit;
00068     }

Axis setUnit ( Unit  unit  )  [inherited]

Set the Unit in which values on this axis are measured.

Definition at line 71 of file Axis.java.

00071                                    {
00072         _unit = unit;
00073         return this;
00074     }

Logger log (  )  [package, inherited]


Member Data Documentation

.hibernate.annotations.CollectionOfElements.hibernate.annotations. length [package]

Initial value:

10000)
    private List<String> _comments = new Vector<String>()

Definition at line 65 of file YAxis.java.

Dataset _dataset [protected]

Parent dataset.

Definition at line 70 of file YAxis.java.


The documentation for this class was generated from the following file:


Generated on Tue Apr 21 15:54:51 2009 for HepData object model by  doxygen 1.5.5