<commit_before>/**
 * @file	KCBitmapView.swift
 * @brief	Define KCBitmapView class
 * @par Copyright
 *   Copyright (C) 2021 Steel Wheels Project
 */

import CoconutData
import CoreGraphics
#if os(OSX)
import Cocoa
#else
import UIKit
#endif

open class KCBitmapView: KCLayerView
{
	private var mContext:		CNBitmapContext
	private var mRowCount:		Int
	private var mColumnCount:	Int

	public override init(frame : KCRect){
		mContext     = CNBitmapContext()
		mRowCount    = 10
		mColumnCount = 10
		super.init(frame: frame)
	}

	public convenience init(){
		let frame = KCRect(x: 0.0, y: 0.0, width: 480, height: 270)
		self.init(frame: frame)
	}

	required public init?(coder: NSCoder) {
		mContext     = CNBitmapContext()
		mRowCount    = 10
		mColumnCount = 10
		super.init(coder: coder)
	}

	public var rowCount: Int {
		get		{ return mRowCount }
		set(newval)	{ mRowCount = newval }
	}

	public var columnCount: Int {
		get		{ return mColumnCount   }
		set(newval)	{ mColumnCount = newval }
	}

	open override func draw(context ctxt: CGContext, count cnt: Int32) {
		self.mContext.begin(context: ctxt, physicalFrame: self.frame, width: self.mColumnCount, height: self.mRowCount)
		self.draw(bitmapContext: self.mContext, count: cnt)
		self.mContext.end()
	}

	open func draw(bitmapContext ctxt: CNBitmapContext, count cnt: Int32) {
		NSLog("must be override at \(#function) \(cnt)")
	}

	open override func accept(visitor vis: KCViewVisitor){
		vis.visit(bitmapView: self)
	}
}
<commit_msg>KCBitmapView: Add "update" method.<commit_after>/**
 * @file	KCBitmapView.swift
 * @brief	Define KCBitmapView class
 * @par Copyright
 *   Copyright (C) 2021 Steel Wheels Project
 */

import CoconutData
import CoreGraphics
#if os(OSX)
import Cocoa
#else
import UIKit
#endif

open class KCBitmapView: KCLayerView
{
	private var mContext:		CNBitmapContext
	private var mRowCount:		Int
	private var mColumnCount:	Int

	public override init(frame : KCRect){
		mContext     = CNBitmapContext()
		mRowCount    = 10
		mColumnCount = 10
		super.init(frame: frame)
	}

	public convenience init(){
		let frame = KCRect(x: 0.0, y: 0.0, width: 480, height: 270)
		self.init(frame: frame)
	}

	required public init?(coder: NSCoder) {
		mContext     = CNBitmapContext()
		mRowCount    = 10
		mColumnCount = 10
		super.init(coder: coder)
	}

	public var rowCount: Int {
		get		{ return mRowCount }
		set(newval)	{ mRowCount = newval }
	}

	public var columnCount: Int {
		get		{ return mColumnCount   }
		set(newval)	{ mColumnCount = newval }
	}

	public override func draw(context ctxt: CGContext, count cnt: Int32) {
		/* Draw the bitmap */
		self.mContext.draw(context: ctxt, physicalFrame: self.frame, width: self.mColumnCount, height: self.mRowCount)
		/* Update the content of bitmap */
		self.update(bitmapContext: self.mContext, count: cnt)
	}

	open func update(bitmapContext ctxt: CNBitmapContext, count cnt: Int32) {
		NSLog("must be override at \(#function) \(cnt)")
	}

	open override func accept(visitor vis: KCViewVisitor){
		vis.visit(bitmapView: self)
	}
}

{'fraction_non_alphanumeric': 0.10547002947920078, 'fraction_numerical': 0.017032427120864724, 'mean_word_length': 3.957792207792208, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1863785', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1071, 'n_words': 302}