Sha256: cd83eb92f5e76a1dadd283bf7c4136378a9187508dbb15ca5535fa13b9c0915e

Contents?: true

Size: 1.04 KB

Versions: 12

Compression:

Stored size: 1.04 KB

Contents

package org.cx4a.rsense.ruby;

import java.util.Map;
import java.util.HashMap;

public class LocalScope implements Scope {
    private RubyModule cref;
    private Map<String, IRubyObject> localVars;

    public LocalScope(RubyModule cref) {
        this.cref = cref;
        this.localVars = new HashMap<String, IRubyObject>();
    }

    public RubyModule getModule() {
        return cref;
    }

    public IRubyObject getValue(String name) {
        return localVars.get(name);
    }

    public void setValue(String name, IRubyObject value) {
        localVars.put(name, value);
    }

    @Override
    public int hashCode() {
        int code = 0;
        code = cref.hashCode();
        for (Map.Entry<String, IRubyObject> entry : localVars.entrySet()) {
            code ^= entry.getKey().hashCode();
            code <<= 4;
            code ^= entry.getValue().hashCode();
        }
        return code;
    }

    @Override
    public String toString() {
        return "<LocalScope: " + cref.toString() + " " + localVars.toString() + ">";
    }
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rsense-core-0.6.6 src/org/cx4a/rsense/ruby/LocalScope.java
rsense-core-0.6.5 src/org/cx4a/rsense/ruby/LocalScope.java
rsense-core-0.6.4 src/org/cx4a/rsense/ruby/LocalScope.java
rsense-core-0.6.2 src/org/cx4a/rsense/ruby/LocalScope.java
rsense-core-0.6.1 src/org/cx4a/rsense/ruby/LocalScope.java
rsense-core-0.6.0 src/org/cx4a/rsense/ruby/LocalScope.java
rsense-core-0.5.9 src/org/cx4a/rsense/ruby/LocalScope.java
rsense-core-0.5.8 src/org/cx4a/rsense/ruby/LocalScope.java
rsense-core-0.5.6 src/org/cx4a/rsense/ruby/LocalScope.java
rsense-core-0.5.2 src/org/cx4a/rsense/ruby/LocalScope.java
rsense-core-0.5.1 src/org/cx4a/rsense/ruby/LocalScope.java
rsense-core-0.5.0 src/org/cx4a/rsense/ruby/LocalScope.java