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


Java ArrayList.clone方法代码示例

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


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

示例1: apply

import java.util.ArrayList; //导入方法依赖的package包/类
@Override
boolean apply(IXulDataSelectContext dataCtx, ArrayList<XulDataNode> ctx, XulDataNode node) {
	val = XulUtils.STR_EMPTY;
	ArrayList<XulDataNode> cloneCtx = (ArrayList<XulDataNode>) ctx.clone();
	if (!_selector.apply(dataCtx, cloneCtx)) {
		return false;
	}

	if (cloneCtx.isEmpty()) {
		return true;
	}

	XulDataNode xulDataNode = cloneCtx.get(0);
	node.setOwnerBinding(xulDataNode.getOwnerBinding());
	this.val = xulDataNode.getValue();
	return true;
}
 
开发者ID:starcor-company,项目名称:starcor.xul,代码行数:18,代码来源:XulBindingSelector.java

示例2: getSetInfos

import java.util.ArrayList; //导入方法依赖的package包/类
/**
 *  Gets the SetInfos (directories of files) that are currently configured in the repository.
 *
 * @return    The setInfos.
 * @see       SetInfo
 */
public ArrayList getSetInfos() {
	synchronized (setInfosLock) {
		ArrayList setInfos = arrayListGet(Keys.SET_INFOS, false);
		if (setInfos == null) {
			try {
				adminData.delete(Keys.SET_INFOS);
			} catch (Throwable e) {}
			return null;
		}
		ArrayList retVals = (ArrayList) setInfos.clone();
		String sets = "";
		for (int i = 0; i < retVals.size(); i++)
			sets += ((SetInfo) retVals.get(i)).getSetSpec() + " ";

		//prtln("getSetInfos(): {" + sets.trim() + "}");
		return retVals;
	}
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:25,代码来源:RepositoryManager.java

示例3: Person

import java.util.ArrayList; //导入方法依赖的package包/类
/**
 * @param cSalutation  String for salutation
 * @param cGivenNames  Array list of strings for given names
 * @param cFamName     String for family name
 * @param cFamNameLast true if family name is at the end
 */
public Person(String cSalutation, ArrayList<String> cGivenNames, String cFamName, Boolean cFamNameLast)
{
    super(true);
    setFamilyName(cFamName);
    givenNames = (ArrayList<String>) cGivenNames.clone();
    setSalutation(cSalutation);
    familyNameLast = cFamNameLast;
    email = "";
}
 
开发者ID:Alienturnedhuman,项目名称:PearPlanner,代码行数:16,代码来源:Person.java

示例4: createOutputColumns

import java.util.ArrayList; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected ArrayList<Integer> createOutputColumns(Database db, ArrayList<Integer> input) {
    IndexScanPlanNode inlineScan = (IndexScanPlanNode) m_inlineNodes.get(PlanNodeType.INDEXSCAN);
    assert(inlineScan != null);

    inlineScan.updateOutputColumns(db);
    input.addAll(inlineScan.m_outputColumns);

    return (ArrayList<Integer>) input.clone();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:12,代码来源:NestLoopIndexPlanNode.java

示例5: MultivariateGaussianMixture

import java.util.ArrayList; //导入方法依赖的package包/类
/**
 * Constructor. The Gaussian mixture model will be learned from the given data
 * with the EM algorithm. The number of components will be selected by BIC.
 * @param data the training data.
 * @param diagonal true if the components have diagonal covariance matrix.
 */
@SuppressWarnings("unchecked")
public MultivariateGaussianMixture(double[][] data, boolean diagonal) {
    if (data.length < 20)
        throw new IllegalArgumentException("Too few samples.");

    ArrayList<Component> mixture = new ArrayList<>();
    Component c = new Component();
    c.priori = 1.0;
    c.distribution = new MultivariateGaussianDistribution(data, diagonal);
    mixture.add(c);

    int freedom = 0;
    for (int i = 0; i < mixture.size(); i++)
        freedom += mixture.get(i).distribution.npara();

    double bic = 0.0;
    for (double[] x : data) {
        double p = c.distribution.p(x);
        if (p > 0) bic += Math.log(p);
    }
    bic -= 0.5 * freedom * Math.log(data.length);

    double b = Double.NEGATIVE_INFINITY;
    while (bic > b) {
        b = bic;
        components = (ArrayList<Component>) mixture.clone();

        split(mixture);
        bic = EM(mixture, data);

        freedom = 0;
        for (int i = 0; i < mixture.size(); i++)
            freedom += mixture.get(i).distribution.npara();

        bic -= 0.5 * freedom * Math.log(data.length);
    }
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:44,代码来源:MultivariateGaussianMixture.java

示例6: GaussianMixture

import java.util.ArrayList; //导入方法依赖的package包/类
/**
 * Constructor. The Gaussian mixture model will be learned from the given data
 * with the EM algorithm. The number of components will be selected by BIC.
 * @param data the training data.
 */
@SuppressWarnings("unchecked")
public GaussianMixture(double[] data) {
    if (data.length < 20)
        throw new IllegalArgumentException("Too few samples.");
    
    ArrayList<Component> mixture = new ArrayList<>();
    Component c = new Component();
    c.priori = 1.0;
    c.distribution = new GaussianDistribution(data);
    mixture.add(c);

    int freedom = 0;
    for (int i = 0; i < mixture.size(); i++)
        freedom += mixture.get(i).distribution.npara();

    double bic = 0.0;
    for (double x : data) {
        double p = c.distribution.p(x);
        if (p > 0) bic += Math.log(p);
    }
    bic -= 0.5 * freedom * Math.log(data.length);

    double b = Double.NEGATIVE_INFINITY;
    while (bic > b) {
        b = bic;
        components = (ArrayList<Component>) mixture.clone();

        split(mixture);
        bic = EM(mixture, data);

        freedom = 0;
        for (int i = 0; i < mixture.size(); i++)
            freedom += mixture.get(i).distribution.npara();

        bic -= 0.5 * freedom * Math.log(data.length);
    }
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:43,代码来源:GaussianMixture.java

示例7: findDistToLeaf

import java.util.ArrayList; //导入方法依赖的package包/类
/**
     * 用于找到一个节点在领域树中距离叶子节点还有几层
     * @param upLocation 上下位关系中,上位关系那一列
	 * @param dnLocation 上下位关系中,下位关系那一列
	 * @param node 目标节点
	 * @return 层数。
	 */
	@SuppressWarnings("unchecked")
	public static int findDistToLeaf(ArrayList<String> upLocation, ArrayList<String> dnLocation, String node){
		int distToLeaf = 0;
		if(IsLeaf(upLocation, node))
			return distToLeaf;
		ArrayList<String> childNodePre = new ArrayList<>();
		HashSet<String> findedNode = new HashSet<>();
		findedNode.add(node);
		childNodePre.add(node);
		while(true)
		{
			ArrayList<String> childNode = new ArrayList<>();
			for(String string : childNodePre)
			{
				if(IsLeaf(upLocation, string))
					return distToLeaf;
				for(int i = 0; i < upLocation.size(); i++)
				{
					if(upLocation.get(i).equals(string))
					{
						if(!findedNode.contains(dnLocation.get(i)))
							childNode.add(dnLocation.get(i));
					}
				}
			}
			childNodePre = (ArrayList<String>) childNode.clone();
			childNode = new ArrayList<>();
			distToLeaf++;
		}
//		return distToLeaf;
	}
 
开发者ID:guozhaotong,项目名称:FacetExtract,代码行数:39,代码来源:FindRelationship.java

示例8: CodeSuggestAdapter

import java.util.ArrayList; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public CodeSuggestAdapter(@NonNull Context context, @LayoutRes int resource, @NonNull ArrayList<Description> objects) {
    super(context, resource, objects);
    this.inflater = LayoutInflater.from(context);
    this.context = context;
    this.clone = (ArrayList<Description>) objects.clone();
    this.suggestion = new ArrayList<>();
    this.resourceID = resource;

    AppSetting appSetting = new AppSetting(context);
    editorTextSize = appSetting.getEditorTextSize();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:13,代码来源:CodeSuggestAdapter.java

示例9: BasicCompletionAdapter

import java.util.ArrayList; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked", "deprecation"})
public BasicCompletionAdapter(@NonNull Context context,
                              @LayoutRes int resource, @NonNull ArrayList<CompletionItem> objects) {
    super(context, resource, objects);
    this.inflater = LayoutInflater.from(context);
    this.clone = (ArrayList<CompletionItem>) objects.clone();
    this.suggestion = new ArrayList<>();
    this.resourceID = resource;
    colorKeyWord = context.getResources().getColor(android.R.color.primary_text_dark);
    colorNormal = context.getResources().getColor(android.R.color.primary_text_dark);
}
 
开发者ID:Light-Team,项目名称:ModPE-IDE-Source,代码行数:12,代码来源:BasicCompletionAdapter.java

示例10: initData

import java.util.ArrayList; //导入方法依赖的package包/类
private void initData(){
	handler = new EventHandler() {
		@SuppressWarnings("unchecked")
		public void afterEvent(final int event, final int result, final Object data) {
			if (result == SMSSDK.RESULT_COMPLETE) {
				if (event == SMSSDK.EVENT_GET_CONTACTS) {
					// 请求获取本地联系人列表
					ArrayList<HashMap<String,Object>> rawList = (ArrayList<HashMap<String,Object>>) data;
					if (rawList == null) {
						contactsInMobile = new ArrayList<HashMap<String,Object>>();
					} else {
						contactsInMobile = (ArrayList<HashMap<String,Object>>) rawList.clone();
					}
					refreshContactList();
				} else if (event == SMSSDK.EVENT_GET_FRIENDS_IN_APP) {
					// 请求获取服务器上,应用内的朋友
					friendsInApp = (ArrayList<HashMap<String,Object>>) data;
					SMSSDK.getContacts(false);
				}
			} else {
				runOnUIThread(new Runnable() {
					public void run() {
						if (pd != null && pd.isShowing()) {
							pd.dismiss();
						}
						// 网络错误
						int resId = ResHelper.getStringRes(activity, "smssdk_network_error");
						if (resId > 0) {
							Toast.makeText(activity, resId, Toast.LENGTH_SHORT).show();
						}
					}
				});
			}
		}
	};
	// 注册事件监听器
	SMSSDK.registerEventHandler(handler);

	if(friendsInApp != null && friendsInApp.size() > 0) {
		// 获取本地联系人
		SMSSDK.getContacts(false);
	} else {
		// 获取应用内的好友列表
		SMSSDK.getFriendsInApp();
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:47,代码来源:ContactsPage.java

示例11: cloneCollection

import java.util.ArrayList; //导入方法依赖的package包/类
/**
 * 
 */
@SuppressWarnings("unchecked")
public ArrayList<V> cloneCollection(ArrayList<V> collection) {
    return (ArrayList<V>)collection.clone();
}
 
开发者ID:annoflex,项目名称:annoflex,代码行数:8,代码来源:MultiMapController.java

示例12: ViewCluster

import java.util.ArrayList; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public ViewCluster(ArrayList<View> views, ItemConfiguration config) {
    this.views = (ArrayList<View>) views.clone();
    this.config = config;
    resetEdges();
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:7,代码来源:CellLayout.java

示例13: PublisherRunner

import java.util.ArrayList; //导入方法依赖的package包/类
/**
 * @param connectionFactory The connection settings to use for tests.
 * @param topic The topic to publish test messages to.
 * @param testMessages The messages to test.
 */
public PublisherRunner(ConnectionFactory connectionFactory, Topic topic, ArrayList<Message> testMessages) {
    this.publisher = new RabbitPublisher(connectionFactory, new JavaSerializer());
    this.topic = topic;
    this.testMessages = (ArrayList<Message>) testMessages.clone();
}
 
开发者ID:INAETICS,项目名称:Drones-Simulator,代码行数:11,代码来源:PublisherRunner.java

示例14: findParent

import java.util.ArrayList; //导入方法依赖的package包/类
/**
 * 用于找到一个特定节点node所有的祖先节点
 * @param upLocation 上下位关系中,上位关系那一列 
 * @param dnLocation 上下位关系中,下位关系那一列
 * @param node 目标节点
 * @return 所有祖先节点。
 */
@SuppressWarnings("unchecked")
public static ArrayList<String> findParent(ArrayList<String> upLocation, ArrayList<String> dnLocation, String node){
	ArrayList<String> newNode = new ArrayList<>();//下一次要遍历的节点
	HashSet<String> findedNode = new HashSet<>();
	findedNode.add(node);
	ArrayList<String> parent = new ArrayList<>();
	ArrayList<String> directParent = new ArrayList<>();//亲父节点
	for(int i = 0; i < upLocation.size(); i++)
	{
		if(dnLocation.get(i).equals(node))
		{
			if(findedNode.contains(upLocation.get(i)))
				continue;
			findedNode.add(upLocation.get(i));
			parent.add(upLocation.get(i));
			newNode.add(upLocation.get(i));
			directParent.add(upLocation.get(i));
		}
	}
	while(newNode.size() != 0)
	{
		ArrayList<String> newnewNode = new ArrayList<>();
		for(int j = 0; j < newNode.size(); j++)
		{
			for(int i = 0; i < upLocation.size(); i++)
			{
				if(dnLocation.get(i).equals(newNode.get(j)))
				{
					if(findedNode.contains(upLocation.get(i)))
						continue;
					findedNode.add(upLocation.get(i));
					parent.add(upLocation.get(i));
					newnewNode.add(upLocation.get(i));
				}
			}
		}
		newNode = (ArrayList<String>) newnewNode.clone();
	}
	return parent;
}
 
开发者ID:guozhaotong,项目名称:FacetExtract,代码行数:48,代码来源:FindRelationship.java

示例15: handleMessage

import java.util.ArrayList; //导入方法依赖的package包/类
public void handleMessage(Message msg) {
    int i;
    ValueAnimator anim;
    boolean callAgain = true;
    ArrayList<ValueAnimator> animations = (ArrayList) ValueAnimator.access$000().get();
    ArrayList<ValueAnimator> delayedAnims = (ArrayList) ValueAnimator.access$100().get();
    switch (msg.what) {
        case 0:
            ArrayList<ValueAnimator> pendingAnimations = (ArrayList) ValueAnimator.access$200
                    ().get();
            if (animations.size() > 0 || delayedAnims.size() > 0) {
                callAgain = false;
            }
            while (pendingAnimations.size() > 0) {
                ArrayList<ValueAnimator> pendingCopy = (ArrayList) pendingAnimations.clone();
                pendingAnimations.clear();
                int count = pendingCopy.size();
                for (i = 0; i < count; i++) {
                    anim = (ValueAnimator) pendingCopy.get(i);
                    if (ValueAnimator.access$300(anim) == 0) {
                        ValueAnimator.access$400(anim);
                    } else {
                        delayedAnims.add(anim);
                    }
                }
            }
            break;
        case 1:
            break;
        default:
            return;
    }
    long currentTime = AnimationUtils.currentAnimationTimeMillis();
    ArrayList<ValueAnimator> readyAnims = (ArrayList) ValueAnimator.access$500().get();
    ArrayList<ValueAnimator> endingAnims = (ArrayList) ValueAnimator.access$600().get();
    int numDelayedAnims = delayedAnims.size();
    for (i = 0; i < numDelayedAnims; i++) {
        anim = (ValueAnimator) delayedAnims.get(i);
        if (ValueAnimator.access$700(anim, currentTime)) {
            readyAnims.add(anim);
        }
    }
    int numReadyAnims = readyAnims.size();
    if (numReadyAnims > 0) {
        for (i = 0; i < numReadyAnims; i++) {
            anim = (ValueAnimator) readyAnims.get(i);
            ValueAnimator.access$400(anim);
            ValueAnimator.access$802(anim, true);
            delayedAnims.remove(anim);
        }
        readyAnims.clear();
    }
    int numAnims = animations.size();
    i = 0;
    while (i < numAnims) {
        anim = (ValueAnimator) animations.get(i);
        if (anim.animationFrame(currentTime)) {
            endingAnims.add(anim);
        }
        if (animations.size() == numAnims) {
            i++;
        } else {
            numAnims--;
            endingAnims.remove(anim);
        }
    }
    if (endingAnims.size() > 0) {
        for (i = 0; i < endingAnims.size(); i++) {
            ValueAnimator.access$900((ValueAnimator) endingAnims.get(i));
        }
        endingAnims.clear();
    }
    if (!callAgain) {
        return;
    }
    if (!animations.isEmpty() || !delayedAnims.isEmpty()) {
        sendEmptyMessageDelayed(1, Math.max(0, ValueAnimator.access$1000() - (AnimationUtils
                .currentAnimationTimeMillis() - currentTime)));
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:81,代码来源:ValueAnimator$AnimationHandler.java


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