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


Java Cloner.deepClone方法代码示例

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


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

示例1: run

import com.rits.cloning.Cloner; //导入方法依赖的package包/类
public void run() throws OutOfMemoryError {
	int numberOfColumns = this.numberOfColumns;
	
	DifferenceSets[] differenceSetsModulo = this.differenceSets.allModulo(this.numberOfColumns);
	for (int rhsIndex = 0; rhsIndex < numberOfColumns; rhsIndex++) {
		DifferenceSets orig = differenceSetsModulo[rhsIndex];
		Cloner cloner = new Cloner();
		DifferenceSets uncovered = cloner.deepClone(orig);
		if (orig.isEmpty()) {
			ColumnCollection lhs = new ColumnCollection(this.numberOfColumns);
			
			for (Integer lhsIndex : lhs.setCopy(rhsIndex).complement().getSetBits()) {
				this.minimalDependencies.addRHSColumn(lhs.setCopy(lhsIndex), rhsIndex);
			}
		} 
		else if (!orig.containsEmptySet()) {
			PartialOrder currentOrder = new PartialOrder(orig);
			Path path = new Path(numberOfColumns);
			findCovers(rhsIndex, orig, uncovered, path, currentOrder);
		}
	}
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:23,代码来源:FastFDs.java

示例2: EntityScheme

import com.rits.cloning.Cloner; //导入方法依赖的package包/类
private EntityScheme (Entity entity, Cloner cloner, CloningPolicy cloningPolicy) {
	fillBag.clear();
	entity.getComponents(fillBag);
	components = new Array<>(fillBag.size());

	for (Component component : fillBag) {
		if (component == null) continue;
		if (component.getClass().isAnnotationPresent(Transient.class)) continue;
		if (cloningPolicy == CloningPolicy.SKIP_INVISIBLE && component instanceof Invisible) continue;

		if (component instanceof VisUUID) schemeUUID = ((VisUUID) component).getUUID();

		if (component instanceof UsesProtoComponent) {
			components.add(((UsesProtoComponent) component).toProtoComponent());
		} else {
			components.add(component);
		}
	}

	if (schemeUUID == null) throw new IllegalStateException("Missing VisUUID component in Entity");

	if (cloner != null) {
		components = cloner.deepClone(components);
	}
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:26,代码来源:EntityScheme.java

示例3: updateTheDocument

import com.rits.cloning.Cloner; //导入方法依赖的package包/类
@When("I update the document")
public void updateTheDocument() {
    Cloner cloner = new Cloner();
    updatedDocument = cloner.deepClone(document);
    new Conditions().expect(document).includeTheHashKey().verify(updatedDocument);

    updatedDocument.setName("My New Name");

    try {
        DocumentFlows documentFlows = new DocumentFlows();
        documentFlows.shouldUpdateDocument(updatedDocument);
    } catch (Exception e) {
        String msg = "Failed to update document " + updatedDocument.getNum() + ": " + e.getCause() + ", " + e.getMessage();
        LOG.error(msg);
        Assert.fail(msg);
    }
}
 
开发者ID:sporcina,项目名称:dynamodb-connector,代码行数:18,代码来源:DocumentSteps.java

示例4: generateNextLevel

import com.rits.cloning.Cloner; //导入方法依赖的package包/类
private CollectionSet<ColumnCollection> generateNextLevel(CollectionSet<ColumnCollection> currentLevel) {
	CollectionSet<ColumnCollection> nextLevel = new CollectionSet<>();
	
	Cloner cloner = new Cloner();
	AprioriGeneration<ColumnCollection> prefixBlockGenerator = new AprioriGeneration<>(cloner.deepClone(currentLevel));
	for (CollectionSet<ColumnCollection> k : prefixBlockGenerator.prefixBlocks()) {
		for (ColumnCollection y : k) {
			for (ColumnCollection z : k.tailSet(y)) {
				ColumnCollection x = y.orCopy(z);
				boolean xInNextLevel = true;
				for (Integer a : x.getSetBits()) {
					x.clear(a);
					if (!currentLevel.contains(x)) {
						xInNextLevel = false;
						break;
					}
					x.set(a);
				}
				if (xInNextLevel) {
					nextLevel.add(x);
					strippedPartitions.put(x, strippedProduct(strippedPartitions.get(y), strippedPartitions.get(z)));
				}
			}
		}
	}

	return nextLevel;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:29,代码来源:Tane.java

示例5: recognize

import com.rits.cloning.Cloner; //导入方法依赖的package包/类
/**
 * Reconhece uma lista de símbolos representado a cadeia de entrada.
 * @param input Lista de símbolos representando a cadeia de entrada.
 * @return Um valor lógico informando se o autômato adaptativo reconheceu
 * a cadeia de entrada.
 */
public boolean recognize(List<Symbol> input) {
    
    // cria um objeto de clonagem para realizar
    // a cópia do autômato adaptativo corrente
    Cloner dolly = new Cloner();
    
    // cria um clone do autômato corrente
    reference = dolly.deepClone(this);
    
    // inicia o processo de reconhecimento da lista de
    // símbolos, retornando o resultado
    return reference.recognizeOnce(input);
}
 
开发者ID:cereda,项目名称:aa,代码行数:20,代码来源:AdaptiveAutomaton.java

示例6: initKMeans

import com.rits.cloning.Cloner; //导入方法依赖的package包/类
@Override
public void initKMeans(DataSource<T> bds, T[] clusters) throws IOException {
	bds.getRandomRows(clusters);

	final Cloner cloner = new Cloner();
	for (int i = 0; i < clusters.length; i++) {
		clusters[i] = cloner.deepClone(clusters[i]);
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:10,代码来源:FeatureVectorKMeansInit.java

示例7: getAlignmentClone

import com.rits.cloning.Cloner; //导入方法依赖的package包/类
public Alignment getAlignmentClone() {
		Cloner cloner = new Cloner();
//		cloner.setDumpClonedClasses(true);
		cloner.dontClone(OntologyManager.class); 
		cloner.dontCloneInstanceOf(OntologyManager.class); 
		cloner.dontClone(DirectedWeightedMultigraph.class); 
		cloner.dontCloneInstanceOf(DirectedWeightedMultigraph.class); 
		return cloner.deepClone(this);
	}
 
开发者ID:therelaxist,项目名称:spring-usc,代码行数:10,代码来源:Alignment.java

示例8: clone

import com.rits.cloning.Cloner; //导入方法依赖的package包/类
public Node clone() {

    	Cloner cloner = new Cloner();
    	return cloner.deepClone(this);

//    	switch (this.type) {
//			case None: return new SimpleNode(this.getId(), this.getLabel()); 
//			case ColumnNode: return new ColumnNode(this.getId(), ((ColumnNode)this).getHNodeId(), ((ColumnNode)this).getColumnName()); 
//			case LiteralNode: return new LiteralNode(this.getId(), ((LiteralNode)this).getValue(), ((LiteralNode)this).getDatatype()); 
//			case InternalNode: return new InternalNode(this.getId(), this.getLabel());
//		}
//
//		logger.error("Cloning the node has been failed. Cannot identify the type of the node.");
//		return null;
    }
 
开发者ID:therelaxist,项目名称:spring-usc,代码行数:16,代码来源:Node.java

示例9: cloneThis

import com.rits.cloning.Cloner; //导入方法依赖的package包/类
/**
 * You can override this to do custom cloning. Return null if you don't want the question to be asked again after student fails to answer the question correctly
 * 
 * @param problem
 * @return
 */
public default <P extends Problem> P cloneThis(P problem) {
	Cloner cloner = new Cloner();
	cloner.setNullTransient(true);
	P clone = cloner.deepClone(problem);
	return clone;
}
 
开发者ID:villeteam,项目名称:vexer,代码行数:13,代码来源:Problem.java

示例10: cloneForValidation

import com.rits.cloning.Cloner; //导入方法依赖的package包/类
@Override
public CruiseConfig cloneForValidation() {
    Cloner cloner = new Cloner();
    BasicCruiseConfig configForValidation = cloner.deepClone(BasicCruiseConfig.this);
    // and this must be initialized again, we don't want _same_ instances in groups and in allPipelineConfigs
    configForValidation.allPipelineConfigs = null;
    configForValidation.pipelineNameToConfigMap = new ConcurrentHashMap<>();
    return configForValidation;
}
 
开发者ID:gocd,项目名称:gocd,代码行数:10,代码来源:BasicCruiseConfig.java

示例11: shouldCollectPipelineNameConflictErrorsInTheChildren_InMergedConfig_WhenCloned

import com.rits.cloning.Cloner; //导入方法依赖的package包/类
@Test
public void shouldCollectPipelineNameConflictErrorsInTheChildren_InMergedConfig_WhenCloned() {
    //we need this case because cloning has proven to be problematic with complex object graph in merged config
    BasicCruiseConfig mainCruiseConfig = GoConfigMother.configWithPipelines("pipeline-1");
    PartialConfig partialConfig = PartialConfigMother.withPipelineInGroup("pipeline-1", "g2");
    partialConfig.setOrigin(new RepoConfigOrigin());
    CruiseConfig config = new BasicCruiseConfig(mainCruiseConfig, partialConfig);
    Cloner CLONER = new Cloner();
    CruiseConfig cloned = CLONER.deepClone(config);

    List<ConfigErrors> allErrors = cloned.validateAfterPreprocess();
    assertThat(allErrors.size(), is(2));
    assertThat(allErrors.get(0).on("name"), is("You have defined multiple pipelines named 'pipeline-1'. Pipeline names must be unique. Source(s): [http://some.git at 1234fed, cruise-config.xml]"));
    assertThat(allErrors.get(1).on("name"), is("You have defined multiple pipelines named 'pipeline-1'. Pipeline names must be unique. Source(s): [http://some.git at 1234fed, cruise-config.xml]"));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:16,代码来源:MergeCruiseConfigTest.java

示例12: testFindBlocks

import com.rits.cloning.Cloner; //导入方法依赖的package包/类
@Test
public void testFindBlocks() throws Exception {
    ArrayList<Block> trueBlocks = Lists.newArrayList(
            new Block(Lists.newArrayList(1, 5), Block.RANDOM_ID),
            new Block(Lists.newArrayList(2, 3, 4), Block.RANDOM_ID),
            new Block(Lists.newArrayList(1, 2, 3), Block.RANDOM_ID));
    one.exitsNeighbors(Lists.newArrayList(1, 2, 3, 5));
    two.exitsNeighbors(Lists.newArrayList(1, 2, 3, 4));
    three.exitsNeighbors(Lists.newArrayList(1, 2, 3, 4));
    four.exitsNeighbors(Lists.newArrayList(2, 3, 4));
    five.exitsNeighbors(Lists.newArrayList(1, 5));

    List<NeighborsVector> list = Lists.newArrayList(one, two, three, four, five);

    for (int i = 0; i < 6; i++) {

        Collections.shuffle(list);
        List<Block> blocks = classUnderTest.findBlocks(list);

        // create copy of trueBlocks
        Cloner cloner = new Cloner();
        ArrayList<Block> tempList = cloner.deepClone(trueBlocks);

        // assert
        trueBlocks.removeAll(blocks);
        assertThat(trueBlocks, is(empty()));

        trueBlocks = tempList;
        blocks.removeAll(trueBlocks);
        assertThat(blocks, is(empty()));
    }
}
 
开发者ID:sapirgolan,项目名称:MFIBlocking,代码行数:33,代码来源:FindBlockAlgorithmTest.java

示例13: onItemDismiss

import com.rits.cloning.Cloner; //导入方法依赖的package包/类
@Override
public void onItemDismiss(int position) {
    // snooze + save in undo + save details for pushbuttons
    final Reminder remind = reminders.get(position);
    final Cloner cloner = new Cloner();
    //cloner.setDumpClonedClasses(true);
    //cloner.dontClone(
    //       android.graphics.DashPathEffect.class);
    last_undo = cloner.deepClone(remind);
    if (SimpleItemTouchHelperCallback.last_swipe_direction == ItemTouchHelper.LEFT) {

        // swipe left
        snoozeReminder(remind, remind.last_snoozed_for > 0 ? remind.last_snoozed_for : default_snooze);

        last_swiped = remind;
        last_undo_pos = position;
        reminders.remove(position);
        notifyItemRemoved(position);
        cancelAlert();
        showSnoozeFloater();
    } else {
        // swipe right

        if (remind.repeating || !remind.isDue()) {
            remind.schedule_next();
            setFloaterText(remind.getTitle() + " next in " + JoH.niceTimeTill(remind.next_due));
        } else if (!remind.repeating) {
            setFloaterText(remind.getTitle() + " completed");
            remind.enabled = false;
            remind.save();
        }

        last_swiped = remind;
        last_undo_pos = position;
        reminders.remove(position);
        notifyItemRemoved(position);
        cancelAlert();
        showSnoozeFloater();
    }
    JoH.runOnUiThreadDelayed(new Runnable() {
        @Override
        public void run() {
            reinject(remind);
        }
    }, 500);
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:47,代码来源:Reminders.java

示例14: deepCloneDevice

import com.rits.cloning.Cloner; //导入方法依赖的package包/类
private KonnektingDevice deepCloneDevice() {
    Cloner cloner = new Cloner();
    KonnektingDevice clone = cloner.deepClone(device);
    return clone;
}
 
开发者ID:KONNEKTING,项目名称:KonnektingDeviceConfig,代码行数:6,代码来源:DeviceConfigContainer.java

示例15: deepClone_Cloning

import com.rits.cloning.Cloner; //导入方法依赖的package包/类
@Benchmark
public Object deepClone_Cloning(BenchmarkState state) {
    Cloner cloner = new Cloner();
    return cloner.deepClone(state.index);
}
 
开发者ID:tzaeschke,项目名称:distributed-phtree,代码行数:6,代码来源:CloningBenchmark.java


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