public class StatisticsFlow
extends java.lang.Object
StatisticsFlow represents a network flow used for calculating statistics, which is based on 5-tuple: | Modifier and Type | Field and Description |
|---|---|
long |
flow_id
Identifier of the flow.
|
int |
local_port
Local transport layer port of the flow.
|
java.util.ArrayList<StatisticsPacket> |
packets
List of packets assigned to the flow.
|
java.lang.String |
protocol_name
Transport layer protocol name of the flow.
|
int |
remote_port
Remote transport layer port of the flow.
|
java.lang.String |
traffic_class
Type of the traffic, like web, multimedia, audio, video, etc.
|
| Constructor and Description |
|---|
StatisticsFlow()
Constructs the object.
|
| Modifier and Type | Method and Description |
|---|---|
private StatisticsStatistics |
calculateStatistics(StatisticsStatistics stat)
Calculates statistics from the flow and stored them in the
stat object. |
void |
commit(java.io.PrintWriter writer)
Writes statistics calculated from the flow to an external file.
|
private static java.util.ArrayList<java.lang.Long> |
GetValuesGreaterThan(java.util.ArrayList<java.lang.Long> values,
double limit,
boolean orEqualTo)
Gets values greater than the limit.
|
private static java.util.ArrayList<java.lang.Long> |
GetValuesLessThan(java.util.ArrayList<java.lang.Long> values,
double limit,
boolean orEqualTo)
Gets values smaller than the limit.
|
private static double |
Median(java.util.ArrayList<java.lang.Long> values)
Returns median from the list of values.
|
private static double[] |
Quartiles(java.util.ArrayList<java.lang.Long> values)
Calculates quartiles of values specified on the list.
|
public long flow_id
public int local_port
public int remote_port
public java.lang.String protocol_name
public java.lang.String traffic_class
public java.util.ArrayList<StatisticsPacket> packets
public void commit(java.io.PrintWriter writer)
StatisticsStatistics object which is the writer responsible for
writing statistics to the file. Then, we calculate the statistics by the calculateStatistics method.
Lastly, we write these statistics to the file by the commit method of the StatisticsStatistics object.writer - writer responsible for writing a text to a text fileprivate StatisticsStatistics calculateStatistics(StatisticsStatistics stat) throws HugePacketException
stat object.stat - object to store the calculated statisticsHugePacketException - if any packet belonging to the flow is bigger than 1500 Bprivate static double[] Quartiles(java.util.ArrayList<java.lang.Long> values)
values - list containing the values from which the quartiles are calculatedprivate static java.util.ArrayList<java.lang.Long> GetValuesGreaterThan(java.util.ArrayList<java.lang.Long> values,
double limit,
boolean orEqualTo)
values - list of values used for selectionlimit - values greater than this limit will be returnedorEqualTo - if true, values equal to the limit will be returned as wellprivate static java.util.ArrayList<java.lang.Long> GetValuesLessThan(java.util.ArrayList<java.lang.Long> values,
double limit,
boolean orEqualTo)
values - list of values used for selectionlimit - values smaller than this limit will be returnedorEqualTo - if true, values equal to the limit will be returned as wellprivate static double Median(java.util.ArrayList<java.lang.Long> values)
values - the list of values