check draw.
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="edu.tictactoe/src/main/java"/>
|
||||
<classpathentry kind="lib" path="edu.tictactoe/build/libs/edu.tictactoe-1.0.jar"/>
|
||||
<classpathentry kind="lib" path="gradle/wrapper/gradle-wrapper.jar"/>
|
||||
<classpathentry kind="lib" path="/home/sherwinp/eclipse/plugins/org.aspectj.runtime_1.9.25.202512161955.jar"/>
|
||||
<classpathentry kind="output" path="edu.tictactoe/build/classes/aspectj/main"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>tictactoe</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.ajdt.core.ajbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.ajdt.ui.ajnature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -4,6 +4,7 @@
|
||||
plugins {
|
||||
// Apply the java plugin.
|
||||
id 'java'
|
||||
id("io.freefair.aspectj") version "9.2.0"
|
||||
}
|
||||
|
||||
java {
|
||||
@@ -26,6 +27,16 @@ dependencies {
|
||||
implementation("org.aspectj:aspectjrt:1.9.25")
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Automatic-Module-Name':'edu.tictactoe',
|
||||
'Main-Class': 'edu.tictactoe.App',
|
||||
'Class-Path': 'edu.tictactoe org.aspectj.runtime'
|
||||
}
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
}
|
||||
|
||||
tasks.named('jar') {
|
||||
manifest {
|
||||
attributes(
|
||||
|
||||
@@ -84,7 +84,7 @@ public final class Board {
|
||||
}
|
||||
}
|
||||
|
||||
protected ResultEnum checkGamePlay() {
|
||||
public ResultEnum checkGamePlay(BoardButton[] buttons) {
|
||||
|
||||
if ((buttons[0].played && buttons[4].played && buttons[8].played)
|
||||
&&
|
||||
@@ -166,7 +166,7 @@ public final class Board {
|
||||
|
||||
synchronized protected void PlayEventUpdate() {
|
||||
long delay = 0L;
|
||||
ResultEnum checkplays = checkGamePlay();
|
||||
ResultEnum checkplays = checkGamePlay(buttons);
|
||||
|
||||
if (ResultEnum.winner == checkplays) {
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package edu.tictactoe;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public aspect Referee { // call the plays.
|
||||
pointcut PlayEventUpdate(): execution(public * edu.tictactoe.Board.*(..));
|
||||
|
||||
ResultEnum around(BoardButton[] buttons): execution(public * edu.tictactoe.Board.checkGamePlay(BoardButton[])) && args(buttons) && if(buttons!=null)
|
||||
{
|
||||
ResultEnum oval = proceed(buttons);
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(Board.class);
|
||||
|
||||
logger.info(String.format("Checking Board play: %s ", oval));
|
||||
return oval;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package edu.tictactoe;
|
||||
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
|
||||
@Aspect
|
||||
public class Validator {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user