Java Code Examples for java.util.Vector#elements()

The following examples show how to use java.util.Vector#elements() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RegSMO.java    From KEEL with GNU General Public License v3.0 6 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 = new Vector();
   
   result.addElement(new Option(
"\tThe epsilon for round-off error.\n" 
+ "\t(default 1.0e-12)", 
"P", 1, "-P <double>"));
   
   Enumeration enm = super.listOptions();
   while (enm.hasMoreElements()) {
     result.addElement(enm.nextElement());
   }
   
   return result.elements();
 }
 
Example 2
Source File: Dagging.java    From tsml with GNU General Public License v3.0 6 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 = new Vector();
  
  result.addElement(new Option(
      "\tThe number of folds for splitting the training set into\n"
      + "\tsmaller chunks for the base classifier.\n"
      + "\t(default 10)",
      "F", 1, "-F <folds>"));
  
  result.addElement(new Option(
      "\tWhether to print some more information during building the\n"
      + "\tclassifier.\n"
      + "\t(default is off)",
      "verbose", 0, "-verbose"));
  
  Enumeration en = super.listOptions();
  while (en.hasMoreElements())
    result.addElement(en.nextElement());
    
  return result.elements();
}
 
Example 3
Source File: AddNoise.java    From tsml with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns an enumeration describing the available options
 *
 * @return an enumeration of all the available options
 */
public Enumeration listOptions() {

  Vector newVector = new Vector(4);

  newVector.addElement(new Option(
            "\tIndex of the attribute to be changed \n"
            +"\t(default last attribute)",
            "C", 1, "-C <col>"));
  newVector.addElement(new Option(
            "\tTreat missing values as an extra value \n",
            "M", 1, "-M"));
  newVector.addElement(new Option(
            "\tSpecify the percentage of noise introduced \n"
            +"\tto the data (default 10)",
            "P", 1, "-P <num>"));
  newVector.addElement(new Option(
            "\tSpecify the random number seed (default 1)",
            "S", 1, "-S <num>"));

  return newVector.elements();
}
 
Example 4
Source File: SnmpAcl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns an enumeration of trap communities for a given host.
 *
 * @param i The address of the host.
 *
 * @return An enumeration of trap communities for a given host (enumeration of <CODE>String</CODE>).
 */
public Enumeration<String> getTrapCommunities(InetAddress i) {
    Vector<String> list = null;
    if ((list = trapDestList.get(i)) != null ) {
        if (SNMP_LOGGER.isLoggable(Level.FINER)) {
            SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
                "getTrapCommunities", "["+i.toString()+"] is in list");
        }
        return list.elements();
    } else {
        list = new Vector<>();
        if (SNMP_LOGGER.isLoggable(Level.FINER)) {
            SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
                "getTrapCommunities", "["+i.toString()+"] is not in list");
        }
        return list.elements();
    }
}
 
Example 5
Source File: TextDirectoryLoader.java    From tsml with GNU General Public License v3.0 6 votes vote down vote up
/** 
  * Lists the available options
  * 
  * @return 		an enumeration of the available options
  */  
 public Enumeration listOptions() {
   
   Vector<Option> result = new Vector<Option>();
   
   result.add(new Option(
"\tEnables debug output.\n"
+ "\t(default: off)",
"D", 0, "-D"));
   
   result.add(new Option(
"\tStores the filename in an additional attribute.\n"
+ "\t(default: off)",
"F", 0, "-F"));
   
   result.add(new Option(
"\tThe directory to work on.\n"
+ "\t(default: current directory)",
"dir", 0, "-dir <directory>"));
   
   result.add(new Option("\tThe character set to use, e.g UTF-8.\n\t" +
   		"(default: use the default character set)", "charset", 1, 
   		"-charset <charset name>"));    
   
   return  result.elements();
 }
 
Example 6
Source File: Skeleton.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
private void writeIDs ()
{
  Vector list = new Vector ();
  buildIDList (i, list);
  Enumeration e = list.elements ();
  boolean first = true;
  while (e.hasMoreElements ())
  {
    if (first)
      first = false;
    else
      stream.println (", ");
    stream.print ("    \"" + (String)e.nextElement () + '"');
  }
}
 
Example 7
Source File: ClusterMembership.java    From tsml with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns an enumeration describing the available options.
 *
 * @return an enumeration of all the available options.
 */
public Enumeration listOptions() {
  
  Vector newVector = new Vector(2);
  
  newVector.
    addElement(new Option("\tFull name of clusterer to use. eg:\n"
                   + "\t\tweka.clusterers.EM\n"
	    + "\tAdditional options after the '--'.\n"
	    + "\t(default: weka.clusterers.EM)",
	    "W", 1, "-W <clusterer name>"));

  newVector.
    addElement(new Option("\tThe range of attributes the clusterer should ignore."
	    +"\n\t(the class attribute is automatically ignored)",
	    "I", 1,"-I <att1,att2-att4,...>"));

  return newVector.elements();
}
 
Example 8
Source File: MinkowskiDistance.java    From tsml with GNU General Public License v3.0 6 votes vote down vote up
/**
  * Returns an enumeration describing the available options.
  *
  * @return 		an enumeration of all the available options.
  */
 public Enumeration listOptions() {
   Vector<Option> result = new Vector<Option>();
   
   result.addElement(new Option(
       "\tThe order 'p'. With '1' being the Manhattan distance and '2'\n"
+ "\tthe Euclidean distance.\n"
       + "\t(default: 2)",
       "P", 1, "-P <order>"));
   
   Enumeration en = super.listOptions();
   while (en.hasMoreElements())
     result.addElement((Option)en.nextElement());
     
   return result.elements();
 }
 
Example 9
Source File: SnmpAcl.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns ann enumeration of community strings. Community strings are returned as String.
 * @return The enumeration of community strings.
 */
public Enumeration<String> communities() {
    HashSet<String> set = new HashSet<String>();
    Vector<String> res = new Vector<String>();
    for (Enumeration<AclEntry> e = acl.entries() ; e.hasMoreElements() ;) {
        AclEntryImpl entry = (AclEntryImpl) e.nextElement();
        for (Enumeration<String> cs = entry.communities();
             cs.hasMoreElements() ;) {
            set.add(cs.nextElement());
        }
    }
    String[] objs = set.toArray(new String[0]);
    for(int i = 0; i < objs.length; i++)
        res.addElement(objs[i]);

    return res.elements();
}
 
Example 10
Source File: AmidstRegressor.java    From toolbox with Apache License 2.0 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 = new Vector<Option>(1);

    newVector.addElement(new Option(
            "\tNumber of Gaussian hidden variables.\n"+
                    "\t(Default = 0)",
            "G", 1,"-G <number of Gaussian hidden>"));

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

    return newVector.elements();
}
 
Example 11
Source File: SnmpMibAgent.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void concatVector(SnmpMibRequest req, Vector<SnmpVarBind> source) {
    for(Enumeration<SnmpVarBind> e= source.elements(); e.hasMoreElements(); ) {
        SnmpVarBind var= e.nextElement();
        // We need to duplicate the SnmpVarBind otherwise it is going
        // to be overloaded by the next get Next ...
        req.addVarBind(new SnmpVarBind(var.oid, var.value));
    }
}
 
Example 12
Source File: SnmpVarBindList.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Adds elements in the specified <CODE>SnmpVarBindList</CODE> to this list.
 * The elements are not cloned.
 * @param list A vector of <CODE>SnmpVarBind</CODE>.
 */
final public synchronized void concat(Vector<SnmpVarBind> list) {
    ensureCapacity(size() + list.size()) ;
    for (Enumeration<SnmpVarBind> e = list.elements() ; e.hasMoreElements() ; ) {
        addElement(e.nextElement()) ;
    }
}
 
Example 13
Source File: SubsetSizeForwardSelection.java    From tsml with GNU General Public License v3.0 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 newVector = new Vector(9);

  newVector.addElement(new Option("\tPerform initial ranking to select the" +
                                  "\n\ttop-ranked attributes.", "I", 0, "-I"));
  newVector.addElement(new Option(
                                  "\tNumber of top-ranked attributes that are " +
                                  "\n\ttaken into account by the search.", "K", 1, "-K <num>"));
  newVector.addElement(new Option(
                                  "\tType of Linear Forward Selection (default = 0).", "T", 1,
                                  "-T <0 = fixed-set | 1 = fixed-width>"));
  newVector.addElement(new Option(
                                  "\tSize of lookup cache for evaluated subsets." +
                                  "\n\tExpressed as a multiple of the number of" +
                                  "\n\tattributes in the data set. (default = 1)", "S", 1, "-S <num>"));
  newVector.addElement(new Option(
                                  "\tSubset-evaluator used for subset-size determination." + "-- -M",
                                  "E", 1, "-E <subset evaluator>"));
  newVector.addElement(new Option("\tNumber of cross validation folds" +
                                  "\n\tfor subset size determination (default = 5).", "F", 1, "-F <num>"));
  newVector.addElement(new Option("\tSeed for cross validation" +
                                  "\n\tsubset size determination. (default = 1)", "R", 1, "-R <num>"));
  newVector.addElement(new Option("\tverbose on/off", "Z", 0, "-Z"));

  if ((m_setSizeEval != null) && (m_setSizeEval instanceof OptionHandler)) {
    newVector.addElement(new Option("", "", 0,
                                    "\nOptions specific to " + "evaluator " +
                                    m_setSizeEval.getClass().getName() + ":"));

    Enumeration enu = ((OptionHandler) m_setSizeEval).listOptions();

    while (enu.hasMoreElements()) {
      newVector.addElement(enu.nextElement());
    }
  }

  return newVector.elements();
}
 
