[Schmitzm-commits] r1840 - trunk/schmitzm-core/src/main/java/de/schmitzm/io

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jan 26 11:57:31 CET 2012


Author: mojays
Date: 2012-01-26 11:57:31 +0100 (Thu, 26 Jan 2012)
New Revision: 1840

Added:
   trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceHashMap.java
   trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceTreeMap.java
   trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceVector.java
Removed:
   trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceSortedMap.java
Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceList.java
   trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceMap.java
Log:
FileSource objects restructured with interface layer

Added: trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceHashMap.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceHashMap.java	2012-01-25 18:26:40 UTC (rev 1839)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceHashMap.java	2012-01-26 10:57:31 UTC (rev 1840)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Martin O. J. Schmitz.
+ * 
+ * This file is part of the LESLIE library.
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License (license.txt)
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ * or try this link: http://www.gnu.org/licenses/lgpl.html
+ * 
+ * Contributors:
+ *     Martin O. J. Schmitz
+ ******************************************************************************/
+
+package de.schmitzm.io;
+
+import java.io.File;
+import java.util.HashMap;
+
+/**
+ * A {@link HashMap} which is based on a source file.
+ * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
+ */
+public class FileSourceHashMap<K,V> extends HashMap<K,V> implements FileSourceMap<K,V> {
+
+  /** Holds the source file. */
+  protected File source = null;
+  
+  /**
+   * Creates a new list without source.
+   */
+  public FileSourceHashMap() {
+    this(null);
+  }
+
+  /**
+   * Creates a new list.
+   */
+  public FileSourceHashMap(File source) {
+    super();
+    this.source = source;
+  }
+  
+  /**
+   * Returns the source file path.
+   */
+  @Override
+  public Object getSource() {
+    return source;
+  }
+
+  /**
+   * Returns the source file.
+   */
+  @Override
+  public File getSourceFile() {
+    return source;
+  }
+
+}

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceList.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceList.java	2012-01-25 18:26:40 UTC (rev 1839)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceList.java	2012-01-26 10:57:31 UTC (rev 1840)
@@ -24,47 +24,11 @@
 
 package de.schmitzm.io;
 
-import java.io.File;
-import java.util.Vector;
+import java.util.List;
 
 /**
- * A {@link Vector} which is based on a source file.
+ * Interface to combine {@link FileSource} and {@link List}.
  * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
  */
