class-hierarchy

How to build recursive predicates/functions in Alloy

*爱你&永不变心* 提交于 2019-12-11 11:51:22
问题 I am trying to generate in Alloy two sets of classes, for instance, classes before a refactoring application and classes after a refactoring application. Suppose in the first set we have the following classes: ALeft -> BLeft -> CLeft Class1 Class2 -> Class3 -> Class4 meaning that ALeft is the parent of BLeft which in turn is the parent of CLeft, Class1 and Class2, which in turn is the parent of Class3 and Class4. On the other hand, following the same reasoning, we have in the second set the

Best Way to Refactor Class Hierarchy

浪尽此生 提交于 2019-12-11 05:29:39
问题 I have a class CGrandMother having a public method virtual bool Compute() that does virtual bool Compute() { return false; } From CGrandMother derives publicly CMother which does not implement Compute . Now from CMother derive publicly C1 and C2 that do implement virtual bool Compute() . Now virtual bool C1::Compute() and virtual bool C2::Compute() respectively do a lot of stuff proper to respectively C1 and to C2 , but also a lot of identical stuff proper to CMother . Now there's a class

Retrieve only the superclass from a class hierarchy

三世轮回 提交于 2019-12-10 16:38:14
问题 I have an scenario as the following: @Entity @Table(name = "ANIMAL") @Inheritance(strategy = InheritanceType.JOINED) public class Animal implements Serializable { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "S_ANIMAL") @SequenceGenerator(name = "S_ANIMAL", sequenceName = "S_ANIMAL", allocationSize = 1) public int getNumero() { return numero; } public void setNumero(int numero) { this.numero = numero; } . . . } and as the subclass: @Entity @Table(name = "DOG") public

Can anonymous modules and class be nested in Ruby?

蓝咒 提交于 2019-12-10 06:54:33
问题 I can define an anonymous class within an anonymous module: c = nil m = Module.new do c = Class.new end m #=> #<Module:0x007fad3a055660> c #=> #<Class:0x007fad3a0555e8> Is the above equivalent to: m = Module.new c = Class.new In other words: does the concept of "nesting" actually apply to anonymous modules? 回答1: It is not about being anonymous. Assigning a dynamically created class to a constant makes it named: Foo = Class.new # => Foo foo = Class.new # => #<Class:0x007fe5dd45d650> Yet it

Tool to Show Class Hierarchies in .NET

对着背影说爱祢 提交于 2019-12-10 02:06:57
问题 Is there a way/tool that could show me all the classes/interfaces that implement a certain interface in my project? In Eclipse (Java) I would use the context menu "Open Type Hierarchy" option, which would show me a (pretty) tree of types that extend the selected type. Is there a tool to do the same in .NET? 回答1: I second Marc's recommendation of .NET Reflector - and would like to add that there is an impressive series of add-in available at CodePlex. Just a few of the add-ins I use with

Java: Superclass and subclass

匆匆过客 提交于 2019-12-08 03:55:04
问题 Can a subclass variable be cast to any of its superclasses? Can a superclass variable be assigned any subclass variable? Can a superclass be assigned any variable? If so, can an interface variable be assigned a variable from any implementing class? 回答1: Are all dogs also animals? Are all animals also dogs? If you need an animal, and I give you a dog, is that always acceptable? If you need a dog specifically, but I give you any animal, can that ever be problematic? If you need something you

What is the opposite of c++ `override` / `final` specifier?

梦想的初衷 提交于 2019-12-06 23:57:30
问题 In c++11 the override specifier protects from not overriding an intended virtual base function (because the signatures do not match). The final specifier protects from unintentionally overriding a function in a derived class. => Is there a specifier (something like maybe first or no_override ) that protects from overriding an unknown base function? I'd like to get a compiler error when a virtual function was added to a base class with the same signature as an already existing virtual function

Common Lisp class hierarchy

五迷三道 提交于 2019-12-06 11:40:19
问题 Greg Pfeil's Class Hierarchy diagram provides a comprehensive picture the Common Lisp type system. But I'm trying to better understand the class relationships at the top of the hierarchy. For a simple example, let (defstruct person name age) , and then (defparameter *p1* (make-person :name "Yosh" :age 19) . Now (typep *p1* 'person) T (typep *p1* 'structure) T (typep *p1* 'structure-object) T (typep *p1* 'atom) T (typep *p1* t) T The Hyperspec says the precedence list for structure-object is

How to link “parallel” class hierarchy?

我是研究僧i 提交于 2019-12-06 05:11:34
问题 I've got a little class hierarchy where each class corresponds to a certain TComponent descendent (say base class TDefaultFrobber with descendents TActionFrobber and TMenuItemFrobber, corresponding to TComponent, TCustomAction and TMenuItem, respectively). Now I want a factory (?) function something like this: function CreateFrobber(AComponent: TComponent): IFrobber; begin if AComponent is TCustomAction then Result := TActionFrobber.Create(TCustomAction(AComponent)) else if AComponent is

Create inheritance graphs/trees for Django templates

隐身守侯 提交于 2019-12-06 02:03:45
问题 Is there any tool out there that would take a directory with a Django application, scan it for templates and draw/print/list a hierarchy of inheritance between templates? Seeing which blocks are being overridden at every level would be an especially helpful feature in such a tool. 回答1: Old question but FWIW there is (or was) django-template-graph that should work with Django 1.7. It doesn't (yet) work with Django 1.8+ when the template logic changed a bit so it needs to be patched, I opened