Examples of OObject


Examples of jscicalc.OObject

   *   If expressionList is now empty, replace with Complex only.
   */
  Sum sum = clone();
  System.out.println( "Clone complete: FIXME" );
  // Product was not already in sum
  OObject o = x.unBox();
  if( o instanceof Complex )
      sum.complex = sum.complex.add( (Complex)o );
  else if( o instanceof Expression )
      sum.expressionList.add( (Expression)o );
  else
View Full Code Here

Examples of jscicalc.OObject

     */
    public OObject add( Sum x ){
  Sum s = clone();
  // Add complex
  s.complex = s.complex.add( x.complex );
  OObject sum = (OObject)s;
  for( java.util.ListIterator<Expression> i = x.expressionList.listIterator();
       i.hasNext(); ){
      sum = sum.add( i.next() );
  }
  return sum;
    }
View Full Code Here

Examples of jscicalc.OObject

     */
    private OObject rMultiply( OObject o ){
  if( !((o instanceof Complex) || (o instanceof Expression)) )
      return new jscicalc.Error( "Error in Sum.rMultiply" );
  Sum s = new Sum();
  OObject p = o.multiply( complex );
  if( p instanceof Complex ){
      s.complex = s.complex.add( (Complex)p );
  } else if( p instanceof Expression ){
      s.expressionList.add( (Expression)p );
  } else
View Full Code Here

Examples of jscicalc.OObject

     * @param t Another Sum
     * @result The result of the multiplication
     */
    OObject multiply( Sum t ){
  Sum s = new Sum();
  OObject p = rMultiply( t.complex );
  if( p instanceof Complex ){
      s.complex = s.complex.add( (Complex)p );
  } else if( p instanceof Expression ){
      s.expressionList.add( (Expression)p );
  } else
View Full Code Here

Examples of jscicalc.OObject

     */
    public OObject auto_simplify(){
  // recursively simplify expressions
  for( java.util.ListIterator<Expression> i = expressionList.listIterator();
       i.hasNext(); ){
      OObject o = i.next().auto_simplify();
      if( o instanceof Complex ){
    complex = complex.multiply( (Complex)o );
    i.remove();
      } else if( o instanceof Expression ){
    i.set( (Expression)o );
      } else {
    return new jscicalc.Error( "Product.auto_simplify() error" );
      }
  }
  sort();
  if( expressionList.isEmpty() ) return unBox(); // should be a Complex
  // now work through expressions in sum
  java.util.ListIterator<Expression> i = expressionList.listIterator();
  Expression f = null; // initialise for loop
  for( Expression e = i.next(); i.hasNext(); e = f ){
      Product product_e = null;
      if( e instanceof Product ){
    product_e = (Product)e;
      } else {
    product_e = new Product( e, false );
      }
      f = i.next();
      Product product_f = null;
      if( f instanceof Product ){
    product_f = (Product)f;
      } else {
    product_f = new Product( f, false );
      }     
      if( product_e.compareTo( product_f ) == 0 ){
    System.out.println( "Adding comparable expressions" );
    Product product = new Product( product_e, false ); // start with e.
    product.setComplex( product_e.getComplex()
            .add( product_f.getComplex() ) );
    OObject o = product.unBox();
    if( o instanceof Complex ){
        complex = complex.add( (Complex)o );
        i.remove(); // remove f
        i.previous();
        i.remove(); // remove e
View Full Code Here

Examples of jscicalc.OObject

    public OObject substitute( jscicalc.Substitution substitution ){
  Sum s = clone();
  for( java.util.ListIterator<Expression>
     i = s.expressionList.listIterator(); i.hasNext(); ){
      Expression expression = i.next();
      OObject o = expression.substitute( substitution );
      if( o instanceof Complex ){
    i.remove();
    s.complex = s.complex.add( (Complex)o );
      } else if( o instanceof Expression ) {
    i.set( (Expression)o );
View Full Code Here

Examples of jscicalc.OObject

  final Base b = getBase();
  final Notation n = panel.getApplet().getNotation();
  double factor = 1;
  if( panel.getApplet().getAngleType() == AngleType.DEGREES )
      factor = 1;//180 / StrictMath.PI;
  OObject o = panel.getApplet().getValue();
  if( o != null )
      setExpression( o, m, precision, b, n, factor );
  synchronized( displayCaret ){
      displayCaret.updateFlag = true;
  }
View Full Code Here

Examples of jscicalc.OObject

      if( getApplet().getMode() != 0 ){
    getApplet().setMode( pobject );
    getApplet().requestFocusInWindow();
    return;
      }
      OObject m = getApplet().getMemory();
      getApplet().pushHistory();
      OObject o = getApplet().getValue();
      if( !getApplet().getParser().isEmpty() ){
    //System.out.println( "__________" );
    PObject p = getApplet().getParser().getLast();
    if( !(o instanceof jscicalc.Error) && ( p instanceof RFunction ||
              p instanceof DFunction ||
              p instanceof MFunction ||
              p instanceof AFunction ) ){
        Ans ans = new Ans();
        ans.setValue( o );
        getApplet().insert( ans );
        getApplet().updateDisplay( true, true );
    }
      } else {
    //System.out.println( "**********" );
    Ans ans = new Ans();
    ans.setValue( o );
    getApplet().insert( ans );
    getApplet().updateDisplay( true, true );
      }
      o = getApplet().getParser().evaluate( getApplet().getAngleType() );
      if( !(o instanceof jscicalc.Error) ){
    OObject q =  m.add( o );
    if( !(q instanceof jscicalc.Error) )
        getApplet().setMemory( q );
    getApplet().updateDisplay( false, true );
      }
      getApplet().setShift( false );
View Full Code Here

Examples of jscicalc.OObject

      if( getApplet().getMode() != 0 ){
    getApplet().setMode( pobject );
    getApplet().requestFocusInWindow();
    return;
      }
      OObject o = getApplet().getValue();
      if( !getApplet().getParser().isEmpty() ){
    PObject p = getApplet().getParser().getLast();
    if( !(o instanceof jscicalc.Error) && ( p instanceof RFunction ||
              p instanceof DFunction ||
              p instanceof MFunction ||
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.