Package de.labathome
Class FortranNamelist
- java.lang.Object
-
- de.labathome.FortranNamelist
-
public class FortranNamelist extends Object
Class to parse Fortran namelists into Java classes. This uses the information given in the class definition to constrain the parser.- Version:
- 0.9.0 2018-07-25 intial implementation, 1.0.1 2018-09-11 1d and 2d arrays with fancy specifiers
- Author:
- Jonathan Schilling (jonathan.schilling@mail.de)
-
-
Field Summary
Fields Modifier and Type Field Description boolean_debugset to true to be enable verbal diarrhea with lots of debug output
-
Constructor Summary
Constructors Constructor Description FortranNamelist(String _namelist, String _groupName, Object _parseInto)Define parser for groupgroupNamefrom the namelist given as text innamelistaccording to the Object definition given asparseInto.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanallowedArrayIndex(int minIdx, int maxIdx, int idxToCheck, String varname)Check index boundaries for inserting values into array; named version.ObjectgetParsed()Call the parser and return the parsed Object.
-
-
-
Constructor Detail
-
FortranNamelist
public FortranNamelist(String _namelist, String _groupName, Object _parseInto)
Define parser for groupgroupNamefrom the namelist given as text innamelistaccording to the Object definition given asparseInto.- Parameters:
_namelist- String containing the namelist_groupName- group name of the group to be parsed into the objectparseInto_parseInto- Object definition for parsing target. Use annotationnamelist_variable(name="lstell_sym")to specify which variables to parse.nameis optional (default=take variable name as identifier in namelist) and can be used to map from Fortran names (e.g. lstell_sym) to your own defitions (e.g. stellaratorSymmetric).
-
-
Method Detail
-
getParsed
public Object getParsed()
Call the parser and return the parsed Object.- Returns:
- Object of same type as
parseIntowith member variables filled out as stated in namelist.
-
allowedArrayIndex
public static boolean allowedArrayIndex(int minIdx, int maxIdx, int idxToCheck, String varname)Check index boundaries for inserting values into array; named version.- Parameters:
minIdx- minimum allowable index, i.e. 0 for int[] a = int[10];maxIdx- maximum allowable index, i.e. 9 for int[] a = int[10];idxToCheck- index to check, i.e. 5 or 11varname- name of variable to be included in error message for debugging- Returns:
- true: idxToCheck within bounds (i.e. for idxToCheck=5); false if not (i.e. for idxToCheck=11)
-
-