Examples of MatchSet


Examples of net.jini.space.MatchSet

    protected Entry[] getEntryArray() {
      try {
  List acc = new java.util.LinkedList();
  if (proxy instanceof JavaSpace05) {
    MatchSet set =
      ((JavaSpace05) proxy).contents(Collections.singleton(null),
             null, Lease.ANY, Integer.MAX_VALUE);
    Lease lease = set.getLease();
    if (lease != null) {
      lease = (Lease) browser.leasePreparer.prepareProxy(lease);
      browser.leaseMgr.renewUntil(lease, Lease.ANY, null);
    }
    try {
      while (true) {
        try {
    Entry e = set.next();
    if (e == null)
      break;
    acc.add(e);
        } catch (UnusableEntryException e) {
    Browser.logger.log(Level.INFO, "unusable entry", e);
View Full Code Here

Examples of net.jini.space.MatchSet

         * MatchSet.next() method
         */
        JavaSpace05 space05 = (JavaSpace05) space;
        templates.add(sampleEntry1);
        txn = getTransaction();
        MatchSet matchSet = space05.contents(templates, txn, Lease.ANY,
                                             MAX_ENTRIES);
        if (matchSet.next() == null) {
            throw new TestException(
                    "Match set is exhausted. But it shouldn't be.");
        }

        // -- now it is supposed to be exhausted
        if (matchSet.next() != null) {
            throw new TestException(
                    "Match set was not exhausted. But should have been.");
        }
        space.write(sampleEntry1, txn, leaseForeverTime);
        Thread.sleep(1000);
        if (matchSet.next() != null) {
            throw new TestException("An entry added to exhausted match set. "
                                    + "But must not have been.");
        }
        txn.commit();
        reset();

        /*
         * After maxEntries entries are yielded by next invocations the match
         * set becomes empty. For this test case let maxEntries = 2
         */
        templates.add(null);    // for 3 existing entries
        txn = getTransaction();
        matchSet = space05.contents(templates, txn, Lease.ANY, 2);
        matchSet.next();
        matchSet.next();
        if (matchSet.next() != null) {
            throw new TestException("Match set is not empty after maxEntries "
                                    + "are yielded by next invocations");
        }
        txn.commit();
        reset();

        /*
         * The initial duration of the lease must be less than or equal to
         * leaseDuration. Let leaseDuration = instantTime.
         */
        templates.add(null);    // for 3 existing entries
        txn = getTransaction();
        matchSet = space05.contents(templates, txn, leaseForeverTime,
                                    MAX_ENTRIES);
        Lease lease = matchSet.getLease();
        if (lease != null) {
            long initialDuration = lease.getExpiration()
                    - System.currentTimeMillis();
            if (initialDuration > leaseForeverTime) {
                throw new TestException("Initial duration of the lease "
                                        + "is more than leaseDuration");
            }
        } // else Lease is not tested as the matchset is not leased
        txn.commit();
        reset();

        //corresponds to item #6 in this method's comments
        txn = getTransaction();
        templates.add((SimpleEntry) sampleEntry1.clone());
        matchSet = space05.contents(templates, txn, leaseForeverTime,
                                    MAX_ENTRIES);
        matchSet.next();
        SimpleEntry entry = (SimpleEntry) space.take(
                (SimpleEntry) sampleEntry1.clone(), null, instantTime);
        if (entry != null) {
            throw new TestException("Locked entry can be taken "
                                    + "from the space.");
View Full Code Here

Examples of net.jini.space.MatchSet

    {
        if (txn == null) {
            throw new TestException("Transaction is null for test " + testName);
        }
        JavaSpace05 space05 = (JavaSpace05) space;
        MatchSet matchSet = space05.contents(templates, txn, leaseDuration,
                                             maxEntries);
        ArrayList result = new ArrayList();
        SimpleEntry entry = (SimpleEntry) matchSet.next();
        while (entry != null) {
            result.add(entry);
            entry = (SimpleEntry) matchSet.next();
        }

        if (result.size() != expectedResult.size()) {
            throw new TestException(testName + " failed. "
                                    + "Taken result is not as expected.");
View Full Code Here

Examples of org.antlr.v4.codegen.model.MatchSet

    return new TokenListDecl(this, gen.getTarget().getListLabel(label));
  }

  @Override
  public List<SrcOp> set(GrammarAST setAST, GrammarAST labelAST, boolean invert) {
    MatchSet matchOp;
    if ( invert ) matchOp = new MatchNotSet(this, setAST);
    else matchOp = new MatchSet(this, setAST);
    if ( labelAST!=null ) {
      String label = labelAST.getText();
      RuleFunction rf = getCurrentRuleFunction();
      if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) {
        defineImplicitLabel(setAST, matchOp);
View Full Code Here

Examples of org.flowforwarding.warp.protocol.ofstructures.MatchSet

   protected InstructionSet instructions;
   protected MatchSet matches;
  
   protected OFMessageFlowMod() {
      // TODO Improvs: create() instead of Constructor?
      matches = new MatchSet();
      instructions = new InstructionSet();
   }
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.