LMAssembly // Change isLoaded() from function to variable.
This commit is contained in:
parent
3aee3159e1
commit
04bdb0db47
|
@ -88,7 +88,7 @@ extension vChewingLM {
|
||||||
|
|
||||||
// MARK: - 工具函式
|
// MARK: - 工具函式
|
||||||
|
|
||||||
public var isLanguageModelLoaded: Bool { lmCore.isLoaded() }
|
public var isLanguageModelLoaded: Bool { lmCore.isLoaded }
|
||||||
public func loadLanguageModel(path: String) {
|
public func loadLanguageModel(path: String) {
|
||||||
if FileManager.default.isReadableFile(atPath: path) {
|
if FileManager.default.isReadableFile(atPath: path) {
|
||||||
lmCore.open(path)
|
lmCore.open(path)
|
||||||
|
@ -98,7 +98,7 @@ extension vChewingLM {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public var isCNSDataLoaded: Bool { vChewingLM.LMInstantiator.lmCNS.isLoaded() }
|
public var isCNSDataLoaded: Bool { vChewingLM.LMInstantiator.lmCNS.isLoaded }
|
||||||
public func loadCNSData(path: String) {
|
public func loadCNSData(path: String) {
|
||||||
if FileManager.default.isReadableFile(atPath: path) {
|
if FileManager.default.isReadableFile(atPath: path) {
|
||||||
vChewingLM.LMInstantiator.lmCNS.open(path)
|
vChewingLM.LMInstantiator.lmCNS.open(path)
|
||||||
|
@ -108,7 +108,7 @@ extension vChewingLM {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public var isMiscDataLoaded: Bool { lmMisc.isLoaded() }
|
public var isMiscDataLoaded: Bool { lmMisc.isLoaded }
|
||||||
public func loadMiscData(path: String) {
|
public func loadMiscData(path: String) {
|
||||||
if FileManager.default.isReadableFile(atPath: path) {
|
if FileManager.default.isReadableFile(atPath: path) {
|
||||||
lmMisc.open(path)
|
lmMisc.open(path)
|
||||||
|
@ -118,7 +118,7 @@ extension vChewingLM {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public var isSymbolDataLoaded: Bool { vChewingLM.LMInstantiator.lmSymbols.isLoaded() }
|
public var isSymbolDataLoaded: Bool { vChewingLM.LMInstantiator.lmSymbols.isLoaded }
|
||||||
public func loadSymbolData(path: String) {
|
public func loadSymbolData(path: String) {
|
||||||
if FileManager.default.isReadableFile(atPath: path) {
|
if FileManager.default.isReadableFile(atPath: path) {
|
||||||
vChewingLM.LMInstantiator.lmSymbols.open(path)
|
vChewingLM.LMInstantiator.lmSymbols.open(path)
|
||||||
|
|
|
@ -24,7 +24,7 @@ extension vChewingLM {
|
||||||
rangeMap = [:]
|
rangeMap = [:]
|
||||||
}
|
}
|
||||||
|
|
||||||
public func isLoaded() -> Bool {
|
public var isLoaded: Bool {
|
||||||
!rangeMap.isEmpty
|
!rangeMap.isEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ extension vChewingLM {
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult public mutating func open(_ path: String) -> Bool {
|
@discardableResult public mutating func open(_ path: String) -> Bool {
|
||||||
if isLoaded() {
|
if isLoaded {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ extension vChewingLM {
|
||||||
}
|
}
|
||||||
|
|
||||||
public mutating func close() {
|
public mutating func close() {
|
||||||
if isLoaded() {
|
if isLoaded {
|
||||||
rangeMap.removeAll()
|
rangeMap.removeAll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ extension vChewingLM {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 檢測資料庫辭典內是否已經有載入的資料。
|
/// 檢測資料庫辭典內是否已經有載入的資料。
|
||||||
public func isLoaded() -> Bool {
|
public var isLoaded: Bool {
|
||||||
!rangeMap.isEmpty
|
!rangeMap.isEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ extension vChewingLM {
|
||||||
/// - parameters:
|
/// - parameters:
|
||||||
/// - path: 給定路徑。
|
/// - path: 給定路徑。
|
||||||
@discardableResult public mutating func open(_ path: String) -> Bool {
|
@discardableResult public mutating func open(_ path: String) -> Bool {
|
||||||
if isLoaded() {
|
if isLoaded {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ extension vChewingLM {
|
||||||
|
|
||||||
/// 將當前語言模組的資料庫辭典自記憶體內卸除。
|
/// 將當前語言模組的資料庫辭典自記憶體內卸除。
|
||||||
public mutating func close() {
|
public mutating func close() {
|
||||||
if isLoaded() {
|
if isLoaded {
|
||||||
rangeMap.removeAll()
|
rangeMap.removeAll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ extension vChewingLM {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 檢測資料庫辭典內是否已經有載入的資料。
|
/// 檢測資料庫辭典內是否已經有載入的資料。
|
||||||
public func isLoaded() -> Bool {
|
public var isLoaded: Bool {
|
||||||
!rangeMap.isEmpty
|
!rangeMap.isEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ extension vChewingLM {
|
||||||
/// - parameters:
|
/// - parameters:
|
||||||
/// - path: 給定路徑。
|
/// - path: 給定路徑。
|
||||||
@discardableResult public mutating func open(_ path: String) -> Bool {
|
@discardableResult public mutating func open(_ path: String) -> Bool {
|
||||||
if isLoaded() {
|
if isLoaded {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ extension vChewingLM {
|
||||||
|
|
||||||
/// 將當前語言模組的資料庫辭典自記憶體內卸除。
|
/// 將當前語言模組的資料庫辭典自記憶體內卸除。
|
||||||
public mutating func close() {
|
public mutating func close() {
|
||||||
if isLoaded() {
|
if isLoaded {
|
||||||
rangeMap.removeAll()
|
rangeMap.removeAll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,12 @@ extension vChewingLM {
|
||||||
rangeMap = [:]
|
rangeMap = [:]
|
||||||
}
|
}
|
||||||
|
|
||||||
public func isLoaded() -> Bool {
|
public var isLoaded: Bool {
|
||||||
!rangeMap.isEmpty
|
!rangeMap.isEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult public mutating func open(_ path: String) -> Bool {
|
@discardableResult public mutating func open(_ path: String) -> Bool {
|
||||||
if isLoaded() {
|
if isLoaded {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ extension vChewingLM {
|
||||||
}
|
}
|
||||||
|
|
||||||
public mutating func close() {
|
public mutating func close() {
|
||||||
if isLoaded() {
|
if isLoaded {
|
||||||
rangeMap.removeAll()
|
rangeMap.removeAll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,12 @@ extension vChewingLM {
|
||||||
rangeMap = [:]
|
rangeMap = [:]
|
||||||
}
|
}
|
||||||
|
|
||||||
public func isLoaded() -> Bool {
|
public var isLoaded: Bool {
|
||||||
!rangeMap.isEmpty
|
!rangeMap.isEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult public mutating func open(_ path: String) -> Bool {
|
@discardableResult public mutating func open(_ path: String) -> Bool {
|
||||||
if isLoaded() {
|
if isLoaded {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ extension vChewingLM {
|
||||||
}
|
}
|
||||||
|
|
||||||
public mutating func close() {
|
public mutating func close() {
|
||||||
if isLoaded() {
|
if isLoaded {
|
||||||
rangeMap.removeAll()
|
rangeMap.removeAll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue