package baf.sci;

import com.sun.java.swing.tree.TreeNode;

class TypedResourceList extends baf.util.SortedList implements TreeNode {
  final int type;
  final ResourceCollection parent;

  TypedResourceList(int type, ResourceCollection parent) {
    this.type = type;
    this.parent = parent;
  }

  public String toString() {
    return Resource.typenames[type];
  }

  public TreeNode getChildAt(int i) {
    return (TreeNode)elementAt(i);
  }

  public int getChildCount() {
    return size();
  }

  public TreeNode getParent() {
    return parent;
  }

  public int getIndex(TreeNode t) {
    if (t instanceof ResourceIndex)
      return indexOf((ResourceIndex)t);
    else return -1;
  }

  public boolean getAllowsChildren() {
    return true;
  }

  public boolean isLeaf() {
    return false;
  }

  public java.util.Enumeration children() {
    return elements();
  }

}
