instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
/* * Copyright (c) 2009-2010 European Molecular Biology Laboratory * * This program 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 3 of the License, or * (at your option) any later versio...
Explain and rewrite the following Scala code:
package org.brijest.storm.engine class Client(engine: Engine, ui: UI) { def awaitTermination() = engine.awaitTermination() }
Explain and rewrite the following Scala code:
package com.rumblesan.scalaexperiments.scalaztypes.rwsmonad import scalaz._, Scalaz._ case class Config(number: Int) object ReaderWriterStateExample { type MyState = List[Int] type MyLog = List[String] def getConfigNumber(value: Int): ReaderWriterState[Config, MyLog, MyState, Int] = ReaderWriterState { ...
Explain and rewrite the following Scala code:
/* sbt -- Simple Build Tool * Copyright 2009 Mark Harrah */ package xsbt.datatype sealed trait Definition extends NotNull { val name: String } final class ClassDef(val name: String, val parent: Option[ClassDef], val members: Seq[MemberDef], val isAbstract: Boolean) extends Definition { def allMembers = members ...
Explain and rewrite the following Scala code:
package teststate.core import japgolly.microlibs.name_fn._ import teststate.core.NamedOps.ToOps._ import teststate.data._ import teststate.typeclass.Conditional.Implicits._ import teststate.typeclass.Display.ToOps._ import teststate.typeclass.Profunctor.ToOps._ import teststate.typeclass._ import teststate.{core => ^}...
Explain and rewrite the following Scala code:
/** * Licensed to Gravity.com under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. Gravity.com licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this fil...
Explain and rewrite the following Scala code:
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Explain and rewrite the following Scala code:
package one.niu.outcome.dag import java.nio.ByteBuffer import scala.collection.mutable /** * Created by ericfalk on 16/01/2017. */ class Node(val isRoot: Boolean = true, val isLeaf:Boolean = false, val level: Int, val symbol: ByteBuffer){ val parents : mutable.HashMap[ByteBuffer,Node] = mutable.HashMap.empty[B...
Explain and rewrite the following Scala code:
package jp.co.cyberagent.aeromock.server.http.error import java.io.{PrintWriter, StringWriter} import java.util.Locale import io.netty.handler.codec.http.HttpResponseStatus import jp.co.cyberagent.aeromock._ import jp.co.cyberagent.aeromock.config.MessageManager import org.yaml.snakeyaml.error.YAMLException import jp...
Explain and rewrite the following Scala code:
package com.htc.studio.example.wordcount import scala.util.Random import com.twitter.scalding.Args import com.twitter.summingbird.storm.Storm import com.htc.studio.summingbird.storm.HTCStormJob /** * The demo word count job. The source is a generator that emits random words * every second. * * @author Zhongyang...
Explain and rewrite the following Scala code:
package com.github.j5ik2o.forseti.adaptor.validator import java.net.URI import java.time.ZonedDateTime import java.util.UUID import com.github.j5ik2o.forseti.adaptor.handler.flow.code.AuthorizationCodeRequest import com.github.j5ik2o.forseti.domain._ import com.github.j5ik2o.forseti.domain.client._ import com.github....
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala.lang.psi import com.intellij.openapi.application.{ApplicationManager, ApplicationAdapter} import com.intellij.psi._ import com.intellij.psi.util.PsiTreeUtil import org.jetbrains.plugins.scala.annotator.intention.ScalaImportTypeFix import org.jetbrains.plugins.scala.extensions._ impo...
Explain and rewrite the following Scala code:
package geometry.areas import org.salgo.geometry.areas.Shoelace import org.salgo.geometry.structures.Point2D import org.scalatest.{FunSuite, Matchers} class ShoelaceSpec extends FunSuite with Matchers { test("Empty points") { Shoelace.calculateArea(Seq.empty[Point2D]) shouldEqual 0.0} test("Single point") { Shoel...
Explain and rewrite the following Scala code:
package nn import java.nio.file.Files.exists import java.nio.file.Paths.get /** * Created by nm on 08/02/17. */ package object conv { /* Types and data structures */ case class Tile(kernels_per_group: Int = 0, els_per_thread: Int = 0, inputTileSize: Int = 0, ...
Explain and rewrite the following Scala code:
package models.user import play.api.libs.json.Json case class LoginResult(successful: Boolean, customerId: Option[Long]) object LoginResult { implicit val jsonReads = Json.reads[LoginResult] }
Explain and rewrite the following Scala code:
package di class HelloWorldMessageProvider extends MessageProvider { override def getMessage: String = { "Hello World!" } }
Explain and rewrite the following Scala code:
package com.enkidu.lignum.parsers.ast.expression.types.templates import com.enkidu.lignum.parsers.ast.expression.types.annotations.Annotation import com.enkidu.lignum.parsers.ast.expression.types.references.ReferenceType case class AnyBaseClassTemplate(annotations: Seq[Annotation], bound: ReferenceType) extends Bound...
Explain and rewrite the following Scala code:
package querious import fastparse.core.Parsed import fastparse.core.Parsed.Success import hedgehog._ import hedgehog.runner._ /** * @author Kevin Lee * @since 2017-07-22 */ object BooleanPredicateParserSpec extends Properties { override def tests: List[Test] = List( property( """Parsers.booleanPred...
Explain and rewrite the following Scala code:
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Explain and rewrite the following Scala code:
/* * PriorityQueue.scala * (FScape) * * Copyright (c) 2001-2022 Hanns Holger Rutz. All rights reserved. * * This software is published under the GNU Affero General Public License v3+ * * * For further information, please contact Hanns Holger Rutz at * contact@sciss.de */ package de.sciss.fscape packag...
Explain and rewrite the following Scala code:
/* * Copyright 2001-2013 Artima, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agre...
Explain and rewrite the following Scala code:
package org.monalang.monac.common.util object OptionUtils { /** * Perform an action that may throw an exception and wrap the result in an Option * * @param action An action that returns a result * @return None if the action threw an exception, Some(resultOfAction) otherwise */ def fromAction[A](act...
Explain and rewrite the following Scala code:
package io.finch import cats.Id import com.twitter.finagle.http.Status import com.twitter.io.Buf import java.nio.charset.{Charset, StandardCharsets} import scala.util.{Failure, Success, Try} class OutputSpec extends FinchSpec { behavior of "Output" it should "propagate status to response" in { check { o: Ou...
Explain and rewrite the following Scala code:
package frmr.scyig.db import java.util.UUID import net.liftweb.common._ import slick.jdbc.MySQLProfile.api._ trait Scheduleable { def round: Int } case class Match( id: Option[Int], competitionId: Int, prosecutionTeamId: Int, defenseTeamId: Int, presidingJudgeId: Int, scoringJudgeId: Int, round: Int,...
Explain and rewrite the following Scala code:
package io.github.katrix.katlib.serializer import java.lang.{Byte => JByte, Double => JDouble, Float => JFloat, Integer => JInt, Long => JLong, Short => JShort} import java.util import scala.collection.JavaConverters._ import scala.util.{Failure, Success, Try} import org.apache.commons.lang3.math.NumberUtils import...
Explain and rewrite the following Scala code:
/* * Copyright 2022 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
Explain and rewrite the following Scala code:
package geotrellis.config case class Attributes(tileType: TileType, ingestType: IngestType)
Explain and rewrite the following Scala code:
/* * @author Philip Stutz * * Copyright 2011 University of Zurich * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * U...
Explain and rewrite the following Scala code:
package is.hail.io.plink import is.hail.annotations.{Region, RegionValueBuilder} import is.hail.expr.JSONAnnotationImpex import is.hail.expr.ir._ import is.hail.expr.ir.lowering.TableStage import is.hail.types._ import is.hail.types.physical.{PBoolean, PCanonicalArray, PCanonicalCall, PCanonicalLocus, PCanonicalString...
Explain and rewrite the following Scala code:
package com.seanshubin.concurrency.samples.statemachine import java.io._ import java.nio.charset.Charset import scala.annotation.tailrec object IoUtil { @tailrec def feedInputStreamToOutputStream(inputStream: InputStream, outputStream: OutputStream): Unit = { val byte = inputStream.read() if (byte != -1)...
Explain and rewrite the following Scala code:
package se.blea.flexiconf /** Base trait for argument types */ sealed trait ArgumentKind[T] { /** Returns true if the value meets the criteria for this type */ def accepts(value: String): Boolean /** Returns the native value for the provided value */ def valueOf(value: String): ArgumentValue /** Returns a...
Explain and rewrite the following Scala code:
package actors import scala.language.{ postfixOps } import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.{ Await, Future } import scala.concurrent.duration._ import services.scala.{ Item, ItemService } import akka.actor._ import akka.pattern.ask import akka.util.Timeout import actors.ItemS...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2020 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and...
Explain and rewrite the following Scala code:
import scala.quoted.* def qqq(s: String)(using Quotes): Expr[Unit] = '{()} inline val InlineVal = "i" inline def InlineDef = "i" inline def withInlineVal = ${ qqq(InlineVal) } inline def withInlineDef = ${ qqq(InlineDef) } // error inline def withString = ${ qqq("i") }
Explain and rewrite the following Scala code:
package com.ubirch.util.neo4j.utils import com.typesafe.scalalogging.slf4j.StrictLogging import org.joda.time.DateTime import org.neo4j.driver.v1.Value /** * author: cvandrei * since: 2018-08-08 */ object Neo4jParseUtil extends StrictLogging { def asType[T](value: Value, field: String): T = { val value...
Explain and rewrite the following Scala code:
object Test { val f = 0; ({ toString; (x: Any) => x})("$f ") }
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
Explain and rewrite the following Scala code:
package sbt package appmacro import scala.reflect._ import macros._ import scala.tools.nsc.Global import ContextUtil.{ DynamicDependencyError, DynamicReferenceError } object ContextUtil { final val DynamicDependencyError = "Illegal dynamic dependency" final val DynamicReferenceError = "Illegal dynamic reference" ...
Explain and rewrite the following Scala code:
package core object Keys { private[this] val maxPlayerCount = 4 // zone keys val deck = 0 val hand = deck + maxPlayerCount val played = hand + maxPlayerCount val discard = played + maxPlayerCount val trash = discard + 1 // stat keys val playerCount = 0 val activePlayerIndex = playerCount + 1 v...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package lang package psi package impl package base package patterns import org.jetbrains.plugins.scala.lang.psi.api.base.patterns._ import org.jetbrains.plugins.scala.lang.psi.ScalaPsiElementImpl import com.intellij.lang.ASTNode /** * @author ilyas */ class ScSeqWildcardImpl (...
Explain and rewrite the following Scala code:
/* * SPDX-License-Identifier: Apache-2.0 * * Copyright 2015-2021 Andre White. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * ...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2015 Jason Mar * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed t...
Explain and rewrite the following Scala code:
/* * Copyright 2014-2022 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
Explain and rewrite the following Scala code:
package ch5_strictness_and_laziness /** * Ex 5.1 * Write a function to convert a Stream to a List, * which will force its evaluation and let you look at it in the REPL. * You can convert to the regular List type in the standard library. * You can place this and other functions that operate on a Stream inside the ...
Explain and rewrite the following Scala code:
package io.pivotal.gemfire.spark.connector.internal.rdd import org.apache.spark.Partition /** * This serializable class represents a GemFireRDD partition. Each partition is mapped * to one or more buckets of region. The GemFireRDD can materialize the data of the * partition based on all information contained here...
Explain and rewrite the following Scala code:
package models case class IndexedCourse(val id: Int, val name: String)
Explain and rewrite the following Scala code:
/* * Copyright 2013 - 2020 Outworkers Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or...
Explain and rewrite the following Scala code:
package com.yetu.oauth2provider.services.data import com.yetu.oauth2provider.base.DataServiceBaseSpec import com.yetu.oauth2provider.registry.{ IntegrationTestRegistry, TestRegistry } import org.scalatest.concurrent.ScalaFutures import org.scalatest.time.{ Seconds, Span } import securesocial.core.services.SaveMode im...
Explain and rewrite the following Scala code:
/* * Copyright 2014 Databricks * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
Explain and rewrite the following Scala code:
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); yo...
Explain and rewrite the following Scala code:
/** * Licensed to Big Data Genomics (BDG) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The BDG licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use ...
Explain and rewrite the following Scala code:
package edu.berkeley.nlp.entity.preprocess import edu.berkeley.nlp.futile.LightRunner import edu.berkeley.nlp.entity.ConllDoc import edu.berkeley.nlp.entity.ConllDocReader import java.io.File import edu.berkeley.nlp.entity.lang.Language import edu.berkeley.nlp.entity.ConllDocWriter import edu.berkeley.nlp.futile.fig.b...
Explain and rewrite the following Scala code:
/* * Copyright 2011-2014 Chris de Vreeze * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agree...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
package artie import akka.actor.ActorSystem import akka.http.scaladsl.Http import akka.http.scaladsl.model._ import akka.http.scaladsl.server.{Directives, ExceptionHandler} import akka.stream.ActorMaterializer import play.api.libs.json._ import de.heikoseeberger.akkahttpplayjson.PlayJsonSupport import scala.util.cont...
Explain and rewrite the following Scala code:
package com.danielwestheide.kontextfrei.rdd import org.apache.spark.SparkContext import org.apache.spark.rdd.RDD private[kontextfrei] trait RDDBase { def sparkContext: SparkContext private[rdd] def withSite[A, R](as: RDD[A])(body: RDD[A] => R): R = { val (method, site) = RDDBase.callSiteInfo as.sparkCo...
Explain and rewrite the following Scala code:
/* * Copyright 2021 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
Explain and rewrite the following Scala code:
/* __ *\\ ** ________ ___ / / ___ __ ____ Scala.js API ** ** / __/ __// _ | / / / _ | __ / // __/ (c) 2013, LAMP/EPFL ** ** __\\ \\/ /__/ __ |/ /__/ __ |/_// /_\\ \\ http://scala-lang.org/ ** ** /____/\\___/...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
Explain and rewrite the following Scala code:
package com.github.simy4.xpath package scala import com.github.simy4.xpath.spi.{ Effect => JEffect } import effects.{ PutEffect, PutValueEffect, RemoveEffect } import expr.Expr import javax.xml.namespace.NamespaceContext import javax.xml.xpath.XPathExpressionException import parser.XPathParser /** * XML model modifi...
Explain and rewrite the following Scala code:
/* * Basics.scala * * Copyright (c) 2013 Lonnie Pryor III * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
package org.denigma.codemirror.addons import org.denigma.binding.extensions._ import org.denigma.codemirror._ import org.denigma.kappa.messages.WebSimMessages.WebSimError import scala.scalajs.js import scala.scalajs.js.annotation.{JSName, ScalaJSDefined} import scala.scalajs.js.{Array, |} package object lint { va...
Explain and rewrite the following Scala code:
package breeze.signal.support import breeze.linalg.{DenseVector, DenseMatrix} /** * Construction delegate for getting the FHT of a value of type InputType. * Implementation details (especially * option arguments) may be added in the future, so it is recommended not * to call this implicit delegate directly. * *...
Explain and rewrite the following Scala code:
package org.kirhgoff.ap.analysis /** * Created by Kirill Lastovirya (kirill.lastovirya@gmail.com) aka kirhgoff on 31/05/15. */ import slick.driver.H2Driver.api._ import scala.concurrent.ExecutionContext.Implicits.global object LotkeVolterraProof { def main(a:Array[String]) { val db = Database.forConfig("h2me...
Explain and rewrite the following Scala code:
import com.amazonaws.auth._ import com.amazonaws.AmazonClientException /** * AWS Credentials loader. */ object CredentialsLoader { def load(): CredentialsProvider = { val provider = DefaultCredentialsProvider() if (tryCredentials(provider)) { provider } else { throw new IllegalStateExcepti...
Explain and rewrite the following Scala code:
package dotty.tools package dotc package ast import core._ import Types._, Names._, Flags._, util.Positions._, Contexts._, Constants._, SymDenotations._, Symbols._ import Denotations._, StdNames._ import annotation.tailrec import language.higherKinds import collection.IndexedSeqOptimized import collection.immutable.In...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/* * Copyright 2014โ€“2018 SlamData Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
Explain and rewrite the following Scala code:
package org.apache.spark.sql.cassandra.types import scala.reflect.runtime.universe.typeTag import java.util.UUID import org.apache.spark.annotation.DeveloperApi import org.apache.spark.sql.catalyst.ScalaReflectionLock import org.apache.spark.sql.types.AtomicType /** * :: DeveloperApi :: * * The data type represe...
Explain and rewrite the following Scala code:
package lore.compiler.assembly.values import lore.compiler.assembly.AsmChunk import lore.compiler.assembly.types.TypeAssembler import lore.compiler.poem._ import lore.compiler.semantics.expressions.Expression import lore.compiler.semantics.expressions.Expression.{BinaryOperator, Literal, UnaryOperator, XaryOperator} i...
Explain and rewrite the following Scala code:
package org.goingok import com.typesafe.config.ConfigFactory import org.goingok.httpServer.Server /** The Application entry point starts the akka-http server * * @todo - Need to wire in config * */ object Application extends App { Server.startServer(Config.string("server.host"),Config.int("server.port")) } ...
Explain and rewrite the following Scala code:
/* * Copyright 2014โ€“2017 SlamData Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
Explain and rewrite the following Scala code:
package com.conekta import org.slf4j.LoggerFactory import com.typesafe.scalalogging.slf4j.Logger import play.api.libs.json.JsResultException import play.api.libs.json.JsValue import play.api.libs.json.Json object Resource { val ApiBase = "https://api.conekta.io" val BindingsVersion = "0.3.0" val CharSet = "UT...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
Explain and rewrite the following Scala code:
package net.sansa_stack.query.tests import java.net.URI import java.nio.file.Paths import org.apache.jena.query.{Query, QueryExecutionFactory, QueryFactory, ResultSetFormatter} import org.apache.jena.rdf.model.{Model, ModelFactory, RDFList} import org.apache.jena.riot.{Lang, RDFDataMgr} import org.apache.jena.util.Sp...
Explain and rewrite the following Scala code:
package com.divisiblebyzero.ada.player import com.divisiblebyzero.ada.view.component.Board class HumanPlayer extends Player { override def makeMove(board: Board, color: Int) { } }
Explain and rewrite the following Scala code:
package com.twitter.scrooge.java_generator import com.github.mustachejava.{DefaultMustacheFactory, Mustache} import com.google.common.base.Charsets import com.google.common.io.CharStreams import com.twitter.mustache.ScalaObjectHandler import com.twitter.scrooge.ast._ import com.twitter.scrooge.frontend.{ResolvedDocume...
Explain and rewrite the following Scala code:
/* * Copyright 2012-2014 Comcast Cable Communications Management, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unl...
Explain and rewrite the following Scala code:
package renesca import akka.http.scaladsl.marshalling.{Marshal} import akka.http.scaladsl.model._ import akka.http.scaladsl.model.headers.{Authorization, BasicHttpCredentials, Location, RawHeader} import akka.util.{Timeout} import scala.collection.mutable import scala.concurrent.duration._ import scala.concurrent.{Aw...
Explain and rewrite the following Scala code:
package com.twitter.util.reflect import java.lang.reflect.Method import java.io.Serializable import net.sf.cglib.proxy._ import net.sf.cglib.proxy.{MethodInterceptor => CGMethodInterceptor} import com.twitter.util.Future class NonexistentTargetException extends Exception("MethodCall was invoked without a valid target...
Explain and rewrite the following Scala code:
package ru.primetalk.synapse.core.components /** * @author zhizhelev, 13.04.15. */ object Contact { def unapply(contact: Contact[_]): Option[String] = Some(contact.name) } /** * Basis point of connection of other elements. * If auxiliary then it is drawn on the graph as a simple little circle. * * It or...
Explain and rewrite the following Scala code:
/* * ecalogic: a tool for performing energy consumption analysis. * * Copyright (c) 2013, J. Neutelings, D. Peelen, M. Schoolderman * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: ...
Explain and rewrite the following Scala code:
/* Title: Pure/Admin/ci_profile.scala Author: Lars Hupel Build profile for continuous integration services. */ package isabelle import java.time.{Instant, ZoneId} import java.time.format.DateTimeFormatter import java.util.{Properties => JProperties, Map => JMap} abstract class CI_Profile extends Isa...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2012-2017 Snowplow Analytics Ltd. All rights reserved. * * This program is licensed to you under the Apache License Version 2.0, * and you may not use this file except in compliance with the Apache License Version 2.0. * You may obtain a copy of the Apache License Version 2.0 at * http://www.ap...
Explain and rewrite the following Scala code:
// See also pos/override-object-yes.scala package case1 { // Missing interface in overriding object class Bippy { def f = 1 } trait Bippo trait Foo { object Bar extends Bippy with Bippo { override def f = 2 } def f(x: Bippo) def g = f(Bar) } trait Foo2 extends Foo { override object Bar ext...
Explain and rewrite the following Scala code:
package gv.jleon package util trait AkkaUtilImports { final type ByteString = akka.util.ByteString final val ByteString = akka.util.ByteString }
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
package com.pongr.fourarms.util import org.specs2.mutable._ import javax.mail.internet._ import com.pongr.fourarms.mail._ import com.pongr.fourarms.Helper class FromMethodsSpec extends Specification with FromMethods with Helper { "FromMethodsSpec test" should { "get sender email as string from mail object" ...
Explain and rewrite the following Scala code:
/* Copyright 2009-2016 EPFL, Lausanne */ package leon package xlang import purescala.Common._ import purescala.Definitions._ import purescala.DefinitionTransformer import purescala.DefOps._ import purescala.Expressions._ import purescala.Extractors._ import purescala.Constructors._ import purescala.Types._ /** Clean...
Explain and rewrite the following Scala code:
package au.com.intelix.evt.slf4j import akka.util.ByteString import au.com.intelix.essentials.uuid.UUIDTools import com.google.common.cache.{CacheBuilder, CacheLoader} import com.typesafe.config.Config import org.slf4j.{Logger, LoggerFactory} import play.api.libs.json._ import au.com.intelix.config.ConfigOps.wrap impo...
Explain and rewrite the following Scala code:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Explain and rewrite the following Scala code:
/*********************************************************************** * Copyright (c) 2013-2016 Commonwealth Computer Research, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is ...
Explain and rewrite the following Scala code:
package spray.shapeless.marshalling trait HListChunkedMarshaller[-L] extends HListDefaultMarshaller[L] object HListChunkedMarshaller { import shapeless._ import spray._ import http._ import httpx.marshalling._ def apply[L <: HList](fn: (L, MarshallingContext) => Unit): HListChunkedMarshaller[L] = new H...
Explain and rewrite the following Scala code:
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2014-2020 by The Monix Project Developers. * See the project homepage at: https://monix.io * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache...
Explain and rewrite the following Scala code:
package com.shocktrade.webapp.routes import com.shocktrade.common.models.FacebookAppInfo import com.shocktrade.server.common.LoggerFactory import io.scalajs.nodejs.os.OS import io.scalajs.npm.express.{Application, Request, Response} import io.scalajs.npm.mongodb.Db import scala.concurrent.{ExecutionContext, Future} ...
Explain and rewrite the following Scala code:
package counter.operation import akka.actor.{Actor, ActorRef, Props} import counter.manager.CounterManager.Start import counter.operation.OperationReceiver.Success import counter.operation.StartOperation.{StartCounter, Started} class StartOperation(counterManager: ActorRef) extends Actor { def receive = { case...
Explain and rewrite the following Scala code:
package com.rv.parser import java.io.File import scala.annotation.tailrec import sys.process._ object ParseFiles { def getFilePaths(pathDir : String) = { val d = new File(pathDir) (d.exists && d.isDirectory) match { case true => { val files = d.listFiles().filter { f => f.isFile() && isText...