当前位置: 首页>>代码示例>>Java>>正文


Java InPort类代码示例

本文整理汇总了Java中gnu.mapping.InPort的典型用法代码示例。如果您正苦于以下问题:Java InPort类的具体用法?Java InPort怎么用?Java InPort使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InPort类属于gnu.mapping包,在下文中一共展示了InPort类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readChar

import gnu.mapping.InPort; //导入依赖的package包/类
final Object readChar (InPort port)
 {
   try
     {
int ch = peeking ? port.peek() : port.read();
if (ch < 0)
  return Sequence.eofValue;
return Char.make (ch);
     }
   catch (java.io.IOException e)
     {
throw new RuntimeException ("IO Exception caught");
     }
 }
 
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:15,代码来源:readchar.java

示例2: apply1

import gnu.mapping.InPort; //导入依赖的package包/类
public final Object apply1 (Object arg1)
{
  if (arg1 instanceof InPort)
    return readChar ((InPort) arg1);
  if (arg1 instanceof Reader)
    return readChar ((Reader) arg1);
  if (arg1 instanceof InputStream)
    return readChar ((InputStream) arg1);
  throw new WrongType (this, 1, arg1, "<input-port>");
}
 
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:11,代码来源:readchar.java

示例3: apply1

import gnu.mapping.InPort; //导入依赖的package包/类
public final Object apply1 (Object arg1)
   {
IntNum retval = new IntNum();

// When passed an integer N, return an int M s.t. 0 <= M < N.
if (arg1 instanceof IntNum)
    {
	IntNum.divide(IntNum.makeU(Math.abs(prg.nextLong()) >> 1),
		      (IntNum) arg1, null, retval, Numeric.FLOOR);
	return retval;
    }

// InPort, e.g. /dev/random, for initializing generator
if (arg1 instanceof InPort)
    try
	{
	    InPort i = (InPort)arg1;
	    prg.setSeed((long)
			i.read()
			+ i.read() << 8
			+ i.read() << 16
			+ i.read() << 24);
	    i.close();
	    return retval;
	}
    catch (java.io.IOException e)
	{
	    throw new GenericError ("I/O exception in brl-random: "
				    + e.toString ());
	}
throw new WrongType (this, 1, arg1, "real");
   }
 
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:33,代码来源:random.java

示例4: readVector

import gnu.mapping.InPort; //导入依赖的package包/类
public static FVector readVector(LispReader lexer, LineBufferedReader port, int count, char close, int sharingIndex)
   throws java.io.IOException, SyntaxException
 {
   char saveReadState = ' ';
   if (port instanceof InPort)
     {	
saveReadState = ((InPort) port).readState;
((InPort) port).readState = close == ']' ? '[' : '(';
     }
   int startLine = port.getLineNumber();
   int startColumn = port.getColumnNumber()-1;
    try
      {
        ConstVector result = new ConstVector();
        lexer.bindSharedObject(sharingIndex, result);

        ReadTable rtable = ReadTable.getCurrent();
        Pair head = new Pair(null, LList.Empty);
        Pair last = head;
 for (;;)
   {
     int ch = lexer.read();
     if (ch < 0)
       lexer.eofError("unexpected EOF in vector starting here",
		      startLine + 1, startColumn);
     if (ch == close)
       break;
            last = lexer.readValuesAndAppend(ch, rtable, last);
   }
        result.setDataBackDoor(((LList) head.getCdr()).toArray());
 return result;

      }
    finally
      {
 if (port instanceof InPort)
   ((InPort) port).readState = saveReadState;
      }
 }
 
开发者ID:alain91,项目名称:kawa,代码行数:40,代码来源:ReaderVector.java

示例5: BiggerFuture

