Java Code Examples for weka.core.Tag

The following are top voted examples for showing how to use weka.core.Tag. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: repo.kmeanspp.silhouette_score   File: Vote.java   Source Code and License 6 votes vote down vote up
/**
 * Returns an enumeration describing the available options.
 * 
 * @return an enumeration of all the available options.
 */
@Override
public Enumeration<Option> listOptions() {

  Vector<Option> result = new Vector<Option>();

  result.addElement(new Option(
    "\tFull path to serialized classifier to include.\n"
      + "\tMay be specified multiple times to include\n"
      + "\tmultiple serialized classifiers. Note: it does\n"
      + "\tnot make sense to use pre-built classifiers in\n"
      + "\ta cross-validation.", "P", 1, "-P <path to serialized "
      + "classifier>"));

  result.addElement(new Option("\tThe combination rule to use\n"
    + "\t(default: AVG)", "R", 1, "-R " + Tag.toOptionList(TAGS_RULES)));

  result.addElement(new Option(
    "\tSuppress the printing of the individual models in the output",
    "do-not-print", 0, "-do-not-print"));

  result.addAll(Collections.list(super.listOptions()));

  return result.elements();
}
 
Example 2
Project: repo.kmeanspp.silhouette_score   File: SerializedModelSaverCustomizer.java   Source Code and License 6 votes vote down vote up
private void setUpFileFormatComboBox() {
  m_fileFormatBox = new JComboBox();
  for (int i = 0; i < SerializedModelSaver.s_fileFormatsAvailable.size(); i++) {
    Tag temp = SerializedModelSaver.s_fileFormatsAvailable.get(i);
    m_fileFormatBox.addItem(temp);
  }

  Tag result = m_smSaver.validateFileFormat(m_smSaver.getFileFormat());
  if (result == null) {
    m_fileFormatBox.setSelectedIndex(0);
  } else {
    m_fileFormatBox.setSelectedItem(result);
  }

  /*
   * m_fileFormatBox.addActionListener(new ActionListener() { public void
   * actionPerformed(ActionEvent e) { Tag selected =
   * (Tag)m_fileFormatBox.getSelectedItem(); if (selected != null) {
   * m_smSaver.setFileFormat(selected); } } });
   */
}
 
Example 3
Project: repo.kmeanspp.silhouette_score   File: SerializedModelSaver.java   Source Code and License 6 votes vote down vote up
/**
 * Validate the file format. After this bean is deserialized, classes for XML
 * serialization may not be in the classpath any more.
 * 
 * @param ff the current file format to validate
 */
public Tag validateFileFormat(Tag ff) {
  Tag r = ff;
  if (ff.getID() == BINARY) {
    return ff;
  }

  if (ff.getID() == KOMLV && !KOML.isPresent()) {
    r = null;
  }

  if (ff.getID() == XSTREAM && !XStream.isPresent()) {
    r = null;
  }

  return r;
}
 
Example 4
Project: repo.kmeanspp.silhouette_score   File: SelectedTagEditor.java   Source Code and License 6 votes vote down vote up
/**
  * Returns a description of the property value as java source.
  *
  * @return a value of type 'String'
  */
 public String getJavaInitializationString() {

   SelectedTag s = (SelectedTag)getValue();
   Tag [] tags = s.getTags();
   String result = "new SelectedTag("
     + s.getSelectedTag().getID()
     + ", {\n";
   for (int i = 0; i < tags.length; i++) {
     result += "new Tag(" + tags[i].getID()
+ ",\"" + tags[i].getReadable()
+ "\")";
     if (i < tags.length - 1) {
result += ',';
     }
     result += '\n';
   }
   return result + "})";
 }
 
Example 5
Project: repo.kmeanspp.silhouette_score   File: SelectedTagEditor.java   Source Code and License 6 votes vote down vote up
/**
  * Sets the current property value as text.
  *
  * @param text the text of the selected tag.
  * @exception java.lang.IllegalArgumentException if an error occurs
  */
 public void setAsText(String text)
   {

   SelectedTag s = (SelectedTag)getValue();
   Tag [] tags = s.getTags();
   try {
     for (int i = 0; i < tags.length; i++) {
if (text.equals(tags[i].getReadable())) {
  setValue(new SelectedTag(tags[i].getID(), tags));
  return;
}
     }
   } catch (Exception ex) {
     throw new java.lang.IllegalArgumentException(text);
   }
 }
 
