新聞中心
Line

創(chuàng)新互聯(lián)是一家專(zhuān)注于網(wǎng)站制作、成都網(wǎng)站制作與策劃設(shè)計(jì),文峰網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)做網(wǎng)站,專(zhuān)注于網(wǎng)站建設(shè)十年,網(wǎng)設(shè)計(jì)領(lǐng)域的專(zhuān)業(yè)建站公司;建站業(yè)務(wù)涵蓋:文峰等地區(qū)。文峰做網(wǎng)站價(jià)格咨詢(xún):18982081108
java.lang.Object
|---ohos.agp.utils.Line
public class Line
extends Object
提供線(xiàn)路規(guī)格和 alpha 值。
Since:
5
構(gòu)造函數(shù)摘要
| 構(gòu)造函數(shù) | 描述 |
|---|---|
| Line(Point startPoint, Point endPoint) | 用于創(chuàng)建具有指定起點(diǎn)和終點(diǎn)的 Line 實(shí)例的構(gòu)造函數(shù)。 |
方法總結(jié)
| 修飾符和類(lèi)型 | 方法 | 描述 |
|---|---|---|
| boolean | equals(Object object) | 指示其他對(duì)象是否“等于”這個(gè)對(duì)象。 |
| double | getDistance() | 獲取這條線(xiàn)的起點(diǎn)和終點(diǎn)之間的距離。 |
| Point | getEndPoint() | 獲取直線(xiàn)的終點(diǎn)。 |
| float | getEndPointX() | 獲取直線(xiàn)終點(diǎn)的 x 坐標(biāo)。 |
| float | getEndPointY() | 獲取直線(xiàn)終點(diǎn)的 y 坐標(biāo)。 |
| Point | getStartPoint() | 獲取直線(xiàn)的起點(diǎn)。 |
| float | getStartPointX() | 獲取直線(xiàn)起點(diǎn)的 x 坐標(biāo)。 |
| float | getStartPointY() | 獲取直線(xiàn)起點(diǎn)的 y 坐標(biāo)。 |
| int | hashCode() | 返回對(duì)象的哈希碼值。 |
| boolean | isEmpty() | 檢查這條線(xiàn)的起點(diǎn)和終點(diǎn)之間的距離是否為零。 |
| boolean | isVertical(Line line) | 檢查指定的行和該行是否垂直。 |
| void | set(float startPointX, float startPointY, float endPointX, float endPointY) | 設(shè)置這條線(xiàn)的起點(diǎn)和終點(diǎn)的坐標(biāo)。 |
| void | set(Line line) | 設(shè)置此行的屬性。 |
| void | set(Point startPoint, Point endPoint) | 設(shè)置這條線(xiàn)的起點(diǎn)和終點(diǎn)。 |
| void | setEmpty() | 將此線(xiàn)的起點(diǎn)和終點(diǎn)的坐標(biāo)設(shè)置為 (0, 0)。 |
| void | setEndPoint(Point point) | 設(shè)置這條線(xiàn)的終點(diǎn)。 |
| void | setEndPointX(float x) | 設(shè)置這條線(xiàn)的終點(diǎn)的 x 坐標(biāo)。 |
| void | setEndPointY(float y) | 設(shè)置這條線(xiàn)的終點(diǎn)的 y 坐標(biāo)。 |
| void | setStartPoint(Point point) | 設(shè)置這條線(xiàn)的起點(diǎn)。 |
| void | setStartPointX(float x) | 設(shè)置這條線(xiàn)的起點(diǎn)的 x 坐標(biāo)。 |
| void | setStartPointY(float y) | 設(shè)置這條線(xiàn)的起點(diǎn)的 y 坐標(biāo)。 |
| String | toString() | 返回對(duì)象的字符串表示形式。 |
| void | translate(float dx, float dy) | 將這條線(xiàn)平移指定的距離。 |
| void | translate(Point point) | 平移這條線(xiàn),其在 x 軸和 y 軸上的偏移量由 Point 實(shí)例指定。 |
| 從類(lèi) java.lang.Object 繼承的方法 |
|---|
| clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
構(gòu)造函數(shù)詳細(xì)信息
Line
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
方法詳情
isEmpty
public boolean isEmpty()
檢查這條線(xiàn)的起點(diǎn)和終點(diǎn)之間的距離是否為零。
返回:
如果此行的長(zhǎng)度為零,則返回 true; 否則返回 false。
Since:
5
set
public void set(Line line)
設(shè)置此行的屬性。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| line | 表示要設(shè)置的線(xiàn)路屬性。 |
Since:
5
set
public void set(float startPointX, float startPointY, float endPointX, float endPointY)
設(shè)置這條線(xiàn)的起點(diǎn)和終點(diǎn)的坐標(biāo)。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| startPointX | 指示要設(shè)置的線(xiàn)的起點(diǎn)的 x 坐標(biāo)。 |
| startPointY | 指示要設(shè)置的線(xiàn)的起點(diǎn)的 y 坐標(biāo)。 |
| endPointX | 指示要設(shè)置的線(xiàn)的終點(diǎn)的 x 坐標(biāo)。 |
| endPointY | 指示要設(shè)置的線(xiàn)的終點(diǎn)的 y 坐標(biāo)。 |
Since:
5
set
public void set(Point startPoint, Point endPoint)
設(shè)置這條線(xiàn)的起點(diǎn)和終點(diǎn)。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| startPoint | 表示要設(shè)置的起點(diǎn)。 |
| endPoint | 指示要設(shè)置的終點(diǎn)。 |
Since:
5
setStartPointX
public void setStartPointX(float x)
設(shè)置這條線(xiàn)的起點(diǎn)的 x 坐標(biāo)。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| x | 指示要設(shè)置的 x 坐標(biāo)。 |
Since:
5
setStartPointY
public void setStartPointY(float y)
設(shè)置這條線(xiàn)的起點(diǎn)的 y 坐標(biāo)。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| y | 指示要設(shè)置的 y 坐標(biāo)。 |
Since:
5
setEndPointX
public void setEndPointX(float x)
設(shè)置這條線(xiàn)的終點(diǎn)的 x 坐標(biāo)。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| x | 指示要設(shè)置的 x 坐標(biāo)。 |
Since:
5
setEndPointY
public void setEndPointY(float y)
設(shè)置這條線(xiàn)的終點(diǎn)的 y 坐標(biāo)。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| y | 指示要設(shè)置的 y 坐標(biāo)。 |
Since:
5
setEmpty
public void setEmpty()
將此線(xiàn)的起點(diǎn)和終點(diǎn)的坐標(biāo)設(shè)置為 (0, 0)。
Since:
5
getDistance
public double getDistance()
獲取這條線(xiàn)的起點(diǎn)和終點(diǎn)之間的距離。
返回:
返回距離。
Since:
5
getStartPoint
public Point getStartPoint()
獲取直線(xiàn)的起點(diǎn)。
返回:
返回線(xiàn)的起點(diǎn)。
Since:
5
getEndPoint
public Point getEndPoint()
獲取直線(xiàn)的終點(diǎn)。
返回:
返回行的終點(diǎn)。
Since:
5
getStartPointX
public float getStartPointX()
獲取直線(xiàn)起點(diǎn)的 x 坐標(biāo)。
返回:
返回直線(xiàn)起點(diǎn)的 x 坐標(biāo)。
Since:
5
getStartPointY
public float getStartPointY()
獲取直線(xiàn)起點(diǎn)的 y 坐標(biāo)。
返回:
返回直線(xiàn)起點(diǎn)的 y 坐標(biāo)。
Since:
5
getEndPointX
public float getEndPointX()
獲取直線(xiàn)終點(diǎn)的 x 坐標(biāo)。
返回:
返回線(xiàn)的終點(diǎn)的 x 坐標(biāo)。
Since:
5
getEndPointY
public float getEndPointY()
獲取直線(xiàn)終點(diǎn)的 y 坐標(biāo)。
返回:
返回直線(xiàn)終點(diǎn)的 y 坐標(biāo)。
Since:
5
setStartPoint
public void setStartPoint(Point point)
設(shè)置這條線(xiàn)的起點(diǎn)。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| point | 表示要設(shè)置的起點(diǎn)。 |
Since:
5
setEndPoint
public void setEndPoint(Point point)
設(shè)置這條線(xiàn)的終點(diǎn)。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| point | 指示要設(shè)置的終點(diǎn)。 |
Since:
5
translate
public void translate(float dx, float dy)
將這條線(xiàn)平移指定的距離。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| dx | 表示這條線(xiàn)在 x 軸上的偏移量。 |
| dy | 表示這條線(xiàn)在 y 軸上的偏移量。 |
Since:
5
translate
public void translate(Point point)
平移這條線(xiàn),其在 x 軸和 y 軸上的偏移量由 Point 實(shí)例指定。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| point | 指示指定此線(xiàn)在 x 軸和 y 軸上的偏移量的 Point 實(shí)例。 |
Since:
5
hashCode
public int hashCode()
從類(lèi)復(fù)制的描述:對(duì)象
返回對(duì)象的哈希碼值。 支持這種方法是為了有利于哈希表,例如 HashMap 提供的那些。
hashCode 的一般合約是:
- 每當(dāng)在 Java 應(yīng)用程序執(zhí)行期間對(duì)同一對(duì)象多次調(diào)用時(shí),hashCode 方法必須始終返回相同的整數(shù),前提是沒(méi)有修改對(duì)象上相等比較中使用的信息。 該整數(shù)不需要從應(yīng)用程序的一次執(zhí)行到同一應(yīng)用程序的另一次執(zhí)行保持一致。
- 如果兩個(gè)對(duì)象根據(jù) equals(Object) 方法相等,則對(duì)兩個(gè)對(duì)象中的每一個(gè)調(diào)用 hashCode 方法必須產(chǎn)生相同的整數(shù)結(jié)果。
- 如果根據(jù) Object.equals(java.lang.Object) 方法,如果兩個(gè)對(duì)象不相等,則不要求對(duì)兩個(gè)對(duì)象中的每一個(gè)調(diào)用 hashCode 方法必須產(chǎn)生不同的整數(shù)結(jié)果。 但是,程序員應(yīng)該意識(shí)到,為不相等的對(duì)象生成不同的整數(shù)結(jié)果可能會(huì)提高哈希表的性能。
在合理可行的情況下,由 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ì)象的哈希碼值。
equals
public boolean equals(Object object)
從類(lèi)復(fù)制的描述:對(duì)象
指示其他對(duì)象是否“等于”這個(gè)對(duì)象。
equals 方法在非空對(duì)象引用上實(shí)現(xiàn)等價(jià)關(guān)系:
- 它是自反的:對(duì)于任何非空引用值 x,x.equals(x) 應(yīng)該返回 true。
- 它是對(duì)稱(chēng)的:對(duì)于任何非空引用值 x 和 y,當(dāng)且僅當(dāng) y.equals(x) 返回 true 時(shí),x.equals(y) 才應(yīng)該返回 true。
- 它是可傳遞的:對(duì)于任何非空引用值 x、y 和 z,如果 x.equals(y) 返回 true 并且 y.equals(z) 返回 true,則 x.equals(z) 應(yīng)該返回 true。
- 它是一致的:對(duì)于任何非空引用值 x 和 y,x.equals(y) 的多次調(diào)用始終返回 true 或始終返回 false,前提是沒(méi)有修改對(duì)象上 equals 比較中使用的信息。
- 對(duì)于任何非空引用值 x,x.equals(null) 應(yīng)該返回 false。
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。
toString
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)制表示形式組成。 換句話(huà)說(shuō),此方法返回一個(gè)等于以下值的字符串:
getClass().getName() + '@' + Integer.toHexString(hashCode())
覆蓋:
類(lèi) Object 中的 toString
返回:
對(duì)象的字符串表示形式。
isVertical
public boolean isVertical(Line line)
檢查指定的行和該行是否垂直。
參數(shù):
| 參數(shù)名稱(chēng) | 參數(shù)描述 |
|---|---|
| line | 表示指定的行。 |
返回:
如果兩條線(xiàn)是垂直的,則返回 true; 否則返回 false。
Since:
5
本文標(biāo)題:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSLine
本文來(lái)源:http://m.fisionsoft.com.cn/article/djehcip.html


咨詢(xún)
建站咨詢(xún)
