Examples of INode


Examples of lupos.rif.generated.syntaxtree.INode

public class ChildrenSyntaxTreeVisitor implements IRetArguVisitor<List<INode>, Object> {

  private List<INode> list(INode... nodes) {
    List<INode> ret = new ArrayList<INode>();
    for (int i = 0; i < nodes.length; i++) {
      INode node = nodes[i];
      if (node instanceof INodeList)
        ret.addAll(list(node.accept(this, null).toArray(new INode[] {})));
      else if (node instanceof NodeOptional)
        ret.addAll(list(node.accept(this, null).toArray(new INode[] {})));
      else if (node instanceof NodeChoice)
        ret.addAll(list(((NodeChoice) node).choice));
      else if (node != null)
        ret.add(node);
    }
View Full Code Here

Examples of org.aisearch.data.INode

    for (MetaArtefactOperation nextOperation : availableOperations) {
      if (nextOperation.equals(operation))
        continue;
      if (!nextOperation.getSourceType().equals(targetType))
        continue;
      INode node = new Node(nextOperation, availableOperations);
      edges.add(new Edge(node, 1));
    }
    return edges;
  }
View Full Code Here

Examples of org.apache.axiom.om.impl.common.INode

                builder.debugDiscarded(container);
            }
            throw new NodeUnavailableException();
        }
        if (cache) {
            INode child = (INode)container.getFirstOMChild();
            while (child != null) {
                child.internalSerialize(this, format, true);
                child = (INode)child.getNextOMSibling();
            }
        } else {
            // First, recursively serialize all child nodes that have already been created
            INode child = (INode)container.getFirstOMChildIfAvailable();
            while (child != null) {
                child.internalSerialize(this, format, cache);
                child = (INode)child.getNextOMSiblingIfAvailable();
            }
            // Next, if the container is incomplete, disable caching (temporarily)
            // and serialize the nodes that have not been built yet by copying the
            // events from the underlying XMLStreamReader.
            if (!container.isComplete() && container.getBuilder() != null) {
View Full Code Here

Examples of org.apache.hadoop.dfs.FSDirectory.INode

        for (int i = 0; i < nrBlocks; i++)
          root.getBlocks()[i].write(out);
      }
    }
    for(Iterator it = root.getChildren().values().iterator(); it.hasNext(); ) {
      INode child = (INode) it.next();
      saveImage( fullName, child, out );
    }
  }
View Full Code Here

