/*
 * Created on 19.09.2003
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package eworks.RDF.model;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/**
 * @author wleklinski
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public class Statements extends AbstractTuples {
	
	/**
	 * 
	 */
	public Statements() {
		super();
	}

	/**
	 * @param initialCapacity
	 */
	public Statements(int initialCapacity) {
		super(initialCapacity);
	}

	/**
	 * @param c
	 */
	public Statements(Collection c) {
		super(c);
	}
	
	public boolean add(Statement s) {
		return super.add(s);
	}
	
	public Object clone() {
		return new Statements( (ArrayList) super.clone() );
	}
	
	public boolean addAll(Collection c, boolean distinct) {
		if (distinct && this.size() > 0) {
			Iterator i = c.iterator();
			Statement s;
			boolean result = false;
			while (i.hasNext()) {
				if (! this.contains(s = (Statement) i.next())) {
					this.add(s);
					result = true;
				}
			}
			return result;
		} else {
			return super.addAll(c);
		}
	}
	
	public Statement getStatement(int index) {
		return (Statement) super.get(index);
	}
}
