Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xbase] Operator Overloading(How to introduce own_operator_multiply method)
[Xbase] Operator Overloading [message #686063] Tue, 21 June 2011 14:47
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi,

I have added a XDecimalLiteral to Xbase which parses values like "4.2" to an EBigDecimal.

Now I want to add an own DecimalExtension.java for all the operators like:
public class DecimalExtension
{
	/**
	 * The binary <code>times</code> operator. This is the equivalent to the java <code>*</code> operator.
	 * 
	 * @param a
	 *            an double. May not be <code>null</code>.
	 * @param b
	 *            a number. May not be <code>null</code>.
	 * @return <code>a*b</code>
	 * @throws NullPointerException
	 *             if {@code a} or {@code b} is <code>null</code>.
	 */
	public static double operator_multiply(
			Double a,
			Number b )
	{
		return a * b.doubleValue();
	}
}


Where do I have to register that class? (Guice / Scoping)

Thanks,
Ingo Meyer
Previous Topic:Cross reference - not sure how to do it here
Next Topic:[Xtext 1.0.1]Problem with cross-referencing and duplicated names
Goto Forum:
  


Current Time: Fri Apr 26 02:40:28 GMT 2024

Powered by FUDForum. Page generated in 0.03028 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top