source: trunk/src/org/expeditee/core/bounds/CombinationBounds.java@ 1415

Last change on this file since 1415 was 1415, checked in by bln4, 5 years ago

Renamed Frame.getItems() to Frame.getSortedItems() to better represent its functionality.

-> org.apollo.ApolloGestureActions
-> org.apollo.ApolloSystem
-> org.expeditee.actions.Actions
-> org.expeditee.actions.Debug
-> org.expeditee.actions.ExploratorySearchActions
-> org.expeditee.actions.JfxBrowserActions
-> org.expeditee.actions.Misc
-> org.expeditee.actions.Navigation
-> org.expeditee.actions.ScriptBase
-> org.expeditee.actions.Simple
-> org.expeditee.agents.ComputeTree
-> org.expeditee.agents.CopyTree
-> org.expeditee.agents.DisplayComet
-> org.expeditee.agents.DisplayTree
-> org.expeditee.agents.DisplayTreeLeaves
-> org.expeditee.agents.GraphFramesetLinks
-> org.expeditee.agents.TreeProcessor
-> org.expeditee.gio.gesture.StandardGestureActions
-> org.expeditee.gui.DisplayController
-> org.expeditee.gui.FrameCreator
-> org.expeditee.gui.FrameIO
-> org.expeditee.io.DefaultTreeWriter
-> org.expeditee.io.JavaWriter
-> org.expeditee.io.PDF2Writer
-> org.expeditee.io.TXTWriter
-> org.expeditee.io.WebParser
-> org.expeditee.io.flowlayout.XGroupItem
-> org.expeditee.items.Dot
-> org.expeditee.items.Item
-> org.expeditee.items.ItemUtils
-> org.expeditee.network.FrameShare
-> org.expeditee.stats.TreeStats


Created ItemsList class to wrap ArrayList<Item>. Frames now use this new class to store its body list (used for display) as well as its primaryBody and surrogateBody.

-> org.expeditee.agents.Format
-> org.expeditee.agents.HFormat
-> org.expeditee.gio.gesture.StandardGestureActions
-> org.expeditee.gui.Frame
-> org.expeditee.gui.FrameUtils


Refactorted Frame.setResort(bool) to Frame.invalidateSorted() to better function how it is intended to with a more accurate name.

-> org.expeditee.agents.Sort


When writing out .exp files and getting attributes to respond to LEFT + RIGHT click, boolean items are by default true. This has always been the case. An ammendment to this is that defaults can now be established.
Also added 'EnterClick' functionality. If cursored over a item with this property and you press enter, it acts as if you have clicked on it instead.

-> org.expeditee.assets.resources-public.framesets.authentication.1.exp to 6.exp
-> org.expeditee.gio.gesture.StandardGestureActions
-> org.expeditee.gio.input.KBMInputEvent
-> org.expeditee.gio.javafx.JavaFXConversions
-> org.expeditee.gio.swing.SwingConversions
-> org.expeditee.gui.AttributeUtils
-> org.expeditee.io.Conversion
-> org.expeditee.io.DefaultFrameWriter
-> org.expeditee.items.Item


Fixed a bug caused by calling Math.abs on Integer.MIN_VALUE returning unexpected result. Due to zero being a thing, you cannot represent Math.abs(Integer.MIN_VALUE) in a Integer object. The solution is to use Integer.MIN_VALUE + 1 instead of Integer.MIN_VALUE.

-> org.expeditee.core.bounds.CombinationBounds
-> org.expeditee.io.flowlayout.DimensionExtent


Recoded the contains function in EllipticalBounds so that intersection tests containing circles work correctly.

-> org.expeditee.core.bounds.EllipticalBounds


Added toString() to PolygonBounds to allow for useful printing during debugging.

-> org.expeditee.core.bounds.PolygonBounds

Implemented Surrogate Mode!

-> org.expeditee.encryption.io.EncryptedExpReader
-> org.expeditee.encryption.io.EncryptedExpWriter
-> org.expeditee.encryption.items.surrogates.EncryptionDetail
-> org.expeditee.encryption.items.surrogates.Label
-> org.expeditee.gui.FrameUtils
-> org.expeditee.gui.ItemsList
-> org.expeditee.items.Item
-> org.expeditee.items.Text


???? Use Integer.MAX_VALUE cast to a float instead of Float.MAX_VALUE. This fixed some bug which I cannot remember.

-> org.expeditee.gio.TextLayoutManager
-> org.expeditee.gio.swing.SwingTextLayoutManager


Improved solution for dealing with the F10 key taking focus away from Expeditee due to it being a assessibility key.

-> org.expeditee.gio.swing.SwingInputManager


Renamed variable visibleItems in FrameGraphics.paintFrame to itemsToPaintCanditates to better represent functional intent.

-> org.expeditee.gui.FrameGraphics


Improved checking for if personal resources exist before recreating them

-> org.expeditee.gui.FrameIO


Repeated messages to message bay now have a visual feedback instead of just a beep. This visual feedback is in the form of a count of the amount of times it has repeated.

-> org.expeditee.gui.MessageBay


Updated comment on the Vector class to explain what vectors are.

-> org.expeditee.gui.Vector


Added constants to represent all of the property keys in DefaultFrameReader and DefaultFrameWriter.

-> org.expeditee.io.DefaultFrameReader
-> org.expeditee.io.DefaultFrameWriter


Updated the KeyList setting to be more heirarcial with how users will store their Secrets.

-> org.expeditee.settings.identity.secrets.KeyList

File size: 5.5 KB
Line 
1package org.expeditee.core.bounds;
2
3import java.util.LinkedList;
4import java.util.List;
5
6import org.expeditee.core.Point;
7
8/**
9 * The CombinationBounds class represents a collection of bounds, which
10 * may be disjoint. A point is considered inside the CombinationBounds if
11 * it is inside any of the individual bounds in the collection (i.e. if it
12 * is inside the conjunction of the individual bounds). If the combination
13 * bounds has no component bounds, then no points are inside it.
14 *
15 * @author cts16
16 */
17public class CombinationBounds extends Bounds {
18
19 /** The collection of bounds. */
20 protected List<Bounds> _bounds;
21
22 /** Default constructor. */
23 public CombinationBounds()
24 {
25 this(null);
26 }
27
28 /** Standard constructor. */
29 public CombinationBounds(Bounds b)
30 {
31 _bounds = new LinkedList<Bounds>();
32 add(b);
33 }
34
35 /** Copy constructor. */
36 public CombinationBounds(CombinationBounds other)
37 {
38 _bounds = new LinkedList<Bounds>();
39 for (Bounds b : other._bounds) add(b);
40 }
41
42 /** Adds a bounds to the combination. */
43 public CombinationBounds add(Bounds b)
44 {
45 // Only valid Bounds are allowed in the collection
46 if (b == null) return this;
47
48 _bounds.add(b);
49
50 return this;
51 }
52
53 /** Gets the bounds at the given index in this combination. */
54 public Bounds get(int index)
55 {
56 if (0 <= index && index < _bounds.size()) return _bounds.get(index);
57
58 return null;
59 }
60
61 /** Removes all component bounds. */
62 public CombinationBounds clear()
63 {
64 _bounds.clear();
65
66 return this;
67 }
68
69 /** Whether this combination bounds has no component bounds. */
70 public boolean isEmpty()
71 {
72 return _bounds.isEmpty();
73 }
74
75 @Override
76 public boolean contains(int x, int y)
77 {
78 // If any component bounds contains the point, then the combination as
79 // a whole does as well
80 for (Bounds b : _bounds) {
81 if (b.contains(x, y)) return true;
82 }
83
84 // No component contained the point
85 return false;
86 }
87
88 @Override
89 public int getMaxX() {
90 // +1 makes it safe to do math.abs on
91 int maxX = Integer.MIN_VALUE + 1;
92
93 for (Bounds b : _bounds) {
94 int thisX = b.getMaxX();
95 if (thisX > maxX) maxX = thisX;
96 }
97
98 return maxX;
99 }
100
101 @Override
102 public int getMinX()
103 {
104 int minX = Integer.MAX_VALUE;
105
106 for (Bounds b : _bounds) {
107 int thisX = b.getMinX();
108 if (thisX < minX) minX = thisX;
109 }
110
111 return minX;
112 }
113
114 @Override
115 public int getMaxY() {
116 // +1 makes it safe to do math.abs on
117 int maxY = Integer.MIN_VALUE + 1;
118
119 for (Bounds b : _bounds) {
120 int thisY = b.getMaxY();
121 if (thisY > maxY) maxY = thisY;
122 }
123
124 return maxY;
125 }
126
127 @Override
128 public int getMinY()
129 {
130 int minY = Integer.MAX_VALUE;
131
132 for (Bounds b : _bounds) {
133 int thisY = b.getMinY();
134 if (thisY < minY) minY = thisY;
135 }
136
137 return minY;
138 }
139
140 @Override
141 public CombinationBounds translate(int x, int y)
142 {
143 for (Bounds b : _bounds) {
144 b.translate(x, y);
145 }
146
147 return this;
148 }
149
150 @Override
151 public boolean equals(Bounds other)
152 {
153 if (other instanceof CombinationBounds) {
154 CombinationBounds c = (CombinationBounds) other;
155 if (_bounds.size() == c._bounds.size()) {
156 for (int i = 0; i < _bounds.size(); i++) {
157 if (!(_bounds.get(i).equals(c._bounds.get(i)))) return false;
158 }
159 return true;
160 }
161 }
162 return false;
163 }
164
165 @Override
166 public boolean intersects(Bounds other)
167 {
168 for (Bounds b : _bounds) {
169 if (b.intersects(other)) return true;
170 }
171
172 return false;
173 }
174
175 @Override
176 public boolean intersects(AxisAlignedBoxBounds other)
177 {
178 return intersects((Bounds) other);
179 }
180
181 @Override
182 public boolean intersects(CombinationBounds other)
183 {
184 return intersects((Bounds) other);
185 }
186
187 @Override
188 public boolean intersects(EllipticalBounds other)
189 {
190 return intersects((Bounds) other);
191 }
192
193 @Override
194 public boolean intersects(PolygonBounds other)
195 {
196 return intersects((Bounds) other);
197 }
198
199 @Override
200 public double getArea()
201 {
202 // TODO Complete. Difficult as have to take into account overlapping areas. cts16
203 System.err.println("Unimplemented method: CombinationBounds.getArea()");
204 return 0;
205 }
206
207 @Override
208 public boolean perimeterContains(Point p, double error)
209 {
210 for (Bounds b : _bounds) {
211 if (b.perimeterContains(p, error)) {
212 for (Bounds b2 : _bounds) {
213 if (b2 != b && b2.contains(p) && !b2.perimeterContains(p, error)) return false;
214 }
215 return true;
216 }
217 }
218
219 return false;
220 }
221
222 @Override
223 public boolean completelyContains(AxisAlignedBoxBounds other)
224 {
225 // TODO Complete. Difficult as we have to take into account conjoined areas. cts16
226 System.err.println("Unimplemented method: CombinationBounds.completelyContains(AxisAlignedBoxBounds)");
227 return false;
228 }
229
230 @Override
231 public boolean completelyContains(CombinationBounds other)
232 {
233 // TODO Complete. Difficult as we have to take into account conjoined areas. cts16
234 System.err.println("Unimplemented method: CombinationBounds.completelyContains(CombinationBounds)");
235 return false;
236 }
237
238 @Override
239 public boolean completelyContains(EllipticalBounds other)
240 {
241 // TODO Complete. Difficult as we have to take into account conjoined areas. cts16
242 System.err.println("Unimplemented method: CombinationBounds.completelyContains(EllipticalBounds)");
243 return false;
244 }
245
246 @Override
247 public boolean completelyContains(PolygonBounds other)
248 {
249 // TODO Complete. Difficult as we have to take into account conjoined areas. cts16
250 System.err.println("Unimplemented method: CombinationBounds.completelyContains(PolygonBounds)");
251 return false;
252 }
253
254 @Override
255 public CombinationBounds clone()
256 {
257 return new CombinationBounds(this);
258 }
259}
Note: See TracBrowser for help on using the repository browser.