| Код | interface IConnectionSchema { }
interface IConnection { }
interface ILayerSchema { List<? extends IConnectionSchema> getInArrows(); }
interface ILayer { List<? extends IConnection> getInputConnections(); }
interface ILayerModel extends ILayer, ILayerSchema { }
interface IConnectionModel extends IConnection, IConnectionSchema { }
class LayerModel implements ILayerModel { private List<IConnectionModel> myOutputConnections; private List<IConnectionModel> myInputConnections;
LayerModel() { myOutputConnections = new LinkedList<IConnectionModel>(); myInputConnections = new LinkedList<IConnectionModel>(); }
public List<? extends IConnectionSchema> getInArrows() { return Collections.unmodifiableList(myInputConnections); }
public List<? extends IConnection> getInputConnections() { return Collections.unmodifiableList(myInputConnections); } } |
Добавлено через 28 секунд Или:
| Код | interface IConnectionSchema { }
interface IConnection { }
interface ILayerSchema<T extends IConnectionSchema> { List<T> getInArrows(); }
interface ILayer<T extends IConnection> { List<T> getInputConnections(); }
interface ILayerModel<T1 extends IConnection, T2 extends IConnectionSchema> extends ILayer<T1>, ILayerSchema<T2> { }
interface IConnectionModel extends IConnection, IConnectionSchema { }
class LayerModel implements ILayerModel<IConnectionModel, IConnectionModel> { private List<IConnectionModel> myOutputConnections; private List<IConnectionModel> myInputConnections;
LayerModel() { myOutputConnections = new LinkedList<IConnectionModel>(); myInputConnections = new LinkedList<IConnectionModel>(); }
public List<IConnectionModel> getInArrows() { return Collections.unmodifiableList(myInputConnections); }
public List<IConnectionModel> getInputConnections() { return Collections.unmodifiableList(myInputConnections); } } |
|