@Override protected Boolean projectArray(Path p, QueryEvaluationContext ctx) { // Is this array element in range? int index = p.getIndex(p.numSegments() - 1); if (index >= from && index <= to) { // This array element is selected. setLastMatch(true); return isIncluded() ? Boolean.TRUE : Boolean.FALSE; } else { return Boolean.FALSE; } } }
/** * Builds a (potentially nested) projection based on the given projection, * and the location in the metadata field tree. */ public static Projector getInstance(Projection projection, Path ctxPath, FieldTreeNode ctx) { if (projection instanceof FieldProjection) { return new FieldProjector((FieldProjection) projection, ctxPath, ctx); } else if (projection instanceof ProjectionList) { return new ListProjector((ProjectionList) projection, ctxPath, ctx); } else if (projection instanceof ArrayRangeProjection) { return new ArrayRangeProjector((ArrayRangeProjection) projection, ctxPath, ctx); } else { return new ArrayQueryProjector((ArrayQueryMatchProjection) projection, ctxPath, ctx); } }
@Override protected Projection.Inclusion projectArray(Path p, QueryEvaluationContext ctx) { // Is this array element in range? int index = p.getIndex(p.numSegments() - 1); if (to == null) { if (index >= from) { // This array element is selected. return isIncluded() ? Projection.Inclusion.explicit_inclusion : Projection.Inclusion.explicit_exclusion; } else { return Projection.Inclusion.explicit_exclusion; } } else if (to < 0) { return Projection.Inclusion.explicit_exclusion; } else if (from <= to && index >= from && index <= to) { // This array element is selected. return isIncluded() ? Projection.Inclusion.explicit_inclusion : Projection.Inclusion.explicit_exclusion; } else { return Projection.Inclusion.explicit_exclusion; } } }
/** * Builds a (potentially nested) projection based on the given projection, * and the location in the metadata field tree. */ public static Projector getInstance(Projection projection, Path ctxPath, FieldTreeNode ctx) { if (projection instanceof FieldProjection) { return new FieldProjector((FieldProjection) projection, ctxPath, ctx); } else if (projection instanceof ProjectionList) { return new ListProjector((ProjectionList) projection, ctxPath, ctx); } else if (projection instanceof ArrayRangeProjection) { return new ArrayRangeProjector((ArrayRangeProjection) projection, ctxPath, ctx); } else { return new ArrayQueryProjector((ArrayQueryMatchProjection) projection, ctxPath, ctx); } }
@Override protected Projection.Inclusion projectArray(Path p, QueryEvaluationContext ctx) { // Is this array element in range? int index = p.getIndex(p.numSegments() - 1); if (to == null) { if (index >= from) { // This array element is selected. return isIncluded() ? Projection.Inclusion.explicit_inclusion : Projection.Inclusion.explicit_exclusion; } else { return Projection.Inclusion.explicit_exclusion; } } else if (to < 0) { return Projection.Inclusion.explicit_exclusion; } else if (from <= to && index >= from && index <= to) { // This array element is selected. return isIncluded() ? Projection.Inclusion.explicit_inclusion : Projection.Inclusion.explicit_exclusion; } else { return Projection.Inclusion.explicit_exclusion; } } }
/** * Builds a (potentially nested) projection based on the given projection, * and the location in the metadata field tree. */ public static Projector getInstance(Projection projection, Path ctxPath, FieldTreeNode ctx) { if (projection instanceof FieldProjection) { return new FieldProjector((FieldProjection) projection, ctxPath, ctx); } else if (projection instanceof ProjectionList) { return new ListProjector((ProjectionList) projection, ctxPath, ctx); } else if (projection instanceof ArrayRangeProjection) { return new ArrayRangeProjector((ArrayRangeProjection) projection, ctxPath, ctx); } else { return new ArrayQueryProjector((ArrayQueryMatchProjection) projection, ctxPath, ctx); } }