⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lispprinter.java

📁 计算机代数系统
💻 JAVA
字号:
package net.sf.yacas;


class LispPrinter 
{
  public void Print(LispPtr aExpression, LispOutput aOutput, LispEnvironment aEnvironment) throws Exception
  {
    PrintExpression(aExpression, aOutput, aEnvironment,0);
  }
  public void RememberLastChar(char aChar)
  {
  }

   void PrintExpression(LispPtr aExpression, LispOutput aOutput, 
   	                 LispEnvironment aEnvironment,int aDepth /* =0 */) throws Exception
   {
    LispPtr iter = new LispPtr();
    iter.Set(aExpression.Get()); 
    int item = 0;
    while (iter.Get() != null) 
    {
        // if String not null pointer: print string
        String string = iter.Get().String();

        if (string != null)
        {
            aOutput.Write(string);
            aOutput.PutChar(' ');
        }
        // else print "(", print sublist, and print ")"
        else if (iter.Get().SubList() != null) 
        {
	    if (item != 0)
	    {
	      Indent(aOutput,aDepth+1);
	    }
            aOutput.Write("(");
            PrintExpression((iter.Get().SubList()),aOutput, aEnvironment,aDepth+1); 
            aOutput.Write(")");
	    item=0;
        }
        else
        {
            aOutput.Write("[GenericObject]");
        }
        iter = (iter.Get().Next()); 
	item++;
    } // print next element
   }

   void Indent(LispOutput aOutput, int aDepth) throws Exception
   {
	  aOutput.Write("\n");
	  int i;
	  for (i=aDepth;i>0;i--)
	  {
		aOutput.Write("  ");
	  }
   }
};


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -