[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Dear list members,

This is about the Quickstone version of JCSP, but I guess it also
applies to yours. Is there a reason not to use generics?
I mean, One2OneChannel etc. do not derive from some general Channel
interface, while they all have to have a in() and out() method that
returns a ChannelInput and a ChannelOutput.

public interface Channel<I extends ChannelInput, O extends
ChannelOutput> {
    public I in();
    public O out();
Likewise ChannelOutput only does have one thing to carry, so it's
naturally to give the one extending the class the ability to restrict
the type of object that can be transported in the following way:

public interface ChannelOutput<O> {
  public void write (O object);

This can be used by extensions, although not for basic data types (like
int), e.g. in the following sense:

public interface ChannelOutputInteger extends ChannelOutput<Integer> { 
  public void write (Integer integer);
I hope you see enough reasons in terms of extendibility that you
consider this option.

Kind regards,