コード例 #1
0
 /**
  * returns the weights how much a individual column contributes to the overall scores, i.e. the
  * normalized weights
  *
  * @return
  */
 public float[] getWeights() {
   float[] r = new float[this.size()];
   float base = width - getSpaces();
   int i = 0;
   for (ARankColumnModel col : this) {
     r[i++] = (float) col.getParentData() / base;
   }
   return r;
 }
コード例 #2
0
 @Override
 public ARankColumnModel setWidth(float width) {
   if (isCompressed) {
     this.propertySupport.firePropertyChange(
         PROP_WIDTH, compressedWidth, this.compressedWidth = width);
     return this;
   }
   float shift = getSpaces();
   float factor = (width - shift) / (this.width - shift); // new / old
   for (ARankColumnModel col : this) {
     float wi = ((float) col.getParentData()) * factor;
     col.setParentData(wi);
     col.removePropertyChangeListener(PROP_WIDTH, listener);
     col.setWidth(wi);
     col.addPropertyChangeListener(PROP_WIDTH, listener);
   }
   return super.setWidth(width);
 }