Changes between Version 32 and Version 33 of Java API

Show
Ignore:
Timestamp:
06/09/15 11:18:18 (9 years ago)
Author:
jorisborgdorff
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Java API

    v32 v33  
    264264A terminal, either a source or a sink, may generate or store values from a conduit. It can be used to perform I/O in a way that is transparent in MUSCLE, so instead of writing to a file, messages can be sent over a conduit and processed by a terminal. It can also be used to test submodels, by studying it in isolation and exactly controlling what messages will be sent or received over the different conduits. 
    265265 
    266 The Source class uses Java Generics to specify what data type {{{T}}} will be generated. To extend a Source, it is necessary to implement the {{{Observation<T> take()}}} and {{{isEmpty()}}} methods. In {{{take}}} a message is generated, while isEmpty defines whether the Source will have another message. An example implementation, which would generate five random double arrays, is the following: 
     266The Source class uses Java Generics to specify what data type {{{T}}} will be generated. To extend a Source, it is necessary to implement the {{{Observation<T> generate()}}} and {{{isEmpty()}}} methods. In {{{take}}} a message is generated, while isEmpty defines whether the Source will have another message. An example implementation, which would generate five random double arrays, is the following: 
    267267{{{ 
    268268public class RandomDoubleSource extends Source<double[]> { 
    269269    int iteration = 0; 
    270270    @Override 
    271     public Observation<double[]> take() { 
     271    public Observation<double[]> generate() { 
    272272        iteration++; 
    273273        double[] data = new double[10];