Skip to content
Snippets Groups Projects
Select Git revision
  • 3e3e3c0c05a1ad0c2939b16bd5c2fcec1eb51e1a
  • master default protected
  • emoUS
  • add_default_vectorizer_and_pretrained_loading
  • clean_code
  • readme
  • issue127
  • generalized_action_dicts
  • ppo_num_dialogues
  • crossowoz_ddpt
  • issue_114
  • robust_masking_feature
  • scgpt_exp
  • e2e-soloist
  • convlab_exp
  • change_system_act_in_env
  • pre-training
  • nlg-scgpt
  • remapping_actions
  • soloist
20 results

ddpt_agent.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    EditCostPanel.java 3.50 KiB
    /*******************************************************************************
     * Copyright (C) 2017 Philipp Spohr
     * 
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     * 
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     * 
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     * SOFTWARE.
     ******************************************************************************/
    package de.hhu.ba.yoshikoWrapper.gui;
    
    
    import javax.swing.GroupLayout;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.GroupLayout.Alignment;
    
    import org.cytoscape.model.CyColumn;
    
    import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
    
    @SuppressWarnings("serial") //Will never be serialized
    public class EditCostPanel extends JPanel {
    	
    	//SWING COMPONENTS
    	private final ColumnMapper columnMapper;
    	
    	private final DoubleInputField  icField;
    	private final DoubleInputField dcField;
    	
    	private final JLabel icLabel;
    	private final JLabel dcLabel;
    	
    	private final JPanel groupIC;
    	private final JPanel groupDC;
    	
    	public EditCostPanel() {
    
    		//Initialize components
    		columnMapper = new ColumnMapper();
    		
    		icField = new DoubleInputField(Double.NEGATIVE_INFINITY,0);
    		dcField = new DoubleInputField(0,Double.POSITIVE_INFINITY);
    		
    		icField.setText("-1.0");
    		icField.setToolTipText(LocalizationManager.get("icTooltip"));
    		dcField.setText("1.0");
    		
    		icLabel = new JLabel(LocalizationManager.get("defaultInsertion"));
    		dcLabel = new JLabel(LocalizationManager.get("defaultDeletion"));
    		//Group the labels with their text fields
    		groupIC = new JPanel();
    		groupDC = new JPanel();
    
    		SwingUtil.addAll(groupIC,icLabel,icField);
    		SwingUtil.addAll(groupDC,dcLabel,dcField);
    		
    		SwingUtil.addAll(this,columnMapper,groupIC,groupDC);
    
    		
    		//Layout
    		GroupLayout layout = new GroupLayout(this);
    		
    		layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING,true)
    				.addComponent(columnMapper)
    				.addComponent(groupIC)
    				.addComponent(groupDC)
    		);
    		
    		layout.setVerticalGroup(layout.createSequentialGroup()
    				.addComponent(columnMapper)
    				.addComponent(groupIC)
    				.addComponent(groupDC)
    		);
    		
    		this.setLayout(layout);
    		
    	}
    	//SETTER / GETTER
    
    	public CyColumn getWeightColumn() {
    		return columnMapper.getEditingCostColumn();
    	}
    	
    	public CyColumn getPermanentColumn() {
    		return columnMapper.getPermanentColumn();
    	}
    	
    	public CyColumn getForbiddenColumn() {
    		return columnMapper.getForbiddenColumn();
    	}
    
    	public double getDefaultInsertionCost() {
    		return icField.getValueAsDouble();
    	}
    	
    	public double getDefaultDeletionCost() {
    		return dcField.getValueAsDouble();
    	}
    
    	public ColumnMapper getColumnMapper() {
    		return columnMapper;
    	}
    	
    }