Class Metrics
- java.lang.Object
-
- page.codeberg.terratactician_expandoria.world.Metrics
-
public class Metrics extends java.lang.Object
Metrics aka Resources. This class will be used for multiple metrics values relevant to the game.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Metrics
clone()
static Metrics
deserialize(org.json.JSONObject data)
deserializes metrics from a json object.double
getFood()
get food component.double
getMaterials()
get materials component.double
getMoney()
get money componentboolean
isSmallerEqThen(Metrics other)
Check is the metrics are smaller or equal than another metrics object.org.json.JSONObject
serialize()
serializes Metrics to jsonjava.lang.String
toString()
-
-
-
Constructor Detail
-
Metrics
public Metrics()
Create empty metrics object.
-
Metrics
public Metrics(Metrics other)
Copy the metrics- Parameters:
other
- metrics to copy
-
-
Method Detail
-
deserialize
public static Metrics deserialize(org.json.JSONObject data)
deserializes metrics from a json object.- Parameters:
data
- json data- Returns:
- deserialized metrics
-
serialize
public org.json.JSONObject serialize()
serializes Metrics to json- Returns:
- json object
-
getFood
public double getFood()
get food component.- Returns:
- amount
-
getMaterials
public double getMaterials()
get materials component.- Returns:
- amount
-
getMoney
public double getMoney()
get money component- Returns:
- amount
-
isSmallerEqThen
public boolean isSmallerEqThen(Metrics other)
Check is the metrics are smaller or equal than another metrics object.- Parameters:
other
- to compare to- Returns:
- if is smaller/equal
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
clone
public Metrics clone()
- Overrides:
clone
in classjava.lang.Object
-
-