<commit_before>local LXSC = require 'lib/lxsc'
LXSC.State={}; LXSC.State.__meta = {__index=LXSC.State}

LXSC.State.stateKinds = {state=1,parallel=1,final=1,history=1,initial=1}
LXSC.State.realKinds  = {state=1,parallel=1,final=1}
LXSC.State.aggregates = {onentry=1,onexit=1,datamodel=1,donedata=1}

function LXSC:state(kind)
	local t = {
		_kind       = kind or 'state',
		id          = kind.."-"..self.uuid4(),
		isAtomic    = true,
		isCompound  = false,
		isParallel  = kind=='parallel',
		isHistory   = kind=='history',
		isFinal     = kind=='final',
		ancestors   = {},

		states      = {},
		reals       = {},
		transitions = {},
		_eventlessTransitions = {},
		_eventedTransitions   = {},

		_onentrys   = {},
		_onexits    = {},
		_datamodels = {},
		_donedatas  = {},
		_invokes    = {}
	}
	t.selfAndAncestors={t}
	return setmetatable(t,self.State.__meta)
end

function LXSC.State:attr(name,value)
	if name=="name" or name=="id" or name=="initial" then
		self[name] = value
	else
		if self[name] then print(string.format("Warning: updating state %s=%s with %s=%s",name,tostring(self[name]),name,tostring(value))) end
		self[name] = value
	end
end

function LXSC.State:addChild(item)
	if item._kind=='transition' then
		item.source = self
		table.insert( self.transitions, item )

	elseif self.aggregates[item._kind] then
		item.state = self<commit_msg>Don't warn about overwriting values unless they are different than the current<commit_after>local LXSC = require 'lib/lxsc'
LXSC.State={}; LXSC.State.__meta = {__index=LXSC.State}

LXSC.State.stateKinds = {state=1,parallel=1,final=1,history=1,initial=1}
LXSC.State.realKinds  = {state=1,parallel=1,final=1}
LXSC.State.aggregates = {onentry=1,onexit=1,datamodel=1,donedata=1}

function LXSC:state(kind)
	local t = {
		_kind       = kind or 'state',
		id          = kind.."-"..self.uuid4(),
		isAtomic    = true,
		isCompound  = false,
		isParallel  = kind=='parallel',
		isHistory   = kind=='history',
		isFinal     = kind=='final',
		ancestors   = {},

		states      = {},
		reals       = {},
		transitions = {},
		_eventlessTransitions = {},
		_eventedTransitions   = {},

		_onentrys   = {},
		_onexits    = {},
		_datamodels = {},
		_donedatas  = {},
		_invokes    = {}
	}
	t.selfAndAncestors={t}
	return setmetatable(t,self.State.__meta)
end

function LXSC.State:attr(name,value)
	if name=="name" or name=="id" or name=="initial" then
		self[name] = value
	else
		if self[name] and self[name]~=value then print(string.format("Warning: updating state %s=%s with %s=%s",name,tostring(self[name]),name,tostring(value))) end
		self[name] = value
	end
end

function LXSC.State:addChild(item)
	if item._kind=='transition' then
		item.source = self
		table.insert( self.transitions, item )

	elseif self.aggregates[item._kind] then
		item.state = self
{'fraction_non_alphanumeric': 0.1598433606265575, 'fraction_numerical': 0.009255962976148096, 'mean_word_length': 3.982269503546099, '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': '1299244', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1064, 'n_words': 190}