Révision 2

SRC/src/fr/triangle/hyperalign/kernel/DisplayData.java (revision 2)
1
package fr.triangle.hyperalign.kernel;
2

  
3
import java.util.Vector;
4

  
5
import fr.triangle.hyperalign.kernel.corpus.ParallelTextElement;
6
import fr.triangle.hyperalign.kernel.corpus.text.HyperalignText;
7
import fr.triangle.hyperalign.kernel.dico.Dictionary;
8
import fr.triangle.hyperalign.kernel.termino.Terminology;
9
import fr.triangle.hyperalign.vocabulary.OccurrenceSet;
10

  
11
public class DisplayData {
12

  
13
	private Vector<OccurrenceSet> currentOccurrencesToIndex;
14
	private HyperalignText currentText;
15
	private String currentSelection;
16
	private int[] currentIndexes;
17
	private ParallelTextElement currentDivision; //where in the corpus structure
18
	private OccurrenceSet currentOccSet;
19
	//private Localisation currentLocalisation = new Localisation(null, null, new Terminology[0]);
20
	private Dictionary[] currentDictionary = new Dictionary[0];
21
	private Terminology[] currentTerminology = new Terminology[0];
22
	
23
	private DataManager manager;
24

  
25
	public DisplayData(DataManager manager){
26
		this.manager = manager;
27
	}
28

  
29

  
30
	public void setData(HyperalignText text, 
31
			ParallelTextElement localisation, 
32
			String selection, 
33
			OccurrenceSet annot, 
34
			int[] indexes){	
35
		//System.out.println("\tDisplayData - SET DATA ["+localisation.computeName()+"] -");
36
		if(text!=null){
37
			Vector<Dictionary> dicos = text.getDictionaries();
38
			if(dicos!=null){
39
			Dictionary [] dics = new Dictionary[dicos.size()];
40
			for(int i = 0 ; i < dicos.size(); ++i){
41
				dics[i] = dicos.get(i);
42
			}
43
			this.currentDictionary = dics;
44
			}
45
		}
46
		this.currentText = text;
47
		this.currentDivision = localisation;
48
		this.currentSelection = selection;
49
		this.currentIndexes = indexes;
50
		this.currentOccSet = annot;
51
	}
52

  
53

  
54
	/*
55
	private void setLocalisation(Localisation loc){
56
		currentData.setLocalisation(loc);
57
	}
58

  
59
	 */
60

  
61
	public Vector<OccurrenceSet> getCurrentOccurrencesToIndex(){
62
		return currentOccurrencesToIndex;
63
	}
64

  
65
	public void setCurrentOccurrencesToIndex(Vector<OccurrenceSet> occs){
66
		currentOccurrencesToIndex = occs;
67
	}
68

  
69

  
70
	public ParallelTextElement getCurrentParallelElement(){
71
		return currentDivision;
72
	}
73

  
74
	public HyperalignText getCurrentText(){
75
		return this.currentText;
76
	}
77

  
78

  
79
	public OccurrenceSet getCurrentOccurrence(){
80
		return this.currentOccSet;
81
	}
82

  
83
	/*public void setLocalisation(Localisation loc){
84
		this.currentLocalisation = loc;
85
	}
86

  
87

  
88
	public Localisation getLocalisation(){
89
		return new Localisation(currentDivision,currentText,currentTerminology);
90
	}*/
91

  
92

  
93

  
94
	public String getCurrentSelection(){
95
		return currentSelection;
96
	}
97

  
98

  
99
	public int[] getCurrentIndexes(){
100
		return currentIndexes;
101
	}
102

  
103
	public void setCurrentDictionaries(Dictionary [] dicos){
104
		this.currentDictionary = dicos;
105
	}
106
	
107
	public void setCurrentParallelElement(ParallelTextElement el){
108
		this.currentDivision = el;
109
	}
110
	
111
	public Dictionary [] getCurrentDictionaries(){
112
		return this.currentDictionary;
113
	}
114
	
115
	public void setCurrentTerminologies(Terminology [] terminos){
116
		this.currentTerminology = terminos;
117
	}
118
	
119
	public Terminology [] getCurrentTerminologies(){
120
		return this.currentTerminology;
121
	}
122
}
SRC/src/fr/triangle/hyperalign/kernel/annot/Metadata.java (revision 2)
1
package fr.triangle.hyperalign.kernel.annot;
2

  
3
import java.util.HashMap;
4
import java.util.Vector;
5

  
6
public class Metadata {
7

  
8
	Vector<Metadata> children;
9
	Metadata father;
10
	String name; //Tag name
11
	String content; //Value if there is
12
	HashMap<String, String> attributes;
13
	boolean isleaf = false;
14
	
15
	public Metadata(String name){
16
		children = new Vector<Metadata>();
17
		attributes = new HashMap<String, String>();
18
		this.name = name;
19
		isleaf = false;
20
	}
21
	
22
	
23
	public Metadata(Metadata father, String name, HashMap<String, String> attributes){
24
		children = new Vector<Metadata>();
25
		this.attributes = attributes;
26
		this.name = name;
27
		isleaf = false;
28
		this.father = father;
29
		father.addMetadata(this);
30
	}
31
	
32
	public Metadata(Metadata father, String name, String content){
33
		children = new Vector<Metadata>();
34
		this.attributes = new HashMap<String, String>();
35
		this.name = name;
36
		this.content = content;
37
		isleaf = true;
38
		this.father = father;
39
		father.addMetadata(this);
40
	}
41
	
42
	public Metadata(Metadata father, String name, String content, HashMap<String, String> attributes){
43
		children = new Vector<Metadata>();
44
		this.attributes = attributes;
45
		this.name = name;
46
		this.content = content;
47
		isleaf = true;
48
		this.father = father;
49
		father.addMetadata(this);
50
	}
51

  
52
	public void modifyContent(String content){
53
		this.content = content;
54
	}
55
	
56
	public String getContent(){
57
		return content;
58
	}
59
	
60
	public void setContent(String newContent){
61
		System.out.println("Metadata.setContent() '"+newContent+"' for ["+name+"] with old content '"+content+"'");
62
		this.content = newContent;
63
	}
64
	
65
	public String getName(){
66
		return name;
67
	}
68

  
69
	public String toString(){
70
		return name;
71
	}
72
	
73
	public Metadata getFather(){
74
		return father;
75
	}
76
	
77
	
78
	public void addMetadata(Metadata child){
79
		if(!children.contains(child)){
80
			children.add(child);
81
		}else {
82
			System.out.println("Metadata.addMetadata() >>>>> ERROR - Same child : "+child.getName());
83
		}
84
	}
85
	
86
	public Vector<Metadata> getMetadatas(){
87
		return children;
88
	}
89
	
90
	public void setAttribute(String tag, String content){
91
		if(attributes.containsKey(tag)){
92
			System.err.println("Attribute '"+tag+"' already in the Metadata '"+content+"'");
93
		}
94
		attributes.put(tag, content);
95
	}
96
	
97
	public HashMap<String, String> getAttributes(){
98
		return attributes;
99
	}
100
	
101
	public Metadata getMetadata(String name){
102
		if(this.getName().equals(name)){
103
			System.out.println("Metadat.getMetadata() > FOUND "+this.getName()+" / "+this.getContent());
104
			return this;
105
		}else {
106
			return findMetadataInChildren(this, name);
107
		}
108
	}
109
	
110
	private Metadata findMetadataInChildren(Metadata metadata, String name){
111
		if(metadata.children!=null){
112
			if(metadata.children.size()!=0){
113
				for(int i = 0 ; i < metadata.children.size() ; ++i){
114
					Metadata child = metadata.children.get(i);
115
					System.out.println("Metadat.findMetadataInChildren() > CHILD "+child.getName()+" / "+child.getContent());
116
					
117
					Metadata foundMetadata = child.getMetadata(name);
118
					if(foundMetadata!=null){
119
						return foundMetadata;
120
					}
121
				}
122
			}
123
		}else {
124
			return null;
125
		}
126
		return null;
127
	}
128
	
129
	
130
	
131
}
SRC/src/fr/triangle/hyperalign/kernel/annot/AnnotationParameters.java (revision 2)
1
package fr.triangle.hyperalign.kernel.annot;
2

  
3
import java.util.HashMap;
4

  
5
import fr.triangle.hyperalign.kernel.Parameter;
6
import fr.triangle.hyperalign.kernel.Parameters;
7
import fr.triangle.hyperalign.kernel.TreeElement;
8
import fr.triangle.hyperalign.kernel.termino.TerminologyElement;
9
import fr.triangle.hyperalign.vocabulary.OccurrenceSet;
10

  
11
public class AnnotationParameters extends Parameters {
12
		
13
	///////////// ANNOTATION PARAMETERS /////////////////
14
	/**
15
	 * This static value corresponds to annotation key : "editTerminology"
16
	 */ 
17
	//whether AnnotPane is going to be for terminology or edition elements ?
18
	public final static String ANNOTATION_EDITTERMINOLOGY = "editTerminology";
19
	
20
	/**
21
	 * This static value corresponds to annotation key : "editTerm"
22
	 */
23
	public final static String ANNOTATION_EDITTERM = "editTerm";
24
	/**
25
	 * This static value corresponds to annotation key : "editType"
26
	 */
27
	public final static String ANNOTATION_EDITINFO = "editInfo";
28
	/**
29
	 * This static value corresponds to annotation key : "newEntry"
30
	 */
31
	public final static String ANNOTATION_NEWENTRY = "newEntry";
32
	/**
33
	 * This static value corresponds to annotation key : "indexOcc"
34
	 */
35
	public final static String ANNOTATION_INDEXOCC = "indexOcc";
36
	
37
	/**
38
	 * This static value corresponds to annotation key : "indexOcc"
39
	 */
40
	public final static String ANNOTATION_EDITOCC = "editOcc";
41
	
42
	
43
	//Localisation localisation ;
44
	OccurrenceSet occSet;
45
	String [] stringToAnnot ;
46
	String stringAnnotType;
47
	TreeElement element;
48
	
49
	public AnnotationParameters(TreeElement element,  HashMap<String, Parameter> newParameters){
50
		super(newParameters, "Annotation");
51
		this.element = element;
52
		this.stringToAnnot = null;
53
		if(element instanceof TerminologyElement){
54
			TerminologyElement terminoEl = (TerminologyElement) element;
55
			this.stringAnnotType = terminoEl.getReference();
56
		}
57
	}
58
	
59
	public AnnotationParameters(String [] strToAnnot, OccurrenceSet occSet,
60
										HashMap<String, Parameter> newParameters){
61
		super(newParameters, "Annotation");
62
		this.occSet = occSet;
63
		this.stringToAnnot = strToAnnot;
64
		this.element = null;
65
		this.stringAnnotType = null;
66
	}
67

  
68
	
69
	public TreeElement getAnnotationElement(){
70
		return this.element;
71
	}
72
	
73
	
74
	
75
	/////////////////////////////////////
76
	//SET--------------------------------
77
	public void indexOccOn(boolean edit){
78
		HashMap<String, Parameter> parameters = getParameters();
79
		if(parameters.containsKey(AnnotationParameters.ANNOTATION_INDEXOCC)){
80
			Parameter param = parameters.get(AnnotationParameters.ANNOTATION_INDEXOCC);
81
			param.setValue(edit);
82
		}
83
	}
84
	
85
	public void editOccOn(boolean edit){
86
		HashMap<String, Parameter> parameters = getParameters();
87
		if(parameters.containsKey(AnnotationParameters.ANNOTATION_EDITOCC)){
88
			Parameter param = parameters.get(AnnotationParameters.ANNOTATION_EDITOCC);
89
			param.setValue(edit);
90
		}
91
	}
92
	
93
	public void editTermOn(boolean edit){
94
		HashMap<String, Parameter> parameters = getParameters();
95
		if(parameters.containsKey(AnnotationParameters.ANNOTATION_EDITTERM)){
96
			Parameter param = parameters.get(AnnotationParameters.ANNOTATION_EDITTERM);
97
			param.setValue(edit);
98
		}
99
	}
100
	
101
	public void editTerminology(boolean terminoEdition){
102
		HashMap<String, Parameter> parameters = getParameters();
103
		if(parameters.containsKey(AnnotationParameters.ANNOTATION_EDITTERMINOLOGY)){
104
			Parameter param = parameters.get(AnnotationParameters.ANNOTATION_EDITTERMINOLOGY);
105
			param.setValue(terminoEdition);
106
		}
107
	}
108
	
109
	public void editNewChildEntry(boolean edit){
110
		HashMap<String, Parameter> parameters = getParameters();
111
		if(parameters.containsKey(AnnotationParameters.ANNOTATION_NEWENTRY)){
112
			Parameter param = parameters.get(AnnotationParameters.ANNOTATION_NEWENTRY);
113
			param.setValue(edit);
114
		}
115
	}
116
	
117
	public void editInfo(boolean edit){
118
		HashMap<String, Parameter> parameters = getParameters();
119
		if(parameters.containsKey(AnnotationParameters.ANNOTATION_EDITINFO)){
120
			Parameter param = parameters.get(AnnotationParameters.ANNOTATION_EDITINFO);
121
			param.setValue(edit);
122
		}
123
	}
124
	
125
	public void setAnnotationString(String [] newString){
126
		this.stringToAnnot = newString;
127
	}
128
	
129
	public void setAnnotationType(String type){
130
		stringAnnotType = type;
131
	}
132
	
133
	/*public void setAnnotationLocalisation(Localisation newLoc){
134
		//System.out.println("AnnotationParameters.setAnnotationLocalisation() "+newLoc.getLength());
135
		this.localisation = newLoc;
136
	}*/
137
	
138
	public void setAnnotationOccurrence(OccurrenceSet occurrenceSet){
139
		this.occSet = occurrenceSet;
140
	}
141
	
142
	public void setAnnotationElement(TreeElement newElement){
143
		this.element = newElement;
144
	}
145
	
146
	public void setParameters(OccurrenceSet occSet, String [] newString, String type,
147
			TreeElement newEl, boolean editTermino, boolean editTermOn, boolean editInfo, boolean indexOccOn,
148
			boolean editOccOn, boolean editNewChild){
149
		//this.setAnnotationLocalisation(newLoc);
150
		this.setAnnotationOccurrence(occSet);
151
		this.setAnnotationString(newString);
152
		this.setAnnotationType(type);
153
		this.setAnnotationElement(newEl);
154
		this.editTerminology(editTermino);
155
		this.editTermOn(editTermOn);
156
		this.editInfo(editInfo);
157
		this.editOccOn(editOccOn);
158
		this.indexOccOn(indexOccOn);
159
		this.editNewChildEntry(editNewChild);
160
	}
161
	
162
	/////////////////////////////////////
163
	//GET--------------------------------
164
	public boolean getOption(String name){
165
		HashMap<String, Parameter> parameters = getParameters();
166
		Parameter param =  parameters.get(name);
167
		return param.isValue();
168
	}
169
	
170

  
171
	public String getAnnotationType(){
172
		return stringAnnotType;
173
	}
174
	
175
	public OccurrenceSet getAnnotationOccurrence(){
176
		return occSet;
177
	}
178
	
179
	public String [] getAnnotationString(){
180
		return stringToAnnot;
181
	}
182
	
183
	/*public Localisation getAnnotationLocalisation(){
184
		return localisation;
185
	}*/
186
	
187
}
188

  
189

  
SRC/src/fr/triangle/hyperalign/kernel/TEITags.java (revision 2)
1
/*
2
 * Created on 15 juillet 2008
3
 */
