本文整理汇总了Java中it.unimi.dsi.fastutil.objects.AbstractObjectSet类的典型用法代码示例。如果您正苦于以下问题:Java AbstractObjectSet类的具体用法?Java AbstractObjectSet怎么用?Java AbstractObjectSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractObjectSet类属于it.unimi.dsi.fastutil.objects包,在下文中一共展示了AbstractObjectSet类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sparseEntrySet
import it.unimi.dsi.fastutil.objects.AbstractObjectSet; //导入依赖的package包/类
@Override
public ObjectSet<Int2DoubleMap.Entry> sparseEntrySet() {
return new AbstractObjectSet<Int2DoubleMap.Entry>() {
@Override
public ObjectIterator<Int2DoubleMap.Entry> iterator() {
return new ObjectIterator<Int2DoubleMap.Entry>() {
int n = 0;
@Override
public int skip(int i) {
int nold = n;
n = Math.max(0, Math.min(size(), n + i));
return n - nold;
}
@Override
public boolean hasNext() {
return n < size();
}
@Override
public Int2DoubleMap.Entry next() {
return new AbstractInt2DoubleMap.BasicEntry(n, getDouble(n++));
}
@Override
public void remove() {
}
};
}
@Override
public int size() {
return DenseVector.this.size();
}
};
}
示例2: keySet
import it.unimi.dsi.fastutil.objects.AbstractObjectSet; //导入依赖的package包/类
public ObjectSet<LongArrayBitVector> keySet() {
return new AbstractObjectSet<LongArrayBitVector>() {
@Override
public ObjectIterator<LongArrayBitVector> iterator() {
return new ObjectIterator<LongArrayBitVector>() {
private int i = 0;
private int pos = -1;
@Override
public boolean hasNext() {
return i < size;
}
@Override
public LongArrayBitVector next() {
if (! hasNext()) throw new NoSuchElementException();
while(node[++pos] == null);
i++;
return LongArrayBitVector.copy(node[pos].handle(transform));
}
};
}
@Override
public boolean contains(Object o) {
final BitVector v = (BitVector)o;
return get(v, true) != null;
}
@Override
public int size() {
return size;
}
};
}
示例3: mapTargetInstance
import it.unimi.dsi.fastutil.objects.AbstractObjectSet; //导入依赖的package包/类
public Instances mapTargetInstance(Instances inp){
// Creates instances with the same format
Instances result=getOutputFormat();
Attribute contentAtt=inp.attribute(this.m_textIndex.getIndex());
for(Instance inst:inp){
String content=inst.stringValue(contentAtt);
// tokenises the content
List<String> tokens = affective.core.Utils.tokenize(content, this.toLowerCase, this.standarizeUrlsUsers, this.reduceRepeatedLetters, this.m_tokenizer,this.m_stemmer,this.m_stopwordsHandler);
// Identifies the distinct terms
AbstractObjectSet<String> terms=new ObjectOpenHashSet<String>();
terms.addAll(tokens);
Object2IntMap<String> docVec=this.calculateDocVec(tokens);
double[] values = new double[result.numAttributes()];
values[result.classIndex()]= inst.classValue();
for(String att:docVec.keySet()){
if(this.m_Dictionary.containsKey(att)){
int attIndex=this.m_Dictionary.getInt(att);
// we normalise the value by the number of documents
values[attIndex]=docVec.getInt(att);
}
}
Instance outInst=new SparseInstance(1, values);
inst.setDataset(result);
result.add(outInst);
}
return result;
}
示例4: mapTargetInstance
import it.unimi.dsi.fastutil.objects.AbstractObjectSet; //导入依赖的package包/类
public Instances mapTargetInstance(Instances inp){
// Creates instances with the same format
Instances result=getOutputFormat();
Attribute contentAtt=inp.attribute(this.m_textIndex.getIndex());
for(Instance inst:inp){
String content=inst.stringValue(contentAtt);
// tokenises the content
List<String> tokens = affective.core.Utils.tokenize(content, this.toLowerCase, this.standarizeUrlsUsers, this.reduceRepeatedLetters, this.m_tokenizer,this.m_stemmer,this.m_stopwordsHandler);
// Identifies the distinct terms
AbstractObjectSet<String> terms=new ObjectOpenHashSet<String>();
terms.addAll(tokens);
Object2IntMap<String> docVec=this.calculateDocVec(tokens);
double[] values = new double[result.numAttributes()];
values[result.classIndex()]= inst.classValue();
for(String att:docVec.keySet()){
if(this.m_Dictionary.containsKey(att)){
int attIndex=this.m_Dictionary.getInt(att);
// we normalise the value by the number of documents
values[attIndex]=docVec.getInt(att);
}
}
Instance outInst=new SparseInstance(1, values);
inst.setDataset(result);
result.add(outInst);
}
return result;
}