01: /*
02: * @(#)isJava2.java 1.2 04/12/06
03: *
04: * Copyright (c) 1997-2004 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * See the file "LICENSE.txt" for information on usage and redistribution
07: * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
08: */
09: package org.pnuts.lib;
10:
11: import pnuts.lang.PnutsFunction;
12: import pnuts.lang.Context;
13: import pnuts.lang.Pnuts;
14:
15: public class isJava2 extends PnutsFunction {
16:
17: public isJava2() {
18: super ("isJava2");
19: }
20:
21: public boolean defined(int nargs) {
22: return nargs == 0;
23: }
24:
25: protected Object exec(Object args[], Context context) {
26: if (args.length == 0) {
27: if (Pnuts.isJava2()) {
28: return Boolean.TRUE;
29: } else {
30: return Boolean.FALSE;
31: }
32: } else {
33: undefined(args, context);
34: return null;
35: }
36: }
37:
38: public String toString() {
39: return "function isJava2()";
40: }
41: }
|