instruction
stringclasses
1 value
output
stringlengths
5
1M
Explain and rewrite the following Scala code:
/* __ *\\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2003-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 may ...
Explain and rewrite the following Scala code:
/** * (c) Copyright 2014 WibiData, Inc. * * See the NOTICE 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 may obtain a copy of...
Explain and rewrite the following Scala code:
package metascala.test import metascala.Utils.Equal object HArrayTest { import metascala.TLists._ import metascala.Nats._ import metascala.HArrays._ // Cons val l1 : HArray[Int :: Boolean :: TNil] = 10 :: true :: HArrayNil val l2 : HArray[Double :: String :: TNil] = 10.1 :: "hello" :: HArrayNi...
Explain and rewrite the following Scala code:
package no.uio.musit.test import java.io.IOException import java.net.{ServerSocket => JServerSocket} import play.api.test.Helpers import scala.util.{Random, Try} trait Network { def generatePort: Int = { Try { val portnum = Helpers.testServerPort + Random.nextInt(500) val socket = new JServerSoc...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2017 joesan @ http://github.com/joesan * 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 applicab...
Explain and rewrite the following Scala code:
/* * Copyright 2014 http4s.org * * 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:
package bootstrap.liftweb import _root_.net.liftweb._ import http.ResourceServer._ import actor._ import util._ import Helpers._ import common._ import http._ import sitemap._ import Loc._ import java.util.Locale import java.sql.DriverManager import _root_.net.liftweb.util.{ Props } import _root_.net.liftweb.http.prov...
Explain and rewrite the following Scala code:
package net.bmjames.json package object syntax extends JValueSyntax with CursorArrowSyntax with PStateSyntax
Explain and rewrite the following Scala code:
object Test { def assertApply(expected: Boolean) = { val frames = Thread.currentThread.getStackTrace.takeWhile(_.getMethodName != "main") val usesObjectApply = frames.exists(_.getMethodName == "apply") assert(expected == usesObjectApply, frames.mkString("\\n")) } def assertSpecialized() = assertApply(...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2017 Ruben de Gooijer * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, pu...
Explain and rewrite the following Scala code:
package io.eels.component.jdbc import java.sql.{ResultSet, ResultSetMetaData} import com.sksamuel.exts.Logging import io.eels.schema.{Field, StructType} /** * Generates an eel schema from the metadata in a resultset. */ object JdbcSchemaFns extends Logging { def fromJdbcResultset(rs: ResultSet, dialect: JdbcDia...
Explain and rewrite the following Scala code:
/* * Copyright 2001-2008 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 dotty.tools package dotc package core import Contexts._, Types._, Symbols._, Names._, Flags._, Scopes._ import SymDenotations._, Denotations.SingleDenotation import config.Printers._ import util.Positions._ import Decorators._ import StdNames._ import Annotations._ import util.SimpleMap import collection.mutab...
Explain and rewrite the following Scala code:
/** * Copyright (C) 2013 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 i...
Explain and rewrite the following Scala code:
/* * Copyright 2017-2020 Aleksey Fomkin * * 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 ag...
Explain and rewrite the following Scala code:
/* Copyright 2013 Nest Labs 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 writing...
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 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0 * See accompanying LICENSE file. */ package kafka.manager import java.nio.charset.StandardCharsets import java.util.Properties import akka.actor.{ActorRef, ActorSystem, Props} import akka.pattern._ import akka.util.Timeout import com.ty...
Explain and rewrite the following Scala code:
package controllers /** * GraPHPizer source code analytics engine * Copyright (C) 2015 Martin Helmich <kontakt@martin-helmich.de> * * 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...
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 lv.ddgatve.velesanas.cleanup /** * Build a set of standardized tables from */ class Projection(val dsetNames: List[String], val fieldNames: Map[String, List[String]]) { private def transformMap(arg: Map[String, String], fields: List[String], transforms: Map[String, String]): Map[String, String] = ...
Explain and rewrite the following Scala code:
/* * Copyright 2001-2011 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.jetbrains.plugins.scala.lang.formatter.tests import com.intellij.psi.codeStyle.CommonCodeStyleSettings import org.jetbrains.plugins.scala.lang.formatter.AbstractScalaFormatterTestBase /** * @author Alexander Podkhalyuzin */ class ScalaBugsTest extends AbstractScalaFormatterTestBase { /* stub: def t...
Explain and rewrite the following Scala code:
import sbt._ import sbt.Keys._ import sbtrelease.ReleasePlugin._ import sbtrelease.ReleasePlugin.ReleaseKeys._ import sbtrelease._ import sbtrelease.ReleaseStateTransformations._ import com.typesafe.sbt.SbtPgp.PgpKeys._ import scala._ import scala.Some import Utilities._ import sbtbuildinfo.Plugin._ object BuildSetti...
Explain and rewrite the following Scala code:
import sbt._ object Version { val akka = "2.3.6" val scalaTest = "2.2.2" val scalaCheck = "1.12.1" val logback = "1.1.2" val combinators = "2.11.0-M4" val scopt = "3.3.0" val scalaz = "7.1.3" val ficus = "1.1.2" } object Library { val scalaTes...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2016-2017 Lightbend Inc. <https://www.lightbend.com> */ package com.lightbend.lagom.scaladsl.pubsub import java.util.Locale import scala.concurrent.duration._ import akka.remote.testkit.MultiNodeConfig import akka.remote.testkit.MultiNodeSpec import akka.testkit.ImplicitSender import com.typesafe...
Explain and rewrite the following Scala code:
package org.dohrm.toolkit.context import akka.actor.ActorSystem import akka.stream.ActorMaterializer import akka.util.Timeout /** * @author michaeldohr * @since 14/05/16 */ trait ActorContext { implicit val as: ActorSystem implicit val am: ActorMaterializer implicit val actorTimeout: Timeout }
Explain and rewrite the following Scala code:
/* * asr-scala digital signal processor * * Copyright (C) 2013 Paul Ciarlo <paul.ciarlo@gmail.com> * * 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 *...
Explain and rewrite the following Scala code:
package org.sisioh.aws4s.sns.model import com.amazonaws.services.sns.model.ListSubscriptionsRequest import org.sisioh.aws4s.PimpedType object ListSubscriptionsRequestFactory { def create(): ListSubscriptionsRequest = new ListSubscriptionsRequest() def create(nextToken: String): ListSubscriptionsRequest = ...
Explain and rewrite the following Scala code:
package uk.co.sprily package btf.webshared trait PanelReadings { def current: Int def activePower: Int def reactivePower: Int def powerFactor: Int def voltage: Int def frequency: Int } case class GridReadings( current: Int, activePower: Int, reactivePower: Int, powerFactor: Int, voltag...
Explain and rewrite the following Scala code:
package org.sunnyshahmca.connect.mongodb package object collectionReader { import org.mongodb.scala.{MongoClient,MongoDatabase,MongoCollection,Document,FindObservable} import org.mongodb.scala.bson.{BsonObjectId,BsonValue} import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.durati...
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:
/* * TimelineView.scala * (Mellite) * * Copyright (c) 2012-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.lucre.swing.g...
Explain and rewrite the following Scala code:
package edu.gemini.dataman.app import edu.gemini.dataman.core.DmanId.{Obs, Dset, Prog} import edu.gemini.dataman.core.DmanId import edu.gemini.gsa.query.Arbitraries import edu.gemini.pot.sp.SPObservationID import edu.gemini.spModel.core.SPProgramID import edu.gemini.spModel.dataset.DatasetLabel import org.scalacheck.{...
Explain and rewrite the following Scala code:
/* * Copyright (C) 2005, The Beangle Software. * * 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 3 of the License, or * (at your option) any later version. * * This...
Explain and rewrite the following Scala code:
package org.http4s package blazecore import cats.effect.Effect import cats.implicits._ import fs2._ import fs2.Stream._ import java.nio.ByteBuffer import java.time.Instant import org.http4s.blaze.http.parser.BaseExceptions.ParserException import org.http4s.blaze.pipeline.{Command, TailStage} import org.http4s.blaze.ut...
Explain and rewrite the following Scala code:
/** * (c) Copyright 2013 WibiData, Inc. * * See the NOTICE 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 may obtain a copy of...
Explain and rewrite the following Scala code:
package org.ai4fm.proofprocess.cdo.internal import java.net.URI import org.ai4fm.proofprocess.cdo.internal.db.PProcessRepositoryManager import org.eclipse.core.runtime.{IProgressMonitor, IStatus, NullProgressMonitor, Plugin, Status} import org.eclipse.emf.cdo.session.CDOSession import org.osgi.framework.BundleConte...
Explain and rewrite the following Scala code:
package t1000711 object Nested { trait A { trait A class B object C } class B { trait A class B object C } object C { trait A class B object C } }
Explain and rewrite the following Scala code:
package se.culvertsoft.mgen.visualdesigner.view import java.awt.Cursor import java.awt.event.MouseAdapter import java.awt.event.MouseEvent import se.culvertsoft.mgen.visualdesigner.util.Asof.AsofOps import se.culvertsoft.mgen.visualdesigner.model.PlacedEntity trait Movable { self: AbstractView => import Graphics2...
Explain and rewrite the following Scala code:
import models._ import play.api._ object Global extends GlobalSettings { override def onStart(app: Application) { // Model.register[User]("users") // Model.register[Group]("groups") } }
Explain and rewrite the following Scala code:
package edu.gemini.ags.gems import edu.gemini.catalog.api._ import edu.gemini.catalog.votable.TestVoTableBackend import edu.gemini.spModel.gemini.gems.Canopus.Wfs import org.specs2.time.NoTimeConversions import scala.concurrent.duration._ import edu.gemini.shared.util.immutable.{None => JNone} import edu.gemini.spMode...
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:
/****************************************************************************** * Copyright (c) 2014, Equal Experts Ltd * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * 1. Redistributions of ...
Explain and rewrite the following Scala code:
package sexamples.virtualnetworking.pingpongvirtual import se.sics.kompics.sl._ import se.sics.kompics.config.Conversions; import se.sics.kompics.network.netty.serialization.Serializers import java.net.{InetAddress, UnknownHostException} object Main { // #registration // register Serializers.register(NetSeriali...
Explain and rewrite the following Scala code:
//uncomment to enable SASS //import com.typesafe.sbt.web.SbtWeb import org.scalajs.sbtplugin.cross.CrossProject import sbt._ import Keys._ import Tests._ import org.scalajs.sbtplugin.ScalaJSPlugin import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._ import sbt.Project.projectToRef object Build extends sbt.Build {...
Explain and rewrite the following Scala code:
import sbt._ import Keys._ object BuildSettings { val buildSettings = Defaults.defaultSettings ++ Seq ( organization := "org.mybatis.scala", version := "1.0-beta2", scalaVersion := "2.9.1" ) } object Resolvers { val sonatypeSnapshots = "Sonatype OSS Snapshots" at "https://oss.sonatype.org/conte...
Explain and rewrite the following Scala code:
package djinni import djinni.ast._ import djinni.generatorTools._ import djinni.meta._ class CppMarshal(spec: Spec) extends Marshal(spec) { override def typename(tm: MExpr): String = toCppType(tm, None) def typename(name: String, ty: TypeDef): String = ty match { case e: Enum => idCpp.enumType(name) case...
Explain and rewrite the following Scala code:
package net.fwbrasil.activate.play import play.api.data.FormError import play.api.data.Form import play.api.data.Mapping import play.api._ import play.api.mvc._ import play.api.data._ import play.api.data.Forms._ import play.api.data.format.Formats._ import net.fwbrasil.activate.statement.StatementMocks import net.fwb...
Explain and rewrite the following Scala code:
/** * Copyright (C) 2010-2011 LShift 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...
Explain and rewrite the following Scala code:
package metaconfig.internal import metaconfig.Conf import metaconfig.ConfDecoder import metaconfig.ConfError import metaconfig.Configured import metaconfig.generic.Settings object NoTyposDecoder { def apply[A]( underlying: ConfDecoder[A] )(implicit ev: Settings[A]): ConfDecoder[A] = new ConfDecoder[A] {...
Explain and rewrite the following Scala code:
package com.intel.analytics.bigdl.apps.model.inference.flink.TextClassification import com.intel.analytics.bigdl.orca.inference.InferenceModel class TextClassificationInferenceModel(val supportedConcurrentNum: Int, val stopWordsCount: Int, val sequenceLength: Int, val embeddingFilePath: String) extends InferenceMod...
Explain and rewrite the following Scala code:
package io.getquill.context.jdbc.mysql import io.getquill.context.sql.PeopleSpec class PeopleJdbcSpec extends PeopleSpec { val context = testContext import testContext._ override def beforeAll = { testContext.transaction { testContext.run(query[Couple].delete) testContext.run(query[Person].fil...
Explain and rewrite the following Scala code:
import sbt._ object ResolverSettings { lazy val resolvers = Seq( Resolver.mavenLocal, Resolver.sonatypeRepo("releases"), Resolver.typesafeRepo("releases"), Resolver.typesafeRepo("snapshots"), Resolver.sonatypeRepo("snapshots"), "Linter" at "http://hairyfotr.github.io/linteRepo/releases", ...
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 swave.core.impl.stages.fanout import swave.core.Stage import swave.core.impl.{Inport, Outport} import...
Explain and rewrite the following Scala code:
package com.github.andr83.parsek.pipe import java.io.ByteArrayInputStream import java.util.zip.GZIPInputStream import com.github.andr83.parsek._ import com.typesafe.config.Config /** * @author andr83 */ case class UnGzipPipe(config: Config) extends TransformPipe(config) { override def transformString(str: String...
Explain and rewrite the following Scala code:
object Main extends App { implicit class Regex(sc: StringContext) { def r = new util.matching.Regex(sc.parts.mkString, sc.parts.tail.map(_ => "x"): _*) } import scala.io.Source import java.io._ val writer = new PrintWriter(new File("inserts.sql" )) writer.write("use slic;\\n") writer.write("START TRANSACTION;\\n")...
Explain and rewrite the following Scala code:
/* * Copyright 2008, Mark Harrah * * This file is part of Frostbridge. * * Frostbridge 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 optio...
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:
/** * Magmanics Licensing. This web application allows for centralized control * of client application activation, with optional configuration parameters * to control licensable features, and storage of supplementary information * about the client machine. Client applications may interface with this * central serv...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package codeInsight.intention.types import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import org.jetbrains.plugins.scala.ScalaBundle import org.jetbrains.plugins.scala.lang.ps...
Explain and rewrite the following Scala code:
package com.criteo.dev.cluster.docker import com.criteo.dev.cluster.DevClusterProcess import org.slf4j.LoggerFactory import scala.collection.mutable.ListBuffer import scala.sys.process.{Process, ProcessLogger} /** * Builds docker image from docker file * @param dockerFile location of docker file (relative to /d...
Explain and rewrite the following Scala code:
package com.rasterfoundry.common.utils import com.typesafe.scalalogging.LazyLogging import geotrellis.proj4.{LatLng, WebMercator} import geotrellis.vector.{Extent, Point, Polygon, Projected} object TileUtils extends LazyLogging { private val tileSize = 256.0 final case class TileCoordinates(z: Int, x: Int, y: In...
Explain and rewrite the following Scala code:
package com.softwaremill.bootzooka.common import org.joda.time.DateTime import org.joda.time.format.DateTimeFormat import java.util.Random object Utils { val OneWeek = 7 * 24 * 3600 val DateFormat = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss") def md5(s: String): String = { val m = java.security.Messa...
Explain and rewrite the following Scala code:
package commons.utils object PwfStringUtils { def startsWithWhiteSpace(str: String): Boolean = str.matches("(?U)^\\\\s.*") def endsWithWhiteSpace(str: String): Boolean = str.matches("(?U).*\\\\s$") }
Explain and rewrite the following Scala code:
package com.rasterfoundry.datamodel import java.sql.Timestamp import java.time.Instant import java.util.{Date, UUID} import io.circe._ import io.circe.generic.JsonCodec /** A Project's Area of Interest. * This represents an area on the map (a `MultiPolygon`) which a user has * set filters for. If a new Scene en...
Explain and rewrite the following Scala code:
package concurrent_programming.peers import io.threadcso._ import scala.util.Random /* In this protocol, each client node sends its value to a central node, which calculates the minimum and maximum, and sends those back. */ object CentralizedProtocol extends Runnable{ type IntPair = (Int, Int) private val t...
Explain and rewrite the following Scala code:
package io.udash.web.guide.views import io.udash._ import io.udash.web.guide.FaqState object FaqViewFactory extends StaticViewFactory[FaqState.type](() => new FaqView) class FaqView extends View { import scalatags.JsDom.all._ private val content = div( h2("FAQ"), p("TODO") ) override def getTemplat...
Explain and rewrite the following Scala code:
/* * Copyright 2015 IBM 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 applicable law or agreed to ...
Explain and rewrite the following Scala code:
package core import org.scalatest.{FunSpec, Matchers} class InlineEnumsSpec extends FunSpec with Matchers { def buildJson( typ: String = """ |{ | "type": { | "enum": "user_post_error_code", | "description": "A test enum", | "values": [ | { "n...
Explain and rewrite the following Scala code:
package graphql import org.parboiled.scala._ import org.scalatest.{Matchers, FunSuite} class CommonParserTest extends FunSuite with Matchers with ParboiledTestKit { val parser = new CommonParser with Parser test("testComma") { parser.Comma shouldParse "," } test("testWhiteSpace") { parser.WhiteSpa...
Explain and rewrite the following Scala code:
package scalaz.stream import collection.mutable import org.scalacheck.{Prop, Properties} import org.scalacheck.Prop._ import scalaz.{\\/, -\\/} import scala.concurrent.SyncVar import scalaz.concurrent.Task object AsyncTopicSpec extends Properties("topic") { case object TestedEx extends Throwable { override def...
Explain and rewrite the following Scala code:
package org.jetbrains.plugins.scala package lang package parser package parsing package expressions import org.jetbrains.plugins.scala.lang.lexer.ScalaTokenTypes import org.jetbrains.plugins.scala.lang.parser.parsing.builder.ScalaPsiBuilder /** * @author Alexander Podkhalyuzin * Date: 06.03.2008 */ /* * Bindings ::...
Explain and rewrite the following Scala code:
package com.dojo.silhouette.silhouette case class ElemSilhouette( x: Int, // coordenada horizontal h: Int // altura ) { def this(x: Int) = this(x, 0) }
Explain and rewrite the following Scala code:
package cs.ucla.edu.bwaspark.datatype class MemAlnRegArrayType { var maxLength: Int = 0 var curLength: Int = 0 var regs: Array[MemAlnRegType] = _ }
Explain and rewrite the following Scala code:
package controllers import io.rampant.vulgar.security.{AuthRequest, Secured} import play.api.libs.json.Json import play.api.mvc._ object Application extends Controller { val unauthorizedResult = Redirect(routes.Application.index()) def main(title: String) = { implicit request: AuthRequest[AnyContent] => Ok(vi...
Explain and rewrite the following Scala code:
package ndimrtree import shapeless._ import spire._, implicits._, math._ import NDimRTree._, NDimRTreeOps._ // TODO : crisp up, not quite ideal yet, // should ops be monomorphic on rtree or have polymorphic dispatch like it is currently? object NDimRTreeOps { implicit def toLeafOps [V, T <: HList : ZWMin : ZWM...
Explain and rewrite the following Scala code:
package io.mediachain.util import java.io.IOException import io.mediachain.Types.{Hashable, Signable} import io.mediachain.core.TranslationError.{ConversionToJsonFailed, InvalidFormat} import org.json4s.FieldSerializer.ignore import org.json4s.JsonAST.JObject import org.json4s.jackson.{JsonMethods => Json} import org...
Explain and rewrite the following Scala code:
/* * ____ ____ _____ ____ ___ ____ * | _ \ | _ \ | ____| / ___| / _/ / ___| Precog (R) * | |_) | | |_) | | _| | | | | /| | | _ Advanced Analytics Engine for NoSQL Data * | __/ | _ < | |___ | |___ |/ _| | | |_| | Copyright (C) 2010 - 2013 SlamData, Inc....
Explain and rewrite the following Scala code:
/* * Copyright (C) 2017 LREN CHUV for Human Brain Project * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version...
Explain and rewrite the following Scala code:
package util import domain.UserView import org.joda.time.DateTime import org.joda.time.format.DateTimeFormat import play.api.Logger class UserViewParser { def parseRow(row: String): Option[UserView] = { val rowSplitted: Array[String] = row.split("\\t") val timeStamp = rowSplitted(0) val appDomain ...
Explain and rewrite the following Scala code:
package akka.ainterface.datatype import akka.util.ByteString /** * Represents an Erlang term. */ sealed abstract class ErlTerm extends Serializable /** * Represents an integral value of Erlang. */ final case class ErlInteger(value: BigInt) extends ErlTerm object ErlInteger { /** * Creates an ErlInteger fro...
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 model import play.api.libs.json._ /** * Represents the Swagger definition for GithubContent. * @param additionalProperties Any additional properties this model may have. */ @javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2022-02-13...
Explain and rewrite the following Scala code:
/*§ =========================================================================== EighthBridge =========================================================================== Copyright (C) 2016 Gianluca Costa =========================================================================== Licensed under the Apache Lic...
Explain and rewrite the following Scala code:
import java.util.{Calendar, GregorianCalendar} import org.apache.spark.rdd.RDD import org.apache.spark.{SparkConf, SparkContext} import scala.collection.mutable.ArrayBuffer import scala.util.Random object spark_partitioner { /* input structure /user/yilu/tpch1000-spark/lineitem/part-00000 .... *...
Explain and rewrite the following Scala code:
/* *\\ ** \\ \\ / _) \\ \\ / \\ | ** ** \\ \\ / | __ \\ _ \\ __| \\ \\ / |\\/ | ** ** \\ \\ / | | | __/ | \\ \\ / | | ** ** \\_/ _| .__/ \\___| _| \\_/ _| _| ** ** _| ...
Explain and rewrite the following Scala code:
/** * Copyright 2011-2016 GatlingCorp (http://gatling.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.org/licenses/LICENSE-2.0 * * Unless required by appli...
Explain and rewrite the following Scala code:
package test.crawler import org.specs2.mutable.Specification import spray.http.HttpResponse import test.crawler.CrawlerMocksUtil.HttpClientMock import test.crawler.CrawlerMocksUtil.HttpClientMock._ import wow.crawler.WowGuildApi import wow.dto.WowGuild import scala.concurrent.Await import scala.concurrent.duration._ ...
Explain and rewrite the following Scala code:
package dyno.demo object Test { def main(args: Array[String]): Unit = { print("line> ") if (io.StdIn.readLine() != "boo") { println("okay") } else { val x = new NoSuchClass x.foo() } } }
Explain and rewrite the following Scala code:
package controllers import security.MyDeadboltHandler import play.api.mvc.{Action, Controller} import views.html.accessOk import be.objectify.deadbolt.scala.DeadboltActions import be.objectify.deadbolt.core.PatternType /** * * @author Steve Chaloner (steve@objectify.be) */ object PatternController extends Controll...
Explain and rewrite the following Scala code:
package monocle.law import monocle.Lens import monocle.internal.IsEq import cats.data.Const import cats.Id case class LensLaws[S, A](lens: Lens[S, A]) { import IsEq.syntax def getReplace(s: S): IsEq[S] = lens.replace(lens.get(s))(s) <==> s def replaceGet(s: S, a: A): IsEq[A] = lens.get(lens.replace(a...
Explain and rewrite the following Scala code:
package almhirt.herder import java.time.LocalDateTime import almhirt.common.CanCreateDateTime import almhirt.collections.CircularBuffer import java.lang.management.OperatingSystemMXBean final case class RuntimeHistoryEntry( timestamp: LocalDateTime, // The amount of free memory in the Java Virtual Machine. free...
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 sangria.validation.rules import sangria.util.{Pos, ValidationSupport} import org.scalatest.wordspec.AnyWordSpec import sangria.validation.rules.KnownTypeNames.SuggestionFunction class KnownTypeNamesDisabledSpec extends AnyWordSpec with ValidationSupport { override val defaultRule = Some(new KnownTypeNames(...
Explain and rewrite the following Scala code:
/* * Happy Melly Teller * Copyright (C) 2013 - 2015, Happy Melly http://www.happymelly.com * * This file is part of the Happy Melly Teller. * * Happy Melly Teller 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 Fo...
Explain and rewrite the following Scala code:
/* Copyright (C) 2008-2014 University of Massachusetts Amherst. This file is part of "FACTORIE" (Factor graphs, Imperative, Extensible) http://factorie.cs.umass.edu, http://github.com/factorie Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with...
Explain and rewrite the following Scala code:
package org.dele.text.maen import org.dele.text.maen.AtomPropMatcherLib._ import org.dele.text.maen.ConfValueStringParser.Parsed import org.dele.text.maen.TAtomMatcher.PropMatchBase import org.dele.text.maen.matchers.MatcherManager._ import org.dele.text.maen.matchers.{StoppedByMatcherManager, SubMatchCheckerLib} impo...
Explain and rewrite the following Scala code:
/* * Copyright (c) 2016 - Alberto Paro All Rights Reserved. */ package io.megl.web.icons import japgolly.scalajs.react.vdom.all._ /** * Provides type-safe access to Glyphicon icons */ object Glyphicon { def apply(name: String): web.Icon = i(cls := s"glyphicon-$name") def adjust = apply("adjust") def a...