Refine search
/** * @param predictorIndex index (0-based) among only predictors (not ID, not ignored, not target) * @return index (0-based) among all features */ public int predictorToFeatureIndex(int predictorIndex) { Integer featureIndex = allToPredictorMap.inverse().get(predictorIndex); Preconditions.checkArgument(featureIndex != null, "No feature for predictor %s", predictorIndex); return featureIndex; }
private int getDataTypeRegistration(Class datatype) { Integer registrationNo = registrations.inverse().get(normalizeDataType(datatype)); Preconditions.checkArgument(registrationNo!=null,"Datatype is not supported by database since no serializer has been registered: %s",datatype); assert registrationNo>0; return registrationNo; }
@Override public Integer getResourceId(ResName resName) { Integer id = resourceTable.inverse().get(resName); if (id == null && resName != null && resName.name.contains(".")) { // try again with underscores (in case we're looking in the compile-time resources, where // we haven't read XML declarations and only know what the R.class tells us). id = resourceTable .inverse() .get(new ResName(resName.packageName, resName.type, underscorize(resName.name))); } return id != null ? id : 0; }
/** * Retrieve the native id for given object. Assigns a new unique id to the object if not * previously registered. * * @deprecated Use {@link #register(Object)} instead. */ @Deprecated public synchronized long getNativeObjectId(T o) { checkNotNull(o); Long nativeId = nativeObjToIdMap.inverse().get(o); if (nativeId == null) { nativeId = nextId; if (debug) { System.out.printf("NativeObjRegistry %s: register %d -> %s%n", name, nativeId, o); } nativeObjToIdMap.put(nativeId, o); nextId++; } return nativeId; }
private int getDataTypeRegistration(Class datatype) { Integer registrationNo = registrations.inverse().get(normalizeDataType(datatype)); Preconditions.checkArgument(registrationNo!=null,"Datatype is not supported by database since no serializer has been registered: %s",datatype); assert registrationNo>0; return registrationNo; }
@Override protected void expectContents(Collection<Entry<K, V>> expected) { super.expectContents(expected); List<Entry<V, K>> reversedEntries = new ArrayList<>(); for (Entry<K, V> entry : expected) { reversedEntries.add(reverseEntry(entry)); } Helpers.assertEqualIgnoringOrder(getMap().inverse().entrySet(), reversedEntries); for (Entry<K, V> entry : expected) { assertEquals( "Wrong key for value " + entry.getValue(), entry.getKey(), getMap().inverse().get(entry.getValue())); } }
synchronized public int getUid(String user) throws IOException { checkAndUpdateMaps(); Integer id = uidNameMap.inverse().get(user); if (id == null) { updateMapIncr(user, false); id = uidNameMap.inverse().get(user); if (id == null) { throw new IOException("User just deleted?:" + user); } } return id.intValue(); }
synchronized public int getGid(String group) throws IOException { checkAndUpdateMaps(); Integer id = gidNameMap.inverse().get(group); if (id == null) { updateMapIncr(group, true); id = gidNameMap.inverse().get(group); if (id == null) { throw new IOException("No such group:" + group); } } return id.intValue(); }
public Object getPreviousClone(Class<?> instanceClass, Long originalId) { Object previousClone; if (currentEquivalentMap.inverse().containsKey(instanceClass.getName() + "_" + originalId)) { previousClone = currentCloneMap.get(currentEquivalentMap.inverse().get(instanceClass.getName() + "_" + originalId)); } else { previousClone = getClonedVersion(instanceClass, originalId); } return previousClone; }
/** * Convert source format class name to internal format. * * @return internal format class name */ public static String sourceToInternal(String sourceName) { String sourceBaseName = sourceName.replace("[]", ""); StringBuilder sb = new StringBuilder(); int dimensionCount = (sourceName.length() - sourceBaseName.length()) / 2; for (int i = 0; i < dimensionCount; i++) { sb.append('['); } String internalPrimitive = internalPrimitiveToBinaryName.inverse().get(sourceBaseName); if (internalPrimitive != null) { sb.append(internalPrimitive); } else { sb.append('L').append(sourceBaseName.replace('.', '/')).append(';'); } return sb.toString(); }
ContainerId getContainerIdForAttempt(TezTaskAttemptID taskAttemptId) { LlapNodeId llapNodeId = getNodeIdForTaskAttempt(taskAttemptId); if (llapNodeId != null) { BiMap<TezTaskAttemptID, ContainerId> bMap = nodeMap.get(llapNodeId).inverse(); if (bMap != null) { synchronized (bMap) { return bMap.get(taskAttemptId); } } else { return null; } } else { return null; } }