Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property not attached to flow spec instance for instance root component #1815

Closed
reteprelief opened this issue May 20, 2019 · 1 comment
Closed

Comments

@reteprelief
Copy link
Contributor

@reteprelief reteprelief commented May 20, 2019

The top level system type has two flow specs. One has the property in {} the other assigned by applies to within the type.
Only the {} property gets attached.
You have a component type with the same setup but it is used as subcomponent.
In this case both flow instances have the property.

package NoFlowProps
public
	abstract Air
		features
			outp: out data port ;
			outp1: out data port ;
		flows
			fs: flow source outp ;  -- property in instance
			fs1: flow source outp1 {Latency => 10 ms .. 15 ms;} ; -- property in instance
		properties
			Latency => 10 ms .. 15 ms applies to fs;
	end Air;
	system Top
		features
			outp: out data port ;
			outp1: out data port ;
		flows
			fs: flow source outp ;  -- LOOK HERE: no property in instance
			fs1: flow source outp1 {Latency => 10 ms .. 15 ms;} ; -- property in instance
		properties
			Latency => 10 ms .. 15 ms applies to fs;
	end Top;
	system implementation Top.impl
		subcomponents
			a1: abstract air; 
	end Top.impl;
	
end NoFlowProps;```
See attached example.
[NoFlowProperties.txt](https://github.com/osate/osate2/files/3195902/NoFlowProperties.txt)

@AaronGreenhouse
Copy link
Contributor

@AaronGreenhouse AaronGreenhouse commented Jun 18, 2019

The problem was that while CachedContainedPropertyAssociations.caseComponentInstance() searches both the component type and component implementation of the component instance, caseSystemInstance() only searched the component implementation of the system instance. I have changed the method from

		@Override
		public String caseSystemInstance(final SystemInstance si) {
			if (monitor.isCanceled()) {
				cancelTraversal();
				return DONE;
			}
			monitor.subTask("Caching system instance contained property associations");
			processContainedPropertyAssociations(si, si, si.getComponentImplementation().getAllPropertyAssociations());
			// TODO: Insert hooks here
			return DONE;
		}

to

		@Override
		public String caseSystemInstance(final SystemInstance si) {
			if (monitor.isCanceled()) {
				cancelTraversal();
				return DONE;
			}
			monitor.subTask("Caching system instance contained property associations");
			// N.B. System instance must be associated with a system implementation, so this will never be null
			final ComponentImplementation ci = si.getComponentImplementation();
			processContainedPropertyAssociations(si, si, ci.getType().getAllPropertyAssociations());
			processContainedPropertyAssociations(si, si, ci.getAllPropertyAssociations());
			// TODO: Insert hooks here
			return DONE;
		}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants