From d8cd813ddc54c455eb3071795038b97b72dc1ee9 Mon Sep 17 00:00:00 2001 From: Stefan Suhren Date: Tue, 9 Jun 2015 09:13:55 +0200 Subject: Add working version of UpnFx --- .../in/inf/upnfx/util/ObservableDoubleStack.java | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/de/fhswf/in/inf/upnfx/util/ObservableDoubleStack.java (limited to 'src/de/fhswf/in/inf/upnfx/util/ObservableDoubleStack.java') diff --git a/src/de/fhswf/in/inf/upnfx/util/ObservableDoubleStack.java b/src/de/fhswf/in/inf/upnfx/util/ObservableDoubleStack.java new file mode 100644 index 0000000..8fbcc6d --- /dev/null +++ b/src/de/fhswf/in/inf/upnfx/util/ObservableDoubleStack.java @@ -0,0 +1,40 @@ +/** + * + */ + +package de.fhswf.in.inf.upnfx.util; + +import javafx.beans.property.SimpleListProperty; +import javafx.collections.FXCollections; + +/** + * An observable list that has the Stack methods. + * + * @author Stefan Suhren + * @version 1.0 + */ +public class ObservableDoubleStack extends SimpleListProperty +{ + public ObservableDoubleStack() + { + super(FXCollections.observableArrayList()); + } + + public Double peek() + { + return get(size() - 1); + } + + public Double pop() + { + Double ret = get(size() - 1); + remove(size() - 1); + return ret; + } + + public void push(Double item) + { + add(item); + } + +} -- cgit v1.2.3-70-g09d2