Revision 2017

tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitiesSelection.java (revision 2017)
76 76
	public SpecificitiesSelection(String parametersNodePath)	{
77 77
		super(parametersNodePath);
78 78
	}
79

  
80
	
81
	/**
82
	 * @return true if selection is found in the specificities table
83
	 */
79 84
	@Override
80 85
	protected boolean __compute() throws Exception {
81 86
		Specificities specificities = this.getParent();
......
84 89
		String[] rowNames = specificities.getTypeNames();
85 90

  
86 91
		selectedSpecificitiesIndex = new double[selectedTypeNames.size()][partNames.length];
92
		
93
		// initialize with zeros in case a word is not found in the specif table
94
		double[] zeros = new double[partNames.length];
95
		for (int i = 0 ; i < selectedTypeNames.size() ; i++) {
96
			selectedSpecificitiesIndex[i] = zeros;
97
		}
98
		
99
		//find words in the specif table
100
		int n = 0;
87 101
		for (int i = 0; i < rowNames.length; i++) {
88 102
			double[] line = tableLines[i];
89 103
			String rowName = rowNames[i];
90 104
			if (selectedTypeNames.contains(rowName)) {
91 105
				selectedSpecificitiesIndex[selectedTypeNames.indexOf(rowName)] = line;
106
				n++;
92 107
			}
93 108
		}
94 109

  
95
		return selectedSpecificitiesIndex.length > 0;
110
		return n > 0;
96 111
	}
97 112

  
98 113
	@Override

Also available in: Unified diff