Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
288,700
DocCommandGroupId (Document doc) { return new DocCommandGroupId(doc, new Object()); }
noneGroupId
288,701
DocCommandGroupId (Document doc, Object groupId) { return new DocCommandGroupId(doc, groupId); }
withGroupId
288,702
Document () { return myDocument; }
getDocument
288,703
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DocCommandGroupId that = (DocCommandGroupId)o; if (!myDocument.equals(that.myDocument)) return false; if (!myGroupId.equals(that.myGroupId)) return false; return true; }
equals
288,704
int () { int result = myDocument.hashCode(); result = 31 * result + myGroupId.hashCode(); return result; }
hashCode
288,705
TextAttributesEffectsBuilder () { return new TextAttributesEffectsBuilder(); }
create
288,706
TextAttributesEffectsBuilder (@NotNull TextAttributes deepestAttributes) { return create().coverWith(deepestAttributes); }
create
288,707
TextAttributesEffectsBuilder (@NotNull TextAttributes attributes) { attributes.forEachAdditionalEffect(this::coverWith); coverWith(attributes.getEffectType(), attributes.getEffectColor()); return this; }
coverWith
288,708
TextAttributesEffectsBuilder (@NotNull TextAttributes attributes) { slipUnder(attributes.getEffectType(), attributes.getEffectColor()); attributes.forEachAdditionalEffect(this::slipUnder); return this; }
slipUnder
288,709
TextAttributesEffectsBuilder (@Nullable EffectType effectType, @Nullable Color effectColor) { return mutateBuilder(effectType, effectColor, myEffectsMap::put); }
coverWith
288,710
TextAttributesEffectsBuilder (@Nullable EffectType effectType, @Nullable Color effectColor) { return mutateBuilder(effectType, effectColor, myEffectsMap::putIfAbsent); }
slipUnder
288,711
TextAttributesEffectsBuilder (@Nullable EffectType effectType, @Nullable Color effectColor, @NotNull BiConsumer<? super EffectSlot, ? super EffectDescriptor> slotMutator) { if (effectColor != null && effectType != null) { EffectSlot slot = EFFECT_SLOTS_MAP.get(effectType); if (slot != null) { slotMutator.accept(slot, EffectDescriptor.create(effectType, effectColor)); } else { LOG.debug("Effect " + effectType + " is not supported by builder"); } } return this; }
mutateBuilder
288,712
TextAttributes (final @NotNull TextAttributes targetAttributes) { Iterator<EffectDescriptor> effectsIterator = myEffectsMap.values().iterator(); if (!effectsIterator.hasNext()) { targetAttributes.setEffectColor(null); targetAttributes.setEffectType(BOXED); targetAttributes.setAdditionalEffects(Collections.emptyMap()); } else { EffectDescriptor mainEffectDescriptor = effectsIterator.next(); targetAttributes.setEffectType(mainEffectDescriptor.effectType); targetAttributes.setEffectColor(mainEffectDescriptor.effectColor); int effectsLeft = myEffectsMap.size() - 1; if (effectsLeft == 0) { targetAttributes.setAdditionalEffects(Collections.emptyMap()); } else if (effectsLeft == 1) { EffectDescriptor additionalEffect = effectsIterator.next(); targetAttributes.setAdditionalEffects(Collections.singletonMap(additionalEffect.effectType, additionalEffect.effectColor)); } else { Map<EffectType, Color> effectsMap = new EnumMap<>(EffectType.class); effectsIterator.forEachRemaining(descriptor -> effectsMap.put(descriptor.effectType, descriptor.effectColor)); targetAttributes.setAdditionalEffects(effectsMap); } } return targetAttributes; }
applyTo
288,713
EffectDescriptor (@NotNull EffectType effectType, @NotNull Color effectColor) { return new EffectDescriptor(effectType, effectColor); }
create
288,714
String () { return "[ERASE_MARKER]"; }
toString
288,715
TextAttributes (@Nullable TextAttributes under, @Nullable TextAttributes above) { if (under == null) return above; if (above == null) return under; TextAttributes attrs = under.clone(); if (above.getBackgroundColor() != null){ attrs.setBackgroundColor(above.getBackgroundColor()); } if (above.getForegroundColor() != null){ attrs.setForegroundColor(above.getForegroundColor()); } attrs.setFontType(above.getFontType() | under.getFontType()); TextAttributesEffectsBuilder.create(under).coverWith(above).applyTo(attrs); return attrs; }
merge
288,716
void (@NotNull TextAttributes other) { myAttrs = other.myAttrs; }
copyFrom
288,717
void (Color foregroundColor, Color backgroundColor, Color effectColor, Color errorStripeColor, EffectType effectType, @JdkConstants.FontStyle int fontType) { myAttrs = AttributesFlyweight .create(foregroundColor, backgroundColor, fontType, effectColor, effectType, Collections.emptyMap(), errorStripeColor); }
setAttributes
288,718
boolean () { return getForegroundColor() == null && getBackgroundColor() == null && getEffectColor() == null && getFontType() == Font.PLAIN; }
isEmpty
288,719
AttributesFlyweight () { return myAttrs; }
getFlyweight
288,720
TextAttributes (@NotNull AttributesFlyweight flyweight) { return new TextAttributes(flyweight); }
fromFlyweight
288,721
Color () { return myAttrs.getForeground(); }
getForegroundColor
288,722
void (Color color) { myAttrs = myAttrs.withForeground(color); }
setForegroundColor
288,723
Color () { return myAttrs.getBackground(); }
getBackgroundColor
288,724
void (Color color) { myAttrs = myAttrs.withBackground(color); }
setBackgroundColor
288,725
Color () { return myAttrs.getEffectColor(); }
getEffectColor
288,726
void (Color color) { myAttrs = myAttrs.withEffectColor(color); }
setEffectColor
288,727
Color () { return myAttrs.getErrorStripeColor(); }
getErrorStripeColor
288,728
void (Color color) { myAttrs = myAttrs.withErrorStripeColor(color); }
setErrorStripeColor
288,729
boolean () { return myAttrs.hasEffects(); }
hasEffects
288,730
void (@NotNull Map<@NotNull EffectType, ? extends @NotNull Color> effectsMap) { myAttrs = myAttrs.withAdditionalEffects(effectsMap); }
setAdditionalEffects
288,731
void (@NotNull EffectType effectType, @NotNull Color color) { TextAttributesEffectsBuilder .create(this) .coverWith(effectType, color) .applyTo(this); }
withAdditionalEffect
288,732
void (@NotNull BiConsumer<? super EffectType, ? super Color> consumer) { myAttrs.getAdditionalEffects().forEach(consumer); }
forEachAdditionalEffect
288,733
void (@NotNull BiConsumer<? super EffectType, ? super Color> consumer) { myAttrs.getAllEffects().forEach(consumer); }
forEachEffect
288,734
void (EffectType effectType) { myAttrs = myAttrs.withEffectType(effectType); }
setEffectType
288,735
int () { return myAttrs.getFontType(); }
getFontType
288,736
void (@JdkConstants.FontStyle int type) { if (type < 0 || type > 3) { LOG.error("Wrong font type: " + type); type = Font.PLAIN; } myAttrs = myAttrs.withFontType(type); }
setFontType
288,737
TextAttributes () { return new TextAttributes(myAttrs); }
clone
288,738
boolean (Object obj) { if(!(obj instanceof TextAttributes)) { return false; } return Objects.equals(myAttrs, ((TextAttributes)obj).myAttrs); }
equals
288,739
int () { return myAttrs.hashCode(); }
hashCode
288,740
void (@NotNull Element element) { myAttrs = AttributesFlyweight.create(element); }
readExternal
288,741
void (Element element) { myAttrs.writeExternal(element); }
writeExternal
288,742
String () { return "[" + getForegroundColor() + "," + getBackgroundColor() + "," + getFontType() + "," + getEffectType() + "," + getEffectColor() + "," + myAttrs.getAdditionalEffects() + "," + getErrorStripeColor() + "]"; }
toString
288,743
boolean (Object o) { if (this == o) return true; if (!(o instanceof FlyweightKey)) return false; FlyweightKey key = (FlyweightKey)o; if (fontType != key.fontType) return false; if (!Objects.equals(background, key.background)) return false; if (!Objects.equals(effectColor, key.effectColor)) return false; if (effectType != key.effectType) return false; if (!Objects.equals(errorStripeColor, key.errorStripeColor)) return false; if (!Objects.equals(foreground, key.foreground)) return false; if (!myAdditionalEffects.equals(key.myAdditionalEffects)) return false; return true; }
equals
288,744
int () { int result = foreground != null ? foreground.hashCode() : 0; result = 31 * result + (background != null ? background.hashCode() : 0); result = 31 * result + fontType; result = 31 * result + (effectColor != null ? effectColor.hashCode() : 0); result = 31 * result + (effectType != null ? effectType.hashCode() : 0); result = 31 * result + (errorStripeColor != null ? errorStripeColor.hashCode() : 0); result = 31 * result + myAdditionalEffects.hashCode(); return result; }
hashCode
288,745
FlyweightKey () { try { return (FlyweightKey)super.clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } }
clone
288,746
AttributesFlyweight (Color foreground, Color background, @JdkConstants.FontStyle int fontType, Color effectColor, EffectType effectType, Color errorStripeColor) { return create(foreground, background, fontType, effectColor, effectType, Collections.emptyMap(), errorStripeColor); }
create
288,747
AttributesFlyweight (Color foreground, Color background, @JdkConstants.FontStyle int fontType, Color effectColor, EffectType effectType, @NotNull Map<@NotNull EffectType, ? extends @NotNull Color> additionalEffects, Color errorStripeColor) { FlyweightKey key = ourKey.get(); if (key == null) { ourKey.set(key = new FlyweightKey()); } key.foreground = foreground; key.background = background; key.fontType = fontType; key.effectColor = effectColor; key.effectType = effectType; key.myAdditionalEffects = additionalEffects.isEmpty() ? Collections.emptyMap() : new EnumMap<>(additionalEffects); key.errorStripeColor = errorStripeColor; AttributesFlyweight flyweight = entries.get(key); if (flyweight != null) { return flyweight; } return ConcurrencyUtil.cacheOrGet(entries, key.clone(), new AttributesFlyweight(key)); }
create
288,748
void (@NotNull Element element, @NotNull String fieldName, Color color) { if (color != null) { String string = Integer.toString(color.getRGB() & 0xFFFFFF, 16); JDOMExternalizerUtil.writeField(element, fieldName, string); } }
writeColor
288,749
int (EffectType effectType) { if (effectType == null) return -1; switch (effectType) { case BOXED: return EFFECT_BORDER; case LINE_UNDERSCORE: return EFFECT_LINE; case BOLD_LINE_UNDERSCORE: return EFFECT_BOLD_LINE; case STRIKEOUT: return EFFECT_STRIKEOUT; case WAVE_UNDERSCORE: return EFFECT_WAVE; case BOLD_DOTTED_LINE: return EFFECT_BOLD_DOTTED_LINE; default: return -1; } }
fromEffectType
288,750
EffectType (int effectType) { switch (effectType) { case EFFECT_BORDER: return EffectType.BOXED; case EFFECT_BOLD_LINE: return EffectType.BOLD_LINE_UNDERSCORE; case EFFECT_LINE: return EffectType.LINE_UNDERSCORE; case EFFECT_STRIKEOUT: return EffectType.STRIKEOUT; case EFFECT_WAVE: return EffectType.WAVE_UNDERSCORE; case EFFECT_BOLD_DOTTED_LINE: return EffectType.BOLD_DOTTED_LINE; default: return null; } }
toEffectType
288,751
Color () { return myForeground; }
getForeground
288,752
Color () { return myBackground; }
getBackground
288,753
int () { return myFontType; }
getFontType
288,754
Color () { return myEffectColor; }
getEffectColor
288,755
EffectType () { return myEffectType; }
getEffectType
288,756
boolean () { return myEffectColor != null && myEffectType != null || !myAdditionalEffects.isEmpty(); }
hasEffects
288,757
AttributesFlyweight (Color foreground) { return Comparing.equal(foreground, myForeground) ? this : create(foreground, myBackground, myFontType, myEffectColor, myEffectType, myAdditionalEffects, myErrorStripeColor); }
withForeground
288,758
AttributesFlyweight (Color background) { return Comparing.equal(background, myBackground) ? this : create(myForeground, background, myFontType, myEffectColor, myEffectType, myAdditionalEffects, myErrorStripeColor); }
withBackground
288,759
AttributesFlyweight (@JdkConstants.FontStyle int fontType) { return fontType == myFontType ? this : create(myForeground, myBackground, fontType, myEffectColor, myEffectType, myAdditionalEffects, myErrorStripeColor); }
withFontType
288,760
AttributesFlyweight (Color effectColor) { return Comparing.equal(effectColor, myEffectColor) ? this : create(myForeground, myBackground, myFontType, effectColor, myEffectType, myAdditionalEffects, myErrorStripeColor); }
withEffectColor
288,761
AttributesFlyweight (EffectType effectType) { return Comparing.equal(effectType, myEffectType) ? this : create(myForeground, myBackground, myFontType, myEffectColor, effectType, myAdditionalEffects, myErrorStripeColor); }
withEffectType
288,762
AttributesFlyweight (Color stripeColor) { return Comparing.equal(stripeColor, myErrorStripeColor) ? this : create(myForeground, myBackground, myFontType, myEffectColor, myEffectType, myAdditionalEffects, stripeColor); }
withErrorStripeColor
288,763
AttributesFlyweight (@NotNull Map<@NotNull EffectType, ? extends @NotNull Color> additionalEffects) { return Comparing.equal(additionalEffects, myAdditionalEffects) ? this : create(myForeground, myBackground, myFontType, myEffectColor, myEffectType, additionalEffects, myErrorStripeColor); }
withAdditionalEffects
288,764
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AttributesFlyweight that = (AttributesFlyweight)o; if (myFontType != that.myFontType) return false; if (!Objects.equals(myBackground, that.myBackground)) return false; if (!Objects.equals(myEffectColor, that.myEffectColor)) return false; if (myEffectType != that.myEffectType) return false; if (!Objects.equals(myErrorStripeColor, that.myErrorStripeColor)) return false; if (!Objects.equals(myForeground, that.myForeground)) return false; if (!myAdditionalEffects.equals(that.myAdditionalEffects)) return false; return true; }
equals
288,765
int () { return myHashCode; }
hashCode
288,766
void (@NotNull TextAttributes other) { throw new UnsupportedOperationException(); }
copyFrom
288,767
void (Color foregroundColor, Color backgroundColor, Color effectColor, Color errorStripeColor, EffectType effectType, int fontType) { throw new UnsupportedOperationException(); }
setAttributes
288,768
void (Color color) { throw new UnsupportedOperationException(); }
setForegroundColor
288,769
void (Color color) { throw new UnsupportedOperationException(); }
setBackgroundColor
288,770
void (Color color) { throw new UnsupportedOperationException(); }
setEffectColor
288,771
void (Color color) { throw new UnsupportedOperationException(); }
setErrorStripeColor
288,772
void (@NotNull Map<@NotNull EffectType, ? extends @NotNull Color> effectsMap) { throw new UnsupportedOperationException(); }
setAdditionalEffects
288,773
void (EffectType effectType) { throw new UnsupportedOperationException(); }
setEffectType
288,774
void (int type) { throw new UnsupportedOperationException(); }
setFontType
288,775
void (@NotNull Element element) { throw new UnsupportedOperationException(); }
readExternal
288,776
void (@NotNull DataInput in) { throw new UnsupportedOperationException(); }
readExternal
288,777
ColorKey (@NotNull String externalName) { return ourRegistry.computeIfAbsent(externalName, s -> new ColorKey(s,null,null)); }
find
288,778
String () { return myExternalName; }
toString
288,779
String () { return myExternalName; }
getExternalName
288,780
int (@NotNull ColorKey key) { return myExternalName.compareTo(key.myExternalName); }
compareTo
288,781
Color () { return myDefaultColor; }
getDefaultColor
288,782
ColorKey (@NonNls @NotNull String externalName) { return find(externalName); }
createColorKey
288,783
ColorKey (@NonNls @NotNull String externalName, @Nullable ColorKey fallbackColorKey) { ColorKey existing = ourRegistry.get(externalName); if (existing != null) { if (Comparing.equal(existing.getFallbackColorKey(), fallbackColorKey)) return existing; // some crazy life cycle assumes we can overwrite color ourRegistry.remove(externalName, existing); } ColorKey newKey = new ColorKey(externalName, existing == null ? null : existing.getDefaultColor(), fallbackColorKey); ColorKey res = ConcurrencyUtil.cacheOrGet(ourRegistry, externalName, newKey); if (fallbackColorKey != null) { JBIterable<ColorKey> it = JBIterable.generate(fallbackColorKey, o -> o == res ? null : o.myFallbackColorKey); if (it.find(o -> o == res) == res) { String cycle = StringUtil.join(it.map(ColorKey::getExternalName), "->"); LOG.error("Cycle detected: " + cycle); } } return res; }
createColorKeyWithFallback
288,784
ColorKey (@NonNls @NotNull String externalName, @Nullable Color defaultColor) { ColorKey existing = ourRegistry.get(externalName); if (existing != null) { if (Comparing.equal(existing.getDefaultColor(), defaultColor)) return existing; // some crazy life cycle assumes we should overwrite default color // (e.g. when read from external schema HintUtil.INFORMATION_COLOR_KEY with null color, then try to re-create it with not-null color in HintUtil initializer) ourRegistry.remove(externalName, existing); } ColorKey newKey = new ColorKey(externalName, defaultColor, existing == null ? null : existing.getFallbackColorKey()); return ConcurrencyUtil.cacheOrGet(ourRegistry, externalName, newKey); }
createColorKey
288,785
int () { return myExternalName.hashCode(); }
hashCode
288,786
boolean (Object obj) { return obj instanceof ColorKey && myExternalName.equals(((ColorKey)obj).myExternalName); }
equals
288,787
void (@NotNull TextAttributesKey fallbackAttributeKey) { for (TextAttributesKey key = fallbackAttributeKey; key != null; key = key.myFallbackAttributeKey) { if (equals(key)) { throw new IllegalArgumentException("Can't use this fallback key: " + fallbackAttributeKey + ":" + " Cycle detected: " + StringUtil.join(JBIterable.generate(myFallbackAttributeKey, o -> o == this ? null : o.myFallbackAttributeKey), "->")); } } }
checkForCycle
288,788
TextAttributesKey (@NotNull @NonNls String externalName) { return ourRegistry.computeIfAbsent(externalName, name -> new TextAttributesKey(name, null, null)); }
find
288,789
int (@NotNull TextAttributesKey key) { return myExternalName.compareTo(key.myExternalName); }
compareTo
288,790
TextAttributesKey (@NonNls @NotNull String externalName) { return find(externalName); }
createTextAttributesKey
288,791
void (Element element) { JDOMExternalizerUtil.writeField(element, "myExternalName", myExternalName); if (myDefaultAttributes != null) { Element option = JDOMExternalizerUtil.writeOption(element, "myDefaultAttributes"); myDefaultAttributes.writeExternal(option); } }
writeExternal
288,792
boolean (final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final TextAttributesKey that = (TextAttributesKey)o; return myExternalName.equals(that.myExternalName); }
equals
288,793
int () { return myExternalName.hashCode(); }
hashCode
288,794
TextAttributes () { TextAttributes defaultAttributes = myDefaultAttributes; if (defaultAttributes == null) { final TextAttributeKeyDefaultsProvider provider = ourDefaultsProvider.getValue(); if (provider != null) { Set<String> called = CALLED_RECURSIVELY.get(); if (!called.add(myExternalName)) return null; try { return ObjectUtils.notNull(provider.getDefaultAttributes(this), NULL_ATTRIBUTES); } finally { called.remove(myExternalName); } } } return defaultAttributes; }
getDefaultAttributes
288,795
TextAttributesKey (@NonNls @NotNull String externalName, TextAttributes defaultAttributes) { return getOrCreate(externalName, defaultAttributes, null); }
createTextAttributesKey
288,796
TextAttributesKey (@NonNls @NotNull String externalName, TextAttributesKey fallbackAttributeKey) { return getOrCreate(externalName, null, fallbackAttributeKey); }
createTextAttributesKey
288,797
TextAttributesKey (@NotNull @NonNls String externalName, TextAttributes defaultAttributes, TextAttributesKey fallbackAttributeKey) { TextAttributesKey existing = ourRegistry.get(externalName); if (existing != null && (defaultAttributes == null || Comparing.equal(existing.myDefaultAttributes, defaultAttributes)) && (fallbackAttributeKey == null || Comparing.equal(existing.myFallbackAttributeKey, fallbackAttributeKey))) { return existing; } return ourRegistry.compute(externalName, (oldName, oldKey) -> mergeKeys(oldName, oldKey, defaultAttributes, fallbackAttributeKey)); }
getOrCreate
288,798
TextAttributesKey (@NonNls @NotNull String externalName, @Nullable TextAttributesKey oldKey, TextAttributes defaultAttributes, TextAttributesKey fallbackAttributeKey) { if (oldKey == null) { return new TextAttributesKey(externalName, defaultAttributes, fallbackAttributeKey); } // ouch. Someone's re-creating already existing key with different attributes. // Have to re-create the new one with correct attributes, re-insert to the map // but don't allow to rewrite not-null fallback key if (oldKey.myFallbackAttributeKey != null && !oldKey.myFallbackAttributeKey.equals(fallbackAttributeKey)) { LOG.error(new IllegalStateException("TextAttributeKey(name:'" + externalName + "', fallbackAttributeKey:'" + fallbackAttributeKey + "') " + " was already registered with the other fallback attribute key: " + oldKey.myFallbackAttributeKey)); } // but don't allow to rewrite not-null default attributes if (oldKey.myDefaultAttributes != null && !oldKey.myDefaultAttributes.equals(defaultAttributes)) { LOG.error(new IllegalStateException("TextAttributeKey(name:'" + externalName + "', defaultAttributes:'" + defaultAttributes + "') " + " was already registered with the other defaultAttributes: " + oldKey.myDefaultAttributes)); } TextAttributes newDefaults = ObjectUtils.chooseNotNull(defaultAttributes, oldKey.myDefaultAttributes); // care with not calling unwanted providers TextAttributesKey newFallback = ObjectUtils.chooseNotNull(fallbackAttributeKey, oldKey.myFallbackAttributeKey); return new TextAttributesKey(externalName, newDefaults, newFallback); }
mergeKeys
288,799
TextAttributesKey (@NonNls @NotNull String externalName, TextAttributes defaultAttributes) { return createTextAttributesKey(TEMP_PREFIX + externalName, defaultAttributes); }
createTempTextAttributesKey