Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2172 Rev 2195
Line 14... Line 14...
14
public class MotsClesUtilitaire {
14
public class MotsClesUtilitaire {
Line 15... Line 15...
15
	
15
	
16
	//TODO rassembler tout ce qui construit les arbres de mots clés ici
16
	//TODO rassembler tout ce qui construit les arbres de mots clés ici
Line 17... Line 17...
17
	private static String[] caracteresInterdits = {"\\", "/", ","};
17
	private static String[] caracteresInterdits = {"\\", "/", ","};
18
	
18
	
-
 
19
	public static String obtenirCheminParent(String cheminMotCle) {
-
 
20
		String[] tabChemin = cheminMotCle.split("/");
-
 
21
		String cheminParent = "/";
-
 
22
		if(tabChemin.length >= 1) {
-
 
23
			for(int i = 1; i < tabChemin.length - 1; i++) {
-
 
24
				cheminParent += tabChemin[i]+"/";
-
 
25
			}
19
	public static String obtenirCheminParent(String cheminMotCle, String motCle) {
26
		}
Line 20... Line 27...
20
		return cheminMotCle.substring(0, cheminMotCle.length() - motCle.length() -1).toLowerCase();
27
		return cheminParent;
21
	}
28
	}
Line 55... Line 62...
55
				// la variantes minuscules majuscule d'un mot clé
62
				// la variantes minuscules majuscule d'un mot clé
56
				// qui peuvent poser problème
63
				// qui peuvent poser problème
57
				String chemin = noeud.get("chemin").isString()
64
				String chemin = noeud.get("chemin").isString()
58
						.stringValue().toLowerCase();
65
						.stringValue().toLowerCase();
Line 59... Line 66...
59
				
66
				
60
				String cheminParent = MotsClesUtilitaire.obtenirCheminParent(chemin, motCle);
67
				String cheminParent = MotsClesUtilitaire.obtenirCheminParent(chemin);
Line 61... Line 68...
61
				String parent = parentes.get(cheminParent);
68
				String parent = parentes.get(cheminParent);
Line 62... Line 69...
62
				
69
				
Line 153... Line 160...
153
				break;
160
				break;
154
			}
161
			}
155
		}		
162
		}		
156
		return valide;
163
		return valide;
157
	}
164
	}
-
 
165
 
-
 
166
	public static boolean estUnePositionAutorisee(TreeNode node, Node parent, String text) {
-
 
167
		if(parent == null) {
-
 
168
			parent = node.getParentNode();
-
 
169
		}
-
 
170
		Node[] noeudsFreres = parent.getChildNodes(); 
-
 
171
		boolean ok = true;
-
 
172
		for(int i = 0; i <= noeudsFreres.length; i++) {
-
 
173
			if(noeudsFreres[i] != null) {
-
 
174
				String cheminFrere = noeudsFreres[i].getPath();
-
 
175
				String cheminNoeud = node.getPath();
-
 
176
				String texteNoeudfrere = ((String[])noeudsFreres[i].getUserObject())[0];
-
 
177
				if(!cheminFrere.equals(cheminNoeud) && text.equals(texteNoeudfrere)) {
-
 
178
					ok = false;
-
 
179
				}
-
 
180
			}
-
 
181
		}
-
 
182
		return ok;
-
 
183
	}
158
}
184
}