From 0188379174a33bbac89a429148228169893f28b5 Mon Sep 17 00:00:00 2001 From: asivache Date: Mon, 23 Mar 2009 14:12:22 +0000 Subject: [PATCH] PrimitivePair.\* : pair(s) based directly on primitive types. Hail generics. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@148 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/utils/PrimitivePair.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 core/java/src/org/broadinstitute/sting/utils/PrimitivePair.java diff --git a/core/java/src/org/broadinstitute/sting/utils/PrimitivePair.java b/core/java/src/org/broadinstitute/sting/utils/PrimitivePair.java new file mode 100644 index 000000000..7363ba3c3 --- /dev/null +++ b/core/java/src/org/broadinstitute/sting/utils/PrimitivePair.java @@ -0,0 +1,33 @@ +package org.broadinstitute.sting.utils; + + +/** This class is used to group together multiple Pair classes for + * primitive types (thanks to generics shortcomings, these implementations + * are more efficient then generic ones). This class contains no methods and + * no fields, but only declarations of inner classes. + */ + +public class PrimitivePair { + + /** Pair of two integers */ + public static class Int { + // declare public, STL-style for easier and more efficient access: + public int first; + public int second; + + public Int(int x, int y) { first = x; second = y; } + public Int() { first = second = 0; } + + public void set(int x, int y) { first = x; second = y; } + + /** Java-style getter; note that we currently allow direct access to + the member field. + */ + public int getFirst() { return first; } + + /** Java-style getter; note that we currently allow direct access to + the member field. + */ + public int getSecond() { return second; } + } +}