Skip to content
This repository was archived by the owner on Jan 27, 2025. It is now read-only.
This repository was archived by the owner on Jan 27, 2025. It is now read-only.

Refactor Duplicate RGB Parsing Code in CursorLoader.java to Improve Maintainability #95

@gmsv07

Description

@gmsv07

Describe the clone
The clone refers to a repetitive code pattern found in the CursorLoader.java file. The duplicated code is responsible for parsing and converting color values from an ICO image file into RGB format, specifically handling the color values from the image data based on the index values.

Location of the clones
Starting at line 401 of : jmonkeyengineFall2024\jme3-desktop\src\main\java\com\jme3\cursors\plugins\CursorLoader.java
Starting at line 478 of : jmonkeyengineFall2024\jme3-desktop\src\main\java\com\jme3\cursors\plugins\CursorLoader.java

Clone Type
This is a Type #1 clone (i.e., exact duplication of the same lines of code in multiple places without significant structural differences).

Expected outcome
The expected outcome is to refactor the repeated block into a single method to remove duplication and make the code more maintainable and modular. The method should accept parameters (e.g., the colorTableOffset, index, and icoImage) to handle the RGB conversion dynamically.

Code before refactoring
Screenshot (160)

Code after refactoring
Screenshot (162)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions