Package nexj.core.meta

Examples of nexj.core.meta.BinaryFunction


      Type type = first.getType();

      if (type.isPrimitive())
      {
         Primitive primitiveType = (Primitive)type;
         BinaryFunction f = primitiveType.getEQFunction(primitiveType);

         for (int i = 1; i < m_nOperandCount; ++i)
         {
            if (((Boolean)f.invoke(firstValue, m_operandArray[i].getValue())).booleanValue())
            {
               return Boolean.TRUE;
            }
         }
View Full Code Here


            if (left != null)
            {
               Primitive leftType = Primitive.primitiveOf(left);
               Primitive rightType, resultType;
               BinaryFunction fun;
               Object right;

               for (int i = 1; i < nArgCount; ++i)
               {
                  right = machine.getArg(i, nArgCount);

                  if (right == null)
                  {
                     left = null;

                     break;
                  }

                  rightType = Primitive.primitiveOf(right);
                  resultType = getCoercedType(leftType, rightType);

                  if (leftType != resultType)
                  {
                     left = resultType.getConverter(leftType).invoke(left);
                     leftType = resultType;
                  }

                  if (rightType != resultType)
                  {
                     right = resultType.getConverter(rightType).invoke(right);
                  }

                  if ((fun = m_functionArray[resultType.getOrdinal()]) == null)
                  {
                     throw new TypeMismatchException(getSymbol());
                  }

                  left = fun.invoke(left, right);
               }
            }

            machine.returnValue(left, nArgCount);
         }
View Full Code Here

         Object left = machine.getArg(0, nArgCount);

         Primitive leftType = Primitive.primitiveOf(left);
         Primitive rightType, coercedType = null;
         BinaryFunction fun;
         Object right;

         for (int i = 1; i < nArgCount; ++i)
         {
            right = machine.getArg(i, nArgCount);
            rightType = Primitive.primitiveOf(right);

            if (leftType == null)
            {
               if (rightType != null)
               {
                  coercedType = rightType;
               }
            }
            else if (rightType == null)
            {
               coercedType = leftType;
            }
            else
            {
               coercedType = getCoercedType(leftType, rightType);
            }

            if (coercedType != null)
            {
               if (leftType != coercedType)
               {
                  left = coercedType.getConverter(leftType).invoke(left);
                  leftType = coercedType;
               }

               if (rightType != coercedType)
               {
                  right = coercedType.getConverter(rightType).invoke(right);
               }

               if ((fun = m_functionArray[coercedType.getOrdinal()]) == null)
               {
                  throw new TypeMismatchException(getSymbol());
               }

               if (fun.invoke(left, right) == m_stopResult)
               {
                  machine.returnValue(m_stopResult, nArgCount);

                  return false;
               }
View Full Code Here

         verifyMinArgCount(nArgCount, 1);

         Object left = machine.getArg(0, nArgCount);
         Primitive leftType = Primitive.primitiveOf(left);
         Primitive rightType, coercedType = null;
         BinaryFunction fun;
         Object right;

         for (int i = 1; i < nArgCount; ++i)
         {
            right = machine.getArg(i, nArgCount);
            rightType = Primitive.primitiveOf(right);

            if (leftType == null)
            {
               if (rightType != null)
               {
                  coercedType = rightType;
               }
            }
            else if (rightType == null)
            {
               coercedType = leftType;
            }
            else
            {
               coercedType = getCoercedType(leftType, rightType);
            }

            if (coercedType != null)
            {
               if (leftType != coercedType)
               {
                  left = coercedType.getConverter(leftType).invoke(left);
                  leftType = coercedType;
               }

               if (rightType != coercedType)
               {
                  right = coercedType.getConverter(rightType).invoke(right);
               }

               if ((fun = m_functionArray[coercedType.getOrdinal()]) == null)
               {
                  throw new TypeMismatchException(getSymbol());
               }

               if (fun.invoke(left, right) == Boolean.TRUE)
               {
                  left = right;
               }
            }
            else
View Full Code Here

TOP

Related Classes of nexj.core.meta.BinaryFunction

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.