/** * Set the edge value data from the option * * @param option EnumConfOption option to use * @param conf Configuration */ public void setEdgeValue(EnumConfOption<T> option, Configuration conf) { edgeValue = option.get(conf); }
/** * Create new EnumConfOption * * @param key String configuration key * @param klass enum class * @param defaultValue default enum value * @param description description of the option * @param <X> enum type * @return EnumConfOption */ public static <X extends Enum<X>> EnumConfOption<X> create(String key, Class<X> klass, X defaultValue, String description) { return new EnumConfOption<X>(key, klass, defaultValue, description); }
/** * Lookup value * * @param conf Configuration * @return enum value */ public T get(Configuration conf) { String valueStr = conf.get(getKey(), getDefaultValueStr()); return T.valueOf(klass, valueStr); }
/** * Set value for given GraphType * * @param conf Configuration * @param graphType GraphType * @param language Language */ public void set(Configuration conf, GraphType graphType, T language) { get(graphType).set(conf, language); }
/** * Constructor * * @param keyPrefix Configuration key prefix * @param klass Enum class * @param defaultValue default value * @param description description of the option */ public PerGraphTypeEnumConfOption(String keyPrefix, Class<T> klass, T defaultValue, String description) { vertexId = EnumConfOption.create(keyPrefix + ".vertex.id", klass, defaultValue, description); vertexValue = EnumConfOption.create(keyPrefix + ".vertex.value", klass, defaultValue, description); edgeValue = EnumConfOption.create(keyPrefix + ".edge.value", klass, defaultValue, description); outgoingMessage = EnumConfOption.create(keyPrefix + ".outgoing.message", klass, defaultValue, description); }
/** * Set value * * @param conf Configuration * @param value to set */ public void set(Configuration conf, Enum<T> value) { conf.set(getKey(), value.name()); }
conf, shouldCreateVertexOnMsgs(conf)); if (shouldSendOneMessageToAll(conf)) { GiraphConstants.MESSAGE_ENCODE_AND_STORE_TYPE.setIfUnset( conf, MessageEncodeAndStoreType.EXTRACT_BYTEARRAY_PER_PARTITION);
/** * Sets up the Configuration for using Jython * * @param conf Configuration to se * @param klassName Class name of Jython Computation */ public static void init(Configuration conf, String klassName) { COMPUTATION_LANGUAGE.set(conf, Language.JYTHON); COMPUTATION_FACTORY_CLASS.set(conf, JythonComputationFactory.class); JythonOptions.JYTHON_COMPUTATION_CLASS_NAME.set(conf, klassName); }
/** * Constructor * * @param graphType GraphType */ public JythonGraphTypeOptions(GraphType graphType) { this.graphType = graphType; jythonClassNameOption = new StrConfOption("giraph.jython." + graphType.dotString() + ".class.name", null, "Name of class in Jython implementing " + graphType.spaceString()); needsWrapperOption = new BooleanConfOption("giraph.jython." + graphType.dotString() + ".needs.wrapper", false, "Whether the " + graphType.spaceString() + " jython type needs a wrapper"); languageOption = EnumConfOption.create("giraph." + graphType.dotString() + ".language", Language.class, Language.JAVA, "Language " + graphType.spaceString() + " is implemented in"); }
/** * Set the vertex id data from the option * * @param option EnumConfOption option to use * @param conf Configuration */ public void setVertexId(EnumConfOption<T> option, Configuration conf) { vertexId = option.get(conf); }
/** * Set the vertex value data from the option * * @param option EnumConfOption option to use * @param conf Configuration */ public void setVertexValue(EnumConfOption<T> option, Configuration conf) { vertexValue = option.get(conf); }
/** * Set the outgoing message value data from the option * * @param option EnumConfOption option to use * @param conf Configuration */ public void setOutgoingMessage(EnumConfOption<T> option, Configuration conf) { outgoingMessage = option.get(conf); }
@Override public boolean isDefaultValue(Configuration conf) { return Objects.equal(get(conf), defaultValue); }
@Override public MessageClasses<I, M> getMessageClasses( ImmutableClassesGiraphConfiguration conf) { return new DefaultMessageClasses( messageClass, DefaultMessageValueFactory.class, messageCombinerClass, GiraphConstants.MESSAGE_ENCODE_AND_STORE_TYPE.get(conf)); }
if (COMPUTATION_LANGUAGE.get(conf) == Language.JYTHON) { return;