@Override protected boolean isMatchingElement(Object element, String pattern) { for (PairConvertor<Object, String, Boolean> convertor : myOrderedConvertors) { final Boolean matched = convertor.convert(element, pattern); if (Boolean.TRUE.equals(matched)) return true; } return false; }
public MultipleTraitsListSpeedSearch(JList component, @NotNull List<PairConvertor<Object, String, Boolean>> convertors) { super(component, convertors); }
public MultipleTraitsSpeedSearch(Comp component, @NotNull List<PairConvertor<Object, String, Boolean>> convertors) { super(component); myOrderedConvertors = convertors; }
private MySpeedSearch(JList component) { super(component, new ArrayList<PairConvertor<Object, String, Boolean>>()); initConvertors(); }
public static PairConvertor<String, String, List<Set<SchemaTypeInfo>>> getWorker(final Project project, final VirtualFile currentFile) { return new MyWorker(currentFile, project); }
private Collection<SchemaTypeInfo> gatherInheritors(XmlTagImpl xml) { XmlAttribute name = getNameAttr(xml); if (name == null || StringUtil.isEmptyOrSpaces(name.getValue())) return null; String localName = name.getValue(); final boolean hasPrefix = localName.contains(":"); localName = hasPrefix ? localName.substring(localName.indexOf(':') + 1) : localName; final String nsPrefix = hasPrefix ? name.getValue().substring(0, name.getValue().indexOf(':')) : null; final XmlFile file = XmlUtil.getContainingFile(xml); if (file == null) return null; final Project project = file.getProject(); if (project == null) return null; final Set<SchemaTypeInfo> result = new HashSet<SchemaTypeInfo>(); final ArrayDeque<SchemaTypeInfo> queue = new ArrayDeque<SchemaTypeInfo>(); String nsUri; if (! hasPrefix) { nsUri = getDefaultNs(file); } else { nsUri = XmlUtil.findNamespaceByPrefix(nsPrefix, file.getRootTag()); } if (nsUri == null) return null; queue.add(new SchemaTypeInfo(localName, true, nsUri)); final PairConvertor<String,String,List<Set<SchemaTypeInfo>>> worker = SchemaTypeInheritanceIndex.getWorker(project, file.getContainingFile().getVirtualFile()); while (! queue.isEmpty()) { final SchemaTypeInfo info = queue.removeFirst(); final List<Set<SchemaTypeInfo>> childrenOfType = worker.convert(info.getNamespaceUri(), info.getTagName()); for (Set<SchemaTypeInfo> infos : childrenOfType) { for (SchemaTypeInfo typeInfo : infos) { if (typeInfo.isIsTypeName()) { queue.add(typeInfo); } result.add(typeInfo); } } } return result; }
public MultipleTraitsListSpeedSearch(JList component, @Nonnull List<PairConvertor<Object, String, Boolean>> convertors) { super(component, convertors); }
public MultipleTraitsSpeedSearch(Comp component, @Nonnull List<PairConvertor<Object, String, Boolean>> convertors) { super(component); myOrderedConvertors = convertors; }
private Collection<SchemaTypeInfo> gatherInheritors(XmlTagImpl xml) { XmlAttribute name = getNameAttr(xml); if(name == null || StringUtil.isEmptyOrSpaces(name.getValue())) { return null; } String localName = name.getValue(); final boolean hasPrefix = localName.contains(":"); localName = hasPrefix ? localName.substring(localName.indexOf(':') + 1) : localName; final String nsPrefix = hasPrefix ? name.getValue().substring(0, name.getValue().indexOf(':')) : null; final XmlFile file = XmlUtil.getContainingFile(xml); if(file == null) { return null; } final Project project = file.getProject(); if(project == null) { return null; } final Set<SchemaTypeInfo> result = new HashSet<SchemaTypeInfo>(); final ArrayDeque<SchemaTypeInfo> queue = new ArrayDeque<SchemaTypeInfo>(); String nsUri; if(!hasPrefix) { nsUri = getDefaultNs(file); } else { nsUri = XmlUtil.findNamespaceByPrefix(nsPrefix, file.getRootTag()); } if(nsUri == null) { return null; } queue.add(new SchemaTypeInfo(localName, true, nsUri)); final PairConvertor<String, String, List<Set<SchemaTypeInfo>>> worker = SchemaTypeInheritanceIndex.getWorker(project, file.getContainingFile().getVirtualFile()); while(!queue.isEmpty()) { final SchemaTypeInfo info = queue.removeFirst(); final List<Set<SchemaTypeInfo>> childrenOfType = worker.convert(info.getNamespaceUri(), info.getTagName()); for(Set<SchemaTypeInfo> infos : childrenOfType) { for(SchemaTypeInfo typeInfo : infos) { if(typeInfo.isIsTypeName()) { queue.add(typeInfo); } result.add(typeInfo); } } } return result; }