Examples of RuleWritable


Examples of com.tinkerpop.gremlin.giraph.process.computer.util.RuleWritable

                    MemoryHelper.validateKey(key);
                    this.registerPersistentAggregator(key, MemoryAggregator.class);
                }
                this.registerPersistentAggregator(Constants.GREMLIN_GIRAPH_HALT, MemoryAggregator.class);
                this.registerPersistentAggregator(Constants.SYSTEM_RUNTIME, MemoryAggregator.class);
                this.setAggregatedValue(Constants.GREMLIN_GIRAPH_HALT, new RuleWritable(RuleWritable.Rule.SET, false));
                this.set(Constants.SYSTEM_RUNTIME, System.currentTimeMillis());
            } catch (final Exception e) {
                throw new IllegalStateException(e.getMessage(), e);
            }
            this.vertexProgram.setup(this);
        } else {
            if (this.get(Constants.GREMLIN_GIRAPH_HALT)) {
                this.haltComputation();
            } else if (this.vertexProgram.terminate(this)) { // terminate
                if (!this.getConf().getBoolean(Constants.GREMLIN_GIRAPH_DERIVE_MEMORY, false)) // no need for the extra BSP round if memory is not required
                    this.haltComputation();
                else
                    this.setAggregatedValue(Constants.GREMLIN_GIRAPH_HALT, new RuleWritable(RuleWritable.Rule.SET, true));
            }
        }
    }
View Full Code Here

Examples of com.tinkerpop.gremlin.giraph.process.computer.util.RuleWritable

        return this.memoryKeys;
    }

    @Override
    public boolean exists(final String key) {
        final RuleWritable rule = this.isMasterCompute ? this.getAggregatedValue(key) : this.worker.getAggregatedValue(key);
        return null != rule.getObject();
    }
View Full Code Here

Examples of com.tinkerpop.gremlin.giraph.process.computer.util.RuleWritable

    }

    @Override
    public <R> R get(final String key) throws IllegalArgumentException {
        //this.checkKey(key);
        final RuleWritable rule = this.isMasterCompute ? this.getAggregatedValue(key) : this.worker.getAggregatedValue(key);
        if (null == rule.getObject())
            throw Memory.Exceptions.memoryDoesNotExist(key);
        else
            return rule.getObject();
    }
View Full Code Here

Examples of com.tinkerpop.gremlin.giraph.process.computer.util.RuleWritable

    @Override
    public void set(final String key, Object value) {
        this.checkKeyValue(key, value);
        if (this.isMasterCompute)
            this.setAggregatedValue(key, new RuleWritable(RuleWritable.Rule.SET, value));
        else
            this.worker.aggregate(key, new RuleWritable(RuleWritable.Rule.SET, value));
    }
View Full Code Here

Examples of com.tinkerpop.gremlin.giraph.process.computer.util.RuleWritable

    public boolean and(final String key, final boolean bool) {
        this.checkKeyValue(key, bool);
        if (this.isMasterCompute) {  // only called on setup() and terminate()
            Boolean value = this.<RuleWritable>getAggregatedValue(key).<Boolean>getObject();
            value = null == value ? bool : bool && value;
            this.setAggregatedValue(key, new RuleWritable(RuleWritable.Rule.AND, value));
            return value;
        } else {
            final Boolean result = ((RuleWritable) this.worker.getAggregatedValue(key)).getObject();
            this.worker.aggregate(key, new RuleWritable(RuleWritable.Rule.AND, bool));
            return null == result ? bool : result && bool;
        }
    }
View Full Code Here

Examples of com.tinkerpop.gremlin.giraph.process.computer.util.RuleWritable

    public boolean or(final String key, final boolean bool) {
        this.checkKeyValue(key, bool);
        if (this.isMasterCompute) {   // only called on setup() and terminate()
            Boolean value = this.<RuleWritable>getAggregatedValue(key).<Boolean>getObject();
            value = null == value ? bool : bool || value;
            this.setAggregatedValue(key, new RuleWritable(RuleWritable.Rule.OR, value));
            return value;
        } else {
            final Boolean result = ((RuleWritable) this.worker.getAggregatedValue(key)).getObject();
            this.worker.aggregate(key, new RuleWritable(RuleWritable.Rule.OR, bool));
            return null == result ? bool : result || bool;
        }
    }
View Full Code Here

Examples of com.tinkerpop.gremlin.giraph.process.computer.util.RuleWritable

    public long incr(final String key, final long delta) {
        this.checkKeyValue(key, delta);
        if (this.isMasterCompute) {   // only called on setup() and terminate()
            Number value = this.<RuleWritable>getAggregatedValue(key).<Number>getObject();
            value = null == value ? delta : value.longValue() + delta;
            this.setAggregatedValue(key, new RuleWritable(RuleWritable.Rule.INCR, value));
            return value.longValue();
        } else {
            final Long result = ((RuleWritable) this.worker.getAggregatedValue(key)).getObject();
            this.worker.aggregate(key, new RuleWritable(RuleWritable.Rule.INCR, delta));
            return null == result ? delta : result + delta;
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.