KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > taglib > core > LoopTagStatus


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.cocoon.taglib.core;
18
19 /**
20  * <p>Provides an interface for objects representing the current status of
21  * an iteration. Cocoon taglibrary provides a mechanism for LoopTags to
22  * return information about the current index of the iteration and
23  * convenience methods to determine whether or not the current round is
24  * either the first or last in the iteration. It also lets authors
25  * use the status object to obtain information about the iteration range,
26  * step, and current object.</p>
27  *
28  * <p>Environments that require more status can extend this interface.</p>
29  *
30  * This Interface is a copy from JSTL1.0
31  * @see javax.servlet.jsp.jstl.core.LoopTagStatus
32  *
33  * @author <a HREF="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
34  * @version CVS $Id: LoopTagStatus.java 30932 2004-07-29 17:35:38Z vgritsenko $
35  */

36 public interface LoopTagStatus {
37
38     /**
39      * Retrieves the current item in the iteration. Behaves
40      * idempotently; calling getCurrent() repeatedly should return the same
41      * Object until the iteration is advanced. (Specifically, calling
42      * getCurrent() does <b>not</b> advance the iteration.)
43      *
44      * @return the current item as an object
45      */

46     public Object JavaDoc getCurrent();
47
48     /**
49      * Retrieves the index of the current round of the iteration. If
50      * iteration is being performed over a subset of an underlying
51      * array, java.lang.Collection, or other type, the index returned
52      * is absolute with respect to the underlying collection. Indices
53      * are 0-based.
54      *
55      * @return the 0-based index of the current round of the iteration
56      */

57     public int getIndex();
58
59     /**
60      * <p>Retrieves the "count" of the current round of the iteration. The
61      * count is a relative, 1-based sequence number identifying the
62      * current "round" of iteration (in context with all rounds the
63      * current iteration will perform).</p>
64      *
65      * <p>As an example, an iteration with begin = 5, end = 15, and step =
66      * 5 produces the counts 1, 2, and 3 in that order.</p>
67      *
68      * @return the 1-based count of the current round of the iteration
69      */

70     public int getCount();
71
72     /**
73      * Returns information about whether the current round of the
74      * iteration is the first one. This current round may be the 'first'
75      * even when getIndex() != 0, for 'index' refers to the absolute
76      * index of the current 'item' in the context of its underlying
77      * collection. It is always that case that a true result from
78      * isFirst() implies getCount() == 1.
79      *
80      * @return <tt>true</tt> if the current round is the first in the
81      * iteration, <tt>false</tt> otherwise.
82      */

83     public boolean isFirst();
84
85     /**
86      * Returns information about whether the current round of the
87      * iteration is the last one. As with isFirst(), subsetting is
88      * taken into account. isLast() doesn't necessarily refer to the
89      * status of the underlying Iterator; it refers to whether or not
90      * the current round will be the final round of iteration for the
91      * tag associated with this LoopTagStatus.
92      *
93      * @return <tt>true</tt> if the current round is the last in the
94      * iteration, <tt>false</tt> otherwise.
95      */

96     public boolean isLast();
97
98     /**
99      * Returns the value of the 'begin' attribute for the associated tag,
100      * or null if no 'begin' attribute was specified.
101      *
102      * @return the 'begin' value for the associated tag, or null
103      * if no 'begin' attribute was specified
104      */

105     public Integer JavaDoc getBegin();
106
107     /**
108      * Returns the value of the 'end' attribute for the associated tag,
109      * or null if no 'end' attribute was specified.
110      *
111      * @return the 'end' value for the associated tag, or null
112      * if no 'end' attribute was specified
113      */

114     public Integer JavaDoc getEnd();
115
116     /**
117      * Returns the value of the 'step' attribute for the associated tag,
118      * or null if no 'step' attribute was specified.
119      *
120      * @return the 'step' value for the associated tag, or null
121      * if no 'step' attribute was specified
122      */

123     public Integer JavaDoc getStep();
124
125 }
126
Popular Tags