134
140
<!-- options-end -->
136
142
* @author fracpete (fracpete at waikato dot ac dot nz)
137
* @version $Revision: 1.3 $
143
* @version $Revision: 1.5 $
138
144
* @see Capabilities
139
145
* @see Capabilities.Capability
140
146
* @see GenericPropertiesCreator
142
148
public class FindWithCapabilities
143
implements OptionHandler, CapabilitiesHandler {
149
implements OptionHandler, CapabilitiesHandler, RevisionHandler {
145
/** the capabilities to look for */
151
/** the capabilities to look for. */
146
152
protected Capabilities m_Capabilities = new Capabilities(this);
148
/** the capabilities to look for to "not have" */
154
/** the capabilities to look for to "not have". */
149
155
protected Capabilities m_NotCapabilities = new Capabilities(this);
151
/** the packages to search in */
157
/** the packages to search in. */
152
158
protected Vector m_Packages = new Vector();
154
/** a capabilities handler to retrieve the capabilities from */
160
/** a capabilities handler to retrieve the capabilities from. */
155
161
protected CapabilitiesHandler m_Handler = null;
157
/** a file the capabilities can be based on */
163
/** a file the capabilities can be based on. */
158
164
protected String m_Filename = "";
160
/** the class index, in case the capabilities are based on a file */
166
/** the class index, in case the capabilities are based on a file. */
161
167
protected SingleIndex m_ClassIndex = new SingleIndex();
163
/** the superclass from the GenericPropertiesCreator to retrieve the packages from */
169
/** the superclass from the GenericPropertiesCreator to retrieve the packages from. */
164
170
protected String m_Superclass = "";
166
/** whether to use the GenericPropertiesCreator with the superclass */
172
/** whether to use the GenericPropertiesCreator with the superclass. */
167
173
protected boolean m_GenericPropertiesCreator = false;
169
/** the classes that matched */
175
/** the classes that matched. */
170
176
protected Vector m_Matches = new Vector();
172
/** the class that didn't match */
178
/** the class that didn't match. */
173
179
protected Vector m_Misses = new Vector();
219
225
"relational-class", 0, "-relational-class"));
221
227
result.addElement(new Option(
228
"\tMust handle missing class values.",
229
"missing-class-values", 0, "-missing-class-values"));
231
result.addElement(new Option(
222
232
"\tDoesn't need a class.",
223
233
"no-class", 0, "-no-class"));
251
261
"relational-atts", 0, "-relational-atts"));
253
263
result.addElement(new Option(
264
"\tMust handle missing attribute values.",
265
"missing-att-values", 0, "-missing-att-values"));
267
result.addElement(new Option(
254
268
"\tMust handle multi-instance data.",
255
269
"only-multiinstance", 0, "-only-multiinstance"));
371
385
enable(Capability.DATE_CLASS);
372
386
if (Utils.getFlag("relational-class", options))
373
387
enable(Capability.RELATIONAL_CLASS);
388
if (Utils.getFlag("missing-class-values", options))
389
enable(Capability.MISSING_CLASS_VALUES);
376
392
if (Utils.getFlag("not-nominal-class", options)) {
391
407
enableNot(Capability.DATE_CLASS);
392
408
if (Utils.getFlag("not-relational-class", options))
393
409
enableNot(Capability.RELATIONAL_CLASS);
410
if (Utils.getFlag("not-relational-class", options))
411
enableNot(Capability.RELATIONAL_CLASS);
412
if (Utils.getFlag("not-missing-class-values", options))
413
enableNot(Capability.MISSING_CLASS_VALUES);
396
416
if (Utils.getFlag("nominal-atts", options)) {
411
431
enable(Capability.DATE_ATTRIBUTES);
412
432
if (Utils.getFlag("relational-atts", options))
413
433
enable(Capability.RELATIONAL_ATTRIBUTES);
434
if (Utils.getFlag("missing-att-values", options))
435
enable(Capability.MISSING_VALUES);
415
437
if (Utils.getFlag("not-nominal-atts", options)) {
416
438
enableNot(Capability.NOMINAL_ATTRIBUTES);
430
452
enableNot(Capability.DATE_ATTRIBUTES);
431
453
if (Utils.getFlag("not-relational-atts", options))
432
454
enableNot(Capability.RELATIONAL_ATTRIBUTES);
455
if (Utils.getFlag("not-missing-att-values", options))
456
enableNot(Capability.MISSING_VALUES);
434
458
if (Utils.getFlag("only-multiinstance", options))
435
459
enable(Capability.ONLY_MULTIINSTANCE);
492
516
result.add("-date-class");
493
517
if (isEnabled(Capability.RELATIONAL_CLASS))
494
518
result.add("-relational-class");
519
if (isEnabled(Capability.MISSING_CLASS_VALUES))
520
result.add("-missing-class-values");
497
523
if (isEnabled(Capability.UNARY_ATTRIBUTES))
508
534
result.add("-date-atts");
509
535
if (isEnabled(Capability.RELATIONAL_ATTRIBUTES))
510
536
result.add("-relational-atts");
537
if (isEnabled(Capability.MISSING_VALUES))
538
result.add("-missing-att-values");
513
541
if (isEnabledNot(Capability.NO_CLASS))
526
554
result.add("-not-date-class");
527
555
if (isEnabledNot(Capability.RELATIONAL_CLASS))
528
556
result.add("-not-relational-class");
557
if (isEnabledNot(Capability.MISSING_CLASS_VALUES))
558
result.add("-not-missing-class-values");
530
560
if (isEnabledNot(Capability.UNARY_ATTRIBUTES))
531
561
result.add("-not-unary-atts");
541
571
result.add("-not-date-atts");
542
572
if (isEnabledNot(Capability.RELATIONAL_ATTRIBUTES))
543
573
result.add("-not-relational-atts");
574
if (isEnabledNot(Capability.MISSING_VALUES))
575
result.add("-not-missing-att-values");
545
577
if (isEnabled(Capability.ONLY_MULTIINSTANCE))
546
578
result.add("-only-multi-instance");
617
* returns the current filename for the dataset to base the capabilities on
655
* returns the current filename for the dataset to base the capabilities on.
657
* @return the filename of the dataset
619
659
public String getFilename() {
620
660
return m_Filename;
624
* sets the class index, -1 for none, first and last are also valid
664
* sets the class index, -1 for none, first and last are also valid.
666
* @param value the class index
626
668
public void setClassIndex(String value) {
627
669
if (value.equals("-1"))
634
* returns the current current class index, -1 if no class attribute
676
* returns the current current class index, -1 if no class attribute.
678
* @return the class index
636
680
public String getClassIndex() {
637
681
if (m_ClassIndex == null)