fable.adt
Class Folder

java.lang.Object
  extended by fable.adt.FableComponent
      extended by fable.adt.Folder
All Implemented Interfaces:
FableContainer

public class Folder
extends FableComponent

This class represents the folder contains folders, feeds, and/or articles. Folder contains its description.

Author:
Wonsik Kim

Constructor Summary
Folder()
          Constructs a new empty folder.
 
Method Summary
 void accept(FableVisitor v)
          Accept the visitor v to visit this.
 void acceptRecursive(FableVisitor v)
          Accept the visitor v to visit this, and recurse on children of this.
 boolean addChild(FableComponent fc)
          Add c as a child of this.
 boolean isSimilarTo(FableComponent fc)
          Returns true if this and fc are similar.
 java.lang.String toString()
          Returns string representation of this folder.
 
Methods inherited from class fable.adt.FableComponent
activate, addStructuralChangeListener, getChildren, getDate, getDescendants, getParent, getPosition, getTitle, isAncestorOf, moveDown, moveUp, removeAllListeners, removeChild, removeStructuralChangeListener, setParent, setPosition, setTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Folder

public Folder()
Constructs a new empty folder.

Effects:
construct a new Folder object.
Modifies:
this
Method Detail

isSimilarTo

public boolean isSimilarTo(FableComponent fc)
Returns true if this and fc are similar. In this case, similar means that two components are equals.

Specified by:
isSimilarTo in class FableComponent
Parameters:
fc - FableComponent object to compare.
Returns:
true if this and fc are similar.

toString

public java.lang.String toString()
Returns string representation of this folder.

Overrides:
toString in class java.lang.Object
Returns:
string representation of this folder.

addChild

public final boolean addChild(FableComponent fc)
Add c as a child of this. Returns true if c is successfully added as a child of this, otherwise false. Since Folder can only contain Folder and Feed, it will reject other components like Article.

Specified by:
addChild in interface FableContainer
Overrides:
addChild in class FableComponent
Parameters:
fc - A child to be added.
Returns:
true if c is successfully added. false otherwise.
Throws:
java.lang.NullPointerException - if fc is null.
Effects:
add c as a child of this if c is an instance of Folder or Feed, and this is not a children of c.
Modifies:
this.children

accept

public void accept(FableVisitor v)
Description copied from class: FableComponent
Accept the visitor v to visit this.

Specified by:
accept in class FableComponent
Parameters:
v - the visitor to visit this.

acceptRecursive

public void acceptRecursive(FableVisitor v)
Description copied from class: FableComponent
Accept the visitor v to visit this, and recurse on children of this.

Specified by:
acceptRecursive in class FableComponent
Parameters:
v - the visitor to visit this and decendants of this.