Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import aguiaj.iscte.*;
- class Organizador extends Manipulação{
- private Fotografia[] fotos = new Fotografia[4];
- ColorImage ant;
- ColorImage exibicao;
- ColorImage next;
- private int current = 0;
- private int currentPos = 0;
- Organizador(Fotografia foto) {
- this.fotos[1] = foto;
- this.exibicao = fotos[0].getImage();
- currentPos++;
- }
- private void previous() {
- if(current - 1 < 0) {
- int k = 0;
- while(fotos[fotos.length-1-k] == null)
- k++;
- ant = reduzir(fotos[fotos.length-1-k].getImage(),2);
- }
- else {
- ant = reduzir(fotos[current-1].getImage(),2);
- }
- }
- private void next() {
- if(current + 1 > fotos.length) {
- int k = 0;
- while(fotos[0+k] == null)
- k++;
- next = reduzir(fotos[0+k].getImage(),2);
- }
- else {
- next = reduzir(fotos[current+1].getImage(),2);
- }
- }
- Organizador(ColorImage[] imgs, String etiqueta) {
- for(int i = 0; i < imgs.length; i++) {
- fotos[i] = new Fotografia(imgs[i]);
- fotos[i].addEtiqueta(etiqueta);
- currentPos++;
- }
- exibicao = fotos[0].getImage();
- previous();
- next();
- }
- void addImage(ColorImage img) {
- if(currentPos < fotos.length - 1)
- fotos[currentPos] = new Fotografia(img);
- else
- throw new IllegalArgumentException("O Organizador está cheio");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement