本文整理匯總了Java中gnu.trove.map.hash.TIntObjectHashMap.get方法的典型用法代碼示例。如果您正苦於以下問題:Java TIntObjectHashMap.get方法的具體用法?Java TIntObjectHashMap.get怎麽用?Java TIntObjectHashMap.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gnu.trove.map.hash.TIntObjectHashMap
的用法示例。
在下文中一共展示了TIntObjectHashMap.get方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1:
import gnu.trove.map.hash.TIntObjectHashMap; //導入方法依賴的package包/類
/**
* <p>
* Invert an index of quantised features. The inversion process swaps keys
* and feature {@link QuantisedLocalFeature#id}s around so that the inverted
* index is a hash of ids to {@link QuantisedLocalFeature}s with the
* {@link Object#hashCode()} of the key stored in the
* {@link QuantisedLocalFeature#id} field.
* </p>
* <p>
* The original index is not affected by the inversion operation.
* </p>
*
* @param <T>
* the type of local feature.
* @param <K>
* the type of key.
* @param index
* the index to invert.
* @return an inverted-index data structure.
*/
public static <K extends ReadWriteable, T extends QuantisedLocalFeature<?>>
TIntObjectHashMap<TIntObjectHashMap<List<T>>>
invert(LocalFeatureListIndex<K, T> index)
{
final TIntObjectHashMap<TIntObjectHashMap<List<T>>> invertedIndex = new TIntObjectHashMap<TIntObjectHashMap<List<T>>>();
for (final Entry<K, LocalFeatureList<T>> e : index.entrySet()) {
final K docid = e.getKey();
for (final T t : e.getValue()) {
final int termid = t.id;
if (!invertedIndex.containsKey(termid))
invertedIndex.put(termid, new TIntObjectHashMap<List<T>>());
final TIntObjectHashMap<List<T>> postings = invertedIndex.get(termid);
if (!postings.containsKey(docid.hashCode()))
postings.put(docid.hashCode(), new ArrayList<T>());
postings.get(docid.hashCode()).add(t);
}
}
return invertedIndex;
}
示例2: get
import gnu.trove.map.hash.TIntObjectHashMap; //導入方法依賴的package包/類
@Override
public T get(int x, int y) {
if (!grid.containsKey(x)) {
return defaultElement;
}
TIntObjectHashMap<T> map = grid.get(x);
if (!map.containsKey(y)) {
return defaultElement;
}
return map.get(y);
}
示例3: reverseDirected
import gnu.trove.map.hash.TIntObjectHashMap; //導入方法依賴的package包/類
public static String reverseDirected(String ss, TIntObjectHashMap<String> props_index){
String p = reverse(ss);
String[] vals = p.split("-");
String out = "";
String prop = "";
String to_search = "";
for(String s : vals){
prop = props_index.get(Integer.parseInt(s));
to_search = "";
if(prop.startsWith("inv_"))
to_search = prop.substring(4);
else
to_search = "inv_" + prop;
for(int i : props_index.keys()){
if(props_index.get(i).equals(to_search))
out += i + "-";
}
}
return out.substring(0, out.length()-1);
}
示例4: get
import gnu.trove.map.hash.TIntObjectHashMap; //導入方法依賴的package包/類
public List get (int key1, int key2)
{
TIntObjectHashMap inner = (TIntObjectHashMap) backing.get (key1);
if (inner == null) {
return null;
} else {
return (List) inner.get (key2);
}
}
示例5: get
import gnu.trove.map.hash.TIntObjectHashMap; //導入方法依賴的package包/類
public Object get (int key1, int key2)
{
TIntObjectHashMap inner = (TIntObjectHashMap) backing.get (key1);
if (inner == null) {
return null;
} else {
return inner.get (key2);
}
}
示例6: foldMemoryOperandImpl
import gnu.trove.map.hash.TIntObjectHashMap; //導入方法依賴的package包/類
@Override
protected MachineInstr foldMemoryOperandImpl(MachineFunction mf,
MachineInstr mi, int i, ArrayList<MachineOperand> mos, int align)
{
TIntObjectHashMap<Pair<Integer, Integer>> OpcodeTablePtr = null;
boolean isTwoAddrFold = false;
int NumOps = mi.getDesc().getNumOperands();
boolean isTwoAddr = NumOps > 1
&& mi.getDesc().getOperandConstraint(1, TIED_TO) != -1;
MachineInstr NewMI = null;
// Folding a memory location into the two-address part of a two-address
// instruction is different than folding it other places. It requires
// replacing the *two* registers with the memory location.
if (isTwoAddr && NumOps >= 2 && i < 2 && mi.getOperand(0).isRegister() && mi
.getOperand(1).isRegister() && mi.getOperand(0).getReg() == mi
.getOperand(1).getReg())
{
OpcodeTablePtr = regOp2MemOpTable2Addr;
isTwoAddrFold = true;
}
else if (i == 0)
{ // If operand 0
if (mi.getOpcode() == MOV16r0)
NewMI = MakeM0Inst(this, MOV16mi, mos, mi);
else if (mi.getOpcode() == MOV32r0)
NewMI = MakeM0Inst(this, MOV32mi, mos, mi);
else if (mi.getOpcode() == MOV8r0)
NewMI = MakeM0Inst(this, MOV8mi, mos, mi);
if (NewMI != null)
return NewMI;
OpcodeTablePtr = regOp2MemOpTable0;
}
else if (i == 1)
{
OpcodeTablePtr = regOp2MemOpTable1;
}
else if (i == 2)
{
OpcodeTablePtr = regOp2MemOpTable2;
}
// If table selected...
if (OpcodeTablePtr != null)
{
// Find the Opcode to fuse
if (OpcodeTablePtr.containsKey(mi.getOpcode()))
{
int MinAlign = OpcodeTablePtr.get(mi.getOpcode()).second;
if (align < MinAlign)
return null;
if (isTwoAddrFold)
NewMI = FuseTwoAddrInst(mf,
OpcodeTablePtr.get(mi.getOpcode()).first, mos, mi,
this);
else
NewMI = FuseInst(mf,
OpcodeTablePtr.get(mi.getOpcode()).first, i, mos,
mi, this);
return NewMI;
}
}
// No fusion
if (PrintFailedFusing.value)
{
System.err.printf("We failed to fuse operand %d in ", i);
mi.print(System.err, null);
}
return null;
}
示例7: getItemModel
import gnu.trove.map.hash.TIntObjectHashMap; //導入方法依賴的package包/類
protected IBakedModel getItemModel(Item item, int meta)
{
TIntObjectHashMap<IBakedModel> map = models.get(item);
return map == null ? null : map.get(meta);
}
示例8: analyseImage
import gnu.trove.map.hash.TIntObjectHashMap; //導入方法依賴的package包/類
@Override
public void analyseImage(FImage image) {
final int height = image.getHeight();
final int width = image.getWidth();
this.radmap = new TIntObjectHashMap<TIntObjectHashMap<TIntFloatHashMap>>();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
if (image.pixels[y][x] == 1)
{
for (int rad = 0; rad < nRadius; rad++) {
final int actualrad = (rad * this.radIncr) + this.minRad;
final float radiusWeight = 1f / this.nDegree;
// if(actualrad == 0){
// throw new
// RuntimeException("The weight should never be 0");
// }
for (int ang = 0; ang < nDegree; ang++) {
final int x0 = round(x + this.cosanglemap[rad][ang]);
final int y0 = round(y + this.sinanglemap[rad][ang]);
TIntObjectHashMap<TIntFloatHashMap> xMap = this.radmap.get(actualrad);
if (xMap == null) {
this.radmap.put(actualrad, xMap = new TIntObjectHashMap<TIntFloatHashMap>());
}
TIntFloatHashMap yMap = xMap.get(x0);
if (yMap == null) {
xMap.put(x0, yMap = new TIntFloatHashMap());
}
yMap.adjustOrPutValue(y0, radiusWeight, radiusWeight);
// if(x0 == 37 && y0 == 22 && actualrad == 1){
// logger.debug("This should not be !");
// logger.debug(String.format("Pixel = %d,%d",
// x,y));
// logger.debug(String.format("x=%d,y=%d,r=%d,v=%2.5f",x0
// ,y0 ,actualrad , newValue ));
// }
// if(x0 > 22 && x0 < 27 && y0 > 22 && y0 < 27 &&
// actualrad > 10 && actualrad < 14){
// logger.debug("This should be correct!");
// logger.debug(String.format("x=%d,y=%d,r=%d,v=%2.5f",x0
// ,y0 ,actualrad , newValue ));
// }
// if(Float.isInfinite(newValue)){
// throw new
// RuntimeException("The value held should never be infinity");
// }
// logger.debug(String.format("x=%d,y=%d,r=%d,v=%2.5f\n",x0
// ,y0 ,actualrad , newValue ));
// maxWeight = Math.max(newValue, maxWeight);
}
}
}
}
}
logger.debug("Done analysing the image!");
}