public HashMap < Type , Double > getInversePossibilities ( ) { HashMap < Type , Double > ret = new HashMap < Type , Double > ( ) ; for ( Type t : Type . values ( ) ) ret . put ( t , 0.0 ) ; for ( Type t : types ) { //??? IS THIS CORRECT ??? --> Seems correct //get inverse of each relation that is 1.0 Type inverseRelation = FuzzyAllenIntervalConstraint . getInverseRelation ( t ) ; HashMap < FuzzyAllenIntervalConstraint . Type , Double > possibilities = this . getPossibilities ( ) ; //set poss of each inverse relation to 1.0 ret . put ( inverseRelation , possibilities . get ( t ) ) ; //calculate the Freksa N of each inverse relation HashMap < FuzzyAllenIntervalConstraint . Type , Double > fr = new HashMap < FuzzyAllenIntervalConstraint . Type , Double > ( ) ; for ( int i = 0 ; i < FuzzyAllenIntervalConstraint . freksa_neighbor [ inverseRelation . ordinal ( ) ] . length ; i ++ ) fr . put ( FuzzyAllenIntervalConstraint . lookupTypeByInt ( i ) , FuzzyAllenIntervalConstraint . getPossibilityDegree ( FuzzyAllenIntervalConstraint . freksa_neighbor [ inverseRelation . ordinal ( ) ] [ i ] ) ) ; //take the maximum between calculated Freksa N and previously added possibilities //(because this is an OR) for ( FuzzyAllenIntervalConstraint . Type t1 : fr . keySet ( ) ) ret . put ( t1 , Math . max ( ret . get ( t1 ) , fr . get ( t1 ) ) ) ; } /* System.out.println("====================================="); System.out.println("DIRECT " + this + ":\n" + this.possibilities); System.out.println("INVERSE:\n" + ret); System.out.println("====================================="); */ return ret ; }
Get the possibilities of all inverse relations .