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 import netscape.javascript.JSObject;
23 
24 import js.Vars;
25 import js.core.*;
26 
27 final class JseString extends JsString implements Live, Unwrappable<JseObject>
28 {
29     public JseString(JseObject var) {
30         super((Object)var);
31     }
32 
33     @Override
34     public final String valueOf() {
35         return (String)unwrap().valueOf();
36     }
37     @Override
38     public final JseString var() {
39         return this;
40     }
41     public final JseObject unwrap() {
42         return (JseObject)var;
43     }
44     public final JSObject getJSObject() {
45         return unwrap().getJSObject();
46     }
47 
48     @Override
49     public final String toString() {
50         return var == null ? "undefined" : unwrap().toString();
51     }
52 
53     @Override
54     public final boolean undefined() {
55         return var == null || unwrap().undefined();
56     }
57 
58     @Override
59     public final boolean delete() {
60         if (undefined()) return false;
61         return unwrap().delete();
62     }
63 
64     @Override
65     public final boolean delete(Mid mid) {
66         return undefined() ? false : unwrap().delete(mid);
67     }
68 
69     public final boolean in(Object o) {
70         return true;
71     }
72 
73     @Override
74     public final Object var(Mid mid) {
75         return unwrap().var(mid);
76     }
77     @Override
78     public final <S> S var(Mid mid, S v) {
79         return unwrap().var(mid, v);
80     }
81 
82     @Override
83     protected final <T> T call(JsFunction.Member<T> member) {
84         return unwrap().call(member);
85     }
86     @Override
87     protected final <T> T call(JsFunction.Member<T> member, Object arg) {
88         return unwrap().call(member, arg);
89     }
90     @Override
91     protected final <T> T call(JsFunction.Member<T> member, Vars<?> args) {
92         return unwrap().call(member, args);
93     }
94 }