Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.30 KB | None | 0 0
  1. import aguiaj.iscte.*;
  2.  
  3.  
  4. class Organizador extends Manipulação{
  5.     private Fotografia[] fotos = new Fotografia[4];
  6.     ColorImage ant;
  7.     ColorImage exibicao;
  8.     ColorImage next;
  9.     private int current = 0;
  10.     private int currentPos = 0;
  11.    
  12.     Organizador(Fotografia foto) {
  13.         this.fotos[1] = foto;
  14.         this.exibicao = fotos[0].getImage();
  15.         currentPos++;
  16.         }
  17.    
  18.     private void previous() {
  19.         if(current - 1 < 0) {
  20.             int k = 0;
  21.             while(fotos[fotos.length-1-k] == null)
  22.                 k++;
  23.             ant = reduzir(fotos[fotos.length-1-k].getImage(),2);
  24.             }
  25.         else {
  26.             ant = reduzir(fotos[current-1].getImage(),2);
  27.             }
  28.         }
  29.    
  30.     private void next() {
  31.         if(current + 1 > fotos.length) {
  32.             int k = 0;
  33.             while(fotos[0+k] == null)
  34.                 k++;
  35.             next = reduzir(fotos[0+k].getImage(),2);
  36.             }
  37.         else {
  38.             next = reduzir(fotos[current+1].getImage(),2);
  39.             }
  40.         }
  41.    
  42.     Organizador(ColorImage[] imgs, String etiqueta) {
  43.         for(int i = 0; i < imgs.length; i++) {
  44.             fotos[i] = new Fotografia(imgs[i]);
  45.             fotos[i].addEtiqueta(etiqueta);
  46.             currentPos++;
  47.         }
  48.         exibicao = fotos[0].getImage();
  49.         previous();
  50.         next();
  51.     }
  52.    
  53.     void addImage(ColorImage img) {
  54.         if(currentPos < fotos.length - 1)
  55.             fotos[currentPos] = new Fotografia(img);
  56.         else
  57.             throw new IllegalArgumentException("O Organizador está cheio");
  58.             }
  59.  
  60.  
  61.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement