You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
521 B
32 lines
521 B
package patronIterator;
|
|
|
|
public class Vector {
|
|
public int[] datos;
|
|
|
|
public Vector(int tamanyo) {
|
|
this.datos = new int[tamanyo];
|
|
for(int i = 0; i<datos.length; i++) {
|
|
datos[i] = i;
|
|
}
|
|
}
|
|
|
|
public int getValor(int pos) {
|
|
return datos[pos];
|
|
}
|
|
|
|
public void setValor(int pos, int valor) {
|
|
datos[pos] = valor;
|
|
}
|
|
|
|
public int dimension() {
|
|
return datos.length;
|
|
}
|
|
|
|
public IteradorVector iterador() {
|
|
return new IteradorVector(this);
|
|
}
|
|
|
|
public int[] getDatos() {
|
|
return datos;
|
|
}
|
|
}
|
|
|