com.scudata.dm.op.IDResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of esproc Show documentation
Show all versions of esproc Show documentation
SPL(Structured Process Language) A programming language specially for structured data computing.
package com.scudata.dm.op;
import java.util.Comparator;
import com.scudata.array.IArray;
import com.scudata.dm.ComputeStack;
import com.scudata.dm.Context;
import com.scudata.dm.Current;
import com.scudata.dm.Env;
import com.scudata.dm.HashLinkSet;
import com.scudata.dm.ListBase1;
import com.scudata.dm.Sequence;
import com.scudata.dm.comparator.BaseComparator;
import com.scudata.dm.cursor.ICursor;
import com.scudata.expression.Expression;
import com.scudata.expression.fn.gather.ICount.ICountBitSet;
import com.scudata.expression.fn.gather.ICount.ICountPositionSet;
import com.scudata.util.HashUtil;
/**
* ???ڶ?????????????ȡȥ?غ???ֶ?ֵ
* @author RunQian
*
*/
public class IDResult implements IResult {
private Expression[] exps; // ȥ???ֶα???ʽ????
private int count; // ?????Ľ????????ʡ?Ա???????
private String opt;
private Context ctx; // ??????????
private boolean optB;
private boolean optN;
private HashUtil hashUtil; // ?ṩ??ϣ????Ĺ?ϣ??
private ListBase1 [][]allGroups; // ??ϣ??
private Sequence []outs;
private ICountBitSet bitSet;
private ICountPositionSet posSet;
private HashLinkSet hashLinkSet;
public IDResult(Expression []exps, int count, String opt, Context ctx) {
this.exps = exps;
this.count = count;
this.opt = opt;
this.ctx = ctx;
if (opt != null) {
optB = opt.indexOf('b') != -1;
optN = opt.indexOf('n') != -1;
}
int capacity;
if (count == Integer.MAX_VALUE) {
capacity = Env.getDefaultHashCapacity();
} else {
capacity = count;
}
int fcount = exps.length;
if (optB) {
bitSet = new ICountBitSet();
} else if (optN) {
posSet = new ICountPositionSet();
} else if (exps.length == 1 && count == Integer.MAX_VALUE) {
hashLinkSet = new HashLinkSet();
} else {
hashUtil = new HashUtil(capacity);
allGroups = new ListBase1[fcount][];
for (int i = 0; i < fcount; ++i) {
allGroups[i] = new ListBase1[hashUtil.getCapacity()];
}
}
outs = new Sequence[fcount];
for (int i = 0; i < fcount; ++i) {
outs[i] = new Sequence(capacity);
}
}
/**
* ȡȥ?غ?Ľ??
* @return Sequence
*/
public Sequence getResultSequence() {
Sequence result;
if (hashLinkSet != null) {
IArray array = hashLinkSet.getElementArray();
array.sort();
result = new Sequence(array);
} else if (exps.length == 1) {
if (opt == null || opt.indexOf('u') == -1) {
Comparator
© 2015 - 2024 Weber Informatics LLC | Privacy Policy