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
| case class Dni(src: String, parsed: String) { | |
| override def equals(obj: scala.Any): Boolean = obj match { | |
| case dni: Dni => dni.src == src || dni.parsed == parsed | |
| case dni: String => dni == src || dni == parsed | |
| case _ => false | |
| } | |
| override def toString: String = src | |
| } |
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
| /* Data definition */ | |
| trait DocumentInfo { | |
| val title: String | |
| } | |
| case class D1(title: String, content: String) extends DocumentInfo | |
| case class D2(title: String, count: Int) extends DocumentInfo | |
| /* -------------- */ | |
| /* Type Class */ |
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
| import java.awt.Dimension | |
| import java.awt.event.MouseAdapter | |
| import java.awt.event.MouseEvent | |
| import javax.swing.JFrame | |
| import scala.collection.immutable | |
| import scala.concurrent.duration._ | |
| import akka.actor._ | |
| import akka.stream._ |
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
| import scala.util._ | |
| import akka.actor._ | |
| import akka.stream._ | |
| import akka.stream.scaladsl._ | |
| import akka.util._ | |
| object SimpleTcpServer extends App { | |
| val address = "127.0.0.1" |
OlderNewer