Merge branch 'javadoc'

This commit is contained in:
Ilkka Seppala
2015-08-21 23:29:48 +03:00
252 changed files with 3737 additions and 2819 deletions

View File

@ -1,27 +1,31 @@
package com.iluwatar.visitor;
/**
*
* Visitor pattern defines mechanism to apply operations on nodes
* in hierarchy. New operations can be added without altering the node
* interface.
*
* In this example there is a unit hierarchy beginning from Commander.
* This hierarchy is traversed by visitors. SoldierVisitor applies
* its operation on Soldiers, SergeantVisitor on Sergeants and so
* on.
*
*/
public class App {
public static void main(String[] args) {
Commander commander = new Commander(new Sergeant(new Soldier(),
new Soldier(), new Soldier()), new Sergeant(new Soldier(),
new Soldier(), new Soldier()));
commander.accept(new SoldierVisitor());
commander.accept(new SergeantVisitor());
commander.accept(new CommanderVisitor());
}
}
package com.iluwatar.visitor;
/**
*
* Visitor pattern defines mechanism to apply operations on nodes
* in hierarchy. New operations can be added without altering the node
* interface.
* <p>
* In this example there is a unit hierarchy beginning from {@link Commander}.
* This hierarchy is traversed by visitors. {@link SoldierVisitor} applies
* its operation on {@link Soldier}s, {@link SergeantVisitor} on {@link Sergeant}s and so
* on.
*
*/
public class App {
/**
* Program entry point
* @param args command line args
*/
public static void main(String[] args) {
Commander commander = new Commander(new Sergeant(new Soldier(),
new Soldier(), new Soldier()), new Sergeant(new Soldier(),
new Soldier(), new Soldier()));
commander.accept(new SoldierVisitor());
commander.accept(new SergeantVisitor());
commander.accept(new CommanderVisitor());
}
}

View File

@ -1,14 +1,19 @@
package com.iluwatar.visitor;
import org.junit.Test;
import com.iluwatar.visitor.App;
public class AppTest {
@Test
public void test() {
String[] args = {};
App.main(args);
}
}
package com.iluwatar.visitor;
import org.junit.Test;
import com.iluwatar.visitor.App;
/**
*
* Application test
*
*/
public class AppTest {
@Test
public void test() {
String[] args = {};
App.main(args);
}
}