<commit_before>SortDescriptor
================
[![License](http://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)
![CI Status](https://travis-ci.org/dbi1463/SortDescriptor.svg?branch=master)

A NSSortDescriptor-like implementation on Java.

## Features
* Sort objects with multiple conditions
* Sort objects with object's persistent properties without writing comparator
* Sort objects with object's transient properties by writing transformers
* Object's persistent properties and transient properties can be used together as the sort conditions

## How to use
The `SortDescriptorsBuilder` can be use to organize the sort conditions. Given a person object that has first name, last name, full name, age, and gender properties (see the Person.java in test code). For example, if we would like to sort persons first by whether the person is adult or not, than by the gender, and last by his/her first name. There is no need to write complicated comparator. With `SortDescriptorsBuilder`, the following code combines three sort descriptors together. The first sort descriptor wraps a transformer (`AdultChecker`) to sort transient property from a person object. The third statement adds a property sort descriptor by just simply declares the property name in the first parameter. The second parameter is used to control the ordering: ascending or descending.

```java
// Sort the persons by whether the person is adult or not, the gender, and the first name
List<Person> result = SortDescriptorsBuilder
	.startWith(new AdultChecker(), true)
	.thenWith("gender", false)
	.thenWith("firstName", true)
	.sortedList(persons);
```<commit_msg>Add code coverage badge in README.md<commit_after>SortDescriptor
================
[![License](http://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)
![CI Status](https://travis-ci.org/dbi1463/SortDescriptor.svg?branch=master)
[![Coverage Status](https://coveralls.io/repos/dbi1463/SortDescriptor/badge.svg?branch=master&service=github)](https://coveralls.io/github/dbi1463/SortDescriptor?branch=master)

A NSSortDescriptor-like implementation on Java.

## Features
* Sort objects with multiple conditions
* Sort objects with object's persistent properties without writing comparator
* Sort objects with object's transient properties by writing transformers
* Object's persistent properties and transient properties can be used together as the sort conditions

## How to use
The `SortDescriptorsBuilder` can be use to organize the sort conditions. Given a person object that has first name, last name, full name, age, and gender properties (see the Person.java in test code). For example, if we would like to sort persons first by whether the person is adult or not, than by the gender, and last by his/her first name. There is no need to write complicated comparator. With `SortDescriptorsBuilder`, the following code combines three sort descriptors together. The first sort descriptor wraps a transformer (`AdultChecker`) to sort transient property from a person object. The third statement adds a property sort descriptor by just simply declares the property name in the first parameter. The second parameter is used to control the ordering: ascending or descending.

```java
// Sort the persons by whether the person is adult or not, the gender, and the first name
List<Person> result = SortDescriptorsBuilder
	.startWith(new AdultChecker(), true)
	.thenWith("gender", false)
	.thenWith("firstName", true)
	.sortedList(persons);
```
{'fraction_non_alphanumeric': 0.08602150537634409, 'fraction_numerical': 0.004527447651386531, 'mean_word_length': 5.510128913443831, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2668296', 'n_tokens_mistral': 899, 'n_tokens_neox': 858, 'n_words': 415}