diff -r 00a822751b57 xml.xam/apichanges.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml.xam/apichanges.xml Mon Aug 03 22:12:14 2009 +0400 @@ -0,0 +1,152 @@ + + + + + + + + + + + + + Extansible Abstract Model (XAM) + + + + + + + + + Two new methods to enhance model's performance + + + + + + Two new methods are added: +
    +
  • {@link org.netbeans.modules.xml.xam.AbstractComponent#checkChildrenPopulated()}
  • +
  • {@link org.netbeans.modules.xml.xam.AbstractComponent#getChildrenCount()}
  • +
+

+ They are intended to be used instead of getChildren() in cases + when the children's list isn't required. It helps impove performance. +

+
+ + +
+ +
+ + + + + + + Change History for the Extansible Abstract Model (XAM) + + + + + + +

Introduction

+ +

This document lists changes made to the Extansible Abstract Model (XAM).

+
+ +

@FOOTER@

+ +
+ +
diff -r 00a822751b57 xml.xam/nbproject/project.properties --- a/xml.xam/nbproject/project.properties Mon Aug 03 20:33:11 2009 +0400 +++ b/xml.xam/nbproject/project.properties Mon Aug 03 22:12:14 2009 +0400 @@ -42,4 +42,5 @@ is.autoload=true is.autoload=true javac.source=1.5 javadoc.arch=${basedir}/arch.xml -spec.version.base=1.6.0 +javadoc.apichanges=${basedir}/apichanges.xml +spec.version.base=1.6.1 diff -r 00a822751b57 xml.xam/src/org/netbeans/modules/xml/xam/AbstractComponent.java --- a/xml.xam/src/org/netbeans/modules/xml/xam/AbstractComponent.java Mon Aug 03 20:33:11 2009 +0400 +++ b/xml.xam/src/org/netbeans/modules/xml/xam/AbstractComponent.java Mon Aug 03 22:12:14 2009 +0400 @@ -138,7 +138,33 @@ public abstract class AbstractComponent< List result = new ArrayList(_getChildren()); return Collections.unmodifiableList(result); } - + + /** + * This method guarantee that children are populated. + * It's preferable to use it instead of getChildren() if children themselves + * aren't necessary. This method works much faster then using getChildren() + * in case of big amount of children because of absence of copying children + * to a separate list. + * + * @since 1.6.1 + */ + public void checkChildrenPopulated() { + _getChildren(); + } + + /** + * Sometimes it's necessary to know amount of children but the children + * themselves aren't necessary. This method works much faster then using + * getChildren().size() in case of big amount of children because of + * absence of copying children to a separate list. + * + * @return number of children + * @since 1.6.1 + */ + public int getChildrenCount() { + return _getChildren().size(); + } + /** * This method provides the ability to detect whether calling getChildren() * will trigger population of children. This can be used for meta models diff -r 00a822751b57 xml.xam/src/org/netbeans/modules/xml/xam/dom/AbstractDocumentComponent.java --- a/xml.xam/src/org/netbeans/modules/xml/xam/dom/AbstractDocumentComponent.java Mon Aug 03 20:33:11 2009 +0400 +++ b/xml.xam/src/org/netbeans/modules/xml/xam/dom/AbstractDocumentComponent.java Mon Aug 03 22:12:14 2009 +0400 @@ -473,7 +473,7 @@ public abstract class AbstractDocumentCo } protected DocumentModelAccess getAccess() { - getChildren(); //make sure children populated before potential mutation + checkChildrenPopulated(); //make sure children populated before potential mutation return (DocumentModelAccess) getModel().getAccess(); } diff -r 00a822751b57 xml.xam/src/org/netbeans/modules/xml/xam/dom/AbstractDocumentModel.java --- a/xml.xam/src/org/netbeans/modules/xml/xam/dom/AbstractDocumentModel.java Mon Aug 03 20:33:11 2009 +0400 +++ b/xml.xam/src/org/netbeans/modules/xml/xam/dom/AbstractDocumentModel.java Mon Aug 03 22:12:14 2009 +0400 @@ -469,7 +469,7 @@ public abstract class AbstractDocumentMo Element e = pathFromRoot.get(current); if (base.referencesSameNode(e)) { if (pathFromRoot.size() == current + 1) { - base.getChildren(); // make sure children inited + base.checkChildrenPopulated(); // make sure children inited return base; } else { for (Object child : base.getChildren()) {