Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dat() {
- filename = "";
- header = "";
- t_pont = new HashMap();
- geometria = new HashMap();
- /*geometria.put("point",new ArrayList());
- geometria.put("linestring",null);
- geometria.put("polgon",null);*/
- try_it() {
- print("The '"+this.geometria+"' is here!");
- }
- open(filename) {
- // https://techknowstudy.wordpress.com/2015/03/10/reading-a-file-through-bean-shell/
- fileReader=new FileReader(filename);
- bufferReader= new BufferedReader(fileReader);
- linenumber=0;
- do {
- line=bufferReader.readLine();
- if (line!=null){
- line = line.trim().replaceAll("\\*$","");
- if ( ++linenumber == 1 ) {
- header = line;
- continue;
- }
- if(line.startsWith("T_")) {
- table = line;
- geometria.put(table,new ArrayList());
- continue;
- } else {/*
- String[] words = line.split("\\*");
- for(i=0;i<words.length;i++){
- print(words[i]+"\t");
- }*/
- geometria{table}.add(line);
- }
- }
- } while(line!=null);
- fileReader.close();
- bufferReader.close();
- }
- return this;
- }
- {
- dat = Dat();
- dat.open("q:\\OpenJUMP\\beanshell\\ck_proba.dat");
- print ( dat.header );
- for ( t : dat.geometria.keySet() ) {
- print(t+": "+dat.geometria{t}.size());
- for ( s : dat.geometria{t} ){
- print("\t"+s);
- }
- }
- print ("dump:\n"+dat.geometria );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement