01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: ElementVariableModel.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.gui.model;
09:
10: import com.uwyn.rife.gui.model.exceptions.GuiModelException;
11:
12: public abstract class ElementVariableModel extends ElementPropertyModel {
13: protected ElementVariableModel(ElementModel element, String name)
14: throws GuiModelException {
15: super (element, name);
16: }
17:
18: public boolean equals(Object object) {
19: if (object instanceof ParticlePropertyModel) {
20: ParticlePropertyModel property = (ParticlePropertyModel) object;
21: if (property.getParticle() == getParticle()
22: && object instanceof ElementVariableModel
23: && property.getName().equals(getName())) {
24: return true;
25: }
26: }
27:
28: return false;
29: }
30:
31: protected static ParticlePropertyModel findConflictingProperty(
32: ParticleModel particle, Class type, String name) {
33: assert particle != null;
34: assert type != null;
35: assert name != null;
36: assert name.length() > 0;
37:
38: return particle.getProperty(ElementVariableModel.class, name);
39: }
40: }
|