浏览代码

Add initial files

Sam Jaffe 8 年之前
父节点
当前提交
22ed4dfde9

+ 12 - 0
.codepro/deadCodeEntryPoints.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated by Code Pro -->
+<entry-points
+		version="1">
+	<explicit-entry-points/>
+	<include-main
+			enabled="true"/>
+	<include-tests
+			enabled="false"/>
+	<include-xml
+			enabled="true"/>
+</entry-points>

+ 117 - 0
pom.xml

@@ -0,0 +1,117 @@
+<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>org.leumasjaffe</groupId>
+	<artifactId>container</artifactId>
+	<version>0.1</version>
+
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+	</properties>
+
+	<build>
+		<pluginManagement>
+			<plugins>
+				<plugin>
+					<groupId>org.eclipse.m2e</groupId>
+					<artifactId>lifecycle-mapping</artifactId>
+					<version>1.0.0</version>
+					<configuration>
+						<lifecycleMappingMetadata>
+							<pluginExecutions>
+								<pluginExecution>
+									<pluginExecutionFilter>
+										<groupId>org.projectlombok</groupId>
+										<artifactId>lombok-maven-plugin</artifactId>
+										<versionRange>[1,)</versionRange>
+										<goals>
+											<goal>delombok</goal>
+										</goals>
+									</pluginExecutionFilter>
+									<action>
+										<ignore />
+									</action>
+								</pluginExecution>
+							</pluginExecutions>
+						</lifecycleMappingMetadata>
+					</configuration>
+				</plugin>
+			</plugins>
+		</pluginManagement>
+		<sourceDirectory>target/generated-sources/delombok</sourceDirectory>
+		<plugins>
+			<plugin>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>3.5.1</version>
+				<configuration>
+					<compilerVersion>1.8</compilerVersion>
+					<source>1.8</source>
+					<target>1.8</target>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.projectlombok</groupId>
+				<artifactId>lombok-maven-plugin</artifactId>
+				<version>1.16.18.0</version>
+				<executions>
+					<execution>
+						<id>delombok</id>
+						<phase>generate-sources</phase>
+						<goals>
+							<goal>delombok</goal>
+						</goals>
+					</execution>
+				</executions>
+				<configuration>
+					<addOutputDirectory>false</addOutputDirectory>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-jar-plugin</artifactId>
+				<version>2.4</version>
+				<configuration>
+					<archive>
+						<manifest>
+							<addClasspath>true</addClasspath>
+							<classpathPrefix>dependency-jars/</classpathPrefix>
+						</manifest>
+					</archive>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-dependency-plugin</artifactId>
+				<version>2.5.1</version>
+				<executions>
+					<execution>
+						<id>copy-dependencies</id>
+						<phase>package</phase>
+						<goals>
+							<goal>copy-dependencies</goal>
+						</goals>
+						<configuration>
+							<outputDirectory>
+								${project.build.directory}/dependency-jars/
+							</outputDirectory>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+	
+	<dependencies>
+    <dependency>
+      <groupId>org.projectlombok</groupId>
+      <artifactId>lombok</artifactId>
+      <version>1.16.18</version>
+    </dependency>
+    <dependency>
+      <groupId>org.projectlombok</groupId>
+      <artifactId>lombok-maven-plugin</artifactId>
+      <version>1.16.18.0</version>
+      <type>maven-plugin</type>
+    </dependency>
+	</dependencies>
+</project>

+ 35 - 0
src/main/lombok/org/leumasjaffe/container/Either.java

@@ -0,0 +1,35 @@
+package org.leumasjaffe.container;
+
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@AllArgsConstructor(access=AccessLevel.PRIVATE)
+@Getter
+public class Either<T1, T2> {
+	public enum State { LEFT, RIGHT }
+	T1 left;
+	T2 right;
+	
+	public static <T1, T2> Either<T1, T2> ofLeft(T1 left) {
+		return new Either<>(left, null);
+	}
+	
+	public static <T1, T2> Either<T1, T2> ofRight(T2 right) {
+		return new Either<>(null, right);
+	}
+	
+	public State getState() {
+		return left == null ? State.RIGHT : State.LEFT;
+	}
+	
+	public void setLeft(T1 left) {
+		this.right = null;
+		this.left = left;
+	}
+
+	public void setRight(T2 right) {
+		this.right = right;
+		this.left = null;
+	}
+}

+ 11 - 0
src/main/lombok/org/leumasjaffe/container/Pair.java

@@ -0,0 +1,11 @@
+package org.leumasjaffe.container;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data @AllArgsConstructor @NoArgsConstructor
+public class Pair<T1, T2> {
+	T1 left;
+	T2 right;
+}

+ 12 - 0
src/main/lombok/org/leumasjaffe/container/Triple.java

@@ -0,0 +1,12 @@
+package org.leumasjaffe.container;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data @NoArgsConstructor @AllArgsConstructor
+public class Triple<S1, S2, S3> {
+	S1 first;
+	S2 second;
+	S3 third;
+}