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


Java Vector.removeElementAt方法代码示例

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


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

示例1: removeMenuItem

import java.util.Vector; //导入方法依赖的package包/类
private static boolean removeMenuItem(Vector vector, String menuItem) { //ugh...
    getFactory(); //assert menu bar stuff is loaded.

    for (int i = 0; i < vector.size(); i++) {
        MysterMenuItemFactory item = (MysterMenuItemFactory) (vector.elementAt(i));
        if (item.getName().equalsIgnoreCase(menuItem)) {
            vector.removeElementAt(i);
            while ((vector.size() > 0)
                    && (((MysterMenuItemFactory) (vector.elementAt(vector.size() - 1)))
                            .getName().equals("-"))) {
                vector.removeElementAt(vector.size() - 1);
            }

            updateMenuBars();

            return true;
        }
    }

    return false;
}
 
开发者ID:addertheblack,项目名称:myster,代码行数:22,代码来源:MysterMenuBar.java

示例2: DomRemove2D

import java.util.Vector; //导入方法依赖的package包/类
/**
 * La funzione elimina i punti dominati dal vettore passato
 * @param vertices      è un vettore di NewPoint
 * @return              un vettore di NewPoint contenente i vertici non dominati
 */
public Vector<newPoint> DomRemove2D(Vector<newPoint> vertices) {
	//Vector out = vertices;

	for (int i = 0; i < vertices.size(); i++) {
		boolean t = false;
		double x1 = vertices.get(i).getX();
		double y1 = vertices.get(i).getY();
		for (int j = 0; j < vertices.size(); j++) {

			double x2 = vertices.get(j).getX();
			double y2 = vertices.get(j).getY();
			if (x1 < x2 && y1 < y2) {
				t = true;
				break;
			}
		}
		if (t == true) {
			vertices.removeElementAt(i);
			// necessario x non saltare il punto successivo dato il ridimens. del vettore
			i--;
		}
	}
	return vertices;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:30,代码来源:Util2d.java

示例3: RemoveCollinear

import java.util.Vector; //导入方法依赖的package包/类
public Vector<newPoint> RemoveCollinear(Vector<newPoint> vertices) {
	Vector<newPoint> out = new Vector<newPoint>(vertices);
	int ilast = vertices.size() - 1;
	newPoint first = out.get(0);
	// Attenzione qui sotto out.get(0) -> out.get(1) ??
	newPoint second = out.get(1);
	newPoint last = out.lastElement();
	newPoint prelast = out.get(ilast - 1);

	if (last.x == prelast.x && last.y == 0) {
		out.remove(out.lastElement());
	}

	if (first.y == second.y && first.x == 0) {
		out.removeElementAt(0);
	}

	return out;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:20,代码来源:Util2d.java

示例4: DeleteFake

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Cancella il settore dove saturano 2 stazioni che unirebbe due settori complanari in cui saturano
 * 3 stazioni
 *
 * @param s3d
 * @return
 */
public Vector<Object> DeleteFake(Vector<Object> s3d) {
	for (int i = 0; i < s3d.size(); i++) {

		if (Math.abs(((Sector3D) s3d.get(i)).getBeta(0, 0) - ((Sector3D) s3d.get(i)).getBeta(1, 0)) < EPSYLON
				&& Math.abs(((Sector3D) s3d.get(i)).getBeta(0, 1) - ((Sector3D) s3d.get(i)).getBeta(1, 1)) < EPSYLON
				&& Math.abs(((Sector3D) s3d.get(i)).getBeta(0, 2) - ((Sector3D) s3d.get(i)).getBeta(1, 2)) < EPSYLON
				&& Math.abs(((Sector3D) s3d.get(i)).getBeta(2, 0) - ((Sector3D) s3d.get(i)).getBeta(3, 0)) < EPSYLON
				&& Math.abs(((Sector3D) s3d.get(i)).getBeta(2, 1) - ((Sector3D) s3d.get(i)).getBeta(3, 1)) < EPSYLON
				&& Math.abs(((Sector3D) s3d.get(i)).getBeta(2, 2) - ((Sector3D) s3d.get(i)).getBeta(3, 2)) < EPSYLON) {
			s3d.removeElementAt(i);
			i--;
		}
	}
	return s3d;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:23,代码来源:Beta3D.java

示例5: DomRemove2D

import java.util.Vector; //导入方法依赖的package包/类
/**
 * La funzione elimina i punti dominati dal vettore passato
 * @param vertices      � un vettore di NewPoint
 * @return              un vettore di NewPoint contenente i vertici non dominati
 */
public Vector<newPoint> DomRemove2D(Vector<newPoint> vertices) {
	//Vector out = vertices;

	for (int i = 0; i < vertices.size(); i++) {
		boolean t = false;
		double x1 = vertices.get(i).getX();
		double y1 = vertices.get(i).getY();
		for (int j = 0; j < vertices.size(); j++) {

			double x2 = vertices.get(j).getX();
			double y2 = vertices.get(j).getY();
			if (x1 < x2 && y1 < y2) {
				t = true;
				break;
			}
		}
		if (t == true) {
			vertices.removeElementAt(i);
			// necessario x non saltare il punto successivo dato il ridimens. del vettore
			i--;
		}
	}
	return vertices;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:30,代码来源:Util2d.java

示例6: findLiveBlocks

import java.util.Vector; //导入方法依赖的package包/类
public static BasicBlock[] findLiveBlocks(BasicBlock[] blocks) {
	// add reachable blocks
	Vector next = new Vector ();
	next.addElement( blocks[0] );
	while ( ! next.isEmpty() ) {
		BasicBlock b = (BasicBlock) next.elementAt(0);
		next.removeElementAt(0);
		if ( ! b.islive ) {
			b.islive = true;
			for ( int i=0, n=b.next!=null? b.next.length: 0; i<n; i++ )
				if ( ! b.next[i].islive )
					next.addElement( b.next[i] );
		}
	}
	
	// create list in natural order
	Vector list = new Vector();
	for ( int i=0; i<blocks.length; i=blocks[i].pc1+1 )
		if ( blocks[i].islive )
			list.addElement(blocks[i]);
	
	// convert to array
	BasicBlock[] array = new BasicBlock[list.size()];
	list.copyInto(array);
	return array;
}
 
开发者ID:hsllany,项目名称:HtmlNative,代码行数:27,代码来源:BasicBlock.java

示例7: removeColumn

import java.util.Vector; //导入方法依赖的package包/类
public void removeColumn(int index) {
	TableColumn column = getColumnModel().getColumn(index);
	int modelIndex = column.getModelIndex();
	Vector modelData = model.getDataVector();
	Vector columnIdentifiers = model.getColumnIdentifiers();

	// remove the column from the table
	removeColumn(column);

	// remove the column header from the table model
	columnIdentifiers.removeElementAt(modelIndex);

	// remove the column data
	for (int i = 0; i < modelData.size(); i++) {
		Vector row = (Vector) modelData.get(i);
		row.removeElementAt(modelIndex);
	}
	model.setDataVector(modelData, columnIdentifiers);

	// correct the model indices in the TableColumn objects
	Enumeration columns = getColumnModel().getColumns();
	while (columns.hasMoreElements()) {
		TableColumn currentColumn = (TableColumn) columns.nextElement();
		if (currentColumn.getModelIndex() >= modelIndex) {
			currentColumn.setModelIndex(currentColumn.getModelIndex() - 1);
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:29,代码来源:MatrixPropertyTable.java

示例8: updateUndoPositions

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Resets the location for all the UndoPosRef instances
 * in <code>positions</code>.
 * <p>
 * This is meant for internal usage, and is generally not of interest
 * to subclasses.
 *
 * @param positions the positions of the instances
 */
protected void updateUndoPositions(Vector positions) {
    for(int counter = positions.size() - 1; counter >= 0; counter--) {
        UndoPosRef ref = (UndoPosRef)positions.elementAt(counter);
        // Check if the Position is still valid.
        if(ref.rec.unused) {
            positions.removeElementAt(counter);
        }
        else
            ref.resetLocation();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:StringContent.java

示例9: reverse

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Reverse the order of the vertices that define a contour
 */
public void reverse() {
	/* Add vertices in reverse order */
	Vector<Vertex> vertices = getVertices();
	int size = vertices.size();
	for (int i = 1; i < size; i++) {
		vertices.insertElementAt(vertices.elementAt(i), 0);
		vertices.removeElementAt(i + 1);
	}
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:13,代码来源:Polygon.java

示例10: markForBack

import java.util.Vector; //导入方法依赖的package包/类
public static void markForBack(HttpServletRequest request, String uri, String title, boolean back, boolean clear) {
	synchronized (request.getSession()) {
		Vector backList = getBackList(request.getSession());
		if (clear) backList.clear();
		if (back) {
			if (uri==null && request.getAttribute("javax.servlet.forward.request_uri")==null) return;
			Object titleObj = (title==null?request.getAttribute("title"):title);
			String requestURI = (String)request.getAttribute("javax.servlet.forward.request_uri");
			String queryString = (String)request.getAttribute("javax.servlet.forward.query_string");
			if (queryString!=null && queryString.length()>0)
				requestURI += "?"+queryString;
			if (uri!=null)
				requestURI = uri;
			if (!backList.isEmpty()) {
				int found = -1;
				for (int idx = 0; idx<backList.size(); idx++) {
					String[] lastBack = (String[])backList.elementAt(idx);
					if (lastBack[0].equals(requestURI)) {
						found = idx; break;
					}
				}
				while (found>=0 && backList.size()>found)
					backList.removeElementAt(backList.size()-1);
			}
			backList.addElement(new String[]{requestURI,(titleObj==null?null:titleObj.toString())});
			//System.out.println("ADD BACK:"+requestURI+" ("+titleObj+")");
		}
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:30,代码来源:BackTracker.java

示例11: stripJavaPackage

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Strip Java #pragma prefix and/or -pkgPrefix prefix package names from
 * given IDLEntity ct.
 * Strip any package prefix which may have been added by comparing with
 * repository id. For example in Java package fake.omega:
 *   repid = IDL:phoney.pfix/omega/Juliet:1.0 gives { "omega" }
 * @param ct CompoundType containing given IDLEntity.
 * @param vec Returned Vector of stripped IDL module names.
 */
protected void stripJavaPackage(
                                CompoundType ct,
                                Vector vec ) {
    vec.removeAllElements();
    if ( ! ct.isIDLEntity() ) return;

    String repID = ct.getRepositoryID().substring( 4 );
    StringTokenizer rept = new StringTokenizer( repID,"/" );
    if ( rept.countTokens() < 2 ) return;

    while ( rept.hasMoreTokens() )
        vec.addElement( rept.nextToken() );
    vec.removeElementAt( vec.size() - 1 );

    String pName = ct.getPackageName();         //start from Java package names
    if ( pName == null ) return;
    Vector pVec = new Vector();
    StringTokenizer pt = new StringTokenizer( pName,"." );
    while ( pt.hasMoreTokens() ) pVec.addElement( pt.nextToken() );

    int i1 = vec.size() - 1;
    int i2 = pVec.size() - 1;
    while ( i1 >= 0 && i2 >= 0 ) {                      //go R->L till mismatch
        String rep = (String)( vec.elementAt( i1 ) );
        String pkg = (String)( pVec.elementAt( i2 ) );
        if ( ! pkg.equals( rep ) ) break;
        i1--; i2--;
    }
    for ( int i3 = 0; i3 <= i1; i3++ )
        vec.removeElementAt( 0 );                                  //strip prefix
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:IDLGenerator.java

示例12: translateJavaPackage

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Apply user specified -idlModule translation to package names of given
 * IDLEntity ct. Example:
 *   -idlModule foo.bar real::mod::nesting
 * @param ct CompoundType containing given IDLEntity.
 * @param vec Returned Vector of translated IDL module names.
 * @return boolean true if any translation was done.
 */
protected boolean translateJavaPackage(
                                       CompoundType ct,
                                       Vector vec ) {
    vec.removeAllElements();
    boolean ret = false;
    String fc = null;
    if ( ! ct.isIDLEntity() ) return ret;

    String pName = ct.getPackageName();         //start from Java package names
    if ( pName == null ) return ret;
    StringTokenizer pt = new StringTokenizer( pName,"." );
    while ( pt.hasMoreTokens() ) vec.addElement( pt.nextToken() );

    if ( imHash.size() > 0 ) {           //any -idlModule translation to apply?
        Enumeration k = imHash.keys();

    nextModule:
        while ( k.hasMoreElements() ) {      //loop thro user-defined -idlModules
            String from = (String)k.nextElement();                  //from String..
            StringTokenizer ft = new StringTokenizer( from,"." );
            int vecLen = vec.size();
            int ifr;
            for ( ifr = 0; ifr < vecLen && ft.hasMoreTokens(); ifr++ )
                if ( ! vec.elementAt(ifr).equals( ft.nextToken() ) )
                    continue nextModule;                                  //..no match

            if ( ft.hasMoreTokens() ) {                          //matched so far..
                fc = ft.nextToken();                         //a 'from' token remains
                if ( ! ct.getName().equals( fc ) ||             //matches class name?
                     ft.hasMoreTokens() )
                    continue nextModule;                                   //..no match
            }

            ret = true;                                             //found a match
            for ( int i4 = 0; i4 < ifr; i4++ )
                vec.removeElementAt( 0 );                     //remove 'from' package

            String to = (String)imHash.get( from );                   //..to String
            StringTokenizer tt = new StringTokenizer( to,IDL_NAME_SEPARATOR );

            int itoco = tt.countTokens();
            int ito = 0;
            if ( fc != null ) itoco--;               //user may have given IDL type
            for ( ito = 0; ito < itoco; ito++ )
                vec.insertElementAt( tt.nextToken(),ito );      //insert 'to' modules
            if ( fc != null ) {
                String tc = tt.nextToken();
                if ( ! ct.getName().equals( tc ) )           //not the IDL type, so..
                    vec.insertElementAt( tc,ito );           //insert final 'to' module
            }
        }
    }
    return ret;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:63,代码来源:IDLGenerator.java

示例13: JoinComplanars

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Il metodo è usato per unire i settori complanari, quelli cioè dove saturano più di 3 stazioni contemp.
 *
 * @param triangles è un vettore contenente i settori a triangolo dove saturano 3 stazioni contemporaneamente
 * @return un vettore con i settori uniti
 */
public Vector<Object> JoinComplanars(Vector<Object> triangles) {
	Vector<Object> out = new Vector<Object>();
	for (int i = 0; i < triangles.size(); i++) {
		for (int j = i + 1; j < triangles.size(); j++) {
			Vector<BetaVertex> bi = new Vector<BetaVertex>();
			int c = 0;
			for (int h = 0; h < ((Sector3D) triangles.get(i)).CountPoint(); h++) {
				bi.addElement(((Sector3D) triangles.get(i)).getV(h));
			}

			{
				int[] d = { -1, -1 };
				int k = 0;

				Vector<BetaVertex> bj = new Vector<BetaVertex>();
				for (int h = 0; h < ((Sector3D) triangles.get(j)).CountPoint(); h++) {
					bj.addElement(((Sector3D) triangles.get(j)).getV(h));
				}

				for (int a = 0; a < bi.size(); a++) {
					for (int b = 0; b < bj.size(); b++) {
						if (bj.get(b).CircaEquals(bi.get(a))) {
							c++;
							d[k] = a;
							k++;
						}
					}
				}

				//ATTIVARE SOLO PER CONTROLLI
				//System.out.println(c);
				//System.out.println(k);

				if (c > 1) {
					// toglie un triangolo e crea un settore con 4 stazioni
					((Sector3D) triangles.get(i)).setType(((Sector3D) triangles.get(i)).getType() + 1);
					int z = 0;
					if (d[0] != 0 && d[1] != 0) {
						z = 0;
					} else if (d[0] != 1 && d[1] != 1) {
						z = 1;
					} else if (d[0] != 2 && d[1] != 2) {
						z = 2;
					}
					BetaVertex betas = new BetaVertex(((Sector3D) triangles.get(j)).getBetas(z));
					((Sector3D) triangles.get(i)).AddVertex(betas, ((Sector3D) triangles.get(j)).getS(z));
					triangles.removeElementAt(j);
					j--;
				}
			}
		}
	}

	//todo creare un controllo ciclico che crei settori con N stazioni
	out = triangles;
	return out;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:64,代码来源:Beta3D.java

示例14: mergeTables

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Description of the Method
 *
 * @param txt1 Description of the Parameter
 * @param txt2 Description of the Parameter
 * @return Description of the Return Value
 */
public String mergeTables(String txt1, String txt2) {
    YassProperties prop = new YassProperties();
    YassRow.setValidTags(prop.getProperty("valid-tags"));
    YassRow.setValidLines(prop.getProperty("valid-lines"));

    YassTable t1 = new YassTable();
    t1.setText(txt1.toString());
    YassTable t2 = new YassTable();
    t2.setText(txt2.toString());

    double gap1 = t1.getGap();
    double gap2 = t2.getGap();

    if (gap2 < gap1) {
        double g = gap1;
        gap1 = gap2;
        gap2 = g;

        YassTable d = t1;
        t1 = t2;
        t2 = d;
    }

    int dbeat = (int) Math.round((gap2 - gap1) * 4 * bpm / (60.0 * 1000.0));

    int n1 = t1.getRowCount();
    YassTableModel tm = (YassTableModel) t1.getModel();
    Vector<YassRow> data = tm.getData();
    data.removeElementAt(n1 - 1);

    int n2 = t2.getRowCount();
    for (int i = 0; i < n2; i++) {
        YassRow r = t2.getRowAt(i);
        if (r.isComment()) {
            continue;
        }
        if (r.isNoteOrPageBreak()) {
            int beat = r.getBeatInt();
            r.setBeat(beat + dbeat);
        }
        data.addElement(r);
    }

    java.util.Collections.sort(data);
    String txt = t1.getPlainText();
    System.out.println(txt);
    return txt;
}
 
开发者ID:SarutaSan72,项目名称:Yass,代码行数:56,代码来源:YassMIDIConverter.java

示例15: computeUniqueCatchList

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Compute the exceptions which need to be caught and rethrown in a
 * stub method before wrapping Exceptions in UnexpectedExceptions,
 * given the exceptions declared in the throws clause of the method.
 * Returns a Vector containing ClassDefinition objects for each
 * exception to catch.  Each exception is guaranteed to be unique,
 * i.e. not a subclass of any of the other exceptions in the Vector,
 * so the catch blocks for these exceptions may be generated in any
 * order relative to each other.
 *
 * RemoteException and RuntimeException are each automatically placed
 * in the returned Vector (if none of their superclasses are already
 * present), since those exceptions should always be directly rethrown
 * by a stub method.
 *
 * The returned Vector will be empty if java.lang.Exception or one
 * of its superclasses is in the throws clause of the method, indicating
 * that no exceptions need to be caught.
 */
private Vector<ClassDefinition> computeUniqueCatchList(ClassDeclaration[] exceptions) {
    Vector<ClassDefinition> uniqueList = new Vector<>();       // unique exceptions to catch

    uniqueList.addElement(defRuntimeException);
    uniqueList.addElement(defRemoteException);

    /* For each exception declared by the stub method's throws clause: */
nextException:
    for (int i = 0; i < exceptions.length; i++) {
        ClassDeclaration decl = exceptions[i];
        try {
            if (defException.subClassOf(env, decl)) {
                /*
                 * (If java.lang.Exception (or a superclass) was declared
                 * in the throws clause of this stub method, then we don't
                 * have to bother catching anything; clear the list and
                 * return.)
                 */
                uniqueList.clear();
                break;
            } else if (!defException.superClassOf(env, decl)) {
                /*
                 * Ignore other Throwables that do not extend Exception,
                 * since they do not need to be caught anyway.
                 */
                continue;
            }
            /*
             * Compare this exception against the current list of
             * exceptions that need to be caught:
             */
            for (int j = 0; j < uniqueList.size();) {
                ClassDefinition def = uniqueList.elementAt(j);
                if (def.superClassOf(env, decl)) {
                    /*
                     * If a superclass of this exception is already on
                     * the list to catch, then ignore and continue;
                     */
                    continue nextException;
                } else if (def.subClassOf(env, decl)) {
                    /*
                     * If a subclass of this exception is on the list
                     * to catch, then remove it.
                     */
                    uniqueList.removeElementAt(j);
                } else {
                    j++;    // else continue comparing
                }
            }
            /* This exception is unique: add it to the list to catch. */
            uniqueList.addElement(decl.getClassDefinition(env));
        } catch (ClassNotFound e) {
            env.error(0, "class.not.found", e.name, decl.getName());
            /*
             * REMIND: We do not exit from this exceptional condition,
             * generating questionable code and likely letting the
             * compiler report a resulting error later.
             */
        }
    }
    return uniqueList;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:82,代码来源:RMIGenerator.java


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