package com.linguahack.app.parser;

import com.linguahack.app.core.TextStats;

import java.lang.Long;
import java.util.*;

public class ParserImpl implements Parser{


    public TextStats parse(String inputText, long timestamp) {

        return new TextStats(calcTempo(inputText, timestamp),
                             calcSaturation(inputText),
                             calcLength(inputText),
                             calcArtistry(inputText),
                             calcActivity(inputText),
                             getWordsAmountMap(inputText),
                             getLettersAmountMap(inputText)
                            );
    }

    public double calcTempo(String inputText, long timestamp) {
        return 0.0;
    }

    public double calcSaturation(String inputText) {
        return 0.0;
    }

    public int calcLength(String inputText) {
        return 0;
    }

    public double calcArtistry(String inputText) {
        return 0.0;
    }

    public double calcActivity(String inputText) {
        return 0.0;
    }

    public Map<String, Integer> getWordsAmountMap(String inputText) {
        return new HashMap();
    }

    public Map<Character, Integer> getLettersAmountMap(String inputText) {
        return new HashMap();
    }


}

@@ -75,31 +75,39 @@
 ts;%0A
-%0A
 import 
-java.lang.Long;
+org.omg.CORBA.INTERNAL;%0A
 %0Aimp
@@ -736,34 +736,443 @@
 ) %7B%0A        
-return 0.0
+int charCount = 0;%0A        int charCode;%0A        double result;%0A%0A        for( int i = 0; i %3C inputText.length( ); i++ )%0A        %7B%0A            charCode = (int) inputText.charAt( i );%0A%0A            if( (charCode %3E= 97 && charCode%3C= 122))%0A                charCount++;%0A        %7D%0A%0A        if (timestamp %3E 0) %7B%0A            result = charCount/timestamp;%0A        %7D else %7B%0A            result = 0;%0A        %7D%0A%0A        return result
 ;%0A    %7D%0A%0A   
@@ -1665,36 +1665,489 @@
         
-return new HashMap()
+Map%3CCharacter, Integer%3E map = new HashMap%3CCharacter, Integer%3E();%0A%0A        char letter;%0A%0A        for( int i=0; i%3CinputText.length(); i++ ) %7B%0A            letter = inputText.charAt(i);%0A            if(((int) letter %3E= 97 && (int) letter%3C= 122)) %7B%0A                if (map.containsKey(letter)) %7B%0A                    map.put(letter, map.get(letter) + 1);%0A                %7D else %7B%0A                    map.put(letter, 1);%0A                %7D%0A            %7D%0A        %7D%0A        return map
 ;%0A    %7D%0A

add tempo and letters calculation methods