Examples of org.apache.hadoop.fs.s3.INode

    // TODO: Use passed in Progressable to report progress.
    nextBlockOutputStream();
    store.storeBlock(nextBlock, backupFile);
    Block[] arr = new Block[blocks.size()];
    arr = blocks.toArray(arr);
    store.storeINode(path, new INode(INode.FILE_TYPES[1], arr));

    //
    // Delete local backup, start new one
    //
    boolean b = backupFile.delete();
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INode

      IOUtils.cleanup(null, fin);
    }
  }

  private void list(String parent, long dirId) {
    INode inode = inodes.get(dirId);
    if (LOG.isTraceEnabled()) {
      LOG.trace("Listing directory id " + dirId + " parent '" + parent
          + "' (INode is " + inode + ")");
    }
    listINode(parent.isEmpty() ? "/" : parent, inode);
    long[] children = dirmap.get(dirId);
    if (children == null) {
      return;
    }
    String newParent = parent + inode.getName().toStringUtf8() + "/";
    for (long cid : children) {
      list(newParent, cid);
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.INode

    final Path xyz = new Path(xyzStr);
    hdfs.mkdirs(xyz, new FsPermission((short)0777));
    final Path bar = new Path(xyz, "bar");
    hdfs.rename(foo, bar);
   
    final INode fooRef = fsdir.getINode(
        SnapshotTestHelper.getSnapshotPath(abc, "s0", "foo").toString());
    Assert.assertTrue(fooRef.isReference());
    Assert.assertTrue(fooRef.asReference() instanceof INodeReference.WithName);

    final INodeReference.WithCount withCount
        = (INodeReference.WithCount)fooRef.asReference().getReferredINode();
    Assert.assertEquals(2, withCount.getReferenceCount());

    final INode barRef = fsdir.getINode(bar.toString());
    Assert.assertTrue(barRef.isReference());

    Assert.assertSame(withCount, barRef.asReference().getReferredINode());
   
    hdfs.delete(bar, false);
    Assert.assertEquals(1, withCount.getReferenceCount());
  }
View Full Code Here

Examples of org.cspoker.ai.bots.bot.gametree.mcts.nodes.INode

public abstract class MaxFunctionSelector implements SelectionStrategy {

  @Override
  public INode select(InnerNode innerNode) {
    ImmutableList<INode> children = innerNode.getChildren();
    INode maxNode = null;
    double maxValue = Double.NEGATIVE_INFINITY;
    for (INode node : children) {
      double value = evaluate(node);
      if(value>maxValue){
        maxValue = value;
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.INode

          IConstructor attributeConstructor = (IConstructor)attributeValue;

          if (attributeConstructor.getName().equals("tag")) {
       
            for (IValue childValue : attributeConstructor.getChildren()) {
              INode childNode = (INode)childValue;

              // non-empty breakable tag?
              if (childNode.getName().equals("breakable")
                  && childNode.getChildren().iterator().hasNext()) {

                String c = ((IString)childNode.get(0)).getValue();
                String s = c.substring(1,c.length()-1);
                result = s.split(",");
              }
            }
          }
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.INode

    return null;
  }

  @SuppressWarnings("unused")
  private IValue buildTerm(IMap t, Type type) {
    INode result;
    IValue key = t.get(nameKey);
    if (debug && key != null)
      System.err.println("builterm key=" + key);
    if (key == null) {
      if (type.isMap() || t.getType().isMap())
        return _buildTerm(t, type);
      else
        return t;
    }
    /* Abstract Data Type */
    final String funname = ((IString) key).getValue();
    if (debug && key != null)
      System.err.println("builterm funname=" + funname);
    IList rs = vf.list(tf.valueType());
    final Iterator<IValue> args = ((IList) t.get(argKey)).iterator();
    while (args.hasNext()) {
      IValue arg = (IValue) args.next();
      arg = buildTerm(arg, type);
      rs = rs.append(arg);
    }
    IValue[] a = new IValue[rs.length()];
    Type[] b = new Type[rs.length()];
    {
      int i = 0;
      for (IValue c : rs) {
        a[i] = c;
        b[i] = c.getType();
        i++;
      }
    }
    HashMap<String, IValue> map = new HashMap<String, IValue>();
    IMap annoMap = (IMap) t.get(annoKey);
    if (annoMap != null) {
      Iterator<IValue> iterator = annoMap.iterator();
      while (iterator.hasNext()) {
        IValue k = iterator.next();
        String ky = ((IString) k).getValue();
        IValue v = annoMap.get(k);
        map.put(ky, v);
      }
    }
   
    // keyword parameters
   
    HashMap<String, IValue> kwmap = new HashMap<String, IValue>();
   
    Iterator<IValue> iterator = t.iterator();
    while (iterator.hasNext()) {
      IValue k = iterator.next();
      String ky = ((IString) k).getValue();

      if(!(k.equals(nameKey) || k.equals(argKey) || k.equals(annoKey))){
        IValue v = t.get(k);
        kwmap.put(ky, v);
      }
    }
   
    if (funname.equals("#rat")) {
      int dn = ((IInteger) a[0]).intValue(), nm = ((IInteger) a[1])
          .intValue();
      return vf.rational(dn, nm);
    }
    if (funname.equals("#tuple")) {
      return vf.tuple(a);
    }
    if (funname.equals("#loc")) {
      try {
        final URI uri = URIUtil.createFromEncoded(((IString) a[0]).getValue());
        return vf.sourceLocation(uri);
      } catch (URISyntaxException e) {
        e.printStackTrace();
      }
    }
    if (funname.equals("#set")) {
      return a.length == 0 ? vf.set(tf.valueType()) : vf.set(a);
    }
    if (funname.equals("#map")) {
      IMapWriter w = vf.mapWriter();
      for (int i = 0; i < a.length; i++) {
        w.put(((ITuple) a[i]).get(0), ((ITuple) a[i]).get(1));
      }
      return w.done();
    }
    if (funname.equals("#datetime"))
      return dateTime(((IString) a[0]).getValue());

    Type computed = tf.tupleType(b);
    if (debug)
      System.err.println("lookupFirstConstructor:" + funname + " "
          + computed + " " + type);
    Type found = null;
    if (type.isAbstractData())
      found = ts.lookupConstructor(type, funname, computed);
    if (found == null)
      found = ts.lookupFirstConstructor(funname, computed);
    ArrayList<IValue[]> r = new ArrayList<IValue[]>();
    ArrayList<Type> f = new ArrayList<Type>();
    if (found == null) {
      Set<Type> nodes = ts.lookupConstructors(funname);
      if (debug)
        System.err.println("Number of nodes found:" + nodes.size());
      Iterator<Type> it = nodes.iterator();
      while (it.hasNext()) {
        found = it.next();
        IValue[] v = matched(found, a);
        if (v == null)
          break;
        r.add(v);
        f.add(found);
      }
      if (r.size() != 1)
        found = null;
      else {
        found = f.get(0);
        a = r.get(0);
      }
    }
    if (debug)
      System.err.println("JSonReader found:" + r.size());
    if (debug)
      System.err.println("node2=" + found);
    if (found == null) {
      result = vf.node(funname, a);
    } else {
      if (found.isAliased())
        found = found.getAliased();
      result = vf.constructor(found, a);
      if (debug)
        System.err.println("JSonReader result:" + result);
    }
    if (annoMap != null)
      result = result.asAnnotatable().setAnnotations(map);
    if(kwmap.size() > 0){
      result = result.asWithKeywordParameters().setParameters(kwmap);
    }
    return result;
  }
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.