bibliothek.gui.dock.accept
Class CombinatoryAcceptance

java.lang.Object
  extended by bibliothek.gui.dock.accept.AbstractAcceptance
      extended by bibliothek.gui.dock.accept.CombinatoryAcceptance
All Implemented Interfaces:
DockAcceptance

public class CombinatoryAcceptance
extends AbstractAcceptance

A DockAcceptance that is a combination out of two other acceptances.

Author:
Benjamin Sigg

Nested Class Summary
static class CombinatoryAcceptance.Combination
           
 
Constructor Summary
CombinatoryAcceptance(CombinatoryAcceptance.Combination combination, DockAcceptance first, DockAcceptance second)
          Constructor, sets up all fields of this acceptance
 
Method Summary
 boolean accept(DockStation parent, Dockable child)
          Tells whether or not child is allowed to become a real child of parent.
 boolean accept(DockStation parent, Dockable child, Dockable next)
          Tells whether child, which may be already a child of parent, and next are allowed to be combined.
protected  boolean compare(boolean first, boolean second)
          Makes a logical operation with first and second according to the operation specified as combination.
 CombinatoryAcceptance.Combination getCombination()
          Gets how the combination is calculated
 DockAcceptance getFirst()
          Gets the "left" operand of the combination
 DockAcceptance getSecond()
          Gets the "right" operand of the combination
 void setCombination(CombinatoryAcceptance.Combination combination)
          Sets, how the two acceptances of this CombinatoryAcceptance have to be combined
 void setFirst(DockAcceptance first)
          Sets the "left" operand of the combination
 void setSecond(DockAcceptance second)
          Sets the "right" operand of the combination
 
Methods inherited from class bibliothek.gui.dock.accept.AbstractAcceptance
andAccept, equalAccept, impliedAccept, impliesAccept, orAccept, xorAccept
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CombinatoryAcceptance

public CombinatoryAcceptance(CombinatoryAcceptance.Combination combination,
                             DockAcceptance first,
                             DockAcceptance second)
Constructor, sets up all fields of this acceptance

Parameters:
combination - How the two Acceptances first and second will be combined.
first - The acceptance at the "left" side of the operation
second - The acceptance at the "right" side of the operation
Method Detail

accept

public boolean accept(DockStation parent,
                      Dockable child)
Description copied from interface: DockAcceptance
Tells whether or not child is allowed to become a real child of parent.

Specified by:
accept in interface DockAcceptance
Overrides:
accept in class AbstractAcceptance
Parameters:
parent - the future parent
child - the future child
Returns:
whether or not child and parent are allowed to be combined

accept

public boolean accept(DockStation parent,
                      Dockable child,
                      Dockable next)
Description copied from interface: DockAcceptance
Tells whether child, which may be already a child of parent, and next are allowed to be combined. The result of this combination would replace child on parent.

Specified by:
accept in interface DockAcceptance
Overrides:
accept in class AbstractAcceptance
Parameters:
parent - the future parent of the combination
child - a Dockable which may be a child of parent
next - a new Dockable
Returns:
whether the combination is allowed or not

compare

protected boolean compare(boolean first,
                          boolean second)
Makes a logical operation with first and second according to the operation specified as combination.

Parameters:
first - The operand at the left side
second - The operand at the right side
Returns:
The combination

setCombination

public void setCombination(CombinatoryAcceptance.Combination combination)
Sets, how the two acceptances of this CombinatoryAcceptance have to be combined

Parameters:
combination - How to calculate accept(DockStation, Dockable) out of the results of first and of second
Throws:
IllegalArgumentException - if combination is null

getCombination

public CombinatoryAcceptance.Combination getCombination()
Gets how the combination is calculated

Returns:
The operand
See Also:
setCombination(bibliothek.gui.dock.accept.CombinatoryAcceptance.Combination)

setFirst

public void setFirst(DockAcceptance first)
Sets the "left" operand of the combination

Parameters:
first - The first acceptance whose opinion for an accept will be asked.
Throws:
IllegalArgumentException - if the argument is null

getFirst

public DockAcceptance getFirst()
Gets the "left" operand of the combination

Returns:
The acceptance
See Also:
setFirst(DockAcceptance)

setSecond

public void setSecond(DockAcceptance second)
Sets the "right" operand of the combination

Parameters:
second - The second acceptance whose opinion for accept(DockStation, Dockable) will be asked.
Throws:
IllegalArgumentException - if the argument is null

getSecond

public DockAcceptance getSecond()
Gets the "right" operand of the combination

Returns:
The right operand
See Also:
setSecond(DockAcceptance)