Package org.eclipse.sapphire.modeling.el

Examples of org.eclipse.sapphire.modeling.el.FunctionContext


{
    @Test
   
    public void testWithArray()
    {
        FunctionContext context;
       
        context = new TestFunctionContext( new Object[] {} );
        testForExpectedValue( context, "${ Avg( Collection ) }", new BigDecimal( "0" ) );

        context = new TestFunctionContext( new Object[] { "1" } );
View Full Code Here


   
    @Test
   
    public void testWithList()
    {
        FunctionContext context;
       
        context = new TestFunctionContext( list() );
        testForExpectedValue( context, "${ Avg( Collection ) }", new BigDecimal( "0" ) );

        context = new TestFunctionContext( list( "1" ) );
View Full Code Here

   
    @Test
   
    public void testWithSet()
    {
        FunctionContext context;
       
        context = new TestFunctionContext( set() );
        testForExpectedValue( context, "${ Avg( Collection ) }", new BigDecimal( "0" ) );

        context = new TestFunctionContext( set( "1" ) );
View Full Code Here

    public void testWithModelElementList()
    {
        final TestModelRoot root = TestModelRoot.TYPE.instantiate();
        final ElementList<TestModelElementA> list = root.getList1();
        final FunctionContext context = new ModelElementFunctionContext( root );
       
        TestModelElementA a;
       
        testForExpectedValue( context, "${ Avg( List1 ) }", new BigDecimal( "0" ) );
        testForExpectedValue( context, "${ Avg( List1, 'Value1' ) }", new BigDecimal( "0" ) );
View Full Code Here

{
    @Test
   
    public void test()
    {
        final FunctionContext context = new FunctionContext();
       
        // Increasing the scale.
       
        testForExpectedValue( context, "${ Scale( 2, 1 ) }", new BigDecimal( "2.0" ) );
        testForExpectedValue( context, "${ Scale( 2, 2 ) }", new BigDecimal( "2.00" ) );
View Full Code Here

        final int[] intArray = new int[] { 1, 2 };
        final long[] longArray = new long[] { 1, 2 };
        final float[] floatArray = new float[] { 1, 2 };
        final double[] doubleArray = new double[] { 1, 2 };
       
        final FunctionContext context = new FunctionContext()
        {
            @Override
            public FunctionResult property( final Object element,
                                            final String name )
            {
View Full Code Here

    @Test
   
    public void EqualityOperator_ElementProperty_Null()
    {
        final TestElement element = TestElement.TYPE.instantiate();
        final FunctionContext context = new ModelElementFunctionContext( element );
       
        final FunctionResult fr = ExpressionLanguageParser.parse( "${ ChildElement == null }" ).evaluate( context );
       
        try
        {
View Full Code Here

{
    @Test
   
    public void testVersionMatchesFunction()
    {
        final FunctionContext context = new FunctionContext();
       
        testForExpectedValue( context, "${ VersionMatches( '1.2.3', '[1.2.3-2.0)' ) }", Boolean.TRUE );
        testForExpectedValue( context, "${ VersionMatches( '3.5', '[1.2.3-2.0)' ) }", Boolean.FALSE );
    }
View Full Code Here

   
    @Test
   
    public void testSapphireVersionMatchesFunction()
    {
        final FunctionContext context = new FunctionContext();
       
        testForExpectedValue( context, "${ SapphireVersionMatches( '[9.0-9.0.1)' ) }", Boolean.TRUE );
        testForExpectedValue( context, "${ SapphireVersionMatches( '[0.5-0.6)' ) }", Boolean.FALSE );
    }
View Full Code Here

    @Test
   
    public void testHeadFunction()
    {
        final TestElement element = TestElement.TYPE.instantiate();
        final FunctionContext context = new ModelElementFunctionContext( element );
       
        FunctionResult fr = ExpressionLanguageParser.parse( "${ Value.Head( 3 ) }" ).evaluate( context );
       
        try
        {
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.modeling.el.FunctionContext

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.