Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring of the initialization code of the 'particleMesh' variable. #1769

Merged
merged 1 commit into from Feb 12, 2022
Merged

Refactoring of the initialization code of the 'particleMesh' variable. #1769

merged 1 commit into from Feb 12, 2022

Conversation

capdevon
Copy link
Contributor

@capdevon capdevon commented Feb 10, 2022

switch (meshType) {
    case Point:
        particleMesh = new ParticlePointMesh();
        this.setMesh(particleMesh);
        break;
    case Triangle:
        particleMesh = new ParticleTriMesh();
        this.setMesh(particleMesh);
        break;
    default:
        throw new IllegalStateException("Unrecognized particle type: " + meshType);
}

This piece of code is repeated 3 times in ParticleEmitter class, violating the DRY programming rule. So I encapsulated it in a separate method.

Fixed typo compatability -> compatibility

This piece of code is repeated 3 times in this class, violating the DRY
programming rule.

Fixed typo compatability -> compatibility
@stephengold stephengold added this to the Future Release milestone Feb 12, 2022
Copy link
Member

@stephengold stephengold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This refactoring seems worthwhile.

@stephengold stephengold merged commit e7086c2 into jMonkeyEngine:master Feb 12, 2022
@stephengold
Copy link
Member

Thanks for your contribution to our project, @capdevon!

@Ali-RS Ali-RS modified the milestones: Future Release, v3.6.0 Dec 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants