use of org.eclipse.wst.dtd.core.internal.emf.DTDElement in project webtools.sourceediting by eclipse.
the class DTDMetrics method getElementReferences.
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;
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDElement in project webtools.sourceediting by eclipse.
the class DTDMetrics method getElementReferencesGen.
/**
* @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;
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDElement in project webtools.sourceediting by eclipse.
the class DTDMetrics method getLeastReferencedElement.
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;
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDElement in project webtools.sourceediting by eclipse.
the class DTDElementContentImpl method isFirstElementContent.
public boolean isFirstElementContent() {
DTDElement element = getElement();
if (element != null) {
// This means this is the only element content in the element
return true;
}
// end of if ()
DTDGroupContent group = getGroup();
int pos = group.getContentPosition(this);
if (pos == 0) {
// now recurse and ensure this group is the first group
return group.isFirstElementContent();
} else // end of if ()
{
return false;
}
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDElement in project webtools.sourceediting by eclipse.
the class DTDVisitor method visitDTDFileGen.
/**
* @generated
*/
protected void visitDTDFileGen(DTDFile file) {
Collection notations = file.listDTDNotation();
for (Iterator i = notations.iterator(); i.hasNext(); ) {
visitDTDNotation((DTDNotation) i.next());
}
Collection entities = file.listDTDEntity();
for (Iterator i = entities.iterator(); i.hasNext(); ) {
visitDTDEntity((DTDEntity) i.next());
}
Collection objects = file.listDTDElementAndDTDParameterEntityReference();
for (Iterator i = objects.iterator(); i.hasNext(); ) {
DTDObject object = (DTDObject) i.next();
if (object instanceof DTDElement) {
visitDTDElement((DTDElement) object);
} else // end of if ()
{
visitDTDParameterEntityReference((DTDParameterEntityReference) object);
}
// end of if ()
}
}
Aggregations