#107 Composite example JavaDoc
This commit is contained in:
parent
98abe5b5b6
commit
a7d25e0485
@ -3,12 +3,16 @@ package com.iluwatar.composite;
|
||||
/**
|
||||
*
|
||||
* With Composite we can treat tree hierarchies of objects with uniform
|
||||
* interface (LetterComposite). In this example we have sentences composed of
|
||||
* interface ({@link LetterComposite}). In this example we have sentences composed of
|
||||
* words composed of letters.
|
||||
*
|
||||
*/
|
||||
public class App {
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
* @param args command line args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Message from the orcs: ");
|
||||
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar.composite;
|
||||
|
||||
/**
|
||||
*
|
||||
* Letter
|
||||
*
|
||||
*/
|
||||
public class Letter extends LetterComposite {
|
||||
|
||||
private char c;
|
||||
|
@ -4,6 +4,11 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Messenger
|
||||
*
|
||||
*/
|
||||
public class Messenger {
|
||||
|
||||
LetterComposite messageFromOrcs() {
|
||||
|
@ -2,6 +2,11 @@ package com.iluwatar.composite;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Sentence
|
||||
*
|
||||
*/
|
||||
public class Sentence extends LetterComposite {
|
||||
|
||||
public Sentence(List<Word> words) {
|
||||
|
@ -2,6 +2,11 @@ package com.iluwatar.composite;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Word
|
||||
*
|
||||
*/
|
||||
public class Word extends LetterComposite {
|
||||
|
||||
public Word(List<Letter> letters) {
|
||||
|
@ -4,6 +4,11 @@ import org.junit.Test;
|
||||
|
||||
import com.iluwatar.composite.App;
|
||||
|
||||
/**
|
||||
*
|
||||
* Application test
|
||||
*
|
||||
*/
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user