本文整理汇总了Java中de.uni.freiburg.iig.telematik.sepia.petrinet.cpn.CPNTransition类的典型用法代码示例。如果您正苦于以下问题:Java CPNTransition类的具体用法?Java CPNTransition怎么用?Java CPNTransition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CPNTransition类属于de.uni.freiburg.iig.telematik.sepia.petrinet.cpn包,在下文中一共展示了CPNTransition类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCPNFlowRelationClone
import de.uni.freiburg.iig.telematik.sepia.petrinet.cpn.CPNTransition; //导入依赖的package包/类
@Test
public void testCPNFlowRelationClone() {
// Test PT transition
CPNFlowRelation f1 = new CPNFlowRelation(cpnP, cpnT);
assertEquals(f1.getSource().getName(), "p0");
assertEquals(f1.getTarget().getName(), "t0");
assertTrue(f1.getConstraint().equals(new Multiset<String>("black")));
CPNFlowRelation f1clone = f1.clone((CPNPlace) f1.getSource(), (CPNTransition) f1.getTarget(), f1.getDirectionPT());
assertEquals(f1, f1clone);
assertNotSame(f1, f1clone);
assertEquals(f1.getSource().getName(), f1clone.getSource().getName());
assertEquals(f1.getTarget().getName(), f1clone.getTarget().getName());
assertTrue(f1clone.getConstraint().equals(new Multiset<String>("black")));
// Test TP transition
CPNFlowRelation f2 = new CPNFlowRelation(cpnT, cpnP);
assertEquals(f2.getSource().getName(), "t0");
assertEquals(f2.getTarget().getName(), "p0");
assertTrue(f2.getConstraint().equals(new Multiset<String>("black")));
CPNFlowRelation f2clone = f2.clone((CPNPlace) f2.getTarget(), (CPNTransition) f2.getSource(), f2.getDirectionPT());
assertEquals(f2, f2clone);
assertNotSame(f2, f2clone);
assertEquals(f2.getSource().getName(), f2clone.getSource().getName());
assertEquals(f2.getTarget().getName(), f2clone.getTarget().getName());
assertTrue(f2clone.getConstraint().equals(new Multiset<String>("black")));
}
示例2: CWNInfoProvider
import de.uni.freiburg.iig.telematik.sepia.petrinet.cpn.CPNTransition; //导入依赖的package包/类
public CWNInfoProvider(CPN net) {
mTransitions = new ArrayList<String>();
Collection<CPNTransition> transitions = net.getTransitions();
for (CPNTransition transition : transitions) {
mTransitions.add(transition.getName() + "(" + transition.getLabel() + ")");
}
mPlaces = new ArrayList<String>();
mPlacesToColorMap = new HashMap<String, ArrayList<String>>();
Collection<CPNPlace> places = net.getPlaces();
for (CPNPlace p : places) {
mPlaces.add(p.getName() + "(" + p.getLabel() + ")");
ArrayList<String> possibleColors = new ArrayList<String>();
if(net.getInitialMarking().get(p.getName()) != null) {
possibleColors.addAll(net.getInitialMarking().get(p.getName()).support());
}
LinkedList<AbstractCPNFlowRelation<?,?>> inRelations =
new LinkedList<AbstractCPNFlowRelation<?,?>>(p.getIncomingRelations());
for (AbstractCPNFlowRelation<?,?> inRel : inRelations) {
possibleColors.addAll(inRel.getConstraint().support());
}
mPlacesToColorMap.put(p.getName() + "(" + p.getLabel() + ")", possibleColors);
}
}
示例3: testProcessesColor
import de.uni.freiburg.iig.telematik.sepia.petrinet.cpn.CPNTransition; //导入依赖的package包/类
@Test
public void testProcessesColor() {
// Create a transition
CPNTransition cpnTrans = setUpStandadEnabledTransition();
// check whether the transition knows that it consumes a red token
// but not a pink token
assertTrue(cpnTrans.processesColor("red"));
assertFalse(cpnTrans.processesColor("pink"));
}
示例4: testGetConsumedTokens
import de.uni.freiburg.iig.telematik.sepia.petrinet.cpn.CPNTransition; //导入依赖的package包/类
@Test
public void testGetConsumedTokens() {
// Create a transition
CPNTransition cpnTrans = setUpStandadEnabledTransition();
// The transition consumes two red, one black and one green token
assertEquals(2, cpnTrans.getConsumedTokens("black"));
assertEquals(2, cpnTrans.getConsumedTokens("red"));
assertEquals(0, cpnTrans.getConsumedTokens("pink"));
assertEquals(0, cpnTrans.getConsumedTokens(null));
}
示例5: testGetProducedTokens
import de.uni.freiburg.iig.telematik.sepia.petrinet.cpn.CPNTransition; //导入依赖的package包/类
@Test
public void testGetProducedTokens() {
// Create a transition
CPNTransition cpnTrans = setUpStandadEnabledTransition();
// The transition produces a black and a yellow token
assertEquals(2, cpnTrans.getProducedTokens("black"));
assertEquals(1, cpnTrans.getProducedTokens("yellow"));
assertEquals(0, cpnTrans.getProducedTokens("pink"));
assertEquals(0, cpnTrans.getProducedTokens(null));
}
示例6: testConsumesColor
import de.uni.freiburg.iig.telematik.sepia.petrinet.cpn.CPNTransition; //导入依赖的package包/类
@Test
public void testConsumesColor() {
// Create a transition
CPNTransition cpnTrans = setUpStandadEnabledTransition();
// The transition consumes two red, one black and one green token
assertTrue(cpnTrans.consumesColor("black"));
assertFalse(cpnTrans.consumesColor("pink"));
assertFalse(cpnTrans.consumesColor(null));
}
示例7: testProducesColor
import de.uni.freiburg.iig.telematik.sepia.petrinet.cpn.CPNTransition; //导入依赖的package包/类
@Test
public void testProducesColor() {
// Create a transition
CPNTransition cpnTrans = setUpStandadEnabledTransition();
// /The transition produces a black and a yellow token
assertTrue(cpnTrans.producesColor("black"));
assertTrue(cpnTrans.producesColor("yellow"));
assertFalse(cpnTrans.producesColor("pink"));
assertFalse(cpnTrans.producesColor(null));
}
示例8: setUp
import de.uni.freiburg.iig.telematik.sepia.petrinet.cpn.CPNTransition; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
// Setup standard transition and place
cpnT = new CPNTransition("t0");
cpnP = new CPNPlace("p0");
}
示例9: testCPNTransitionClone
import de.uni.freiburg.iig.telematik.sepia.petrinet.cpn.CPNTransition; //导入依赖的package包/类
@Test
public void testCPNTransitionClone() throws ParameterException {
// CPNTransition with non-default values
CPNTransition t1 = setUpStandadEnabledTransition();
t1.setSilent(true);
assertTrue(t1.isSilent());
assertTrue(t1.processesColor("red"));
assertFalse(t1.processesColor("pink"));
CPNTransition t1clone = t1.clone();
// System.out.println(t1.equals(t1clone));
assertEquals(t1, t1clone);
assertNotSame(t1, t1clone);
assertTrue(t1clone.isSilent());
assertEquals(t1.getName(), t1clone.getName());
assertEquals(t1.getLabel(), t1clone.getLabel());
assertEquals(t1.isPlace(), t1clone.isPlace());
assertEquals(t1.isDrain(), t1clone.isDrain());
assertEquals(t1.isSource(), t1clone.isSource());
assertEquals(t1.isTransition(), t1clone.isTransition());
// Processes color can't be tested
// assertTrue(t1clone.processesColor("red"));
// assertFalse(t1clone.processesColor("pink"));
// CPNTransition with default values
CPNTransition t2 = new CPNTransition("name_trans1");
assertFalse(t2.isSilent());
assertFalse(t2.processesColor("black"));
CPNTransition t2clone = t2.clone();
assertEquals(t2, t2clone);
assertNotSame(t2, t2clone);
assertFalse(t2clone.isSilent());
assertEquals(t2.getName(), t2clone.getName());
assertEquals(t2.getLabel(), t2clone.getLabel());
assertEquals(t2.isPlace(), t2clone.isPlace());
assertEquals(t2.isDrain(), t2clone.isDrain());
assertEquals(t2.isSource(), t2clone.isSource());
assertEquals(t2.isTransition(), t2clone.isTransition());
// assertFalse(t2clone.processesColor("black"));
}
示例10: testCPNClone
import de.uni.freiburg.iig.telematik.sepia.petrinet.cpn.CPNTransition; //导入依赖的package包/类
@Test
public void testCPNClone() {
/*
* Test equal CPNs
*/
CPN cpn1 = createCPN();
CPN cpn1clone = (CPN) cpn1.clone();
assertNotSame(cpn1, cpn1clone);
// Can't just test equality because of the different order of same lists.
// assertEquals(cpn1, cpn1clone);
// Check equality for places
assertEquals(cpn1.getPlaces().size(), cpn1clone.getPlaces().size());
for (CPNPlace p : cpn1.getPlaces()) {
assertTrue(cpn1clone.getPlace(p.getName()) != null);
assertEquals(p, cpn1clone.getPlace(p.getName()));
assertNotSame(p, cpn1clone.getPlace(p.getName()));
}
// Check equality for transitions
assertEquals(cpn1.getTransitions().size(), cpn1clone.getTransitions().size());
for (CPNTransition t : cpn1.getTransitions()) {
assertTrue(cpn1clone.getTransition(t.getName()) != null);
assertEquals(t, cpn1clone.getTransition(t.getName()));
assertNotSame(t, cpn1clone.getTransition(t.getName()));
}
// Check equality for flow relations
assertEquals(cpn1.getFlowRelations().size(), cpn1clone.getFlowRelations().size());
for (CPNFlowRelation f : cpn1.getFlowRelations()) {
CPNFlowRelation flowRelationClone = null;
for (CPNFlowRelation fc : cpn1clone.getFlowRelations()) {
if (fc.getSource().equals(f.getSource()) && fc.getTarget().equals(f.getTarget()) && fc.getDirectionPT() == f.getDirectionPT() && fc.getConstraint().equals(f.getConstraint())) {
flowRelationClone = fc;
}
}
assertFalse(flowRelationClone == null);
assertEquals(f, flowRelationClone);
assertNotSame(f, flowRelationClone);
}
// Check equality for the initial marking
assertEquals(cpn1.getInitialMarking(), cpn1clone.getInitialMarking());
assertNotSame(cpn1.getInitialMarking(), cpn1clone.getInitialMarking());
}
示例11: getTransitionToolTip
import de.uni.freiburg.iig.telematik.sepia.petrinet.cpn.CPNTransition; //导入依赖的package包/类
@Override
protected String getTransitionToolTip(PNGraphCell cell) {
CPNTransition ptTransition = getNetContainer().getPetriNet().getTransition(cell.getId());
return (ptTransition.isEnabled())? "enabled": "not enabled";
}