1 19 package org.netbeans.tax.decl; 20 21 import java.util.*; 22 23 import org.netbeans.tax.*; 24 25 public abstract class ChildrenType extends TreeElementDecl.ContentType implements TypeCollection { 26 27 28 protected List context; 30 31 35 public ChildrenType (Collection col) { 36 super (); 37 38 context = new LinkedList (); 39 context.addAll (col); 40 } 41 42 public ChildrenType () { 43 this (new ArrayList ()); 44 } 45 46 public ChildrenType (ChildrenType childrenType) { 47 super (childrenType); 48 49 context = new LinkedList (); 50 Iterator it = childrenType.context.iterator (); 51 while ( it.hasNext () ) { 52 context.add (((TreeElementDecl.ContentType)it.next ()).clone ()); 53 } 54 } 55 56 57 61 63 protected void setNodeDecl (TreeNodeDecl nodeDecl) { 64 super.setNodeDecl (nodeDecl); 65 66 initNodeDecl (); 67 } 68 69 protected final void initNodeDecl () { 70 } 76 77 78 82 84 public void addTypes (Collection types) { 85 Iterator it = types.iterator (); 87 while (it.hasNext ()) { 88 if (it.next () == null) it.remove (); 89 } 90 context.addAll (types); 91 92 initNodeDecl (); 93 } 94 95 96 public void addType (TreeElementDecl.ContentType type) { 97 if (type == null) 98 return; 99 context.add (type); 100 101 initNodeDecl (); 102 } 103 104 106 public Collection getTypes () { 107 return context; 108 } 109 110 112 public boolean allowElements () { 113 return true; 114 } 115 116 118 public boolean allowText () { 119 return false; 120 } 121 122 124 public boolean hasChildren () { 125 return context.size () > 0; 126 } 127 128 130 public abstract String getSeparator (); 131 132 } 133 | Popular Tags |