mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Clean up formatting.
This commit is contained in:
parent
b901db9067
commit
efa5849c1f
@ -41,79 +41,79 @@ import java.util.Properties;
|
||||
* @author Patrick C. Beard
|
||||
*/
|
||||
public class Environment extends ScriptableObject {
|
||||
private Environment thePrototypeInstance = null;
|
||||
|
||||
public static void defineClass(ScriptableObject scope) {
|
||||
private Environment thePrototypeInstance = null;
|
||||
|
||||
public static void defineClass(ScriptableObject scope) {
|
||||
try {
|
||||
ScriptableObject.defineClass(scope, Environment.class);
|
||||
} catch (Exception e) {
|
||||
ScriptableObject.defineClass(scope, Environment.class);
|
||||
} catch (Exception e) {
|
||||
throw new Error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return "Environment";
|
||||
}
|
||||
|
||||
public Environment() {
|
||||
if (thePrototypeInstance == null)
|
||||
thePrototypeInstance = this;
|
||||
}
|
||||
|
||||
public Environment(ScriptableObject scope) {
|
||||
setParentScope(scope);
|
||||
public Environment() {
|
||||
if (thePrototypeInstance == null)
|
||||
thePrototypeInstance = this;
|
||||
}
|
||||
|
||||
public Environment(ScriptableObject scope) {
|
||||
setParentScope(scope);
|
||||
Object ctor = ScriptRuntime.getTopLevelProp(scope, "Environment");
|
||||
if (ctor != null && ctor instanceof Scriptable) {
|
||||
Scriptable s = (Scriptable) ctor;
|
||||
setPrototype((Scriptable) s.get("prototype", s));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean has(String name, Scriptable start) {
|
||||
if (this == thePrototypeInstance)
|
||||
return super.has(name, start);
|
||||
|
||||
return (System.getProperty(name) != null);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean has(String name, Scriptable start) {
|
||||
if (this == thePrototypeInstance)
|
||||
return super.has(name, start);
|
||||
|
||||
return (System.getProperty(name) != null);
|
||||
}
|
||||
|
||||
public Object get(String name, Scriptable start) {
|
||||
if (this == thePrototypeInstance)
|
||||
return super.get(name, start);
|
||||
|
||||
String result = System.getProperty(name);
|
||||
if (result != null)
|
||||
return ScriptRuntime.toObject(getParentScope(), result);
|
||||
else
|
||||
return Scriptable.NOT_FOUND;
|
||||
}
|
||||
|
||||
public void put(String name, Scriptable start, Object value) {
|
||||
if (this == thePrototypeInstance)
|
||||
super.put(name, start, value);
|
||||
else
|
||||
System.getProperties().put(name, ScriptRuntime.toString(value));
|
||||
}
|
||||
if (this == thePrototypeInstance)
|
||||
return super.get(name, start);
|
||||
|
||||
String result = System.getProperty(name);
|
||||
if (result != null)
|
||||
return ScriptRuntime.toObject(getParentScope(), result);
|
||||
else
|
||||
return Scriptable.NOT_FOUND;
|
||||
}
|
||||
|
||||
public void put(String name, Scriptable start, Object value) {
|
||||
if (this == thePrototypeInstance)
|
||||
super.put(name, start, value);
|
||||
else
|
||||
System.getProperties().put(name, ScriptRuntime.toString(value));
|
||||
}
|
||||
|
||||
private Object[] collectIds() {
|
||||
Properties props = System.getProperties();
|
||||
Enumeration names = props.propertyNames();
|
||||
Vector keys = new Vector();
|
||||
while (names.hasMoreElements())
|
||||
keys.addElement(names.nextElement());
|
||||
Object[] ids = new Object[keys.size()];
|
||||
keys.copyInto(ids);
|
||||
return ids;
|
||||
}
|
||||
private Object[] collectIds() {
|
||||
Properties props = System.getProperties();
|
||||
Enumeration names = props.propertyNames();
|
||||
Vector keys = new Vector();
|
||||
while (names.hasMoreElements())
|
||||
keys.addElement(names.nextElement());
|
||||
Object[] ids = new Object[keys.size()];
|
||||
keys.copyInto(ids);
|
||||
return ids;
|
||||
}
|
||||
|
||||
public Object[] getIds() {
|
||||
if (this == thePrototypeInstance)
|
||||
return super.getIds();
|
||||
return collectIds();
|
||||
if (this == thePrototypeInstance)
|
||||
return super.getIds();
|
||||
return collectIds();
|
||||
}
|
||||
|
||||
public Object[] getAllIds() {
|
||||
if (this == thePrototypeInstance)
|
||||
return super.getAllIds();
|
||||
return collectIds();
|
||||
if (this == thePrototypeInstance)
|
||||
return super.getAllIds();
|
||||
return collectIds();
|
||||
}
|
||||
}
|
||||
|
@ -41,79 +41,79 @@ import java.util.Properties;
|
||||
* @author Patrick C. Beard
|
||||
*/
|
||||
public class Environment extends ScriptableObject {
|
||||
private Environment thePrototypeInstance = null;
|
||||
|
||||
public static void defineClass(ScriptableObject scope) {
|
||||
private Environment thePrototypeInstance = null;
|
||||
|
||||
public static void defineClass(ScriptableObject scope) {
|
||||
try {
|
||||
ScriptableObject.defineClass(scope, Environment.class);
|
||||
} catch (Exception e) {
|
||||
ScriptableObject.defineClass(scope, Environment.class);
|
||||
} catch (Exception e) {
|
||||
throw new Error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return "Environment";
|
||||
}
|
||||
|
||||
public Environment() {
|
||||
if (thePrototypeInstance == null)
|
||||
thePrototypeInstance = this;
|
||||
}
|
||||
|
||||
public Environment(ScriptableObject scope) {
|
||||
setParentScope(scope);
|
||||
public Environment() {
|
||||
if (thePrototypeInstance == null)
|
||||
thePrototypeInstance = this;
|
||||
}
|
||||
|
||||
public Environment(ScriptableObject scope) {
|
||||
setParentScope(scope);
|
||||
Object ctor = ScriptRuntime.getTopLevelProp(scope, "Environment");
|
||||
if (ctor != null && ctor instanceof Scriptable) {
|
||||
Scriptable s = (Scriptable) ctor;
|
||||
setPrototype((Scriptable) s.get("prototype", s));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean has(String name, Scriptable start) {
|
||||
if (this == thePrototypeInstance)
|
||||
return super.has(name, start);
|
||||
|
||||
return (System.getProperty(name) != null);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean has(String name, Scriptable start) {
|
||||
if (this == thePrototypeInstance)
|
||||
return super.has(name, start);
|
||||
|
||||
return (System.getProperty(name) != null);
|
||||
}
|
||||
|
||||
public Object get(String name, Scriptable start) {
|
||||
if (this == thePrototypeInstance)
|
||||
return super.get(name, start);
|
||||
|
||||
String result = System.getProperty(name);
|
||||
if (result != null)
|
||||
return ScriptRuntime.toObject(getParentScope(), result);
|
||||
else
|
||||
return Scriptable.NOT_FOUND;
|
||||
}
|
||||
|
||||
public void put(String name, Scriptable start, Object value) {
|
||||
if (this == thePrototypeInstance)
|
||||
super.put(name, start, value);
|
||||
else
|
||||
System.getProperties().put(name, ScriptRuntime.toString(value));
|
||||
}
|
||||
if (this == thePrototypeInstance)
|
||||
return super.get(name, start);
|
||||
|
||||
String result = System.getProperty(name);
|
||||
if (result != null)
|
||||
return ScriptRuntime.toObject(getParentScope(), result);
|
||||
else
|
||||
return Scriptable.NOT_FOUND;
|
||||
}
|
||||
|
||||
public void put(String name, Scriptable start, Object value) {
|
||||
if (this == thePrototypeInstance)
|
||||
super.put(name, start, value);
|
||||
else
|
||||
System.getProperties().put(name, ScriptRuntime.toString(value));
|
||||
}
|
||||
|
||||
private Object[] collectIds() {
|
||||
Properties props = System.getProperties();
|
||||
Enumeration names = props.propertyNames();
|
||||
Vector keys = new Vector();
|
||||
while (names.hasMoreElements())
|
||||
keys.addElement(names.nextElement());
|
||||
Object[] ids = new Object[keys.size()];
|
||||
keys.copyInto(ids);
|
||||
return ids;
|
||||
}
|
||||
private Object[] collectIds() {
|
||||
Properties props = System.getProperties();
|
||||
Enumeration names = props.propertyNames();
|
||||
Vector keys = new Vector();
|
||||
while (names.hasMoreElements())
|
||||
keys.addElement(names.nextElement());
|
||||
Object[] ids = new Object[keys.size()];
|
||||
keys.copyInto(ids);
|
||||
return ids;
|
||||
}
|
||||
|
||||
public Object[] getIds() {
|
||||
if (this == thePrototypeInstance)
|
||||
return super.getIds();
|
||||
return collectIds();
|
||||
if (this == thePrototypeInstance)
|
||||
return super.getIds();
|
||||
return collectIds();
|
||||
}
|
||||
|
||||
public Object[] getAllIds() {
|
||||
if (this == thePrototypeInstance)
|
||||
return super.getAllIds();
|
||||
return collectIds();
|
||||
if (this == thePrototypeInstance)
|
||||
return super.getAllIds();
|
||||
return collectIds();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user