当前位置: 首页>>代码示例>>Java>>正文


Java Vector.set方法代码示例

本文整理汇总了Java中java.util.Vector.set方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.set方法的具体用法?Java Vector.set怎么用?Java Vector.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Vector的用法示例。


在下文中一共展示了Vector.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: editSeriesExchangeData

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Edits the data series by exchanging data.
 * @param series the series
 * @param targetDataSeriesIndex the target data series index
 */
public void editSeriesExchangeData(DataSeries series, int targetDataSeriesIndex) throws NoSuchSeriesException {

	if (targetDataSeriesIndex<=(this.getColumnCount()-1)) {
		
		int targetTbIndex = targetDataSeriesIndex+1;
		List valuePairs = parentDataModel.getValuePairsFromSeries(series);
		for (int i = 0; i < valuePairs.size(); i++) {
			// --- Find the key in the table ----------
			ValuePair vp = (ValuePair) valuePairs.get(i);
			Number key = parentDataModel.getXValueFromPair(vp);
			Number value = parentDataModel.getYValueFromValuePair(vp);

			Vector<Number> editRow = this.tableModelDataVector.getKeyRowVectorTreeMap().get(key);
			if (editRow!=null) {
				// --- Edit the row -------------------
				editRow.set(targetTbIndex, value);
			}
		}
		this.fireTableStructureChanged();
		
	} else {
		throw new NoSuchSeriesException();
	}
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:30,代码来源:TimeSeriesTableModel.java

示例2: editSeriesRemoveData

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Edits the data series by remove data.
 * @param series the series
 * @param targetDataSeriesIndex the target data series index
 */
public void editSeriesRemoveData(DataSeries series, int targetDataSeriesIndex) throws NoSuchSeriesException {

	if (targetDataSeriesIndex<=(this.getColumnCount()-1)) {
		
		int targetTbIndex = targetDataSeriesIndex+1;
		HashSet<Number> removeKeys = this.getKeyHashSetFromDataSeries(series);
		
		for (int i = 0; i < this.tableModelDataVector.size(); i++) {
			Vector<Number> rowVector = this.tableModelDataVector.get(i);
			Number keyValue = (Number) rowVector.get(0);
			if (removeKeys.contains(keyValue)) {
				// --- Delete Value ---------
				rowVector.set(targetTbIndex, null);
			}
		}
		this.removeEmptyRows();
		this.fireTableStructureChanged();
		
	} else {
		throw new NoSuchSeriesException();
	}
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:28,代码来源:TimeSeriesTableModel.java

示例3: parseSimplified

import java.util.Vector; //导入方法依赖的package包/类
/**
 * When the parser realises that it is dealign with a simplified stylesheet
 * it will create an empty Stylesheet object with the root element of the
 * stylesheet (a LiteralElement object) as its only child. The Stylesheet
 * object will then create this Template object and invoke this method to
 * force some specific behaviour. What we need to do is:
 *  o) create a pattern matching on the root node
 *  o) add the LRE root node (the only child of the Stylesheet) as our
 *     only child node
 *  o) set the empty Stylesheet as our parent
 *  o) set this template as the Stylesheet's only child
 */
public void parseSimplified(Stylesheet stylesheet, Parser parser) {

    _stylesheet = stylesheet;
    setParent(stylesheet);

    _name = null;
    _mode = null;
    _priority = Double.NaN;
    _pattern = parser.parsePattern(this, "/");

    final Vector contents = _stylesheet.getContents();
    final SyntaxTreeNode root = (SyntaxTreeNode)contents.elementAt(0);

    if (root instanceof LiteralElement) {
        addElement(root);
        root.setParent(this);
        contents.set(0, this);
        parser.setTemplate(this);
        root.parseContents(parser);
        parser.setTemplate(null);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:Template.java

示例4: partition

import java.util.Vector; //导入方法依赖的package包/类
private int partition(Vector templates, int p, int r) {
    final Template x = (Template)templates.elementAt(p);
    int i = p - 1;
    int j = r + 1;
    while (true) {
        while (x.compareTo((Template)templates.elementAt(--j)) > 0);
        while (x.compareTo((Template)templates.elementAt(++i)) < 0);
        if (i < j) {
            templates.set(j, templates.set(i, templates.elementAt(j)));
        }
        else {
            return j;
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:Mode.java

示例5: updateImportListFor

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Namespace growth
 *
 * Go through the import list of a given grammar and for each imported
 * grammar, check to see if the grammar bucket has a newer version.
 * If a new instance is found, we update the import list with the
 * newer version.
 */
private void updateImportListFor(SchemaGrammar grammar) {
    Vector importedGrammars = grammar.getImportedGrammars();
    if (importedGrammars != null) {
        for (int i=0; i<importedGrammars.size(); i++) {
            SchemaGrammar isg1 = (SchemaGrammar) importedGrammars.elementAt(i);
            SchemaGrammar isg2 = fGrammarBucket.getGrammar(isg1.getTargetNamespace());
            if (isg2 != null && isg1 != isg2) {
                importedGrammars.set(i, isg2);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:XSDHandler.java

示例6: extAttr

import java.util.Vector; //导入方法依赖的package包/类
void extAttr(Vector receiver, String attr, String value) {
    int attr_pos=receiver.indexOf(attr) ;
    if ( attr_pos == -1) {
      // If attr IS NOT present in the Vector - add it
      receiver.add(attr); receiver.add(value);
    } else {
      // If attr IS present in the Vector - append value to it
      receiver.set(attr_pos+1,receiver.get(attr_pos+1)+value);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:BuildConfig.java

示例7: sortPathes

import java.util.Vector; //导入方法依赖的package包/类
private void sortPathes(Vector<DistanceEntry> pathList) {
	for (int i = 0; i < pathList.size(); i++) {
		for (int j = 0; j < pathList.size(); j++) {
			if (pathList.get(i).getDistance() > (pathList.get(j)
					.getDistance())) {
				DistanceEntry temp = pathList.get(i);
				pathList.set(i, pathList.get(j));
				pathList.set(j, temp);
			}
		}
	}
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:13,代码来源:DistributedNode.java

示例8: checkListContents

import java.util.Vector; //导入方法依赖的package包/类
private void checkListContents(Vector<String> scList, String... expList) {
    assertEquals("List does not contains expected number of items", expList.length, scList.size());
    for (int i = 0; i < scList.size(); i++) {
        scList.set(i, scList.get(i).toLowerCase());
    }
    for (String string : expList) {
        assertTrue(scList.contains(string.toLowerCase()));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:KeyMapTest.java

示例9: resetRowNumberAndReminderMaps

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Resets reminder maps.
 */
public void resetRowNumberAndReminderMaps() {
	keyRowVectorTreeMap.clear();
	keyIndexHashMap.clear();
	for (int i = 0; i < this.size(); i++) {
		Vector<Number> rowVector = this.get(i);
		if (this.isActivateRowNumber()==true) {
			rowVector.set(0, i+1);
		}
		Number key = rowVector.get(this.getKeyColumnIndex());
		this.keyRowVectorTreeMap.put(key, rowVector);
		this.keyIndexHashMap.put(key, i);
	}
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:17,代码来源:TableModelDataVector.java

示例10: adjustBaseModelWeights

import java.util.Vector; //导入方法依赖的package包/类
/**
 * This helper method takes as input the traing set and the set of models trained so far. It
 * re-estimates the model weights one by one, which means that it changes the contents of the
 * modelInfo container. Works with crisp base classifiers, only!
 *
 * @param exampleSet
 *            the training set to be used to tune the weights
 * @param modelInfo
 *            the <code>Vector</code> of <code>Model</code>s, each with its biasMatrix
 * @return <code>true</code> iff the <code>ExampleSet</code> contains at least one example that
 *         is not yet explained deterministically (otherwise: nothing left to learn)
 */
private boolean adjustBaseModelWeights(ExampleSet exampleSet, Vector<BayBoostBaseModelInfo> modelInfo)
		throws OperatorException {

	for (int j = 0; j < modelInfo.size(); j++) {
		BayBoostBaseModelInfo consideredModelInfo = modelInfo.get(j);
		Model consideredModel = consideredModelInfo.getModel();
		ContingencyMatrix cm = consideredModelInfo.getContingencyMatrix();
		// double[][] oldBiasMatrix = (double[][]) consideredModelInfo[1];

		BayBoostStream.createOrReplacePredictedLabelFor(exampleSet, consideredModel);
		exampleSet = consideredModel.apply(exampleSet);
		if (exampleSet.getAttributes().getPredictedLabel().isNominal() == false) {
			// Only the case of nominal base classifiers is supported!
			throw new UserError(this, 101, new Object[] { exampleSet.getAttributes().getLabel(),
			"BayBoostStream base learners" });
		}

		WeightedPerformanceMeasures wp = new WeightedPerformanceMeasures(exampleSet);
		ContingencyMatrix cmNew = wp.getContingencyMatrix();
		// double[][] newBiasMatrix = wp.createLiftRatioMatrix();
		if (isModelUseful(cm) == false) {
			modelInfo.remove(j);
			j--;
			log("Discard base model because of low advantage.");
		} else {
			consideredModelInfo = new BayBoostBaseModelInfo(consideredModel, cmNew);
			modelInfo.set(j, consideredModelInfo);

			boolean stillUncoveredExamples = WeightedPerformanceMeasures.reweightExamples(exampleSet, cmNew, false) > 0;
			if (stillUncoveredExamples == false) {
				return false;
			}
		}
	}
	return true;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:49,代码来源:BayBoostStream.java

示例11: combineFactors

import java.util.Vector; //导入方法依赖的package包/类
private Vector<Operator> combineFactors(Vector<Operator> operations, int i, Operator oper, double result) {
    // Change the factor 2 of previous operation
    if(i>0){
        Operator oper_previous=(Operator)operations.get(i-1);
        if (oper.getOperation()==ListOperations.SUBTRACTION){
            result=-result;
        }
        oper_previous.setFactor2(result);
        operations.set(i-1, oper_previous);
    }
    // Change the factor 1 of next operation
    if(i<operations.size()-1){
        Operator oper_next=(Operator)operations.get(i+1);
        oper_next.setFactor1(result);
        operations.set(i+1, oper_next);
    }

    // Delete the current object from the vector
    if (operations.size()>1) {
        operations.remove(i);
    }
    else{
        Operator oper_final=(Operator)operations.get(i);
        oper_final.setResult(result);
        operations.set(i, oper_final);
    }

    // Return the combined vector
    return operations;
}
 
开发者ID:DavidDuranPerez,项目名称:Simulator_Casio_fx-82MS,代码行数:31,代码来源:Calculator.java

示例12: parseConfig

import java.util.Vector; //导入方法依赖的package包/类
public void parseConfig(Reader reader) throws IOException, ConfigParseError {
    HashMap<String, String> optionAliases = new HashMap<>();
    optionAliases.put("server-poll-timeout", "timeout-connect");
    BufferedReader br = new BufferedReader(reader);
    int lineno = 0;
    try {
        while (true) {
            String line = br.readLine();
            lineno++;
            if (line == null) break;
            if (lineno == 1) {
                if ((line.startsWith("PK\003\004") || (line.startsWith("PK\007\008")))) {
                    throw new ConfigParseError("Input looks like a ZIP Archive. Import is only possible for OpenVPN config files (.ovpn/.conf)");
                }
                if (line.startsWith("\uFEFF")) {
                    line = line.substring(1);
                }
            }
            // Check for OpenVPN Access Server Meta information
            if (line.startsWith("# OVPN_ACCESS_SERVER_")) {
                Vector<String> metaarg = parsemeta(line);
                meta.put(metaarg.get(0), metaarg);
                continue;
            }
            Vector<String> args = parseline(line);
            if (args.size() == 0) continue;
            if (args.get(0).startsWith("--")) args.set(0, args.get(0).substring(2));
            checkinlinefile(args, br);
            String optionname = args.get(0);
            if (optionAliases.get(optionname) != null) optionname = optionAliases.get(optionname);
            if (!options.containsKey(optionname)) {
                options.put(optionname, new Vector<Vector<String>>());
            }
            options.get(optionname).add(args);
        }
    } catch (OutOfMemoryError memoryError) {
        throw new ConfigParseError("File too large to parse: " + memoryError.getLocalizedMessage());
    }
}
 
开发者ID:akashdeepsingh9988,项目名称:Cybernet-VPN,代码行数:40,代码来源:ConfigParser.java

示例13: editSeriesAddOrExchangeData

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Edits the data series by adding or exchanging data.
 * @param series the series
 * @param targetDataSeriesIndex the target data series index
 */
public void editSeriesAddOrExchangeData(DataSeries series, int targetDataSeriesIndex) throws NoSuchSeriesException {

	if (targetDataSeriesIndex<=(this.getColumnCount()-1)) {
		
		boolean dataWereAdded = false;
		int targetTbIndex = targetDataSeriesIndex+1;
		TreeMap<Number, Vector<Number>> tableDataTreeMap = new TreeMap<Number, Vector<Number>>(this.tableModelDataVector.getKeyRowVectorTreeMap()); 
		
		List valuePairs = parentDataModel.getValuePairsFromSeries(series);
		for (int i = 0; i < valuePairs.size(); i++) {
			// --- Find the key in the table ----------
			ValuePair vp = (ValuePair) valuePairs.get(i);
			Number key = parentDataModel.getXValueFromPair(vp);
			Number value = parentDataModel.getYValueFromValuePair(vp);

			Vector<Number> editRow = tableDataTreeMap.get(key);
			if (editRow==null) {
				// --- Add a new row ------------------
				editRow = new Vector<Number>();
				while(editRow.size() < this.getColumnCount()){
					editRow.add(null);
				}
				editRow.set(0, key);
				editRow.set(targetTbIndex, value);
				tableDataTreeMap.put(key, editRow);
				dataWereAdded = true;
				
			} else {
				// --- Finally edit the row -----------
				editRow.set(targetTbIndex, value);
			}
		}
		
		// --- Finally update the table, if necessary -
		if (dataWereAdded==true) {
			// --- Rebuild the table ------------------
			Number[] keyArray = new Number[tableDataTreeMap.size()]; 
			tableDataTreeMap.keySet().toArray(keyArray);
			for (int i=0; i<keyArray.length; i++) {
				Number keyTreeMap = keyArray[i];
				if ((valuePairs.size()-1)<i) {
					// --- Just add new data ----------
					this.tableModelDataVector.add(i, tableDataTreeMap.get(keyTreeMap));
				} else {
					Number keyValuePair = parentDataModel.getXValueFromPair((ValuePair) valuePairs.get(i));
					if (keyTreeMap.equals(keyValuePair)==false) {
						// --- New data was found -----
						this.tableModelDataVector.add(i, tableDataTreeMap.get(keyTreeMap));
					}	
				}
			}	
		}
		this.fireTableStructureChanged();
		
	} else {
		throw new NoSuchSeriesException();
	}
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:64,代码来源:TimeSeriesTableModel.java

示例14: exchangeSeries

import java.util.Vector; //导入方法依赖的package包/类
@Override
public void exchangeSeries(int seriesIndex, DataSeries series) throws NoSuchSeriesException {
	
	if(seriesIndex < this.getSeriesCount()){

		XyDataSeries xyDataSeries = (XyDataSeries) series;
		XYSeries editSeries = this.getSeries(seriesIndex);
		// --- Are there configuration changes ? -------------------------- 
		if (xyDataSeries.getAutoSort()==editSeries.getAutoSort() && xyDataSeries.getAvoidDuplicateXValues()==(!editSeries.getAllowDuplicateXValues())) {
			// --- No configuration changes -------------------------------
			editSeries.clear();
			if (series.getLabel()!=null) {
				editSeries.setKey(series.getLabel());
			}
			
			List valuePairs = xyDataSeries.getXyValuePairs();
			for (int i = 0; i < valuePairs.size(); i++) {
				XyValuePair valuePair = (XyValuePair) valuePairs.get(i);
				editSeries.add(valuePair.getXValue().getFloatValue(), valuePair.getYValue().getFloatValue());	
			}
			
		} else {
			// --- Configuration has changed ------------------------------
			XYSeries newSeries = (XYSeries) this.getXYSeriesFromXyDataSeries(xyDataSeries);
			// --- Replace the edit series with the new series ------------
			Vector<XYSeries> currSerieses = new Vector<XYSeries>();
			for (int i=0; i < this.getSeriesCount(); i++) {
				currSerieses.add(this.getSeries(i));
			}
			currSerieses.set(seriesIndex, newSeries);

			this.getXySeriesCollection().removeAllSeries();
			for (int i = 0; i < currSerieses.size(); i++) {
				this.getXySeriesCollection().addSeries(currSerieses.get(i));
			}
		}
		
	}else{
		throw new NoSuchSeriesException();
	}
	
	this.setChanged();
	this.notifyObservers(ChartModel.EventType.SERIES_ADDED);
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:45,代码来源:XyChartModel.java

示例15: getNext

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Find the next unique combination
 */
private void getNext() {
    assert (this.next == null);
    final boolean trace = LOG.isTraceEnabled();
    final boolean debug = LOG.isDebugEnabled();

    if (debug)
        LOG.debug("Finding next combination [call=" + (this.attempt_ctr++) + "]");

    boolean valid = false;
    Vector<Integer> buffer = null;
    for (int i = this.last.get(0); i < this.num_elements; i++) {
        if (trace)
            LOG.trace("\n" + this);

        buffer = new Vector<Integer>();
        buffer.setSize(this.combo_size);
        buffer.set(0, i);

        // We have a new combination!
        if (this.calculateCombinations(buffer, 1)) {
            if (trace)
                LOG.trace("Found new combination: " + buffer);
            valid = true;
            break;
        }
        if (trace)
            LOG.trace("No combination found that starts with index #" + i);
        buffer = null;
        this.initializeLast(i + 1);
    } // FOR

    if (trace)
        LOG.trace("VALID = " + valid);
    if (valid) {
        assert (this.combo_size == buffer.size());
        this.next = new ListOrderedSet<E>();
        for (int i = 0; i < this.combo_size; i++) {
            this.next.add(this.data.get(buffer.get(i)));
        } // FOR
        if (trace)
            LOG.trace("NEXT = " + this.next);

        // Increase the last position's counter so that it is different next
        // time
        this.last.set(this.combo_size - 1, this.last.lastElement() + 1);
        if (trace)
            LOG.trace("NEW LAST = " + this.last);

        this.finished = false;
    } else {
        this.finished = true;
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:57,代码来源:UniqueCombinationIterator.java


注:本文中的java.util.Vector.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。