File: clone.Rd

package info (click to toggle)
rjava 1.0-11-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 3,184 kB
  • sloc: java: 13,223; ansic: 5,479; sh: 3,776; xml: 325; makefile: 250; perl: 33
file content (51 lines) | stat: -rw-r--r-- 1,179 bytes parent folder | download | duplicates (7)
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
\name{clone}
\alias{clone}
\alias{clone,jobjRef-method}
\alias{clone,jarrayRef-method}
\alias{clone,jrectRef-method}

\title{
Object cloner
}
\description{
Generic function to clone objects
}
\usage{
clone(x, ...)
}
\section{Methods}{
  \describe{
    \item{clone}{\code{signature(x = "jobjRef")}: clone a java object reference (must implement Cloneable) }
    \item{clone}{\code{signature(x = "jarrayRef")}: clone a java rugged array (not yet implemented) }
    \item{clone}{\code{signature(x = "jrectRef")}: clone a java rectangular array (not yet implemented) }
  }
}

\arguments{
  \item{x}{An object to clone}
  \item{\dots}{Further arguments, ignored}
}
\value{
A clone of the object
}
\section{Warning}{
	The implementation of clone for java object references uses
	the clone method of the Object class. The reading of its description
	in the java help page is \emph{strongly} recommended. 
}

\examples{
\dontshow{.jinit()}

  p1 <- .jnew("java/awt/Point" )
  p2 <- clone( p1 )
  p2$move( 10L, 10L )
  p1$getX() 

  # check that p1 and p2 are not references to the same java object
  stopifnot( p1$getX() == 0 )
  stopifnot( p2$getX() == 10 )

}
\keyword{ programming }