net.finmath.smartcontract.settlement.Settlements Maven / Gradle / Ivy
package net.finmath.smartcontract.settlement;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.List;
import java.util.Optional;
/**
* Collection of settlements.
*/
@XmlRootElement
public class Settlements {
@SuppressWarnings("java:S1700")
private List settlements;
@XmlElement(name = "settlement")
public List getSettlements() {
return settlements;
}
public void setSettlements(List settlements) {
this.settlements = settlements;
}
public Optional getPrevious(Settlement settlement) {
int currentIndex = settlements.indexOf(settlement);
if (currentIndex <= 0) return Optional.empty();
else return Optional.of(settlements.get(currentIndex - 1));
}
public Optional getNext(Settlement settlement) {
int currentIndex = settlements.indexOf(settlement);
if (currentIndex > settlements.size() - 2) return Optional.empty();
else return Optional.of(settlements.get(currentIndex + 1));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy