|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License Version * 1.0 (the "License"). You may not use this file except in compliance * with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is Terminal Emulator. * The Initial Developer of the Original Code is Sun Microsystems, Inc.. * Portions created by Sun Microsystems, Inc. are Copyright (C) 2001-2004. * All Rights Reserved. * * Contributor(s): Ivan Soleimanipour. */ package org.netbeans.lib.terminalemulator; /** * A cartesian coordinate class, similar to Point. * The equivalent of 'offset' in swing.text.Document. *
* * a < b === a.compareTo(b) < 0 * a >= b === a.compareTo(b) >= 0 **/ public int compareTo(Object o) throws ClassCastException { BCoord target = (BCoord) o; // -1 or negative -> this < o // 0 -> this == o // +1 or positive -> this > o if (this.row < target.row) return -1; else if (this.row > target.row) return +1; else { return this.col - target.col; } } public void clip(int rows, int cols) { // BE CAREFUL and clip view BCoords with a view box and buffer // BCoords with a buffer box! if (row < 0) row = 0; else if (row > rows) row = rows; if (col < 0) col = 0; else if (col > cols) col = cols; } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.