summaryrefslogtreecommitdiffstats
path: root/src/de/fhswf/in/inf/upnfx/util/ObservableDoubleStack.java
blob: 8fbcc6d68ece2fffa7aee4069a5cc47998c7f386 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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<Double>
{
   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);
   }

}