source: trunk/fmgVen/src/net/fmg/ven/Olcut.java @ 22

Last change on this file since 22 was 22, checked in by fmguler, 14 years ago

Refs #3 - The new com.fmguler.ven package is created. Project netbeans encoding is changed from windows 1254 to UTF-8. Existing Turkish source files are transformed to UTF-8. Project license is set as apache 2.0 and netbeans license template is created (which is copied from netbeans apache20 and project name is added). To install this template to netbeans, you should import the etc/license/license-ven-apache20.txt to netbeans->tools->templates ->licenses.

The new Ven class is created having the new license template. Now the translation task is to be done.

File size: 2.8 KB
Line 
1/*
2 * Olcut.java
3 *
4 * Created on December 20, 2006, 1:45 PM
5 * (4.12.06 tarihli SpringDaoDeneme çalışmasından derlenmiştir)
6 *
7 * Ven - Ayar Yerine Gelenek veritabanı erişim nesnesi
8 */
9
10package net.fmg.ven;
11
12import java.util.HashMap;
13import java.util.HashSet;
14import java.util.List;
15import java.util.Map;
16import java.util.Set;
17import net.fmg.ven.arac.Cevir;
18
19/**
20 * Ven için ölçütlerin belirlenebileceği sınıf
21 * @author Fatih Mehmet Güler
22 */
23public class Olcut {
24    private String metin;
25    private Map parametreler;
26    private Set baglaclar;
27   
28    /**
29     * Yeni ölçüt
30     */
31    public Olcut() {
32        this.metin = "";
33        this.parametreler = new HashMap();
34        this.baglaclar =  new HashSet();
35        //{"and", "or", "=", "<>", "<", ">"}
36    }
37   
38    /**
39     * YAPILMADI
40     */
41    public Olcut ekle(Olcut olcut){       
42        return null;
43    }
44   
45    /**
46     * YAPILMADI
47     */
48    public Olcut ekle(List olcutler){       
49        return null;
50    }
51   
52    /**
53     * YAPILMADI
54     */
55    public Olcut ve(){
56        return null;
57    }
58   
59    /**
60     * koşul ekle
61     */
62    public Olcut ekle(String kosul){
63        this.metin +=" "+kosul;
64        return this;
65    }
66   
67    /**
68     * koşullarda kullanılan parametreleri ekle
69     */
70    public Olcut ekle(String parametre, Object nesne){
71        this.parametreler.put(parametre,nesne);
72        return this;
73    }
74   
75    /**
76     * koşullarda kullanılan parametreleri tümden ekle
77     */
78    public Olcut ekle(Map parametreler){
79        this.parametreler.putAll(parametreler);
80        return this;
81    }
82   
83    public String olcutleriAl(){
84        //((1=1) and ((1=1) and (musteri_numuneler_numune_sahibi.rapor_tarihi is null) and (musteri.no = 4)))
85        //Musteri.numuneler.deneyler.deneyTip.ad like :p1
86        String sonuc = "";
87        metin = metin.replace("(","( ");
88        metin = metin.replace(")"," )");
89        String[] parcalar = metin.split(" ");
90        for (int i = 0; i < parcalar.length; i++) {
91            if (!parcalar[i].startsWith(":") && parcalar[i].contains(".")){
92                int sonNokta = parcalar[i].lastIndexOf('.');               
93                sonuc += " ";
94                int u = parcalar[i].length();               
95                sonuc +=Cevir.vt(parcalar[i].substring(0,sonNokta).replace('.','_'));
96                sonuc +=Cevir.vt(parcalar[i].substring(sonNokta,u));
97            }else{
98                sonuc += " "+parcalar[i];
99            }
100        }
101        return sonuc;
102    }
103   
104    public Map parametreler(){
105        return this.parametreler;
106    }
107
108    public String toString() {
109        return olcutleriAl()+" "+this.parametreler;
110    }
111   
112}
Note: See TracBrowser for help on using the repository browser.