Created
February 14, 2013 15:12
-
-
Save RCura/4953443 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def createColumnNamesList(): List[String] = | |
| { | |
| val columnsToAdd = new ListBuffer[String] | |
| val tmpXCol = mappedVar.get("X") match { | |
| case Some(x: String) ⇒ x | |
| case _ ⇒ "" | |
| } | |
| if (tmpXCol != "") { | |
| columnsToAdd += tmpXCol | |
| } | |
| val tmpYCol = mappedVar.get("Y") match { | |
| case Some(x: String) ⇒ x | |
| case _ ⇒ "" | |
| } | |
| if (tmpYCol != "") { | |
| columnsToAdd += tmpYCol | |
| } | |
| val tmpColumnsToAdd = new ListBuffer[String] | |
| if (listFiltre.size > 0) { | |
| listFiltre.foreach { v ⇒ | |
| v | |
| tmpColumnsToAdd += v.name.toString | |
| } | |
| tmpColumnsToAdd.distinct.foreach { v ⇒ | |
| v | |
| columnsToAdd += v | |
| } | |
| } | |
| return columnsToAdd.toList | |
| } | |
| def createFiltredColumnMap(): Map[String, Array[Double]] = { | |
| val columnsList = createColumnNamesList() | |
| println("columnsList : " + columnsList.mkString(",")) | |
| val filtredColumnMap = mutable.Map[String, Array[Double]]() | |
| columnsList.foreach { | |
| colname ⇒ | |
| colname | |
| println("colname : " + colname.toString) | |
| val colVariable = getVariableFromColumn(colname.toString) | |
| println("colVariable : " + colVariable.toString) | |
| val colValue = get[Array[Double]](colVariable) match { | |
| case Some(i: Array[Double]) ⇒ i | |
| case None ⇒ throw new UserBadDataError("column type not equal ") | |
| } | |
| println("colValue : " + colValue.toString) | |
| filtredColumnMap.put(colname, colValue) | |
| } | |
| return filtredColumnMap.toMap // Map[nomColonne -> [val1, val2, val3 ...] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment