CrxOop CrxOop: Bringing Object Oriented Programming, and Proper Prototype Based Programming, To Javascript
The aim of the library documented below is to provide developers with a solution to allow development using interfaces and classes as they are known in other object oriented programming (OOP) languages such as C++, C#, Java and PHP. Further more, V1.4 introduces structures, a generalization of the concept of prototypal inheritance, known here as POBP.
Subject
Body*
Email
SUBMIT CLOSE
Menu

7.6 crxOop.isStructureContaining

crxOop.isStructureContaining can be used during run time to inspect if pure instances of a structure are a super set of another structure. The function behaves exactly like crxOop.isStructureInheriting, but will return true if a structure is checked against itself. If any of the parameters is not a valid structure definition object, or registered structure name, crxOop.isStructureContaining will issue a fatal error.

JS (Tree)
crx_registerStructure("ExampleStructure1",
{
});

crx_registerStructure("ExampleStructure2",
{
   INHERITS: ["ExampleStructure1"]
});

crx_registerStructure("ExampleStructure3",
{
   INHERITS: ["ExampleStructure2"]
});

console.log((crxOop.isStructureContaining("ExampleStructure1", "ExampleStructure2") ? "true" : "false"));
console.log((crxOop.isStructureContaining("ExampleStructure2", "ExampleStructure1") ? "true" : "false"));
console.log((crxOop.isStructureContaining("ExampleStructure3", "ExampleStructure2") ? "true" : "false"));
console.log((crxOop.isStructureContaining("ExampleStructure3", "ExampleStructure3") ? "true" : "false"));
console.log((crxOop.isStructureContaining("ExampleStructure1", "ExampleStructure3") ? "true" : "false"));
false
true
true
true
false
JS (Verbose)
crx_registerStructure("ExampleStructure1",
{
   "VERBOSE": 1
});

crx_registerStructure("ExampleStructure2",
{
   "VERBOSE": 1,
   INHERITS: ["ExampleStructure1"]
});

crx_registerStructure("ExampleStructure3",
{
   "VERBOSE": 1,
   INHERITS: ["ExampleStructure2"]
});

console.log((crxOop.isStructureContaining("ExampleStructure1", "ExampleStructure2") ? "true" : "false"));
console.log((crxOop.isStructureContaining("ExampleStructure2", "ExampleStructure1") ? "true" : "false"));
console.log((crxOop.isStructureContaining("ExampleStructure3", "ExampleStructure2") ? "true" : "false"));
console.log((crxOop.isStructureContaining("ExampleStructure3", "ExampleStructure3") ? "true" : "false"));
console.log((crxOop.isStructureContaining("ExampleStructure1", "ExampleStructure3") ? "true" : "false"));
false
true
true
true
false