330 likes | 510 Views
JMario. Equipe Augusto Cesar Neves Lima Filho. JMario. Jogo usando Java2D Fiel ao clássico Mario para snes. Feature Model. Feature Model. public void init(){ ... imagemInterfacePontuacao = resourceManager.loadImage( "interfacePontuacao.png");
E N D
JMario Equipe Augusto Cesar Neves Lima Filho
JMario Jogo usando Java2D Fiel ao clássico Mario para snes
public void init(){ ... imagemInterfacePontuacao = resourceManager.loadImage( "interfacePontuacao.png"); imagemInterfaceTotal = resourceManager.loadImage( "interfaceTotal.png"); imagemInterfacePausa = resourceManager.loadImage( "interfacePausa.png" ); } Feature - Language
Feature - Language privilegedabstractaspect LanguageSupport { ... private Image GameManager.loadImageLang (String name, String language) { ... } pointcut resourceInit(GameManager gm) : execution(* *.init()) && ... protectedabstract String getLanguageCode(); after(GameManager gm) returning : resourceInit(gm){ gm.imagemInterfacePontuacao = gm.loadImageLang("interfacePontuacao.png", getLanguageCode ()); ... } } ... aspect EnglishSupport extends LanguageSupport{ protected String getLanguage(){ return "US"; }
Feature – Changeable Language privileged aspect ChangeLanguageAspect ... private LanguageStrategy GameManager.languageStrategy; private LanguageFactory GameManager.languageFactory = new LanguageFactory(); before(GameManager gm) : checkInput(gm){ if (gm.language.isPressed()) { ... } } ... privatevoid GameManager.changeLanguage() { languageStrategy = languageFactory.createLanguageStrategy(); imagemInterfacePontuacao = languageStratrategy.loadImageLang("interfacePontuacao.png"); ... }
Feature Model publicvoid loadCreatureSprites() { ... Image[][] imagensBat = new Image[4][]; Image[][] imagensTurtle = new Image[4][]; Image[][] imagensMummyTurtle = new Image[4][]; Image[][] imagensBlueDragon = new Image[4][]; ... imagensFlyGoomba[1] = new Image[imagensFlyGoomba[0].length]; imagensFlyGoomba[2] = new Image[imagensFlyGoomba[0].length]; imagensFlyGoomba[3] = new Image[imagensFlyGoomba[0].length]; imagensGoomba[1] = new Image[imagensGoomba[0].length]; imagensGoomba[2] = new Image[imagensGoomba[0].length]; imagensGoomba[3] = new Image[imagensGoomba[0].length]; imagensGreenKoopa[1] = new Image[imagensGreenKoopa[0].length]; imagensGreenKoopa[2] = new Image[imagensGreenKoopa[0].length]; imagensGreenKoopa[3] = new Image[imagensGreenKoopa[0].length]; ...
Feature Model Técnica : Code Generation and Transformation (CGT)
Feature – Static Enemy publicvoid loadCreatureSprites() { #foreach($enemy in $enemys) Image[][] imagens$enemy.Name = new Image[4][]; #end ... #foreach($enemy in $enemys) imagens$enemy.Name[ 1 ] = new Image[ imagens$enemy. Name[ 0 ].length ]; imagens$enemy.Name[ 2 ] = new Image[ imagens$enemy. Name[ 0 ].length ]; imagens$enemy.Name[ 3 ] = new Image[ imagens$enemy. Name[ 0 ].length ]; #end ...
Feature – Static Enemy <?xml version="1.0"?> <Enemys> <Enemy NAME="Goomba" CODIGO="1" SPEED="0.1" FLYER="false"> <Frame NAME="goomba1.png"/> <Frame NAME="goomba2.png"/> </Enemy> <Enemy NAME="Fly Goomba" CODIGO="2" SPEED="0.1" FLYER="false"> <Frame NAME="flyGoomba1.png"/> <Frame NAME="flyGoomba2.png"/> </Enemy> ...
Gráfico de Clones Redução : 54%
Feature Model Técnica : Adaptive Object Model (AOM)
Feature: User-Defined enemys publicvoid loadCreatureSprites() { XMLEnemyHandler handler = new XMLEnemyHandler(); ... List<EnemyDescription> enemys = handler.getEnemys(); for (int i = 0; i < enemys.size(); i++) { EnemyDescription enemyDescription = enemys.get(i); ... EnemyType enemyType = new EnemyType(enemyDescription.getCodigo(), enemyDescription.getName(), enemyDescription.getSpeed(), enemyDescription.isFlyer()); ...
Feature: User-Defined enemys //#ifdef aom import variations.EnemyType; //#endif //#ifdef aom publicclass Creature extends Sprite { //#else //@public abstract class Creature extends Sprite { //#endif
Dificuldades Uso de técnicas não definidas diretamente em decision models Flip-Pure-Variants
Conclusões • Uso de diversas técnicas em uma mesma variação • Uso extensivo de AO