Commit a1f19621 authored by Mathieu Féry (Mathius)'s avatar Mathieu Féry (Mathius)
Browse files

Merge branch 'api' into jonctApiFront

parents 8e9cf566 b3dc47f1
Pipeline #23352 failed with stages
in 2 minutes and 34 seconds
......@@ -55,6 +55,7 @@ dependencies {
implementation 'com.koushikdutta.ion:ion:3.1.0'
implementation 'com.google.android.gms:play-services-base:17.5.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'org.apache.commons:commons-lang3:3.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
......
......@@ -3,6 +3,8 @@ package fr.iutnantes.miar.dndgenerator.api.dnd;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.io.Serializable;
/**
......@@ -51,7 +53,8 @@ public class DnDAttr implements Serializable {
*/
@Override
public int hashCode() {
return nameAttr.hashCode() * value.hashCode();
return new HashCodeBuilder(1, 3)
.append(nameAttr.hashCode()).append(value.hashCode()).toHashCode();
}
/**
......
......@@ -3,6 +3,8 @@ package fr.iutnantes.miar.dndgenerator.api.dnd;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.io.Serializable;
/**
......@@ -54,11 +56,12 @@ public class DnDSaves implements Serializable {
*/
@Override
public int hashCode() {
return (wands != null ? wands.hashCode() : 1)
* (breath != null ? breath.hashCode() : 1)
* (stone != null ? stone.hashCode() : 1)
* (magic != null ? magic.hashCode() : 1)
* (poison != null ? poison.hashCode() : 1);
return new HashCodeBuilder(5, 7)
.append(wands != null ? wands.hashCode() : 1)
.append(breath != null ? breath.hashCode() : 1)
.append(stone != null ? stone.hashCode() : 1)
.append(magic != null ? magic.hashCode() : 1)
.append(poison != null ? poison.hashCode() : 1).toHashCode();
}
/**
......
......@@ -13,6 +13,8 @@ import com.google.gson.JsonObject;
import com.koushikdutta.async.future.SimpleFuture;
import com.koushikdutta.ion.Ion;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Comparator;
......@@ -297,20 +299,16 @@ public class DnDSheet implements Serializable {
*/
@Override
public int hashCode() {
return (hp != null ? hp.hashCode() : 1)
* (thac9 != null ? thac9.hashCode() : 1)
* (ac != null ? ac.hashCode() : 1)
* (appearance != null ? appearance.hashCode() : 1)
* caracterClass.hashCode()
* (personality != null ? personality.hashCode() : 1)
* system.hashCode()
* languages.hashCode()
* equipment.hashCode()
* notes.hashCode()
* spells.hashCode()
* saves.hashCode()
* attr.hashCode()
* skills.hashCode();
return new HashCodeBuilder(9, 11)
.append(hp != null ? hp.hashCode() : 1)
.append(thac9 != null ? thac9.hashCode() : 1)
.append(ac != null ? ac.hashCode() : 1)
.append(appearance != null ? appearance.hashCode() : 1)
.append(caracterClass.hashCode())
.append(personality != null ? personality.hashCode() : 1)
.append(system.hashCode()).append(languages.hashCode()).append(equipment.hashCode())
.append(notes.hashCode()).append(spells.hashCode()).append(saves.hashCode())
.append(attr.hashCode()).append(skills.hashCode()).toHashCode();
}
/**
......
......@@ -3,6 +3,8 @@ package fr.iutnantes.miar.dndgenerator.api.dnd;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.io.Serializable;
/**
......@@ -40,7 +42,8 @@ public class DnDSkill implements Serializable {
*/
@Override
public int hashCode() {
return skillName.hashCode() * value.hashCode();
return new HashCodeBuilder(13, 15)
.append(skillName.hashCode()).append(value.hashCode()).toHashCode();
}
/**
......
......@@ -65,7 +65,7 @@ public class DnDSavesDB extends BaseDB {
static {
PRIMARY_KEY = Vars._ID;
TABLE_NAME = Vars.TABLE_NAME;
DATABASE_VERSION = 1;
DATABASE_VERSION = DnDSheetDB.DATABASE_VERSION;
DATABASE_NAME = TABLE_NAME;
List<String> tempInt = new ArrayList<>();
tempInt.add(Vars.WANDS);
......
......@@ -85,7 +85,7 @@ public class DnDSheetDB extends BaseDB {
static {
PRIMARY_KEY = Vars._ID;
TABLE_NAME = Vars.TABLE_NAME;
DATABASE_VERSION = 3;
DATABASE_VERSION = 5;
DATABASE_NAME = TABLE_NAME;
List<String> tempInt = new ArrayList<>();
tempInt.add(Vars.HP);
......
......@@ -2,6 +2,8 @@ package fr.iutnantes.miar.dndgenerator.api.tenor;
import androidx.annotation.NonNull;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.io.Serializable;
import java.util.List;
......@@ -64,6 +66,7 @@ public class Dimension implements Serializable {
*/
@Override
public int hashCode() {
return width.hashCode() * height.hashCode();
return new HashCodeBuilder(17, 19)
.append(width).append(height).toHashCode();
}
}
......@@ -2,6 +2,8 @@ package fr.iutnantes.miar.dndgenerator.api.tenor;
import androidx.annotation.NonNull;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.io.Serializable;
/**
......@@ -58,4 +60,27 @@ public class GIFArtifact implements Serializable {
this.mediaFilter = mediaFilter;
this.filterContent = filterContent;
}
/**
* For compare Any Object with this artifact.
* @param obj : Object for comparison
* @return equals
*/
@Override
public boolean equals(Object obj) {
if (obj != null && obj.getClass() == this.getClass())
return this.hashCode() == obj.hashCode();
else
return false;
}
/**
* For identify artifact.
* @return hashCode
*/
@Override
public int hashCode() {
return new HashCodeBuilder(21, 23)
.append(query.hashCode()).append(mediaFilter.hashCode())
.append(filterContent.hashCode()).toHashCode();
}
}
......@@ -3,6 +3,8 @@ package fr.iutnantes.miar.dndgenerator.api.tenor;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.io.Serializable;
import java.util.List;
......@@ -105,6 +107,8 @@ public class MediaObject implements Serializable {
*/
@Override
public int hashCode() {
return url.hashCode() * preview.hashCode() * dims.hashCode();
return new HashCodeBuilder(25, 27)
.append(url.hashCode()).append(preview.hashCode()).append(dims.hashCode())
.toHashCode();
}
}
......@@ -13,6 +13,7 @@ import java.util.ArrayList;
import java.util.List;
import fr.iutnantes.miar.dndgenerator.api.BaseDB;
import fr.iutnantes.miar.dndgenerator.api.dnd.models.DnDSheetDB;
import fr.iutnantes.miar.dndgenerator.api.tenor.FilterContent;
import fr.iutnantes.miar.dndgenerator.api.tenor.GIFArtifact;
import fr.iutnantes.miar.dndgenerator.api.tenor.MediaFilter;
......@@ -69,7 +70,7 @@ public class GIFArtifactDB extends BaseDB {
static {
PRIMARY_KEY = Vars._ID;
TABLE_NAME = Vars.TABLE_NAME;
DATABASE_VERSION = 1;
DATABASE_VERSION = DnDSheetDB.DATABASE_VERSION;
DATABASE_NAME = TABLE_NAME;
List<String> tempInt = new ArrayList<>();
tempInt.add(Vars.MEDIA_FILTER_ID);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment