def _checkSeqContainment()

in archive/preprocess/clospan.py [0:0]


	def _checkSeqContainment(self, s1, s2):
		if len(s1) == len(s2):
			for i in range(0, len(s1)):
				if s1[i] != s2[i]:
					return 2
			return 0
		elif len(s1) < len(s2):
			i1 = 0
			i2 = 0
			while i1 < len(s1) and i2 < len(s2) and len(s1) - i1 <= len(s2) - i2:
				if s1[i1] == s2[i2]:
					i1 += 1
					i2 += 1
				else:
					i2 += 1
			if i1 >= len(s1):
				return -1
			else:
				return 2
		else: # len(s1) > len(s2)
			i1 = 0
			i2 = 0
			while i1 < len(s1) and i2 < len(s2) and len(s1) - i1 >= len(s2) - i2:
				if s1[i1] == s2[i2]:
					i1 += 1
					i2 += 1
				else:
					i1 += 1
			if i2 >= len(s2):
				return 1
			else:
				return 2