# Class XYArrayPlacement

java.lang.Object
uk.ac.starlink.ttools.plot2.layer.XYArrayPlacement

@Equality public abstract class XYArrayPlacement extends Object
Defines how to map an XYArrayData object to a definite position in data space.

Since:
  18 Aug 2022
Author:
  Mark Taylor

## Field Summary

Fields
Modifier and Type
Field
Description
`static final XYArrayPlacement`
`INDEX`
Uses X,Y position at indicated fraction through arrays.
`static final XYArrayPlacement`
`XMAX`
Uses the position with the maximal X value.
`static final XYArrayPlacement`
`XMIN`
Uses the position with the minimal X value.
`static final XYArrayPlacement`
`XYMEAN`
Uses the center of gravity of all the (X,Y) values.
`static final XYArrayPlacement`
`YMAX`
Uses the position with the maximal Y value.
`static final XYArrayPlacement`
`YMIN`
Uses the position with the minimal Y value.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`XYArrayPlacement(String name, String description, boolean usesFraction)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`String`
`getDescription()`
Returns this placement policy's description.
`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.
`String`
`toString()`
`boolean`
`usesFraction()`
Indicates whether this placement pays attention to the value of the fraction parameter.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### 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 Details

### XYArrayPlacement

protected XYArrayPlacement(String name, 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 Details

### getName

public String getName()
Returns this placement policy's name.

Returns:
  name

### getDescription

public 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 String toString()

Overrides:
  `toString` in class `Object`