All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.gridkit.jvmtool.stacktrace.analytics.ClassificatorAST Maven / Gradle / Ivy

package org.gridkit.jvmtool.stacktrace.analytics;

import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class ClassificatorAST {

    public Root newRoot() {
        return new Root();
    }
    
    public static Filter disjunction(Collection filters) {
        if (filters.isEmpty()) {
            return new FalseFilter();
        }
        else if (filters.size() == 1) {
            return filters.iterator().next();
        }
        else {
            return new AndCombinatorFilter(filters);
        }
    }

    public static Filter conjunction(Collection filters) {
        if (filters.isEmpty()) {
            return new FalseFilter();
        }
        else if (filters.size() == 1) {
            return filters.iterator().next();
        }
        else {
            return new OrCombinatorFilter(filters);
        }
    }
    
    public static class Root {
        
        public Map classifications = new LinkedHashMap();
    }
    
    public static class Classification {
        
        public String name;
        
        public Map subclasses = new LinkedHashMap();
        public Filter rootFilter;
        
    }
    
    public static interface Filter {
        
    }

    public static interface FrameMatcher {
        
    }

    public static class AnyOfFrameMatcher implements FrameMatcher {
        
        public List submatchers = new ArrayList();
        
        public AnyOfFrameMatcher() {            
        }

        public AnyOfFrameMatcher(List submatchers) {
            this.submatchers.addAll(submatchers);
        }
    }
    
    public static class OrCombinatorFilter implements Filter {
        
        public List subfilters = new ArrayList();
        
        public OrCombinatorFilter() {            
        }

        public OrCombinatorFilter(Collection subfilters) {
            this.subfilters.addAll(subfilters);
        }
    }

    public static class AndCombinatorFilter implements Filter {
        
        public List subfilters = new ArrayList();

        public AndCombinatorFilter() {            
        }

        public AndCombinatorFilter(Collection subfilters) {
            this.subfilters.addAll(subfilters);
        }
    }

    public static class PatternFilter implements Filter, FrameMatcher {
        
        public List patterns = new ArrayList();
    }

    public static class TrueFilter implements Filter, FrameMatcher {
        
    }

    public static class FalseFilter implements Filter, FrameMatcher {
        
    }
    
    public static class NotFilter {
        
        public Filter nested;
        
    }

    public static class LastFollowedFilter implements Filter {
        
        public FrameMatcher snippet;
        public Filter followFilter;
    }

    public static class LastNotFollowedFilter implements Filter {
        
        public FrameMatcher snippet;
        public Filter followFilter;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy