/*
 * Copyright 2003 Association for Universities for Research in Astronomy, Inc.,
 * Observatory Control System, Gemini Telescopes Project.
 *
 * $Id: TargetDesc.java 42349 2012-03-01 13:03:51Z swalker $
 */

package jsky.coords;


import edu.gemini.shared.util.immutable.Option;

import java.util.function.Function;

/**
 * A simple class describing a target object and some related information.
 *
 * @version $Revision: 42349 $
 * @author Allan Brighton
 */
public abstract class TargetDesc {
    public static enum ElConstraintType {
    	NONE, HOUR_ANGLE, AIRMASS
    }

    private String _name;
    private Function<Option<Long>, Option<WorldCoords>> _coords;
    private String _priority;
    private String _category;
    private ElConstraintType _elType;
    private double _elMin;
    private double _elMax;

    protected TargetDesc(String name, Function<Option<Long>, Option<WorldCoords>> coords, String priority, String category,
                          ElConstraintType elType, Double elMin, Double elMax) {
        _name = name;
        _coords = coords;
        _priority = priority;
        _category = category;
        _elType = elType;
        _elMin = elMin;
        _elMax = elMax;
    }

    public String getName() {
        return _name;
    }

    public String toString() {
        return _name;
    }

    public Option<WorldCoords> getCoordinates(Option<Long> when) {
        return _coords.apply(when);
    }

    public String getPriority() {
        return _priority;
    }

    public String getCategory() {
        return _category;
    }

    /** Return an array of one or more Strings describing the target */
    public String[] getDescriptionFields() {
        return new String[]{_name};
    }

    public double getElMax() {
        return _elMax;
    }

    public double getElMin() {
        return _elMin;
    }

    public ElConstraintType getElType() {
        return _elType;
    }
}


@@ -505,15 +505,8 @@
 lic 
-static 
 enum
@@ -844,16 +844,41 @@
 ng name,
+%0A                        
  Functio
@@ -925,25 +925,75 @@
 rds,
- String priority,
+%0A                         String priority,%0A                        
  Str
@@ -1006,17 +1006,16 @@
 tegory,%0A
- 
         
@@ -1059,22 +1059,72 @@
 ype,
- Double elMin,
+%0A                         Double elMin,%0A                        
  Dou
@@ -1150,16 +1150,20 @@
   _name 
+    
 = name;%0A
@@ -1178,16 +1178,18 @@
 _coords 
+  
 = coords
@@ -1266,16 +1266,18 @@
 _elType 
+  
 = elType
@@ -1293,16 +1293,19 @@
  _elMin 
+   
 = elMin;
@@ -1320,16 +1320,19 @@
  _elMax 
+   
 = elMax;

reformat TargetDesc