Class DefaultFormula

java.lang.Object
org.apache.sis.io.wkt.FormattableObject
org.apache.sis.referencing.operation.DefaultFormula
All Implemented Interfaces:
Serializable, org.opengis.referencing.operation.Formula

public class DefaultFormula extends FormattableObject implements org.opengis.referencing.operation.Formula, Serializable
Specification of the coordinate operation method formula. A formula may be given textually, or may be a reference to a publication.

Formula is for human reading. The object that actually does the work of applying formula to coordinate values is MathTransform.

Since:
0.5
Version:
0.5
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final org.opengis.metadata.citation.Citation
    Reference to a publication giving the formula(s) or procedure used by the coordinate operation method.
    private final org.opengis.util.InternationalString
    Formula(s) or procedure used by the operation method.
    private static final long
    For cross-version compatibility.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    Creates a new formula from the given string.
     
    DefaultFormula(org.opengis.metadata.citation.Citation citation)
    Creates a new formula from the given citation.
    protected
    DefaultFormula(org.opengis.referencing.operation.Formula formula)
    Creates a new formula with the same values than the specified one.
    (package private)
    DefaultFormula(org.opengis.util.InternationalString formula, org.opengis.metadata.citation.Citation citation)
    Creates a new formula.
  • Method Summary

    Modifier and Type
    Method
    Description
    castOrCopy(org.opengis.referencing.operation.Formula object)
    Returns a SIS formula implementation with the same values than the given arbitrary implementation.
    boolean
    equals(Object object)
    Compares this formula with the given object for equality.
    protected String
    formatTo(Formatter formatter)
    Formats this formula as a pseudo-Well Known Text element.
    org.opengis.metadata.citation.Citation
    Returns the reference to a publication giving the formula(s) or procedure used by the coordinate operation method, or null if none.
    org.opengis.util.InternationalString
    Returns the formula(s) or procedure used by the operation method, or null if none.
    int
    Returns a hash code value for this formula.

    Methods inherited from class org.apache.sis.io.wkt.FormattableObject

    print, toString, toString, toWKT

    Methods inherited from class java.lang.Object

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

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • formula

      private final org.opengis.util.InternationalString formula
      Formula(s) or procedure used by the operation method.
    • citation

      private final org.opengis.metadata.citation.Citation citation
      Reference to a publication giving the formula(s) or procedure used by the coordinate operation method.
  • Constructor Details

    • DefaultFormula

      DefaultFormula(org.opengis.util.InternationalString formula, org.opengis.metadata.citation.Citation citation)
      Creates a new formula. This constructor is not public because of Formula object should not have both the formula literal and the citation. But we use this constructor an unmarshalling time if the XML document have both. Having both is not valid GML, but SIS is tolerant to this situation.
    • DefaultFormula

      public DefaultFormula(CharSequence formula)
      Creates a new formula from the given string.
      Parameters:
      formula - the formula.
    • DefaultFormula

      public DefaultFormula(org.opengis.metadata.citation.Citation citation)
      Creates a new formula from the given citation.
      Parameters:
      citation - the citation.
    • DefaultFormula

      protected DefaultFormula(org.opengis.referencing.operation.Formula formula)
      Creates a new formula with the same values than the specified one. This copy constructor provides a way to convert an arbitrary implementation into a SIS one or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API.

      This constructor performs a shallow copy, i.e. the properties are not cloned.

      Parameters:
      formula - the formula to copy.
      See Also:
  • Method Details

    • castOrCopy

      public static DefaultFormula castOrCopy(org.opengis.referencing.operation.Formula object)
      Returns a SIS formula implementation with the same values than the given arbitrary implementation. If the given object is null, then this method returns null. Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged. Otherwise a new SIS implementation is created and initialized to the attribute values of the given object.
      Parameters:
      object - the object to get as a SIS implementation, or null if none.
      Returns:
      a SIS implementation containing the values of the given object (may be the given object itself), or null if the argument was null.
    • getFormula

      public org.opengis.util.InternationalString getFormula()
      Returns the formula(s) or procedure used by the operation method, or null if none.
      Specified by:
      getFormula in interface org.opengis.referencing.operation.Formula
    • getCitation

      public org.opengis.metadata.citation.Citation getCitation()
      Returns the reference to a publication giving the formula(s) or procedure used by the coordinate operation method, or null if none.
      Specified by:
      getCitation in interface org.opengis.referencing.operation.Formula
    • hashCode

      public int hashCode()
      Returns a hash code value for this formula.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object object)
      Compares this formula with the given object for equality.
      Overrides:
      equals in class Object
      Parameters:
      object - the object to compare with this formula.
      Returns:
      true if both objects are equal.
    • formatTo

      protected String formatTo(Formatter formatter)
      Formats this formula as a pseudo-Well Known Text element.
      Compatibility note: ISO 19162 does not define a WKT representation for Formula objects. The text formatted by this method is SIS-specific and causes the text to be flagged as invalid WKT. The WKT content of this element may change in any future SIS version.
      Specified by:
      formatTo in class FormattableObject
      Parameters:
      formatter - the formatter where to format the inner content of this WKT element.
      Returns:
      "Formula".
      See Also: