Package ffx.xray.scatter
Record Class NeutronScatteringParameters
java.lang.Object
java.lang.Record
ffx.xray.scatter.NeutronScatteringParameters
public record NeutronScatteringParameters(String name, int atomicNumber, double[] formFactor)
extends Record
Represents neutron scattering parameters for a given atom, including its name, atomic number,
and form factor.
This class uses a static cache to store precomputed neutron scattering parameters for atoms and allows for retrieval of these parameters by atom name.
- Since:
- 1.0
- Author:
- Michael J. Schnieders
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionNeutronScatteringParameters(String name, int atomicNumber, double[] formFactor) Creates an instance of aNeutronScatteringParametersrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theatomicNumberrecord component.final booleanIndicates whether some other object is "equal to" this one.double[]Returns the value of theformFactorrecord component.static NeutronScatteringParametersgetFormFactor(String atom) Retrieves the neutron scattering parameters (form factor) for a specified atom.final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
NeutronScatteringParameters
Creates an instance of aNeutronScatteringParametersrecord class.- Parameters:
name- the value for thenamerecord componentatomicNumber- the value for theatomicNumberrecord componentformFactor- the value for theformFactorrecord component
-
-
Method Details
-
getFormFactor
Retrieves the neutron scattering parameters (form factor) for a specified atom. If the atom does not exist in the form factors map, returns null.- Parameters:
atom- the name of the atom for which the form factor is requested- Returns:
- the neutron scattering parameters for the specified atom, or null if the atom is not found in the form factors map
-
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 '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
atomicNumber
public int atomicNumber()Returns the value of theatomicNumberrecord component.- Returns:
- the value of the
atomicNumberrecord component
-
formFactor
public double[] formFactor()Returns the value of theformFactorrecord component.- Returns:
- the value of the
formFactorrecord component
-