vcs: cleanup - move field copying into copy constructor

This commit is contained in:
Aleksey Pivovarov
2016-12-20 17:22:58 +03:00
committed by Aleksey Pivovarov
parent d7e65b11e3
commit 61365c7e90
@@ -49,6 +49,23 @@ public class LocalChangeListImpl extends LocalChangeList {
myId = origin.getId();
myProject = origin.myProject;
setName(origin.myName);
myComment = origin.myComment;
myIsDefault = origin.myIsDefault;
myIsReadOnly = origin.myIsReadOnly;
myData = origin.myData;
if (myChanges != null) {
myChanges = ContainerUtil.newHashSet(origin.myChanges);
}
if (myChangesBeforeUpdate != null) {
myChangesBeforeUpdate = new OpenTHashSet((Collection<Change>)origin.myChangesBeforeUpdate);
}
if (myReadChangesCache != null) {
myReadChangesCache = ContainerUtil.newHashSet(origin.myReadChangesCache);
}
}
@NotNull
@@ -246,25 +263,7 @@ public class LocalChangeListImpl extends LocalChangeList {
}
public LocalChangeList copy() {
final LocalChangeListImpl copy = new LocalChangeListImpl(this);
copy.myComment = myComment;
copy.myIsDefault = myIsDefault;
copy.myIsReadOnly = myIsReadOnly;
copy.myData = myData;
if (myChanges != null) {
copy.myChanges = ContainerUtil.newHashSet(myChanges);
}
if (myChangesBeforeUpdate != null) {
copy.myChangesBeforeUpdate = new OpenTHashSet<>((Collection<Change>)myChangesBeforeUpdate);
}
if (myReadChangesCache != null) {
copy.myReadChangesCache = ContainerUtil.newHashSet(myReadChangesCache);
}
return copy;
return new LocalChangeListImpl(this);
}
public void setId(String id) {