Example 6
Project: autoweka   File: Vote.java   Source Code and License 6 votes vote down vote up
/**
  * Returns an enumeration describing the available options.
  *
  * @return an enumeration of all the available options.
  */
 public Enumeration listOptions() {
   Enumeration 	enm;
   Vector		result;
   
   result = new Vector();
   
   enm = super.listOptions();
   while (enm.hasMoreElements())
     result.addElement(enm.nextElement());
   
   result.addElement(new Option(
       "\tFull path to serialized classifier to include.\n"
       + "\tMay be specified multiple times to include\n"
       + "\tmultiple serialized classifiers. Note: it does\n"
       + "\tnot make sense to use pre-built classifiers in\n"
       + "\ta cross-validation.", "P", 1, "-P <path to serialized " +
       		"classifier>"));

   result.addElement(new Option(
"\tThe combination rule to use\n"
+ "\t(default: AVG)",
"R", 1, "-R " + Tag.toOptionList(TAGS_RULES)));
   
   return result.elements();
 }
 
Example 7
Project: autoweka   File: Main.java   Source Code and License 6 votes vote down vote up
/**
  * Gets an enumeration describing the available options.
  *
  * @return 		an enumeration of all the available options.
  */
 public Enumeration listOptions(){
   Vector        	result;
   String		desc;
   SelectedTag		tag;
   int			i;

   result = new Vector();

   desc  = "";
   for (i = 0; i < TAGS_GUI.length; i++) {
     tag = new SelectedTag(TAGS_GUI[i].getID(), TAGS_GUI);
     desc  +=   "\t" + tag.getSelectedTag().getIDStr() 
     	       + " = " + tag.getSelectedTag().getReadable()
     	       + "\n";
   }
   result.addElement(new Option(
"\tDetermines the layout of the GUI:\n"
+ desc
+ "\t(default: " + new SelectedTag(GUI_MDI, TAGS_GUI) + ")",
"gui", 1, "-gui " + Tag.toOptionList(TAGS_GUI)));

   return result.elements();
 }
 
Example 8
Project: autoweka   File: SerializedModelSaverCustomizer.java   Source Code and License 6 votes vote down vote up
private void setUpFileFormatComboBox() {
    m_fileFormatBox = new JComboBox();
    for (int i = 0; i < SerializedModelSaver.s_fileFormatsAvailable.size(); i++) {
      Tag temp = SerializedModelSaver.s_fileFormatsAvailable.get(i);
      m_fileFormatBox.addItem(temp);
    }

    Tag result = m_smSaver.validateFileFormat(m_smSaver.getFileFormat());
    if (result == null) {
      m_fileFormatBox.setSelectedIndex(0);
    } else {
      m_fileFormatBox.setSelectedItem(result);
    }

/*    m_fileFormatBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          Tag selected = (Tag)m_fileFormatBox.getSelectedItem();
          if (selected != null) {
            m_smSaver.setFileFormat(selected);
          }
        }
      }); */
  }
 
Example 9
Project: autoweka   File: SerializedModelSaver.java   Source Code and License 6 votes vote down vote up
/**
 * Validate the file format. After this bean is deserialized, classes for
 * XML serialization may not be in the classpath any more.
 *
 * @param ff the current file format to validate
 */
public Tag validateFileFormat(Tag ff) {
  Tag r = ff;
  if (ff.getID() == BINARY) {
    return ff;
  }

  if (ff.getID() == KOMLV && !KOML.isPresent()) {
    r = null;
  }

  if (ff.getID() == XSTREAM && !XStream.isPresent()) {
    r = null;
  }

  return r;
}
 
Example 10
Project: autoweka   File: SelectedTagEditor.java   Source Code and License 6 votes vote down vote up
/**
  * Returns a description of the property value as java source.
  *
  * @return a value of type 'String'
  */
 public String getJavaInitializationString() {

   SelectedTag s = (SelectedTag)getValue();
   Tag [] tags = s.getTags();
   String result = "new SelectedTag("
     + s.getSelectedTag().getID()
     + ", {\n";
   for (int i = 0; i < tags.length; i++) {
     result += "new Tag(" + tags[i].getID()
+ ",\"" + tags[i].getReadable()
+ "\")";
     if (i < tags.length - 1) {
result += ',';
     }
     result += '\n';
   }
   return result + "})";
 }
 
Example 11
Project: autoweka   File: SelectedTagEditor.java   Source Code and License 6 votes vote down vote up
/**
  * Sets the current property value as text.
  *
  * @param text the text of the selected tag.
  * @exception java.lang.IllegalArgumentException if an error occurs
  */
 public void setAsText(String text)
   {

   SelectedTag s = (SelectedTag)getValue();
   Tag [] tags = s.getTags();
   try {
     for (int i = 0; i < tags.length; i++) {
if (text.equals(tags[i].getReadable())) {
  setValue(new SelectedTag(tags[i].getID(), tags));
  return;
}
     }
   } catch (Exception ex) {
     throw new java.lang.IllegalArgumentException(text);
   }
 }
 
