@Override public RAbstractVector tryFoldConstantTime(RAbstractVector operand, int operandLength) { if (arithmetic instanceof Plus) { return operand; } else if (arithmetic instanceof Negate && operand instanceof RSequence) { if (operand instanceof RIntSequence) { int start = ((RIntSequence) operand).getStart(); int stride = ((RIntSequence) operand).getStride(); return RDataFactory.createIntSequence( applyInteger(start), applyInteger(stride), operandLength); } else if (operand instanceof RDoubleSequence) { double start = ((RDoubleSequence) operand).getStart(); double stride = ((RDoubleSequence) operand).getStride(); return RDataFactory.createDoubleSequence( applyDouble(start), applyDouble(stride), operandLength); } } return null; }