Skip to content

Commit

Permalink
Update sbt/scala/scalacheck/scalatest deps
Browse files Browse the repository at this point in the history
  • Loading branch information
mdr committed Jan 25, 2017
1 parent 361d759 commit 61fb705
Show file tree
Hide file tree
Showing 40 changed files with 180 additions and 194 deletions.
12 changes: 6 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ organization := "com.github.mdr"

version := "0.0.6"

scalaVersion := "2.10.1"
scalaVersion := "2.12.1"

crossScalaVersions := Seq("2.9.1", "2.9.2", "2.10.1")

scalacOptions ++= Seq("-deprecation")

javacOptions ++= Seq("-source", "1.6", "-target", "1.6")

libraryDependencies += "org.scalatest" %% "scalatest" % "1.9.1" % "test"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"

libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.10.1" % "test"
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.13.4" % "test"

// Screen-sized dependency graph:
// libraryDependencies += "org.vert-x" % "vertx-core" % "1.3.1.final"
Expand All @@ -23,12 +23,12 @@ EclipseKeys.withSource := true

EclipseKeys.eclipseOutput := Some("bin")

net.virtualvoid.sbt.graph.Plugin.graphSettings
//net.virtualvoid.sbt.graph.Plugin.graphSettings

scalariformSettings
import com.typesafe.sbt.SbtScalariform.ScalariformKeys

ScalariformKeys.preferences <<= baseDirectory.apply { dir =>
scalariform.formatter.preferences.PreferencesImporterExporter.loadPreferences((dir / "formatterPreferences.properties").getPath)
scalariform.formatter.preferences.PreferencesImporterExporter.loadPreferences((dir / "formatterPreferences.properties").getPath)
}

publishMavenStyle := true
Expand Down
3 changes: 2 additions & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
sbt.version=0.12.3
sbt.version=0.13.13

9 changes: 4 additions & 5 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.2.0")

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.3")

// addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4-SNAPSHOT")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.2")

addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8")

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.4.0")
resolvers += Resolver.typesafeRepo("releases")

addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.0.1")
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.mdr.ascii.java

import java.{ util ju }
import java.{util ju}
import scala.collection.JavaConverters._
import com.github.mdr.ascii.graph.Graph
import com.github.mdr.ascii.layout.GraphLayout
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/com/github/mdr/ascii/diagram/Box.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ trait Box extends Container {
edge edges
if edgeType.includeEdge(edge, this)
otherBox = edge.otherBox(this)
} yield edge -> otherBox
} yield edge otherBox

}
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,13 @@ trait DiagramImplementation { self: DiagramParser ⇒
Region(
Point(
points.map(_.row).min,
points.map(_.column).min),
points.map(_.column).min
),
Point(
points.map(_.row).max,
points.map(_.column).max))
points.map(_.column).max
)
)

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DiagramParser(s: String)
innerBox diagram.allBoxes
if outerBox != innerBox
if outerBox.region contains innerBox.region
} yield outerBox -> innerBox).toMap
} yield outerBox innerBox).toMap

