Esempio n. 1
0
def tstring():
	from ConcurrenTree import node
	grey = node.make("grey")
	gc = grey.context()
	gc.live.insert(4, " cat.") # "grey cat."
	gc.live.delete(0, 1) # "rey cat."
	gc.live.delete(7, 1) # "rey cat"
	gc.live.insert(0, "G") # "Grey cat"
	gc.live.insert(8, "!") # "Grey cat!"
	return gc.value == "Grey cat!" or gc.value
Esempio n. 2
0
def tstring():
    from ConcurrenTree import node
    grey = node.make("grey")
    gc = grey.context()
    gc.live.insert(4, " cat.")  # "grey cat."
    gc.live.delete(0, 1)  # "rey cat."
    gc.live.delete(7, 1)  # "rey cat"
    gc.live.insert(0, "G")  # "Grey cat"
    gc.live.insert(8, "!")  # "Grey cat!"
    return gc.value == "Grey cat!" or gc.value
Esempio n. 3
0
	def set(self, key, value):
		if self.has(key):
			# Use existing SingleNode
			r = self.get(key).context().set(value)
			return address.Address([key, "/single"])+r
		else:
			# Make Singlenode
			s = instruction.InsertSingle([], key)
			# Make actual node
			n = node.make(value).op(0, [key, "/single"])
			return s + n
Esempio n. 4
0
 def set(self, value):
     addr, head = self.head()
     op = operation.Operation()
     if len(head._children[0]) > 0:
         # Extend head
         op += instruction.InsertSingle(addr, 1)
         addr += [1, '/single']
         head = head.head()[1]
     # Insert value
     vnode = node.make(value)
     op += vnode.op(0, addr)
     return op
Esempio n. 5
0
def tlist():
    from ConcurrenTree import node
    hello = node.make(["Hello"])
    hc = hello.context()
    hc.live.insert(1, ['world'])  # ["Hello", "world"]
    hc.live.delete(0, 1)  # ["world"]
    hc.live.insert(1, ['wide', 'web'])  # ["world", "wide", "web"]
    hc.live.delete(0, 2)  # ["web"]
    hc.live.insert(1, ['site'])  # ["web", "site"]
    hc.live.insert(0, ['major'])  # ["major", "web", "site"]
    hc.live.delete(1, 1)  # ["major", "site"]
    return hc.value == ["major", "site"] or hc.value
Esempio n. 6
0
def tlist():
	from ConcurrenTree import node
	hello = node.make(["Hello"])
	hc = hello.context()
	hc.live.insert(1, ['world']) # ["Hello", "world"]
	hc.live.delete(0,1) # ["world"]
	hc.live.insert(1, ['wide', 'web']) # ["world", "wide", "web"]
	hc.live.delete(0,2) # ["web"]
	hc.live.insert(1,['site']) # ["web", "site"]
	hc.live.insert(0,['major']) # ["major", "web", "site"]
	hc.live.delete(1,1) # ["major", "site"]
	return hc.value == ["major", "site"] or hc.value
Esempio n. 7
0
	def set(self, value):
		addr, head = self.head()
		op = operation.Operation()
		if len(head._children[0]) > 0:
			# Extend head
			op += instruction.InsertSingle(addr, 1)
			addr += [1, '/single']
			head = head.head()[1]
		# Insert value
		vnode = node.make(value)
		op += vnode.op(0, addr)
		return op
Esempio n. 8
0
	def __init__(self, root={}, applied = [], docname=""):
		self.root = make(root)
		self.docname = docname

		self.own_opsink = True
		self.private = dict({
			'ops':{
				'known'  : {},
				'applied': {}
				# MCP negotiation data should go here too
			}
		})
		for ophash in applied:
			self.applied[ophash] = True;
		self.routing
		self.content
Esempio n. 9
0
    def __init__(self, root={}, applied=[], docname=""):
        self.root = make(root)
        self.docname = docname

        self.own_opsink = True
        self.private = dict({
            'ops': {
                'known': {},
                'applied': {}
                # MCP negotiation data should go here too
            }
        })
        for ophash in applied:
            self.applied[ophash] = True
        self.routing
        self.content
Esempio n. 10
0
	def insert(self, pos, value):
		iaddr, ipos = self._traceindex(pos)
		i = instruction.InsertNode(iaddr, ipos, node.make(value))
		return operation.Operation([i])
Esempio n. 11
0
	def insert(self, pos, value):
		iaddr, ipos = self._traceindex(pos)
		n = node.make([value])
		return iaddr + operation.FromNode(n, ipos)
Esempio n. 12
0
 def insert(self, pos, value):
     iaddr, ipos = self._traceindex(pos)
     n = node.make([value])
     return iaddr + operation.FromNode(n, ipos)
Esempio n. 13
0
	def insert(self, pos, value):
		iaddr, ipos = self._traceindex(pos)
		i = instruction.InsertNode(iaddr, ipos, node.make(value))
		return operation.Operation([i])