public class ConfigHandler
extends java.io.BufferedReader
| Modifier and Type | Field and Description |
|---|---|
private java.util.ArrayList<java.lang.String> |
appNamesList
The names for each
Application defined in config file |
private java.lang.String |
config
Path to and name of config file
|
private java.util.ArrayList<java.util.ArrayList<NamedPoint>> |
pointsList
All
NamedPoints for each Application defined in config file |
| Constructor and Description |
|---|
ConfigHandler(java.lang.String config) |
| Modifier and Type | Method and Description |
|---|---|
int |
getApplicationIndex(java.lang.String s)
Gets the index of the
Application with the given name. |
java.lang.String |
getApplicationName(int index)
Gets the name of the
Application at the given index. |
java.util.ArrayList<java.lang.String> |
getAppNamesList()
Gets the names of all
Applications specified in config file. |
private java.lang.String |
getBetween(java.lang.String line,
char begin,
char end)
Gets a substring starting from the first occurrence of
begin and ending at first occurrence of
end. |
java.lang.String |
getConfig()
Gets the path to the config file.
|
java.util.ArrayList<NamedPoint> |
getPoints(int index)
Gets the list of points for the
Application at the specified index. |
private java.lang.String |
nextAppropriate(java.lang.String line,
char begin)
Gets a substring beginning from the first occurrence of
begin or null if no occurrence is found. |
void |
updateConfig()
Reads the info from the config file and loads it into local
ArrayLists. |
private java.lang.String config
private java.util.ArrayList<java.util.ArrayList<NamedPoint>> pointsList
NamedPoints for each Application defined in config fileprivate java.util.ArrayList<java.lang.String> appNamesList
Application defined in config filepublic ConfigHandler(java.lang.String config)
throws java.io.FileNotFoundException
config - Path to config filejava.io.FileNotFoundExceptionpublic java.lang.String getConfig()
Applicationpublic java.util.ArrayList<java.lang.String> getAppNamesList()
Applications specified in config file.ApplicationsApplicationpublic java.util.ArrayList<NamedPoint> getPoints(int index)
Application at the specified index.index - Index of ApplicationApplicationApplicationpublic int getApplicationIndex(java.lang.String s)
Application with the given name.s - Name to search forApplication with the given name or -1 if none is foundpublic java.lang.String getApplicationName(int index)
Application at the given index.index - Index to queryApplication at the given indexpublic void updateConfig()
throws java.io.IOException
ArrayLists.java.io.IOExceptionArrayListprivate java.lang.String nextAppropriate(java.lang.String line,
char begin)
begin or null if no occurrence is found.line - Line to be searchedbegin - Char to be searched for in linebegin or null if no occurrence of it is foundprivate java.lang.String getBetween(java.lang.String line,
char begin,
char end)
begin and ending at first occurrence of
end.
Gets a substring starting from the first occurrence of begin and ending at first occurrence of
end after begin. The characters begin and end are
not included in substring. Returns null if both begin and end are not found.
line - Line to be searchedbegin - Char substring will begin fromend - Char substring will end atbegin and ending at first occurrence of
end after begin