下面列出了java.util.Vector#elements ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* 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();
}
/**
* 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();
}
/**
* 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();
}
/**
* 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();
}
}
/**
* 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();
}
/**
*
**/
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 () + '"');
}
}
/**
* 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();
}
/**
* 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();
}
/**
* 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();
}
/**
* 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();
}
@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();
}
/**
* 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();
}
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();
}
/**
* 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();
}
/**
* 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()) ;
}
}
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));
}
}
/**
* 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();
}
/**
* 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;
}
/**
* 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();
}
public Enumeration<Applet> getApplets() {
Vector<Applet> applets = new Vector<>();
applets.addElement(target);
return applets.elements();
}