All Projects → d-plaindoux → suitcase

d-plaindoux / suitcase

Licence: LGPL-2.1 license
Java Pattern Matching library

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to suitcase

Mlstyle.jl
Julia functional programming infrastructures and metaprogramming facilities
Stars: ✭ 223 (+961.9%)
Mutual labels:  pattern-matching
chemin
🥾 A type-safe pattern builder & route matching library written in TypeScript
Stars: ✭ 37 (+76.19%)
Mutual labels:  pattern-matching
montre
The original timed regular expression matcher over temporal behaviors
Stars: ✭ 14 (-33.33%)
Mutual labels:  pattern-matching
Poica
🧮 A research programming language on top of C macros
Stars: ✭ 231 (+1000%)
Mutual labels:  pattern-matching
when-switch
JavaScript functional implementation of switch/case
Stars: ✭ 20 (-4.76%)
Mutual labels:  pattern-matching
asteroid
Asteroid is a modern, multi-paradigm programming language that supports first-class patterns.
Stars: ✭ 29 (+38.1%)
Mutual labels:  pattern-matching
Trivia
Pattern Matcher Compatible with Optima
Stars: ✭ 210 (+900%)
Mutual labels:  pattern-matching
wink-nlp
Developer friendly Natural Language Processing ✨
Stars: ✭ 312 (+1385.71%)
Mutual labels:  pattern-matching
grime
A language for matching two-dimensional patterns, based on Boolean grammars.
Stars: ✭ 13 (-38.1%)
Mutual labels:  pattern-matching
egison-haskell
Template Haskell Implementation of Egison Pattern Matching
Stars: ✭ 31 (+47.62%)
Mutual labels:  pattern-matching
csharp-workshop
NDC London 2019, Workshop: Become a better C# programmer: more Value, more Expressions, no Waiting
Stars: ✭ 21 (+0%)
Mutual labels:  pattern-matching
extractacy
Spacy pipeline object for extracting values that correspond to a named entity (e.g., birth dates, account numbers, laboratory results)
Stars: ✭ 47 (+123.81%)
Mutual labels:  pattern-matching
simplematch
Minimal, super readable string pattern matching for python.
Stars: ✭ 147 (+600%)
Mutual labels:  pattern-matching
Actor Framework
An Open Source Implementation of the Actor Model in C++
Stars: ✭ 2,637 (+12457.14%)
Mutual labels:  pattern-matching
pmatch
Pattern matching DSL for R
Stars: ✭ 21 (+0%)
Mutual labels:  pattern-matching
Patty
A pattern matching library for Nim
Stars: ✭ 214 (+919.05%)
Mutual labels:  pattern-matching
regexm
A Rust macro for writing regex pattern matching.
Stars: ✭ 46 (+119.05%)
Mutual labels:  pattern-matching
CVparser
CVparser is software for parsing or extracting data out of CV/resumes.
Stars: ✭ 28 (+33.33%)
Mutual labels:  pattern-matching
pattern-matching
full-featured pattern-matching in python, however it's more likely to be dynamic contracts.
Stars: ✭ 18 (-14.29%)
Mutual labels:  pattern-matching
sweet-egison
Haskell library for non-deterministic pattern matching
Stars: ✭ 15 (-28.57%)
Mutual labels:  pattern-matching

SuitCase

Codacy Badge Build Status Coverage Status Maven Central stable

SuitCase is a convenient Java library dedicated to object manipulation using pattern matching mechanism.

Quick Overview

If you want to manipulate object based on types in Java the dedicated design pattern is the visitor. Unfortunately even if such pattern is well known its implementation is always painful because it implies code dissemination and finally brakes incremental compilation approach.

In addition such mechanism only enables selection based on types and does not provides a simple and intuitive mechanism filtering objects using their values i.e. attributes.

For this purpose a simple pattern matching inspired by Scala extractor object has been designed.

This pattern matching offers a simple mechanism for simple object selection based on intrinsic equality. Indeed pattern matching cases can be done on the object kind and it's internal state. For instance the following sample checks if an integer is O or not.

Matcher<Integer, Boolean> isZero = Matcher.match();

isZero.caseOf(0).then(true);
isZero.caseOf(Any()).then(false);

isZero.match(0); // == true

Regexp, List Patterns and more ...

More information and descriptions are given in the Wiki and in particular ad-hoc case is explained with practical implementations covering matching for lists, string regular expression, XML etc.

Releases

This library is available at Sonatype OSS Repository Hosting service and can be simply used adding the following dependency to your pom project.

<dependency>
  <groupId>org.smallibs</groupId>
  <artifactId>suitcase</artifactId>
  <version>0.3</version>
</dependency>

Presentation

A presentation (in french) has been given during a Toulouse Java User Group session.

Other Propositions & Discussions

A review of various approaches is given in the Structural Pattern Matching in Java. It starts from the visitor and proposes alternatives with a functional programming approach.

Some propositions like Towards Pattern Matching in Java or Java 8 annotation processor and framework for deriving algebraic data types constructors, pattern-matching, morphisms are also available.

License

Copyright (C)2015 D. Plaindoux.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].