<commit_before>/*
 * 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 org.apache.wicket.markup.html.list;

import java.util.Iterator;

import org.apache.wicket.Component;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.repeater.AbstractRepeater;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.util.collections.ReadOnlyIterator;

/**
 * A very simple loop component whose model is an Integer defining the number of iterations the loop
 * should render. During rendering, Loop iterates from 0 to getIterations() - 1, creating a new
 * MarkupContainer for each iteration. The MarkupContainer is populated by the Loop subclass by
 * implementing the abstract method populate(LoopItem). The populate() method is called just before
 * the LoopItem container is rendered.
 * 
 * @author <NAME>
 * @author <NAME>
 * @author <NAME>
 * 
 */
public abstract class Loop extends AbstractRepeater<Integer>
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * Item container for a Loop iteration.
	 * 
	 * @author <NAME>
	 */
	// FIXME 1.5: store iteration in the model instead of taking up a slot in a field
	public static class LoopItem extends WebMarkupContainer
	{
		private static final long serialVersionUID = 1L;

		/** The iteration number */
		private final int iteration;

		/**
		 * Constructor
		 * 
		 * @param iteration
		 *            The iteration of the loop
		 */
		public LoopItem(final int iteration)
		{
			super(Integer.toString(iteration));
			this.iteration = iteration;
		}

		/**
		 * @return Returns the iteration.
		 */
		public final int getIteration()
		{
			return iteration;
		}
	}

	/**
	 * Construct.
	 * 
	 * @param id
	 *            See Component
	 * @param iterations
	 *            max index of the loop
	 * @see org.apache.wicket.Component#Component(String, IModel)
	 */
	public Loop(final String id, final int iterations)<commit_msg>generics void type for loop item<commit_after>/*
 * 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 org.apache.wicket.markup.html.list;

import java.util.Iterator;

import org.apache.wicket.Component;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.repeater.AbstractRepeater;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.util.collections.ReadOnlyIterator;

/**
 * A very simple loop component whose model is an Integer defining the number of iterations the loop
 * should render. During rendering, Loop iterates from 0 to getIterations() - 1, creating a new
 * MarkupContainer for each iteration. The MarkupContainer is populated by the Loop subclass by
 * implementing the abstract method populate(LoopItem). The populate() method is called just before
 * the LoopItem container is rendered.
 * 
 * @author <NAME>
 * @author <NAME>
 * @author <NAME>
 * 
 */
public abstract class Loop extends AbstractRepeater<Integer>
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * Item container for a Loop iteration.
	 * 
	 * @author <NAME>
	 */
	public static class LoopItem extends WebMarkupContainer<Void>
	{
		private static final long serialVersionUID = 1L;

		/** The iteration number */
		private final int iteration;

		/**
		 * Constructor
		 * 
		 * @param iteration
		 *            The iteration of the loop
		 */
		public LoopItem(final int iteration)
		{
			super(Integer.toString(iteration).intern());
			this.iteration = iteration;
		}

		/**
		 * @return Returns the iteration.
		 */
		public final int getIteration()
		{
			return iteration;
		}
	}

	/**
	 * Construct.
	 * 
	 * @param id
	 *            See Component
	 * @param iterations
	 *            max index of the loop
	 * @see org.apache.wicket.Component#Component(String, IModel)
	 */
	public Loop(final String id, final int iterations)
{'fraction_non_alphanumeric': 0.08359475918066064, 'fraction_numerical': 0.0033216460601587007, 'mean_word_length': 3.479338842975207, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4230163', 'n_tokens_mistral': 1573, 'n_tokens_neox': 1424, 'n_words': 584}