I want to design a class "Signal", which holds the attributes "TimeDomain and FreqDomain" (2 other objects)
- A Signal should be instantiated using either the TimeDomain, or the FreqDomain. But NOT BOTH, because one depends on the other (e.g. FreqDomain is calculated from TimeDomain using the FFT algorithm)
- Additionally, the TimeDomain or FreqDomain should not be able to be created without belonging to a Signal.
- Whenever the TimeDomain is changed, the FreqDomain should be changed accordingly (e.g. given a TimeDomain, I need to access its outer object (Signal) then access FreqDomain from that)
Attachments 1-2 show my attempt to implement this.
However, in the multiply method (line33): "Signal.this cannot be used from a static context" and I'm not sure how to access Signal from the TimeDomain passed in as a parameter
What should I do?