Skip to content

Commit

Permalink
Update for Kompics 1.1 and some cleanup and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Bathtor committed May 3, 2019
1 parent d7ad76e commit 6d276d3
Show file tree
Hide file tree
Showing 14 changed files with 458 additions and 378 deletions.
32 changes: 32 additions & 0 deletions .scalariform.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#Scalariform formatter preferences
#Thu Jul 12 21:00:44 CEST 2018
singleCasePatternOnNewline=true
newlineAtEndOfFile=true
alignParameters=true
formatXml=true
spaceBeforeContextColon=false
doubleIndentMethodDeclaration=false
doubleIndentConstructorArguments=false
spacesAroundMultiImports=true
spaceInsideBrackets=false
indentWithTabs=false
firstParameterOnNewline=Force
spaceInsideParentheses=false
multilineScaladocCommentsStartOnFirstLine=false
alignSingleLineCaseStatements=true
compactStringConcatenation=false
placeScaladocAsterisksBeneathSecondAsterisk=false
indentPackageBlocks=true
compactControlReadability=false
allowParamGroupsOnNewlines=false
danglingCloseParenthesis=Prevent
spacesWithinPatternBinders=true
alignSingleLineCaseStatements.maxArrowIndent=40
doubleIndentClassDeclaration=false
preserveSpaceBeforeArguments=true
spaceBeforeColon=false
firstArgumentOnNewline=Force
alignArguments=false
rewriteArrowSymbols=false
indentLocalDefs=false
indentSpaces=2
1 change: 1 addition & 0 deletions core/.scalariform.conf
8 changes: 4 additions & 4 deletions core/kompics-scala.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name := "Kompics-Scala"
organization := "se.sics.kompics"


version := "1.0.1"
version := "1.1.0-SNAPSHOT"

scalaVersion := "2.12.8"

Expand All @@ -16,11 +16,11 @@ resolvers += Resolver.mavenLocal
resolvers += Resolver.jcenterRepo
resolvers += Resolver.bintrayRepo("kompics", "Maven")

libraryDependencies += "se.sics.kompics" % "kompics-core" % "1.0.+"
libraryDependencies += "se.sics.kompics" % "kompics-core" % "1.1.0-SNAPSHOT"
libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.9.+"
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value
libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.+"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.+" % "test"
libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.5"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.5" % "test"
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.+" % "test"

parallelExecution in Test := false
Expand Down
2 changes: 2 additions & 0 deletions core/project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.4")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9")

addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.4")

addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2")
2 changes: 1 addition & 1 deletion core/src/main/scala/se/sics/kompics/sl/NegativePort.scala
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class NegativeWrapper[P <: PortType](original: PortCore[P]) extends NegativePort
throw new ConfigurationException("Can't use closure based handlers on non ScalaPort");
}

override def doSubscribe(handler: se.sics.kompics.MatchedHandler[PT, V, E] forSome { type PT; type V; type E <: se.sics.kompics.PatternExtractor[PT, _ >: V] }) {
override def doSubscribe(handler: se.sics.kompics.MatchedHandler[_, _, _]): Unit = {
original.doSubscribe(handler);
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/se/sics/kompics/sl/PositivePort.scala
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class PositiveWrapper[P <: PortType](original: PortCore[P]) extends PositivePort
original.enqueue(event);
}

override def doSubscribe(handler: se.sics.kompics.MatchedHandler[PT, V, E] forSome { type PT; type V; type E <: se.sics.kompics.PatternExtractor[PT, _ >: V] }) {
override def doSubscribe(handler: se.sics.kompics.MatchedHandler[_, _, _]): Unit = {
original.doSubscribe(handler);
}

Expand Down
7 changes: 6 additions & 1 deletion core/src/main/scala/se/sics/kompics/sl/ScalaPort.scala
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ class ScalaPort[P <: PortType](positive: Boolean, pType: P, parent: ComponentCor
doSubscribe(closureHandler);
}

override def doSubscribe(handler: se.sics.kompics.MatchedHandler[PT, V, E] forSome { type PT; type V; type E <: se.sics.kompics.PatternExtractor[PT, _ >: V] }) {
/**
* This method has no implementation in Scala!
*
* Use pattern matching instead!
*/
override def doSubscribe(handler: se.sics.kompics.MatchedHandler[_, _, _]): Unit = {
throw new ConfigurationException("Can not use se.sics.kompics.MatchedHandler in ScalaPort! Use Scala's pattern matching instead.");
}

Expand Down
25 changes: 21 additions & 4 deletions core/src/test/scala/se/sics/kompics/MatcherTestScala.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
/*
* This file is part of the Kompics component model runtime.
*
* Copyright (C) 2009 Swedish Institute of Computer Science (SICS)
* Copyright (C) 2009 Royal Institute of Technology (KTH)
*
* Kompics is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package se.sics.kompics

import org.scalatest._

import se.sics.kompics.KompicsEvent
import se.sics.kompics.Kompics

class MatcherTestScala extends sl.KompicsUnitSuite {
import sl.KompicsUnitSuite._

Expand Down Expand Up @@ -59,7 +76,7 @@ class DataParent extends ComponentDefinition with sl.EventTester {
val dp = requires(classOf[DataPort]);

val child = create(classOf[DataChild], Init.NONE);
connect(dp.getPair(), child.getPositive(classOf[DataPort]));
connect(dp.getPair(), child.getPositive(classOf[DataPort]), Channel.TWO_WAY);

val dataHandler = new ClassMatchedHandler[CData, DataContainer]() {

Expand Down
Loading

0 comments on commit 6d276d3

Please sign in to comment.