samples/growingparameters/src-impl/impl/Impl.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:53:37 +0200
changeset 77 22c1953e372c
child 78 af48bccb02cb
permissions -rw-r--r--
Compute with added method converted to separate project
jtulach@77
     1
package impl;
jtulach@77
     2
jtulach@77
     3
import api.classes.Compute;
jtulach@77
     4
import api.classes.Support;
jtulach@77
     5
import java.util.Collections;
jtulach@77
     6
import java.util.List;
jtulach@77
     7
import java.util.Map;
jtulach@77
     8
jtulach@77
     9
public class Impl {
jtulach@77
    10
    public static void main(String[] args) {
jtulach@77
    11
        class ProviderWrittenAgainstVersion1 extends Compute {
jtulach@77
    12
            @Override
jtulach@77
    13
            public List<String> getData() {
jtulach@77
    14
                return Collections.singletonList("Hello");
jtulach@77
    15
            }
jtulach@77
    16
        }
jtulach@77
    17
        int index1 = Support.searchByDescription("Hello", new ProviderWrittenAgainstVersion1());
jtulach@77
    18
        assert index1 == 0;
jtulach@77
    19
        int index2 = Support.searchByDescription("Unknown", new ProviderWrittenAgainstVersion1());
jtulach@77
    20
        assert index2 == -1;
jtulach@77
    21
jtulach@77
    22
        
jtulach@77
    23
        class ProviderWrittenAgainstVersion2 extends Compute {
jtulach@77
    24
            @Override
jtulach@77
    25
            public List<String> getData() {
jtulach@77
    26
                return Collections.singletonList("Hello");
jtulach@77
    27
            }
jtulach@77
    28
jtulach@77
    29
            @Override
jtulach@77
    30
            public Map<String, String> getDataAndDescription() {
jtulach@77
    31
                return Collections.singletonMap("Hello", "Says hello");
jtulach@77
    32
            }
jtulach@77
    33
        }
jtulach@77
    34
jtulach@77
    35
        int index3 = Support.searchByDescription("Says hello", new ProviderWrittenAgainstVersion2());
jtulach@77
    36
        assert index3 == 0;
jtulach@77
    37
    }
jtulach@77
    38
}