So I'm using Processing to draw a map from a data file. I want to stock some information of the first line inside a class. In processing this class is an inner class of PApplet, so it has to be a static class (Otherwise i get an error: static fieldscan only be declared in static or top level type).
public static class PlacesInfo{ static final int totalCount; static final float xMin; static final float yMin; static final float xMax; static final float yMax; static final int populationMax; static final int densityMax; //Set all static variables once static{ String[] lines = loadStrings("population.tsv"); String info = lines[0].substring(2); //to delete some useless char String[] infoInit = split(info, ','); //to parse the data of the first line totalCount = int(infoInit[0]); xMin = float(infoInit[1]); xMax = float(infoInit[2]); yMin = float(infoInit[3]); yMax = float(infoInit[4]); populationMax = int(infoInit[6]); densityMax = int(infoInit[8]); } } When I run this code, I get an error, because I can't use the loadStrings() function (which is non-static).
So what I want is to have static final variables that I can initialize from the "population.tsv" file. What are your ideas/advices?
loadStrings()a static method?