dakotahNorth / CoralME

A simple, fast and garbage-free matching engine order book that you can use as a starting point for your matching engines.
Apache License 2.0
0 stars 3 forks source link

Refactor Enums in Order.java to Separate Files and Update References #8

Open dakotahNorth opened 6 days ago

dakotahNorth commented 6 days ago

Refactoring enums in Order.java to separate files involves moving each enum type (like TimeInForce, RejectReason, etc.) into its own Java file. This change is meant to:

  1. Improve Code Organization: By having each enum in its own file, the codebase becomes more organized, making it easier to locate and understand each enum.
  2. Enhance Maintainability: With enums in separate files, it becomes simpler to manage and update them individually without affecting other parts of the code.
  3. Simplify Imports: Instead of dealing with a large Order.java file, you can import only the specific enums you need, which can make the code cleaner.

Steps to Implement:

  1. Create New Files: For each enum in Order.java, create a new file in the same package (com.coralblocks.coralme).
  2. Move Enum Code: Copy the enum definition from Order.java to the respective new file.
  3. Update References: Go through the entire codebase and update the import statements to point to the new locations of these enums.
  4. Test: Ensure the project compiles correctly and all tests pass, verifying that the changes did not introduce any errors.

Example:

If TimeInForce is an enum in Order.java, you'll move it to a new file named TimeInForce.java:

Original in Order.java:

public static enum TimeInForce {
    GTC('T', "1"), 
    IOC('I', "3"),
    DAY('D', "0");
    // Rest of the code
}

New File: TimeInForce.java:

package com.coralblocks.coralme;

public enum TimeInForce {
    GTC('T', "1"), 
    IOC('I', "3"),
    DAY('D', "0");
    // Rest of the code
}

Here are the enums defined within Order.java that need to be moved to separate files:

  1. TimeInForce
  2. RejectReason
  3. CancelRejectReason
  4. CancelReason
  5. ReduceRejectReason
  6. Type
  7. ExecuteSide
  8. Side

Each of these enums should be placed in its own Java file within the same package (com.coralblocks.coralme).

Benefits:

This approach results in a more modular and maintainable codebase, which is particularly beneficial as the project grows.


Refactor Enums in Order.java to Separate Files

Description:

Improve code organization and maintainability by moving each enum from Order.java into its own file within the com.coralblocks.coralme package. This change will reduce the size of Order.java and make it easier to manage individual enums.

Tasks:

Test:

Additional Tasks:

sweep-ai[bot] commented 5 days ago

❌ Error

Traceback (most recent call last):
  File "/app/sweepai/handlers/on_ticket.py", line 167, in on_ticket
    await fix_ci_failures(pull_request, tracking_id)
  File "/app/sweepai/handlers/fix_ci.py", line 242, in fix_ci_failures
    cleaned_logs = clean_ci_logs(username=username, error_logs=logs_list[0])
  File "/app/sweepai/modify/gha/cleanup_ci.py", line 58, in clean_ci_logs
    raise ValueError("No CI/CD logs found")
ValueError: No CI/CD logs found

No CI/CD logs found

Sweep has encountered a runtime error unrelated to your request. Please let us know via this link or at support@sweep.dev directly.

:book: For more information on how to use Sweep, please read our documentation.

Tracking ID: cf1820c41d