eu.xtreemos.xosd.localallocmgr.basic.manipulators
Class TTElmJoin

java.lang.Object
  extended by eu.xtreemos.xosd.localallocmgr.basic.manipulators.TTElmJoin

public class TTElmJoin
extends java.lang.Object

joining of two elms. When two elements have non-empty intersection and one is not a proper subset of the other, three elements are created. The end time of the first one must be updated, the start of the second one and a new one must be created, holding the added information.

Author:
urosjovanovic

Field Summary
private static TimeAttrExclusion timeAttrExclusion
           
 
Constructor Summary
TTElmJoin()
           
 
Method Summary
private static boolean checkConformance(TTElm elm)
          checks whether the time table element has all the needed attributes.
private static long endTimeInMs(TTElm elm)
           
static java.util.ArrayList<TTElm> join(TTElm elm1, TTElm elm2)
          it is expected, that the elm1 starts before or at the same time as the elm2. this can be the default since time table is always sorted from the earliest to the latest element.
private static long startTimeInMs(TTElm elm)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timeAttrExclusion

private static TimeAttrExclusion timeAttrExclusion
Constructor Detail

TTElmJoin

public TTElmJoin()
Method Detail

join

public static java.util.ArrayList<TTElm> join(TTElm elm1,
                                              TTElm elm2)
                                       throws TTElmJoinException
it is expected, that the elm1 starts before or at the same time as the elm2. this can be the default since time table is always sorted from the earliest to the latest element. returns null if the time table elements are not holding the proper set of attributes. returns the updated elements. if the there is no intersection, the returned array is empty. if one is a proper subset of the other, then the middle element is set to null. returns null if something went wrong (as in not allowed operation), signaling that the transaction must be reversed!

Parameters:
elm1 -
elm2 -
Returns:
Throws:
TTElmJoinException

checkConformance

private static boolean checkConformance(TTElm elm)
checks whether the time table element has all the needed attributes.

Parameters:
elm -
Returns:

startTimeInMs

private static long startTimeInMs(TTElm elm)

endTimeInMs

private static long endTimeInMs(TTElm elm)