Package daikon
Class FileIO.VarDefinition
- Object
-
- VarDefinition
-
- All Implemented Interfaces:
Serializable,Cloneable
- Enclosing class:
- FileIO
public static class FileIO.VarDefinition extends Object implements Serializable, Cloneable
Class that holds information from the declaration record (in the file). Once collected, this information is used to create a VarInfo. This class is necessary because a VarInfo cannot be created until much of this information is present: the constructor requires all the information at the time of construction, and some of the fields are final.In general, each field has a one-to-one relation with the corresponding entry in the variable definition block in the trace file. More detailed information about each of the fields can be found in the 'Variable declarations' section of the 'File Formats' appendix of the Daikon developers manual. Specifics can also be found in the 'parse_[field]' methods of the class (eg, parse_var_kind, parse_enclosing_var_name, etc).
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description intarr_dimsNumber of array dimensions (0 or 1).VarComparabilitycomparabilityComparability of this variable (required.ProglangTypedeclared_typeDeclared type of the variable as an arbitrary string (required)@Nullable Stringenclosing_var_nameName of variable that contains this variable (optional)EnumSet<VarInfo.VarFlags>flagsVariable flags (optional)@Nullable List<String>function_argsNon-null iff (vardef.kind == VarKind.FUNCTION).VarInfo.VarKindkindType of the variable (required).EnumSet<VarInfo.LangFlags>lang_flagsLanguage specific variable flags (optional)@Nullable Integermax_lengthNon-null if it is statically known that the array will have up to this many elements.@Nullable Stringmax_valueNon-null if it is statically known that the value of the variable will be always less than or equal to this value.@Nullable Integermin_lengthNon-null if it is statically known that the array will have at least this many elements.@Nullable Stringmin_valueNon-null if it is statically known that the value of the variable will be always greater than or equal to this value.StringnameName of the variable (required).List<VarParent>parentsParent program points in ppt hierarchy (optional)VarInfo.RefTyperef_typeType of reference for structure/class variables.@Nullable Stringrelative_namethe simple (not fully specified) name of this variable (optional)ProglangTyperep_typeThe type of the variable as stored in the dtrace file (required)@Nullable @Interned Objectstatic_constant_valueNon-null if this 'variable' always has the same value (optional)@Nullable Stringvalid_valuesNon-null if the set of valid values for the variable is statically known.
-
Constructor Summary
Constructors Constructor Description VarDefinition(FileIO.ParseState state, Scanner scanner)Initialize from the 'variable name' record.VarDefinition(String name, VarInfo.VarKind kind, ProglangType type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckRep()Check representation invariants.voidclear_parent_relation()Clears the parent relations, if any existed.FileIO.VarDefinitionclone()FileIO.VarDefinitioncopy()@Interned Stringneed(Scanner scanner, String description)Helper function, returns the next string token unescaped and interned.voidneed_eol(Scanner scanner)Throws Daikon.UserError if the scanner is not at end of linevoidparse_array(Scanner scanner)Parses the array record.voidparse_comparability(Scanner scanner)Parses a comparability record.voidparse_constant(Scanner scanner)Parse a constant record.voidparse_dec_type(Scanner scanner)voidparse_enclosing_var_name(Scanner scanner)Parses the enclosing-var record.<E extends Enum<E>>
Eparse_enum_val(Scanner scanner, Class<E> enum_class, String descr)Looks up the next token as a member of enum_class.voidparse_flags(Scanner scanner)Parse the flags record.voidparse_function_args(Scanner scanner)Parses the function-args record.voidparse_lang_flags(Scanner scanner)Parse the langauge specific flags record.voidparse_max_length(Scanner scanner)Parse a maximum length record.voidparse_max_value(Scanner scanner)Parse a maximum value record.voidparse_min_length(Scanner scanner)Parse a minimum length record.voidparse_min_value(Scanner scanner)Parse a minimum value record.voidparse_parent(Scanner scanner, List<FileIO.ParentRelation> ppt_parents)Parse a parent ppt record.voidparse_reference_type(Scanner scanner)Parses the reference-type record.voidparse_rep_type(Scanner scanner)voidparse_valid_values(Scanner scanner)Parse a valid values record.voidparse_var_kind(Scanner scanner)Parse a var-kind record.
-
-
-
Field Detail
-
kind
public VarInfo.VarKind kind
Type of the variable (required).
-
enclosing_var_name
public @Nullable String enclosing_var_name
Name of variable that contains this variable (optional)
-
relative_name
public @Nullable String relative_name
the simple (not fully specified) name of this variable (optional)
-
ref_type
public VarInfo.RefType ref_type
Type of reference for structure/class variables.
-
arr_dims
public int arr_dims
Number of array dimensions (0 or 1).
-
function_args
public @Nullable List<String> function_args
Non-null iff (vardef.kind == VarKind.FUNCTION). The arguments that were used to create this function application.
-
rep_type
public ProglangType rep_type
The type of the variable as stored in the dtrace file (required)
-
declared_type
public ProglangType declared_type
Declared type of the variable as an arbitrary string (required)
-
flags
public EnumSet<VarInfo.VarFlags> flags
Variable flags (optional)
-
lang_flags
public EnumSet<VarInfo.LangFlags> lang_flags
Language specific variable flags (optional)
-
comparability
public VarComparability comparability
Comparability of this variable (required.
-
static_constant_value
public @Nullable @Interned Object static_constant_value
Non-null if this 'variable' always has the same value (optional)
-
min_value
public @Nullable String min_value
Non-null if it is statically known that the value of the variable will be always greater than or equal to this value.
-
max_value
public @Nullable String max_value
Non-null if it is statically known that the value of the variable will be always less than or equal to this value.
-
min_length
public @Nullable Integer min_length
Non-null if it is statically known that the array will have at least this many elements.
-
max_length
public @Nullable Integer max_length
Non-null if it is statically known that the array will have up to this many elements.
-
valid_values
public @Nullable String valid_values
Non-null if the set of valid values for the variable is statically known.
-
-
Constructor Detail
-
VarDefinition
public VarDefinition(FileIO.ParseState state, Scanner scanner)
Initialize from the 'variable name' record. Scanner should be pointing at name.
-
VarDefinition
public VarDefinition(String name, VarInfo.VarKind kind, ProglangType type)
-
-
Method Detail
-
checkRep
public void checkRep()
Check representation invariants.
-
clone
@SideEffectFree public FileIO.VarDefinition clone(@GuardSatisfied FileIO.VarDefinition this)
-
copy
public FileIO.VarDefinition copy()
-
clear_parent_relation
public void clear_parent_relation()
Clears the parent relations, if any existed.
-
parse_var_kind
public void parse_var_kind(Scanner scanner)
Parse a var-kind record. Scanner should be pointing at the variable kind.
-
parse_enclosing_var_name
public void parse_enclosing_var_name(Scanner scanner)
Parses the enclosing-var record.
-
parse_reference_type
public void parse_reference_type(Scanner scanner)
Parses the reference-type record.
-
parse_array
public void parse_array(Scanner scanner)
Parses the array record.
-
parse_function_args
public void parse_function_args(Scanner scanner)
Parses the function-args record.
-
parse_rep_type
public void parse_rep_type(Scanner scanner)
-
parse_dec_type
public void parse_dec_type(Scanner scanner)
-
parse_flags
public void parse_flags(Scanner scanner)
Parse the flags record. Multiple flags can be specified.
-
parse_lang_flags
public void parse_lang_flags(Scanner scanner)
Parse the langauge specific flags record. Multiple flags can be specified.
-
parse_comparability
public void parse_comparability(Scanner scanner)
Parses a comparability record.
-
parse_parent
public void parse_parent(Scanner scanner, List<FileIO.ParentRelation> ppt_parents) throws Daikon.ParseError
Parse a parent ppt record.- Throws:
Daikon.ParseError
-
parse_constant
public void parse_constant(Scanner scanner)
Parse a constant record.
-
parse_min_value
public void parse_min_value(Scanner scanner)
Parse a minimum value record.
-
parse_max_value
public void parse_max_value(Scanner scanner)
Parse a maximum value record.
-
parse_min_length
public void parse_min_length(Scanner scanner)
Parse a minimum length record.
-
parse_max_length
public void parse_max_length(Scanner scanner)
Parse a maximum length record.
-
parse_valid_values
public void parse_valid_values(Scanner scanner)
Parse a valid values record.
-
need
public @Interned String need(Scanner scanner, String description)
Helper function, returns the next string token unescaped and interned. Throw Daikon.UserError if there is no next token.
-
need_eol
public void need_eol(Scanner scanner)
Throws Daikon.UserError if the scanner is not at end of line
-
parse_enum_val
public <E extends Enum<E>> E parse_enum_val(Scanner scanner, Class<E> enum_class, String descr)
Looks up the next token as a member of enum_class. Throws Daikon.UserError if there is no token or if it is not valid member of the class. Enums are presumed to be in in upper case.
-
-