def getNewHeader(self): line = "" attrs = [] # Getting the relation name and the attributes if (self.storeAttributesAsNonStatic == True and self.attributes != None): line = "@relation " + self.attributes.getRelationName() + "\n" attrs = self.attributes.getInputAttributes(Attributes) else: line = "@relation " + Attributes.getRelationName() + "\n" attrs = Attributes.getInputAttributes(Attributes) for i in range(0, attrs.length): line += attrs[i].toString() + "\n" # Gettin all the outputs attributes if (self.storeAttributesAsNonStatic and self.attributes != None): attrs = self.attributes.getOutputAttributes() line += attrs[0].toString() + "\n" # Getting @inputs and @outputs line += self.attributes.getInputHeader() + "\n" line += self.attributes.getOutputHeader() + "\n" else: attrs = Attributes.getOutputAttributes() line += str(attrs[0]) + "\n" # Getting @inputs and @outputs line += Attributes.getInputHeader() + "\n" line += Attributes.getOutputHeader() + "\n" return line
def printAsOriginal(self,out, int): # Printing the header as the original one print(self.header) if (self.storeAttributesAsNonStatic and self.attributes != None): if (self.printInOut == 1 or self.printInOut == 3): print(self.attributes.getInputHeader()) if (self.printInOut == 2 or self.printInOut == 3): print(self.attributes.getOutputHeader()) else: if (self.printInOut == 1 or self.printInOut == 3): out.println(Attributes.getInputHeader()) if (self.printInOut == 2 or self.printInOut == 3): out.println(Attributes.getOutputHeader()) print("@data") for i in range(0, len(self.instanceSet)): print() if (self.storeAttributesAsNonStatic and self.attributes != None): self.instanceSet[i].printAsOriginal(self.attributes, out) else: self.instanceSet[i].printAsOriginal(out)
def copyHeader(self): p = "" print("copyHeader begin...., P is :" + p) p = "@relation " + Attributes.getRelationName(Attributes) + "\n" print(" after relation P is :" + p) p += Attributes.getInputAttributesHeader(Attributes) print(" after getInputAttributesHeader P is :" + p) p += Attributes.getOutputAttributesHeader(Attributes) print(" after getOutputAttributesHeader P is :" + p) p += Attributes.getInputHeader(Attributes) + "\n" print(" after getInputHeader P is :" + p) p += Attributes.getOutputHeader(Attributes) + "\n" print(" after getOutputHeader P is :" + p) p += "@data\n" print("P is :" + p) return p