Skip to content
Snippets Groups Projects
TableauStd.java 651 B
Newer Older
package p4a;

public class TableauStd implements Structure {
	
	private Object[] tableau;
	
	public TableauStd(Object[] tableau) {
		this.tableau = tableau;
	}

	@Override
	public void ajout(Object element, int position) {
		throw new UnsupportedOperationException("ajout : opration non supporte");
	}

	@Override
	public void suppression(int position) {
		throw new UnsupportedOperationException("suppression : opration non supporte");
	}

	@Override
	public Object acces(int position) {
		if (position > tableau.length || position < 0) {
			throw new IllegalArgumentException("acces : position incorecte");
		}
		return tableau[position];