Przeglądaj źródła

Check access modifiers, remove redundant methods

Robin Maisch 4 lat temu
rodzic
commit
2180e2a542

+ 4 - 5
jplag.frontend.scala/src/main/scala/de/jplag/scala/Parser.scala

@@ -30,7 +30,7 @@ class Parser extends AbstractParser {
          * @param after opt. token type to insert at the end of the tree
          * @param traverse custom method of traversing the tree
          */
-        case class TR(before: Option[ScalaTokenConstants.Value] = None,
+        private case class TR(before: Option[ScalaTokenConstants.Value] = None,
                       after: Option[ScalaTokenConstants.Value] = None,
                       traverse: Tree => Unit = _.children.foreach(traverser.apply)
                      )
@@ -252,7 +252,7 @@ class Parser extends AbstractParser {
          * @param els a sequence of values, Trees or Lists
          * @tparam T the type of elements
          */
-        def applyRecursively[T](els: Seq[T]): Unit = els.foreach {
+        private def applyRecursively[T](els: Seq[T]): Unit = els.foreach {
             case tree: Tree => apply(tree)
             case treeList: List[_] => applyRecursively(treeList)
             case _ =>
@@ -281,7 +281,7 @@ class Parser extends AbstractParser {
          *                   @param doApply if true, the substructure of each element is traversed
          * @tparam T list may contain more lists or leaves
          */
-        def assignRecursively[T](els: List[T], tokenType: ScalaTokenConstants.Value, doApply: Boolean = false): Unit = els.foreach {
+        private def assignRecursively[T](els: List[T], tokenType: ScalaTokenConstants.Value, doApply: Boolean = false): Unit = els.foreach {
             case treeList: List[_] => assignRecursively(treeList, tokenType)
             case el: Tree =>
                 add(tokenType, el, fromEnd = false)
@@ -295,7 +295,7 @@ class Parser extends AbstractParser {
          * @param tree Tree to enclose and traverse
          * @param record contains token types
          */
-        def encloseAndApply(tree: Tree, record: TR): Unit = {
+        private def encloseAndApply(tree: Tree, record: TR): Unit = {
             record.before match {
                 case Some(value) => add(value, tree, fromEnd = false)
                 case None =>
@@ -310,7 +310,6 @@ class Parser extends AbstractParser {
         }
     }
 
-
     def parse(dir: File, files: Array[String]): TokenList = {
         tokens = new TokenList
         errors = 0

+ 0 - 14
jplag.frontend.scala/src/main/scala/de/jplag/scala/ScalaToken.scala

@@ -29,20 +29,6 @@ class ScalaToken(tType: Int,
         }
     }
 
-    override def setLine(line: Int): Unit = this.line = line
-
-    override def setColumn(column: Int): Unit = this.column = column
-
-    override def setLength(length: Int): Unit = this.length = length
-
-    override def getLine: Int = this.line
-
-    override def getColumn: Int = this.column
-
-    override def getLength: Int = this.length
-
-    def numberOfTokens: Int = ScalaTokenConstants.maxId
-
     /**
      * @return a string representation depending on the type of the token.
      */