for {
(box, containingBoxMap) boxContains.groupBy(_._2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ object DiagramToGraphConvertor {
vertex2 boxToVertexMap.get(edge.box2)
} yield {
if (edge.hasArrow2)
vertex1 -> vertex2
vertex1 vertex2
else
vertex2 -> vertex1
vertex2 vertex1
}
Graph(vertices, edges)
}
Expand Down
9 changes: 2 additions & 7 deletions src/main/scala/com/github/mdr/ascii/layout/GraphLayout.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ object GraphLayout {
def renderGraph[V](
graph: Graph[V],
vertexRenderingStrategy: VertexRenderingStrategy[V] = ToStringVertexRenderingStrategy,
layoutPrefs: LayoutPrefs = LayoutPrefsImpl()): String = {
layoutPrefs: LayoutPrefs = LayoutPrefsImpl()
): String = {
val cycleRemovalResult = CycleRemover.removeCycles(graph)
val (layering, _) = new LayeringCalculator[V].assignLayers(cycleRemovalResult)
val reorderedLayering = LayerOrderingCalculator.reorder(layering)
Expand All @@ -30,12 +31,6 @@ object GraphLayout {
drawing = KinkRemover.removeKinks(drawing)
if (layoutPrefs.elevateEdges)
drawing = EdgeElevator.elevateEdges(drawing)

// if (layoutPrefs.removeKinks)
// drawing = KinkRemover.removeKinks(drawing)
// if (layoutPrefs.elevateEdges)
// drawing = EdgeElevator.elevateEdges(drawing)
//
if (layoutPrefs.compactify)
drawing = RedundantRowRemover.removeRedundantRows(drawing)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ class EdgeBendCalculator(edgeInfos: List[EdgeInfo], edgeZoneTopRow: Int, selfEdg
if row1 > row2
if !swappedEdges.contains((edgeInfo1, edgeInfo2)) // Prevents more involved infinite loops
} {
updatedEdgeToRowMap += edgeInfo1 -> row2
updatedEdgeToRowMap += edgeInfo2 -> row1
updatedEdgeToRowMap += edgeInfo1 row2
updatedEdgeToRowMap += edgeInfo2 row1
swappedEdges += ((edgeInfo1, edgeInfo2))
continue = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Layouter(vertexRenderingStrategy: VertexRenderingStrategy[_], vertical: Bo
var layerInfos: Map[Layer, LayerInfo] = Map()
for ((previousLayerOpt, currentLayer, nextLayerOpt) Utils.withPreviousAndNext(layering.layers)) {
val layerInfo = calculateLayerInfo(currentLayer, layering.edges, previousLayerOpt, nextLayerOpt)
layerInfos += currentLayer -> layerInfo
layerInfos += currentLayer layerInfo
}
PortNudger.nudge(layering, spaceVertices(layerInfos))
}
Expand Down Expand Up @@ -99,8 +99,8 @@ class Layouter(vertexRenderingStrategy: VertexRenderingStrategy[_], vertical: Bo
private def makeVertexInfo(vertex: DummyVertex, boxRegion: Region, greaterRegion: Region, inEdges: List[Edge], outEdges: List[Edge]): VertexInfo = {
val (List(inVertex), List(outVertex)) = (inEdges, outEdges)
val port = boxRegion.topLeft
val inEdgeToPortMap = Map(inVertex -> port)
val outEdgeToPortMap = Map(outVertex -> port)
val inEdgeToPortMap = Map(inVertex port)
val outEdgeToPortMap = Map(outVertex port)
VertexInfo(boxRegion, greaterRegion, inEdgeToPortMap, outEdgeToPortMap, Nil, Nil)
}

Expand Down Expand Up @@ -164,7 +164,7 @@ class Layouter(vertexRenderingStrategy: VertexRenderingStrategy[_], vertical: Bo
case _ 0
}
val greaterRegion = boxRegion.expandRight(selfEdgesSpacing).expandUp(selfEdgesSpacing).expandDown(selfEdgesSpacing)
regions += vertex -> (boxRegion, greaterRegion)
regions += vertex (boxRegion, greaterRegion)
nextVertexTopLeft = boxRegion.topRight.right(selfEdgesSpacing + 2)
}
regions
Expand All @@ -185,7 +185,7 @@ class Layouter(vertexRenderingStrategy: VertexRenderingStrategy[_], vertical: Bo

private def spaceVertices(layerInfos: Map[Layer, LayerInfo]): Map[Layer, LayerInfo] = {
val diagramWidth = calculateDiagramWidth(layerInfos)
layerInfos.map { case (layer, info) layer -> spaceVertices(layer, info, diagramWidth) }
layerInfos.map { case (layer, info) layer spaceVertices(layer, info, diagramWidth) }
}

/**
Expand All @@ -209,15 +209,16 @@ class Layouter(vertexRenderingStrategy: VertexRenderingStrategy[_], vertical: Bo
leftColumn += vertexInfo.greaterRegion.width
leftColumn += horizontalSpacing
val verticalCenteringOffset = (layerHeight - vertexInfo.boxRegion.height) / 2
v -> vertexInfo.setLeft(oldLeftColumn).down(verticalCenteringOffset)
v vertexInfo.setLeft(oldLeftColumn).down(verticalCenteringOffset)
}
LayerInfo(newVertexInfos.toMap)
}

private case class LayerLayoutResult(
drawingElements: List[DrawingElement],
layerInfo: LayerInfo,
updatedIncompletedEdges: Map[DummyVertex, List[Point]])
updatedIncompletedEdges: Map[DummyVertex, List[Point]]
)

/**
* 1) Decide the (vertical) order of edges coming into the currentLayer -- that is, what row they bend on (if required)
Expand All @@ -233,7 +234,8 @@ class Layouter(vertexRenderingStrategy: VertexRenderingStrategy[_], vertical: Bo
previousLayerInfo: LayerInfo,
currentLayerInfo: LayerInfo,
edges: List[Edge],
incompleteEdges: Map[DummyVertex, List[Point]]): LayerLayoutResult = {
incompleteEdges: Map[DummyVertex, List[Point]]
): LayerLayoutResult = {

val edgeInfos: List[EdgeInfo] = makeEdgeInfos(edges, previousLayerInfo, currentLayerInfo)

Expand All @@ -245,7 +247,7 @@ class Layouter(vertexRenderingStrategy: VertexRenderingStrategy[_], vertical: Bo

val updatedIncompleteEdges: Map[DummyVertex, List[Point]] =
for ((EdgeInfo(_, finishVertex: DummyVertex, _, _, _), points) edgeInfoToPoints)
yield finishVertex -> points
yield finishVertex points

val updatedLayerInfo = currentLayerInfo.down(edgeBendCalculator.edgeZoneBottomRow + 1)

Expand Down Expand Up @@ -317,7 +319,7 @@ class Layouter(vertexRenderingStrategy: VertexRenderingStrategy[_], vertical: Bo
val p4 = p3.up(vertexInfo.boxRegion.height + 2 * (selfEdgeIndex + 1) + 1)
val p5 = p4.left(p4.column - inPort.column)
val p6 = inPort.up(1)
EdgeDrawingElement(List(p1, p2, p3, p4, p5, p6), false, true)
EdgeDrawingElement(List(p1, p2, p3, p4, p5, p6), hasArrow1 = false, hasArrow2 = true)
}

private def makeVertexElements(layerInfo: LayerInfo): List[VertexDrawingElement] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object PortNudger {
val previousLayerInfoOpt = previousLayerOpt.map(updatedLayerInfos)
val currentLayerInfo = layerInfos(currentLayer)
val updatedLayerInfo = nudgeLayer(previousLayerInfoOpt, currentLayerInfo)
updatedLayerInfos += currentLayer -> updatedLayerInfo
updatedLayerInfos += currentLayer updatedLayerInfo
}
updatedLayerInfos
}
Expand All @@ -53,7 +53,7 @@ object PortNudger {

val newVertexInfos = currentLayerInfo.vertexInfos.map {
case (vertex, vertexInfo)
vertex -> nudgeVertexInfo(vertex, vertexInfo, previousLayerInfoOpt, previousEdgeColumns)
vertex nudgeVertexInfo(vertex, vertexInfo, previousLayerInfoOpt, previousEdgeColumns)
}
currentLayerInfo.copy(vertexInfos = newVertexInfos)
}
Expand All @@ -67,14 +67,14 @@ object PortNudger {
val newInEdgeToPortMap = vertexInfo.inEdgeToPortMap.map {
case (edge, port) if shouldNudge(edge, port)
nudgedColumns += port.column
edge -> port.right
edge port.right
case pair pair
}

// We need to also nudge the out ports for dummy vertices we nudged earlier
val newOutEdgeToPortMap = vertex match {
case _: DummyVertex vertexInfo.outEdgeToPortMap.map {
case (edge, port) if nudgedColumns contains port.column edge -> port.right
case (edge, port) if nudgedColumns contains port.column edge port.right
case pair pair
}
case _: RealVertex vertexInfo.outEdgeToPortMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ case class VertexInfo(
inEdgeToPortMap: Map[Edge, Point],
outEdgeToPortMap: Map[Edge, Point],
selfInPorts: List[Point],
selfOutPorts: List[Point])
selfOutPorts: List[Point]
)
extends Translatable[VertexInfo] {

/**
Expand All @@ -35,7 +36,8 @@ case class VertexInfo(
Utils.transformValues(inEdgeToPortMap)(_.translate(down, right)),
Utils.transformValues(outEdgeToPortMap)(_.translate(down, right)),
selfInPorts.map(_.translate(down, right)),
selfOutPorts.map(_.translate(down, right)))
selfOutPorts.map(_.translate(down, right))
)

def setLeft(column: Int): VertexInfo = translate(right = column - boxRegion.leftColumn)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ class CycleRemovalInfo[V](graph: Graph[V]) {
}

private def addVertexToDegreeDiffMaps(v: V, degreeDiff: Int) = {
degreeDiffToVertices += degreeDiff -> (v :: degreeDiffToVertices.getOrElse(degreeDiff, Nil))
verticesToDegreeDiff += v -> degreeDiff
degreeDiffToVertices += degreeDiff (v :: degreeDiffToVertices.getOrElse(degreeDiff, Nil))
verticesToDegreeDiff += v degreeDiff
}

private def removeVertexFromDegreeDiffMaps(v: V): Int = {
Expand All @@ -79,7 +79,7 @@ class CycleRemovalInfo[V](graph: Graph[V]) {
if (updatedVertices.isEmpty)
degreeDiffToVertices -= degreeDiff
else
degreeDiffToVertices += degreeDiff -> updatedVertices
degreeDiffToVertices += degreeDiff updatedVertices
verticesToDegreeDiff -= v
degreeDiff
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ case class VertexDrawingElement(region: Region, textLines: List[String])
case class EdgeDrawingElement(
bendPoints: List[Point],
hasArrow1: Boolean,
hasArrow2: Boolean)
hasArrow2: Boolean
)
extends DrawingElement with Translatable[EdgeDrawingElement] with Transposable[EdgeDrawingElement] {

lazy val points: List[Point] = segments.flatMap(_.points).distinct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object EdgeElevator {
for {
segmentInfo segmentInfos.sortBy(_.row)
updatedEdgeSegment elevate(segmentInfo, edgeTracker)
} segmentUpdates = addToMultimap(segmentUpdates, segmentInfo.edgeElement, segmentInfo.segment2 -> updatedEdgeSegment)
} segmentUpdates = addToMultimap(segmentUpdates, segmentInfo.edgeElement, segmentInfo.segment2 updatedEdgeSegment)

for ((edge, updates) segmentUpdates)
currentDrawing = currentDrawing.replaceElement(edge, updateEdge(edge, updates))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ package com.github.mdr.ascii.layout.drawing
* v
*/
case class EdgeSegmentInfo(
edgeElement: EdgeDrawingElement, segment1: EdgeSegment, segment2: EdgeSegment, segment3: EdgeSegment) {
edgeElement: EdgeDrawingElement, segment1: EdgeSegment, segment2: EdgeSegment, segment3: EdgeSegment
) {

def row = segment2.start.row

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ object KinkRemover {
for {
edgeElement drawing.edgeElements
newEdgeElement removeKink(edgeElement, drawing, edgeTracker)
} return Some(edgeElement -> newEdgeElement)
} return Some(edgeElement newEdgeElement)
None
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class LayeringCalculator[V] {
if (count == 1)
revEdges -= graphEdge
else
revEdges += graphEdge -> (count - 1)
revEdges += graphEdge (count - 1)
true
case None
false
Expand All @@ -83,7 +83,7 @@ class LayeringCalculator[V] {
private def makeRealVertices(cycleRemovalResult: CycleRemovalResult[V]): Map[V, RealVertex] =
cycleRemovalResult.dag.vertices.map { v
val selfEdges = cycleRemovalResult.countSelfEdges(v)
v -> new RealVertex(v, selfEdges)
v new RealVertex(v, selfEdges)
}.toMap

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object LongestDistancesToSinkCalculator {
/**
* The current known longest distances to a sink.
*/
var distances: Map[V, Int] = graph.vertices.map(_ -> 0).toMap
var distances: Map[V, Int] = graph.vertices.map(_ 0).toMap

var boundary = finalisedVertices

Expand All @@ -31,7 +31,7 @@ object LongestDistancesToSinkCalculator {
v1 graph.inVertices(v2)
} {
val newDistance = math.max(distances(v1), distances(v2) + 1)
distances += v1 -> newDistance
distances += v1 newDistance
if (graph.outVertices(v1).forall(finalisedVertices)) {
finalisedVertices += v1
newBoundary += v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ case class LayoutPrefsImpl(
unicode: Boolean = true,
doubleVertices: Boolean = false,
rounded: Boolean = false, // Typical Windows fonts don't render bend characters correctly
explicitAsciiBends: Boolean = false)
explicitAsciiBends: Boolean = false
)
extends LayoutPrefs
3 changes: 2 additions & 1 deletion src/main/scala/com/github/mdr/ascii/util/QuadTree.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class QuadTree[T <: HasRegion](dimension: Dimension) {
}

private case class QuadNode(
region: Region, items: Set[T], topLeft: Node, topRight: Node, bottomLeft: Node, bottomRight: Node)
region: Region, items: Set[T], topLeft: Node, topRight: Node, bottomLeft: Node, bottomRight: Node
)
extends Node {

override def childNodes: List[Node] = List(topLeft, topRight, bottomLeft, bottomRight)
Expand Down
Loading

0 comments on commit 61fb705

Please sign in to comment.