Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] Henshin Transformation Units

Hi Christian, 

thanks, this would be perfect. But if I don't misunderstand the code, the method executePriorityUnit() will break if one sub unit succeeds. Where's my error in reasoning?

Cheers,
Yannic


On 29 May 2013 10:52, Christian Krause <henshin.ck@xxxxxxxxx> wrote:
Hi Yannic,
a PriorityUnit applies all sub-units no matter if they succeed or not. Would that be sufficient in your case?

Cheers,
Christian


2013/5/29 Christian Krause <me@xxxxxxxxxxx>
Hi Yannic,
a PriorityUnit applies all sub-units no matter if they succeed or not. Would that be sufficient in your case?

Cheers,
Christian


2013/5/29 Yannic Noller <nolleryc@xxxxxxxxx>
Hi Christian,

one question to the IndpendentUnits. You wrote that all subunits are applied in arbitrary order, but the code will break the while loop, if one execution finishes with true:

	/*
	 * Execute an IndependentUnit.
	 */
	protected boolean executeIndependentUnit(ApplicationMonitor monitor) {
		IndependentUnit indepUnit = (IndependentUnit) unit;
		List<Unit> subUnits = new ArrayList<Unit>(indepUnit.getSubUnits());
		boolean success = false;
		while (!subUnits.isEmpty()) {
			if (monitor.isCanceled()) {
				if (monitor.isUndo()) undo(monitor);
				break;
			}
			int index = new Random().nextInt(subUnits.size());
			UnitApplicationImpl unitApp = createApplicationFor(subUnits.remove(index));
			if (unitApp.execute(monitor)) {
				updateParameterValues(unitApp);
				appliedRules.addAll(unitApp.appliedRules);
				success = true;
				break;
			}
		}
		monitor.notifyExecute(this, success);
		return success;
	}
What I need is a unit which executes all subunits independent therefrom they finish with true or false. Have you an idea or do I misunderstand the code?
Cheers,
Yannic


On 22 May 2013 14:51, Christian Krause <henshin.ck@xxxxxxxxx> wrote:
Dear Yannic,

you can take a look at this paper: http://journal.ub.tu-berlin.de/eceasst/article/view/528/530. There you can find the following:

A HENSHIN transformation unit may be of type IndependentUnit (all subunits are applied in arbitrary order), SequentialUnit (all subunits are applied sequentially in a given order), CountedUnit (its subunit is applied a given number of times), ConditionalUnit
(its subunits are applied depending on the evaluation of a given condition unit), and PriorityUnit (the applicable subunit with the highest priority is applied next). A unit is applicable (and returns true) if it can be successfully executed. PriorityUnits and IndependentUnits are always applicable, while SequentialUnits (CountedUnits) are applicable only if all subunits are applicable in the given order (the given number of times). A ConditionalUnit is applicable if either the thensubunit (in case the condition is true) or the else-subunit (in case the condition is false) are applicable.

If you want to know exactly how they work, you can take a look at the default implementation of UnitApplication: http://dev.eclipse.org/svnroot/modeling/org.eclipse.emft.henshin/trunk/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/impl/UnitApplicationImpl.java (check out the execute* methods)

Hope that helps.

Cheers,
Christian



2013/5/22 Yannic Noller <nolleryc@xxxxxxxxx>
Dear Henshin developers,

is there any documentation about the transformation units? Especially I would like to know how exactly the PriorityUnit works.

Best Regards,
Yannic Noller

_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev



_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev





_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev



Back to the top