Exemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D otherActor)
 {
     if (bCanUseEvents)
     {
         CPrimitiveObject engine_ePO = new CPrimitiveObject();
         engine_ePO.Name        = otherActor.gameObject.name;
         engine_ePO.eObject     = otherActor.gameObject;
         engine_ePO.eCollider2D = otherActor;
         engine_ePO.eTag        = otherActor.transform.tag;
         OnActorBeginOverlap(engine_ePO);
     }
 }
Exemplo n.º 2
0
        protected void Validate(CPrimitiveObject cPrimitiveObject)
        {
            this.Validate((CDefinedObject)cPrimitiveObject);

            Invariant(cPrimitiveObject.AnyAllowed() ^ cPrimitiveObject.Item != null,
                      AmValidationStrings.CPrimitiveObjectAllowAnyXor);

            if (cPrimitiveObject.Item != null)
            {
                this.Validate(cPrimitiveObject.Item);
            }
        }
Exemplo n.º 3
0
 private void OnCollisionExit2D(Collision2D otherActor)
 {
     if (bCanUseEvents)
     {
         CPrimitiveObject engine_ePO = new CPrimitiveObject();
         engine_ePO.Name         = otherActor.gameObject.name;
         engine_ePO.eObject      = otherActor.gameObject;
         engine_ePO.eCollision2D = otherActor;
         engine_ePO.eTag         = otherActor.transform.tag;
         OnActorEndOverlap(engine_ePO);
     }
 }
Exemplo n.º 4
0
        internal static CObject CObject(string typeName)
        {
            DesignByContract.Check.Require(!string.IsNullOrEmpty(typeName), string.Format(CommonStrings.XMustNotBeNullOrEmpty, "typeName"));

            CObject cObject = null;

            switch (typeName)
            {
            case "C_COMPLEX_OBJECT":
                cObject = new CComplexObject();
                break;

            case "C_PRIMITIVE_OBJECT":
                cObject = new CPrimitiveObject();
                break;

            case "ARCHETYPE_INTERNAL_REF":
                cObject = new ArchetypeInternalRef();
                break;

            case "CONSTRAINT_REF":
                cObject = new ConstraintRef();
                break;

            case "ARCHETYPE_SLOT":
                cObject = new ArchetypeSlot();
                break;

            case "C_CODE_PHRASE":
                cObject = new CCodePhrase();
                break;

            case "C_DV_STATE":
                cObject = new CDvState();
                break;

            case "C_DV_ORDINAL":
                cObject = new CDvOrdinal();
                break;

            case "C_DV_QUANTITY":
                cObject = new CDvQuantity();
                break;

            default:
                throw new NotSupportedException("type not supported: " + typeName);
            }

            DesignByContract.Check.Ensure(cObject != null, "cObject must not be null.");

            return(cObject);
        }
Exemplo n.º 5
0
        private static CPrimitiveObject Map(this C_PRIMITIVE_OBJECT model)
        {
            var primitiveObject = new CPrimitiveObject
            {
                AnyAllowed             = model.any_allowed,
                NodeId                 = model.node_id,
                Item                   = model.item.Map(),
                ReferenceModelTypeName = model.rm_type_name,
                Occurences             = model.occurrences.Map()
            };

            return(primitiveObject);
        }
Exemplo n.º 6
0
        private static string GetName(CComplexObject cComplexObject)
        {
            CComplexObject nameAttribute = GetCObjectByAttributeName(cComplexObject, "name") as CComplexObject;

            if (nameAttribute != null)
            {
                CPrimitiveObject cPrimativeObject = GetCObjectByAttributeName(nameAttribute, "value") as CPrimitiveObject;

                Check.Assert(cPrimativeObject != null);

                CString cString = cPrimativeObject.Item as CString;

                Check.Assert(cString != null);

                foreach (string name in cString.List)
                {
                    return(name);
                }
            }

            return(string.Empty);
        }
Exemplo n.º 7
0
        public void testNodeAtPath()
        {
            string adl = System.IO.File.ReadAllText(@"..\..\..\..\java-libs\adl-parser\src\test\resources\adl-test-car.paths.test.adl");

            se.acode.openehr.parser.ADLParser  parser    = new se.acode.openehr.parser.ADLParser(adl);
            org.openehr.am.archetype.Archetype archetype = parser.parse();
            Assert.IsNotNull(archetype);
            CComplexObject definition = archetype.getDefinition();

            String[] paths =
            {
                "/",
                "/wheels[at0001]",
                "/wheels[at0001]/description",
                "/wheels[at0001]/parts[at0002]",
                "/wheels[at0001]/parts[at0002]/something",
                "/wheels[at0001]/parts[at0002]/something_else",
                "/wheels[at0003]",
                "/wheels[at0003]/description",
                "/wheels[at0004]",
                "/wheels[at0004]/description",
                "/wheels[at0005]",
                "/wheels[at0005]/description"
            };

            CAttribute       wheels = (CAttribute)definition.getAttributes().get(0);
            CComplexObject   wheel1 = ((CComplexObject)wheels.getChildren().get(0));
            CComplexObject   wheel2 = ((CComplexObject)wheels.getChildren().get(1));
            CComplexObject   wheel3 = ((CComplexObject)wheels.getChildren().get(2));
            CComplexObject   wheel4 = ((CComplexObject)wheels.getChildren().get(3));
            CAttribute       w      = (CAttribute)wheel1.getAttributes().get(1);
            CComplexObject   parts  = (CComplexObject)w.getChildren().get(0);
            CAttribute       pt     = (CAttribute)parts.getAttributes().get(0);
            CPrimitiveObject pts    = (CPrimitiveObject)pt.getChildren().get(0);
            CAttribute       pt2    = (CAttribute)parts.getAttributes().get(1);
            CPrimitiveObject pts2   = (CPrimitiveObject)pt2.getChildren().get(0);

            CAttribute       h1 = (CAttribute)wheel1.getAttributes().get(0);
            CPrimitiveObject p1 = (CPrimitiveObject)h1.getChildren().get(0);
            CAttribute       h2 = (CAttribute)wheel2.getAttributes().get(0);
            CPrimitiveObject p2 = (CPrimitiveObject)h2.getChildren().get(0);
            CAttribute       h3 = (CAttribute)wheel3.getAttributes().get(0);
            CPrimitiveObject p3 = (CPrimitiveObject)h3.getChildren().get(0);
            CAttribute       h4 = (CAttribute)wheel4.getAttributes().get(0);
            CPrimitiveObject p4 = (CPrimitiveObject)h4.getChildren().get(0);

            CObject[] nodes =
            {
                definition,
                wheel1,
                p1,
                parts,
                pts,
                pts2,
                wheel2,
                p2,
                wheel3,
                p3,
                wheel4,
                p4,
            };

            for (int i = 0; i < paths.Length; i++)
            {
                Assert.AreEqual(nodes[i], archetype.node(paths[i]));
            }
        }
Exemplo n.º 8
0
 public void IsValidValueThrowsException()
 {
     var instance = new CPrimitiveObject();
     var result   = instance.IsValidValue(null);
 }
Exemplo n.º 9
0
 public void DefaultValueThrowsException()
 {
     var instance = new CPrimitiveObject();
     var result   = instance.DefaultValue();
 }
Exemplo n.º 10
0
 public void IsSubsetOfThrowsException()
 {
     var instance = new CPrimitiveObject();
     var result   = instance.IsSubsetOf(null);
 }
Exemplo n.º 11
0
 protected override void OnActorEndOverlap(CPrimitiveObject otherActor)
 {
 }