Example 14
Source File: Team.java    From megamek with GNU General Public License v2.0 5 votes vote down vote up
public Enumeration<IPlayer> getNonObserverPlayers() {
    Vector<IPlayer> nonObservers = new Vector<IPlayer>();
    for (int i = 0; i < players.size(); i++) {
        if (!players.get(i).isObserver()) {
            nonObservers.add(players.get(i));
        }
    }
    return nonObservers.elements();
}
 
Example 15
Source File: FT.java    From tsml with GNU General Public License v3.0 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 newVector = new Vector(8);
  
  newVector.addElement(new Option("\tBinary splits (convert nominal attributes to binary ones) ",
                                  "B", 0, "-B"));
  
  newVector.addElement(new Option("\tUse error on probabilities instead of misclassification error "+
                                  "for stopping criterion of LogitBoost.",
                                  "P", 0, "-P"));
  
  newVector.addElement(new Option("\tSet fixed number of iterations for LogitBoost (instead of using "+
                                  "cross-validation)",
                                  "I",1,"-I <numIterations>"));
  
  newVector.addElement(new Option("\tSet Funtional Tree type to be generate: "+
                                  " 0 for FT, 1 for FTLeaves and 2 for FTInner",
                                  "F",1,"-F <modelType>"));
  
  newVector.addElement(new Option("\tSet minimum number of instances at which a node can be split (default 15)",
                                  "M",1,"-M <numInstances>"));
  
  newVector.addElement(new Option("\tSet beta for weight trimming for LogitBoost. Set to 0 (default) for no weight trimming.",
                                  "W",1,"-W <beta>"));
  
  newVector.addElement(new Option("\tThe AIC is used to choose the best iteration.",
                                  "A", 0, "-A"));
  
  return newVector.elements();
}
 
Example 16
Source File: ParameterDecodingFilter.java    From subsonic with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Enumeration getParameterNames() {
    Enumeration e = super.getParameterNames();
    Vector<String> v = new Vector<String>();
    while (e.hasMoreElements()) {
        String name = (String) e.nextElement();
        if (name.endsWith(PARAM_SUFFIX)) {
            name = name.replace(PARAM_SUFFIX, "");
        }
        v.add(name);
    }

    return v.elements();
}
 
Example 17
Source File: ListOptions.java    From tsml with GNU General Public License v3.0 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<Option> result = new Vector<Option>();

  result.addElement(new Option(
      "\tThe class to load.",
      "W", 1, "-W <classname>"));
  
  return result.elements();
}
 
Example 18
Source File: CityBuilder.java    From megamek with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Build a bridge across an obstacle
 * 
 * @todo: use a bridge not a road when bridges are working
 * @param start
 * @param direction
 * @return coordinates to resume roadbuilding
 */
private Coords tryToBuildBridge(Coords start, int direction) {
    if (!board.contains(start))
        return null;
    Vector<Coords> hexes = new Vector<Coords>(7);
    Coords end = null;
    Coords next = start.translated(direction);
    while (hexes.size() < 6) {
        if (!board.contains(next)) {
            // offboard, why bother?
            break;
        }
        if (!hexNeedsBridge(board.getHex(next))) {
            end = next;
            break;
        }
        hexes.add(next);
        next = next.translated(direction);
    }
    if (end != null) {
        // got start and end, can we make a bridge?
        if (hexes.size() == 0)
            return null;
        int elev1 = board.getHex(start).getLevel();
        int elev2 = board.getHex(end).getLevel();
        int elevBridge = board.getHex(end).terrainLevel(Terrains.BRIDGE);
        if (elevBridge >= 0) {
            if (Math.abs(elev2 + elevBridge - elev1) > 2)
                return null;
            elev1 = elev2 + elevBridge;
        } else {
            if (Math.abs(elev1 - elev2) > 4) {
                // nobody could use the bridge, give up
                return null;
            }
            elev1 = (elev1 + elev2) / 2;
        }
        // build the bridge
        int exits = (1 << direction) | (1 << ((direction + 3) % 6));
        int cf = mapSettings.getCityMinCF()
                + Compute.randomInt(1 + mapSettings.getCityMaxCF()
                        - mapSettings.getCityMinCF());

        for (Enumeration<Coords> e = hexes.elements(); e.hasMoreElements();) {
            Coords c = e.nextElement();
            addBridge(board.getHex(c), exits, elev1, cf);
        }
        connectHexes(start, hexes.firstElement(), 1);
        connectHexes(end, hexes.lastElement(), 1);
    }
    return end;
}
 
Example 19
Source File: M5Base.java    From tsml with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns an enumeration of the additional measure names
 * @return an enumeration of the measure names
 */
public Enumeration enumerateMeasures() {
  Vector newVector = new Vector(1);
  newVector.addElement("measureNumRules");
  return newVector.elements();
}
 
Example 20
Source File: Beans.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public Enumeration<Applet> getApplets() {
    Vector<Applet> applets = new Vector<>();
    applets.addElement(target);
    return applets.elements();
}