Package jscicalc.expression

Examples of jscicalc.expression.Product


      } else if( x instanceof Product ){
    Sum s = new Sum( (Variable)this );
    return s.add( (Product)x );
      } else if( x instanceof Expression ){
    Sum s = new Sum( (Variable)this );
    return s.add( new Product( (Expression)x, false ) );
      }
  } else if( this instanceof Sum ){
      if( x instanceof Complex ){
    return ((Sum)this).add( (Complex)x );
      } else if( x instanceof Variable ){
    Product s = new Product( (Variable)x, false );
    return ((Sum)this).add( s );
      } else if( x instanceof Product ){
    return ((Sum)this).add( (Product)x );
      } else if( x instanceof Sum ){
    return ((Sum)this).add( (Sum)x );
      } else if( x instanceof Expression ){
    return ((Sum)this).add( new Product( (Expression)x, false ) );
      }
  } else if( this instanceof Product ){
      if( x instanceof Complex ){
    Sum s = new Sum( (Product)this );
    return s.add( (Complex)x );
      } else if( x instanceof Variable ){
    Sum s = new Sum( (Product)this );
    Product p = new Product( (Variable)x, false );
    return s.add( p );
      } else if( x instanceof Sum ){
    Sum s = new Sum( (Product)this );
    return s.add( (Sum)x );
      } else if( x instanceof Product ){
    Sum s = new Sum( (Product)this );
    return s.add( (Product)x );
      } else if( x instanceof Expression ){
    Sum s = new Sum( (Product)this );
    return s.add( new Product( (Expression)x, false ) );
      }
  } else if( this instanceof Expression ){
      Sum s = new Sum( new Product( (Expression)this, false ) );
      if( x instanceof Complex ){
    return s.add( (Complex)x );
      } else if( x instanceof Sum ){
    return s.add( (Sum)x );
      } else if( x instanceof Product ){
    return s.add( (Product)x );
      } else if( x instanceof Expression ){
    return s.add( new Product( (Expression)x, false ) );
      }
  }
  // default
  return new Error( "OObject add( x ) error" );
    }
View Full Code Here


      return new Error( "OObject multiply( x ) error" );
  else if( this instanceof Complex ){
      if( x instanceof Complex ){
    return ((Complex)this).multiply( (Complex)x );
      } else if( x instanceof Variable ){
    Product p = new Product( (Variable)x, false );
    return p.multiply( (Complex)this );
      } else if( x instanceof Sum ){
    Product p = new Product( (Expression)x, false );
    return p.multiply( this );
      } else if( x instanceof Product ){
    Product p = (Product)x;
    return p.multiply( (Complex)this );
      } else if( x instanceof Expression ){
    Product p = new Product( (Expression)x, false );
    return p.multiply( (Complex)this );
      }
  } else if( this instanceof Variable ){
      if( x instanceof Complex ){
    Product p = new Product( (Variable)this, false );
    return p.multiply( (Complex)x );
      } else if( x instanceof Variable ){
    Product p = new Product( (Variable)this, false );
    Product q = new Product( (Variable)x, false );
    return p.multiply( q );
      } else if( x instanceof Sum ){
    Product p = new Product( (Variable)this, false );
    return p.multiply( (Expression)this );
      } else if( x instanceof Product ){
    Product p = new Product( (Variable)this, false );
    return p.multiply( (Product)x );
      } else if( x instanceof Expression ){
    Product p = new Product( (Variable)this, false );
    return p.multiply( (Expression)x );
      }
  } else if( this instanceof Sum ){
      if( x instanceof Complex ){
    Product p = new Product( (Expression)this, false );
    return p.multiply( (Complex)x );
      } else if( x instanceof Expression ){
    Product p = new Product( (Expression)x, false );
    return p.multiply( (Expression)this );
      }
  } else if( this instanceof Product ){
      if( x instanceof Complex ){
    Product p = (Product)this;
    return p.multiply( (Complex)x );
      } else if( x instanceof Product ){
    return ((Product)this).multiply( (Product)x );
      } else if( x instanceof Expression ){
    return ((Product)this).multiply( new Product( (Expression)x, false ) );
      }
  } else if( this instanceof Expression ){
      if( x instanceof Complex ){
    Product p = new Product( (Expression)this, false );
    return p.multiply( (Complex)x );
      } else if( x instanceof Product ){
    return (new Product( (Expression)this, false )).multiply( (Product)x );
      } else if( x instanceof Expression ){
    Product p = new Product( (Expression)this, false );
    return p.multiply( (Expression)x );
      }
  }
  return new Error( "OObject multiply( x ) error" );
    }
View Full Code Here

      return new Error( "OObject multiply( x ) error" );
  else if( this instanceof Complex ){
      if( x instanceof Complex ){
    return ((Complex)this).divide( (Complex)x );
      } else if( x instanceof Variable ){
    Product p = new Product( (Variable)x, true );
    return p.multiply( (Complex)this );
      } else if( x instanceof Sum ){
    Product p = new Product( (Expression)x, true );
    return p.multiply( this );
      } else if( x instanceof Product ){
    Product p = new Product( (Expression)x, true );
    return p.multiply( (Complex)this );
      } else if( x instanceof Expression ){
    Product p = new Product( (Expression)x, true );
    return p.multiply( (Complex)this );
      }
  } else if( this instanceof Variable ){
      if( x instanceof Complex ){
    Product p = new Product( (Variable)this, false );
    return p.divide( (Complex)x );
      } else if( x instanceof Variable ){
    Product p = new Product( (Variable)this, false );
    Product q = new Product( (Variable)x, true );
    return p.multiply( q );
      } else if( x instanceof Sum ){
    Product p = new Product( (Variable)this, false );
    Product q = new Product( (Sum)x, true );
    return p.multiply( q );
      } else if( x instanceof Product ){
    Product p = new Product( (Variable)this, false );
    return p.divide( (Product)x );
      } else if( x instanceof Expression ){
    Product p = new Product( (Variable)this, false );
    Product q = new Product( (Expression)x, true );
    return p.multiply( q );
      }
  } else if( this instanceof Sum ){
      if( x instanceof Complex ){
    Product p = new Product( (Expression)this, false );
    return p.multiply( (Complex)x );
      } else if( x instanceof Expression ){
    Product p = new Product( (Expression)x, false );
    Product q = new Product( (Expression)x, true );
    return p.multiply( q );
      }
  } else if( this instanceof Product ){
      if( x instanceof Complex ){
    Product p = (Product)this;
    return p.divide( (Complex)x );
      } else if( x instanceof Product ){
    return ((Product)this).divide( (Product)x );
      } else if( x instanceof Expression ){
    Product q = new Product( (Expression)x, true );
    return ((Product)this).multiply( q );
      }
  } else if( this instanceof Expression ){
      if( x instanceof Complex ){
    Product p = new Product( (Expression)this, false );
    return p.divide( (Complex)x );
      } else if( x instanceof Product ){
    Product p = new Product( (Expression)this, false );
    return p.divide( (Product)x );
      } else if( x instanceof Expression ){
    Product p = new Product( (Expression)this, false );
    Product q = new Product( (Expression)x, true );
    return p.multiply( q );
      }
  }
  return new Error( "OObject divide( x ) error" );
    }
View Full Code Here

      return ((Complex)this).root( (Complex)y );
  } else if( !(this instanceof Error) ){
      if( y instanceof Complex )
    return new jscicalc.expression.Power( this, ((Complex)y).inverse() );
      else if( y instanceof Expression ){
    Product p = new Product( (Expression)y, true ); // inverse
    return new jscicalc.expression.Power( this, p );
      }
  }
  return new Error( "OObject root( y ) error" );
    }
View Full Code Here

TOP

Related Classes of jscicalc.expression.Product

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.