de.cau.cs.kieler.klay.layered
Class IntermediateProcessingStrategy

java.lang.Object
  extended by de.cau.cs.kieler.klay.layered.IntermediateProcessingStrategy

public class IntermediateProcessingStrategy
extends Object

A strategy for intermediate layout processors to be used.

Layout phases use instances of this class to specify which intermediate layout processors they depend on. The layout provider uses this class to keep track of which intermediate layout processors must be inserted into the layout algorithm workflow.

To construct a processing strategy that just depends on processors in a single processing slot, use code like the following:

 new IntermediateProcessingStrategy(
         IntermediateProcessingStrategy.BEFORE_PHASE_3,
         EnumSet.of(IntermediateLayoutProcessor.EDGE_SPLITTER));
 

To construct a processing strategy with processors in more than one slot, you can use code like the following:

 new IntermediateProcessingStrategy(
         // Before Phase 1
         null,
         // Before Phase 2
         null,
         // Before Phase 3
         EnumSet.of(IntermediateLayoutProcessor.STRANGE_PORT_SIDE_PROCESSOR),
         // Before Phase 4
         null,
         // Before Phase 5
         null,
         // After Phase 5
         EnumSet.of(IntermediateLayoutProcessor.SOME_OTHER_PROCESSOR,
                    IntermediateLayoutProcessor.YET_ANOTHER_PROCESSOR);
 

Rating red

Field Summary
static int AFTER_PHASE_5
          Constant for the processors that should come after phase 5.
static int BEFORE_PHASE_1
          Constant for the processors that should come before phase 1.
static int BEFORE_PHASE_2
          Constant for the processors that should come before phase 2.
static int BEFORE_PHASE_3
          Constant for the processors that should come before phase 3.
static int BEFORE_PHASE_4
          Constant for the processors that should come before phase 4.
static int BEFORE_PHASE_5
          Constant for the processors that should come before phase 5.
static int INTERMEDIATE_PHASE_SLOTS
          How many slots there are for intermediate processing.
 
Constructor Summary
IntermediateProcessingStrategy()
          Constructs a new empty strategy.
IntermediateProcessingStrategy(Collection<IntermediateLayoutProcessor> beforePhase1, Collection<IntermediateLayoutProcessor> beforePhase2, Collection<IntermediateLayoutProcessor> beforePhase3, Collection<IntermediateLayoutProcessor> beforePhase4, Collection<IntermediateLayoutProcessor> beforePhase5, Collection<IntermediateLayoutProcessor> afterPhase5)
          Constructs a new strategy containing the given intermediate layout processors.
IntermediateProcessingStrategy(int slotIndex, Collection<IntermediateLayoutProcessor> processors)
          Constructs a new strategy that has the given processors in the given slot, but is otherwise empty.
IntermediateProcessingStrategy(IntermediateProcessingStrategy init)
          Constructs a new strategy as a copy of the given strategy.
IntermediateProcessingStrategy(int slotIndex, IntermediateLayoutProcessor processor)
          Constructs a new strategy that has the given processor in the given slot, but is otherwise empty.
 
Method Summary
 IntermediateProcessingStrategy addAll(int slotIndex, Collection<IntermediateLayoutProcessor> processors)
          Adds all layout processors in the given collection to the given slot, without duplicates.
 IntermediateProcessingStrategy addAll(IntermediateProcessingStrategy operand)
          Adds the items from the given strategy to this strategy.
 void addLayoutProcessor(int slotIndex, IntermediateLayoutProcessor processor)
          Adds the given layout processor to the given slot, if it's not already in there.
 void clear()
          Clears this strategy.
 Set<IntermediateLayoutProcessor> getProcessors(int slotIndex)
          Returns the layout processors in the given slot.
 void removeLayoutProcessor(int slotIndex, IntermediateLayoutProcessor processor)
          Removes the given layout processor from the given slot.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BEFORE_PHASE_1

public static final int BEFORE_PHASE_1
Constant for the processors that should come before phase 1.

See Also:
Constant Field Values

BEFORE_PHASE_2

public static final int BEFORE_PHASE_2
Constant for the processors that should come before phase 2.

See Also:
Constant Field Values

BEFORE_PHASE_3

public static final int BEFORE_PHASE_3
Constant for the processors that should come before phase 3.

See Also:
Constant Field Values

BEFORE_PHASE_4

public static final int BEFORE_PHASE_4
Constant for the processors that should come before phase 4.

See Also:
Constant Field Values

BEFORE_PHASE_5

public static final int BEFORE_PHASE_5
Constant for the processors that should come before phase 5.

See Also:
Constant Field Values

AFTER_PHASE_5

public static final int AFTER_PHASE_5
Constant for the processors that should come after phase 5.

See Also:
Constant Field Values

INTERMEDIATE_PHASE_SLOTS

public static final int INTERMEDIATE_PHASE_SLOTS
How many slots there are for intermediate processing.

See Also:
Constant Field Values
Constructor Detail

IntermediateProcessingStrategy

public IntermediateProcessingStrategy()
Constructs a new empty strategy.


IntermediateProcessingStrategy

public IntermediateProcessingStrategy(IntermediateProcessingStrategy init)
Constructs a new strategy as a copy of the given strategy.

Parameters:
init - the strategy to copy.

IntermediateProcessingStrategy

public IntermediateProcessingStrategy(int slotIndex,
                                      IntermediateLayoutProcessor processor)
Constructs a new strategy that has the given processor in the given slot, but is otherwise empty.

Parameters:
slotIndex - the slot index. Must be >= 0 and < INTERMEDIATE_PHASE_SLOTS.
processor - the layout processor to add.

IntermediateProcessingStrategy

public IntermediateProcessingStrategy(int slotIndex,
                                      Collection<IntermediateLayoutProcessor> processors)
Constructs a new strategy that has the given processors in the given slot, but is otherwise empty.

Parameters:
slotIndex - the slot index. Must be >= 0 and < INTERMEDIATE_PHASE_SLOTS.
processors - the layout processors to add.

IntermediateProcessingStrategy

public IntermediateProcessingStrategy(Collection<IntermediateLayoutProcessor> beforePhase1,
                                      Collection<IntermediateLayoutProcessor> beforePhase2,
                                      Collection<IntermediateLayoutProcessor> beforePhase3,
                                      Collection<IntermediateLayoutProcessor> beforePhase4,
                                      Collection<IntermediateLayoutProcessor> beforePhase5,
                                      Collection<IntermediateLayoutProcessor> afterPhase5)
Constructs a new strategy containing the given intermediate layout processors.

Parameters:
beforePhase1 - layout processors before phase 1. May be null.
beforePhase2 - layout processors before phase 2. May be null.
beforePhase3 - layout processors before phase 3. May be null.
beforePhase4 - layout processors before phase 4. May be null.
beforePhase5 - layout processors before phase 5. May be null.
afterPhase5 - layout processors after phase 5. May be null.
Method Detail

getProcessors

public Set<IntermediateLayoutProcessor> getProcessors(int slotIndex)
Returns the layout processors in the given slot. Modifications of the returned set do not result in modifications of this strategy.

Parameters:
slotIndex - the slot index. Must be >= 0 and < INTERMEDIATE_PHASE_SLOTS.
Returns:
the slot's set of layout processors.

addLayoutProcessor

public void addLayoutProcessor(int slotIndex,
                               IntermediateLayoutProcessor processor)
Adds the given layout processor to the given slot, if it's not already in there.

Parameters:
slotIndex - the slot index. Must be >= 0 and < INTERMEDIATE_PHASE_SLOTS.
processor - the layout processor to add.

addAll

public IntermediateProcessingStrategy addAll(int slotIndex,
                                             Collection<IntermediateLayoutProcessor> processors)
Adds all layout processors in the given collection to the given slot, without duplicates.

Parameters:
slotIndex - the slot index. Must be >= 0 and < INTERMEDIATE_PHASE_SLOTS.
processors - the layout processors to add. May be null.
Returns:
this strategy.

addAll

public IntermediateProcessingStrategy addAll(IntermediateProcessingStrategy operand)
Adds the items from the given strategy to this strategy. The different intermediate processing slots will have duplicate processors removed.

Parameters:
operand - the strategy to unify this strategy with. May be null.
Returns:
this strategy.

removeLayoutProcessor

public void removeLayoutProcessor(int slotIndex,
                                  IntermediateLayoutProcessor processor)
Removes the given layout processor from the given slot.

Parameters:
slotIndex - the slot index. Must be >= 0 and < INTERMEDIATE_PHASE_SLOTS.
processor - the layout processor to add.

clear

public void clear()
Clears this strategy.