Examples of Scanner


Examples of java_cup_11a.runtime.Scanner

      L.alloy_filename = filename;
      L.alloy_lineoffset = lineOffset;
      L.alloy_seenDollar = seenDollar;
      // Replace "ID : RUN/CHECK ID"   with "RUN/CHECK ID ID"
      // Replace "ID : RUN/CHECK {"    WITH "RUN/CHECK ID  {"
      final Scanner A = new Scanner() {
         private Symbol a, b, c, d;
         public final Symbol next_token() throws Exception {
            if (a==null) a=L.next_token(); if (a.sym==EOF) { b=a; c=a; d=a; }
            if (b==null) b=L.next_token(); if (b.sym==EOF) { c=b; d=b; }
            if (c==null) c=L.next_token(); if (c.sym==EOF) { d=c; }
            if (d==null) d=L.next_token();
            if (a.sym==ID && b.sym==COLON && (c.sym==RUN || c.sym==CHECK) && (d.sym==ID || d.sym==LBRACE)) {
               Symbol x=c; b=d; c=null; d=null; return x;
            }
            Symbol x=a; a=b; b=c; c=d; d=null; return x;
         }
      };
      // Merges   "pred" "/" "xxx"       into the actual symbol
      // Merges   "fun" "/" "xxx"        into the actual symbol
      // Merges   ! { in = < <= > >= }   into a single symbol
      // Merges   {..}=>{..}             into a single symbol
      final Scanner B = new Scanner() {
         private Symbol undo;
         public final Symbol next_token() throws Exception {
            Symbol x = undo;
            undo = null;
            if (x==null) x = A.next_token();
            if (x.sym==NOT) {
               Symbol y = A.next_token();
               if (y.sym==IN)     return merge(x, y, NOTIN);
               if (y.sym==EQUALS) return merge(x, y, NOTEQUALS);
               if (y.sym==LT)     return merge(x, y, NOTLT);
               if (y.sym==LTE)    return merge(x, y, NOTLTE);
               if (y.sym==GT)     return merge(x, y, NOTGT);
               if (y.sym==GTE)    return merge(x, y, NOTGTE);
               undo = y;
            } else if (x.sym==PRED) {
               Symbol y = A.next_token();
               if (y.sym!=SLASH) { undo=y; return x; }
               Symbol z = A.next_token();
               if (z.sym==ID && ((ExprVar)(z.value)).label.equals("totalOrder")) return merge(x, z, TOTALORDER);
               undo = z;
            } else if (x.sym==FUN) {
               Symbol y = A.next_token();
               if (y.sym!=SLASH) { undo=y; return x; }
               Symbol z = A.next_token();
               if (z.sym==ID && ((ExprVar)(z.value)).label.equals("add"))   return merge(x, z, INTADD);
               if (z.sym==ID && ((ExprVar)(z.value)).label.equals("sub"))   return merge(x, z, INTSUB);
               if (z.sym==ID && ((ExprVar)(z.value)).label.equals("mul"))   return merge(x, z, INTMUL);
               if (z.sym==ID && ((ExprVar)(z.value)).label.equals("div"))   return merge(x, z, INTDIV);
               if (z.sym==ID && ((ExprVar)(z.value)).label.equals("rem"))   return merge(x, z, INTREM);
               if (z.sym==ID && ((ExprVar)(z.value)).label.equals("min"))   return merge(x, z, INTMIN);
               if (z.sym==ID && ((ExprVar)(z.value)).label.equals("max"))   return merge(x, z, INTMAX);
               if (z.sym==ID && ((ExprVar)(z.value)).label.equals("next"))  return merge(x, z, INTNEXT);
            } else if (x.sym==ONE) {
               Symbol y = A.next_token();
               if (y.sym!=ARROW) { undo=y; return x; }
               Symbol z = A.next_token();
               if (z.sym==ONEreturn merge(x, z, ONE_ARROW_ONE);
               if (z.sym==LONE) return merge(x, z, ONE_ARROW_LONE);
               if (z.sym==SOME) return merge(x, z, ONE_ARROW_SOME);
               if (z.sym==SETreturn merge(x, z, ONE_ARROW_ANY); else { undo=z; return merge(x, y, ONE_ARROW_ANY); }
            } else if (x.sym==LONE) {
               Symbol y = A.next_token();
               if (y.sym!=ARROW) { undo=y; return x; }
               Symbol z = A.next_token();
               if (z.sym==ONEreturn merge(x, z, LONE_ARROW_ONE);
               if (z.sym==LONE) return merge(x, z, LONE_ARROW_LONE);
               if (z.sym==SOME) return merge(x, z, LONE_ARROW_SOME);
               if (z.sym==SETreturn merge(x, z, LONE_ARROW_ANY); else { undo=z; return merge(x, y, LONE_ARROW_ANY); }
            } else if (x.sym==SOME) {
               Symbol y = A.next_token();
               if (y.sym!=ARROW) { undo=y; return x; }
               Symbol z = A.next_token();
               if (z.sym==ONEreturn merge(x, z, SOME_ARROW_ONE);
               if (z.sym==LONE) return merge(x, z, SOME_ARROW_LONE);
               if (z.sym==SOME) return merge(x, z, SOME_ARROW_SOME);
               if (z.sym==SETreturn merge(x, z, SOME_ARROW_ANY); else { undo=z; return merge(x, y, SOME_ARROW_ANY); }
            } else if (x.sym==SET) {
               Symbol y = A.next_token();
               if (y.sym!=ARROW) { undo=y; return x; }
               Symbol z = A.next_token();
               if (z.sym==ONEreturn merge(x, z, ANY_ARROW_ONE);
               if (z.sym==LONE) return merge(x, z, ANY_ARROW_LONE);
               if (z.sym==SOME) return merge(x, z, ANY_ARROW_SOME);
               if (z.sym==SETreturn merge(x, z, ARROW); else { undo=z; return merge(x, y, ARROW); }
            } else if (x.sym==ARROW) {
               Symbol z = A.next_token();
               if (z.sym==ONEreturn merge(x, z, ANY_ARROW_ONE);
               if (z.sym==LONE) return merge(x, z, ANY_ARROW_LONE);
               if (z.sym==SOME) return merge(x, z, ANY_ARROW_SOME);
               if (z.sym==SETreturn merge(x, z, ARROW); else { undo=z; }
            }
            return x;
         }
      };
      // Merge "- number" into "-number" whenever it is not immediately following ")" "]" "}" DISJ TOTALORDER INT SUM ID NUMBER STR IDEN THIS INTMIN INTMAX INTNEXT UNIV SIGINT NONE
      final Scanner C = new Scanner() {
         private Symbol last, undo;
         public final Symbol next_token() throws Exception {
            Symbol x = undo;
            undo = null;
            if (x==null) x = B.next_token();
View Full Code Here

Examples of net.janino.Scanner

  // require Janino from http://www.janino.net
  private static class JaninoCompiller implements Compiller {

    public byte[] compile( String name, String source) throws Exception {
      // using janino embeddable compiller
      Parser p = new Parser( new Scanner( name, new StringReader( source)));
      CompilationUnit cu = p.parseCompilationUnit();
      IClassLoader cl = new ClassLoaderIClassLoader( new URLClassLoader( new URL[] {}));
      return cu.compile( cl, 0)[0].toByteArray();
    }
View Full Code Here

Examples of net.yacy.cora.protocol.Scanner

                    if (host.startsWith("smb://")) host = host.substring(6);
                    int p = host.indexOf('/');
                    if (p >= 0) host = host.substring(0, p);
                    ia.add(Domains.dnsResolve(host));
                }
                final Scanner scanner = new Scanner(ia, CONCURRENT_RUNNER, timeout);
                if (post.get("scanftp", "").equals("on")) scanner.addFTP(bigrange);
                if (post.get("scanhttp", "").equals("on")) scanner.addHTTP(bigrange);
                if (post.get("scanhttps", "").equals("on")) scanner.addHTTPS(bigrange);
                if (post.get("scansmb", "").equals("on")) scanner.addSMB(bigrange);
                scanner.start();
                scanner.terminate();
                if ("on".equals(post.get("accumulatescancache", "")) && !"scheduler".equals(post.get("rescan", ""))) {
                    Scanner.scancacheExtend(scanner, validTime);
                } else {
                    Scanner.scancacheReplace(scanner, validTime);
                }
            }
           
            if (post.containsKey("scan") && "intranet".equals(post.get("source", ""))) {
                final Scanner scanner = new Scanner(Domains.myIntranetIPs(), CONCURRENT_RUNNER, timeout);
                if ("on".equals(post.get("scanftp", ""))) scanner.addFTP(bigrange);
                if ("on".equals(post.get("scanhttp", ""))) scanner.addHTTP(bigrange);
                if ("on".equals(post.get("scanhttps", ""))) scanner.addHTTPS(bigrange);
                if ("on".equals(post.get("scansmb", ""))) scanner.addSMB(bigrange);
                scanner.start();
                scanner.terminate();
                if ("on".equals(post.get("accumulatescancache", "")) && !"scheduler".equals(post.get("rescan", ""))) {
                    Scanner.scancacheExtend(scanner, validTime);
                } else {
                    Scanner.scancacheReplace(scanner, validTime);
                }
View Full Code Here

Examples of org.apache.accumulo.core.client.Scanner

      if (opts != null && opts.isSetAuthorizations()) {
        auth = getAuthorizations(opts.authorizations);
      } else {
        auth = connector.securityOperations().getUserAuthorizations(connector.whoami());
      }
      Scanner scanner = connector.createScanner(tableName, auth);
     
      if (opts != null) {
        if (opts.iterators != null) {
          for (org.apache.accumulo.proxy.thrift.IteratorSetting iter : opts.iterators) {
            IteratorSetting is = new IteratorSetting(iter.getPriority(), iter.getName(), iter.getIteratorClass(), iter.getProperties());
            scanner.addScanIterator(is);
          }
        }
        org.apache.accumulo.proxy.thrift.Range prange = opts.range;
        if (prange != null) {
          Range range = new Range(Util.fromThrift(prange.getStart()), prange.startInclusive, Util.fromThrift(prange.getStop()), prange.stopInclusive);
          scanner.setRange(range);
        }
        if (opts.columns != null) {
          for (ScanColumn col : opts.columns) {
            if (col.isSetColQualifier())
              scanner.fetchColumn(ByteBufferUtil.toText(col.colFamily), ByteBufferUtil.toText(col.colQualifier));
            else
              scanner.fetchColumnFamily(ByteBufferUtil.toText(col.colFamily));
          }
        }
      }
     
      UUID uuid = UUID.randomUUID();
     
      ScannerPlusIterator spi = new ScannerPlusIterator();
      spi.scanner = scanner;
      spi.iterator = scanner.iterator();
      scannerCache.put(uuid, spi);
      return uuid.toString();
    } catch (Exception e) {
      handleExceptionTNF(e);
      return null;
View Full Code Here

Examples of org.apache.accumulo.tserver.Tablet.Scanner

        else
          range = Range.exact(new Text(scm.getRow()), new Text(tc.getCf()), new Text(tc.getCq()), new Text(tc.getCv()));

        IterConfig ic = compressedIters.decompress(tc.iterators);

        Scanner scanner = tablet.createScanner(range, 1, emptyCols, cs.auths, ic.ssiList, ic.ssio, false, cs.interruptFlag);

        try {
          ScanBatch batch = scanner.read();

          Value val = null;

          for (KVEntry entry2 : batch.results) {
            val = entry2.getValue();
View Full Code Here

Examples of org.apache.cassandra.db.Scanner

        System.out.println("Read done ...");
    }
   
    private static void doScannerTest() throws Throwable
    {
        Scanner scanner = new Scanner("Mailbox");
        scanner.fetch(Integer.toString(105), "MailboxMailList0");
       
        while ( scanner.hasNext() )
        {
            System.out.println(scanner.next().name());
        }            
    }
View Full Code Here

Examples of org.apache.hadoop.gateway.shell.hbase.table.scanner.Scanner

  public Row row() {
    return row( null );
  }

  public Scanner scanner( String id ) {
    return new Scanner( id ).table( this );
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.Scanner

  }

  private void scanTable(boolean printResults)
  throws IOException {
    HTable table = new HTable(conf, TABLE_NAME);
    Scanner scanner = table.getScanner(columns,
        HConstants.EMPTY_START_ROW);
    try {
      for (RowResult r : scanner) {
        if (printResults) {
          LOG.info("row: " + r.getRow());
        }
        for (Map.Entry<byte [], Cell> e : r.entrySet()) {
          if (printResults) {
            LOG.info(" column: " + e.getKey() + " value: "
                + new String(e.getValue().getValue(), HConstants.UTF8_ENCODING));
          }
        }
      }
    } finally {
      scanner.close();
    }
  }
View Full Code Here

Examples of org.apache.hadoop.io.file.tfile.TFile.Reader.Scanner

        new Reader(fs.open(path), fs.getFileStatus(path).getLen(), conf);
    Assert.assertFalse(reader.isSorted());
    Assert.assertEquals((int) reader.getEntryCount(), 4);

    try {
      Scanner scanner =
          reader.createScannerByKey("aaa".getBytes(), "zzz".getBytes());
      Assert
          .fail("Failed to catch creating scanner with keys on unsorted file.");
    }
    catch (RuntimeException e) {
View Full Code Here

Examples of org.apache.hadoop.zebra.tfile.TFile.Reader.Scanner

        new Reader(fs.open(path), fs.getFileStatus(path).getLen(), conf);
    long offset = 0;
    long rowCount = 0;
    BytesWritable key, value;
    for (int i = 0; i < numSplit; ++i, offset += splitSize) {
      Scanner scanner = reader.createScannerByByteRange(offset, splitSize);
      int count = 0;
      key = new BytesWritable();
      value = new BytesWritable();
      while (!scanner.atEnd()) {
        scanner.entry().get(key, value);
        ++count;
        scanner.advance();
      }
      scanner.close();
      Assert.assertTrue(count > 0);
      rowCount += count;
    }
    Assert.assertEquals(rowCount, reader.getEntryCount());
    reader.close();
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.