mnemonic-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject incubator-mnemonic git commit: MNEMONIC-243: Using Scala feature to remove redundant getters and setters
Date Mon, 24 Apr 2017 19:09:54 GMT
Repository: incubator-mnemonic
Updated Branches:
  refs/heads/master 954cba610 -> 09fae08b1


MNEMONIC-243: Using Scala feature to remove redundant getters and setters


Project: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/commit/09fae08b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/tree/09fae08b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/diff/09fae08b

Branch: refs/heads/master
Commit: 09fae08b16c90a6fae19593061f876f75573de69
Parents: 954cba6
Author: Wang, Gang(Gary) <gang1.wang@intel.com>
Authored: Mon Apr 24 12:08:57 2017 -0700
Committer: Wang, Gang(Gary) <gang1.wang@intel.com>
Committed: Mon Apr 24 12:08:57 2017 -0700

----------------------------------------------------------------------
 .../mnemonic/spark/MneDurableInputSession.scala |  6 +---
 .../spark/MneDurableOutputSession.scala         | 32 +++++---------------
 .../apache/mnemonic/spark/rdd/DurableRDD.scala  |  2 +-
 3 files changed, 10 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/09fae08b/mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/MneDurableInputSession.scala
----------------------------------------------------------------------
diff --git a/mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/MneDurableInputSession.scala
b/mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/MneDurableInputSession.scala
index d56bddc..d027c52 100644
--- a/mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/MneDurableInputSession.scala
+++ b/mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/MneDurableInputSession.scala
@@ -33,11 +33,7 @@ import org.apache.mnemonic.sessions.SessionIterator
 class MneDurableInputSession[V: ClassTag]
     extends DurableInputSession[V, NonVolatileMemAllocator] {
 
-  private var _flist: Array[File] = null
-
-  def fileList = _flist
-
-  def fileList_=(value: Array[File]): Unit = _flist = value
+  var fileList: Array[File] = null
 
   override def initNextPool(sessiter: SessionIterator[V, NonVolatileMemAllocator]): Boolean
= {
     var ret: Boolean = false

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/09fae08b/mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/MneDurableOutputSession.scala
----------------------------------------------------------------------
diff --git a/mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/MneDurableOutputSession.scala
b/mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/MneDurableOutputSession.scala
index e25f8ce..9a55150 100644
--- a/mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/MneDurableOutputSession.scala
+++ b/mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/MneDurableOutputSession.scala
@@ -33,44 +33,28 @@ import org.apache.mnemonic.sessions.DurableOutputSession
 class MneDurableOutputSession[V: ClassTag]
     extends DurableOutputSession[V, NonVolatileMemAllocator] {
 
-  private var _baseDir: Path = null
-  private var _flist: ArrayBuffer[File] = new ArrayBuffer[File]
-  private var _outputFile: File = null
-  private var _outPrefix: String = null
+  var baseDir: Path = null
+  var fileList: ArrayBuffer[File] = new ArrayBuffer[File]
+  var outputFile: File = null
+  var outputPrefix: String = null
   private var _outidx: Long = 0L
 
-  def baseDir = _baseDir
-
-  def baseDir_=(value: Path): Unit = _baseDir = value
-
-  def fileList = _flist.toArray
-
-  def outputPrefix = _outPrefix
-
-  def outputPrefix_=(value: String): Unit = _outPrefix = value
-
   protected def genNextPoolFile(): File = {
-    val file = new File(baseDir.toFile(), f"${_outPrefix}_${_outidx}%05d.mne")
+    val file = new File(baseDir.toFile(), f"${outputPrefix}_${_outidx}%05d.mne")
     _outidx = _outidx + 1
-    _flist += file
+    fileList += file
     file
   }
 
-  def setOutputFile(file: File): Unit = {
-    _outputFile = file
-  }
-
-  def getOutputFile: File = _outputFile
-
   override def initNextPool(): Boolean = {
     var ret: Boolean = false
     if (null != getAllocator) {
       getAllocator.close();
       setAllocator(null);
     }
-    setOutputFile(genNextPoolFile);
+    outputFile = genNextPoolFile;
     m_act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService(getServiceName),
-      getPoolSize, getOutputFile.toString, true);
+      getPoolSize, outputFile.toString, true);
     if (null != getAllocator) {
       m_newpool = true;
       ret = true;

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/09fae08b/mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/rdd/DurableRDD.scala
----------------------------------------------------------------------
diff --git a/mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/rdd/DurableRDD.scala
b/mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/rdd/DurableRDD.scala
index c77709f..8cdb7be 100644
--- a/mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/rdd/DurableRDD.scala
+++ b/mnemonic-spark/mnemonic-spark-core/src/main/scala/org/apache/mnemonic/spark/rdd/DurableRDD.scala
@@ -63,7 +63,7 @@ class DurableRDD[D: ClassTag, T: ClassTag](
           case None =>
         }
       }
-      _parmap += (split -> outsess.fileList)
+      _parmap += (split -> outsess.fileList.toArray)
     } finally {
       outsess.close()
     }


Mime
View raw message