function varargout = Real_Option_Calculator(varargin)
% REAL_OPTION_CALCULATOR M-file for Real_Option_Calculator.fig
%      REAL_OPTION_CALCULATOR, by itself, creates a new REAL_OPTION_CALCULATOR or raises the existing
%      singleton*.
%
%      H = REAL_OPTION_CALCULATOR returns the handle to a new REAL_OPTION_CALCULATOR or the handle to
%      the existing singleton*.
%
%      REAL_OPTION_CALCULATOR('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in REAL_OPTION_CALCULATOR.M with the given input arguments.
%
%      REAL_OPTION_CALCULATOR('Property','Value',...) creates a new REAL_OPTION_CALCULATOR or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before Real_Option_Calculator_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to Real_Option_Calculator_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help Real_Option_Calculator

% Last Modified by GUIDE v2.5 04-May-2009 14:34:48

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @Real_Option_Calculator_OpeningFcn, ...
                   'gui_OutputFcn',  @Real_Option_Calculator_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before Real_Option_Calculator is made visible.
function Real_Option_Calculator_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to Real_Option_Calculator (see VARARGIN)

% Choose default command line output for Real_Option_Calculator
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes Real_Option_Calculator wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = Real_Option_Calculator_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;



function InvestmentCost_edit_Callback(hObject, eventdata, handles)
% hObject    handle to InvestmentCost_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of InvestmentCost_edit as text
%        str2double(get(hObject,'String')) returns contents of InvestmentCost_edit as a double


% --- Executes during object creation, after setting all properties.
function InvestmentCost_edit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to InvestmentCost_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function MaintenanceCost_edit_Callback(hObject, eventdata, handles)
% hObject    handle to MaintenanceCost_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of MaintenanceCost_edit as text
%        str2double(get(hObject,'String')) returns contents of MaintenanceCost_edit as a double


% --- Executes during object creation, after setting all properties.
function MaintenanceCost_edit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to MaintenanceCost_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function DisposalCost_edit_Callback(hObject, eventdata, handles)
% hObject    handle to DisposalCost_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of DisposalCost_edit as text
%        str2double(get(hObject,'String')) returns contents of DisposalCost_edit as a double


% --- Executes during object creation, after setting all properties.
function DisposalCost_edit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to DisposalCost_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function CycleDuration_edit_Callback(hObject, eventdata, handles)
% hObject    handle to CYcleDuration_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of CYcleDuration_edit as text
%        str2double(get(hObject,'String')) returns contents of CYcleDuration_edit as a double


% --- Executes during object creation, after setting all properties.
function CycleDuration_edit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to CYcleDuration_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function Demand_edit_Callback(hObject, eventdata, handles)
% hObject    handle to Demand_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of Demand_edit as text
%        str2double(get(hObject,'String')) returns contents of Demand_edit as a double


% --- Executes during object creation, after setting all properties.
function Demand_edit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Demand_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function UpFactor_edit_Callback(hObject, eventdata, handles)
% hObject    handle to UpFactor_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of UpFactor_edit as text
%        str2double(get(hObject,'String')) returns contents of UpFactor_edit as a double


% --- Executes during object creation, after setting all properties.
function UpFactor_edit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to UpFactor_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function CostOfPlace_edit_Callback(hObject, eventdata, handles)
% hObject    handle to CostOfPlace_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of CostOfPlace_edit as text
%        str2double(get(hObject,'String')) returns contents of CostOfPlace_edit as a double


% --- Executes during object creation, after setting all properties.
function CostOfPlace_edit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to CostOfPlace_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function DownFactor_edit_Callback(hObject, eventdata, handles)
% hObject    handle to DownFactor_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of DownFactor_edit as text
%        str2double(get(hObject,'String')) returns contents of DownFactor_edit as a double


% --- Executes during object creation, after setting all properties.
function DownFactor_edit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to DownFactor_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function ModifyContent_edit_Callback(hObject, eventdata, handles)
% hObject    handle to ModifyContent_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of ModifyContent_edit as text
%        str2double(get(hObject,'String')) returns contents of ModifyContent_edit as a double


% --- Executes during object creation, after setting all properties.
function ModifyContent_edit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ModifyContent_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function InterestRate_edit_Callback(hObject, eventdata, handles)
% hObject    handle to InterestRate_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of InterestRate_edit as text
%        str2double(get(hObject,'String')) returns contents of InterestRate_edit as a double


% --- Executes during object creation, after setting all properties.
function InterestRate_edit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to InterestRate_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function LaborCost_edit_Callback(hObject, eventdata, handles)
% hObject    handle to LaborCost_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of LaborCost_edit as text
%        str2double(get(hObject,'String')) returns contents of LaborCost_edit as a double


% --- Executes during object creation, after setting all properties.
function LaborCost_edit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to LaborCost_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function Amount_edit_Callback(hObject, eventdata, handles)
% hObject    handle to Amount_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of Amount_edit as text
%        str2double(get(hObject,'String')) returns contents of Amount_edit as a double


% --- Executes during object creation, after setting all properties.
function Amount_edit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Amount_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function EnergyCost_edit_Callback(hObject, eventdata, handles)
% hObject    handle to EnergyCost_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of EnergyCost_edit as text
%        str2double(get(hObject,'String')) returns contents of EnergyCost_edit as a double


% --- Executes during object creation, after setting all properties.
function EnergyCost_edit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to EnergyCost_edit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in GenerateTree_pushbutton.
function GenerateTree_pushbutton_Callback(hObject, eventdata, handles)
% hObject    handle to GenerateTree_pushbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


cycleDur = get(handles.CycleDuration, 'String');
 demand   = get(handles.Demand, 'String');
 up       = get(handles.UpFActor, 'String');
 down     = get(handles.DownFactor, 'String');
interestRate = get(handles.InterestRate, 'String');
 
 startKalkulation(str2double(cycleDur), str2double(demand), str2double(up), str2double(down), str2double(interestRate));
 
 guidata(hObject, handles);





% --- Executes on button press in Edit_pushbutton.
function Edit_pushbutton_Callback(hObject, eventdata, handles)
% hObject    handle to Edit_pushbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in Investment_checkbox.
function Investment_checkbox_Callback(hObject, eventdata, handles)
% hObject    handle to Investment_checkbox (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of Investment_checkbox


% --- Executes on button press in Underlying_checkbox.
function Underlying_checkbox_Callback(hObject, eventdata, handles)
% hObject    handle to Underlying_checkbox (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of Underlying_checkbox