Example 12
Project: umple   File: Vote.java   Source Code and License 6 votes vote down vote up
/**
 * Returns an enumeration describing the available options.
 * 
 * @return an enumeration of all the available options.
 */
@Override
public Enumeration<Option> listOptions() {

  Vector<Option> result = new Vector<Option>();

  result.addElement(new Option(
    "\tFull path to serialized classifier to include.\n"
      + "\tMay be specified multiple times to include\n"
      + "\tmultiple serialized classifiers. Note: it does\n"
      + "\tnot make sense to use pre-built classifiers in\n"
      + "\ta cross-validation.", "P", 1, "-P <path to serialized "
      + "classifier>"));

  result.addElement(new Option("\tThe combination rule to use\n"
    + "\t(default: AVG)", "R", 1, "-R " + Tag.toOptionList(TAGS_RULES)));

  result.addElement(new Option(
    "\tSuppress the printing of the individual models in the output",
    "do-not-print", 0, "-do-not-print"));

  result.addAll(Collections.list(super.listOptions()));

  return result.elements();
}
 
Example 13
Project: umple   File: Main.java   Source Code and License 6 votes vote down vote up
/**
 * Gets an enumeration describing the available options.
 * 
 * @return an enumeration of all the available options.
 */
@Override
public Enumeration<Option> listOptions() {
  Vector<Option> result;
  String desc;
  SelectedTag tag;
  int i;

  result = new Vector<Option>();

  desc = "";
  for (i = 0; i < TAGS_GUI.length; i++) {
    tag = new SelectedTag(TAGS_GUI[i].getID(), TAGS_GUI);
    desc += "\t" + tag.getSelectedTag().getIDStr() + " = "
      + tag.getSelectedTag().getReadable() + "\n";
  }
  result.addElement(new Option("\tDetermines the layout of the GUI:\n" + desc
    + "\t(default: " + new SelectedTag(GUI_MDI, TAGS_GUI) + ")", "gui", 1,
    "-gui " + Tag.toOptionList(TAGS_GUI)));

  return result.elements();
}
 
Example 14
Project: umple   File: SerializedModelSaverCustomizer.java   Source Code and License 6 votes vote down vote up
private void setUpFileFormatComboBox() {
  m_fileFormatBox = new JComboBox();
  for (int i = 0; i < SerializedModelSaver.s_fileFormatsAvailable.size(); i++) {
    Tag temp = SerializedModelSaver.s_fileFormatsAvailable.get(i);
    m_fileFormatBox.addItem(temp);
  }

  Tag result = m_smSaver.validateFileFormat(m_smSaver.getFileFormat());
  if (result == null) {
    m_fileFormatBox.setSelectedIndex(0);
  } else {
    m_fileFormatBox.setSelectedItem(result);
  }

  /*
   * m_fileFormatBox.addActionListener(new ActionListener() { public void
   * actionPerformed(ActionEvent e) { Tag selected =
   * (Tag)m_fileFormatBox.getSelectedItem(); if (selected != null) {
   * m_smSaver.setFileFormat(selected); } } });
   */
}
 
Example 15
Project: umple   File: SerializedModelSaver.java   Source Code and License 6 votes vote down vote up
/**
 * Validate the file format. After this bean is deserialized, classes for XML
 * serialization may not be in the classpath any more.
 * 
 * @param ff the current file format to validate
 */
public Tag validateFileFormat(Tag ff) {
  Tag r = ff;
  if (ff.getID() == BINARY) {
    return ff;
  }

  if (ff.getID() == KOMLV && !KOML.isPresent()) {
    r = null;
  }

  if (ff.getID() == XSTREAM && !XStream.isPresent()) {
    r = null;
  }

  return r;
}
 
Example 16
Project: umple   File: SelectedTagEditor.java   Source Code and License 6 votes vote down vote up
/**
  * Returns a description of the property value as java source.
  *
  * @return a value of type 'String'
  */
 public String getJavaInitializationString() {

   SelectedTag s = (SelectedTag)getValue();
   Tag [] tags = s.getTags();
   String result = "new SelectedTag("
     + s.getSelectedTag().getID()
     + ", {\n";
   for (int i = 0; i < tags.length; i++) {
     result += "new Tag(" + tags[i].getID()
+ ",\"" + tags[i].getReadable()
+ "\")";
     if (i < tags.length - 1) {
result += ',';
     }
     result += '\n';
   }
   return result + "})";
 }
 
