public AttributeCallExp createAttributeCallExp( OclExpression source, CoreAttribute attribute, bool isMarkedPre) { AttributeCallExp exp = new AttributeCallExpImpl(); exp.setFactory(this); exp.setSource(isMarkedPre ? createAtPreOperation(source) : source); exp.setReferredAttribute(attribute); CoreClassifier expType; if (attribute.isOclDefined()) { expType = attribute.getFeatureType(); } else { expType = attribute.getModel() != null?attribute.getModel().toOclType(attribute.getFeatureType()) : attribute.getFeatureType(); } exp.setType(((AttributeCallExpImpl)exp).getExpressionType(source, expType)); if (source != null) { ((OclExpressionImpl)source).setAppliedProperty(exp); } return(exp); }
protected void updateQualifiers(CoreAssociationEnd owner, CoreAttribute newQualifier) { List <object> qualifiers = owner.getQualifier(); qualifiers.Add(newQualifier); owner.setQualifier(qualifiers); }
public BizBoxInfoControl(CoreAttribute attributes) { InitializeComponent(); CoreNameLabel.Text = attributes.CoreName; if (!string.IsNullOrEmpty(attributes.Author)) { CoreAuthorLabel.Text = "authors: " + attributes.Author; } else { CoreAuthorLabel.Visible = false; } CorePortedLabel.Text = attributes.Ported ? " (Ported)" : ""; if (!attributes.Ported) { CoreUrlLink.Visible = false; } else { CoreUrlLink.Visible = true; CoreUrlLink.Text = attributes.PortedVersion; url = attributes.PortedUrl; } }
private void createAssociationEnd(XNamespace xnamespace, CoreAssociation coreAssociation, XElement xassociationend) { CoreAssociationEnd coreAssociationEnd = new CoreAssociationEndImpl(); coreAssociationEnd.setName(xassociationend.Attribute("name").Value); coreAssociationEnd.setAssociation(coreAssociation); coreAssociationEnd.setOrdering(getOrderingKind(xassociationend.Attribute("ordering").Value)); updateConnection(coreAssociation, coreAssociationEnd); var xqualifiernamespace = xassociationend.Element(xnamespace + "AssociationEnd.qualifier"); if (xqualifiernamespace != null) { var xqualifiers = xqualifiernamespace.Elements(xnamespace + "Attribute"); foreach (var xqualifier in xqualifiers) { CoreAttribute qualifier = createAttribute(null, coreAssociationEnd, xqualifier); updateQualifiers(coreAssociationEnd, qualifier); } } var multiplicity = createMultiplicity(xnamespace, xassociationend); coreAssociationEnd.setMultiplicity(multiplicity); var id = xassociationend.Attribute("xmi.id").Value; lookup.Add(id, coreAssociationEnd); var xtyperefid = xassociationend.Attribute("type").Value; idToType.Add(id, xtyperefid); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Title,Type,Unit,Required")] CoreAttribute coreAttribute) { if (id != coreAttribute.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(coreAttribute); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CoreAttributeExists(coreAttribute.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(coreAttribute)); }
public void testAttributeDerive() { AstOclConstraintFactory factory1 = AstOclConstraintFactoryManager.getInstance(umlModel.getOclPackage()); AstOclModelElementFactory factory2 = AstOclModelElementFactoryManager.getInstance(umlModel.getOclPackage()); IntegerLiteralExp exp1 = factory2.createIntegerLiteralExp(100, getClassifier("Integer")); ExpressionInOcl expInOcl = factory1.createExpressionInOcl("name", getClassifier("Film"), exp1); OclAttributeDeriveConstraint constraint = (OclAttributeDeriveConstraint)factory1.createAttributeDeriveConstraint("test.ocl", getClassifier("Film"), getClassifier("Film").lookupAttribute("rentalFee"), expInOcl); Assert.AreEqual("derive: 100", constraint.ToString()); OclConstraint c = getClassifier("Film").getDeriveConstraint("rentalFee"); Assert.AreEqual(constraint, c); CoreAttribute attrib = getClassifier("Film").lookupAttribute("rentalFee"); Assert.IsNotNull(attrib); Assert.AreEqual(expInOcl, attrib.getDerivedValueExpression()); Assert.IsTrue(attrib.isDerived()); getClassifier("Film").deleteAllConstraintsForSource("test.ocl"); Assert.IsNull(getClassifier("Film").getDeriveConstraint("rentalFee")); }
/* (non-Javadoc) * @see br.cos.ufrj.lens.odyssey.tools.psw.metamodels.core.interfaces.CoreClassifier#conformsTo(br.cos.ufrj.lens.odyssey.tools.psw.metamodels.core.interfaces.CoreClassifier) */ public override bool conformsTo(CoreClassifier c) { if (c.getName().Equals("OclAny")) { return(true); } if (!(c is TupleTypeImpl)) { return(false); } TupleType typeToMatch = (TupleType)c; if (this.getTupleParts().Count != typeToMatch.getTupleParts().Count) { return(false); } List <object> tupleTypes = new List <object>(getTupleParts()); for (int i = 0; i < tupleTypes.Count; i++) { TuplePartType element = (TuplePartType)tupleTypes[i]; CoreAttribute elementFound = typeToMatch.lookupAttribute(element.getName()); if (elementFound == null || !element.getFeatureType().conformsTo(elementFound.getFeatureType())) { return(false); } } return(true); }
//被开启时的初始化过程 //传进当前核心 public void BulletStart(uint s_Speed, float s_FlyDistance, float s_DemageNums, float s_HardStraight = 0, float s_BeatBack = 0, string s_GunName = "AK47Gun", CoreAttribute s_coreAttributeBullet = CoreAttribute.Initial) { Speed = s_Speed; FlyDistance = s_FlyDistance; DemageNums = s_DemageNums; GunName = s_GunName; StartFly = Flying = true; coreAttributeBullet = s_coreAttributeBullet; HardStraight = s_HardStraight; BeatBack = s_BeatBack; switch (bulletBelongTo) { case BulletBelongTo.Player: //是否【核心的子弹】攻击判断 if (isCoreAttack) { m_ObjectPoolName = "Bullet/Core/" + coreAttributeBullet + "/"; } else { m_ObjectPoolName = "Bullet/" + GunName + "/"; } break; case BulletBelongTo.Enemy: m_ObjectPoolName = "Bullet/Enemy/"; break; } //产生子弹与枪口特效 GenerateProjectileAndMuzzleParticles(); }
/// <summary> /// 装备核心 /// </summary> public void CoreDrop() { //当前武器已经装配 if (CheckCoreIsTaking(_coreIndex)) { return; } //------------------------------------------- m_CurrentCorePos.sprite = m_AllCore[_coreIndex]; m_CurrentCoreTextPos.sprite = m_AllCoreText[_coreIndex]; //数据修改 CoreAttribute oldCoreAttribute = m_CurrentCoreType; //修改装备栏核心类型 m_CurrentCoreType = (CoreAttribute)_coreIndex; //开启装备的核心的Equipped m_AllCoreShow[_coreIndex].transform.GetChild(4).gameObject.SetActive(true); //关闭之前武器的Equipped m_AllCoreShow[(int)oldCoreAttribute].transform.GetChild(4).gameObject.SetActive(false); //血管有关 //修改血管 ChangeCoreSliderNums(_coreIndex); DestroyImmediate(m_AllCopyDraggingCore[_coreIndex]); }
public async Task <IActionResult> Create([Bind("Id,Name,Title,Type,Unit,Required")] CoreAttribute coreAttribute) { if (ModelState.IsValid) { _context.Add(coreAttribute); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(coreAttribute)); }
public void testNewAttributeOK_02() { doTestContextNotOK("context Film def: newAttr : Integer = true", getCurrentMethodName()); CoreClassifier film = (CoreClassifier)environment.lookup("Film"); CoreAttribute attr = (CoreAttribute)film.lookupAttribute("newAttr"); Assert.IsNotNull(attr); Assert.AreEqual("Integer", attr.getFeatureType().getName()); Assert.IsNull(film.getDeriveConstraint("newAttr")); }
private void ProcessConstructor(Type type, string system, CoreAttribute coreattr, ConstructorInfo cons) { Core core = new Core(coreattr.CoreName, type, cons); List <Core> ss; if (!systems.TryGetValue(system, out ss)) { ss = new List <Core>(); systems.Add(system, ss); } ss.Add(core); }
public CoreAttribute createSpecificAttribute(CoreClassifier classifier, String name, CoreClassifier type) { CorePackage mainPackage = (CorePackage)classifier.getModel().getMainPackage(); CoreAttribute attribute = null; //CoreAttribute attribute = mainPackage.getFoundation().getCore().getAttribute(); //attribute.setName(name); //attribute.setNamespace((CoreClassifier) classifier); //attribute.setType((CoreClassifier) type); return((CoreAttribute)attribute); }
public CoreAttribute createOclDefinedAttribute(string source, string name, CoreClassifier type) { CoreAttribute oclDefinedAttribute = classifier.getModel().getOclPackage().getConstraints().getOclDefinedAttribute().createOclDefinedAttribute(); oclDefinedAttribute.setFeatureOwner(classifier); oclDefinedAttribute.setFeatureType(type); oclDefinedAttribute.setName(name); ((OclDefinedAttributeImpl)oclDefinedAttribute).setSource(source); createdFeatures.Add(oclDefinedAttribute); return(oclDefinedAttribute); }
private int deleteAllDefinedElements(string sourceName) { List <object> namesToBeRemovedFromEnvironment = new List <object>(); int result = 0; List <CoreFeature> elementsToBeRemoved; this.definedFeaturesBySource.TryGetValue(sourceName, out elementsToBeRemoved); if (elementsToBeRemoved != null) { foreach (CoreFeature modelElement in elementsToBeRemoved) { if (modelElement is CoreAttributeImpl) { CoreAttribute attr = (CoreAttribute)modelElement; namesToBeRemovedFromEnvironment.Add(attr.getName()); } else { CoreOperation oper = (CoreOperation)modelElement; namesToBeRemovedFromEnvironment.Add( CoreModelElementNameGeneratorImpl.getInstance().generateNameForOperation(oper.getName(), new List <object>(oper.getParametersTypesExceptReturn()))); } } result = elementsToBeRemoved.Count; foreach (string element in namesToBeRemovedFromEnvironment) { CoreFeature coreFeature; bool foudbefore = this.definedFeatures.TryGetValue(element, out coreFeature); this.definedFeatures.Remove(element); bool foundafter = this.definedFeatures.TryGetValue(element, out coreFeature); } if (this.definedFeaturesBySource.ContainsKey(sourceName)) { this.definedFeaturesBySource[sourceName] = new List <CoreFeature>(); } else { this.definedFeaturesBySource.Add(sourceName, new List <CoreFeature>()); } } return(result); }
public void testAttributeCallExp() { AstOclModelElementFactory factory1 = AstOclModelElementFactoryManager.getInstance(umlModel.getOclPackage()); VariableDeclaration variable = factory1.createVariableDeclaration("abc", getClassifier("Film"), null); VariableExp source1 = factory1.createVariableExp(variable); VariableExp source2 = factory1.createVariableExp(variable); CoreAttribute attribute = getClassifier("Film").lookupAttribute("name"); AttributeCallExp exp1 = factory1.createAttributeCallExp(source1, attribute, false); AttributeCallExp exp2 = factory1.createAttributeCallExp(source2, attribute, true); Assert.AreEqual("abc.name", exp1.ToString()); Assert.AreEqual("String", exp1.getType().getName()); Assert.AreEqual("abc.name@pre", exp2.ToString()); Assert.AreEqual("String", exp2.getType().getName()); }
public Core(Type type, CoreConstructorAttribute consAttr, CoreAttribute coreAttr, ConstructorInfo ctor) { Name = coreAttr.CoreName; Type = type; CTor = ctor; Priority = consAttr.Priority; CoreAttr = coreAttr; var pp = CTor.GetParameters(); if (pp.Length == 1 && pp[0].ParameterType.IsGenericType && pp[0].ParameterType.GetGenericTypeDefinition() == typeof(CoreLoadParameters <,>) ) { _useCoreLoadParameters = true; SettingsType = pp[0].ParameterType.GetGenericArguments()[0]; SyncSettingsType = pp[0].ParameterType.GetGenericArguments()[1]; return; } for (int i = 0; i < pp.Length; i++) { var p = pp[i]; string pName = p.Name.ToLowerInvariant(); if (pName == "settings") { if (p.ParameterType == typeof(object)) { throw new InvalidOperationException($"Setting and SyncSetting constructor parameters for {type} must be annotated with the actual type"); } SettingsType = p.ParameterType; } else if (pName == "syncsettings") { if (p.ParameterType == typeof(object)) { throw new InvalidOperationException($"Setting and SyncSetting constructor parameters for {type} must be annotated with the actual type"); } SyncSettingsType = p.ParameterType; } _paramMap.Add(pName, i); } }
public override bool conformsTo(CoreClassifier type) { if (!(type is TupleTypeImpl)) { return(false); } TupleType targetType = (TupleType)type; foreach (VariableDeclaration declaration in getTuplePart()) { CoreAttribute targetElementType = targetType.lookupAttribute(declaration.getVarName()); if ((targetElementType == null) || (!declaration.getType().conformsTo(targetElementType.getFeatureType()))) { return(false); } } return(true); }
public void testDefAttribute() { getClassifier("Film").addDefinedElement("test.ocl", "myNewAttr", getClassifier("Integer")); try { getClassifier("Film").addDefinedElement("test.ocl", "myNewAttr", getClassifier("Integer")); throw new AssertFailedException(); } catch (Exception e) {} try { getClassifier("Product").addDefinedElement("test.ocl", "myNewAttr", getClassifier("Integer")); throw new AssertFailedException(); } catch (Exception e) {} try { getClassifier("Film").addDefinedElement("test.ocl", "name", getClassifier("Integer")); throw new AssertFailedException(); } catch (Exception e) {} CoreAttribute attr = getClassifier("Film").lookupAttribute("myNewAttr"); Assert.AreEqual("Integer", attr.getFeatureType().getName()); Assert.IsTrue(attr.isOclDefined()); CoreAttribute nameAttr = getClassifier("Film").lookupAttribute("name"); Assert.AreEqual("String", nameAttr.getFeatureType().getName()); Assert.IsFalse(nameAttr.isOclDefined()); getClassifier("Film").deleteAllConstraintsForSource("test.ocl"); Assert.IsNull(getClassifier("Film").lookupAttribute("myNewAttr")); }
public BizBoxInfoControl(CoreAttribute attributes) { InitializeComponent(); CoreNameLabel.Text = attributes.CoreName; if (!string.IsNullOrEmpty(attributes.Author)) { CoreAuthorLabel.Text = $"authors: {attributes.Author}"; } else { CoreAuthorLabel.Visible = false; } if (attributes is PortedCoreAttribute ported) { CorePortedLabel.Text = " (Ported)"; _url = ported.PortedUrl; CoreUrlLink.Text = ported.PortedVersion; CoreUrlLink.Visible = true; } }
public void testIterateExp() { AstOclModelElementFactory factory1 = AstOclModelElementFactoryManager.getInstance(umlModel.getOclPackage()); VariableDeclaration variable = factory1.createVariableDeclaration("abc", getClassifier("Distributor"), null); VariableExp source = factory1.createVariableExp(variable); VariableDeclaration iter = factory1.createVariableDeclaration("iter", getClassifier("SpecialFilm"), null); VariableExp iterRef = factory1.createVariableExp(iter); CoreAttribute attr = getClassifier("SpecialFilm").lookupAttribute("lateReturnFee"); AttributeCallExp attCall = factory1.createAttributeCallExp(iterRef, attr, false); IntegerLiteralExp initExp = factory1.createIntegerLiteralExp(100, getClassifier("Integer")); VariableDeclaration result = factory1.createVariableDeclaration("result", getClassifier("Integer"), initExp); List <object> paramTypes = new List <object>(); paramTypes.Add(getClassifier("Integer")); CoreOperation oper = getClassifier("Integer").lookupOperation("+", paramTypes); VariableExp resultExp = factory1.createVariableExp(result); List <object> args = new List <object>(); args.Add(attCall); OclExpression body = factory1.createOperationCallExp(resultExp, oper, args, getClassifier("Integer"), false); List <object> iterators = new List <object>(); iterators.Add(iter); IterateExp exp = factory1.createIterateExp(getClassifier("Integer"), source, body, iterators, result); Assert.AreEqual("abc->iterate(iter : SpecialFilm ; result : Integer = 100 | result + iter.lateReturnFee)", exp.ToString()); Assert.AreEqual("Integer", exp.getType().getName()); }
public ILAttribute(CoreAttribute attr, ILInterface ifa, CoreModel model) { this.Core = attr; this.ParentInterface = ifa; this.coreModel = model; IsPrimaryKey = attr.IsPrimaryKey; IsCalcualted = attr.IsCalculated; if (attr is CoreRefAttribute) { var refAttr = (CoreRefAttribute)attr; var baseAttr = refAttr.ReferencedAttribute; CDataType = baseAttr.DataType; if (string.IsNullOrEmpty(refAttr.Alias)) { Name = $"{baseAttr.ParentInterface.Name}_{baseAttr.Name}"; } else { Name = $"{refAttr.Alias}_{baseAttr.ParentInterface.Name}_{baseAttr.Name}"; } PrepareDataTypeAndParams(baseAttr.DataType, baseAttr.Length, baseAttr.Decimals); } else { var baseAttr = (CoreBaseAttribute)attr; CDataType = baseAttr.DataType; Name = $"{baseAttr.ParentInterface.Name}_{baseAttr.Name}"; PrepareDataTypeAndParams(baseAttr.DataType, baseAttr.Length, baseAttr.Decimals); } if (IsPrimaryKey) { DataTypeParameters += " not null"; } }
public void testIteratorExp() { AstOclModelElementFactory factory1 = AstOclModelElementFactoryManager.getInstance(umlModel.getOclPackage()); VariableDeclaration variable = factory1.createVariableDeclaration("abc", getClassifier("Distributor"), null); VariableExp source = factory1.createVariableExp(variable); VariableDeclaration iter = factory1.createVariableDeclaration("iter", getClassifier("SpecialFilm"), null); VariableExp iterRef = factory1.createVariableExp(iter); CoreAttribute attr = getClassifier("SpecialFilm").lookupAttribute("name"); AttributeCallExp body = factory1.createAttributeCallExp(iterRef, attr, false); CoreClassifier setSpecialFilm = factory1.createSetType(getClassifier("SpecialFilm")); List <object> iterators = new List <object> (); iterators.Add(iter); IteratorExp exp = factory1.createIteratorExp("select", setSpecialFilm, source, body, iterators); Assert.AreEqual("abc->select(iter : SpecialFilm | iter.name)", exp.ToString()); Assert.AreEqual("Set(SpecialFilm)", exp.getType().getName()); }
public OclConstraint createAttributeDeriveConstraint(string source, CoreClassifier contextualClassifier, CoreAttribute attribute, ExpressionInOcl initialValue) { OclAttributeDeriveConstraint constraint = new OclAttributeDeriveConstraintImpl(); constraint.setSource(source); constraint.setContextualClassifier(contextualClassifier); constraint.setDerivedAttribute(attribute); constraint.setExpression(initialValue); contextualClassifier.addDeriveConstraint(attribute.getName(), constraint); attribute.setDerivedValueExpression(initialValue); // cachedObjects.add(constraint); return(constraint); }
/** * @param referredAttribute The referredAttribute to set. */ public void setReferredAttribute(CoreAttribute referredAttribute) { this.referredAttribute = referredAttribute; }
/** * @param derivedAttribute The derivedAttribute to set. */ public void setDerivedAttribute(CoreAttribute derivedAttribute) { this.derivedAttribute = derivedAttribute; }
/** * @param initializedAttribute The initializedAttribute to set. */ public void setInitializedAttribute(CoreAttribute initializedAttribute) { this.initializedAttribute = initializedAttribute; }
public void setAttribute(CoreAttribute attribute) { this.attribute = attribute; }
private void ProcessConstructor(Type type, CoreConstructorAttribute consAttr, CoreAttribute coreAttr, ConstructorInfo cons) { Core core = new Core(coreAttr.CoreName, type, cons, consAttr.Priority); if (!_systems.TryGetValue(consAttr.System, out var ss)) { ss = new List <Core>(); _systems.Add(consAttr.System, ss); } ss.Add(core); }
IEnumerator GetInfo() { yield return(new WaitForSeconds(0.5f)); while (true) { yield return(null); playerRobotContral = GameManager.Instance.PRC; m_CurrentHP = playerRobotContral._mPlayerRobot.CurrentHp; m_CurrentMP = playerRobotContral._mPlayerRobot.CurrentMp; m_CurrentMAXHP = playerRobotContral._mPlayerRobot.MaxHp; m_CurrentMAXMP = playerRobotContral._mPlayerRobot.MaxMp; MAXHPMPPercent = m_CurrentMAXHP / (m_CurrentMAXHP + m_CurrentMAXMP) * 1.0f; m_CurrentCoreElement = playerRobotContral._mPlayerRobot.Core.Element; m_CurrentLeftGunType = WeaponManager.Instance.CurrentLeftGunType; m_CurrentRightGunType = WeaponManager.Instance.RightGunType; //赋值 LeftGunPos.sprite = WeaponGuns[(int)m_CurrentLeftGunType]; if (m_CurrentRightGunType != GunType.Null) { RightGunPos.sprite = WeaponGuns[(int)m_CurrentRightGunType]; } else { RightGunPos.sprite = WeaponGuns[7]; } CoreAttribute currentCoreAttribute = CoreAttribute.Initial; switch (m_CurrentCoreElement) { case BaseCore.CoreElement.Primary: currentCoreAttribute = CoreAttribute.Initial; break; case BaseCore.CoreElement.Fire: currentCoreAttribute = CoreAttribute.Fire; break; case BaseCore.CoreElement.Amethyst: currentCoreAttribute = CoreAttribute.Amethyst; break; case BaseCore.CoreElement.Ice: currentCoreAttribute = CoreAttribute.Frozen; break; } Corepos.sprite = Cores[(int)currentCoreAttribute]; MainSlider[0].maxValue = MainSlider[1].maxValue = m_CurrentMAXMP + m_CurrentMAXHP; MainSlider[0].value = m_CurrentMAXHP; MainSlider[1].value = m_CurrentMAXMP; HPSlider.maxValue = m_CurrentMAXHP; MPSlider.maxValue = m_CurrentMAXMP; HPSlider.value = m_CurrentHP; MPSlider.value = m_CurrentMP; PartNums.text = WeaponManager.Instance.PartNums.ToString(); } }