private void populateArrayStateActionInstances() { class Object_test1_c implements ClassQueryInterface_c { Object_test1_c(String p) { m_p = p; } private String m_p; public boolean evaluate(Object inst) { ModelClass_c selected = (ModelClass_c) inst; return selected.getName().equals(m_p); } } ModelClass_c obj = ModelClass_c.ModelClassInstance(modelRoot, new Object_test1_c("ArrayOne")); // $NON-NLS-1$ InstanceStateMachine_c ism = InstanceStateMachine_c.getOneSM_ISMOnR518(obj); StateMachine_c sm_i = StateMachine_c.getOneSM_SMOnR517(ism); StateMachineState_c[] states = StateMachineState_c.getManySM_STATEsOnR501(sm_i); Action_c i_acts[] = Action_c.getManySM_ACTsOnR514( ActionHome_c.getManySM_AHsOnR513(MooreActionHome_c.getManySM_MOAHsOnR511(states))); for (int i = 0; i < i_acts.length; ++i) { ActionHome_c ah = ActionHome_c.getOneSM_AHOnR514(i_acts[i]); MooreActionHome_c moah = MooreActionHome_c.getOneSM_MOAHOnR513(ah); StateMachineState_c st = StateMachineState_c.getOneSM_STATEOnR511(moah); if (st.getName().equals("StateOne")) // $NON-NLS-1$ m_arrayStateAction[State_StateOne] = i_acts[i]; else if (st.getName().equals("StateTwo")) // $NON-NLS-1$ m_arrayStateAction[State_StateTwo] = i_acts[i]; else if (st.getName().equals("StateThree")) // $NON-NLS-1$ m_arrayStateAction[State_StateThree] = i_acts[i]; } }
/* (non-Javadoc) * @see junit.framework.TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); if (!firstSetup) { String modelName = "testOAL1"; TestingUtilities.importTestingProjectIntoWorkspace("testOAL1"); project = ResourcesPlugin.getWorkspace().getRoot().getProject("testOAL1"); m_sys = getSystemModel(project.getName()); String modelRootId = Ooaofooa.createModelRootId(project, modelName, true); modelRoot = Ooaofooa.getInstance(modelRootId, true); } firstSetup = true; populateFunctionInstances(); populateBridgeInstances(); class Object_test1_c implements ClassQueryInterface_c { Object_test1_c(String id) { m_id = id; } private String m_id; public boolean evaluate(Object inst) { ModelClass_c selected = (ModelClass_c) inst; return selected.getKey_lett().equals(m_id); } } ModelClass_c diskObj = ModelClass_c.ModelClassInstance(modelRoot, new Object_test1_c("D_D")); // $NON-NLS-1$ ModelClass_c libObj = ModelClass_c.ModelClassInstance(modelRoot, new Object_test1_c("D_H")); // $NON-NLS-1$ populateTransformerInstances(diskObj, false); populateTransformerInstances(libObj, true); populateStateActionInstances(); populateMDAInstances(); }
protected void setUp() throws Exception { super.setUp(); String componentPackageName = "Arrays"; PersistableModelComponent domainComponentPackage = ensureAvailableAndLoaded( projectName, componentPackageName, false, false, "Component Package"); arrayModelRoot = (Ooaofooa) domainComponentPackage.getRootModelElement().getModelRoot(); IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore(); store.setValue(BridgePointPreferencesStore.ALLOW_IMPLICIT_COMPONENT_ADDRESSING, true); class ComponentNameTest implements ClassQueryInterface_c { public boolean evaluate(Object candidate) { Component_c selected = (Component_c) candidate; return selected.getName().equals("SingleDimensionFixedArrays"); } } Component_c comp = Component_c.ComponentInstance(arrayModelRoot, new ComponentNameTest()); populateFunctionInstances(); populateBridgeInstances(); class Object_test1_c implements ClassQueryInterface_c { Object_test1_c(String id) { m_id = id; } private String m_id; public boolean evaluate(Object inst) { ModelClass_c selected = (ModelClass_c) inst; return selected.getKey_lett().equals(m_id); } } ModelClass_c testObj = ModelClass_c.ModelClassInstance(arrayModelRoot, new Object_test1_c("A_T")); // $NON-NLS-1$ populateTransformerInstances(testObj, false); populateInterfaceOperationInstances(comp, "Port1", true); populateInterfaceOperationInstances(comp, "Port2", false); populateArrayStateActionInstances(); }
private void populateStateActionInstances() { class Object_test1_c implements ClassQueryInterface_c { Object_test1_c(String p) { m_p = p; } private String m_p; public boolean evaluate(Object inst) { ModelClass_c selected = (ModelClass_c) inst; return selected.getName().equals(m_p); } } ModelClass_c obj = ModelClass_c.ModelClassInstance(modelRoot, new Object_test1_c("Test")); // $NON-NLS-1$ InstanceStateMachine_c ism = InstanceStateMachine_c.getOneSM_ISMOnR518(obj); StateMachine_c sm_i = StateMachine_c.getOneSM_SMOnR517(ism); StateMachineState_c[] states = StateMachineState_c.getManySM_STATEsOnR501(sm_i); Action_c i_acts[] = Action_c.getManySM_ACTsOnR514( ActionHome_c.getManySM_AHsOnR513(MooreActionHome_c.getManySM_MOAHsOnR511(states))); for (int i = 0; i < i_acts.length; ++i) { ActionHome_c ah = ActionHome_c.getOneSM_AHOnR514(i_acts[i]); MooreActionHome_c moah = MooreActionHome_c.getOneSM_MOAHOnR513(ah); StateMachineState_c st = StateMachineState_c.getOneSM_STATEOnR511(moah); if (st.getName().equals("none")) // $NON-NLS-1$ m_testAction[STATE_ISM_NONE] = i_acts[i]; else if (st.getName().equals("one")) // $NON-NLS-1$ m_testAction[STATE_ISM_ONE] = i_acts[i]; else if (st.getName().equals("two")) // $NON-NLS-1$ m_testAction[STATE_ISM_TWO] = i_acts[i]; else if (st.getName().equals("three")) // $NON-NLS-1$ m_testAction[STATE_ISM_THREE] = i_acts[i]; else if (st.getName().equals("SDTTest")) // $NON-NLS-1$ m_testAction[STATE_ISM_SDTTest] = i_acts[i]; else if (st.getName().equals("SDTMultLvlTest")) // $NON-NLS-1$ m_testAction[STATE_ISM_SDTMultLvlTest] = i_acts[i]; } NewStateTransition_c[] trans = NewStateTransition_c.getManySM_NSTXNsOnR507(Transition_c.getManySM_TXNsOnR505(sm_i)); Action_c[] t_acts = Action_c.getManySM_ACTsOnR514( ActionHome_c.getManySM_AHsOnR513( TransitionActionHome_c.getManySM_TAHsOnR530( Transition_c.getManySM_TXNsOnR507(trans)))); for (int i = 0; i < t_acts.length; ++i) { ActionHome_c ah = ActionHome_c.getOneSM_AHOnR514(t_acts[i]); TransitionActionHome_c tah = TransitionActionHome_c.getOneSM_TAHOnR513(ah); Transition_c tran = Transition_c.getOneSM_TXNOnR530(tah); if (tran.Get_name().contains("none")) // $NON-NLS-1$ m_testAction[TRANS_ISM_NONE] = t_acts[i]; else if (tran.getName().contains("one")) // $NON-NLS-1$ m_testAction[TRANS_ISM_ONE] = t_acts[i]; else if (tran.getName().contains("two")) // $NON-NLS-1$ m_testAction[TRANS_ISM_TWO] = t_acts[i]; else if (tran.getName().contains("three")) // $NON-NLS-1$ m_testAction[TRANS_ISM_THREE] = t_acts[i]; else if (tran.getName().contains("SDTTest")) // $NON-NLS-1$ m_testAction[TRANS_ISM_SDTTest] = t_acts[i]; else if (tran.getName().contains("SDTMultLvlTest")) // $NON-NLS-1$ m_testAction[TRANS_ISM_SDTMultLvlTest] = t_acts[i]; } CreationTransition_c[] crtrs = CreationTransition_c.getManySM_CRTXNsOnR507(Transition_c.getManySM_TXNsOnR505(sm_i)); Action_c[] crt_acts = Action_c.getManySM_ACTsOnR514( ActionHome_c.getManySM_AHsOnR513( TransitionActionHome_c.getManySM_TAHsOnR530( Transition_c.getManySM_TXNsOnR507(crtrs)))); for (int i = 0; i < crt_acts.length; ++i) { ActionHome_c ah = ActionHome_c.getOneSM_AHOnR514(crt_acts[i]); TransitionActionHome_c tah = TransitionActionHome_c.getOneSM_TAHOnR513(ah); Transition_c tran = Transition_c.getOneSM_TXNOnR530(tah); if (tran.Get_name().contains("none")) // $NON-NLS-1$ m_testAction[TRANS_CREATION_ISM_NONE] = crt_acts[i]; else if (tran.getName().contains("one")) // $NON-NLS-1$ m_testAction[TRANS_CREATION_ISM_ONE] = crt_acts[i]; else if (tran.getName().contains("two")) // $NON-NLS-1$ m_testAction[TRANS_CREATION_ISM_TWO] = crt_acts[i]; else if (tran.getName().contains("three")) // $NON-NLS-1$ m_testAction[TRANS_CREATION_ISM_THREE] = crt_acts[i]; else if (tran.getName().contains("SDTTest")) // $NON-NLS-1$ m_testAction[TRANS_CREATION_ISM_SDTTest] = crt_acts[i]; else if (tran.getName().contains("SDTMultLvlTest")) // $NON-NLS-1$ m_testAction[TRANS_CREATION_ISM_SDTMultLvlTest] = crt_acts[i]; } ClassStateMachine_c asm = ClassStateMachine_c.getOneSM_ASMOnR519(obj); StateMachine_c sm_a = StateMachine_c.getOneSM_SMOnR517(asm); states = StateMachineState_c.getManySM_STATEsOnR501(sm_a); Action_c a_acts[] = Action_c.getManySM_ACTsOnR514( ActionHome_c.getManySM_AHsOnR513(MooreActionHome_c.getManySM_MOAHsOnR511(states))); for (int i = 0; i < a_acts.length; ++i) { ActionHome_c ah = ActionHome_c.getOneSM_AHOnR514(a_acts[i]); MooreActionHome_c moah = MooreActionHome_c.getOneSM_MOAHOnR513(ah); if (moah != null) { StateMachineState_c st = StateMachineState_c.getOneSM_STATEOnR511(moah); if (st.getName().equals("one")) // $NON-NLS-1$ m_testAction[STATE_ASM_ONE] = a_acts[i]; else if (st.getName().equals("two")) // $NON-NLS-1$ m_testAction[STATE_ASM_TWO] = a_acts[i]; else if (st.getName().equals("three")) // $NON-NLS-1$ m_testAction[STATE_ASM_THREE] = a_acts[i]; else if (st.getName().equals("SDTTest")) // $NON-NLS-1$ m_testAction[STATE_ASM_SDTTest] = a_acts[i]; else if (st.getName().equals("SDTMultLvlTest")) // $NON-NLS-1$ m_testAction[STATE_ASM_SDTMultLvlTest] = a_acts[i]; } } trans = NewStateTransition_c.getManySM_NSTXNsOnR507(Transition_c.getManySM_TXNsOnR505(sm_a)); t_acts = Action_c.getManySM_ACTsOnR514( ActionHome_c.getManySM_AHsOnR513( TransitionActionHome_c.getManySM_TAHsOnR530( Transition_c.getManySM_TXNsOnR507(trans)))); for (int i = 0; i < t_acts.length; ++i) { ActionHome_c ah = ActionHome_c.getOneSM_AHOnR514(t_acts[i]); TransitionActionHome_c tah = TransitionActionHome_c.getOneSM_TAHOnR513(ah); Transition_c tran = Transition_c.getOneSM_TXNOnR530(tah); if (tran.Get_name().contains("none")) // $NON-NLS-1$ m_testAction[TRANS_CSM_NONE] = t_acts[i]; else if (tran.getName().contains("one")) // $NON-NLS-1$ m_testAction[TRANS_CSM_ONE] = t_acts[i]; else if (tran.getName().contains("two")) // $NON-NLS-1$ m_testAction[TRANS_CSM_TWO] = t_acts[i]; else if (tran.getName().contains("three")) // $NON-NLS-1$ m_testAction[TRANS_CSM_THREE] = t_acts[i]; else if (tran.getName().contains("SDTTest")) // $NON-NLS-1$ m_testAction[TRANS_CSM_SDTTest] = t_acts[i]; else if (tran.getName().contains("SDTMultLvlTest")) // $NON-NLS-1$ m_testAction[TRANS_CSM_SDTMultLvlTest] = t_acts[i]; } obj = ModelClass_c.ModelClassInstance(modelRoot, new Object_test1_c("Test Poly")); // $NON-NLS-1$ ism = InstanceStateMachine_c.getOneSM_ISMOnR518(obj); sm_i = StateMachine_c.getOneSM_SMOnR517(ism); i_acts = Action_c.getManySM_ACTsOnR515(sm_i); for (int i = 0; i < i_acts.length; ++i) { ActionHome_c ah = ActionHome_c.getOneSM_AHOnR514(i_acts[i]); MooreActionHome_c moah = MooreActionHome_c.getOneSM_MOAHOnR513(ah); if (moah != null) { StateMachineState_c st = StateMachineState_c.getOneSM_STATEOnR511(moah); if (st.getName().equals("PolyTwo")) // $NON-NLS-1$ m_testAction[STATE_ISM_POLYTWO] = i_acts[i]; else if (st.getName().equals("PolyOrphaned")) // $NON-NLS-1$ m_testAction[STATE_ISM_POLYORPHANED] = i_acts[i]; } } trans = NewStateTransition_c.getManySM_NSTXNsOnR507(Transition_c.getManySM_TXNsOnR505(sm_i)); t_acts = Action_c.getManySM_ACTsOnR514( ActionHome_c.getManySM_AHsOnR513( TransitionActionHome_c.getManySM_TAHsOnR530( Transition_c.getManySM_TXNsOnR507(trans)))); for (int i = 0; i < t_acts.length; ++i) { ActionHome_c ah = ActionHome_c.getOneSM_AHOnR514(t_acts[i]); TransitionActionHome_c tah = TransitionActionHome_c.getOneSM_TAHOnR513(ah); Transition_c tran = Transition_c.getOneSM_TXNOnR530(tah); StateMachineState_c toState = StateMachineState_c.getOneSM_STATEOnR503( StateEventMatrixEntry_c.getManySM_SEMEsOnR504( NewStateTransition_c.getManySM_NSTXNsOnR507(tran))); if (toState.getName().equals("PolyTwo")) // $NON-NLS-1$ m_testAction[TRANS_ISM_POLYTWO] = t_acts[i]; else if (toState.getName().equals("PolyOrphaned")) // $NON-NLS-1$ m_testAction[TRANS_ISM_POLYORPHANED] = t_acts[i]; } }