本文整理汇总了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);
}
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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]);
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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]"));
}
示例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()));
}
}
示例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);
}
示例14: deepCloneDevice
import com.rits.cloning.Cloner; //导入方法依赖的package包/类
private KonnektingDevice deepCloneDevice() {
Cloner cloner = new Cloner();
KonnektingDevice clone = cloner.deepClone(device);
return clone;
}
示例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);
}