Full Library / Math Operator / Parser / Parse_File
Block Name: Parse_File
Code File Location: VisualSim/actor/lib/Parse_File
Block Overview
- This block converts a file containing strings at the location specified by 'File_Path' plus 'File_Name' into Strings. This block parses an existing text file by looking for spaces to delineate the String Tokens. The Use Model is to bring in an external trace file that can be used with 'Model_List' or 'Model_List_DS' to create an internal list. This list can be executed very fast in a simulation. The 'Parse_String' Block is similar to 'Parse_File' except that the 'Parse_String' block does not open a file. The 'Parse_String' accepts a string that was extracted using the 'File_to_String' Block.
- When Parse_File receives an input in the open_file port, it opens the file named in the parameters and converst the content in the file to a string. When the parse_file port is activated, the string is parsed to match the list of keywords provided in the keyword parameter field. When a keyword is matched, the keyword followed by the string tokens are placed on the string_output. The keyword is sent to both the keyword port and string port, when matched. An End_Of_File marker is generated on the End-of-File output port once the entire file has been parsed. A trigger is required in the parse_file input for the next string_token to be matched and placed on the output ports
- The trigger can be any value. The strings in the file must be separated by space to indicate the next string.
open_file
public TypedIOPort open_file
- Input port, triggers opening file by path, name. The type is general.
parse_file
public TypedIOPort parse_file
- Input port, a trigger to parse the next Java String Token. The type is general.
string_output
public TypedIOPort string_output
- String Token output port, for each Java String Token. The type is string.
keyword_output
public TypedIOPort keyword_output
- Keyword output port, for each Java String Token that matches comma separated list of keywords, sends to this port. The type is string.
end_of_file
public TypedIOPort end_of_file
- EOF Output port, StringToken indicating end of file, which can be used to activate other blocks in the model. The type is string.
File_Name
public Parameter File_Name
- Parameter, file name, including suffix such as .txt. The type is string.
File_Path
public Parameter File_Path
- Parameter, file path. The type is string.
Keywords
public Parameter Keywords
- Parameter, Keywords, comma separated list of keywords. The type is string.
Created with the Personal Edition of HelpNDoc: Free EBook and documentation generator