com.netgrif.application.engine.petrinet.domain.arcs.ResetArc Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of application-engine Show documentation
Show all versions of application-engine Show documentation
System provides workflow management functions including user, role and data management.
package com.netgrif.application.engine.petrinet.domain.arcs;
import com.netgrif.application.engine.petrinet.domain.Place;
/**
* Reset arc does not alter the enabling condition, but involve a change of the marking on p by firing of t:
*
* - m'(p) = 0, if p is not also a postplace of t
* - m'(p) = W(t,p), if p is also a postplace of t
*
* More info
*/
public class ResetArc extends PTArc {
/**
* Always returns true, because Reset arc does not alter the enabling condition.
*
* @return true
*/
@Override
public boolean isExecutable() {
return true;
}
/**
* Changes the marking on p by firing of t:
*
* - m'(p) = 0, if p is not also a postplace of t
* - m'(p) = W(t,p), if p is also a postplace of t
*
*/
@Override
public void execute() {
Place place = ((Place) source);
place.removeAllTokens();
}
@Override
public void rollbackExecution(Integer tokensConsumed) {
((Place) source).addTokens(tokensConsumed);
}
@SuppressWarnings("Duplicates")
@Override
public ResetArc clone() {
ResetArc clone = new ResetArc();
clone.setSourceId(this.sourceId);
clone.setDestinationId(this.destinationId);
clone.setMultiplicity(this.multiplicity);
clone.setObjectId(this.getObjectId());
clone.setImportId(this.importId);
return clone;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy