Esempio n. 1
0
 /**
  * @see com.habelitz.jsobjectizer.jsom.api.statement.base.StatementBlockElementContainer#getSelectedStatementBlockElements(com.habelitz.jsobjectizer.jsom.api.statement.StatementBlockElement.ElementType[])
  */
 public List<StatementBlockElement> getSelectedStatementBlockElements(
     ElementType[] pStatementBlockElementTypes)
 {
     return getSelectedStatementBlockElements(
         pStatementBlockElementTypes, null);
 }
Esempio n. 2
0
        /**
         * @see com.habelitz.jsobjectizer.jsom.api.statement.base.StatementBlockElementContainer#getSelectedStatementBlockElements(com.habelitz.jsobjectizer.jsom.api.statement.StatementBlockElement.ElementType[], java.util.List)
         */
        public List<StatementBlockElement> getSelectedStatementBlockElements(
            ElementType[] pStatementBlockElementTypes,
            List<StatementBlockElement> pList)
        {
            if (!mHasSwitchLabels) {
            return null; // No switch labels available.
            }
            if (mLabels == null) {
            resolveSwitchLabels();
            }
            List<StatementBlockElement> result = pList;
            if (result == null) {
            result = new List<StatementBlockElement>();
            }
            int oldSize = result.Count;
            foreach (SwitchLabel label in mLabels) {
            label.getSelectedStatementBlockElements(
                    pStatementBlockElementTypes, result);
            }

            return result.Count > oldSize ? result : null;
        }
        /**
         * @see com.habelitz.jsobjectizer.jsom.api.statement.base.StatementBlockElementContainer#getSelectedStatementBlockElements(com.habelitz.jsobjectizer.jsom.api.statement.StatementBlockElement.ElementType[], java.util.List)
         */
        public List<StatementBlockElement> getSelectedStatementBlockElements(
            ElementType[] pStatementBlockElementTypes,
            List<StatementBlockElement> pList)
        {
            if (pStatementBlockElementTypes == null) {
            return null;
            }
            if (mElements == null) {
            resolveStatementBlockElements();
            }
            List<StatementBlockElement> result = pList;
            int oldSize = 0;
            if (result == null) {
            result = new List<StatementBlockElement>();
            } else {
            oldSize = result.Count;
            }
            foreach (StatementBlockElement elem in mElements) {
            foreach (ElementType elemType in pStatementBlockElementTypes) {
                if (elemType == null) {
                    continue;
                }
                if (elem.isStatementBlockElementType(elemType)) {
                    result.Add(elem);
                    break; // Continue with the outer loop.
                }
            }
            }

            return result.Count > oldSize ? result : null;
        }
        /**
         * @see com.habelitz.jsobjectizer.jsom.api.statement.base.StatementBlockElementContainer#getSelectedStatementBlockElements(com.habelitz.jsobjectizer.jsom.api.statement.StatementBlockElement.ElementType, java.util.List)
         */
        public List<StatementBlockElement> getSelectedStatementBlockElements(
            ElementType pStatementBlockElementType, 
            List<StatementBlockElement> pList)
        {
            if (mElements == null) {
            resolveStatementBlockElements();
            }
            List<StatementBlockElement> result = pList;
            int oldSize = 0;
            if (result == null) {
            result = new List<StatementBlockElement>();
            } else {
            oldSize = result.Count;
            }
            foreach (StatementBlockElement elem in mElements) {
            if (elem.isStatementBlockElementType(pStatementBlockElementType)) {
                result.Add(elem);
            }
            }

            return result.Count > oldSize ? result : null;
        }
Esempio n. 5
0
 /**
  * Constructor.
  *
  * @param pTree  The root or start node of the statement.
  * @param pStatementBlockElemType  One of the constants defined by <code>
  *                                 StatementBlockElement</code>.
  * @param pTokenRewriteStream  The token stream the token of the stated
  *                             tree node belongs to.
  */
 public AST2Statement(
     AST2JSOMTree pTree, ElementType pStatementBlockElemType,
     TokenRewriteStream pTokenRewriteStream)
     : base(pTree, JSOMType.STATEMENT_BLOCK_ELEMENT, pTokenRewriteStream)
 {
     mStatementBlockElementType = pStatementBlockElemType;
 }
Esempio n. 6
0
 /**
  * Returns <code>true</code> if <code>pType</code> equals to <code>
  * StatementBlockElement.ElementType.LOCAL_VARIABLE_DECLARATION</code>.
  *
  * @return  <code>true</code> if <code>pType</code> equals to <code>
  *          StatementBlockElement.ElementType.LOCAL_VARIABLE_DECLARATION</code>.
  */
 public override bool isStatementBlockElementType(ElementType pType)
 {
     return pType == mStatementBlockElementType;
 }
 /**
  * Returns <code>true</code> if <code>pType</code> equals to <code>
  * StatementBlockElement.ElementType.LOCAL_VARIABLE_DECLARATION</code>.
  *
  * @return  <code>true</code> if <code>pType</code> equals to <code>
  *          StatementBlockElement.ElementType.LOCAL_VARIABLE_DECLARATION</code>.
  */
 public override bool isStatementBlockElementType(ElementType pType)
 {
     return pType == ElementType.LOCAL_VARIABLE_DECLARATION;
 }