Class XYArrayPlacement


  • @Equality
    public abstract class XYArrayPlacement
    extends java.lang.Object
    Defines how to map an XYArrayData object to a definite position in data space.
    Since:
    18 Aug 2022
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected XYArrayPlacement​(java.lang.String name, java.lang.String description, boolean usesFraction)
      Constructor.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getDescription()
      Returns this placement policy's description.
      java.lang.String getName()
      Returns this placement policy's name.
      abstract boolean readPosition​(XYArrayData xyData, double fraction, double[] dpos)
      Attempts to determine the reference position of an XYArrayData object.
      java.lang.String toString()  
      boolean usesFraction()
      Indicates whether this placement pays attention to the value of the fraction parameter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • INDEX

        public static final XYArrayPlacement INDEX
        Uses X,Y position at indicated fraction through arrays.
      • XMAX

        public static final XYArrayPlacement XMAX
        Uses the position with the maximal X value.
      • XMIN

        public static final XYArrayPlacement XMIN
        Uses the position with the minimal X value.
      • YMAX

        public static final XYArrayPlacement YMAX
        Uses the position with the maximal Y value.
      • YMIN

        public static final XYArrayPlacement YMIN
        Uses the position with the minimal Y value.
      • XYMEAN

        public static final XYArrayPlacement XYMEAN
        Uses the center of gravity of all the (X,Y) values.
    • Constructor Detail

      • XYArrayPlacement

        protected XYArrayPlacement​(java.lang.String name,
                                   java.lang.String description,
                                   boolean usesFraction)
        Constructor.
        Parameters:
        name - short name for presentation to users
        description - XML-friendly description of behaviour
        usesFraction - true iff this placement pays any attention to the value of the fraction parameter
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns this placement policy's name.
        Returns:
        name
      • getDescription

        public java.lang.String getDescription()
        Returns this placement policy's description.
        Returns:
        XML-friendly description text
      • usesFraction

        public boolean usesFraction()
        Indicates whether this placement pays attention to the value of the fraction parameter.
        Returns:
        true if fraction may influence placement, false if it definitely doesn't
      • readPosition

        public abstract boolean readPosition​(XYArrayData xyData,
                                             double fraction,
                                             double[] dpos)
        Attempts to determine the reference position of an XYArrayData object. On success, the position in data coordinates is written into the supplied 2-element array.
        Parameters:
        xyData - XY data, not null
        fraction - numeric value in the range 0..1; may or may not be used
        dpos - 2-element array for X, Y output on success
        Returns:
        true for success
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object