import gnu.mapping.InPort; //导入依赖的package包/类
public BiggerFuture(Procedure action,
                    InPort in, OutPort out, OutPort err, String threadName, long stackSize) {
  super(new ThreadGroup("biggerthreads"),
        new RunnableClosure (action, in, out, err),
        threadName, stackSize);
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:7,代码来源:BiggerFuture.java

示例6: apply0

import gnu.mapping.InPort; //导入依赖的package包/类
public final Object apply0 ()
{
  return readChar (InPort.inDefault());
}
 
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:5,代码来源:readchar.java

示例7: readVector

import gnu.mapping.InPort; //导入依赖的package包/类
public static FVector readVector(LispReader lexer, LineBufferedReader port, int count, char close)
   throws java.io.IOException, SyntaxException
 {
   char saveReadState = ' ';
   if (port instanceof InPort)
     {	
saveReadState = ((InPort) port).readState;
((InPort) port).readState = close == ']' ? '[' : '(';
     }
    try
      {
 java.util.Vector vec = new java.util.Vector();
        ReadTable rtable = ReadTable.getCurrent();
 for (;;)
   {
     int ch = lexer.read();
     if (ch < 0)
       lexer.eofError("unexpected EOF in vector");
     if (ch == close)
       break;
     Object value = lexer.readValues(ch, rtable);
     if (value instanceof Values)
       {
	 Object[] values = ((Values) value).getValues();
	 int n = values.length;
	 for (int i = 0;  i < n;  i++)
	   vec.addElement(values[i]);
       }
     else
       {
	 if (value == gnu.expr.QuoteExp.voidExp)
	   value = Values.empty;
	 vec.addElement(value);
       }
   }
 Object[] objs = new Object[vec.size()];
 vec.copyInto(objs);
 return new FVector(objs);
      }
    finally
      {
 if (port instanceof InPort)
   ((InPort) port).readState = saveReadState;
      }
 }
 
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:46,代码来源:ReaderVector.java

示例8: read

import gnu.mapping.InPort; //导入依赖的package包/类
public Object read (Lexer in, int ch, int count)
   throws java.io.IOException, SyntaxException
 {
   int startPos = in.tokenBufferLength;
   LineBufferedReader port = in.getPort();
   ReadTable rtable = ReadTable.getCurrent();
   char saveReadState = '\0';
   in.tokenBufferAppend(ch);
   int c = ch;
   int prev;
   if (port instanceof InPort)
     {
saveReadState = ((InPort) port).readState;
((InPort) port).readState = (char) ch;
     }
   try
     {
boolean got_open_square = false;
for (;;)
  {
    int next;

    prev = c;

    if (port.pos < port.limit && prev != '\n')
      c = port.buffer[port.pos++];
    else
      c = port.read();
    if (c == '\\')
      {
	if (in instanceof LispReader)
	  c = ((LispReader) in).readEscape();
	else
	  c = port.read();
      }
    else
      {
	if ( (!got_open_square && c == '['
	      && true == (got_open_square = true))
	     || (got_open_square && c == ']'
		 && false == (got_open_square = false))
	     || rtable.lookup(c).getKind() == ReadTable.CONSTITUENT)
	  {
	      in.tokenBufferAppend(c);
	      continue;
	  }
	else
	  {
	    in.unread(c);
	    break;
	  }
      }
    }
return (new java.lang.String (in.tokenBuffer, startPos,
			      in.tokenBufferLength - startPos)).intern();
     }
   finally
     {
in.tokenBufferLength = startPos;
if (port instanceof InPort)
  ((InPort) port).readState = saveReadState;
     }
 }
 
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:64,代码来源:ReaderTypespec.java

示例9: getRequestPort

import gnu.mapping.InPort; //导入依赖的package包/类
public InPort getRequestPort()
{
  return new InPort(getRequestStream());
}
 
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:5,代码来源:HttpRequestContext.java

示例10: openReader

import gnu.mapping.InPort; //导入依赖的package包/类
/**
 * @see gnu.jemacs.buffer.Buffer#openReader(int, int)
 */
public InPort openReader(int start, int count)
{
  return new InPort(new BufferContentReader(bufferContent, start, count));
}
 
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:8,代码来源:SwtBuffer.java

示例11: apply0

import gnu.mapping.InPort; //导入依赖的package包/类
public final Object apply0() {
    return readChar (InPort.inDefault());
}
 
开发者ID:alain91,项目名称:kawa,代码行数:4,代码来源:readchar.java

示例12: read

import gnu.mapping.InPort; //导入依赖的package包/类
public Object read (Lexer in, int ch, int count)
   throws java.io.IOException, SyntaxException
 {
   int startPos = in.tokenBufferLength;
   LineBufferedReader port = in.getPort();
   ReadTable rtable = ReadTable.getCurrent();
   char saveReadState = '\0';
   in.tokenBufferAppend(ch);
   int c = ch;
   int prev;
   if (port instanceof InPort)
     {
saveReadState = ((InPort) port).readState;
((InPort) port).readState = (char) ch;
     }
   try
     {
boolean got_open_square = false;
for (;;)
  {
    int next;

    prev = c;

    if (port.pos < port.limit && prev != '\n')
      c = port.buffer[port.pos++];
    else
      c = port.read();
    if (c == '\\')
      {
	if (in instanceof LispReader)
	  c = ((LispReader) in).readEscape();
	else
	  c = port.read();
      }
    else
      {
	if ( (!got_open_square && c == '['
	      && true == (got_open_square = true))
	     || (got_open_square && c == ']'
		 && false == (got_open_square = false))
	     || rtable.lookup(c).getKind() == ReadTable.CONSTITUENT)
	  {
	      in.tokenBufferAppend(c);
	      continue;
	  }
	else
	  {
	    in.unread(c);
	    break;
	  }
      }
    }
return rtable.makeSymbol(new java.lang.String(in.tokenBuffer, startPos,
                                                     in.tokenBufferLength - startPos));
     }
   finally
     {
in.tokenBufferLength = startPos;
if (port instanceof InPort)
  ((InPort) port).readState = saveReadState;
     }
 }
 
开发者ID:alain91,项目名称:kawa,代码行数:64,代码来源:ReaderTypespec.java


注:本文中的gnu.mapping.InPort类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。