Permalink
Browse files

Tidying up and converting to a maven project.

  • Loading branch information...
1 parent b1b87ac commit 1b31016a2468fd1c99d6793e377aa9c026337907 @reines committed Jun 2, 2011
Showing with 61 additions and 8 deletions.
  1. +4 −4 .gitignore
  2. +23 −0 .project
  3. BIN lib/gson-1.4.jar
  4. BIN lib/xpp3_min-1.1.4c.jar
  5. BIN lib/xstream-1.3.1.jar
  6. +23 −0 pom.xml
  7. +11 −4 src/{ → main/java}/com/jamierf/persistenthashmap/CachedPersistentHashMap.java
  8. 0 src/{ → main/java}/com/jamierf/persistenthashmap/EntryIterator.java
  9. 0 src/{ → main/java}/com/jamierf/persistenthashmap/EntrySet.java
  10. 0 src/{ → main/java}/com/jamierf/persistenthashmap/KeyIterator.java
  11. 0 src/{ → main/java}/com/jamierf/persistenthashmap/KeySet.java
  12. 0 src/{ → main/java}/com/jamierf/persistenthashmap/PersistentHashMap.java
  13. 0 src/{ → main/java}/com/jamierf/persistenthashmap/ValueIterator.java
  14. 0 src/{ → main/java}/com/jamierf/persistenthashmap/ValueSet.java
  15. 0 src/{ → main/java}/com/jamierf/persistenthashmap/serializers/GsonSerializer.java
  16. 0 src/{ → main/java}/com/jamierf/persistenthashmap/serializers/OOSSerializer.java
  17. 0 src/{ → main/java}/com/jamierf/persistenthashmap/serializers/ObjectSerializer.java
  18. 0 src/{ → main/java}/com/jamierf/persistenthashmap/serializers/XStreamSerializer.java
  19. 0 src/{ → main/java}/com/jamierf/persistenthashmap/util/FileUtils.java
  20. 0 {tests → src/test/java}/com/jamierf/persistenthashmap/TestCachedPersistentHashMap.java
  21. 0 {tests → src/test/java}/com/jamierf/persistenthashmap/TestGsonSerializerCachedPersistentHashMap.java
  22. 0 {tests → src/test/java}/com/jamierf/persistenthashmap/TestGsonSerializerPersistentHashMap.java
  23. 0 {tests → src/test/java}/com/jamierf/persistenthashmap/TestOOSSerializerCachedPersistentHashMap.java
  24. 0 {tests → src/test/java}/com/jamierf/persistenthashmap/TestOOSSerializerPersistentHashMap.java
  25. 0 {tests → src/test/java}/com/jamierf/persistenthashmap/TestPersistentHashMap.java
  26. 0 ... → src/test/java}/com/jamierf/persistenthashmap/TestXStreamSerializerCachedPersistentHashMap.java
  27. 0 {tests → src/test/java}/com/jamierf/persistenthashmap/TestXStreamSerializerPersistentHashMap.java
View
@@ -1,4 +1,4 @@
-.classpath
-.settings
-.project
-bin/
+/.classpath
+/.settings
+/bin/
+/target/
View
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>persistenthashmap</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
23 pom.xml
@@ -0,0 +1,23 @@
+<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.jamierf</groupId>
+ <artifactId>persistenthashmap</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>1.7.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.thoughtworks.xstream</groupId>
+ <artifactId>xstream</artifactId>
+ <version>1.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>xpp3</groupId>
+ <artifactId>xpp3_min</artifactId>
+ <version>1.1.4c</version>
+ </dependency>
+ </dependencies>
+</project>
@@ -1,9 +1,9 @@
/**
- *
+ *
* This file is part of the Persistent-HashMap library.
* Copyright (C) 2010 Jamie Furness (http://www.jamierf.co.uk)
* License: http://www.gnu.org/licenses/gpl.html GPL version 3 (or higher)
- *
+ *
*/
package com.jamierf.persistenthashmap;
@@ -25,27 +25,29 @@ public CachedPersistentHashMap(File root) {
this (root, new OOSSerializer());
}
- @SuppressWarnings("unchecked")
public CachedPersistentHashMap(File root, ObjectSerializer serializer) {
super(root, serializer, false);
cache = new HashMap<K, V>();
- Iterator<Map.Entry<K, V>> iterator = new EntryIterator(this);
+ Iterator<Map.Entry<K, V>> iterator = new EntryIterator<K, V>(this);
while (iterator.hasNext()) {
Map.Entry<K, V> e = iterator.next();
cache.put(e.getKey(), e.getValue());
}
}
+ @Override
public synchronized boolean containsKey(Object key) {
return cache.containsKey(key);
}
+ @Override
public synchronized boolean containsValue(Object v) {
return cache.containsValue(v);
}
+ @Override
@SuppressWarnings("unchecked")
public synchronized V get(Object key) {
if (cache.containsKey(key))
@@ -58,26 +60,31 @@ public synchronized V get(Object key) {
return value;
}
+ @Override
public synchronized V put(K key, V value) {
cache.put(key, value);
return super.put(key, value);
}
+ @Override
public synchronized V remove(Object key) {
cache.remove(key);
return super.remove(key);
}
+ @Override
public boolean isEmpty() {
return cache.isEmpty();
}
+ @Override
public int size() {
return cache.size();
}
+ @Override
public synchronized void clear() {
cache.clear();
super.clear();

0 comments on commit 1b31016

Please sign in to comment.