Public Member Functions | |
AxisReaction () | |
No-arg constructor. | |
YAxis | getYAxis () |
Get the y-axis. | |
AxisReaction | setYAxis (YAxis yAxis) |
Set the y-axis. | |
Set< Particle > | getInitialState () |
Get initial state. | |
Reaction | setInitialState (Set< Particle > initialState) |
Set initial state. | |
Reaction | addToInitialState (Particle particle) |
Add a particle (with multiplicity) into the initial state. | |
Reaction | removeFromInitialState (Particle particle) |
Remove a particle (with multiplicity) from the initial state: this will only remove the corresponding multiplicity from the state, without going negative. | |
Reaction | purgeFromInitialState (Particle particle) |
Remove all particles of this type from the initial state. | |
Set< Particle > | getFinalState () |
Get final state. | |
Reaction | setFinalState (Set< Particle > finalState) |
Set final state. | |
Reaction | addToFinalState (Particle particle) |
Add a particle (with multiplicity) into the final state. | |
Reaction | removeFromFinalState (Particle particle) |
Remove a particle (with multiplicity) from the final state: this will only remove the corresponding multiplicity from the state, without going negative. | |
Reaction | purgeFromFinalState (Particle particle) |
Remove all particles of this type from the final state. | |
boolean | equals (Object other) |
Compare reactions for equality. | |
String | initialStateToString () |
String representation of the initial state. | |
String | finalStateToString () |
String representation of the final state. | |
String | toString () |
String representation of this Reaction. | |
Package Functions | |
.hibernate.annotations.CollectionOfElements.hibernate.annotations. | CollectionId (columns=@Column(name="InitialStateId"), type=@org.hibernate.annotations.Type(type="long"), generator="sequence") private Set< Particle > _initialState |
A collection of particles and multiplicities in the initial state. | |
.hibernate.annotations.CollectionOfElements.hibernate.annotations. | CollectionId (columns=@Column(name="FinalStateId"), type=@org.hibernate.annotations.Type(type="long"), generator="sequence") private Set< Particle > _finalState |
A collection of particles and multiplicities in the final state. | |
Logger | log () |
Neat method to allow every class to get hold of a custom-named Logger. |
Definition at line 16 of file AxisReaction.java.
AxisReaction | ( | ) |
YAxis getYAxis | ( | ) |
AxisReaction setYAxis | ( | YAxis | yAxis | ) |
Set the y-axis.
Definition at line 41 of file AxisReaction.java.
References YAxis.getReactions().
Referenced by YAxis.addReaction(), and YAxis.removeReaction().
00041 { 00042 _yAxis = yAxis; 00043 if (getYAxis() != null) { 00044 getYAxis().getReactions().add(this); 00045 } 00046 return this; 00047 }
.hibernate.annotations.CollectionOfElements.hibernate.annotations. CollectionId | ( | columns | = @Column(name="InitialStateId") , |
|
type | = @org.hibernate.annotations.Type(type="long") , |
|||
generator | = "sequence" | |||
) | [package, inherited] |
A collection of particles and multiplicities in the initial state.
.hibernate.annotations.CollectionOfElements.hibernate.annotations. CollectionId | ( | columns | = @Column(name="FinalStateId") , |
|
type | = @org.hibernate.annotations.Type(type="long") , |
|||
generator | = "sequence" | |||
) | [package, inherited] |
A collection of particles and multiplicities in the final state.
Set<Particle> getInitialState | ( | ) | [inherited] |
Add a particle (with multiplicity) into the initial state.
If a particle of the same type already exists, the multiplicities will be combined.
Definition at line 64 of file Reaction.java.
References Particle.getMultiplicity().
00064 { 00065 boolean foundType = false; 00066 for (Particle p : _initialState) { 00067 if (Particle.sameType(p, particle)) { 00068 foundType = true; 00069 p.setMultiplicity(p.getMultiplicity() + particle.getMultiplicity()); 00070 break; 00071 } 00072 } 00073 if (!foundType) _initialState.add(particle); 00074 return this; 00075 }
Remove a particle (with multiplicity) from the initial state: this will only remove the corresponding multiplicity from the state, without going negative.
If you want to remove all the particles of a given type from the state, use purgeFromInitialState().
Definition at line 82 of file Reaction.java.
References Particle.getMultiplicity().
00082 { 00083 for (Particle p : _initialState) { 00084 if (Particle.sameType(p, particle)) { 00085 int newMult = p.getMultiplicity() - particle.getMultiplicity(); 00086 if (newMult <= 0) { 00087 _initialState.remove(p); 00088 } else { 00089 p.setMultiplicity(newMult); 00090 } 00091 break; 00092 } 00093 } 00094 return this; 00095 }
Remove all particles of this type from the initial state.
Definition at line 97 of file Reaction.java.
00097 { 00098 for (Particle p : _initialState) { 00099 if (Particle.sameType(p, particle)) { 00100 _initialState.remove(p); 00101 } 00102 } 00103 return this; 00104 }
Set<Particle> getFinalState | ( | ) | [inherited] |
Add a particle (with multiplicity) into the final state.
If a particle of the same type already exists, the multiplicities will be combined.
Definition at line 120 of file Reaction.java.
References Particle.getMultiplicity().
00120 { 00121 boolean foundType = false; 00122 for (Particle p : _finalState) { 00123 if (Particle.sameType(p, particle)) { 00124 foundType = true; 00125 p.setMultiplicity(p.getMultiplicity() + particle.getMultiplicity()); 00126 break; 00127 } 00128 } 00129 if (!foundType) _finalState.add(particle); 00130 return this; 00131 }
Remove a particle (with multiplicity) from the final state: this will only remove the corresponding multiplicity from the state, without going negative.
If you want to remove all the particles of a given type from the state, use purgeFromFinalState().
Definition at line 138 of file Reaction.java.
References Particle.getMultiplicity().
00138 { 00139 for (Particle p : _finalState) { 00140 if (Particle.sameType(p, particle)) { 00141 int newMult = p.getMultiplicity() - particle.getMultiplicity(); 00142 if (newMult <= 0) { 00143 _finalState.remove(p); 00144 } else { 00145 p.setMultiplicity(newMult); 00146 } 00147 break; 00148 } 00149 } 00150 return this; 00151 }
Remove all particles of this type from the final state.
Definition at line 153 of file Reaction.java.
00153 { 00154 for (Particle p : _finalState) { 00155 if (Particle.sameType(p, particle)) { 00156 _finalState.remove(p); 00157 } 00158 } 00159 return this; 00160 }
boolean equals | ( | Object | other | ) | [inherited] |
Compare reactions for equality.
Definition at line 167 of file Reaction.java.
References Reaction.getFinalState(), and Reaction.getInitialState().
00167 { 00168 log().debug("Comparing reactions..."); 00169 if (this == other) return true; 00170 if (! (other instanceof Reaction)) return false; 00171 final Reaction test = (Reaction) other; 00172 00173 if (! this.getInitialState().equals( test.getInitialState() )) return false; 00174 if (test.getInitialState() != null && this.getInitialState() != null) { 00175 Set<Particle> is1 = this.getInitialState(); 00176 Set<Particle> is2 = test.getInitialState(); 00177 if (is1.size() != is2.size()) return false; 00178 for (Particle p : is1) { 00179 if (! is2.contains(p)) return false; 00180 } 00181 } 00182 00183 if (! this.getFinalState().equals( test.getFinalState() )) return false; 00184 if (test.getFinalState() != null && this.getFinalState() != null) { 00185 Set<Particle> fs1 = this.getFinalState(); 00186 Set<Particle> fs2 = test.getFinalState(); 00187 if (fs1.size() != fs2.size()) return false; 00188 for (Particle p : fs1) { 00189 if (! fs2.contains(p)) return false; 00190 } 00191 } 00192 00194 00195 // If not proven guilty... 00196 return true; 00197 }
String initialStateToString | ( | ) | [inherited] |
String representation of the initial state.
Definition at line 206 of file Reaction.java.
00206 { 00207 StringBuffer s = new StringBuffer(); 00208 for (Particle ispart : getInitialState()) { 00209 s.append(" " + ispart.toString()); 00210 } 00211 return s.toString().trim(); 00212 }
String finalStateToString | ( | ) | [inherited] |
String representation of the final state.
Definition at line 216 of file Reaction.java.
00216 { 00217 StringBuffer s = new StringBuffer(); 00218 for (Particle fspart : getFinalState()) { 00219 s.append(" " + fspart.toString()); 00220 } 00221 return s.toString().trim(); 00222 }
String toString | ( | ) | [inherited] |
String representation of this Reaction.
Reimplemented from Storeable.
Definition at line 226 of file Reaction.java.
00226 { 00227 StringBuffer s = new StringBuffer(); 00228 s.append(initialStateToString()); 00229 s.append(" -> "); 00230 s.append(finalStateToString()); 00231 return s.toString().trim(); 00232 }
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(), AxisError.setAxis(), DatasetError.setDataset(), DatasetError.setNormType(), PointError.setPoint(), and Uncertainty.toString().