instruction
stringclasses
1 value
output
stringlengths
5
1M
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 core.authentication.tokenGenerators import core.entities.{AuthTokenClaims, BearerToken} /** * OAuth2 Bearer token generator. * - Backed with Auth0 Json Web Token. */ trait BearerTokenGenerator { /** * Creates a JWT (Json Web Token) Authentication token with User information * @param ctx Given...
Explain and rewrite the following Scala code:
package eu.timepit.refined package util import eu.timepit.refined.string._ import shapeless.tag.@@ object string { /** * Creates a `scala.util.matching.Regex` from a validated string. * * Example: {{{ * scala> import eu.timepit.refined.implicits._ * | import eu.timepit.refined.util.string.regex...
Explain and rewrite the following Scala code:
package odfi.h2dl.indesign.ui.std import com.idyria.osi.vui.lib.view.StandardAView import com.idyria.osi.vui.lib.gridbuilder.GridBuilder import com.idyria.osi.vui.lib.view.StandardAViewCompiler class ExampleFullUI extends StandardAView with GridBuilder { this.content { frame { f => f title("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 may ...
Explain and rewrite the following Scala code:
package net.sansa_stack.inference.spark.forwardchaining.triples import net.sansa_stack.inference.data.RDF import net.sansa_stack.inference.spark.data.model.AbstractRDFGraphSpark import net.sansa_stack.inference.utils.Logging /** * A forward chaining based reasoner. * * @author Lorenz Buehmann */ abstract clas...
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:
import org.specs2.mutable._ import org.specs2.runner._ import org.junit.runner._ import play.api.test._ import play.api.test.Helpers._ /** * Add your spec here. * You can mock out a whole application including requests, plugins etc. * For more information, consult the wiki. */ @RunWith(classOf[JUnitRunner]) class...
Explain and rewrite the following Scala code:
package com.sksamuel.elastic4s.http.search.aggs import com.sksamuel.elastic4s.searches.aggs._ import com.sksamuel.elastic4s.searches.aggs.pipeline.MaxBucketDefinition import org.elasticsearch.common.xcontent.{XContentBuilder, XContentFactory, XContentType} object AggregationBuilderFn { def apply(agg: AbstractAggreg...
Explain and rewrite the following Scala code:
package nest.sparkle.time.server import spray.http._ import spray.httpx.marshalling._ import spray.http.MediaTypes.`text/tab-separated-values` object TsvContent { implicit val TsvContentMarshaller = Marshaller.of[TsvContent](`text/tab-separated-values`) { (value, contentType, ctx) => ctx.marshalTo(HttpE...
Explain and rewrite the following Scala code:
package sbt import java.io.File import org.specs2._ import mutable.Specification import sbt.util.Logger object PluginsTest extends Specification { import AI._ "Auto plugin" should { "enable plugins with trigger=allRequirements AND requirements met" in { deducePlugin(A && B, log) must contain(Q) } "enable ...
Explain and rewrite the following Scala code:
/************************************************************************* * * * This file is part of the 20n/act project. * * 20n/act enables DNA prediction for synthetic biology/bioengineering. * * Copyright (C) 201...
Explain and rewrite the following Scala code:
package model.repositories.anorm import java.util.Date import anorm.SqlParser._ import anorm._ import model.dtos._ object CommentsParser{ val Parse: RowParser[Comment] = { long("id") ~ int("article_id") ~ get[Option[Long]]("parent_id") ~ str("comment") ~ int("source_type_id") ~ ...
Explain and rewrite the following Scala code:
package extracells.common.part import java.io.IOException import java.util import appeng.api.AEApi import appeng.api.implementations.IPowerChannelState import appeng.api.networking.events.{MENetworkPowerStatusChange, MENetworkEventSubscribe} import appeng.api.networking.security.IActionHost import appeng.api.networki...
Explain and rewrite the following Scala code:
/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package viper.silicon package object decider { type Mark = Int }
Explain and rewrite the following Scala code:
/* ,i::, :;;;;;;; ;:,,::;. 1ft1;::;1tL t1;::;1, :;::; _____ __ ___ __ fCLff ;:: tfLLC / ___/ / |/ /____ _ _____ / /_ CLft11 :,, i1tffLi \__ \ ____ / /|_/ //...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com> */ package scalaguide.http.scalasessionflash { import play.api.mvc._ import play.api.test._ import play.api.test.Helpers._ import org.specs2.mutable.Specification import org.junit.runner.RunWith import org.specs2.runner.JUnitRunner im...
Explain and rewrite the following Scala code:
package io.flow.delta.actors object BuildActor { trait Message object Messages { case object Setup extends Message case object CheckLastState extends Message } }
Explain and rewrite the following Scala code:
package lib.reasoner.syntactical package object types { sealed trait Type { val name: String def is(other: Type) = this == other def isNum = false def isJoda = false override def toString(): String = name } case object BoolType extends Type { val name = "Boolean" } case objec...
Explain and rewrite the following Scala code:
package skinny.controller.feature import java.lang.reflect.Modifier import org.scalatra.ScalatraBase import skinny.controller.{ KeyAndErrorMessages, Params } import skinny.exception.RequestScopeConflictException import java.util.Locale import org.joda.time._ import skinny.I18n import skinny.logging.Logging import java...
Explain and rewrite the following Scala code:
package scodec.protocols.mpeg package transport import scodec.Codec import scodec.bits.BitVector import scodec.codecs._ /** Flags in the adaptation field. */ case class AdaptationFieldFlags( discontinuity: Boolean, randomAccess: Boolean, priority: Boolean, pcrFlag: Boolean, opcrFlag: Boolean, splicingPoin...
Explain and rewrite the following Scala code:
package com.alvinalexander.bubbles import akka.actor._ import java.awt.Color import javax.swing.SwingUtilities case object Tick case object StopMoving /** * A class to model each instance of a "bubble/circle". * Receives a `Tick`, which indicates the bubble should re-calc its position. * Receives StopMoving, whic...
Explain and rewrite the following Scala code:
package scalapb.textformat import utest.assert trait ParserSuite { import fastparse._ def check[T](parser: P[_] => P[T], input: String, expected: T) = { val Parsed.Success(value, _) = parse(input, parser(_)) assert(value == expected) } def check[T](parser: P[_] => P[T], input: String)(checker: T => ...
Explain and rewrite the following Scala code:
package scala.compat.java8 /** A trait that indicates that the class is or can be converted to a Scala version by wrapping a Java class */ trait WrappedAsScala[S] { /** Returns an appropriate Scala version */ def asScala: S } /** A trait that indicates that the class is or can be converted to a Java version by w...
Explain and rewrite the following Scala code:
/* * Represents a fixed-size board. Cells on the edge of the board have dead neighbors. */ package arena.game.gameoflife object EndlessBoard { import util.Random.nextBoolean def randomBoard(width: Int, height: Int) = { new EndlessBoard( (0 to width).flatMap((x) => (0 to height).map((y) => Location(x...
Explain and rewrite the following Scala code:
package controllers import play.api.i18n.{Lang, Messages, MessagesApi} import play.api.mvc import play.api.mvc.Result import play.mvc.Http.RequestHeader class MockMessageApi extends MessagesApi { val m = Messages(Lang("en"), this) override def messages: Map[String, Map[String, String]] = ??? override def pref...
Explain and rewrite the following Scala code:
package client.finance import org.sweble.wikitext.parser.nodes.{WtNode, WtText, WtSection} class Section(val wtSection: WtSection) { def heading = wtSection.getHeading.get(0).asInstanceOf[WtText].getContent.trim } object Section { def apply(wtNode: WtNode) = Option(wtNode) collect { case wtSection: WtSec...
Explain and rewrite the following Scala code:
package authentication case class UserRegistrationRequest(email: String, password: String, firstName: String, lastName: String, gender: Int, role: Int) case class UserLoginRequest(email: String, password: String)
Explain and rewrite the following Scala code:
package se.culvertsoft.mgen.cpppack.generator import se.culvertsoft.mgen.compiler.util.SourceCodeBuffer object CppDispatchGenerator { def includeStringH(namespaceString: String): String = { s"$namespaceString::Dispatcher.h".replaceAllLiterally("::", "/") } def includeStringCpp(namespaceString: String): Stri...
Explain and rewrite the following Scala code:
/* * Copyright 2016 OrgSync. * * 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 in ...
Explain and rewrite the following Scala code:
package com.github.pheymann.scala.bft.consensus import cats._ import com.github.pheymann.scala.bft.ScalaBftSpec import com.github.pheymann.scala.bft.messaging.{ClientRequest, PrePrepareMessage, RequestDelivery} import com.github.pheymann.scala.bft.replica.ReplicaAction import com.github.pheymann.scala.bft.replica.Repl...
Explain and rewrite the following Scala code:
// Copyright (C) 2011-2012 the original author or authors. // See the LICENCE.txt file distributed with this work for additional // information regarding copyright ownership. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You ...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2015 Stratio (http://stratio.com) * * 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 app...
Explain and rewrite the following Scala code:
package org.pignat.bwatnwa.view import org.pignat.bwatnwa.util.Utils import org.pignat.bwatnwa.GraphicalView import org.pignat.bwatnwa.ByteArrayEater import org.pignat.bwatnwa.PointListener class Binary2dViewSelect extends GraphicalView with ByteArrayEater with PointListener { var point = -1 def point(s:Int...
Explain and rewrite the following Scala code:
package sttp.client3.internal import sttp.client3._ import sttp.model._ import sttp.client3.NoBody import sttp.model.MediaType class ToCurlConverter[R <: RequestT[Identity, _, _]] { def apply(request: R): String = apply(request, HeaderNames.SensitiveHeaders) def apply(request: R, sensitiveHeaders: Set[String]):...
Explain and rewrite the following Scala code:
package nl.spockz.reflection import scala.reflect.runtime._ import scala.reflect.runtime.universe._ object Util { def createInstance[T: TypeTag](args: AnyRef*)(ctor: Int = 0): T = { val tt = typeTag[T] println(tt) currentMirror.reflectClass(tt.tpe.typeSymbol.asClass).reflectConstructor({ tt.tpe.me...
Explain and rewrite the following Scala code:
package main import scala.collection.AbstractIterator /** * @author Tobin Yehle */ sealed abstract class SkewHeap[A](implicit val ordering: Ordering[A]) extends Iterable[A] { def isEmpty: Boolean def nonEmpty: Boolean def size: Int def first: A def firstOption: Option[A] def rest: SkewHeap[A] def fir...
Explain and rewrite the following Scala code:
package uk.ac.ncl.openlab.intake24.services.systemdb.admin import uk.ac.ncl.openlab.intake24.api.data.{NewRespondentIds, NewUserProfile} import uk.ac.ncl.openlab.intake24.errors._ import uk.ac.ncl.openlab.intake24.services.systemdb.user.UserPhysicalDataOut case class UserProfile(id: Long, name: Option[String], email...
Explain and rewrite the following Scala code:
package grasshopper.test.util import geometry.Point import math._ // Calculates the great-circle distance between two points on the surface of the earth (in km) // See https://en.wikipedia.org/wiki/Haversine_formula object Haversine { val R = 6371 // Mean Earth Radius, see https://en.wikipedia.org/wiki/Earth_radiu...
Explain and rewrite the following Scala code:
package org.http4s package blaze import java.nio.ByteBuffer import java.nio.charset.StandardCharsets import java.time.Instant import org.http4s.headers.{`Transfer-Encoding`, `Content-Length`} import org.http4s.{headers => H} import org.http4s.blaze.util.BufferTools.{concatBuffers, emptyBuffer} import org.http4s.blaze...
Explain and rewrite the following Scala code:
def f(arr:List[Int]):List[Int] = { var x:List[Int]=Nil var i=1 while(i<arr.length) { x=x:::List(arr(i)) i+=2 } return x } //Optimal Solution def f(arr:List[Int]):List[Int] = { arr.zipWithIndex.filter(_._2%2!=0).map(_._1) }
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 agreed to in writ...
Explain and rewrite the following Scala code:
package spotlight.model.outlier import cats.syntax.validated._ import com.typesafe.scalalogging.{ LazyLogging, Logger } import org.slf4j.LoggerFactory import org.joda.{ time ⇒ joda } import omnibus.commons.{ AllErrorsOr, AllIssuesOr } import shapeless.syntax.typeable._ import spotlight.model.outlier.ReduceOutliers.Cor...
Explain and rewrite the following Scala code:
package com.twitter.finagle.loadbalancer import com.twitter.finagle._ import com.twitter.finagle.loadbalancer._ import com.twitter.finagle.stats.{StatsReceiver, NullStatsReceiver} import com.twitter.util.{Future, Time} import java.util.concurrent.atomic.AtomicInteger import org.junit.runner.RunWith import org.scalacti...
Explain and rewrite the following Scala code:
package org.scaladebugger.api.profiles.java.requests.classes import java.util.concurrent.atomic.AtomicInteger import org.scaladebugger.api.profiles.java.JavaDebugProfile import org.scaladebugger.api.virtualmachines.DummyScalaVirtualMachine import org.scaladebugger.test.helpers.ParallelMockFunSpec import test.{ApiTest...
Explain and rewrite the following Scala code:
package shared.requests.policies import shared.responses.policies.Statement case class CreatePolicyRequest ( pathParams: CreatePolicyRequestPathParams, body: CreatePolicyRequestBody ) case class CreatePolicyRequestPathParams( organizationId: String ) case class CreatePolicyRequestBody( name: String, ...
Explain and rewrite the following Scala code:
package app import jp.sf.amateras.scalatra.forms._ import service._ import IssuesService._ import util.{CollaboratorsAuthenticator, ReferrerAuthenticator, ReadableUsersAuthenticator, Notifier, Keys} import util.Implicits._ import util.ControlUtil._ import org.scalatra.Ok class IssuesController extends Iss...
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 not use this f...
Explain and rewrite the following Scala code:
package com.ignition.frame.mllib import org.junit.runner.RunWith import org.specs2.runner.JUnitRunner import com.ignition.frame.{ DataGrid, FrameFlowSpecification } import com.ignition.types.{ RichStructType, double, fieldToRichStruct, int, string } @RunWith(classOf[JUnitRunner]) class CorrelationSpec extends FrameF...
Explain and rewrite the following Scala code:
package com.github.caiiiycuk.ast2uml import com.github.caiiiycuk.ast2uml.clang.ClangAstParser import com.github.caiiiycuk.ast2uml.render.PlantUml object Ast2Uml extends App { val lines = Iterator.continually(Console.readLine).takeWhile(l => { l != null && l.nonEmpty }).toList implicit val ast = ClangAstPa...
Explain and rewrite the following Scala code:
package <%= packageName %>.models object <%= _.capitalize(attr.attrName) %>Enum extends Enumeration { type <%= _.capitalize(attr.attrName) %>Enum = Value <% var index = 1; _.each(attr.enumValues, function (value) { %> val <%= value %> = Value(<%= index++ %>, "<%= value %>")<% }); %> }
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) 2010 Orbeon, Inc. * * This program is free software; you can redistribute it and/or modify it under the terms of the * GNU Lesser General Public License as published by the Free Software Foundation; either version * 2.1 of the License, or (at your option) any later version. * * This program is distr...
Explain and rewrite the following Scala code:
package goggles.macros.errors private[goggles] object Table { def apply(cols: Column*): Table = Table(cols.toList) def empty = Table(Nil) } private[goggles] case class Table(columns: List[Column]) { def render: String = { if (columns.isEmpty) "" else { val headings = columns.map(_.formattedHeading...
Explain and rewrite the following Scala code:
package ru.server.service import org.scalatest.{Matchers, FunSuite} import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner import com.github.pathikrit.dijon._ @RunWith(classOf[JUnitRunner]) class JsonSpec extends FunSuite with Matchers { test("Json parser variable interpolation") { //val (name,...
Explain and rewrite the following Scala code:
package gapt.proofs.nd import gapt.expr._ import gapt.expr.ty.TBase import gapt.expr.ty.TVar import gapt.expr.ty.Ty import gapt.formats.babel.Notation import gapt.formats.babel.Precedence import gapt.proofs.context.update.InductiveType import gapt.proofs.context.update.{ PrimitiveRecursiveFunction => PrimRecFun } 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 ...
Explain and rewrite the following Scala code:
// Copyright (C) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in project root for information. package com.microsoft.ml.spark.contracts import java.lang.RuntimeException import org.apache.spark.ml.util.Identifiable object MMLException { implicit class MMLID(val i: I...
Explain and rewrite the following Scala code:
/* * La Trobe University - Distributed Deep Learning System * Copyright 2016 Matthias Langer (t3l@threelights.de) * * 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.apa...
Explain and rewrite the following Scala code:
/** * Copyright (c) 2016 Intel Corporation  * * 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 applicabl...
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 be.ellefant.cloudr import android.accounts.AccountManager import android.content.Context import com.google.inject._ import roboguice.inject.ContextScoped import CloudrModule._ /** * Guice module for Cloudr. */ class CloudrModule extends AbstractModule { def configure() = { val config = new Config ...
Explain and rewrite the following Scala code:
import scala.tools.partest._ import java.io.File object Test extends StoreReporterDirectTest { def code = ??? def compileCode(code: String) = { val classpath = pathOf(sys.props("partest.lib"), testOutput.path) compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(code) } def show(): Uni...
Explain and rewrite the following Scala code:
/** * Swaggy Jenkins * Jenkins API clients generated from Swagger / Open API specification * * The version of the OpenAPI document: 1.1.2-pre.0 * Contact: blah@cliffano.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not ed...
Explain and rewrite the following Scala code:
package org.randi3.dao import org.randi3.randomization._ import scala.slick.session.Database.threadLocalSession import scalaz._ import org.randi3.utility.UtilityDBComponent import scala.slick.session.Session trait RandomizationMethodDaoComponent { this: DaoComponent with RandomizationPluginManagerComponent wit...
Explain and rewrite the following Scala code:
package net.sansa_stack.query.spark.ontop.kryo import com.esotericsoftware.kryo.io.{Input, Output} import com.esotericsoftware.kryo.{Kryo, Serializer} import it.unibz.inf.ontop.com.google.common.collect.ImmutableList import it.unibz.inf.ontop.model.term.ImmutableFunctionalTerm import it.unibz.inf.ontop.model.term.func...
Explain and rewrite the following Scala code:
package nodes.images.external import org.scalatest.FunSuite import pipelines.{Logging, LocalSparkContext} import utils.{ImageUtils, TestUtils} class SIFTExtractorSuite extends FunSuite with Logging { test("Test Sift on a single image RDD, scaleStep=1 and scaleStep=0, 0 should have more descriptors") { val testI...
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.mothy.letsmod2.proxy class ServerProxy extends CommonProxy { }
Explain and rewrite the following Scala code:
package com.jejking.rprng.main import akka.NotUsed import akka.actor.ActorSystem import akka.stream.scaladsl.Source import akka.stream.{Graph, SourceShape, SystemMaterializer} import akka.util.ByteString import com.jejking.rprng.rng._ import com.jejking.rprng.rng.actors.TimeRangeToReseed import scala.concurrent.durat...
Explain and rewrite the following Scala code:
package org.higherstate.jameson.tokenizers import org.scalatest.{MustMatchers, WordSpec} class ScalaTokenizerSpec extends WordSpec with MustMatchers { "Jackson tokenizer should" should { "process key value tokens correctly" in { val map = Map("key" -> "value", "key2" -> List(2, 3, Map("key3" -> Map("key4...
Explain and rewrite the following Scala code:
/* * Copyright 2017 rdbc contributors * * 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:
import com.rabbitmq.client._ object ReceiveLogsTopic { private val EXCHANGE_NAME = "topic_logs" def main(argv: Array[String]) { val factory = new ConnectionFactory() factory.setHost("localhost") val connection = factory.newConnection() val channel = connection.createChannel() channel.exchange...
Explain and rewrite the following Scala code:
package com.sksamuel.elastic4s import org.elasticsearch.common.geo.{GeoDistance, GeoPoint} import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode import org.elasticsearch.search.aggregations.bucket.children.ChildrenBuilder import org.elasticsearch.search.aggregations.bucket.filter.FilterAggregati...
Explain and rewrite the following Scala code:
package fr.hurrycane.entity case class LuisResponse(query: String, topScoringIntent: LuisIntent, intents: Seq[LuisIntent], entities: Seq[LuisEntity])
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 cucumber.ext.ssh import net.schmizz.sshj.SSHClient /** * Helper base class to manage SSH operations */ object Factory { private[ssh] def login(host:String, user:String, pass:String, hostKeys:Array[String],timeout:Int = 10000) = { val ssh = new SSHClient() // if support.server hasn't responded in ...
Explain and rewrite the following Scala code:
/* * This source code is licensed under the MIT license found in the * LICENSE.txt file in the root directory of this source tree */ package a14e.collz.immut import scala.collection.generic.{CanBuildFrom, GenericCompanion} import scala.collection.mutable import scala.collection.mutable.ArrayBuffer import scala.reflect...
Explain and rewrite the following Scala code:
package im.tox.antox.fragments import java.util import android.os.Bundle import android.support.annotation.Nullable import android.support.v4.app.{Fragment, FragmentManager, FragmentPagerAdapter} import android.support.v4.view.ViewPager import android.util.SparseArray import android.view.{LayoutInflater, View, ViewGr...
Explain and rewrite the following Scala code:
package com.twitter.finatra.thrift.tests.noninjection import com.twitter.finatra.thrift.Controller import com.twitter.noninjection.thriftscala.NonInjectionService import com.twitter.noninjection.thriftscala.NonInjectionService.Echo import com.twitter.util.Future class NonInjectionController() extends Controller with ...
Explain and rewrite the following Scala code:
/* * Copyright 2015 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 example.filesearch import java.io.{File, FileInputStream} import java.nio.channels.FileChannel import java.nio.charset.Charset import java.nio.{ByteBuffer, CharBuffer} import java.util import java.util.regex.{Matcher, Pattern} import scala.annotation.tailrec import scala.collection.mutable.ListBuffer object ...
Explain and rewrite the following Scala code:
/* * Copyright 2014 Commonwealth Computer Research, 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 applica...
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:
/* * Copyright 2017 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 may ...
Explain and rewrite the following Scala code:
/* * Copyright 2015 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 com.nn.math.activations import javax.swing.AbstractAction import com.nn.Neuron import scala.collection.mutable.ArrayBuffer /** * Creates a bipolar sigmoid function for classifications tasks between -1 and 1 * Created by george on 12/7/14. */ class BipolarSigmoidFunction extends ActivationFunction{ /**...
Explain and rewrite the following Scala code:
/* * IP4S/src/main/scala/function/FileExtensionParser.scala * * Copyright (C) 2017 K.Takeuchi * * A class that implements a function for determining the file extension */ package ip4s package function object FileExtensionParser{ val dot:Char = '.' val extensionNameList:List[String] = List("gif", "jpeg", ...
Explain and rewrite the following Scala code:
package spark.partial import cern.jet.stat.Probability /** * A utility class for caching Student's T distribution values for a given confidence level * and various sample sizes. This is used by the MeanEvaluator to efficiently calculate * confidence intervals for many keys. */ class StudentTCacher(confidence: Dou...
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 models import org.specs2.mutable.Specification /** * Created by gabriel on 5/7/16. */ class CitySpec extends Specification { "A city" should { "not add taxis in a blocked position" in { val position = City.state.filter(_._2).head._1 City.addTaxi(Taxi(position)) must beLeft } ...
Explain and rewrite the following Scala code:
package spark.storage import java.nio.ByteBuffer /** * An interface for writing JVM objects to some underlying storage. This interface allows * appending data to an existing block, and can guarantee atomicity in the case of faults * as it allows the caller to revert partial writes. * * This interface does not s...
Explain and rewrite the following Scala code:
class NoReturnSeveralOutput { def foo(i: Int) { /*start*/ val x = 0 val y = "a" val z = 1 val zz = "1" /*end*/ println(x + y + z + zz) } } /* class NoReturnSeveralOutput { def foo(i: Int) { val (x: Int, y: String, z: Int, zz: String) = testMethodName println(x + y + z + zz) } ...
Explain and rewrite the following Scala code:
/* * Copyright 2014-2020 Rik van der Kleij * * 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:
/* * Copyright 2014 Xored Software, Inc. * Copyright 2015 Gleb Kanterov * * 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 r...
Explain and rewrite the following Scala code:
/* * Scala.js (https://www.scala-js.org/) * * Copyright EPFL. * * Licensed under Apache License 2.0 * (https://www.apache.org/licenses/LICENSE-2.0). * * See the NOTICE file distributed with this work for * additional information regarding copyright ownership. */ package org.scalajs.testsuite.javalib.util.fun...
Explain and rewrite the following Scala code:
package kvstore import akka.actor.Props import akka.actor.Actor import akka.actor.ActorRef import scala.concurrent.duration._ object Replicator { case class Replicate(key: String, valueOption: Option[String], id: Long) case class Replicated(key: String, id: Long) case class Snapshot(key: String, valueOption:...
Explain and rewrite the following Scala code:
package scalapb.compiler case class ConstructorField( name: String, typeName: String, default: Option[String], index: Int, annotations: Seq[String] = Nil ) { def fullString: String = Seq( s"${if (annotations.isEmpty) "" else annotations.mkString("", " ", " ")}", s"${name}: ${type...
Explain and rewrite the following Scala code:
package io.swagger.client.model import org.joda.time.DateTime case class ConversionStep ( operation: String, // value: Double // )