01: /*
02: * SameArgumentObjectsCmd.java --
03: *
04: * Return 1 if each arguments to the command
05: * is the same TclObject.
06: *
07: * Copyright (c) 2002 by Mo DeJong
08: *
09: * See the file "license.terms" for information on usage and redistribution
10: * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11: *
12: * RCS: @(#) $Id: SameArgumentObjectsCmd.java,v 1.1 2002/12/31 05:37:17 mdejong Exp $
13: */
14:
15: package tests;
16:
17: import tcl.lang.*;
18:
19: public class SameArgumentObjectsCmd implements Command {
20: public void cmdProc(Interp interp, TclObject[] objv)
21: throws TclException {
22: if (objv.length < 3) {
23: throw new TclNumArgsException(interp, 1, objv,
24: "obj obj ?obj ...?");
25: }
26: TclObject obj = objv[1];
27: boolean same = true;
28: for (int i = 2; i < objv.length; i++) {
29: if (obj != objv[i]) {
30: same = false;
31: break;
32: }
33: }
34: interp.setResult(same);
35: return;
36: }
37: }
|