Exemplo n.º 1
0
 private RError dimensionsError() {
   if (replace) {
     if (mode.isSubset()) {
       if (getDimensions() == 2) {
         return RError.error(this, RError.Message.INCORRECT_SUBSCRIPTS_MATRIX);
       } else {
         return RError.error(this, RError.Message.INCORRECT_SUBSCRIPTS);
       }
     } else {
       return RError.error(this, RError.Message.IMPROPER_SUBSCRIPT);
     }
   } else {
     return RError.error(this, RError.Message.INCORRECT_DIMENSIONS);
   }
 }
Exemplo n.º 2
0
 public static PositionCheckNode createNode(
     ElementAccessMode mode,
     RType containerType,
     Object position,
     int positionIndex,
     int numDimensions,
     boolean exact,
     boolean replace,
     boolean recursive) {
   if (mode.isSubset()) {
     return PositionCheckSubsetNodeGen.create(
         mode, containerType, position, positionIndex, numDimensions, exact, replace);
   } else {
     return PositionCheckSubscriptNodeGen.create(
         mode, containerType, position, positionIndex, numDimensions, exact, replace, recursive);
   }
 }
Exemplo n.º 3
0
 PositionCheckNode(
     ElementAccessMode mode,
     RType containerType,
     Object positionValue,
     int dimensionIndex,
     int numDimensions,
     boolean exact,
     boolean replace) {
   this.positionClass = positionValue.getClass();
   this.dimensionIndex = dimensionIndex;
   this.numDimensions = numDimensions;
   this.replace = replace;
   this.containerType = containerType;
   this.castNode = PositionCastNode.create(mode, replace);
   if (positionValue instanceof String || positionValue instanceof RAbstractStringVector) {
     boolean useNAForNotFound = !replace && isListLike(containerType) && mode.isSubscript();
     characterLookup =
         new PositionCharacterLookupNode(
             mode, numDimensions, dimensionIndex, useNAForNotFound, exact);
   }
 }