You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2019/02/23 16:31:19 UTC
[freemarker] 01/03: (SequenceIterator to be internally usable on
its own)
This is an automated email from the ASF dual-hosted git repository.
ddekany pushed a commit to branch 2.3-gae
in repository https://gitbox.apache.org/repos/asf/freemarker.git
commit 7eeeea1e95b467b74d93e5b4651b19ecc33ea2ab
Author: ddekany <dd...@apache.org>
AuthorDate: Sat Feb 16 21:06:27 2019 +0100
(SequenceIterator to be internally usable on its own)
---
.../freemarker/core/CollectionAndSequence.java | 19 ----------
.../java/freemarker/core/SequenceIterator.java | 44 ++++++++++++++++++++++
2 files changed, 44 insertions(+), 19 deletions(-)
diff --git a/src/main/java/freemarker/core/CollectionAndSequence.java b/src/main/java/freemarker/core/CollectionAndSequence.java
index 33556ff..affb7fe 100644
--- a/src/main/java/freemarker/core/CollectionAndSequence.java
+++ b/src/main/java/freemarker/core/CollectionAndSequence.java
@@ -85,23 +85,4 @@ implements TemplateCollectionModel, TemplateSequenceModel, Serializable {
}
}
- private static class SequenceIterator
- implements TemplateModelIterator {
- private final TemplateSequenceModel sequence;
- private final int size;
- private int index = 0;
-
- SequenceIterator(TemplateSequenceModel sequence) throws TemplateModelException {
- this.sequence = sequence;
- this.size = sequence.size();
-
- }
- public TemplateModel next() throws TemplateModelException {
- return sequence.get(index++);
- }
-
- public boolean hasNext() {
- return index < size;
- }
- }
}
diff --git a/src/main/java/freemarker/core/SequenceIterator.java b/src/main/java/freemarker/core/SequenceIterator.java
new file mode 100644
index 0000000..3c8e84a
--- /dev/null
+++ b/src/main/java/freemarker/core/SequenceIterator.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package freemarker.core;
+
+import freemarker.template.TemplateModel;
+import freemarker.template.TemplateModelException;
+import freemarker.template.TemplateModelIterator;
+import freemarker.template.TemplateSequenceModel;
+
+class SequenceIterator implements TemplateModelIterator {
+ private final TemplateSequenceModel sequence;
+ private final int size;
+ private int index = 0;
+
+ SequenceIterator(TemplateSequenceModel sequence) throws TemplateModelException {
+ this.sequence = sequence;
+ this.size = sequence.size();
+
+ }
+ public TemplateModel next() throws TemplateModelException {
+ return sequence.get(index++);
+ }
+
+ public boolean hasNext() {
+ return index < size;
+ }
+}