@SuppressWarnings("unchecked") public ArrangementEntryWrapper(@NotNull E entry) { myEntry = entry; myStartOffset = entry.getStartOffset(); myEndOffset = entry.getEndOffset(); ArrangementEntryWrapper<E> previous = null; for (ArrangementEntry child : entry.getChildren()) { ArrangementEntryWrapper<E> childWrapper = new ArrangementEntryWrapper<E>((E)child); childWrapper.setParent(this); if (previous != null) { previous.setNext(childWrapper); childWrapper.setPrevious(previous); } previous = childWrapper; myChildren.add(childWrapper); } }
@SuppressWarnings("unchecked") public ArrangementEntryWrapper(@Nonnull E entry) { myEntry = entry; myStartOffset = entry.getStartOffset(); myEndOffset = entry.getEndOffset(); ArrangementEntryWrapper<E> previous = null; for (ArrangementEntry child : entry.getChildren()) { ArrangementEntryWrapper<E> childWrapper = new ArrangementEntryWrapper<E>((E)child); childWrapper.setParent(this); if (previous != null) { previous.setNext(childWrapper); childWrapper.setPrevious(previous); } previous = childWrapper; myChildren.add(childWrapper); } }
@Override public boolean isMatched(@NotNull ArrangementEntry entry) { if (entry instanceof ModifierAwareArrangementEntry) { final Set<ArrangementSettingsToken> modifiers = ((ModifierAwareArrangementEntry)entry).getModifiers(); for (ArrangementAtomMatchCondition condition : myModifiers) { final Object value = condition.getValue(); boolean isInverted = value instanceof Boolean && !((Boolean)value); if (isInverted == modifiers.contains(condition.getType())) { return false; } } return true; } return false; }
@Nullable @Override protected String getTextToMatch(@NotNull ArrangementEntry entry) { if (entry instanceof NamespaceAwareArrangementEntry) { return ((NamespaceAwareArrangementEntry)entry).getNamespace(); } else { return null; } }
@Nullable @Override protected String getTextToMatch(@NotNull ArrangementEntry entry) { if (entry instanceof NameAwareArrangementEntry) { return ((NameAwareArrangementEntry)entry).getName(); } else { return null; } }
@Override public boolean isMatched(@NotNull ArrangementEntry entry) { for (ArrangementEntryMatcher matcher : myMatchers) { if (!matcher.isMatched(entry)) { return false; } } return true; }
@Override public boolean isMatched(@NotNull ArrangementEntry entry) { if (myCompiledPattern == null) { return false; } String text = getTextToMatch(entry); return text != null && myCompiledPattern.matcher(text).matches(); }
@Override public boolean isMatched(@NotNull ArrangementEntry entry) { if (entry instanceof TypeAwareArrangementEntry) { final Set<ArrangementSettingsToken> types = ((TypeAwareArrangementEntry)entry).getTypes(); for (ArrangementAtomMatchCondition condition : myTypes) { final Object value = condition.getValue(); boolean isInverted = value instanceof Boolean && !((Boolean)value); if (isInverted == types.contains(condition.getType())) { return false; } } return true; } return false; }
@Override public boolean isMatched(@NotNull ArrangementEntry entry) { if (entry instanceof ModifierAwareArrangementEntry) { return ((ModifierAwareArrangementEntry)entry).getModifiers().containsAll(myModifiers); } return false; }
@Override public boolean isMatched(@NotNull ArrangementEntry entry) { if (entry instanceof TypeAwareArrangementEntry) { return ((TypeAwareArrangementEntry)entry).getTypes().containsAll(myTypes); } return false; }
@Override public int getBlankLines(@NotNull CodeStyleSettings settings, @Nullable ArrangementEntry entry, @Nullable ArrangementEntry entry2, @NotNull ArrangementEntry entry3) { return 0; }
@Override public boolean isMatched(@Nonnull ArrangementEntry entry) { if (entry instanceof ModifierAwareArrangementEntry) { final Set<ArrangementSettingsToken> modifiers = ((ModifierAwareArrangementEntry)entry).getModifiers(); for (ArrangementAtomMatchCondition condition : myModifiers) { final Object value = condition.getValue(); boolean isInverted = value instanceof Boolean && !((Boolean)value); if (isInverted == modifiers.contains(condition.getType())) { return false; } } return true; } return false; }
@Nullable @Override protected String getTextToMatch(@Nonnull ArrangementEntry entry) { if (entry instanceof NamespaceAwareArrangementEntry) { return ((NamespaceAwareArrangementEntry)entry).getNamespace(); } else { return null; } }
@Nullable @Override protected String getTextToMatch(@Nonnull ArrangementEntry entry) { if (entry instanceof NameAwareArrangementEntry) { return ((NameAwareArrangementEntry)entry).getName(); } else { return null; } }
@Override public boolean isMatched(@Nonnull ArrangementEntry entry) { for (ArrangementEntryMatcher matcher : myMatchers) { if (!matcher.isMatched(entry)) { return false; } } return true; }
@Override public boolean isMatched(@Nonnull ArrangementEntry entry) { if (myCompiledPattern == null) { return false; } String text = getTextToMatch(entry); return text != null && myCompiledPattern.matcher(text).matches(); }
@Override public boolean isMatched(@Nonnull ArrangementEntry entry) { if (entry instanceof TypeAwareArrangementEntry) { final Set<ArrangementSettingsToken> types = ((TypeAwareArrangementEntry)entry).getTypes(); for (ArrangementAtomMatchCondition condition : myTypes) { final Object value = condition.getValue(); boolean isInverted = value instanceof Boolean && !((Boolean)value); if (isInverted == types.contains(condition.getType())) { return false; } } return true; } return false; }
public XmlElementArrangementEntry(@Nullable ArrangementEntry parent, @NotNull TextRange range, @NotNull ArrangementSettingsToken type, @Nullable String name, boolean canBeMatched) { super(parent, range.getStartOffset(), range.getEndOffset(), canBeMatched); myName = name; myType = type; }
@Override public boolean isMatched(@NotNull ArrangementEntry entry) { return myDelegate.isMatched(entry); }
@Override public boolean isMatched(@NotNull ArrangementEntry entry) { return false; }
@Nullable protected abstract String getTextToMatch(@NotNull ArrangementEntry entry);
@Override public boolean isMatched(@Nonnull ArrangementEntry entry) { return myDelegate.isMatched(entry); }
@Override public boolean isMatched(@Nonnull ArrangementEntry entry) { return false; }
@Nullable protected abstract String getTextToMatch(@Nonnull ArrangementEntry entry);
/** * Allows to check if given entry is matched by the current rule. * <p/> * Example: entry like 'public final field' should be matched by a 'final fields' rule but not matched by a 'private fields' rule. * * @param entry entry to check * @return <code>true</code> if given entry is matched by the current rule; <code>false</code> otherwise */ boolean isMatched(@NotNull ArrangementEntry entry);
/** * Allows to check if given entry is matched by the current rule. * <p/> * Example: entry like 'public final field' should be matched by a 'final fields' rule but not matched by a 'private fields' rule. * * @param entry entry to check * @return <code>true</code> if given entry is matched by the current rule; <code>false</code> otherwise */ boolean isMatched(@Nonnull ArrangementEntry entry);