Example 17
Project: umple   File: SelectedTagEditor.java   Source Code and License 6 votes vote down vote up
/**
  * Sets the current property value as text.
  *
  * @param text the text of the selected tag.
  * @exception java.lang.IllegalArgumentException if an error occurs
  */
 public void setAsText(String text)
   {

   SelectedTag s = (SelectedTag)getValue();
   Tag [] tags = s.getTags();
   try {
     for (int i = 0; i < tags.length; i++) {
if (text.equals(tags[i].getReadable())) {
  setValue(new SelectedTag(tags[i].getID(), tags));
  return;
}
     }
   } catch (Exception ex) {
     throw new java.lang.IllegalArgumentException(text);
   }
 }
 
Example 18
Project: jbossBA   File: Vote.java   Source Code and License 6 votes vote down vote up
/**
  * Returns an enumeration describing the available options.
  *
  * @return an enumeration of all the available options.
  */
 public Enumeration listOptions() {
   Enumeration 	enm;
   Vector		result;
   
   result = new Vector();
   
   enm = super.listOptions();
   while (enm.hasMoreElements())
     result.addElement(enm.nextElement());

   result.addElement(new Option(
"\tThe combination rule to use\n"
+ "\t(default: AVG)",
"R", 1, "-R " + Tag.toOptionList(TAGS_RULES)));
   
   return result.elements();
 }
 
Example 19
Project: jbossBA   File: Main.java   Source Code and License 6 votes vote down vote up
/**
 * Gets an enumeration describing the available options.
 * 
 * @return an enumeration of all the available options.
 */
@Override
public Enumeration listOptions() {
  Vector result;
  String desc;
  SelectedTag tag;
  int i;

  result = new Vector();

  desc = "";
  for (i = 0; i < TAGS_GUI.length; i++) {
    tag = new SelectedTag(TAGS_GUI[i].getID(), TAGS_GUI);
    desc += "\t" + tag.getSelectedTag().getIDStr() + " = "
      + tag.getSelectedTag().getReadable() + "\n";
  }
  result.addElement(new Option(Messages.getInstance().getString(
    "Main_ListOptions_Option_Text_First")
    + desc
    + Messages.getInstance().getString("Main_ListOptions_Option_Text_Second")
    + new SelectedTag(GUI_MDI, TAGS_GUI) + ")", "gui", 1, "-gui "
    + Tag.toOptionList(TAGS_GUI)));

  return result.elements();
}
 
Example 20
Project: jbossBA   File: SerializedModelSaverCustomizer.java   Source Code and License 6 votes vote down vote up
private void setUpFileFormatComboBox() {
  m_fileFormatBox = new JComboBox();
  for (int i = 0; i < SerializedModelSaver.s_fileFormatsAvailable.size(); i++) {
    Tag temp = SerializedModelSaver.s_fileFormatsAvailable.get(i);
    m_fileFormatBox.addItem(temp);
  }

  Tag result = m_smSaver.validateFileFormat(m_smSaver.getFileFormat());
  if (result == null) {
    m_fileFormatBox.setSelectedIndex(0);
  } else {
    m_fileFormatBox.setSelectedItem(result);
  }

  m_fileFormatBox.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        Tag selected = (Tag)m_fileFormatBox.getSelectedItem();
        if (selected != null) {
          m_smSaver.setFileFormat(selected);
        }
      }
    });
}
 
Example 21
Project: jbossBA   File: SerializedModelSaver.java   Source Code and License 6 votes vote down vote up
/**
 * Validate the file format. After this bean is deserialized, classes for XML
 * serialization may not be in the classpath any more.
 * 
 * @param ff the current file format to validate
 */
public Tag validateFileFormat(Tag ff) {
  Tag r = ff;
  if (ff.getID() == BINARY) {
    return ff;
  }

  if (ff.getID() == KOMLV && !KOML.isPresent()) {
    r = null;
  }

  if (ff.getID() == XSTREAM && !XStream.isPresent()) {
    r = null;
  }

  return r;
}
 
Example 22
Project: jbossBA   File: SelectedTagEditor.java   Source Code and License 6 votes vote down vote up
/**
  * Returns a description of the property value as java source.
  *
  * @return a value of type 'String'
  */
 public String getJavaInitializationString() {

   SelectedTag s = (SelectedTag)getValue();
   Tag [] tags = s.getTags();
   String result = "new SelectedTag("
     + s.getSelectedTag().getID()
     + ", {\n";
   for (int i = 0; i < tags.length; i++) {
     result += "new Tag(" + tags[i].getID()
+ ",\"" + tags[i].getReadable()
+ "\")";
     if (i < tags.length - 1) {
result += ',';
     }
     result += '\n';
   }
   return result + "})";
 }
 
Example 23
Project: jbossBA   File: SelectedTagEditor.java   Source Code and License 6 votes vote down vote up
/**
  * Sets the current property value as text.
  *
  * @param text the text of the selected tag.
  * @exception java.lang.IllegalArgumentException if an error occurs
  */
 public void setAsText(String text)
   {

   SelectedTag s = (SelectedTag)getValue();
   Tag [] tags = s.getTags();
   try {
     for (int i = 0; i < tags.length; i++) {
if (text.equals(tags[i].getReadable())) {
  setValue(new SelectedTag(tags[i].getID(), tags));
  return;
}
     }
   } catch (Exception ex) {
     throw new java.lang.IllegalArgumentException(text);
   }
 }
 
Example 24
Project: multisearch-weka-package   File: Performance.java   Source Code and License 6 votes vote down vote up
/**
 * Initializes the performance container. If the Evaluation object is null,
 * then the worst possible values for the measures are assumed (in order to
 * assure a low ranking).
 *
 * @param values		the values
 * @param evaluation		the evaluation to extract the performance
 * 				measures from, can be null
 * @param evalType		the type of evaluation
 * @param classLabel		the class label index (if applicable)
 * @param classifier		the classifier
 * @throws Exception	if retrieving of measures fails
 */
public Performance(Point<Object> values, AbstractEvaluationWrapper evaluation, int evalType, int classLabel, Classifier classifier) throws Exception {
  this();

  m_Values       = values;
  m_Evaluation   = evalType;
  m_MetricValues = new HashMap<Integer, Double>();
  m_Metrics      = null;
  m_Classifier   = classifier;
  if (evaluation != null) {
    m_Metrics = evaluation.getMetrics();
    for (Tag tag : evaluation.getMetrics().getTags()) {
      m_MetricValues.put(tag.getID(), evaluation.getMetric(tag, classLabel));
    }
  }
}
 
Example 25
Project: multisearch-weka-package   File: Performance.java   Source Code and License 6 votes vote down vote up
/**
  * returns a string representation of this performance object.
  *
  * @return a string representation
  */
 @Override
 public String toString() {
   String	result;
   String	evalStr;

   evalStr = null;
   if (m_Metrics != null) {
     for (Tag tag: m_Metrics.getTags()) {
if (tag.getID() == m_Evaluation) {
  evalStr = tag.getIDStr();
  break;
}
     }
   }
   if (evalStr == null)
     evalStr = "" + m_Evaluation;

   result = "Performance (" + getValues() + "): ";
   result +=   getPerformance()
             + " (" + evalStr + ")";

   return result;
 }
 
Example 26
Project: multisearch-weka-package   File: MultiSearch.java   Source Code and License 6 votes vote down vote up
/**
 * generates a table string for all the performances in the space and returns
 * that.
 *
 * @param space		the current space to align the performances to
 * @param performances	the performances to align
 * @param type		the type of performance
 * @return			the table string
 */
public String logPerformances(Space space, Vector<Performance> performances, Tag type) {
  StringBuffer	result;
  int			i;

  result = new StringBuffer(type.getReadable() + ":\n");

  result.append(space.toString());
  result.append("\n");
  for (i = 0; i < performances.size(); i++) {
    result.append(performances.get(i).getPerformance(type.getID()));
    result.append("\n");
  }
  result.append("\n");

  return result.toString();
}
 
Example 27
Project: repo.kmeanspp.silhouette_score   File: SelectedTagEditor.java   Source Code and License 5 votes vote down vote up
/**
 * Gets the list of tags that can be selected from.
 *
 * @return an array of string tags.
 */
public String[] getTags() {

  SelectedTag s = (SelectedTag)getValue();
  Tag [] tags = s.getTags();
  String [] result = new String [tags.length];
  for (int i = 0; i < tags.length; i++) {
    result[i] = tags[i].getReadable();
  }
  return result;
}
 
Example 28
Project: repo.kmeanspp.silhouette_score   File: SelectedTagEditor.java   Source Code and License 5 votes vote down vote up
/**
  * Tests out the selectedtag editor from the command line.
  *
  * @param args ignored
  */
 public static void main(String [] args) {

   try {
     GenericObjectEditor.registerEditors();
     Tag [] tags =  {
new Tag(1, "First option"),
new Tag(2, "Second option"),
new Tag(3, "Third option"),
new Tag(4, "Fourth option"),
new Tag(5, "Fifth option"),
     };
     SelectedTag initial = new SelectedTag(1, tags);
     SelectedTagEditor ce = new SelectedTagEditor();
     ce.setValue(initial);
     PropertyValueSelector ps = new PropertyValueSelector(ce);
     JFrame f = new JFrame(); 
     f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
  System.exit(0);
}
     });
     f.getContentPane().setLayout(new BorderLayout());
     f.getContentPane().add(ps, BorderLayout.CENTER);
     f.pack();
     f.setVisible(true);
   } catch (Exception ex) {
     ex.printStackTrace();
     System.err.println(ex.getMessage());
   }
 }
 
