Package statechum.DeterministicDirectedSparseGraph

Examples of statechum.DeterministicDirectedSparseGraph.VertexID


 
  @Test
  public void testGraphConstructionFail5b()
  {
    DirectedSparseVertex v = new DirectedSparseVertex();
    v.addUserDatum(JUConstants.ACCEPTED, true, UserData.SHARED);v.addUserDatum(JUConstants.LABEL, new VertexID("Q"), UserData.SHARED);v.addUserDatum(JUConstants.INITIAL, false, UserData.SHARED);
    checkWithVertex(v, "invalid init property", "testGraphConstructionFail5b");
  }
View Full Code Here


  }

  @Test
  public void testSizeOne4()
  {
    VertexID vert = VertexID.parseID("P21");
    final Attempt<VertexID,Long> map = createMapOne(vert,valueOne);
    Assert.assertNull( ((MapWithSearch<VertexID,Long>)map.getOurs()).findElementById(VertexID.parseID("P20")));
    Assert.assertNull( ((MapWithSearch<VertexID,Long>)map.getOurs()).findElementById(null));
    Assert.assertNull( ((MapWithSearch<VertexID,Long>)map.getOurs()).findElementById(VertexID.parseID("N20")));
    Assert.assertSame(vert, ((MapWithSearch<VertexID,Long>)map.getOurs()).findElementById(vert));
View Full Code Here

  }
 
  @Test
  public void testSizeTwo6()
  {
    VertexID vert = VertexID.parseID("P21"), vert2 = VertexID.parseID("P99");
    final Attempt<VertexID,Long> map = createMapTwo(vert,valueOne,vert2,valueTwo);
    Assert.assertNull( ((MapWithSearch<VertexID,Long>)map.getOurs()).findElementById(VertexID.parseID("P20")));
    Assert.assertNull( ((MapWithSearch<VertexID,Long>)map.getOurs()).findElementById(null));
    Assert.assertSame(vert, ((MapWithSearch<VertexID,Long>)map.getOurs()).findElementById(vert));
    Assert.assertSame(vert, ((MapWithSearch<VertexID,Long>)map.getOurs()).findElementById(VertexID.parseID("P21")));
View Full Code Here

  }
 
  @Test
  public void TestMapWithSearch0b()
  {
    VertexID [] collectionOfKeys = new VertexID[]{new VertexID(VertKind.POSITIVE,0),new VertexID(VertKind.POSITIVE,1),new VertexID(VertKind.POSITIVE,3),new VertexID(VertKind.POSITIVE,4)};
    final Attempt<VertexID,Long> map = createMap();
    for(int i=0;i<collectionOfKeys.length;++i)
    {
      map.put(collectionOfKeys[i], new Long(1000+i));
      for(int j=i+1;j < collectionOfKeys.length;++j)
      {
        Assert.assertFalse("j="+j+", key "+collectionOfKeys[j]+" should not exist",map.containsKey(collectionOfKeys[j]));
        Assert.assertNull(map.remove(collectionOfKeys[j]));
        Assert.assertNull( ((MapWithSearch<VertexID,Long>)map.getOurs()).findElementById(collectionOfKeys[j]) );
      }
      for(int j=0;j <= i;++j)
      {
        Assert.assertEquals(new Long(1000+i),map.get(collectionOfKeys[i]));
        Assert.assertSame(collectionOfKeys[j], ((MapWithSearch<VertexID,Long>)map.getOurs()).findElementById(new VertexID(collectionOfKeys[j])) );
      }
    }
  }
View Full Code Here

          valueA = Math.abs(varName.hashCode());valueB=Math.abs(setter.hashCode());// just some integers likely to be different from each other between different variables.
        }
        else
        if (var.getType().equals(VertID.class))
        {
          valueA = new VertexID("A");valueB = new VertexID("B");
        }
        else
        if (var.getType().equals(JUConstants.class))
        {
          valueA = JUConstants.RED;valueB = JUConstants.BLUE;
View Full Code Here

        Map<String,CmpVertex> row = transitionMatrix.get(currentState);
        assert row != null;// a transition matrix is always total (unless current state is (semi)non-existing but then we'll not get here in this case).
        result = row.get(input);
        if (result == null)
        {// add the current state to the matrix of non-existing states
          result = AbstractLearnerGraph.generateNewCmpVertex(new VertexID(VertKind.NONEXISTING,idCounter++), config);
          nonExistingVertices.add(result);
          transitions = createNewRow();transitions.putAll(row);transitions.put(input, result);// clones the existing row and adds to it
          NonExistingTransitions.put(result, createNewRow());
          NonExistingTransitions.put((CmpVertex)currentState, transitions);
        }
      }
      else
      {// a transition from a non-existing state
        result = transitions.get(input);
        if (result == null)
        {
          result = AbstractLearnerGraph.generateNewCmpVertex(new VertexID(VertKind.NONEXISTING,idCounter++), config);
          transitions.put(input, result);NonExistingTransitions.put(result, createNewRow());
          nonExistingVertices.add(result);
        }
      }
     
View Full Code Here

          valueA = Math.abs(varName.hashCode());valueB=Math.abs(setter.hashCode());// just some integers likely to be different from each other between different variables.
        }
        else
        if (var.getType().equals(VertexID.class))
        {
          valueA = new VertexID("A");valueB = new VertexID("B");
        }
        else
        if (var.getType().equals(JUConstants.class))
        {
          valueA = JUConstants.RED;valueB = JUConstants.BLUE;
View Full Code Here

          valueA = Math.abs(varName.hashCode());valueB=Math.abs(setter.hashCode());// just some integers likely to be different from each other between different variables.
        }
        else
        if (var.getType().equals(VertexID.class))
        {
          valueA = new VertexID("A");valueB = new VertexID("B");
        }
        else
        if (var.getType().equals(JUConstants.class))
        {
          valueA = JUConstants.RED;valueB = JUConstants.BLUE;
View Full Code Here

   */
  public static void addRejectVertices(LearnerGraph gr,String prefix, int number)
  {
    for(int i=-1;i<number;++i)
    {
      VertexID id = new VertexID(prefix+(i>=0?i:""));if (gr.findVertex(id) != null) throw new IllegalArgumentException("vertex already exists");
      CmpVertex newVertex = AbstractLearnerGraph.generateNewCmpVertex(id, gr.config);newVertex.setAccept(false);
      gr.transitionMatrix.put(newVertex, gr.createNewRow());
    }
  }
View Full Code Here

  }
 
  @Test
  public final void testParseID5()
  {
    VertexID id = VertexID.parseID("P00");
    Assert.assertEquals(VertKind.POSITIVE,id.getKind());
    Assert.assertEquals("P0",id.toString());
    Assert.assertEquals(0, id.getIntegerID());
  }
View Full Code Here

TOP

Related Classes of statechum.DeterministicDirectedSparseGraph.VertexID

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.