Skip to content

A most easily usable Pomodoro Technique wrapper in Java. Pomodoro4J provides an easy and intuitive way to implement the cycle of concentration, break, and longer break in the Pomodoro Technique.

License

Notifications You must be signed in to change notification settings

myConsciousness/pomodoro4j

Repository files navigation

Latest Version License
Java CI with Gradle

1. Pomodoro4J

1.1. What is it?

Pomodoro4J is a Pomodoro Technique binding library for the Java language licensed under Apache License 2.0.

1.2. Motivation

  1. Provide a tested, simple, and easy-to-use implementation of the Pomodoro Technique.
  2. To standardize the implementation of the Pomodoro Technique in programming.
  3. Provide intuitive manipulation of the Pomodoro Technique in programming.
  4. Pray that the people of the world can work more productively.

1.3. How To Use

Pomodoro4J is a rigorously interpreted program of Pomodoro Technique procedures and methods.
Therefore, users of Pomodoro4J can reproduce the real Pomodoro Technique without being aware of how to use or implement each method by following the instructions below.

1.3.1. Add the dependencies

Note:
Replace version you want to use. Check the latest Packages.
Please contact me for a token to download the GitHub package.
Alternatively, you can download it directly as a zip file.

Maven

<dependency>
  <groupId>org.pomodoro4j</groupId>
  <artifactId>pomodoro4j</artifactId>
  <version>v1.0.0</version>
</dependency>

<servers>
  <server>
    <id>github</id>
    <username>myConsciousness</username>
    <password>xxxxxxxxxxxxxxxxxx</password>
  </server>
</servers>

Gradle

repositories {
    maven {
        name = "GitHubPackages"
        url = uri("https://maven.pkg.github.com/myConsciousness/pomodoro4j")
        credentials {
          username = "myConsciousness"
          password = "xxxxxxxxxxxxxxxxxx"
        }
    }
}

dependencies {
    implementation 'org.pomodoro4j:pomodoro4j:v1.0.0'
}

1.3.2. Create Pomodoro instance with configuration

Basically, you can create a new Pomodoro instance in the following format.

package demo.pomodoro4j;

import org.pomodoro4j.PomodoroFactory;
import org.pomodoro4j.config.Configuration;
import org.pomodoro4j.config.ConfigurationBuilder;

public class DemoPomodoro {

    public static void main(String[] args) {

        // Set the simple configuration of Pomodoro cycle
        final Configuration configuration = ConfigurationBuilder.newBuilder()
                                                                .setConcentrationMinutes(25)
                                                                .setBreakMinutes(5)
                                                                .setLongerBreakMinutes(15)
                                                                .setCountUntilLongerBreak(4)
                                                                .build();

        final Pomodoro pomodoro = PomodoroFactory.newInstance(configuration).getInstance()
    }
}

For the configuration builder object in the above example, specify arbitrary values for the following property fields.
The initial values of each property are specified by referring to the Pomodoro Technique implementation method here.

Property Initial Value Unit Description
setConcentrationMinutes(int) 25 Minutes A property representing the concentration time in the Pomodoro Technique. The unit is minutes and an integer can be specified. The default value is specified as 25 (minutes).
setBreakMinutes(int) 5 Minutes A property representing the break time in the Pomodoro Technique. The unit is minutes and an integer can be specified. The default value is specified as 5 (minutes).
setLongerBreakMinutes(int) 15 Minutes A property representing the longer break time in the Pomodoro Technique. The unit is minutes and an integer can be specified. The default value is specified as 15 (minutes).
setCountUntilLongerBreak(int) 4 Counts A property representing the count until longer break in the Pomodoro Technique. The unit is count and an integer can be specified. The default value is specified as 4 (counts).

1.3.3. Start Pomodoro cycle

package demo.pomodoro4j;

import org.pomodoro4j.PomodoroFactory;
import org.pomodoro4j.config.Configuration;
import org.pomodoro4j.config.ConfigurationBuilder;

public class DemoPomodoro {

    public static void main(String[] args) {

        // Set the simple configuration of Pomodoro cycle
        final Configuration configuration = ConfigurationBuilder.newBuilder()
                                                                .setConcentrationMinutes(25)
                                                                .setBreakMinutes(5)
                                                                .setLongerBreakMinutes(15)
                                                                .setCountUntilLongerBreak(4)
                                                                .build();

        final Pomodoro pomodoro = PomodoroFactory.newInstance(configuration).getInstance()

        // The entire Pomodoro cycle is performed in this while clause.
        // With the above property value setting,
        // concentration and rest will be performed four times, with a longer rest at the end.
        while (pomodoro.performs()) {

            // When the above property value of 25 minutes has elapsed, the break time begins.
            if (pomodoro.shouldStartBreak()) {
                // Break and long break are determined by internal processing, so just call startBreak().
                pomodoro.startBreak();

                // All cycles during the break will be performed in this while clause.
                while (pomodoro.isBreaking()) {

                    // When the above property value of 5 (normal break) or 15 (longer break) minutes has elapsed, the break time ends.
                    if (pomodoro.shouldEndBreak()) {
                        // If it is a long break,
                        // it means that the entire Pomodoro cycle is complete at this point.
                        pomodoro.endBreak();
                    }
                }
            }
        }
    }
}

1.3.3.1. Simplified implementation

package demo.pomodoro4j;

import org.pomodoro4j.PomodoroFactory;
import org.pomodoro4j.config.ConfigurationBuilder;

public class DemoPomodoro {

    public static void main(String[] args) {

        final Pomodoro pomodoro = PomodoroFactory.newInstance(ConfigurationBuilder.newBuilder().build()).getInstance()

        while (pomodoro.performs()) {
            pomodoro.startBreakIfShould();

            while (pomodoro.isBreaking()) {
              pomodoro.endBreakIfShould();
            }
        }
    }
}

1.4. License

Copyright 2021 Kato Shinya.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License.

1.5. More Information

Pomodoro4J was designed and implemented by Kato Shinya, who works as a freelance developer.

Regardless of the means or content of communication, I would love to hear from you if you have any questions or concerns. I do not check my email box very often so a response may be delayed, anyway thank you for your interest!

About

A most easily usable Pomodoro Technique wrapper in Java. Pomodoro4J provides an easy and intuitive way to implement the cycle of concentration, break, and longer break in the Pomodoro Technique.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Languages