|
FUNCTION connected_in_simple_path (connections : SET [0:?] OF path_element_connection) : BOOLEAN; LOCAL connection_set : SET [ 0 : ? ] OF path_element_connection ; nec0 : INTEGER ; pec0 : INTEGER ; necbranch : INTEGER ; pecbranch : INTEGER ; END_LOCAL ; IF SIZEOF ( connections ) > 1 THEN connection_set := QUERY ( pec1 <* connections | SIZEOF ( QUERY ( pec2 <* connections - pec1 | pec1 . next_element :=: pec2 . previous_element ) ) = 0 ) ; nec0 := SIZEOF ( connection_set ) ; connection_set := QUERY ( pec1 <* connections | SIZEOF ( QUERY ( pec2 <* connections - pec1 | pec2 . next_element :=: pec1 . previous_element ) ) = 0 ) ; pec0 := SIZEOF ( connection_set ) ; connection_set := QUERY ( pec1 <* connections | SIZEOF ( QUERY ( pec2 <* connections - pec1 | pec1 . next_element :=: pec2 . previous_element ) ) > 1 ) ; necbranch := SIZEOF ( connection_set ) ; connection_set := QUERY ( pec1 <* connections | SIZEOF ( QUERY ( pec2 <* connections - pec1 | pec2 . next_element :=: pec1 . previous_element ) ) > 1 ) ; pecbranch := SIZEOF ( connection_set ) ; IF ( ( nec0 <> 1 ) OR ( pec0 <> 1 ) OR ( necbranch > 0 ) OR ( pecbranch > 0 ) ) THEN RETURN ( FALSE ) ; ELSE RETURN ( TRUE ) ; END_IF ; ELSE RETURN ( TRUE ) ; END_IF ; END_FUNCTION; -- connected_in_simple_path |
|
public class FConnected_in_simple_path public static Value run(SdaiContext _context, Value connections) |