nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/buffer/AbstractBuffer.ets
arkts
reset
Resets the buffer index to 0 and makes the buffer reusable.
public reset(): void { this.index = 0; }
AST#method_declaration#Left public reset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . index AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public reset(): void { this.index = 0; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/buffer/AbstractBuffer.ets#L59-L61
cb3019c534368b6de852ece38897b8ffdda64799
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleNotificationManager.ets
arkts
getReminderSettings
获取提醒设置
getReminderSettings(): SimpleReminderSettings { return this.reminderSettings; }
AST#method_declaration#Left getReminderSettings AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left SimpleReminderSettings AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reminderSettings AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getReminderSettings(): SimpleReminderSettings { return this.reminderSettings; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleNotificationManager.ets#L138-L140
cf4e2d778d467f90b564c9d6c5c3e745830c8787
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customanimationtab/Index.ets
arkts
CustomAnimationTab
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export { CustomAnimationTab } from './src/main/ets/utils/CustomAnimationTab'
AST#export_declaration#Left export { CustomAnimationTab } from './src/main/ets/utils/CustomAnimationTab' AST#export_declaration#Right
export { CustomAnimationTab } from './src/main/ets/utils/CustomAnimationTab'
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/Index.ets#L15-L15
4fabd84f915ab1927727f77b8704391a3554c084
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/OfferModel.ets
arkts
getTotalCompensation
获取总包薪资
getTotalCompensation(): number { let total = this.annualSalary || this.baseSalary; total += this.bonus; return total; }
AST#method_declaration#Left getTotalCompensation AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left total = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . annualSalary AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . baseSalary AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left total += AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bonus AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left total AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getTotalCompensation(): number { let total = this.annualSalary || this.baseSalary; total += this.bonus; return total; }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L174-L178
14ed6de7e05dd2af89827cd072681724fd507d7f
github
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/common/beans/ClassifiedStatistic.ets
arkts
导出一个名为 ClassifiedStatistic 的类,用于表示记账应用中的分类统计信息
export default class ClassifiedStatistic { // 类型文本,用于描述统计项的类型 typeText: string = ''; // 账目类型,0 表示支出,1 表示收入 accountType: number = 0; // 金额,表示该类型下的账目总金额,初始为0 amount: number = 0; // 账目数量,表示该类型下的账目数量,初始为0 count: number = 0; // 构造函数,用于创建 ClassifiedStatistic 类的实例 constructor(typeText: string, accountType: number, amount: number = 0, count: number = 0) { // 将传入的参数赋值给实例的各个属性 this.typeText = typeText; this.accountType = accountType; this.amount = amount; this.count = count; } }
AST#export_declaration#Left export default AST#class_declaration#Left class ClassifiedStatistic AST#class_body#Left { // 类型文本,用于描述统计项的类型 AST#property_declaration#Left typeText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right // 账目类型,0 表示支出,1 表示收入 AST#property_declaration#Left accountType : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 金额,表示该类型下的账目总金额,初始为0 AST#property_declaration#Left amount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 账目数量,表示该类型下的账目数量,初始为0 AST#property_declaration#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 构造函数,用于创建 ClassifiedStatistic 类的实例 AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left typeText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left accountType : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left amount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right , AST#parameter#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 将传入的参数赋值给实例的各个属性 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . typeText AST#member_expression#Right = AST#expression#Left typeText AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . accountType AST#member_expression#Right = AST#expression#Left accountType AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . amount AST#member_expression#Right = AST#expression#Left amount AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . count AST#member_expression#Right = AST#expression#Left count AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class ClassifiedStatistic { typeText: string = ''; accountType: number = 0; amount: number = 0; count: number = 0; constructor(typeText: string, accountType: number, amount: number = 0, count: number = 0) { this.typeText = typeText; this.accountType = accountType; this.amount = amount; this.count = count; } }
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/beans/ClassifiedStatistic.ets#L2-L23
1cc2511d94340e8173004058a5cb67141be39122
github
JHB11Hinson/mineMointorAPP.git
b6b853cf534021ac39e66c9b3a35113896a272b2
entry/src/main/ets/common/utils/HttpUtil.ets
arkts
put
PUT 请求
static async put<T>(url: string, data: Record<string, string | number | boolean>): Promise<T> { return HttpUtil.request<T>(url, http.RequestMethod.PUT, data); }
AST#method_declaration#Left static async put AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left boolean AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtil AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . PUT AST#member_expression#Right AST#expression#Right , AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async put<T>(url: string, data: Record<string, string | number | boolean>): Promise<T> { return HttpUtil.request<T>(url, http.RequestMethod.PUT, data); }
https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/common/utils/HttpUtil.ets#L16-L18
22ca92515ae073e8f6be618c77a512dac4793bcb
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/views/CircleView.ets
arkts
========== 构建视图 ==========
build() { Row() { // 左侧 Canvas 绘图 Canvas(this.ctx) .width('auto') .height('100%') .onReady(() => { try { this.drawCanvas(); } catch(e) {} }) // 图例 if (this.showInfo) { Column({ space: 8 }) { ForEach(this.parts, (part: GraphPart) => { Row({ space: 8 }) { Rect() .width(12) .height(12) .backgroundColor(part.color) Text(this.infoText(part)) .fontSize(11) .fontColor($r('sys.color.black')) .textAlign(TextAlign.Start) } .alignItems(VerticalAlign.Center) }) } .padding({ left: 8 }) } } .align(Alignment.Center) }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 左侧 Canvas 绘图 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 'auto' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . onReady ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . drawCanvas AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 图例 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showInfo AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 8 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parts AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left part : AST#type_annotation#Left AST#primary_type#Left GraphPart AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 8 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Rect ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left part AST#expression#Right . color AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . infoText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left part AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 11 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.black' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . align ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { Row() { Canvas(this.ctx) .width('auto') .height('100%') .onReady(() => { try { this.drawCanvas(); } catch(e) {} }) if (this.showInfo) { Column({ space: 8 }) { ForEach(this.parts, (part: GraphPart) => { Row({ space: 8 }) { Rect() .width(12) .height(12) .backgroundColor(part.color) Text(this.infoText(part)) .fontSize(11) .fontColor($r('sys.color.black')) .textAlign(TextAlign.Start) } .alignItems(VerticalAlign.Center) }) } .padding({ left: 8 }) } } .align(Alignment.Center) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/CircleView.ets#L48-L78
b3ff63facc938837972080e45844a23e2ea273d7
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/ciphers/HillCipher.ets
arkts
encrypt
加密文本 @param text 要加密的文本 @param key 2x2密钥矩阵 @returns 加密后的文本
static encrypt(text: string, key: number[][]): string { // 确保文本长度为偶数 if (text.length % 2 !== 0) { text += 'X'; } let result = ''; for (let i = 0; i < text.length; i += 2) { const char1 = text.charCodeAt(i) - 'A'.charCodeAt(0); const char2 = text.charCodeAt(i + 1) - 'A'.charCodeAt(0); // 获取密钥矩阵的元素 const a = key[0][0]; const b = key[0][1]; const c = key[1][0]; const d = key[1][1]; // 计算加密后的字符 const encrypted1 = (a * char1 + b * char2) % HillCipher.MOD; const encrypted2 = (c * char1 + d * char2) % HillCipher.MOD; result += String.fromCharCode(encrypted1 + 'A'.charCodeAt(0)); result += String.fromCharCode(encrypted2 + 'A'.charCodeAt(0)); } return result; }
AST#method_declaration#Left static encrypt AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 确保文本长度为偶数 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . length AST#member_expression#Right AST#expression#Right % AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right !== AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left text += AST#expression#Left 'X' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left '' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left text AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left 2 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left char1 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left 'A' AST#expression#Right AST#binary_expression#Right AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left char2 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left 'A' AST#expression#Right AST#binary_expression#Right AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取密钥矩阵的元素 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left a = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left b = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left c = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left d = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 计算加密后的字符 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left encrypted1 = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right * AST#expression#Left char1 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left b AST#expression#Right * AST#expression#Left char2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right % AST#expression#Left HillCipher AST#expression#Right AST#binary_expression#Right AST#expression#Right . MOD AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left encrypted2 = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left c AST#expression#Right * AST#expression#Left char1 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left d AST#expression#Right * AST#expression#Left char2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right % AST#expression#Left HillCipher AST#expression#Right AST#binary_expression#Right AST#expression#Right . MOD AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left String AST#expression#Right . fromCharCode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left encrypted1 AST#expression#Right + AST#expression#Left 'A' AST#expression#Right AST#binary_expression#Right AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left String AST#expression#Right . fromCharCode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left encrypted2 AST#expression#Right + AST#expression#Left 'A' AST#expression#Right AST#binary_expression#Right AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static encrypt(text: string, key: number[][]): string { if (text.length % 2 !== 0) { text += 'X'; } let result = ''; for (let i = 0; i < text.length; i += 2) { const char1 = text.charCodeAt(i) - 'A'.charCodeAt(0); const char2 = text.charCodeAt(i + 1) - 'A'.charCodeAt(0); const a = key[0][0]; const b = key[0][1]; const c = key[1][0]; const d = key[1][1]; const encrypted1 = (a * char1 + b * char2) % HillCipher.MOD; const encrypted2 = (c * char1 + d * char2) % HillCipher.MOD; result += String.fromCharCode(encrypted1 + 'A'.charCodeAt(0)); result += String.fromCharCode(encrypted2 + 'A'.charCodeAt(0)); } return result; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/HillCipher.ets#L87-L113
f7137df7c261bb32c4c5c609529cb392c76058ba
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
deleteLearn
/ 删除此plan的Learn
async deleteLearn(): Promise<void> { await PlanManager.deleteLearnForPlan(this); }
AST#method_declaration#Left async deleteLearn AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left PlanManager AST#expression#Right AST#await_expression#Right AST#expression#Right . deleteLearnForPlan AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
async deleteLearn(): Promise<void> { await PlanManager.deleteLearnForPlan(this); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L508-L510
9fdaa6e72d310b2a1723c2195c45744716cb09f8
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ar/ARCardService.ets
arkts
碰撞形状枚举
export enum CollisionShape { BOX = 'box', SPHERE = 'sphere', CAPSULE = 'capsule', MESH = 'mesh' }
AST#export_declaration#Left export AST#enum_declaration#Left enum CollisionShape AST#enum_body#Left { AST#enum_member#Left BOX = AST#expression#Left 'box' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SPHERE = AST#expression#Left 'sphere' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left CAPSULE = AST#expression#Left 'capsule' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left MESH = AST#expression#Left 'mesh' AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export enum CollisionShape { BOX = 'box', SPHERE = 'sphere', CAPSULE = 'capsule', MESH = 'mesh' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L167-L172
e3f18b361527ad2c6717c8de9a27d1bc3d45dce8
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets
arkts
aboutToAppear
成功扫描二维码的提示音
aboutToAppear() { // 触发传感器震动 this.vibratorPlay(); // 播放二维码扫描成功提示音 this.avplayerPlay(); // 处理扫码结果信息 for (let i = 0; i < this.scanResults.size; i++) { let scanResult: scanBarcode.ScanResult = this.scanResults.data[i]; this.multiCodeScanResult.push(scanResult); let scanCodeRect: scanBarcode.ScanCodeRect | undefined = scanResult.scanCodeRect; if (scanCodeRect) { this.multiCodeScanLocation.push( [scanCodeRect.left, scanCodeRect.top, scanCodeRect.right, scanCodeRect.bottom] ); } } // 只扫描到一个二维码时,单独处理 if (this.scanResults.size === 1) { this.multiSelectedIndex = 0; let location = this.multiCodeScanLocation[0]; this.singleCodeX = this.getOffset('x', location); this.singleCodeY = this.getOffset('y', location); } }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 触发传感器震动 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vibratorPlay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 播放二维码扫描成功提示音 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avplayerPlay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 处理扫码结果信息 AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . scanResults AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left scanResult : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left scanBarcode . ScanResult AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scanResults AST#member_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . multiCodeScanResult AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left scanResult AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left scanCodeRect : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left scanBarcode . ScanCodeRect AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left scanResult AST#expression#Right . scanCodeRect AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left scanCodeRect AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . multiCodeScanLocation AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left scanCodeRect AST#expression#Right . left AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left scanCodeRect AST#expression#Right . top AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left scanCodeRect AST#expression#Right . right AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left scanCodeRect AST#expression#Right . bottom AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right // 只扫描到一个二维码时,单独处理 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scanResults AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . multiSelectedIndex AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left location = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . multiCodeScanLocation AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . singleCodeX AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'x' AST#expression#Right , AST#expression#Left location AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . singleCodeY AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'y' AST#expression#Right , AST#expression#Left location AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
aboutToAppear() { this.vibratorPlay(); this.avplayerPlay(); for (let i = 0; i < this.scanResults.size; i++) { let scanResult: scanBarcode.ScanResult = this.scanResults.data[i]; this.multiCodeScanResult.push(scanResult); let scanCodeRect: scanBarcode.ScanCodeRect | undefined = scanResult.scanCodeRect; if (scanCodeRect) { this.multiCodeScanLocation.push( [scanCodeRect.left, scanCodeRect.top, scanCodeRect.right, scanCodeRect.bottom] ); } } if (this.scanResults.size === 1) { this.multiSelectedIndex = 0; let location = this.multiCodeScanLocation[0]; this.singleCodeX = this.getOffset('x', location); this.singleCodeY = this.getOffset('y', location); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets#L74-L102
fc0d4559b084c27aa12d10521786d4233865a41e
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/ResponsiveScrollPositionList.ets
arkts
[EndExclude respond_to_scroll_position]
build() { // [StartExclude respond_to_scroll_position] NavDestination() { Column({ space: 12 }) { ComponentCard({ title: $r('app.string.ResponsiveScrollPositionList_titleExample') }) { // [EndExclude use_stack] Stack({ alignContent: Alignment.End }) { // 此为响应滚动位置示例List容器 List({ scroller: this.listScroller }) { // [StartExclude use_foreach] ForEach(contactsGroups, (itemGroup: ContactsGroup) => { ListItemGroup({ header: this.itemHead(itemGroup.title) }) { // 循环渲染ListItem if (itemGroup.contacts) { ForEach(itemGroup.contacts, (item: Contact) => { ListItem() { Row() { Image(item.icon).width(40).height(40).margin(10) Text(item.name).fontSize(20) }.width('100%').justifyContent(FlexAlign.Start) // [EndExclude respond_to_scroll_position] } // [StartExclude respond_to_scroll_position] }, (item: Contact) => JSON.stringify(item)) } } }, (itemGroup: ContactsGroup) => JSON.stringify(itemGroup)) } // [EndExclude respond_to_scroll_position] .onScrollIndex((firstIndex: number) => { // [StartExclude respond_to_scroll_position] // 根据列表滚动到的索引值,重新计算对应联系人索引栏的位置this.selectedIndex let group = contactsGroups[firstIndex] as ContactsGroup; this.currentGroupTitle = group.title; this.selectedIndex = alphabets.indexOf(this.currentGroupTitle); // [EndExclude respond_to_scroll_position] }) // 字母表索引组件 AlphabetIndexer({ arrayValue: alphabets, selected: 0 }) .selected(this.selectedIndex) // [End respond_to_scroll_position] }.height('90%') } } .width('100%') .height('100%') .padding({ left: 12, right: 12 }) } .backgroundColor('#f1f2f3') .title($r('app.string.ResponsiveScrollPositionList_title')) }
AST#build_method#Left build ( ) AST#build_body#Left { // [StartExclude respond_to_scroll_position] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ComponentCard ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.ResponsiveScrollPositionList_titleExample' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // [EndExclude use_stack] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . End AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 此为响应滚动位置示例List容器 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left scroller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listScroller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // [StartExclude use_foreach] AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left contactsGroups AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left itemGroup : AST#type_annotation#Left AST#primary_type#Left ContactsGroup AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItemGroup ( AST#component_parameters#Left { AST#component_parameter#Left header : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemHead AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left itemGroup AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 循环渲染ListItem AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left itemGroup AST#expression#Right . contacts AST#member_expression#Right AST#expression#Right ) { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left itemGroup AST#expression#Right . contacts AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . icon AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // [EndExclude respond_to_scroll_position] } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // [StartExclude respond_to_scroll_position] } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left itemGroup : AST#type_annotation#Left AST#primary_type#Left ContactsGroup AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left itemGroup AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right // [EndExclude respond_to_scroll_position] AST#modifier_chain_expression#Left . onScrollIndex ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left firstIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // [StartExclude respond_to_scroll_position] // 根据列表滚动到的索引值,重新计算对应联系人索引栏的位置this.selectedIndex AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left group = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left contactsGroups AST#expression#Right [ AST#expression#Left firstIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ContactsGroup AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentGroupTitle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left group AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedIndex AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left alphabets AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentGroupTitle AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // [EndExclude respond_to_scroll_position] } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 字母表索引组件 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AlphabetIndexer ( AST#component_parameters#Left { AST#component_parameter#Left arrayValue : AST#expression#Left alphabets AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left selected : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . selected ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedIndex AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // [End respond_to_scroll_position] } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f1f2f3' AST#expression#Right ) AST#modifier_chain_expression#Left . title ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.ResponsiveScrollPositionList_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { NavDestination() { Column({ space: 12 }) { ComponentCard({ title: $r('app.string.ResponsiveScrollPositionList_titleExample') }) { Stack({ alignContent: Alignment.End }) { List({ scroller: this.listScroller }) { ForEach(contactsGroups, (itemGroup: ContactsGroup) => { ListItemGroup({ header: this.itemHead(itemGroup.title) }) { if (itemGroup.contacts) { ForEach(itemGroup.contacts, (item: Contact) => { ListItem() { Row() { Image(item.icon).width(40).height(40).margin(10) Text(item.name).fontSize(20) }.width('100%').justifyContent(FlexAlign.Start) } }, (item: Contact) => JSON.stringify(item)) } } }, (itemGroup: ContactsGroup) => JSON.stringify(itemGroup)) } .onScrollIndex((firstIndex: number) => { let group = contactsGroups[firstIndex] as ContactsGroup; this.currentGroupTitle = group.title; this.selectedIndex = alphabets.indexOf(this.currentGroupTitle); }) AlphabetIndexer({ arrayValue: alphabets, selected: 0 }) .selected(this.selectedIndex) }.height('90%') } } .width('100%') .height('100%') .padding({ left: 12, right: 12 }) } .backgroundColor('#f1f2f3') .title($r('app.string.ResponsiveScrollPositionList_title')) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/ResponsiveScrollPositionList.ets#L124-L175
6447be0b5d223eb58e1bb0ec04fedf7dc5f29d50
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/LanguageSettingsPage.ets
arkts
getLanguageInfo
获取语言信息
private getLanguageInfo(language: SupportedLanguage): LanguageInfo | undefined { return this.supportedLanguages.find(lang => lang.code === language); }
AST#method_declaration#Left private getLanguageInfo AST#parameter_list#Left ( AST#parameter#Left language : AST#type_annotation#Left AST#primary_type#Left SupportedLanguage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left LanguageInfo AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . supportedLanguages AST#member_expression#Right AST#expression#Right . find AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left lang => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left lang AST#expression#Right . code AST#member_expression#Right AST#expression#Right === AST#expression#Left language AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private getLanguageInfo(language: SupportedLanguage): LanguageInfo | undefined { return this.supportedLanguages.find(lang => lang.code === language); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LanguageSettingsPage.ets#L639-L641
14151ec7c171c1aae72781550f26740a81924f39
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/decompressfile/src/main/ets/model/FileListDataSource.ets
arkts
clearData
清空数据
public clearData(): void { this.fileList = []; this.notifyDataReload(); }
AST#method_declaration#Left public clearData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileList AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataReload AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public clearData(): void { this.fileList = []; this.notifyDataReload(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/decompressfile/src/main/ets/model/FileListDataSource.ets#L56-L59
86e6628a4bce33a2b34ecea29702694dbe777123
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/Description.ets
arkts
getTextAlign
Returns the text alignment of the description. @return
public getTextAlign(): TextAlign { return this.mTextAlign; }
AST#method_declaration#Left public getTextAlign AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TextAlign AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mTextAlign AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getTextAlign(): TextAlign { return this.mTextAlign; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/Description.ets#L98-L100
ab5ad131064691aa7ce96b069ac6353cc30c1867
gitee
openharmony/bundlemanager_bundle_framework
89882654172b6bfba2a4a1ebfacdd6c9296f6f21
interfaces/kits/ani/shortcut_manager/ets/bundleManager/ShortcutInfo.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export interface ShortcutInfo { id: string; bundleName: string; moduleName?: string; hostAbility?: string; icon?: string; iconId?: number; label?: string; labelId?: number; wants?: Array<ShortcutWant>; appIndex: number; sourceType: number; visible?: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ShortcutInfo AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left bundleName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left moduleName ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left hostAbility ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left icon ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left iconId ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left label ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left labelId ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left wants ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ShortcutWant AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left appIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left sourceType : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left visible ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface ShortcutInfo { id: string; bundleName: string; moduleName?: string; hostAbility?: string; icon?: string; iconId?: number; label?: string; labelId?: number; wants?: Array<ShortcutWant>; appIndex: number; sourceType: number; visible?: boolean; }
https://github.com/openharmony/bundlemanager_bundle_framework/blob/89882654172b6bfba2a4a1ebfacdd6c9296f6f21/interfaces/kits/ani/shortcut_manager/ets/bundleManager/ShortcutInfo.ets#L16-L29
a8c5cb9fecb15f650caf6fe955821f139f0e35f1
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
版本信息接口
export interface VersionInfo { version: string; buildNumber: string; releaseDate: string; features: string[]; bugFixes: string[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface VersionInfo AST#object_type#Left { AST#type_member#Left version : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left buildNumber : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left releaseDate : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left features : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left bugFixes : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface VersionInfo { version: string; buildNumber: string; releaseDate: string; features: string[]; bugFixes: string[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L191-L197
1a9f8f89e87df736a5d822dfdd4fd290d52174ce
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/media/VoiceService.ets
arkts
recognizeSpeech
语音识别
async recognizeSpeech(audioPath?: string): Promise<RecognitionResult> { if (!this.recognizer) { throw new Error('语音识别引擎未初始化'); } try { const startTime = Date.now(); // 如果没有提供音频文件,则使用实时识别 let result: any; if (audioPath) { result = await this.recognizer.recognizeFile(audioPath); } else { result = await this.recognizer.recognizeRealtime(); } const endTime = Date.now(); const duration = (endTime - startTime) / 1000; const recognitionResult: RecognitionResult = { text: result.text || '', confidence: result.confidence || 0, timestamp: new Date().toISOString(), duration: duration }; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Speech recognition result: ${recognitionResult.text}`); return recognitionResult; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to recognize speech: ${error}`); throw error; } }
AST#method_declaration#Left async recognizeSpeech AST#parameter_list#Left ( AST#parameter#Left audioPath ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left RecognitionResult AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . recognizer AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '语音识别引擎未初始化' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left startTime = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 如果没有提供音频文件,则使用实时识别 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left audioPath AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . recognizer AST#member_expression#Right AST#expression#Right . recognizeFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left audioPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . recognizer AST#member_expression#Right AST#expression#Right . recognizeRealtime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left endTime = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left duration = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left endTime AST#expression#Right - AST#expression#Left startTime AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left recognitionResult : AST#type_annotation#Left AST#primary_type#Left RecognitionResult AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . text AST#member_expression#Right AST#expression#Right || AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left confidence AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . confidence AST#member_expression#Right AST#expression#Right || AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left timestamp AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left duration AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Speech recognition result: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left recognitionResult AST#expression#Right . text AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left recognitionResult AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to recognize speech: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left error AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async recognizeSpeech(audioPath?: string): Promise<RecognitionResult> { if (!this.recognizer) { throw new Error('语音识别引擎未初始化'); } try { const startTime = Date.now(); let result: any; if (audioPath) { result = await this.recognizer.recognizeFile(audioPath); } else { result = await this.recognizer.recognizeRealtime(); } const endTime = Date.now(); const duration = (endTime - startTime) / 1000; const recognitionResult: RecognitionResult = { text: result.text || '', confidence: result.confidence || 0, timestamp: new Date().toISOString(), duration: duration }; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Speech recognition result: ${recognitionResult.text}`); return recognitionResult; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to recognize speech: ${error}`); throw error; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/VoiceService.ets#L338-L373
7b0c21bd6e3f8a63fa39a455c833b7a1b656cfe2
github
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/FlawService.ets
arkts
delFlaw
删除故障 @param id 故障ID @returns 删除结果
static async delFlaw(id: number): Promise<ApiResponse<object>> { try { console.info(`[FlawService] 🗑️ 删除故障,ID: ${id}`); const response = await HttpUtil.delete(`/agv/flaw/${id}`); console.info('[FlawService] ✅ 故障删除成功'); const result: ApiResponse<object> = { code: response.code, msg: response.msg, data: response.data }; return result; } catch (error) { console.error(`[FlawService] ❌ 删除故障失败,ID: ${id}`, error); throw new Error(`删除故障失败,ID: ${id}`); } }
AST#method_declaration#Left static async delFlaw AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ApiResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [FlawService] 🗑️ 删除故障,ID: AST#template_substitution#Left $ { AST#expression#Left id AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left response = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left HttpUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` /agv/flaw/ AST#template_substitution#Left $ { AST#expression#Left id AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[FlawService] ✅ 故障删除成功' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ApiResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left code AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . code AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left msg AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . msg AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . data AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [FlawService] ❌ 删除故障失败,ID: AST#template_substitution#Left $ { AST#expression#Left id AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 删除故障失败,ID: AST#template_substitution#Left $ { AST#expression#Left id AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async delFlaw(id: number): Promise<ApiResponse<object>> { try { console.info(`[FlawService] 🗑️ 删除故障,ID: ${id}`); const response = await HttpUtil.delete(`/agv/flaw/${id}`); console.info('[FlawService] ✅ 故障删除成功'); const result: ApiResponse<object> = { code: response.code, msg: response.msg, data: response.data }; return result; } catch (error) { console.error(`[FlawService] ❌ 删除故障失败,ID: ${id}`, error); throw new Error(`删除故障失败,ID: ${id}`); } }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/FlawService.ets#L159-L174
64d32da17847dbd31016d5ffdcb926e880cc98eb
github
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/lib/Pointer.ets
arkts
hasNext
Checks if there are more elements to iterate over. @returns True if there are more elements, otherwise false.
hasNext(): boolean { do { if (this.pointerMap.getPointer(this.index) != null) { return true; }
AST#method_declaration#Left hasNext AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#ERROR#Left AST#expression_statement#Left AST#expression#Left do AST#expression#Right AST#expression_statement#Right { AST#property_name#Left if AST#property_name#Right ( this AST#modifier_chain_expression#Left . pointerMap AST#modifier_chain_expression#Left . getPointer ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . index AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right ! = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left ) { AST#property_assignment#Left return AST#property_assignment#Right AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
hasNext(): boolean { do { if (this.pointerMap.getPointer(this.index) != null) { return true; }
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/Pointer.ets#L137-L141
d503bc6b9d64516a2d38442dbf74369eea6889e6
github
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/common/utils/MQTTUtil.ets
arkts
scheduleReconnect
安排自动重连
private scheduleReconnect(): void { // 如果已达到最大重连次数,停止重连 if (this.reconnectAttempts >= this.maxReconnectAttempts) { console.error(`已达到最大重连次数(${this.maxReconnectAttempts}),停止重连`); return; } // 清除可能存在的定时器 if (this.reconnectTimer !== -1) { clearTimeout(this.reconnectTimer); } // 计算下次重连延迟 const delay = this.getNextReconnectDelay(); this.reconnectAttempts++; console.info(`安排MQTT重连,第${this.reconnectAttempts}次尝试,延迟${delay}ms`); // 设置重连定时器 this.reconnectTimer = setTimeout(() => { console.info('执行MQTT重连...'); if (this.messageCallback) { this.connect(this.messageCallback); } else { this.connect((err, data) => { if (!err) { console.info(`重连后收到消息: ${data.topic}, ${data.payload}`); } }); } }, delay); }
AST#method_declaration#Left private scheduleReconnect AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 如果已达到最大重连次数,停止重连 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reconnectAttempts AST#member_expression#Right AST#expression#Right >= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . maxReconnectAttempts AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 已达到最大重连次数( AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maxReconnectAttempts AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ),停止重连 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 清除可能存在的定时器 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reconnectTimer AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left clearTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reconnectTimer AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 计算下次重连延迟 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left delay = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getNextReconnectDelay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reconnectAttempts AST#member_expression#Right AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 安排MQTT重连,第 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reconnectAttempts AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 次尝试,延迟 AST#template_substitution#Left $ { AST#expression#Left delay AST#expression#Right } AST#template_substitution#Right ms ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置重连定时器 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reconnectTimer AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '执行MQTT重连...' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . messageCallback AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . connect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . messageCallback AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . connect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right , AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left err AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 重连后收到消息: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . topic AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . payload AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left delay AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private scheduleReconnect(): void { if (this.reconnectAttempts >= this.maxReconnectAttempts) { console.error(`已达到最大重连次数(${this.maxReconnectAttempts}),停止重连`); return; } if (this.reconnectTimer !== -1) { clearTimeout(this.reconnectTimer); } const delay = this.getNextReconnectDelay(); this.reconnectAttempts++; console.info(`安排MQTT重连,第${this.reconnectAttempts}次尝试,延迟${delay}ms`); this.reconnectTimer = setTimeout(() => { console.info('执行MQTT重连...'); if (this.messageCallback) { this.connect(this.messageCallback); } else { this.connect((err, data) => { if (!err) { console.info(`重连后收到消息: ${data.topic}, ${data.payload}`); } }); } }, delay); }
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/MQTTUtil.ets#L152-L183
5352245cd7c0f75aa44add87f434ad63b92665b0
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/Scroller.ets
arkts
customBuilder3
定义List的builder方法
@Builder customBuilder3() {}
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right customBuilder3 AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
@Builder customBuilder3() {}
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/Scroller.ets#L45-L45
56daa6d15976021a09066158f7823cec62384b7e
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets
arkts
connectRemoteService
连接远端Service
async function connectRemoteService(deviceId) { // 连接成功的回调 async function onConnectCallback(element, remote) { console.log('[game]connectRemoteService onConnectCallback:' + remote) mRemote = remote; } // Service异常死亡的回调 function onDisconnectCallback(element) { console.log('[game]connectRemoteService onDisconnectCallback') prompt.showToast({ message: "onDisconnectCallback " }); } // 连接失败的回调 function onFailedCallback(code) { console.log('[game]connectRemoteService onFailedCallback') prompt.showToast({ message: "onConnectRemoteService onFailed: " + code }); } if (remoteDeviceModel.deviceList.length === 0) { console.log('[game]connectRemoteService onConnectRemoteService no device found') prompt.showToast({ message: "onConnectRemoteService no device found" }); return; } await featureAbility.connectAbility( { 'deviceId': deviceId, 'bundleName': "com.huawei.cookbook", 'abilityName': "com.huawei.cookbook.ServiceAbility", }, { onConnect: onConnectCallback, onDisconnect: onDisconnectCallback, onFailed: onFailedCallback, }, ); }
AST#function_declaration#Left async function connectRemoteService AST#parameter_list#Left ( AST#parameter#Left deviceId AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 连接成功的回调 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#function_expression#Left async function onConnectCallback AST#parameter_list#Left ( AST#parameter#Left element AST#parameter#Right , AST#parameter#Left remote AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '[game]connectRemoteService onConnectCallback:' AST#expression#Right + AST#expression#Left remote AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left mRemote = AST#expression#Left remote AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // Service异常死亡的回调 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#function_expression#Left function onDisconnectCallback AST#parameter_list#Left ( AST#parameter#Left element AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[game]connectRemoteService onDisconnectCallback' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left prompt AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left "onDisconnectCallback " AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // 连接失败的回调 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#function_expression#Left function onFailedCallback AST#parameter_list#Left ( AST#parameter#Left code AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[game]connectRemoteService onFailedCallback' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left prompt AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left "onConnectRemoteService onFailed: " AST#expression#Right + AST#expression#Left code AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left remoteDeviceModel AST#expression#Right . deviceList AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[game]connectRemoteService onConnectRemoteService no device found' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left prompt AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left "onConnectRemoteService no device found" AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left featureAbility AST#expression#Right AST#await_expression#Right AST#expression#Right . connectAbility AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'deviceId' AST#property_name#Right : AST#expression#Left deviceId AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'bundleName' AST#property_name#Right : AST#expression#Left "com.huawei.cookbook" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'abilityName' AST#property_name#Right : AST#expression#Left "com.huawei.cookbook.ServiceAbility" AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onConnect AST#property_name#Right : AST#expression#Left onConnectCallback AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onDisconnect AST#property_name#Right : AST#expression#Left onDisconnectCallback AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFailed AST#property_name#Right : AST#expression#Left onFailedCallback AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
async function connectRemoteService(deviceId) { async function onConnectCallback(element, remote) { console.log('[game]connectRemoteService onConnectCallback:' + remote) mRemote = remote; } function onDisconnectCallback(element) { console.log('[game]connectRemoteService onDisconnectCallback') prompt.showToast({ message: "onDisconnectCallback " }); } function onFailedCallback(code) { console.log('[game]connectRemoteService onFailedCallback') prompt.showToast({ message: "onConnectRemoteService onFailed: " + code }); } if (remoteDeviceModel.deviceList.length === 0) { console.log('[game]connectRemoteService onConnectRemoteService no device found') prompt.showToast({ message: "onConnectRemoteService no device found" }); return; } await featureAbility.connectAbility( { 'deviceId': deviceId, 'bundleName': "com.huawei.cookbook", 'abilityName': "com.huawei.cookbook.ServiceAbility", }, { onConnect: onConnectCallback, onDisconnect: onDisconnectCallback, onFailed: onFailedCallback, }, ); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets#L60-L100
c9e370df2a9026f38ab4a9587a4ec65805c9cb7d
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
Base-class of LineChart, BarChart, ScatterChart and CandleStickChart.
export default abstract class BarLineChartBaseModel<T extends BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleDataSet<EntryOhos>>> extends Chart<T> implements BarLineScatterCandleBubbleDataProvider { /** * the maximum number of entries to which values will be drawn * (entry numbers greater than this value will cause value-labels to disappear) */ protected mMaxVisibleCount: number = 100; /** * flag that indicates if auto scaling on the y axis is enabled */ protected mAutoScaleMinMaxEnabled: boolean = false; /** * flag that indicates if pinch-zoom is enabled. if true, both x and y axis * can be scaled with 2 fingers, if false, x and y axis can be scaled * separately */ protected mPinchZoomEnabled: boolean = false; /** * flag that indicates if double tap zoom is enabled or not */ protected mDoubleTapToZoomEnabled: boolean = true; /** * flag that indicates if highlighting per dragging over a fully zoomed out * chart is enabled */ protected mHighlightPerDragEnabled: boolean = true; /** * if true, dragging is enabled for the chart */ private mDragXEnabled: boolean = true; private mDragYEnabled: boolean = true; private mScaleXEnabled: boolean = true; private mScaleYEnabled: boolean = true; /** * paint object for the (by default) lightgrey background of the grid */ protected mGridBackgroundPaint: Paint | null = null; protected mBorderPaint: Paint | null = null; /** * flag indicating if the grid background should be drawn or not */ protected mDrawGridBackground: boolean = false; protected mDrawBorders: boolean = false; protected mClipValuesToContent: boolean = false; protected mClipDataToContent: boolean = true; /** * Sets the minimum offset (padding) around the chart, defaults to 15 */ protected mMinOffset: number = 15.0; /** * flag indicating if the chart should stay at the same position after a rotation. Default is false. */ protected mKeepPositionOnRotation: boolean = false; /** * the listener for user drawing on the chart */ protected mDrawListener: OnDrawListener | null = null; /** * the object representing the labels on the left y-axis */ protected mAxisLeft: YAxis | null = null; /** * the object representing the labels on the right y-axis */ protected mAxisRight: YAxis | null = null; protected mLeftAxisTransformer: Transformer | null = null; protected mRightAxisTransformer: Transformer | null = null; protected mAxisRendererLeft: YAxisRenderer | null = null; protected mAxisRendererRight: YAxisRenderer | null = null; protected mXAxisRenderer: XAxisRenderer | null = null; private mEventControl: EventControl = new EventControl(); /** * long press cursor response capability */ protected mLongPressCursorEnabled: boolean = false; protected mLongPressDuration: number = 500; protected mSwipeEnabled: boolean = false; //Represents whether the chart is horizontally flipped. protected isHorizontalFlip: boolean = false; textSizeCache = new HashMap<string, TextMetrics>(); /** Set the horizontal flip status of the element. @param isHorizontalFlip - Boolean value indicating whether to horizontally flip the element. */ public setHorizontalFlip(isHorizontalFlip: boolean): void { this.isHorizontalFlip = isHorizontalFlip; } /** Get the current horizontal flip status of the element. @returns boolean - Returns true if the element is horizontally flipped, false otherwise. */ public getHorizontalFlip(): boolean { return this.isHorizontalFlip; } public setLongPressCursorEnabled(enabled: boolean): void { this.mLongPressCursorEnabled = enabled; } public getLongPressCursorEnabled(): boolean { return this.mLongPressCursorEnabled; } public setLongPressDuration(duration: number): void { this.mLongPressDuration = duration; } public getLongPressDuration(): number { return this.mLongPressDuration; } public setSwipeEnabled(enabled: boolean): void { this.mSwipeEnabled = enabled; } public getSwipeEnabled(): boolean { return this.mSwipeEnabled; } public get eventControl() { return this.mEventControl } // /** the approximator object used for data filtering */ // private Approximator mApproximator; constructor() { super(); this.init(); } protected mYAxisExtensionLine: boolean = false; public setYAxisExtensionLine(opt: boolean) { this.mYAxisExtensionLine = opt; } public yAxisExtensionLineIsEnable() { return this.mYAxisExtensionLine } /*public BarLineChartBase(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public BarLineChartBase(Context context, AttributeSet attrs) { super(context, attrs); } public BarLineChartBase(Context context) { super(context); }*/ // protected init(): void { super.init(); this.mAxisLeft = new YAxis(AxisDependency.LEFT); this.mAxisRight = new YAxis(AxisDependency.RIGHT); this.mLeftAxisTransformer = new Transformer(this.mViewPortHandler); this.mRightAxisTransformer = new Transformer(this.mViewPortHandler); this.mAxisRendererLeft = new YAxisRenderer(this.mViewPortHandler, this.mAxisLeft, this.mLeftAxisTransformer); this.mAxisRendererRight = new YAxisRenderer(this.mViewPortHandler, this.mAxisRight, this.mRightAxisTransformer); if (this.mXAxis) { this.mXAxisRenderer = new XAxisRenderer(this.mViewPortHandler, this.mXAxis, this.mLeftAxisTransformer); } this.setHighlighter(new ChartHighlighter(this)); this.mChartTouchListener = new BarLineChartTouchListener(this, this.mViewPortHandler.getMatrixTouch(), 3) as ChartTouchListener<Chart<ChartData<IDataSet<EntryOhos>>>>; this.mGridBackgroundPaint = new Paint(); this.mGridBackgroundPaint.setStyle(Style.FILL); // mGridBackgroundPaint.setColor(Color.WHITE); this.mGridBackgroundPaint.setColor('#f0f0f0'); // light // grey this.mBorderPaint = new Paint(); this.mBorderPaint.setStyle(Style.STROKE); this.mBorderPaint.setColor(Color.Black); this.mBorderPaint.setStrokeWidth(Utils.handleDataValues(1)); } // for performance tracking private totalTime: number = 0; private drawCycles: number = 0; public onDraw(context2D: CanvasRenderingContext2D): void { super.onDraw(context2D); if (!this.mData || !this.mRenderer || !this.mChartSizeCorrected) return; // 清空画布,防止图表堆叠 CanvasUtil.clearCanvas(context2D); // let starttime: number = new Date().getMilliseconds(); // execute all drawing commands this.drawGridBackground(context2D); if (this.mAutoScaleMinMaxEnabled) { this.autoScale(); } if (this.mAxisRendererLeft && this.mAxisLeft && this.mAxisLeft.isEnabled()) { this.mAxisRendererLeft.computeAxis(this.mAxisLeft.mAxisMinimum, this.mAxisLeft.mAxisMaximum, this.mAxisLeft.isInverted()); } if (this.mAxisRendererRight && this.mAxisRight && this.mAxisRight.isEnabled()) { this.mAxisRendererRight.computeAxis(this.mAxisRight.mAxisMinimum, this.mAxisRight.mAxisMaximum, this.mAxisRight.isInverted()); } if (this.mXAxisRenderer && this.mXAxis && this.mXAxis.isEnabled()) { this.mXAxisRenderer.computeAxis(this.mXAxis.mAxisMinimum, this.mXAxis.mAxisMaximum, false); } // y轴延长线计算 let extraLength = 0; if (this.yAxisExtensionLineIsEnable()) { extraLength = this.mAxisLeft?.isEnabled() ? this.calcExtensionLine(this.mAxisRendererLeft) : 0; if (!extraLength) { extraLength = this.mAxisRight?.isEnabled() ? this.calcExtensionLine(this.mAxisRendererRight) : 0; } } if (this.mXAxisRenderer) { this.mXAxisRenderer.renderAxisLine(context2D); } if (this.mAxisRendererLeft) { this.mAxisRendererLeft.renderAxisLine(context2D, extraLength); } if (this.mAxisRendererRight) { this.mAxisRendererRight.renderAxisLine(context2D, extraLength); } if (this.mXAxisRenderer && this.mXAxis && this.mXAxis.isDrawGridLinesBehindDataEnabled()) { this.mXAxisRenderer.renderGridLines(context2D); } if (this.mAxisRendererLeft && this.mAxisLeft && this.mAxisLeft.isDrawGridLinesBehindDataEnabled()) { this.mAxisRendererLeft.renderGridLines(context2D); } if (this.mAxisRendererRight && this.mAxisRight && this.mAxisRight.isDrawGridLinesBehindDataEnabled()) { this.mAxisRendererRight.renderGridLines(context2D); } if (this.mXAxisRenderer && this.mXAxis && this.mXAxis.isEnabled()) { this.mXAxisRenderer.renderCustomGridLines(context2D); this.mXAxis.isDrawLimitLinesBehindDataEnabled() && this.mXAxisRenderer.renderLimitLines(context2D); } if (this.mAxisRendererLeft && this.mAxisLeft && this.mAxisLeft.isEnabled()) { this.mAxisRendererLeft.renderCustomGridLines(context2D); this.mAxisLeft.isDrawLimitLinesBehindDataEnabled() && this.mAxisRendererLeft.renderLimitLines(context2D, this.getHorizontalFlip()); } if (this.mAxisRendererRight && this.mAxisRight && this.mAxisRight.isEnabled()) { this.mAxisRendererRight.renderCustomGridLines(context2D); this.mAxisRight.isDrawLimitLinesBehindDataEnabled() && this.mAxisRendererRight.renderLimitLines(context2D, this.getHorizontalFlip()); } //let clipRestoreCount:number = context2D.save(); if (this.isClipDataToContentEnabled()) { // make sure the data cannot be drawn outside the content-rect let rect = this.mViewPortHandler.getContentRect(); context2D.beginPath(); context2D.rect(rect.left, rect.top, rect.width(), rect.height()); context2D.closePath(); context2D.clip(); } this.mRenderer.drawData(context2D); if (this.mXAxisRenderer && this.mXAxis && !this.mXAxis.isDrawGridLinesBehindDataEnabled()) { this.mXAxisRenderer.renderGridLines(context2D); } if (this.mAxisRendererLeft && this.mAxisLeft && !this.mAxisLeft.isDrawGridLinesBehindDataEnabled()) { this.mAxisRendererLeft.renderGridLines(context2D); } if (this.mAxisRendererRight && this.mAxisRight && !this.mAxisRight.isDrawGridLinesBehindDataEnabled()) { this.mAxisRendererRight.renderGridLines(context2D); } // if highlighting is enabled if (this.valuesToHighlight() && this.mIndicesToHighlight) this.mRenderer.drawHighlighted(context2D, this.mIndicesToHighlight, false); // Removes clipping rectangle context2D.restore(); if (this.mRenderer) { this.mRenderer.drawExtras(context2D); } if (this.mXAxisRenderer && this.mXAxis && this.mXAxis.isEnabled() && !this.mXAxis.isDrawLimitLinesBehindDataEnabled()) { this.mXAxisRenderer.renderLimitLines(context2D); } if (this.mAxisRendererLeft && this.mAxisLeft && this.mAxisLeft.isEnabled() && !this.mAxisLeft.isDrawLimitLinesBehindDataEnabled()) { this.mAxisRendererLeft.renderLimitLines(context2D, this.getHorizontalFlip()); } if (this.mAxisRendererRight && this.mAxisRight && this.mAxisRight.isEnabled() && !this.mAxisRight.isDrawLimitLinesBehindDataEnabled()) { this.mAxisRendererRight.renderLimitLines(context2D, this.getHorizontalFlip()); } if (this.mXAxisRenderer) { this.mXAxisRenderer.renderAxisLabels(context2D, this.getHorizontalFlip()); } if (this.mAxisRendererLeft) { this.mAxisRendererLeft.renderAxisLabels(context2D, this.getHorizontalFlip(), true); } if (this.mAxisRendererRight) { this.mAxisRendererRight.renderAxisLabels(context2D, this.getHorizontalFlip(), false); } if (this.isClipValuesToContentEnabled()) { // this.clipRestoreCount = context2D.save(); let rect = this.mViewPortHandler.getContentRect() context2D.rect(rect.left, rect.right, rect.width(), rect.height()); context2D.clip(); this.mRenderer.drawValues(context2D, this.getHorizontalFlip()); context2D.restore(); //canvas.restoreToCount(clipRestoreCount); } else { this.mRenderer.drawValues(context2D, this.getHorizontalFlip()); } if (this.mLegendRenderer) { this.mLegendRenderer.renderLegend(context2D); } this.drawDescription(context2D); this.drawMarkers(context2D); this.drawLongPressMarkers(context2D); // if (this.mLogEnabled) { // let drawtime: number = (new Date().getMilliseconds() - starttime); // this.totalTime += drawtime; // this.drawCycles += 1; // let average: number = this.totalTime / this.drawCycles; // LogUtil.log(Chart.LOG_TAG + "Drawtime: " + drawtime + " ms, average: " + average + " ms, cycles: " // + this.drawCycles); // } } // y轴计算延长线 private calcExtensionLine(render: YAxisRenderer | null) { let extensionLength = 0; if (render) { if (this.mXAxis) { extensionLength = this.mXAxis.getYOffset() + this.mXAxis.mLabelRotatedHeight / 2 + Utils.getLabelTextSize(render.getPaintAxisLine(), '0', this.textSizeCache).height; } } return extensionLength; } /** * RESET PERFORMANCE TRACKING FIELDS */ public resetTracking(): void { this.totalTime = 0; this.drawCycles = 0; } protected prepareValuePxMatrix(): void { if (this.mLogEnabled && this.mXAxis) { LogUtil.log(Chart.LOG_TAG + "Preparing Value-Px Matrix, xmin: " + this.mXAxis.mAxisMinimum + ", xmax: " + this.mXAxis.mAxisMaximum + ", xdelta: " + this.mXAxis.mAxisRange); } if (this.mRightAxisTransformer && this.mXAxis && this.mAxisRight) { this.mRightAxisTransformer.prepareMatrixValuePx(this.mXAxis.mAxisMinimum, this.mXAxis.mAxisRange, this.mAxisRight.mAxisRange, this.mAxisRight.mAxisMinimum); } if (this.mLeftAxisTransformer && this.mXAxis && this.mAxisLeft) { this.mLeftAxisTransformer.prepareMatrixValuePx(this.mXAxis.mAxisMinimum, this.mXAxis.mAxisRange, this.mAxisLeft.mAxisRange, this.mAxisLeft.mAxisMinimum); } } protected prepareOffsetMatrix(): void { if (this.mRightAxisTransformer && this.mAxisRight) { this.mRightAxisTransformer.prepareMatrixOffset(this.mAxisRight.isInverted()); } if (this.mLeftAxisTransformer && this.mAxisLeft) { this.mLeftAxisTransformer.prepareMatrixOffset(this.mAxisLeft.isInverted()); } } public notifyDataSetChanged(): void { if (this.mData == null) { if (this.mLogEnabled) LogUtil.log(Chart.LOG_TAG + "Preparing... DATA NOT SET."); return; } else { if (this.mLogEnabled) LogUtil.log(Chart.LOG_TAG + "Preparing..."); } if (this.mRenderer != null) this.mRenderer.initBuffers(); this.calcMinMax(); if (this.mAxisRendererLeft && this.mAxisLeft) { this.mAxisRendererLeft.computeAxis(this.mAxisLeft.mAxisMinimum, this.mAxisLeft.mAxisMaximum, this.mAxisLeft.isInverted()); } if (this.mAxisRendererRight && this.mAxisRight) { this.mAxisRendererRight.computeAxis(this.mAxisRight.mAxisMinimum, this.mAxisRight.mAxisMaximum, this.mAxisRight.isInverted()); } if (this.mXAxisRenderer && this.mXAxis) { this.mXAxisRenderer.computeAxis(this.mXAxis.mAxisMinimum, this.mXAxis.mAxisMaximum, false); } if (this.mLegendRenderer && this.mLegend) { this.mLegendRenderer.computeLegend(this.mData); } this.calculateOffsets(); } /** * Performs auto scaling of the axis by recalculating the minimum and maximum y-values based on the entries currently in view. */ protected autoScale(): void { if (!this.mData) { return; } const fromX: number = this.getLowestVisibleX(); const toX: number = this.getHighestVisibleX(); this.mData.calcMinMaxY(fromX, toX); if (this.mXAxis) { this.mXAxis.calculate(this.mData.getXMin(), this.mData.getXMax()); } // calculate axis range (min / max) according to provided data if (this.mAxisLeft && this.mAxisLeft.isEnabled()) this.mAxisLeft.calculate(this.mData.getYMin(AxisDependency.LEFT), this.mData.getYMax(AxisDependency.LEFT)); if (this.mAxisRight && this.mAxisRight.isEnabled()) this.mAxisRight.calculate(this.mData.getYMin(AxisDependency.RIGHT), this.mData.getYMax(AxisDependency.RIGHT)); this.calculateOffsets(); } protected calcMinMax(): void { if (!this.mData) { return; } if (this.mXAxis) { this.mXAxis.calculate(this.mData.getXMin(), this.mData.getXMax()); } // calculate axis range (min / max) according to provided data if (this.mAxisLeft) { this.mAxisLeft.calculate(this.mData.getYMin(AxisDependency.LEFT), this.mData.getYMax(AxisDependency.LEFT)); } if (this.mAxisRight) { this.mAxisRight.calculate(this.mData.getYMin(AxisDependency.RIGHT), this.mData.getYMax(AxisDependency .RIGHT)); } } protected calculateLegendOffsets(offsets: MyRect): void { offsets.left = 0; offsets.right = 0; offsets.top = 0; offsets.bottom = 0; if (this.mLegend == null || !this.mLegend.isEnabled() || this.mLegend.isDrawInsideEnabled()) return; switch (this.mLegend.getOrientation()) { case LegendOrientation.VERTICAL: switch (this.mLegend.getHorizontalAlignment()) { case LegendHorizontalAlignment.LEFT: offsets.left += Math.min(this.mLegend.mNeededWidth, this.mViewPortHandler.getChartWidth() * this.mLegend.getMaxSizePercent()) + this.mLegend.getXOffset();
AST#export_declaration#Left export default AST#ERROR#Left abstract class BarLineChartBaseModel AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BarLineScatterCandleBubbleData AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IBarLineScatterCandleBubbleDataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Chart AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#implements_clause#Left implements BarLineScatterCandleBubbleDataProvider AST#implements_clause#Right { /** * the maximum number of entries to which values will be drawn * (entry numbers greater than this value will cause value-labels to disappear) */ AST#property_declaration#Left protected mMaxVisibleCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100 AST#expression#Right ; AST#property_declaration#Right /** * flag that indicates if auto scaling on the y axis is enabled */ AST#property_declaration#Left protected mAutoScaleMinMaxEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * flag that indicates if pinch-zoom is enabled. if true, both x and y axis * can be scaled with 2 fingers, if false, x and y axis can be scaled * separately */ AST#property_declaration#Left protected mPinchZoomEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * flag that indicates if double tap zoom is enabled or not */ AST#property_declaration#Left protected mDoubleTapToZoomEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * flag that indicates if highlighting per dragging over a fully zoomed out * chart is enabled */ AST#property_declaration#Left protected mHighlightPerDragEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * if true, dragging is enabled for the chart */ AST#property_declaration#Left private mDragXEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private mDragYEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private mScaleXEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private mScaleYEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * paint object for the (by default) lightgrey background of the grid */ AST#property_declaration#Left protected mGridBackgroundPaint : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Paint AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left protected mBorderPaint : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Paint AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * flag indicating if the grid background should be drawn or not */ AST#property_declaration#Left protected mDrawGridBackground : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left protected mDrawBorders : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left protected mClipValuesToContent : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left protected mClipDataToContent : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * Sets the minimum offset (padding) around the chart, defaults to 15 */ AST#property_declaration#Left protected mMinOffset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 15.0 AST#expression#Right ; AST#property_declaration#Right /** * flag indicating if the chart should stay at the same position after a rotation. Default is false. */ AST#property_declaration#Left protected mKeepPositionOnRotation : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * the listener for user drawing on the chart */ AST#property_declaration#Left protected mDrawListener : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left OnDrawListener AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * the object representing the labels on the left y-axis */ AST#property_declaration#Left protected mAxisLeft : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left YAxis AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * the object representing the labels on the right y-axis */ AST#property_declaration#Left protected mAxisRight : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left YAxis AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left protected mLeftAxisTransformer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Transformer AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left protected mRightAxisTransformer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Transformer AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left protected mAxisRendererLeft : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left YAxisRenderer AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left protected mAxisRendererRight : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left YAxisRenderer AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left protected mXAxisRenderer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left XAxisRenderer AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private mEventControl : AST#type_annotation#Left AST#primary_type#Left EventControl AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left EventControl AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * long press cursor response capability */ AST#property_declaration#Left protected mLongPressCursorEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left protected mLongPressDuration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 500 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left protected mSwipeEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right //Represents whether the chart is horizontally flipped. AST#property_declaration#Left protected isHorizontalFlip : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left textSizeCache = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left HashMap AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left TextMetrics AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right /** Set the horizontal flip status of the element. @param isHorizontalFlip - Boolean value indicating whether to horizontally flip the element. */ AST#method_declaration#Left public setHorizontalFlip AST#parameter_list#Left ( AST#parameter#Left isHorizontalFlip : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isHorizontalFlip AST#member_expression#Right = AST#expression#Left isHorizontalFlip AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** Get the current horizontal flip status of the element. @returns boolean - Returns true if the element is horizontally flipped, false otherwise. */ AST#method_declaration#Left public getHorizontalFlip AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isHorizontalFlip AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public setLongPressCursorEnabled AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLongPressCursorEnabled AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getLongPressCursorEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLongPressCursorEnabled AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public setLongPressDuration AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLongPressDuration AST#member_expression#Right = AST#expression#Left duration AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getLongPressDuration AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLongPressDuration AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public setSwipeEnabled AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mSwipeEnabled AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getSwipeEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mSwipeEnabled AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public get AST#ERROR#Left eventControl AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mEventControl AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // /** the approximator object used for data filtering */ // private Approximator mApproximator; AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left super AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right AST#property_declaration#Left protected mYAxisExtensionLine : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left public setYAxisExtensionLine AST#parameter_list#Left ( AST#parameter#Left opt : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mYAxisExtensionLine AST#member_expression#Right = AST#expression#Left opt AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public yAxisExtensionLineIsEnable AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mYAxisExtensionLine AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /*public BarLineChartBase(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public BarLineChartBase(Context context, AttributeSet attrs) { super(context, attrs); } public BarLineChartBase(Context context) { super(context); }*/ // AST#method_declaration#Left protected init AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left super AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left YAxis AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AxisDependency AST#expression#Right . LEFT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left YAxis AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AxisDependency AST#expression#Right . RIGHT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLeftAxisTransformer AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Transformer AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRightAxisTransformer AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Transformer AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left YAxisRenderer AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLeftAxisTransformer AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left YAxisRenderer AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRightAxisTransformer AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left XAxisRenderer AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLeftAxisTransformer AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setHighlighter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ChartHighlighter AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mChartTouchListener AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left BarLineChartTouchListener AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . getMatrixTouch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left 3 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ChartTouchListener AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Chart AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ChartData AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IDataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mGridBackgroundPaint AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Paint AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mGridBackgroundPaint AST#member_expression#Right AST#expression#Right . setStyle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Style AST#expression#Right . FILL AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // mGridBackgroundPaint.setColor(Color.WHITE); AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mGridBackgroundPaint AST#member_expression#Right AST#expression#Right . setColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '#f0f0f0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // light // grey AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mBorderPaint AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Paint AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mBorderPaint AST#member_expression#Right AST#expression#Right . setStyle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Style AST#expression#Right . STROKE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mBorderPaint AST#member_expression#Right AST#expression#Right . setColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mBorderPaint AST#member_expression#Right AST#expression#Right . setStrokeWidth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . handleDataValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right // for performance tracking AST#property_declaration#Left private totalTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private drawCycles : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left public onDraw AST#parameter_list#Left ( AST#parameter#Left context2D : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left super AST#expression#Right . onDraw AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . mData AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . mChartSizeCorrected AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right // 清空画布,防止图表堆叠 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CanvasUtil AST#expression#Right . clearCanvas AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // let starttime: number = new Date().getMilliseconds(); // execute all drawing commands AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . drawGridBackground AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAutoScaleMinMaxEnabled AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . autoScale AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right . computeAxis AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . mAxisMinimum AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . mAxisMaximum AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . isInverted AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right . computeAxis AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . mAxisMinimum AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . mAxisMaximum AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . isInverted AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right . computeAxis AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . mAxisMinimum AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . mAxisMaximum AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // y轴延长线计算 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left extraLength = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . yAxisExtensionLineIsEnable AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left extraLength = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right ?. isEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calcExtensionLine AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left extraLength AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left extraLength = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right ?. isEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calcExtensionLine AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right . renderAxisLine AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right . renderAxisLine AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right , AST#expression#Left extraLength AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right . renderAxisLine AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right , AST#expression#Left extraLength AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . isDrawGridLinesBehindDataEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right . renderGridLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . isDrawGridLinesBehindDataEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right . renderGridLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . isDrawGridLinesBehindDataEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right . renderGridLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right . renderCustomGridLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . isDrawLimitLinesBehindDataEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right . renderLimitLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right . renderCustomGridLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . isDrawLimitLinesBehindDataEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right . renderLimitLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getHorizontalFlip AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right . renderCustomGridLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . isDrawLimitLinesBehindDataEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right . renderLimitLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getHorizontalFlip AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right //let clipRestoreCount:number = AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context2D AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isClipDataToContentEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { // make sure the data cannot be drawn outside the content-rect AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left rect = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . getContentRect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context2D AST#expression#Right . beginPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context2D AST#expression#Right . rect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left rect AST#expression#Right . left AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left rect AST#expression#Right . top AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rect AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rect AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context2D AST#expression#Right . closePath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context2D AST#expression#Right . clip AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right . drawData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . isDrawGridLinesBehindDataEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right . renderGridLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . isDrawGridLinesBehindDataEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right . renderGridLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . isDrawGridLinesBehindDataEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right . renderGridLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // if highlighting is enabled AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . valuesToHighlight AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mIndicesToHighlight AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right . drawHighlighted AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mIndicesToHighlight AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right // Removes clipping rectangle AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context2D AST#expression#Right . restore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right . drawExtras AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . isDrawLimitLinesBehindDataEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right . renderLimitLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . isDrawLimitLinesBehindDataEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right . renderLimitLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getHorizontalFlip AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . isDrawLimitLinesBehindDataEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right . renderLimitLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getHorizontalFlip AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right . renderAxisLabels AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getHorizontalFlip AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right . renderAxisLabels AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getHorizontalFlip AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right . renderAxisLabels AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getHorizontalFlip AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isClipValuesToContentEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { // this.clipRestoreCount = AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context2D AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left rect = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . getContentRect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left context 2 D AST#ERROR#Right . rect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left rect AST#expression#Right . left AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left rect AST#expression#Right . right AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rect AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rect AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context2D AST#expression#Right . clip AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right . drawValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getHorizontalFlip AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context2D AST#expression#Right . restore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //canvas.restoreToCount(clipRestoreCount); } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right . drawValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getHorizontalFlip AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLegendRenderer AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLegendRenderer AST#member_expression#Right AST#expression#Right . renderLegend AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . drawDescription AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . drawMarkers AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . drawLongPressMarkers AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context2D AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // if (this.mLogEnabled) { // let drawtime: number = (new Date().getMilliseconds() - starttime); // this.totalTime += drawtime; // this.drawCycles += 1; // let average: number = this.totalTime / this.drawCycles; // LogUtil.log(Chart.LOG_TAG + "Drawtime: " + drawtime + " ms, average: " + average + " ms, cycles: " // + this.drawCycles); // } } AST#block_statement#Right AST#method_declaration#Right // y轴计算延长线 AST#method_declaration#Left private calcExtensionLine AST#parameter_list#Left ( AST#parameter#Left render : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left YAxisRenderer AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left extensionLength = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left render AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left extensionLength = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . getYOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . mLabelRotatedHeight AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Utils AST#expression#Right AST#binary_expression#Right AST#expression#Right . getLabelTextSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left render AST#expression#Right . getPaintAxisLine AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left '0' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textSizeCache AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left extensionLength AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * RESET PERFORMANCE TRACKING FIELDS */ AST#method_declaration#Left public resetTracking AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . totalTime AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . drawCycles AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left protected prepareValuePxMatrix AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLogEnabled AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Chart AST#expression#Right . LOG_TAG AST#member_expression#Right AST#expression#Right + AST#expression#Left "Preparing Value-Px Matrix, xmin: " AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . mAxisMinimum AST#member_expression#Right AST#expression#Right + AST#expression#Left ", xmax: " AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . mAxisMaximum AST#member_expression#Right AST#expression#Right + AST#expression#Left ", xdelta: " AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . mAxisRange AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRightAxisTransformer AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRightAxisTransformer AST#member_expression#Right AST#expression#Right . prepareMatrixValuePx AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . mAxisMinimum AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . mAxisRange AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . mAxisRange AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . mAxisMinimum AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLeftAxisTransformer AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLeftAxisTransformer AST#member_expression#Right AST#expression#Right . prepareMatrixValuePx AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . mAxisMinimum AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . mAxisRange AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . mAxisRange AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . mAxisMinimum AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left protected prepareOffsetMatrix AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRightAxisTransformer AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRightAxisTransformer AST#member_expression#Right AST#expression#Right . prepareMatrixOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . isInverted AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLeftAxisTransformer AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLeftAxisTransformer AST#member_expression#Right AST#expression#Right . prepareMatrixOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . isInverted AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public notifyDataSetChanged AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLogEnabled AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Chart AST#expression#Right . LOG_TAG AST#member_expression#Right AST#expression#Right + AST#expression#Left "Preparing... DATA NOT SET." AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLogEnabled AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Chart AST#expression#Right . LOG_TAG AST#member_expression#Right AST#expression#Right + AST#expression#Left "Preparing..." AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right . initBuffers AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calcMinMax AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererLeft AST#member_expression#Right AST#expression#Right . computeAxis AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . mAxisMinimum AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . mAxisMaximum AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . isInverted AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRendererRight AST#member_expression#Right AST#expression#Right . computeAxis AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . mAxisMinimum AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . mAxisMaximum AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . isInverted AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxisRenderer AST#member_expression#Right AST#expression#Right . computeAxis AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . mAxisMinimum AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . mAxisMaximum AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLegendRenderer AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mLegend AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLegendRenderer AST#member_expression#Right AST#expression#Right . computeLegend AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calculateOffsets AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Performs auto scaling of the axis by recalculating the minimum and maximum y-values based on the entries currently in view. */ AST#method_declaration#Left protected autoScale AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . mData AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left fromX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getLowestVisibleX AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left toX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getHighestVisibleX AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . calcMinMaxY AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fromX AST#expression#Right , AST#expression#Left toX AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . calculate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getXMin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getXMax AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // calculate axis range (min / max) according to provided data AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . calculate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getYMin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AxisDependency AST#expression#Right . LEFT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getYMax AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AxisDependency AST#expression#Right . LEFT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . calculate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getYMin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AxisDependency AST#expression#Right . RIGHT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getYMax AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AxisDependency AST#expression#Right . RIGHT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calculateOffsets AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left protected calcMinMax AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . mData AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis AST#member_expression#Right AST#expression#Right . calculate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getXMin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getXMax AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // calculate axis range (min / max) according to provided data AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLeft AST#member_expression#Right AST#expression#Right . calculate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getYMin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AxisDependency AST#expression#Right . LEFT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getYMax AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AxisDependency AST#expression#Right . LEFT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisRight AST#member_expression#Right AST#expression#Right . calculate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getYMin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AxisDependency AST#expression#Right . RIGHT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getYMax AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AxisDependency AST#expression#Right . RIGHT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right protected calculateLegendOffsets AST#parameter_list#Left ( AST#parameter#Left offsets : AST#type_annotation#Left AST#primary_type#Left MyRect AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right { AST#ERROR#Left AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left offsets AST#expression#Right . left AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left offsets AST#expression#Right . right AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left offsets AST#expression#Right . top AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left offsets AST#expression#Right . bottom AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLegend AST#member_expression#Right AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . mLegend AST#member_expression#Right AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mLegend AST#member_expression#Right AST#expression#Right . isDrawInsideEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLegend AST#member_expression#Right AST#expression#Right . getOrientation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right { AST#property_name#Left case AST#property_name#Right LegendOrientation AST#ERROR#Right AST#modifier_chain_expression#Left . VERTICAL AST#modifier_chain_expression#Right : AST#ERROR#Left switch AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left this . mLegend . getHorizontalAlignment AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ( AST#ERROR#Right ) AST#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ) AST#ERROR#Right { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LegendHorizontalAlignment AST#expression#Right . LEFT AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Right : AST#ERROR#Left AST#qualified_type#Left offsets . left AST#ERROR#Left += Math AST#ERROR#Right . min AST#qualified_type#Right AST#ERROR#Right ( AST#ERROR#Left AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left this . mLegend . mNeededWidth AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right , this . mViewPortHandler . getChartWidth AST#parameter_list#Left ( ) AST#parameter_list#Right * this . mLegend . getMaxSizePercent AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right ) AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left + AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . mLegend AST#member_expression#Right AST#expression#Right . getXOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#export_declaration#Right
export default abstract class BarLineChartBaseModel<T extends BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleDataSet<EntryOhos>>> extends Chart<T> implements BarLineScatterCandleBubbleDataProvider { protected mMaxVisibleCount: number = 100; protected mAutoScaleMinMaxEnabled: boolean = false; protected mPinchZoomEnabled: boolean = false; protected mDoubleTapToZoomEnabled: boolean = true; protected mHighlightPerDragEnabled: boolean = true; private mDragXEnabled: boolean = true; private mDragYEnabled: boolean = true; private mScaleXEnabled: boolean = true; private mScaleYEnabled: boolean = true; protected mGridBackgroundPaint: Paint | null = null; protected mBorderPaint: Paint | null = null; protected mDrawGridBackground: boolean = false; protected mDrawBorders: boolean = false; protected mClipValuesToContent: boolean = false; protected mClipDataToContent: boolean = true; protected mMinOffset: number = 15.0; protected mKeepPositionOnRotation: boolean = false; protected mDrawListener: OnDrawListener | null = null; protected mAxisLeft: YAxis | null = null; protected mAxisRight: YAxis | null = null; protected mLeftAxisTransformer: Transformer | null = null; protected mRightAxisTransformer: Transformer | null = null; protected mAxisRendererLeft: YAxisRenderer | null = null; protected mAxisRendererRight: YAxisRenderer | null = null; protected mXAxisRenderer: XAxisRenderer | null = null; private mEventControl: EventControl = new EventControl(); protected mLongPressCursorEnabled: boolean = false; protected mLongPressDuration: number = 500; protected mSwipeEnabled: boolean = false; protected isHorizontalFlip: boolean = false; textSizeCache = new HashMap<string, TextMetrics>(); public setHorizontalFlip(isHorizontalFlip: boolean): void { this.isHorizontalFlip = isHorizontalFlip; } public getHorizontalFlip(): boolean { return this.isHorizontalFlip; } public setLongPressCursorEnabled(enabled: boolean): void { this.mLongPressCursorEnabled = enabled; } public getLongPressCursorEnabled(): boolean { return this.mLongPressCursorEnabled; } public setLongPressDuration(duration: number): void { this.mLongPressDuration = duration; } public getLongPressDuration(): number { return this.mLongPressDuration; } public setSwipeEnabled(enabled: boolean): void { this.mSwipeEnabled = enabled; } public getSwipeEnabled(): boolean { return this.mSwipeEnabled; } public get eventControl() { return this.mEventControl } constructor() { super(); this.init(); } protected mYAxisExtensionLine: boolean = false; public setYAxisExtensionLine(opt: boolean) { this.mYAxisExtensionLine = opt; } public yAxisExtensionLineIsEnable() { return this.mYAxisExtensionLine } protected init(): void { super.init(); this.mAxisLeft = new YAxis(AxisDependency.LEFT); this.mAxisRight = new YAxis(AxisDependency.RIGHT); this.mLeftAxisTransformer = new Transformer(this.mViewPortHandler); this.mRightAxisTransformer = new Transformer(this.mViewPortHandler); this.mAxisRendererLeft = new YAxisRenderer(this.mViewPortHandler, this.mAxisLeft, this.mLeftAxisTransformer); this.mAxisRendererRight = new YAxisRenderer(this.mViewPortHandler, this.mAxisRight, this.mRightAxisTransformer); if (this.mXAxis) { this.mXAxisRenderer = new XAxisRenderer(this.mViewPortHandler, this.mXAxis, this.mLeftAxisTransformer); } this.setHighlighter(new ChartHighlighter(this)); this.mChartTouchListener = new BarLineChartTouchListener(this, this.mViewPortHandler.getMatrixTouch(), 3) as ChartTouchListener<Chart<ChartData<IDataSet<EntryOhos>>>>; this.mGridBackgroundPaint = new Paint(); this.mGridBackgroundPaint.setStyle(Style.FILL); mGridBackgroundPaint.setColor(Color.WHITE); this.mGridBackgroundPaint.setColor('#f0f0f0'); light grey this.mBorderPaint = new Paint(); this.mBorderPaint.setStyle(Style.STROKE); this.mBorderPaint.setColor(Color.Black); this.mBorderPaint.setStrokeWidth(Utils.handleDataValues(1)); } for performance tracking private totalTime: number = 0; private drawCycles: number = 0; public onDraw(context2D: CanvasRenderingContext2D): void { super.onDraw(context2D); if (!this.mData || !this.mRenderer || !this.mChartSizeCorrected) return; 清空画布,防止图表堆叠 CanvasUtil.clearCanvas(context2D); let starttime: number = new Date().getMilliseconds(); execute all drawing commands this.drawGridBackground(context2D); if (this.mAutoScaleMinMaxEnabled) { this.autoScale(); } if (this.mAxisRendererLeft && this.mAxisLeft && this.mAxisLeft.isEnabled()) { this.mAxisRendererLeft.computeAxis(this.mAxisLeft.mAxisMinimum, this.mAxisLeft.mAxisMaximum, this.mAxisLeft.isInverted()); } if (this.mAxisRendererRight && this.mAxisRight && this.mAxisRight.isEnabled()) { this.mAxisRendererRight.computeAxis(this.mAxisRight.mAxisMinimum, this.mAxisRight.mAxisMaximum, this.mAxisRight.isInverted()); } if (this.mXAxisRenderer && this.mXAxis && this.mXAxis.isEnabled()) { this.mXAxisRenderer.computeAxis(this.mXAxis.mAxisMinimum, this.mXAxis.mAxisMaximum, false); } y轴延长线计算 let extraLength = 0; if (this.yAxisExtensionLineIsEnable()) { extraLength = this.mAxisLeft?.isEnabled() ? this.calcExtensionLine(this.mAxisRendererLeft) : 0; if (!extraLength) { extraLength = this.mAxisRight?.isEnabled() ? this.calcExtensionLine(this.mAxisRendererRight) : 0; } } if (this.mXAxisRenderer) { this.mXAxisRenderer.renderAxisLine(context2D); } if (this.mAxisRendererLeft) { this.mAxisRendererLeft.renderAxisLine(context2D, extraLength); } if (this.mAxisRendererRight) { this.mAxisRendererRight.renderAxisLine(context2D, extraLength); } if (this.mXAxisRenderer && this.mXAxis && this.mXAxis.isDrawGridLinesBehindDataEnabled()) { this.mXAxisRenderer.renderGridLines(context2D); } if (this.mAxisRendererLeft && this.mAxisLeft && this.mAxisLeft.isDrawGridLinesBehindDataEnabled()) { this.mAxisRendererLeft.renderGridLines(context2D); } if (this.mAxisRendererRight && this.mAxisRight && this.mAxisRight.isDrawGridLinesBehindDataEnabled()) { this.mAxisRendererRight.renderGridLines(context2D); } if (this.mXAxisRenderer && this.mXAxis && this.mXAxis.isEnabled()) { this.mXAxisRenderer.renderCustomGridLines(context2D); this.mXAxis.isDrawLimitLinesBehindDataEnabled() && this.mXAxisRenderer.renderLimitLines(context2D); } if (this.mAxisRendererLeft && this.mAxisLeft && this.mAxisLeft.isEnabled()) { this.mAxisRendererLeft.renderCustomGridLines(context2D); this.mAxisLeft.isDrawLimitLinesBehindDataEnabled() && this.mAxisRendererLeft.renderLimitLines(context2D, this.getHorizontalFlip()); } if (this.mAxisRendererRight && this.mAxisRight && this.mAxisRight.isEnabled()) { this.mAxisRendererRight.renderCustomGridLines(context2D); this.mAxisRight.isDrawLimitLinesBehindDataEnabled() && this.mAxisRendererRight.renderLimitLines(context2D, this.getHorizontalFlip()); } let clipRestoreCount:number = context2D.save(); if (this.isClipDataToContentEnabled()) { make sure the data cannot be drawn outside the content-rect let rect = this.mViewPortHandler.getContentRect(); context2D.beginPath(); context2D.rect(rect.left, rect.top, rect.width(), rect.height()); context2D.closePath(); context2D.clip(); } this.mRenderer.drawData(context2D); if (this.mXAxisRenderer && this.mXAxis && !this.mXAxis.isDrawGridLinesBehindDataEnabled()) { this.mXAxisRenderer.renderGridLines(context2D); } if (this.mAxisRendererLeft && this.mAxisLeft && !this.mAxisLeft.isDrawGridLinesBehindDataEnabled()) { this.mAxisRendererLeft.renderGridLines(context2D); } if (this.mAxisRendererRight && this.mAxisRight && !this.mAxisRight.isDrawGridLinesBehindDataEnabled()) { this.mAxisRendererRight.renderGridLines(context2D); } if highlighting is enabled if (this.valuesToHighlight() && this.mIndicesToHighlight) this.mRenderer.drawHighlighted(context2D, this.mIndicesToHighlight, false); Removes clipping rectangle context2D.restore(); if (this.mRenderer) { this.mRenderer.drawExtras(context2D); } if (this.mXAxisRenderer && this.mXAxis && this.mXAxis.isEnabled() && !this.mXAxis.isDrawLimitLinesBehindDataEnabled()) { this.mXAxisRenderer.renderLimitLines(context2D); } if (this.mAxisRendererLeft && this.mAxisLeft && this.mAxisLeft.isEnabled() && !this.mAxisLeft.isDrawLimitLinesBehindDataEnabled()) { this.mAxisRendererLeft.renderLimitLines(context2D, this.getHorizontalFlip()); } if (this.mAxisRendererRight && this.mAxisRight && this.mAxisRight.isEnabled() && !this.mAxisRight.isDrawLimitLinesBehindDataEnabled()) { this.mAxisRendererRight.renderLimitLines(context2D, this.getHorizontalFlip()); } if (this.mXAxisRenderer) { this.mXAxisRenderer.renderAxisLabels(context2D, this.getHorizontalFlip()); } if (this.mAxisRendererLeft) { this.mAxisRendererLeft.renderAxisLabels(context2D, this.getHorizontalFlip(), true); } if (this.mAxisRendererRight) { this.mAxisRendererRight.renderAxisLabels(context2D, this.getHorizontalFlip(), false); } if (this.isClipValuesToContentEnabled()) { this.clipRestoreCount = context2D.save(); let rect = this.mViewPortHandler.getContentRect() context2D.rect(rect.left, rect.right, rect.width(), rect.height()); context2D.clip(); this.mRenderer.drawValues(context2D, this.getHorizontalFlip()); context2D.restore(); canvas.restoreToCount(clipRestoreCount); } else { this.mRenderer.drawValues(context2D, this.getHorizontalFlip()); } if (this.mLegendRenderer) { this.mLegendRenderer.renderLegend(context2D); } this.drawDescription(context2D); this.drawMarkers(context2D); this.drawLongPressMarkers(context2D); if (this.mLogEnabled) { let drawtime: number = (new Date().getMilliseconds() - starttime); this.totalTime += drawtime; this.drawCycles += 1; let average: number = this.totalTime / this.drawCycles; LogUtil.log(Chart.LOG_TAG + "Drawtime: " + drawtime + " ms, average: " + average + " ms, cycles: " + this.drawCycles); } } y轴计算延长线 private calcExtensionLine(render: YAxisRenderer | null) { let extensionLength = 0; if (render) { if (this.mXAxis) { extensionLength = this.mXAxis.getYOffset() + this.mXAxis.mLabelRotatedHeight / 2 + Utils.getLabelTextSize(render.getPaintAxisLine(), '0', this.textSizeCache).height; } } return extensionLength; } public resetTracking(): void { this.totalTime = 0; this.drawCycles = 0; } protected prepareValuePxMatrix(): void { if (this.mLogEnabled && this.mXAxis) { LogUtil.log(Chart.LOG_TAG + "Preparing Value-Px Matrix, xmin: " + this.mXAxis.mAxisMinimum + ", xmax: " + this.mXAxis.mAxisMaximum + ", xdelta: " + this.mXAxis.mAxisRange); } if (this.mRightAxisTransformer && this.mXAxis && this.mAxisRight) { this.mRightAxisTransformer.prepareMatrixValuePx(this.mXAxis.mAxisMinimum, this.mXAxis.mAxisRange, this.mAxisRight.mAxisRange, this.mAxisRight.mAxisMinimum); } if (this.mLeftAxisTransformer && this.mXAxis && this.mAxisLeft) { this.mLeftAxisTransformer.prepareMatrixValuePx(this.mXAxis.mAxisMinimum, this.mXAxis.mAxisRange, this.mAxisLeft.mAxisRange, this.mAxisLeft.mAxisMinimum); } } protected prepareOffsetMatrix(): void { if (this.mRightAxisTransformer && this.mAxisRight) { this.mRightAxisTransformer.prepareMatrixOffset(this.mAxisRight.isInverted()); } if (this.mLeftAxisTransformer && this.mAxisLeft) { this.mLeftAxisTransformer.prepareMatrixOffset(this.mAxisLeft.isInverted()); } } public notifyDataSetChanged(): void { if (this.mData == null) { if (this.mLogEnabled) LogUtil.log(Chart.LOG_TAG + "Preparing... DATA NOT SET."); return; } else { if (this.mLogEnabled) LogUtil.log(Chart.LOG_TAG + "Preparing..."); } if (this.mRenderer != null) this.mRenderer.initBuffers(); this.calcMinMax(); if (this.mAxisRendererLeft && this.mAxisLeft) { this.mAxisRendererLeft.computeAxis(this.mAxisLeft.mAxisMinimum, this.mAxisLeft.mAxisMaximum, this.mAxisLeft.isInverted()); } if (this.mAxisRendererRight && this.mAxisRight) { this.mAxisRendererRight.computeAxis(this.mAxisRight.mAxisMinimum, this.mAxisRight.mAxisMaximum, this.mAxisRight.isInverted()); } if (this.mXAxisRenderer && this.mXAxis) { this.mXAxisRenderer.computeAxis(this.mXAxis.mAxisMinimum, this.mXAxis.mAxisMaximum, false); } if (this.mLegendRenderer && this.mLegend) { this.mLegendRenderer.computeLegend(this.mData); } this.calculateOffsets(); } protected autoScale(): void { if (!this.mData) { return; } const fromX: number = this.getLowestVisibleX(); const toX: number = this.getHighestVisibleX(); this.mData.calcMinMaxY(fromX, toX); if (this.mXAxis) { this.mXAxis.calculate(this.mData.getXMin(), this.mData.getXMax()); } calculate axis range (min / max) according to provided data if (this.mAxisLeft && this.mAxisLeft.isEnabled()) this.mAxisLeft.calculate(this.mData.getYMin(AxisDependency.LEFT), this.mData.getYMax(AxisDependency.LEFT)); if (this.mAxisRight && this.mAxisRight.isEnabled()) this.mAxisRight.calculate(this.mData.getYMin(AxisDependency.RIGHT), this.mData.getYMax(AxisDependency.RIGHT)); this.calculateOffsets(); } protected calcMinMax(): void { if (!this.mData) { return; } if (this.mXAxis) { this.mXAxis.calculate(this.mData.getXMin(), this.mData.getXMax()); } calculate axis range (min / max) according to provided data if (this.mAxisLeft) { this.mAxisLeft.calculate(this.mData.getYMin(AxisDependency.LEFT), this.mData.getYMax(AxisDependency.LEFT)); } if (this.mAxisRight) { this.mAxisRight.calculate(this.mData.getYMin(AxisDependency.RIGHT), this.mData.getYMax(AxisDependency .RIGHT)); } } protected calculateLegendOffsets(offsets: MyRect): void { offsets.left = 0; offsets.right = 0; offsets.top = 0; offsets.bottom = 0; if (this.mLegend == null || !this.mLegend.isEnabled() || this.mLegend.isDrawInsideEnabled()) return; switch (this.mLegend.getOrientation()) { case LegendOrientation.VERTICAL: switch (this.mLegend.getHorizontalAlignment()) { case LegendHorizontalAlignment.LEFT: offsets.left += Math.min(this.mLegend.mNeededWidth, this.mViewPortHandler.getChartWidth() * this.mLegend.getMaxSizePercent()) + this.mLegend.getXOffset();
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarLineChartBaseModel.ets#L53-L564
88489d3f9b9a84c8517cda2040a73e3ff284f297
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/datatype/collections/queue_001_T.ets
arkts
Introduction 集合-队列类型
export function queue_001_T(taint_src : Queue<string>) { taint.Sink(taint_src); }
AST#export_declaration#Left export AST#function_declaration#Left function queue_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Queue AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left taint_src AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function queue_001_T(taint_src : Queue<string>) { taint.Sink(taint_src); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/datatype/collections/queue_001_T.ets#L6-L8
bec2692588a96f00c774611d68f1848e94f4059b
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/dbUtils/DBAccessor.ets
arkts
数据库访问工具类 封装HarmonyOS relationalStore操作,提供安全易用的数据库访问接口 注意:所有数据库操作完成后会自动关闭连接,无需手动管理
export class DBAccessor { // MARK: - 成员变量 /** 主数据库文件路径(示例:'/data/app/main.db') */ private dbPath: string | null; /** 需要附加的数据库路径列表(示例:['/data/app/user.db']) */ private attachPaths: Array<string | null> | null; private isReadOnly: boolean = true /** 数据库连接实例(使用后会自动关闭) */ private rdbStore: relationalStore.RdbStore | null = null; /** 初始化状态标志 */ private isInitialized = false; // MARK: - 初始化方法 /** * 构造函数 * @param dbPath - 主数据库文件路径(必须) * @param attachPaths - 需要附加的其他数据库路径(可选) */ constructor(dbPath: string | null, attachPaths: Array<string | null> | null = null, isReadOnly: boolean = true) { this.dbPath = dbPath; this.attachPaths = attachPaths; this.isReadOnly = isReadOnly } // MARK: - 私有方法 /** * 初始化数据库连接 * @returns Promise<boolean> 返回是否初始化成功 * 注意:该方法会自动处理连接关闭,调用方无需关心资源释放 */ private async initDatabase(): Promise<boolean> { // 已初始化则直接返回 if (this.isInitialized) return true; // 检查数据库路径有效性 if (!this.dbPath) { console.error("DBAccessor: 数据库路径不能为空"); return false; } const relativePath = PathUtility.getRelativeDatabasePath(this.dbPath!) const dbFolder = PathUtility.getParentPathOf(relativePath) const dbFolderPath = PathUtility.removeLastSlashOfDirectoryIfExists(dbFolder) const dbName = PathUtility.getLastComponentName(this.dbPath!) // 数据库配置 const STORE_CONFIG: relationalStore.StoreConfig = { name: dbName, customDir: dbFolderPath!,///相对于../rdb/后的部分 isReadOnly: this.isReadOnly, //只读 securityLevel: relationalStore.SecurityLevel.S2 // S1级安全加密 }; try { // 创建数据库连接 this.rdbStore = await relationalStore.getRdbStore(getAppContext(), STORE_CONFIG); // 附加其他数据库 if (this.attachPaths) { for (const path of this.attachPaths) { if (path) await this.attachDatabase(path); } } this.isInitialized = true; return true; } catch (err) { console.error(`DBAccessor: 数据库初始化失败 - ${err}`); this.closeDatabase(); // 初始化失败时关闭连接 return false; } } /** * 附加其他数据库 * @param path - 需要附加的数据库路径 */ private async attachDatabase(path: string): Promise<void> { if (!this.rdbStore) return; // 从路径中提取数据库名称(去除路径和扩展名) const dbName = path.substring( path.lastIndexOf('/') + 1, // 获取文件名 path.lastIndexOf('.sqlite') // 去除.db后缀 ); try { await this.rdbStore.executeSql(`ATTACH DATABASE '${path}' AS ${dbName}`); DebugLog.d(`ATTACH DATABASE '${path}' AS ${dbName}`) } catch (err) { console.error(`DBAccessor: 附加数据库失败 [${path}] - ${err}`); } } /** * 关闭数据库连接(私有方法) */ private closeDatabase(): void { try { this.rdbStore?.close(); this.rdbStore = null; this.isInitialized = false; DebugLog.d('DBAccessor-closeDatabased') } catch (err) { DebugLog.d("DBAccessor: 关闭数据库连接失败:" + err, ); } } // MARK: - 数据查询接口 /** * 执行查询并返回多条记录 * @param sql - SQL查询语句(需包含WHERE等条件) * @param params - 查询参数数组(可选,默认空数组) * @param handler - 处理单行结果的回调函数 * @returns Promise<T[] | null> 返回查询结果数组或null(出错时) * 注意:该方法会自动关闭结果集和数据库连接 */ async getDatas<T>( sql: string, params: ParamType[] = [], handler: (rs: relationalStore.ResultSet) => T ): Promise<T[] | null> { if (!await this.initDatabase()) return null; try { // 执行查询 const resultSet = await this.rdbStore!.querySql(sql, params); DebugLog.d(sql +' 参数: ' + params) const results: T[] = []; // 遍历结果集 while (resultSet.goToNextRow()) { results.push(handler(resultSet)); } // 关闭结果集 resultSet.close(); return results.length > 0 ? results : null; } catch (err) { console.error(`DBAccessor: 查询失败 [${sql}] - ${err}`); return null; } finally { this.closeDatabase(); // 确保关闭连接 } } ///同步方法,需要提前初始化isInitialized getDatasSync<T>( sql: string, params: ParamType[] = [], handler: (rs: relationalStore.ResultSet) => T ): T[] | null { if (!this.isInitialized) return null; try { const resultSet = this.rdbStore!.querySqlSync(sql, params); // 假设存在同步API DebugLog.d(sql +' 参数: ' + params) const results: T[] = []; while (resultSet.goToNextRow()) { results.push(handler(resultSet)); } resultSet.close(); return results.length > 0 ? results : null; } catch (err) { console.error(`同步查询失败: ${err}`); return null; } } /** * 执行查询并返回单条记录 * @param sql - SQL查询语句 * @param params - 查询参数数组(可选) * @param handler - 处理单行结果的回调函数 * @returns Promise<T | null> 返回查询结果或null(无结果或出错时) * 注意:该方法会自动关闭结果集和数据库连接 */ async getData<T>( sql: string, params: ParamType[] = [], handler: (rs: relationalStore.ResultSet) => T | null ): Promise<T | null> { if (!await this.initDatabase()) return null; try { const resultSet = await this.rdbStore!.querySql(sql, params); DebugLog.d(sql +' 参数: ' + params) // 只获取第一条记录 const result = resultSet.goToNextRow() ? handler(resultSet) : null; resultSet.close(); return result; } catch (err) { console.error(`DBAccessor: 单条查询失败 [${sql}] - ${err}`); return null; } finally { this.closeDatabase(); // 确保关闭连接 } } ///同步方法,需要提前初始化isInitialized getDataSync<T>( sql: string, params: ParamType[] = [], handler: (rs: relationalStore.ResultSet) => T | null ): T | null { if (! this.initDatabase()) return null; try { const resultSet = this.rdbStore!.querySqlSync(sql, params); DebugLog.d(sql +' 参数: ' + params) // 只获取第一条记录 const result = resultSet.goToNextRow() ? handler(resultSet) : null; resultSet.close(); return result; } catch (err) { console.error(`DBAccessor: 单条查询失败 [${sql}] - ${err}`); return null; } finally { this.closeDatabase(); // 确保关闭连接 } } // MARK: - 实用方法 /** * 获取查询结果的行数 * @param sql - COUNT查询语句(如:"SELECT COUNT(*) FROM users") * @param params - 查询参数(可选) * @returns Promise<number> 返回记录数量(出错时返回0) */ async getCount(sql: string, params: ParamType[] = []): Promise<number> { const count = await this.getData<number>( sql, params, rs => rs.getLong(0) // 获取COUNT结果的第一列 ); return count ?? 0; // 空值保护 } /** * 获取指定列的最大值 * @param column - 列名(如:"age") * @param table - 表名(如:"users") * @param where - WHERE条件语句(可选,如:"status = 1") * @returns Promise<number> 返回最大值(无数据时返回0) */ async getMax(column: string, table: string, where?: string): Promise<number> { // 构建MAX查询SQL let sql = `SELECT MAX(${column}) FROM ${table}`; if (where) sql += ` WHERE ${where}`; const max = await this.getData<number>(sql, [], rs => rs.getLong(0)); return max ?? 0; } /** * 检查表中是否存在某列 * @param column - 需要检查的列名 * @param table - 表名 * @returns Promise<boolean> 返回列是否存在 */ async isExist(column: string, table: string): Promise<boolean> { // 使用PRAGMA查询表结构 const names = await this.getDatas<string>( `PRAGMA table_info(${table})`, [], rs => rs.getString(1) // 获取列名字段 ); return names?.includes(column) ?? false; } /** * 检查查询结果是否存在记录 * @param sql - 存在性查询语句(如:"SELECT 1 FROM users WHERE id = ?") * @param params - 查询参数(可选) * @returns Promise<boolean> 返回是否存在记录 */ async isExistWithSql(sql: string, params: ParamType[] = []): Promise<boolean> { if (!await this.initDatabase()) return false; try { const resultSet = await this.rdbStore!.querySql(sql, params); DebugLog.d(sql +' 参数: ' + params) // 只需检查是否有第一条记录 const exists = resultSet.goToNextRow(); resultSet.close(); return exists; } catch (err) { console.error(`DBAccessor: 存在性查询失败 [${sql}] - ${err}`); return false; } finally { this.closeDatabase(); // 确保关闭连接 } } // MARK: - 数据修改接口 /** * 执行更新操作(INSERT/UPDATE/DELETE) * @param sql - 更新语句 * @param params - 参数数组(可选) * @returns Promise<boolean> 返回是否执行成功 * 注意:该方法会自动关闭数据库连接 */ async updateDb(sql: string, params: ParamType[] = []): Promise<boolean> { if (!await this.initDatabase()) return false; try { await this.rdbStore!.executeSql(sql, params); DebugLog.d(sql +' 参数: ' + params) return true; } catch (err) { console.error(`DBAccessor: 更新失败 [${sql}] - ${err}`); return false; } finally { this.closeDatabase(); // 确保关闭连接 } } /** * 在事务中批量执行更新操作 * @param sqls - SQL语句数组 * @param paramsList - 参数数组的数组(与sqls一一对应) * @returns Promise<boolean> 返回是否全部执行成功 * 注意:该方法会自动关闭数据库连接 */ async updateDbBatch( sqls: string[], paramsList: ParamType[][] = [] ): Promise<boolean> { if (!await this.initDatabase()) return false; if (!this.isInitialized || !this.rdbStore) { console.error('数据库未初始化成功'); return false; } try { // 使用 beginTransaction(通常不会返回 txId) this.rdbStore!.beginTransaction(); for (let i = 0; i < sqls.length; i++) { try { await this.rdbStore?.executeSql(sqls[i], paramsList[i] || []); DebugLog.d(sqls[i] +' 参数' + paramsList[i]) } catch (err) { DebugLog.e(`DBAccessor: 执行失败 [${i}] [${sqls[i]}], 参数: ${paramsList[i]}}, - ${err}`); this.rdbStore?.rollBack(); // 注意:rollBack 无参数 return false; } } this.rdbStore?.commit(); return true; } catch (err) { console.error(`DBAccessor: 事务执行异常 - ${err}`); return false; } finally { this.closeDatabase(); } } ///安全编码字符串参数(带输入验证和类型守卫) static encodedParamString(param: string | null): string | null { if (!param?.trim()) return null; // 合并空值检查和trim return StringEncoder.encodedToBase64(param) ?? null; // 空值合并操作符 } }
AST#export_declaration#Left export AST#class_declaration#Left class DBAccessor AST#class_body#Left { // MARK: - 成员变量 /** 主数据库文件路径(示例:'/data/app/main.db') */ AST#property_declaration#Left private dbPath : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** 需要附加的数据库路径列表(示例:['/data/app/user.db']) */ AST#property_declaration#Left private attachPaths : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private isReadOnly : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right /** 数据库连接实例(使用后会自动关闭) */ AST#property_declaration#Right AST#property_declaration#Left private rdbStore : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbStore AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /** 初始化状态标志 */ AST#property_declaration#Left private isInitialized = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // MARK: - 初始化方法 /** * 构造函数 * @param dbPath - 主数据库文件路径(必须) * @param attachPaths - 需要附加的其他数据库路径(可选) */ AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left dbPath : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left attachPaths : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left isReadOnly : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dbPath AST#member_expression#Right = AST#expression#Left dbPath AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . attachPaths AST#member_expression#Right = AST#expression#Left attachPaths AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isReadOnly AST#member_expression#Right = AST#expression#Left isReadOnly AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right // MARK: - 私有方法 /** * 初始化数据库连接 * @returns Promise<boolean> 返回是否初始化成功 * 注意:该方法会自动处理连接关闭,调用方无需关心资源释放 */ AST#method_declaration#Left private async initDatabase AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 已初始化则直接返回 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isInitialized AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right // 检查数据库路径有效性 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . dbPath AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "DBAccessor: 数据库路径不能为空" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left relativePath = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PathUtility AST#expression#Right . getRelativeDatabasePath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dbPath AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dbFolder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PathUtility AST#expression#Right . getParentPathOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left relativePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dbFolderPath = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PathUtility AST#expression#Right . removeLastSlashOfDirectoryIfExists AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dbFolder AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dbName = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PathUtility AST#expression#Right . getLastComponentName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dbPath AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right // 数据库配置 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left STORE_CONFIG : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . StoreConfig AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left dbName AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left customDir AST#property_name#Right : AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left dbFolderPath AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right AST#property_assignment#Right , ///相对于../rdb/后的部分 AST#property_assignment#Left AST#property_name#Left isReadOnly AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isReadOnly AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , //只读 AST#property_assignment#Left AST#property_name#Left securityLevel AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left relationalStore AST#expression#Right . SecurityLevel AST#member_expression#Right AST#expression#Right . S2 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right // S1级安全加密 } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 创建数据库连接 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rdbStore AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left relationalStore AST#expression#Right AST#await_expression#Right AST#expression#Right . getRdbStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getAppContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left STORE_CONFIG AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 附加其他数据库 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . attachPaths AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( const path of AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . attachPaths AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left path AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . attachDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isInitialized AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` DBAccessor: 数据库初始化失败 - AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . closeDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 初始化失败时关闭连接 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 附加其他数据库 * @param path - 需要附加的数据库路径 */ AST#method_declaration#Left private async attachDatabase AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right // 从路径中提取数据库名称(去除路径和扩展名) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dbName = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left path AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left path AST#expression#Right . lastIndexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '/' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right , // 获取文件名 AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left path AST#expression#Right . lastIndexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '.sqlite' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right // 去除.db后缀 ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right . executeSql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` ATTACH DATABASE ' AST#template_substitution#Left $ { AST#expression#Left path AST#expression#Right } AST#template_substitution#Right ' AS AST#template_substitution#Left $ { AST#expression#Left dbName AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` ATTACH DATABASE ' AST#template_substitution#Left $ { AST#expression#Left path AST#expression#Right } AST#template_substitution#Right ' AS AST#template_substitution#Left $ { AST#expression#Left dbName AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` DBAccessor: 附加数据库失败 [ AST#template_substitution#Left $ { AST#expression#Left path AST#expression#Right } AST#template_substitution#Right ] - AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 关闭数据库连接(私有方法) */ AST#method_declaration#Left private closeDatabase AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right ?. close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rdbStore AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isInitialized AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'DBAccessor-closeDatabased' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left "DBAccessor: 关闭数据库连接失败:" AST#expression#Right + AST#expression#Left err AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left , AST#ERROR#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // MARK: - 数据查询接口 /** * 执行查询并返回多条记录 * @param sql - SQL查询语句(需包含WHERE等条件) * @param params - 查询参数数组(可选,默认空数组) * @param handler - 处理单行结果的回调函数 * @returns Promise<T[] | null> 返回查询结果数组或null(出错时) * 注意:该方法会自动关闭结果集和数据库连接 */ AST#method_declaration#Left async getDatas AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left sql : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ParamType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left handler : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left rs : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . initDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 执行查询 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left resultSet = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . querySql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sql AST#expression#Right , AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sql AST#expression#Right + AST#expression#Left ' 参数: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left params AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left results : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 遍历结果集 AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . goToNextRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left results AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left handler AST#expression#Right AST#argument_list#Left ( AST#expression#Left resultSet AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#while_statement#Right AST#statement#Right // 关闭结果集 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left results AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left ? AST#ERROR#Left results : AST#ERROR#Left AST#type_annotation#Left AST#primary_type#Left null AST#primary_type#Right AST#type_annotation#Right ; } catch AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#primary_type#Left err AST#primary_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left console AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` DBAccessor: 查询失败 [ AST#template_substitution#Left $ { AST#expression#Left sql AST#expression#Right } AST#template_substitution#Right ] - AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#finally_clause#Left finally AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . closeDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 确保关闭连接 } AST#block_statement#Right AST#finally_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right ///同步方法,需要提前初始化isInitialized AST#method_declaration#Left getDatasSync AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left sql : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ParamType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left handler : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left rs : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isInitialized AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left resultSet = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . querySqlSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sql AST#expression#Right , AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 假设存在同步API AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sql AST#expression#Right + AST#expression#Left ' 参数: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left params AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left results : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . goToNextRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left results AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left handler AST#expression#Right AST#argument_list#Left ( AST#expression#Left resultSet AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#while_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left results AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left ? AST#ERROR#Left results : AST#ERROR#Left AST#type_annotation#Left AST#primary_type#Left null AST#primary_type#Right AST#type_annotation#Right ; } catch AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#primary_type#Left err AST#primary_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left console AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 同步查询失败: AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 执行查询并返回单条记录 * @param sql - SQL查询语句 * @param params - 查询参数数组(可选) * @param handler - 处理单行结果的回调函数 * @returns Promise<T | null> 返回查询结果或null(无结果或出错时) * 注意:该方法会自动关闭结果集和数据库连接 */ AST#method_declaration#Left async getData AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left sql : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ParamType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left handler : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left rs : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left T AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left T AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . initDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left resultSet = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . querySql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sql AST#expression#Right , AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sql AST#expression#Right + AST#expression#Left ' 参数: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left params AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // 只获取第一条记录 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . goToNextRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left handler AST#expression#Right AST#argument_list#Left ( AST#expression#Left resultSet AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` DBAccessor: 单条查询失败 [ AST#template_substitution#Left $ { AST#expression#Left sql AST#expression#Right } AST#template_substitution#Right ] - AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#finally_clause#Left finally AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . closeDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 确保关闭连接 } AST#block_statement#Right AST#finally_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right ///同步方法,需要提前初始化isInitialized AST#method_declaration#Left getDataSync AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left sql : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ParamType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left handler : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left rs : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left T AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left T AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . initDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left resultSet = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . querySqlSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sql AST#expression#Right , AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sql AST#expression#Right + AST#expression#Left ' 参数: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left params AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // 只获取第一条记录 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . goToNextRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left handler AST#expression#Right AST#argument_list#Left ( AST#expression#Left resultSet AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` DBAccessor: 单条查询失败 [ AST#template_substitution#Left $ { AST#expression#Left sql AST#expression#Right } AST#template_substitution#Right ] - AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#finally_clause#Left finally AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . closeDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 确保关闭连接 } AST#block_statement#Right AST#finally_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // MARK: - 实用方法 /** * 获取查询结果的行数 * @param sql - COUNT查询语句(如:"SELECT COUNT(*) FROM users") * @param params - 查询参数(可选) * @returns Promise<number> 返回记录数量(出错时返回0) */ AST#method_declaration#Left async getCount AST#parameter_list#Left ( AST#parameter#Left sql : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ParamType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left count = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left sql AST#expression#Right , AST#expression#Left params AST#expression#Right , AST#expression#Left AST#arrow_function#Left rs => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rs AST#expression#Right . getLong AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right // 获取COUNT结果的第一列 ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left count AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right // 空值保护 } AST#block_statement#Right AST#method_declaration#Right /** * 获取指定列的最大值 * @param column - 列名(如:"age") * @param table - 表名(如:"users") * @param where - WHERE条件语句(可选,如:"status = 1") * @returns Promise<number> 返回最大值(无数据时返回0) */ AST#method_declaration#Left async getMax AST#parameter_list#Left ( AST#parameter#Left column : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left table : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left where ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 构建MAX查询SQL AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sql = AST#expression#Left AST#template_literal#Left ` SELECT MAX( AST#template_substitution#Left $ { AST#expression#Left column AST#expression#Right } AST#template_substitution#Right ) FROM AST#template_substitution#Left $ { AST#expression#Left table AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left where AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left sql += AST#expression#Left AST#template_literal#Left ` WHERE AST#template_substitution#Left $ { AST#expression#Left where AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left max = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left sql AST#expression#Right , AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left rs => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rs AST#expression#Right . getLong AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left max AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 检查表中是否存在某列 * @param column - 需要检查的列名 * @param table - 表名 * @returns Promise<boolean> 返回列是否存在 */ AST#method_declaration#Left async isExist AST#parameter_list#Left ( AST#parameter#Left column : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left table : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 使用PRAGMA查询表结构 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left names = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . getDatas AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` PRAGMA table_info( AST#template_substitution#Left $ { AST#expression#Left table AST#expression#Right } AST#template_substitution#Right ) ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left rs => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rs AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right // 获取列名字段 ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left names AST#expression#Right ?. includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left column AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 检查查询结果是否存在记录 * @param sql - 存在性查询语句(如:"SELECT 1 FROM users WHERE id = ?") * @param params - 查询参数(可选) * @returns Promise<boolean> 返回是否存在记录 */ AST#method_declaration#Left async isExistWithSql AST#parameter_list#Left ( AST#parameter#Left sql : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ParamType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . initDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left resultSet = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . querySql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sql AST#expression#Right , AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sql AST#expression#Right + AST#expression#Left ' 参数: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left params AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // 只需检查是否有第一条记录 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left exists = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . goToNextRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left exists AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` DBAccessor: 存在性查询失败 [ AST#template_substitution#Left $ { AST#expression#Left sql AST#expression#Right } AST#template_substitution#Right ] - AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#finally_clause#Left finally AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . closeDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 确保关闭连接 } AST#block_statement#Right AST#finally_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // MARK: - 数据修改接口 /** * 执行更新操作(INSERT/UPDATE/DELETE) * @param sql - 更新语句 * @param params - 参数数组(可选) * @returns Promise<boolean> 返回是否执行成功 * 注意:该方法会自动关闭数据库连接 */ AST#method_declaration#Left async updateDb AST#parameter_list#Left ( AST#parameter#Left sql : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ParamType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . initDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . executeSql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sql AST#expression#Right , AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sql AST#expression#Right + AST#expression#Left ' 参数: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left params AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` DBAccessor: 更新失败 [ AST#template_substitution#Left $ { AST#expression#Left sql AST#expression#Right } AST#template_substitution#Right ] - AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#finally_clause#Left finally AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . closeDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 确保关闭连接 } AST#block_statement#Right AST#finally_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 在事务中批量执行更新操作 * @param sqls - SQL语句数组 * @param paramsList - 参数数组的数组(与sqls一一对应) * @returns Promise<boolean> 返回是否全部执行成功 * 注意:该方法会自动关闭数据库连接 */ AST#method_declaration#Left async updateDbBatch AST#parameter_list#Left ( AST#parameter#Left sqls : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left paramsList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ParamType [ ] [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . initDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isInitialized AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '数据库未初始化成功' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 使用 beginTransaction(通常不会返回 txId) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . beginTransaction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left sqls AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right ?. executeSql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left sqls AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left paramsList AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right || AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left sqls AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right + AST#expression#Left ' 参数' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left paramsList AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . e AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` DBAccessor: 执行失败 [ AST#template_substitution#Left $ { AST#expression#Left i AST#expression#Right } AST#template_substitution#Right ] [ AST#template_substitution#Left $ { AST#expression#Left AST#subscript_expression#Left AST#expression#Left sqls AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right } AST#template_substitution#Right ], 参数: AST#template_substitution#Left $ { AST#expression#Left AST#subscript_expression#Left AST#expression#Left paramsList AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right } AST#template_substitution#Right }, - AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right ?. rollBack AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 注意:rollBack 无参数 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right ?. commit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` DBAccessor: 事务执行异常 - AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#finally_clause#Left finally AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . closeDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#finally_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right ///安全编码字符串参数(带输入验证和类型守卫) AST#method_declaration#Left static encodedParamString AST#parameter_list#Left ( AST#parameter#Left param : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left param AST#expression#Right AST#unary_expression#Right AST#expression#Right ?. trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right // 合并空值检查和trim AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StringEncoder AST#expression#Right . encodedToBase64 AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left param AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right // 空值合并操作符 } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class DBAccessor { private dbPath: string | null; private attachPaths: Array<string | null> | null; private isReadOnly: boolean = true private rdbStore: relationalStore.RdbStore | null = null; private isInitialized = false; constructor(dbPath: string | null, attachPaths: Array<string | null> | null = null, isReadOnly: boolean = true) { this.dbPath = dbPath; this.attachPaths = attachPaths; this.isReadOnly = isReadOnly } private async initDatabase(): Promise<boolean> { if (this.isInitialized) return true; if (!this.dbPath) { console.error("DBAccessor: 数据库路径不能为空"); return false; } const relativePath = PathUtility.getRelativeDatabasePath(this.dbPath!) const dbFolder = PathUtility.getParentPathOf(relativePath) const dbFolderPath = PathUtility.removeLastSlashOfDirectoryIfExists(dbFolder) const dbName = PathUtility.getLastComponentName(this.dbPath!) const STORE_CONFIG: relationalStore.StoreConfig = { name: dbName, customDir: dbFolderPath!, isReadOnly: this.isReadOnly, securityLevel: relationalStore.SecurityLevel.S2 }; try { this.rdbStore = await relationalStore.getRdbStore(getAppContext(), STORE_CONFIG); if (this.attachPaths) { for (const path of this.attachPaths) { if (path) await this.attachDatabase(path); } } this.isInitialized = true; return true; } catch (err) { console.error(`DBAccessor: 数据库初始化失败 - ${err}`); this.closeDatabase(); return false; } } private async attachDatabase(path: string): Promise<void> { if (!this.rdbStore) return; const dbName = path.substring( path.lastIndexOf('/') + 1, path.lastIndexOf('.sqlite') ); try { await this.rdbStore.executeSql(`ATTACH DATABASE '${path}' AS ${dbName}`); DebugLog.d(`ATTACH DATABASE '${path}' AS ${dbName}`) } catch (err) { console.error(`DBAccessor: 附加数据库失败 [${path}] - ${err}`); } } private closeDatabase(): void { try { this.rdbStore?.close(); this.rdbStore = null; this.isInitialized = false; DebugLog.d('DBAccessor-closeDatabased') } catch (err) { DebugLog.d("DBAccessor: 关闭数据库连接失败:" + err, ); } } async getDatas<T>( sql: string, params: ParamType[] = [], handler: (rs: relationalStore.ResultSet) => T ): Promise<T[] | null> { if (!await this.initDatabase()) return null; try { const resultSet = await this.rdbStore!.querySql(sql, params); DebugLog.d(sql +' 参数: ' + params) const results: T[] = []; while (resultSet.goToNextRow()) { results.push(handler(resultSet)); } resultSet.close(); return results.length > 0 ? results : null; } catch (err) { console.error(`DBAccessor: 查询失败 [${sql}] - ${err}`); return null; } finally { this.closeDatabase(); } } getDatasSync<T>( sql: string, params: ParamType[] = [], handler: (rs: relationalStore.ResultSet) => T ): T[] | null { if (!this.isInitialized) return null; try { const resultSet = this.rdbStore!.querySqlSync(sql, params); DebugLog.d(sql +' 参数: ' + params) const results: T[] = []; while (resultSet.goToNextRow()) { results.push(handler(resultSet)); } resultSet.close(); return results.length > 0 ? results : null; } catch (err) { console.error(`同步查询失败: ${err}`); return null; } } async getData<T>( sql: string, params: ParamType[] = [], handler: (rs: relationalStore.ResultSet) => T | null ): Promise<T | null> { if (!await this.initDatabase()) return null; try { const resultSet = await this.rdbStore!.querySql(sql, params); DebugLog.d(sql +' 参数: ' + params) const result = resultSet.goToNextRow() ? handler(resultSet) : null; resultSet.close(); return result; } catch (err) { console.error(`DBAccessor: 单条查询失败 [${sql}] - ${err}`); return null; } finally { this.closeDatabase(); } } getDataSync<T>( sql: string, params: ParamType[] = [], handler: (rs: relationalStore.ResultSet) => T | null ): T | null { if (! this.initDatabase()) return null; try { const resultSet = this.rdbStore!.querySqlSync(sql, params); DebugLog.d(sql +' 参数: ' + params) const result = resultSet.goToNextRow() ? handler(resultSet) : null; resultSet.close(); return result; } catch (err) { console.error(`DBAccessor: 单条查询失败 [${sql}] - ${err}`); return null; } finally { this.closeDatabase(); } } async getCount(sql: string, params: ParamType[] = []): Promise<number> { const count = await this.getData<number>( sql, params, rs => rs.getLong(0) ); return count ?? 0; } async getMax(column: string, table: string, where?: string): Promise<number> { let sql = `SELECT MAX(${column}) FROM ${table}`; if (where) sql += ` WHERE ${where}`; const max = await this.getData<number>(sql, [], rs => rs.getLong(0)); return max ?? 0; } async isExist(column: string, table: string): Promise<boolean> { const names = await this.getDatas<string>( `PRAGMA table_info(${table})`, [], rs => rs.getString(1) ); return names?.includes(column) ?? false; } async isExistWithSql(sql: string, params: ParamType[] = []): Promise<boolean> { if (!await this.initDatabase()) return false; try { const resultSet = await this.rdbStore!.querySql(sql, params); DebugLog.d(sql +' 参数: ' + params) const exists = resultSet.goToNextRow(); resultSet.close(); return exists; } catch (err) { console.error(`DBAccessor: 存在性查询失败 [${sql}] - ${err}`); return false; } finally { this.closeDatabase(); } } async updateDb(sql: string, params: ParamType[] = []): Promise<boolean> { if (!await this.initDatabase()) return false; try { await this.rdbStore!.executeSql(sql, params); DebugLog.d(sql +' 参数: ' + params) return true; } catch (err) { console.error(`DBAccessor: 更新失败 [${sql}] - ${err}`); return false; } finally { this.closeDatabase(); } } async updateDbBatch( sqls: string[], paramsList: ParamType[][] = [] ): Promise<boolean> { if (!await this.initDatabase()) return false; if (!this.isInitialized || !this.rdbStore) { console.error('数据库未初始化成功'); return false; } try { this.rdbStore!.beginTransaction(); for (let i = 0; i < sqls.length; i++) { try { await this.rdbStore?.executeSql(sqls[i], paramsList[i] || []); DebugLog.d(sqls[i] +' 参数' + paramsList[i]) } catch (err) { DebugLog.e(`DBAccessor: 执行失败 [${i}] [${sqls[i]}], 参数: ${paramsList[i]}}, - ${err}`); this.rdbStore?.rollBack(); return false; } } this.rdbStore?.commit(); return true; } catch (err) { console.error(`DBAccessor: 事务执行异常 - ${err}`); return false; } finally { this.closeDatabase(); } } static encodedParamString(param: string | null): string | null { if (!param?.trim()) return null; return StringEncoder.encodedToBase64(param) ?? null; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/dbUtils/DBAccessor.ets#L24-L406
9409ac4e5cf14f28bf4c9f8873375dd83fef6615
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SHA.ets
arkts
hmacSegment
消息认证码计算,分段,异步 @param data 传入的消息 @param algName 指定摘要算法(SHA1、SHA224、SHA256、SHA384、SHA512)。 @param symKey 共享对称密钥。 @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 @param len 自定义的数据拆分长度
static async hmacSegment(data: string, algName: crypto.SHA = 'SHA256', symKey: cryptoFramework.SymKey = SHA.symKey, resultCoding: crypto.BhCoding = 'hex', len: number = 120): Promise<string> { return CryptoUtil.hmacSegment(data, algName, symKey, resultCoding, len); }
AST#method_declaration#Left static async hmacSegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . SHA AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SHA256' AST#expression#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left SHA AST#expression#Right . symKey AST#member_expression#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'hex' AST#expression#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 120 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . hmacSegment AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left algName AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right , AST#expression#Left len AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async hmacSegment(data: string, algName: crypto.SHA = 'SHA256', symKey: cryptoFramework.SymKey = SHA.symKey, resultCoding: crypto.BhCoding = 'hex', len: number = 120): Promise<string> { return CryptoUtil.hmacSegment(data, algName, symKey, resultCoding, len); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SHA.ets#L115-L118
f942bec3e47da9c9a1da062db11f2878d88cc4a0
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/user/UserNavigator.ets
arkts
toAddressDetail
跳转到收货地址详情 @param {boolean} isEditMode - 是否为编辑模式(默认 false) @param {number} addressId - 地址 ID(0表示新增,默认 0) @returns {Promise<RefreshResult | undefined>} 返回结果 Promise
static toAddressDetail(isEditMode: boolean = false, addressId: number = 0): Promise<RefreshResult | undefined> { const params: UserAddressDetailParam = { isEditMode, addressId }; return navigateToForResult<RefreshResult>(UserRoutes.AddressDetail, params); }
AST#method_declaration#Left static toAddressDetail AST#parameter_list#Left ( AST#parameter#Left isEditMode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left addressId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left RefreshResult AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left UserAddressDetailParam AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left isEditMode AST#property_assignment#Right , AST#property_assignment#Left addressId AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left navigateToForResult AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left RefreshResult AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left UserRoutes AST#expression#Right . AddressDetail AST#member_expression#Right AST#expression#Right , AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static toAddressDetail(isEditMode: boolean = false, addressId: number = 0): Promise<RefreshResult | undefined> { const params: UserAddressDetailParam = { isEditMode, addressId }; return navigateToForResult<RefreshResult>(UserRoutes.AddressDetail, params); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/user/UserNavigator.ets#L36-L39
3a17e3aa2f52879942e9138cc108fbfd2063af88
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/image/ImageUtil.ets
arkts
base64ToPixelMap
base64转PixelMap @param {string} base64 图片base64字符串 @returns {Promise<image.PixelMap>} 返回图像的PixelMap对象
static async base64ToPixelMap(base64: string): Promise<image.PixelMap> { const reg: RegExp = new RegExp('data:image/\\w+;base64,'); const base64Str: string = base64.replace(reg, ''); const base64Helper: util.Base64Helper = new util.Base64Helper(); const uint8Array: Uint8Array = base64Helper.decodeSync(base64Str); let imageSource: image.ImageSource = image.createImageSource(uint8Array.buffer); let options: image.DecodingOptions = { editable: false }; return imageSource.createPixelMap(options); }
AST#method_declaration#Left static async base64ToPixelMap AST#parameter_list#Left ( AST#parameter#Left base64 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left reg : AST#type_annotation#Left AST#primary_type#Left RegExp AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left RegExp AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'data:image/\\w+;base64,' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left base64Str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left base64 AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left reg AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left base64Helper : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left util . Base64Helper AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . Base64Helper AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left uint8Array : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left base64Helper AST#expression#Right . decodeSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left base64Str AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left imageSource : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageSource AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . createImageSource AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left uint8Array AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . DecodingOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left editable AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imageSource AST#expression#Right . createPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async base64ToPixelMap(base64: string): Promise<image.PixelMap> { const reg: RegExp = new RegExp('data:image/\\w+;base64,'); const base64Str: string = base64.replace(reg, ''); const base64Helper: util.Base64Helper = new util.Base64Helper(); const uint8Array: Uint8Array = base64Helper.decodeSync(base64Str); let imageSource: image.ImageSource = image.createImageSource(uint8Array.buffer); let options: image.DecodingOptions = { editable: false }; return imageSource.createPixelMap(options); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/image/ImageUtil.ets#L81-L89
17333788da3da8d8db4837d913662a27b5a49e72
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/model/Task.ets
arkts
Task insert/update data
export interface TaskData { title: string; due_time: number; is_done: number; created_at: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface TaskData AST#object_type#Left { AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left due_time : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left is_done : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left created_at : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface TaskData { title: string; due_time: number; is_done: number; created_at: number; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/Task.ets#L20-L25
c84dc6787ccd9f2f587b1e93d81b569dcbc69384
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/ConfirmBuilderProxy.ets
arkts
secondaryTitle
弹窗副标题 @param title @returns
secondaryTitle(secondaryTitle: ResourceStr) { (this.builderOptions as IAlertDialogOptions).secondaryTitle = secondaryTitle; return this; }
AST#method_declaration#Left secondaryTitle AST#parameter_list#Left ( AST#parameter#Left secondaryTitle : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left IAlertDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . secondaryTitle AST#member_expression#Right = AST#expression#Left secondaryTitle AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left this AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
secondaryTitle(secondaryTitle: ResourceStr) { (this.builderOptions as IAlertDialogOptions).secondaryTitle = secondaryTitle; return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/ConfirmBuilderProxy.ets#L29-L32
6c9644af92c094da3cc5dcc40aba4ec203f796b1
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
arkts
setAndLink
Called when a hyperlink is set. @since 10
static setAndLink<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T> { return StorageMap.shared.setAndLink(propName, defaultValue) }
AST#method_declaration#Left static setAndLink AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left propName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultValue : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left SubscribedAbstractProperty AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StorageMap AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . setAndLink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left propName AST#expression#Right , AST#expression#Left defaultValue AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static setAndLink<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T> { return StorageMap.shared.setAndLink(propName, defaultValue) }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L76-L78
d50699afc4667e253b6dcaf6e32f32500a7a9beb
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/SearchPage.ets
arkts
buildContactResults
构建联系人搜索结果
@Builder buildContactResults() { Column({ space: 12 }) { Text(`联系人 (${this.searchResult.contacts.length})`) .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor('#333333') .alignSelf(ItemAlign.Start) Column({ space: 1 }) { ForEach(this.searchResult.contacts.slice(0, this.activeTab === 'contacts' ? 50 : 5), (contact: Contact) => { this.buildContactResultItem(contact) }) if (this.activeTab === 'all' && this.searchResult.contacts.length > 5) { Row() { Text(`查看全部${this.searchResult.contacts.length}个联系人`) .fontSize(14) .fontColor('#007AFF') } .width('100%') .height(48) .justifyContent(FlexAlign.Center) .backgroundColor('#f8f9fa') .onClick(() => { this.onTabChange('contacts'); }) } } .backgroundColor('#ffffff') .borderRadius(12) .shadow({ radius: 8, color: 'rgba(0,0,0,0.1)', offsetX: 0, offsetY: 2 }) } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContactResults AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` 联系人 ( AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . searchResult AST#member_expression#Right AST#expression#Right . contacts AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ) ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 1 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . searchResult AST#member_expression#Right AST#expression#Right . contacts AST#member_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . activeTab AST#member_expression#Right AST#expression#Right === AST#expression#Left 'contacts' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 50 AST#expression#Right : AST#expression#Left 5 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildContactResultItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contact AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . activeTab AST#member_expression#Right AST#expression#Right === AST#expression#Left 'all' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . searchResult AST#member_expression#Right AST#expression#Right . contacts AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 5 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` 查看全部 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . searchResult AST#member_expression#Right AST#expression#Right . contacts AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 个联系人 ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#007AFF' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 48 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f8f9fa' AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onTabChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'contacts' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left 'rgba(0,0,0,0.1)' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildContactResults() { Column({ space: 12 }) { Text(`联系人 (${this.searchResult.contacts.length})`) .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor('#333333') .alignSelf(ItemAlign.Start) Column({ space: 1 }) { ForEach(this.searchResult.contacts.slice(0, this.activeTab === 'contacts' ? 50 : 5), (contact: Contact) => { this.buildContactResultItem(contact) }) if (this.activeTab === 'all' && this.searchResult.contacts.length > 5) { Row() { Text(`查看全部${this.searchResult.contacts.length}个联系人`) .fontSize(14) .fontColor('#007AFF') } .width('100%') .height(48) .justifyContent(FlexAlign.Center) .backgroundColor('#f8f9fa') .onClick(() => { this.onTabChange('contacts'); }) } } .backgroundColor('#ffffff') .borderRadius(12) .shadow({ radius: 8, color: 'rgba(0,0,0,0.1)', offsetX: 0, offsetY: 2 }) } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/SearchPage.ets#L437-L475
9ed7aa129b8e68178fde3a947f020aeceb2be52a
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/UniversalKeystoreKit/KeyProving/DevelopmentGuidelines/NonanonymousKeyProof/entry/src/main/ets/pages/NonAnonymousKeyProof.ets
arkts
attestKeyItem
4.证明密钥
function attestKeyItem(keyAlias: string, huksOptions: huks.HuksOptions, throwObject: ThrowObject) { return new Promise<huks.HuksReturnResult>((resolve, reject) => { try { huks.attestKeyItem(keyAlias, huksOptions, (error, data) => { if (error) { reject(error); } else { resolve(data); } }); } catch (error) { throwObject.isThrow = true; throw (error as Error); } }); }
AST#function_declaration#Left function attestKeyItem AST#parameter_list#Left ( AST#parameter#Left keyAlias : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left huksOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left huks . HuksOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left throwObject : AST#type_annotation#Left AST#primary_type#Left ThrowObject AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left huks . HuksReturnResult AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left resolve AST#parameter#Right , AST#parameter#Left reject AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . attestKeyItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyAlias AST#expression#Right , AST#expression#Left huksOptions AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error AST#parameter#Right , AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left error AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left reject AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left resolve AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left throwObject AST#expression#Right . isThrow AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
function attestKeyItem(keyAlias: string, huksOptions: huks.HuksOptions, throwObject: ThrowObject) { return new Promise<huks.HuksReturnResult>((resolve, reject) => { try { huks.attestKeyItem(keyAlias, huksOptions, (error, data) => { if (error) { reject(error); } else { resolve(data); } }); } catch (error) { throwObject.isThrow = true; throw (error as Error); } }); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/UniversalKeystoreKit/KeyProving/DevelopmentGuidelines/NonanonymousKeyProof/entry/src/main/ets/pages/NonAnonymousKeyProof.ets#L139-L154
b108477e0395a8bcb4aacc48f950b285bc2f8f1e
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
analyzeEmotion
分析用户消息的情绪 @param message - 用户消息 @returns 情绪类型和强度
private analyzeEmotion(message: string): EmotionAnalysisResult { const text = message.toLowerCase(); // 开心/兴奋的关键词 const happyKeywords = ['哈哈', '😊', '😄', '开心', '高兴', '太好了', '棒', '赞', '喜欢', '爱', '谢谢', '感谢']; const excitedKeywords = ['!!', '哇', '太棒了', '厉害', '牛', '酷', '🎉', '激动']; // 悲伤的关键词 const sadKeywords = ['难过', '伤心', '😢', '😭', '唉', '失望', '沮丧', '郁闷']; // 生气的关键词 const angryKeywords = ['生气', '愤怒', '烦', '讨厌', '气死了', '😡', '😠']; // 平静的关键词 const calmKeywords = ['好的', '明白', '了解', '知道了', '嗯', '谢谢', 'ok', 'okay']; let emotion = 'neutral'; let matchCount = 0; // 检查情绪并计算匹配数量 const excitedMatches = excitedKeywords.filter(keyword => text.includes(keyword)).length; const happyMatches = happyKeywords.filter(keyword => text.includes(keyword)).length; const sadMatches = sadKeywords.filter(keyword => text.includes(keyword)).length; const angryMatches = angryKeywords.filter(keyword => text.includes(keyword)).length; const calmMatches = calmKeywords.filter(keyword => text.includes(keyword)).length; // 确定主导情绪 if (excitedMatches > 0) { emotion = 'excited'; matchCount = excitedMatches; } else if (happyMatches > 0) { emotion = 'happy'; matchCount = happyMatches; } else if (sadMatches > 0) { emotion = 'sad'; matchCount = sadMatches; } else if (angryMatches > 0) { emotion = 'angry'; matchCount = angryMatches; } else if (calmMatches > 0) { emotion = 'calm'; matchCount = calmMatches; } else if (text.includes('?') || text.includes('?')) { emotion = 'surprised'; matchCount = 1; } // 计算强度 (1-5) // 基于关键词匹配数量和消息长度 let intensity = 3; // 默认中等强度 if (matchCount >= 3) { intensity = 5; // 非常强烈 } else if (matchCount === 2) { intensity = 4; // 强烈 } else if (matchCount === 1) { intensity = 3; // 中等 } // 多个感叹号增加强度 if ((text.match(/!/g) || []).length >= 2 || (text.match(/!/g) || []).length >= 2) { intensity = Math.min(5, intensity + 1); } const result: EmotionAnalysisResult = { emotion, intensity }; return result; }
AST#method_declaration#Left private analyzeEmotion AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left EmotionAnalysisResult AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left text = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . toLowerCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 开心/兴奋的关键词 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left happyKeywords = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '哈哈' AST#expression#Right , AST#expression#Left '😊' AST#expression#Right , AST#expression#Left '😄' AST#expression#Right , AST#expression#Left '开心' AST#expression#Right , AST#expression#Left '高兴' AST#expression#Right , AST#expression#Left '太好了' AST#expression#Right , AST#expression#Left '棒' AST#expression#Right , AST#expression#Left '赞' AST#expression#Right , AST#expression#Left '喜欢' AST#expression#Right , AST#expression#Left '爱' AST#expression#Right , AST#expression#Left '谢谢' AST#expression#Right , AST#expression#Left '感谢' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left excitedKeywords = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '!!' AST#expression#Right , AST#expression#Left '哇' AST#expression#Right , AST#expression#Left '太棒了' AST#expression#Right , AST#expression#Left '厉害' AST#expression#Right , AST#expression#Left '牛' AST#expression#Right , AST#expression#Left '酷' AST#expression#Right , AST#expression#Left '🎉' AST#expression#Right , AST#expression#Left '激动' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 悲伤的关键词 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sadKeywords = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '难过' AST#expression#Right , AST#expression#Left '伤心' AST#expression#Right , AST#expression#Left '😢' AST#expression#Right , AST#expression#Left '😭' AST#expression#Right , AST#expression#Left '唉' AST#expression#Right , AST#expression#Left '失望' AST#expression#Right , AST#expression#Left '沮丧' AST#expression#Right , AST#expression#Left '郁闷' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 生气的关键词 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left angryKeywords = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '生气' AST#expression#Right , AST#expression#Left '愤怒' AST#expression#Right , AST#expression#Left '烦' AST#expression#Right , AST#expression#Left '讨厌' AST#expression#Right , AST#expression#Left '气死了' AST#expression#Right , AST#expression#Left '😡' AST#expression#Right , AST#expression#Left '😠' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 平静的关键词 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left calmKeywords = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '好的' AST#expression#Right , AST#expression#Left '明白' AST#expression#Right , AST#expression#Left '了解' AST#expression#Right , AST#expression#Left '知道了' AST#expression#Right , AST#expression#Left '嗯' AST#expression#Right , AST#expression#Left '谢谢' AST#expression#Right , AST#expression#Left 'ok' AST#expression#Right , AST#expression#Left 'okay' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left emotion = AST#expression#Left 'neutral' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left matchCount = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 检查情绪并计算匹配数量 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left excitedMatches = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left excitedKeywords AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left keyword => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyword AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left happyMatches = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left happyKeywords AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left keyword => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyword AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sadMatches = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left sadKeywords AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left keyword => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyword AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left angryMatches = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left angryKeywords AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left keyword => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyword AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left calmMatches = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left calmKeywords AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left keyword => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyword AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 确定主导情绪 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left excitedMatches AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left emotion = AST#expression#Left 'excited' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left matchCount = AST#expression#Left excitedMatches AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left happyMatches AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left emotion = AST#expression#Left 'happy' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left matchCount = AST#expression#Left happyMatches AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left sadMatches AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left emotion = AST#expression#Left 'sad' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left matchCount = AST#expression#Left sadMatches AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left angryMatches AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left emotion = AST#expression#Left 'angry' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left matchCount = AST#expression#Left angryMatches AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left calmMatches AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left emotion = AST#expression#Left 'calm' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left matchCount = AST#expression#Left calmMatches AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '?' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left text AST#expression#Right AST#binary_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '?' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left emotion = AST#expression#Left 'surprised' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left matchCount = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right // 计算强度 (1-5) // 基于关键词匹配数量和消息长度 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left intensity = AST#expression#Left 3 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 默认中等强度 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left matchCount AST#expression#Right >= AST#expression#Left 3 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left intensity = AST#expression#Left 5 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 非常强烈 } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left matchCount AST#expression#Right === AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left intensity = AST#expression#Left 4 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 强烈 } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left matchCount AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left intensity = AST#expression#Left 3 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 中等 } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right // 多个感叹号增加强度 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . match AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left / ! AST#ERROR#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right || AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right . length AST#member_expression#Right AST#expression#Right >= AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . match AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left / AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left AST#expression#Right AST#unary_expression#Right AST#expression#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right >= AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left intensity = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . min AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 5 AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left intensity AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left EmotionAnalysisResult AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left emotion AST#property_assignment#Right , AST#property_assignment#Left intensity AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private analyzeEmotion(message: string): EmotionAnalysisResult { const text = message.toLowerCase(); const happyKeywords = ['哈哈', '😊', '😄', '开心', '高兴', '太好了', '棒', '赞', '喜欢', '爱', '谢谢', '感谢']; const excitedKeywords = ['!!', '哇', '太棒了', '厉害', '牛', '酷', '🎉', '激动']; const sadKeywords = ['难过', '伤心', '😢', '😭', '唉', '失望', '沮丧', '郁闷']; const angryKeywords = ['生气', '愤怒', '烦', '讨厌', '气死了', '😡', '😠']; const calmKeywords = ['好的', '明白', '了解', '知道了', '嗯', '谢谢', 'ok', 'okay']; let emotion = 'neutral'; let matchCount = 0; const excitedMatches = excitedKeywords.filter(keyword => text.includes(keyword)).length; const happyMatches = happyKeywords.filter(keyword => text.includes(keyword)).length; const sadMatches = sadKeywords.filter(keyword => text.includes(keyword)).length; const angryMatches = angryKeywords.filter(keyword => text.includes(keyword)).length; const calmMatches = calmKeywords.filter(keyword => text.includes(keyword)).length; if (excitedMatches > 0) { emotion = 'excited'; matchCount = excitedMatches; } else if (happyMatches > 0) { emotion = 'happy'; matchCount = happyMatches; } else if (sadMatches > 0) { emotion = 'sad'; matchCount = sadMatches; } else if (angryMatches > 0) { emotion = 'angry'; matchCount = angryMatches; } else if (calmMatches > 0) { emotion = 'calm'; matchCount = calmMatches; } else if (text.includes('?') || text.includes('?')) { emotion = 'surprised'; matchCount = 1; } let intensity = 3; if (matchCount >= 3) { intensity = 5; } else if (matchCount === 2) { intensity = 4; } else if (matchCount === 1) { intensity = 3; } if ((text.match(/!/g) || []).length >= 2 || (text.match(/!/g) || []).length >= 2) { intensity = Math.min(5, intensity + 1); } const result: EmotionAnalysisResult = { emotion, intensity }; return result; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L181-L246
49e056580a52f370b356c53e0aabf2bbc91e2215
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/FlexLayout/entry/src/main/ets/common/constants/StyleConstants.ets
arkts
Style constants for all Component.
export default class StyleConstants { /** * Font weight. */ static readonly FONT_WEIGHT: number = 500; /** * One hundred percent. */ static readonly FULL_PERCENT: string = '100%'; /** * Recent text height. */ static readonly RECENT_TEXT_HEIGHT: string = '2.7%'; /** * Recent text width. */ static readonly RECENT_TEXT_WIDTH: string = '48.9%'; /** * Delete image height. */ static readonly DELETE_IMAGE_HEIGHT: string = '4%'; /** * Delete image width. */ static readonly DELETE_IMAGE_WIDTH: string = '6.7%'; /** * No search image height. */ static readonly NO_SEARCH_IMAGE_HEIGHT: string = '15.4%'; /** * No search image width. */ static readonly NO_SEARCH_IMAGE_WIDTH: string = '33.3%'; /** * No search text height. */ static readonly NO_SEARCH_TEXT_HEIGHT: string = '2.7%'; /** * No search text width. */ static readonly NO_SEARCH_TEXT_WIDTH: string = '26.7%'; /** * Flew layout padding top. */ static readonly FLEX_PADDING_TOP: string = '0.8%'; /** * Flew layout padding bottom. */ static readonly FLEX_PADDING_BOTTOM: string = '0.8%'; /** * Flew layout padding left. */ static readonly FLEX_PADDING_LEFT: string = '4.4%'; /** * Flew layout padding right. */ static readonly FLEX_PADDING_RIGHT: string = '4.4%'; /** * Search input height. */ static readonly SEARCH_HEIGHT: string = '5.1%'; /** * Search input width. */ static readonly SEARCH_WIDTH: string = '81.1%'; /** * Text max line. */ static readonly TEXT_MAX_LINE: number = 2; /** * Search placeholder. */ static readonly SEARCH_PLACEHOLDER: string = '搜索...'; /** * Layout weight. */ static readonly LAYOUT_WEIGHT: number = 8; /** * Search icon. */ static readonly SEARCH_ICON: string = '/resources/base/media/ic_search.png'; }
AST#export_declaration#Left export default AST#class_declaration#Left class StyleConstants AST#class_body#Left { /** * Font weight. */ AST#property_declaration#Left static readonly FONT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 500 AST#expression#Right ; AST#property_declaration#Right /** * One hundred percent. */ AST#property_declaration#Left static readonly FULL_PERCENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /** * Recent text height. */ AST#property_declaration#Left static readonly RECENT_TEXT_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '2.7%' AST#expression#Right ; AST#property_declaration#Right /** * Recent text width. */ AST#property_declaration#Left static readonly RECENT_TEXT_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '48.9%' AST#expression#Right ; AST#property_declaration#Right /** * Delete image height. */ AST#property_declaration#Left static readonly DELETE_IMAGE_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '4%' AST#expression#Right ; AST#property_declaration#Right /** * Delete image width. */ AST#property_declaration#Left static readonly DELETE_IMAGE_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '6.7%' AST#expression#Right ; AST#property_declaration#Right /** * No search image height. */ AST#property_declaration#Left static readonly NO_SEARCH_IMAGE_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '15.4%' AST#expression#Right ; AST#property_declaration#Right /** * No search image width. */ AST#property_declaration#Left static readonly NO_SEARCH_IMAGE_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '33.3%' AST#expression#Right ; AST#property_declaration#Right /** * No search text height. */ AST#property_declaration#Left static readonly NO_SEARCH_TEXT_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '2.7%' AST#expression#Right ; AST#property_declaration#Right /** * No search text width. */ AST#property_declaration#Left static readonly NO_SEARCH_TEXT_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '26.7%' AST#expression#Right ; AST#property_declaration#Right /** * Flew layout padding top. */ AST#property_declaration#Left static readonly FLEX_PADDING_TOP : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '0.8%' AST#expression#Right ; AST#property_declaration#Right /** * Flew layout padding bottom. */ AST#property_declaration#Left static readonly FLEX_PADDING_BOTTOM : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '0.8%' AST#expression#Right ; AST#property_declaration#Right /** * Flew layout padding left. */ AST#property_declaration#Left static readonly FLEX_PADDING_LEFT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '4.4%' AST#expression#Right ; AST#property_declaration#Right /** * Flew layout padding right. */ AST#property_declaration#Left static readonly FLEX_PADDING_RIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '4.4%' AST#expression#Right ; AST#property_declaration#Right /** * Search input height. */ AST#property_declaration#Left static readonly SEARCH_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '5.1%' AST#expression#Right ; AST#property_declaration#Right /** * Search input width. */ AST#property_declaration#Left static readonly SEARCH_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '81.1%' AST#expression#Right ; AST#property_declaration#Right /** * Text max line. */ AST#property_declaration#Left static readonly TEXT_MAX_LINE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right ; AST#property_declaration#Right /** * Search placeholder. */ AST#property_declaration#Left static readonly SEARCH_PLACEHOLDER : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '搜索...' AST#expression#Right ; AST#property_declaration#Right /** * Layout weight. */ AST#property_declaration#Left static readonly LAYOUT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 8 AST#expression#Right ; AST#property_declaration#Right /** * Search icon. */ AST#property_declaration#Left static readonly SEARCH_ICON : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '/resources/base/media/ic_search.png' AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class StyleConstants { static readonly FONT_WEIGHT: number = 500; static readonly FULL_PERCENT: string = '100%'; static readonly RECENT_TEXT_HEIGHT: string = '2.7%'; static readonly RECENT_TEXT_WIDTH: string = '48.9%'; static readonly DELETE_IMAGE_HEIGHT: string = '4%'; static readonly DELETE_IMAGE_WIDTH: string = '6.7%'; static readonly NO_SEARCH_IMAGE_HEIGHT: string = '15.4%'; static readonly NO_SEARCH_IMAGE_WIDTH: string = '33.3%'; static readonly NO_SEARCH_TEXT_HEIGHT: string = '2.7%'; static readonly NO_SEARCH_TEXT_WIDTH: string = '26.7%'; static readonly FLEX_PADDING_TOP: string = '0.8%'; static readonly FLEX_PADDING_BOTTOM: string = '0.8%'; static readonly FLEX_PADDING_LEFT: string = '4.4%'; static readonly FLEX_PADDING_RIGHT: string = '4.4%'; static readonly SEARCH_HEIGHT: string = '5.1%'; static readonly SEARCH_WIDTH: string = '81.1%'; static readonly TEXT_MAX_LINE: number = 2; static readonly SEARCH_PLACEHOLDER: string = '搜索...'; static readonly LAYOUT_WEIGHT: number = 8; static readonly SEARCH_ICON: string = '/resources/base/media/ic_search.png'; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/FlexLayout/entry/src/main/ets/common/constants/StyleConstants.ets#L19-L119
c56e848cf5e05e21f95dc7cc62e59958acca11db
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/DistributedAppDev/DistributedFilemanager/Library/src/main/ets/mock/local/FileData.ets
arkts
文件价\文件结构
export class FileStructure { // 名字 public name: string = ""; // 时间 public time: string = ""; // 子文件数量 public childrenNum?: number // 数据类型 1:文件夹、2:文件 public type: number = 0; // 文件大小 public size?: string // 处理日期格式 private dateFormat(time: Date): string { let date = time; let year = date.getFullYear(); let month: string | number = date.getMonth() + 1; month = month >= 10 ? month : ('0' + month); let day: string | number = date.getDate(); day = day >= 10 ? day : ('0' + day); let hours: string | number = date.getHours(); hours = hours >= 10 ? hours : ('0' + hours); let minutes: string | number = date.getMinutes(); minutes = minutes >= 10 ? minutes : ('0' + minutes); return `${year}/${month}/${day} ${hours}:${minutes}`; } constructor(name: string, type: number, time: Date, childrenNum?: number, size?: string) { this.name = name; this.type = type; // 如果是文件就给出子目录文件数量,如果不是就给出文件大小 if (type === 1) { this.childrenNum = childrenNum; } else { this.size = size; } // 创建时间,没有的话给当前时间 this.time = this.dateFormat(time); } }
AST#export_declaration#Left export AST#class_declaration#Left class FileStructure AST#class_body#Left { // 名字 AST#property_declaration#Left public name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#property_declaration#Right // 时间 AST#property_declaration#Left public time : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#property_declaration#Right // 子文件数量 AST#property_declaration#Left public childrenNum ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right // 数据类型 1:文件夹、2:文件 AST#property_declaration#Right AST#property_declaration#Left public type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 文件大小 AST#property_declaration#Left public size ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right // 处理日期格式 AST#property_declaration#Right AST#method_declaration#Left private dateFormat AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left date = AST#expression#Left time AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left year = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left month : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left month = AST#expression#Left AST#binary_expression#Left AST#expression#Left month AST#expression#Right >= AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left ? AST#expression#Left AST#binary_expression#Left AST#expression#Left month AST#expression#Right AST#ERROR#Left : ( '0' AST#ERROR#Right + AST#expression#Left month AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left day : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left day = AST#expression#Left AST#binary_expression#Left AST#expression#Left day AST#expression#Right >= AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left ? AST#expression#Left AST#binary_expression#Left AST#expression#Left day AST#expression#Right AST#ERROR#Left : ( '0' AST#ERROR#Right + AST#expression#Left day AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left hours : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getHours AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left hours = AST#expression#Left AST#binary_expression#Left AST#expression#Left hours AST#expression#Right >= AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left ? AST#expression#Left AST#binary_expression#Left AST#expression#Left hours AST#expression#Right AST#ERROR#Left : ( '0' AST#ERROR#Right + AST#expression#Left hours AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left minutes : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getMinutes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left minutes = AST#expression#Left AST#binary_expression#Left AST#expression#Left minutes AST#expression#Right >= AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left ? AST#expression#Left AST#binary_expression#Left AST#expression#Left minutes AST#expression#Right AST#ERROR#Left : ( '0' AST#ERROR#Right + AST#expression#Left minutes AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left year AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left month AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left day AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left hours AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left minutes AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left childrenNum ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left size ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . name AST#member_expression#Right = AST#expression#Left name AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . type AST#member_expression#Right = AST#expression#Left type AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 如果是文件就给出子目录文件数量,如果不是就给出文件大小 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . childrenNum AST#member_expression#Right = AST#expression#Left childrenNum AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . size AST#member_expression#Right = AST#expression#Left size AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 创建时间,没有的话给当前时间 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . time AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dateFormat AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left time AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class FileStructure { public name: string = ""; public time: string = ""; public childrenNum?: number public type: number = 0; public size?: string private dateFormat(time: Date): string { let date = time; let year = date.getFullYear(); let month: string | number = date.getMonth() + 1; month = month >= 10 ? month : ('0' + month); let day: string | number = date.getDate(); day = day >= 10 ? day : ('0' + day); let hours: string | number = date.getHours(); hours = hours >= 10 ? hours : ('0' + hours); let minutes: string | number = date.getMinutes(); minutes = minutes >= 10 ? minutes : ('0' + minutes); return `${year}/${month}/${day} ${hours}:${minutes}`; } constructor(name: string, type: number, time: Date, childrenNum?: number, size?: string) { this.name = name; this.type = type; if (type === 1) { this.childrenNum = childrenNum; } else { this.size = size; } this.time = this.dateFormat(time); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedFilemanager/Library/src/main/ets/mock/local/FileData.ets#L17-L55
e2780a30f25935e9ffe4efb2ff514944bab528c1
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocache/src/main/ets/model/VideoPlayerManager.ets
arkts
setAVPlayerCallback
状态机函数,监听视频状态 @param callback 回调函数 @returns
async setAVPlayerCallback(callback: (avPlayer: media.AVPlayer) => void): Promise<void> { logger.info(TAG, `setAVPlayerCallback start`); if (this.avPlayer === null) { logger.info(TAG, 'avPlayer has not init'); return; } // seek操作结果回调函数 this.avPlayer.on('seekDone', (seekDoneTime) => { logger.info(TAG, `AVPlayer seek succeeded, seek time is ${seekDoneTime}`); }) // error回调监听函数,当avPlayer在操作过程中出现错误时调用reset接口触发重置流程 this.avPlayer.on('error', (err) => { logger.error(TAG, `Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`); this.avPlayer.reset(); // 调用reset重置资源,触发idle状态 }) // 状态机变化回调函数 this.avPlayer.on('stateChange', async (state, reason) => { switch (state) { case 'idle': // 成功调用reset接口后触发该状态机上报 logger.info(TAG, 'AVPlayer state idle called.'); this.videoRelease(); // 调用release接口销毁实例对象 break; case 'initialized': // avplayer 设置播放源后触发该状态上报 logger.info(TAG, 'AVPlayer state initialized called.');
AST#method_declaration#Left async setAVPlayerCallback AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left avPlayer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayer AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` setAVPlayerCallback start ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'avPlayer has not init' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // seek操作结果回调函数 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'seekDone' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left seekDoneTime AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` AVPlayer seek succeeded, seek time is AST#template_substitution#Left $ { AST#expression#Left seekDoneTime AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // error回调监听函数,当avPlayer在操作过程中出现错误时调用reset接口触发重置流程 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'error' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Invoke avPlayer failed, code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . reset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 调用reset重置资源,触发idle状态 } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // 状态机变化回调函数 AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#ERROR#Left ( AST#expression#Left 'stateChange' AST#expression#Right , async AST#parameter_list#Left ( AST#parameter#Left state AST#parameter#Right , AST#parameter#Left reason AST#parameter#Right ) AST#parameter_list#Right => { AST#property_name#Left switch AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left state AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 'idle' AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Right : // 成功调用reset接口后触发该状态机上报 AST#ERROR#Left AST#qualified_type#Left logger . info AST#qualified_type#Right AST#ERROR#Right ( AST#parameter#Left TAG AST#parameter#Right , 'AVPlayer state idle called.' ) AST#ERROR#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoRelease AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 调用release接口销毁实例对象 AST#expression_statement#Left AST#expression#Left break AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 'initialized' AST#expression#Right AST#expression_statement#Right : // avplayer 设置播放源后触发该状态上报 AST#ERROR#Left AST#qualified_type#Left logger . info AST#qualified_type#Right AST#ERROR#Right ( AST#parameter#Left TAG AST#parameter#Right , 'AVPlayer state initialized called.' ) AST#ERROR#Right ; AST#method_declaration#Right
async setAVPlayerCallback(callback: (avPlayer: media.AVPlayer) => void): Promise<void> { logger.info(TAG, `setAVPlayerCallback start`); if (this.avPlayer === null) { logger.info(TAG, 'avPlayer has not init'); return; } this.avPlayer.on('seekDone', (seekDoneTime) => { logger.info(TAG, `AVPlayer seek succeeded, seek time is ${seekDoneTime}`); }) this.avPlayer.on('error', (err) => { logger.error(TAG, `Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`); this.avPlayer.reset(); }) this.avPlayer.on('stateChange', async (state, reason) => { switch (state) { case 'idle': logger.info(TAG, 'AVPlayer state idle called.'); this.videoRelease(); break; case 'initialized': logger.info(TAG, 'AVPlayer state initialized called.');
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocache/src/main/ets/model/VideoPlayerManager.ets#L69-L92
f16ebd4481bab866faac407c6b0083793291be17
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_axios/src/main/ets/axios/EfClientApi.ets
arkts
delete
delete请求 @param efClientParams 删除请求入参实体 @returns
async delete<E>(efClientParams: efClientParams<null>, cls?: ClassConstructor<E>): Promise<E | EfAxiosError> { try { //如果当前请求efClientParams.loadingTxt传入参数 则 更改当前的loading文本 if (efClientParams.loadingTxt) { efAxiosParams.loadingTxt = efClientParams.loadingTxt; } let response: AxiosResponse<E> = await efAxios.delete<E, AxiosResponse<E>, null>(efClientParams.url, { headers: EfClientApi.appendHeader(efClientParams.headers), baseURL: EfClientApi.appendBaseURL(efClientParams.baseUrl) }); //如果当前请求更改过loading文字的话 - 更改默认值 if (efClientParams.loadingTxt) { efAxiosParams.loadingTxt = EfAxiosConst.loadingTxt; } //需要转换类型解决状态变量监听的问题 if (cls) { return plainToClass(cls, response.data); } //返回response的数据 return response.data; } catch (error) { //如果当前请求更改过loading文字的话 - 更改默认值 if (efClientParams.loadingTxt) { efAxiosParams.loadingTxt = EfAxiosConst.loadingTxt; } let e: AxiosError = error as AxiosError; //将异常抛出 return new EfAxiosError(Number(e.code), e.name, e.message, e.stack); } }
AST#method_declaration#Left async delete AST#type_parameters#Left < AST#type_parameter#Left E AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left efClientParams : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left efClientParams AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left null AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cls ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ClassConstructor AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left E AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left E AST#primary_type#Right | AST#primary_type#Left EfAxiosError AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { //如果当前请求efClientParams.loadingTxt传入参数 则 更改当前的loading文本 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left efClientParams AST#expression#Right . loadingTxt AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left efAxiosParams AST#expression#Right . loadingTxt AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left efClientParams AST#expression#Right . loadingTxt AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left response : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AxiosResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left E AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left efAxios AST#expression#Right AST#await_expression#Right AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left E AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AxiosResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left E AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left null AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left efClientParams AST#expression#Right . url AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left headers AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EfClientApi AST#expression#Right . appendHeader AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left efClientParams AST#expression#Right . headers AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left baseURL AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EfClientApi AST#expression#Right . appendBaseURL AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left efClientParams AST#expression#Right . baseUrl AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //如果当前请求更改过loading文字的话 - 更改默认值 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left efClientParams AST#expression#Right . loadingTxt AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left efAxiosParams AST#expression#Right . loadingTxt AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left EfAxiosConst AST#expression#Right . loadingTxt AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right //需要转换类型解决状态变量监听的问题 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left cls AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left plainToClass AST#expression#Right AST#argument_list#Left ( AST#expression#Left cls AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right //返回response的数据 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . data AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { //如果当前请求更改过loading文字的话 - 更改默认值 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left efClientParams AST#expression#Right . loadingTxt AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left efAxiosParams AST#expression#Right . loadingTxt AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left EfAxiosConst AST#expression#Right . loadingTxt AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left e : AST#type_annotation#Left AST#primary_type#Left AxiosError AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AxiosError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //将异常抛出 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left EfAxiosError AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . name AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . stack AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async delete<E>(efClientParams: efClientParams<null>, cls?: ClassConstructor<E>): Promise<E | EfAxiosError> { try { if (efClientParams.loadingTxt) { efAxiosParams.loadingTxt = efClientParams.loadingTxt; } let response: AxiosResponse<E> = await efAxios.delete<E, AxiosResponse<E>, null>(efClientParams.url, { headers: EfClientApi.appendHeader(efClientParams.headers), baseURL: EfClientApi.appendBaseURL(efClientParams.baseUrl) }); if (efClientParams.loadingTxt) { efAxiosParams.loadingTxt = EfAxiosConst.loadingTxt; } if (cls) { return plainToClass(cls, response.data); } return response.data; } catch (error) { if (efClientParams.loadingTxt) { efAxiosParams.loadingTxt = EfAxiosConst.loadingTxt; } let e: AxiosError = error as AxiosError; return new EfAxiosError(Number(e.code), e.name, e.message, e.stack); } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/axios/EfClientApi.ets#L266-L295
5716a84e780d5e7c1e078a2d8ac4b304889902bf
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/view/Detail/dialog/IntervalDialog.ets
arkts
IntervalDialog
尺寸工具类 定义一个自定义的对话框组件,用于设置闹钟的间隔时间
@CustomDialog export default struct IntervalDialog { // 使用DetailConstants中的默认提供器键来消费AlarmItem @Consume(DetailConstants.DEFAULT_PROVIDER_KEY) alarmItem: AlarmItem; // 定义状态变量:间隔分钟和间隔次数 @State intervalMinuteSelect: number = 0; @State intervalTimesSelect: number = 0; // 对话框控制器 controller?: CustomDialogController; // 在对话框即将出现时的操作 aboutToAppear(): void { // 初始化状态变量为AlarmItem中的值 this.intervalMinuteSelect = this.alarmItem.intervalMinute; this.intervalTimesSelect = this.alarmItem.intervalTimes; } // 构建对话框的内容 build() { // 使用Flex布局 Flex() { // 如果间隔时间或间隔次数大于0 if ((this.intervalTimesSelect | this.intervalMinuteSelect) > 0) { // 创建一个通用对话框 CommonDialog({ title: $r('app.string.ring_interval'), // 设置标题 controller: this.controller, // 设置控制器 // 确认按钮的回调函数 onConfirm: () => { // 更新AlarmItem的间隔分钟和次数 this.alarmItem.intervalMinute = Number(this.intervalMinuteSelect.toFixed(0)) this.alarmItem.intervalTimes = Number(this.intervalTimesSelect.toFixed(0)) } }) { // 创建两个间隔设置项 this.IntervalItem($r('app.string.ring_interval_content'), 0) // 间隔分钟设置项 // 分割线 Divider() .opacity($r('app.float.divider_opacity')) // 设置透明度 .color($r('app.color.grey_divider')) // 设置颜色 .lineCap(LineCapStyle.Round) // 设置线帽样式 // 间隔次数设置项 this.IntervalItem($r('app.string.ring_times_content'), CommonConstants.DEFAULT_SINGLE) } } } } // 构建间隔项的方法,包含文本和滑动条 @Builder IntervalItem(title: string | Resource, intervalType: number) { // 显示标题文本 Text(title) .fontSize(DimensionUtil.getFp($r('app.float.interval_dialog_title_font_size'))) .width(CommonConstants.FULL_LENGTH) .textAlign(TextAlign.Start) .margin({ top: DimensionUtil.getVp($r('app.float.interval_dialog_title_margin_top')) }) // 使用行布局 Row() { // 滑动条组件 Slider({ value: (intervalType === 0 ? this.intervalMinuteSelect : this.intervalTimesSelect), // 根据类型设置当前值 min: (intervalType === 0 ? CommonConstants.DEFAULT_INTERVAL_STEP : 0), // 设置最小值 max: (intervalType === 0 ? CommonConstants.DEFAULT_INTERVAL_MINUTE_MAX : CommonConstants.DEFAULT_INTERVAL_TIME_MAX), // 设置最大值 step: (intervalType === 0 ? CommonConstants.DEFAULT_INTERVAL_STEP : CommonConstants.DEFAULT_DOUBLE), // 设置步长 style: SliderStyle.OutSet // 设置样式 }) .blockColor(Color.Blue) // 设置滑块颜色 .trackColor(Color.Gray) // 设置轨道颜色 .selectedColor(Color.Blue) // 设置选择颜色 .showSteps(true) // 显示步进 .showTips(false) // 不显示提示 // 当滑动条值改变时的回调 .onChange((value: number) => { // 根据类型更新状态变量 if (intervalType === 0) { this.intervalMinuteSelect = value; } else { this.intervalTimesSelect = value; } }) // 显示当前选定值的文本 Text((intervalType === 0 ? this.intervalMinuteSelect : this.intervalTimesSelect).toFixed(0)) .fontSize(DimensionUtil.getFp($r('app.float.interval_dialog_result_font_size'))) } .width(CommonConstants.FULL_LENGTH) // 设置宽度 } }
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct IntervalDialog AST#component_body#Left { // 使用DetailConstants中的默认提供器键来消费AlarmItem AST#property_declaration#Left AST#decorator#Left @ Consume ( AST#expression#Left AST#member_expression#Left AST#expression#Left DetailConstants AST#expression#Right . DEFAULT_PROVIDER_KEY AST#member_expression#Right AST#expression#Right ) AST#decorator#Right alarmItem : AST#type_annotation#Left AST#primary_type#Left AlarmItem AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 定义状态变量:间隔分钟和间隔次数 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right intervalMinuteSelect : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right intervalTimesSelect : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 对话框控制器 AST#property_declaration#Left controller ? : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 在对话框即将出现时的操作 AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 初始化状态变量为AlarmItem中的值 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . intervalMinuteSelect AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . alarmItem AST#member_expression#Right AST#expression#Right . intervalMinute AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . intervalTimesSelect AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . alarmItem AST#member_expression#Right AST#expression#Right . intervalTimes AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right // 构建对话框的内容 AST#build_method#Left build ( ) AST#build_body#Left { // 使用Flex布局 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( ) AST#container_content_body#Left { // 如果间隔时间或间隔次数大于0 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . intervalTimesSelect AST#member_expression#Right AST#expression#Right | AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . intervalMinuteSelect AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { // 创建一个通用对话框 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left CommonDialog ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.ring_interval' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , // 设置标题 AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , // 设置控制器 // 确认按钮的回调函数 AST#component_parameter#Left onConfirm : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 更新AlarmItem的间隔分钟和次数 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . alarmItem AST#member_expression#Right AST#expression#Right . intervalMinute AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . intervalMinuteSelect AST#member_expression#Right AST#expression#Right . toFixed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . alarmItem AST#member_expression#Right AST#expression#Right . intervalTimes AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . intervalTimesSelect AST#member_expression#Right AST#expression#Right . toFixed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 创建两个间隔设置项 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . IntervalItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.ring_interval_content' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // 间隔分钟设置项 // 分割线 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.divider_opacity' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) // 设置透明度 AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.grey_divider' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) // 设置颜色 AST#modifier_chain_expression#Left . lineCap ( AST#expression#Left AST#member_expression#Left AST#expression#Left LineCapStyle AST#expression#Right . Round AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 设置线帽样式 // 间隔次数设置项 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . IntervalItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.ring_times_content' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEFAULT_SINGLE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right // 构建间隔项的方法,包含文本和滑动条 AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right IntervalItem AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left intervalType : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // 显示标题文本 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left title AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DimensionUtil AST#expression#Right . getFp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.interval_dialog_title_font_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_LENGTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DimensionUtil AST#expression#Right . getVp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.interval_dialog_title_margin_top' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 使用行布局 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 滑动条组件 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Slider ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left intervalType AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . intervalMinuteSelect AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . intervalTimesSelect AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#component_parameter#Right , // 根据类型设置当前值 AST#component_parameter#Left min : AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left intervalType AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEFAULT_INTERVAL_STEP AST#member_expression#Right AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#component_parameter#Right , // 设置最小值 AST#component_parameter#Left max : AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left intervalType AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEFAULT_INTERVAL_MINUTE_MAX AST#member_expression#Right AST#expression#Right : AST#expression#Left CommonConstants AST#expression#Right AST#conditional_expression#Right AST#expression#Right . DEFAULT_INTERVAL_TIME_MAX AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#component_parameter#Right , // 设置最大值 AST#component_parameter#Left step : AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left intervalType AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEFAULT_INTERVAL_STEP AST#member_expression#Right AST#expression#Right : AST#expression#Left CommonConstants AST#expression#Right AST#conditional_expression#Right AST#expression#Right . DEFAULT_DOUBLE AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#component_parameter#Right , // 设置步长 AST#component_parameter#Left style : AST#expression#Left AST#member_expression#Left AST#expression#Left SliderStyle AST#expression#Right . OutSet AST#member_expression#Right AST#expression#Right AST#component_parameter#Right // 设置样式 } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . blockColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right ) // 设置滑块颜色 AST#modifier_chain_expression#Left . trackColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ) // 设置轨道颜色 AST#modifier_chain_expression#Left . selectedColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right ) // 设置选择颜色 AST#modifier_chain_expression#Left . showSteps ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) // 显示步进 AST#modifier_chain_expression#Left . showTips ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) // 不显示提示 // 当滑动条值改变时的回调 AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 根据类型更新状态变量 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left intervalType AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . intervalMinuteSelect AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . intervalTimesSelect AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 显示当前选定值的文本 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left intervalType AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . intervalMinuteSelect AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . intervalTimesSelect AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toFixed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DimensionUtil AST#expression#Right . getFp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.interval_dialog_result_font_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_LENGTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 设置宽度 } AST#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@CustomDialog export default struct IntervalDialog { @Consume(DetailConstants.DEFAULT_PROVIDER_KEY) alarmItem: AlarmItem; @State intervalMinuteSelect: number = 0; @State intervalTimesSelect: number = 0; controller?: CustomDialogController; aboutToAppear(): void { this.intervalMinuteSelect = this.alarmItem.intervalMinute; this.intervalTimesSelect = this.alarmItem.intervalTimes; } build() { Flex() { if ((this.intervalTimesSelect | this.intervalMinuteSelect) > 0) { CommonDialog({ title: $r('app.string.ring_interval'), controller: this.controller, onConfirm: () => { this.alarmItem.intervalMinute = Number(this.intervalMinuteSelect.toFixed(0)) this.alarmItem.intervalTimes = Number(this.intervalTimesSelect.toFixed(0)) } }) { this.IntervalItem($r('app.string.ring_interval_content'), 0) Divider() .opacity($r('app.float.divider_opacity')) .color($r('app.color.grey_divider')) .lineCap(LineCapStyle.Round) this.IntervalItem($r('app.string.ring_times_content'), CommonConstants.DEFAULT_SINGLE) } } } } @Builder IntervalItem(title: string | Resource, intervalType: number) { Text(title) .fontSize(DimensionUtil.getFp($r('app.float.interval_dialog_title_font_size'))) .width(CommonConstants.FULL_LENGTH) .textAlign(TextAlign.Start) .margin({ top: DimensionUtil.getVp($r('app.float.interval_dialog_title_margin_top')) }) Row() { Slider({ value: (intervalType === 0 ? this.intervalMinuteSelect : this.intervalTimesSelect), min: (intervalType === 0 ? CommonConstants.DEFAULT_INTERVAL_STEP : 0), max: (intervalType === 0 ? CommonConstants.DEFAULT_INTERVAL_MINUTE_MAX : CommonConstants.DEFAULT_INTERVAL_TIME_MAX), step: (intervalType === 0 ? CommonConstants.DEFAULT_INTERVAL_STEP : CommonConstants.DEFAULT_DOUBLE), style: SliderStyle.OutSet }) .blockColor(Color.Blue) .trackColor(Color.Gray) .selectedColor(Color.Blue) .showSteps(true) .showTips(false) .onChange((value: number) => { if (intervalType === 0) { this.intervalMinuteSelect = value; } else { this.intervalTimesSelect = value; } }) Text((intervalType === 0 ? this.intervalMinuteSelect : this.intervalTimesSelect).toFixed(0)) .fontSize(DimensionUtil.getFp($r('app.float.interval_dialog_result_font_size'))) } .width(CommonConstants.FULL_LENGTH) } }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/view/Detail/dialog/IntervalDialog.ets#L9-L101
e77c05d4ad6f2a454253ee817eb20033d9f3c925
github
anhao0226/harmony-music-player.git
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
entry/src/main/ets/api/SongApi.ets
arkts
@param artistId @returns
export function fetchAlbumDetail(albumId: number) { const params = { id: albumId }; return new Promise <AlbumDetailResult>((resolve, reject) => { httpRequestGet<AlbumDetailResponse>(AccessUrls.AlbumDetail, { queryParams: params }) .then((res) => { if (res.code === 200) { resolve({ songs: res.songs, album: res.album }); } else { reject(new Error(`Response error: code ${res.code}, message: ${res.message}`)); } }) .catch((err) => { console.log(err); reject(err); }) }); }
AST#export_declaration#Left export AST#function_declaration#Left function fetchAlbumDetail AST#parameter_list#Left ( AST#parameter#Left albumId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left albumId AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AlbumDetailResult AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left resolve AST#parameter#Right , AST#parameter#Left reject AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left httpRequestGet AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AlbumDetailResponse AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AccessUrls AST#expression#Right . AlbumDetail AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left queryParams AST#property_name#Right : AST#expression#Left params AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left res AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . code AST#member_expression#Right AST#expression#Right === AST#expression#Left 200 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left resolve AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left songs AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . songs AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left album AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . album AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left reject AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Response error: code AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left reject AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function fetchAlbumDetail(albumId: number) { const params = { id: albumId }; return new Promise <AlbumDetailResult>((resolve, reject) => { httpRequestGet<AlbumDetailResponse>(AccessUrls.AlbumDetail, { queryParams: params }) .then((res) => { if (res.code === 200) { resolve({ songs: res.songs, album: res.album }); } else { reject(new Error(`Response error: code ${res.code}, message: ${res.message}`)); } }) .catch((err) => { console.log(err); reject(err); }) }); }
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/api/SongApi.ets#L197-L213
6efceeed3ad049ec1ed8360f8e915bed5dfe55a9
github
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/utils/HttpUtil.ets
arkts
request
发送HTTP请求 @param url 请求URL @param config 请求配置 @returns Promise<HttpResponse>
static async request<T = Object>(url: string, config: RequestConfig = {}): Promise<HttpResponse<T>> { const httpRequest = http.createHttp(); try { const fullUrl = url.startsWith('http') ? url : `${HttpUtil.BASE_URL}${url}`; console.info(`[HttpUtil] 发起请求: ${fullUrl}`); // 合并headers const mergedHeaders: Record<string, string> = { 'Content-Type': 'application/json' }; // 添加自定义headers if (config.headers) { const customHeaderKeys = Object.keys(config.headers); for (let i = 0; i < customHeaderKeys.length; i++) { const key = customHeaderKeys[i]; mergedHeaders[key] = config.headers[key]; } } const requestOptions: http.HttpRequestOptions = { method: config.method || http.RequestMethod.GET, header: mergedHeaders, connectTimeout: config.timeout || HttpUtil.TIMEOUT, readTimeout: config.timeout || HttpUtil.TIMEOUT, extraData: config.data ? JSON.stringify(config.data) : undefined }; console.info(`[HttpUtil] 请求配置:`, JSON.stringify(requestOptions)); const response = await httpRequest.request(fullUrl, requestOptions); console.info(`[HttpUtil] 响应状态码: ${response.responseCode}`); console.info(`[HttpUtil] 响应内容: ${response.result}`); if (response.responseCode === 200) { try { const rawResult: Object = JSON.parse(response.result as string); console.info(`[HttpUtil] 原始响应数据:`, JSON.stringify(rawResult)); // 检查是否是标准的HttpResponse格式 if (rawResult && typeof rawResult === 'object') { const resultObj = rawResult as Record<string, Object>; if (resultObj.code !== undefined && resultObj.msg !== undefined) { // 标准格式,直接返回 const result = rawResult as HttpResponse<T>; console.info(`[HttpUtil] 标准格式响应:`, JSON.stringify(result)); return result; } else { // 非标准格式,包装成HttpResponse const wrappedResult: HttpResponse<T> = { code: 200, msg: 'success', data: rawResult as T }; console.info(`[HttpUtil] 包装后的响应:`, JSON.stringify(wrappedResult)); return wrappedResult; } } else { // 非对象类型,包装成HttpResponse const wrappedResult: HttpResponse<T> = { code: 200, msg: 'success', data: rawResult as T }; console.info(`[HttpUtil] 包装后的响应:`, JSON.stringify(wrappedResult)); return wrappedResult; } } catch (parseError) { console.error(`[HttpUtil] JSON解析失败:`, parseError); return { code: -1, msg: 'JSON解析失败', data: undefined }; } } else { console.warn(`[HttpUtil] HTTP错误: ${response.responseCode}`); return { code: response.responseCode, msg: `HTTP ${response.responseCode}`, data: undefined }; } } catch (error) { console.error('[HttpUtil] HTTP请求失败:', error); return { code: -1, msg: '网络请求失败', data: undefined }; } finally { httpRequest.destroy(); } }
AST#method_declaration#Left static async request AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left RequestConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HttpResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . createHttp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left fullUrl = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left url AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'http' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#ERROR#Left ? AST#ERROR#Left url : AST#ERROR#Right AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtil AST#expression#Right . BASE_URL AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left url AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#ERROR#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] 发起请求: AST#template_substitution#Left $ { AST#expression#Left fullUrl AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 合并headers AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left mergedHeaders : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'Content-Type' AST#property_name#Right : AST#expression#Left 'application/json' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 添加自定义headers AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . headers AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left customHeaderKeys = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . keys AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . headers AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left customHeaderKeys AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left key = AST#expression#Left AST#subscript_expression#Left AST#expression#Left customHeaderKeys AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left mergedHeaders AST#expression#Right [ AST#expression#Left key AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = config AST#ERROR#Right . headers AST#member_expression#Right AST#expression#Right [ AST#expression#Left key AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left requestOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpRequestOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . method AST#member_expression#Right AST#expression#Right || AST#expression#Left http AST#expression#Right AST#binary_expression#Right AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . GET AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left header AST#property_name#Right : AST#expression#Left mergedHeaders AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . timeout AST#member_expression#Right AST#expression#Right || AST#expression#Left HttpUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . TIMEOUT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . timeout AST#member_expression#Right AST#expression#Right || AST#expression#Left HttpUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . TIMEOUT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left extraData AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . data AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left undefined AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] 请求配置: ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left requestOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left response = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fullUrl AST#expression#Right , AST#expression#Left requestOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] 响应状态码: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] 响应内容: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . result AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right === AST#expression#Left 200 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left rawResult : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . result AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] 原始响应数据: ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rawResult AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 检查是否是标准的HttpResponse格式 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left rawResult AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left rawResult AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'object' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left resultObj = AST#expression#Left AST#as_expression#Left AST#expression#Left rawResult AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultObj AST#expression#Right . code AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left resultObj AST#expression#Right AST#binary_expression#Right AST#expression#Right . msg AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 标准格式,直接返回 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result = AST#expression#Left AST#as_expression#Left AST#expression#Left rawResult AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HttpResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] 标准格式响应: ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 非标准格式,包装成HttpResponse AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left wrappedResult : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HttpResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left code AST#property_name#Right : AST#expression#Left 200 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left msg AST#property_name#Right : AST#expression#Left 'success' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#as_expression#Left AST#expression#Left rawResult AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] 包装后的响应: ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left wrappedResult AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left wrappedResult AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 非对象类型,包装成HttpResponse AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left wrappedResult : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HttpResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left code AST#property_name#Right : AST#expression#Left 200 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left msg AST#property_name#Right : AST#expression#Left 'success' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#as_expression#Left AST#expression#Left rawResult AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] 包装后的响应: ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left wrappedResult AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left wrappedResult AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( parseError ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] JSON解析失败: ` AST#template_literal#Right AST#expression#Right , AST#expression#Left parseError AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left code AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left msg AST#property_name#Right : AST#expression#Left 'JSON解析失败' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left undefined AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] HTTP错误: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left code AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left msg AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` HTTP AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left undefined AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[HttpUtil] HTTP请求失败:' AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left code AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left msg AST#property_name#Right : AST#expression#Left '网络请求失败' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left undefined AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#finally_clause#Left finally AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left httpRequest AST#expression#Right . destroy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#finally_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async request<T = Object>(url: string, config: RequestConfig = {}): Promise<HttpResponse<T>> { const httpRequest = http.createHttp(); try { const fullUrl = url.startsWith('http') ? url : `${HttpUtil.BASE_URL}${url}`; console.info(`[HttpUtil] 发起请求: ${fullUrl}`); const mergedHeaders: Record<string, string> = { 'Content-Type': 'application/json' }; if (config.headers) { const customHeaderKeys = Object.keys(config.headers); for (let i = 0; i < customHeaderKeys.length; i++) { const key = customHeaderKeys[i]; mergedHeaders[key] = config.headers[key]; } } const requestOptions: http.HttpRequestOptions = { method: config.method || http.RequestMethod.GET, header: mergedHeaders, connectTimeout: config.timeout || HttpUtil.TIMEOUT, readTimeout: config.timeout || HttpUtil.TIMEOUT, extraData: config.data ? JSON.stringify(config.data) : undefined }; console.info(`[HttpUtil] 请求配置:`, JSON.stringify(requestOptions)); const response = await httpRequest.request(fullUrl, requestOptions); console.info(`[HttpUtil] 响应状态码: ${response.responseCode}`); console.info(`[HttpUtil] 响应内容: ${response.result}`); if (response.responseCode === 200) { try { const rawResult: Object = JSON.parse(response.result as string); console.info(`[HttpUtil] 原始响应数据:`, JSON.stringify(rawResult)); if (rawResult && typeof rawResult === 'object') { const resultObj = rawResult as Record<string, Object>; if (resultObj.code !== undefined && resultObj.msg !== undefined) { const result = rawResult as HttpResponse<T>; console.info(`[HttpUtil] 标准格式响应:`, JSON.stringify(result)); return result; } else { const wrappedResult: HttpResponse<T> = { code: 200, msg: 'success', data: rawResult as T }; console.info(`[HttpUtil] 包装后的响应:`, JSON.stringify(wrappedResult)); return wrappedResult; } } else { const wrappedResult: HttpResponse<T> = { code: 200, msg: 'success', data: rawResult as T }; console.info(`[HttpUtil] 包装后的响应:`, JSON.stringify(wrappedResult)); return wrappedResult; } } catch (parseError) { console.error(`[HttpUtil] JSON解析失败:`, parseError); return { code: -1, msg: 'JSON解析失败', data: undefined }; } } else { console.warn(`[HttpUtil] HTTP错误: ${response.responseCode}`); return { code: response.responseCode, msg: `HTTP ${response.responseCode}`, data: undefined }; } } catch (error) { console.error('[HttpUtil] HTTP请求失败:', error); return { code: -1, msg: '网络请求失败', data: undefined }; } finally { httpRequest.destroy(); } }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/utils/HttpUtil.ets#L30-L124
0baf8e42618ce8e60c6c1852af7bc37f42767f32
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/map_lib_func_008_F.ets
arkts
Introduction 库函数-map_values
export function map_lib_func_008_F(taint_src : string) { let map = new Map<string,string>(); map.set("t","_"); map.set("tt","a"); taint.Sink(map.values()); }
AST#export_declaration#Left export AST#function_declaration#Left function map_lib_func_008_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left map = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left map AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "t" AST#expression#Right , AST#expression#Left "_" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left map AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "tt" AST#expression#Right , AST#expression#Left "a" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left map AST#expression#Right . values AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function map_lib_func_008_F(taint_src : string) { let map = new Map<string,string>(); map.set("t","_"); map.set("tt","a"); taint.Sink(map.values()); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/map_lib_func_008_F.ets#L7-L12
968233018153f59795f67708fb7940d34aa58ec0
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM4.ets
arkts
encryptGCMSegment
加密(GCM模式)分段,异步 @param dataBlob 加密或者解密的数据。dataBlob不能为null。 @param key 指定加密或解密的密钥。 @param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(SM4_128|GCM|PKCS7、SM4_128|GCM|PKCS5、等) @param len 自定义的数据拆分长度。 @returns
static async encryptGCMSegment(dataBlob: cryptoFramework.DataBlob, key: cryptoFramework.Key, gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'SM4_128|GCM|PKCS7', len: number = 128): Promise<cryptoFramework.DataBlob> { let cipher = cryptoFramework.createCipher(transformation); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, key, gcmParams); let encryptData = new Uint8Array(); for (let i = 0; i < dataBlob.data.length; i += len) { let updateData = dataBlob.data.subarray(i, i + len); let updateDataBlob: cryptoFramework.DataBlob = { data: updateData }; let updateOutput = await cipher.update(updateDataBlob); //分段update let mergeTData = new Uint8Array(encryptData.length + updateOutput.data.length); mergeTData.set(encryptData); mergeTData.set(updateOutput.data, encryptData.length); encryptData = mergeTData; } gcmParams.authTag = await cipher.doFinal(null); let encryptBlob: cryptoFramework.DataBlob = { data: encryptData }; return encryptBlob; }
AST#method_declaration#Left static async encryptGCMSegment AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . Key AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left gcmParams : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . GcmParamsSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transformation : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM4_128|GCM|PKCS7' AST#expression#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 128 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cipher = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createCipher AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left transformation AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left cipher AST#expression#Right AST#await_expression#Right AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . ENCRYPT_MODE AST#member_expression#Right AST#expression#Right , AST#expression#Left key AST#expression#Right , AST#expression#Left gcmParams AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left encryptData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left dataBlob AST#expression#Right AST#binary_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left len AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataBlob AST#expression#Right . data AST#member_expression#Right AST#expression#Right . subarray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left len AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateDataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left updateData AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateOutput = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left cipher AST#expression#Right AST#await_expression#Right AST#expression#Right . update AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left updateDataBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //分段update AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mergeTData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left encryptData AST#expression#Right . length AST#member_expression#Right AST#expression#Right + AST#expression#Left updateOutput AST#expression#Right AST#binary_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mergeTData AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left encryptData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mergeTData AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left updateOutput AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left encryptData AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left encryptData = AST#expression#Left mergeTData AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left gcmParams AST#expression#Right . authTag AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left cipher AST#expression#Right AST#await_expression#Right AST#expression#Right . doFinal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left encryptBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left encryptData AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left encryptBlob AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async encryptGCMSegment(dataBlob: cryptoFramework.DataBlob, key: cryptoFramework.Key, gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'SM4_128|GCM|PKCS7', len: number = 128): Promise<cryptoFramework.DataBlob> { let cipher = cryptoFramework.createCipher(transformation); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, key, gcmParams); let encryptData = new Uint8Array(); for (let i = 0; i < dataBlob.data.length; i += len) { let updateData = dataBlob.data.subarray(i, i + len); let updateDataBlob: cryptoFramework.DataBlob = { data: updateData }; let updateOutput = await cipher.update(updateDataBlob); let mergeTData = new Uint8Array(encryptData.length + updateOutput.data.length); mergeTData.set(encryptData); mergeTData.set(updateOutput.data, encryptData.length); encryptData = mergeTData; } gcmParams.authTag = await cipher.doFinal(null); let encryptBlob: cryptoFramework.DataBlob = { data: encryptData }; return encryptBlob; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L269-L287
07bc8dafb535006bbb6ff449e900d63c846b4eda
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/model/OptionTypes.ets
arkts
选项接口定义 用于下拉选择框等组件的数据结构
export interface Option { value: number; label: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Option AST#object_type#Left { AST#type_member#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface Option { value: number; label: string; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/OptionTypes.ets#L5-L8
3a33f6dc63d765678666e5b92cc5540e2cdca4d3
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets
arkts
任务模型
export interface Task { id: number; dreamId: number; userId: number; title: string; description: string; status: number; priority: number; startDate: string; dueDate: string; completedAt: string | null; reminderTime: string | null; parentTaskId: number | null; createdAt: string; updatedAt: string; dreamTitle?: string; isTodayTask?: boolean; isOverdue?: boolean; isUpcomingTask?: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Task AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left dreamId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left description : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left status : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left priority : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left startDate : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left dueDate : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left completedAt : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left reminderTime : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left parentTaskId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left createdAt : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left updatedAt : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left dreamTitle ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left isTodayTask ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left isOverdue ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left isUpcomingTask ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface Task { id: number; dreamId: number; userId: number; title: string; description: string; status: number; priority: number; startDate: string; dueDate: string; completedAt: string | null; reminderTime: string | null; parentTaskId: number | null; createdAt: string; updatedAt: string; dreamTitle?: string; isTodayTask?: boolean; isOverdue?: boolean; isUpcomingTask?: boolean; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets#L99-L118
7ee104c9ed672589887fd531bcd75af2c41f9844
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/timeto/TimeToManager.ets
arkts
clearSavedTimeByName
清空指定 typeName 的时间和结果
public static clearSavedTimeByName(typeName: string): void { try { const prefs = TimeToManager._getPrefs(); prefs.putSync(TimeToKeys.lastTime(typeName), ''); prefs.putSync(TimeToKeys.lastResult(typeName), ''); prefs.flushSync(); DebugLog.d(`cleared savedTime for: ${typeName}`); } catch (err) { DebugLog.d(`clearSavedTimeByName error for ${typeName}: ${err}`); } }
AST#method_declaration#Left public static clearSavedTimeByName AST#parameter_list#Left ( AST#parameter#Left typeName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left prefs = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TimeToManager AST#expression#Right . _getPrefs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left prefs AST#expression#Right . putSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TimeToKeys AST#expression#Right . lastTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left typeName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left prefs AST#expression#Right . putSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TimeToKeys AST#expression#Right . lastResult AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left typeName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left prefs AST#expression#Right . flushSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` cleared savedTime for: AST#template_substitution#Left $ { AST#expression#Left typeName AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` clearSavedTimeByName error for AST#template_substitution#Left $ { AST#expression#Left typeName AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public static clearSavedTimeByName(typeName: string): void { try { const prefs = TimeToManager._getPrefs(); prefs.putSync(TimeToKeys.lastTime(typeName), ''); prefs.putSync(TimeToKeys.lastResult(typeName), ''); prefs.flushSync(); DebugLog.d(`cleared savedTime for: ${typeName}`); } catch (err) { DebugLog.d(`clearSavedTimeByName error for ${typeName}: ${err}`); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/timeto/TimeToManager.ets#L131-L141
512c9bb0f7487c866603d99c80edcd4babfffb93
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/BasicDataSource.ets
arkts
notifyDataDelete
通知LazyForEach组件需要在index对应索引处删除该子组件
notifyDataDelete(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataDelete(index); }) }
AST#method_declaration#Left notifyDataDelete AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataDelete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
notifyDataDelete(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataDelete(index); }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/BasicDataSource.ets#L68-L72
d9e837db75fbea28e8d25849a18db7ce2e846bf1
gitee
fourseas1998/hos.ArkTSComponents.git
5f0dbd0038f17067722cb035c88fe826e4846e69
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getSwiperImages
获取轮播图资源
getSwiperImages(): Array<Resource>{ let swiperImages: Resource[]=[ $r('app.media.fig1'), $r('app.media.fig2'), $r('app.media.fig3'), $r('app.media.fig4'), ]; return swiperImages; }
AST#method_declaration#Left getSwiperImages AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left swiperImages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.fig1' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.fig2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.fig3' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.fig4' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left swiperImages AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getSwiperImages(): Array<Resource>{ let swiperImages: Resource[]=[ $r('app.media.fig1'), $r('app.media.fig2'), $r('app.media.fig3'), $r('app.media.fig4'), ]; return swiperImages; }
https://github.com/fourseas1998/hos.ArkTSComponents.git/blob/5f0dbd0038f17067722cb035c88fe826e4846e69/entry/src/main/ets/viewmodel/MainViewModel.ets#L8-L16
3e359ea643b7b109e2020e742a155b272509d68b
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets
arkts
setAxisLineWidth
Sets the width of the border surrounding the chart in dp. @param width
public setAxisLineWidth(width: number): void { this.mAxisLineWidth = Utils.convertDpToPixel(width); }
AST#method_declaration#Left public setAxisLineWidth AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLineWidth AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . convertDpToPixel AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left width AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public setAxisLineWidth(width: number): void { this.mAxisLineWidth = Utils.convertDpToPixel(width); }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets#L276-L278
b26ac0cde01815dd5b55749f25bd7e49928532a1
gitee
fmtjava/Ohs_ArkTs_Eyepetizer.git
79578f394ccb926da1455e63b7fe0722df9b9a22
entry/src/main/ets/datasource/BasicDataSource.ets
arkts
notifyDataReload
通知数据重载
notifyDataReload(): void { this.listeners.forEach(listener => { listener.onDataReloaded(); }) }
AST#method_declaration#Left notifyDataReload AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataReloaded AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
notifyDataReload(): void { this.listeners.forEach(listener => { listener.onDataReloaded(); }) }
https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/datasource/BasicDataSource.ets#L85-L89
32f573be70f53b9cb26fe8ba09e5d9cfa28ac91f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/settings/SettingsService.ets
arkts
isVersionCompatible
检查版本兼容性 @param version 版本号 @returns 是否兼容
private isVersionCompatible(version: string): boolean { // 简单的版本兼容性检查 const currentMajor = parseInt(BusinessConstants.SETTINGS_VERSION.toString().split('.')[0]); const importMajor = parseInt(version.split('.')[0]); return importMajor <= currentMajor; }
AST#method_declaration#Left private isVersionCompatible AST#parameter_list#Left ( AST#parameter#Left version : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 简单的版本兼容性检查 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left currentMajor = AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left BusinessConstants AST#expression#Right . SETTINGS_VERSION AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left importMajor = AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left version AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left importMajor AST#expression#Right <= AST#expression#Left currentMajor AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private isVersionCompatible(version: string): boolean { const currentMajor = parseInt(BusinessConstants.SETTINGS_VERSION.toString().split('.')[0]); const importMajor = parseInt(version.split('.')[0]); return importMajor <= currentMajor; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L937-L943
172e89936a058f5914e2f04493c86914f834594e
github
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/network/ConnectionUtils.ets
arkts
openRegister
The method of opening register.
openRegister() { this.netConnection.register((error: BusinessError) => { hilog.info(0x0000, TAG, JSON.stringify(error)); }); }
AST#method_declaration#Left openRegister AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . netConnection AST#member_expression#Right AST#expression#Right . register AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
openRegister() { this.netConnection.register((error: BusinessError) => { hilog.info(0x0000, TAG, JSON.stringify(error)); }); }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/network/ConnectionUtils.ets#L52-L56
4d39bc632e6fc1ecfa45ff045fe9ce4ae3589444
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/nativeembed/src/main/ets/view/NativeEmbedView.ets
arkts
getEmbedId
获取EmbedId
getEmbedId(): string { return this.embedId; }
AST#method_declaration#Left getEmbedId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . embedId AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getEmbedId(): string { return this.embedId; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/nativeembed/src/main/ets/view/NativeEmbedView.ets#L117-L119
ed6952a8751f0c9232ade9b316df06272dfeb7da
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/DistributedFileSample/entry/src/main/ets/pages/Index.ets
arkts
copyDistributedFile
[End copy_distributed_to_sand] B设备在获取A端沙箱文件时,从B设备的分布式路径下将对应的文件拷贝走,以此完成跨设备拷贝。
function copyDistributedFile(): void { // 待拷贝文件的目标沙箱路径 let filePath: string = pathDir + '/dest.txt'; // 获取目标路径uri let destUri = fileUri.getUriFromPath(filePath); // 获取分布式路径下的源文件 let srcUri: string = fileUri.getUriFromPath(distributedPathDir + '/src.txt'); // 定义拷贝回调 let progressListener: fs.ProgressListener = (progress: fs.Progress) => { Logger.info(`progressSize: ${progress.processedSize}, totalSize: ${progress.totalSize}`); }; let options: fs.CopyOptions = { 'progressListener': progressListener }; try { // 将分布式路径下的文件拷贝到其他沙箱路径下 fs.copy(srcUri, destUri, options).then(() => { Logger.info('Succeeded in copying of paste. '); showToast('Succeeded in copying of paste. ', DELAY); Logger.info('src: ' + srcUri + 'dest: ' + destUri); }).catch((error: BusinessError) => { let err: BusinessError = error as BusinessError; Logger.error(`Failed to copy. Code: ${err.code}, message: ${err.message}`); }) } catch (err) { let error: BusinessError = err as BusinessError; Logger.error(`Failed to copy. Code: ${error.code}, message: ${error.message}`); } }
AST#function_declaration#Left function copyDistributedFile AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 待拷贝文件的目标沙箱路径 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left pathDir AST#expression#Right + AST#expression#Left '/dest.txt' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取目标路径uri AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left destUri = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileUri AST#expression#Right . getUriFromPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取分布式路径下的源文件 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left srcUri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileUri AST#expression#Right . getUriFromPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left distributedPathDir AST#expression#Right + AST#expression#Left '/src.txt' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 定义拷贝回调 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left progressListener : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left fs . ProgressListener AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left progress : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left fs . Progress AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` progressSize: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left progress AST#expression#Right . processedSize AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , totalSize: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left progress AST#expression#Right . totalSize AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left fs . CopyOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'progressListener' AST#property_name#Right : AST#expression#Left progressListener AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 将分布式路径下的文件拷贝到其他沙箱路径下 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . copy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left srcUri AST#expression#Right , AST#expression#Left destUri AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Succeeded in copying of paste. ' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left showToast AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Succeeded in copying of paste. ' AST#expression#Right , AST#expression#Left DELAY AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'src: ' AST#expression#Right + AST#expression#Left srcUri AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'dest: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left destUri AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to copy. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left error : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to copy. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
function copyDistributedFile(): void { let filePath: string = pathDir + '/dest.txt'; let destUri = fileUri.getUriFromPath(filePath); let srcUri: string = fileUri.getUriFromPath(distributedPathDir + '/src.txt'); let progressListener: fs.ProgressListener = (progress: fs.Progress) => { Logger.info(`progressSize: ${progress.processedSize}, totalSize: ${progress.totalSize}`); }; let options: fs.CopyOptions = { 'progressListener': progressListener }; try { fs.copy(srcUri, destUri, options).then(() => { Logger.info('Succeeded in copying of paste. '); showToast('Succeeded in copying of paste. ', DELAY); Logger.info('src: ' + srcUri + 'dest: ' + destUri); }).catch((error: BusinessError) => { let err: BusinessError = error as BusinessError; Logger.error(`Failed to copy. Code: ${err.code}, message: ${err.message}`); }) } catch (err) { let error: BusinessError = err as BusinessError; Logger.error(`Failed to copy. Code: ${error.code}, message: ${error.message}`); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/DistributedFileSample/entry/src/main/ets/pages/Index.ets#L194-L222
87ec862418f7cfbd285d7574be0309d0c44538ab
gitee
buqiuz/Account.git
b843a38c24a833a9a4386f63cffec5fa5dadc674
oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/highlight/RadarHighlighter.ets
arkts
getHighlightsAtIndex
Returns an array of Highlight objects for the given index. The Highlight objects give information about the value at the selected index and the DataSet it belongs to. INFORMATION: This method does calculations at runtime. Do not over-use in performance critical situations. @param index @return
protected getHighlightsAtIndex(index: number): Highlight[] { if (this.mChart == null || this.mChart.getData() == null) { return []; } const highlightBuffer: Highlight[] = []; let animator = this.mChart.getAnimator(); if (!animator) { return []; } const phaseX = animator.getPhaseX(); const phaseY = animator.getPhaseY(); const sliceangle = this.mChart.getSliceAngle(); const factor = this.mChart.getFactor(); let pOut = MPPointF.getInstance(0, 0); for (let i = 0; i < this.mChart!.getData()!.getDataSetCount(); i++) { const dataSet: IDataSet<EntryOhos> | null = this.mChart!.getData()!.getDataSetByIndex(i); if (!dataSet) { continue; } const entry = dataSet.getEntryForIndex(index); const y = entry.getY() - this.mChart.getYChartMin(); let centerOffsets = this.mChart.getCenterOffsets(); if (this.mChart != null && centerOffsets != null) { pOut = Utils.getPosition( centerOffsets, y * factor * phaseY, sliceangle * index * phaseX + this.mChart.getRotationAngle(), pOut ); } highlightBuffer.push( new Highlight(index, entry.getY(), i, 0, 0, pOut.x, pOut.y, dataSet.getAxisDependency()) ); } return highlightBuffer; }
AST#method_declaration#Left protected getHighlightsAtIndex AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Highlight [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left highlightBuffer : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Highlight [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left animator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right . getAnimator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left animator AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left phaseX = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left animator AST#expression#Right . getPhaseX AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left phaseY = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left animator AST#expression#Right . getPhaseY AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sliceangle = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right . getSliceAngle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left factor = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right . getFactor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pOut = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left MPPointF AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . getDataSetCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dataSet : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left IDataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . getDataSetByIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left dataSet AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#continue_statement#Left continue ; AST#continue_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left entry = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . getEntryForIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left y = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left entry AST#expression#Right . getY AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right . getYChartMin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left centerOffsets = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right . getCenterOffsets AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left centerOffsets AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left pOut = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . getPosition AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left centerOffsets AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left y AST#expression#Right * AST#expression#Left factor AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left phaseY AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sliceangle AST#expression#Right * AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left phaseX AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right . getRotationAngle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left pOut AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left highlightBuffer AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Highlight AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left entry AST#expression#Right . getY AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left i AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left pOut AST#expression#Right . x AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left pOut AST#expression#Right . y AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . getAxisDependency AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left highlightBuffer AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
protected getHighlightsAtIndex(index: number): Highlight[] { if (this.mChart == null || this.mChart.getData() == null) { return []; } const highlightBuffer: Highlight[] = []; let animator = this.mChart.getAnimator(); if (!animator) { return []; } const phaseX = animator.getPhaseX(); const phaseY = animator.getPhaseY(); const sliceangle = this.mChart.getSliceAngle(); const factor = this.mChart.getFactor(); let pOut = MPPointF.getInstance(0, 0); for (let i = 0; i < this.mChart!.getData()!.getDataSetCount(); i++) { const dataSet: IDataSet<EntryOhos> | null = this.mChart!.getData()!.getDataSetByIndex(i); if (!dataSet) { continue; } const entry = dataSet.getEntryForIndex(index); const y = entry.getY() - this.mChart.getYChartMin(); let centerOffsets = this.mChart.getCenterOffsets(); if (this.mChart != null && centerOffsets != null) { pOut = Utils.getPosition( centerOffsets, y * factor * phaseY, sliceangle * index * phaseX + this.mChart.getRotationAngle(), pOut ); } highlightBuffer.push( new Highlight(index, entry.getY(), i, 0, 0, pOut.x, pOut.y, dataSet.getAxisDependency()) ); } return highlightBuffer; }
https://github.com/buqiuz/Account.git/blob/b843a38c24a833a9a4386f63cffec5fa5dadc674/oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/highlight/RadarHighlighter.ets#L60-L102
fbf03022865779d211956dc2d6d54bc80678f723
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
eventbus/src/main/ets/EventBus.ets
arkts
on
注册事件监听 @param eventName 事件名 @param handler 监听回调 @param isSticky 是否粘性 @returns
static on(eventName: string, handler: Function, isSticky = false) { EventBusCore.getInstance().on(eventName, handler, isSticky); }
AST#method_declaration#Left static on AST#parameter_list#Left ( AST#parameter#Left eventName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left handler : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isSticky = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EventBusCore AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left eventName AST#expression#Right , AST#expression#Left handler AST#expression#Right , AST#expression#Left isSticky AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static on(eventName: string, handler: Function, isSticky = false) { EventBusCore.getInstance().on(eventName, handler, isSticky); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/eventbus/src/main/ets/EventBus.ets#L13-L15
a7229b56f5b31de2d257ff504314e3dac90bd652
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets
arkts
releaseCustomScan
释放自定义扫码资源 @returns {Promise<void>}
async releaseCustomScan(): Promise<void> { logger.info('releaseCustomScan'); try { await customScan.release(); } catch (error) { logger.error('Catch: release error: ' + JSON.stringify(error)); } }
AST#method_declaration#Left async releaseCustomScan AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'releaseCustomScan' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left customScan AST#expression#Right AST#await_expression#Right AST#expression#Right . release AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Catch: release error: ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async releaseCustomScan(): Promise<void> { logger.info('releaseCustomScan'); try { await customScan.release(); } catch (error) { logger.error('Catch: release error: ' + JSON.stringify(error)); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L361-L368
c4ce74641627c383850132068d639b4b212d4da2
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/common/UIUtils.ets
arkts
ActionMenu配置
export class ActionMenuOptions { title: string = ''; buttons: ButtonOptions[] = []; constructor(title?: string, buttons?: ButtonOptions[]) { this.title = title || ''; this.buttons = buttons || []; } }
AST#export_declaration#Left export AST#class_declaration#Left class ActionMenuOptions AST#class_body#Left { AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left buttons : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ButtonOptions [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left title ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left buttons ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ButtonOptions [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left title AST#expression#Right || AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buttons AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left buttons AST#expression#Right || AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class ActionMenuOptions { title: string = ''; buttons: ButtonOptions[] = []; constructor(title?: string, buttons?: ButtonOptions[]) { this.title = title || ''; this.buttons = buttons || []; } }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/common/UIUtils.ets#L46-L54
f31a7b85eeeb452840fd6203c3b99f5dc7a31bcc
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/Current.ets
arkts
initCurveData
初始化数据 @param count 曲线图点的个数 @param range y轴范围
private initCurveData(): LineData { let values = new JArrayList<EntryOhos>(); for (let index: number = 0; index < this.gpData.length; index++) { const gpDataCur = this.gpData[index]; if (String(gpDataCur.currentNow) == '') { parseInt continue } if (this.gpData.length == 2) { values.add(new EntryOhos(Number(index).valueOf() * globalThis.testDuration, Math.round((Number(gpDataCur.currentNow).valueOf() * (Number(gpDataCur.voltageNow).valueOf() / 1e6)) / 3.8) )) } else { values.add(new EntryOhos(Number(index).valueOf() / 2, Math.round((Number(gpDataCur.currentNow).valueOf() * (Number(gpDataCur.voltageNow).valueOf() / 1e6)) / 3.8) )); } } let gradientFillColor: ColorStop[] = []; gradientFillColor.push([0x0C0099CC, 0.2]) gradientFillColor.push([0x7F0099CC, 0.4]) gradientFillColor.push([0x0099CC, 1.0]) let dataSet = new JArrayList<ILineDataSet>(); let set1 = new LineDataSet(values, 'Power Info(归一化电流 MA)'); set1.setDrawFilled(false); set1.setMode(Mode.CUBIC_BEZIER); set1.setGradientFillColor(gradientFillColor) set1.setColorByColor(Color.Blue); set1.setLineWidth(2) set1.setDrawValues(false); set1.setDrawCircles(false); set1.setCircleColor(Color.Blue); set1.setCircleRadius(8); set1.setDrawValues(false); set1.setCircleHoleRadius(4) set1.setCircleHoleColor(Color.Blue) set1.setDrawCircleHole(false) dataSet.add(set1); return new LineData(dataSet) }
AST#method_declaration#Left private initCurveData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LineData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left values = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JArrayList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . gpData AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left gpDataCur = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . gpData AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left gpDataCur AST#expression#Right . currentNow AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left parseInt AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#continue_statement#Left continue AST#continue_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . gpData AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right == AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left values AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left EntryOhos AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . valueOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left globalThis AST#expression#Right AST#binary_expression#Right AST#expression#Right . testDuration AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left gpDataCur AST#expression#Right . currentNow AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . valueOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left gpDataCur AST#expression#Right . voltageNow AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . valueOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left 1e6 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 3.8 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left values AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left EntryOhos AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . valueOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left gpDataCur AST#expression#Right . currentNow AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . valueOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left gpDataCur AST#expression#Right . voltageNow AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . valueOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left 1e6 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 3.8 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left gradientFillColor : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ColorStop [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left gradientFillColor AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0x0C0099CC AST#expression#Right , AST#expression#Left 0.2 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left gradientFillColor AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0x7F0099CC AST#expression#Right , AST#expression#Left 0.4 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left gradientFillColor AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0x0099CC AST#expression#Right , AST#expression#Left 1.0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dataSet = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JArrayList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ILineDataSet AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left set1 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left LineDataSet AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left values AST#expression#Right , AST#expression#Left 'Power Info(归一化电流 MA)' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set1 AST#expression#Right . setDrawFilled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set1 AST#expression#Right . setMode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Mode AST#expression#Right . CUBIC_BEZIER AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set1 AST#expression#Right . setGradientFillColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left gradientFillColor AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set1 AST#expression#Right . setColorByColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set1 AST#expression#Right . setLineWidth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set1 AST#expression#Right . setDrawValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set1 AST#expression#Right . setDrawCircles AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set1 AST#expression#Right . setCircleColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set1 AST#expression#Right . setCircleRadius AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 8 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set1 AST#expression#Right . setDrawValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set1 AST#expression#Right . setCircleHoleRadius AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 4 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set1 AST#expression#Right . setCircleHoleColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set1 AST#expression#Right . setDrawCircleHole AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left set1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left LineData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataSet AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private initCurveData(): LineData { let values = new JArrayList<EntryOhos>(); for (let index: number = 0; index < this.gpData.length; index++) { const gpDataCur = this.gpData[index]; if (String(gpDataCur.currentNow) == '') { parseInt continue } if (this.gpData.length == 2) { values.add(new EntryOhos(Number(index).valueOf() * globalThis.testDuration, Math.round((Number(gpDataCur.currentNow).valueOf() * (Number(gpDataCur.voltageNow).valueOf() / 1e6)) / 3.8) )) } else { values.add(new EntryOhos(Number(index).valueOf() / 2, Math.round((Number(gpDataCur.currentNow).valueOf() * (Number(gpDataCur.voltageNow).valueOf() / 1e6)) / 3.8) )); } } let gradientFillColor: ColorStop[] = []; gradientFillColor.push([0x0C0099CC, 0.2]) gradientFillColor.push([0x7F0099CC, 0.4]) gradientFillColor.push([0x0099CC, 1.0]) let dataSet = new JArrayList<ILineDataSet>(); let set1 = new LineDataSet(values, 'Power Info(归一化电流 MA)'); set1.setDrawFilled(false); set1.setMode(Mode.CUBIC_BEZIER); set1.setGradientFillColor(gradientFillColor) set1.setColorByColor(Color.Blue); set1.setLineWidth(2) set1.setDrawValues(false); set1.setDrawCircles(false); set1.setCircleColor(Color.Blue); set1.setCircleRadius(8); set1.setDrawValues(false); set1.setCircleHoleRadius(4) set1.setCircleHoleColor(Color.Blue) set1.setDrawCircleHole(false) dataSet.add(set1); return new LineData(dataSet) }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/Current.ets#L104-L149
67e1cb4d03ccaa4d36815bdc7c8bba0053c6fb35
gitee
wustcat404/time-bar
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
time_bar/src/main/ets/components/viewModel/TimeBarModel.ets
arkts
onDataChange
Register a callback for data changes. External code can react to data updates (e.g., to redraw the component). @param callback Callback invoked when data changes.
public onDataChange(callback: (type: 'timeRange' | 'currentTime') => void) { this._onDataChange = callback; }
AST#method_declaration#Left public onDataChange AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left type AST#parameter#Right AST#ERROR#Left : 'timeRange' | 'currentTime' AST#ERROR#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _onDataChange AST#member_expression#Right = AST#expression#Left callback AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public onDataChange(callback: (type: 'timeRange' | 'currentTime') => void) { this._onDataChange = callback; }
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/time_bar/src/main/ets/components/viewModel/TimeBarModel.ets#L116-L118
f20a2e467254a13558229f22bb83cdeb42b87888
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
通知设置接口
export interface NotificationSettings { enabled: boolean; channels: Record<NotificationChannel, NotificationChannelConfig>; quietHours: QuietHoursConfig; sound: NotificationSoundConfig; vibration: NotificationVibrationConfig; reminderSettings: ReminderSettings; methods: NotificationMethod[]; showPreview: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationSettings AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left channels : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left NotificationChannel AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left NotificationChannelConfig AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left quietHours : AST#type_annotation#Left AST#primary_type#Left QuietHoursConfig AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left sound : AST#type_annotation#Left AST#primary_type#Left NotificationSoundConfig AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left vibration : AST#type_annotation#Left AST#primary_type#Left NotificationVibrationConfig AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left reminderSettings : AST#type_annotation#Left AST#primary_type#Left ReminderSettings AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left methods : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left NotificationMethod [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left showPreview : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface NotificationSettings { enabled: boolean; channels: Record<NotificationChannel, NotificationChannelConfig>; quietHours: QuietHoursConfig; sound: NotificationSoundConfig; vibration: NotificationVibrationConfig; reminderSettings: ReminderSettings; methods: NotificationMethod[]; showPreview: boolean; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L46-L55
a9d282bac11ca1fa1cbf9d949c782a4352100e92
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/clickanimation/src/main/ets/components/ClickAnimationComponent.ets
arkts
setVibrator
设置振动效果。
setVibrator() { // 查询设备是否支持预设振动效果 vibrator.isSupportEffect(this.presetVibration, (err: BusinessError, state: boolean) => { if (err) { logger.error(TAG, `Failed to query effect. Code: ${err.code}, message: ${err.message}`); return; } if (state) { // 触发马达振动,使用预设效果HapticFeedback.EFFECT_SOFT,强度默认为100,用途设置为‘touch' vibrator.startVibration({ type: 'preset', effectId: this.presetVibration, intensity: this.intensity, }, { usage: 'touch' }, (error: BusinessError) => { if (error) { logger.error(TAG, `Failed to start vibration. Code: ${error.code}, message: ${error.message}`); } else { logger.info(TAG, 'Succeed in starting vibration'); } }); } }) }
AST#method_declaration#Left setVibrator AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 查询设备是否支持预设振动效果 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left vibrator AST#expression#Right . isSupportEffect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . presetVibration AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left err AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to query effect. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left state AST#expression#Right ) AST#block_statement#Left { // 触发马达振动,使用预设效果HapticFeedback.EFFECT_SOFT,强度默认为100,用途设置为‘touch' AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left vibrator AST#expression#Right . startVibration AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left 'preset' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left effectId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . presetVibration AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left intensity AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . intensity AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left usage AST#property_name#Right : AST#expression#Left 'touch' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left error AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to start vibration. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'Succeed in starting vibration' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
setVibrator() { vibrator.isSupportEffect(this.presetVibration, (err: BusinessError, state: boolean) => { if (err) { logger.error(TAG, `Failed to query effect. Code: ${err.code}, message: ${err.message}`); return; } if (state) { vibrator.startVibration({ type: 'preset', effectId: this.presetVibration, intensity: this.intensity, }, { usage: 'touch' }, (error: BusinessError) => { if (error) { logger.error(TAG, `Failed to start vibration. Code: ${error.code}, message: ${error.message}`); } else { logger.info(TAG, 'Succeed in starting vibration'); } }); } }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/components/ClickAnimationComponent.ets#L140-L164
40fbba849a4a2511566bc086c5387d11b77e9503
gitee
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/pages/MyDay.ets
arkts
selectedFolderChanged
在批量管理中,当用户选择日程被移动或复制的目标文件夹时的回调函数。 将被选中的日程,即 batchEditList 中的所有日程移动或复制到目标文件夹。
public selectedFolderChanged(): void { if (this.batchSelectedFolder === null) { return; } else if (this.isBatchMove) { let editList: Array<Schedule> = ArrayUtil.copy(this.batchEditList); editList.forEach((value: Schedule) => { value.folderName = this.batchSelectedFolder.folderName; this.scheduleTable.updateData(value, () => { }); this.getAllSchedules(); }); this.batchEditList = []; this.isBatchEdit = false; this.batchSelectedFolder = null; } else { let editList: Array<Schedule> = ArrayUtil.copy(this.batchEditList); editList.forEach((value: Schedule) => { value.folderName = this.batchSelectedFolder.folderName; this.scheduleTable.insertData(value, () => { }); this.getAllSchedules(); }); this.batchEditList = []; this.isBatchEdit = false; this.batchSelectedFolder = null; } }
AST#method_declaration#Left public selectedFolderChanged AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . batchSelectedFolder AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isBatchMove AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left editList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Schedule AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ArrayUtil AST#expression#Right . copy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . batchEditList AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left editList AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Schedule AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . folderName AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . batchSelectedFolder AST#member_expression#Right AST#expression#Right . folderName AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scheduleTable AST#member_expression#Right AST#expression#Right . updateData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getAllSchedules AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . batchEditList AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isBatchEdit AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . batchSelectedFolder AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left editList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Schedule AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ArrayUtil AST#expression#Right . copy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . batchEditList AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left editList AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Schedule AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . folderName AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . batchSelectedFolder AST#member_expression#Right AST#expression#Right . folderName AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scheduleTable AST#member_expression#Right AST#expression#Right . insertData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getAllSchedules AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . batchEditList AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isBatchEdit AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . batchSelectedFolder AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public selectedFolderChanged(): void { if (this.batchSelectedFolder === null) { return; } else if (this.isBatchMove) { let editList: Array<Schedule> = ArrayUtil.copy(this.batchEditList); editList.forEach((value: Schedule) => { value.folderName = this.batchSelectedFolder.folderName; this.scheduleTable.updateData(value, () => { }); this.getAllSchedules(); }); this.batchEditList = []; this.isBatchEdit = false; this.batchSelectedFolder = null; } else { let editList: Array<Schedule> = ArrayUtil.copy(this.batchEditList); editList.forEach((value: Schedule) => { value.folderName = this.batchSelectedFolder.folderName; this.scheduleTable.insertData(value, () => { }); this.getAllSchedules(); }); this.batchEditList = []; this.isBatchEdit = false; this.batchSelectedFolder = null; } }
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/MyDay.ets#L465-L491
c80c9daed7e966d6117008d201e069e164a7b903
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LogUtil.ets
arkts
print
打印JSON对象和JSON字符串 @param msg
static print(msg: object | string) { try { let content = ''; if (typeof msg === 'object') { if (msg instanceof Error) { content = content + LogUtil.getErrorStr(msg, false); } else { content = content + LogUtil.getObjectToJson(msg, false); } } else if (typeof msg === 'string') { if ((StrUtil.startsWith(msg, '{') && StrUtil.endsWith(msg, '}')) || (StrUtil.startsWith(msg, '[') && StrUtil.endsWith(msg, ']'))) { let obj = JSON.parse(msg.toString()) ?? new Object(msg); content = content + LogUtil.getObjectToJson(obj, false); } else { content = content + msg; } } const len = Math.ceil(content.length / LogUtil.logSize); for (let i = 0; i < len; i++) { let end = (i + 1) * LogUtil.logSize; if (i === (len - 1)) { end = content.length; } let msg = '\n' + content.substring(i * LogUtil.logSize, end); LogUtil.levelLog(msg, hilog.LogLevel.DEBUG); } } catch (err) { let error = err as BusinessError; //异常了 console.error(`LogUtil-print-异常 ~ code: ${error.code} -·- message: ${error.message}`); } }
AST#method_declaration#Left static print AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left object AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left content = AST#expression#Left '' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left msg AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'object' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left msg AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left content = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left content AST#expression#Right + AST#expression#Left LogUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . getErrorStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left msg AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left content = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left content AST#expression#Right + AST#expression#Left LogUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . getObjectToJson AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left msg AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left msg AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrUtil AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left msg AST#expression#Right , AST#expression#Left '{' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left StrUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . endsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left msg AST#expression#Right , AST#expression#Left '}' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right || AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrUtil AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left msg AST#expression#Right , AST#expression#Left '[' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left StrUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . endsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left msg AST#expression#Right , AST#expression#Left ']' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left obj = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left msg AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left AST#new_expression#Left new AST#expression#Left Object AST#expression#Right AST#new_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left msg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left content = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left content AST#expression#Right + AST#expression#Left LogUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . getObjectToJson AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left obj AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left content = AST#expression#Left AST#binary_expression#Left AST#expression#Left content AST#expression#Right + AST#expression#Left msg AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left len = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . ceil AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left content AST#expression#Right . length AST#member_expression#Right AST#expression#Right / AST#expression#Left LogUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . logSize AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left len AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left end = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left LogUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . logSize AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right === AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left len AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left end = AST#expression#Left AST#member_expression#Left AST#expression#Left content AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left msg = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '\n' AST#expression#Right + AST#expression#Left content AST#expression#Right AST#binary_expression#Right AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right * AST#expression#Left LogUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . logSize AST#member_expression#Right AST#expression#Right , AST#expression#Left end AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . levelLog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left msg AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . LogLevel AST#member_expression#Right AST#expression#Right . DEBUG AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left error = AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //异常了 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` LogUtil-print-异常 ~ code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right -·- message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static print(msg: object | string) { try { let content = ''; if (typeof msg === 'object') { if (msg instanceof Error) { content = content + LogUtil.getErrorStr(msg, false); } else { content = content + LogUtil.getObjectToJson(msg, false); } } else if (typeof msg === 'string') { if ((StrUtil.startsWith(msg, '{') && StrUtil.endsWith(msg, '}')) || (StrUtil.startsWith(msg, '[') && StrUtil.endsWith(msg, ']'))) { let obj = JSON.parse(msg.toString()) ?? new Object(msg); content = content + LogUtil.getObjectToJson(obj, false); } else { content = content + msg; } } const len = Math.ceil(content.length / LogUtil.logSize); for (let i = 0; i < len; i++) { let end = (i + 1) * LogUtil.logSize; if (i === (len - 1)) { end = content.length; } let msg = '\n' + content.substring(i * LogUtil.logSize, end); LogUtil.levelLog(msg, hilog.LogLevel.DEBUG); } } catch (err) { let error = err as BusinessError; console.error(`LogUtil-print-异常 ~ code: ${error.code} -·- message: ${error.message}`); } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LogUtil.ets#L127-L157
53fa0c904db5ce99f8318015f23af54cf2415682
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseEntry.ets
arkts
setY
Sets the y-value for the Entry. @param y
public setY(y: number): void { this.y = y; }
AST#method_declaration#Left public setY AST#parameter_list#Left ( AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . y AST#member_expression#Right = AST#expression#Left y AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public setY(y: number): void { this.y = y; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseEntry.ets#L69-L71
747db192507152ace21f1dfd7612edf7a71920c0
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/BarLineScatterCandleBubbleRenderer.ets
arkts
shouldDrawValues
Returns true if the DataSet values should be drawn, false if not. @param set @return
protected shouldDrawValues(dataSet: IDataSet<any>): boolean { return dataSet.isVisible() && (dataSet.isDrawValuesEnabled() || dataSet.isDrawIconsEnabled()); }
AST#method_declaration#Left protected shouldDrawValues AST#parameter_list#Left ( AST#parameter#Left dataSet : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IDataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . isVisible AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . isDrawValuesEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left dataSet AST#expression#Right AST#binary_expression#Right AST#expression#Right . isDrawIconsEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
protected shouldDrawValues(dataSet: IDataSet<any>): boolean { return dataSet.isVisible() && (dataSet.isDrawValuesEnabled() || dataSet.isDrawIconsEnabled()); }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/BarLineScatterCandleBubbleRenderer.ets#L93-L95
6f9e82e78bf3e1e9a3e7a7bfeed6c15434aa8473
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/SHASync.ets
arkts
digestSHA512
SHA512摘要 @param str 带摘要的字符串 @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @returns 摘要后的字符串
static digestSHA512(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.digest(str, 'SHA512', resultCoding); }
AST#method_declaration#Left static digestSHA512 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . digest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left 'SHA512' AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static digestSHA512(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.digest(str, 'SHA512', resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SHASync.ets#L75-L77
9c440ac831c5a7f134c3f2a565c6739b271ced63
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundManager.ets
arkts
removeAllCachedSounds
删除所有缓存
async removeAllCachedSounds() { await CSoundDbAccessor.shared.deleteAll() }
AST#method_declaration#Left async removeAllCachedSounds AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left CSoundDbAccessor AST#expression#Right AST#await_expression#Right AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . deleteAll AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
async removeAllCachedSounds() { await CSoundDbAccessor.shared.deleteAll() }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundManager.ets#L125-L127
f64998ade5693e6df2be9936962d025462faba81
github
ccccjiemo/egl.git
d18849c3da975ccf9373fd09874aa5637ccbe6bd
src/main/ets/constants/Index.ets
arkts
* KHR ext
export const EGL_CL_EVENT_HANDLE_KHR = 0x309C;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left EGL_CL_EVENT_HANDLE_KHR = AST#expression#Left 0x309C AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const EGL_CL_EVENT_HANDLE_KHR = 0x309C;
https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/src/main/ets/constants/Index.ets#L235-L235
4b97b82e8d42bceb56768d70312075693cb23d00
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/TextInputBuilderProxy.ets
arkts
inputType
输入框类型 @default InputType.Normal 、InputType.Password
inputType(inputType: InputType) { this.builderOptions.inputType = inputType; return this }
AST#method_declaration#Left inputType AST#parameter_list#Left ( AST#parameter#Left inputType : AST#type_annotation#Left AST#primary_type#Left InputType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . inputType AST#member_expression#Right = AST#expression#Left inputType AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left this AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
inputType(inputType: InputType) { this.builderOptions.inputType = inputType; return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TextInputBuilderProxy.ets#L18-L21
988768bf30aae73e853dd19daed7bc3f4484ccf8
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets
arkts
@Author csx @DateTime 2024/3/18 10:39:03 @TODO SM2Convert SM2ASN.1跟C1C3C2转换类
export class SM2Convert { /** * C1C3C2格式的字符串转换成ASN.1格式的字符 * @param primal_data C1C3C2格式的字符 * @returns ASN.1格式的字符 */ i2dSM2(primal_data: string): string { let sm2_sequence = new SM2Sequence(); sm2_sequence.C1x = primal_data.slice(0, 64); primal_data = primal_data.slice(64, primal_data.length); sm2_sequence.C1y = primal_data.slice(0, 64); primal_data = primal_data.slice(64, primal_data.length); sm2_sequence.C3 = primal_data.slice(0, 64); primal_data = primal_data.slice(64, primal_data.length); sm2_sequence.C2 = primal_data; let C1x_title: string = (Number.parseInt("0x" + sm2_sequence.C1x.slice(0, 2)) > 127) ? "022100" : "0220"; let C1y_title: string = (Number.parseInt("0x" + sm2_sequence.C1y.slice(0, 2)) > 127) ? "022100" : "0220"; let C3_title: string = "0420"; let C2_title: string = "04" + this.genLenHex(sm2_sequence.C2); let sequence_message: string = C1x_title + sm2_sequence.C1x + C1y_title + sm2_sequence.C1y + C3_title + sm2_sequence.C3 + C2_title + sm2_sequence.C2; let sequence_lenHex: string = this.genLenHex(sequence_message); let standard_data = "30" + sequence_lenHex + sequence_message; return standard_data; } /** * C1C2C3格式的字符串转换成ASN.1格式的字符 * @param primal_data C1C2C3格式的字符 * @returns ASN.1格式的字符 */ i2cSM2(primal_data: string): string { let sm2_sequence = new SM2Sequence(); sm2_sequence.C1x = primal_data.slice(0, 64); primal_data = primal_data.slice(64, primal_data.length); sm2_sequence.C1y = primal_data.slice(0, 64); primal_data = primal_data.slice(64, primal_data.length); sm2_sequence.C3 = primal_data.slice(0, 64); primal_data = primal_data.slice(64, primal_data.length); sm2_sequence.C2 = primal_data; let C1x_title: string = (Number.parseInt("0x" + sm2_sequence.C1x.slice(0, 2)) > 127) ? "022100" : "0220"; let C1y_title: string = (Number.parseInt("0x" + sm2_sequence.C1y.slice(0, 2)) > 127) ? "022100" : "0220"; let C3_title: string = "0420"; let C2_title: string = "04" + this.genLenHex(sm2_sequence.C2); let sequence_message: string = C1x_title + sm2_sequence.C1x + C1y_title + sm2_sequence.C1y + C2_title + sm2_sequence.C2 + C3_title + sm2_sequence.C3; let sequence_lenHex: string = this.genLenHex(sequence_message); let standard_data = "30" + sequence_lenHex + sequence_message; return standard_data; } /** * ASN.1格式的字符串转换成C1C3C2格式的字符 * @param standard_data ASN.1格式的字符 * @returns C1C3C2格式的字符 */ d2i(standard_data: string): string { let message: string = standard_data; if (!message.startsWith(ASN1Util.SEQUENCE)) { Logger.debug('转换SM2字符串出错'); } message = message.slice(ASN1Util.SEQUENCE.length, message.length); let sequence_lexHex: string = this.getLenHex(message); message = message.slice(sequence_lexHex.length, message.length); let sequence_len: number = this.lenHex2number(sequence_lexHex); if (sequence_len != message.length / 2) { Logger.debug('转换SM2字符串出错'); } let sm2_sequence = new SM2Sequence(); message = this.readC1(sm2_sequence, message); message = this.readC3(sm2_sequence, message); message = this.readC2(sm2_sequence, message); console.log(sm2_sequence.toString()); let primal_data: string = sm2_sequence.C1x + sm2_sequence.C1y + sm2_sequence.C3 + sm2_sequence.C2; return primal_data; } /** * ASN.1格式的字符串转换成C1C2C3格式的字符 * @param standard_data ASN.1格式的字符 * @returns C1C3C2格式的字符 */ d2c(standard_data: string): string { let message: string = standard_data; if (!message.startsWith(ASN1Util.SEQUENCE)) { Logger.debug('转换SM2字符串出错'); } message = message.slice(ASN1Util.SEQUENCE.length, message.length); let sequence_lexHex: string = this.getLenHex(message); message = message.slice(sequence_lexHex.length, message.length); let sequence_len: number = this.lenHex2number(sequence_lexHex); if (sequence_len != message.length / 2) { Logger.debug('转换SM2字符串出错'); } let sm2_sequence = new SM2Sequence(); message = this.readC1(sm2_sequence, message); message = this.readC3(sm2_sequence, message); message = this.readC2(sm2_sequence, message); console.log(sm2_sequence.toString()); let primal_data: string = sm2_sequence.C1x + sm2_sequence.C1y + sm2_sequence.C2 + sm2_sequence.C3; return primal_data; } /** * 获取16进制数据长度 * @param content * @returns */ private genLenHex(content: string): string { let size: number = content.length / 2; let lenHex: string; if (size.toString(16).length % 2 == 1) { lenHex = '0' + size.toString(16); } else { lenHex = size.toString(16); } if (size < 0x80) { return lenHex; } let lenHex_size: number = lenHex.length / 2; return (lenHex_size | 0x80).toString(16) + lenHex; } /** * 获取16进制数据长度 * @param data * @returns */ private getLenHex(data: string): string { let byte: number = Number.parseInt("0x" + data.slice(0, 2)); let len_size: number = byte > 127 ? byte - 0x80 + 1 : 1; return data.slice(0, len_size * 2); } /** * 16进制数据转换为数值 * @param lenHex 16进制数据 * @returns 对应的数值 */ private lenHex2number(lenHex: string): number { if (lenHex.length == 2) { return Number.parseInt("0x" + lenHex); } return Number.parseInt("0x" + lenHex.slice(2, lenHex.length)); } /** * 读取C1部分 * @param sm2_sequence sm2序列工具 * @param data 待读取的数据 * @returns C1部分 */ private readC1(sm2_sequence: SM2Sequence, data: string): string { let xy: string[] = []; for (let i = 0; i < 2; i++) { if (data.startsWith("0220")) { xy[i] = data.slice(4, 68); data = data.slice(68, data.length); } else if (data.startsWith("022100")) { xy[i] = data.slice(6, 70); data = data.slice(70, data.length); } else { Logger.debug('读取SM2字符串中的C1出错~'); } } sm2_sequence.C1x = xy[0]; sm2_sequence.C1y = xy[1]; return data; } /** * 读取C2部分 * @param sm2_sequence sm2序列工具 * @param data 待读取的数据 * @returns C2部分 */ private readC2(sm2_sequence: SM2Sequence, data: string): string { if (data.startsWith(ASN1Util.OCTEN_STRING)) { data = data.slice(ASN1Util.OCTEN_STRING.length, data.length); let C2_lenHex = this.getLenHex(data); data = data.slice(C2_lenHex.length, data.length); if (this.lenHex2number(C2_lenHex) != data.length / 2) { Logger.debug('SM2字符串中的C2长度不正确~'); } sm2_sequence.C2 = data; } else { Logger.debug('读取SM2字符串中的C2出错~'); } return data; } /** * 读取C3部分 * @param sm2_sequence sm2序列工具 * @param data 待读取的数据 * @returns C3部分 */ private readC3(sm2_sequence: SM2Sequence, data: string): string { if (data.startsWith("0420")) { sm2_sequence.C3 = data.slice(4, 68); data = data.slice(68, data.length); } else { Logger.debug('读取SM2字符串中的C3出错~'); } return data; } }
AST#export_declaration#Left export AST#class_declaration#Left class SM2Convert AST#class_body#Left { /** * C1C3C2格式的字符串转换成ASN.1格式的字符 * @param primal_data C1C3C2格式的字符 * @returns ASN.1格式的字符 */ AST#method_declaration#Left i2dSM2 AST#parameter_list#Left ( AST#parameter#Left primal_data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sm2_sequence = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SM2Sequence AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C1x AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 64 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left primal_data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 64 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C1y AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 64 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left primal_data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 64 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C3 AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 64 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left primal_data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 64 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C2 AST#member_expression#Right = AST#expression#Left primal_data AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left C1x_title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . parseInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "0x" AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C1x AST#member_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right > AST#expression#Left 127 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left "022100" AST#expression#Right : AST#expression#Left "0220" AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left C1y_title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . parseInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "0x" AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C1y AST#member_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right > AST#expression#Left 127 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left "022100" AST#expression#Right : AST#expression#Left "0220" AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left C3_title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "0420" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left C2_title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "04" AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . genLenHex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C2 AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sequence_message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left C1x_title AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C1x AST#member_expression#Right AST#expression#Right + AST#expression#Left C1y_title AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C1y AST#member_expression#Right AST#expression#Right + AST#expression#Left C3_title AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C3 AST#member_expression#Right AST#expression#Right + AST#expression#Left C2_title AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C2 AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sequence_lenHex : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . genLenHex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sequence_message AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left standard_data = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "30" AST#expression#Right + AST#expression#Left sequence_lenHex AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left sequence_message AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left standard_data AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * C1C2C3格式的字符串转换成ASN.1格式的字符 * @param primal_data C1C2C3格式的字符 * @returns ASN.1格式的字符 */ AST#method_declaration#Left i2cSM2 AST#parameter_list#Left ( AST#parameter#Left primal_data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sm2_sequence = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SM2Sequence AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C1x AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 64 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left primal_data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 64 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C1y AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 64 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left primal_data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 64 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C3 AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 64 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left primal_data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 64 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left primal_data AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C2 AST#member_expression#Right = AST#expression#Left primal_data AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left C1x_title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . parseInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "0x" AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C1x AST#member_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right > AST#expression#Left 127 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left "022100" AST#expression#Right : AST#expression#Left "0220" AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left C1y_title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . parseInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "0x" AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C1y AST#member_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right > AST#expression#Left 127 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left "022100" AST#expression#Right : AST#expression#Left "0220" AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left C3_title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "0420" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left C2_title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "04" AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . genLenHex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C2 AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sequence_message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left C1x_title AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C1x AST#member_expression#Right AST#expression#Right + AST#expression#Left C1y_title AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C1y AST#member_expression#Right AST#expression#Right + AST#expression#Left C2_title AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C2 AST#member_expression#Right AST#expression#Right + AST#expression#Left C3_title AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C3 AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sequence_lenHex : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . genLenHex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sequence_message AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left standard_data = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "30" AST#expression#Right + AST#expression#Left sequence_lenHex AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left sequence_message AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left standard_data AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * ASN.1格式的字符串转换成C1C3C2格式的字符 * @param standard_data ASN.1格式的字符 * @returns C1C3C2格式的字符 */ AST#method_declaration#Left d2i AST#parameter_list#Left ( AST#parameter#Left standard_data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left standard_data AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left message AST#expression#Right AST#unary_expression#Right AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ASN1Util AST#expression#Right . SEQUENCE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '转换SM2字符串出错' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left message = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ASN1Util AST#expression#Right . SEQUENCE AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sequence_lexHex : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getLenHex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left message AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left message = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left sequence_lexHex AST#expression#Right . length AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sequence_len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lenHex2number AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sequence_lexHex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sequence_len AST#expression#Right != AST#expression#Left message AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '转换SM2字符串出错' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sm2_sequence = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SM2Sequence AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left message = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . readC1 AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sm2_sequence AST#expression#Right , AST#expression#Left message AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left message = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . readC3 AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sm2_sequence AST#expression#Right , AST#expression#Left message AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left message = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . readC2 AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sm2_sequence AST#expression#Right , AST#expression#Left message AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left primal_data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C1x AST#member_expression#Right AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C1y AST#member_expression#Right AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C3 AST#member_expression#Right AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C2 AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left primal_data AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * ASN.1格式的字符串转换成C1C2C3格式的字符 * @param standard_data ASN.1格式的字符 * @returns C1C3C2格式的字符 */ AST#method_declaration#Left d2c AST#parameter_list#Left ( AST#parameter#Left standard_data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left standard_data AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left message AST#expression#Right AST#unary_expression#Right AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ASN1Util AST#expression#Right . SEQUENCE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '转换SM2字符串出错' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left message = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ASN1Util AST#expression#Right . SEQUENCE AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sequence_lexHex : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getLenHex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left message AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left message = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left sequence_lexHex AST#expression#Right . length AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sequence_len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lenHex2number AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sequence_lexHex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sequence_len AST#expression#Right != AST#expression#Left message AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '转换SM2字符串出错' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sm2_sequence = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SM2Sequence AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left message = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . readC1 AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sm2_sequence AST#expression#Right , AST#expression#Left message AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left message = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . readC3 AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sm2_sequence AST#expression#Right , AST#expression#Left message AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left message = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . readC2 AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sm2_sequence AST#expression#Right , AST#expression#Left message AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left primal_data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C1x AST#member_expression#Right AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C1y AST#member_expression#Right AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C2 AST#member_expression#Right AST#expression#Right + AST#expression#Left sm2_sequence AST#expression#Right AST#binary_expression#Right AST#expression#Right . C3 AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left primal_data AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 获取16进制数据长度 * @param content * @returns */ AST#method_declaration#Left private genLenHex AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left content AST#expression#Right . length AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left lenHex : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left size AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 16 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right % AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right == AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left lenHex = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '0' AST#expression#Right + AST#expression#Left size AST#expression#Right AST#binary_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 16 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left lenHex = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left size AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 16 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left size AST#expression#Right < AST#expression#Left 0x80 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left lenHex AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left lenHex_size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left lenHex AST#expression#Right . length AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left lenHex_size AST#expression#Right | AST#expression#Left 0x80 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 16 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left lenHex AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 获取16进制数据长度 * @param data * @returns */ AST#method_declaration#Left private getLenHex AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left byte : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . parseInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "0x" AST#expression#Right + AST#expression#Left data AST#expression#Right AST#binary_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left len_size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left byte AST#expression#Right > AST#expression#Left 127 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left byte AST#expression#Right - AST#expression#Left 0x80 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right : AST#expression#Left 1 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left len_size AST#expression#Right * AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 16进制数据转换为数值 * @param lenHex 16进制数据 * @returns 对应的数值 */ AST#method_declaration#Left private lenHex2number AST#parameter_list#Left ( AST#parameter#Left lenHex : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left lenHex AST#expression#Right . length AST#member_expression#Right AST#expression#Right == AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . parseInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left "0x" AST#expression#Right + AST#expression#Left lenHex AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . parseInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "0x" AST#expression#Right + AST#expression#Left lenHex AST#expression#Right AST#binary_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left lenHex AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 读取C1部分 * @param sm2_sequence sm2序列工具 * @param data 待读取的数据 * @returns C1部分 */ AST#method_declaration#Left private readC1 AST#parameter_list#Left ( AST#parameter#Left sm2_sequence : AST#type_annotation#Left AST#primary_type#Left SM2Sequence AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left xy : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "0220" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left xy AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = data AST#ERROR#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 4 AST#expression#Right , AST#expression#Left 68 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 68 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "022100" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left xy AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = data AST#ERROR#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 6 AST#expression#Right , AST#expression#Left 70 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 70 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '读取SM2字符串中的C1出错~' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C1x AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left xy AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C1y AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left xy AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left data AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 读取C2部分 * @param sm2_sequence sm2序列工具 * @param data 待读取的数据 * @returns C2部分 */ AST#method_declaration#Left private readC2 AST#parameter_list#Left ( AST#parameter#Left sm2_sequence : AST#type_annotation#Left AST#primary_type#Left SM2Sequence AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ASN1Util AST#expression#Right . OCTEN_STRING AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ASN1Util AST#expression#Right . OCTEN_STRING AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left C2_lenHex = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getLenHex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left C2_lenHex AST#expression#Right . length AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lenHex2number AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left C2_lenHex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right != AST#expression#Left data AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'SM2字符串中的C2长度不正确~' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C2 AST#member_expression#Right = AST#expression#Left data AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '读取SM2字符串中的C2出错~' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left data AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 读取C3部分 * @param sm2_sequence sm2序列工具 * @param data 待读取的数据 * @returns C3部分 */ AST#method_declaration#Left private readC3 AST#parameter_list#Left ( AST#parameter#Left sm2_sequence : AST#type_annotation#Left AST#primary_type#Left SM2Sequence AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "0420" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C3 AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 4 AST#expression#Right , AST#expression#Left 68 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 68 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '读取SM2字符串中的C3出错~' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left data AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class SM2Convert { i2dSM2(primal_data: string): string { let sm2_sequence = new SM2Sequence(); sm2_sequence.C1x = primal_data.slice(0, 64); primal_data = primal_data.slice(64, primal_data.length); sm2_sequence.C1y = primal_data.slice(0, 64); primal_data = primal_data.slice(64, primal_data.length); sm2_sequence.C3 = primal_data.slice(0, 64); primal_data = primal_data.slice(64, primal_data.length); sm2_sequence.C2 = primal_data; let C1x_title: string = (Number.parseInt("0x" + sm2_sequence.C1x.slice(0, 2)) > 127) ? "022100" : "0220"; let C1y_title: string = (Number.parseInt("0x" + sm2_sequence.C1y.slice(0, 2)) > 127) ? "022100" : "0220"; let C3_title: string = "0420"; let C2_title: string = "04" + this.genLenHex(sm2_sequence.C2); let sequence_message: string = C1x_title + sm2_sequence.C1x + C1y_title + sm2_sequence.C1y + C3_title + sm2_sequence.C3 + C2_title + sm2_sequence.C2; let sequence_lenHex: string = this.genLenHex(sequence_message); let standard_data = "30" + sequence_lenHex + sequence_message; return standard_data; } i2cSM2(primal_data: string): string { let sm2_sequence = new SM2Sequence(); sm2_sequence.C1x = primal_data.slice(0, 64); primal_data = primal_data.slice(64, primal_data.length); sm2_sequence.C1y = primal_data.slice(0, 64); primal_data = primal_data.slice(64, primal_data.length); sm2_sequence.C3 = primal_data.slice(0, 64); primal_data = primal_data.slice(64, primal_data.length); sm2_sequence.C2 = primal_data; let C1x_title: string = (Number.parseInt("0x" + sm2_sequence.C1x.slice(0, 2)) > 127) ? "022100" : "0220"; let C1y_title: string = (Number.parseInt("0x" + sm2_sequence.C1y.slice(0, 2)) > 127) ? "022100" : "0220"; let C3_title: string = "0420"; let C2_title: string = "04" + this.genLenHex(sm2_sequence.C2); let sequence_message: string = C1x_title + sm2_sequence.C1x + C1y_title + sm2_sequence.C1y + C2_title + sm2_sequence.C2 + C3_title + sm2_sequence.C3; let sequence_lenHex: string = this.genLenHex(sequence_message); let standard_data = "30" + sequence_lenHex + sequence_message; return standard_data; } d2i(standard_data: string): string { let message: string = standard_data; if (!message.startsWith(ASN1Util.SEQUENCE)) { Logger.debug('转换SM2字符串出错'); } message = message.slice(ASN1Util.SEQUENCE.length, message.length); let sequence_lexHex: string = this.getLenHex(message); message = message.slice(sequence_lexHex.length, message.length); let sequence_len: number = this.lenHex2number(sequence_lexHex); if (sequence_len != message.length / 2) { Logger.debug('转换SM2字符串出错'); } let sm2_sequence = new SM2Sequence(); message = this.readC1(sm2_sequence, message); message = this.readC3(sm2_sequence, message); message = this.readC2(sm2_sequence, message); console.log(sm2_sequence.toString()); let primal_data: string = sm2_sequence.C1x + sm2_sequence.C1y + sm2_sequence.C3 + sm2_sequence.C2; return primal_data; } d2c(standard_data: string): string { let message: string = standard_data; if (!message.startsWith(ASN1Util.SEQUENCE)) { Logger.debug('转换SM2字符串出错'); } message = message.slice(ASN1Util.SEQUENCE.length, message.length); let sequence_lexHex: string = this.getLenHex(message); message = message.slice(sequence_lexHex.length, message.length); let sequence_len: number = this.lenHex2number(sequence_lexHex); if (sequence_len != message.length / 2) { Logger.debug('转换SM2字符串出错'); } let sm2_sequence = new SM2Sequence(); message = this.readC1(sm2_sequence, message); message = this.readC3(sm2_sequence, message); message = this.readC2(sm2_sequence, message); console.log(sm2_sequence.toString()); let primal_data: string = sm2_sequence.C1x + sm2_sequence.C1y + sm2_sequence.C2 + sm2_sequence.C3; return primal_data; } private genLenHex(content: string): string { let size: number = content.length / 2; let lenHex: string; if (size.toString(16).length % 2 == 1) { lenHex = '0' + size.toString(16); } else { lenHex = size.toString(16); } if (size < 0x80) { return lenHex; } let lenHex_size: number = lenHex.length / 2; return (lenHex_size | 0x80).toString(16) + lenHex; } private getLenHex(data: string): string { let byte: number = Number.parseInt("0x" + data.slice(0, 2)); let len_size: number = byte > 127 ? byte - 0x80 + 1 : 1; return data.slice(0, len_size * 2); } private lenHex2number(lenHex: string): number { if (lenHex.length == 2) { return Number.parseInt("0x" + lenHex); } return Number.parseInt("0x" + lenHex.slice(2, lenHex.length)); } private readC1(sm2_sequence: SM2Sequence, data: string): string { let xy: string[] = []; for (let i = 0; i < 2; i++) { if (data.startsWith("0220")) { xy[i] = data.slice(4, 68); data = data.slice(68, data.length); } else if (data.startsWith("022100")) { xy[i] = data.slice(6, 70); data = data.slice(70, data.length); } else { Logger.debug('读取SM2字符串中的C1出错~'); } } sm2_sequence.C1x = xy[0]; sm2_sequence.C1y = xy[1]; return data; } private readC2(sm2_sequence: SM2Sequence, data: string): string { if (data.startsWith(ASN1Util.OCTEN_STRING)) { data = data.slice(ASN1Util.OCTEN_STRING.length, data.length); let C2_lenHex = this.getLenHex(data); data = data.slice(C2_lenHex.length, data.length); if (this.lenHex2number(C2_lenHex) != data.length / 2) { Logger.debug('SM2字符串中的C2长度不正确~'); } sm2_sequence.C2 = data; } else { Logger.debug('读取SM2字符串中的C2出错~'); } return data; } private readC3(sm2_sequence: SM2Sequence, data: string): string { if (data.startsWith("0420")) { sm2_sequence.C3 = data.slice(4, 68); data = data.slice(68, data.length); } else { Logger.debug('读取SM2字符串中的C3出错~'); } return data; } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L42-L262
a098096d769d4239c810a18b95cd9ea0954c125d
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/card/detailstyle/DetailStyle.ets
arkts
init
---------------- 初始化 ---------------- 根据 value 初始化
static init(fromValue: number): number { switch (fromValue) { case DetailStyle.Style0: return DetailStyle.Style0; case DetailStyle.Style1: return DetailStyle.Style1; case DetailStyle.Style2: return DetailStyle.Style2; default: return DetailStyle.Style0; }
AST#method_declaration#Left static init AST#parameter_list#Left ( AST#parameter#Left fromValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left switch AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left ( AST#expression#Left fromValue AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DetailStyle AST#expression#Right . Style0 AST#member_expression#Right AST#expression#Right AST#expression_statement#Right : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left DetailStyle AST#expression#Right . Style0 AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DetailStyle AST#expression#Right . Style1 AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left DetailStyle AST#expression#Right . Style1 AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DetailStyle AST#expression#Right . Style2 AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left DetailStyle AST#expression#Right . Style2 AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left return AST#ERROR#Left DetailStyle AST#ERROR#Right . Style0 AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static init(fromValue: number): number { switch (fromValue) { case DetailStyle.Style0: return DetailStyle.Style0; case DetailStyle.Style1: return DetailStyle.Style1; case DetailStyle.Style2: return DetailStyle.Style2; default: return DetailStyle.Style0; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/detailstyle/DetailStyle.ets#L29-L35
617a913f6f433b7c63b2e48bd6c097b6d0c2099b
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/myData/WordUser.ets
arkts
get
获取错误日期字符串
get wrangDateString(): string { return `${this.wrangYear}/${this.wrangMonth}/${this.wrangDay}`; }
AST#method_declaration#Left get AST#ERROR#Left wrangDateStr in g AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . wrangYear AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . wrangMonth AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . wrangDay AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
get wrangDateString(): string { return `${this.wrangYear}/${this.wrangMonth}/${this.wrangDay}`; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUser.ets#L68-L70
65676aac3aa71935b36a8aa83e19f66dd4f6e1ac
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Tools/FlipClock/entry/src/main/ets/common/FlipClock.ets
arkts
FlipClock
Copyright (c) 2022-2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
@Component export struct FlipClock { @State timeOne: Array<number> = []; @State timeTwo: Array<number> = []; @State timeThree: Array<number> = []; @State timeFour: Array<number> = []; @State angleOne: Array<number> = [0, 0, 0, 0, 0, 0]; @State angleTwo: Array<number> = [-90, -90, -90, -90, -90, -90]; aboutToAppear() { const arr = this.changeTime(); this.timeOne = [...arr]; this.timeTwo = [...arr]; this.timeThree = [...arr]; this.timeFour = [...arr]; setInterval(() => { const time = new Date(); if (this.timeOne[5] != time.getSeconds() % 10) { const arr = this.changeTime(); for (let i = 0;i < 6; i++) { if (arr[i] != this.timeFour[i]) { this.timeFour[i] = arr[i]; this.animationOne(i); setTimeout(() => { this.timeTwo[i] = arr[i]; }, 100) setTimeout(() => { this.timeThree[i] = arr[i]; }, 150) setTimeout(() => { this.timeOne[i] = arr[i]; }, 240) } } } }, 1000) } //修改时间 changeTime(): Array<number> { const time = new Date(); const hour = time.getHours(); const hourOne = Math.floor(hour / 10); const hourTwo = hour % 10; const minutesOne = Math.floor(time.getMinutes() / 10); const minutesTwo = time.getMinutes() % 10; const secondsOne = Math.floor(time.getSeconds() / 10); const secondsTwo = time.getSeconds() % 10; return [hourOne, hourTwo, minutesOne, minutesTwo, secondsOne, secondsTwo]; } animationOne(i: number): void { animateTo({ duration: 250, delay: 0, iterations: 1, onFinish: () => { this.animationTwo(i); this.angleOne[i] = 0; } }, () => this.angleOne[i] = 90) } animationTwo(i: number): void { animateTo({ duration: 250, delay: 0, iterations: 1, onFinish: () => { this.angleTwo[i] = -90; } }, () => this.angleTwo[i] = 0) } @Builder box(num: number) { Column() { Divider() .zIndex(5) .strokeWidth(2) .color(Color.White) .position({ x: 0, y: '50%' }) Text(`${this.timeOne[num]}`) .zIndex(1) .height(108) .width('100%') .borderRadius(8) .fontWeight(700) .padding({ top: 0 }) .fontSize(90) .position({ x: 0, y: 0 }) .fontColor(Color.White) .fontFamily('Monospace') .backgroundColor($r('app.color.text_bg')) .textAlign(TextAlign.Center) Text(`${this.timeTwo[num]}`) .zIndex(2) .height(64) .width('100%') .fontWeight(700) .borderRadius(8) .padding({ top: 3 }) .fontSize(90) .position({ x: 0, y: 0 }) .fontColor(Color.White) .fontFamily('Monospace') .backgroundColor($r('app.color.text_bg')) .textAlign(TextAlign.Center) Text(`${this.timeThree[num]}`) .zIndex(4) .height(64) .width('100%') .fontWeight(700) .borderRadius(8) .padding({ top: 3 }) .fontSize(90) .position({ x: 0, y: 0 }) .fontColor(Color.White) .fontFamily('Monospace') .textAlign(TextAlign.Center) .backgroundColor($r('app.color.text_bg')) .rotate({ x: 1, y: 0, z: 0, centerX: '50%', centerY: '100%', angle: this.angleOne[num] }) Text(`${this.timeFour[num]}`) .zIndex(3) .height(108) .width('100%') .fontWeight(700) .borderRadius(8) .padding({ top: 0 }) .fontSize(90) .position({ x: 0, y: 0 }) .fontColor(Color.White) .fontFamily('Monospace') .backgroundColor($r('app.color.text_bg')) .textAlign(TextAlign.Center) .rotate({ x: 1, y: 0, z: 0, centerX: '50%', centerY: '50%', angle: this.angleTwo[num] }) } .height(108) .width('50%') } build() { Column() { Row() { Row({ space: 2 }) { this.box(0) this.box(1) } .width('30%') .height('10%') Image($r('app.media.dot')) .width(20) .height(50) Row({ space: 2 }) { this.box(2) this.box(3) } .width('30%') .height('10%') Image($r('app.media.dot')) .width(20) .height(50) Row({ space: 2 }) { this.box(4) this.box(5) } .width('30%') .height('10%') } .id('currentTimeBox') .width('90%') .height('100%') } .width('100%') .height('100%') .justifyContent(FlexAlign.Center) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FlipClock AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right timeOne : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right timeTwo : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right timeThree : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right timeFour : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right angleOne : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right angleTwo : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#unary_expression#Left - AST#expression#Left 90 AST#expression#Right AST#unary_expression#Right AST#expression#Right , AST#expression#Left AST#unary_expression#Left - AST#expression#Left 90 AST#expression#Right AST#unary_expression#Right AST#expression#Right , AST#expression#Left AST#unary_expression#Left - AST#expression#Left 90 AST#expression#Right AST#unary_expression#Right AST#expression#Right , AST#expression#Left AST#unary_expression#Left - AST#expression#Left 90 AST#expression#Right AST#unary_expression#Right AST#expression#Right , AST#expression#Left AST#unary_expression#Left - AST#expression#Left 90 AST#expression#Right AST#unary_expression#Right AST#expression#Right , AST#expression#Left AST#unary_expression#Left - AST#expression#Left 90 AST#expression#Right AST#unary_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left arr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . changeTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeOne AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ... AST#expression#Left arr AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeTwo AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ... AST#expression#Left arr AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeThree AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ... AST#expression#Left arr AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeFour AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ... AST#expression#Left arr AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left time = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeOne AST#member_expression#Right AST#expression#Right [ AST#expression#Left 5 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right != AST#expression#Left time AST#expression#Right AST#binary_expression#Right AST#expression#Right . getSeconds AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right % AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left arr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . changeTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right != AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . timeFour AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeFour AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = arr AST#ERROR#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . animationOne AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeTwo AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = arr AST#ERROR#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 100 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeThree AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = arr AST#ERROR#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 150 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeOne AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = arr AST#ERROR#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 240 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 1000 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right //修改时间 AST#method_declaration#Left changeTime AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left time = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left hour = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left time AST#expression#Right . getHours AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left hourOne = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left hour AST#expression#Right / AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left hourTwo = AST#expression#Left AST#binary_expression#Left AST#expression#Left hour AST#expression#Right % AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left minutesOne = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left time AST#expression#Right . getMinutes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left minutesTwo = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left time AST#expression#Right . getMinutes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right % AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left secondsOne = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left time AST#expression#Right . getSeconds AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left secondsTwo = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left time AST#expression#Right . getSeconds AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right % AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ AST#expression#Left hourOne AST#expression#Right , AST#expression#Left hourTwo AST#expression#Right , AST#expression#Left minutesOne AST#expression#Right , AST#expression#Left minutesTwo AST#expression#Right , AST#expression#Left secondsOne AST#expression#Right , AST#expression#Left secondsTwo AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left animationOne AST#parameter_list#Left ( AST#parameter#Left i : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left animateTo AST#ERROR#Left ( AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression#Left 250 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left delay : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left iterations : AST#expression#Left 1 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onFinish : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . animationTwo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . angleOne AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 0 AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right AST#ERROR#Left , ( AST#ERROR#Right ) => AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . angleOne AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Right = AST#expression#Left 90 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left ) AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left animationTwo AST#parameter_list#Left ( AST#parameter#Left i : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left animateTo ( AST#ERROR#Left AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression#Left 250 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left delay : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left iterations : AST#expression#Left 1 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onFinish : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . angleTwo AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = AST#ERROR#Right - AST#expression#Left 90 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right , AST#ERROR#Right AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . angleTwo AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#ERROR#Left = 0 AST#ERROR#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right box AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 5 AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left '50%' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeOne AST#member_expression#Right AST#expression#Right [ AST#expression#Left num AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 108 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 700 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 90 AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontFamily ( AST#expression#Left 'Monospace' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_bg' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeTwo AST#member_expression#Right AST#expression#Right [ AST#expression#Left num AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 64 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 700 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 90 AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontFamily ( AST#expression#Left 'Monospace' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_bg' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeThree AST#member_expression#Right AST#expression#Right [ AST#expression#Left num AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 4 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 64 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 700 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 90 AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontFamily ( AST#expression#Left 'Monospace' AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_bg' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left z AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left centerX AST#property_name#Right : AST#expression#Left '50%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left centerY AST#property_name#Right : AST#expression#Left '100%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . angleOne AST#member_expression#Right AST#expression#Right [ AST#expression#Left num AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeFour AST#member_expression#Right AST#expression#Right [ AST#expression#Left num AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 3 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 108 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 700 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 90 AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontFamily ( AST#expression#Left 'Monospace' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_bg' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left z AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left centerX AST#property_name#Right : AST#expression#Left '50%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left centerY AST#property_name#Right : AST#expression#Left '50%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . angleTwo AST#member_expression#Right AST#expression#Right [ AST#expression#Left num AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 108 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '50%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 2 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . box AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . box AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '30%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '10%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.dot' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 2 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . box AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . box AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 3 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '30%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '10%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.dot' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 2 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . box AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 4 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . box AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 5 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '30%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '10%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'currentTimeBox' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct FlipClock { @State timeOne: Array<number> = []; @State timeTwo: Array<number> = []; @State timeThree: Array<number> = []; @State timeFour: Array<number> = []; @State angleOne: Array<number> = [0, 0, 0, 0, 0, 0]; @State angleTwo: Array<number> = [-90, -90, -90, -90, -90, -90]; aboutToAppear() { const arr = this.changeTime(); this.timeOne = [...arr]; this.timeTwo = [...arr]; this.timeThree = [...arr]; this.timeFour = [...arr]; setInterval(() => { const time = new Date(); if (this.timeOne[5] != time.getSeconds() % 10) { const arr = this.changeTime(); for (let i = 0;i < 6; i++) { if (arr[i] != this.timeFour[i]) { this.timeFour[i] = arr[i]; this.animationOne(i); setTimeout(() => { this.timeTwo[i] = arr[i]; }, 100) setTimeout(() => { this.timeThree[i] = arr[i]; }, 150) setTimeout(() => { this.timeOne[i] = arr[i]; }, 240) } } } }, 1000) } changeTime(): Array<number> { const time = new Date(); const hour = time.getHours(); const hourOne = Math.floor(hour / 10); const hourTwo = hour % 10; const minutesOne = Math.floor(time.getMinutes() / 10); const minutesTwo = time.getMinutes() % 10; const secondsOne = Math.floor(time.getSeconds() / 10); const secondsTwo = time.getSeconds() % 10; return [hourOne, hourTwo, minutesOne, minutesTwo, secondsOne, secondsTwo]; } animationOne(i: number): void { animateTo({ duration: 250, delay: 0, iterations: 1, onFinish: () => { this.animationTwo(i); this.angleOne[i] = 0; } }, () => this.angleOne[i] = 90) } animationTwo(i: number): void { animateTo({ duration: 250, delay: 0, iterations: 1, onFinish: () => { this.angleTwo[i] = -90; } }, () => this.angleTwo[i] = 0) } @Builder box(num: number) { Column() { Divider() .zIndex(5) .strokeWidth(2) .color(Color.White) .position({ x: 0, y: '50%' }) Text(`${this.timeOne[num]}`) .zIndex(1) .height(108) .width('100%') .borderRadius(8) .fontWeight(700) .padding({ top: 0 }) .fontSize(90) .position({ x: 0, y: 0 }) .fontColor(Color.White) .fontFamily('Monospace') .backgroundColor($r('app.color.text_bg')) .textAlign(TextAlign.Center) Text(`${this.timeTwo[num]}`) .zIndex(2) .height(64) .width('100%') .fontWeight(700) .borderRadius(8) .padding({ top: 3 }) .fontSize(90) .position({ x: 0, y: 0 }) .fontColor(Color.White) .fontFamily('Monospace') .backgroundColor($r('app.color.text_bg')) .textAlign(TextAlign.Center) Text(`${this.timeThree[num]}`) .zIndex(4) .height(64) .width('100%') .fontWeight(700) .borderRadius(8) .padding({ top: 3 }) .fontSize(90) .position({ x: 0, y: 0 }) .fontColor(Color.White) .fontFamily('Monospace') .textAlign(TextAlign.Center) .backgroundColor($r('app.color.text_bg')) .rotate({ x: 1, y: 0, z: 0, centerX: '50%', centerY: '100%', angle: this.angleOne[num] }) Text(`${this.timeFour[num]}`) .zIndex(3) .height(108) .width('100%') .fontWeight(700) .borderRadius(8) .padding({ top: 0 }) .fontSize(90) .position({ x: 0, y: 0 }) .fontColor(Color.White) .fontFamily('Monospace') .backgroundColor($r('app.color.text_bg')) .textAlign(TextAlign.Center) .rotate({ x: 1, y: 0, z: 0, centerX: '50%', centerY: '50%', angle: this.angleTwo[num] }) } .height(108) .width('50%') } build() { Column() { Row() { Row({ space: 2 }) { this.box(0) this.box(1) } .width('30%') .height('10%') Image($r('app.media.dot')) .width(20) .height(50) Row({ space: 2 }) { this.box(2) this.box(3) } .width('30%') .height('10%') Image($r('app.media.dot')) .width(20) .height(50) Row({ space: 2 }) { this.box(4) this.box(5) } .width('30%') .height('10%') } .id('currentTimeBox') .width('90%') .height('100%') } .width('100%') .height('100%') .justifyContent(FlexAlign.Center) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Tools/FlipClock/entry/src/main/ets/common/FlipClock.ets#L16-L214
99366102447e2fceecb4a2f7fbc5332609a3538c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/recommendation/RecommendationEngine.ets
arkts
推荐类型枚举
export enum RecommendationType { GREETING = 'greeting', // 祝福语推荐 GIFT = 'gift', // 礼物推荐 ACTIVITY = 'activity', // 活动推荐 CONTACT = 'contact', // 联系人推荐 REMINDER = 'reminder', // 提醒推荐 THEME = 'theme', // 主题推荐 TEMPLATE = 'template' // 模板推荐 }
AST#export_declaration#Left export AST#enum_declaration#Left enum RecommendationType AST#enum_body#Left { AST#enum_member#Left GREETING = AST#expression#Left 'greeting' AST#expression#Right AST#enum_member#Right , // 祝福语推荐 AST#enum_member#Left GIFT = AST#expression#Left 'gift' AST#expression#Right AST#enum_member#Right , // 礼物推荐 AST#enum_member#Left ACTIVITY = AST#expression#Left 'activity' AST#expression#Right AST#enum_member#Right , // 活动推荐 AST#enum_member#Left CONTACT = AST#expression#Left 'contact' AST#expression#Right AST#enum_member#Right , // 联系人推荐 AST#enum_member#Left REMINDER = AST#expression#Left 'reminder' AST#expression#Right AST#enum_member#Right , // 提醒推荐 AST#enum_member#Left THEME = AST#expression#Left 'theme' AST#expression#Right AST#enum_member#Right , // 主题推荐 AST#enum_member#Left TEMPLATE = AST#expression#Left 'template' AST#expression#Right AST#enum_member#Right // 模板推荐 } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export enum RecommendationType { GREETING = 'greeting', GIFT = 'gift', ACTIVITY = 'activity', CONTACT = 'contact', REMINDER = 'reminder', THEME = 'theme', TEMPLATE = 'template' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L17-L25
f97a9aafd5f3acf0d028b1e955f9118139f1a536
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageDestroy
窗口销毁时调用 释放窗口资源 @returns {void} 无返回值
onWindowStageDestroy(): void { }
AST#method_declaration#Left onWindowStageDestroy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
onWindowStageDestroy(): void { }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/entryability/EntryAbility.ets#L65-L66
b87575bab7b9c2e5e200a9aa6351498e90892c66
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/PageRepository.ets
arkts
@file 页面数据仓库,封装页面聚合数据请求 @author Joker.X
export class PageRepository { /** * 页面网络数据源 */ private networkDataSource: PageNetworkDataSource; /** * 构造函数 * @param networkDataSource 页面网络数据源 */ constructor(networkDataSource?: PageNetworkDataSource) { this.networkDataSource = networkDataSource ?? new PageNetworkDataSourceImpl(); } /** * 获取首页数据 * @returns 首页数据 */ async getHomeData(): Promise<NetworkResponse<Home>> { return this.networkDataSource.getHomeData(); } /** * 获取商品详情 * @param goodsId 商品ID * @returns 商品详情 */ async getGoodsDetail(goodsId: number): Promise<NetworkResponse<GoodsDetail>> { return this.networkDataSource.getGoodsDetail(goodsId); } /** * 获取确认订单页面数据 * @returns 确认订单页面数据 */ async getConfirmOrder(): Promise<NetworkResponse<ConfirmOrder>> { return this.networkDataSource.getConfirmOrder(); } }
AST#export_declaration#Left export AST#class_declaration#Left class PageRepository AST#class_body#Left { /** * 页面网络数据源 */ AST#property_declaration#Left private networkDataSource : AST#type_annotation#Left AST#primary_type#Left PageNetworkDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * 构造函数 * @param networkDataSource 页面网络数据源 */ AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left networkDataSource ? : AST#type_annotation#Left AST#primary_type#Left PageNetworkDataSource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . networkDataSource AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left networkDataSource AST#expression#Right ?? AST#expression#Left AST#new_expression#Left new AST#expression#Left PageNetworkDataSourceImpl AST#expression#Right AST#new_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right /** * 获取首页数据 * @returns 首页数据 */ AST#method_declaration#Left async getHomeData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Home AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . networkDataSource AST#member_expression#Right AST#expression#Right . getHomeData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 获取商品详情 * @param goodsId 商品ID * @returns 商品详情 */ AST#method_declaration#Left async getGoodsDetail AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left GoodsDetail AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . networkDataSource AST#member_expression#Right AST#expression#Right . getGoodsDetail AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left goodsId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 获取确认订单页面数据 * @returns 确认订单页面数据 */ AST#method_declaration#Left async getConfirmOrder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ConfirmOrder AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . networkDataSource AST#member_expression#Right AST#expression#Right . getConfirmOrder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class PageRepository { private networkDataSource: PageNetworkDataSource; constructor(networkDataSource?: PageNetworkDataSource) { this.networkDataSource = networkDataSource ?? new PageNetworkDataSourceImpl(); } async getHomeData(): Promise<NetworkResponse<Home>> { return this.networkDataSource.getHomeData(); } async getGoodsDetail(goodsId: number): Promise<NetworkResponse<GoodsDetail>> { return this.networkDataSource.getGoodsDetail(goodsId); } async getConfirmOrder(): Promise<NetworkResponse<ConfirmOrder>> { return this.networkDataSource.getConfirmOrder(); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/PageRepository.ets#L8-L46
2b9e08e7272031f7e888018b4029d979851ef4ce
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onBackPressed
返回true表示UIAbility将会被移到后台不销毁,返回false表示UIAbility将正常销毁。
onBackPressed(): boolean { return true; }
AST#method_declaration#Left onBackPressed AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
onBackPressed(): boolean { return true; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/entryability/EntryAbility.ets#L100-L102
f0375700857dca7b97acebeabc6c8f72f70c0fc2
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/RadarChartModel.ets
arkts
getWebAlpha
Returns the alpha value for all web lines. @return
public getWebAlpha(): number { return this.mWebAlpha; }
AST#method_declaration#Left public getWebAlpha AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mWebAlpha AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getWebAlpha(): number { return this.mWebAlpha; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/RadarChartModel.ets#L270-L272
8e14f8c78b00886e005516cf053527a52439921b
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pageturninganimation/src/main/ets/view/PageTurningAnimation.ets
arkts
aboutToAppear
旋转中心点参数y。 在UI显示前,传入各项变量的具体值
aboutToAppear(): void { // 通过setInterval函数每秒调用一次动画效果,实现连续翻页 setInterval(() => { this.pageTurningAnimate(); }, 1000) // 函数调用周期要大于每次动画持续的时长 }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 通过setInterval函数每秒调用一次动画效果,实现连续翻页 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left setInterval ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pageTurningAnimate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 1000 AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 函数调用周期要大于每次动画持续的时长 } AST#builder_function_body#Right AST#method_declaration#Right
aboutToAppear(): void { setInterval(() => { this.pageTurningAnimate(); }, 1000) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageturninganimation/src/main/ets/view/PageTurningAnimation.ets#L82-L87
4cc066389b14ca9b1690d816c6ec3a1616ac373b
gitee
weboose/jellyfin-sdk-arkts.git
826b1dabd29c5d4702d3d4a31e358114fb5b7c91
entry/src/main/ets/pages/ItemsPage.ets
arkts
toolbarBuilder
toolbar
@Builder private toolbarBuilder(){ Row({space: 12}){ if(this.result?.TotalRecordCount && this.result?.TotalRecordCount > 0){ Text(`${this.result?.TotalRecordCount || 0} 中的 ${(this.result?.StartIndex || 0) + 1} - ${Math.min(this.page * this.limit, this.result?.TotalRecordCount)}`) .fontSize(14); }else if(this.result?.TotalRecordCount && this.result?.TotalRecordCount <= 0){ Text("暂无数据") } Button("上一页") .enabled(this.page > 1) .padding(8) .onClick(()=>{ this.page = this.page - 1; this.loadItems(); }); Button("下一页") .enabled(this.page < this.totalPages) .padding(8) .onClick(()=>{ this.page = this.page + 1; this.loadItems(); }); Select(SupportSorts.map<SelectOption>((item) => ({ icon: item.icon, value: item.label }))) .value(SupportSorts[this.currentSortIndex].label) .selected($$this.currentSortIndex) .onSelect((index) => { this.currentSortIndex = index; this.loadItems(); }); } .width("100%") .justifyContent(FlexAlign.Center) .alignItems(VerticalAlign.Center) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private toolbarBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . result AST#member_expression#Right AST#expression#Right ?. TotalRecordCount AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . result AST#member_expression#Right AST#expression#Right ?. TotalRecordCount AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . result AST#member_expression#Right AST#expression#Right ?. TotalRecordCount AST#member_expression#Right AST#expression#Right || AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right 中的 AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . result AST#member_expression#Right AST#expression#Right ?. StartIndex AST#member_expression#Right AST#expression#Right || AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . min AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . page AST#member_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . limit AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . result AST#member_expression#Right AST#expression#Right ?. TotalRecordCount AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . result AST#member_expression#Right AST#expression#Right ?. TotalRecordCount AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . result AST#member_expression#Right AST#expression#Right ?. TotalRecordCount AST#member_expression#Right AST#expression#Right <= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "暂无数据" AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left "上一页" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . enabled ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . page AST#member_expression#Right AST#expression#Right > AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . page AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . page AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadItems AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left "下一页" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . enabled ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . page AST#member_expression#Right AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . totalPages AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . page AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . page AST#member_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadItems AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Select ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SupportSorts AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left SelectOption AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left icon AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . icon AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . label AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . value ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left SupportSorts AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSortIndex AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . label AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . selected ( AST#expression#Left AST#member_expression#Left AST#expression#Left $$this AST#expression#Right . currentSortIndex AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onSelect ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left index AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSortIndex AST#member_expression#Right = AST#expression#Left index AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadItems AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left "100%" AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder private toolbarBuilder(){ Row({space: 12}){ if(this.result?.TotalRecordCount && this.result?.TotalRecordCount > 0){ Text(`${this.result?.TotalRecordCount || 0} 中的 ${(this.result?.StartIndex || 0) + 1} - ${Math.min(this.page * this.limit, this.result?.TotalRecordCount)}`) .fontSize(14); }else if(this.result?.TotalRecordCount && this.result?.TotalRecordCount <= 0){ Text("暂无数据") } Button("上一页") .enabled(this.page > 1) .padding(8) .onClick(()=>{ this.page = this.page - 1; this.loadItems(); }); Button("下一页") .enabled(this.page < this.totalPages) .padding(8) .onClick(()=>{ this.page = this.page + 1; this.loadItems(); }); Select(SupportSorts.map<SelectOption>((item) => ({ icon: item.icon, value: item.label }))) .value(SupportSorts[this.currentSortIndex].label) .selected($$this.currentSortIndex) .onSelect((index) => { this.currentSortIndex = index; this.loadItems(); }); } .width("100%") .justifyContent(FlexAlign.Center) .alignItems(VerticalAlign.Center) }
https://github.com/weboose/jellyfin-sdk-arkts.git/blob/826b1dabd29c5d4702d3d4a31e358114fb5b7c91/entry/src/main/ets/pages/ItemsPage.ets#L131-L171
104d687adf3287a4afb9ac28bc5fc138300013b3
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/common/IntroductionTitle.ets
arkts
IntroductionTitle
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License") you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
@Component export struct IntroductionTitle { private introduction!: Resource | string; build() { Column() { Blank() Text(this.introduction) .fontSize(14) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.font_color_grey')) } .height(56) .width('100%') .padding({ left: 12, right: 12, bottom: 8 }) .alignItems(HorizontalAlign.Start) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct IntroductionTitle AST#component_body#Left { AST#property_declaration#Left private introduction AST#ERROR#Left ! AST#ERROR#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . introduction AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.font_color_grey' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 56 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct IntroductionTitle { private introduction!: Resource | string; build() { Column() { Blank() Text(this.introduction) .fontSize(14) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.font_color_grey')) } .height(56) .width('100%') .padding({ left: 12, right: 12, bottom: 8 }) .alignItems(HorizontalAlign.Start) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/common/IntroductionTitle.ets#L16-L33
eea6b2a0f72fa6eddfa64d605beb6d682627d2be
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/DialogBuilder.ets
arkts
DialogAttachBuilder
挂件
@Builder export function DialogAttachBuilder(dialogId: string, w: Length, h: Length, attaches: AttachType[], attachAction?: NumberCallback,) { RelativeContainer() { ForEach(attaches, (item: IPresetAttachImage, index) => { if (item) { Column() { Image(item.image) .width(item.width) .height(item.height) .draggable(false) } .markAnchor(item.markAnchor) .margin(item.margin) .padding(item.padding) .alignRules(item.alignRules) .responseRegion({ width: '200%', height: '200%', x: '-50%', y: '-50%', }) .onClick(() => { attachAction?.(index, dialogId ?? '') }) } }) } .width(w) .height(h) .hitTestBehavior(HitTestMode.Transparent) }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function DialogAttachBuilder AST#parameter_list#Left ( AST#parameter#Left dialogId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left w : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left h : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left attaches : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left AttachType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left attachAction ? : AST#type_annotation#Left AST#primary_type#Left NumberCallback AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left attaches AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left IPresetAttachImage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left item AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . image AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . width AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . draggable ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . markAnchor ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . markAnchor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . margin AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . padding AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . alignRules AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . responseRegion ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left '200%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left '200%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left '-50%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left '-50%' AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left attachAction AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left dialogId AST#expression#Right ?? AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left w AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left h AST#expression#Right ) AST#modifier_chain_expression#Left . hitTestBehavior ( AST#expression#Left AST#member_expression#Left AST#expression#Left HitTestMode AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
@Builder export function DialogAttachBuilder(dialogId: string, w: Length, h: Length, attaches: AttachType[], attachAction?: NumberCallback,) { RelativeContainer() { ForEach(attaches, (item: IPresetAttachImage, index) => { if (item) { Column() { Image(item.image) .width(item.width) .height(item.height) .draggable(false) } .markAnchor(item.markAnchor) .margin(item.margin) .padding(item.padding) .alignRules(item.alignRules) .responseRegion({ width: '200%', height: '200%', x: '-50%', y: '-50%', }) .onClick(() => { attachAction?.(index, dialogId ?? '') }) } }) } .width(w) .height(h) .hitTestBehavior(HitTestMode.Transparent) }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogBuilder.ets#L52-L84
76db44b5d462add002f9bdc60c29e6a7f32d2304
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/views/SegmentButton.ets
arkts
aboutToAppear
========== 生命周期:计算每个按钮宽度 ==========
aboutToAppear() { // 按钮数量 this.btnCount = this.items.length > 0 ? this.items.length : 1 // totalWidth 为数字(像素)时,直接平均分配(返回数字) if (typeof this.totalWidth === 'number') { const numWidth = (this.totalWidth as number) / this.btnCount this.computedBtnWidth = Math.floor(numWidth) // 使用整数像素(可按需保留小数) return } // totalWidth 为字符串且为百分比(如 "100%")时,解析百分比并平均分配 if (typeof this.totalWidth === 'string' && (this.totalWidth as string).trim().endsWith('%')) { const s = (this.totalWidth as string).trim() const percent = parseFloat(s.substring(0, s.length - 1)) // 例如 100 if (!isNaN(percent)) { const eachPercent = percent / this.btnCount // 保留 4 位小数以减少误差 this.computedBtnWidth = `${(Math.round(eachPercent * 10000) / 10000).toString()}%` return } } // 其它情况回退为 'auto'(按内容自适应) this.computedBtnWidth = 'auto' }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 按钮数量 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . btnCount AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . items AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . items AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right : AST#expression#Left 1 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right // totalWidth 为数字(像素)时,直接平均分配(返回数字) AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . totalWidth AST#member_expression#Right AST#expression#Right === AST#expression#Left 'number' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left numWidth = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . totalWidth AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . btnCount AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . computedBtnWidth AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left numWidth AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right // 使用整数像素(可按需保留小数) AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // totalWidth 为字符串且为百分比(如 "100%")时,解析百分比并平均分配 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . totalWidth AST#member_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . totalWidth AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . endsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '%' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left s = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . totalWidth AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left percent = AST#expression#Left AST#call_expression#Left AST#expression#Left parseFloat AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left s AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left s AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right // 例如 100 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left isNaN AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left percent AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left eachPercent = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left percent AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . btnCount AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right // 保留 4 位小数以减少误差 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . computedBtnWidth AST#member_expression#Right = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left eachPercent AST#expression#Right * AST#expression#Left 10000 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left 10000 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right % ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 其它情况回退为 'auto'(按内容自适应) AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . computedBtnWidth AST#member_expression#Right = AST#expression#Left 'auto' AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
aboutToAppear() { this.btnCount = this.items.length > 0 ? this.items.length : 1 if (typeof this.totalWidth === 'number') { const numWidth = (this.totalWidth as number) / this.btnCount this.computedBtnWidth = Math.floor(numWidth) return } if (typeof this.totalWidth === 'string' && (this.totalWidth as string).trim().endsWith('%')) { const s = (this.totalWidth as string).trim() const percent = parseFloat(s.substring(0, s.length - 1)) if (!isNaN(percent)) { const eachPercent = percent / this.btnCount this.computedBtnWidth = `${(Math.round(eachPercent * 10000) / 10000).toString()}%` return } } this.computedBtnWidth = 'auto' }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/SegmentButton.ets#L50-L75
bab689adc576196499c40e3f2eca966132cbb176
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/components/DeleteItem.ets
arkts
DeleteItem
删除组件
@Component export struct DeleteItem { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); build() { Stack() { Image($rawfile('delete.svg')) .width(this.inputStyle.featurePicSize) .height(this.inputStyle.featurePicSize) } .backgroundColor($r('app.color.key_item_gray')) .borderRadius(4) .onClick(() => { InputHandler.getInstance().deleteForward(1); }) .width(this.inputStyle.switchButtonWidth) .height('100%') .shadow({ radius: 1, color: $r('app.color.shadow'), offsetY: 3 }) .stateStyles({ normal: normalStyles, pressed: pressedStyles }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct DeleteItem AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'inputStyle' AST#expression#Right ) AST#decorator#Right inputStyle : AST#type_annotation#Left AST#primary_type#Left KeyStyle AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConfiguration AST#expression#Right . getSavedInputStyle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#call_expression#Left AST#expression#Left $rawfile AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'delete.svg' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . featurePicSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . featurePicSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.key_item_gray' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 4 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left InputHandler AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . deleteForward AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . switchButtonWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.shadow' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . stateStyles ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left normal AST#property_name#Right : AST#expression#Left normalStyles AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left pressed AST#property_name#Right : AST#expression#Left pressedStyles AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct DeleteItem { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); build() { Stack() { Image($rawfile('delete.svg')) .width(this.inputStyle.featurePicSize) .height(this.inputStyle.featurePicSize) } .backgroundColor($r('app.color.key_item_gray')) .borderRadius(4) .onClick(() => { InputHandler.getInstance().deleteForward(1); }) .width(this.inputStyle.switchButtonWidth) .height('100%') .shadow({ radius: 1, color: $r('app.color.shadow'), offsetY: 3 }) .stateStyles({ normal: normalStyles, pressed: pressedStyles }) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/components/DeleteItem.ets#L28-L50
ff0c8ca59ba4973645c90eac445374f6d6c95d4b
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets
arkts
PickerController
The class for PickerController @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
@Observed export declare class PickerController { /** * Set data to picker component * * @param { DataType } dataType - data type * @param { Object } data - data * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ setData(dataType: DataType, data: Object): void; /** * Set max select count to picker component, include max_total_count, max_photo_count and max_video_count. * * @param { MaxSelected } maxSelected - max select count data * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ setMaxSelected(maxSelected: MaxSelected): void; /** * Set photo browser item to picker component. * * @param { string } uri - specify image uri for photo browsing * @param { PhotoBrowserRange } photoBrowserRange - photo browser slide range * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ setPhotoBrowserItem(uri: string, photoBrowserRange?: PhotoBrowserRange): void; /** * Exit photo browser. * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 13 */ exitPhotoBrowser(): void; /** * Sets whether other elements on the photo browser page are visible. * * @param { Array<PhotoBrowserUIElement> } elements - other elements on the photo browser page * @param { boolean } isVisible - visible or not * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 13 */ setPhotoBrowserUIElementVisibility(elements: Array<PhotoBrowserUIElement>, isVisible: boolean): void; }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right class PickerController AST#class_body#Left { /** * Set data to picker component * * @param { DataType } dataType - data type * @param { Object } data - data * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#method_declaration#Left setData AST#parameter_list#Left ( AST#parameter#Left dataType : AST#type_annotation#Left AST#primary_type#Left DataType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right /** * Set max select count to picker component, include max_total_count, max_photo_count and max_video_count. * * @param { MaxSelected } maxSelected - max select count data * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#method_declaration#Left setMaxSelected AST#parameter_list#Left ( AST#parameter#Left maxSelected : AST#type_annotation#Left AST#primary_type#Left MaxSelected AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right /** * Set photo browser item to picker component. * * @param { string } uri - specify image uri for photo browsing * @param { PhotoBrowserRange } photoBrowserRange - photo browser slide range * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#method_declaration#Left setPhotoBrowserItem AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left photoBrowserRange ? : AST#type_annotation#Left AST#primary_type#Left PhotoBrowserRange AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right /** * Exit photo browser. * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 13 */ AST#method_declaration#Left exitPhotoBrowser AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right /** * Sets whether other elements on the photo browser page are visible. * * @param { Array<PhotoBrowserUIElement> } elements - other elements on the photo browser page * @param { boolean } isVisible - visible or not * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 13 */ AST#method_declaration#Left setPhotoBrowserUIElementVisibility AST#parameter_list#Left ( AST#parameter#Left elements : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left PhotoBrowserUIElement AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isVisible : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right } AST#class_body#Right AST#decorated_export_declaration#Right
@Observed export declare class PickerController { setData(dataType: DataType, data: Object): void; setMaxSelected(maxSelected: MaxSelected): void; setPhotoBrowserItem(uri: string, photoBrowserRange?: PhotoBrowserRange): void; exitPhotoBrowser(): void; setPhotoBrowserUIElementVisibility(elements: Array<PhotoBrowserUIElement>, isVisible: boolean): void; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L184-L233
2d398a6aaf0c2d53897869e01f81e5bca4295f58
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/ui/animation/AnimationUtils.ets
arkts
scale
缩放动画
static scale(from: number = 0, to: number = 1, duration: number = 300): object { return { duration: duration, curve: curve.EaseOut }; }
AST#method_declaration#Left static scale AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right AST#parameter#Right , AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 300 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left duration AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left curve AST#expression#Right . EaseOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static scale(from: number = 0, to: number = 1, duration: number = 300): object { return { duration: duration, curve: curve.EaseOut }; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/ui/animation/AnimationUtils.ets#L31-L36
68f02c34cd5c6b8cbf9eb95bdd1d78816512ccc4
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
/** the approximator object used for data filtering private Approximator mApproximator;
constructor() { super(); this.init(); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left super AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
constructor() { super(); this.init(); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarLineChartBaseModel.ets#L183-L186
90d634de3d924b8e65f36684c4c8f68d9cafbb8a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets
arkts
设备信息接口
export interface DeviceInfo { deviceId: string; platform: string; osVersion: string; appVersion: string; screenResolution: string; language: string; timezone: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface DeviceInfo AST#object_type#Left { AST#type_member#Left deviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left platform : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left osVersion : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left appVersion : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left screenResolution : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left language : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left timezone : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface DeviceInfo { deviceId: string; platform: string; osVersion: string; appVersion: string; screenResolution: string; language: string; timezone: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets#L133-L141
7090148a02e7a275fb7af0b5d5bfb80887de8ae5
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
avscreen-capture-screen-record-master/entry/src/main/ets/model/MyAVScreenCapture.ets
arkts
startRecording
开始屏幕录制
public async startRecording(filesDir: string) { // [Start create_record] // 获取fd this.updateFileFd(filesDir); // 实例化对象 try { this.screenCapture = await media.createAVScreenCaptureRecorder(); } catch (error) { let err = error as BusinessError; hilog.error(0x0000, 'testTag', `createAVScreenCaptureRecorder fail. code = ${err.code}, message = ${err.message}`); } if (this.screenCapture != undefined) { hilog.info(0xFF00, CommonConstants.LOG_TAG, 'ScreenCapture has been created successfully.'); } else { hilog.info(0xFF00, CommonConstants.LOG_TAG, 'ScreenCapture creation failed.'); return; } // 监听屏幕捕获的状态更改 this.screenCapture?.on('stateChange', async (infoType: media.AVScreenCaptureStateCode) => { switch (infoType) { case media.AVScreenCaptureStateCode.SCREENCAPTURE_STATE_STARTED: hilog.info(0xFF00, CommonConstants.LOG_TAG, '录屏成功开始后会收到的回调.'); break; case media.AVScreenCaptureStateCode.SCREENCAPTURE_STATE_CANCELED: this.screenCapture?.release(); this.screenCapture = undefined; hilog.info(0xFF00, CommonConstants.LOG_TAG, '不允许使用录屏功能.'); break; case media.AVScreenCaptureStateCode.SCREENCAPTURE_STATE_STOPPED_BY_USER: this.screenCapture?.release();
AST#method_declaration#Left public async startRecording AST#parameter_list#Left ( AST#parameter#Left filesDir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left { // [Start create_record] // 获取fd AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateFileFd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filesDir AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 实例化对象 AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . screenCapture AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left media AST#expression#Right AST#await_expression#Right AST#expression#Right . createAVScreenCaptureRecorder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` createAVScreenCaptureRecorder fail. code = AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message = AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . screenCapture AST#member_expression#Right AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0xFF00 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LOG_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left 'ScreenCapture has been created successfully.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0xFF00 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LOG_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left 'ScreenCapture creation failed.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 监听屏幕捕获的状态更改 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . screenCapture AST#member_expression#Right AST#expression#Right ?. on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 'stateChange' AST#expression#Right AST#ERROR#Left , async AST#parameter_list#Left ( AST#parameter#Left infoType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVScreenCaptureStateCode AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left => { AST#ERROR#Left AST#property_name#Left switch AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left infoType AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left media AST#expression#Right . AVScreenCaptureStateCode AST#member_expression#Right AST#expression#Right . SCREENCAPTURE_STATE_STARTED AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left hilog . info AST#ERROR#Left ( 0xFF00 , CommonConstants AST#ERROR#Right . LOG_TAG AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right , '录屏成功开始后会收到的回调.' ) ; AST#ERROR#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left media AST#expression#Right . AVScreenCaptureStateCode AST#member_expression#Right AST#expression#Right . SCREENCAPTURE_STATE_CANCELED AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left this . screenCapture AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right ?. release AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . screenCapture AST#member_expression#Right = AST#expression#Left undefined AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0xFF00 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LOG_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left '不允许使用录屏功能.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left media AST#expression#Right . AVScreenCaptureStateCode AST#member_expression#Right AST#expression#Right . SCREENCAPTURE_STATE_STOPPED_BY_USER AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right : AST#ERROR#Left AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left this . screenCapture AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ? . rele as e AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Right ; AST#method_declaration#Right
public async startRecording(filesDir: string) { this.updateFileFd(filesDir); try { this.screenCapture = await media.createAVScreenCaptureRecorder(); } catch (error) { let err = error as BusinessError; hilog.error(0x0000, 'testTag', `createAVScreenCaptureRecorder fail. code = ${err.code}, message = ${err.message}`); } if (this.screenCapture != undefined) { hilog.info(0xFF00, CommonConstants.LOG_TAG, 'ScreenCapture has been created successfully.'); } else { hilog.info(0xFF00, CommonConstants.LOG_TAG, 'ScreenCapture creation failed.'); return; } this.screenCapture?.on('stateChange', async (infoType: media.AVScreenCaptureStateCode) => { switch (infoType) { case media.AVScreenCaptureStateCode.SCREENCAPTURE_STATE_STARTED: hilog.info(0xFF00, CommonConstants.LOG_TAG, '录屏成功开始后会收到的回调.'); break; case media.AVScreenCaptureStateCode.SCREENCAPTURE_STATE_CANCELED: this.screenCapture?.release(); this.screenCapture = undefined; hilog.info(0xFF00, CommonConstants.LOG_TAG, '不允许使用录屏功能.'); break; case media.AVScreenCaptureStateCode.SCREENCAPTURE_STATE_STOPPED_BY_USER: this.screenCapture?.release();
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/avscreen-capture-screen-record-master/entry/src/main/ets/model/MyAVScreenCapture.ets#L32-L63
7fe74d3f95e8f81daaae2e693937c9ecc3497839
gitee
wustcat404/time-bar
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
entry/src/main/ets/common/contants/CommonConstants.ets
arkts
Small epsilon to stay at the last frame when pausing
export const LOG_DOMAIN = 0x0001;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left LOG_DOMAIN = AST#expression#Left 0x0001 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const LOG_DOMAIN = 0x0001;
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/common/contants/CommonConstants.ets#L81-L81
0f7e242501d4019443b8e9bb7ae7befd496b1b0f
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CartViewModel.ets
arkts
get
获取选中的商品总数量 @returns {number} 选中商品数量
get selectedCount(): number { return this.selectedSpecIds.size; }
AST#method_declaration#Left get AST#ERROR#Left selectedCount AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedSpecIds AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
get selectedCount(): number { return this.selectedSpecIds.size; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CartViewModel.ets#L46-L48
fbd0fbb1f79b8bdde4db1bd809edb6050d81eb8b
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/accessibility/AccessibilityService.ets
arkts
无障碍设置接口
export interface AccessibilitySettings { // 基础设置 isEnabled: boolean; currentMode: AccessibilityMode; // 视觉辅助 fontSize: FontSizeLevel; contrast: ContrastLevel; colorBlindFriendly: boolean; reduceMotion: boolean; highContrastMode: boolean; // 听觉辅助 voiceOverEnabled: boolean; speechRate: SpeechRate; soundFeedback: boolean; // 触觉反馈 hapticFeedback: boolean; hapticIntensity: HapticIntensity; // 适老化设置 elderlyMode: boolean; simplifiedInterface: boolean; largeButtons: boolean; // 交互辅助 touchAssist: boolean; longPressDelay: number; tapAssist: boolean; // 导航辅助 navigationAssist: boolean; audioDescription: boolean; keyboardNavigation: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AccessibilitySettings AST#object_type#Left { // 基础设置 AST#type_member#Left isEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left currentMode : AST#type_annotation#Left AST#primary_type#Left AccessibilityMode AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 视觉辅助 AST#type_member#Left fontSize : AST#type_annotation#Left AST#primary_type#Left FontSizeLevel AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left contrast : AST#type_annotation#Left AST#primary_type#Left ContrastLevel AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left colorBlindFriendly : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left reduceMotion : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left highContrastMode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 听觉辅助 AST#type_member#Left voiceOverEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left speechRate : AST#type_annotation#Left AST#primary_type#Left SpeechRate AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left soundFeedback : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 触觉反馈 AST#type_member#Left hapticFeedback : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left hapticIntensity : AST#type_annotation#Left AST#primary_type#Left HapticIntensity AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 适老化设置 AST#type_member#Left elderlyMode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left simplifiedInterface : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left largeButtons : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 交互辅助 AST#type_member#Left touchAssist : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left longPressDelay : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left tapAssist : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 导航辅助 AST#type_member#Left navigationAssist : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left audioDescription : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left keyboardNavigation : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface AccessibilitySettings { isEnabled: boolean; currentMode: AccessibilityMode; fontSize: FontSizeLevel; contrast: ContrastLevel; colorBlindFriendly: boolean; reduceMotion: boolean; highContrastMode: boolean; voiceOverEnabled: boolean; speechRate: SpeechRate; soundFeedback: boolean; hapticFeedback: boolean; hapticIntensity: HapticIntensity; elderlyMode: boolean; simplifiedInterface: boolean; largeButtons: boolean; touchAssist: boolean; longPressDelay: number; tapAssist: boolean; navigationAssist: boolean; audioDescription: boolean; keyboardNavigation: boolean; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/accessibility/AccessibilityService.ets#L70-L105
2bea0262eb487ec52aab61d3c4efbbdb8de4d2cc
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/ciphers/VigenereCipher.ets
arkts
encrypt
加密文本 @param text 要加密的文本 @param key 密钥 @returns 加密后的文本
static encrypt(text: string, key: string): string { if (!text || !key) { return ''; } const normalizedKey = key.toUpperCase(); let result = ''; let keyIndex = 0; for (let i = 0; i < text.length; i++) { const char = text[i]; if (char >= 'A' && char <= 'Z') { // 大写字母 const shift = normalizedKey.charCodeAt(keyIndex % normalizedKey.length) - 65; result += String.fromCharCode(((char.charCodeAt(0) - 65 + shift) % 26) + 65); keyIndex++; } else if (char >= 'a' && char <= 'z') { // 小写字母 const shift = normalizedKey.charCodeAt(keyIndex % normalizedKey.length) - 65; result += String.fromCharCode(((char.charCodeAt(0) - 97 + shift) % 26) + 97); keyIndex++; } else { // 非字母字符保持不变 result += char; } } return result; }
AST#method_declaration#Left static encrypt AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left text AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left key AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left '' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left normalizedKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left key AST#expression#Right . toUpperCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left '' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyIndex = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left text AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left char = AST#expression#Left AST#subscript_expression#Left AST#expression#Left text AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left char AST#expression#Right >= AST#expression#Left 'A' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left char AST#expression#Right <= AST#expression#Left 'Z' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 大写字母 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left shift = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left normalizedKey AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left keyIndex AST#expression#Right % AST#expression#Left normalizedKey AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left 65 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left String AST#expression#Right . fromCharCode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left char AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left 65 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left shift AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right % AST#expression#Left 26 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right + AST#expression#Left 65 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left keyIndex AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left char AST#expression#Right >= AST#expression#Left 'a' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left char AST#expression#Right <= AST#expression#Left 'z' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 小写字母 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left shift = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left normalizedKey AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left keyIndex AST#expression#Right % AST#expression#Left normalizedKey AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left 65 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left String AST#expression#Right . fromCharCode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left char AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left 97 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left shift AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right % AST#expression#Left 26 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right + AST#expression#Left 97 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left keyIndex AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 非字母字符保持不变 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result += AST#expression#Left char AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static encrypt(text: string, key: string): string { if (!text || !key) { return ''; } const normalizedKey = key.toUpperCase(); let result = ''; let keyIndex = 0; for (let i = 0; i < text.length; i++) { const char = text[i]; if (char >= 'A' && char <= 'Z') { const shift = normalizedKey.charCodeAt(keyIndex % normalizedKey.length) - 65; result += String.fromCharCode(((char.charCodeAt(0) - 65 + shift) % 26) + 65); keyIndex++; } else if (char >= 'a' && char <= 'z') { const shift = normalizedKey.charCodeAt(keyIndex % normalizedKey.length) - 65; result += String.fromCharCode(((char.charCodeAt(0) - 97 + shift) % 26) + 97); keyIndex++; } else { result += char; } } return result; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/VigenereCipher.ets#L12-L40
b874e968d13385cbe88baac595b6a9951d4b3ae3
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/livedetectionandencryptiond/src/main/ets/components/StartFacialFecognition.ets
arkts
privateStartDetection
校验CAMERA权限,跳转人脸活体验证控件 @param routerOptions 活体检测参数 @param permissionArr 权限列表
public static privateStartDetection(routerOptions: interactiveLiveness.InteractiveLivenessConfig, permissionArr: Array<Permissions>) { let context = getContext(); // 向用户申请权限,此处为相机权限 abilityAccessCtrl.createAtManager().requestPermissionsFromUser(context, permissionArr).then((res) => { for (let i = 0; i < res.permissions.length; i++) { if (res.permissions[i] === 'ohos.permission.CAMERA' && res.authResults[i] === 0) { // 拉起活体检测 interactiveLiveness.startLivenessDetection(routerOptions).then((DetectState: boolean) => { }) } } }) }
AST#method_declaration#Left public static privateStartDetection AST#parameter_list#Left ( AST#parameter#Left routerOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left interactiveLiveness . InteractiveLivenessConfig AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left permissionArr : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 向用户申请权限,此处为相机权限 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left abilityAccessCtrl AST#expression#Right . createAtManager AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . requestPermissionsFromUser AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left permissionArr AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left res AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left res AST#expression#Right AST#binary_expression#Right AST#expression#Right . permissions AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . permissions AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left 'ohos.permission.CAMERA' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left res AST#expression#Right AST#binary_expression#Right AST#expression#Right . authResults AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 拉起活体检测 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left interactiveLiveness AST#expression#Right . startLivenessDetection AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left routerOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left DetectState : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public static privateStartDetection(routerOptions: interactiveLiveness.InteractiveLivenessConfig, permissionArr: Array<Permissions>) { let context = getContext(); abilityAccessCtrl.createAtManager().requestPermissionsFromUser(context, permissionArr).then((res) => { for (let i = 0; i < res.permissions.length; i++) { if (res.permissions[i] === 'ohos.permission.CAMERA' && res.authResults[i] === 0) { interactiveLiveness.startLivenessDetection(routerOptions).then((DetectState: boolean) => { }) } } }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/livedetectionandencryptiond/src/main/ets/components/StartFacialFecognition.ets#L29-L42
c9bbf10bba0cfe59538db04199760f143b04c646
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LocationUtil.ets
arkts
isGeocoderAvailable
判断地理编码与逆地理编码服务是否可用 @returns
static isGeocoderAvailable() { return geoLocationManager.isGeocoderAvailable(); }
AST#method_declaration#Left static isGeocoderAvailable AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left geoLocationManager AST#expression#Right . isGeocoderAvailable AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static isGeocoderAvailable() { return geoLocationManager.isGeocoderAvailable(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L196-L198
3481edfda0b312f97c8eeff8c21d21e8edcb9dd3
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/view/ProfilePage.ets
arkts
构建个人中心页面 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.profile_title"), viewModel: this.vm }) { this.ProfileContent(); IBestDialog({ visible: this.vm.showLogoutDialog, title: $r("app.string.logout_confirm_title"), message: $r("app.string.logout_confirm_message"), showCancelButton: true, confirmButtonText: $r("app.string.confirm"), cancelButtonText: $r("app.string.cancel"), onConfirm: (): void => this.vm.confirmLogout(), onCancel: (): void => this.vm.hideLogoutDialog(), onClose: (): void => this.vm.hideLogoutDialog() }); } }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.profile_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left viewModel : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ProfileContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_custom_component_statement#Left IBestDialog ( AST#component_parameters#Left { AST#component_parameter#Left visible : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . showLogoutDialog AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.logout_confirm_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left message : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.logout_confirm_message" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left showCancelButton : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left confirmButtonText : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.confirm" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left cancelButtonText : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.cancel" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onConfirm : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . confirmLogout AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onCancel : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . hideLogoutDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onClose : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . hideLogoutDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { AppNavDestination({ title: $r("app.string.profile_title"), viewModel: this.vm }) { this.ProfileContent(); IBestDialog({ visible: this.vm.showLogoutDialog, title: $r("app.string.logout_confirm_title"), message: $r("app.string.logout_confirm_message"), showCancelButton: true, confirmButtonText: $r("app.string.confirm"), cancelButtonText: $r("app.string.cancel"), onConfirm: (): void => this.vm.confirmLogout(), onCancel: (): void => this.vm.hideLogoutDialog(), onClose: (): void => this.vm.hideLogoutDialog() }); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/ProfilePage.ets#L29-L48
b8a373ce8330590afe359e2987cc81541b32774e
github
iamhyc/Aigis.git
585de9128882d868484438d32832ca9b9b50442d
entry/src/main/ets/components/settings.ets
arkts
fp
build() { Column({space:3}) { Row() { Text(this.title) .fontWeight(FontWeight.Medium) .fontSize(this.titleFontSize) .fontColor(this.disabled ? $r('sys.color.font_tertiary') : $r('sys.color.font_primary')) } .padding({left:6}) .width('100%') // if (this.description) { Row() { Text(this.description) .fontColor($r('sys.color.font_secondary')) .fontSize(12) } .padding({left:6}) .width('100%') } } .padding({top:6,bottom:6}) .width('100%') .flexBasis('auto') .flexShrink(2) }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 3 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . titleFontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . disabled AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.font_tertiary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.font_primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 6 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . description AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . description AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.font_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 6 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 6 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 6 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . flexBasis ( AST#expression#Left 'auto' AST#expression#Right ) AST#modifier_chain_expression#Left . flexShrink ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { Column({space:3}) { Row() { Text(this.title) .fontWeight(FontWeight.Medium) .fontSize(this.titleFontSize) .fontColor(this.disabled ? $r('sys.color.font_tertiary') : $r('sys.color.font_primary')) } .padding({left:6}) .width('100%') if (this.description) { Row() { Text(this.description) .fontColor($r('sys.color.font_secondary')) .fontSize(12) } .padding({left:6}) .width('100%') } } .padding({top:6,bottom:6}) .width('100%') .flexBasis('auto') .flexShrink(2) }
https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/components/settings.ets#L21-L46
9d43a416c04009f02025d16dfc9978926fa80904
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@system.router.d.ets
arkts
enableAlertBeforeBackPage
Pop up dialog to ask whether to back @param { EnableAlertBeforeBackPageOptions } options Options. @syscap SystemCapability.ArkUI.ArkUI.Full @since 6 @deprecated since 8
static enableAlertBeforeBackPage(options: EnableAlertBeforeBackPageOptions): void;
AST#method_declaration#Left static enableAlertBeforeBackPage AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left EnableAlertBeforeBackPageOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
static enableAlertBeforeBackPage(options: EnableAlertBeforeBackPageOptions): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.router.d.ets#L321-L321
10b03104fa12e3a6fd378f92de87715344743f18
gitee