diff options
author | nitind | 2006-04-13 07:14:24 +0000 |
---|---|---|
committer | nitind | 2006-04-13 07:14:24 +0000 |
commit | 658bf9a258a3226f3be6f9db0b1e2733ba6cad0d (patch) | |
tree | e15c0af83aebdacbd9e513e97e5a740065cac49b /bundles/org.eclipse.wst.dtd.core/emfmodel/org/eclipse/wst/dtd/core/internal/emf/util/DTDMetrics.java | |
parent | 618a19448e2301333a97badaa47bd90747a663db (diff) | |
download | webtools.sourceediting-200604130316.tar.gz webtools.sourceediting-200604130316.tar.xz webtools.sourceediting-200604130316.zip |
This commit was manufactured by cvs2svn to create tag 'v200604130316'.v200604130316
Diffstat (limited to 'bundles/org.eclipse.wst.dtd.core/emfmodel/org/eclipse/wst/dtd/core/internal/emf/util/DTDMetrics.java')
-rw-r--r-- | bundles/org.eclipse.wst.dtd.core/emfmodel/org/eclipse/wst/dtd/core/internal/emf/util/DTDMetrics.java | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/bundles/org.eclipse.wst.dtd.core/emfmodel/org/eclipse/wst/dtd/core/internal/emf/util/DTDMetrics.java b/bundles/org.eclipse.wst.dtd.core/emfmodel/org/eclipse/wst/dtd/core/internal/emf/util/DTDMetrics.java deleted file mode 100644 index 32c06e3f88..0000000000 --- a/bundles/org.eclipse.wst.dtd.core/emfmodel/org/eclipse/wst/dtd/core/internal/emf/util/DTDMetrics.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.dtd.core.internal.emf.util; - -import java.util.Collection; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Vector; - -import org.eclipse.wst.dtd.core.internal.emf.DTDElement; -import org.eclipse.wst.dtd.core.internal.emf.DTDElementReferenceContent; -import org.eclipse.wst.dtd.core.internal.emf.DTDFile; - - -public class DTDMetrics { - protected DTDFile dtdFile; - protected Hashtable elementReferenceMap; - - public DTDMetrics(DTDFile dtdFile) { - this.dtdFile = dtdFile; - } - - public Hashtable getElementReferences() { - if (elementReferenceMap == null) { - elementReferenceMap = new Hashtable(); - new DTDVisitor() { - - public void visitDTDElementReferenceContent(DTDElementReferenceContent elementReferenceContent) { - DTDElement dtdElement = elementReferenceContent.getReferencedElement(); - Object visitation = elementReferenceMap.get(dtdElement); - if (visitation == null) { - elementReferenceMap.put(dtdElement, visitation = new Vector()); - } - ((Vector) visitation).addElement(elementReferenceContent); - } - }.visitDTDFile(dtdFile); - } - - return elementReferenceMap; - } - - public int getElementReferenceCount(DTDElement dtdElement) { - Object elementReferences = getElementReferences().get(dtdElement); - return elementReferences == null ? 0 : ((Vector) elementReferences).size(); - } - - public DTDElement getLeastReferencedElement() { - DTDElement result = null; - int lowestReferenceCount = Integer.MAX_VALUE; - - Collection elements = dtdFile.listDTDElement(); - for (Iterator i = elements.iterator(); i.hasNext();) { - DTDElement element = (DTDElement) i.next(); - int count = getElementReferenceCount(element); - if (count < lowestReferenceCount) { - result = element; - lowestReferenceCount = count; - } - } - - return result; - } - - /** - * @generated - */ - protected Hashtable getElementReferencesGen() { - - if (elementReferenceMap == null) { - elementReferenceMap = new Hashtable(); - new DTDVisitor() { - - public void visitDTDElementReferenceContent(DTDElementReferenceContent elementReferenceContent) { - DTDElement dtdElement = elementReferenceContent.getReferencedElement(); - Object visitation = elementReferenceMap.get(dtdElement); - if (visitation == null) { - elementReferenceMap.put(dtdElement, visitation = new Vector()); - } - ((Vector) visitation).addElement(elementReferenceContent); - } - }.visitDTDFile(dtdFile); - } - - return elementReferenceMap; - } - - /** - * @generated - */ - protected int getElementReferenceCountGen(DTDElement dtdElement) { - - Object elementReferences = getElementReferences().get(dtdElement); - return elementReferences == null ? 0 : ((Vector) elementReferences).size(); - } - - /** - * @generated - */ - protected DTDElement getLeastReferencedElementGen() { - - DTDElement result = null; - int lowestReferenceCount = Integer.MAX_VALUE; - - Collection elements = dtdFile.listDTDElement(); - for (Iterator i = elements.iterator(); i.hasNext();) { - DTDElement element = (DTDElement) i.next(); - int count = getElementReferenceCount(element); - if (count < lowestReferenceCount) { - result = element; - lowestReferenceCount = count; - } - } - - return result; - } -} |