Project

General

Profile

1
import org.joda.time.format.DateTimeFormat;
2
import org.joda.time.format.DateTimeFormatter;
3
import org.jsoup.Jsoup;
4

    
5
import java.text.DateFormat;
6
import java.text.ParseException;
7
import java.text.SimpleDateFormat;
8
import java.util.ArrayList;
9
import java.util.Arrays;
10
import java.util.List;
11

    
12
/**
13
 * Created by eri on 1/14/16.
14
 */
15
public class Test {
16

    
17

    
18
    public static void main(String[] args) throws ParseException {
19

    
20
        String date = "2015-05-26";
21

    
22
        DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
23
        System.out.println(formatter.parseDateTime(date));
24
        DateFormat df = new SimpleDateFormat("yyyy-mm-dd");
25
        System.out.println(df.parse(date));
26

    
27

    
28
        String value = " \"lala\" /lo {}li?   la ";
29

    
30
        value = "i";
31

    
32
        System.out.println("value " + value);
33
        value = value.replace(" ", "");
34
        System.out.println("value " + value);
35
        value = value.replace(" ", "");
36

    
37
        value="Gary  Richard,Lewin ,Lewin % Gary > Richard>";
38
        value = value.replaceAll("[\"\\r\\\\;]", "");
39

    
40
        value = value.replaceAll("[^a-zA-Z0-9 .-_:/&!@+=]+", " ");
41
        System.out.println("VALUE IS" + value);
42

    
43

    
44
        value="http://dx.doi.org/10.17014/ijog.vol1no2.20063-Papandayan-is-an-A-type-active-strato-volcano-located-at-some-20-km-SW-of-Garut-or-about-70-km-SE-of-Bandung-the-capital-city-of-West-Java-Province.-Geographically-the-summit-of-this-volcano-lies-at-the-intersection-between-07--19--42--S-and-107--44--E.-The-2002-Papandayan-eruption-was-preceded-by-two-felt-earthquakes-8-times-of-A-type-volcanic-earthquakes-and-150-times-of-B--type-volcanic-earthquake.-These-events-were-followed-by-a-phreatic-eruption-that-took-place-on-11-November-at-16.02-local-time.-Field-observation-shows-that-the-summit-region-mainly-around-the-craters-consists-of-rocks-that-have-hydrothermally-altered-to-yield-clay-rich-material.-This-clay-rich-material-covers-most-of-the-crater-fl-oors-and-the-crater-rim.-Mount-Nangklak-that-forms-part-of-the-rim-also-contains-a-lava-plug-from-the-Old-Papandayan-volcano.-This-mountain-is-covered-by-fi-ne-grained-unconsolidated-material-and-altered-rocks.-Much-of-this-altered-rocks-coincides-with-solfataric-and-fumarolic-activities-of-80-to->-300-C.-The-summit-area-also-contains-high-discharge-of-water-either-originating-from-the-springs-or-surface-water.-The-increase-in-seismicity-the-fi-ne-grained-hydrothermal-altered-rocks-and-the-existence-of-some-faults-that-pass-through-the-summit-region-might-have-weaken-the-stability-of-the-summit-area.-As-the-result-a-landslide-occurred-on-the-north-fl-ank-of-Mount-Nangklak-where-the-landslide-material-blocked-the-upper-course-of-Cibeureum-Gede-River.-This-landslide-material-had-formed-big-mudfl-ows-that-caused-several-houses-of-fi-ve-villages-were-partly-burried-some-bridges-were-devastated-and-several-hectares-of-cultivated-land-were-damaged.\n" +
45
                "\tat java.net.URI$Parser.fail(URI.java:2829)";
46
        System.out.println("char is " +value.charAt(1057) + value.charAt(1058));
47

    
48

    
49
        value="http://dx.doi.org/10.5902/1984686X5486-O-objetivo-deste-estudo-foi-descrever-o-processo-de-valida-o-de-conte-do-de-um-instrumento-de-avalia-o-do-esquema-corporal-para-crian-as-comcegueira-cong-nita-com-idade-entre-6-e-9-anos.-A-popula-o-foi-constitu-dapor-sete-professores-universit-rios-os-quais-receberam-uma-primeiravers-o-do-instrumento-eles-analisaram-cada-item-nos-quesitos-clareza-delinguagem-pertin-ncia-te-rica-viabilidade-de-aplica-o-e-adequa-o-aoconstructo.-A-prova-1--obteve-80%-de-concord-ncia-a-Prova-2-recebeu-70%-a-prova-3---60%-e-a-prova-4--75%.-Adotou-se-como-crit-rio-de-perman-nciada-prova-o-m-nimo-de-80%-de-concord-ncia.-A-prova-1-permaneceu-como-naprimeira-vers-o-a-prova-2-foi-exclu-da-e-as-provas-3-e-4-foram-modificadas.-Com-base-nas-sugest-es-dos-ju-zes-e-no--ndice-de-concord-ncia-elaborou-se-uma-segunda-vers-o-do-instrumento-composta-por-tr-s-itens.-Com-isso-foi-poss-vel-considerar-que-as-adapta-es-sugeridas-pelos-ju-zes-foram-importantes-para-garantir-a-validade-de-conte-do-do-instrumento.-Palavras-chave:-Educa-o-Especial-Educa-o-F-sica-adaptada-Cegueira-Avalia-o-Esquema-corporal.\n" +
50
                "java.net.URISyntaxException: Malformed escape pair at index 489: http://dx.doi.org/10.5902/1984686X5486-O-objetivo-deste-estudo-foi-descrever-o-processo-de-valida-o-de-conte-do-de-um-instrumento-de-avalia-o-do-esquema-corporal-para-crian-as-comcegueira-cong-nita-com-idade-entre-6-e-9-anos.-A-popula-o-foi-constitu-dapor-sete-professores-universit-rios-os-quais-receberam-uma-primeiravers-o-do-instrumento-eles-analisaram-cada-item-nos-quesitos-clareza-delinguagem-pertin-ncia-te-rica-viabilidade-de-aplica-o-e-adequa-o-aoconstructo.-A-prova-1--obteve-80%-de-concord-ncia-a-Prova-2-recebeu-70%-a-prova-3---60%-e-a-prova-4--75%.-Adotou-se-como-crit-rio-de-perman-nciada-prova-o-m-nimo-de-80%-de-concord-ncia.-A-prova-1-permaneceu-como-naprimeira-vers-o-a-prova-2-foi-exclu-da-e-as-provas-3-e-4-foram-modificadas.-Com-base-nas-sugest-es-dos-ju-zes-e-no--ndice-de-concord-ncia-elaborou-se-uma-segunda-vers-o-do-instrumento-composta-por-tr-s-itens.-Com-isso-foi-poss-vel-considerar-que-as-adapta-es-sugeridas-pelos-ju-zes-foram-importantes-para-garantir-a-validade-de-conte-do-do-instrumento.-Palavras-chave:-Educa-o-Especial-Educa-o-F-sica-adaptada-Cegueira-Avalia-o-Esquema-corporal.\n" +
51
                "\tat java.net.URI$Parser.fail(URI.java:2829)";
52

    
53

    
54
        System.out.println("malformed escaped pair char is " +value.charAt(489) +value.charAt(490) );
55

    
56

    
57
        /*value = value.replace("\\r", " ");
58
        value = value.replace("\\", "");
59
		*/
60

    
61
		 /*value = value.replace("\\r", " ");
62
	     value = value.replace("\\", "");
63
*/
64

    
65

    
66
        value = "http://dx.doi.org/10.5902/198050985739<br /><br />O presente trabalho objetivou avaliar a capacidade de adesão da madeira serrada de eucalipto proveniente de três sistemas de manejo, empregando-se os adesivos: resorcina formaldeído, e dois adesivos em emulsão aquosa à base de poliacetato de vinila. Os sistemas de manejo foram caracterizados por três estratos, sendo o estrato um (E1) caracterizado por madeira proveniente de talhadia e idade de 70 meses; o estrato dois (E2) caracterizado por madeira de reforma e idade de 166 meses e o estrato três (E3) caracterizado também por reforma aos 70 meses de idade.";
67

    
68

    
69
        System.out.println(Jsoup.parse(value).text());
70

    
71

    
72
        List<String> s = new ArrayList<String>();
73
        s.add("A");
74
        s.add("B");
75
        s.add("C");
76
        s.add("D");
77
        int listSize= s.size();
78
        List<String> newList= new ArrayList<String>();
79
String DELIM=";";
80
        String valueEntity="result";
81

    
82
        for(int i=0; i< s.size()-1;i++)
83
        {
84
            System.out.println(i);
85
            for(int j=i+1; j<s.size();j++)
86
            {System.out.println("j is " +j);
87
                newList.add("dedup" + DELIM +
88
                        valueEntity + DELIM +
89
                        s.get(i) + DELIM +
90
                        valueEntity+ DELIM+
91
                        s.get(j) + DELIM);
92

    
93

    
94
            }
95
        }
96

    
97

    
98
        System.out.println(newList);
99

    
100

    
101

    
102
       //  MyString.formStrings("");
103
    }
104

    
105
    public static List<List<String>> generatePerm(List<String> original) {
106
        if (original.size() == 0) {
107
            List<List<String>> result = new ArrayList<List<String>>();
108
            result.add(new ArrayList<String>());
109
            return result;
110
        }
111
        String firstElement = original.remove(0);
112
        List<List<String>> returnValue = new ArrayList<List<String>>();
113

    
114
        List<List<String>> permutations = generatePerm(original);
115

    
116
        for (List<String> smallerPermutated : permutations) {
117
            for (int index = 0; index <= smallerPermutated.size(); index++) {
118
                List<String> temp = new ArrayList<String>(smallerPermutated);
119
                temp.add(index, firstElement);
120
                returnValue.add(temp);
121
            }
122
        }
123
        return returnValue;
124
    }
125

    
126
    public static class MyString {
127

    
128
        static final String[] chars = {"a", "b", "c"};
129
        static final int reqLen = 2;
130

    
131
        public static void formStrings(String crtStr) {
132

    
133
            if (crtStr.length() == reqLen) {
134
                System.out.println(crtStr);
135
                return;
136
            } else
137
                for (int i = 1; i < chars.length; i++) {
138
                    if(!crtStr.contains(chars[i] +crtStr))
139
                    formStrings(crtStr + chars[i]);
140
                    else
141
                    { formStrings(crtStr);
142

    
143
                    }
144

    
145
                }
146
        }
147
    }
148

    
149

    
150

    
151

    
152
    static void fillList(ArrayList list) {
153
        list.add("lala");
154

    
155
    }
156

    
157
}
(1-1/2)