Skip to content

Commit

Permalink
Graphviz: eliminate duplicate arrows
Browse files Browse the repository at this point in the history
This ensures that at most one arrow is drawn for every source and
destination pair. Duplicate arrows add no information value and only
make the diagram cluttered.

For example, see
https://github.com/kaitai-io/kaitai_struct_formats/blob/e533644618670a3b94be687253b0bf11a051640c/common/bcd.ksy,
which used to generate many duplicate arrows with the same source and
destination. It looks much cleaner now.
  • Loading branch information
generalmimon committed Aug 11, 2024
1 parent bfdd54a commit 3c855b3
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import io.kaitai.struct.languages.components.{LanguageCompiler, LanguageCompiler
import io.kaitai.struct.precompile.CalculateSeqSizes
import io.kaitai.struct.translators.RubyTranslator

import scala.collection.mutable.ListBuffer
import scala.collection.mutable.{ListBuffer, LinkedHashSet}

class GraphvizClassCompiler(classSpecs: ClassSpecs, topClass: ClassSpec) extends AbstractCompiler {
import GraphvizClassCompiler._
Expand All @@ -17,7 +17,7 @@ class GraphvizClassCompiler(classSpecs: ClassSpecs, topClass: ClassSpec) extends

val provider = new ClassTypeProvider(classSpecs, topClass)
val translator = new RubyTranslator(provider)
val links = ListBuffer[(String, String, String)]()
val links = LinkedHashSet[(String, String, String)]()
val extraClusterLines = new StringLanguageOutputWriter(indent)

def nowClass: ClassSpec = provider.nowClass
Expand Down

0 comments on commit 3c855b3

Please sign in to comment.