01 
02 /*
03  *  JScripter Simulation 1.0 - For Java To Script
04  *  Copyright (C) 2008-2011  J.J.Liu<jianjunliu@126.com> <http://www.jscripter.org>
05  *  
06  *  This program is free software: you can redistribute it and/or modify
07  *  it under the terms of the GNU Affero General Public License as published by
08  *  the Free Software Foundation, either version 3 of the License, or
09  *  (at your option) any later version.
10  *  
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU Affero General Public License for more details.
15  *  
16  *  You should have received a copy of the GNU Affero General Public License
17  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 package org.jscripter.sim.client;
21 
22 
23 
24 import netscape.javascript.JSObject;
25 
26 import js.Vars;
27 import js.core.*;
28 
29 final class JseRegExp extends JsRegExp implements Unwrappable<JseObject>, Live
30 {
31     public JseRegExp(JseObject var) {
32         super((Object)var);
33     }
34 
35     @Override
36     public final JseRegExp var() {
37         return this;
38     }
39     public final JseObject unwrap() {
40         return (JseObject)var;
41     }
42     public final JSObject getJSObject() {
43         return unwrap().getJSObject();
44     }
45 
46     @Override
47     public final String toString() {
48         return var == null ? "undefined" : unwrap().toString();
49     }
50 
51     @Override
52     public final boolean undefined() {
53         return var == null || unwrap().undefined();
54     }
55 
56     @Override
57     public final boolean delete() {
58         if (undefined()) return false;
59         return unwrap().delete();
60     }
61 
62     @Override
63     public final boolean delete(Mid mid) {
64         return undefined() ? false : unwrap().delete(mid);
65     }
66 
67     public final boolean in(Object o) {
68         return true;
69     }
70 
71     @Override
72     public final Object var(Mid mid) {
73         return unwrap().var(mid);
74     }
75     @Override
76     public final <S> S var(Mid mid, S v) {
77         return unwrap().var(mid, v);
78     }
79 
80     @Override
81     protected final <T> T call(JsFunction.Member<T> member) {
82         return unwrap().call(member);
83     }
84     @Override
85     protected final <T> T call(JsFunction.Member<T> member, Object arg) {
86         return unwrap().call(member, arg);
87     }
88     @Override
89     protected final <T> T call(JsFunction.Member<T> member, Vars<?> args) {
90         return unwrap().call(member, args);
91     }
92 }