Examples of SimpleSequence


Examples of freemarker.template.SimpleSequence

    }

    private TemplateModel emptyResult(boolean seq) {
        return seq
                ? (_TemplateAPI.getTemplateLanguageVersionAsInt(this) < _TemplateAPI.VERSION_INT_2_3_21
                        ? new SimpleSequence(Collections.EMPTY_LIST, null)
                        : Constants.EMPTY_SEQUENCE)
                : TemplateScalarModel.EMPTY_STRING;
    }
View Full Code Here

Examples of freemarker.template.SimpleSequence

        else if (namespaces instanceof ListLiteral) {
            nss = ((ListLiteral) namespaces).evaluateStringsToNamespaces(env);
        }
        if (nss != null) {
            if (nss instanceof Environment.Namespace) {
                SimpleSequence ss = new SimpleSequence(1);
                ss.add(nss);
                nss = ss;
            }
            else if (!(nss instanceof TemplateSequenceModel)) {
                if (namespaces != null) {
                    throw new NonSequenceException(namespaces, nss, env);
View Full Code Here

Examples of freemarker.template.SimpleSequence

            final SimpleSequence groupsSeq;
           
            MatchWithGroups(String input, Matcher matcher) {
                matchedInputPart = input.substring(matcher.start(), matcher.end());
                final int grpCount = matcher.groupCount() + 1;
                groupsSeq = new SimpleSequence(grpCount);
                for (int i = 0; i < grpCount; i++) {
                    groupsSeq.add(matcher.group(i));
                }
            }
View Full Code Here

Examples of freemarker.template.SimpleSequence

                    }
                    map.put(key, value);
                    keyList.add(key);
                    valueList.add(value);
                }
                keyCollection = new CollectionAndSequence(new SimpleSequence(keyList));
                valueCollection = new CollectionAndSequence(new SimpleSequence(valueList));
            }
        }
View Full Code Here

Examples of freemarker.template.SimpleSequence

        }

        public TemplateCollectionModel keys() {
            if (keyCollection == null) {
                // This can only happen when IcI >= 2.3.21, an the map is a LinkedHashMap.
                keyCollection = new CollectionAndSequence(new SimpleSequence(map.keySet()));
            }
            return keyCollection;
        }
View Full Code Here

Examples of freemarker.template.SimpleSequence

        }

        public TemplateCollectionModel values() {
            if (valueCollection == null) {
                // This can only happen when IcI >= 2.3.21, an the map is a LinkedHashMap.
                valueCollection = new CollectionAndSequence(new SimpleSequence(map.values()));
            }
            return valueCollection;
        }
View Full Code Here

Examples of freemarker.template.SimpleSequence

        }
    }

    static class word_listBI extends BuiltInForString {
        TemplateModel calculateResult(String s, Environment env) {
            SimpleSequence result = new SimpleSequence();
            StringTokenizer st = new StringTokenizer(s);
            while (st.hasMoreTokens()) {
               result.add(st.nextToken());
            }
            return result;
        }
View Full Code Here

Examples of freemarker.template.SimpleSequence

        private void initKeys()
        throws TemplateModelException
        {
            if (keys == null) {
                HashSet keySet = new HashSet();
                SimpleSequence keySeq = new SimpleSequence(32);
                addKeys(keySet, keySeq, (TemplateHashModelEx)this.left);
                addKeys(keySet, keySeq, (TemplateHashModelEx)this.right);
                size = keySet.size();
                keys = new CollectionAndSequence(keySeq);
            }
View Full Code Here

Examples of freemarker.template.SimpleSequence

        private void initValues()
        throws TemplateModelException
        {
            if (values == null) {
                SimpleSequence seq = new SimpleSequence(size());
                // Note: size() invokes initKeys() if needed.
           
                int ln = keys.size();
                for (int i  = 0; i < ln; i++) {
                    seq.add(get(((TemplateScalarModel)keys.get(i)).getAsString()));
                }
                values = new CollectionAndSequence(seq);
            }
        }
View Full Code Here

Examples of freemarker.template.SimpleSequence

        else if (namespaces instanceof ListLiteral) {
            nss = ((ListLiteral) namespaces).evaluateStringsToNamespaces(env);
        }
        if (nss != null) {
            if (nss instanceof TemplateHashModel) {
                SimpleSequence ss = new SimpleSequence(1);
                ss.add(nss);
                nss = ss;
            }
            else if (!(nss instanceof TemplateSequenceModel)) {
                if (namespaces != null) {
                    throw new NonSequenceException(namespaces, nss, env);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.