adjusting.availability_adjusting
Class FailureTrace

java.lang.Object
  extended by adjusting.availability_adjusting.FailureTrace
All Implemented Interfaces:
java.io.Serializable

public class FailureTrace
extends java.lang.Object
implements java.io.Serializable

This class resembles the periods of time that a Server object should be artificially failed in them. For example: [12:01 - 12:03] , [ 14:05 - 14:10 ] , [ 18:23: 18:33] is a trace meaning that the server in subject will be unavailable or failed in the times 12:01 to 12:03, 14:05 to 14:10 and 18:23 to 18:33.

Author:
Majd Kokaly
See Also:
Serialized Form

Constructor Summary
FailureTrace()
           
 
Method Summary
 boolean add(FailurePeriod period)
           
 boolean doesPeriodOverlapAFailurePeriod(FailurePeriod period)
           
 boolean doesRangeOverlapAFailurePeriod(java.util.GregorianCalendar startTime, java.util.GregorianCalendar endTime)
           
 void fillTrace(java.util.GregorianCalendar startTime, java.util.GregorianCalendar endTime, double periodLengthMean, double interPeriodLengthMean, double minutesInTimeUnit)
          This method fills a trace of failure periods.
 java.util.GregorianCalendar getEndOfFailure(java.util.GregorianCalendar time)
           
 java.util.ArrayList<FailurePeriod> getFailurePeriods()
           
 double getMeanIfInterPeriodsInMinutes()
           
 double getMeanOfPeriodsInMinutes()
           
 int getNumbersOfPeriods()
           
 boolean IsTimeInFailure(java.util.GregorianCalendar time)
           
 void print()
           
 void setFailurePeriods(java.util.ArrayList<FailurePeriod> failingPeriods)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FailureTrace

public FailureTrace()
Method Detail

getFailurePeriods

public java.util.ArrayList<FailurePeriod> getFailurePeriods()

setFailurePeriods

public void setFailurePeriods(java.util.ArrayList<FailurePeriod> failingPeriods)

getNumbersOfPeriods

public int getNumbersOfPeriods()

getMeanOfPeriodsInMinutes

public double getMeanOfPeriodsInMinutes()
Returns:
the mean of the lengths of all the FailurePeriod objects in this trace. (length: is endTime - beginingTime)

getMeanIfInterPeriodsInMinutes

public double getMeanIfInterPeriodsInMinutes()
Returns:
the mean of the lengths of periods between artificial periods. (i.e mean of up-time periods)

add

public boolean add(FailurePeriod period)
Parameters:
period - is FailurePeriod Object
Returns:
true if addition succeeded, false otherwise. Additions might fail if the to be added period overlaps an existing FailurePeriod

print

public void print()

IsTimeInFailure

public boolean IsTimeInFailure(java.util.GregorianCalendar time)
Parameters:
time - is a GregorianCalendar (i.e time object)
Returns:
true if time is in any FailurePeriod object in this trace and false otherwise.

getEndOfFailure

public java.util.GregorianCalendar getEndOfFailure(java.util.GregorianCalendar time)
Parameters:
time - Calendar object
Returns:
the end of the failure period that cal is in. If cal is not in any failure period, null is returned.

doesPeriodOverlapAFailurePeriod

public boolean doesPeriodOverlapAFailurePeriod(FailurePeriod period)
Parameters:
period - is a FailurePeriod object.
Returns:
true if period overlaps with some FailurePeriod object in this trace, false otherwise.

doesRangeOverlapAFailurePeriod

public boolean doesRangeOverlapAFailurePeriod(java.util.GregorianCalendar startTime,
                                              java.util.GregorianCalendar endTime)
Parameters:
startTime - is a Time
endTime - is a Time
Returns:
true if time range between startTime and endTime overlaps with some FailurePeriod object in this trace, false otherwise.

fillTrace

public void fillTrace(java.util.GregorianCalendar startTime,
                      java.util.GregorianCalendar endTime,
                      double periodLengthMean,
                      double interPeriodLengthMean,
                      double minutesInTimeUnit)
This method fills a trace of failure periods.

Parameters:
startTime - the start time of the trace
endTime - The end time of the trace
periodLengthMean - the mean of all the periods lengths
interPeriodLengthMean - the mean between the periods of failures
minutesInTimeUnit - the minutes per Time Unit of the system