/** * Grupo T - MC726 * Componentes: * Flavia Garcia Poly RA:981191 * Jocelen Correa da Silva RA:981390 * Priscilla Sanches Marques RA:981944 * Ruth Fabiana Leite Vieira RA:982116 * Sergio Ricardo Martelo RA:982141 * Roberto Akira RA:963150 */ package pckEngenho; import java.io.FileReader; import java.io.StreamTokenizer; import java.io.IOException; import pckPlano.Veiculo; import pckDemanda.Encomenda; public class Leitura { /** Acessa o arquivo indicado no construtor do objeto e retorna um array de Veiculos correspondente ao conteudo do arquivo. Retorno: Veiculo[] */ public Veiculo[] carregarVeiculo(String vPath) throws Exception{ try { StreamTokenizer stk = new StreamTokenizer(new FileReader(vPath)); Veiculo[] aVeiculos; int i=0; stk.ordinaryChar((int)';'); stk.quoteChar((int)'\''); while (stk.TT_EOF != stk.nextToken()) { stk.pushBack(); aVeiculos[i++] = new VeiculoImpl(stk); } return aVeiculos; } catch(IOException e) { System.out.println("ERRO: " + e.toString()); } } /** Acessa o arquivo indicado no construtor do objeto e retorna um array de Veiculos correspondente ao conteudo do arquivo. Retorno: Veiculos[] */ public Encomenda[] carregarEncomenda(String ePath) throws Exception{ try { StreamTokenizer stk = new StreamTokenizer(new FileReader(ePath)); Encomenda[] aEncomendas; int i=0; stk.ordinaryChar((int)';'); stk.quoteChar((int)'\''); while (stk.TT_EOF != stk.nextToken()) { stk.pushBack(); aEncomendas[i++] = new Encomenda(stk); } return aEncomendas; } catch(IOException e) { System.out.println("ERRO: " + e.toString()); } } }