Interface ISliceFilter

  • All Superinterfaces:
    com.google.common.base.Predicate<org.eclipse.xtext.resource.IEObjectDescription>, Predicate<org.eclipse.xtext.resource.IEObjectDescription>
    All Known Implementing Classes:
    OneSegmentPredicate, SomeSegmentsPredicate

    public interface ISliceFilter
    extends com.google.common.base.Predicate<org.eclipse.xtext.resource.IEObjectDescription>
    Special predicate defines the index slice in DT project.
    This predicates are registered in extension point "com._1c.g5.v8.dt.core.indexSlicePredicate".
    It is main part of useful mechanism of increasing performance for searching elements in DT project index
    Also it is a identifier for concrete index slice therefore there is only one instance of it . For getting it should use special service IIndexSlicePredicateService.

    This special index slices are used with IScope or IScopeProvider. Some examples: Though index slice predicate names are "FooIndexSlice" and "TooIndexSlice". For getting elements from index corresponding to the them you should write this code:

    public Iterable getFooTooElementsFromIndex(Resource resource, EReference reference, IGlobalScopeProvider                                                                   scopeProvder, IIndexSlicePredicateService slicePredicateService)
    {
        ISliceFilter filter = slicePredicateService.getPredicate("FooIndexSlice");
        com._1c.g5.modeling.xtext.scoping.AndPredicate allFilters = new AndPredicate<>(filter);
        filter = slicePredicateService.getPredicate("TooIndexSlice");
        allFilters.addPredicate(filter);
        return scopeProvider.getScope(resource, reference, allFilters).getAllElements();
    }
    
    If you use "IScopeProvider" then write this code:
    public Iterable getFooTooElementsFromIndex(EObject context, EReference reference, IScopeProvider                                                                   scopeProvder, IIndexSlicePredicateService slicePredicateService)
    {
        List allFilters = new ArrayList<>();
        ISliceFilter filter = slicePredicateService.getPredicate("FooIndexSlice");
        allFilters.add(filter);
        filter = slicePredicateService.getPredicate("TooIndexSlice");
        allFilters.add(filter);
        IScope scope = scopeProvider.getScope(resource, reference);
        return ((ISlicedScope)scope).getAllElements(allFilters);
    }
    

    • Method Summary

      • Methods inherited from interface com.google.common.base.Predicate

        apply, equals, test