Révision 3144

tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesEditor.java (revision 3144)
304 304
			
305 305
			if (!this.getResult().isDirty()) {
306 306
				
307
				// units
308
				String[] typeNames = this.getResult().getTypeNames();
309
				// units' total freq
310
				int[] typeFreq = this.getResult().getFormFrequencies();
311
				// units' index for each part
312
				double[][] specIndex = this.getResult().getSpecificitesIndex();
307
				
308
				String[] typeNames = this.getResult().getTypeNames(); // units
309
				int[] typeFreq = this.getResult().getFormFrequencies(); // units' total freq
310
				double[][] specIndex = this.getResult().getSpecificitesIndex(); // units' index for each part
313 311
				int[][] specFreqs = this.getResult().getFrequencies();
314 312
				
315 313
				// units' total in parts
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificities.java (revision 3144)
162 162
		
163 163
		this.frequencies = null;
164 164
		
165
		// delete the specificities selection chart children since they can not be valid
166
		// anymore if the unit property has changed
165
		// delete the specificities selection chart children since they can not be valid anymore if the unit property has changed
167 166
		// FIXME: doesn't work
168
		if (this.lexicalTable.hasParameterChanged(TBXPreferences.UNIT_PROPERTY)) {
169
			this.deleteChildren(SpecificitiesSelection.class);
170
		}
167
//		if (this.lexicalTable.hasParameterChanged(TBXPreferences.UNIT_PROPERTY)) {
168
//			this.deleteChildren(SpecificitiesSelection.class);
169
//		}
171 170
		
172 171
		ILexicalTable data = this.lexicalTable.getData();
173 172
		SpecificitiesR rSpecificities = new SpecificitiesR(data);
174 173
		double[][] specIndex = rSpecificities.getScores();
175 174
		
176
		// TODO if test no more necessary ? only if lexicalTable symb
177
		// if (this.lexicalTable.getPartition() != null) {
178
		// init(symbol, specIndex);
179
		// }
180
		// else {
181 175
		init(rSpecificities.getSymbol(), specIndex);
182
		this.symbol = rSpecificities.getSymbol();
183
		// }
184
		// }
185 176
		
186 177
		return true;
187 178
	}
......
209 200
				RWorkspace.getRWorkspaceInstance().removeVariableFromWorkspace(this.symbol);
210 201
			}
211 202
			catch (RWorkspaceException e) {
212
				e.printStackTrace();
203
				Log.printStackTrace();
213 204
			}
214 205
		}
215 206
		this.symbol = symbol;
......
241 232
			MIN = -maxScore;
242 233
		}
243 234
		
235
		// fixing max and min score values
244 236
		for (int i = 0; i < indices.length; i++) {
245 237
			for (int j = 0; j < indices[i].length; j++) {
246 238
				if (indices[i][j] > MAX) {
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/MatrixImpl.java (revision 3144)
434 434
	 * Fusion rows.
435 435
	 *
436 436
	 * @param row the row
437
	 * @throws RWorkspaceException
437
	 * @throws StatException 
438 438
	 */
439
	public boolean mergeCols(int[] cols) throws RWorkspaceException {
439
	public boolean mergeCols(int[] cols) throws StatException {
440 440
		if (cols.length < 2) return false;
441 441
		Arrays.sort(cols);
442 442
		// System.out.println("fusion rows: "+Arrays.toString(rows)); //$NON-NLS-1$
......
737 737
	 *
738 738
	 * @param col the col
739 739
	 * @param checkEmptyLines the check empty lines
740
	 * @throws StatException 
740 741
	 */
741
	public void removeCol(int col, boolean checkEmptyLines) {
742
	public void removeCol(int col, boolean checkEmptyLines) throws StatException {
742 743
		// System.out.println("rmv col " + col);
743
		try {
744 744
			removeCol(col);
745 745
			
746 746
			// we remove the empty lineslines
747 747
			if (checkEmptyLines) {
748 748
				removeEmptyRows();
749 749
			}
750
		}
751
		catch (RWorkspaceException e) {
752
			Log.printStackTrace(e);
753
		}
754 750
	}
755 751
	
756 752
	/**
757 753
	 * Removes the cols.
758 754
	 *
759 755
	 * @param cols the cols
756
	 * @throws StatException 
760 757
	 */
761
	public void removeCols(int[] cols) {
758
	public void removeCols(int[] cols) throws StatException {
762 759
		Arrays.sort(cols);
763 760
		int index = 0;
764 761
		for (int i = cols.length - 1; i >= 0; i--) {
......
767 764
		}
768 765
	}
769 766
	
770
	public void removeCols(int[] cols, boolean removeEmptyLines) throws RWorkspaceException {
767
	public void removeCols(int[] cols, boolean removeEmptyLines) throws StatException {
771 768
		removeCols(cols);
772 769
		if (removeEmptyLines) {
773 770
			removeEmptyRows();
......
778 775
	 * Removes the cols.
779 776
	 *
780 777
	 * @param cols the cols
778
	 * @throws StatException 
781 779
	 */
782
	public void removeCols(List<Integer> cols) {
780
	public void removeCols(List<Integer> cols) throws StatException {
783 781
		Collections.sort(cols);
784 782
		int index = 0;
785 783
		for (int i = cols.size() - 1; i >= 0; i--) {
786 784
			index = cols.get(i);
787 785
			removeCol(index, false);
788 786
		}
787
		removeEmptyRows();
789 788
	}
790 789
	
791
	public void removeCols(List<Integer> cols, boolean removeEmptyLines) throws RWorkspaceException {
792
		removeCols(cols);
793
		if (removeEmptyLines) {
794
			removeEmptyRows();
795
		}
796
	}
790
//	public void removeCols(List<Integer> cols, boolean removeEmptyLines) throws RWorkspaceException {
791
//		removeCols(cols);
792
//		if (removeEmptyLines) {
793
//			removeEmptyRows();
794
//		}
795
//	}
797 796
	
798
	private void removeEmptyCols() throws RWorkspaceException {
797
	private void removeEmptyCols() throws StatException {
799 798
		try {
800 799
			int[] colsums = rw.eval("apply(" + symbol + ",2,sum)").asIntegers();// get a vector of line sums //$NON-NLS-1$ //$NON-NLS-2$
801 800
			ArrayList<Integer> removecols = new ArrayList<>();
......
817 816
	
818 817
	/**
819 818
	 * Removes the empty lines.
820
	 *
821
	 * @throws RWorkspaceException the r workspace exception
819
	 * @throws StatException 
822 820
	 */
823
	public void removeEmptyRows() throws RWorkspaceException {
824
		try {
825
			int[] rowsums = rw.eval("apply(" + symbol + ",1,sum)").asIntegers();// get a vector of line sums //$NON-NLS-1$ //$NON-NLS-2$
821
	public void removeEmptyRows() throws StatException {
822
			int[] rowsums = this.getRowMargins();
826 823
			ArrayList<Integer> rowIndexes = new ArrayList<>();
827 824
			// get the empty line index
828 825
			for (int i = 0; i < rowsums.length; i++) {
......
834 831
			if (rowIndexes.size() > 0) {
835 832
				removeRows(rowIndexes);
836 833
			}
837
		}
838
		catch (REXPMismatchException e) {
839
			Log.printStackTrace(e);
840
		}
841 834
	}
842 835
	
843 836
	/**
......
925 918
		}
926 919
	}
927 920
	
928
	public void removeRows(int[] rows, boolean removeEmptyCols) throws RWorkspaceException {
921
	public void removeRows(int[] rows, boolean removeEmptyCols) throws StatException {
929 922
		removeRows(rows);
930 923
		if (removeEmptyCols) {
931 924
			removeEmptyCols();
......
977 970
		}
978 971
	}
979 972
	
980
	public void removeRows(List<Integer> rows, boolean removeEmptyCols) throws RWorkspaceException {
973
	public void removeRows(List<Integer> rows, boolean removeEmptyCols) throws StatException {
981 974
		this.removeRows(rows);
982 975
		if (removeEmptyCols) {
983 976
			removeEmptyCols();

Formats disponibles : Unified diff