tensorics / tensorics-core

The core library of Tensorics - a Java Library for Manipulating Multi-Dimensional Data with Pleasure
http://tensorics.org
Apache License 2.0
10 stars 2 forks source link

explicitely express multidimensionality and finite dimensionality #35

Open kaifox opened 6 years ago

kaifox commented 6 years ago

This comes from a comment from michi on the resampling pull request: " I don't think it's clear from the code that a Tensoric is supposed to be bound to a certain dimension set, as the dimension set is by no way obtainable from the interface ..."

https://github.com/tensorics/tensorics-core/pull/33

I fully agree with Michis comment on the tensoric. I thought in similar ways, but left out this, as it was not immediately necessary ... and was not exactly shure how to implement it. I see the following options:

a) Extract an interface from shape, which would contain the following methods:

The name of the interface could be e.g. Dimensional (NOTE: If the contains(..) method belongs here is not fully clear ... probably better a dedicated interface.... Shape and Tensoric would then implement this... (and thus also the tensor, which might be convenient in any case and simply delegate to shape())

b) Optionally, we could have a similar interface/object e.g. called Dimensionality which could be returned from Tensoric by a dimensionality() method....

c) We could strip down the Shape interface (which anyhow should be created) to those methods and e.g. rename the actual Shape (with the positions() method) to something like a FiniteShape.... Tensoric would then have a method:

Shape shape();

and Tensor could then override this by:

FiniteShape shape();

I think I like c) for the moment ... probably with a combination of a) so that we have the convenience methods in Tensor + Tensoric.

... still undesided ... input welcome ;-)