def getAttribute(self, _name):
        i = 0
        for i in range(0, len(self.__attributes)):
            if Attribute(self.__attributes[i]).getName() == _name:
                break

        if i == len(self.__attributes):
            return None
        return Attribute(self.__attributes[i])
    def searchUndefPosition( self,attToDel):
        undefCount=0,
        count = 0;

        att_aux = Attribute(self.__attributes[count])
        while (attToDel != att_aux):
            if (att_aux.getDirectionAttribute() == Attribute.DIR_NOT_DEF):
                undefCount+=1

            count+=1
            att_aux = Attribute(self.__attributes[count])

        return undefCount
    def searchUndefPosition(self, attToDel):
        undefCount = 0
        count = 0

        att_aux = Attribute(self.__attributes[count])
        while attToDel != att_aux:
            if att_aux.getDirectionAttribute() == Attribute.DIR_NOT_DEF:
                undefCount = undefCount + 1

            count = count + 1
            att_aux = Attribute(self.__attributes[count])

        return undefCount
 def getInputAttributes(self):
     if len(self.__inputAttr) == 0:
         return None
     attr = Attribute[len(self.__inputAttr)]
     for i in range(0, len(attr)):
         attr[i] = Attribute(self.__inputAttr[i])
         return attr
    def getAttributesExcept(self, v):
        restAt = []
        for i in range(0, len(self.__attributes)):
            attName = Attribute(self.__attributes[i]).getName()
            if attName not in v:
                restAt.append(attName)

        return restAt
    def getUndefinedAttributes(self):
        if len(self.__undefinedAttr) == 0:
            return None
        attr = Attribute[len(self.__undefinedAttr)]
        for i in range(0, attr.length):
            attr[i] = Attribute(self.__undefinedAttr[i])

        return attr
    def areAllDefinedAsInputs(self, inputNames):
        if len(inputNames) != len(self.__inputAttr):
            return False

        for i in range(0, len(self.__inputAttr)):
            input_name = Attribute(self.__inputAttr[i]).getName()
            if input_name not in inputNames:
                return False
        return True
    def areAllDefinedAsOutputs(self, outputNames):
        if outputNames.size() != len(self.__outputAttr):
            return False

        for i in range(0, len(self.__outputAttr)):
            out_put_name = Attribute(self.__outputAttr[i]).getName()
            if out_put_name not in outputNames:
                return False

        return True
    def getOutputHeader(self):
        aux = "@outputs ";
        ending = ","
        out_put_att_length = len(self.__outputAttr)
        for i in range(0, out_put_att_length):
            if i == out_put_att_length - 1:
                ending = ""
            aux += (Attribute(self.outputAttr[i]).getName()) + ending;

        return aux
    def getInputHeader(self):
        aux = "@inputs "
        ending = ","
        inputLength = len(self.__inputAttr)
        for i in range(0, inputLength):
            if i == (inputLength - 1):
                ending = ""
            aux += (Attribute(self.__inputAttr[i])).getName() + ending

        return aux
    def setOutputInputAttributes(self, inAttNames, outAttNames):
        i = 0
        attName = ""
        att = Attribute()

        for i in range(0, len(self.__attributes)):
            att = Attribute(self.__attributes[i])
            attName = att.getName()
            if attName in inAttNames:
                att.setDirectionAttribute(Attribute.INPUT)
                self.__inputAttr.append(self.__attributes[i])
            elif attName in outAttNames:
                att.setDirectionAttribute(Attribute.OUTPUT)
                self.__outputAttr.append(self.__attributes[i])
            else:
                self.__undefinedAttr.append(self.__attributes[i])

        # Finally, making some statistics
        self.__hasNominal = False
        self.__hasInteger = False
        self.__hasReal = False

        for index in range(0, 2):
            if index == 0:
                iterations = len(self.__inputAttr)
            else:
                iterations = len(self.__outputAttr)

            for i in range(0, iterations):

                if index == 0:
                    att = Attribute(self.__inputAttr[i])
                else:
                    att = Attribute(self.__outputAttr[i])
                if att.getType() == Attribute.NOMINAL:

                    self.__hasNominal = True

                elif att.getType() == Attribute.INTEGER:
                    self.__hasInteger = True

                elif att.getType() == Attribute.REAL:
                    self.__hasReal = True
 def getAttribute(self, pos):
     return Attribute(self.__attributes[pos]);
 def getOutputAttribute(self, pos):
     if pos < 0 or pos >= len(self.__outputAttr):
         return None
     return Attribute(self.__outputAttr[pos])
 def getAttributes(self):
     if len(self.__attributes) == 0:
         return None
     attr = Attribute[len(self.__attributes)]
     for i in range(0, len(attr)):
         attr[i] = Attribute(self.__attributes[i])
    def removeAttribute(self, inputAtt, whichAtt):
        atToDel = None;
        if inputAtt and (whichAtt >= len(self.__inputAttr) or whichAtt < 0):
            return False;
        if self.__inputAtt and (whichAtt >= len(self.__outputAttr) or whichAtt < 0):
            return False;

        if inputAtt:
            # inputAttribute
            atToDel = Attribute(self.__inputAttr[whichAtt])
            atToDel.setDirectionAttribute(Attribute.DIR_NOT_DEF)
            self.__inputAttr.removeElementAt(whichAtt);

        else:  # output attribute
            atToDel = Attribute(self.__outputAttr[whichAtt])
            atToDel.setDirectionAttribute(Attribute.DIR_NOT_DEF)
            self.__outputAttr.removeElementAt(whichAtt)

        # We get the position where it has to go in the undefined attributes vector.
        self.__undefPosition = self.searchUndefPosition(atToDel)
        self.__undefinedAttr.insertElementAt(atToDel, self.__undefPosition)

        self.__hasNominal = False
        self.__hasInteger = False
        self.__hasReal = False
        for index in (0, 2):
            iterations = 0
            if index == 0:
                iterations = len(self.__inputAttr)
            else:
                iterations = len(self.__outputAttr)
            for i in range(0, iterations):
                if index == 0:
                    att = Attribute(self.__inputAttr[i])
                else:
                    att = Attribute(self.__outputAttr[i])
            attTypeHere = att.getType()
            if attTypeHere == Attribute.NOMINAL:

                self.__hasNominal = True

            elif attTypeHere == Attribute.INTEGER:
                self.__hasInteger = True

            elif attTypeHere == Attribute.REAL:
                self.__hasReal = True

        return True
 def getUndefinedAttribute(self, pos):
     if pos < 0 or pos >= len(self.__undefinedAttr):
         return None
     return Attribute(self.__undefinedAttr[pos])
 def getInputAttribute( self,pos) :
     if (pos<0 or pos >= len(self.__inputAttr)) :
         return None
     return Attribute(self.__inputAttr[pos])