Package nexj.core.meta

Examples of nexj.core.meta.TypeMismatchException


         Object indexArg = machine.getArg(1, nArgCount);
        
         if (!(indexArg instanceof Number))
         {
            throw new TypeMismatchException(getSymbol());
         }

         int nIndex = ((Number)indexArg).intValue();
         int nByteCount = getByteCount();
View Full Code Here


         {
            throw new ScriptingException("err.scripting.invalidEndianness", new Object[]{endianness, getSymbol().getName()});
         }
         else
         {
            throw new TypeMismatchException(getSymbol());
         }

         machine.returnValue(getNumber(nArray, nIndex, nByteCount, bBigEndian), nArgCount);

         return false;
View Full Code Here

         Object indexArg = machine.getArg(1, nArgCount);

         if (!(indexArg instanceof Number))
         {
            throw new TypeMismatchException(getSymbol());
         }

         int nIndex = ((Number)indexArg).intValue();
         int nByteCount = getByteCount();
         byte[] nArray = getByteVectorArg(0, nArgCount, machine);

         verifyIndexRange(nIndex, nByteCount, nArray.length);

         if ((nIndex & (nByteCount - 1)) != 0)
         {
            throw new ScriptingException("err.scripting.invalidNativeAlignment",
               new Object[]{getSymbol().getName(), Primitive.createInteger(nByteCount), indexArg});
         }

         Object value = machine.getArg(2, nArgCount);

         if (!(value instanceof Number))
         {
            throw new TypeMismatchException(getSymbol());
         }

         setNumber(nArray, nIndex, (Number)value);
         machine.returnValue(value, nArgCount);
View Full Code Here

         Object endianness = machine.getArg(3, nArgCount);
         boolean bBigEndian;

         if (!(value instanceof Number))
         {
            throw new TypeMismatchException(getSymbol());
         }

         if (endianness == Symbol.BIG)
         {
            bBigEndian = true;
         }
         else if (endianness == Symbol.LITTLE)
         {
            bBigEndian = false;
         }
         else if (endianness instanceof Symbol)
         {
            throw new ScriptingException("err.scripting.invalidEndianness", new Object[]{endianness, getSymbol().getName()});
         }
         else
         {
            throw new TypeMismatchException(getSymbol());
         }

         setNumber(nArray, nIndex, nByteCount, (Number)value, bBigEndian);
         machine.returnValue(value, nArgCount);
View Full Code Here

         {
            throw new ScriptingException("err.scripting.invalidEndianness", new Object[]{endianness, getSymbol().getName()});
         }
         else
         {
            throw new TypeMismatchException(getSymbol());
         }

         machine.returnValue(toNumberList(nArray, nByteCount, bBigEndian, isSigned()), nArgCount);

         return false;
View Full Code Here

               {
                  bResult = (obj != null) && ((Class)clazz).isAssignableFrom(obj.getClass());
               }
               else
               {
                  throw new TypeMismatchException(getSymbol());
               }

               machine.returnValue(Boolean.valueOf(bResult), nArgCount);

               return false;
View Full Code Here

            {
               throw new ScriptingException("err.scripting.invalidEndianness",
                  new Object[]{endianness, getSymbol().getName()});
            }

            throw new TypeMismatchException(getSymbol());
         }

         Object head = machine.getArg(0, nArgCount);
         Pair pair;
         int nLength = 0;
         int nByteCount = getLengthArg(2, nArgCount, machine);

         for (Object next = head; next != null; next = pair.getTail())
         {
            if (!(next instanceof Pair))
            {
               throw new ScriptingException("err.scripting.badList", new Object[]{getSymbol().getName()});
            }

            pair = (Pair)next;

            Object num = pair.getHead();

            if (!(num instanceof Number))
            {
               throw new TypeMismatchException(getSymbol());
            }

            nLength++;
         }
View Full Code Here

            if (endianness instanceof Symbol)
            {
               throw new ScriptingException("err.scripting.invalidEndianness", new Object[]{endianness, getSymbol().getName()});
            }

            throw new TypeMismatchException(getSymbol());
         }

         if (nArgCount == 2 || !isTrue(machine.getArg(2, nArgCount)))
         {
            byte[] nBOMArray = getBigEndianByteOrderMark();
View Full Code Here

            machine.returnValue(list.toArray(), nArgCount);
         }
         else
         {
            throw new TypeMismatchException(getSymbol());
         }

         return false;
      }
View Full Code Here

      {
         int nValue;

         if (!(value instanceof Number))
         {
            throw new TypeMismatchException(getSymbol());
         }

         if (value instanceof Float || value instanceof Double)
         {
            Number num = (Number)value;

            nValue = num.intValue();

            if (nValue != num.doubleValue())
            {
               throw new TypeMismatchException(getSymbol());
            }
         }
         else if (value instanceof BigDecimal)
         {
            BigDecimal dec = (BigDecimal)value;

            if (dec.compareTo(dec.setScale(0, BigDecimal.ROUND_DOWN)) != 0)
            {
               throw new TypeMismatchException(getSymbol());
            }

            nValue = dec.intValue();
         }
         else
View Full Code Here

TOP

Related Classes of nexj.core.meta.TypeMismatchException

Copyright © 2018 www.massapicom. 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.