4

  
5
package fr.triangle.hyperalign.kernel;
6

  
7
import org.jdom.Namespace;
8

  
9
import fr.triangle.hyperalign.io.XSLTags;
10

  
11
/**
12
 * Name : TEITags <br>
13
 * Description : The class represents the tags that can be found in
14
 *  TEI file
15
 * @author Severine Gedzelman
16
 */
17
public class TEITags {
18

  
19
	/**
20
	 * ATTRIBUTS
21
	 */
22
	
23
	public final static String TEI_XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
24
	public final static String TEI_TXM_NAMESPACE = "http://textometrie.org/1.0";
25
	public final static String TEI_XML = "xml";
26
	public final static String TEI_TXM = "txm";
27

  
28
	/**
29
	 * This static value corresponds to the TEI tag : "teiCorpus"
30
	 */
31
	public final static String TEI_CORPUS = "teiCorpus";
32
	/**
33
	 * This static value corresponds to the TEI tag : "type"
34
	 */
35
	public final static String TEI_TEI = "TEI";
36
	/**
37
	 * This static value corresponds to the TEI tag : "type"
38
	 */
39
	public final static String TEI_DIV = "div";
40
	
41
	/**
42
	 * This static value corresponds to the TEI tag : "witList"
43
	 */
44
	public final static String TEI_WITNESSLIST = "witList";
45
	/**
46
	 * This static value corresponds to the TEI tag : "witness"
47
	 */
48
	public final static String TEI_WITNESS = "witness";
49
	/**
50
	 * This static value corresponds to the TEI tag : "rdg"
51
	 */
52
	public final static String TEI_RDG = "rdg";
53
	/**
54
	 * This static value corresponds to the TEI tag : "lem"
55
	 */
56
	public final static String TEI_LEM = "lem";
57
	
58
	
59
	/**
60
	 * This static value corresponds to the TEI tag : "link"
61
	 */
62
	public final static String TEI_LINK = "link";
63
	/**
64
	 * This static value corresponds to the TEI tag : "key"
65
	 */
66
	public final static String TEI_KEY = "key";
67
	/**
68
	 * This static value corresponds to the TEI tag : "p"
69
	 */
70
	public final static String TEI_P = "p";
71
	/**
72
	 * This static value corresponds to the TEI tag : "note"
73
	 */
74
	public final static String TEI_NOTE = "note";
75
	/**
76
	 * This static value corresponds to the TEI tag : "linkGrp"
77
	 */
78
	public final static String TEI_LINKGROUP = "linkGrp";
79
	/**
80
	 * This static value corresponds to the TEI tag : "app"
81
	 */
82
	public final static String TEI_APP = "app";
83
	/**
84
	 * This static value corresponds to the TEI tag attribute : "sigil"
85
	 */
86
	public final static String TEI_SIGIL = "sigil";
87
	/**
88
	 * This static value corresponds to the TEI tag attribute : "wit"
89
	 */
90
	public final static String TEI_WIT = "wit";
91
	/**
92
	 * This static value corresponds to the TEI tag : "anchor"
93
	 */
94
	public final static String TEI_ANCHOR = "anchor";
95
	/**
96
	 * This static value corresponds to the TEI tag attribute : "subtype"
97
	 */
98
	public final static String TEI_SUBTYPE = "subtype"; //subtype="debut" ou "fin"
99
	
100
	
101
	//////////////////////////////////
102
	/**
103
	 * This static value corresponds to the TEI tag : "teiHeader"
104
	 */
105
	public final static String TEI_HEADER = "teiHeader";
106
	/**
107
	 * This static value corresponds to the TEI tag : "sourceDesc"
108
	 */
109
	public final static String TEI_SOURCEDESC = "sourceDesc";
110
	/**
111
	 * This static value corresponds to the TEI tag : "imprint"
112
	 */
113
	public final static String TEI_IMPRINT = "imprint";
114
	/**
115
	 * This static value corresponds to the TEI tag : "pubPlace"
116
	 */
117
	public final static String TEI_PLACE = "pubPlace";
118
	/**
119
	 * This static value corresponds to the TEI tag : "publisher"
120
	 */
121
	public final static String TEI_PUBLISHER = "publisher";
122
	/**
123
	 * This static value corresponds to the TEI tag : "date"
124
	 */
125
	public final static String TEI_DATE = "date";
126
	/**
127
	 * This static value corresponds to the TEI tag : "title"
128
	 */
129
	public final static String TEI_TITLE = "title";
130
	/**
131
	 * This static value corresponds to the TEI attribute tag : "lang"
132
	 */
133
	public final static String TEI_LANG = "lang";
134
	/**
135
	 * This static value corresponds to the TEI  tag : "language"
136
	 */
137
	public final static String TEI_LANGUAGE = "language";
138
	/**
139
	 * This static value corresponds to the TEI  tag : "language"
140
	 */
141
	public final static String TEI_LANGUSAGE = "langUsage";
142
	/**
143
	 * This static value corresponds to the TEI attribute tag : "xml:lang"
144
	 */
145
	public final static String TEI_XMLLANG = "xml:lang";
146
	/**
147
	 * This static value corresponds to the TEI attribute tag : "ana"
148
	 */
149
	public final static String TEI_ANA = "ana";
150
	/**
151
	 * This static value corresponds to the TEI tag : "biblStruct" dans "sourceDesc"
152
	 */
153
	public final static String TEI_BIBL = "biblStruct";
154
	/**
155
	 * This static value corresponds to the TEI attribute tag : "ident" dans "language"
156
	 */
157
	public final static String TEI_IDENT = "ident";
158
	/**
159
	 * This static value corresponds to the TEI attribute tag : "usage" dans "language"
160
	 */
161
	public final static String TEI_USAGE = "usage";
162
	
163
	/**
164
	 * This static value corresponds to the TEI tag : "monogr" dans "sourceDesc"
165
	 */
166
	public final static String TEI_MONOGRAPH = "monogr";
167
	/**
168
	 * This static value corresponds to the TEI tag : "author" dans "sourceDesc"
169
	 */
170
	public final static String TEI_AUTHOR = "author";
171
	/**
172
	 * This static value corresponds to the TEI tag : "name" dans "respStmt"
173
	 */
174
	public final static String TEI_RESPNAME = "name";
175
	/**
176
	 * This static value corresponds to the TEI tag : "resp" dans "respStmt"
177
	 */
178
	public final static String TEI_RESP = "resp";
179
	
180
	//The FOUR TEI HEADER CATEGORIES !!
181
	/**
182
	 * This static value corresponds to the TEI tag : "fileDesc"
183
	 */
184
	public final static String TEI_FILEDESC = "fileDesc";
185
	/**
186
	 * This static value corresponds to the TEI tag : "encodingDesc"
187
	 */
188
	public final static String TEI_ENCODEDESC = "encodingDesc";
189
	/**
190
	 * This static value corresponds to the TEI tag : "profileDesc"
191
	 */
192
	public final static String TEI_PROFILEDESC = "profileDesc";
193
	/**
194
	 * This static value corresponds to the TEI tag : "revisionDesc"
195
	 */
196
	public final static String TEI_REVISIONDESC = "revisionDesc";
197
	
198
	/**
199
	 * This static value corresponds to the TEI tag : "p"
200
	 */
201
	public final static String TEI_PARA = "p";
202
	
203
	/////////////////////////////////////////////////////////
204
	//////////////////////////// FILE DESC //////////////////
205
	////////////////////////////////////////////////////////
206
	/**
207
	 * This static value corresponds to the TEI tag : "titleStmt"
208
	 */
209
	public final static String TEI_FILEDESC_TITLESTMT = "titleStmt";
210
	/**
211
	 * This static value corresponds to the TEI tag : "editionStmt"
212
	 */
213
	public final static String TEI_FILEDESC_EDSTMT = "editionStmt";
214
	/**
215
	 * This static value corresponds to the TEI tag : "extent"
216
	 */
217
	public final static String TEI_FILEDESC_EXTENT = "extent";
218
	/**
219
	 * This static value corresponds to the TEI tag : "publicationStmt"
220
	 */
221
	public final static String TEI_FILEDESC_PUBSTMT = "publicationStmt";
222
	/**
223
	 * This static value corresponds to the TEI tag : "seriesStmt"
224
	 */
225
	public final static String TEI_FILEDESC_SERIESTMT = "seriesStmt";
226
	/**
227
	 * This static value corresponds to the TEI tag : "notesStmt"
228
	 */
229
	public final static String TEI_FILEDESC_NOTESTMT = "notesStmt";
230
	
231
	public final static String TEI_RESPSTMT = "respStmt";
232
	public final static String TEI_SOURCEDESC_IMPRINT = "imprint";
233
	public final static String TEI_SOURCEDESC_CORRECTION = "correction";
234
	public final static String TEI_SOURCEDESC_NORMALIZATION = "normalization";
235
	public final static String TEI_SOURCEDESC_SEGMENTATION = "segmentation";
236
	public final static String TEI_SOURCEDESC_INTERPRETATION = "interpretation";
237
	/**
238
	 * This static value corresponds to the TEI tag : "sourceDesc"
239
	 */
240
	public final static String TEI_FILEDESC_SOURCEDESC = "sourceDesc";	
241
	///////////////////////////
242
	
243
	/////////////////////////////////////////////////////////
244
	//////////////////////////// ENCODING DESC //////////////////
245
	////////////////////////////////////////////////////////
246
	/**
247
	 * This static value corresponds to the TEI tag : "projectDesc"
248
	 */
249
	public final static String TEI_ENCODEDESC_PROJECTDESC = "projectDesc";
250
	/**
251
	 * This static value corresponds to the TEI tag : "editorialDecl"  
252
	 */
253
	public final static String TEI_ENCODEDESC_EDITODECL = "editorialDecl";
254
	/**
255
	 * This static value corresponds to the TEI tag : "editorialDecl" 
256
	 */
257
	public final static String TEI_ENCODEDESC_TAGSDECL = "tagsDecl";
258

  
259
	public final static String XML_TEXT = "text()";
260
	/**
261
	 * This static value corresponds to the TEI tag : "text"
262
	 */
263
	public final static String TEI_TEXT = "text";
264
	/**
265
	 * This static value corresponds to the TEI tag : "front"
266
	 */
267
	public final static String TEI_FRONT = "front";
268
	/**
269
	 * This static value corresponds to the TEI tag : "back"
270
	 */
271
	public final static String TEI_BACK = "back";
272
	/**
273
	 * This static value corresponds to the TEI tag : "body"
274
	 */
275
	public final static String TEI_BODY = "body";
276
	/**
277
	 * This static value corresponds to the TEI tag : "head"
278
	 */
279
	public final static String TEI_HEAD = "head";
280
	/**
281
	 * This static value corresponds to the TEI tag : "seg"
282
	 */
283
	public final static String TEI_SEG = "seg";
284
	/**
285
	 * This static value corresponds to the TEI tag : "milestone"
286
	 */
287
	public final static String TEI_MILESTONE = "milestone";
288
	
289
	/**
290
	 * This static value corresponds to the TEI attribute tag : "type" of the DIV tag
291
	 */
292
	public final static String TEI_TYPE = "type";
293
	
294
	/**
295
	 * This static value corresponds to the TEI attribute tag : "n" of the DIV tag
296
	 */
297
	public final static String TEI_N = "n";	
298
	
299
	/**
300
	 * This static value corresponds to the TEI attribute tag : "type" of the DIV tag
301
	 */
302
	public final static String TEI_XMLID = "xml:id";
303
	/**
304
	 * This static value corresponds to the TEI attribute tag : "id" of the MILESTONE tag
305
	 */
306
	public final static String TEI_ID = "id";
307
	/**
308
	 * This static value corresponds to the TEI attribute tag : "gi" of the MILESTONE tag
309
	 */
310
	public final static String TEI_GI = "gi";
311
	/**
312
	 * This static value corresponds to the TEI value : "alignment" for type attribute
313
	 */
314
	public final static String TEI_ALIGNMENT = "alignment";
315
	/**
316
	 * This static value corresponds to the TEI attribute tag : "targets"
317
	 */
318
	public final static String TEI_TARGETS = "targets";	
319
	
320
	
321
	/************************DICTIONNAIRE***************************/
322
	/**
323
	 * This static value corresponds to the TEI tag : "entry"
324
	 */
325
	public final static String TEI_DICT_ENTRY = "entry";
326
	/**
327
	 * This static value corresponds to the TEI tag : "form"
328
	 */
329
	public final static String TEI_DICT_FORM = "form";
330
	/**
331
	 * This static value corresponds to the TEI tag : "orth"
332
	 */
333
	public final static String TEI_DICT_ORTH = "orth";
334
	/**
335
	 * This static value corresponds to the TEI tag : "gramGrp"
336
	 */
337
	public final static String TEI_DICT_GRAM = "gramGrp";
338
	/**
339
	 * This static value corresponds to the TEI tag : "pos"
340
	 */
341
	public final static String TEI_DICT_POS = "pos";
342
	/**
343
	 * This static value corresponds to the TEI tag : "sense"
344
	 */
345
	public final static String TEI_DICT_SENSE = "sense";
346
	/**
347
	 * This static value corresponds to the TEI tag : "def"
348
	 */
349
	public final static String TEI_DEF = "def";
350
	
351
	
352
	/**
353
	 * This static value corresponds to the TXM tag : "applicationDesc"
354
	 */
355
	public final static String TXM_APPLIDESC = "applicationDesc";
356
	/**
357
	 * This static value corresponds to the TXM tag : "application"
358
	 */
359
	public final static String TXM_APPLI = "application";
360
	/**
361
	 * This static value corresponds to the TXM tag : "commandLine"
362
	 */
363
	public final static String TXM_COMMANDLINE = "commandLine";
364
	/**
365
	 * This static value corresponds to the TXM tag : "os"
366
	 */
367
	public final static String TXM_OS = "os";
368
	/**
369
	 * This static value corresponds to the TXM tag : "osSeparator"
370
	 */
371
	public final static String TXM_OSSEPARATOR = "osSeparator";
372
	/**
373
	 * This static value corresponds to the TXM tag : "program"
374
	 */
375
	public final static String TXM_PROGRAM = "program";
376
	/**
377
	 * This static value corresponds to the TXM tag : "args"
378
	 */
379
	public final static String TXM_ARGS = "args";
380
	/**
381
	 * This static value corresponds to the TXM tag : "arg"
382
	 */
383
	public final static String TXM_ARG = "arg";
384
	/**
385
	 * This static value corresponds to the TXM tag : "ab"
386
	 */
387
	public final static String TXM_AB = "ab";
388
	/**
389
	 * This static value corresponds to the TXM tag : "list"
390
	 */
391
	public final static String TXM_LIST = "list";
392
	/**
393
	 * This static value corresponds to the TXM tag : "align"
394
	 */
395
	public final static String TXM_ALIGN = "align";
396
	/**
397
	 * This static value corresponds to the TXM tag : "item"
398
	 */
399
	public final static String TXM_ITEM = "item";
400
	/**
401
	 * This static value corresponds to the TXM tag : "ref"
402
	 */
403
	public final static String TXM_REF = "ref";
404
	/**
405
	 * This static value corresponds to the TXM tag : "metadata"
406
	 */
407
	public final static String TXM_METADATA = "metadata";
408
	/**
409
	 * This static value corresponds to the TXM attribute tag : "name"
410
	 */
411
	public final static String TXM_NAME = "name";
412
	/**
413
	 * This static value corresponds to the TXM attribute tag : "value"
414
	 */
415
	public final static String TXM_VALUE = "value";
416
	/**
417
	 * This static value corresponds to the TXM tag : "form"
418
	 */
419
	public final static String TXM_FORM = "form";
420
	/**
421
	 * This static value corresponds to the TXM tag : "w"
422
	 */
423
	public final static String TXM_WORD = "w";
424
	/**
425
	 * This static value corresponds to the TXM attribute tag : "ana"
426
	 */
427
	public final static String TXM_ANA = "ana";
428
	/**
429
	 * This static value corresponds to the TXM tag : "resp"
430
	 */
431
	public final static String TXM_RESP = "resp";
432
	/**
433
	 * This static value corresponds to the TXM tag : "type"
434
	 */
435
	public final static String TXM_TYPE = "type";
436
	/**
437
	 * This static value corresponds to the TXM attribute tag : "version"
438
	 */
439
	public final static String TXM_VERSION = "version";
440
	
441
	public final static String HM_LIST = "list";
442
	public final static String HM_CONCEPT = "concept";
443
	public final static String HM_TERM = "term";
444
	public final static String HM_TERMS = "terms";
445
	public final static String HM_OCCS = "occurrences";
446
	public final static String HM_LOC = "localisation";
447
	public final static String HM_EQUIVALENCES = "equivalences";
448
	public final static String HM_EQUIVALENCE = "equivalence";
449
	public final static String HM_ATT_NAME = "name";
450
	public final static String HM_ATT_ID = "id";
451
	public final static String HM_ATT_NB = "nb";
452
	public final static String HM_ATT_REF = "ref";
453
	
454
	public static Namespace TXM_NAMESPACE;
455
	public static Namespace XML_NAMESPACE;
456
	public static Namespace XSL_NAMESPACE;
457
	private static Namespace NAMESPACE;
458
	
459
	static public Namespace getXmlNamespace(){
460
		return XML_NAMESPACE;
461
	}
462
	
463
	static public Namespace getXslNamespace(){
464
		return XSL_NAMESPACE;
465
	}
466
	
467
	static public Namespace getTxmNamespace(){
468
		return TXM_NAMESPACE;
469
	}
470
	
471
	static public void setNamespace(String name, String ns){
472
		NAMESPACE = Namespace.getNamespace(name, ns);
473
		if(name.equals(TEITags.TEI_XML)){
474
			XML_NAMESPACE = NAMESPACE;
475
		}
476
		if(name.equals(XSLTags.XSL_XSL)){
477
			XSL_NAMESPACE = NAMESPACE;
478
		}
479
		if(name.equals(TEITags.TEI_TXM)){
480
			TXM_NAMESPACE = NAMESPACE;
481
		}
482
	}
483
	
484
	static public void setXmlNamespace(Namespace xmlns){
485
		//System.out.println("=========== NAMESPACE XML is SET ===========");
486
		XML_NAMESPACE = xmlns;
487
	}
488
}
SRC/src/fr/triangle/hyperalign/kernel/Parameters.java (revision 2)
1
package fr.triangle.hyperalign.kernel;
2

  
3
import java.util.HashMap;
4

  
5
public class Parameters {
6
	
7
	HashMap<String, Parameter> parameters;
8
	String name;
9
	
10
	public Parameters(HashMap<String, Parameter> parameters, String name){
11
		this.parameters = parameters;
12
		this.name = name;
13
	}
14
	
15
	public HashMap<String, Parameter> getParameters(){
16
		return parameters;
17
	}
18
	
19
	public Parameter getParameter(String name){
20
		return parameters.get(name);
21
	}
22
	
23
	public String getName(){
24
		return name;
25
	}
26
	
27
	public void setName(String name){
28
		this.name = name;
29
	}
30

  
31
}
SRC/src/fr/triangle/hyperalign/kernel/cooc/NeighbourElement.java (revision 2)
1
package fr.triangle.hyperalign.kernel.cooc;
2

  
3
import java.awt.datatransfer.DataFlavor;
4
import java.awt.datatransfer.Transferable;
5
import java.awt.datatransfer.UnsupportedFlavorException;
6
import java.io.IOException;
7
import java.util.HashMap;
8
import java.util.Iterator;
9
import java.util.Set;
10
import java.util.Vector;
11

  
12
import fr.triangle.hyperalign.vocabulary.OccurrenceSet;
13

  
14
public class NeighbourElement implements Transferable {
15

  
16
	private NeighbourElement parent;
17
	private String name;
18
	private Vector<OccurrenceSet> occs;
19
	private HashMap<String, Vector<OccurrenceSet>> neighboursName;
20
	private HashMap<NeighbourElement, Integer> neighbours;
21
	private Vector<NeighbourElement> children = new Vector<NeighbourElement>(); 
22
	public boolean isRoot = false;
23
	private boolean rightNeighbour;
24
	private int level;
25
	
26
	public NeighbourElement(String name, Vector<NeighbourElement> neighbours, boolean rightNeighbour){
27
		this.name = name;
28
		this.isRoot = true;
29
		this.children = neighbours;
30
		this.rightNeighbour = rightNeighbour;
31
	}
32
	
33
	public NeighbourElement(String name, Vector<OccurrenceSet> occs, boolean isRoot, boolean rightNeighbour, int level){
34
		this.name = name;
35
		this.occs = occs;
36
		this.isRoot = isRoot;
37
		this.level = level;
38
		neighboursName = new HashMap<String,Vector<OccurrenceSet>>();
39
		neighbours = new HashMap<NeighbourElement, Integer>();
40
		this.rightNeighbour = rightNeighbour;
41
		if(rightNeighbour){
42
			computeNextNeighbour();
43
		}else {
44
			computePreviousNeighbour();
45
		}
46
	}
47
	
48
	public NeighbourElement(NeighbourElement parent, String name, Vector<OccurrenceSet> occs, boolean isRoot, boolean rightNeighbour, int level){
49
		this.parent = parent;
50
		this.name = name;
51
		this.occs = occs;
52
		this.isRoot = isRoot;
53
		this.level = level;
54
		neighboursName = new HashMap<String,Vector<OccurrenceSet>>();
55
		neighbours = new HashMap<NeighbourElement, Integer>();
56
		this.rightNeighbour = rightNeighbour;
57
		if(rightNeighbour){
58
			computeNextNeighbour();
59
		}else {
60
			computePreviousNeighbour();
61
		}
62
	}
63

  
64
	public boolean rightNeighbours(){
65
		return rightNeighbour;
66
	}
67
	
68
	public int getLevel(){
69
		return level;
70
	}
71
	
72
	private void computeNextNeighbour(){
73
		//System.out.println("------------------ computeNextNeighbour -----------------");
74
		for (int i = 0; i < occs.size(); i++) {
75
			OccurrenceSet occSet = occs.get(i);
76
			/*Occurrence occ = occSet.getLast();
77
			Occurrence newOcc = occ.getDivision().getVocabulary().buildNeighbourOccurrence(occ);
78
			Occurrence next = newOcc.hasNextWord();
79
			if(next!=null){
80
				if(neighboursName.containsKey(next.getValue())){
81
					occSet.addOccurrence(next);
82
					Vector<OccurrenceSet> occSetsIn = neighboursName.get(next.getValue());
83
					occSetsIn.add(occSet);
84
					//System.out.println("NeighbourElement.computeNextNeighbour() ADD TO ["+next.getValue()+"] "+occSetsIn.size()+" = "+occSet.toString()+" ("+occSet.getNbWords()+") AT "+occSet.getDivision().computeName());
85
				}else {
86
					Vector<OccurrenceSet> occSets = new Vector<OccurrenceSet>();
87
					occSet.addOccurrence(next);
88
					occSets.add(occSet);
89
					//System.out.println("NeighbourElement.computeNextNeighbour() NEW ["+next.getValue()+"] = "+occSet.toString()+" ("+occSet.getNbWords()+") AT "+occSet.getDivision().computeName());
90
					neighboursName.put(next.getValue(),occSets);
91
				}
92
			}*/
93
		}
94
	}
95
	
96
	private void computePreviousNeighbour(){
97
		//System.out.println("------------------ computeNextNeighbour -----------------");
98
		for (int i = 0; i < occs.size(); i++) {
99
			OccurrenceSet occSet = occs.get(i);
100
			/*Occurrence occ = occSet.getLast();
101
			Occurrence newOcc = occ.getDivision().getVocabulary().buildNeighbourOccurrence(occ);
102
			Occurrence previous = newOcc.hasPreviousWord();
103
			if(previous!=null){
104
				if(neighboursName.containsKey(previous.getValue())){
105
					occSet.addOccurrence(previous);
106
					Vector<OccurrenceSet> occSetsIn = neighboursName.get(previous.getValue());
107
					occSetsIn.add(occSet);
108
					//System.out.println("NeighbourElement.computeNextNeighbour() ADD TO ["+next.getValue()+"] "+occSetsIn.size()+" = "+occSet.toString()+" ("+occSet.getNbWords()+") AT "+occSet.getDivision().computeName());
109
				}else {
110
					Vector<OccurrenceSet> occSets = new Vector<OccurrenceSet>();
111
					occSet.addOccurrence(previous);
112
					occSets.add(occSet);
113
					//System.out.println("NeighbourElement.computeNextNeighbour() NEW ["+next.getValue()+"] = "+occSet.toString()+" ("+occSet.getNbWords()+") AT "+occSet.getDivision().computeName());
114
					neighboursName.put(previous.getValue(),occSets);
115
				}
116
			}*/
117
		}
118
	}
119

  
120
	public String getName(){
121
		return name;
122
	}
123
	
124
	public HashMap<String, Vector<OccurrenceSet>> getNeighboursOcc(){
125
		return neighboursName;
126
	}
127

  
128

  
129
	public HashMap<NeighbourElement,Integer> getNeighbours(){
130
		return neighbours;
131
	}
132
	
133
	public Vector<OccurrenceSet> getOccs(){
134
		return occs;
135
	}
136

  
137
	public void setNeighbours(HashMap<NeighbourElement,Integer> neighbours){
138
		this.neighbours = neighbours;
139
		///ADD AS CHILREN
140
		this.children = new Vector<NeighbourElement>();
141
		Set<NeighbourElement> keys = neighbours.keySet();
142
		Iterator<NeighbourElement> it = keys.iterator();
143
		while(it.hasNext()){
144
			NeighbourElement el = it.next();
145
			//System.out.println("\t child /"+el.getName()+"/ => "+neighbours.get(el));
146
			children.add(el);
147
		}
148
	}
149

  
150
	public void deleteChildren(){
151
		children = new Vector<NeighbourElement>();
152
	}
153

  
154
	public Vector<NeighbourElement> children() {
155
		return children;
156
	}
157

  
158
	//méthode surchargée
159
	/**
160
	 * 
161
	 */
162
	public String toString() {
163
		if(children.size()!=0){
164
			return this.name+" ("+children.size()+")";
165
		}else {
166
			return this.name;
167
		}
168
	}
169
	
170
	public NeighbourElement getParent() {
171
		return parent;
172
	}
173

  
174
	public NeighbourElement getChild(String element){
175
		for(int i = 0 ; i < children.size(); ++i){
176
			NeighbourElement child = (NeighbourElement) children.get(i);
177
			if (child.toString().equals(element)){
178
				return child;
179
			}
180
		}
181
		return null;
182
	}
183

  
184

  
185
	public NeighbourElement getChildAt(int index) {
186
		if (children.size()!=0) {
187
			return (NeighbourElement) children.elementAt(index);
188
		}
189
		return null;
190
	}
191

  
192
	public int getChildCount() {
193
		if (children == null) {
194
			return 0;
195
		} else {
196
			return children.size();
197
		}
198
	}
199

  
200
	public void addChild(NeighbourElement childNode, int childCount) {
201
		Vector<NeighbourElement> newChildren = new Vector<NeighbourElement>();
202
		
203
		boolean done = false;
204
		if(children.size()!=0){
205
			for(int i = 0 ; i < children.size() ; ++i){
206
				NeighbourElement child = (NeighbourElement) children.get(i);
207
				int dist = child.toString().compareTo(childNode.toString());
208
				if(dist<0){
209
					newChildren.add(child);
210
					
211
					int end = children.size()-1;
212
					if(i==end){
213
						newChildren.add(childNode);
214
					}
215
				}else {
216
					if(!done){
217
						newChildren.add(childNode);
218
						done = true;
219
					}
220
					newChildren.add(child);
221
				}
222
			}
223
		}else {
224
			newChildren.add(childNode);
225
		}
226
		children = newChildren;
227
	}
228
	
229
	public int getIndexOfChild(NeighbourElement element){
230
		if (children == null) return -1;
231
		String ref = element.toString();
232
		for(int i = 0 ; i < children.size();++i){
233
			NeighbourElement child = (NeighbourElement) children.get(i); 
234
			if(child.toString().equals(ref)){
235
				return i;
236
			}
237
		}
238
		return -1;
239
	}
240

  
241
	public void removeChild(NeighbourElement elementToRemove){
242
		int index = getIndexOfChild(elementToRemove);
243
		children.remove(index);
244
	}
245

  
246
	@Override
247
	public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
248
		if(!isDataFlavorSupported(flavor))	throw new UnsupportedFlavorException(flavor);
249
		else return this;
250
		
251
	}
252

  
253
	@Override
254
	public DataFlavor[] getTransferDataFlavors() {
255
		DataFlavor temp=null;
256
		try{
257
			temp=new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType);
258
		}
259
		catch(ClassNotFoundException ex) {}
260
		DataFlavor[] retour=new DataFlavor[1];
261
		retour[0]=temp;
262
		return retour;
263
	}
264

  
265
	@Override
266
	public boolean isDataFlavorSupported(DataFlavor flavor) {
267
		DataFlavor temp=null;
268
		try{
269
			temp=new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType);
270
		}
271
		catch(ClassNotFoundException ex) {}
272
		return (flavor.equals(temp));
273
	}
274
}
SRC/src/fr/triangle/hyperalign/kernel/DataManager.java (revision 2)
1
package fr.triangle.hyperalign.kernel;
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff