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


Java Vector.clone方法代码示例

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


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

示例1: EngineConvex2D

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Costructor of the life
 * @param allPoints All the point of the graph
 * @param sd3 The sector of saturation
 */
public EngineConvex2D(Vector<Point2D> allPoints, Vector<Object> sd3) {
	this.allPoints = (Vector<Point2D>) allPoints.clone();
	allConvex = new Vector<Point2D>();
	allImperant = (Vector<Point2D>) allPoints.clone();
	allDominates = new Vector<Point2D>();

	filtDominants = new Vector<Point2D>();
	filtDominates = new Vector<Point2D>();
	filtPoints = new Vector<DPoint>();
	filtConvex = new Vector<Point2D>();

	filtArea = new Area();

	separator();
	//calcConvex();
	calcConvex(sd3);

	dominates = (Vector<Point2D>) allDominates.clone();
	imperant = (Vector<Point2D>) allImperant.clone();
	convex = (Vector<Point2D>) allConvex.clone();
	points = (Vector<Point2D>) this.allPoints.clone();
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:28,代码来源:EngineConvex2D.java

示例2: orderByX

import java.util.Vector; //导入方法依赖的package包/类
/**
 * This function return a vector that contains the same point of the parameter one but
 * the points are ordered from the point with the biggest X to the point with 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;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:30,代码来源:EngineConvex2D.java

示例3: 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;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:30,代码来源:EngineConvex2D.java

示例4: queueEvent

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Add the event and vector of listeners to the queue to be delivered.
 * An event dispatcher thread dequeues events from the queue and dispatches
 * them to the registered listeners.
 * Package private; used by NamingEventNotifier to fire events
 */
synchronized void queueEvent(EventObject event,
                             Vector<? extends NamingListener> vector) {
    if (eventQueue == null)
        eventQueue = new EventQueue();

    /*
     * Copy the vector in order to freeze the state of the set
     * of EventListeners the event should be delivered to prior
     * to delivery.  This ensures that any changes made to the
     * Vector from a target listener's method during the delivery
     * of this event will not take effect until after the event is
     * delivered.
     */
    @SuppressWarnings("unchecked") // clone()
    Vector<NamingListener> v =
            (Vector<NamingListener>)vector.clone();
    eventQueue.enqueue(event, v);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:EventSupport.java

示例5: find

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Scans the classpath for classes, returning those accepted by the given {@link Predicate}
 *
 * @param classLoader The classloader to look for classes and define classes if they're not found
 * @param scanJar If the current jar should be scanned (Also scans classes in IntelliJ runs) or only the current classloader
 * @param predicate Returns if a class should be added or not to the {@link Set}
 * @return The classes located
 */
@SuppressWarnings("unchecked")
public static Set<Class<?>> find(ClassLoader classLoader, boolean scanJar, Predicate<String> predicate) {
    Set<Class<?>> set = new HashSet<>();
    Vector<Class<?>> vector = GET_CLASSES.apply(classLoader);
    for(Class<?> c : (Vector<Class>)vector.clone()) {
        CLASS_CACHE.putIfAbsent(c.getName(), c);
        if(predicate.test(c.getName())) set.add(c);
    }
    if(scanJar) {
        jar(classLoader, set, predicate);
    }
    return Collections.unmodifiableSet(set);
}
 
开发者ID:BRjDevs,项目名称:BRjLibs,代码行数:22,代码来源:ClasspathScanner.java

示例6: addNewImportedGrammars

import java.util.Vector; //导入方法依赖的package包/类
private void addNewImportedGrammars(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
    final Vector igs1 = srcGrammar.getImportedGrammars();
    if (igs1 != null) {
        Vector igs2 = dstGrammar.getImportedGrammars();

        if (igs2 == null) {
            igs2 = ((Vector) igs1.clone());
            dstGrammar.setImportedGrammars(igs2);
        }
        else {
            updateImportList(igs1, igs2);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:XSDHandler.java

示例7: clone

import java.util.Vector; //导入方法依赖的package包/类
@SuppressWarnings("unchecked") // clone()
private LdapName(String name, Vector<Rdn> rdns) {
    unparsed = name;
    this.rdns = (Vector<Rdn>)rdns.clone();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:LdapName.java

示例8: putGrammar

import java.util.Vector; //导入方法依赖的package包/类
/**
 * put a schema grammar and any grammars imported by it (directly or
 * inderectly) into the registry. when a grammar with the same target
 * namespace is already in the bucket, and different from the one being
 * added, it's an error, and no grammar will be added into the bucket.
 *
 * @param grammar   the grammar to put in the registry
 * @param deep      whether to add imported grammars
 * @return          whether the process succeeded
 */
public boolean putGrammar(SchemaGrammar grammar, boolean deep) {
    // whether there is one with the same tns
    SchemaGrammar sg = getGrammar(grammar.fTargetNamespace);
    if (sg != null) {
        // if the one we have is different from the one passed, it's an error
        return sg == grammar;
    }
    // not deep import, then just add this one grammar
    if (!deep) {
        putGrammar(grammar);
        return true;
    }

    // get all imported grammars, and make a copy of the Vector, so that
    // we can recursively process the grammars, and add distinct ones
    // to the same vector
    Vector currGrammars = (Vector)grammar.getImportedGrammars();
    if (currGrammars == null) {
        putGrammar(grammar);
        return true;
    }

    Vector grammars = ((Vector)currGrammars.clone());
    SchemaGrammar sg1, sg2;
    Vector gs;
    // for all (recursively) imported grammars
    for (int i = 0; i < grammars.size(); i++) {
        // get the grammar
        sg1 = (SchemaGrammar)grammars.elementAt(i);
        // check whether the bucket has one with the same tns
        sg2 = getGrammar(sg1.fTargetNamespace);
        if (sg2 == null) {
            // we need to add grammars imported by sg1 too
            gs = sg1.getImportedGrammars();
            // for all grammars imported by sg2, but not in the vector
            // we add them to the vector
            if(gs == null) continue;
            for (int j = gs.size() - 1; j >= 0; j--) {
                sg2 = (SchemaGrammar)gs.elementAt(j);
                if (!grammars.contains(sg2))
                    grammars.addElement(sg2);
            }
        }
        // we found one with the same target namespace
        // if the two grammars are not the same object, then it's an error
        else if (sg2 != sg1) {
            return false;
        }
    }

    // now we have all imported grammars stored in the vector. add them
    putGrammar(grammar);
    for (int i = grammars.size() - 1; i >= 0; i--)
        putGrammar((SchemaGrammar)grammars.elementAt(i));

    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:68,代码来源:XSGrammarBucket.java

示例9: setConnectionMonitors

import java.util.Vector; //导入方法依赖的package包/类
public void setConnectionMonitors(Vector monitors) {
    synchronized (this) {
        connectionMonitors = (Vector) monitors.clone();
    }
}
 
开发者ID:fast-data-transfer,项目名称:fdt,代码行数:6,代码来源:TransportManager.java

示例10: addUnprocessedImports

import java.util.Vector; //导入方法依赖的package包/类
public void addUnprocessedImports(Vector aImports) {
    unprocessedImports = (Vector) (aImports.clone());
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:4,代码来源:ClassDef.java

示例11: setLoopingStates

import java.util.Vector; //导入方法依赖的package包/类
/**
 * This function is used to update the list of current loooping states (i.e.,
 * states that are controlled by a *? construct).  It backfills values from
 * the looping states into unpopulated cells of the states that are currently
 * marked for backfilling, and then updates the list of looping states to be
 * the new list
 * @param newLoopingStates The list of new looping states
 * @param endStates The list of states to treat as end states (states that
 * can exit the loop).
 */
private void setLoopingStates(Vector<Integer> newLoopingStates,
                              Vector<Integer> endStates) {

    // if the current list of looping states isn't empty, we have to backfill
    // values from the looping states into the states that are waiting to be
    // backfilled
    if (!loopingStates.isEmpty()) {
        int loopingState = loopingStates.lastElement().intValue();
        int rowNum;

        // don't backfill into an end state OR any state reachable from an end state
        // (since the search for reachable states is recursive, it's split out into
        // a separate function, eliminateBackfillStates(), below)
        for (int i = 0; i < endStates.size(); i++) {
            eliminateBackfillStates(endStates.elementAt(i).intValue());
        }

        // we DON'T actually backfill the states that need to be backfilled here.
        // Instead, we MARK them for backfilling.  The reason for this is that if
        // there are multiple rules in the state-table description, the looping
        // states may have some of their values changed by a succeeding rule, and
        // this wouldn't be reflected in the backfilled states.  We mark a state
        // for backfilling by putting the row number of the state to copy from
        // into the flag cell at the end of the row
        for (int i = 0; i < statesToBackfill.size(); i++) {
            rowNum = statesToBackfill.elementAt(i).intValue();
            short[] state = tempStateTable.elementAt(rowNum);
            state[numCategories] =
                (short)((state[numCategories] & ALL_FLAGS) | loopingState);
        }
        statesToBackfill.removeAllElements();
        loopingStates.removeAllElements();
    }

    if (newLoopingStates != null) {
        @SuppressWarnings("unchecked")
        Vector<Integer> clone = (Vector<Integer>)newLoopingStates.clone();
        loopingStates = clone;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:51,代码来源:RuleBasedBreakIteratorBuilder.java


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