Design Pattern to unify similar generated classes

I have a project where I work with generated classes for some web interfaces. Some of these classes are (almost) identical and most of the functionality I need them for only use the identical parts. Currently that functionality is implemented for each class separately. I want to refactor it in a way that I only have to implement the functionality once, independent of the used classes.

package a; public class Domain{   //some attributes   public String getName(){//impl};   public String getType(){//impl};   public Boolean getDnsSec(){//impl};   //some setters } 
package b; public class Domain{   //some attributes   public String getName(){//impl};   public String getType(){//impl};   public Boolean getIsSecured(){//impl};   public String getLastEditor(){//impl};   //some setters } 
package c; public class Domain{   //some attributes   public String getName(){//impl};   public String getType(){//impl};   public Boolean getDnsSec(){//impl};   //some setters } 

My current idea is to use some kind of adapter pattern but I’m not sure if it’s the right approach and if I’m doing it the correct way. The implementation would look something like this:

public abstract class DomainAdapter <Domain>{   private Domain domain;   public DomainAdapter(Domain domain){     this.domain = domain;   }   public abstract String getName();   public abstract String getType();   public abstract Boolean getDnsSec();   public Domain getDomain(){     return this.domain;   } } 
public DomainAAdapter extends DomainAdapter<a.Domain>{   public DomainGkAdapter(a.Domain domain) {     super(domain);   }   @Override   public String getName() {     return getDomain().getName();   }   @Override   public String getType(){     return getDomain().getType();   };   @Override   public Boolean getDnsSec(){     return getDomain().getDnsSec();   }; } 

I’m wondering if this a good approach, if there is something better I could do or if it’s maybe just wrong what I’m trying to do here. Thanks for the help and feedback in advance.

Multiclassed character with all classes – any reason this can’t be done in 12 levels?

I was recently watching some Youtube gaming videos and came across this one in which the narrator created a character he said was book legal: a 14th level character who had at least one level in each basic class. The player in the video was allowed to make the character as a 14th level character, even though there are 12 classes.

Question: Is there any reason this can’t be done in 12 levels instead of 14?

Assume either point buy or basic array for ability scores, only published races and the base PHB classes allowable. Character must meet all requirements for multiclassing.

Extra love given to an answer that explains the general advantages and disadvantages of doing so.

Writing classes to withstand future business logic changes

I have a processor class AbstractProcessor and multiple concrete classes of the same which gets called in order of the business logic.

public Abstract class AbstractProcessor {    public void doProcess(){} } 

The logic in my concrete classes keeps on changing depending on the business requirement. This leads to change in the corresponding test classes and seems to be a tightly coupled approach. Is there a better way to design such classes.

Add classes to programmatically added fields

I have programmatically created a few content types and fields for said content types in a module I’m building, but I need to add classes to said fields.

So if I have a text field called “background_color”, I would like to add a class to it called “color-picker”.

Im added the instance of the field to my bundle like:

...     'background_color' => array(         'field_name' => $  fields['field_background_color']['field_name'],         'label' => 'The stroke color',         'bundle' => 'nji_map',         'entity_type' => 'node',         'attributes' =>array('class'=>array('minicolors')),         'widget'      => array(             'type'    => 'text_textfield',         ),         'display' => array(             'default' => array(             'label' => 'above',             'type' => 'text_textfield',             ),         ),         'description' => 'The background color is the color between.',      ).... 

Edit – Here is more of my code (node the full code snippet because there are too many fields)..

        $  fields = array(         'field_map_background_color' => array(             'field_name' => 'field_map_background_color',             'type' => 'text'         ),...  $  instances =  array(     'background_color' => array(         'field_name' => $  fields['field_map_background_color']['field_name'],         'label' => 'The background color',         'bundle' => 'nji_map',         'entity_type' => 'node',         'attributes' =>array('class'=>array('minicolors')),         'settings' => array(             'prefix' => '<div class = "minicolors">',             'suffix' => '</div>',         ),         'widget'      => array(             'type'    => 'text_textfield',         ),         'display' => array(             'default' => array(             'label' => 'above',             'type' => 'text_textfield',             ),         ),         'description' => 'The background color is the color between.',      ), ....    foreach ($  fields as $  field) {     field_create_field($  field);   }    foreach ($  instances as $  instance) {     field_create_instance($  instance);   } 

How to name base classes so that it’s most convenient for those extending a framework?

I’m designing a game engine that is supposed to be overridden. I have, for example, a class called Character. Should I prefix this with BaseCharacter or should I expect that whoever uses the framework prefixes their classes with GameNameCharacter or CharacterGameName?

What would be most convenient to you?

What is the geometrical meaning of higher Chern forms and classes?

Let $ M$ be a complex manifold, $ R^{\nabla}$ be the curvature operator for connections $ \nabla$ . Consider a polynomial function $ f:\operatorname M_n(\mathbb{C})\to\mathbb{C}$ . For the gauge group $ \operatorname{GL}_n(\mathbb{C})$ , if $ f(A)=f(gAg^{-1})$ where $ A \in \operatorname M_n(\mathbb{C})$ and $ g \in \operatorname{GL}_n(\mathbb{C})$ , then $ f$ is said to be an invariant polynomial function. Let $ I^k(\operatorname M_n(\mathbb{C}))$ be the set of all such polynomials of degree $ k$ . Also, $ \bigoplus_{k\geq0}I^{k}(\operatorname M_n(\mathbb{C}))=I(\operatorname M_n(\mathbb{C}))$ .

We shall need $ \phi_n(A)=det(A)$ , $ n>1$ , and $ \phi_1(A)=Tr(A)$ .

Define a global differential form ($ 2k$ -form) $ f(R^{\nabla}) \in \mathbb{A}^{2k}(M)$ . If we have the de Rham cohomology group $ H^{2k}(M)$ , then the Weil homomorphism is defined as the map $ \omega:I(\operatorname M_n(\mathbb{C}))\to \bigoplus_{k\geq 0}H^{2k}(M)$ .

The Chern forms $ c_{i}(R^{\nabla})=\phi_{i}(\frac{\sqrt{-1}}{2\pi}R^{\nabla})$ .

For the complex vector bundle $ (\mathbb{E},\pi,M)$ , where $ \mathbb{E}$ is the total space, the Chern classes are defined as $ c_{i}(\mathbb{E}) \in H^{2k}(M)$ .

Therefore $ c_{i}(\mathbb{E})\mathrel{:=}\omega(c_{i}(R^{\nabla}))=[c_{i}(R^{\nabla})]$ (de Rham cohomology class).

The Chern forms $ c_{i}(R^{\nabla}) \in \mathbb{A}^{2i}(\mathbb{E})$ .

$ \mathbb{A}^{2i}(\mathbb{E})$ is sheaf of smooth $ \mathbb{E}$ -valued $ 2i$ for $ M$ .

Cohomology groups are very important in geometry for understanding the invariants that can be defined on manifolds. That is, the transformations that keep some special properties of the manifold and which analogous to the gauge transformations in physics.

Chern classes are special type of cohomology classes. If the first Chern class vanishes for a particular manifold, then it must be a Ricci-flat manifold. For example the Calabi–Yau manifolds (they have lots of other special properties, e.g., trivial canonical bundle, etc.).

But what do the higher Chern classes mean? What uses are those higher cohomology classes corresponding to the higher Chern classes of?

How do I add classes to blocks?

I am using Drupal 8 Panels and it is working fine. The problem currently I have is, that I want to add classes to individual blocks on the panel layout page. Is there a way to add classes to blocks on panel pages?something like the Drupal 7 version of CSS properties on panel panes?

Is Size of conjugacy classes in Finite classical groups polynomials?

Suppose $ G$ is a classical matrix group over a finite field.If $ C$ is any conjugacy class of $ G$ , then is $ |C|$ is a polynomial in $ q$ . This question is encouraged from the fact whenever I have calculated all conjugacy classes and its sizes for very small groups, for example, $ GL_{2}(\mathbb{F}_{q})$ , $ GL_{3}(\mathbb{F}_{q})$ , $ SL_{2}(\mathbb{F}_{q})$ , $ SL_{3}(\mathbb{F}_{q})$ , it does turn out to be polynomials in $ q$ . So, is it true in all finite classical group or at least even in the case of $ GL_n$ or $ SL_n$ ?