本文整理汇总了Java中gnu.trove.iterator.TIntIterator类的典型用法代码示例。如果您正苦于以下问题:Java TIntIterator类的具体用法?Java TIntIterator怎么用?Java TIntIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TIntIterator类属于gnu.trove.iterator包,在下文中一共展示了TIntIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import gnu.trove.iterator.TIntIterator; //导入依赖的package包/类
@Override
public String toString() {
StringBuilder outputBuilder = new StringBuilder();
outputBuilder.append("{");
for(TEquivalence entry : this) {
outputBuilder.append("{");
for (TIntIterator valueIt=entry.iterator(); valueIt.hasNext(); ) {
// for (TIntIteratorInteger value : entry) {
outputBuilder.append(valueIt.next());
outputBuilder.append(",");
}
outputBuilder.append("}");
}
outputBuilder.append("}");
return outputBuilder.toString();
}
示例2: toString
import gnu.trove.iterator.TIntIterator; //导入依赖的package包/类
@Override
public String toString() {
StringBuilder outputBuilder = new StringBuilder();
outputBuilder.append(String.format("[%s]{", this.indices));
for(TEquivalence equivalenceGroup : this) {
outputBuilder.append("{");
for (TIntIterator valueIt=equivalenceGroup.iterator(); valueIt.hasNext(); ) {
outputBuilder.append(valueIt.next());
outputBuilder.append(",");
}
outputBuilder.append("}");
}
outputBuilder.append("}");
return outputBuilder.toString();
}
示例3: refineBy
import gnu.trove.iterator.TIntIterator; //导入依赖的package包/类
public Collection<Partition> refineBy(int target) {
HashMap<Cluster, Partition> map = new HashMap<Cluster, Partition>();
for(TIntIterator iter = array.iterator(); iter.hasNext();) {
int next = iter.next();
Cluster c = StrippedPartition.clusters.get(next)[target];
if(c == null) {
continue;
}
if(map.containsKey(c)) {
map.get(c).add(next);
} else {
Partition p = new Partition();
p.add(next);
map.put(c, p);
}
}
return map.values();
}
示例4: materials
import gnu.trove.iterator.TIntIterator; //导入依赖的package包/类
public Iterable<MaterialData> materials() {
return new Iterable<MaterialData>() {
@Override
public Iterator<MaterialData> iterator() {
return new Iterator<MaterialData>() {
final TIntIterator iter = counts.keySet().iterator();
@Override
public boolean hasNext() {
return iter.hasNext();
}
@Override
public MaterialData next() {
return decodeMaterial(iter.next());
}
@Override
public void remove() {
iter.remove();
}
};
}
};
}
示例5: removeAll
import gnu.trove.iterator.TIntIterator; //导入依赖的package包/类
/** {@inheritDoc} */
public boolean removeAll( TIntCollection collection ) {
if ( this == collection ) {
clear();
return true;
}
boolean changed = false;
TIntIterator iter = collection.iterator();
while ( iter.hasNext() ) {
int element = iter.next();
if ( remove( element ) ) {
changed = true;
}
}
return changed;
}
示例6: removeAll
import gnu.trove.iterator.TIntIterator; //导入依赖的package包/类
/** {@inheritDoc} */
public boolean removeAll( TIntCollection collection ) {
if ( collection == this ) {
clear();
return true;
}
boolean changed = false;
TIntIterator iter = collection.iterator();
while ( iter.hasNext() ) {
int element = iter.next();
if ( remove( element ) ) {
changed = true;
}
}
return changed;
}
示例7: equals
import gnu.trove.iterator.TIntIterator; //导入依赖的package包/类
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TIntLinkedList that = (TIntLinkedList) o;
if (no_entry_value != that.no_entry_value) return false;
if (size != that.size) return false;
TIntIterator iterator = iterator();
TIntIterator thatIterator = that.iterator();
while (iterator.hasNext()) {
if (!thatIterator.hasNext())
return false;
if (iterator.next() != thatIterator.next())
return false;
}
return true;
}
示例8: iterator
import gnu.trove.iterator.TIntIterator; //导入依赖的package包/类
/**
* Creates an iterator over the values of the set.
*
* @return an iterator with support for removals in the underlying set
*/
public Iterator<Integer> iterator() {
return new Iterator<Integer>() {
private final TIntIterator it = _set.iterator();
public Integer next() {
return Integer.valueOf( it.next() );
}
public boolean hasNext() {
return it.hasNext();
}
public void remove() {
it.remove();
}
};
}
示例9: ProbeTable
import gnu.trove.iterator.TIntIterator; //导入依赖的package包/类
public ProbeTable(Partition partition) {
// set the no entry key and no entry value to something recognizable
super(partition.size(), 2, -1, -1);
// The probe table maps each tuple index to the index of the equivalence class it belongs to
for (TEquivalence equivalenceGroup : partition) {
int groupIdentifier = equivalenceGroup.getIdentifier();
for (TIntIterator groupValueIt=equivalenceGroup.iterator(); groupValueIt.hasNext(); ) {
// for (Integer groupValue : equivalenceGroup) {
this.put(groupValueIt.next(), groupIdentifier);
}
}
}
示例10: retainAll
import gnu.trove.iterator.TIntIterator; //导入依赖的package包/类
public boolean retainAll( TIntCollection collection ) {
if ( this == collection ) {
return false;
}
boolean modified = false;
TIntIterator iter = iterator();
while ( iter.hasNext() ) {
if ( ! collection.contains( iter.next() ) ) {
iter.remove();
modified = true;
}
}
return modified;
}
示例11: removeAll
import gnu.trove.iterator.TIntIterator; //导入依赖的package包/类
/** {@inheritDoc} */
public boolean removeAll(int[] array) {
Arrays.sort(array);
boolean modified = false;
TIntIterator iter = iterator();
while (iter.hasNext()) {
if (Arrays.binarySearch(array, iter.next()) >= 0) {
iter.remove();
modified = true;
}
}
return modified;
}
示例12: containsAll
import gnu.trove.iterator.TIntIterator; //导入依赖的package包/类
/** {@inheritDoc} */
public boolean containsAll( TIntCollection collection ) {
TIntIterator iter = collection.iterator();
while ( iter.hasNext() ) {
if ( ! TObjectIntHashMap.this.containsValue( iter.next() ) ) {
return false;
}
}
return true;
}
示例13: buildCoalscingEdgeCosts
import gnu.trove.iterator.TIntIterator; //导入依赖的package包/类
private PBQPMatrix buildCoalscingEdgeCosts(
TIntArrayList allowedReg1,
TIntArrayList allowedReg2, double cost)
{
PBQPMatrix m = new PBQPMatrix(allowedReg1.size()+1, allowedReg2.size()+1);
boolean isAllZero = true;
int i = 1;
for (TIntIterator itr = allowedReg1.iterator(); itr.hasNext(); )
{
int j = 1;
int reg1 = itr.next();
for (TIntIterator itr2 = allowedReg2.iterator(); itr2.hasNext(); )
{
if (reg1 == itr2.next())
{
m.set(i, j, -cost);
isAllZero = false;
}
j++;
}
i++;
}
if (isAllZero)
return null;
return m;
}
示例14: buildInterferenceEdgeCosts
import gnu.trove.iterator.TIntIterator; //导入依赖的package包/类
private PBQPMatrix buildInterferenceEdgeCosts(
TIntArrayList allowedReg1,
TIntArrayList allowedReg2)
{
PBQPMatrix m = new PBQPMatrix(allowedReg1.size()+1, allowedReg2.size()+1);
boolean isAllZero = true;
int i = 1;
for (TIntIterator itr = allowedReg1.iterator(); itr.hasNext(); )
{
int j = 1;
int reg1 = itr.next();
for (TIntIterator itr2 = allowedReg2.iterator(); itr2.hasNext(); )
{
// If the row/column regs are identical or alias insert an infinity.
int reg2 = itr2.next();
if (tri.regsOverlap(reg1, reg2))
{
m.set(i, j, Double.MAX_VALUE);
isAllZero = false;
}
j++;
}
i++;
}
if (isAllZero)
return null;
return m;
}
示例15: retainAll
import gnu.trove.iterator.TIntIterator; //导入依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings({"SuspiciousMethodCalls"})
public boolean retainAll( Collection<?> collection ) {
boolean modified = false;
TIntIterator iter = iterator();
while ( iter.hasNext() ) {
if ( ! collection.contains( Integer.valueOf ( iter.next() ) ) ) {
iter.remove();
modified = true;
}
}
return modified;
}