Giter Site home page Giter Site logo

khaledekramy / percolation-system-gui Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 12 KB

Explore percolation theory with this Java-based system. Simulate fluid flow using a weighted quick-union algorithm. Ideal for understanding connectivity, it finds applications in various domains. Simple, efficient, and versatile.

Java 100.00%
algorithms data-structures dynamic-connectivity gui percolation percolation-system quick-find quick-union visualization weighted-quick-union-with-path-compression

percolation-system-gui's Introduction

Percolation System GUI

Overview

The "Percolation System GUI" project is designed to provide a graphical user interface (GUI) for visualizing and interacting with the Percolation System. The core functionality is implemented in the Java class Percolation.

Features

  • Interactive Grid Display: Visualize the percolation system through an interactive grid where each cell represents a site.

  • Real-time Simulation: Simulate percolation processes by opening sites and observing the system's dynamic behavior.

  • Visual Feedback: Identify full sites to understand the percolation status visually.

  • Parameter Adjustment: Adjust system parameters, such as grid size (n), to explore different percolation configurations.

  • Statistical Information: View real-time data, including the number of open sites, to track system evolution.

Repository Structure

  • src: Contains the Java source code, including the Percolation class and potentially additional classes for GUI implementation.

  • docs: Documentation explaining the percolation algorithm, GUI functionalities, and usage instructions.", 'which is going to be included in the following Percolation class The core class for the Application.

  • resources: Graphical assets or resources used in the GUI.

Percolation Class API

Constructor

/**
 * Creates a Percolation object for a grid of specified size.
 * @param n Size of the grid (n x n).
 * @throws IllegalArgumentException if n is less than or equal to 0.
 */
public Percolation(int n);

Open Method

/**
 * Opens a site at the specified row and column if it is not already open.
 * @param row Row index (1-based).
 * @param col Column index (1-based).
 * @throws IndexOutOfBoundsException if the site is out of bounds.
 */
public void open(int row, int col);

Is Open Method

/**
 * Checks if a site at the specified row and column is open.
 * @param row Row index (1-based).
 * @param col Column index (1-based).
 * @return true if the site is open, false otherwise.
 * @throws IndexOutOfBoundsException if the site is out of bounds.
 */
public boolean isOpen(int row, int col);

Is Full Method

/**
 * Checks if a site at the specified row and column is full.//Means having a mutual connection with any element in top row.
 * @param row Row index (1-based).
 * @param col Column index (1-based).
 * @return true if the site is full, false otherwise.
 * @throws IndexOutOfBoundsException if the site is out of bounds.
 */
public boolean isFull(int row, int col);

Number of Open Sites Method

/**
 * Gets the number of open sites in the grid.
 * @return Number of open sites.
 */
public int numberOfOpenSites();

Percolates Method

/**
 * Checks if the system percolates (there is a path from the top to the bottom).
 * @return true if the system percolates, false otherwise.
 */
public boolean percolates();

Random Integer Method

/**
 * Generates a random integer between 0 (inclusive) and n (exclusive).
 * @param n Upper bound (exclusive) for the random integer.
 * @return A random integer.
 * @throws IllegalArgumentException if n is less than or equal to 0.
 */
public static int uniformInt(int n);

Usage

  • Education: Suitable for students, researchers, or enthusiasts interested in percolation theory for educational exploration.

Contributing

Feel free to contribute to the project by forking the repository and creating pull requests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.