# Class TimeJELFunction

java.lang.Object
uk.ac.starlink.ttools.plot2.geom.TimeJELFunction

All Implemented Interfaces:
  `DoubleUnaryOperator`

public class TimeJELFunction extends Object implements DoubleUnaryOperator
Function operating on a time value as used in a Time plot. The input value of the function is in unix seconds. A number of variables representing time and based on that input value are available, currently: "mjd", "jd", "unixSec" and "decYear". Typically the expression will simply be one of these terms.

Since:
  15 Dec 2022
Author:
  Mark Taylor

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`TimeJELFunction.TimeQuantity`
Defines a quantity representing time that can be used in expressions supplied to this class.
`static class`
`TimeJELFunction.TimeResolver`
This public class is an implementation detail, not intended for external use.

## Constructor Summary

Constructors
Constructor
Description
`TimeJELFunction(String fexpr)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`double`
`applyAsDouble(double unixSec)`
Function of time in seconds since the Unix epoch.
`String`
`getExpression()`
Returns the text of the function expression.
`static TimeJELFunction.TimeQuantity[]`
`getTimeQuantities()`
Returns a list of TimeQuantity objects that can be referred to by name from expressions used by this class.

### Methods inherited from class Object

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

### Methods inherited from interface DoubleUnaryOperator

`andThen, compose`

## Constructor Details

### TimeJELFunction

public TimeJELFunction(String fexpr) throws gnu.jel.CompilationException
Constructor.

Parameters:
  `fexpr` - JEL expression in terms of a time variable
Throws:
  `gnu.jel.CompilationException`

## Method Details

### applyAsDouble

public double applyAsDouble(double unixSec)
Function of time in seconds since the Unix epoch.

Specified by:
  `applyAsDouble` in interface `DoubleUnaryOperator`
Parameters:
  `unixSec` - unix seconds
Returns:
  time representation as defined by this function

### getExpression

public String getExpression()
Returns the text of the function expression.

Returns:
  function expression

### getTimeQuantities

public static TimeJELFunction.TimeQuantity[] getTimeQuantities()
Returns a list of TimeQuantity objects that can be referred to by name from expressions used by this class.

Returns:
  ordered list of time quantities