class HugeCountStepStrategy
        extends AbstractTraversalStrategy<ProviderOptimizationStrategy>
        implements ProviderOptimizationStrategy {

    private static final long serialVersionUID = -3910433925919057771L;

    private static final HugeCountStepStrategy INSTANCE;

    static {
        INSTANCE = new HugeCountStepStrategy();
    }

    private HugeCountStepStrategy() {
        // pass
    }

    @Override
    @SuppressWarnings({"rawtypes", "unchecked"})
    public void apply(Traversal.Admin<?, ?> traversal) {<FILL_FUNCTION_BODY>}

    @Override
    public Set<Class<? extends ProviderOptimizationStrategy>> applyPrior() {
        return Collections.singleton(HugeGraphStepStrategy.class);
    }

    @Override
    public Set<Class<? extends ProviderOptimizationStrategy>> applyPost() {
        return Collections.singleton(HugeVertexStepStrategy.class);
    }

    public static HugeCountStepStrategy instance() {
        return INSTANCE;
    }
}

        TraversalUtil.convAllHasSteps(traversal);

        // Extract CountGlobalStep
        List<CountGlobalStep> steps = TraversalHelper.getStepsOfClass(
                CountGlobalStep.class, traversal);
        if (steps.isEmpty()) {
            return;
        }

        // Find HugeGraphStep before count()
        CountGlobalStep<?> originStep = steps.get(0);
        List<Step<?, ?>> originSteps = new ArrayList<>();
        HugeGraphStep<?, ? extends Element> graphStep = null;
        Step<?, ?> step = originStep;
        do {
            if (!(step instanceof CountGlobalStep ||
                  step instanceof GraphStep ||
                  step instanceof IdentityStep ||
                  step instanceof NoOpBarrierStep ||
                  step instanceof CollectingBarrierStep) ||
                (step instanceof TraversalParent &&
                 TraversalHelper.anyStepRecursively(s -> {
                     return s instanceof SideEffectStep ||
                            s instanceof AggregateGlobalStep ||
                            s instanceof AggregateLocalStep;
                 }, (TraversalParent) step))) {
                return;
            }
            originSteps.add(step);
            if (step instanceof HugeGraphStep) {
                graphStep = (HugeGraphStep<?, ? extends Element>) step;
                break;
            }
            step = step.getPreviousStep();
        } while (step != null);

        if (graphStep == null) {
            return;
        }

        // Replace with HugeCountStep
        graphStep.queryInfo().aggregate(Aggregate.AggregateFunc.COUNT, null);
        HugeCountStep<?> countStep = new HugeCountStep<>(traversal, graphStep);
        for (Step<?, ?> origin : originSteps) {
            TraversalHelper.copyLabels(origin, countStep, false);
            traversal.removeStep(origin);
        }
        traversal.addStep(0, countStep);
    
<no_super_class>