summaryrefslogtreecommitdiff
path: root/src/cldc-library/scala/compat/Platform.scala
blob: 6d2ccbcfbb999768998ea8fa4cbafbe4b2b20e0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*                     __                                               *\
**     ________ ___   / /  ___     Scala API                            **
**    / __/ __// _ | / /  / _ |    (c) 2002-2008, LAMP/EPFL             **
**  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
\*                                                                      */

// $Id$


package scala.compat


import java.lang.System
import Predef._

object Platform {

  //type StackOverflowError = java.lang.StackOverflowError
  type ConcurrentModificationException = java.lang.RuntimeException

  /**
   *  @param src     ..
   *  @param srcPos  ..
   *  @param dest    ..
   *  @param destPos ..
   *  @param length  ..
   */
  def arraycopy(src: AnyRef, srcPos: Int, dest: AnyRef, destPos: Int, length: Int): Unit =
    System.arraycopy(src, srcPos, dest, destPos, length)

  /** Create array of the same type as arrayInstance with the given
   *  length.
   *
   *  @param elemClass ..
   *  @param length    ..
   *  @return          ..
   */
  def createArray(elemClass: Class[_], length: Int): AnyRef =
    throw new RuntimeException("" + elemClass + "[" + length+ "]")
    //java.lang.reflect.Array.newInstance(elemClass, length)

  //def arrayclear(arr: Array[Int]): Unit = java.util.Arrays.fill(arr, 0)
  def arrayclear(arr: Array[Int]): Unit = for (i <- 0 to arr.length) arr(i) = 0

  def getClassForName(name: String): Class[_] = java.lang.Class.forName(name)

  val EOL = "\n"

  def currentTime: Long = System.currentTimeMillis()

  def collectGarbage: Unit = System.gc()

}