// Path: src/com/infdot/analysis/solver/DataflowExpression.java
// public interface DataflowExpression<V> {
// 	/**
// 	 * Evaluates expression using the given variable values.
// 	 */
// 	V eval(V[] values);
// 	
// 	/**
// 	 * Helper to collect all variables,
// 	 */
// 	void collectVariables(Set<Integer> variables);
// }
// 
// Path: src/com/infdot/analysis/util/StringUtil.java
// public class StringUtil {
// 	
// 	public static String join(Collection<?> col, String separator) {
// 		StringBuilder builder = new StringBuilder();
// 		
// 		boolean first = true;
// 		for (Object o : col) {
// 			if (first) {
// 				first = false;
// 			} else {
// 				builder.append(separator);
// 			}
// 			builder.append(o);
// 		}
// 		
// 		return builder.toString();
// 	}
// }


import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import com.infdot.analysis.solver.DataflowExpression;
import com.infdot.analysis.util.StringUtil;
package com.infdot.analysis.solver.lattice.powerset;



/**
 * Dataflow expression to construct powerset value from
 * the given set of values.
 * 
 * @author Raivo Laanemets
 *
 * @param <V> type of set element.
 */
public class SetExpression<V> implements DataflowExpression<Set<V>> {
	private Set<V> set;

	public SetExpression(Collection<V> set) {
		this.set = new HashSet<V>(set);
	}
	
	public SetExpression(V element) {
		this.set = Collections.singleton(element);
	}

	@Override
	public Set<V> eval(Set<V>[] values) {
		return set;
	}

	@Override
	public String toString() {
// Path: src/com/infdot/analysis/solver/DataflowExpression.java
// public interface DataflowExpression<V> {
// 	/**
// 	 * Evaluates expression using the given variable values.
// 	 */
// 	V eval(V[] values);
// 	
// 	/**
// 	 * Helper to collect all variables,
// 	 */
// 	void collectVariables(Set<Integer> variables);
// }
// 
// Path: src/com/infdot/analysis/util/StringUtil.java
// public class StringUtil {
// 	
// 	public static String join(Collection<?> col, String separator) {
// 		StringBuilder builder = new StringBuilder();
// 		
// 		boolean first = true;
// 		for (Object o : col) {
// 			if (first) {
// 				first = false;
// 			} else {
// 				builder.append(separator);
// 			}
// 			builder.append(o);
// 		}
// 		
// 		return builder.toString();
// 	}
// }


// Path: src/com/infdot/analysis/solver/lattice/powerset/SetExpression.java
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import com.infdot.analysis.solver.DataflowExpression;
import com.infdot.analysis.util.StringUtil;

package com.infdot.analysis.solver.lattice.powerset;



/**
 * Dataflow expression to construct powerset value from
 * the given set of values.
 * 
 * @author Raivo Laanemets
 *
 * @param <V> type of set element.
 */
public class SetExpression<V> implements DataflowExpression<Set<V>> {
	private Set<V> set;

	public SetExpression(Collection<V> set) {
		this.set = new HashSet<V>(set);
	}
	
	public SetExpression(V element) {
		this.set = Collections.singleton(element);
	}

	@Override
	public Set<V> eval(Set<V>[] values) {
		return set;
	}

	@Override
	public String toString() {
		return "{" + StringUtil.join(set, ",") + "}";