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


Java Vector.clear方法代码示例

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


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

示例1: refreshModel

import java.util.Vector; //导入方法依赖的package包/类
private void refreshModel(final ProfilerTable table) {
    Object selected = null;
    Set original = new HashSet();
    int selrow = table.getSelectedRow();
    int column = table.convertColumnIndexToView(0);
    for (int row = 0; row < table.getRowCount(); row++) {
        Object value = table.getValueAt(row, column);
        original.add(value);
        if (row == selrow) selected = value;
    }
    
    final DefaultTableModel model = (DefaultTableModel)table.getModel();
    Vector data = model.getDataVector();
    data.clear();
    
    for (JavaPlatform platform : JavaPlatform.getPlatforms()) {
        data.add(new Vector(Arrays.asList(platform, null)));
        if (!original.contains(platform)) selected = platform;
    }
    
    table.clearSelection();
    model.fireTableDataChanged();
    
    if (selected != null) table.selectValue(selected, column, true);
    
    RequestProcessor.getDefault().post(new Runnable() {
        public void run() { refreshTimes(model); }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:RunCalibrationAction.java

示例2: checkinlinefile

import java.util.Vector; //导入方法依赖的package包/类
private void checkinlinefile(Vector<String> args, BufferedReader br) throws IOException, ConfigParseError {
    String arg0 = args.get(0).trim();
    // CHeck for <foo>
    if (arg0.startsWith("<") && arg0.endsWith(">")) {
        String argname = arg0.substring(1, arg0.length() - 1);
        String inlinefile = VpnProfile.INLINE_TAG;
        String endtag = String.format("</%s>", argname);
        do {
            String line = br.readLine();
            if (line == null) {
                throw new ConfigParseError(String.format("No endtag </%s> for starttag <%s> found", argname, argname));
            }
            if (line.trim().equals(endtag)) break;
            else {
                inlinefile += line;
                inlinefile += "\n";
            }
        } while (true);
        if (inlinefile.endsWith("\n")) inlinefile = inlinefile.substring(0, inlinefile.length() - 1);
        args.clear();
        args.add(argname);
        args.add(inlinefile);
    }
}
 
开发者ID:akashdeepsingh9988,项目名称:Cybernet-VPN,代码行数:25,代码来源:ConfigParser.java

示例3: finalizeSubCurves

import java.util.Vector; //导入方法依赖的package包/类
public static void finalizeSubCurves(Vector subcurves, Vector chains) {
    int numchains = chains.size();
    if (numchains == 0) {
        return;
    }
    if ((numchains & 1) != 0) {
        throw new InternalError("Odd number of chains!");
    }
    ChainEnd[] endlist = new ChainEnd[numchains];
    chains.toArray(endlist);
    for (int i = 1; i < numchains; i += 2) {
        ChainEnd open = endlist[i - 1];
        ChainEnd close = endlist[i];
        CurveLink subcurve = open.linkTo(close);
        if (subcurve != null) {
            subcurves.add(subcurve);
        }
    }
    chains.clear();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:AreaOp.java

示例4: finalizeSubCurves

import java.util.Vector; //导入方法依赖的package包/类
public static void finalizeSubCurves(Vector<CurveLink> subcurves,
                                     Vector<ChainEnd> chains) {
    int numchains = chains.size();
    if (numchains == 0) {
        return;
    }
    if ((numchains & 1) != 0) {
        throw new InternalError("Odd number of chains!");
    }
    ChainEnd[] endlist = new ChainEnd[numchains];
    chains.toArray(endlist);
    for (int i = 1; i < numchains; i += 2) {
        ChainEnd open = endlist[i - 1];
        ChainEnd close = endlist[i];
        CurveLink subcurve = open.linkTo(close);
        if (subcurve != null) {
            subcurves.add(subcurve);
        }
    }
    chains.clear();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:AreaOp.java

示例5: getTemplates

import java.util.Vector; //导入方法依赖的package包/类
public static Vector<Template> getTemplates(Vector<Template> data,
                                            int decompositionType) {
    data.clear();
    data.add(simpleModel);
    data.add(classicModel);
    data.add(ditalizatedModel);
    data = getUserTemplates(data, decompositionType);
    return data;
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:10,代码来源:TemplateFactory.java

示例6: 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

示例7: search

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Search user-defined configs for SimpleItypeConfig with the given id
 * @param httpSession Session object containing user-defined configs
 * @param id Id of the target config
 * @param indx Stores the row number of the config element that has the match
 * @return null if not found, SimpleItypeConfig object if found
 */
private SimpleItypeConfig search(String id, Vector indx, boolean clearErrorFlags) {

    // Read user defined config
    Vector sp = (Vector) sessionContext.getAttribute(SimpleItypeConfig.CONFIGS_ATTR_NAME);

    // No subparts
    if(sp==null || sp.size()==0)
        return null;

    SimpleItypeConfig result = null;

    // Loop through itypes
    for(int i=0; i<sp.size(); i++) {
        SimpleItypeConfig sic = (SimpleItypeConfig) sp.elementAt(i);

        indx.clear();
        indx.addElement(""+i);

        if (clearErrorFlags)
            sic.setHasError(false);

        // Recursively process each itype config
        result = searchR(sic, id, clearErrorFlags);
        if(result!=null) break;
    }

    if (clearErrorFlags)
        sessionContext.setAttribute(SimpleItypeConfig.CONFIGS_ATTR_NAME, sp);

    return result;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:39,代码来源:InstructionalOfferingConfigEditAction.java

示例8: parseTree

import java.util.Vector; //导入方法依赖的package包/类
public static String parseTree(String s, Vector children)
{
    children.clear();
    if(s != null && s.length() > 0 && s.startsWith("{") && s.endsWith("}"))
    {
        int end = s.indexOf('{', 1);
        if(end == -1)
        {
            end = s.indexOf('}', 1);
            return s.substring(1, end);
        }
        String root = s.substring(1, end);
        String rest = s.substring(end, s.length() - 1);
        for(int match = 0; rest.length() > 0 && (match = matchingBracket(rest, 0)) != -1;)
        {
            children.add(rest.substring(0, match + 1));
            if(match + 1 < rest.length())
                rest = rest.substring(match + 1);
            else
                rest = "";
        }

        return root;
    } else
    {
        return null;
    }
}
 
开发者ID:DatabaseGroup,项目名称:apted,代码行数:29,代码来源:FormatUtilities.java

示例9: updateParticalAnalysisReports

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Takes the processed image and writes information on each particle (blob) into
 * the global <reports> array, in order of overall particle area.
 */
public void updateParticalAnalysisReports ()
{
    if (this.camera.gethaveCamera() == true
            && this.currentImage != null)
        {
        final int numParticles = NIVision
                .imaqCountParticles(this.currentImage, 0);

        // Measure particles and sort by particle size
        final Vector<ParticleReport> particles = new Vector<ParticleReport>();

        if (numParticles > 0)
            {

            for (int particleIndex = 0; particleIndex < numParticles; particleIndex++)
                {

                final ParticleReport particle = new ParticleReport();
                particle.PercentAreaToImageArea = NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_AREA_BY_IMAGE_AREA);
                particle.area = NIVision.imaqMeasureParticle(
                        this.currentImage,
                        particleIndex, 0,
                        NIVision.MeasurementType.MT_AREA);
                particle.ConvexHullArea = NIVision
                        .imaqMeasureParticle(
                                this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_CONVEX_HULL_AREA);
                particle.boundingRectTop = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_BOUNDING_RECT_TOP);
                particle.boundingRectLeft = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_BOUNDING_RECT_LEFT);
                particle.boundingRectBottom = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_BOUNDING_RECT_BOTTOM);
                particle.boundingRectRight = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_BOUNDING_RECT_RIGHT);
                particle.boundingRectWidth = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_BOUNDING_RECT_WIDTH);// par.boundingRectRight
                // -
                // par.boundingRectLeft;
                particle.center_mass_x = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_CENTER_OF_MASS_X);
                particle.center_mass_y = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_CENTER_OF_MASS_Y);
                particle.imageWidth = NIVision
                        .imaqGetImageSize(this.currentImage).width;
                particles.add(particle);
                }
            particles.sort(null);

            }
        this.reports = new ParticleReport[particles.size()];
        particles.copyInto(this.reports);
        particles.clear();
        }
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:78,代码来源:ImageProcessor.java

示例10: normalizeProbabilities

import java.util.Vector; //导入方法依赖的package包/类
public void normalizeProbabilities(Map values, Vector outputKeys, Object thisClassKey, Object thisStation){
	Vector<Object> sinkClosedprobabilities = new Vector<Object>();
	Vector<Object> normalProbabilities = new Vector<Object>();
	boolean allSink = true;
	for(int i=0; i<outputKeys.size(); i++){
		if(isClosedClassSinkProbability(outputKeys.get(i),thisClassKey)){
			sinkClosedprobabilities.add(outputKeys.get(i));
		}else{
			normalProbabilities.add(outputKeys.get(i));
			allSink = false;
		}			
    }
	if(allSink){
		normalProbabilities.addAll(sinkClosedprobabilities);
		sinkClosedprobabilities.clear();
	}
    Double[] probabilities = new Double[outputKeys.size()];
    Object[] keys = new Object[outputKeys.size()];
    outputKeys.toArray(keys);
    //extract all values from map in array form
    for(int i=0; i<keys.length; i++){
        probabilities[i] = (Double)values.get(keys[i]);
    }
    for(int i=0; i<probabilities.length; i++){	    	
        if(probabilities[i] != null && probabilities[i].doubleValue() != 0.0 && sinkClosedprobabilities.contains(keys[i])){
        	probabilities[i] = new Double(0.0);
        	String className = getClassName(thisClassKey);
        	String stationName = getStationName(thisStation);
        	if(!sinkProbabilityUpdateClasses.contains(className)){//I dont want the Names repeated.
        		sinkProbabilityUpdateClasses.add(className);
        	}
        	if(!sinkProbabilityUpdateStations.contains(stationName)){
        		sinkProbabilityUpdateStations.add(stationName);
        	}	        	
			sinkProbabilityUpdate = true;
        }	    	
    }
    values.clear();
    //scan for null values and for total sum
    double totalSum = 0.0;
    int totalNonNull = 0;
    boolean allNull = true;
    for(int i=0; i<probabilities.length; i++){
        if(probabilities[i]!=null && normalProbabilities.contains(keys[i])){
            totalSum += probabilities[i].doubleValue();
            totalNonNull++;
            allNull = false;
        }
    }
    //modify non null values for their sum to match 1 and put null values to 1
    for(int i=0; i<probabilities.length; i++){
        if((probabilities[i]!=null || allNull) && normalProbabilities.contains(keys[i])){
            if(totalSum==0){
                probabilities[i] = new Double(1.0/(double)totalNonNull);
            }else{
                probabilities[i] = new Double(probabilities[i].doubleValue()/totalSum);
            }
        }else{
            probabilities[i] = new Double(0.0);
        }
        values.put(keys[i], probabilities[i]);
    }
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:64,代码来源:CommonModel.java

示例11: validate

import java.util.Vector; //导入方法依赖的package包/类
@Override
public void validate(Vector<Scan<?,?>> scans) throws Exception {
	
	final APEXScan<?,?> firstScan = (APEXScan<?,?>) scans.get(0);
	final APEXSubscan<?,?> firstSubscan = firstScan.get(0);
	final EquatorialCoordinates reference = firstScan.equatorial;
	final String sourceName = firstScan.getSourceName();
	
	final double pointingTolerance = getPointSize() / 5.0;
	
	final boolean isChopped = firstSubscan.getChopper() != null;
	

	if(isChopped) {
		info("Chopped photometry reduction mode.");
		info("Target is [" + sourceName + "] at " + reference.toString());
		setOption("chopped");
	}
	else if(sourceName.equalsIgnoreCase("SKYDIP")) {
		info("Skydip reduction mode.");
		setOption("skydip");
		
		if(scans.size() > 1) {
			info("Ignoring all but first scan in list (for skydip).");
			scans.clear();
			scans.add(firstScan);
		}
	}
	
	if(firstScan.type.equalsIgnoreCase("POINT")) if(scans.size() == 1) {
		setPointing(firstScan);
	}
	
	if(hasOption("nochecks")) return;
	
	// Make sure the rest of the list conform to the first scan...
	for(int i=scans.size(); --i > 0; ) {
		APEXScan<?,?> scan = (APEXScan<?,?>) scans.get(i);
		APEXSubscan<?,?> subscan = scan.get(0);
		
		// Throw out any subsequent skydips...
		if(scan.getSourceName().equalsIgnoreCase("SKYDIP")) {
		    warning("Scan " + scan.getID() + " is a skydip. Dropping from dataset.");
			scans.remove(i);
		}
		
		boolean subscanChopped = subscan.getChopper() != null;
		
		if(subscanChopped != isChopped) {	
			if(isChopped) warning("Scan " + scan.getID() + " is not a chopped scan. Dropping from dataset.");
			else warning("Scan " + scan.getID() + " is a chopped scan. Dropping from dataset.");
			scans.remove(i);
			continue;
		}
		
		if(isChopped) {
			if(!scan.isNonSidereal) {
				if(scan.equatorial.distanceTo(reference) > pointingTolerance) {
					warning("Scan " + scan.getID() + " observed at a different position. Dropping from dataset.");
					CRUSH.suggest(this, "           (You can use 'moving' to keep and reduce anyway.)");
					scans.remove(i);
				}
			}
			else if(!scan.getSourceName().equalsIgnoreCase(sourceName)) {
				warning("Scan " + scan.getID() + " is on a different object. Dropping from dataset.");
				scans.remove(i);
			}
		}
	}
	
	
	super.validate(scans);		
}
 
开发者ID:attipaci,项目名称:crush,代码行数:74,代码来源:APEXCamera.java

示例12: 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:SunburstApps,项目名称:OpenJSharp,代码行数:82,代码来源:RMIGenerator.java


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