Skip to content
This repository has been archived by the owner on Aug 18, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1 from evolutionsoftswiss/develop
Browse files Browse the repository at this point in the history
Develop merge to main
  • Loading branch information
evolutionsoftswiss authored Jan 17, 2021
2 parents fc0ea60 + f2971cf commit d5d6197
Show file tree
Hide file tree
Showing 83 changed files with 1,884 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/target/
/.classpath
/.settings/
/.project
/home/
/.metadata/
Binary file added lib/libpoker-eval.so
Binary file not shown.
Binary file added lib/libpokerjni.so
Binary file not shown.
Binary file added lib/pokersource-1.0.jar
Binary file not shown.
153 changes: 153 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
<?xml version="1.0"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ch.evolutionsoft.poker.calucator</groupId>
<artifactId>poker-calculator</artifactId>
<packaging>war</packaging>
<name>poker-calculator</name>
<version>1.0.0</version>

<build>

<plugins>

<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
<warName>poker-calculator</warName>
</configuration>
</plugin>
</plugins>

</build>


<dependencies>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>javax.faces-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.2.20</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.liferay.faces</groupId>
<artifactId>com.liferay.faces.bridge.ext</artifactId>
<version>6.0.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.liferay.faces</groupId>
<artifactId>com.liferay.faces.bridge.impl</artifactId>
<version>4.1.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces</artifactId>
</dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces-ace</artifactId>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>com.liferay.portal.kernel</artifactId>
<version>9.19.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jni</artifactId>
<version>9.0.37</version>
</dependency>

<dependency>
<groupId>ch.evolutionsoft.poker</groupId>
<artifactId>pokersource</artifactId>
<version>1.0</version>
</dependency>

</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces</artifactId>
<version>4.3.0</version>
<exclusions>
<exclusion>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
</exclusion>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>javax.activation</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces-ace</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>org.icepush</groupId>
<artifactId>icepush</artifactId>
<version>4.3.0</version>
<exclusions>
<exclusion>
<artifactId>jsp-api</artifactId>
<groupId>javax.servlet.jsp</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>

</project>
84 changes: 84 additions & 0 deletions src/main/java/ch/evolutionsoft/poker/calculator/model/Board.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package ch.evolutionsoft.poker.calculator.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.pokersource.game.Deck;

public class Board implements Serializable {

private static final long serialVersionUID = -5358787319613157298L;
private List<Card> cards = new ArrayList<Card>();

public Board() {

this.init();
}

public void init() {

cards.add(new Card());
cards.add(new Card());
cards.add(new Card());
cards.add(new Card());
cards.add(new Card());
}

public List<Card> getCards() {

return this.cards;
}

public boolean hasValidSize() {

int numberOfBoardCards = this.getValidCardsNumber();

return numberOfBoardCards == 0 || numberOfBoardCards >= 3 && numberOfBoardCards <= 5;
}

public int getValidCardsNumber() {

int number = 0;

for (Card card : this.cards) {

String cardValue = card.getValue();
if (cardValue != null && Card.isValidValue(cardValue)) {

number++;
}
}
return number;
}

public long parseBoard() {

String stringValue = this.toString();

if (!stringValue.isEmpty()) {

return Deck.parseCardMask(stringValue);
}
return 0L;
}

public void removeCard(int index) {

this.cards.get(index).setValue(null);
}

public String toString() {

String result = "";
for (Card card : this.cards) {
if (card.getValue() != null && card.isValid()) {
result += card.toString() + " ";
}
}
if (result.length() > 1) {
return result.substring(0, result.length() - 1);
}
return result;
}
}
Loading

0 comments on commit d5d6197

Please sign in to comment.