Java Code Examples for org.jfree.util.StrokeList#size()

The following examples show how to use org.jfree.util.StrokeList#size() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HashUtilities.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Computes a hash code for a {@link StrokeList}.  In the latest version
 * of JCommon, the {@link StrokeList} class should implement the hashCode()
 * method correctly, but we compute it here anyway so that we can work with 
 * older versions of JCommon (back to 1.0.0).
 * 
 * @param pre  the seed value.
 * @param list  the list (<code>null</code> permitted).
 * 
 * @return The hash code.
 * 
 * @since 1.0.9
 */
public static int hashCode(int pre, StrokeList list) {
    if (list == null) {
        return pre;
    }
    int result = 127;
    int size = list.size();
    result = HashUtilities.hashCode(result, size);
    
    // for efficiency, we just use the first, last and middle items to
    // compute a hashCode...
    if (size > 0) {
        result = HashUtilities.hashCode(result, list.getStroke(0));
        if (size > 1) {
            result = HashUtilities.hashCode(result, 
                    list.getStroke(size - 1));
            if (size > 2) {
                result = HashUtilities.hashCode(result, 
                        list.getStroke(size / 2));
            }
        }
    }
    return 37 * pre + result;
}
 
Example 2
Source File: HashUtilities.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Computes a hash code for a {@link StrokeList}.  In the latest version
 * of JCommon, the {@link StrokeList} class should implement the hashCode()
 * method correctly, but we compute it here anyway so that we can work with 
 * older versions of JCommon (back to 1.0.0).
 * 
 * @param pre  the seed value.
 * @param list  the list (<code>null</code> permitted).
 * 
 * @return The hash code.
 * 
 * @since 1.0.9
 */
public static int hashCode(int pre, StrokeList list) {
    if (list == null) {
        return pre;
    }
    int result = 127;
    int size = list.size();
    result = HashUtilities.hashCode(result, size);
    
    // for efficiency, we just use the first, last and middle items to
    // compute a hashCode...
    if (size > 0) {
        result = HashUtilities.hashCode(result, list.getStroke(0));
        if (size > 1) {
            result = HashUtilities.hashCode(result, 
                    list.getStroke(size - 1));
            if (size > 2) {
                result = HashUtilities.hashCode(result, 
                        list.getStroke(size / 2));
            }
        }
    }
    return 37 * pre + result;
}
 
Example 3
Source File: HashUtilities.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Computes a hash code for a {@link StrokeList}.  In the latest version
 * of JCommon, the {@link StrokeList} class should implement the hashCode()
 * method correctly, but we compute it here anyway so that we can work with 
 * older versions of JCommon (back to 1.0.0).
 * 
 * @param pre  the seed value.
 * @param list  the list (<code>null</code> permitted).
 * 
 * @return The hash code.
 * 
 * @since 1.0.9
 */
public static int hashCode(int pre, StrokeList list) {
    if (list == null) {
        return pre;
    }
    int result = 127;
    int size = list.size();
    result = HashUtilities.hashCode(result, size);
    
    // for efficiency, we just use the first, last and middle items to
    // compute a hashCode...
    if (size > 0) {
        result = HashUtilities.hashCode(result, list.getStroke(0));
        if (size > 1) {
            result = HashUtilities.hashCode(result, 
                    list.getStroke(size - 1));
            if (size > 2) {
                result = HashUtilities.hashCode(result, 
                        list.getStroke(size / 2));
            }
        }
    }
    return 37 * pre + result;
}
 
Example 4
Source File: HashUtilities.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Computes a hash code for a {@link StrokeList}.  In the latest version
 * of JCommon, the {@link StrokeList} class should implement the hashCode()
 * method correctly, but we compute it here anyway so that we can work with 
 * older versions of JCommon (back to 1.0.0).
 * 
 * @param pre  the seed value.
 * @param list  the list (<code>null</code> permitted).
 * 
 * @return The hash code.
 * 
 * @since 1.0.9
 */
public static int hashCode(int pre, StrokeList list) {
    if (list == null) {
        return pre;
    }
    int result = 127;
    int size = list.size();
    result = HashUtilities.hashCode(result, size);
    
    // for efficiency, we just use the first, last and middle items to
    // compute a hashCode...
    if (size > 0) {
        result = HashUtilities.hashCode(result, list.getStroke(0));
        if (size > 1) {
            result = HashUtilities.hashCode(result, 
                    list.getStroke(size - 1));
            if (size > 2) {
                result = HashUtilities.hashCode(result, 
                        list.getStroke(size / 2));
            }
        }
    }
    return 37 * pre + result;
}
 
Example 5
Source File: HashUtilities.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Computes a hash code for a {@link StrokeList}.  In the latest version
 * of JCommon, the {@link StrokeList} class should implement the hashCode()
 * method correctly, but we compute it here anyway so that we can work with 
 * older versions of JCommon (back to 1.0.0).
 * 
 * @param pre  the seed value.
 * @param list  the list (<code>null</code> permitted).
 * 
 * @return The hash code.
 * 
 * @since 1.0.9
 */
public static int hashCode(int pre, StrokeList list) {
    if (list == null) {
        return pre;
    }
    int result = 127;
    int size = list.size();
    result = HashUtilities.hashCode(result, size);
    
    // for efficiency, we just use the first, last and middle items to
    // compute a hashCode...
    if (size > 0) {
        result = HashUtilities.hashCode(result, list.getStroke(0));
        if (size > 1) {
            result = HashUtilities.hashCode(result, 
                    list.getStroke(size - 1));
            if (size > 2) {
                result = HashUtilities.hashCode(result, 
                        list.getStroke(size / 2));
            }
        }
    }
    return 37 * pre + result;
}
 
Example 6
Source File: HashUtilities.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Computes a hash code for a {@link StrokeList}.  In the latest version
 * of JCommon, the {@link StrokeList} class should implement the hashCode()
 * method correctly, but we compute it here anyway so that we can work with 
 * older versions of JCommon (back to 1.0.0).
 * 
 * @param pre  the seed value.
 * @param list  the list (<code>null</code> permitted).
 * 
 * @return The hash code.
 * 
 * @since 1.0.9
 */
public static int hashCode(int pre, StrokeList list) {
    if (list == null) {
        return pre;
    }
    int result = 127;
    int size = list.size();
    result = HashUtilities.hashCode(result, size);
    
    // for efficiency, we just use the first, last and middle items to
    // compute a hashCode...
    if (size > 0) {
        result = HashUtilities.hashCode(result, list.getStroke(0));
        if (size > 1) {
            result = HashUtilities.hashCode(result, 
                    list.getStroke(size - 1));
            if (size > 2) {
                result = HashUtilities.hashCode(result, 
                        list.getStroke(size / 2));
            }
        }
    }
    return 37 * pre + result;
}