lib: new API for Comparator

Also remove old deprecated classes.

Signed-off-by: Jean Privat <jean@pryen.org>
lib: beef-up the Comparator api and documentation

Signed-off-by: Jean Privat <jean@pryen.org>
model: rename LinexComparator::min/max to avoid name conflicts

Signed-off-by: Jean Privat <jean@pryen.org>
stream: Offer string-backed input streams.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
lib/math: Added bin_not function to Int

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
Merge: Improve Comparator type-kindness

The Comparator class in Nit was a PITA because, with the traditional modelization with a generic class, Comparator is contravariant but Nit only allows covariance in its genericity.

Example:

~~~nit
var ao = new Array[Object].with_items(2,1,10)
ao.sort_with(alpha_comparator)
print ao.join(" ") # => 1 10 2

var ai = new Array[Int].with_items(2,1,10)
ai.sort_with(alpha_comparator)
# Static error: expected a Comparator[Int], got a Comparator[Object]
~~~

This PR implements the nice proposition of Etienne Gagnon to makes Comparator a non-generic class but use virtual types to control the type of compared elements.

It is clearly an improvement over the previous implementation:

* more expressive (++++)
* less code (+)
* simpler for the client (less generic stuff) (+)
* coherent with the `Comparable` hierarchy that also use virtual types (+)
* a little more complex for the lib (virtual type redefinition) (-)
* loss of information when things are typed with the interface `Comparator`, yielding to more potential covariance error at runtime (--)

While less type-safe than a full (and complex) contravariance solution, the proposed solution is still better in term of type-safety than dynamic languages and non-generic-non-virtual-type solutions (eg. Java4):

* runtime errors are detected earlier than with erasure or with dynamic typing (fail fast)
* some errors are still detected statically:

~~~
var a = [1,10,2,3]
alpha_comparator.sort(a)
print a.join(" ") #=> 1 10 2 3
default_comparator.sort(a)
print a.join(" ") #=> 1 2 3 10

var b = [true, false]
alpha_comparator.sort(b)
print b.join(" ") # => false true
default_comparator.sort(b)
# Static type error: expected Array[Comparable], got Array[Bool]
~~~

Original-Idea-By: Etienne M. Gagnon <egagnon@j-meg.com>

Pull-Request: #803
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
NOTICE: update dates and authors.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
stream: Introduce a push-back reader.

May be useful when implementing backtracking algorithms.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Merge: NOTICE: update dates and authors.

After 2 years, I think the `NOTICE` file need to be updated.

Pull-Request: #804
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Merge: stream: push-back reader

I implemented something similar to http://docs.oracle.com/javase/7/docs/api/java/io/PushbackReader.html last week thinking I needed it for the XML parser, but I ended up with a top-down parser that do not need to backtrack by more than one octet.

Pull-Request: #805
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
lib/standard/math: Fixed documentation on old binary operators

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
nitunit: accept an absolute path for `--dir`.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Merge: lib/math: Added bin_not function to Int

Added missing function bin_not to `Int` as I might need it in the near future.

I figured it could be needed by someone else, so why not !

Pull-Request: #806
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Merge: nitunit: accept an absolute path for `--dir`.

When I passed an absolute path to the `--dir` option of `nitunit`, I got errors like this one:
```
ERROR: test_unread_order (in file /my/costum/dir/.nitunit/test_push_back_reader_TestPushBackDecorator_test_unread_order.nit): sh: 1: .//my/costum/dir/.nitunit/test_push_back_reader_TestPushBackDecorator_test_unread_order.bin: not found
```

It was a trivial bug so I fixed this.

Pull-Request: #809
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Merge remote-tracking branch 'upstream/master' into nitvm

Signed-off-by: Julien Pagès <julien.projet@gmail.com>
nitvm: Continuing method dispatch with PH

Signed-off-by: Julien Pagès <julien.projet@gmail.com>