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


Java IValueFactory.listWriter方法代码示例

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


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

示例1: delete

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static IList delete(IValueFactory vf, IList list1, int index) {
	IListWriter w = vf.listWriter();

	int currentIndex = 0;
	boolean deleted = false;
	for (Iterator<IValue> iterator = list1.iterator(); iterator.hasNext(); currentIndex++) {
		IValue e = iterator.next();

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

示例2: closure

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static IList closure(IValueFactory vf, IList list1) {
	// will throw exception if not binary and reflexive
	list1.getType().closure();

	IList tmp = list1;

	int prevCount = 0;

	ShareableValuesHashSet addedTuples = new ShareableValuesHashSet();
	while (prevCount != tmp.length()) {
		prevCount = tmp.length();
		IList tcomp = compose(vf, tmp, tmp);
		IListWriter w = vf.listWriter();
		for (IValue t1 : tcomp) {
			if (!tmp.contains(t1)) {
				if (!addedTuples.contains(t1)) {
					addedTuples.add(t1);
					w.append(t1);
				}
			}
		}
		tmp = tmp.concat(w.done());
		addedTuples.clear();
	}
	return tmp;
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:27,代码来源:ListFunctions.java

示例3: carrier

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static IList carrier(IValueFactory vf, IList rel1) {
	IListWriter w = vf.listWriter();
	java.util.HashSet<IValue> cache = new java.util.HashSet<>();

	for (IValue v : rel1) {
		ITuple t = (ITuple) v;
		for (IValue e : t) {
			if (!cache.contains(e)) {
				cache.add(e);
				w.append(e);
			}
		}
	}

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

示例4: range

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static IList range(IValueFactory vf, IList rel1) {
	int columnIndex = rel1.getType().getArity() - 1;
	IListWriter w = vf.listWriter();
	java.util.HashSet<IValue> cache = new java.util.HashSet<>();

	for (IValue elem : rel1) {
		ITuple tuple = (ITuple) elem;
		IValue e = tuple.get(columnIndex);
		if (!cache.contains(e)) {
			cache.add(e);
			w.append(e);
		}
	}

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

示例5: sublist

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static IList sublist(IValueFactory vf, IList list1, int offset, int length) {
	if (offset < 0 || length < 0 || offset + length > list1.length()) {
		throw new IndexOutOfBoundsException();
	}
	IListWriter w = vf.listWriter();
	for (int i = offset; i < offset + length; i++) {
		w.append(list1.get(i));
	}
	return w.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:11,代码来源:ListFunctions.java

示例6: insert

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static IList insert(IValueFactory vf, IList list1, IValue e) {
	IListWriter w = vf.listWriter();
	w.appendAll(list1);
	w.insert(e);

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

示例7: put

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static IList put(IValueFactory vf, IList list1, int i, IValue e)
		throws IndexOutOfBoundsException {
	IListWriter w = vf.listWriter();
	w.appendAll(list1);
	w.replaceAt(i, e);
	return w.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:8,代码来源:ListFunctions.java

示例8: append

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static IList append(IValueFactory vf, IList list1, IValue e) {
	IListWriter w = vf.listWriter();
	w.appendAll(list1);
	w.append(e);

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

示例9: reverse

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static IList reverse(IValueFactory vf, IList list1) {
	IListWriter w = vf.listWriter();
	for (IValue e : list1) {
		w.insert(e);
	}
	return w.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:8,代码来源:ListFunctions.java

示例10: product

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static IList product(IValueFactory vf, IList list1, IList list2) {
	IListWriter w = vf.listWriter();

	for (IValue t1 : list1) {
		for (IValue t2 : list2) {
			IValue values[] = { t1, t2 };
			ITuple t3 = vf.tuple(values);
			w.insert(t3);
		}
	}

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

示例11: intersect

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static IList intersect(IValueFactory vf, IList list1, IList list2) {
	IListWriter w = vf.listWriter();

	for (IValue v : list1) {
		if (list2.contains(v)) {
			w.append(v);
		}
	}

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

示例12: subtract

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static IList subtract(IValueFactory vf, IList list1, IList list2) {
	IListWriter w = vf.listWriter();
	for (IValue v : list1) {
		if (list2.contains(v)) {
			list2 = list2.delete(v);
		} else
			w.append(v);
	}
	return w.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:11,代码来源:ListFunctions.java

示例13: closureStar

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static IList closureStar(IValueFactory vf, IList list1) {
	list1.getType().closure();
	// an exception will have been thrown if the type is not acceptable

	IListWriter reflex = vf.listWriter();

	for (IValue e : carrier(vf, list1)) {
		reflex.insert(vf.tuple(new IValue[] { e, e }));
	}

	return closure(vf, list1).concat(reflex.done());
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:13,代码来源:ListFunctions.java

示例14: compose

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static IList compose(IValueFactory vf, IList list1, IList list2) {

		Type otherTupleType = list2.getType().getFieldTypes();

		if (list1.getElementType() == TF.voidType())
			return list1;
		if (otherTupleType == TF.voidType())
			return list2;

		if (list1.getElementType().getArity() != 2
				|| otherTupleType.getArity() != 2)
			throw new IllegalOperationException("compose",
					list1.getElementType(), otherTupleType);

		// Relaxed type constraint:
		if (!list1.getElementType().getFieldType(1)
				.comparable(otherTupleType.getFieldType(0)))
			throw new IllegalOperationException("compose",
					list1.getElementType(), otherTupleType);

		IListWriter w = vf.listWriter();

		for (IValue v1 : list1) {
			ITuple tuple1 = (ITuple) v1;
			for (IValue t2 : list2) {
				ITuple tuple2 = (ITuple) t2;

				if (tuple1.get(1).isEqual(tuple2.get(0))) {
					w.append(vf.tuple(tuple1.get(0), tuple2.get(1)));
				}
			}
		}
		return w.done();
	}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:35,代码来源:ListFunctions.java

示例15: domain

import org.eclipse.imp.pdb.facts.IValueFactory; //导入方法依赖的package包/类
public static IList domain(IValueFactory vf, IList rel1) {
	int columnIndex = 0;
	IListWriter w = vf.listWriter();
	java.util.HashSet<IValue> cache = new java.util.HashSet<>();

	for (IValue elem : rel1) {
		ITuple tuple = (ITuple) elem;
		IValue e = tuple.get(columnIndex);
		if (!cache.contains(e)) {
			cache.add(e);
			w.append(e);
		}
	}
	return w.done();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:16,代码来源:ListFunctions.java


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