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 (String header)
 YAxis (String header, Unit unit)
 YAxis (Dataset dataset)
 YAxis (Dataset dataset, String header)
 YAxis (Dataset dataset, String header, Unit unit)
 YAxis (Observable observable)
 YAxis (Observable observable, String header)
 YAxis (Observable observable, String header, Unit unit)
 YAxis (Dataset dataset, Observable observable)
 YAxis (Dataset dataset, Observable observable, String header)
 YAxis (Dataset dataset, Observable observable, String header, 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 ()
YAxis setReactions (Set< AxisReaction > reactions)
YAxis addReaction (AxisReaction reaction)
YAxis removeReaction (AxisReaction reaction)
Observable getObservable ()
 Get observable.
YAxis setObservable (Observable 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 addPoint (Point point)
 Set points from a Collection.
YAxis removePoint (Point point)
 Remove a point.
SortedSet< AxisErrorgetErrors ()
YAxis setErrors (SortedSet< AxisError > axisErrors)
YAxis setErrors (Collection< AxisError > axisErrors)
YAxis addError (AxisError axisError)
YAxis removeError (AxisError axisError)
SortedSet< UncertaintygetDatasetErrors ()
SortedSet< UncertaintygetAllErrors ()
Set< AxisPropertygetProperties ()
YAxis setProperties (Set< AxisProperty > properties)
YAxis addProperty (AxisProperty property)
YAxis removeProperty (AxisProperty property)
int compareTo (YAxis other)
String toString ()
 String representation.
String toString (Integer indentBy)
 String representation with indent.
boolean equals (Object other)
int hashCode ()
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. Cascade (value={org.hibernate.annotations.CascadeType.ALL}) private Observable _observable
 The observable 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
Revision

Definition at line 26 of file YAxis.java.


Constructor & Destructor Documentation

YAxis (  ) 

No-arg constructor.

Definition at line 83 of file YAxis.java.

00083                    {
00084         super();
00085         log().debug("Making a YAxis (0 arg constructor)");
00086     }

YAxis ( String  header  ) 

Definition at line 88 of file YAxis.java.

00088                                 {
00089         super(header);
00090         log().debug("Making a YAxis (1 arg constructor)");
00091     }

YAxis ( String  header,
Unit  unit 
)

Definition at line 93 of file YAxis.java.

00093                                            {
00094         super(header, unit);
00095         log().debug("Making a YAxis (2 arg constructor)");
00096     }

YAxis ( Dataset  dataset  ) 

Definition at line 98 of file YAxis.java.

00098                                   {
00099         this();
00100         setDataset(dataset);
00101         log().debug("Making a YAxis (1 arg constructor)");
00102     }

YAxis ( Dataset  dataset,
String  header 
)

Definition at line 104 of file YAxis.java.

00104                                                  {
00105         this(header);
00106         setDataset(dataset);
00107         log().debug("Making a YAxis (2 arg constructor)");
00108     }

YAxis ( Dataset  dataset,
String  header,
Unit  unit 
)

Definition at line 110 of file YAxis.java.

00110                                                             {
00111         this(header, unit);
00112         setDataset(dataset);
00113         log().debug("Making a YAxis (3 arg constructor)");
00114     }

YAxis ( Observable  observable  ) 

Definition at line 116 of file YAxis.java.

00116                                         {
00117         this();
00118         log().debug("Making a YAxis (1 arg constructor)");
00119         setObservable(observable);
00120     }

YAxis ( Observable  observable,
String  header 
)

Definition at line 122 of file YAxis.java.

00122                                                        {
00123         this(header);
00124         log().debug("Making a YAxis (2 arg constructor)");
00125         setObservable(observable);
00126     }

YAxis ( Observable  observable,
String  header,
Unit  unit 
)

Definition at line 128 of file YAxis.java.

00128                                                                   {
00129         this(header, unit);
00130         log().debug("Making a YAxis (3 arg constructor)");
00131         setObservable(observable);
00132     }

YAxis ( Dataset  dataset,
Observable  observable 
)

Definition at line 134 of file YAxis.java.

00134                                                          {
00135         this(dataset);
00136         log().debug("Making a YAxis (2 arg constructor)");
00137         setObservable(observable);
00138     }

YAxis ( Dataset  dataset,
Observable  observable,
String  header 
)

Definition at line 140 of file YAxis.java.

00140                                                                         {
00141         this(dataset, header);
00142         log().debug("Making a YAxis (3 arg constructor)");
00143         setObservable(observable);
00144     }

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

Definition at line 146 of file YAxis.java.

00146                                                                                    {
00147         this(dataset, header, unit);
00148         log().debug("Making a YAxis (4 arg constructor)");
00149         setObservable(observable);
00150     }


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. Cascade (  )  [package]

The observable 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 159 of file YAxis.java.

Referenced by YAxis.equals().

00159                             {
00160         if (getDataset() != null) {
00161             return getDataset().getPaper();
00162         } else {
00163             return null;
00164         }
00165     }

List<String> getComments (  ) 

Definition at line 169 of file YAxis.java.

00169                                       {
00170         return _comments;
00171     }

YAxis setComments ( List< String >  comments  ) 

Definition at line 172 of file YAxis.java.

00172                                                     {
00173         _comments = comments;
00174         return this;
00175     }

YAxis addComment ( String  comment  ) 

Definition at line 176 of file YAxis.java.

00176                                             {
00177         _comments.add(comment);
00178         return this;
00179     }

YAxis removeComment ( String  comment  ) 

Definition at line 180 of file YAxis.java.

00180                                                {
00181         _comments.remove(comment);
00182         return this;
00183     }

Integer getId (  ) 

Get y-axis ID code.

Definition at line 190 of file YAxis.java.

Referenced by Dataset.addYAxis(), and YAxis.compareTo().

00190                            {
00191         return _localId;
00192     }

YAxis setId ( Integer  yAxisId  ) 

Set y-axis ID code.

Definition at line 194 of file YAxis.java.

Referenced by Dataset.addYAxis().

00194                                         {
00195         _localId = yAxisId;
00196         return this;
00197     }

Dataset getDataset (  ) 

Get the Dataset that this axis belongs to.

Definition at line 201 of file YAxis.java.

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

00201                                 {
00202         return _dataset;
00203     }

YAxis setDataset ( Dataset  dataset  ) 

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

Definition at line 205 of file YAxis.java.

References Dataset.getYAxes().

Referenced by Dataset.addYAxis(), and Dataset.removeYAxis().

00205                                              {
00206         log().debug("Calling setDataset()");
00207         _dataset = dataset;
00208         if (dataset != null) {
00209             if (getId() == null) {
00210                 int highestId = 0;
00211                 if (dataset.getYAxes().size() > 0) {
00212                     highestId = dataset.getYAxes().last().getId();
00213                 }
00214                 log().debug("Incrementing y-axis ID: " + (highestId + 1));
00215                 setId(highestId + 1);
00216             }
00217             log().debug("Adding myself to a Dataset");
00218             dataset.getYAxes().add(this);
00219         } else {
00220             log().warn("Tried to attach a YAxis to a null Dataset");
00221         }
00222         return this;
00223     }

SortedSet<XAxis> getXAxes (  ) 

Get associated x-axes.

Definition at line 227 of file YAxis.java.

00227                                        {
00228         if (getDataset() != null) {
00229             return getDataset().getXAxes();
00230         } else {
00231             return null;
00232         }
00233     }

Set<AxisReaction> getReactions (  ) 

Definition at line 237 of file YAxis.java.

00237                                             {
00238         return _reactions;
00239     }

YAxis setReactions ( Set< AxisReaction reactions  ) 

Todo:
Bidirectional?

Definition at line 240 of file YAxis.java.

00240                                                            {
00242         _reactions = reactions;
00243         return this;
00244     }

YAxis addReaction ( AxisReaction  reaction  ) 

Definition at line 245 of file YAxis.java.

References AxisReaction.setYAxis().

00245                                                     {
00246         if (reaction != null) {
00247             reaction.setYAxis(this);
00248             _reactions.add(reaction);
00249         } else {
00250             log().warn("Tried to add a null reaction to a y-axis");
00251         }
00252         return this;
00253     }

YAxis removeReaction ( AxisReaction  reaction  ) 

Definition at line 254 of file YAxis.java.

References AxisReaction.setYAxis().

00254                                                        {
00255         if (reaction != null) {
00256             reaction.setYAxis(null);
00257             _reactions.remove(reaction);
00258         } else {
00259             log().warn("Tried to remove a null reaction from a y-axis");
00260         }
00261         return this;
00262     }

Observable getObservable (  ) 

Get observable.

Definition at line 266 of file YAxis.java.

00266                                       {
00267         return _observable;
00268     }

YAxis setObservable ( Observable  observable  ) 

Set observable.

Definition at line 271 of file YAxis.java.

References Observable.getYAxes().

Referenced by Observable.addYAxis(), and Observable.removeYAxis().

00271                                                       {
00272         if (observable != null) observable.getYAxes().add(this);
00273         _observable = observable;
00274         return this;
00275     }

SortedSet<Point> getPoints (  ) 

Get points.

Definition at line 279 of file YAxis.java.

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

00279                                         {
00280         return _points;
00281     }

Point getPoint ( Integer  pointId  ) 

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

Definition at line 284 of file YAxis.java.

Referenced by Dataset.getPoints().

00284                                            {
00285         Point thePoint = null;
00286         for (Point p : getPoints()) {
00287             if (p.getId().equals(pointId)) {
00288                 thePoint = p;
00289                 break;
00290             }
00291         }
00292         return thePoint;
00293     }

YAxis setPoints ( SortedSet< Point points  ) 

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

Definition at line 296 of file YAxis.java.

00296                                                     {
00297         log().debug("Calling setPoints(SortedSet<Point>)");
00298         _points = points;
00299         return this;
00300     }

YAxis addPoint ( Point  point  ) 

Set points from a Collection.

Set points from an array. Add a point.

Definition at line 317 of file YAxis.java.

References Point.getId(), Point.setId(), and Point.setYAxis().

Referenced by Data.makeExampleYAxes().

00317                                        {
00318         if (point != null) {
00319             if (point.getId() == null) {
00320                 int highestId = 0;
00321                 if (getPoints().size() > 0) {
00322                     highestId = getPoints().last().getId();
00323                 }
00324                 log().debug("Incrementing point ID: " + (highestId + 1));
00325                 point.setId(highestId + 1);
00326             }
00327             log().debug("Adding point to y-axis " + getId() + ": ID = " + point.getId());
00328             point.setYAxis(this);
00329         } else {
00330             log().warn("Tried to add a null Point to a YAxis");
00331         }
00332         return this;
00333     }

YAxis removePoint ( Point  point  ) 

Remove a point.

Definition at line 336 of file YAxis.java.

References Point.setYAxis().

00336                                           {
00337         log().debug("Removing point: " + point);
00338         if (point != null) {
00339             getPoints().remove(point);
00340             point.setYAxis(null);
00341         } else {
00342             log().warn("Tried to remove a null Point from a YAxis");
00343         }
00344         log().debug("Removing point: done");
00345         return this;
00346     }

SortedSet<AxisError> getErrors (  ) 

Definition at line 350 of file YAxis.java.

00350                                             {
00351         return _errors;
00352     }

YAxis setErrors ( SortedSet< AxisError axisErrors  ) 

Definition at line 353 of file YAxis.java.

00353                                                             {
00354         getErrors().clear();
00355         for (AxisError e : axisErrors) addError(e);
00356         return this;
00357     }

YAxis setErrors ( Collection< AxisError axisErrors  ) 

Definition at line 358 of file YAxis.java.

00358                                                              {
00359         getErrors().clear();
00360         for (AxisError e : axisErrors) addError(e);
00361         return this;
00362     }

YAxis addError ( AxisError  axisError  ) 

Definition at line 363 of file YAxis.java.

References AxisError.getId(), and AxisError.setId().

Referenced by Data.makeExampleYAxes().

00363                                                {
00364         if (axisError != null) {
00365             getErrors().add(axisError);
00366             // Auto-increment the local ID if necessary
00367             if (axisError.getId() == null) {
00368                 if (getErrors().last() != null && getErrors().last().getId() != null) {
00369                     axisError.setId(getErrors().last().getId() + 1);
00370                 } else {
00371                     axisError.setId(getErrors().size() + 1);
00372                 }
00373             }
00374         } else {
00375             log().warn("Tried to add a null AxisError to a YAxis");
00376         }
00377         return this;
00378     }

YAxis removeError ( AxisError  axisError  ) 

Definition at line 379 of file YAxis.java.

00379                                                   {
00380         if (axisError != null) {
00381             getErrors().remove(axisError);
00382         } else {
00383             log().warn("Tried to remove a null AxisError from a YAxis");
00384         }
00385         return this;
00386     }

SortedSet<Uncertainty> getDatasetErrors (  ) 

Definition at line 390 of file YAxis.java.

00390                                                      {
00391         SortedSet<Uncertainty> dsErrors = new TreeSet<Uncertainty>();
00392         if (getDataset() != null) {
00393             dsErrors.addAll( getDataset().getErrors() );
00394         }
00395         return dsErrors;
00396     }

SortedSet<Uncertainty> getAllErrors (  ) 

Definition at line 397 of file YAxis.java.

00397                                                  {
00398         SortedSet<Uncertainty> allErrors = new TreeSet<Uncertainty>();
00399         allErrors.addAll(getErrors());
00400         allErrors.addAll(getDatasetErrors());
00401         return allErrors;
00402     }

Set<AxisProperty> getProperties (  ) 

Definition at line 406 of file YAxis.java.

00406                                              {
00407         return _properties;
00408     }

YAxis setProperties ( Set< AxisProperty properties  ) 

Definition at line 409 of file YAxis.java.

00409                                                              {
00410         _properties = properties;
00411         return this;
00412     }

YAxis addProperty ( AxisProperty  property  ) 

Definition at line 413 of file YAxis.java.

00413                                                     {
00414         if (property != null) {
00415             property.setYAxis(this);
00416             _properties.add(property);
00417         } else {
00418             log().warn("Tried to add a null AxisProperty to a YAxis");
00419         }
00420         return this;
00421     }

YAxis removeProperty ( AxisProperty  property  ) 

Definition at line 422 of file YAxis.java.

00422                                                        {
00423         if (property != null) {
00424             property.setYAxis(null);
00425             _properties.remove(property);
00426         } else {
00427             log().warn("Tried to remove a null AxisProperty from a YAxis");
00428         }
00429         return this;
00430     }

int compareTo ( YAxis  other  ) 

Definition at line 436 of file YAxis.java.

References YAxis.getId().

00436                                       {
00437         log().debug("Comparing y-axes...");
00438         if (getId() == null) {
00439             log().debug("Null YAxis ID");
00440             return 1; // Sort null y-axes at the end
00441         } else if (getId() > other.getId()) {
00442             log().debug("Greater than");
00443             return 1;
00444         } else if (getId() < other.getId()) {
00445             log().debug("Less than");
00446             return -1;
00447         } else {
00448             log().debug("Equal to");
00449             return 0;
00450         }
00451     }

String toString (  ) 

String representation.

Reimplemented from Axis.

Definition at line 458 of file YAxis.java.

00458                              {
00459         return toString(0);
00460     }

String toString ( Integer  indentBy  ) 

String representation with indent.

Definition at line 463 of file YAxis.java.

00463                                              {
00464         log().debug("Writing out y-axis as a string");
00465         StringBuffer s = new StringBuffer();
00466         String indent = "";
00467         for (int i  = 0; i < indentBy; ++i) indent += " ";
00468 
00469         s.append(indent + "Y-axis ID: " + getId() + "\n");
00470         s.append(indent + "Header: " + getHeader());
00471         for (Point point : getPoints()) {
00472             s.append("\n" + point.toString(indentBy + 2));
00473         }
00474         return s.toString();
00475     }

boolean equals ( Object  other  ) 

Definition at line 481 of file YAxis.java.

References YAxis.getDataset(), Axis.getHeader(), YAxis.getPaper(), and Axis.getUnit().

Referenced by Point.equals().

00481                                         {
00482         if (this == other) return true;
00483         if (! (other instanceof YAxis)) return false;
00484 
00485         final YAxis test = (YAxis) other;
00486         if (! test.getPaper().equals(getPaper()) ) return false;
00487         if (! test.getDataset().equals(getDataset()) ) return false;
00488         if (! test.getHeader().equals(getHeader()) ) return false;
00489         if (! test.getUnit().equals(getUnit()) ) return false;
00490         return true;
00491     }

int hashCode (  ) 

Definition at line 493 of file YAxis.java.

00493                           {
00494         int code = 0;
00495         if (getPaper()   != null) code += 1000000 * getPaper().hashCode();
00496         if (getDataset() != null) code += 100 * getDataset().hashCode();
00497         if (getHeader()  != null) code += 10 * getHeader().hashCode();
00498         if (getUnit()    != null) code += getUnit().hashCode();
00499         code *= 2; // ensure this is even
00500         return code;
00501     }

.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.

Referenced by YAxis.equals(), and XAxis.equals().

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.

Referenced by YAxis.equals(), and XAxis.equals().

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]

Neat method to allow every class to get hold of a custom-named Logger.

Definition at line 14 of file Storeable.java.

Referenced by Uncertainty.compareTo(), Reference.compareTo(), PointError.compareTo(), Modification.compareTo(), Experiment.compareTo(), DatasetError.compareTo(), AxisError.compareTo(), Data.makeExample(), Data.makeExampleDataset(), Data.makeExampleExperiment(), Data.makeExamplePaper(), Data.makeExampleXAxes(), Data.makeExampleYAxes(), DatasetError.setNormType(), and Uncertainty.toString().

00014                  {
00015         return Logger.getLogger(this.getClass());
00016     }


Member Data Documentation

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

Initial value:

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

Definition at line 71 of file YAxis.java.

Dataset _dataset [protected]

Parent dataset.

Definition at line 76 of file YAxis.java.


The documentation for this class was generated from the following file:
Generated on Thu Sep 20 11:41:40 2007 by  doxygen 1.5.3