Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/datamodel/BasicModel.java')
-rw-r--r--bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/datamodel/BasicModel.java149
1 files changed, 0 insertions, 149 deletions
diff --git a/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/datamodel/BasicModel.java b/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/datamodel/BasicModel.java
deleted file mode 100644
index 3b3b43589..000000000
--- a/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/datamodel/BasicModel.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.ws.internal.datamodel;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-public class BasicModel implements Model
-{
-
- // Copyright
- public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";
-
- private String fName;
- private Hashtable fElements;
- private Element fRoot;
- //This is used by the MUID
- private int fUniqueNumberCounter;
-
- public BasicModel ( String name )
- {
- fName = name;
- fElements = new Hashtable();
- fRoot = null;
- fUniqueNumberCounter = 0;
- }
-
- public void setName ( String name )
- {
- fName = name;
- }
-
- public String getName ()
- {
- return fName;
- }
-
-
- /*
- * simple counter that increments each call
- */
- public int getUniqueNumber()
- {
- fUniqueNumberCounter++;
- return fUniqueNumberCounter;
- }
-
- /*
- * This will use a unique number and append it to the end of the name
- * @param String name of the element
- * @return String MUID
- */
- public String makeMUID(String name)
- {
- String num = String.valueOf(getUniqueNumber());
- String muid = name + num;
- return muid;
- }
-
-
- public boolean setRootElement ( Element root )
- {
- if (root.getModel() == null)
- addElement(root);
- else if (root.getModel() != this)
- return false;
- fRoot = root;
- return true;
- }
-
- public Element getRootElement ()
- {
- if (fRoot == null) fRoot = getFirstElement();
- return fRoot;
- }
-
-
- /**
- * Get the elements that have this name
- * @param String name the name of the element
- * @return Vector a vector of elements that have this name
- * These elements may be of different types
- **/
-
- public Vector getElementsByName(String name)
- {
- Vector vector = new Vector();
- Enumeration e = fElements.keys();
- while (e.hasMoreElements()){
- Element element = (Element)e.nextElement();
- if (element.getName().equals(name)) vector.addElement(element);
- }
- return vector;
- }
-
-
-
- public boolean addElement ( Element element )
- {
- if (element.getModel() != null) return false;
- fElements.put(element,element);
- return true;
- }
-
- public boolean removeElement ( Element element )
- {
- if (element.getModel() != this) return false;
- element.disconnectAll();
- if (fRoot == element) fRoot = null;
- return (fElements.remove(element) == element);
- }
-
- public Enumeration getElements ()
- {
- return fElements.elements();
- }
-
- public int getNumberOfElements ()
- {
- return fElements.size();
- }
-
- public boolean containsElement ( Element element )
- {
- return fElements.contains(element);
- }
-
- private Element getFirstElement ()
- {
- Enumeration e = getElements();
- return (e.hasMoreElements() ? (Element)e.nextElement() : null);
- }
-
- public String toString ()
- {
- return getName();
- }
-}
-

Back to the top