This repository has been archived by the owner on Sep 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CB_UndoableEdit.java
135 lines (130 loc) · 4.6 KB
/
CB_UndoableEdit.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/**
* Copyright © 2006-2008 Paul van Santen & Erik Kerkvliet,
*
* This file is part of ClassicalBuilder.
*
* ClassicalBuilder is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ClassicalBuilder is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with ClassicalBuilder; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* http://www.gnu.org/licenses/gpl.txt
**/
package ClassicalBuilder;
import javax.swing.undo.AbstractUndoableEdit;
public abstract class CB_UndoableEdit extends AbstractUndoableEdit {
protected CB_Box oldBox, newBox;
protected CB_Colors oldColors, newColors;
protected CB_Particle oldParticle, newParticle;
protected CB_Particles oldParticles, newParticles;
protected CB_Interaction oldInteraction, newInteraction;
protected CB_Constraint oldConstraint, newConstraint;
protected CB_Relations oldRelations, newRelations;
protected CB_Relations oldInteractions, newInteractions, oldConstraints, newConstraints;
protected int[] oldArray, newArray;
protected double[] oldVector, newVector;
private int id;
private int[] ids;
public CB_UndoableEdit(int id, int[] oldArray, int[] newArray) {
super();
this.id = id;
this.oldArray = oldArray;
this.newArray = newArray;
}
public CB_UndoableEdit(CB_Box oldBox, CB_Box newBox, CB_Particles oldParticles, CB_Particles newParticles) {
super();
this.oldBox = oldBox;
this.newBox = newBox;
this.oldParticles = oldParticles;
this.newParticles = newParticles;
}
public CB_UndoableEdit(CB_Colors oldColors, CB_Colors newColors, CB_Particles oldParticles, CB_Particles newParticles) {
super();
this.oldColors = oldColors;
this.newColors = newColors;
this.oldParticles = oldParticles;
this.newParticles = newParticles;
}
public CB_UndoableEdit(int id, double[] oldVector, double[] newVector) {
super();
this.id = id;
this.oldVector = oldVector;
this.newVector = newVector;
}
public CB_UndoableEdit(int id, CB_Particle oldParticle, CB_Particle newParticle) {
super();
this.id = id;
this.oldParticle = oldParticle;
this.newParticle = newParticle;
}
public CB_UndoableEdit(int[] ids, CB_Particles oldParticles, CB_Particles newParticles) {
super();
this.ids = ids;
this.oldParticles = oldParticles;
this.newParticles = newParticles;
}
public CB_UndoableEdit(int[] ids, CB_Particles oldParticles, CB_Particles newParticles,
CB_Relations oldInteractions, CB_Relations newInteractions,
CB_Relations oldConstraints, CB_Relations newConstraints) {
super();
this.ids = ids;
this.oldParticles = oldParticles;
this.newParticles = newParticles;
this.oldInteractions = oldInteractions;
this.newInteractions = newInteractions;
this.oldConstraints = oldConstraints;
this.newConstraints = newConstraints;
}
public CB_UndoableEdit(CB_Particles oldParticles, CB_Particles newParticles) {
super();
this.oldParticles = oldParticles;
this.newParticles = newParticles;
}
public CB_UndoableEdit(int id, CB_Interaction oldInteraction, CB_Interaction newInteraction) {
super();
this.id = id;
this.oldInteraction = oldInteraction;
this.newInteraction = newInteraction;
}
public CB_UndoableEdit(int id, CB_Constraint oldConstraint, CB_Constraint newConstraint) {
super();
this.id = id;
this.oldConstraint = oldConstraint;
this.newConstraint = newConstraint;
}
public CB_UndoableEdit(int[] ids, CB_Relations oldRelations, CB_Relations newRelations) {
super();
this.ids = ids;
this.oldRelations = oldRelations;
this.newRelations = newRelations;
}
public CB_UndoableEdit(CB_Relations oldRelations, CB_Relations newRelations) {
super();
this.oldRelations = oldRelations;
this.newRelations = newRelations;
}
public int getId() {
return id;
}
public int[] getIds() {
return ids;
}
public int getId(int index) {
return ids[index];
}
public String getRedoPresentationName() {
return "Redo " + getUndoRedoPresentationName();
}
public String getUndoPresentationName() {
return "Undo " + getUndoRedoPresentationName();
}
public abstract String getUndoRedoPresentationName();
}