alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (PrintMgr.scala)

This example Scala source code file (PrintMgr.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

int, many, many, none, none, printmgr, some, some, string, string

The Scala PrintMgr.scala source code

/*                     __                                               *\
**     ________ ___   / /  ___     Scala Parallel Testing               **
**    / __/ __// _ | / /  / _ |    (c) 2007-2011, LAMP/EPFL             **
**  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
\*                                                                      */

// $Id$

package scala.tools.partest
package utils

/**
 * @author Thomas Hofer
 */
object PrintMgr {

  val NONE = 0
  val SOME = 1
  val MANY = 2

  var outline = ""
  var success = ""
  var failure = ""
  var warning = ""
  var default = ""

  def initialization(number: Int) = number match {
    case MANY =>
      outline = Console.BOLD + Console.BLACK
      success = Console.BOLD + Console.GREEN
      failure = Console.BOLD + Console.RED
      warning = Console.BOLD + Console.YELLOW
      default = Console.RESET
    case SOME =>
      outline = Console.BOLD + Console.BLACK
      success = Console.RESET
      failure = Console.BOLD + Console.BLACK
      warning = Console.BOLD + Console.BLACK
      default = Console.RESET
    case _ =>
  }

  def printOutline(msg: String) = print(outline + msg + default)

  def printSuccess(msg: String) = print(success  + msg + default)

  def printFailure(msg: String) = print(failure  + msg + default)

  def printWarning(msg: String) = print(warning  + msg + default)
}

Other Scala examples (source code examples)

Here is a short list of links related to this Scala PrintMgr.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.