本文整理汇总了Java中java.util.Vector.remove方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.remove方法的具体用法?Java Vector.remove怎么用?Java Vector.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Vector
的用法示例。
在下文中一共展示了Vector.remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTableDataAsObjectVector
import java.util.Vector; //导入方法依赖的package包/类
/**
* Converts the table data to a Vector of Object Vectors
* @param addHeaders If true, an additional vector containing the column headers will be added
* @param isTimeSeriesData If true, the first column is interpreted as timestamps and converted to a time format
* @return The table data as a Vector of Object Vectors
*/
public Vector<Vector<Object>> getTableDataAsObjectVector(boolean addHeaders, boolean isTimeSeriesData){
Vector<Vector<Object>> dataVector = new Vector<Vector<Object>>();
DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
if(addHeaders == true){
dataVector.addElement(new Vector<Object>(Arrays.asList(columnTitles.toArray())));
}
Collection<Vector<Number>> treeMapData = this.getTableModelDataVector().getKeyRowVectorTreeMap().values();
for(Vector<Number> numberVector : treeMapData){
Vector<Object> objectVector = new Vector<Object>(Arrays.asList(numberVector.toArray()));
if(isTimeSeriesData == true){
long timestamp = (long) objectVector.get(0);
String dateTime = dateFormat.format(new Date(timestamp));
objectVector.remove(0);
objectVector.insertElementAt(dateTime, 0);
}
dataVector.addElement(objectVector);
}
return dataVector;
}
示例2: remove
import java.util.Vector; //导入方法依赖的package包/类
/**
* Removes the specified <code>TrayIcon</code> from the
* <code>SystemTray</code>.
*
* <p> All icons added by the application are automatically
* removed from the <code>SystemTray</code> upon application exit
* and also when the desktop system tray becomes unavailable.
*
* <p> If <code>trayIcon</code> is <code>null</code> or was not
* added to the system tray, no exception is thrown and no action
* is performed.
*
* @param trayIcon the <code>TrayIcon</code> to be removed
* @see #add(TrayIcon)
* @see TrayIcon
*/
public void remove(TrayIcon trayIcon) {
if (trayIcon == null) {
return;
}
TrayIcon[] oldArray = null, newArray = null;
synchronized (this) {
oldArray = systemTray.getTrayIcons();
Vector<TrayIcon> icons = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
// TrayIcon with no peer is not contained in the array.
if (icons == null || !icons.remove(trayIcon)) {
return;
}
trayIcon.removeNotify();
newArray = systemTray.getTrayIcons();
}
firePropertyChange("trayIcons", oldArray, newArray);
}
示例3: loadSeats
import java.util.Vector; //导入方法依赖的package包/类
private void loadSeats(){
try {
Flight f = new Flight(fl.getFlight_no());
Tickets tk = new Tickets();
ResultSet rs = tk.getforleg(fl.getLeg_no());
Vector tickets = new Vector();
for(int i=1; i<f.getMax_seats();i++){
tickets.addElement(i);
}
while(rs.next()){
tickets.remove(rs.getInt("seat_no"));
}
jComboBox1.removeAllItems();
for(Object s : tickets){
jComboBox1.addItem(s.toString());
}
} catch (SQLException ex) {
Logger.getLogger(ChooseSeat.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例4: getStreamedSectors
import java.util.Vector; //导入方法依赖的package包/类
/**
* Метод повертає набір під’єднаних секторв, які мають зв’язок з потоком.
*
* @param point
* @param v
*/
protected void getStreamedSectors(final Crosspoint point,
final Vector<Sector> v) {
if (point == null)
return;
final int oLen = v.size();
point.getSectors(v);
final int len = v.size();
final Vector<Sector> r = new Vector<Sector>();
for (int i = oLen; i < len; i++)
if (!v.get(i).getFunction().equals(getFunction())
|| v.get(i).getStream() == null
|| !v.get(i).getStream().equals(getStream()))
r.add(v.get(i));
for (int i = 0; i < r.size(); i++)
v.remove(r.get(i));
}
示例5: setProperty
import java.util.Vector; //导入方法依赖的package包/类
/**
* Sets the value for the specified property
*
* @param propertyName the name of the property to be set. The supported properties are: <br>
* - FROM_PROPERTY <br>
* - TO_PROPERTY <br>
* - STEPS_PROPERTY <br>
* - REFERENCE_CLASS_PROPERTY
* @param value the value to be set
*/
@Override
public void setProperty(String propertyName, String value) {
if (propertyName.equals(FROM_PROPERTY)) {
initialValue = Double.parseDouble(value);
} else if (propertyName.equals(TO_PROPERTY)) {
finalValue = Double.parseDouble(value);
} else if (propertyName.equals(STEPS_PROPERTY)) {
numberOfSteps = Integer.parseInt(value);
if (numberOfSteps > MAX_STEP_NUMBER) {
numberOfSteps = MAX_STEP_NUMBER;
}
} else if (propertyName.equals(REFERENCE_CLASS_PROPERTY)) {
classKey = classDef.getClassByName(value);
Vector temp = classDef.getClosedClassKeys();
temp.remove(classKey);
otherClassKey = temp.get(0);
}
}
示例6: updateTable
import java.util.Vector; //导入方法依赖的package包/类
private void updateTable(Iterator iterator) {
int rowCount = dftm.getRowCount();
for (int i = 0; i < rowCount; i++) {
dftm.removeRow(0);
}
while (iterator.hasNext()) {
Vector vector = new Vector();
List view = (List) iterator.next();
Vector row=new Vector(view);
int rowSize = row.size();
for(int i=rowSize-2;i<rowSize;i++){
Object colValue = row.get(i);
row.remove(i);
row.insertElementAt(colValue, 2);
}
vector.addAll(row);
dftm.addRow(vector);
}
}
示例7: orderByX
import java.util.Vector; //导入方法依赖的package包/类
/**
* This function return a vector that contains the same point of the parameter one but
* the points are orderet from the point whith the biggest X to the point whith the smallest X
* @param v The vector to order
* @return The vector ordered
*/
private Vector<Point2D> orderByX(Vector<Point2D> v) {
Vector<Point2D> r = (Vector<Point2D>) v.clone();
boolean again = true;
while (again) {
again = false;
for (int k = 0; k < r.size() - 1; k++) {
//Take the points
Point2D p1 = r.get(k);
Point2D p2 = r.get(k + 1);
if (p1.getX() < p2.getX()) {
//swap
r.remove(k);
r.insertElementAt(p2, k);
r.remove(k + 1);
r.insertElementAt(p1, k + 1);
again = true;
}
}
}
return r;
}
示例8: toTexString
import java.util.Vector; //导入方法依赖的package包/类
@Override
public String toTexString(){
StringBuffer sb = new StringBuffer();
sb.append("(");
Vector<ComposedConstraint> alternatives = new Vector<ComposedConstraint>();
alternatives.add(left);
alternatives.add(right);
for (int i = 0; i < alternatives.size(); i++){
ComposedConstraint constraint = alternatives.get(i);
if (constraint instanceof AndConstraint){
alternatives.remove(i);
alternatives.add(i, ((AndConstraint)constraint).right);
alternatives.add(i, ((AndConstraint)constraint).left);
i--;
} else {
if (i > 0)
sb.append("\\wedge ");
sb.append(constraint.toTexString());
}
}
sb.append(")");
return sb.toString();
}
示例9: toTexString
import java.util.Vector; //导入方法依赖的package包/类
@Override
public String toTexString(){
StringBuffer sb = new StringBuffer();
sb.append("(");
Vector<ComposedConstraint> alternatives = new Vector<ComposedConstraint>();
alternatives.add(left);
alternatives.add(right);
for (int i = 0; i < alternatives.size(); i++){
ComposedConstraint constraint = alternatives.get(i);
if (constraint instanceof OrConstraint){
alternatives.remove(i);
alternatives.add(i, ((OrConstraint)constraint).right);
alternatives.add(i, ((OrConstraint)constraint).left);
i--;
} else {
if (i > 0)
sb.append("\\vee ");
sb.append(constraint.toTexString());
}
}
sb.append(")");
return sb.toString();
}
示例10: sortAgentClassMetricDescriptionVectorDescending
import java.util.Vector; //导入方法依赖的package包/类
/**
* Sort agent class metric description vector descending.
*
* @param acmdv the agent class metric description vector
* @return the sorted (descending) agent class metric description vector
*/
private Vector<AgentClassMetricDescription> sortAgentClassMetricDescriptionVectorDescending(Vector<AgentClassMetricDescription> acmdv){
Vector<AgentClassMetricDescription> sortedAcmdv = new Vector<AgentClassMetricDescription>();
//copy
for(int i = 0; i < acmdv.size(); i++){
sortedAcmdv.add(acmdv.get(i));;
}
for(int indexA = 0; indexA < sortedAcmdv.size()-1; indexA++){
for(int indexB = 1; indexB < sortedAcmdv.size()-indexA; indexB++){
double metricA = 0;
double metricB = 0;
if(currProject.getAgentClassLoadMetrics().isUseRealLoadMetric() == true){
metricA = sortedAcmdv.get(indexB-1).getRealMetric();
metricB = sortedAcmdv.get(indexB).getRealMetric();
}else{
metricA = sortedAcmdv.get(indexB-1).getUserPredictedMetric();
metricB = sortedAcmdv.get(indexB).getUserPredictedMetric();
}
//compare and reorder
if(metricA < metricB){
AgentClassMetricDescription acmdvTemp = sortedAcmdv.get(indexB-1);
sortedAcmdv.remove(indexB-1);
sortedAcmdv.add(indexB, acmdvTemp);
}
}
}
return sortedAcmdv;
}
示例11: doImport
import java.util.Vector; //导入方法依赖的package包/类
/**
* This method imports data from a CSV file
*/
public void doImport(){
if (this.getFile()==null) {
System.err.println("No CSV file specified for import!");
}else{
CsvFileReader fileReader = new CsvFileReader(this.separator);
Vector<Vector<Object>> importedData = fileReader.importData(this.file);
if(importedData != null){
Vector<Object> headlines;
if(this.hasHeadlines()){
headlines = importedData.get(0);
importedData.remove(0);
}else{
headlines = new Vector<Object>();
int columnCount = importedData.get(0).size();
for(int i=0; i<columnCount; i++){
headlines.addElement("Column "+(i+1));
}
}
DefaultTableModel tableModel = new DefaultTableModel();
tableModel.setDataVector(importedData, headlines);
this.setTableModel(tableModel);
}
}
}
示例12: 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;
}
示例13: initVectors
import java.util.Vector; //导入方法依赖的package包/类
public void initVectors(){
hiddenV = new Vector<String>();
visibleV = new Vector<String>();
Vector<String> v = (Vector<String>) ds.header.clone();
for (int i = 0; i < ds.tm.indexH.size(); i++){
visibleV.add(ds.header.get(ds.tm.indexH.get(i)));
v.remove(visibleV.get(visibleV.size()-1));
}
v.trimToSize();
for (int i =0; i < v.size(); i++)
hiddenV.add(v.get(i));
}
示例14: getMultipleNodesAsNeeded
import java.util.Vector; //导入方法依赖的package包/类
/**
* For a 'multiple' cardinality of a slot, the needed nodes will be created.
*
* @param currNode the curr node
* @param nodesNeeded the nodes needed
* @return the multiple nodes as needed
*/
private Vector<DefaultMutableTreeNode> getMultipleNodesAsNeeded(DefaultMutableTreeNode currNode, int nodesNeeded) {
// --- Get the Vector of all currently available nodes of this kind -------------
Vector<DefaultMutableTreeNode> nodesAvailableVector = this.getMultipleNodesAvailable(currNode);
int nodesAvailableCounter = nodesAvailableVector.size();
// --- Get the kind of the DynTyp-object ----------------------------------------
DynType dt = (DynType) currNode.getUserObject();
String typeName = dt.getTypeName();
boolean isInnerClass = false;
if (typeName.equals(DynType.typeClass) || typeName.equals(DynType.typeInnerClassType)) {
isInnerClass = true;
} else if (typeName.equals(DynType.typeRawType)) {
isInnerClass = false;
} else if (typeName.equals(DynType.typeCyclic)) {
return nodesAvailableVector;
}
// --- If the number of nodes is different to the 'numberOfSlotsNeeded' ---------
if (nodesAvailableCounter<nodesNeeded) {
// --- Consider the number of nodes found is smaller than needed -------
Vector<DefaultMutableTreeNode> nodesNew = new Vector<DefaultMutableTreeNode>();
while (nodesAvailableVector.size()+nodesNew.size()<nodesNeeded) {
DefaultMutableTreeNode newNode = this.addSingleMultipleNode(currNode, isInnerClass);
nodesNew.add(newNode);
}
Collections.reverse(nodesNew);
nodesAvailableVector.addAll(nodesNew);
} else if (nodesAvailableCounter>nodesNeeded) {
// --- Consider the number of nodes found is greater than needed -------
while (nodesAvailableVector.size()>nodesNeeded && nodesAvailableVector.size()>1) {
DefaultMutableTreeNode delNode = nodesAvailableVector.get(nodesAvailableVector.size()-1);
this.removeMultiple(delNode);
nodesAvailableVector.remove(nodesAvailableVector.size()-1);
}
}
return nodesAvailableVector;
}
示例15: prioritizeRules
import java.util.Vector; //导入方法依赖的package包/类
/**
* Orders a set or rules by priority, removes redundant rules and rules
* that are shadowed by stronger, contradicting rules.
*/
private static int prioritizeRules(Vector rules) {
WhitespaceRule currentRule;
int defaultAction = PRESERVE_SPACE;
// Sort all rules with regard to priority
quicksort(rules, 0, rules.size()-1);
// Check if there are any "xsl:strip-space" elements at all.
// If there are no xsl:strip elements we can ignore all xsl:preserve
// elements and signal that all whitespaces should be preserved
boolean strip = false;
for (int i = 0; i < rules.size(); i++) {
currentRule = (WhitespaceRule)rules.elementAt(i);
if (currentRule.getAction() == STRIP_SPACE) {
strip = true;
}
}
// Return with default action: PRESERVE_SPACE
if (!strip) {
rules.removeAllElements();
return PRESERVE_SPACE;
}
// Remove all rules that are contradicted by rules with higher priority
for (int idx = 0; idx < rules.size(); ) {
currentRule = (WhitespaceRule)rules.elementAt(idx);
// Remove this single rule if it has no purpose
if (findContradictingRule(rules,currentRule) != null) {
rules.remove(idx);
}
else {
// Remove all following rules if this one overrides all
if (currentRule.getStrength() == RULE_ALL) {
defaultAction = currentRule.getAction();
for (int i = idx; i < rules.size(); i++) {
rules.removeElementAt(i);
}
}
// Skip to next rule (there might not be any)...
idx++;
}
}
// The rules vector could be empty if first rule has strength RULE_ALL
if (rules.size() == 0) {
return defaultAction;
}
// Now work backwards and strip away all rules that have the same
// action as the default rule (no reason the check them at the end).
do {
currentRule = (WhitespaceRule)rules.lastElement();
if (currentRule.getAction() == defaultAction) {
rules.removeElementAt(rules.size() - 1);
}
else {
break;
}
} while (rules.size() > 0);
// Signal that whitespace detection predicate must be used.
return defaultAction;
}