private boolean connectionOf ( String pre , String now , long currentComponent ) { List < Long > prel = new LinkedList < Long > ( ) , nowl = new LinkedList < Long > ( ) ; if ( ! pre . equals ( now ) && referentOfToken . get ( pre ) != null && referentOfToken . get ( now ) != null ) { for ( long l : referentOfToken . get ( pre ) . keySet ( ) ) { if ( referentList . get ( ( int ) l ) != null && referentList . get ( ( int ) l ) . component == currentComponent && referentOfToken . get ( pre ) . get ( l ) . equals ( 0 ) ) { prel . add ( l ) ; } } for ( long l : referentOfToken . get ( now ) . keySet ( ) ) { if ( referentList . get ( ( int ) l ) != null && referentList . get ( ( int ) l ) . component == currentComponent && referentOfToken . get ( now ) . get ( l ) . equals ( 0 ) ) { nowl . add ( l ) ; } } for ( long l : nowl ) { if ( prel . contains ( l ) ) { return true ; } } } prel = new LinkedList < Long > ( ) ; nowl = new LinkedList < Long > ( ) ; if ( ! pre . equals ( now ) && referentOfToken . get ( pre ) != null && referentOfToken . get ( now ) != null ) { for ( long l : referentOfToken . get ( pre ) . keySet ( ) ) { if ( referentList . get ( ( int ) l ) != null && referentList . get ( ( int ) l ) . component == currentComponent && referentOfToken . get ( pre ) . get ( l ) . equals ( 1 ) ) { prel . add ( l ) ; } } for ( long l : referentOfToken . get ( now ) . keySet ( ) ) { if ( referentList . get ( ( int ) l ) != null && referentList . get ( ( int ) l ) . component == currentComponent && referentOfToken . get ( now ) . get ( l ) . equals ( 1 ) ) { nowl . add ( l ) ; } } for ( long l : nowl ) { if ( prel . contains ( l ) ) { return true ; } } } return false ; }
Calculates wheather a line determinded by its component should be discontinous