Comments (15)
Look at the constructors for these classes:
public Polyspiral(final VisualizerDrawer visualizerDrawer) {
this.visualizerDrawer = visualizerDrawer;
}
public Oscilloscope(VisualizerDrawer visualizerDrawer) {
this.visualizerDrawer = visualizerDrawer;
}
and the beginning of VisaulizerDrawer:
public class VisualizerDrawer extends VisualizerModel {
private final Oscilloscope oscilloscope = new Oscilloscope(this);
private Polyspiral polySpiral = new Polyspiral(this);
protected final Sierpinski sierpinski = new Sierpinski(this);
private final JuliaSet juliaSet = new JuliaSet(this);
private Sprites3D sprite3D = new Sprites3D(this, Shape3D.SPHERE);
When you create Oscilloscope or PolySpiral, you need to provide a VisualizerDrawer as argument.
When you create a VisualizerDrawer, both Oscilloscope and PolySpiral will be created.
from xr3player.
Again I have to correct myself. The refactoring did help. That is because the creation of Oscilloscope and siblings are done at creation of Visualizer, but Oscilloscope only needs a reference to an VisualizerDrawer. So in a unit test, I can create a VisualizerDrawer, and pass it to a new Oscilloscope. No Visualizer will be created, and therefore no siblings of Oscilloscope. Right now the creation takes place in the constructor of PaintService, but that doesn't feel like a natural place. Better to have it in Visualizer. In practice, there is not much difference.
from xr3player.
I have made a branch where Oscilloscope and its siblings can now be instantiated independently of each other. They are no longer owned by VisusalizerDrawer, but by a new class GadgetOwner.
This might be a step towards a better structure, but there are still issues. The instances are now created upon initialization of PaintService. (The GadgetOwner object is created there and then, with its owned objects). It would be better to inject the GadgetOwner into the PaintService object.
GadgetOwner is not a good name, but it will do for now.
Of the five objects owned by GadgetOwner, I have tested four. I didn't manage to visualize using the JuliaSet from the GUI, but I think it would work.
Take a look at https://github.com/HelgeStenstrom/XR3Player/tree/refactorOscilloscope
I can make a pull request from it, if you want, but it's not ready for merging.
from xr3player.
Ouh i have to see the code to answer you, actually i think you can create a Polyspiral without creating an Oscilloscope, can you send me the code that is proving the opposite :)?
from xr3player.
Aouuuu now i catch you, i was Junior developer and didn't knew well refactoring concepts back then. I see... your point.
from xr3player.
@HelgeStenstrom Please run the application after refactorings because it ,may break , i am trying to run it after the merge requests and now i am getting full of errors , i will fix but be careful :
from xr3player.
I didn’t run it. Your problem above looks like a compile time problem, and I doubt that it’s caused by my changes. At least not by one particular change, but perhaps if merge conflicts were not properly solved.
from xr3player.
It was due to making to <> on some services. I fixed it It was something new for me :)
from xr3player.
I fooled myself: my refactoring did not remove the cross-dependence between VisualizerDrawer and the "gadgets". I just moved the point where these items are created. I have to think a bit more.
from xr3player.
@HelgeStenstrom Give it a pull request i like your idea, we will make a library from iy and completely remove it from XR3Player so we will use the library :)
from xr3player.
I will will finish it for you, let me see how it looks like :)
from xr3player.
I want to make XR3Player professional product like Traktor and VirtualDJ, it's not long from there and in some places it has more features.
Imagine it having 20. 000 stars one day and you are a contributor :)
from xr3player.
If I understand correctly, once the player is started, we have 5 instances of Oscilloscope, 5 instances of JuliaSet, and so on. How many of these may at most be visible at the same time?
I don’t know the lifetime of these objects. Do they live until the application is closed?
For the object called player0 (if I remember correctly), is there a need to show both Oscilloscope and Sierpinsky or JuliaSet simultaneously? If not, they can be created when they need to be shown, and left to garbage collection when they don’t. On the other hand, I don’t think they take much resources. But I care about understandable code.
from xr3player.
We have 3 XR3PlayerControllers (each one representing a player), each one containing a Visualizer which has 1 instance of all the above mentioned before .
This below is an XR3PlayerController class :
from xr3player.
You can see 3 of them in the application . Inside it contains the visualizer the djdisc etc etc etc all the objects .
from xr3player.
Related Issues (20)
- SonarLint plugin HOT 3
- Visualizers Drawers make application UI Freeze HOT 3
- module java.base does not open java.lang.reflect to module XR3Player HOT 7
- Isn't there a better way to exit the application, than to call System.exit()? HOT 1
- Unwanted dependency on a stream player.
- Broken browser resolution HOT 3
- Move on Java 13 HOT 5
- Add alternative waveform HOT 9
- Tell me about how you use your own separate libraries in this project HOT 3
- How to use advanced UI? HOT 3
- How to set up this software? HOT 17
- Make default player in Windows HOT 2
- Potential security problem(s)
- Packaging Linux HOT 20
- There are many dependencies in the idea software that need to be re-joined HOT 8
- Cannot run HOT 1
- Cannot run HOT 4
- Feature Request HOT 1
- error using "All in XR3Player" run configuration HOT 10
- Would GitHub Actions be of any interest?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xr3player.