Package org.cloudsimplus.traces.google
Enum MachineEventType
- java.lang.Object
-
- java.lang.Enum<MachineEventType>
-
- org.cloudsimplus.traces.google.MachineEventType
-
- All Implemented Interfaces:
Serializable
,Comparable<MachineEventType>
public enum MachineEventType extends Enum<MachineEventType>
Defines the type of an event (a line) in the trace file that represents the operation to be performed with theHost
. Each enum instance is a possible value for theGoogleMachineEventsTraceReader.FieldIndex.EVENT_TYPE
field.This enum defines a some methods to move the processing logic of each event type to the enum value associated to it. Since the enum includes the
process(GoogleMachineEventsTraceReader)
abstract method, if a new enum value is added, we just need to implement the method for that value. Using such approach we avoid spreading if chains to check which event type a trace line is to call the corresponding process method.- Since:
- CloudSim Plus 4.0.0
- Author:
- Manoel Campos da Silva Filho
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static MachineEventType
getValue(int ordinal)
Gets an enum instance from its ordinal value.protected abstract boolean
process(GoogleMachineEventsTraceReader reader)
Executes an operation with the Hosts according to the Event Type.static MachineEventType
valueOf(String name)
Returns the enum constant of this type with the specified name.static MachineEventType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ADD
public static final MachineEventType ADD
0: AHost
became available to the cluster - all machines in the trace will have an ADD event.
-
REMOVE
public static final MachineEventType REMOVE
1: AHost
was removed from the cluster. Removals can occur due to failures or maintenance.
-
UPDATE
public static final MachineEventType UPDATE
2: AHost
available to the cluster had its available resources changed.
-
-
Method Detail
-
values
public static MachineEventType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (MachineEventType c : MachineEventType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static MachineEventType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getValue
public static MachineEventType getValue(int ordinal)
Gets an enum instance from its ordinal value.- Parameters:
ordinal
- the ordinal value to get the enum instance from- Returns:
- the enum instance
-
process
protected abstract boolean process(GoogleMachineEventsTraceReader reader)
Executes an operation with the Hosts according to the Event Type. Each enum value must implement this method to include its own processing logic.- Parameters:
reader
- the trace file reader- Returns:
- true if trace line for the event type was processed, false otherwise
-
-