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

    Constructors
    Constructor
    Description
    NeutronScatteringParameters(String name, int atomicNumber, double[] formFactor)
    Creates an instance of a NeutronScatteringParameters record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the atomicNumber record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    double[]
    Returns the value of the formFactor record component.
    Retrieves the neutron scattering parameters (form factor) for a specified atom.
    final int
    Returns a hash code value for this object.
    Returns the value of the name record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • NeutronScatteringParameters

      public NeutronScatteringParameters(String name, int atomicNumber, double[] formFactor)
      Creates an instance of a NeutronScatteringParameters record class.
      Parameters:
      name - the value for the name record component
      atomicNumber - the value for the atomicNumber record component
      formFactor - the value for the formFactor record component
  • Method Details

    • getFormFactor

      public static NeutronScatteringParameters getFormFactor(String atom)
      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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • atomicNumber

      public int atomicNumber()
      Returns the value of the atomicNumber record component.
      Returns:
      the value of the atomicNumber record component
    • formFactor

      public double[] formFactor()
      Returns the value of the formFactor record component.
      Returns:
      the value of the formFactor record component