01: /*
02: * Copyright (C) 2003-2007 Kepler Project.
03: *
04: * Permission is hereby granted, free of charge, to any person obtaining
05: * a copy of this software and associated documentation files (the
06: * "Software"), to deal in the Software without restriction, including
07: * without limitation the rights to use, copy, modify, merge, publish,
08: * distribute, sublicense, and/or sell copies of the Software, and to
09: * permit persons to whom the Software is furnished to do so, subject to
10: * the following conditions:
11: *
12: * The above copyright notice and this permission notice shall be
13: * included in all copies or substantial portions of the Software.
14: *
15: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16: * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17: * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18: * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19: * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20: * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21: * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22: */
23:
24: package org.keplerproject.luajava.test;
25:
26: /**
27: *
28: */
29: public class ObjPrint implements Printable {
30: Printable p;
31:
32: public ObjPrint() {
33: this (null);
34: }
35:
36: public ObjPrint(Printable p) {
37: this .p = p;
38: }
39:
40: public void print(String str) {
41: if (p != null)
42: p.print(str);
43: else
44: System.out.println("Printing from Java1..." + str);
45: }
46:
47: public void print(String str, int i) {
48: if (p != null)
49: p.print(str, 1);
50: else
51: System.out.println("Printing from Java2..." + str);
52: }
53: }
|