⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 value.java

📁 RESIN 3.2 最新源码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
    return emptySet.iterator();  }  /**   * Returns an iterator for the field keys.   * The default implementation uses the Iterator returned   * by {@link #getIterator(Env)}; derived classes may override and   * provide a more efficient implementation.   */  public Iterator<Value> getKeyIterator(Env env)  {    final Iterator<Map.Entry<Value, Value>> iter = getIterator(env);    return new Iterator<Value>() {      public boolean hasNext() { return iter.hasNext(); }      public Value next()      { return iter.next().getKey(); }      public void remove()     { iter.remove(); }    };  }  /**   * Returns the field keys.   */  public Value []getKeyArray(Env env)  {    return NULL_VALUE_ARRAY;  }  /**   * Returns the field values.   */  public Value []getValueArray(Env env)  {    return NULL_VALUE_ARRAY;  }    /**   * Returns an iterator for the field values.   * The default implementation uses the Iterator returned   * by {@link #getIterator(Env)}; derived classes may override and   * provide a more efficient implementation.   */  public Iterator<Value> getValueIterator(Env env)  {    final Iterator<Map.Entry<Value, Value>> iter = getIterator(env);    return new Iterator<Value>() {      public boolean hasNext() { return iter.hasNext(); }      public Value next()      { return iter.next().getValue(); }      public void remove()     { iter.remove(); }    };  }  //  // Object field references  //  /**   * Returns the field value   */  public Value getField(Env env, StringValue name)  {    return NullValue.NULL;  }  /**   * Returns the field ref.   */  public Value getFieldRef(Env env, StringValue name)  {    return getField(env, name);  }  /**   * Returns the field used as a method argument   */  public Value getFieldArg(Env env, StringValue name)  {    return getFieldRef(env, name);  }  /**   * Returns the field ref for an argument.   */  public Value getFieldArgRef(Env env, StringValue name)  {    return getFieldRef(env, name);  }  /**   * Returns the value for a field, creating an object if the field   * is unset.   */  public Value getFieldObject(Env env, StringValue name)  {    Value v = getField(env, name);    if (! v.isset()) {      v = env.createObject();      putField(env, name, v);    }    return v;  }  /**   * Returns the value for a field, creating an object if the field   * is unset.   */  public Value getFieldArray(Env env, StringValue name)  {    Value v = getField(env, name);    Value array = v.toAutoArray();    if (v == array)      return v;    else {      putField(env, name, array);      return array;    }  }  /**   * Returns the field ref.   */  public Value putField(Env env, StringValue name, Value object)  {    return NullValue.NULL;  }  /**   * Returns true if the field is set   */  public boolean issetField(StringValue name)  {    return false;  }  /**   * Removes the field ref.   */  public void unsetField(StringValue name)  {  }  /**   * Returns the field value   */  public Value getThisField(Env env, StringValue name)  {    return getField(env, name);  }  /**   * Returns the field ref.   */  public Value getThisFieldRef(Env env, StringValue name)  {    return getThisField(env, name);  }  /**   * Returns the field used as a method argument   */  public Value getThisFieldArg(Env env, StringValue name)  {    return getThisFieldRef(env, name);  }  /**   * Returns the field ref for an argument.   */  public Value getThisFieldArgRef(Env env, StringValue name)  {    return getThisFieldRef(env, name);  }  /**   * Returns the value for a field, creating an object if the field   * is unset.   */  public Value getThisFieldObject(Env env, StringValue name)  {    Value v = getThisField(env, name);    if (! v.isset()) {      v = env.createObject();      putThisField(env, name, v);    }    return v;  }  /**   * Returns the value for a field, creating an object if the field   * is unset.   */  public Value getThisFieldArray(Env env, StringValue name)  {    Value v = getField(env, name);    Value array = v.toAutoArray();    if (v == array)      return v;    else {      putField(env, name, array);      return array;    }  }  /**   * Returns the field ref.   */  public Value putThisField(Env env, StringValue name, Value object)  {    return putField(env, name, object);  }  /**   * Returns true if the field is set   */  public boolean issetThisField(StringValue name)  {    return issetField(name);  }  /**   * Removes the field ref.   */  public void unsetThisField(StringValue name)  {    unsetField(name);  }  //  // field convenience  //  public Value putField(Env env, String name, Value value)  {    return putThisField(env, env.createString(name), value);  }  /**   * Returns the array ref.   */  public Value get(Value index)  {    return UnsetValue.UNSET;  }  /**   * Returns a reference to the array value.   */  public Value getRef(Value index)  {    return get(index);  }  /**   * Returns the array ref as a function argument.   */  public Value getArg(Value index)  {    return get(index);  }  /**   * Returns the array value, copying on write if necessary.   */  public Value getDirty(Value index)  {    return get(index);  }  /**   * Returns the value for a field, creating an array if the field   * is unset.   */  public Value getArray()  {    return this;  }  /**   * Returns the value for a field, creating an array if the field   * is unset.   */  public Value getArray(Value index)  {    return NullValue.NULL;  }  /**   * Returns the value for the variable, creating an object if the var   * is unset.   */  public Value getObject(Env env)  {    return NullValue.NULL;  }  /**   * Returns the value for a field, creating an object if the field   * is unset.   */  public Value getObject(Env env, Value index)  {    return NullValue.NULL;  }  /**   * Sets the value ref.   */  public Value set(Value value)  {    return value;  }  /**   * Sets the array ref.   */  public Value put(Value index, Value value)  {    return value;  }  /**   * Appends an array value   */  public Value put(Value value)  {    return value;  }  /**   * Sets the array ref.   */  public Value putRef()  {    return NullValue.NULL;  }  /**   * Appends the array   */  public Value putArray()  {    ArrayValue value = new ArrayValueImpl();    put(value);    return value;  }  /**   * Appends a new object   */  public Value putObject(Env env)  {    Value value = env.createObject();    put(value);    return value;  }  /**   * Return true if the array value is set   */  public boolean isset(Value index)  {    return false;  }  /**   * Return unset the value.   */  public Value remove(Value index)  {    return UnsetValue.UNSET;  }    /**   * Takes the values of this array, unmarshalls them to objects of type   * <i>elementType</i>, and puts them in a java array.   */  public Object valuesToArray(Env env, Class elementType)  {    env.error(L.l("Can't assign {0} with type {1} to {2}[]", this, this.getClass(), elementType));    return null;  }  /**   * Returns the character at the named index.   */  public Value charValueAt(long index)  {    return NullValue.NULL;  }  /**   * Sets the character at the named index.   */  public Value setCharValueAt(long index, String value)  {    return NullValue.NULL;  }  /**   * Prints the value.   * @param env   */  public void print(Env env)  {    env.print(toString(env));  }  /**   * Prints the value.   * @param env   */  public void print(Env env, WriteStream out)  {    try {      out.print(toString(env));    } catch (IOException e) {      throw new QuercusRuntimeException(e);    }  }  /**   * Serializes the value.   */  public void serialize(StringBuilder sb)  {    throw new UnsupportedOperationException(getClass().getName());  }    /*   * Serializes the value.   *    * @param sb holds result of serialization   * @param serializeMap holds reference indexes   */  public void serialize(StringBuilder sb, SerializeMap serializeMap)  {    serializeMap.incrementIndex();        serialize(sb);  }  /**   * Exports the value.   */  public void varExport(StringBuilder sb)  {    throw new UnsupportedOperationException(getClass().getName());  }  //  // Java generator code  //  /**   * Generates code to recreate the expression.   *   * @param out the writer to the Java source code.   */  public void generate(PrintWriter out)    throws IOException  {  }  protected void printJavaString(PrintWriter out, StringValue s)  {    if (s == null) {      out.print("");      return;    }    int len = s.length();    for (int i = 0; i < len; i++) {      char ch = s.charAt(i);      switch (ch) {      case '\r':	out.print("\\r");	break;      case '\n':	out.print("\\n");	break;      case '\"':	out.print("\\\"");	break;      case '\'':	out.print("\\\'");	break;      case '\\':	out.print("\\\\");	break;      default:	out.print(ch);	break;      }    }  }  public String toInternString()  {    return toString().intern();  }  public String toDebugString()  {    return toString();  }  final public void varDump(Env env,                            WriteStream out,                            int depth,                            IdentityHashMap<Value, String> valueSet)    throws IOException  {    if (valueSet.get(this) != null) {       out.print("#recursion#");       return;     }    valueSet.put(this, "printing");    try {      varDumpImpl(env, out, depth, valueSet);    }    finally {      valueSet.remove(this);    }  }  protected void varDumpImpl(Env env,                             WriteStream out,                             int depth,                             IdentityHashMap<Value, String> valueSet)    throws IOException  {    out.print("resource(" + toString() + ")");  }  final public void printR(Env env,                           WriteStream out,                           int depth,                           IdentityHashMap<Value, String> valueSet)    throws IOException  {    if (valueSet.get(this) != null) {      out.print("#recursion#");      return;    }    valueSet.put(this, "printing");    try {      printRImpl(env, out, depth, valueSet);    }    finally {      valueSet.remove(this);    }  }  protected void printRImpl(Env env,                            WriteStream out,                            int depth,                            IdentityHashMap<Value, String> valueSet)    throws IOException  {    out.print(toString());  }  protected void printDepth(WriteStream out, int depth)    throws IOException  {    for (int i = 0; i < depth; i++)      out.print(' ');  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -