Searches for abstract classes and replace it by an interface.

@param lines
@return
961507
public List<String> replaceAbstractClasses(List<String> lines) {
        List<String> result = new LinkedList<String>();
        for (int i = 0; i < lines.size(); i++) {
            result.add(removeAbstract(lines.get(i)));
        }
        return result;
    }
83298
public final void addBodyLine(final String line) {
        if (line == null) {
            throw new IllegalArgumentException("The argument 'line' cannot be NULL!");
        }
        body.add(line.trim());
    }
442858
protected Set<AbstractExpression> findAllSubexpressionsOfClass(Class< ? extends AbstractExpression> aeClass) {
        HashSet<AbstractExpression> exprs = new HashSet<>();
        if (m_joinTree != null) {
            AbstractExpression treeExpr = m_joinTree.getAllFilters();
            if (treeExpr != null) {
                exprs.addAll(treeExpr.findAllSubexpressionsOfClass(aeClass));
            }
        }
        return exprs;
    }
680235
public static String[] replaceFunctionQuote(String[] lines) {
        boolean function = false;
        boolean immediately = false;
        for (int i = 0; i < lines.length; i++) {
            String line = lines[i].trim();
            if (!function && line.contains("\"function")) {
                function = true;
                line = line.replaceAll("\"function", "function");
            }
            if (function && line.contains("}\"")) {
                function = false;
                line = line.replaceAll("\\}\"", "\\}");
            }

            if (!immediately && line.contains("\"(function")) {
                immediately = true;
                line = line.replaceAll("\"\\(function", "\\(function");
            }
            if (immediately && line.contains("})()\"")) {
                immediately = false;
                line = line.replaceAll("\\}\\)\\(\\)\"", "\\}\\)\\(\\)");
            }
            lines[i] = line;
        }
        return lines;
    }
283835
static ClassInfoList getAllImplementedInterfaceClasses(final Collection<ClassInfo> classes,
            final ScanSpec scanSpec) {
        return new ClassInfoList(ClassInfo.filterClassInfo(classes, scanSpec, /* strictWhitelist = */ true,
                ClassType.IMPLEMENTED_INTERFACE), /* sortByName = */ true);
    }
194799
private Set<String> readFeatureNameList(String line) {
        String[] parts = FeatureDefinitionUtils.installedFeatureSplitPattern.split(line);
        return parts.length > 0 ? Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(parts))) : Collections.<String> emptySet();
    }
729916
protected String[] getLineParts(final String line) {
		String[] parts = line.split(" ");
		List<String> ans = new ArrayList<>();
		int idx = 0;
		int len = parts.length;
		while (idx < len) {
			if (parts[idx].contains("='") && !parts[idx].endsWith("'")) {
				StringBuilder builder = new StringBuilder(parts[idx++]);
				while (idx < len) {
					builder.append(" ").append(parts[idx]);
					if (parts[idx++].endsWith("'")) {
						break;
					}
				}
				ans.add(builder.toString());
			} else if (parts[idx].contains("=[") && !parts[idx].endsWith("]")) {
				StringBuilder builder = new StringBuilder(parts[idx++]);
				while (idx < len) {
					builder.append(" ").append(parts[idx]);
					if (parts[idx++].endsWith("]")) {
						break;
					}
				}
				ans.add(builder.toString());
			} else {
				String part = parts[idx++];
				if (StringUtils.isNotEmpty(part)) {
					ans.add(part);
				}
			}
		}
		return ans.toArray(new String[ans.size()]);
	}
1157718
public void removeSimilarClassesFromFile1() throws IOException {
        logging.info("Start reding cs File");
        List<String> linescs1 = getFileLinesAsList(csFile1);
        logging.info("Start reding cs File");
        List<String> linescs2 = getFileLinesAsList(csFile2);
        logging.info("Search classes");
        List<String> classNames1 = searchClasses(linescs1);
        logging.info("Found " + classNames1.size() + " classes");
        logging.info("Search classes");
        List<String> classNames2 = searchClasses(linescs2);
        logging.info("Found " + classNames2.size() + " classes");
        logging.info("Removing similarities from the file");
        for (String name : findSimilarClassNames(classNames1, classNames2)) {
            linescs1 = removeLinesContainingClassname(linescs1, name);
        }
        logging.info("Remove Attributes, which stands alone");
        linescs1 = removeAttributesNotBoundToClass(linescs1);
        if (!windows) {
            logging.info("Replace abstract classes with interfaces");
            linescs1 = replaceAbstractClasses(linescs1);
            linescs2 = replaceAbstractClasses(linescs2);
            logging.info("Save files");
        }
        replaceFilesWithNewContent(linescs1, csFile1);
        replaceFilesWithNewContent(linescs2, csFile2);
    }
