View Javadoc

1   /*
2    * This file is part of Pease Plate Template Engine.
3    * 
4    * Pease Plate Template Engine is free software: you can redistribute
5    * it and/or modify it under the terms of the GNU Lesser General 
6    * Public License as published by the Free Software Foundation, 
7    * either version 3 of the License, or any later version.
8    * 
9    * Pease Plate Template Engine is distributed in the hope that it 
10   * will be useful, but WITHOUT ANY WARRANTY; without even the implied
11   * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12   * See the GNU Lesser General Public License for more details.
13   * 
14   * You should have received a copy of the GNU Lesser General Public 
15   * License along with Pease Plate Template Engine. If not, see 
16   * <http://www.gnu.org/licenses/>.
17   * 
18   * Copyright (c) 2008 Manfred HANTSCHEL
19   */
20  package org.peaseplate.internal.lang.command;
21  
22  import org.peaseplate.TemplateRuntimeException;
23  import org.peaseplate.internal.BuildContext;
24  import org.peaseplate.locator.TemplateLocator;
25  
26  public abstract class AbstractDoubleParameterCommand extends AbstractCommand {
27  
28  	private final ICommand leftCommand;
29  	private final ICommand rightCommand;
30  	
31  	public AbstractDoubleParameterCommand(TemplateLocator locator, int line, int column, ICommand leftCommand, ICommand rightCommand) {
32  		super(locator, line, column);
33  		
34  		this.leftCommand = leftCommand;
35  		this.rightCommand = rightCommand;
36  	}
37  
38  	public ICommand getLeftCommand() {
39  		return leftCommand;
40  	}
41  
42  	public ICommand getRightCommand() {
43  		return rightCommand;
44  	}
45  
46  	public Object callLeftCommand(BuildContext context) throws TemplateRuntimeException {
47  		return getLeftCommand().call(context);
48  	}
49  	
50  	public Object callRightCommand(BuildContext context) throws TemplateRuntimeException {
51  		return getRightCommand().call(context);
52  	}
53  
54  }