File size: 1,171 Bytes
21baa2f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

'''
Created on ٢٩‏/٠٤‏/٢٠١٠

@Created by: Muhammad Altabba
'''

class UnvoweledPattern(object):
    """
     # PyUML: Do not remove this line! # XMI_ID:_qz4WCI35Ed-gg8GOK1TmhA
    """
    '''
    Unvoweled Pattern
    '''
    String = '';
    Rules = [];
    IDs = [];

    def __init__(self, string, rules, ids):
        '''
        Constructor
        '''
        self.String = string;
        self.Rules = rules;
        self.IDs = ids;
        pass
    
    def GetRootsStringsAndRules(self, string):
        if (string == None):
            string = self.String;
            
        rootStrings = [];
        rootRules = [];
        for j in range(len(self.Rules)):
            rootRule = '';
            rootString = '';
            for k in range(len(self.Rules[j])):
                rootRule += self.Rules[j][k];
                if self.Rules[j][k].isdigit():
                    rootString += string[int(self.Rules[j][k]) - 1];
                else:
                    rootString += self.Rules[j][k];
            rootStrings.append(rootString);
            rootRules.append(rootRule);
                    
        return [rootStrings, rootRules];