/*
Online Java - IDE, Code Editor, Compiler

Online Java is a quick and easy tool that helps you to build, compile, test your programs online.
*/
/*
The List will create instances of class...
The class will also consist of enums....

The list will be of maximum size of 20 corresponding to each team.

In terms of NcR    
if n is not taken to be all objects.. it will simply skip a  list item (consisting of the club...)

Can perhaps include something in the logic to allow end users to exclude certain teams (bit advanced)
And at the enum level... the enumSet can be restricted to fixture 1 only for instance...
i.e it would focus on upcoming game fixture...
Also, some data might not be available for fixutre 2, so this is beneficial.

Do not want to overcomplicate
it will take 1 event from fixture 1 of the Club(in list)
and perform it in accumulator with another

Can expand functionalty later....
*/

import java.util.*;
import java.text.DecimalFormat;

public class Main
{
    static DecimalFormat format = new DecimalFormat("##0. 00");
    
    enum Club                                          //open enum  , open Fixture,  open and close each constant, 
    {
        
        //is this the best way to store the information... it makes sense due to its visibility
        // but whats best way to populate information in...
        //perhaps it can get information from a text file?
        
        // Text file might have information as such which is clear data.....
        // For moment, not going to deal with data extraction..
        //Assumed data is imported from external source as such
        
        /*
        Club: Leicester 
        Fixture1:  Leicester vs Nottingham Forest
        Under 2.5:  3/4
        Over 2.5:   11/8
        Full time result:    this would be array of ints  .. it would need home win, draw, away win.... 
        Time first goal:
        
        Fixture 2:  Ipswich Town vs Leicester City
        Under 2.5:
        Over 2.5:
        Full time result:    this would be array of ints  .. it would need home win, draw, away win.... 
        Time first goal:
        */
        
        //All odds stored,  will need to convert to string...
        //add .0 at end of the numerator and denominator
        // bring it back
        
        FIXTURE1 ("Leicester vs Nottingham Forest", "4/11", "8/11", new String []{"4/5", "2/1", "2/1"})
        {
        public void amount ()
        {
            System.out.println("1");
        }
        },   // is this to close the fixtures or does it close the entire constants in enum?
        
        FIXTURE2 ("Leicester vs Nottingham Forest", "4/11", "8/11", new String []{"4/5", "2/1", "2/1"})
        {
        public void amount ()
        {
            System.out.println("1");
            System.out.println("Format odds");
            formatOdds(this.under2Half);           // at this moment, it is imagining the logic from
                                                   //lst => class instance => enum has selected this value
            
        }
        };   // is this to close the fixtures or does it close the entire constants in enum?
        
        
        
        /*
        FIXTURE2 ("Leicester vs Nottingham Forest", 4/11, 8/11, fullTimeResult= new Double []{(4/5), (2/1), (2/1)})
        {
        public void test ()
        {
            System.out.println("1");
        }
        };   // is this to close the fixtures or does it close the entire constants in enum?
        */
        
        
        public abstract void amount();
        
        private Club()
        {
            System.out.println("In constructor");
        }
        
        public String fixture;
        public String under2Half;
        public String over2Half;
        public String[] fullTimeResult;
        
        Club (String fixture, String under2Half, String over2Half, String [] fullTimeResult)
        {
            this.fixture=fixture;
            this.under2Half=under2Half;
            this.over2Half=over2Half;
            this.fullTimeResult=fullTimeResult;
            
        }
    };        // THIS IS TO CLOSE THE ENUM
    
    
    public static void formatOdds(String over2Half)   // for now, going to imagine this has been selection....
    {
        
        int pos = over2Half.indexOf("/");
        //System.out.println(OddsInDoubleFormat);
        Double num = Double.valueOf (over2Half.substring(0,pos)+".0");
        Double den = Double.valueOf (over2Half.substring(pos+1) + ".0");
        
        
        Double odds = num/den;
        System.out.println(odds);
        
        
        
    }
    
    public static void main(String[] args) {
        System.out.println("Welcome to Online IDE!! Happy Coding :)");
        
        Club c;
        
        c = Club.FIXTURE1;
        
        Club [] allTeams = Club.values();
        
        System.out.println(Club.values()[0].name());   //should print Fixture 1
        
        
        Club.values()[1].amount();
        
        
        /*
        for (enum b: Club.values())
        {
            System.out.println(b.fixture);
        }
        */
        //alternatively can try from the array?
        
        //System.out.println(allTeams[0].name());

        
    }
}
