Subversion Repositories SmartDukaan

Rev

Rev 3185 | Rev 5322 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3185 Rev 5048
Line 37... Line 37...
37
    
37
    
38
    List<String> slides = new ArrayList<String>();
38
    List<String> slides = new ArrayList<String>();
39
    
39
    
40
    private List<String> productList;
40
    private List<String> productList;
41
    private List<String> productNames;
41
    private List<String> productNames;
-
 
42
    private List<String> productTitles;
42
    private Map<String, String> snippets;
43
    private Map<String, String> snippets;
43
    private List<String> unComparedSlides;
44
    private List<String> unComparedSlides;
44
    private List<String> commonSlides;
45
    private List<String> commonSlides;
45
    
46
    
46
    private Map<String, String> slideNameImportanceMap;
47
    private Map<String, String> slideNameImportanceMap;
Line 84... Line 85...
84
        return "show";
85
        return "show";
85
    }
86
    }
86
    
87
    
87
    public List<String> getSlideNames() {
88
    public List<String> getSlideNames() {
88
        productNames = new ArrayList<String>();
89
        productNames = new ArrayList<String>();
-
 
90
        productTitles = new ArrayList<String>();
89
        slideNameImportanceMap = new LinkedHashMap<String, String>();
91
        slideNameImportanceMap = new LinkedHashMap<String, String>();
90
        productSlideScores = new LinkedHashMap<String, Map<String, Double>>();
92
        productSlideScores = new LinkedHashMap<String, Map<String, Double>>();
91
        
93
        
92
        for (String productId : productList) {
94
        for (String productId : productList) {
93
            File f = new File(Utils.EXPORT_ENTITIES_PATH + productId + File.separator + "SlideNamesSnippet.html");
95
            File f = new File(Utils.EXPORT_ENTITIES_PATH + productId + File.separator + "SlideNamesSnippet.html");
94
            FileInputStream fis = null;
96
            FileInputStream fis = null;
95
            try {
97
            try {
96
                fis = new FileInputStream(f);
98
                fis = new FileInputStream(f);
97
                BufferedReader br = new BufferedReader(new InputStreamReader(fis));
99
                BufferedReader br = new BufferedReader(new InputStreamReader(fis));
98
                String line;
100
                String line;
99
                boolean isProductName = true;;
101
                boolean isProductName = true;
-
 
102
                boolean isProductTitle = true;
100
                Map<String, Double> slideScores = new LinkedHashMap<String, Double>();
103
                Map<String, Double> slideScores = new LinkedHashMap<String, Double>();
101
                while((line = br.readLine()) != null){
104
                while((line = br.readLine()) != null){
102
                    if(isProductName){
105
                    if(isProductName){
103
                        productNames.add(line);
106
                        productNames.add(line);
104
                        productSlideScores.put(line, slideScores);
107
                        productSlideScores.put(line, slideScores);
105
                        isProductName = false;
108
                        isProductName = false;
106
                        continue;
109
                        continue;
107
                    }
110
                    }
-
 
111
                    if(isProductTitle){
-
 
112
                    	productTitles.add(line);
-
 
113
                    	isProductTitle = false;
-
 
114
                    	continue;
-
 
115
                    }
108
                    
116
                    
109
                    String[] parts = line.split("!!!");
117
                    String[] parts = line.split("!!!");
110
                    String slideName = parts[0];
118
                    String slideName = parts[0];
111
                    String importance = parts[1];
119
                    String importance = parts[1];
112
                    double score = Double.parseDouble(parts[2]);
120
                    double score = Double.parseDouble(parts[2]);
Line 236... Line 244...
236
    
244
    
237
    public List<String> getProductNames(){
245
    public List<String> getProductNames(){
238
        return this.productNames;
246
        return this.productNames;
239
    }
247
    }
240
 
248
 
-
 
249
    public String getPageTitle(){
-
 
250
    	StringBuffer sb1 = new StringBuffer("Compare ");
-
 
251
    	StringBuffer sb2 = new StringBuffer("");
-
 
252
    	for(String title : this.productTitles) {
-
 
253
    		sb2.append(" vs " + title);
-
 
254
    	}
-
 
255
    	sb2.replace(0, 3, "");
-
 
256
    	return sb1.append(sb2).toString();
-
 
257
    }
-
 
258
 
-
 
259
    public String getPageDescription(){
-
 
260
    	StringBuffer sb1 = new StringBuffer("Compare ");
-
 
261
    	StringBuffer sb2 = new StringBuffer("");
-
 
262
    	for(String name : this.productNames) {
-
 
263
    		sb2.append(" vs " + name);
-
 
264
    	}
-
 
265
    	sb2.replace(0, 3, "");
-
 
266
    	return sb1.append(sb2).append(" | Price, Specifications and Reviews ").toString();
-
 
267
    }
-
 
268
    
-
 
269
    public String getKeywords(){
-
 
270
    	StringBuffer sb1 = new StringBuffer("Compare, ");
-
 
271
    	StringBuffer sb2 = new StringBuffer("");
-
 
272
    	for(String name : this.productNames) {
-
 
273
    		sb2.append(", " + name);
-
 
274
    	}
-
 
275
    	sb2.replace(0, 2, "");
-
 
276
    	return sb1.append(sb2).append(", Price, Specifications and Reviews ").toString();
-
 
277
    	
-
 
278
    }
-
 
279
 
241
    public Map<String, String> getSlideNameImportanceMap(){
280
    public Map<String, String> getSlideNameImportanceMap(){
242
        return this.slideNameImportanceMap;
281
        return this.slideNameImportanceMap;
243
    }
282
    }
244
    
283
    
245
    public Map<String, Map<String, Double>> getProductSlideScores(){
284
    public Map<String, Map<String, Double>> getProductSlideScores(){