public int storeSafe(Object obj) { if (safeClone.isSafeToReuse(obj)) { int description = safeToReuse.get(obj); if (description == 0) { safeToReuse.put(obj, safeToReuse.size() + 1); description = safeToReuse.size(); reuse.add(obj); } return description; } else { return 0; } }
@Override public String toString() { StringBuilder sb = new StringBuilder(); if (myVarIndex.size() != myVarSizes.size()) { return "inconsistent"; } List<Trinity<DeclarationDescriptor, Integer, Integer>> descriptors = Lists.newArrayList(); for (Object descriptor0 : myVarIndex.keys()) { DeclarationDescriptor descriptor = (DeclarationDescriptor) descriptor0; int varIndex = myVarIndex.get(descriptor); int varSize = myVarSizes.get(descriptor); descriptors.add(Trinity.create(descriptor, varIndex, varSize)); } Collections.sort( descriptors, new Comparator<Trinity<DeclarationDescriptor, Integer, Integer>>() { @Override public int compare( Trinity<DeclarationDescriptor, Integer, Integer> left, Trinity<DeclarationDescriptor, Integer, Integer> right) { return left.second - right.second; } }); sb.append("size=").append(myMaxIndex); boolean first = true; for (Trinity<DeclarationDescriptor, Integer, Integer> t : descriptors) { if (!first) { sb.append(", "); } first = false; sb.append(t.first).append(",i=").append(t.second).append(",s=").append(t.third); } return sb.toString(); }
private OrderMap(@NotNull TObjectIntHashMap<HighlightSeverity> map) { super(map.size()); map.forEachEntry( new TObjectIntProcedure<HighlightSeverity>() { @Override public boolean execute(HighlightSeverity key, int value) { OrderMap.super.put(key, value); return true; } }); trimToSize(); }
public GrIntroduceParameterDialog(IntroduceParameterInfo info) { super(info.getProject(), true); myInfo = info; myProject = info.getProject(); myCanIntroduceSimpleParameter = GroovyIntroduceParameterUtil.findExpr(myInfo) != null || GroovyIntroduceParameterUtil.findVar(myInfo) != null || findStringPart() != null; TObjectIntHashMap<GrParameter> parametersToRemove = GroovyIntroduceParameterUtil.findParametersToRemove(info); toRemoveCBs = new TObjectIntHashMap<JCheckBox>(parametersToRemove.size()); for (Object p : parametersToRemove.keys()) { JCheckBox cb = new JCheckBox( GroovyRefactoringBundle.message( "remove.parameter.0.no.longer.used", ((GrParameter) p).getName())); toRemoveCBs.put(cb, parametersToRemove.get((GrParameter) p)); cb.setSelected(true); } init(); }