Package nexj.core.meta

Examples of nexj.core.meta.TypeMismatchException


      {
         m_bConstant = false;

         if (!(type instanceof Primitive))
         {
            throw new TypeMismatchException(getSymbol());
         }
      }

      return this;
   }
View Full Code Here


                  m_bConstant = false;
                  m_type = type;
                  break;

               default:
                  throw new TypeMismatchException(getSymbol());
            }

            if (op.isConstant())
            {
               foldConstant();
            }
         }
         else
         {
            throw new TypeMismatchException(getSymbol());
         }
      }

      return this;
   }
View Full Code Here

            mapper = getConversionMapper();
            descriptor = mapper.getUnaryDescriptor(this);

            if (descriptor == null)
            {
               throw new TypeMismatchException(getSymbol());
            }
         }
         else
         {
            resultType = getConversionMapper().getUnaryDescriptor(this).getResultType();
View Full Code Here

    * Normalizes a class attribute.
    * @see nexj.core.persistence.Operator#normalize(int)
    */
   protected Operator normalizeMetaclass(int nFlags)
   {
      throw new TypeMismatchException(getSymbol());
   }
View Full Code Here

         }
         else
         {
            if (op.getType() != Primitive.BOOLEAN)
            {
               throw new TypeMismatchException(getSymbol());
            }

            if (op.isConstant())
            {
               if (Boolean.FALSE.equals(op.getValue()))
View Full Code Here

      {
         if (rightType != null)
         {
            if (!rightType.isPrimitive())
            {
               throw new TypeMismatchException(getSymbol());
            }
         }

         if (leftType == Primitive.ANY && m_left.isConstant() && m_right.isConstant())
         {
            foldObjectComparison();
            return this;
         }

         ConversionMapper mapper = null;
         BinaryDescriptor descriptor = null;

         if (m_source != null)
         {
            mapper = m_source.getAdapter().getConversionMapper();
            descriptor = mapper.getBinaryDescriptor(this);
         }

         if (descriptor == null)
         {
            m_source = null;
            mapper = getConversionMapper();
            descriptor = mapper.getBinaryDescriptor(this);

            if (descriptor == null)
            {
               throw new TypeMismatchException(getSymbol());
            }
         }

         Primitive rightPrimitive = (Primitive)rightType;

         if (mapper.getType(rightPrimitive) != mapper.getType(descriptor.getRightType()))
         {
            setRight(new TypeConversionOperator(descriptor.getRightType(), m_right));
            m_right = m_right.normalize(nFlags | NORMALIZE_NORECUR);
         }

         Primitive leftPrimitive = (Primitive)leftType;

         if (mapper.getType(leftPrimitive) != mapper.getType(descriptor.getLeftType()))
         {
            if (m_right.isConstant() && Primitive.isOrderPreserved(leftPrimitive, descriptor.getLeftType()))
            {
               if (m_right.getValue() != null)
               {
                  m_bConstant = false;

                  if (unconvertConstantComparison(leftPrimitive, rightPrimitive, m_right.getValue()))
                  {
                     if (m_bConstant)
                     {
                        return this;
                     }
                  }
                  else
                  {
                     setLeft(new TypeConversionOperator(descriptor.getLeftType(), m_left));
                     m_left = m_left.normalize(nFlags | NORMALIZE_NORECUR);
                  }
               }
            }
            else
            {
               setLeft(new TypeConversionOperator(descriptor.getLeftType(), m_left));
               m_left = m_left.normalize(nFlags | NORMALIZE_NORECUR);
            }
         }

         if (m_left.isConstant())
         {
            assert m_right.isConstant();

            setConstantValue(evaluate());
         }
         else if (m_right.isConstant())
         {
            if (m_left.getOrdinal() == AttributeOperator.ORDINAL)
            {
               AttributeOperator left = (AttributeOperator)m_left;
               Converter converter = left.getConverter();

               if (converter != null && (isEquivalence() ||
                  Primitive.isOrderPreserved(converter.getSourceType(), converter.getDestinationType())))
               {
                  left.setType(converter.getSourceType());
                  left.setNoConversion(true);
                  m_right.setValue(converter.getInverseFunction().invoke(m_right.getValue()));
                  m_right.setType(converter.getSourceType());
               }
            }
            else if (m_left.getType() == Primitive.BOOLEAN && m_right.getValue() != null)
            {
               switch (booleanPredicate(((Boolean)m_right.getValue()).booleanValue()))
               {
                  case BOOL_LHS:
                     return m_left;

                  case BOOL_NOT:
                     NotOperator op = new NotOperator();

                     op.setOperand(m_left);
                     op.normalize(nFlags | NORMALIZE_NORECUR);

                     return op;

                  case BOOL_TRUE:
                     setConstantValue(Boolean.TRUE);
                     break;

                  case BOOL_FALSE:
                     setConstantValue(Boolean.FALSE);
                     break;
               }
            }
         }
      }
      else
      {
         assert m_left.getOrdinal() == AttributeOperator.ORDINAL;

         if (rightType != null)
         {
            if (rightType.isPrimitive() &&
               (rightType != Primitive.ANY || !m_right.isConstant() ||
                m_right.getValue() != null && !(m_right.getValue() instanceof OIDHolder)))
            {
               throw new TypeMismatchException(getSymbol());
            }
         }

         if (m_left.isConstant())
         {
            foldObjectComparison();
            return this;
         }

         if ((nFlags & NORMALIZE_PERSISTENCE) != 0 && m_source != null)
         {
            PersistenceAdapter adapter = m_source.getAdapter();
            Field[] leftFieldArray = adapter.getFields(m_left.getSource());

            if (leftFieldArray != null)
            {
               Field[] rightFieldArray = null;
               Object[] valueArray = null;

               if (m_right.isConstant())
               {
                  if (m_right.getValue() != null)
                  {
                     OID oid = ((OIDHolder)m_right.getValue()).getOID();

                     if (oid != null)
                     {
                        valueArray = adapter.getValues(oid, m_left.getSource());

                        if (leftFieldArray.length != valueArray.length)
                        {
                           throw new TypeMismatchException(getSymbol());
                        }
                     }
                     else if (isEquivalence())
                     {
                        setConstantValue(Boolean.valueOf(nullPredicate(false)));

                        return this;
                     }
                  }
               }
               else
               {
                  assert m_right.getOrdinal() == AttributeOperator.ORDINAL;

                  rightFieldArray = adapter.getFields((Query)m_right.getSource());

                  assert rightFieldArray != null;

                  if (leftFieldArray.length != rightFieldArray.length)
                  {
                     throw new TypeMismatchException(getSymbol());
                  }
               }

               assert leftFieldArray.length > 0;
View Full Code Here

      if (m_left.getValue() != null)
      {
         if (!(m_left.getValue() instanceof OIDHolder))
         {
            throw new TypeMismatchException(getSymbol());
         }

         OID oid = ((OIDHolder)m_left.getValue()).getOID();

         if (oid != null)
         {
            leftValues = oid.getValueArray();
         }
         else
         {
            bReference = true;
         }
      }

      Object[] rightValues = null;

      if (m_right.getValue() != null)
      {
         if (!(m_right.getValue() instanceof OIDHolder))
         {
            throw new TypeMismatchException(getSymbol());
         }

         OID oid = ((OIDHolder)m_right.getValue()).getOID();

         if (oid != null)
         {
            rightValues = oid.getValueArray();
         }
         else
         {
            bReference = true;
         }
      }

      if (bReference && isEquivalence())
      {
         m_value = Boolean.valueOf(nullPredicate(m_left.getValue() == m_right.getValue()));
      }
      else if (leftValues != null)
      {
         int nCount = leftValues.length;

         if (rightValues != null && rightValues.length != nCount)
         {
            throw new TypeMismatchException(getSymbol());
         }
         else
         {
            m_value = compare(leftValues, rightValues, nCount);
         }
View Full Code Here

      if (leftValue == null)
      {
         return Boolean.valueOf(nullPredicate(m_right.getValue() == null));
      }

      throw new TypeMismatchException(getSymbol());
   }
View Full Code Here

         if (fromType != null)
         {
            if (!fromType.isPrimitive())
            {
               throw new TypeMismatchException(getSymbol());
            }

            Primitive toType = m_argTypeArray[i];

            if (toType != fromType)
            {
               if (toType.findStrictConverter((Primitive)fromType) == null)
               {
                  throw new TypeMismatchException(getSymbol());
               }

               op = new TypeConversionOperator(toType, op);
               setOperand(i, op);
               op = op.normalize(nFlags | NORMALIZE_NORECUR);
View Full Code Here

               mapper = getConversionMapper();
               descriptor = mapper.getBinaryDescriptor(this);

               if (descriptor == null)
               {
                  throw new TypeMismatchException(getSymbol());
               }
            }
            else
            {
               resultType = getConversionMapper().getBinaryDescriptor(this).getResultType();
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.