package br.edu.ufsc.compilador.ui;

import java.util.List;

import javax.swing.table.AbstractTableModel;

import br.edu.ufsc.compilador.analisadores.Token;

/**
 * @author Andr Matias
 * ltima atualizao 16/11/2014
 */
public class TokenTableModel extends AbstractTableModel {
	
	private static final long serialVersionUID = 6616245723082918187L;
	
	private List<Token> tokens;

	public TokenTableModel(List<Token> tokens) {
		this.tokens = tokens;
	}

	@Override
	public int getColumnCount() {
		return 2;
	}

	@Override
	public int getRowCount() {
		return tokens.size();
	}

	@Override
	public Object getValueAt(int linha, int coluna) {
		switch (coluna) {
			case 0:
				return tokens.get(linha).getLexeme();
			case 1:
				return tokens.get(linha).getPosition();
			default:
				return "";
		}
	}
	
	@Override
	public String getColumnName(int coluna) {
		switch (coluna) {
			case 0:
				return "Lexema";
			case 1:
				return "Posio";
			default:
				return "";
		}
	}

}

@@ -178,16 +178,17 @@
 hor Andr
+%C3%A9
  Matias%0D
@@ -191,16 +191,17 @@
 ias%0D%0A * 
+%C3%9A
 ltima at
@@ -206,16 +206,18 @@
 atualiza
+%C3%A7%C3%A3
 o 16/11/
@@ -227,16 +227,43 @@
 4%0D%0A */%0D%0A
+//Gabriel fez altera%C3%A7%C3%B5es.%0D%0A
 public c
@@ -555,10 +555,25 @@
 urn 
-2;
+3;//Adicionado +1
 %0D%0A%09%7D
@@ -735,32 +735,605 @@
 a) %7B%0D%0A%09%09%09case 0:
+ //Acredito que deva existir algo mais bonito do que essa gambiarra, mas est%C3%A1 funcionando assim Att.Gabriel%0D%0A%09%09%09%09int x =  tokens.get(linha).getId();%0D%0A%09%09%09%09if(x == 0)%7B%0D%0A%09%09%09%09%09return %22EPSLON%22;%0D%0A%09%09%09%09%7Delse if(x == 1)%7B%0D%0A%09%09%09%09%09return %22DOLLAR%22;%0D%0A%09%09%09%09%7Delse if(x == 2)%7B%0D%0A%09%09%09%09%09return %22id%22;%0D%0A%09%09%09%09%7Delse if(x == 3 %7C%7C x == 4)%7B%0D%0A%09%09%09%09%09return %22Constante Num%C3%A9rica%22;%0D%0A%09%09%09%09%7Delse if(x == 5)%7B%0D%0A%09%09%09%09%09return %22Constante Literal%22;%0D%0A%09%09%09%09%7Delse if(x %3E 33)%7B%0D%0A%09%09%09%09%09return %22S%C3%ADmbolo Especial%22; %0D%0A%09%09%09%09%7Delse if(x %3E 5)%7B%0D%0A%09%09%09%09%09return %22Palavra Reservada%22;%0D%0A%09%09%09%09%7Delse%7B%0D%0A%09%09%09%09%09return %22ERRO L%C3%89XICO%22;%0D%0A%09%09%09%09%7D%0D%0A%09%09%09case 1:
 %0D%0A%09%09%09%09return tok
@@ -1361,33 +1361,33 @@
 eme();%0D%0A%09%09%09case 
-1
+2
 :%0D%0A%09%09%09%09return to
@@ -1548,16 +1548,116 @@
 ase 0:%0D%0A
+%09%09%09%09return %22Token%22;//Reavaliar: Coloquei %22Token%22, mas pode ser %22Tipo Token%22, n%C3%A3o sei..%0D%0A%09%09%09case 1:%0D%0A
 %09%09%09%09retu
@@ -1670,33 +1670,33 @@
 xema%22;%0D%0A%09%09%09case 
-1
+2
 :%0D%0A%09%09%09%09return %22P
@@ -1698,16 +1698,18 @@
 rn %22Posi
+%C3%A7%C3%A3
 o%22;%0D%0A%09%09%09

Update TokenTableModel.java