-public class FileSourceList<E> extends Vector<E> implements FileSource {
-
-  /** Holds the source file. */
-  protected File source = null;
-  
-  /**
-   * Creates a new list without source.
-   */
-  public FileSourceList() {
-    this(null);
-  }
-
-  /**
-   * Creates a new list.
-   */
-  public FileSourceList(File source) {
-    super();
-    this.source = source;
-  }
-  
-  /**
-   * Returns the source file path.
-   */
-  @Override
-  public Object getSource() {
-    return source;
-  }
-
-  /**
-   * Returns the source file.
-   */
-  @Override
-  public File getSourceFile() {
-    return source;
-  }
-
+public interface FileSourceList<E> extends FileSource, List<E> {
 }

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceMap.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceMap.java	2012-01-25 18:26:40 UTC (rev 1839)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceMap.java	2012-01-26 10:57:31 UTC (rev 1840)
@@ -24,47 +24,11 @@
 
 package de.schmitzm.io;
 
-import java.io.File;
-import java.util.HashMap;
+import java.util.Map;
 
 /**
- * A {@link HashMap} which is based on a source file.
+ * Interface to combine {@link FileSource} and {@link Map}.
  * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
  */
-public class FileSourceMap<K,V> extends HashMap<K,V> implements FileSource {
-
-  /** Holds the source file. */
-  protected File source = null;
-  
-  /**
-   * Creates a new list without source.
-   */
-  public FileSourceMap() {
-    this(null);
-  }
-
-  /**
-   * Creates a new list.
-   */
-  public FileSourceMap(File source) {
-    super();
-    this.source = source;
-  }
-  
-  /**
-   * Returns the source file path.
-   */
-  @Override
-  public Object getSource() {
-    return source;
-  }
-
-  /**
-   * Returns the source file.
-   */
-  @Override
-  public File getSourceFile() {
-    return source;
-  }
-
+public interface FileSourceMap<K,V> extends FileSource, Map<K,V> {
 }

Deleted: trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceSortedMap.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceSortedMap.java	2012-01-25 18:26:40 UTC (rev 1839)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceSortedMap.java	2012-01-26 10:57:31 UTC (rev 1840)
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Martin O. J. Schmitz.
- * 
- * This file is part of the LESLIE library.
- * 
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public License (license.txt)
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- * or try this link: http://www.gnu.org/licenses/lgpl.html
- * 
- * Contributors:
- *     Martin O. J. Schmitz
- ******************************************************************************/
-
-package de.schmitzm.io;
-
-import java.io.File;
-import java.util.TreeMap;
-
-/**
- * A {@link TreeMap} which is based on a source file.
- * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
- */
-public class FileSourceSortedMap<K,V> extends TreeMap<K,V> implements FileSource {
-
-  /** Holds the source file. */
-  protected File source = null;
-  
-  /**
-   * Creates a new list without source.
-   */
-  public FileSourceSortedMap() {
-    this(null);
-  }
-
-  /**
-   * Creates a new list.
-   */
-  public FileSourceSortedMap(File source) {
-    super();
-    this.source = source;
-  }
-  
-  /**
-   * Returns the source file path.
-   */
-  @Override
-  public Object getSource() {
-    return source;
-  }
-
-  /**
-   * Returns the source file.
-   */
-  @Override
-  public File getSourceFile() {
-    return source;
-  }
-
-}

Added: trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceTreeMap.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceTreeMap.java	2012-01-25 18:26:40 UTC (rev 1839)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceTreeMap.java	2012-01-26 10:57:31 UTC (rev 1840)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Martin O. J. Schmitz.
+ * 
+ * This file is part of the LESLIE library.
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License (license.txt)
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ * or try this link: http://www.gnu.org/licenses/lgpl.html
+ * 
+ * Contributors:
+ *     Martin O. J. Schmitz
+ ******************************************************************************/
+
+package de.schmitzm.io;
+
+import java.io.File;
+import java.util.Comparator;
+import java.util.TreeMap;
+
+/**
+ * A {@link TreeMap} which is based on a source file.
+ * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
+ */
+public class FileSourceTreeMap<K,V> extends TreeMap<K,V> implements FileSourceMap<K,V> {
+
+  /** Holds the source file. */
+  protected File source = null;
+  
+  /**
+   * Creates a new list without source.
+   */
+  public FileSourceTreeMap() {
+    this((File)null);
+  }
+
+  /**
+   * Creates a new list.
+   */
+  public FileSourceTreeMap(Comparator<? super K> comparator) {
+    this(comparator,null);
+  }
+
+  /**
+   * Creates a new list.
+   */
+  public FileSourceTreeMap(File source) {
+    super();
+    this.source = source;
+  }
+  
+  /**
+   * Creates a new list.
+   */
+  public FileSourceTreeMap(Comparator<? super K> comparator, File source) {
+    super(comparator);
+    this.source = source;
+  }
+
+  /**
+   * Returns the source file path.
+   */
+  @Override
+  public Object getSource() {
+    return source;
+  }
+
+  /**
+   * Returns the source file.
+   */
+  @Override
+  public File getSourceFile() {
+    return source;
+  }
+
+}

Added: trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceVector.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceVector.java	2012-01-25 18:26:40 UTC (rev 1839)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/io/FileSourceVector.java	2012-01-26 10:57:31 UTC (rev 1840)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Martin O. J. Schmitz.
+ * 
+ * This file is part of the LESLIE library.
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License (license.txt)
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ * or try this link: http://www.gnu.org/licenses/lgpl.html
+ * 
+ * Contributors:
+ *     Martin O. J. Schmitz
+ ******************************************************************************/
+
+package de.schmitzm.io;
+
+import java.io.File;
+import java.util.Vector;
+
+/**
+ * A {@link Vector} which is based on a source file.
+ * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
+ */
+public class FileSourceVector<E> extends Vector<E> implements FileSourceList<E> {
+
+  /** Holds the source file. */
+  protected File source = null;
+  
+  /**
+   * Creates a new list without source.
+   */
+  public FileSourceVector() {
+    this(null);
+  }
+
+  /**
+   * Creates a new list.
+   */
+  public FileSourceVector(File source) {
+    super();
+    this.source = source;
+  }
+  
+  /**
+   * Returns the source file path.
+   */
+  @Override
+  public Object getSource() {
+    return source;
+  }
+
+  /**
+   * Returns the source file.
+   */
+  @Override
+  public File getSourceFile() {
+    return source;
+  }
+
+}



More information about the Schmitzm-commits mailing list