Questions tagged [cloning]

Cloning refers to the making of an exact copy (deep copy) of any kind of object. It is the opposite of shallow copying, in which a reference to particular object is copied, not the object itself.

Cloning refers to the making of an exact copy (deep copy) of any kind of object. It is the opposite of shallow copying, in which a reference to particular object is copied, not the object itself.

377 questions
4
votes
2 answers

C# Cloning- working with nonserializable data types

I've hit a bit of a stumbling block in my quest to implement object cloning in my game engine. My goal is to have a cloning system that I don't have to maintain on a class by class basis, unless the class needs special treatment. My game engine's…
Will Tice
  • 434
  • 4
  • 17
4
votes
1 answer

Is there a way to clone objects in Dart?

I went through a few questions about this on Stackoverflow but nothing made sense to me. What's the easiest way?
Track Back
  • 51
  • 1
  • 7
4
votes
1 answer

The role of input_tensors in tf.keras.models.clone_model

I am trying to copy a existing keras model. The following is a sample code that I created and it seems that it's working as expected. model = CreateSimpleModel() model.compile(loss="sparse_categorical_crossentropy", …
chanwcom
  • 4,420
  • 8
  • 37
  • 49
4
votes
1 answer

Event Subscriber Cloning

I would like to know how it is best done to clone an object and reattach the event subscribers to the newly cloned object. Background: I use a Converter, which can convert from a string to an object. The object is known in the context of the…
Gregor Favre
  • 155
  • 1
  • 10
4
votes
4 answers

Implementing clone on a LinkedList

I am trying to implement a clone() method on a DoubleLinkedList. Now, the problem is that implementing it by "the convention" is a lot more troublesome than just creating a new DoubleLinkedList and filling it with all the elements of my current…
devoured elysium
  • 101,373
  • 131
  • 340
  • 557
4
votes
5 answers

does java HashMap.putall clone all elements?

I have a Hashmap in which I wrote a class that deals with adding and retrieving values. class ReputationMatrix { private HashMap < Integer, int[] > repMatrix; public ReputationMatrix() { repMatrix = new HashMap < Integer, int[]…
user1378063
  • 263
  • 1
  • 6
  • 9
4
votes
2 answers

Cloning objects in C#

I defined next class with virtual properties: public class Order: BaseEPharmObject { public Order() { } public virtual Guid Id { get; set; } public virtual DateTime Created { get; set; } public virtual DateTime? Closed {…
akrisanov
  • 3,212
  • 6
  • 33
  • 56
4
votes
4 answers

How to achieve independent cloned TADODataSet?

The scenarios is like this: We have some SQL table. We are performing an SQL query on this table and we have results in TADOQuery object. var qryOryginal, qryClone: TADOQuery; begin //setup all the things here qryOryginal.Active := True; …
Wodzu
  • 6,932
  • 10
  • 65
  • 105
4
votes
5 answers

Confused about cloning in Java

I have this code in Java. public class CloneTest implements Cloneable{ String name; int marks; public CloneTest(String s, int i) { name = s; marks = i; } public void setName(String s) { name = s; } …
JavaNewbie_M107
  • 2,007
  • 3
  • 21
  • 36
4
votes
5 answers

Is it possible to copy/clone HttpContext of a web request

What's the easiest way to clone current request's HttpContext instance? I'm developing an app in Asp.net MVC v1. I upgraded the regular PartialView capabilities to actually have sub-controllers that act very similar, but have their own context. When…
Robert Koritnik
  • 103,639
  • 52
  • 277
  • 404
4
votes
1 answer

Best way to clone properties of disparate objects

I have an MVC3 application that needs to sync view models with database models. I found myself writing way too much code to copy properties back and forth between the different objects. I avoided this where I could simply subclass the data model,…
B2K
  • 2,541
  • 1
  • 22
  • 34
4
votes
1 answer

deep copy of node with kxml (java me)

I ran into a problem while developing onto Blackberry. I am using KXML2 api for XML parsing (well actually, I got someone else's code to continue and fix, so I have to use this). The problem is the lack of cloning in java me, and im having some…
omniflash
  • 191
  • 1
  • 14
4
votes
1 answer

Deserialization and null references best practice - set to null or ignore?

This is a question about serialization in general, but in particular I am using ServiceStack's excellent serializers in my .NET code. Should the deserializers set null references on properties? It seems like currently it ignores null references and…
Patrick Szalapski
  • 8,738
  • 11
  • 67
  • 129
3
votes
1 answer

jquery cloning. click event not triggering on newly created cloned rows

This code is working fine, almost Lets say I have 10 rows on a table, I click on top row, it gets CLONED and then ADDED to the bottom of table and the original is REMOVED, repeat these steps 5 times. I now end with the five rows that were cloned on…
rudy
  • 311
  • 3
  • 14
3
votes
2 answers

Clone object to another object but exclude some properties?

I would like to clone an Object to another object but exclude a property from the original object. example if object A has Name, Salary, Location, then the cloned object should have only Name and salary properties if i excluded the Location…
user282807
  • 905
  • 3
  • 13
  • 26
1 2
3
25 26