Examples of UnsupportedOperation


Examples of org.rascalmpl.interpreter.staticErrors.UnsupportedOperation

        throw new UnexpectedType(keyType, subscript.getType(),
            this.getSubscript());
      }
      // TODO implement other subscripts
      throw new UnsupportedOperation("subscript",
          receiver.getType(), this);

    }
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnsupportedOperation

      if (name.equals("year")) {
        if (!dt.isTime()) {
          return makeResult(getTypeFactory().integerType(), vf.integer(dt.getYear()), ctx);
        }
        throw new UnsupportedOperation("Can not retrieve the year on a time value",ctx.getCurrentAST());
      } else if (name.equals("month")) {
        if (!dt.isTime()) {
          return makeResult(getTypeFactory().integerType(), vf.integer(getValue().getMonthOfYear()), ctx);
        }
        throw new UnsupportedOperation("Can not retrieve the month on a time value",ctx.getCurrentAST());
      } else if (name.equals("day")) {
        if (!dt.isTime()) {
          return makeResult(getTypeFactory().integerType(), vf.integer(getValue().getDayOfMonth()), ctx);
        }
        throw new UnsupportedOperation("Can not retrieve the day on a time value",ctx.getCurrentAST());
      } else if (name.equals("hour")) {
        if (!dt.isDate()) {
          return makeResult(getTypeFactory().integerType(), vf.integer(getValue().getHourOfDay()), ctx);
        }
        throw new UnsupportedOperation("Can not retrieve the hour on a date value",ctx.getCurrentAST());
      } else if (name.equals("minute")) {
        if (!dt.isDate()) {
          return makeResult(getTypeFactory().integerType(), vf.integer(getValue().getMinuteOfHour()), ctx);
        }
        throw new UnsupportedOperation("Can not retrieve the minute on a date value",ctx.getCurrentAST());
      } else if (name.equals("second")) {
        if (!dt.isDate()) {
          return makeResult(getTypeFactory().integerType(), vf.integer(getValue().getSecondOfMinute()), ctx);
        }
        throw new UnsupportedOperation("Can not retrieve the second on a date value",ctx.getCurrentAST());
      } else if (name.equals("millisecond")) {
        if (!dt.isDate()) {
          return makeResult(getTypeFactory().integerType(), vf.integer(getValue().getMillisecondsOfSecond()), ctx);
        }
        throw new UnsupportedOperation("Can not retrieve the millisecond on a date value",ctx.getCurrentAST());
      } else if (name.equals("timezoneOffsetHours")) {
        if (!dt.isDate()) {
          return makeResult(getTypeFactory().integerType(), vf.integer(getValue().getTimezoneOffsetHours()), ctx);
        }
        throw new UnsupportedOperation("Can not retrieve the timezone offset hours on a date value",ctx.getCurrentAST());
      } else if (name.equals("timezoneOffsetMinutes")) {
        if (!dt.isDate()) {
          return makeResult(getTypeFactory().integerType(), vf.integer(getValue().getTimezoneOffsetMinutes()), ctx);
        }
        throw new UnsupportedOperation("Can not retrieve the timezone offset minutes on a date value",ctx.getCurrentAST());
      } else if (name.equals("century")) {
        if (!dt.isTime()) {
          return makeResult(getTypeFactory().integerType(), vf.integer(getValue().getCentury()), ctx);
        }
        throw new UnsupportedOperation("Can not retrieve the century on a time value",ctx.getCurrentAST());
      } else if (name.equals("isDate")) {
        return makeResult(getTypeFactory().boolType(), vf.bool(getValue().isDate()), ctx);
      } else if (name.equals("isTime")) {
        return makeResult(getTypeFactory().boolType(), vf.bool(getValue().isTime()), ctx);
      } else if (name.equals("isDateTime")) {
        return makeResult(getTypeFactory().boolType(), vf.bool(getValue().isDateTime()), ctx);
      } else if (name.equals("justDate")) {
        if (!dt.isTime()) {
          return makeResult(getTypeFactory().dateTimeType(),
              vf.date(dt.getYear(), dt.getMonthOfYear(), dt.getDayOfMonth()), ctx);
        }
        throw new UnsupportedOperation("Can not retrieve the date component of a time value",ctx.getCurrentAST());
      } else if (name.equals("justTime")) {
        if (!dt.isDate()) {
          return makeResult(getTypeFactory().dateTimeType(),
              vf.time(dt.getHourOfDay(), dt.getMinuteOfHour(), dt.getSecondOfMinute(),
                  dt.getMillisecondsOfSecond(), dt.getTimezoneOffsetHours(),
                  dt.getTimezoneOffsetMinutes()), ctx);
        }
        throw new UnsupportedOperation("Can not retrieve the time component of a date value",ctx.getCurrentAST());
      }
    } catch (InvalidDateTimeException e) {
      throw RuntimeExceptionFactory.illegalArgument(dt, ctx.getCurrentAST(), null, e.getMessage());

    }
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnsupportedOperation

    int tzOffsetMin = dt.getTimezoneOffsetMinutes();

    try {
      if (name.equals("year")) {
        if (dt.isTime()) {
          throw new UnsupportedOperation("Can not update the year on a time value",ctx.getCurrentAST());
        }     
        if (!replType.isInteger()) {
          throw new UnexpectedType(getTypeFactory().integerType(), replType, ctx.getCurrentAST());
        }
        year = ((IInteger) replValue).intValue();
      } else if (name.equals("month")) {
        if (dt.isTime()) {
          throw new UnsupportedOperation("Can not update the month on a time value",ctx.getCurrentAST());
        }     
        if (!replType.isInteger()) {
          throw new UnexpectedType(getTypeFactory().integerType(), replType, ctx.getCurrentAST());
        }
        month = ((IInteger) replValue).intValue();       
      } else if (name.equals("day")) {
        if (dt.isTime()) {
          throw new UnsupportedOperation("Can not update the day on a time value",ctx.getCurrentAST());
        }     
        if (!replType.isInteger()) {
          throw new UnexpectedType(getTypeFactory().integerType(), replType, ctx.getCurrentAST());
        }
        day = ((IInteger) replValue).intValue();       
      } else if (name.equals("hour")) {
        if (dt.isDate()) {
          throw new UnsupportedOperation("Can not update the hour on a date value",ctx.getCurrentAST());
        }     
        if (!replType.isInteger()) {
          throw new UnexpectedType(getTypeFactory().integerType(), replType, ctx.getCurrentAST());
        }
        hour = ((IInteger) replValue).intValue();       
      } else if (name.equals("minute")) {
        if (dt.isDate()) {
          throw new UnsupportedOperation("Can not update the minute on a date value",ctx.getCurrentAST());
        }     
        if (!replType.isInteger()) {
          throw new UnexpectedType(getTypeFactory().integerType(), replType, ctx.getCurrentAST());
        }
        minute = ((IInteger) replValue).intValue();       
      } else if (name.equals("second")) {
        if (dt.isDate()) {
          throw new UnsupportedOperation("Can not update the second on a date value",ctx.getCurrentAST());
        }     
        if (!replType.isInteger()) {
          throw new UnexpectedType(getTypeFactory().integerType(), replType, ctx.getCurrentAST());
        }
        second = ((IInteger) replValue).intValue();       
      } else if (name.equals("millisecond")) {
        if (dt.isDate()) {
          throw new UnsupportedOperation("Can not update the millisecond on a date value",ctx.getCurrentAST());
        }     
        if (!replType.isInteger()) {
          throw new UnexpectedType(getTypeFactory().integerType(), replType, ctx.getCurrentAST());
        }
        milli = ((IInteger) replValue).intValue();     
      } else if (name.equals("timezoneOffsetHours")) {
        if (dt.isDate()) {
          throw new UnsupportedOperation("Can not update the timezone offset hours on a date value",ctx.getCurrentAST());
        }     
        if (!replType.isInteger()) {
          throw new UnexpectedType(getTypeFactory().integerType(), replType, ctx.getCurrentAST());
        }
        tzOffsetHour = ((IInteger) replValue).intValue();       
      } else if (name.equals("timezoneOffsetMinutes")) {
        if (dt.isDate()) {
          throw new UnsupportedOperation("Can not update the timezone offset minutes on a date value",ctx.getCurrentAST());
        }     
        if (!replType.isInteger()) {
          throw new UnexpectedType(getTypeFactory().integerType(), replType, ctx.getCurrentAST());
        }
        tzOffsetMin = ((IInteger) replValue).intValue();       
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnsupportedOperation

      }
     
      if (Factory.Tree_Appl.hasField(name)) {
        Type fieldType = Factory.Tree_Appl.getFieldType(name);
        if (repl.getType().isSubtypeOf(fieldType)) {
          throw new UnsupportedOperation("changing " + name + " in concrete tree", ctx.getCurrentAST());
        }
        throw new UnexpectedType(fieldType, repl.getType(), ctx.getCurrentAST());
      }

      throw RuntimeExceptionFactory.noSuchField(name, ctx.getCurrentAST(), ctx.getStackTrace());
    }
    throw new UnsupportedOperation("field update", ctx.getCurrentAST());
  }
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnsupportedOperation

  @Override
  public <U extends IValue, V extends IValue> Result<U> fieldUpdate(
      String name, Result<V> repl, TypeStore store) {
    if(type.getKeyLabel() != null){
      if (type.getKeyLabel().equals(name)) {
        throw new UnsupportedOperation("You can not update the keys of a map using the field update operator", ctx.getCurrentAST());
      }
      else if (type.getValueLabel().equals(name)) {
        // interesting operation, sets the image of all keys to one default
        if (!repl.getType().isSubtypeOf(type.getValueType())) {
          throw new UnexpectedType(type.getValueType(), repl.getType(), ctx.getCurrentAST());
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnsupportedOperation

      Result<IValue> result = this.getArgument().interpret(__eval);
      Type expected = getType().typeOf(__eval.getCurrentEnvt(), true, __eval);

      if (!(expected instanceof NonTerminalType)) {
        throw new UnsupportedOperation("inline parsing", expected, this);
      }
     
      if (!result.getType().isSubtypeOf(TF.stringType())) {
        throw new UnsupportedOperation("inline parsing", result.getType(), this);
      }
     
      IConstructor symbol = ((NonTerminalType) expected).getSymbol();
      if (!SymbolAdapter.isSort(symbol) && !SymbolAdapter.isLex(symbol) && !SymbolAdapter.isLayouts(symbol)) {
        throw new UnsupportedOperation("inline parsing", expected, this);
      }

      __eval.__setInterrupt(false);
      try {
        IConstructor tree = __eval.parseObject(symbol, VF.mapWriter().done(),
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnsupportedOperation

      if (shallow) {
        throw new NotEnumerable(subjectType.toString(), ctx.getCurrentAST());
      }
      return new SingleIValueIterator(subjectValue);
    } else {
      throw new UnsupportedOperation("makeIterator", subjectType, ctx.getCurrentAST());
    }
  }
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnsupportedOperation

  public static Type jdbc2pdbType(int columnType, boolean nullable) {
    Type res = null;

    switch(columnType) {
      case Types.ARRAY:
        throw new UnsupportedOperation("JDBC Array types are currently not supported", null);
      case Types.BIGINT:
        res = TF.integerType();
        break;
      case Types.BINARY:
        res = TF.listType(TF.integerType());
        break;
      case Types.BIT:
        res = TF.boolType();
        break;
      case Types.BLOB:
        res = TF.listType(TF.integerType());
        break;
      case Types.BOOLEAN:
        res = TF.boolType();
        break;
      case Types.CHAR:
        res = TF.stringType();
        break;
      case Types.CLOB:
        res = TF.stringType();
        break;
      case Types.DATALINK:
        throw new UnsupportedOperation("JDBC Datalink types are currently not supported", null);
      case Types.DATE:
        res = TF.dateTimeType();
        break;
      case Types.DECIMAL:
        res = TF.realType();
        break;
      case Types.DISTINCT:
        throw new UnsupportedOperation("JDBC Distinct types are currently not supported", null);
      case Types.DOUBLE:
        res = TF.realType();
        break;
      case Types.FLOAT:
        res = TF.realType();
        break;
      case Types.INTEGER:
        res = TF.integerType();
        break;
      case Types.JAVA_OBJECT:
        throw new UnsupportedOperation("JDBC JavaObject types are currently not supported", null);
      case Types.LONGNVARCHAR:
        res = TF.stringType();
        break;
      case Types.LONGVARBINARY:
        res = TF.listType(TF.integerType());
        break;
      case Types.LONGVARCHAR:
        res = TF.stringType();
        break;
      case Types.NCHAR:
        res = TF.stringType();
        break;
      case Types.NCLOB:
        res = TF.stringType();
        break;
      case Types.NULL:
        throw new UnsupportedOperation("JDBC Null types are currently not supported", null);
      case Types.NUMERIC:
        res = TF.realType();
        break;
      case Types.NVARCHAR:
        res = TF.stringType();
        break;
      case Types.OTHER:
        throw new UnsupportedOperation("JDBC Other types are currently not supported", null);
      case Types.REAL:
        res = TF.realType();
        break;
      case Types.REF:
        throw new UnsupportedOperation("JDBC Ref types are currently not supported", null);
      case Types.ROWID:
        throw new UnsupportedOperation("JDBC RowID types are currently not supported", null);
      case Types.SMALLINT:
        res = TF.integerType();
        break;
      case Types.SQLXML:
        throw new UnsupportedOperation("JDBC SQLXML types are currently not supported", null);
      case Types.STRUCT:
        throw new UnsupportedOperation("JDBC Struct types are currently not supported", null);
      case Types.TIME:
        res = TF.dateTimeType();
        break;
      case Types.TIMESTAMP:
        res = TF.dateTimeType();
        break;
      case Types.TINYINT:
        res = TF.integerType();
        break;
      case Types.VARBINARY:
        res = TF.listType(TF.integerType());
        break;
      case Types.VARCHAR:
        res = TF.stringType();
        break;
      default:
        throw new UnsupportedOperation("Unknown column type: " + columnType, null);
    }
   
    if (nullable) {
      HashMap<Type,Type> bindings = new HashMap<Type,Type>();
      bindings.put(nullableT, res);
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnsupportedOperation

      InputStream isr = null;
      int isrRes = -1;
     
      switch(jdbcColumnType) {
        case Types.ARRAY:
          throw new UnsupportedOperation("JDBC Array types are currently not supported", null);
        case Types.BIGINT:
          if (rs.getBigDecimal(idx) != null)
            res = vf.integer(rs.getBigDecimal(idx).toString());
          else
            res = vf.integer(0);
          break;
        case Types.BINARY:
          isr = rs.getBinaryStream(idx);
          lw = vf.listWriter(TypeFactory.getInstance().integerType());
          if (isr != null) {
            isrRes = isr.read();
            while (isrRes != -1) {
              lw.append(vf.integer(isrRes));
              isrRes = isr.read();
            }
          }
          res = lw.done();
          break;
        case Types.BIT:
          res = vf.bool(rs.getBoolean(idx));
          break;
        case Types.BLOB:
          lw = vf.listWriter(TypeFactory.getInstance().integerType());
          if (rs.getBlob(idx) != null) {
            isr = rs.getBlob(idx).getBinaryStream();
            if (isr != null) {
              isrRes = isr.read();
              while (isrRes != -1) {
                lw.append(vf.integer(isrRes));
                isrRes = isr.read();
              }
            }
          }
          res = lw.done();
          break;
        case Types.BOOLEAN:
          res = vf.bool(rs.getBoolean(idx));
          break;
        case Types.CHAR:
          if (rs.getString(idx) != null)
            res = vf.string(rs.getString(idx));
          else
            res = vf.string("");
          break;
        case Types.CLOB:
          lw = vf.listWriter(TypeFactory.getInstance().integerType());
          if (rs.getClob(idx) != null) {
            isr = rs.getClob(idx).getAsciiStream();
            if (isr != null) {
              isrRes = isr.read();
              while (isrRes != -1) {
                lw.append(vf.integer(isrRes));
                isrRes = isr.read();
              }
            }
          }
          res = lw.done();
          break;
        case Types.DATALINK:
          throw new UnsupportedOperation("JDBC Datalink types are currently not supported", null);
        case Types.DATE:
          if (rs.getDate(idx) != null) {
            c = Calendar.getInstance();
            c.setTimeInMillis(rs.getDate(idx).getTime());
//            c.setTime(rs.getDate(idx));
          }
          res = vf.date(c.get(Calendar.YEAR), c.get(Calendar.MONTH)+1, c.get(Calendar.DAY_OF_MONTH));
          break;
        case Types.DECIMAL:
          if (rs.getBigDecimal(idx) != null)
            res = vf.real(rs.getBigDecimal(idx).toString());
          else
            res = vf.real(0.0);
          break;
        case Types.DISTINCT:
          throw new UnsupportedOperation("JDBC Distinct types are currently not supported", null);
        case Types.DOUBLE:
          res = vf.real(rs.getDouble(idx));
          break;
        case Types.FLOAT:
          res = vf.real(rs.getFloat(idx));
          break;
        case Types.INTEGER:
          res = vf.integer(rs.getInt(idx));
          break;
        case Types.JAVA_OBJECT:
          throw new UnsupportedOperation("JDBC JavaObject types are currently not supported", null);
        case Types.LONGNVARCHAR:
          if (rs.getString(idx) != null)
            res = vf.string(rs.getString(idx));
          else
            res = vf.string("");
          break;
        case Types.LONGVARBINARY:
          lw = vf.listWriter(TypeFactory.getInstance().integerType());
          isr = rs.getBinaryStream(idx);
          if (isr != null) {
            isrRes = isr.read();
            while (isrRes != -1) {
              lw.append(vf.integer(isrRes));
              isrRes = isr.read();
            }
          }
          res = lw.done();
          break;
        case Types.LONGVARCHAR:
          if (rs.getString(idx) != null)
            res = vf.string(rs.getString(idx));
          else
            res = vf.string("");
          break;
        case Types.NCHAR:
          if (rs.getString(idx) != null)
            res = vf.string(rs.getString(idx));
          else
            res = vf.string("");
          break;
        case Types.NCLOB:
          lw = vf.listWriter(TypeFactory.getInstance().integerType());
          if (rs.getNClob(idx) != null) {
            isr = rs.getNClob(idx).getAsciiStream();
            if (isr != null) {
              isrRes = isr.read();
              while (isrRes != -1) {
                lw.append(vf.integer(isrRes));
                isrRes = isr.read();
              }
            }
          }
          res = lw.done();
          break;
        case Types.NULL:
          throw new UnsupportedOperation("JDBC Null types are currently not supported", null);
        case Types.NUMERIC:
          if (rs.getBigDecimal(idx) != null) {
            res = vf.real(rs.getBigDecimal(idx).toString());
          } else {
            res = vf.real(0);
          }
          break;
        case Types.NVARCHAR:
          if (rs.getString(idx) != null)
            res = vf.string(rs.getString(idx));
          else
            res = vf.string("");
          break;
        case Types.OTHER:
          throw new UnsupportedOperation("JDBC Other types are currently not supported", null);
        case Types.REAL:
          res = vf.real(rs.getDouble(idx));
          break;
        case Types.REF:
          throw new UnsupportedOperation("JDBC Ref types are currently not supported", null);
        case Types.ROWID:
          throw new UnsupportedOperation("JDBC RowID types are currently not supported", null);
        case Types.SMALLINT:
          res = vf.integer(rs.getInt(idx));
          break;
        case Types.SQLXML:
          throw new UnsupportedOperation("JDBC SQLXML types are currently not supported", null);
        case Types.STRUCT:
          throw new UnsupportedOperation("JDBC Struct types are currently not supported", null);
        case Types.TIME:
          if (rs.getTime(idx) != null) {
            c = Calendar.getInstance();
            c.setTimeInMillis(rs.getDate(idx).getTime());
          }
          res = vf.time(c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE), c.get(Calendar.SECOND), c.get(Calendar.MILLISECOND));
          break;
        case Types.TIMESTAMP:
          if (rs.getTimestamp(idx) != null) {
            c = Calendar.getInstance();
            c.setTimeInMillis(rs.getDate(idx).getTime());
          }
          res = vf.datetime(c.get(Calendar.YEAR), c.get(Calendar.MONTH)+1, c.get(Calendar.DAY_OF_MONTH), c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE), c.get(Calendar.SECOND), c.get(Calendar.MILLISECOND));
          break;
        case Types.TINYINT:
          res = vf.integer(rs.getInt(idx));
          break;
        case Types.VARBINARY:
          lw = vf.listWriter(TypeFactory.getInstance().integerType());
          isr = rs.getBinaryStream(idx);
          if (isr != null) {
            isrRes = isr.read();
            while (isrRes != -1) {
              lw.append(vf.integer(isrRes));
              isrRes = isr.read();
            }
          }
          res = lw.done();
          break;
        case Types.VARCHAR:
          if (rs.getString(idx) != null)
            res = vf.string(rs.getString(idx));
          else
            res = vf.string("");
          break;
        default:
          throw new UnsupportedOperation("Unknown column type: " + jdbcColumnType, null);
      }

      if(rs.getMetaData().isNullable(idx) != ResultSetMetaData.columnNoNulls) {
        Type resType = jdbc2pdbType(jdbcColumnType, true);
View Full Code Here

Examples of simtools.data.UnsupportedOperation

         */
        public Object getMin() throws UnsupportedOperation {
            try {
                return new Double(TimeStampedDataSource.this.getStart());
            } catch (DataException e) {
                throw new UnsupportedOperation(e.getMessage());
           
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.