Package lupos.datastructures.items

Examples of lupos.datastructures.items.TripleComparator


  private final Heap<HeapEntry> heap;
  private int idOfLastElement;

  public MergeIndicesTripleIterator(final IndicesTripleIterator[] itia,
      final RDF3XIndexScan.CollationOrder collationOrder) {
    this.comparator = new TripleComparator(collationOrder);
    this.heap = new SequentialHeap<HeapEntry>(itia.length, true);
    for (int i = 0; i < itia.length; i++) {
      if (itia[i] != null) {
        final Triple t = itia[i].next();
        if (t != null) {
View Full Code Here


                dbbptree.setName(order.toString());

                return new OptimizedDBBPTreeGeneration<TripleKey, Triple>(new DBMergeSortedMap<TripleKey, Triple>(new SortConfiguration(), (Class<lupos.datastructures.dbmergesortedds.MapEntry<TripleKey, Triple>>) (new lupos.datastructures.dbmergesortedds.MapEntry<TripleKey, Triple>(null, null)).getClass()), dbbptree);
            } else {
        return new PrefixSearchFromSortedMap<TripleKey, Triple>(new TreeMap<TripleKey, Triple>(new TripleKeyComparator(new TripleComparator(order))));
      }

        } catch (final IOException e) {
            System.err.println(e);
            e.printStackTrace();
View Full Code Here

                    System.err.println(e);
                    e.printStackTrace();
                }
            }
        } else {
          this.SPO.put(new TripleKey(t, new TripleComparator(CollationOrder.SPO)), t);
          this.SOP.put(new TripleKey(t, new TripleComparator(CollationOrder.SOP)), t);
          this.PSO.put(new TripleKey(t, new TripleComparator(CollationOrder.PSO)), t);
          this.POS.put(new TripleKey(t, new TripleComparator(CollationOrder.POS)), t);
          this.OSP.put(new TripleKey(t, new TripleComparator(CollationOrder.OSP)), t);
          this.OPS.put(new TripleKey(t, new TripleComparator(CollationOrder.OPS)), t);
        }
    }
View Full Code Here

    }

    @Override
    public boolean contains(final Triple t) {
      this.waitForAdderThreads();
        return (this.SPO.get(new TripleKey(t, new TripleComparator(CollationOrder.SPO))) != null);
    }
View Full Code Here

        this.OPS = this.getDatastructure(CollationOrder.OPS);
    }

    @Override
    public void remove(final Triple t) {
      this.SPO.remove(new TripleKey(t, new TripleComparator(CollationOrder.SPO)));
      this.SOP.remove(new TripleKey(t, new TripleComparator(CollationOrder.SOP)));
      this.PSO.remove(new TripleKey(t, new TripleComparator(CollationOrder.PSO)));
      this.POS.remove(new TripleKey(t, new TripleComparator(CollationOrder.POS)));
      this.OSP.remove(new TripleKey(t, new TripleComparator(CollationOrder.OSP)));
      this.OPS.remove(new TripleKey(t, new TripleComparator(CollationOrder.OPS)));
    }
View Full Code Here

        @Override
        public void run() {
            try {
                while (this.bbt.hasNext()) {
                    final Triple t = this.bbt.get();
                    this.ps.put(new TripleKey(t, new TripleComparator(this.order)), t);
                }
            } catch (final InterruptedException e) {
                System.err.println(e);
                e.printStackTrace();
            }
View Full Code Here

    final int order = in.read();
    if (order < 0) {
      return null;
    }
    final Triple t = InputHelper.readLuposTriple(in);
    return new TripleKey(t, new TripleComparator((byte) order));
  }
View Full Code Here

    final int order = in.read();
    if (order < 0) {
      return null;
    }
    final Triple t = InputHelper.readLuposTriple(previousTriple, in);
    return new TripleKey(t, new TripleComparator((byte) order));
  }
View Full Code Here

    super(new DBMergeSortedSet<BindingsArrayReadTriples>(new SortConfiguration(),
        new Comparator<BindingsArrayReadTriples>() {

          public int compare(final BindingsArrayReadTriples arg0,
              final BindingsArrayReadTriples arg1) {
            final TripleComparator tc = new TripleComparator(
                RDF3XIndexScan.CollationOrder.SPO);
            final Iterator<Triple> it0 = arg0.getTriples()
                .iterator();
            final Iterator<Triple> it1 = arg1.getTriples()
                .iterator();
            while (it0.hasNext()) {
              if (!it1.hasNext())
                return -1;
              final Triple t0 = it0.next();
              final Triple t1 = it1.next();
              final int compare = tc.compare(t0, t1);
              if (compare != 0)
                return compare;
            }
            if (it1.hasNext())
              return 1;
View Full Code Here

      return LengthHelper.lengthLuposByte();
    }

    @Override
    public void serialize(final Comparator<Triple> t, final OutputStream out) throws IOException {
      final TripleComparator tc = (TripleComparator) t;
      OutHelper.writeLuposByte(tc.getBytePattern(), out);
    }
View Full Code Here

TOP

Related Classes of lupos.datastructures.items.TripleComparator

Copyright © 2018 www.massapicom. 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.