{"id":36425949,"url":"https://github.com/bartlomiejgora/rpnlibrary","last_synced_at":"2026-01-11T18:00:18.795Z","repository":{"id":26372441,"uuid":"29821690","full_name":"bartlomiejgora/RPNLibrary","owner":"bartlomiejgora","description":"Java Reverse Polish Notation Library","archived":false,"fork":false,"pushed_at":"2025-08-18T21:07:31.000Z","size":375,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-18T21:30:57.636Z","etag":null,"topics":["java","library","rpn","rpn-expression"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bartlomiejgora.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2015-01-25T16:54:36.000Z","updated_at":"2025-08-18T21:07:35.000Z","dependencies_parsed_at":"2025-04-11T17:22:58.436Z","dependency_job_id":"b0b1bd59-a559-4374-9eb6-7ce78dd74e75","html_url":"https://github.com/bartlomiejgora/RPNLibrary","commit_stats":null,"previous_names":["bartlomiej-gora/rpnlibrary","bartgora/rpnlibrary","bartlomiejgora/rpnlibrary"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/bartlomiejgora/RPNLibrary","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartlomiejgora%2FRPNLibrary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartlomiejgora%2FRPNLibrary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartlomiejgora%2FRPNLibrary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartlomiejgora%2FRPNLibrary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bartlomiejgora","download_url":"https://codeload.github.com/bartlomiejgora/RPNLibrary/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartlomiejgora%2FRPNLibrary/sbom","scorecard":{"id":226335,"data":{"date":"2025-08-11","repo":{"name":"github.com/bartlomiej-gora/RPNLibrary","commit":"016104606779b95ec5cf7cf650306c37fa826b7b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU General Public License v3.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'","Warn: branch protection not enabled for branch 'release/3.2.2'","Warn: branch protection not enabled for branch 'release/3.2.1'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":4,"reason":"SAST tool is not run on all commits -- score normalized to 4","details":["Warn: 10 commits out of 22 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T03:53:50.440Z","repository_id":26372441,"created_at":"2025-08-17T03:53:50.440Z","updated_at":"2025-08-17T03:53:50.440Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28316889,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T14:58:17.114Z","status":"ssl_error","status_checked_at":"2026-01-11T14:55:53.580Z","response_time":60,"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":["java","library","rpn","rpn-expression"],"created_at":"2026-01-11T18:00:16.818Z","updated_at":"2026-01-11T18:00:18.788Z","avatar_url":"https://github.com/bartlomiejgora.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RPNLibrary\n\nSimple RPN (Reverse Polish Notation) Library for Java.\u003cbr\u003e\nIt is based on Dijkstra Algorithm. (https://en.wikipedia.org/wiki/Reverse_Polish_notation)\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=bartgora_RPNLibrary\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=bartgora_RPNLibrary) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=bartgora_RPNLibrary\u0026metric=bugs)](https://sonarcloud.io/summary/new_code?id=bartgora_RPNLibrary) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=bartgora_RPNLibrary\u0026metric=code_smells)](https://sonarcloud.io/summary/new_code?id=bartgora_RPNLibrary) [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=bartgora_RPNLibrary\u0026metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=bartgora_RPNLibrary)\n\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/b004cdd19ecf42b697db1a19a3ae82ec)](https://app.codacy.com/gh/bartgora/RPNLibrary/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.bartlomiej-gora/RPNLibrary/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.bartlomiej-gora/RPNLibrary)\n\n[![javadoc](https://javadoc.io/badge2/com.github.bartlomiej-gora/RPNLibrary/javadoc.svg)](https://javadoc.io/doc/com.github.bartlomiej-gora/RPNLibrary)\n\nStory\n===\nCouple years ago I read Joshua Bloch's \"Java. Effective Programming\".\nI wanted to practice what I've learned.\nI didn't want to create another CRUD like application, so I found that Dijkstra's algorithm would be good \nto learn design patterns, and effective programming.\nFirst version's were available on Sourceforge.\nCouple years later I manage to publish my library on maven cetral repo.\nOver the years I built a small ecosystem around this library.\nFeel free to check my other projects that use this one.\n  \n \nAvailable functions:\n===\n+,-,*,/ with (), power(^)\nSin, cos, tg, ctg,\nmin, max, fib\n\nexample: \n```java\n        Calculator calc = Calculator.createCalulator();\n        BigDecimal result = calc.calculate(\"2^3*(12/6)+18/3+5.0/2\");\n        BigDecimal result2 = calc.calculate(\"3.678^2\");\n        BigDecimal resultSin = calc.calculate(\"sin(2)\");\n        BigDecimal resultSin2 = calc.calculate(\"sin(1+1)\");\n        BigDecimal resultCtg = calc.calculate(\"ctg(-1.65091)\");\n        BigDecimal min = calc.calculate(\"min(10, 8) + 10\");\n```\n\n\nMaven:\n===\n```\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.bartlomiejgora\u003c/groupId\u003e\n    \u003cartifactId\u003eRPNLibrary\u003c/artifactId\u003e\n    \u003cversion\u003e5.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n\nChangelog:\n====\n\n\n### Version 5.1.0:\n\n- Removed Tests in Kotlin.\n- Moved to Java 17 (var, and Map.of)\n- Changed Interfaces names from RPNChecking -\u003e RPNChecker, and RPNExecuting -\u003e RPNExecutioner  \n- Added new Factories for RPNChecker, and RPNExecutioner.\u003c/br\u003e\nIf you want to customize the calculator by adding your own operators and functions to existing one, you can use those\n- Factories. Below there is an example of adding % (moduli) operator to the calculator.\n```java\n var rpnChecker = RPNCheckerFactory.createRPNCheckerWithDefaults(Map.of(\"%\", 1), Map.of());\n        AbstractOperatorStrategy modulo = new AbstractOperatorStrategy(\"%\") {\n\n            @Override\n            public BigDecimal execute(final String first, final String second, final MathContext mathContext) {\n                var firstDec = new BigDecimal(first, mathContext);\n                var secondDec = new BigDecimal(second, mathContext);\n                return firstDec.remainder(secondDec);\n            }\n        };\n        var rpnExecutioner = RPNExecutionerFactory.createRPNExecutionerWithDefaults(Map.of(\"%\", modulo), Map.of());\n\n        var calc = Calculator.createCalculator(rpnChecker,rpnExecutioner, MathContext.DECIMAL64, 2);\n\n        BigDecimal result = calc.calculate(\"4%17\");\n        assertThat(result).isEqualTo(new BigDecimal(\"4.00\"));\n```\n\n### Version 5.0.0:\n\n- Moved to java 8\n- Refactoring, split Calculator class into smaller pieces, using java 8 functional interfaces\n- Added tests written in Kotest:\n\nexample:\n```kotlin\nclass RPNFactoryTest : FreeSpec({\n\n    val tested = RPNFactory(RPNChecker(DefaultStrategyProvider()))\n            \"should Return RPN\" - {\n                val text = \"( 2 + 3 ) * 5\"\n                val result = tested.apply(text)\n                result shouldBe \"2 3 + 5 *\"\n            }\n            \"should Return RPN for Function call\" - {\n                val text = \"sin ( 1 )\"\n                val result = tested.apply(text)\n                result shouldBe \"1 sin\"\n            }\n            \"should Return RPN for Function and equation\" - {\n                val text = \"sin ( 1 ) + 27 * 8\"\n                val result = tested.apply(text)\n                result shouldBe \"1 sin 27 8 * +\"\n            }\n            \"should Return RPN for  two Functions call\" - {\n                val text = \"sin ( 1 ) + ctg ( 0 )\"\n                val result = tested.apply(text)\n                result shouldBe \"1 sin 0 ctg +\"\n            }\n})\n```\n\n### Version 4.0.0:\n\n- Using big Decimal Math library (https://github.com/eobermuhlner/big-math)\n- General refactoring.\n- Added Javadoc\n\n### Version 3.2.2:\n\n- Changed internal calculation from BigDecimal to Double in DefaultCalculator implementation\n\n### Version 3.2.1:\n\n- Fixed bug in divide operator, that caused:\n ex: \"10/4 = 2, and not 2.5\",\n \"5/2 = 2, and not 2.5\"\n- Changed RoundinMode from HALF_UP, to HALF_EVEN\n- Changed internal calculation type from BigDecimal to Double\n\n### Version 3.2.1-SNAPSHOT:\n\n- Fixed bug in divide operator, that caused:\n ex: \"10/4 = 2, and not 2.5\",\n \"5/2 = 2, and not 2.5\"\n- Changed RoundinMode from HALF_UP, to HALF_EVEN\n- Changed internal calculation type from BigDecimal to Double\n\n### Version 3.2.0:\n\n\u003cb\u003eIMPORTANT:\u003c/b\u003e\u003cbr\u003e\nChanged package names from\n```java\n    pl.bgora.rpn\n```\n to \n ```java\n com.github.bgora.rpnlibrary\n ```\n  \n  \u003cb\u003eFixed bug, that prevented from exucuting functions with multiple parameters.\u003c/b\u003e\n  \n  \u003cb\u003eNew functions:\u003c/b\u003e\u003c/br\u003e\n  max() - takes two parameters, returns greater one\u003c/br\u003e\n  min() - take two parameters, returns less one\u003c/br\u003e\n  fib() - Fibonacci number\u003c/br\u003e\n  \n  \u003cb\u003eRefactor:\u003c/b\u003e\n  \n  Changed \u003ci\u003ecreateCalulator\u003c/i\u003e, and \u003ci\u003e getDefaultEngine\u003c/i\u003e to use \u003ci\u003eCalculationEngine\u003c/i\u003e interface\n  \n```java\n    /**\n     * Creates AdvanceCalculator with given CalculatorEngine\n     *\n     * @param engine CalculationEngine implementation\n     * @return AdvanceCalculator\n     */\n    public CalculatorInterface createCalulator(CalculationEngine engine) {\n        return new AdvancedCalculator(RoundingMode.HALF_UP, engine);\n    }\n\n\n    /**\n     * Return default CalculationEngine implementation\n     *\n     * @return CalculatorEngine\n     */\n    public CalculationEngine getDefaultEngine() {\n        return new CalculatorEngine(StrategiesUtil.DEFAULT_OPERATORS, StrategiesUtil.DEFAULT_FUNCTIONS);\n    }\n```\n\n### Version 3.1.0:\n\n\n\n- Added package pl.bgora.rpn.advanced\u003cbr\u003e\n- Added AdvancedCalculatorFactory\u003cbr\u003e\n\n\nThe advanced Calculator works with CalculationEngine, which uses strategy pattern to run.\nplease see:\u003cbr\u003e\npl.bgora.rpn.AbstractOperatorStrategy\u003cbr\u003e\npl.bgora.rpn.AbstractFunctionStrategy\u003cbr\u003e\n\n### Example 1:\n\n\n```java\n        AdvancedCalculatorFactory advancedCalculatorFactory = new AdvancedCalculatorFactory();\n        calc = advancedCalculatorFactory.createCalulator();\n```\n\n### Example 2:\n\nAssume that you want to add a function sqrt(number), which will return The square root , You will have to extend\nAbstractFunctionStrategy like this:\n\n```java\npublic class SqrtFunctionStrategy extends AbstractFunctionStrategy {\n    public SqrtFunctionStrategy() {\n        super(\"sqrt\", 1, RoundingMode.HALF_EVEN);\n    }\n\n    @Override\n    public BigDecimal execute(String... params) {\n        return java.math.BigDecimal.valueOf(Math.sqrt(x));\n    }\n}\n```\n\nAnd then you can add your function like that:\n\n```java\n        CalculatorInterface calc;\n        AdvancedCalculatorFactory advancedCalculatorFactory = new AdvancedCalculatorFactory();\n        CalculatorEngine engine = advancedCalculatorFactory.getDefaultEngine();\n        engine.addFunctionStartegy(new SqrtFunctionStrategy());\n        calc = advancedCalculatorFactory.createCalulator(engine);\n```\n\n### Example 3:\nAssume that you want to add a function max(number, number), which will return greater value, You will have to extend\nAbstractFunctionStrategy like this:\n\n```java\npublic class MaxFunctionStrategy extends AbstractFunctionStrategy {\n    public MaxFunctionStrategy() {\n        super(\"max\", 2, RoundingMode.HALF_EVEN);\n    }\n\n    @Override\n    public BigDecimal execute(String... params) {\n        String first = params[0];\n        String second = params[1];\n        BigDecimal result = //do you calculation here\n        return result; //result;\n    }\n}\n```\n\nAnd then you can add your function like that:\n\n```java\n        CalculatorInterface calc;\n        AdvancedCalculatorFactory advancedCalculatorFactory = new AdvancedCalculatorFactory();\n        CalculatorEngine engine = advancedCalculatorFactory.getDefaultEngine();\n        engine.addFunctionStartegy(new MaxFunctionStrategy());\n        calc = advancedCalculatorFactory.createCalulator(engine);\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartlomiejgora%2Frpnlibrary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbartlomiejgora%2Frpnlibrary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartlomiejgora%2Frpnlibrary/lists"}