Class TraceReaderAbstract
java.lang.Object
org.cloudsimplus.traces.FileReader
org.cloudsimplus.traces.TraceReaderAbstract
- All Implemented Interfaces:
TraceReader
- Direct Known Subclasses:
GoogleMachineEventsTraceReader,GoogleTaskEventsTraceReader,GoogleTaskUsageTraceReader,SwfWorkloadFileReader
An abstract class to implement trace file readers for specific file formats.
NOTES
- This class can only read trace files in the following format: ASCII text, zip, gz.
- If you need to load multiple trace files, create multiple instances of this class.
- If the size of the trace reader is huge or contains lots of traces, please increase the JVM heap size accordingly by using java -Xmx option when running the simulation. For instance, you can use java -Xmx200M to define the JVM heap size will be 200MB.
- Since:
- CloudSim Plus 4.0.0
- Author:
- Manoel Campos da Silva Filho
-
Field Summary
Fields inherited from class org.cloudsimplus.traces.FileReader
DEF_FIELD_DELIMITER_REGEXFields inherited from interface org.cloudsimplus.traces.TraceReader
LOGGER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Enum>
doublegetFieldDoubleValue(T field) Gets a field's value from thelast parsed lineas double.<T extends Enum>
doublegetFieldDoubleValue(T field, double defaultValue) Gets a field's value from thelast parsed lineas double.<T extends Enum>
intgetFieldIntValue(T field) Gets a field's value from thelast parsed lineas an int.<T extends Enum>
intgetFieldIntValue(T field, int defaultValue) Gets a field's value from thelast parsed lineas an int.<T extends Enum>
longgetFieldLongValue(T field) Gets a field's value from thelast parsed lineas an int.<T extends Enum>
longgetFieldLongValue(T field, long defaultValue) Gets a field's value from thelast parsed lineas an int.getFieldValue(T field) Gets a field's value from thelast parsed lineas String.protected String[]protected voidsetLastParsedLineArray(@NonNull String[] lastParsedLineArray) Sets an array containing the field values from the last parsed trace line.Methods inherited from class org.cloudsimplus.traces.FileReader
getCommentString, getSingleLineReader, readFile, readFile, setCommentString, setMaxLinesToReadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.cloudsimplus.traces.TraceReader
getCommentString, getFieldDelimiterRegex, getFilePath, getLastLineNumber, getMaxLinesToRead, setCommentString, setFieldDelimiterRegex, setMaxLinesToRead
-
Constructor Details
-
TraceReaderAbstract
Create a TraceReader object.- Parameters:
filePath- the workload trace file path in one of the following formats: ASCII text, zip, gz.- Throws:
IllegalArgumentException- when the workload trace file name is null or empty; or the resource PE mips is less or equal to 0IllegalArgumentException- when the workload trace file name is null or empty
-
-
Method Details
-
getFieldValue
Gets a field's value from thelast parsed lineas String.- Parameters:
field- an enum value representing the index of the field to get the value- Returns:
- the field value as String
-
getFieldDoubleValue
Gets a field's value from thelast parsed lineas double.- Parameters:
field- an enum value representing the index of the field to get the value- Returns:
- the field value as double
-
getFieldDoubleValue
Gets a field's value from thelast parsed lineas double.- Parameters:
field- an enum value representing the index of the field to get the valuedefaultValue- the default value to be returned if the field value is not a number- Returns:
- the field value as double
-
getFieldIntValue
Gets a field's value from thelast parsed lineas an int.- Parameters:
field- an enum value representing the index of the field to get the value- Returns:
- the field value as int
-
getFieldIntValue
Gets a field's value from thelast parsed lineas an int.- Parameters:
field- an enum value representing the index of the field to get the valuedefaultValue- the default value to be returned if the field value is not an int- Returns:
- the field value as int
-
getFieldLongValue
Gets a field's value from thelast parsed lineas an int.- Parameters:
field- an enum value representing the index of the field to get the value- Returns:
- the field value as long
-
getFieldLongValue
Gets a field's value from thelast parsed lineas an int.- Parameters:
field- an enum value representing the index of the field to get the valuedefaultValue- the default value to be returned if the field value is not an int- Returns:
- the field value as long
-
getLastParsedLineArray
- Returns:
- an array containing the field values from the last parsed trace line.
-
setLastParsedLineArray
Sets an array containing the field values from the last parsed trace line.- Parameters:
lastParsedLineArray- the field values from the last parsed trace line
-