<commit_before>//-----BEGIN DISCLAIMER-----
/*******************************************************************************
* Copyright (c) 2011, 2020 JCrypTool Team and Contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
//-----END DISCLAIMER-----
package org.jcryptool.visual.secretsharing.views;

import java.math.BigInteger;
import java.text.MessageFormat;
import java.util.Vector;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Path;
import org.eclipse.swt.graphics.PathData;
import org.eclipse.swt.graphics.Transform;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Spinner;
import org.eclipse.swt.widgets.Text;
import org.jcryptool.core.util.colors.ColorService;
import org.jcryptool.core.util.fonts.FontService;
import org.jcryptool.visual.secretsharing.algorithm.Point;
import org.jcryptool.visual.secretsharing.algorithm.ShamirsSecretSharing;
import org.jcryptool.visual.secretsharing.views.Constants;

public class ShamirsSecretSharingComposite extends Composite {

	private Group groupSecretSharing;
	private Button resetButton;
	private Label reconstructPxLabel;
	private StyledText stValue;
	private Group groupShares;
	private ScrolledComposite scrolledShares;
	private Composite compositeShares;
	private Composite sharesButtonComposite;
	private Button selectAllButton;
	private Button deselectAllButton;
	private Group groupParameter;
	private Label numberOfConcernedLabel;
	private Spinner spnrN;
	private Label numberForReconstructionLabel;
	private Spinner spnrT;
	private Label modulLabel;
	private Text modulText;
	private VerifyListener numberOnlyVerifyListenerModul;
	private Label secretLabel;
	private Text secretText;
	private VerifyListener numberOnlyVerifyListenerSecret;
	private Label coefficentLabel;
	private Button selectCoefficientButton;
	private Label polynomLabel;
	private Label pxLabel;
	private StyledText stPolynom;
	private Button computeSharesButton;
	protected String[] result;
	protected BigInteger[] coefficients;
	protected BigInteger modul;
	protected BigInteger secret;
	protected String polynomialString = "";
	protected ShamirsSecretSharing shamirsSecretSharing;
	protected Point[] shares = new Point[] {};
	protected Canvas canvasCurve;
	private Text infoText;
	private StyledText stInfo;
	private Button[] sharesUseCheckButtonSet;
	private Button reconstructButton;
	private Vector<BigInteger[]> subpolynomial;
	private BigInteger[] reconstructedPolynomial;
	private Group groupReconstruction;
	protected Composite compositeReconstruction;
	private ScrolledComposite scrolledReconstruction;
	private Text shareYCoordinateModText;
	private Text sharesYCoordinateText;
	private Group groupCurve;
	private Composite sharePointInfo;
	private Label shareLabel;
	private Label openLabel;
	private Text xText;
	private Label seperatorLabel;
	private Text yText;
	private Label closeLabel;
	protected int mousePosX;
	protected int mousePosY;
	private int yAxisGap;
	private int xAxisGap;
	protected int pointValue;
	private int gridSizeY;
	private int gridSizeX;
	



	public ShamirsSecretSharingComposite(Composite parent, int style) {
		super(parent, style);
		
		setLayout(new GridLayout(2, false));
		setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
		
		createCompositeIntro(this);
		
		createGroupSecretSharing(this);

		createGroupCurve(this);
		
	}
	
	
	
    private void createGroupSecretSharing(Composite parent) {
        groupSecretSharing = new Group(parent, SWT.NONE);
        groupSecretSharing.setLayout(new GridLayout(2, true));
        groupSecretSharing.setText(Messages.ShamirsCompositeGraphical_title);
        GridData gd_groupSecretSharing = new GridData(SWT.FILL, SWT.FILL, false, true);
        groupSecretSharing.setLayoutData(gd_groupSecretSharing);

        createGroupParameter(groupSecretSharing);
        
        createGroupShares(groupSecretSharing);
        
        createGroupInfo(groupSecretSharing);
        
        createGroupReconstruction(groupSecretSharing);
        
        createCompositeReset(groupSecretSharing);
		
	}



	private void createCompositeReset(Composite parent) {
		<commit_msg>fixes for #291<commit_after>//-----BEGIN DISCLAIMER-----
/*******************************************************************************
* Copyright (c) 2011, 2020 JCrypTool Team and Contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
//-----END DISCLAIMER-----
package org.jcryptool.visual.secretsharing.views;

import java.math.BigInteger;
import java.text.MessageFormat;
import java.util.Vector;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Path;
import org.eclipse.swt.graphics.PathData;
import org.eclipse.swt.graphics.Transform;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Spinner;
import org.eclipse.swt.widgets.Text;
import org.jcryptool.core.util.colors.ColorService;
import org.jcryptool.core.util.fonts.FontService;
import org.jcryptool.visual.secretsharing.algorithm.Point;
import org.jcryptool.visual.secretsharing.algorithm.ShamirsSecretSharing;
import org.jcryptool.visual.secretsharing.views.Constants;

public class ShamirsSecretSharingComposite extends Composite {

	private Composite groupSecretSharing;
	private Button resetButton;
	private Label reconstructPxLabel;
	private StyledText stValue;
	private Group groupShares;
	private ScrolledComposite scrolledShares;
	private Composite compositeShares;
	private Composite sharesButtonComposite;
	private Button selectAllButton;
	private Button deselectAllButton;
	private Group groupParameter;
	private Label numberOfConcernedLabel;
	private Spinner spnrN;
	private Label numberForReconstructionLabel;
	private Spinner spnrT;
	private Label modulLabel;
	private Text modulText;
	private VerifyListener numberOnlyVerifyListenerModul;
	private Label secretLabel;
	private Text secretText;
	private VerifyListener numberOnlyVerifyListenerSecret;
	private Label coefficentLabel;
	private Button selectCoefficientButton;
	private Label polynomLabel;
	private Label pxLabel;
	private StyledText stPolynom;
	private Button computeSharesButton;
	protected String[] result;
	protected BigInteger[] coefficients;
	protected BigInteger modul;
	protected BigInteger secret;
	protected String polynomialString = "";
	protected ShamirsSecretSharing shamirsSecretSharing;
	protected Point[] shares = new Point[] {};
	protected Canvas canvasCurve;
	private Text infoText;
	private StyledText stInfo;
	private Button[] sharesUseCheckButtonSet;
	private Button reconstructButton;
	private Vector<BigInteger[]> subpolynomial;
	private BigInteger[] reconstructedPolynomial;
	private Group groupReconstruction;
	protected Composite compositeReconstruction;
	private ScrolledComposite scrolledReconstruction;
	private Text shareYCoordinateModText;
	private Text sharesYCoordinateText;
	private Group groupCurve;
	private Composite sharePointInfo;
	private Label shareLabel;
	private Label openLabel;
	private Text xText;
	private Label seperatorLabel;
	private Text yText;
	private Label closeLabel;
	protected int mousePosX;
	protected int mousePosY;
	private int yAxisGap;
	private int xAxisGap;
	protected int pointValue;
	private int gridSizeY;
	private int gridSizeX;
	



	public ShamirsSecretSharingComposite(Composite parent, int style) {
		super(parent, style);
		
		setLayout(new GridLayout(2, false));
		setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
		
		createCompositeIntro(this);
		
		createGroupSecretSharing(this);

		createGroupCurve(this);
		
	}
	
	
	
    private void createGroupSecretSharing(Composite parent) {
        groupSecretSharing = new Composite(parent, SWT.NONE);
        groupSecretSharing.setLayout(new GridLayout(2, true));
        // groupSecretSharing.setText(Messages.ShamirsCompositeGraphical_title);
        GridData gd_groupSecretSharing = new GridData(SWT.FILL, SWT.FILL, false, true);
        groupSecretSharing.setLayoutData(gd_groupSecretSharing);

        createGroupParameter(groupSecretSharing);
        
        createGroupShares(groupSecretSharing);
        
        createGroupInfo(groupSecretSharing);
        
        createGroupReconstruction(groupSecretSharing);
        
        createCompositeReset(groupSecretSharing);
		
	}



	private void createCompositeReset(Composite parent) {
		
{'fraction_non_alphanumeric': 0.10598434004474273, 'fraction_numerical': 0.002889634601043997, 'mean_word_length': 5.647459727385378, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2283369', 'n_tokens_mistral': 3202, 'n_tokens_neox': 3022, 'n_words': 712}