955087
@SuppressWarnings("unchecked")
    public static <T> Stream<Class<? extends T>> streamClasses(Collection<Class<?>> classes,
            Class<? extends T> baseClass) {
        return classes
                .stream()
                .filter(ClassPredicates.classIsDescendantOf(baseClass))
                .map(c -> (Class<T>) c);
    }
883560
private static Filter createFilter(final BundleContext bundleContext, final Class<?>... classes) {
		final StringBuilder filter = new StringBuilder();
		if (classes != null) {
			if (classes.length > 1) {
				filter.append("(|");
			}
			for (Class<?> clazz : classes) {
				filter.append("(").append(Constants.OBJECTCLASS).append("=").append(clazz.getName()).append(")");
			}
			if (classes.length > 1) {
				filter.append(")");
			}
		}
		try {
			return bundleContext.createFilter(filter.toString());
		} catch (InvalidSyntaxException e) {
			throw new IllegalArgumentException("Unexpected InvalidSyntaxException: " + e.getMessage());
		}
	}
200981
@PublicAPI(usage = ACCESS)
    public JavaClasses importClasses(Collection<Class<?>> classes) {
        Set<Location> locations = new HashSet<>();
        for (Class<?> clazz : classes) {
            locations.addAll(Locations.ofClass(clazz));
        }
        return importLocations(locations);
    }
88998
public static OClass getDeepestOClass(Iterable<OClass> classes) {
		if(classes==null) return null;
		OClass ret=null;
		for(OClass oClass: classes) {
			if(ret==null) ret = oClass;
			else {
				if(!ret.equals(oClass) && oClass.isSubClassOf(ret)) ret = oClass;
			}
		}
		return ret;
	}
190244
public static void getAllInterfaces(Class<?> classObject, ArrayList<Type> interfaces) {
        Type[] superInterfaces = classObject.getGenericInterfaces();
        interfaces.addAll((Arrays.asList(superInterfaces)));

        // for cases where the extended class is defined with a Generic.
        Type tgs = classObject.getGenericSuperclass();
        if (tgs != null) {
            if ((tgs) instanceof ParameterizedType) {
                interfaces.add(tgs);
            }
        }

        if (tc.isDebugEnabled()) {
            Tr.debug(tc, "updated interfaces to: " + interfaces);
        }

        Class<?> superClass = classObject.getSuperclass();
        if (superClass != null) {
            getAllInterfaces(superClass, interfaces);
        }
    }
619983
@NonNull
    public <T> List<T> create(@NonNull Collection<Class<? extends T>> classes) {
        final List<T> result = new ArrayList<>();
        for (Class<? extends T> clazz : classes) {
            final T instance = create(clazz);
            if (instance != null) {
                result.add(instance);
            }
        }
        return result;
    }
819644
public List<Class<?>> directSuperclasses(Class<?> c)
    {
        if(c.isPrimitive()) {
            return primitiveSuperclasses(c);
        }
        else if(c.isArray()) {
            return arrayDirectSuperclasses(0, c);
        }
        else {
            Class<?> [] interfaces = c.getInterfaces();
            Class<?> superclass = c.getSuperclass();

            List<Class<?>> classes = new LinkedList<Class<?>>();
            classes.addAll(Arrays.asList(interfaces));
            if(superclass == null) {
                if(interfaces.length == 0 &&
                   c != Object.class)
                    classes.add(Object.class);
            }
            else {
                classes.add(superclass);
            }

            return classes;
        }
    }
325112
public boolean isLastHeaderLine(String line) {
        return lastLineDetectionPattern != null && line != null && lastLineDetectionPattern.matcher(line).matches();
    }
1226430
@Override
    public final MatchResult matches(final List<String> lines) {
        for (int i = 0; i < lines.size(); i++) {
            if (matches(i + 1, lines.get(i))) return new MatchResult(true, this, i);
        }
        return NO_MATCH;
    }