All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.meliorbis.economics.infrastructure.notifications.Notifier Maven / Gradle / Ivy

Go to download

A library for solving economic models, particularly macroeconomic models with heterogeneous agents who have model-consistent expectations

There is a newer version: 1.1
Show newest version
package com.meliorbis.economics.infrastructure.notifications;

import java.util.ArrayList;
import java.util.List;

import com.meliorbis.economics.model.State;
import com.meliorbis.numerics.generic.primitives.DoubleArray;

/**
 * Aggregates a bunch of change listeners and notifies them when notified
 * 
 * @author Tobias Grasl
 * 
 * @param  The type of State to be observed
 */
public class Notifier> implements ArrayObserver
{
	List> _listeners = new ArrayList>();
	
	@Override
	public void changed(DoubleArray oldArray_, DoubleArray newArray_, S state_)
	{
		for (ArrayObserver listener : _listeners)
		{
			listener.changed(oldArray_, newArray_, state_);
		}
	}
	
	public void registerListener(ArrayObserver listener_)
	{
		_listeners.add(listener_);
	}
}