<commit_before>package system

import autowire.Server
import shared.MapApi
import shared.map.{CrossingDef, RoadDef, RoadMap}
import upickle.Js
import upickle.default._
import shared.geometry._

object ApiImplementation extends MapApi {
  override def test: String = "Takie Ajaxy ktore dzialaja wysmienicie"

  override def map(): RoadMap = {
    val n1 = "raz"
    val n2 = "dwa"
    val cross1 = CrossingDef(n1, 50.0><70.0)
    val cross2 = CrossingDef(n2, 100.0><120.0)
    RoadMap(List(cross1, cross2), List(RoadDef(n1, n2, List.empty)))
  }
}

object MyServer extends Server[Js.Value, Reader, Writer] {

  def read[Result: Reader](p: Js.Value) = upickle.default.readJs[Result](p)

  def write[Result: Writer](r: Result) = upickle.default.writeJs(r)


  //  val routes = MyServer.route[MapApi](ApiImplementation)
}<commit_msg>Better map from server.<commit_after>package system

import java.io.FileInputStream

import autowire.Server
import play.api.libs.json.Json
import shared.MapApi
import shared.map.{CrossingDef, RoadDef, RoadMap}
import upickle.Js
import upickle.default._
import shared.geometry._
import utils.map.json._

object ApiImplementation extends MapApi {
  override def test: String = "Takie Ajaxy ktore dzialaja wysmienicie"

  override def map(): RoadMap = mockMap2

  def mockMap1(): RoadMap = {
    val n1 = "raz"
    val n2 = "dwa"
    val cross1 = CrossingDef(n1, 50.0><70.0)
    val cross2 = CrossingDef(n2, 100.0><120.0)
    RoadMap(List(cross1, cross2), List(RoadDef(n1, n2, List.empty)))
  }

  def mockMap2(): RoadMap = Json.parse(new FileInputStream("map.json")).as[RoadMap]
}

object MyServer extends Server[Js.Value, Reader, Writer] {

  def read[Result: Reader](p: Js.Value) = upickle.default.readJs[Result](p)

  def write[Result: Writer](r: Result) = upickle.default.writeJs(r)


  //  val routes = MyServer.route[MapApi](ApiImplementation)
}
{'fraction_non_alphanumeric': 0.12513312034078808, 'fraction_numerical': 0.027156549520766772, 'mean_word_length': 4.510263929618769, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5204829', 'n_tokens_mistral': 704, 'n_tokens_neox': 662, 'n_words': 160}