package ru.job4j;

import javafx.beans.binding.MapExpression;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import java.io.File;
import java.io.IOException;
import java.sql.*;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by Andrey on 03.10.2017.
 */
public class Test extends DefaultHandler {

    public static void main(String[] args) {
        /*try {

            SAXParserFactory factory = SAXParserFactory.newInstance();
            SAXParser saxParser = factory.newSAXParser();

            DefaultHandler handler = new DefaultHandler() {


                public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
                {

                    if ("entry".equals(qName)) {
                        for (int i = 0; i < atts.getLength(); i++) {
                            System.out.println(atts.getValue(i));
                        }
                    }
                }

            };

            saxParser.parse("C:\\Users\\Andrey\\Desktop/2.xml", handler);

        } catch (Exception e) {
            e.printStackTrace();
        }*/


        /*long start = System.currentTimeMillis();

        try {
            System.out.println(new SQLStorage().countSumOfElements(1000000, "postgres", "password", "admin", "C:\\Users\\Andrey\\Desktop/1.xml", "C:\\Users\\Andrey\\Desktop/2.xml", "C:\\Users\\Andrey\\Desktop/xslFilter.xml"));
        } catch (IOException e) {
            e.printStackTrace();
        } catch (SAXException e) {
            e.printStackTrace();
        } catch (ParserConfigurationException e) {
            e.printStackTrace();
        }

        long end = System.currentTimeMillis();
        System.out.println(end - start);*/



        /*Connection conn = null;
        try {
            conn = DriverManager.getConnection("jdbc:sqlite:sample.db");
            conn.setAutoCommit(false);
            PreparedStatement st =conn.prepareStatement("CREATE TABLE IF NOT EXISTS TEST (field INT )");
            st.executeUpdate();
            st = conn.prepareStatement("INSERT INTO TEST VALUES (1)");
            st.executeUpdate();
            st = conn.prepareStatement("SELECT * FROM TEST");
            ResultSet rs = st.executeQuery();
            while (rs.next()) {
                System.out.println(rs.getString("field"));
            }

        } catch (SQLException e) {
            e.printStackTrace();
        }*/


//        new Assembly_Module().execute(new File("C:\\Users\\Andrey\\Desktop/readme.txt"), 1000);


        Map<Character, Integer> map = new HashMap<>();
        char[] array = new String("meagatest").toCharArray();
        char[] array2 = new String("testagemq").toCharArray();
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array.length; j++) {
                if (array[i] == array[j]) {
                    count++;
                }
            }
            map.put(array[i], count);
            count = 0;
        }

        boolean b = true;

        for (int i = 0; i < array2.length; i++) {
            for (Map.Entry<Character, Integer> entry : map.entrySet()) {
                if (array2[i] == entry.getKey()) {
                    map.put(entry.getKey(), entry.getValue() - 1);
                    break;
                }
            }
        }

        for (Map.Entry<Character, Integer> entry : map.entrySet()) {
            if (entry.getValue() != 0) {
                b = false;
                break;
            }
        }
        if (array.length != array2.length) {
            b = false;
        }
        if (!b) {
            System.out.println("suck my nuts ! ! !");
        }



        /*for (Map.Entry<Character, Integer> entry : map.entrySet()) {
            System.out.println(String.format("%s %d", entry.getKey(), entry.getValue()));
        }*/


        /*for (Map.Entry<Character, Integer> entry : map.entrySet()) {
            System.out.println(String.format("%s %x", entry.getKey(), entry.getValue()));
        }*/

        


    }
}
@@ -3856,25 +3856,14 @@
 n(%22s
-uck my nuts ! ! !
+kiping
 %22);%0A
@@ -4242,8 +4242,9 @@
 %0A    %7D%0A%7D
+%0A

Update Test.java