/** * Creates long range value. * * @return Instance of {@link RangeValueLong}. */ @SuppressWarnings({ "rawtypes" }) protected RangeValue createRangeValue() { Distribution dist = peek() instanceof Distribution ? (Distribution) pop() : null; Boolean useEdgeCases = peek() instanceof Boolean ? (Boolean) pop() : null; Range range = (Range) pop(); return rangeValueFactory.create(range, useEdgeCases, dist); }
/** * Creates discrete value. * * @return Instance of {@link DiscreteValue}. */ @SuppressWarnings({ "unchecked", "rawtypes" }) protected DiscreteValue createDiscreteValue() { return peek() instanceof Distribution ? new DiscreteValue((List) pop(1), (Distribution) pop()) : new DiscreteValue((List) pop()); }
/** * Creates random content value. * * @return Instance of {@link RandomContentStringValue}. */ @SuppressWarnings({ "unchecked", "rawtypes" }) protected RandomContentStringValue createRandomContentStringValue() { return peek() instanceof List ? new RandomContentStringValue((Value<Integer>) pop(1), (List) pop()) : new RandomContentStringValue((Value<Integer>) pop()); }
/** * Constructs {@link StringTransformer}. * * @return Instance of {@link StringTransformer}. */ @SuppressWarnings({ "unchecked", "rawtypes" }) protected Value<String> getStringValue() { List values = getItemsUpToDelimiter(STRING_VALUE_DELIMITER); String formatString = (String) pop(); return new StringTransformer(formatString, values); }
/** * Boolean value definition. * * @return Boolean value definition rule. */ public Rule booleanLiteralValue() { return Sequence(booleanLiteral(), push(ConstantValue.of(pop()))); }
/** * Getter transformer definition. * * @return Getter transformer definition rule. */ @SuppressWarnings({ "rawtypes" }) public Rule getterTransformer() { return Sequence(function("get", Sequence(stringLiteral(), comma(), value())), push(new GetterTransformer<>((String) pop(1), Object.class, (Value) pop()))); }
/** * Number value definition. * * @return Number value definition rule. */ public Rule numberLiteralValue() { return Sequence(numberLiteral(), push(ConstantValue.of(pop()))); }
/** * Number value definition. * * @return Number value definition rule. */ public Rule numberLiteralValue() { return Sequence(numberLiteral(), push(ConstantValue.of(pop()))); }
/** * JSON transformer definition. * * @return JSON transformer definition rule. */ public Rule jsonTransformer() { return Sequence(function("json", valueReference()), push(new JsonTransformer((Value<?>) pop()))); }
/** * String value definition. * * @return String value definition rule. */ public Rule stringLiteralValue() { return Sequence(FirstOf(stringLiteral(), nakedStringLiteral()), push(ConstantValue.of(pop()))); }
/** * Circular value definition. * * @return Circular value definition rule. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public Rule circularValue() { return Sequence(function("circular", bracketList(value())), push(new CircularValue((List) pop()))); }
/** * List value definition. * * @return List value definition rule. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public Rule listValue() { return Sequence(function("list", bracketList(value())), push(new ListValue((List) pop()))); }
/** * Exact weighted value definition. * * @return Weighted value definition rule. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public Rule exactWeightedValue() { return Sequence(function("exactly", bracketList(countValuePair())), push(new ExactWeightedValue<>((List) pop()))); }
/** * Exact weighted value definition. * * @return Weighted value definition rule. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public Rule exactWeightedValue() { return Sequence(function("exactly", bracketList(countValuePair())), push(new ExactWeightedValue<>((List) pop()))); }
/** * Explicit integer definition. * * @return Explicit integer definition rule. */ public Rule explicitLongLiteral() { return Sequence(function("long", Sequence(Sequence(Optional(sign()), unsignedIntegerLiteral()), push(match()))), push(Long.parseLong((String) pop()))); }
/** * Explicit integer definition. * * @return Explicit integer definition rule. */ public Rule explicitIntegerLiteral() { return Sequence(function("int", Sequence(Sequence(Optional(sign()), unsignedIntegerLiteral()), push(match()))), push(Integer.parseInt((String) pop()))); }
/** * Explicit integer definition. * * @return Explicit integer definition rule. */ public Rule explicitIntegerLiteral() { return Sequence(function("int", Sequence(Sequence(Optional(sign()), unsignedIntegerLiteral()), push(match()))), push(Integer.parseInt((String) pop()))); }
/** * Explicit integer definition. * * @return Explicit integer definition rule. */ public Rule explicitLongLiteral() { return Sequence(function("long", Sequence(Sequence(Optional(sign()), unsignedIntegerLiteral()), push(match()))), push(Long.parseLong((String) pop()))); }
/** * Short definition. * * @return Short definition rule. */ public Rule explicitShortLiteral() { return Sequence( function("short", Sequence(Sequence(Optional(sign()), unsignedIntegerLiteral()), push(match()))), push(Short.parseShort((String) pop()))); }