All pastes #825236 Raw Edit

Anonymous

public java v1 · immutable
#825236 ·published 2007-12-20 12:53 UTC
rendered paste body
public TeacherIntervalTree () {  intervalTree = new BinaryTree < PairInformation < IntInformation , IntInformation > >();}public void insert ( PairInformation < IntInformation , IntInformation > interval ) {  insert ( intervalTree , interval );}private void insert (BinaryTreeI < PairInformation < IntInformation , IntInformation > > tree , PairInformation < IntInformation , IntInformation > interval ) {  if ( tree . size () == 0) {    tree . set ( interval ,         new BinaryTree < PairInformation < IntInformation ,               IntInformation > >() ,         new BinaryTree < PairInformation < IntInformation ,               IntInformation > >());    return ;  } else {    int a = interval . firstValue (). intValue ();    int b = interval . secondValue (). intValue ();    int c = tree . root (). firstValue (). intValue ();    int d = tree . root (). secondValue (). intValue ();    if ( c > a && d > b ) {       insert ( tree . leftSubtree () , interval );    } else if ( c < a && d < b ) {       insert ( tree . rightSubtree () , interval );    }  }}