#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
|
* 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.
|
* words composed of letters.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class App {
|
public class App {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Program entry point
|
||||||
|
* @param args command line args
|
||||||
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("Message from the orcs: ");
|
System.out.println("Message from the orcs: ");
|
||||||
|
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar.composite;
|
package com.iluwatar.composite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Letter
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class Letter extends LetterComposite {
|
public class Letter extends LetterComposite {
|
||||||
|
|
||||||
private char c;
|
private char c;
|
||||||
|
@ -4,6 +4,11 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Messenger
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class Messenger {
|
public class Messenger {
|
||||||
|
|
||||||
LetterComposite messageFromOrcs() {
|
LetterComposite messageFromOrcs() {
|
||||||
|
@ -2,6 +2,11 @@ package com.iluwatar.composite;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Sentence
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class Sentence extends LetterComposite {
|
public class Sentence extends LetterComposite {
|
||||||
|
|
||||||
public Sentence(List<Word> words) {
|
public Sentence(List<Word> words) {
|
||||||
|
@ -2,6 +2,11 @@ package com.iluwatar.composite;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Word
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class Word extends LetterComposite {
|
public class Word extends LetterComposite {
|
||||||
|
|
||||||
public Word(List<Letter> letters) {
|
public Word(List<Letter> letters) {
|
||||||
|
@ -4,6 +4,11 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import com.iluwatar.composite.App;
|
import com.iluwatar.composite.App;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Application test
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class AppTest {
|
public class AppTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user