Z (programming language)
From Wikipedia, the free encyclopedia
This article is about the simulation language. For the specification language, see Z notation.
|
|
This article may contain material not appropriate for Wikipedia. Please discuss this issue on the talk page. |
| Paradigm(s) | stack-oriented, simulation |
|---|---|
| Developer | ZOLO Technologies |
Z is a stack-based, complex arithmetic simulation language by ZOLO Technologies.
[edit] Simulation Object
// function (side, x, at, format, labels = TRUE, ...) {
//
// mat <- missing(at) || is.null(at)
// if (!mat)
// x <- as.POSIXct(at)
// else x <- as.POSIXct(x)
// range <- par("usr")[if (side%%2)
// 1L:2L
// else 3L:4L]
// d <- range[2L] - range[1L]
// z <- c(range, x[is.finite(x)])
// attr(z, "tzone") <- attr(x, "tzone")
// if (d < 1.1 * 60) {
// sc <- 1
// if (missing(format))
// format <- "%S"
// }
// else if (d < 1.1 * 60 * 60) {
// sc <- 60
// if (missing(format))
// format <- "%M:%S"
// }
// else if (d < 1.1 * 60 * 60 * 24) {
// sc <- 60 * 60
// if (missing(format))
// format <- "%H:%M"
// }
// else if (d < 2 * 60 * 60 * 24) {
// sc <- 60 * 60
// if (missing(format))
// format <- "%a %H:%M"
// }
// else if (d < 7 * 60 * 60 * 24) {
// sc <- 60 * 60 * 24
// if (missing(format))
// format <- "%a"
// }
// else {
// sc <- 60 * 60 * 24
// }
// if (d < 60 * 60 * 24 * 50) {
// zz <- pretty(z/sc)
// z <- zz * sc
// z <- .POSIXct(z, attr(x, "tzone"))
// if (sc == 60 * 60 * 24)
// z <- as.POSIXct(round(z, "days"))
// if (missing(format))
// format <- "%b %d"
// }
// else if (d < 1.1 * 60 * 60 * 24 * 365) {
// z <- .POSIXct(z, attr(x, "tzone"))
// zz <- as.POSIXlt(z)
// zz$mday <- zz$wday <- zz$yday <- 1
// zz$isdst <- -1
// zz$hour <- zz$min <- zz$sec <- 0
// zz$mon <- pretty(zz$mon)
// m <- length(zz$mon)
// M <- 2 * m
// m <- rep.int(zz$year[1L], m)
// zz$year <- c(m, m + 1)
// zz <- lapply(zz, function(x) rep(x, length.out = M))
// zz <- .POSIXlt(zz, attr(x, "tzone"))
// z <- as.POSIXct(zz)
// if (missing(format))
// format <- "%b"
// }
// else {
// z <- .POSIXct(z, attr(x, "tzone"))
// zz <- as.POSIXlt(z)
// zz$mday <- zz$wday <- zz$yday <- 1
// zz$isdst <- -1
// zz$mon <- zz$hour <- zz$min <- zz$sec <- 0
// zz$year <- pretty(zz$year)
// M <- length(zz$year)
// zz <- lapply(zz, function(x) rep(x, length.out = M))
// z <- as.POSIXct(.POSIXlt(zz))
// if (missing(format))
// format <- "%Y"
// }
// if (!mat)
// z <- x[is.finite(x)]
// keep <- z >= range[1L] & z <= range[2L]
// z <- z[keep]
// if (!is.logical(labels))
// labels <- labels[keep]
// else if (identical(labels, TRUE))
// labels <- format(z, format = format)
// else if (identical(labels, FALSE))
// labels <- rep("", length(z))
// axis(side, at = z, labels = labels, ...)
// }
[edit] References
- "Z". FOLDOC. http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=Z&action=Search. Retrieved July 11, 2005.
This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL.