Package org.woped.core.model.petrinet

Examples of org.woped.core.model.petrinet.PlaceModel


        LowLevelPetriNet lNet = new LowLevelPetriNet();
        Set<AbstractPetriNetElementModel> successors;
        Set<AbstractPetriNetElementModel> predecessors;
        TransitionModel tm;
        PlaceModel pm;

        // loop over all places
        while (iterPlace.hasNext()) {
            pm = (PlaceModel) iterPlace.next();
            lNet.getPlaceNode(new PlaceNode(pm.getTokenCount(), pm.getVirtualTokenCount(), pm.getId(), pm
                    .getNameValue(), makeOriginId(pm.getId())));
        }

        // loops over all transitions and set predecessors and successors
        while (iterTransition.hasNext()) {
          AbstractPetriNetElementModel trans = iterTransition.next();
View Full Code Here


        return true;
      }
    }
   
    if (cell instanceof PlaceModel) {
      PlaceModel place = (PlaceModel) cell;
      int num = mp.getElementContainer().
        getOutgoingArcs(place.getId()).size();

      return num > 1;
    }

    return false;
View Full Code Here

            {
                // Check basetype of Element
                if (map.getType() == AbstractPetriNetElementModel.PLACE_TYPE)
                {
                    // Creating a new ModelElement with
                    modElement = new PlaceModel(map);
                   
                    // Tokens
                    if (map.getTokens() > 0)
                      ((PlaceModel) modElement).setTokens(map.getTokens());
                   
View Full Code Here

        Iterator<String> incomingArcsIter = getPetriNet().getElementContainer().getIncomingArcs(transitionId).keySet()
                .iterator();
        while (incomingArcsIter.hasNext()) {
            ArcModel arc = getPetriNet().getElementContainer().getArcById(incomingArcsIter.next());
            if (active) {
                PlaceModel place = (PlaceModel) getPetriNet().getElementContainer().getElementById(arc.getSourceId());
                if (place.getVirtualTokenCount() > 0) {
                    arc.setActivated(true);
                    // TODO: check weight
                }
            } else {
                arc.setActivated(false);
View Full Code Here

    /*
     * Send (subtract) Tokens from the arc's source. ATTENTION: source must be a Place.
     */
    private void sendTokens(ArcModel arc) {
        try {
            PlaceModel place = (PlaceModel) getPetriNet().getElementContainer().getElementById(arc.getSourceId());
            if (place != null) {
                place.sendToken();
                // TODO: when ARC WEIGTH implemented send tokens weigth times
            }
        } catch (ClassCastException cce) {
            LoggerManager.warn(Constants.QUALANALYSIS_LOGGER,
                    "TokenGame: Cannot send token. Source is not a place. Ignore arc: " + arc.getId());
View Full Code Here

    /*
     * Receive (add) Tokens to the place that is the target of the arc. ATTENTION: Target must be a place.
     */
    private void receiveTokens(ArcModel arc) {
        try {
            PlaceModel place = (PlaceModel) getPetriNet().getElementContainer().getElementById(arc.getTargetId());
            if (place != null) {
                place.receiveToken();
                // TODO: when ARC WEIGTH implemented receive tokens weigth times
            }
        } catch (ClassCastException cce) {
            LoggerManager.warn(Constants.QUALANALYSIS_LOGGER,
                    "TokenGame: Cannot receive token. Target is not a place. Ignore arc: " + arc.getId());
View Full Code Here

    /*
     * Send (subtract) Tokens from the arc's target on Backward stepping. ATTENTION: target must be a Place.
     */
    private void sendBackwardTokens(ArcModel arc) {
        try {
            PlaceModel place = (PlaceModel) getPetriNet().getElementContainer().getElementById(arc.getTargetId());
            if (place != null) {
                place.sendToken();
                // TODO: when ARC WEIGTH implemented send tokens weigth times
            }
        } catch (ClassCastException cce) {
            LoggerManager.warn(Constants.QUALANALYSIS_LOGGER,
                    "TokenGame: Cannot send token. Source is not a place. Ignore arc: " + arc.getId());
View Full Code Here

    /*
     * Receive (add) Tokens to the place that is the source of the arc. ATTENTION: Target must be a place.
     */
    private void receiveBackwardTokens(ArcModel arc) {
        try {
            PlaceModel place = (PlaceModel) getPetriNet().getElementContainer().getElementById(arc.getSourceId());
            if (place != null) {
                place.receiveToken();
                // TODO: when ARC WEIGTH implemented receive tokens weigth times
            }
        } catch (ClassCastException cce) {
            LoggerManager.warn(Constants.QUALANALYSIS_LOGGER,
                    "TokenGame: Cannot receive token. Target is not a place. Ignore arc: " + arc.getId());
View Full Code Here

    
     */
        public void mouseReleased(MouseEvent e) {
            Vector<Object> allCells = getGraph().getAllCellsForLocation(e.getPoint().x, e.getPoint().y);
            TransitionModel transition = findTransitionInCell(allCells);
            PlaceModel place = findPlaceInCell(allCells);
            ArcModel arc = findArcInCell(allCells);
            if (transition != null && transition.isActivated()) {
                transitionClicked(transition, e);
            } else
                if (arc != null && arc.isActivated()) {
                    arcClicked(arc);
                } else
                    if (place != null && place.isActivated()) {
                        // If an active place has been clicked there is only one reasonable explanation for this:
                        // It is a sink place of a sub-process
                        RemoteControl = ParentControl.getRemoteControlReference();
                        // De-register the sub-process
                        RemoteControl.changeTokenGameReference(null, true);
View Full Code Here

        IMarking marking = (IMarking) place.getUserObject();
        SortedMap<String, Integer> map = marking.getMarking();
        for (Iterator<AbstractPetriNetElementModel> placeIter = getPetriNet().getElementContainer().getElementsByType(
                AbstractPetriNetElementModel.PLACE_TYPE).values().iterator(); placeIter.hasNext();) {
            try {
                PlaceModel curplace = (PlaceModel) placeIter.next();
                curplace.setVirtualTokens(map.get(curplace.getId()));
            } catch (Exception ex) {
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.woped.core.model.petrinet.PlaceModel

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.