package com.iluwatar.observer;

import com.iluwatar.observer.generic.GHobbits;
import com.iluwatar.observer.generic.GOrcs;
import com.iluwatar.observer.generic.GWeather;

/**
 * 
 * Observer pattern defines one-to-many relationship between objects. The target
 * object sends change notifications to its registered observers.
 * 
 */
public class App {

	/**
	 * Program entry point
	 * @param args command line args
	 */
	public static void main(String[] args) {

		Weather weather = new Weather();
		weather.addObserver(new Orcs());
		weather.addObserver(new Hobbits());

		weather.timePasses();
		weather.timePasses();
		weather.timePasses();
		weather.timePasses();

		// Generic observer inspired by Java Generics and Collection by Naftalin & Wadler
		System.out.println("\n--Running generic version--");
		GWeather gWeather = new GWeather();
		gWeather.addObserver(new GOrcs());
		gWeather.addObserver(new GHobbits());

		gWeather.timePasses();
		gWeather.timePasses();
		gWeather.timePasses();
		gWeather.timePasses();
	}
}

@@ -174,16 +174,20 @@
 *%0A * %0A *
+ The
  Observe
@@ -200,112 +200,657 @@
 ern 
-defines one-
+is a software design pattern in which an object, called %0A * the subject, maintains a list of its dependents, called observers, and notifies %0A * them au
 to
--
 ma
-ny relationship between objects. The target%0A * object sends change notifications to 
+tically of any state changes, usually by calling one of their methods. %0A * It is mainly used to implement distributed event handling systems. The Observer %0A * pattern is also a key part in the familiar model%E2%80%93view%E2%80%93controller (MVC) architectural %0A * pattern. The Observer pattern is implemented in numerous programming libraries and %0A * systems, including almost all GUI toolkits.%0A * %3Cp%3E%0A * In this example %7B@link Weather%7D has a state that can be observed. The %7B@link Orcs%7D%0A * and %7B@link Hobb
 its
+%7D
  reg
@@ -854,18 +854,19 @@
 register
-ed
+ as
  observe
@@ -867,16 +867,78 @@
 bservers
+ and receive notifications when the%0A * %7B@link Weather%7D changes
 .%0A * %0A *

Improve Observer Javadoc