/Users/20800/Desktop/IA_Final_Submission_000307-0050/Product/IA_Netbeans_Project/src/mainPackage/Searches.java
 1 /*
 2  * To change this license header, choose License Headers in Project Properties.
 3  * To change this template file, choose Tools | Templates
 4  * and open the template in the editor.
 5  */
 6 package mainPackage;
 7 
 8 /**
 9  *
10  * @author 20800
11  */
12 
13 //This class is used for various Searches to get function array element numbers or comboBox element numbers
14 
15 public class Searches {
16     public int sequentialSearchFunctionName(Function[] arr, String name){ //Pre Conditions: enter the main function array and String name of desired function
17         for(int i = 0; i < arr.length; i++){
18             if( (arr[i].getFunctionSettings().getName()) .equals(name)){
19                 return i;
20             }
21         }
22         return -1;
23     } //Post Conditions: returns the element in the array corresponding to the function with the same Strin name as entered
24     
25     public int sequentialSearchFunctionTypeCB(String type){ //Pre Conditions: enter a string functionType in parameter
26         if(type.equals("Square")){
27             return 0;
28         }else if(type.equals("Square Root")){
29             return 1;
30         }else if(type.equals("Slope Intercept")){
31             return 2;
32         }else if(type.equals("Custom Point Entry")){
33             return 3;
34         }else if(type.equals("Sine")){
35             return 4;
36         }else if(type.equals("Cosine")){
37             return 5;
38         }else if(type.equals("Tangent")){
39             return 6;
40         }else if(type.equals("e^x")){
41             return 7;
42         }else if(type.equals("Natural Log")){
43             return 8;
44         }else if(type.equals("Cubic")){
45             return 9;
46         }else if(type.equals("Arcsine")){
47             return 10;
48         }else if(type.equals("Arccosine")){
49             return 11;
50         }else if(type.equals("Arctangent")){
51             return 12;
52         }else if(type.equals("Absolute Value")){
53             return 13;
54         }
55         return -1;
56     } //Post Conditions: returns the element number in the functionTypeSelectorComboBox's array corresponding to the String functionType in the parameter
57     
58     public int sequentialSearchFunctionColorCB(String color){ //Pre Conditions: enter a String color in parameter
59         if(color.equals("Blue")){
60             return 0;
61         }else if(color.equals("Black")){
62             return 1;
63         }else if(color.equals("Green")){
64             return 2;
65         }else if(color.equals("Orange")){
66             return 3;
67         }else if(color.equals("Purple")){
68             return 4;
69         }else if(color.equals("Yellow")){
70             return 5;
71         }else if(color.equals("Gray")){
72             return 6;
73         }else if(color.equals("Pink")){
74             return 7;
75         }else if(color.equals("Cyan")){
76             return 8;
77         }else if(color.equals("Red")){
78             return 9;
79         }
80         
81         return -1;
82     } //Post Conditions: returns the element number in the colorSelectorComboBox's array corresponding to the Strin color in the parameter
83 }
84