{"id":28159978,"url":"https://github.com/codefodvn/course-project-1","last_synced_at":"2026-01-23T05:38:06.474Z","repository":{"id":291538923,"uuid":"977928900","full_name":"codefodvn/course-project-1","owner":"codefodvn","description":"The first group project of CodeFOD's java mentor course","archived":false,"fork":false,"pushed_at":"2025-05-05T07:51:12.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-15T10:12:09.272Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codefodvn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-05T07:44:29.000Z","updated_at":"2025-05-05T07:51:16.000Z","dependencies_parsed_at":"2025-05-05T08:47:58.039Z","dependency_job_id":null,"html_url":"https://github.com/codefodvn/course-project-1","commit_stats":null,"previous_names":["codefodvn/course-project-1"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codefodvn/course-project-1","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefodvn%2Fcourse-project-1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefodvn%2Fcourse-project-1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefodvn%2Fcourse-project-1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefodvn%2Fcourse-project-1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codefodvn","download_url":"https://codeload.github.com/codefodvn/course-project-1/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefodvn%2Fcourse-project-1/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28681023,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T04:33:33.518Z","status":"ssl_error","status_checked_at":"2026-01-23T04:33:30.433Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-15T10:12:08.775Z","updated_at":"2026-01-23T05:38:06.457Z","avatar_url":"https://github.com/codefodvn.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Coure Project 1: Java class diagram generator\n\nThis is a repository for a project about a Java-based tool for scanning vanilla Java code and visualizing class structures through Mermaid diagrams.\n\n## Overview\n\nCerebro is a powerful Java application designed to scan vanilla Java code files, analyze their structure using the JavaCompiler API, and generate visual class diagrams using Mermaid. The tool enables users to select specific files for inclusion through a command-line interface or configuration file.\n\n## Educational Purpose\n\nThis group project is designed to help students gain practical experience with several important Java concepts:\n\n- **File I/O Operations**: Reading and analyzing Java source files\n- **Multithreading**: Implementing parallel file processing for enhanced performance\n- **JVM Understanding**: Working with the Java Virtual Machine's compilation process\n- **JavaCompiler API**: Using the javax.tools.JavaCompiler API to analyze source code and generate abstract syntax trees\n\n## Features\n\n- Scan and analyze vanilla Java code files using the JavaCompiler API\n- Select specific files for diagram generation via CLI or configuration file\n- Generate comprehensive class diagrams using Mermaid syntax that showcase:\n  - Class hierarchies and relationships\n  - Fields and their visibility modifiers\n  - Methods and their signatures\n  - Inheritance and implementation relationships\n  - Association, aggregation, and composition relationships\n\n## Getting Started\n\n### Prerequisites\n\n- Java Development Kit (JDK) 17 or higher\n- Maven or Gradle for dependency management\n- Git for version control\n\n### How to Start\n\n1. **Fork the Repository**\n   - Visit [https://github.com/codefodvn/course-project-1](https://github.com/codefodvn/course-project-1)\n   - Click the \"Fork\" button in the upper right corner to create a copy in your GitHub account\n\n2. **Clone Your Forked Repository**\n   ```bash\n   # Clone your forked repository\n   git clone https://github.com/YOUR-USERNAME/course-project-1.git\n\n   # Navigate to the project directory\n   cd course-project-1\n   ```\n\n3. **Create a Feature Branch**\n   ```bash\n   # Create a new branch for your feature or task\n   git checkout -b feature/your-feature-name\n   ```\n\n4. **Build and Run the Project**\n   ```bash\n   # Build the project\n   mvn clean install\n   \n   # Run using the JAR file\n   java -jar target/cerebro.jar --scan-path=/path/to/java/project\n   ```\n\n5. **Commit and Push Changes**\n   ```bash\n   # Add your changes\n   git add .\n   \n   # Commit with a descriptive message\n   git commit -m \"Add feature: brief description of your changes\"\n   \n   # Push to your forked repository\n   git push origin feature/your-feature-name\n   ```\n\n### Recommended user interface\n\n#### Using the Command Line Interface\n\n```bash\n# Basic usage\njava -jar cerebro.jar --scan-path=/path/to/java/project\n\n# Generate a class diagram with specific files\njava -jar cerebro.jar --scan-path=/path/to/java/project --include=Model.java,Service.java\n\n# Specify output file\njava -jar cerebro.jar --scan-path=/path/to/java/project --output=class-diagram.md\n```\n\n#### Using a Configuration File\n\nCreate a `cerebro-config.json` file:\n\n```json\n{\n  \"scanPath\": \"/path/to/java/project\",\n  \"includeFiles\": [\n    \"Model.java\",\n    \"Service.java\",\n    \"Utils.java\"\n  ],\n  \"outputPath\": \"./diagrams/class-diagram.md\",\n  \"threadCount\": 4,\n  \"showPrivateMembers\": true,\n  \"showFieldTypes\": true,\n  \"includeMethodParameters\": true\n}\n```\n\nThen run:\n\n```bash\njava -jar cerebro.jar --config=cerebro-config.json\n```\n\n## Recommended project structure\n\n```\ncerebro/\n├── src/\n│   ├── main/\n│   │   ├── java/\n│   │   │   └── com/\n│   │   │       └── cerebro/\n│   │   │           ├── Main.java\n│   │   │           ├── scanner/\n│   │   │           │   ├── FileScanner.java\n│   │   │           │   └── JavaParser.java\n│   │   │           ├── model/\n│   │   │           │   ├── JavaClass.java\n│   │   │           │   ├── JavaMethod.java\n│   │   │           │   └── Relationship.java\n│   │   │           ├── diagram/\n│   │   │           │   ├── DiagramGenerator.java\n│   │   │           │   └── ClassDiagramGenerator.java\n│   │   │           └── util/\n│   │   │               ├── ConfigurationManager.java\n│   │   │               ├── CompilerHelper.java\n│   │   │               └── ASTVisitor.java\n│   │   └── resources/\n│   │       └── log4j2.xml\n│   └── test/\n│       └── java/\n│           └── com/\n│               └── cerebro/\n│                   ├── scanner/\n│                   ├── diagram/\n│                   └── util/\n├── pom.xml\n├── README.md\n├── LICENSE\n└── .gitignore\n```\n\n## Core Components\n\n### File Scanner\n\nThe file scanner component recursively traverses the specified directory, identifies Java source files, and prepares them for compilation and analysis. It utilizes multithreading to efficiently process multiple files in parallel.\n\n### JavaCompiler API Integration\n\nLeverages the javax.tools.JavaCompiler API to:\n- Compile Java source files in-memory\n- Generate and access the Abstract Syntax Tree (AST)\n- Extract precise type information and relationships\n- Analyze class structure, field types, and method signatures\n\n### AST Visitor\n\nThe AST visitor navigates the compiler-generated syntax tree to:\n- Identify class declarations and their relationships\n- Extract field declarations with types and modifiers\n- Collect method signatures with parameter and return types\n- Determine inheritance hierarchies and interface implementations\n\n### Diagram Generator\n\nThe diagram generator creates Mermaid syntax representations for class diagrams:\n- Shows classes with proper relationships (inheritance, implementation)\n- Represents fields with visibility modifiers and types\n- Displays methods with parameters and return types\n- Visualizes associations between classes based on field types\n\n## Example Output\n\n### Class Diagram\n\n```mermaid\nclassDiagram\n    class Shape {\n        \u003c\u003cabstract\u003e\u003e\n        -int x\n        -int y\n        +Shape(int, int)\n        +getX() int\n        +getY() int\n        +setPosition(int, int) void\n        +draw() void*\n        +area() double*\n    }\n    \n    class Circle {\n        -double radius\n        +Circle(int, int, double)\n        +getRadius() double\n        +setRadius(double) void\n        +draw() void\n        +area() double\n    }\n    \n    class Rectangle {\n        -double width\n        -double height\n        +Rectangle(int, int, double, double)\n        +getWidth() double\n        +getHeight() double\n        +setDimensions(double, double) void\n        +draw() void\n        +area() double\n    }\n    \n    class DrawingCanvas {\n        -List~Shape~ shapes\n        +DrawingCanvas()\n        +addShape(Shape) void\n        +removeShape(Shape) void\n        +drawAll() void\n        +calculateTotalArea() double\n    }\n    \n    Shape \u003c|-- Circle\n    Shape \u003c|-- Rectangle\n    DrawingCanvas o-- Shape : contains\n```\n\n## Group Assignment Tasks\n\n1. **Setup and Basic Structure**\n   - Set up the project structure and version control\n   - Implement the command-line interface and configuration file parser\n   - Create the basic file scanning functionality\n\n2. **JavaCompiler API Integration**\n   - Set up the JavaCompiler API\n   - Implement in-memory compilation of Java source files\n   - Create the AST visitor patterns for analyzing compiled code\n   - Develop the type resolution system for identifying relationships\n\n3. **Class Diagram Generation**\n   - Build the class structure model from the AST analysis\n   - Implement relationship detection (inheritance, implementation, association)\n   - Create the Mermaid diagram syntax generator\n   - Implement formatting and styling options\n\n4. **Multithreading and Performance**\n   - Implement parallel file processing\n   - Optimize the compilation and analysis process\n   - Add progress tracking and reporting\n\n5. **Testing and Documentation**\n   - Write unit tests for all core components\n   - Create integration tests with sample Java projects\n   - Document the codebase and prepare usage examples\n\n## Acknowledgments\n\n- This project was created as a group assignment to demonstrate proficiency in Java programming concepts\n- Mermaid.js for the diagram syntax and rendering capabilities\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodefodvn%2Fcourse-project-1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodefodvn%2Fcourse-project-1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodefodvn%2Fcourse-project-1/lists"}