Permalink
Browse files

Clean-up: purged Max dependencies from net.loadbang.osc.

  • Loading branch information...
1 parent 23d5985 commit d1cbab5370e28413ca87dddf90661212f4f511f9 @cassiel committed Jul 14, 2013
View
@@ -0,0 +1,5 @@
+`-*- word-wrap: t; -*-`
+
+## 2.0.0, 2013-07-14:
+
+Purged all Max-related code. TCP/UDP writer objects and Max proxies removed.
View
@@ -7,7 +7,7 @@
<groupId>net.loadbang</groupId>
<artifactId>net.loadbang.lib</artifactId>
- <version>1.9.0</version>
+ <version>2.0.0</version>
<packaging>jar</packaging>
<name>net.loadbang.lib</name>
@@ -1,69 +0,0 @@
-// $Id$
-// $Source$
-
-package net.loadbang.util;
-
-/** Pair of arbitrary object types. Either may be null. (We should probably use the
- "00" notation here, but it's not really worth it for a pure datatype.) */
-
-public class Pair<A, B> {
- private A itsFst;
- private B itsSnd;
-
- public Pair(A fst, B snd) {
- itsFst = fst;
- itsSnd = snd;
- }
-
- public void setFst(A fst) {
- itsFst = fst;
- }
-
- public void setSnd(B snd) {
- itsSnd = snd;
- }
-
- public A getFst() {
- return itsFst;
- }
-
- public B getSnd() {
- return itsSnd;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((itsFst == null) ? 0 : itsFst.hashCode());
- result = prime * result + ((itsSnd == null) ? 0 : itsSnd.hashCode());
- return result;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final Pair<A, B> other = (Pair<A, B>) obj;
- if (itsFst == null) {
- if (other.itsFst != null)
- return false;
- } else if (!itsFst.equals(other.itsFst))
- return false;
- if (itsSnd == null) {
- if (other.itsSnd != null)
- return false;
- } else if (!itsSnd.equals(other.itsSnd))
- return false;
- return true;
- }
-
- @Override public String toString() {
- return "(" + itsFst + ", " + itsSnd + ")";
- }
-}
@@ -1,16 +0,0 @@
-// $Id$
-// $Source$
-
-package net.loadbang.util;
-
-/** Library. */
-
-public class RandLib {
- static public int random(int limit) {
- return (int) (Math.random() * limit);
- }
-
- static public boolean coin() {
- return random(2) == 1;
- }
-}
@@ -1,85 +0,0 @@
-// $Id$
-// $Source$
-
-package net.loadbang.util;
-
-/** Triple of arbitrary object types. Either may be null. (We should probably use the
- "00" notation here, but it's not really worth it for a pure datatype.) */
-
-public class Triple<A, B, C> {
- private A itsFst;
- private B itsSnd;
- private C itsThd;
-
- public Triple(A fst, B snd, C thd) {
- itsFst = fst;
- itsSnd = snd;
- itsThd = thd;
- }
-
- public void setFst(A fst) {
- itsFst = fst;
- }
-
- public void setSnd(B snd) {
- itsSnd = snd;
- }
-
- public void setThd(C thd) {
- itsThd = thd;
- }
-
- public A getFst() {
- return itsFst;
- }
-
- public B getSnd() {
- return itsSnd;
- }
-
- public C getThd() {
- return itsThd;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((itsFst == null) ? 0 : itsFst.hashCode());
- result = prime * result + ((itsSnd == null) ? 0 : itsSnd.hashCode());
- result = prime * result + ((itsThd == null) ? 0 : itsThd.hashCode());
- return result;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Triple<A, B, C> other = (Triple<A, B, C>) obj;
- if (itsFst == null) {
- if (other.itsFst != null)
- return false;
- } else if (!itsFst.equals(other.itsFst))
- return false;
- if (itsSnd == null) {
- if (other.itsSnd != null)
- return false;
- } else if (!itsSnd.equals(other.itsSnd))
- return false;
- if (itsThd == null) {
- if (other.itsThd != null)
- return false;
- } else if (!itsThd.equals(other.itsThd))
- return false;
- return true;
- }
-
- @Override public String toString() {
- return "(" + itsFst + ", " + itsSnd + ", " + itsThd + ")";
- }
-}
@@ -1,50 +0,0 @@
-// $Id$
-// $Source$
-
-package net.loadbang.util;
-
-import java.util.HashMap;
-
-/** Simple two-dimensional HashMap. */
-
-public class TwoDHashMap<K1, K2, V> {
- private HashMap<K1, HashMap<K2, V>> itsMap;
-
- public TwoDHashMap() {
- itsMap = new HashMap<K1, HashMap<K2, V>>();
- }
-
- public void put(K1 key1, K2 key2, V value) {
- HashMap<K2, V> m00 = itsMap.get(key1);
-
- if (m00 == null) {
- HashMap<K2, V> single = new HashMap<K2, V>();
- single.put(key2, value);
- itsMap.put(key1, single);
- } else {
- m00.put(key2, value);
- }
- }
-
- public V get00(K1 key1, K2 key2) {
- HashMap<K2, V> m00 = itsMap.get(key1);
-
- if (m00 == null) {
- return null;
- } else {
- return m00.get(key2);
- }
- }
-
- public void remove(K1 key1, K2 key2) {
- HashMap<K2, V> m00 = itsMap.get(key1);
-
- if (m00 != null) {
- m00.remove(key2);
-
- if (m00.size() == 0) {
- itsMap.remove(key1);
- }
- }
- }
-}
@@ -1,34 +0,0 @@
-package net.loadbang.util;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import org.junit.Test;
-
-public class TwoDHashMapTest {
- @Test
- public void remove2D() {
- TwoDHashMap<Integer, Integer, String> map =
- new TwoDHashMap<Integer, Integer, String>();
-
- assertNull(map.get00(1, 2));
- map.put(1, 2, "HELLO");
- assertEquals("HELLO", map.get00(1, 2));
- map.remove(1, 2);
- assertNull(map.get00(1, 2));
- }
-
- @Test
- public void secondLayer() {
- TwoDHashMap<Integer, Integer, String> map =
- new TwoDHashMap<Integer, Integer, String>();
-
- assertNull(map.get00(1, 2));
- assertNull(map.get00(1, 3));
- map.put(1, 2, "HELLO-2");
- map.put(1, 3, "HELLO-3");
- assertEquals("HELLO-2", map.get00(1, 2));
- map.remove(1, 2);
- assertEquals("HELLO-3", map.get00(1, 3));
- }
-}

0 comments on commit d1cbab5

Please sign in to comment.