Example 29
Project: repo.kmeanspp.silhouette_score   File: SortLabels.java   Source Code and License 5 votes vote down vote up
/**
 * Returns an enumeration describing the available options.
 * 
 * @return an enumeration of all the available options.
 */
@Override
public Enumeration<Option> listOptions() {

  Vector<Option> result = new Vector<Option>();

  result.addElement(new Option(
    "\tSpecify list of string attributes to convert to words.\n"
      + "\t(default: select all relational attributes)", "R", 1,
    "-R <index1,index2-index4,...>"));

  result.addElement(new Option(
    "\tInverts the matching sense of the selection.", "V", 0, "-V"));

  String desc = "";
  for (Tag element : TAGS_SORTTYPE) {
    SelectedTag tag = new SelectedTag(element.getID(), TAGS_SORTTYPE);
    desc += "\t" + tag.getSelectedTag().getIDStr() + " = "
      + tag.getSelectedTag().getReadable() + "\n";
  }
  result.addElement(new Option("\tDetermines the type of sorting:\n" + desc
    + "\t(default: " + new SelectedTag(SORT_CASESENSITIVE, TAGS_SORTTYPE)
    + ")", "S", 1, "-S " + Tag.toOptionList(TAGS_SORTTYPE)));

  result.addAll(Collections.list(super.listOptions()));

  return result.elements();
}
 
Example 30
Project: autoweka   File: SelectedTagEditor.java   Source Code and License 5 votes vote down vote up
/**
 * Gets the list of tags that can be selected from.
 *
 * @return an array of string tags.
 */
public String[] getTags() {

  SelectedTag s = (SelectedTag)getValue();
  Tag [] tags = s.getTags();
  String [] result = new String [tags.length];
  for (int i = 0; i < tags.length; i++) {
    result[i] = tags[i].getReadable();
  }
  return result;
}
 
Example 31
Project: autoweka   File: SelectedTagEditor.java   Source Code and License 5 votes vote down vote up
/**
  * Tests out the selectedtag editor from the command line.
  *
  * @param args ignored
  */
 public static void main(String [] args) {

   try {
     GenericObjectEditor.registerEditors();
     Tag [] tags =  {
new Tag(1, "First option"),
new Tag(2, "Second option"),
new Tag(3, "Third option"),
new Tag(4, "Fourth option"),
new Tag(5, "Fifth option"),
     };
     SelectedTag initial = new SelectedTag(1, tags);
     SelectedTagEditor ce = new SelectedTagEditor();
     ce.setValue(initial);
     PropertyValueSelector ps = new PropertyValueSelector(ce);
     JFrame f = new JFrame(); 
     f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
  System.exit(0);
}
     });
     f.getContentPane().setLayout(new BorderLayout());
     f.getContentPane().add(ps, BorderLayout.CENTER);
     f.pack();
     f.setVisible(true);
   } catch (Exception ex) {
     ex.printStackTrace();
     System.err.println(ex.getMessage());
   }
 }
 
Example 32
Project: autoweka   File: SortLabels.java   Source Code and License 5 votes vote down vote up
/**
  * Returns an enumeration describing the available options.
  *
  * @return 		an enumeration of all the available options.
  */
 public Enumeration listOptions() {
   Vector        	result;
   Enumeration   	en;
   String		desc;
   int			i;
   SelectedTag		tag;

   result = new Vector();

   en = super.listOptions();
   while (en.hasMoreElements())
     result.addElement(en.nextElement());

   result.addElement(new Option(
"\tSpecify list of string attributes to convert to words.\n"
+ "\t(default: select all relational attributes)",
"R", 1, "-R <index1,index2-index4,...>"));

   result.addElement(new Option(
"\tInverts the matching sense of the selection.",
"V", 0, "-V"));

   desc  = "";
   for (i = 0; i < TAGS_SORTTYPE.length; i++) {
     tag = new SelectedTag(TAGS_SORTTYPE[i].getID(), TAGS_SORTTYPE);
     desc  +=   "\t" + tag.getSelectedTag().getIDStr() 
     	       + " = " + tag.getSelectedTag().getReadable()
     	       + "\n";
   }
   result.addElement(new Option(
"\tDetermines the type of sorting:\n"
+ desc
+ "\t(default: " + new SelectedTag(SORT_CASESENSITIVE, TAGS_SORTTYPE) + ")",
"S", 1, "-S " + Tag.toOptionList(TAGS_SORTTYPE)));

   return result.elements();
 }
 
Example 33
Project: umple   File: SelectedTagEditor.java   Source Code and License 5 votes vote down vote up
/**
 * Gets the list of tags that can be selected from.
 *
 * @return an array of string tags.
 */
