@Override
	public Value caseAMapCompMapExp(AMapCompMapExp node, Context ctxt)
			throws AnalysisException
	{
		BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt);
		ValueMap map = new ValueMap();

		try
		{
			QuantifierList quantifiers = new QuantifierList();

			for (PMultipleBind mb : node.getBindings())
			{
				ValueList bvals = ctxt.assistantFactory.createPMultipleBindAssistant().getBindValues(mb, ctxt, false);

				for (PPattern p : mb.getPlist())
				{
					Quantifier q = new Quantifier(p, bvals);
					quantifiers.add(q);
				}
			}

			quantifiers.init(ctxt, false);

			while (quantifiers.hasNext())
			{
				Context evalContext = new Context(ctxt.assistantFactory, node.getLocation(), "map comprehension", ctxt);
				NameValuePairList nvpl = quantifiers.next();
				boolean matches = true;

				for (NameValuePair nvp : nvpl)
				{
					Value v = evalContext.get(nvp.name);

					if (v == null)
					{
						evalContext.put(nvp.name, nvp.value);
					} else
					{
						if (!v.equals(nvp.value))
						{
							matches = false;
							break; // This quantifier set does not match
						}
					}
				}

				if (matches
						&& (node.getPredicate() == null || node.getPredicate().apply(VdmRuntime.getExpressionEvaluator(), evalContext).boolValue(ctxt)))
				{
					Value dom = node.getFirst().getLeft().apply(VdmRuntime.getExpressionEvaluator(), evalContext);
					Value rng = node.getFirst().getRight().apply(VdmRuntime.getExpressionEvaluator(), evalContext);
					node.getFirst().getLocation().hit();

					Value old = map.put(dom, rng);

					if (old != null && !old.equals(rng))
					{
						VdmRuntimeError.abort(node.getLocation(), 4016, "Duplicate map keys have different values: "
								+ dom, ctxt);
					}
				}
			}
		} catch (ValueException e)
		{
			return VdmRuntimeError.abort(node.getLocation(), e);
		}

		return new MapValue(map);
	}
@ Override public Value caseAMapCompMapExp ( AMapCompMapExp node , Context ctxt ) throws AnalysisException { BreakpointManager . getBreakpoint ( node ) . check ( node . getLocation ( ) , ctxt ) ; ValueMap map = new ValueMap ( ) ; try { QuantifierList quantifiers = new QuantifierList ( ) ; for ( PMultipleBind mb : node . getBindings ( ) ) { ValueList bvals = ctxt . assistantFactory . createPMultipleBindAssistant ( ) . getBindValues ( mb , ctxt , false ) ; for ( PPattern p : mb . getPlist ( ) ) { Quantifier q = new Quantifier ( p , bvals ) ; quantifiers . add ( q ) ; } } quantifiers . init ( ctxt , false ) ; while ( quantifiers . hasNext ( ) ) { Context evalContext = new Context ( ctxt . assistantFactory , node . getLocation ( ) , "map comprehension" , ctxt ) ; NameValuePairList nvpl = quantifiers . next ( ) ; boolean matches = true ; for ( NameValuePair nvp : nvpl ) { Value v = evalContext . get ( nvp . name ) ; if ( v == null ) { evalContext . put ( nvp . name , nvp . value ) ; } else { if ( ! v . equals ( nvp . value ) ) { matches = false ; break ; } } } if ( matches && ( node . getPredicate ( ) == null || node . getPredicate ( ) . apply ( VdmRuntime . getExpressionEvaluator ( ) , evalContext ) . boolValue ( ctxt ) ) ) { Value dom = node . getFirst ( ) . getLeft ( ) . apply ( VdmRuntime . getExpressionEvaluator ( ) , evalContext ) ; Value rng = node . getFirst ( ) . getRight ( ) . apply ( VdmRuntime . getExpressionEvaluator ( ) , evalContext ) ; node . getFirst ( ) . getLocation ( ) . hit ( ) ; Value old = map . put ( dom , rng ) ; if ( old != null && ! old . equals ( rng ) ) { VdmRuntimeError . abort ( node . getLocation ( ) , 4016 , "Duplicate map keys have different values: " + dom , ctxt ) ; } } } } catch ( ValueException e ) { return VdmRuntimeError . abort ( node . getLocation ( ) , e ) ; } return new MapValue ( map ) ; }
/*
Map