W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
java.lang.Object
|---ohos.agp.utils.Line
public class Line
extends Object
提供線路規(guī)格和 alpha 值。
Since:
5
構(gòu)造函數(shù) | 描述 |
---|---|
Line(Point startPoint, Point endPoint) | 用于創(chuàng)建具有指定起點(diǎn)和終點(diǎn)的 Line 實(shí)例的構(gòu)造函數(shù)。 |
修飾符和類(lèi)型 | 方法 | 描述 |
---|---|---|
boolean | equals(Object object) | 指示其他對(duì)象是否“等于”這個(gè)對(duì)象。 |
double | getDistance() | 獲取這條線的起點(diǎn)和終點(diǎn)之間的距離。 |
Point | getEndPoint() | 獲取直線的終點(diǎn)。 |
float | getEndPointX() | 獲取直線終點(diǎn)的 x 坐標(biāo)。 |
float | getEndPointY() | 獲取直線終點(diǎn)的 y 坐標(biāo)。 |
Point | getStartPoint() | 獲取直線的起點(diǎn)。 |
float | getStartPointX() | 獲取直線起點(diǎn)的 x 坐標(biāo)。 |
float | getStartPointY() | 獲取直線起點(diǎn)的 y 坐標(biāo)。 |
int | hashCode() | 返回對(duì)象的哈希碼值。 |
boolean | isEmpty() | 檢查這條線的起點(diǎn)和終點(diǎn)之間的距離是否為零。 |
boolean | isVertical(Line line) | 檢查指定的行和該行是否垂直。 |
void | set(float startPointX, float startPointY, float endPointX, float endPointY) | 設(shè)置這條線的起點(diǎn)和終點(diǎn)的坐標(biāo)。 |
void | set(Line line) | 設(shè)置此行的屬性。 |
void | set(Point startPoint, Point endPoint) | 設(shè)置這條線的起點(diǎn)和終點(diǎn)。 |
void | setEmpty() | 將此線的起點(diǎn)和終點(diǎn)的坐標(biāo)設(shè)置為 (0, 0)。 |
void | setEndPoint(Point point) | 設(shè)置這條線的終點(diǎn)。 |
void | setEndPointX(float x) | 設(shè)置這條線的終點(diǎn)的 x 坐標(biāo)。 |
void | setEndPointY(float y) | 設(shè)置這條線的終點(diǎn)的 y 坐標(biāo)。 |
void | setStartPoint(Point point) | 設(shè)置這條線的起點(diǎn)。 |
void | setStartPointX(float x) | 設(shè)置這條線的起點(diǎn)的 x 坐標(biāo)。 |
void | setStartPointY(float y) | 設(shè)置這條線的起點(diǎn)的 y 坐標(biāo)。 |
String | toString() | 返回對(duì)象的字符串表示形式。 |
void | translate(float dx, float dy) | 將這條線平移指定的距離。 |
void | translate(Point point) | 平移這條線,其在 x 軸和 y 軸上的偏移量由 Point 實(shí)例指定。 |
從類(lèi) java.lang.Object 繼承的方法 |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
public Line(Point startPoint, Point endPoint)
用于創(chuàng)建具有指定起點(diǎn)和終點(diǎn)的 Line 實(shí)例的構(gòu)造函數(shù)。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
startPoint | 指示 Line 實(shí)例的指定起點(diǎn)。 |
endPoint | 指示 Line 實(shí)例的指定端點(diǎn)。 |
Since:
5
public boolean isEmpty()
檢查這條線的起點(diǎn)和終點(diǎn)之間的距離是否為零。
返回:
如果此行的長(zhǎng)度為零,則返回 true; 否則返回 false。
Since:
5
public void set(Line line)
設(shè)置此行的屬性。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
line | 表示要設(shè)置的線路屬性。 |
Since:
5
public void set(float startPointX, float startPointY, float endPointX, float endPointY)
設(shè)置這條線的起點(diǎn)和終點(diǎn)的坐標(biāo)。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
startPointX | 指示要設(shè)置的線的起點(diǎn)的 x 坐標(biāo)。 |
startPointY | 指示要設(shè)置的線的起點(diǎn)的 y 坐標(biāo)。 |
endPointX | 指示要設(shè)置的線的終點(diǎn)的 x 坐標(biāo)。 |
endPointY | 指示要設(shè)置的線的終點(diǎn)的 y 坐標(biāo)。 |
Since:
5
public void set(Point startPoint, Point endPoint)
設(shè)置這條線的起點(diǎn)和終點(diǎn)。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
startPoint | 表示要設(shè)置的起點(diǎn)。 |
endPoint | 指示要設(shè)置的終點(diǎn)。 |
Since:
5
public void setStartPointX(float x)
設(shè)置這條線的起點(diǎn)的 x 坐標(biāo)。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
x | 指示要設(shè)置的 x 坐標(biāo)。 |
Since:
5
public void setStartPointY(float y)
設(shè)置這條線的起點(diǎn)的 y 坐標(biāo)。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
y | 指示要設(shè)置的 y 坐標(biāo)。 |
Since:
5
public void setEndPointX(float x)
設(shè)置這條線的終點(diǎn)的 x 坐標(biāo)。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
x | 指示要設(shè)置的 x 坐標(biāo)。 |
Since:
5
public void setEndPointY(float y)
設(shè)置這條線的終點(diǎn)的 y 坐標(biāo)。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
y | 指示要設(shè)置的 y 坐標(biāo)。 |
Since:
5
public void setEmpty()
將此線的起點(diǎn)和終點(diǎn)的坐標(biāo)設(shè)置為 (0, 0)。
Since:
5
public double getDistance()
獲取這條線的起點(diǎn)和終點(diǎn)之間的距離。
返回:
返回距離。
Since:
5
public Point getStartPoint()
獲取直線的起點(diǎn)。
返回:
返回線的起點(diǎn)。
Since:
5
public Point getEndPoint()
獲取直線的終點(diǎn)。
返回:
返回行的終點(diǎn)。
Since:
5
public float getStartPointX()
獲取直線起點(diǎn)的 x 坐標(biāo)。
返回:
返回直線起點(diǎn)的 x 坐標(biāo)。
Since:
5
public float getStartPointY()
獲取直線起點(diǎn)的 y 坐標(biāo)。
返回:
返回直線起點(diǎn)的 y 坐標(biāo)。
Since:
5
public float getEndPointX()
獲取直線終點(diǎn)的 x 坐標(biāo)。
返回:
返回線的終點(diǎn)的 x 坐標(biāo)。
Since:
5
public float getEndPointY()
獲取直線終點(diǎn)的 y 坐標(biāo)。
返回:
返回直線終點(diǎn)的 y 坐標(biāo)。
Since:
5
public void setStartPoint(Point point)
設(shè)置這條線的起點(diǎn)。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
point | 表示要設(shè)置的起點(diǎn)。 |
Since:
5
public void setEndPoint(Point point)
設(shè)置這條線的終點(diǎn)。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
point | 指示要設(shè)置的終點(diǎn)。 |
Since:
5
public void translate(float dx, float dy)
將這條線平移指定的距離。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
dx | 表示這條線在 x 軸上的偏移量。 |
dy | 表示這條線在 y 軸上的偏移量。 |
Since:
5
public void translate(Point point)
平移這條線,其在 x 軸和 y 軸上的偏移量由 Point 實(shí)例指定。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
point | 指示指定此線在 x 軸和 y 軸上的偏移量的 Point 實(shí)例。 |
Since:
5
public int hashCode()
從類(lèi)復(fù)制的描述:對(duì)象
返回對(duì)象的哈希碼值。 支持這種方法是為了有利于哈希表,例如 HashMap 提供的那些。
hashCode 的一般合約是:
在合理可行的情況下,由 Object 類(lèi)定義的 hashCode 方法確實(shí)為不同的對(duì)象返回不同的整數(shù)。 (這通常通過(guò)將對(duì)象的內(nèi)部地址轉(zhuǎn)換為整數(shù)來(lái)實(shí)現(xiàn),但 Java? 編程語(yǔ)言不需要這種實(shí)現(xiàn)技術(shù)。)
覆蓋:
類(lèi) Object 中的 hashCode
返回:
此對(duì)象的哈希碼值。
public boolean equals(Object object)
從類(lèi)復(fù)制的描述:對(duì)象
指示其他對(duì)象是否“等于”這個(gè)對(duì)象。
equals 方法在非空對(duì)象引用上實(shí)現(xiàn)等價(jià)關(guān)系:
Object 類(lèi)的 equals 方法實(shí)現(xiàn)了對(duì)象上最有區(qū)別的可能等價(jià)關(guān)系; 也就是說(shuō),對(duì)于任何非空引用值 x 和 y,當(dāng)且僅當(dāng) x 和 y 引用同一個(gè)對(duì)象(x == y 的值為 true)時(shí),此方法才返回 true。
請(qǐng)注意,每當(dāng)重寫(xiě)該方法時(shí),通常都需要重寫(xiě) hashCode 方法,以維護(hù) hashCode 方法的一般約定,即相等的對(duì)象必須具有相等的哈希碼。
覆蓋:
類(lèi) Object 中的等于
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
object | 要與之比較的參考對(duì)象。 |
返回:
如果此對(duì)象與 obj 參數(shù)相同,則為 true; 否則為 false。
public String toString()
從類(lèi)復(fù)制的描述:對(duì)象
返回對(duì)象的字符串表示形式。 通常,toString 方法返回一個(gè)“以文本方式表示”該對(duì)象的字符串。 結(jié)果應(yīng)該是一個(gè)簡(jiǎn)潔但信息豐富的表示,易于人們閱讀。 建議所有子類(lèi)重寫(xiě)此方法。
Object 類(lèi)的 toString 方法返回一個(gè)字符串,該字符串由對(duì)象作為其實(shí)例的類(lèi)的名稱(chēng)、at 符號(hào)字符“@”和對(duì)象哈希碼的無(wú)符號(hào)十六進(jìn)制表示形式組成。 換句話說(shuō),此方法返回一個(gè)等于以下值的字符串:
getClass().getName() + '@' + Integer.toHexString(hashCode())
覆蓋:
類(lèi) Object 中的 toString
返回:
對(duì)象的字符串表示形式。
public boolean isVertical(Line line)
檢查指定的行和該行是否垂直。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
line | 表示指定的行。 |
返回:
如果兩條線是垂直的,則返回 true; 否則返回 false。
Since:
5
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: