当前位置: 首页>>代码示例>>Java>>正文


Java IValueFactory.setWriter方法代码示例

本文整理汇总了Java中org.eclipse.imp.pdb.facts.IValueFactory.setWriter方法的典型用法代码示例。如果您正苦于以下问题:Java IValueFactory.setWriter方法的具体用法?Java IValueFactory.setWriter怎么用?Java IValueFactory.setWriter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.imp.pdb.facts.IValueFactory的用法示例。


在下文中一共展示了IValueFactory.setWriter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: closure

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static ISet closure(IValueFactory vf, ISet rel1) {
	if (rel1.getElementType() == TF.voidType())
		return rel1;
	if (!isBinary(rel1))
		throw new IllegalOperationException("closure", rel1.getType());

	Type tupleElementType = rel1.getElementType().getFieldType(0).lub(rel1.getElementType().getFieldType(1));
	Type tupleType = TF.tupleType(tupleElementType, tupleElementType);

	java.util.Set<IValue> closureDelta = computeClosureDelta(vf, rel1, tupleType);

	// NOTE: type is already known, thus, using a SetWriter degrades performance
	ISetWriter resultWriter = vf.setWriter(tupleType);
	resultWriter.insertAll(rel1);
	resultWriter.insertAll(closureDelta);

	return resultWriter.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:19,代码来源:SetFunctions.java

示例2: testEqualityAfterInsertDelete

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
@Test
	public void testEqualityAfterInsertDelete() {
		IValueFactory valueFactory = ValueFactory.getInstance();
		int size = 50;
				
		ISetWriter writer1 = valueFactory.setWriter();
		ISetWriter writer2 = valueFactory.setWriter();
		
		for (int i = size; i > 0; i--) {
			writer1.insert(valueFactory.integer(i));
			writer2.insert(valueFactory.integer(i));
		}
		
		ISet testSet = writer1.done();
		ISet testSetDuplicate = writer2.done();
	
//		IValue VALUE_EXISTING = valueFactory.integer(size - 1);
		IValue VALUE_NOT_EXISTING = valueFactory.integer(size + 1);

		testSetDuplicate = testSet.insert(VALUE_NOT_EXISTING);
		testSetDuplicate = testSetDuplicate.delete(VALUE_NOT_EXISTING);
		
		boolean equals = testSet.equals(testSetDuplicate);
		
		assertTrue (equals);
	}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:27,代码来源:TrieSetTests.java

示例3: immutableSetOfMapsToSetOfMapValues

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
private static ISet immutableSetOfMapsToSetOfMapValues(
				ImmutableSet<ImmutableMap<IConstructor, ImmutableSet<IConstructor>>> result) {
	// convert back to PDB for serialization
	IValueFactory vf = org.eclipse.imp.pdb.facts.impl.persistent.ValueFactory.getInstance();

	ISetWriter resultBuilder = vf.setWriter();

	for (ImmutableMap<IConstructor, ImmutableSet<IConstructor>> dominatorResult : result) {
		IMapWriter builder = vf.mapWriter();

		for (Map.Entry<IConstructor, ImmutableSet<IConstructor>> entry : dominatorResult
						.entrySet()) {
			builder.put(entry.getKey(), immutableSetToPdbSet(entry.getValue()));
		}

		resultBuilder.insert(builder.done());
	}

	return resultBuilder.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:21,代码来源:DominatorsChamp_LazyHashCode.java

示例4: intersect

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static ISet intersect(IValueFactory vf, ISet set1, ISet set2) {
	if (set1 == set2)
		return set1;
	
	ISetWriter w = vf.setWriter();
	
	for (IValue v : set1) {
		if (set2.contains(v)) {
			w.insert(v);
		}
	}
	
	return w.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:15,代码来源:SetFunctions.java

示例5: union

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static ISet union(IValueFactory vf, ISet set1, ISet set2) {
	if (set1 == set2)
		return set1;
	
	ISetWriter w = vf.setWriter();
	w.insertAll(set1);
	w.insertAll(set2);
	return w.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:10,代码来源:SetFunctions.java

示例6: subtract

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static ISet subtract(IValueFactory vf, ISet set1, ISet set2) {
	if (set1 == set2)
		return vf.set();
	
	ISetWriter sw = vf.setWriter();
	for (IValue a : set1) {
		if (!set2.contains(a)) {
			sw.insert(a);
		}
	}
	return sw.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:13,代码来源:SetFunctions.java

示例7: delete

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static ISet delete(IValueFactory vf, ISet set1, IValue v) {
	ISetWriter w = vf.setWriter();

	boolean deleted = false;
	for (Iterator<IValue> iterator = set1.iterator(); iterator.hasNext();) {
		IValue e = iterator.next();

		if (!deleted && e.isEqual(v)) {
			deleted = true; // skip first occurrence
		} else {
			w.insert(e);
		}
	}
	return w.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:16,代码来源:SetFunctions.java

示例8: product

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static ISet product(IValueFactory vf, ISet set1, ISet set2) {
	ISetWriter w = vf.setWriter();

	for (IValue t1 : set1) {
		for (IValue t2 : set2) {
			ITuple t3 = vf.tuple(t1, t2);
			w.insert(t3);
		}
	}

	return w.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:13,代码来源:SetFunctions.java

示例9: carrier

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static ISet carrier(IValueFactory vf, ISet set1) {
	ISetWriter w = vf.setWriter();

	for (IValue t : set1) {
		w.insertAll((ITuple) t);
	}

	return w.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:10,代码来源:SetFunctions.java

示例10: closureStar

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static ISet closureStar(IValueFactory vf, ISet rel1) {
	if (rel1.getElementType() == TF.voidType())
		return rel1;
	if (!isBinary(rel1))
		throw new IllegalOperationException("closureStar", rel1.getType());

	Type tupleElementType = rel1.getElementType().getFieldType(0).lub(rel1.getElementType().getFieldType(1));
	Type tupleType = TF.tupleType(tupleElementType, tupleElementType);

	// calculate
	ShareableValuesHashSet closureDelta = computeClosureDelta(vf, rel1, tupleType);
	ISet carrier = carrier(vf, rel1);

	// aggregate result
	// NOTE: type is already known, thus, using a SetWriter degrades performance
	ISetWriter resultWriter = vf.setWriter(rel1.getElementType());
	resultWriter.insertAll(rel1);
	resultWriter.insertAll(closureDelta);
	
	Iterator<IValue> carrierIterator = carrier.iterator();
	while (carrierIterator.hasNext()) {
		IValue element = carrierIterator.next();
		resultWriter.insert(vf.tuple(tupleType, element, element));
	}

	return resultWriter.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:28,代码来源:SetFunctions.java

示例11: domain

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static ISet domain(IValueFactory vf, ISet set1) {
	int columnIndex = 0;
	ISetWriter w = vf.setWriter();

	for (IValue elem : set1) {
		ITuple tuple = (ITuple) elem;
		w.insert(tuple.get(columnIndex));
	}
	return w.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:11,代码来源:SetFunctions.java

示例12: range

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static ISet range(IValueFactory vf, ISet set1) {
	int columnIndex = set1.getType().getArity() - 1;
	ISetWriter w = vf.setWriter();

	for (IValue elem : set1) {
		ITuple tuple = (ITuple) elem;
		w.insert(tuple.get(columnIndex));
	}

	return w.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:12,代码来源:SetFunctions.java

示例13: project

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static ISet project(IValueFactory vf, ISet set1, int... fields) {
	ISetWriter w = vf.setWriter();

	for (IValue v : set1) {
		w.insert(((ITuple) v).select(fields));
	}

	return w.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:10,代码来源:SetFunctions.java

示例14: immutableSetToPdbSet

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
private static <K extends IValue> ISet immutableSetToPdbSet(ImmutableSet<K> set) {
	IValueFactory vf = org.eclipse.imp.pdb.facts.impl.persistent.ValueFactory.getInstance();

	ISetWriter builder = vf.setWriter();

	for (K key : set) {
		builder.insert(key);
	}

	return builder.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:12,代码来源:DominatorsChamp_LazyHashCode.java

示例15: insert

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static ISet insert(IValueFactory vf, ISet set1, IValue e) {
	ISetWriter sw = vf.setWriter();
	sw.insertAll(set1);
	sw.insert(e);
	return sw.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:7,代码来源:SetFunctions.java


注:本文中的org.eclipse.imp.pdb.facts.IValueFactory.setWriter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。