Ejemplo n.º 1
0
 /**
  * Return the number of corners in the specified stroke. This calls numCorners with threshold
  * values either initialized in the constructor or specified by the user.
  *
  * <p>First check to see if this feature already exists in the stroke's property table (access
  * using PROPERTY_KEY). If so, return that value (cast to double). Otherwise call numCorners to
  * compute and cache the result in the table.
  *
  * <p>
  */
 public double apply(TimedStroke s) {
   Integer num = (Integer) s.getProperty(PROPERTY_KEY);
   if (num == null) {
     int val = numCorners(s, _threshDot, _threshMagRatio, _threshRelaxedDot);
     s.setProperty(PROPERTY_KEY, new Integer(val));
     return (double) val;
   } else {
     return num.doubleValue();
   }
 }