001: /*
002: * Copyright (C) Chaperon. All rights reserved.
003: * -------------------------------------------------------------------------
004: * This software is published under the terms of the Apache Software License
005: * version 1.1, a copy of which has been included with this distribution in
006: * the LICENSE file.
007: */
008:
009: package net.sourceforge.chaperon.model.symbol;
010:
011: /**
012: * This class represents a abstract collection of symbols.
013: *
014: * @author <a href="mailto:stephan@apache.org">Stephan Michels</a>
015: * @version CVS $Id: SymbolCollection.java,v 1.4 2003/12/09 19:55:53 benedikta Exp $
016: */
017: public interface SymbolCollection {
018: /*
019: * Add a symbol to this colection
020: *
021: * @param symbol Symbol, which should added
022: *
023: * @return Index of the symbol in this collection
024: */
025: public boolean addSymbol(Symbol symbol);
026:
027: /*
028: * Add the symbols from an other collection to this collection.
029: *
030: * @param collection Collection of symbols.
031: */
032: public boolean addSymbol(SymbolCollection collection);
033:
034: /**
035: * Removes a symbol by an index from this collection
036: *
037: * @param index Index of the symbol.
038: */
039: public void removeSymbol(int index);
040:
041: /**
042: * Removes a symbol from this collection.
043: *
044: * @param symbol Symbol, which should be removed.
045: */
046: public void removeSymbol(Symbol symbol);
047:
048: /**
049: * Replace a symbol by an index.
050: *
051: * @param index The index, at which the symbol be inserted.
052: * @param symbol Symbol.
053: */
054: public void setSymbol(int index, Symbol symbol);
055:
056: /**
057: * Return a symbol giving by an index.
058: *
059: * @param index Index of the symbol.
060: *
061: * @return Symbol.
062: */
063: public Symbol getSymbol(int index);
064:
065: /**
066: * Returns a symbol from this collection given by the name of the symbol.
067: *
068: * @param name Name of the symbol.
069: *
070: * @return Symbol.
071: */
072: public Symbol getSymbol(String name);
073:
074: /**
075: * Returns the count of symbols in the collection.
076: *
077: * @return Count of symbols.
078: */
079: public int getSymbolCount();
080:
081: /**
082: * If this collection is empty.
083: *
084: * @return True, if the collection is empty.
085: */
086: public boolean isEmpty();
087:
088: /**
089: * Return the index of a symbol.
090: *
091: * @param symbol Symbol.
092: *
093: * @return Index of this symbol.
094: */
095: public int indexOf(Symbol symbol);
096:
097: /**
098: * Return the index of a symbol, given by the name of the Symbol.
099: *
100: * @param name Name of symbol.
101: *
102: * @return Index of this symbol.
103: */
104: public int indexOf(String name);
105:
106: /**
107: * If the collection contains the symbol.
108: *
109: * @param symbol Symbol.
110: *
111: * @return True, if the collection contains the symbol.
112: */
113: public boolean contains(Symbol symbol);
114:
115: /**
116: * If the collection contains a symbol, given by the name of the symbol.
117: *
118: * @param name Name of the symbol.
119: *
120: * @return True, if the collection contains the symbol.
121: */
122: public boolean contains(String name);
123:
124: /**
125: * Removes all symbols from this collection.
126: */
127: public void clear();
128:
129: /**
130: * Compares to another collection of symbols.
131: *
132: * @param o Another object.
133: *
134: * @return True, if both collections contains the same symbols.
135: */
136: public boolean equals(Object o);
137:
138: /**
139: * Return a string representation of the collection.
140: *
141: * @return String representation of the collection.
142: */
143: public String toString();
144: }
|