KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > util > EObjectEList


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2002-2004 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: EObjectEList.java,v 1.3 2005/06/08 06:20:10 nickb Exp $
16  */

17 package org.eclipse.emf.ecore.util;
18
19
20 import org.eclipse.emf.common.notify.Notification;
21 import org.eclipse.emf.ecore.InternalEObject;
22
23
24 public class EObjectEList extends EcoreEList
25 {
26   public static class Unsettable extends EObjectEList
27   {
28     protected boolean isSet;
29
30     public Unsettable(Class JavaDoc dataClass, InternalEObject owner, int featureID)
31     {
32       super(dataClass, owner, featureID);
33     }
34
35     protected void didChange()
36     {
37       isSet = true;
38     }
39
40     public boolean isSet()
41     {
42       return isSet;
43     }
44
45     public void unset()
46     {
47       super.unset();
48       if (isNotificationRequired())
49       {
50         boolean oldIsSet = isSet;
51         isSet = false;
52         owner.eNotify(createNotification(Notification.UNSET, oldIsSet, false));
53       }
54       else
55       {
56         isSet = false;
57       }
58     }
59   }
60
61   protected final int featureID;
62
63   public EObjectEList(Class JavaDoc dataClass, InternalEObject owner, int featureID)
64   {
65     super(dataClass, owner);
66     this.featureID = featureID;
67   }
68
69   public int getFeatureID()
70   {
71     return featureID;
72   }
73
74   protected boolean useEquals()
75   {
76     return false;
77   }
78
79   protected boolean isUnique()
80   {
81     return true;
82   }
83
84   protected boolean hasInverse()
85   {
86     return false;
87   }
88
89   protected boolean isEObject()
90   {
91     return true;
92   }
93
94   protected boolean canContainNull()
95   {
96     return false;
97   }
98
99   protected Object JavaDoc resolve(int index, Object JavaDoc object)
100   {
101     return object;
102   }
103 }
104
Popular Tags