Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ekozlov committed Aug 23, 2013
1 parent 04217da commit 43cd3ce
Show file tree
Hide file tree
Showing 7 changed files with 539 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .gitignore
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
73 changes: 73 additions & 0 deletions pom.xml
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 src/main/java/com/github/xtension/ComparableExtensions.xtend
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
}
}
Loading

0 comments on commit 43cd3ce

Please sign in to comment.