Révision 2412
| tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/CreateSubCorpus.java (revision 2412) | ||
|---|---|---|
| 58 | 58 |
* Command which creates a subcorpus from a Corpus @ author mdecorde. |
| 59 | 59 |
*/ |
| 60 | 60 |
public class CreateSubCorpus extends AbstractHandler {
|
| 61 |
|
|
| 61 |
|
|
| 62 | 62 |
/** The selection. */ |
| 63 | 63 |
private IStructuredSelection selection; |
| 64 |
|
|
| 65 |
/* (non-Javadoc) |
|
| 64 |
|
|
| 65 |
/* |
|
| 66 |
* (non-Javadoc) |
|
| 66 | 67 |
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
| 67 | 68 |
*/ |
| 68 | 69 |
@Override |
| ... | ... | |
| 70 | 71 |
|
| 71 | 72 |
selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); |
| 72 | 73 |
if (selection == null) {
|
| 73 |
System.out.println(TXMUIMessages.noSelectionForColon+HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
|
|
| 74 |
System.out.println(TXMUIMessages.noSelectionForColon + HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
|
|
| 74 | 75 |
return null; |
| 75 | 76 |
} |
| 76 | 77 |
Object firstElement = selection.getFirstElement(); |
| 77 | 78 |
|
| 78 | 79 |
if (!(firstElement instanceof CQPCorpus)) {
|
| 79 |
System.out.println(TXMUIMessages.selectionIsNotACorpusColon+firstElement);
|
|
| 80 |
System.out.println(TXMUIMessages.selectionIsNotACorpusColon + firstElement);
|
|
| 80 | 81 |
return null; |
| 81 | 82 |
} |
| 82 | 83 |
|
| 83 | 84 |
final CQPCorpus corpus = (CQPCorpus) firstElement; |
| 84 |
Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event) |
|
| 85 |
.getShell(); |
|
| 85 |
Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell(); |
|
| 86 | 86 |
final CreateSubcorpusDialog d = new CreateSubcorpusDialog(shell, corpus); |
| 87 | 87 |
int code = d.open(); |
| 88 | 88 |
if (code == Window.OK) {
|
| 89 |
JobHandler jobhandler = new JobHandler(NLS.bind( |
|
| 90 |
TXMUIMessages.creatingASubcorpusOnP0, corpus.getName())) {
|
|
| 89 |
JobHandler jobhandler = new JobHandler(NLS.bind(TXMUIMessages.creatingASubcorpusOnP0, corpus.getName())) {
|
|
| 90 |
|
|
| 91 | 91 |
@Override |
| 92 |
protected IStatus run(IProgressMonitor monitor) {
|
|
| 92 |
protected IStatus run(IProgressMonitor monitor) {
|
|
| 93 | 93 |
this.runInit(monitor); |
| 94 | 94 |
JobsTimer.start(); |
| 95 | 95 |
try {
|
| 96 | 96 |
monitor.beginTask(TXMUIMessages.creatingASubcorpusInTheSearchEngine, 100); |
| 97 | 97 |
final Subcorpus subcorpus; |
| 98 |
|
|
| 98 |
|
|
| 99 | 99 |
if (d.isAdvancedSelected() || d.isAssistedSelected()) {
|
| 100 | 100 |
CQLQuery q = new CQLQuery(d.getQuery()); |
| 101 |
System.out.println(NLS.bind(TXMUIMessages.computeSubCorpusOnP0QueryColonP1, |
|
| 102 |
corpus.getName(), q.getQueryString())); |
|
| 101 |
System.out.println(NLS.bind(TXMUIMessages.computeSubCorpusOnP0QueryColonP1, corpus.getName(), q.getQueryString())); |
|
| 103 | 102 |
subcorpus = corpus.createSubcorpus(q, d.getName()); |
| 104 |
}
|
|
| 103 |
} |
|
| 105 | 104 |
else {
|
| 106 | 105 |
System.out.println(NLS.bind(TXMUIMessages.computeSubCorpusOnP0StructsColonP1AmpPropsP2ColonP3, |
| 107 |
new Object[]{corpus.getName(), d.getStructuralUnit(),
|
|
| 108 |
d.getStructuralUnitProperty(), d.getValues()}));
|
|
| 106 |
new Object[] { corpus.getName(), d.getStructuralUnit(),
|
|
| 107 |
d.getStructuralUnitProperty(), d.getValues() }));
|
|
| 109 | 108 |
|
| 110 |
//Escape regex char of prop values |
|
| 111 |
//List<String> values = d.getValues(); |
|
| 112 |
//for(int i = 0 ; i < values.size() ; i++) |
|
| 113 |
// values.set(i, Query.addBackSlash(values.get(i)));
|
|
| 109 |
// Escape regex char of prop values
|
|
| 110 |
// List<String> values = d.getValues();
|
|
| 111 |
// for(int i = 0 ; i < values.size() ; i++)
|
|
| 112 |
// values.set(i, Query.addBackSlash(values.get(i)));
|
|
| 114 | 113 |
|
| 115 |
subcorpus = corpus.createSubcorpus(d |
|
| 116 |
.getStructuralUnit(), d |
|
| 117 |
.getStructuralUnitProperty(), |
|
| 114 |
subcorpus = corpus.createSubcorpus( |
|
| 115 |
d.getStructuralUnit(), d.getStructuralUnitProperty(), |
|
| 118 | 116 |
d.getValues(), d.getName()); |
| 119 |
|
|
| 120 | 117 |
} |
| 121 | 118 |
|
| 122 |
if(subcorpus == null) |
|
| 123 |
{
|
|
| 119 |
if (subcorpus == null) {
|
|
| 124 | 120 |
monitor.done(); |
| 125 | 121 |
System.out.println(TXMUIMessages.errorColonSubcorpusWasNotCreated); |
| 126 | 122 |
return Status.CANCEL_STATUS; |
| 127 | 123 |
} |
| 128 | 124 |
|
| 129 |
System.out.println(NLS.bind(TXMUIMessages.doneColonP0Created |
|
| 130 |
, subcorpus.getName())); |
|
| 125 |
System.out.println(NLS.bind(TXMUIMessages.doneColonP0Created, subcorpus.getName())); |
|
| 131 | 126 |
monitor.worked(50); |
| 132 |
|
|
| 127 |
|
|
| 133 | 128 |
monitor.subTask(TXMUIMessages.refreshingCorpora); |
| 134 | 129 |
syncExec(new Runnable() {
|
| 130 |
|
|
| 135 | 131 |
@Override |
| 136 | 132 |
public void run() {
|
| 137 | 133 |
CorporaView.refresh(); |
| 138 |
//System.out.println("expand");
|
|
| 134 |
// System.out.println("expand");
|
|
| 139 | 135 |
CorporaView.expand(subcorpus.getParent()); |
| 140 | 136 |
} |
| 141 | 137 |
}); |
| 142 |
|
|
| 138 |
|
|
| 143 | 139 |
monitor.worked(100); |
| 144 |
} catch (ThreadDeath td) {
|
|
| 140 |
} |
|
| 141 |
catch (ThreadDeath td) {
|
|
| 145 | 142 |
return Status.CANCEL_STATUS; |
| 146 |
} catch (CqiClientException e) {
|
|
| 143 |
} |
|
| 144 |
catch (CqiClientException e) {
|
|
| 147 | 145 |
org.txm.utils.logger.Log.printStackTrace(e); |
| 148 | 146 |
Log.severe(e.toString()); |
| 149 | 147 |
|
| 150 | 148 |
try {
|
| 151 | 149 |
System.out.println(NLS.bind(CQPSearchEngineCoreMessages.lastCQPErrorColon, CQPSearchEngine.getCqiClient().getLastCQPError())); |
| 152 |
} catch (Exception e1) {
|
|
| 153 |
System.out.println(TXMUIMessages.failedToGetLastCQPErrorColon+e1); |
|
| 150 |
} |
|
| 151 |
catch (Exception e1) {
|
|
| 152 |
System.out.println(TXMUIMessages.failedToGetLastCQPErrorColon + e1); |
|
| 154 | 153 |
org.txm.utils.logger.Log.printStackTrace(e1); |
| 155 | 154 |
} |
| 156 |
} finally {
|
|
| 155 |
} |
|
| 156 |
finally {
|
|
| 157 | 157 |
monitor.done(); |
| 158 | 158 |
JobsTimer.stopAndPrint(); |
| 159 |
}
|
|
| 159 |
} |
|
| 160 | 160 |
return Status.OK_STATUS; |
| 161 | 161 |
} |
| 162 | 162 |
}; |
| ... | ... | |
| 164 | 164 |
} |
| 165 | 165 |
return null; |
| 166 | 166 |
} |
| 167 |
|
|
| 168 |
} |
|
| 167 |
|
|
| 168 |
} |
|
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/actions/CreateSubcorpusDialog.java (revision 2412) | ||
|---|---|---|
| 61 | 61 |
public class CreateSubcorpusDialog extends Dialog {
|
| 62 | 62 |
// For the "simple" tab |
| 63 | 63 |
/** The selected structural unit. */ |
| 64 |
//private StructuralUnit selectedStructuralUnit; |
|
| 65 |
//List<StructuralUnitProperty> selectableStructuralUnitProperties = null; |
|
| 64 |
// private StructuralUnit selectedStructuralUnit;
|
|
| 65 |
// List<StructuralUnitProperty> selectableStructuralUnitProperties = null;
|
|
| 66 | 66 |
/** The selected structural unit property. */ |
| 67 |
//private StructuralUnitProperty selectedStructuralUnitProperty; |
|
| 68 |
|
|
| 67 |
// private StructuralUnitProperty selectedStructuralUnitProperty;
|
|
| 68 |
|
|
| 69 | 69 |
/** The selected values. */ |
| 70 |
//private List<String> selectedValues; |
|
| 71 |
|
|
| 70 |
// private List<String> selectedValues;
|
|
| 71 |
|
|
| 72 | 72 |
// For the assisted tab |
| 73 | 73 |
/** The simple and complex panels. */ |
| 74 | 74 |
SimpleSubcorpusPanel simplePanel; |
| 75 |
|
|
| 75 | 76 |
ComplexSubcorpusPanel complexPanel; |
| 76 |
|
|
| 77 |
|
|
| 77 | 78 |
// For the "advanced" tab |
| 78 | 79 |
/** The query text. */ |
| 79 | 80 |
private QueryWidget queryText; |
| 80 |
|
|
| 81 |
|
|
| 81 | 82 |
/** The query string. */ |
| 82 | 83 |
private String queryString; |
| 83 |
|
|
| 84 |
|
|
| 84 | 85 |
// for both tab |
| 85 | 86 |
/** The name. */ |
| 86 | 87 |
private Text name; |
| 87 |
|
|
| 88 |
|
|
| 88 | 89 |
/** The name string. */ |
| 89 | 90 |
private String nameString; |
| 90 |
|
|
| 91 |
|
|
| 91 | 92 |
/** The corpus. */ |
| 92 | 93 |
private CQPCorpus corpus; |
| 93 |
|
|
| 94 |
|
|
| 94 | 95 |
/** The is advanced selected. */ |
| 95 | 96 |
private boolean isAdvancedSelected = false; |
| 96 |
|
|
| 97 |
|
|
| 97 | 98 |
/** The assisted selected. */ |
| 98 | 99 |
private boolean assistedSelected = false; |
| 99 |
|
|
| 100 |
|
|
| 100 | 101 |
/** |
| 101 | 102 |
* Instantiates a new creates the subcorpus dialog. |
| 102 | 103 |
* |
| ... | ... | |
| 108 | 109 |
this.corpus = corpus; |
| 109 | 110 |
this.setShellStyle(this.getShellStyle() | SWT.RESIZE); |
| 110 | 111 |
} |
| 111 |
|
|
| 112 |
/* (non-Javadoc) |
|
| 112 |
|
|
| 113 |
/* |
|
| 114 |
* (non-Javadoc) |
|
| 113 | 115 |
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) |
| 114 | 116 |
*/ |
| 115 | 117 |
@Override |
| ... | ... | |
| 118 | 120 |
newShell.setText(TXMUIMessages.createSubcorpus); |
| 119 | 121 |
newShell.setMinimumSize(300, 300); |
| 120 | 122 |
} |
| 121 |
|
|
| 123 |
|
|
| 122 | 124 |
/** The structural units final. */ |
| 123 | 125 |
List<StructuralUnit> structuralUnitsFinal; |
| 124 |
|
|
| 126 |
|
|
| 125 | 127 |
/** The structural units combo. */ |
| 126 | 128 |
Combo structuralUnitsCombo; |
| 127 |
|
|
| 129 |
|
|
| 128 | 130 |
/** The property combo. */ |
| 129 | 131 |
Combo propertyCombo; |
| 130 |
|
|
| 132 |
|
|
| 131 | 133 |
/** The value combo. */ |
| 132 | 134 |
org.eclipse.swt.widgets.List valueCombo; |
| 133 |
|
|
| 134 |
/* (non-Javadoc) |
|
| 135 |
|
|
| 136 |
/* |
|
| 137 |
* (non-Javadoc) |
|
| 135 | 138 |
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) |
| 136 | 139 |
*/ |
| 137 | 140 |
@Override |
| 138 | 141 |
protected Control createDialogArea(Composite parent) {
|
| 139 |
|
|
| 142 |
|
|
| 140 | 143 |
Composite inclosing = new Composite(parent, SWT.NONE); |
| 141 | 144 |
// TODO : we just put a composite into another composite. Everything |
| 142 | 145 |
// should be directly put into parent |
| 143 | 146 |
GridLayout layout4inclosing = new GridLayout(1, true); |
| 144 | 147 |
inclosing.setLayout(layout4inclosing); |
| 145 | 148 |
inclosing.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); |
| 146 |
|
|
| 149 |
|
|
| 147 | 150 |
// name panel |
| 148 | 151 |
Composite nameComposite = new Composite(inclosing, SWT.NONE); |
| 149 | 152 |
nameComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); |
| 150 | 153 |
GridLayout layout4nameComposite = new GridLayout(2, false); |
| 151 | 154 |
nameComposite.setLayout(layout4nameComposite); |
| 152 |
|
|
| 155 |
|
|
| 153 | 156 |
Label nameLabel = new Label(nameComposite, SWT.NONE); |
| 154 | 157 |
nameLabel.setText(TXMUIMessages.ampNameColon); |
| 155 | 158 |
nameLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false)); |
| 156 |
|
|
| 159 |
|
|
| 157 | 160 |
name = new Text(nameComposite, SWT.BORDER); |
| 158 | 161 |
name.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); |
| 159 |
|
|
| 162 |
|
|
| 160 | 163 |
// Param panel |
| 161 | 164 |
final TabFolder tabFolder = new TabFolder(inclosing, SWT.NONE); |
| 162 | 165 |
tabFolder.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
| ... | ... | |
| 167 | 170 |
simplePanel = new SimpleSubcorpusPanel(tabFolder, SWT.NONE, this, corpus); |
| 168 | 171 |
simpleTab.setControl(simplePanel); |
| 169 | 172 |
|
| 170 |
//Second tab: assisted mode |
|
| 173 |
// Second tab: assisted mode
|
|
| 171 | 174 |
TabItem secondTab = new TabItem(tabFolder, SWT.NONE); |
| 172 | 175 |
secondTab.setText(TXMUIMessages.assisted); |
| 173 | 176 |
this.complexPanel = new ComplexSubcorpusPanel(tabFolder, SWT.NONE, this.corpus); |
| 174 | 177 |
secondTab.setControl(complexPanel); |
| 175 |
|
|
| 178 |
|
|
| 176 | 179 |
// Third tab: advanced mode |
| 177 | 180 |
TabItem advancedTab = new TabItem(tabFolder, SWT.NONE); |
| 178 | 181 |
advancedTab.setText(TXMUIMessages.advanced); |
| 179 |
|
|
| 182 |
|
|
| 180 | 183 |
Composite compositeForAdvanced = new Composite(tabFolder, SWT.NONE); |
| 181 | 184 |
advancedTab.setControl(compositeForAdvanced); |
| 182 |
|
|
| 185 |
|
|
| 183 | 186 |
GridLayout layoutForAdvanced = new GridLayout(3, false); |
| 184 | 187 |
compositeForAdvanced.setLayout(layoutForAdvanced); |
| 185 |
|
|
| 188 |
|
|
| 186 | 189 |
Label advancedPartLabel = new Label(compositeForAdvanced, SWT.NONE); |
| 187 | 190 |
advancedPartLabel.setText(TXMUIMessages.ampQuery); |
| 188 |
advancedPartLabel.setLayoutData(new GridData(GridData.END, |
|
| 189 |
GridData.CENTER, false, false)); |
|
| 190 |
|
|
| 191 |
advancedPartLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false)); |
|
| 192 |
|
|
| 191 | 193 |
queryText = new QueryWidget(compositeForAdvanced, SWT.DROP_DOWN); |
| 192 | 194 |
queryText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); |
| 193 | 195 |
GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false); |
| 194 | 196 |
gridData.widthHint = convertHeightInCharsToPixels(20); |
| 195 | 197 |
queryText.setLayoutData(gridData); |
| 196 |
|
|
| 198 |
|
|
| 197 | 199 |
// check the state of the OK button according to the change of tab |
| 198 | 200 |
// -------------------------------- |
| 199 |
|
|
| 201 |
|
|
| 200 | 202 |
tabFolder.addSelectionListener(new SelectionListener() {
|
| 203 |
|
|
| 201 | 204 |
@Override |
| 202 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 203 |
} |
|
| 204 |
|
|
| 205 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 206 |
|
|
| 205 | 207 |
@Override |
| 206 | 208 |
public void widgetSelected(SelectionEvent e) {
|
| 207 | 209 |
if (tabFolder.getSelectionIndex() == 0) {
|
| 208 | 210 |
isAdvancedSelected = false; |
| 209 | 211 |
assistedSelected = false; |
| 210 |
} else if (tabFolder.getSelectionIndex() == 1) {
|
|
| 212 |
} |
|
| 213 |
else if (tabFolder.getSelectionIndex() == 1) {
|
|
| 211 | 214 |
isAdvancedSelected = false; |
| 212 | 215 |
assistedSelected = true; |
| 213 |
}else {
|
|
| 216 |
} |
|
| 217 |
else {
|
|
| 214 | 218 |
isAdvancedSelected = true; |
| 215 | 219 |
assistedSelected = false; |
| 216 | 220 |
} |
| 217 | 221 |
} |
| 218 | 222 |
}); |
| 219 |
|
|
| 223 |
|
|
| 220 | 224 |
return tabFolder; |
| 221 | 225 |
} |
| 222 |
|
|
| 223 |
|
|
| 224 | 226 |
|
| 227 |
|
|
| 228 |
|
|
| 229 |
@Override |
|
| 225 | 230 |
public Button getButton(int id) {
|
| 226 | 231 |
return this.getButton(id); |
| 227 | 232 |
} |
| 228 |
|
|
| 229 |
/* (non-Javadoc) |
|
| 233 |
|
|
| 234 |
/* |
|
| 235 |
* (non-Javadoc) |
|
| 230 | 236 |
* @see org.eclipse.jface.dialogs.Dialog#okPressed() |
| 231 | 237 |
*/ |
| 232 | 238 |
@Override |
| 233 | 239 |
protected void okPressed() {
|
| 234 | 240 |
if (name.getText().length() == 0) {
|
| 235 | 241 |
String generated = "subcorpus"; //$NON-NLS-1$ |
| 236 |
|
|
| 242 |
|
|
| 237 | 243 |
System.out.println(TXMUIMessages.noSubcorpusNameWasSpecifiedWeveGeneratedOne); |
| 238 | 244 |
if (isAdvancedSelected()) {
|
| 239 |
generated += ""+(this.corpus.getSubcorpora().size()+1); //$NON-NLS-1$ |
|
| 240 |
} else if (assistedSelected) {
|
|
| 245 |
generated += "" + (this.corpus.getSubcorpora().size() + 1); //$NON-NLS-1$ |
|
| 246 |
} |
|
| 247 |
else if (assistedSelected) {
|
|
| 241 | 248 |
generated = this.complexPanel.getGeneratedName(); |
| 242 |
} else { // simple
|
|
| 243 |
generated = this.corpus.getName()+"_"+getStructuralUnitProperty().getFullName(); //$NON-NLS-1$ |
|
| 244 | 249 |
} |
| 245 |
//return; |
|
| 250 |
else { // simple
|
|
| 251 |
generated = this.corpus.getName() + "_" + getStructuralUnitProperty().getFullName(); //$NON-NLS-1$ |
|
| 252 |
} |
|
| 253 |
// return; |
|
| 246 | 254 |
name.setText(generated); |
| 247 | 255 |
} |
| 248 | 256 |
// test if a query has been set |
| 249 | 257 |
if ((isAdvancedSelected()) && queryText.getText().length() == 0) {
|
| 250 |
MessageDialog.openError(getShell(), |
|
| 251 |
TXMUIMessages.invalidQuery, |
|
| 252 |
TXMUIMessages.queryCannotBeLeftEmpty); |
|
| 258 |
MessageDialog.openError(getShell(), TXMUIMessages.invalidQuery, TXMUIMessages.queryCannotBeLeftEmpty); |
|
| 253 | 259 |
return; |
| 254 | 260 |
} |
| 255 |
|
|
| 261 |
|
|
| 256 | 262 |
queryString = queryText.getQueryString(); |
| 257 |
//queryText.memorize(); |
|
| 258 |
|
|
| 263 |
// queryText.memorize();
|
|
| 264 |
|
|
| 259 | 265 |
if (assistedSelected) {
|
| 260 |
//System.out.println("1 "+queryString);
|
|
| 266 |
// System.out.println("1 "+queryString);
|
|
| 261 | 267 |
queryString = this.complexPanel.getQueryFieldValue(); |
| 262 |
//System.out.println("2 "+queryString);
|
|
| 268 |
// System.out.println("2 "+queryString);
|
|
| 263 | 269 |
if (queryString == null || queryString.trim().length() == 0) {
|
| 264 | 270 |
queryString = this.complexPanel.getQueryString(); |
| 265 |
//System.out.println("3 "+queryString);
|
|
| 271 |
// System.out.println("3 "+queryString);
|
|
| 266 | 272 |
if (queryString == null || queryString.trim().length() == 0) {
|
| 267 |
MessageDialog.openError(getShell(), |
|
| 268 |
TXMUIMessages.invalidQuery, |
|
| 269 |
TXMUIMessages.queryCannotBeLeftEmpty); |
|
| 273 |
MessageDialog.openError(getShell(), TXMUIMessages.invalidQuery, TXMUIMessages.queryCannotBeLeftEmpty); |
|
| 270 | 274 |
return; |
| 271 | 275 |
} |
| 272 | 276 |
} |
| 273 | 277 |
} |
| 274 |
|
|
| 278 |
|
|
| 275 | 279 |
nameString = name.getText(); |
| 276 | 280 |
super.okPressed(); |
| 277 | 281 |
} |
| 278 |
|
|
| 282 |
|
|
| 279 | 283 |
/** |
| 280 | 284 |
* Tell if the user is using the "advanced" tab. |
| 281 | 285 |
* |
| ... | ... | |
| 284 | 288 |
public boolean isAdvancedSelected() {
|
| 285 | 289 |
return isAdvancedSelected; |
| 286 | 290 |
} |
| 287 |
|
|
| 291 |
|
|
| 288 | 292 |
/** |
| 289 | 293 |
* Tell if the user is using the "assisted" tab. |
| 290 | 294 |
* |
| ... | ... | |
| 293 | 297 |
public boolean isAssistedSelected() {
|
| 294 | 298 |
return assistedSelected; |
| 295 | 299 |
} |
| 296 |
|
|
| 300 |
|
|
| 297 | 301 |
/** |
| 298 | 302 |
* Gets the structural unit. |
| 299 | 303 |
* |
| 300 | 304 |
* @return the structural unit |
| 301 | 305 |
*/ |
| 302 | 306 |
public StructuralUnit getStructuralUnit() {
|
| 303 |
if (isAdvancedSelected()) |
|
| 304 |
throw new IllegalStateException( |
|
| 305 |
TXMUIMessages.cannotAskForTheSimpleTabWhenTheUserHasSelectedTheAdvancedTab);
|
|
| 307 |
if (isAdvancedSelected()) {
|
|
| 308 |
throw new IllegalStateException(TXMUIMessages.cannotAskForTheSimpleTabWhenTheUserHasSelectedTheAdvancedTab);
|
|
| 309 |
}
|
|
| 306 | 310 |
return simplePanel.selectedStructuralUnit; |
| 307 | 311 |
} |
| 308 |
|
|
| 312 |
|
|
| 309 | 313 |
/** |
| 310 | 314 |
* Gets the structural unit property. |
| 311 | 315 |
* |
| 312 | 316 |
* @return the structural unit property |
| 313 | 317 |
*/ |
| 314 | 318 |
public StructuralUnitProperty getStructuralUnitProperty() {
|
| 315 |
if (isAdvancedSelected()) |
|
| 316 |
throw new IllegalStateException( |
|
| 317 |
TXMUIMessages.cannotAskForTheSimpleTabWhenTheUserHasSelectedTheAdvancedTab);
|
|
| 319 |
if (isAdvancedSelected()) {
|
|
| 320 |
throw new IllegalStateException(TXMUIMessages.cannotAskForTheSimpleTabWhenTheUserHasSelectedTheAdvancedTab);
|
|
| 321 |
}
|
|
| 318 | 322 |
return simplePanel.selectedStructuralUnitProperty; |
| 319 | 323 |
} |
| 320 |
|
|
| 324 |
|
|
| 321 | 325 |
/** |
| 322 | 326 |
* Gets the values. |
| 323 | 327 |
* |
| 324 | 328 |
* @return the values |
| 325 | 329 |
*/ |
| 326 | 330 |
public List<String> getValues() {
|
| 327 |
if (isAdvancedSelected()) |
|
| 328 |
throw new IllegalStateException( |
|
| 329 |
TXMUIMessages.cannotAskForTheSimpleTabWhenTheUserHasSelectedTheAdvancedTab);
|
|
| 331 |
if (isAdvancedSelected()) {
|
|
| 332 |
throw new IllegalStateException(TXMUIMessages.cannotAskForTheSimpleTabWhenTheUserHasSelectedTheAdvancedTab);
|
|
| 333 |
}
|
|
| 330 | 334 |
return simplePanel.selectedValues; |
| 331 | 335 |
} |
| 332 |
|
|
| 336 |
|
|
| 333 | 337 |
/** |
| 334 | 338 |
* Gets the query. |
| 335 | 339 |
* |
| 336 | 340 |
* @return the query |
| 337 | 341 |
*/ |
| 338 | 342 |
public String getQuery() {
|
| 339 |
if (isAdvancedSelected() == false && isAssistedSelected() == false) |
|
| 340 |
throw new IllegalStateException( |
|
| 341 |
TXMUIMessages.cannotAskForTheSimpleTabWhenTheUserHasSelectedTheAdvancedTab);
|
|
| 343 |
if (isAdvancedSelected() == false && isAssistedSelected() == false) {
|
|
| 344 |
throw new IllegalStateException(TXMUIMessages.cannotAskForTheSimpleTabWhenTheUserHasSelectedTheAdvancedTab);
|
|
| 345 |
}
|
|
| 342 | 346 |
return queryString; |
| 343 | 347 |
} |
| 344 |
|
|
| 348 |
|
|
| 345 | 349 |
/** |
| 346 | 350 |
* Gets the name. |
| 347 | 351 |
* |
| ... | ... | |
| 350 | 354 |
public String getName() {
|
| 351 | 355 |
return nameString; |
| 352 | 356 |
} |
| 353 |
|
|
| 357 |
|
|
| 354 | 358 |
/** |
| 355 | 359 |
* Gets the sub corpus name. |
| 356 | 360 |
* |
| ... | ... | |
| 359 | 363 |
public String getSubCorpusName() {
|
| 360 | 364 |
return name.getText(); |
| 361 | 365 |
} |
| 362 |
} |
|
| 366 |
} |
|
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/PartitionComposer.java (revision 2412) | ||
|---|---|---|
| 56 | 56 |
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty; |
| 57 | 57 |
import org.txm.searchengine.cqp.corpus.query.CQLQuery; |
| 58 | 58 |
import org.txm.searchengine.cqp.corpus.query.QueryPart; |
| 59 |
import org.txm.searchengine.cqp.corpus.query.SubcorpusCQLQuery; |
|
| 60 |
|
|
| 59 | 61 |
// TODO: Auto-generated Javadoc |
| 60 | 62 |
/** |
| 61 | 63 |
* used for assisted mode of partition creation @ author mdecorde. |
| 62 | 64 |
*/ |
| 63 | 65 |
public class PartitionComposer extends Composite {
|
| 64 |
|
|
| 66 |
|
|
| 65 | 67 |
/** The self. */ |
| 66 | 68 |
PartitionComposer self; |
| 67 | 69 |
|
| ... | ... | |
| 73 | 75 |
|
| 74 | 76 |
/** The available list. */ |
| 75 | 77 |
org.eclipse.swt.widgets.List availableList; |
| 76 |
|
|
| 78 |
|
|
| 77 | 79 |
/** The parts. */ |
| 78 |
List<PartItem> parts = new ArrayList<PartItem>();
|
|
| 79 |
|
|
| 80 |
List<PartItem> parts = new ArrayList<>(); |
|
| 81 |
|
|
| 80 | 82 |
/** The corpus. */ |
| 81 | 83 |
CQPCorpus corpus; |
| 82 | 84 |
|
| ... | ... | |
| 85 | 87 |
|
| 86 | 88 |
/** The property. */ |
| 87 | 89 |
StructuralUnitProperty property; |
| 88 |
|
|
| 90 |
|
|
| 89 | 91 |
/** The btn area. */ |
| 90 | 92 |
Composite parent, partArea, firstArea, dispoArea, btnArea; |
| 91 |
|
|
| 93 |
|
|
| 92 | 94 |
private ScrolledComposite sc1; |
| 93 |
|
|
| 95 |
|
|
| 94 | 96 |
/** |
| 95 | 97 |
* Instantiates a new partition composer. |
| 96 | 98 |
* |
| ... | ... | |
| 103 | 105 |
self = this; |
| 104 | 106 |
this.setLayout(new GridLayout(1, true)); |
| 105 | 107 |
this.corpus = corpus; |
| 106 |
|
|
| 108 |
|
|
| 107 | 109 |
firstArea = new Composite(this, SWT.NONE); |
| 108 | 110 |
firstArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, |
| 109 | 111 |
true, false)); |
| ... | ... | |
| 117 | 119 |
sc1 = new ScrolledComposite(this, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); |
| 118 | 120 |
sc1.setLayout(new GridLayout(1, true)); |
| 119 | 121 |
sc1.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
| 120 |
sc1.setExpandHorizontal( true );
|
|
| 121 |
sc1.setExpandVertical( true );
|
|
| 122 |
sc1.setMinSize( 0, 250 );
|
|
| 122 |
sc1.setExpandHorizontal(true);
|
|
| 123 |
sc1.setExpandVertical(true);
|
|
| 124 |
sc1.setMinSize(0, 250);
|
|
| 123 | 125 |
|
| 124 | 126 |
partArea = new Composite(sc1, SWT.NONE); |
| 125 | 127 |
sc1.setContent(partArea); |
| 126 | 128 |
partArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, |
| 127 | 129 |
true)); |
| 128 |
|
|
| 130 |
|
|
| 129 | 131 |
// struct&prop |
| 130 | 132 |
RowLayout layout = new RowLayout(); |
| 131 | 133 |
layout.center = true; |
| ... | ... | |
| 141 | 143 |
structCombo.add(su.getName()); |
| 142 | 144 |
} |
| 143 | 145 |
getStructure(); |
| 144 |
} catch (CqiClientException e) {
|
|
| 146 |
} |
|
| 147 |
catch (CqiClientException e) {
|
|
| 145 | 148 |
org.txm.utils.logger.Log.printStackTrace(e); |
| 146 | 149 |
return; |
| 147 | 150 |
} |
| 148 |
|
|
| 151 |
|
|
| 149 | 152 |
if (structCombo.getItemCount() > 0) {
|
| 150 | 153 |
structCombo.select(0); |
| 151 | 154 |
String[] items = structCombo.getItems(); |
| 152 |
for(int i = 0 ; i < items.length ; i++)
|
|
| 155 |
for (int i = 0; i < items.length; i++)
|
|
| 153 | 156 |
if (items[i].equals("text")) //$NON-NLS-1$
|
| 154 | 157 |
{
|
| 155 | 158 |
structCombo.select(i); |
| 156 | 159 |
break; |
| 157 | 160 |
} |
| 158 | 161 |
} |
| 159 |
|
|
| 162 |
|
|
| 160 | 163 |
structCombo.addSelectionListener(new SelectionListener() {
|
| 164 |
|
|
| 161 | 165 |
@Override |
| 162 | 166 |
public void widgetSelected(SelectionEvent e) {
|
| 163 | 167 |
reloadProperties(); |
| 164 | 168 |
updateDisplay(); |
| 165 | 169 |
} |
| 166 |
|
|
| 170 |
|
|
| 167 | 171 |
@Override |
| 168 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 169 |
} |
|
| 172 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 170 | 173 |
}); |
| 171 |
|
|
| 174 |
|
|
| 172 | 175 |
Label propLabel = new Label(firstArea, SWT.NONE); |
| 173 | 176 |
propLabel.setText(TXMCoreMessages.common_property); |
| 174 |
|
|
| 177 |
|
|
| 175 | 178 |
propCombo = new Combo(firstArea, SWT.READ_ONLY | SWT.SINGLE); |
| 176 | 179 |
reloadProperties(); |
| 177 |
|
|
| 180 |
|
|
| 178 | 181 |
propCombo.addSelectionListener(new SelectionListener() {
|
| 182 |
|
|
| 179 | 183 |
@Override |
| 180 | 184 |
public void widgetSelected(SelectionEvent e) {
|
| 181 | 185 |
reloadPropertyValues(); |
| 182 | 186 |
updateDisplay(); |
| 183 | 187 |
} |
| 184 |
|
|
| 188 |
|
|
| 185 | 189 |
@Override |
| 186 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 187 |
} |
|
| 190 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 188 | 191 |
}); |
| 189 |
|
|
| 192 |
|
|
| 190 | 193 |
// dispo |
| 191 | 194 |
GridLayout layout2 = new GridLayout(2, false); |
| 192 | 195 |
dispoArea.setLayout(layout2); |
| ... | ... | |
| 200 | 203 |
data.heightHint = 10 * availableList.getItemHeight(); |
| 201 | 204 |
availableList.setLayoutData(data); |
| 202 | 205 |
reloadPropertyValues(); |
| 203 |
|
|
| 206 |
|
|
| 204 | 207 |
// btn |
| 205 | 208 |
btnArea.setLayout(new RowLayout()); |
| 206 | 209 |
Button addPart = new Button(btnArea, SWT.PUSH); |
| 207 | 210 |
addPart.setText(TXMUIMessages.newPart); |
| 208 | 211 |
addPart.addSelectionListener(new SelectionListener() {
|
| 212 |
|
|
| 209 | 213 |
@Override |
| 210 | 214 |
public void widgetSelected(SelectionEvent e) {
|
| 211 |
//System.out.println(Messages.PartitionComposer_4); |
|
| 215 |
// System.out.println(Messages.PartitionComposer_4);
|
|
| 212 | 216 |
PartItem p = new PartItem(partArea, SWT.BORDER, self); |
| 213 | 217 |
GridData gdata = new GridData(GridData.FILL, GridData.FILL, true, true); |
| 214 | 218 |
gdata.minimumHeight = 200; |
| ... | ... | |
| 219 | 223 |
updateDisplay(); |
| 220 | 224 |
sc1.setMinSize(partArea.computeSize(SWT.DEFAULT, SWT.DEFAULT)); |
| 221 | 225 |
} |
| 222 |
|
|
| 226 |
|
|
| 223 | 227 |
@Override |
| 224 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 225 |
} |
|
| 228 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 226 | 229 |
}); |
| 227 | 230 |
Button rmvPart = new Button(btnArea, SWT.PUSH); |
| 228 | 231 |
rmvPart.setText(TXMUIMessages.rmvAllTheParts); |
| 229 | 232 |
rmvPart.addSelectionListener(new SelectionListener() {
|
| 233 |
|
|
| 230 | 234 |
@Override |
| 231 | 235 |
public void widgetSelected(SelectionEvent e) {
|
| 232 | 236 |
for (PartItem p : parts) {
|
| ... | ... | |
| 239 | 243 |
updateDisplay(); |
| 240 | 244 |
sc1.setMinSize(partArea.computeSize(SWT.DEFAULT, SWT.DEFAULT)); |
| 241 | 245 |
} |
| 242 |
|
|
| 246 |
|
|
| 243 | 247 |
@Override |
| 244 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 245 |
} |
|
| 248 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 246 | 249 |
}); |
| 247 | 250 |
// parts |
| 248 | 251 |
partArea.setLayout(new GridLayout(3, false)); |
| ... | ... | |
| 252 | 255 |
p.setLayoutData(gdata); |
| 253 | 256 |
p.setTitle(TXMUIMessages.part + (parts.size() + 1)); |
| 254 | 257 |
parts.add(p); |
| 255 |
|
|
| 258 |
|
|
| 256 | 259 |
} |
| 257 |
|
|
| 260 |
|
|
| 258 | 261 |
/** |
| 259 | 262 |
* Update display. |
| 260 | 263 |
*/ |
| ... | ... | |
| 266 | 269 |
super.getParent().layout(); |
| 267 | 270 |
super.getParent().getParent().layout(); |
| 268 | 271 |
} |
| 269 |
|
|
| 272 |
|
|
| 270 | 273 |
/** |
| 271 | 274 |
* Reload properties. |
| 272 | 275 |
*/ |
| ... | ... | |
| 278 | 281 |
List<StructuralUnitProperty> sups = su.getOrderedProperties(); |
| 279 | 282 |
Collections.sort(sups); |
| 280 | 283 |
for (StructuralUnitProperty sup : sups) {
|
| 281 |
if (su.getName().equals("text") && (sup.getName().equals("base") || sup.getName().equals("project")) ) continue;
|
|
| 284 |
if (su.getName().equals("text") && (sup.getName().equals("base") || sup.getName().equals("project"))) continue;
|
|
| 282 | 285 |
|
| 283 | 286 |
propCombo.add(sup.getName()); |
| 284 | 287 |
} |
| ... | ... | |
| 286 | 289 |
if (propCombo.getItemCount() > 0) {
|
| 287 | 290 |
propCombo.select(0); |
| 288 | 291 |
String[] items = propCombo.getItems(); |
| 289 |
for (int i = 0 ; i < items.length ; i++)
|
|
| 292 |
for (int i = 0; i < items.length; i++)
|
|
| 290 | 293 |
if (items[i].equals("id")) { //$NON-NLS-1$
|
| 291 | 294 |
propCombo.select(i); |
| 292 | 295 |
break; |
| 293 | 296 |
} |
| 294 | 297 |
} |
| 295 | 298 |
propCombo.layout(); |
| 296 |
|
|
| 299 |
|
|
| 297 | 300 |
reloadPropertyValues(); |
| 298 | 301 |
} |
| 299 |
|
|
| 302 |
|
|
| 300 | 303 |
/** |
| 301 | 304 |
* Removes the. |
| 302 | 305 |
* |
| ... | ... | |
| 307 | 310 |
this.availableList.remove(s); |
| 308 | 311 |
availableList.update(); |
| 309 | 312 |
} |
| 310 |
|
|
| 313 |
|
|
| 311 | 314 |
/** |
| 312 | 315 |
* Adds the. |
| 313 | 316 |
* |
| ... | ... | |
| 317 | 320 |
this.availableList.add(s); |
| 318 | 321 |
availableList.update(); |
| 319 | 322 |
} |
| 320 |
|
|
| 323 |
|
|
| 321 | 324 |
/** |
| 322 | 325 |
* Reload property values. |
| 323 | 326 |
*/ |
| ... | ... | |
| 333 | 336 |
for (int i = 0; i < plist.size(); i++) {
|
| 334 | 337 |
items[i] = plist.get(i); |
| 335 | 338 |
} |
| 336 |
} catch (CqiClientException e) {
|
|
| 339 |
} |
|
| 340 |
catch (CqiClientException e) {
|
|
| 337 | 341 |
org.txm.utils.logger.Log.printStackTrace(e); |
| 338 | 342 |
return; |
| 339 | 343 |
} |
| 340 |
|
|
| 344 |
|
|
| 341 | 345 |
availableList.setItems(items); |
| 342 | 346 |
availableList.setSize(400, 300); |
| 343 |
|
|
| 347 |
|
|
| 344 | 348 |
for (PartItem p : parts) {
|
| 345 | 349 |
p.removeAll(); |
| 346 | 350 |
} |
| ... | ... | |
| 349 | 353 |
self.layout(true); |
| 350 | 354 |
self.getParent().layout(true); |
| 351 | 355 |
} |
| 352 |
|
|
| 356 |
|
|
| 353 | 357 |
/** |
| 354 | 358 |
* Gets the structure. |
| 355 | 359 |
* |
| ... | ... | |
| 364 | 368 |
else |
| 365 | 369 |
return null; |
| 366 | 370 |
structure = corpus.getStructuralUnit(structCombo.getItem(index)); |
| 367 |
} catch (CqiClientException e) {
|
|
| 371 |
} |
|
| 372 |
catch (CqiClientException e) {
|
|
| 368 | 373 |
org.txm.utils.logger.Log.printStackTrace(e); |
| 369 | 374 |
return null; |
| 370 | 375 |
} |
| 371 | 376 |
return structure; |
| 372 | 377 |
} |
| 373 |
|
|
| 378 |
|
|
| 374 | 379 |
/** |
| 375 | 380 |
* Gets the property. |
| 376 | 381 |
* |
| ... | ... | |
| 388 | 393 |
property = structure.getProperty(propCombo.getItem(index)); |
| 389 | 394 |
return property; |
| 390 | 395 |
} |
| 391 |
|
|
| 396 |
|
|
| 392 | 397 |
/** |
| 393 | 398 |
* Gets the part queries. |
| 394 | 399 |
* |
| 395 | 400 |
* @return the part queries |
| 396 | 401 |
*/ |
| 397 | 402 |
public List<String> getPartQueries() {
|
| 398 |
ArrayList<String> queries = new ArrayList<String>();
|
|
| 403 |
ArrayList<String> queries = new ArrayList<>(); |
|
| 399 | 404 |
for (PartItem p : parts) |
| 400 | 405 |
queries.add(p.getQuery()); |
| 401 | 406 |
return queries; |
| 402 | 407 |
} |
| 403 |
|
|
| 408 |
|
|
| 404 | 409 |
/** |
| 405 | 410 |
* Gets the selection. |
| 406 | 411 |
* |
| ... | ... | |
| 409 | 414 |
public List<String> getSelection() {
|
| 410 | 415 |
return Arrays.asList(availableList.getSelection()); |
| 411 | 416 |
} |
| 412 |
|
|
| 417 |
|
|
| 413 | 418 |
/** |
| 414 | 419 |
* The Class PartItem. |
| 415 | 420 |
*/ |
| ... | ... | |
| 426 | 431 |
|
| 427 | 432 |
/** The self p. */ |
| 428 | 433 |
PartItem selfP; |
| 429 |
|
|
| 434 |
|
|
| 430 | 435 |
/** |
| 431 | 436 |
* Instantiates a new part item. |
| 432 | 437 |
* |
| ... | ... | |
| 439 | 444 |
selfP = this; |
| 440 | 445 |
this.composer = _composer; |
| 441 | 446 |
this.setLayout(new GridLayout(4, false)); |
| 442 |
|
|
| 447 |
|
|
| 443 | 448 |
Label titleLabel = new Label(this, SWT.NONE); |
| 444 | 449 |
titleLabel.setLayoutData(new GridData(GridData.FILL, |
| 445 | 450 |
GridData.CENTER, false, false, 1, 1)); |
| ... | ... | |
| 449 | 454 |
defaultFont.setStyle(SWT.BOLD); |
| 450 | 455 |
Font newf = new Font(titleLabel.getDisplay(), defaultFont); |
| 451 | 456 |
titleLabel.setFont(newf); |
| 452 |
|
|
| 457 |
|
|
| 453 | 458 |
title = new Text(this, SWT.BORDER); |
| 454 | 459 |
title.setLayoutData(new GridData(GridData.FILL, GridData.FILL, |
| 455 | 460 |
true, false, 2, 1)); |
| 456 |
|
|
| 461 |
|
|
| 457 | 462 |
Button delete = new Button(this, SWT.PUSH); |
| 458 | 463 |
delete.setImage(IImageKeys.getImage(IImageKeys.ACTION_DELETE)); |
| 459 | 464 |
delete.setLayoutData(new GridData(GridData.FILL, GridData.FILL, |
| 460 | 465 |
false, false, 1, 1)); |
| 461 | 466 |
delete.addSelectionListener(new SelectionListener() {
|
| 467 |
|
|
| 462 | 468 |
@Override |
| 463 | 469 |
public void widgetSelected(SelectionEvent e) {
|
| 464 | 470 |
PartItem p = selfP; |
| 465 |
|
|
| 471 |
|
|
| 466 | 472 |
for (String s : p.getColumns()) |
| 467 | 473 |
self.add(s); |
| 468 | 474 |
parts.remove(selfP); |
| 469 | 475 |
p.dispose(); |
| 470 |
|
|
| 476 |
|
|
| 471 | 477 |
availableList.update(); |
| 472 | 478 |
updateDisplay(); |
| 473 | 479 |
} |
| 474 |
|
|
| 480 |
|
|
| 475 | 481 |
@Override |
| 476 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 477 |
} |
|
| 482 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 478 | 483 |
}); |
| 479 | 484 |
Button add = new Button(this, SWT.PUSH); |
| 480 | 485 |
add.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, |
| 481 | 486 |
false, 2, 1)); |
| 482 | 487 |
add.setText(TXMUIMessages.assign); |
| 483 | 488 |
add.addSelectionListener(new SelectionListener() {
|
| 489 |
|
|
| 484 | 490 |
@Override |
| 485 | 491 |
public void widgetSelected(SelectionEvent e) {
|
| 486 |
//System.out.println(Messages.bind(Messages.PartitionComposer_10, composer.getSelection())); |
|
| 492 |
// System.out.println(Messages.bind(Messages.PartitionComposer_10, composer.getSelection()));
|
|
| 487 | 493 |
for (String s : composer.getSelection()) |
| 488 | 494 |
columns.add(s); |
| 489 | 495 |
composer.remove(composer.getSelection()); |
| ... | ... | |
| 493 | 499 |
composer.layout(true); |
| 494 | 500 |
updateDisplay(); |
| 495 | 501 |
} |
| 496 |
|
|
| 502 |
|
|
| 497 | 503 |
@Override |
| 498 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 499 |
} |
|
| 504 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 500 | 505 |
}); |
| 501 |
|
|
| 506 |
|
|
| 502 | 507 |
Button rmv = new Button(this, SWT.PUSH); |
| 503 | 508 |
rmv.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, |
| 504 | 509 |
false, 2, 1)); |
| 505 | 510 |
rmv.setText(TXMUIMessages.remove); |
| 506 | 511 |
rmv.addSelectionListener(new SelectionListener() {
|
| 512 |
|
|
| 507 | 513 |
@Override |
| 508 | 514 |
public void widgetSelected(SelectionEvent e) {
|
| 509 |
//System.out.println(Messages.bind(Messages.PartitionComposer_12, getSelection())); |
|
| 515 |
// System.out.println(Messages.bind(Messages.PartitionComposer_12, getSelection()));
|
|
| 510 | 516 |
for (String s : getSelection()) |
| 511 | 517 |
composer.add(s); |
| 512 |
|
|
| 518 |
|
|
| 513 | 519 |
for (String s : getSelection()) |
| 514 | 520 |
columns.remove(s); |
| 515 | 521 |
layout(true); |
| ... | ... | |
| 517 | 523 |
composer.getParent().layout(true); |
| 518 | 524 |
availableList.update(); |
| 519 | 525 |
updateDisplay(); |
| 520 |
|
|
| 526 |
|
|
| 521 | 527 |
} |
| 522 |
|
|
| 528 |
|
|
| 523 | 529 |
@Override |
| 524 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 525 |
} |
|
| 530 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
|
| 526 | 531 |
}); |
| 527 |
|
|
| 532 |
|
|
| 528 | 533 |
columns = new org.eclipse.swt.widgets.List(this, SWT.MULTI |
| 529 | 534 |
| SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL); |
| 530 | 535 |
columns.setLayoutData(new GridData(GridData.FILL, GridData.FILL, |
| 531 | 536 |
true, true, 4, 1)); |
| 532 | 537 |
columns.setSize(200, 300); |
| 533 | 538 |
} |
| 534 |
|
|
| 539 |
|
|
| 535 | 540 |
/** |
| 536 | 541 |
* Removes the all. |
| 537 | 542 |
*/ |
| 538 | 543 |
public void removeAll() {
|
| 539 | 544 |
columns.removeAll(); |
| 540 | 545 |
} |
| 541 |
|
|
| 546 |
|
|
| 542 | 547 |
/** |
| 543 | 548 |
* Sets the title. |
| 544 | 549 |
* |
| ... | ... | |
| 547 | 552 |
public void setTitle(String string) {
|
| 548 | 553 |
this.title.setText(string); |
| 549 | 554 |
} |
| 550 |
|
|
| 555 |
|
|
| 551 | 556 |
/** |
| 552 | 557 |
* Gets the columns. |
| 553 | 558 |
* |
| ... | ... | |
| 556 | 561 |
public String[] getColumns() {
|
| 557 | 562 |
return columns.getItems(); |
| 558 | 563 |
} |
| 559 |
|
|
| 564 |
|
|
| 560 | 565 |
/** |
| 561 | 566 |
* Gets the query. |
| 562 | 567 |
* |
| ... | ... | |
| 565 | 570 |
public String getQuery() {
|
| 566 | 571 |
return getSelection().toString(); |
| 567 | 572 |
} |
| 568 |
|
|
| 573 |
|
|
| 569 | 574 |
/** |
| 570 | 575 |
* Gets the selection. |
| 571 | 576 |
* |
| ... | ... | |
| 575 | 580 |
return Arrays.asList(columns.getSelection()); |
| 576 | 581 |
} |
| 577 | 582 |
} |
| 578 |
|
|
| 583 |
|
|
| 579 | 584 |
/** |
| 580 | 585 |
* Gets the partition. |
| 581 | 586 |
* |
| ... | ... | |
| 587 | 592 |
return null; |
| 588 | 593 |
} |
| 589 | 594 |
|
| 590 |
List<String> queries = new ArrayList<String>();
|
|
| 591 |
List<String> partnames = new ArrayList<String>();
|
|
| 595 |
List<String> queries = new ArrayList<>(); |
|
| 596 |
List<String> partnames = new ArrayList<>(); |
|
| 592 | 597 |
for (PartItem part : this.parts) {
|
| 593 | 598 |
if (part.columns.getItemCount() > 0) {
|
| 594 |
String value = ""; //$NON-NLS-1$ |
|
| 595 |
for (String s : part.columns.getItems()) |
|
| 596 |
value += CQLQuery.addBackSlash(s) + "|"; //$NON-NLS-1$ |
|
| 597 |
value = value.substring(0, value.length() - 1); |
|
| 598 |
QueryPart q = new QueryPart(structure, property, value); |
|
| 599 |
String regexp = ""; //$NON-NLS-1$ |
|
| 600 |
for (String s : part.columns.getItems()) {
|
|
| 601 |
regexp += CQLQuery.addBackSlash(s) + "|"; //$NON-NLS-1$ |
|
| 602 |
} |
|
| 603 |
regexp = regexp.substring(0, regexp.length() - 1); |
|
| 604 |
SubcorpusCQLQuery q = new SubcorpusCQLQuery(structure, property, regexp); |
|
| 599 | 605 |
queries.add(q.getQueryString()); |
| 600 | 606 |
partnames.add(part.title.getText()); |
| 601 | 607 |
} |
| 602 | 608 |
} |
| 603 |
|
|
| 609 |
|
|
| 604 | 610 |
try {
|
| 605 | 611 |
Partition p = new Partition(corpus); |
| 606 |
p.setParameters(name, queries, partnames); //$NON-NLS-1$
|
|
| 612 |
p.setParameters(name, queries, partnames); |
|
| 607 | 613 |
p.compute(); |
| 608 | 614 |
return p; |
| 609 |
} catch (Exception e) {
|
|
| 615 |
} |
|
| 616 |
catch (Exception e) {
|
|
| 610 | 617 |
org.txm.utils.logger.Log.printStackTrace(e); |
| 611 | 618 |
} |
| 612 | 619 |
return null; |
| 613 | 620 |
} |
| 614 |
|
|
| 621 |
|
|
| 615 | 622 |
/** |
| 616 | 623 |
* Checks for unassigned. |
| 617 | 624 |
* |
| ... | ... | |
| 620 | 627 |
public boolean hasUnassigned() {
|
| 621 | 628 |
return this.availableList.getItemCount() > 0; |
| 622 | 629 |
} |
| 623 |
|
|
| 630 |
|
|
| 624 | 631 |
public String getGeneratedName() {
|
| 625 | 632 |
// TODO Auto-generated method stub |
| 626 | 633 |
return null; |
| 627 | 634 |
} |
| 628 |
} |
|
| 635 |
} |
|
| tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java (revision 2412) | ||
|---|---|---|
| 241 | 241 |
for (String value : pValues) {
|
| 242 | 242 |
String partName = value.replace("\\", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
| 243 | 243 |
pPartNames.add(partName); |
| 244 |
CQLQuery query = new QueryPart(pProperty.getStructuralUnit(), pProperty, CQLQuery.addBackSlash(value)); // second option is faster
|
|
| 244 |
CQLQuery query = new QueryPart(pProperty.getStructuralUnit(), pProperty, value); // second option is faster
|
|
| 245 | 245 |
|
| 246 | 246 |
pQueries.add(query.getQueryString()); |
| 247 | 247 |
} |
| tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java (revision 2412) | ||
|---|---|---|
| 55 | 55 |
import org.txm.searchengine.cqp.corpus.query.Match; |
| 56 | 56 |
import org.txm.searchengine.cqp.corpus.query.CQLQuery; |
| 57 | 57 |
import org.txm.searchengine.cqp.corpus.query.QueryPart; |
| 58 |
import org.txm.searchengine.cqp.corpus.query.SubcorpusCQLQuery; |
|
| 58 | 59 |
import org.txm.searchengine.cqp.serverException.CqiServerError; |
| 59 | 60 |
import org.txm.utils.logger.Log; |
| 60 | 61 |
import org.w3c.dom.Element; |
| ... | ... | |
| 70 | 71 |
* @author Jean-Philippe Magué, Sylvain Loiseau |
| 71 | 72 |
*/ |
| 72 | 73 |
public abstract class CQPCorpus extends org.txm.objects.CorpusBuild implements CqpObject {
|
| 73 |
|
|
| 74 |
protected static HashMap<Class<?>, ArrayList<?>> cache = new HashMap<Class<?>, ArrayList<?>>();
|
|
| 75 |
|
|
| 74 |
|
|
| 75 |
protected static HashMap<Class<?>, ArrayList<?>> cache = new HashMap<>(); |
|
| 76 |
|
|
| 76 | 77 |
private static final int CACHE_MAXIMUM_SIZE = 5; |
| 77 |
|
|
| 78 |
|
|
| 78 | 79 |
/** The nocorpus. */ |
| 79 | 80 |
protected static int nocorpus = 1; |
| 80 |
|
|
| 81 |
|
|
| 81 | 82 |
/** The prefix r. */ |
| 82 | 83 |
protected static String prefixR = "Corpus"; //$NON-NLS-1$ |
| 84 |
|
|
| 83 | 85 |
private static Integer QUERY_COUNTER = new Integer(0); |
| 86 |
|
|
| 84 | 87 |
protected static Integer SUBCORPUS_COUNTER = new Integer(0); |
| 88 |
|
|
| 85 | 89 |
protected static String WORD = TXMPreferences.DEFAULT_UNIT_PROPERTY; |
| 86 |
|
|
| 90 |
|
|
| 87 | 91 |
public static final Comparator<WordProperty> wordFirstComparator = new Comparator<WordProperty>() {
|
| 92 |
|
|
| 88 | 93 |
@Override |
| 89 | 94 |
public int compare(WordProperty o1, WordProperty o2) {
|
| 90 | 95 |
if (o1.getName().equals("word"))
|
| ... | ... | |
| 94 | 99 |
return o1.compareTo(o2); |
| 95 | 100 |
} |
| 96 | 101 |
}; |
| 97 |
|
|
| 102 |
|
|
| 98 | 103 |
/** |
| 99 | 104 |
* store an object for a maximum of 5 object cached per object |
| 100 | 105 |
* |
| ... | ... | |
| 105 | 110 |
public static Object cache(Object toCache) {
|
| 106 | 111 |
if (toCache == null) |
| 107 | 112 |
return null; |
| 108 |
|
|
| 113 |
|
|
| 109 | 114 |
ArrayList<?> ocCache = getObjectCacheForClass(toCache.getClass()); |
| 110 | 115 |
if (ocCache.size() > CACHE_MAXIMUM_SIZE) {
|
| 111 | 116 |
ocCache.remove(0); // oldest value |
| 112 | 117 |
} |
| 113 | 118 |
return toCache; |
| 114 | 119 |
} |
| 115 |
|
|
| 120 |
|
|
| 116 | 121 |
/** |
| 117 | 122 |
* Returns the first parent object that is a Subcorpus, a Corpus or a |
| 118 | 123 |
* MainCorpus. Returns the object itself if its class is one of the the three |
| ... | ... | |
| 130 | 135 |
} |
| 131 | 136 |
return corpus; |
| 132 | 137 |
} |
| 138 |
|
|
| 133 | 139 |
public static String getNextQueryCounter() {
|
| 134 | 140 |
QUERY_COUNTER++; |
| 135 | 141 |
return QUERY_COUNTER.toString(); |
| ... | ... | |
| 137 | 143 |
|
| 138 | 144 |
/** |
| 139 | 145 |
* append the current timestamp to the subcorpus counter -> should avoid clash between subcorpus created between different TXM sessions |
| 146 |
* |
|
| 140 | 147 |
* @return |
| 141 | 148 |
*/ |
| 142 | 149 |
public static String getNextSubcorpusCounter() {
|
| 143 | 150 |
SUBCORPUS_COUNTER++; |
| 144 |
return ""+System.currentTimeMillis()+"_"+SUBCORPUS_COUNTER.toString();
|
|
| 151 |
return "" + System.currentTimeMillis() + "_" + SUBCORPUS_COUNTER.toString();
|
|
| 145 | 152 |
} |
| 146 |
|
|
| 153 |
|
|
| 147 | 154 |
/** |
| 148 | 155 |
* retrieve all cached objects for an object |
| 149 | 156 |
* |
| ... | ... | |
| 154 | 161 |
public static HashMap<Class<?>, ArrayList<?>> getObjectCache() {
|
| 155 | 162 |
return cache; |
| 156 | 163 |
} |
| 157 |
|
|
| 164 |
|
|
| 158 | 165 |
/** |
| 159 | 166 |
* retrieve all cached objects of a certain class for an object |
| 160 | 167 |
* |
| ... | ... | |
| 165 | 172 |
public static ArrayList<?> getObjectCacheForClass(Class<?> c) {
|
| 166 | 173 |
HashMap<Class<?>, ArrayList<?>> oCache = getObjectCache(); |
| 167 | 174 |
if (!oCache.containsKey(c)) {
|
| 168 |
oCache.put(c, new ArrayList<Object>());
|
|
| 175 |
oCache.put(c, new ArrayList<>()); |
|
| 169 | 176 |
} |
| 170 | 177 |
return oCache.get(c); |
| 171 | 178 |
} |
| 172 |
|
|
| 179 |
|
|
| 173 | 180 |
/** |
| 174 | 181 |
* Gets the main corpus parent. |
| 175 | 182 |
* |
| ... | ... | |
| 179 | 186 |
synchronized public static TXMResult getParentMainCorpus(TXMResult result) {
|
| 180 | 187 |
return result.getFirstParent(MainCorpus.class); |
| 181 | 188 |
} |
| 182 |
|
|
| 189 |
|
|
| 183 | 190 |
/** |
| 184 | 191 |
* remove a cached object |
| 185 | 192 |
* |
| ... | ... | |
| 190 | 197 |
public static ArrayList<?> uncache(Class classToUnCache) {
|
| 191 | 198 |
if (classToUnCache == null) |
| 192 | 199 |
return null; |
| 193 |
|
|
| 200 |
|
|
| 194 | 201 |
return cache.remove(classToUnCache); |
| 195 | 202 |
} |
| 196 |
|
|
| 203 |
|
|
| 197 | 204 |
/** |
| 198 | 205 |
* remove a cached object |
| 199 | 206 |
* |
| ... | ... | |
| 204 | 211 |
public static boolean uncache(Object toUnCache) {
|
| 205 | 212 |
if (toUnCache == null) |
| 206 | 213 |
return false; |
| 207 |
|
|
| 214 |
|
|
| 208 | 215 |
ArrayList<?> ocCache = getObjectCacheForClass(toUnCache.getClass()); |
| 209 | 216 |
return ocCache.remove(toUnCache); |
| 210 | 217 |
} |
| 211 |
|
|
| 218 |
|
|
| 212 | 219 |
/** All private infos of the corpus. */ |
| 213 | 220 |
protected String charset = "latin1"; //$NON-NLS-1$ |
| 214 |
|
|
| 221 |
|
|
| 215 | 222 |
/** |
| 216 | 223 |
* Gets the locale of the corpus. |
| 217 | 224 |
* |
| 218 | 225 |
* @return the locale |
| 219 | 226 |
*/ |
| 220 | 227 |
protected String lang = null; |
| 221 |
|
|
| 228 |
|
|
| 222 | 229 |
/** The corpus lexical units properties. */ |
| 223 | 230 |
protected List<WordProperty> lexicalUnitsProperties; |
| 224 |
|
|
| 231 |
|
|
| 225 | 232 |
/** The size in token */ |
| 226 | 233 |
protected int size = -1; |
| 227 |
|
|
| 234 |
|
|
| 228 | 235 |
/** The number of starting text. */ |
| 229 | 236 |
protected int nbtext = -1; |
| 230 |
|
|
| 237 |
|
|
| 231 | 238 |
protected int[] textEndLimits; |
| 232 |
|
|
| 239 |
|
|
| 233 | 240 |
/** The textids. */ |
| 234 | 241 |
protected HashMap<String, Integer> textids = null; |
| 235 | 242 |
|
| ... | ... | |
| 273 | 280 |
//// // FIXME: at this moment, store the CQPID as UUIDD for persistence tests |
| 274 | 281 |
//// this.uniqueID = this.pID; |
| 275 | 282 |
// } |
| 276 |
|
|
| 283 |
|
|
| 277 | 284 |
/** The corpus structural units. */ |
| 278 | 285 |
protected List<StructuralUnit> structuralUnits; |
| 279 |
|
|
| 286 |
|
|
| 280 | 287 |
/** The symbol. */ |
| 281 | 288 |
protected String symbol; |
| 282 |
|
|
| 289 |
|
|
| 283 | 290 |
protected StructuralUnitProperty textIdStructuralUnitProperty; |
| 284 | 291 |
// public HashSet<Object> getStoredData(Class class1) {
|
| 285 | 292 |
// |
| ... | ... | |
| 303 | 310 |
// HashSet<Object> hash = storedData.get(o.getClass()); |
| 304 | 311 |
// hash.add(o); |
| 305 | 312 |
// } |
| 306 |
|
|
| 313 |
|
|
| 307 | 314 |
protected int[] textLimits; |
| 308 |
|
|
| 315 |
|
|
| 309 | 316 |
protected StructuralUnit textStructuralUnit; |
| 310 |
|
|
| 317 |
|
|
| 311 | 318 |
protected WordProperty wordProperty = null; |
| 312 |
|
|
| 319 |
|
|
| 313 | 320 |
/** |
| 314 | 321 |
* |
| 315 | 322 |
* @param corpus |
| ... | ... | |
| 317 | 324 |
public CQPCorpus(CQPCorpus corpus) {
|
| 318 | 325 |
super(corpus); |
| 319 | 326 |
} |
| 320 |
|
|
| 327 |
|
|
| 321 | 328 |
/** |
| 322 | 329 |
* |
| 323 | 330 |
* @param partition |
| ... | ... | |
| 325 | 332 |
public CQPCorpus(Partition partition) {
|
| 326 | 333 |
super(partition); |
| 327 | 334 |
} |
| 328 |
|
|
| 335 |
|
|
| 329 | 336 |
/** |
| 330 | 337 |
* |
| 331 | 338 |
* @param project |
| ... | ... | |
| 333 | 340 |
protected CQPCorpus(Project project) {
|
| 334 | 341 |
super(project); |
| 335 | 342 |
} |
| 336 |
|
|
| 343 |
|
|
| 337 | 344 |
// /** |
| 338 | 345 |
// * Drop all the partitions. |
| 339 | 346 |
// * |
| ... | ... | |
| 347 | 354 |
// } |
| 348 | 355 |
// _partitions = null; |
| 349 | 356 |
// } |
| 350 |
|
|
| 357 |
|
|
| 351 | 358 |
/** |
| 352 | 359 |
* |
| 353 | 360 |
* @param parametersNodePath |
| ... | ... | |
| 355 | 362 |
public CQPCorpus(String parametersNodePath) {
|
| 356 | 363 |
super(parametersNodePath); |
| 357 | 364 |
} |
| 358 |
|
|
| 365 |
|
|
| 359 | 366 |
// /** |
| 360 | 367 |
// * Drops a partition. |
| 361 | 368 |
// * |
| ... | ... | |
| 375 | 382 |
// throw new CqiClientException(e); |
| 376 | 383 |
// } |
| 377 | 384 |
// } |
| 378 |
|
|
| 385 |
|
|
| 379 | 386 |
/* |
| 380 | 387 |
* (non-Javadoc) |
| 381 |
* |
|
| 382 | 388 |
* @see org.txm.objects.TxmObject#load() |
| 383 | 389 |
*/ |
| 390 |
@Override |
|
| 384 | 391 |
protected boolean _load(Element e) {
|
| 385 | 392 |
// System.out.println("*** Load corpus: "+name);
|
| 386 | 393 |
if (e == null) {
|
| 387 | 394 |
Log.warning(TXMCoreMessages.warningColonCantLoadCorpus + this); |
| 388 | 395 |
return false; |
| 389 | 396 |
} |
| 390 |
|
|
| 397 |
|
|
| 391 | 398 |
// 1- texts queries then |
| 392 | 399 |
// 2- get metadatas, pattributes, sattributes, editions, biblios, uis, |
| 393 | 400 |
super._load(e); |
| 394 | 401 |
// System.out.println("Load corpus : "+this.name);
|
| 395 | 402 |
// this.loadMetadata(); // read <prop>s |
| 396 |
|
|
| 403 |
|
|
| 397 | 404 |
// 3- build saved subcorpus and partition |
| 398 | 405 |
// System.out.println("restore subcorpora: "+selfElement);
|
| 399 | 406 |
NodeList preBuildElems = e.getElementsByTagName("preBuild"); //$NON-NLS-1$
|
| ... | ... | |
| 414 | 421 |
// + " : " + ex); //$NON-NLS-1$ |
| 415 | 422 |
// } |
| 416 | 423 |
} |
| 417 |
|
|
| 424 |
|
|
| 418 | 425 |
NodeList partitionElems = preBuildElem.getElementsByTagName("partition"); //$NON-NLS-1$
|
| 419 | 426 |
for (int i = 0; i < partitionElems.getLength(); i++) {
|
| 420 | 427 |
Element partitionElem = (Element) partitionElems.item(i); |
| 421 | 428 |
if (!partitionElem.getParentNode().equals(preBuildElem)) |
| 422 | 429 |
continue; // level 1 elements |
| 423 | 430 |
String name = partitionElem.getAttribute("name"); //$NON-NLS-1$
|
| 424 |
List<String> names = new ArrayList<String>();
|
|
| 425 |
List<String> queries = new ArrayList<String>();
|
|
| 426 |
|
|
| 431 |
List<String> names = new ArrayList<>(); |
|
| 432 |
List<String> queries = new ArrayList<>(); |
|
| 433 |
|
|
| 427 | 434 |
NodeList partElems = partitionElem.getElementsByTagName("part"); //$NON-NLS-1$
|
| 428 | 435 |
for (int j = 0; j < partElems.getLength(); j++) {
|
| 429 | 436 |
Element part = (Element) partElems.item(j); |
| ... | ... | |
| 435 | 442 |
// "+queries+", names "+names); |
| 436 | 443 |
Partition partition = new Partition(this); |
| 437 | 444 |
partition.setParameters(name, queries, names); |
| 438 |
|
|
| 445 |
|
|
| 439 | 446 |
// partition.setSelfElement(partitionElem); |
| 440 | 447 |
// partition.load(); |
| 441 | 448 |
// partition.compute(); |
| 442 |
} catch (Exception ex) {
|
|
| 449 |
} |
|
| 450 |
catch (Exception ex) {
|
|
| 443 | 451 |
Log.warning(this.pID + TXMCoreMessages.failedToRestorePartition + name + " : " + ex); //$NON-NLS-1$ |
| 444 | 452 |
// c.getParentNode().removeChild(c); |
| 445 | 453 |
} |
| 446 | 454 |
} |
| 447 | 455 |
} |
| 448 |
|
|
| 456 |
|
|
| 449 | 457 |
// 4- initialize JPA persistence of annotations |
| 450 | 458 |
// try {
|
| 451 | 459 |
// AnnotationManager.getInstance().initTemporaryAnnotationDatabase(this); |
| ... | ... | |
| 456 | 464 |
// |
| 457 | 465 |
return true; |
| 458 | 466 |
} |
| 459 |
|
|
| 467 |
|
|
| 460 | 468 |
/** |
| 461 | 469 |
* Empty the corpus cache |
| 462 | 470 |
*/ |
| ... | ... | |
| 477 | 485 |
textStructuralUnit = null; |
| 478 | 486 |
wordProperty = null; |
| 479 | 487 |
} |
| 480 |
|
|
| 488 |
|
|
| 481 | 489 |
/** |
| 482 | 490 |
* recursive method to clone a result |
| 483 | 491 |
* |
| ... | ... | |
| 486 | 494 |
* @param all |
| 487 | 495 |
* @return |
| 488 | 496 |
*/ |
| 497 |
@Override |
|
| 489 | 498 |
protected TXMResult clone(TXMResult newParent, boolean all) {
|
| 490 | 499 |
CQPCorpus c = (CQPCorpus) super.clone(newParent, all); |
| 491 | 500 |
c.pID = "S" + getNextSubcorpusCounter(); |
| 492 | 501 |
return c; |
| 493 | 502 |
} |
| 494 |
|
|
| 503 |
|
|
| 495 | 504 |
@Override |
| 496 | 505 |
public int compareTo(TXMResult o) {
|
| 497 | 506 |
// Compare node weights |
| ... | ... | |
| 507 | 516 |
} |
| 508 | 517 |
return output; |
| 509 | 518 |
} |
| 510 |
|
|
| 519 |
|
|
| 511 | 520 |
/** |
Formats disponibles : Unified diff