public String[] getTags() {

  SelectedTag s = (SelectedTag)getValue();
  Tag [] tags = s.getTags();
  String [] result = new String [tags.length];
  for (int i = 0; i < tags.length; i++) {
    result[i] = tags[i].getReadable();
  }
  return result;
}
 
Example 34
Project: umple   File: SelectedTagEditor.java   Source Code and License 5 votes vote down vote up
/**
  * Tests out the selectedtag editor from the command line.
  *
  * @param args ignored
  */
 public static void main(String [] args) {

   try {
     GenericObjectEditor.registerEditors();
     Tag [] tags =  {
new Tag(1, "First option"),
new Tag(2, "Second option"),
new Tag(3, "Third option"),
new Tag(4, "Fourth option"),
new Tag(5, "Fifth option"),
     };
     SelectedTag initial = new SelectedTag(1, tags);
     SelectedTagEditor ce = new SelectedTagEditor();
     ce.setValue(initial);
     PropertyValueSelector ps = new PropertyValueSelector(ce);
     JFrame f = new JFrame(); 
     f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
  System.exit(0);
}
     });
     f.getContentPane().setLayout(new BorderLayout());
     f.getContentPane().add(ps, BorderLayout.CENTER);
     f.pack();
     f.setVisible(true);
   } catch (Exception ex) {
     ex.printStackTrace();
     System.err.println(ex.getMessage());
   }
 }
 
Example 35
Project: umple   File: SortLabels.java   Source Code and License 5 votes vote down vote up
/**
 * Returns an enumeration describing the available options.
 * 
 * @return an enumeration of all the available options.
 */
@Override
public Enumeration<Option> listOptions() {

  Vector<Option> result = new Vector<Option>();

  result.addElement(new Option(
    "\tSpecify list of string attributes to convert to words.\n"
      + "\t(default: select all relational attributes)", "R", 1,
    "-R <index1,index2-index4,...>"));

  result.addElement(new Option(
    "\tInverts the matching sense of the selection.", "V", 0, "-V"));

  String desc = "";
  for (Tag element : TAGS_SORTTYPE) {
    SelectedTag tag = new SelectedTag(element.getID(), TAGS_SORTTYPE);
    desc += "\t" + tag.getSelectedTag().getIDStr() + " = "
      + tag.getSelectedTag().getReadable() + "\n";
  }
  result.addElement(new Option("\tDetermines the type of sorting:\n" + desc
    + "\t(default: " + new SelectedTag(SORT_CASESENSITIVE, TAGS_SORTTYPE)
    + ")", "S", 1, "-S " + Tag.toOptionList(TAGS_SORTTYPE)));

  result.addAll(Collections.list(super.listOptions()));

  return result.elements();
}
 
Example 36
Project: umple   File: Add.java   Source Code and License 5 votes vote down vote up
/**
 * Returns an enumeration describing the available options.
 * 
 * @return an enumeration of all the available options.
 */
@Override
public Enumeration<Option> listOptions() {
  Vector<Option> newVector;
  String desc;
  SelectedTag tag;
  int i;

  newVector = new Vector<Option>();

  desc = "";
  for (i = 0; i < TAGS_TYPE.length; i++) {
    tag = new SelectedTag(TAGS_TYPE[i].getID(), TAGS_TYPE);
    desc += "\t" + tag.getSelectedTag().getIDStr() + " = "
      + tag.getSelectedTag().getReadable() + "\n";
  }
  newVector.addElement(new Option("\tThe type of attribute to create:\n"
    + desc + "\t(default: " + new SelectedTag(Attribute.NUMERIC, TAGS_TYPE)
    + ")", "T", 1, "-T " + Tag.toOptionList(TAGS_TYPE)));

  newVector.addElement(new Option(
    "\tSpecify where to insert the column. First and last\n"
      + "\tare valid indexes.(default: last)", "C", 1, "-C <index>"));

  newVector.addElement(new Option("\tName of the new attribute.\n"
    + "\t(default: 'Unnamed')", "N", 1, "-N <name>"));

  newVector.addElement(new Option(
    "\tCreate nominal attribute with given labels\n"
      + "\t(default: numeric attribute)", "L", 1, "-L <label1,label2,...>"));

  newVector.addElement(new Option(
    "\tThe format of the date values (see ISO-8601)\n"
      + "\t(default: yyyy-MM-dd'T'HH:mm:ss)", "F", 1, "-F <format>"));

  return newVector.elements();
}
 
Example 37
Project: jbossBA   File: GridSearch.java   Source Code and License 5 votes vote down vote up
/**
 * returns a string containing a gnuplot script+data file
 * 
 * @return		the data in gnuplot format
 */
