Package chemaxon.calculations.elemental
Record Class FormulaAtom
java.lang.Object
java.lang.Record
chemaxon.calculations.elemental.FormulaAtom
- Record Components:
symbol- the atom symbolmassNumber- the optional value of the mass number of the atom, or empty if not specifiedcharge- the charge of the atom
@PublicApi
public record FormulaAtom(String symbol, Optional<Integer> massNumber, int charge)
extends Record
Represents an atom in an
ElementalAnalysis.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFormulaAtom(String symbol, int charge) Creates a new instance with the given symbol and charge.FormulaAtom(String symbol, int massNumber, int charge) Creates a new instance with the given symbol, mass number and charge.FormulaAtom(String symbol, Optional<Integer> massNumber, int charge) Creates an instance of aFormulaAtomrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcharge()Returns the value of thechargerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of themassNumberrecord component.symbol()Returns the value of thesymbolrecord component.toString()Returns a string representation of this record class.
-
Field Details
-
HYDROGEN
-
-
Constructor Details
-
FormulaAtom
Creates a new instance with the given symbol and charge.- Parameters:
symbol- the atom symbolcharge- the charge of the atom
-
FormulaAtom
Creates a new instance with the given symbol, mass number and charge.- Parameters:
symbol- the atom symbolmassNumber- the mass number of the atomcharge- the charge of the atom
-
FormulaAtom
Creates an instance of aFormulaAtomrecord class.- Parameters:
symbol- the value for thesymbolrecord componentmassNumber- the value for themassNumberrecord componentcharge- the value for thechargerecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
symbol
Returns the value of thesymbolrecord component.- Returns:
- the value of the
symbolrecord component
-
massNumber
Returns the value of themassNumberrecord component.- Returns:
- the value of the
massNumberrecord component
-
charge
public int charge()Returns the value of thechargerecord component.- Returns:
- the value of the
chargerecord component
-