001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.commons.math4.legacy.linear; 018 019import java.util.EventObject; 020 021/** 022 * The root class from which all events occurring while running an 023 * {@link IterationManager} should be derived. 024 * 025 */ 026public class IterationEvent extends EventObject { 027 /** */ 028 private static final long serialVersionUID = 20120128L; 029 030 /** The number of iterations performed so far. */ 031 private final int iterations; 032 033 /** 034 * Creates a new instance of this class. 035 * 036 * @param source the iterative algorithm on which the event initially 037 * occurred 038 * @param iterations the number of iterations performed at the time 039 * {@code this} event is created 040 */ 041 public IterationEvent(final Object source, final int iterations) { 042 super(source); 043 this.iterations = iterations; 044 } 045 046 /** 047 * Returns the number of iterations performed at the time {@code this} event 048 * is created. 049 * 050 * @return the number of iterations performed 051 */ 052 public int getIterations() { 053 return iterations; 054 } 055 }