public String toGnuplot() {
  StringBuffer	result;
  Tag		type;
  int		i;
  
  result = new StringBuffer();
  type   = new SelectedTag(getType(), TAGS_EVALUATION).getSelectedTag();
  
  result.append("Gnuplot (" + type.getReadable() + "):\n");
  result.append("# begin 'gridsearch.data'\n");
  result.append("# " + type.getReadable() + "\n");
  for (i = 0; i < getPerformances().size(); i++)
    result.append(getPerformances().get(i).toGnuplot(type.getID()) + "\n");
  result.append("# end 'gridsearch.data'\n\n");
  
  result.append("# begin 'gridsearch.plot'\n");
  result.append("# " + type.getReadable() + "\n");
  result.append("set data style lines\n");
  result.append("set contour base\n");
  result.append("set surface\n");
  result.append("set title '" + m_Data.relationName() + "'\n");
  result.append("set xrange [" + getGrid().getMinX() + ":" + getGrid().getMaxX() + "]\n");
  result.append("set xlabel 'x (" + getFilter().getClass().getName() + ": " + getXProperty() + ")'\n");
  result.append("set yrange [" + getGrid().getMinY() + ":" + getGrid().getMaxY() + "]\n");
  result.append("set ylabel 'y - (" + getClassifier().getClass().getName() + ": " + getYProperty() + ")'\n");
  result.append("set zrange [" + (getMin() - (getMax() - getMin())*0.1) + ":" + (getMax() + (getMax() - getMin())*0.1) + "]\n");
  result.append("set zlabel 'z - " + type.getReadable() + "'\n");
  result.append("set dgrid3d " + getGrid().height() + "," + getGrid().width() + ",1\n");
  result.append("show contour\n");
  result.append("splot 'gridsearch.data'\n");
  result.append("pause -1\n");
  result.append("# end 'gridsearch.plot'");

  return result.toString();
}
 
Example 38
Project: jbossBA   File: GridSearch.java   Source Code and License 5 votes vote down vote up
/**
 * generates a table string for all the performances in the grid and returns
 * that.
 * 
 * @param grid		the current grid to align the performances to
 * @param performances	the performances to align
 * @param type		the type of performance
 * @return			the table string
 */
protected String logPerformances(Grid grid, Vector<Performance> performances, Tag type) {
  StringBuffer	result;
  PerformanceTable	table;
  
  result = new StringBuffer(type.getReadable() + ":\n");
  table  = new PerformanceTable(grid, performances, type.getID());
  
  result.append(table.toString() + "\n");
  result.append("\n");
  result.append(table.toGnuplot() + "\n");
  result.append("\n");
  
  return result.toString();
}
 
Example 39
Project: jbossBA   File: SelectedTagEditor.java   Source Code and License 5 votes vote down vote up
/**
 * Gets the list of tags that can be selected from.
 *
 * @return an array of string tags.
 */
public String[] getTags() {

  SelectedTag s = (SelectedTag)getValue();
  Tag [] tags = s.getTags();
  String [] result = new String [tags.length];
  for (int i = 0; i < tags.length; i++) {
    result[i] = tags[i].getReadable();
  }
  return result;
}
 
Example 40
Project: jbossBA   File: SelectedTagEditor.java   Source Code and License 5 votes vote down vote up
/**
  * Tests out the selectedtag editor from the command line.
  *
  * @param args ignored
  */
 public static void main(String [] args) {

   try {
     GenericObjectEditor.registerEditors();
     Tag [] tags =  {
new Tag(1, Messages.getInstance().getString("SelectedTagEditor_Main_Tags_Text_First")),
new Tag(2, Messages.getInstance().getString("SelectedTagEditor_Main_Tags_Text_Second")),
new Tag(3, Messages.getInstance().getString("SelectedTagEditor_Main_Tags_Text_Third")),
new Tag(4, Messages.getInstance().getString("SelectedTagEditor_Main_Tags_Text_Fourth")),
new Tag(5, Messages.getInstance().getString("SelectedTagEditor_Main_Tags_Text_Fifth")),
     };
     SelectedTag initial = new SelectedTag(1, tags);
     SelectedTagEditor ce = new SelectedTagEditor();
     ce.setValue(initial);
     PropertyValueSelector ps = new PropertyValueSelector(ce);
     JFrame f = new JFrame(); 
     f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
  System.exit(0);
}
     });
     f.getContentPane().setLayout(new BorderLayout());
     f.getContentPane().add(ps, BorderLayout.CENTER);
     f.pack();
     f.setVisible(true);
   } catch (Exception ex) {
     ex.printStackTrace();
     System.err.println(ex.getMessage());
   }
 }