-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ekozlov
committed
Aug 23, 2013
1 parent
04217da
commit 43cd3ce
Showing
7 changed files
with
539 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
*.class | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.ear | ||
|
||
src/main/xtend-gen | ||
src/test/xtend-gen | ||
/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.github.xtension</groupId> | ||
<artifactId>xtension</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
|
||
<properties> | ||
<xtend.version>2.4.2</xtend.version> | ||
<guava.version>14.0.1</guava.version> | ||
<java.version>1.6</java.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
<version>${guava.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.xtend</groupId> | ||
<artifactId>org.eclipse.xtend.lib</artifactId> | ||
<version>${xtend.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.11</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<version>1.3.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.1</version> | ||
<configuration> | ||
<source>${java.version}</source> | ||
<target>${java.version}</target> | ||
<encoding>${project.build.sourceEncoding}</encoding> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.eclipse.xtend</groupId> | ||
<artifactId>xtend-maven-plugin</artifactId> | ||
<version>${xtend.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>compile</goal> | ||
<goal>testCompile</goal> | ||
</goals> | ||
<configuration> | ||
<outputDirectory>src/main/xtend-gen</outputDirectory> | ||
<testOutputDirectory>src/test/xtend-gen</testOutputDirectory> | ||
<encoding>${project.build.sourceEncoding}</encoding> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
25 changes: 25 additions & 0 deletions
25
src/main/java/com/github/xtension/ComparableExtensions.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.github.xtension | ||
|
||
import com.google.common.annotations.Beta | ||
|
||
final class ComparableExtensions { | ||
|
||
private new() { | ||
} | ||
|
||
/** | ||
* Determines whether the value is in [start, end] range (start included, end included). | ||
*/ | ||
@Beta | ||
def static <C> boolean isBetween(Comparable<? super C> obj, C start, C end) { | ||
obj.compareTo(start) >= 0 && obj.compareTo(end) <= 0 | ||
} | ||
|
||
/** | ||
* Determines whether the value value is in (start, end) range (start excluded, end excluded). | ||
*/ | ||
@Beta | ||
def static <C> boolean isStrictlyBetween(Comparable<? super C> obj, C start, C end) { | ||
obj.compareTo(start) > 0 && obj.compareTo(end) < 0 | ||
} | ||
} |
Oops, something went wrong.