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

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

public class TimeTableDefragmenter
extends java.lang.Object

Manipulator that combines the succeeding elements with the same attributes, which were made during different manipulations of the time table (adding, removing sequences). This manipulator is not needed for for the sake of the time table but to decrease the number of entries and to make the elms in the time table as close to the original reservation representation as possible.

Author:
urosjovanovic

Constructor Summary
TimeTableDefragmenter()
           
 
Method Summary
private static TTElm createReferentialElm(java.util.ArrayList<TTElm> selection, int endpos)
          returns defragmented object reference or null if something is wrong
static boolean defragment(TimeTable tt)
           
static boolean defragment(TimeTable tt, java.util.GregorianCalendar from, java.util.GregorianCalendar to)
          how to do: defragment anything between the given dates. defragmentation is done on the objects that hold exactly the same elements (attributes).
private static int defragSelection(java.util.ArrayList<TTElm> selection, TimeTable tt)
           
private static int endPosDefragmented(java.util.ArrayList<TTElm> selection)
          returns the position of the last element in the selection that has the same attributes as the first element. returns -1 if no such element exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeTableDefragmenter

public TimeTableDefragmenter()
Method Detail

defragment

public static boolean defragment(TimeTable tt)

defragment

public static boolean defragment(TimeTable tt,
                                 java.util.GregorianCalendar from,
                                 java.util.GregorianCalendar to)
how to do: defragment anything between the given dates. defragmentation is done on the objects that hold exactly the same elements (attributes).

Returns:

createReferentialElm

private static TTElm createReferentialElm(java.util.ArrayList<TTElm> selection,
                                          int endpos)
                                   throws AttributeConformanceException
returns defragmented object reference or null if something is wrong

Parameters:
selection -
endpos -
Returns:
Throws:
AttributeConformanceException

defragSelection

private static int defragSelection(java.util.ArrayList<TTElm> selection,
                                   TimeTable tt)
                            throws AttributeConformanceException
Throws:
AttributeConformanceException

endPosDefragmented

private static int endPosDefragmented(java.util.ArrayList<TTElm> selection)
returns the position of the last element in the selection that has the same attributes as the first element. returns -1 if no such element exists.

Parameters:
selection -
Returns: