Example usage for java.util Scanner nextInt

List of usage examples for java.util Scanner nextInt

Introduction

In this page you can find the example usage for java.util Scanner nextInt.

Prototype

public int nextInt() 

Source Link

Document

Scans the next token of the input as an int .

Usage

From source file:ehospital.Principal.java

private void btn_cargar_ambuMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btn_cargar_ambuMouseClicked
    // TODO add your handling code here:
    Scanner sc = null;
    File archivo2;/*ww  w.  ja va  2  s. c o  m*/
    try {
        archivo2 = new File("./Ambulancia.txt");
        sc = new Scanner(archivo2);
        sc.useDelimiter(",");
        while (sc.hasNext()) {
            Ambulancias ambu = new Ambulancias(sc.next(), sc.nextInt(), sc.nextInt(), new Lugar(sc.next()),
                    sc.nextBoolean());
            lista_ambu.add(ambu);
        }
        JOptionPane.showMessageDialog(null, "Ambulancias Cargadas");
    } catch (Exception e) {
    } finally {
        sc.close();
    }
    System.out.println(lista_ambu.toString());
}

From source file:ehospital.Principal.java

private void btn_cargar_paramMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btn_cargar_paramMouseClicked
    // TODO add your handling code here:
    Scanner sc = null;
    File archivo2;//from w w  w.  j  ava  2  s  .c  o  m
    try {
        archivo2 = new File("./Paramedicos.txt");
        sc = new Scanner(archivo2);
        sc.useDelimiter(",");
        while (sc.hasNext()) {
            Paramedicos param = new Paramedicos(sc.next(), sc.nextInt(), sc.nextInt(), sc.next(),
                    new Lugar(sc.next()), sc.nextBoolean());
            lista_param.add(param);
        }
        JOptionPane.showMessageDialog(null, "Paramedicos Cargadas");
    } catch (Exception e) {
    } finally {
        sc.close();
    }
    System.out.println(lista_param.toString());
}

From source file:plptool.gui.ProjectDriver.java

/**
 * Open plp file specified by path.//from  w  ww  . j a  v  a  2  s  .  co  m
 *
 * @param path Path to project file to load.
 * @param assemble Attempt to assemble after opening (if dirty is not set)
 * @return PLP_OK on successful operation, error code otherwise
 */
public int open(String path, boolean assemble) {
    File plpFile = new File(path);
    CallbackRegistry.callback(CallbackRegistry.PROJECT_OPEN, plpFile);

    if (!plpFile.exists())
        return Msg.E("open(" + path + "): File not found.", Constants.PLP_BACKEND_PLP_OPEN_ERROR, null);

    boolean metafileFound = false;
    dirty = true;

    Msg.I("Opening " + path, null);

    if (arch != null) {
        arch.cleanup();
        arch = null;
    }
    asm = null;
    asms = new ArrayList<PLPAsmSource>();
    smods = null;
    watcher = null;
    pAttrSet = new HashMap<String, Object>();
    HashMap<String, Integer> asmFileOrder = new HashMap<String, Integer>();

    try {

        TarArchiveInputStream tIn = new TarArchiveInputStream(new FileInputStream(plpFile));
        TarArchiveEntry entry;
        byte[] image;
        String metaStr;

        // Find meta file first
        while ((entry = tIn.getNextTarEntry()) != null) {
            if (entry.getName().equals("plp.metafile")) {
                image = new byte[(int) entry.getSize()];
                tIn.read(image, 0, (int) entry.getSize());
                metaStr = new String(image);

                metafileFound = true;
                meta = metaStr;
                Scanner metaScanner;

                String lines[] = meta.split("\\r?\\n");
                if (lines[0].equals(Text.projectFileVersionString)) {

                } else {
                    Msg.W("This is not a " + Text.projectFileVersionString + " project file. Opening anyways.",
                            this);
                }

                metaScanner = new Scanner(meta);
                metaScanner.findWithinHorizon("DIRTY=", 0);
                if (metaScanner.nextInt() == 0)
                    dirty = false;
                if (metaScanner.findWithinHorizon("ARCH=", 0) != null) {
                    String temp = metaScanner.nextLine();
                    if (Config.cfgOverrideISA >= 0) { // ISA ID override, ignore the metafile
                        arch = ArchRegistry.getArchitecture(this, Config.cfgOverrideISA);
                        arch.init();
                    } else if (temp.equals("plpmips")) {
                        Msg.W("This project file was created by PLPTool version 3 or earlier. "
                                + "Meta data for this project will be updated "
                                + "with the default ISA (plpmips) when the project " + "file is saved.", this);
                        arch = ArchRegistry.getArchitecture(this, ArchRegistry.ISA_PLPMIPS);
                        arch.init();
                    } else {
                        arch = ArchRegistry.getArchitecture(this, Integer.parseInt(temp));
                        if (arch == null) {
                            Msg.W("Invalid ISA ID is specified in the project file: '" + temp
                                    + "'. Assuming PLPCPU.", this);
                            arch = ArchRegistry.getArchitecture(this, ArchRegistry.ISA_PLPMIPS);
                        }
                        arch.init();
                    }
                    arch.hook(this);
                }

                // get asm files order
                int asmOrder = 0;
                while (metaScanner.hasNext()) {
                    String asmName = metaScanner.nextLine();
                    if (asmName.endsWith(".asm")) {
                        asmFileOrder.put(asmName, new Integer(asmOrder));
                        asmOrder++;
                        asms.add(null);
                    }
                }
            }
        }

        if (!metafileFound)
            return Msg.E("No PLP metadata found.", Constants.PLP_BACKEND_INVALID_PLP_FILE, this);

        // reset the tar input stream
        tIn = new TarArchiveInputStream(new FileInputStream(plpFile));

        while ((entry = tIn.getNextTarEntry()) != null) {
            boolean handled = false;
            image = new byte[(int) entry.getSize()];
            tIn.read(image, 0, (int) entry.getSize());
            metaStr = new String(image);

            // Hook for project open for each entry
            Object[] eParams = { entry.getName(), image, plpFile };
            handled = CallbackRegistry.callback(CallbackRegistry.PROJECT_OPEN_ENTRY, eParams) || handled;

            if (entry.getName().endsWith("asm") && !entry.getName().startsWith("plp.")) {
                Integer order = (Integer) asmFileOrder.get(entry.getName());
                if (order == null)
                    Msg.W("The file '" + entry.getName() + "' is not listed in "
                            + "the meta file. This file will be removed when the project " + "is saved.", this);
                else {
                    asms.set(order, new PLPAsmSource(metaStr, entry.getName(), order));
                }

            } else if (entry.getName().equals("plp.metafile")) {
                // we've done reading the metafile

            } else if (entry.getName().equals("plp.image")) {
                binimage = new byte[(int) entry.getSize()];
                binimage = image;

            } else if (entry.getName().equals("plp.hex")) {
                hexstring = new String(image);

                // Restore bus modules states
            } else if (entry.getName().equals("plp.simconfig")) {
                Msg.D("simconfig:\n" + metaStr + "\n", 4, this);
                String lines[] = metaStr.split("\\r?\\n");
                int i;

                for (i = 0; i < lines.length; i++) {
                    String tokens[] = lines[i].split("::");

                    if (lines[i].startsWith("simRunnerDelay")) {
                        Config.simRunnerDelay = Integer.parseInt(tokens[1]);
                    }

                    if (lines[i].equals("MODS")) {
                        i++;
                        this.smods = new Preset();

                        while (i < lines.length && !lines[i].equals("END")) {
                            tokens = lines[i].split("::");
                            if (tokens.length > 4 && tokens[4].equals("noframe"))
                                smods.addModuleDefinition(Integer.parseInt(tokens[0]),
                                        Long.parseLong(tokens[2]), Long.parseLong(tokens[3]), false, false);
                            else if (tokens.length > 4)
                                smods.addModuleDefinition(Integer.parseInt(tokens[0]),
                                        Long.parseLong(tokens[2]), Long.parseLong(tokens[3]), true,
                                        Boolean.parseBoolean(tokens[5]));

                            i++;
                        }
                    }

                    if (lines[i].equals("WATCHER")) {
                        i++;
                        this.watcher = Watcher.getTableInitialModel();

                        while (i < lines.length && !lines[i].equals("END")) {
                            tokens = lines[i].split("::");
                            Object row[] = { tokens[0], tokens[1], null, null };
                            watcher.addRow(row);
                            i++;
                        }
                    }

                    if (lines[i].equals("ISASPECIFIC")) {
                        i++;

                        while (i < lines.length && !lines[i].equals("END")) {
                            tokens = lines[i].split("::");
                            arch.restoreArchSpecificSimStates(tokens);
                            i++;
                        }
                    }
                }
            } else if (handled) {

            } else {
                Msg.W("open(" + path + "): unable to process entry: " + entry.getName()
                        + ". This file will be removed when" + " you save the project.", this);
            }
        }

        tIn.close();

        if (asmFileOrder.isEmpty()) {
            return Msg.E("open(" + path + "): no .asm files found.", Constants.PLP_BACKEND_INVALID_PLP_FILE,
                    null);
        }

    } catch (Exception e) {
        Msg.trace(e);
        return Msg.E("open(" + path + "): Invalid PLP archive.", Constants.PLP_BACKEND_INVALID_PLP_FILE, null);
    }

    if (arch == null) {
        Msg.W("No ISA information specified in the archive, assuming plpmips", this);
        arch = ArchRegistry.getArchitecture(this, ArchRegistry.ISA_PLPMIPS);
        arch.init();
    }

    plpfile = new File(path);
    modified = false;
    open_asm = 0;

    for (int i = 0; i < asms.size(); i++)
        Msg.I(i + ": " + asms.get(i).getAsmFilePath(), null);

    if (g)
        refreshProjectView(false);
    if (!dirty && assemble) {
        assemble();
        asm_req = false;
    } else
        asm_req = true;

    if (g) {
        g_opts.restoreSavedOpts();
        desimulate();

        if (asm != null && asm.isAssembled())
            g_dev.enableSimControls();
        else
            g_dev.disableSimControls();

        this.setUnModified();
        updateWindowTitle();
        g_dev.updateDevelopRecentProjectList(plpFile.getAbsolutePath());
        if (g_asmview != null)
            g_asmview.dispose();
    }

    CallbackRegistry.callback(CallbackRegistry.PROJECT_OPEN_SUCCESSFUL, plpFile);
    return Constants.PLP_OK;
}

From source file:Model.MultiPlatformLDA.java

public void readData() {
    Scanner sc = null;
    BufferedReader br = null;//from   ww w.jav  a  2  s. co m
    String line = null;
    HashMap<String, Integer> userId2Index = null;
    HashMap<Integer, String> userIndex2Id = null;

    try {
        String folderName = dataPath + "/users";
        File postFolder = new File(folderName);

        // Read number of users
        int nUser = postFolder.listFiles().length;
        users = new User[nUser];
        userId2Index = new HashMap<String, Integer>(nUser);
        userIndex2Id = new HashMap<Integer, String>(nUser);
        int u = -1;

        // Read the posts from each user file
        for (File postFile : postFolder.listFiles()) {
            u++;
            users[u] = new User();

            // Read index of the user
            String userId = FilenameUtils.removeExtension(postFile.getName());
            userId2Index.put(userId, u);
            userIndex2Id.put(u, userId);
            users[u].userID = userId;

            // Read the number of posts from user
            int nPost = 0;
            br = new BufferedReader(new FileReader(postFile.getAbsolutePath()));
            while (br.readLine() != null) {
                nPost++;
            }
            br.close();

            // Declare the number of posts from user
            users[u].posts = new Post[nPost];

            // Read each of the post
            br = new BufferedReader(new FileReader(postFile.getAbsolutePath()));
            int j = -1;
            while ((line = br.readLine()) != null) {
                j++;
                users[u].posts[j] = new Post();

                sc = new Scanner(line.toString());
                sc.useDelimiter(",");
                while (sc.hasNext()) {
                    users[u].posts[j].postID = sc.next();
                    users[u].posts[j].platform = sc.nextInt();
                    users[u].posts[j].batch = sc.nextInt();

                    // Read the words in each post
                    String[] tokens = sc.next().toString().split(" ");
                    users[u].posts[j].words = new int[tokens.length];
                    for (int i = 0; i < tokens.length; i++) {
                        users[u].posts[j].words[i] = Integer.parseInt(tokens[i]);
                    }
                }
            }
            br.close();
        }

        // Read post vocabulary
        String vocabularyFileName = dataPath + "/vocabulary.csv";

        br = new BufferedReader(new FileReader(vocabularyFileName));
        int nPostWord = 0;
        while (br.readLine() != null) {
            nPostWord++;
        }
        br.close();
        vocabulary = new String[nPostWord];

        br = new BufferedReader(new FileReader(vocabularyFileName));
        while ((line = br.readLine()) != null) {
            String[] tokens = line.split(",");
            int index = Integer.parseInt(tokens[0]);
            vocabulary[index] = tokens[1];
        }
        br.close();

    } catch (Exception e) {
        System.out.println("Error in reading post from file!");
        e.printStackTrace();
        System.exit(0);
    }
}

From source file:codeu.chat.client.commandline.Chat.java

public String doOneTestCommand(Scanner lineScanner) {
    final Scanner tokenScanner = new Scanner(lineScanner.nextLine());
    if (!tokenScanner.hasNext()) {
        return "";
    }/*from   ww  w .jav a  2  s .  co m*/
    final String token = tokenScanner.next();

    if (token.equals("exit")) {

        alive = false;

    } else if (token.equals("help")) {

        help();

    } else if (token.equals("sign-in")) {

        if (!tokenScanner.hasNext()) {
            System.out.println("ERROR: No user name supplied.");
        } else {
            signInUser(tokenScanner.nextLine().trim());

            // Automatically create the bot user and the conversation with the bot once a user signs in
            if (clientContext.user.lookup(BOT_NAME) == null) // Check whether the bot and convo already exist
            {
                addUser(BOT_NAME);
                clientContext.conversation.startConversation(BOT_CONVO, clientContext.user.getCurrent().id);
            }
        }

    } else if (token.equals("sign-out")) {

        if (!clientContext.user.hasCurrent()) {
            System.out.println("ERROR: Not signed in.");
        } else {
            signOutUser();
        }

    } else if (token.equals("current")) {

        showCurrent();

    } else if (token.equals("u-add")) {

        if (!tokenScanner.hasNext()) {
            System.out.println("ERROR: Username not supplied.");
        } else {
            addUser(tokenScanner.nextLine().trim());
        }

    } else if (token.equals("u-list-all")) {

        showAllUsers();

    } else if (token.equals("c-add")) {

        if (!clientContext.user.hasCurrent()) {
            System.out.println("ERROR: Not signed in.");
        } else {
            if (!tokenScanner.hasNext()) {
                System.out.println("ERROR: Conversation title not supplied.");
            } else {
                final String title = tokenScanner.nextLine().trim();
                clientContext.conversation.startConversation(title, clientContext.user.getCurrent().id);
            }
        }

    } else if (token.equals("c-list-all")) {

        clientContext.conversation.showAllConversations();

    } else if (token.equals("c-select")) {

        selectConversation(lineScanner);

    } else if (token.equals("m-add")) {

        if (!clientContext.user.hasCurrent()) {
            System.out.println("ERROR: Not signed in.");
        } else if (!clientContext.conversation.hasCurrent()) {
            System.out.println("ERROR: No conversation selected.");
        } else {
            if (!tokenScanner.hasNext()) {
                System.out.println("ERROR: Message body not supplied.");
            } else {
                final String body = tokenScanner.nextLine().trim();
                clientContext.message.addMessage(clientContext.user.getCurrent().id,
                        clientContext.conversation.getCurrentId(), body);

                respondAsBot(body, false);
            }
        }

    } else if (token.equals("m-list-all")) {

        if (!clientContext.conversation.hasCurrent()) {
            System.out.println("ERROR: No conversation selected.");
        } else {
            clientContext.message.showAllMessages();
        }

    } else if (token.equals("m-next")) {

        if (!clientContext.conversation.hasCurrent()) {
            System.out.println("ERROR: No conversation selected.");
        } else if (!tokenScanner.hasNextInt()) {
            System.out.println("Command requires an integer message index.");
        } else {
            clientContext.message.selectMessage(tokenScanner.nextInt());
        }

    } else if (token.equals("m-show")) {

        if (!clientContext.conversation.hasCurrent()) {
            System.out.println("ERROR: No conversation selected.");
        } else {
            final int count = (tokenScanner.hasNextInt()) ? tokenScanner.nextInt() : 1;
            clientContext.message.showMessages(count);
        }

    } else {

        System.out.format("Command not recognized: %s\n", token);
        System.out.format("Command line rejected: %s%s\n", token,
                (tokenScanner.hasNext()) ? tokenScanner.nextLine() : "");
        System.out.println("Type \"help\" for help.");
    }
    tokenScanner.close();
    return response;
}

From source file:codeu.chat.client.commandline.Chat.java

private void doOneCommand(Scanner lineScanner) {

    final Scanner tokenScanner = new Scanner(lineScanner.nextLine());
    if (!tokenScanner.hasNext()) {
        return;//from   www. j  a v  a  2 s  . com
    }
    final String token = tokenScanner.next();

    if (token.equals("exit")) {

        alive = false;

    } else if (token.equals("help")) {

        help();

    } else if (token.equals("sign-in")) {

        if (!tokenScanner.hasNext()) {
            System.out.println("ERROR: No user name supplied.");
        } else {
            signInUser(tokenScanner.nextLine().trim());

            // Check whether the bot/convo already exist
            if (clientContext.user.lookup(BOT_NAME) == null) {
                addUser(BOT_NAME);
                clientContext.conversation.startConversation(BOT_CONVO, clientContext.user.getCurrent().id);
            }
        }

    } else if (token.equals("sign-out")) {

        if (!clientContext.user.hasCurrent()) {
            System.out.println("ERROR: Not signed in.");
        } else {
            signOutUser();
        }

    } else if (token.equals("current")) {

        showCurrent();

    } else if (token.equals("u-add")) {

        if (!tokenScanner.hasNext()) {
            System.out.println("ERROR: Username not supplied.");
        } else {
            addUser(tokenScanner.nextLine().trim());
        }

    } else if (token.equals("u-list-all")) {

        showAllUsers();

    } else if (token.equals("c-add")) {

        if (!clientContext.user.hasCurrent()) {
            System.out.println("ERROR: Not signed in.");
        } else {
            if (!tokenScanner.hasNext()) {
                System.out.println("ERROR: Conversation title not supplied.");
            } else {
                final String title = tokenScanner.nextLine().trim();
                clientContext.conversation.startConversation(title, clientContext.user.getCurrent().id);
            }
        }

    } else if (token.equals("c-list-all")) {

        clientContext.conversation.showAllConversations();

    } else if (token.equals("c-select")) {

        selectConversation(lineScanner);

    } else if (token.equals("c-search-title")) {

        if (!tokenScanner.hasNext()) {
            System.out.println("ERROR: Conversation title not supplied.");
        } else {
            final String title = tokenScanner.nextLine().trim();
            clientContext.conversation.searchTitle(title);
        }

    } else if (token.equals("m-add")) {

        if (!clientContext.user.hasCurrent()) {
            System.out.println("ERROR: Not signed in.");
        } else if (!clientContext.conversation.hasCurrent()) {
            System.out.println("ERROR: No conversation selected.");
        } else {
            if (!tokenScanner.hasNext()) {
                System.out.println("ERROR: Message body not supplied.");
            } else {
                final String body = tokenScanner.nextLine().trim();
                clientContext.message.addMessage(clientContext.user.getCurrent().id,
                        clientContext.conversation.getCurrentId(), body);

                respondAsBot(body, true);
            }
        }

    } else if (token.equals("m-list-all")) {

        if (!clientContext.conversation.hasCurrent()) {
            System.out.println("ERROR: No conversation selected.");
        } else {
            clientContext.message.showAllMessages();
        }

    } else if (token.equals("m-next")) {

        if (!clientContext.conversation.hasCurrent()) {
            System.out.println("ERROR: No conversation selected.");
        } else if (!tokenScanner.hasNextInt()) {
            System.out.println("Command requires an integer message index.");
        } else {
            clientContext.message.selectMessage(tokenScanner.nextInt());
        }

    } else if (token.equals("m-show")) {

        if (!clientContext.conversation.hasCurrent()) {
            System.out.println("ERROR: No conversation selected.");
        } else {
            final int count = (tokenScanner.hasNextInt()) ? tokenScanner.nextInt() : 1;
            clientContext.message.showMessages(count);
        }

    } else if (token.equals("m-search-string")) {

        if (!clientContext.conversation.hasCurrent()) {
            System.out.println("ERROR: No conversation selected.");
        } else if (!tokenScanner.hasNext()) {
            System.out.println("ERROR: String not supplied.");
        } else {
            final String keyword = tokenScanner.nextLine().trim();
            clientContext.message.searchString(keyword);
        }

    } else if (token.equals("m-search-author")) {

        if (!clientContext.conversation.hasCurrent()) {
            System.out.println("ERROR: No conversation selected.");
        } else if (!tokenScanner.hasNext()) {
            System.out.println("ERROR: author body not supplied.");
        } else {
            final String author = tokenScanner.nextLine().trim();
            clientContext.message.searchAuthor(author);
        }

    } else if (token.equals("t-add")) {

        if (!clientContext.user.hasCurrent()) {
            System.out.println("ERROR: Not signed in.");
        } else {
            if (!tokenScanner.hasNext()) {
                System.out.println("ERROR: tag name not supplied.");
            } else {
                final String name = tokenScanner.nextLine().trim();
                clientContext.tag.addTag(clientContext.user.getCurrent().id, name);
            }
        }

    } else if (token.equals("t-list")) {
        if (!clientContext.user.hasCurrent()) {
            System.out.println("ERROR: Not signed in.");
        } else {
            if (!tokenScanner.hasNext()) {
                System.out.println("ERROR: tag name not supplied.");
            } else {
                final String name = tokenScanner.nextLine().trim();
                clientContext.tag.listTag(clientContext.user.getCurrent().id, name);
            }
        }

    } else if (token.equals("t-list-all")) {
        showAllTags();

    } else if (token.equals("t-list-user")) {
        if (!clientContext.user.hasCurrent()) {
            System.out.println("ERROR: Not signed in.");
        } else {
            clientContext.tag.showUserTags(clientContext.user.getCurrent().id);
        }
    } else {
        System.out.format("Command not recognized: %s\n", token);
        System.out.format("Command line rejected: %s%s\n", token,
                (tokenScanner.hasNext()) ? tokenScanner.nextLine() : "");
        System.out.println("Type \"help\" for help.");
    }
    tokenScanner.close();
}

From source file:InternalFrame.InternalFrameproject.java

private void loadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadActionPerformed

    String userhome = System.getProperty(constants.getProgrampath());
    JFileChooser chooser = new JFileChooser(userhome + "\\" + constants.getProject_input_folder());
    FileNameExtensionFilter txtfilter = new FileNameExtensionFilter("emft files (*Emft)", "Emft");
    chooser.setDialogTitle(language_internal_frame.LangLabel(constants.getLanguage_option(), 7));
    chooser.setFileFilter(txtfilter);//  w  w w  . jav a 2s  .c o  m
    chooser.showOpenDialog(null);

    File f = chooser.getSelectedFile();
    File subor = new File(f.getParent() + "\\" + f.getName());

    int pocet_Vysok = 0;
    try {
        Scanner input = new Scanner(subor);

        basicInfoPanel.jTextField_mano.setText(input.nextLine());
        basicInfoPanel.jTextField_mano_projektu.setText(input.nextLine());
        basicSettingsPanel.jTextField_A.setText(String.valueOf(input.nextDouble()));
        basicSettingsPanel.jTextField_Z.setText(String.valueOf(input.nextDouble()));
        basicSettingsPanel.jTextField_H.setText(String.valueOf(input.nextDouble()));
        basicSettingsPanel.jTextField_krok.setText(String.valueOf(input.nextDouble()));
        basicSettingsPanel.jTextField_krok_pozorovatela.setText(String.valueOf(input.nextDouble()));
        input.nextLine();

        pocet_Vysok = input.nextInt();
        input.nextLine();
        int rowCount = observerPanel1.DTMTable.getRowCount();// odsrrani riadky z DTM table
        for (int i = rowCount - 1; i >= 0; i--) {
            observerPanel1.isListener = false;
            observerPanel1.DTMTable.removeRow(i);
            observerPanel1.isListener = true;
        }
        for (int i = 0; i < pocet_Vysok; i++) {
            observerPanel1.isListener = false;
            observerPanel1.DTMTable.addRow(new Object[] { input.nextLine() });
            observerPanel1.isListener = true;
        }

        observerPanel1.Table.selectAll(); // ozna? potom vetky stplce

        observerPanel1.isListener = false;
        observerPanel1.DTMTable.addRow(new Object[0]);
        observerPanel1.isListener = true;

        int pocet_catenary_riadkov = input.nextInt();
        input.nextLine();
        rowCount = catenaryPanel1.DTMTable.getRowCount();// odsrrani riadky z DTM table
        for (int i = rowCount - 1; i >= 0; i--) {
            catenaryPanel1.isListener = false;
            catenaryPanel1.DTMTable.removeRow(i);
            catenaryPanel1.isListener = true;
        }
        for (int i = 0; i < pocet_catenary_riadkov; i++) {
            catenaryPanel1.isListener = false;

            double V1 = input.nextDouble();
            double V2 = input.nextDouble();
            double I1 = input.nextDouble();
            double I2 = input.nextDouble();
            double W1 = input.nextDouble();
            double W2 = input.nextDouble();
            double X1 = input.nextDouble();
            double X2 = input.nextDouble();
            int zvazok = input.nextInt();
            double alpha = input.nextDouble();
            double d = input.nextDouble();
            int CH = input.nextInt();
            boolean ch = false;
            if (CH == 1) {
                ch = true;
            }
            double val = input.nextDouble();
            double r = input.nextDouble();
            double U = input.nextDouble();
            double I = input.nextDouble();
            double Phi = input.nextDouble();
            int pocitaj = input.nextInt();
            String lano = input.nextLine();
            lano = lano.substring(1);
            boolean poc = false;
            if (pocitaj == 1) {
                poc = true;
            }

            // najdi lano v databaze
            int index = 0;
            for (int j = 0; j < catenaryPanel1.getConductor_Name_Matrix().size(); j++) {

                if (lano.equals(catenaryPanel1.getConductor_Name_Matrix().get(j))) {
                    index = j;
                }
            }

            catenaryPanel1.DTMTable.addRow(new Object[] { V1, V2, I1, I2, W1, W2, X1, X2, zvazok, alpha, d, ch,
                    val, r, U, I, Phi, "-", "-", "-", poc, false, lano });
            catenaryPanel1.isListener = true;
        }
        catenaryPanel1.isListener = false;
        catenaryPanel1.DTMTable.addRow(new Object[0]);
        catenaryPanel1.isListener = true;

    } catch (FileNotFoundException ex) {
        Logger.getLogger(terenmodel_jDialog.class.getName()).log(Level.SEVERE, null, ex);

    }

}