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


Java IPersistentVector类代码示例

本文整理汇总了Java中clojure.lang.IPersistentVector的典型用法代码示例。如果您正苦于以下问题:Java IPersistentVector类的具体用法?Java IPersistentVector怎么用?Java IPersistentVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: done

import clojure.lang.IPersistentVector; //导入依赖的package包/类
@Override
// TODO: turns vector into sequence for type inference
public IList done() {
	IPersistentVector resultVector = (IPersistentVector) xs.persistent();
	Type resultType = List.lub(resultVector.seq());
	return new Vector(resultType, resultVector);
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:8,代码来源:VectorWriter.java

示例2: done

import clojure.lang.IPersistentVector; //导入依赖的package包/类
public IList  done(){
	if (constructedList == null) {
		ITransientCollection ret = PersistentVector.EMPTY.asTransient();
		for(Object item : data)
			ret = ret.conj(item);
		
		IPersistentVector persistentData = (IPersistentVector) ret.persistent();

		constructedList = new Vector(elementType, persistentData);
	}
	
	return constructedList;
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:14,代码来源:FastListWriter.java

示例3: insert

import clojure.lang.IPersistentVector; //导入依赖的package包/类
@Override
public IList insert(IValue newItem) {
	ITransientVector result = PersistentVector.EMPTY.asTransient();
	result = (ITransientVector) result.conj(newItem);
	for(Object item : (Iterable<?>) xs)
		result = (ITransientVector) result.conj(item);
	
	return new Vector(this.lub(newItem), (IPersistentVector) result.persistent());
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:10,代码来源:Vector.java

示例4: delete

import clojure.lang.IPersistentVector; //导入依赖的package包/类
@Override
public IList delete(IValue x) {
	ITransientVector result = PersistentVector.EMPTY.asTransient();
	
	boolean skipped = false;
	for(Object item : (Iterable<?>) xs) {
		if (!skipped && item.equals(x)) {
			skipped = true;
		} else {
			result = (ITransientVector) result.conj(item);
		}
	}
			
	return new Vector(getElementType(), (IPersistentVector) result.persistent());
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:16,代码来源:Vector.java

示例5: select

import clojure.lang.IPersistentVector; //导入依赖的package包/类
@Override
public IValue select(int... fields) throws IndexOutOfBoundsException {
	Type resultType = getType().select(fields);
	
	if (resultType.isTuple()) {
    	ITransientVector resultVector = PersistentVector.EMPTY.asTransient();
    	for (int i : fields) {
    		resultVector = (ITransientVector) resultVector.conj(xs.nth(i));
    	}
    	
    	return new Tuple(resultType, (IPersistentVector) resultVector.persistent());
    } else {
    	return get(fields[0]);
    } 
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:16,代码来源:Tuple.java

示例6: intoClojureList

import clojure.lang.IPersistentVector; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> ClojureList<T> intoClojureList(List<? extends T> list) {
    if (list instanceof ClojureList) return (ClojureList<T>) list;
    if (list instanceof IPersistentVector) return (ClojureList<T>) ClojureList.wrap((IPersistentVector) list);

    // Work around an inference bug in some older JDKs
    Collector<T, TransientList<T>, ClojureList<T>> collector = toClojureList();

    return list.stream().collect(collector);
}
 
开发者ID:rschmitt,项目名称:collider,代码行数:11,代码来源:Collider.java

示例7: toJava

import clojure.lang.IPersistentVector; //导入依赖的package包/类
/**
 * Turn a Clojure result into an object that is easier for Java to handle.
 *
 * @param result The result value to wrap.
 * @param <T> The type of the return value.
 * @return If the result is a core Clojure collection, returns an instanceof IClojureIterable, else returns result.
 */
@SuppressWarnings("unchecked")
public static <T> T toJava(Object result) {
    if (result instanceof IPersistentMap) {
        return (T) new ClojureMap((IPersistentMap) result);
    } else if (result instanceof IPersistentVector) {
        return (T) new ClojureVector((IPersistentVector) result);
    } else if (result instanceof ISeq) {
        return (T) new ClojureSeq((ISeq) result);
    } else if (result instanceof Seqable) {
        return (T) new ClojureSeq(((Seqable)result).seq());
    }
    return (T) result;
}
 
开发者ID:shopsmart,项目名称:ClJ,代码行数:21,代码来源:ClJ.java

示例8: persistentVec

import clojure.lang.IPersistentVector; //导入依赖的package包/类
public static IPersistentVector persistentVec(final Object... init) {
    return RT.vector(init);
}
 
开发者ID:ohpauleez,项目名称:jloj,代码行数:4,代码来源:Jloj.java

示例9: TridentTupleView

import clojure.lang.IPersistentVector; //导入依赖的package包/类
public TridentTupleView(IPersistentVector delegates, ValuePointer[] index, Map<String, ValuePointer> fieldIndex) {
    _delegates = delegates;
    _index = index;
    _fieldIndex = fieldIndex;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:6,代码来源:TridentTupleView.java

示例10:

import clojure.lang.IPersistentVector; //导入依赖的package包/类
public final static IPersistentVector core$vec(IPersistentCollection xs) {
	return (IPersistentVector) core$vec.invoke(xs);
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:4,代码来源:ClojureHelper.java

示例11: insertAt

import clojure.lang.IPersistentVector; //导入依赖的package包/类
private void insertAt(int i, ISeq ys) {
	IPersistentVector tmp = (IPersistentVector) xs.persistent();
	xs = PersistentVector.create(core$concat(core$concat(core$take(i, tmp), ys), core$drop(i, tmp))).asTransient();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:5,代码来源:VectorWriter.java

示例12: Vector

import clojure.lang.IPersistentVector; //导入依赖的package包/类
protected Vector(Type et, IPersistentVector xs) {
	this.ct = inferListOrRelType(et, xs.count() == 0);
	this.xs = xs;
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:5,代码来源:Vector.java

示例13: append

import clojure.lang.IPersistentVector; //导入依赖的package包/类
@Override
public IList append(IValue newItem) {
	return new Vector(this.lub(newItem), (IPersistentVector) xs.cons(newItem));
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:5,代码来源:Vector.java

示例14: replaceInSeq

import clojure.lang.IPersistentVector; //导入依赖的package包/类
protected static ISeq replaceInSeq(ISeq xs, int i, IValue x) {
	IPersistentVector leftRight = core$splitAt(i, xs);
	ISeq newLeft = (ISeq) leftRight.nth(0);	
	ISeq newRight = (ISeq) core$cons.invoke(x, core$next((IPersistentCollection) leftRight.nth(1)));
	return core$concat(newLeft, newRight);
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:7,代码来源:List.java

示例15: Tuple

import clojure.lang.IPersistentVector; //导入依赖的package包/类
protected Tuple(Type type, IPersistentVector xs) {
	super(type);
	this.xs = xs;
	if (!type.isTuple())
		throw new RuntimeException();
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:7,代码来源:Tuple.java


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