input
stringlengths
10
828
output
stringlengths
5
107
public void test angle b system out println angle b plane a new plane point north pole plane b new plane new point math pi 4 math pi 2 double exp result math pi 4 double result a angle b assert equals true math abs exp result result util tolerance
test of angle method of class com
public void test intersects a system out println intersects a orthodrome a new orthodrome new point math pi 4 0 new point math pi 4 0 orthodrome b new orthodrome new point 0 math pi 4 new point 0 math pi 4 boolean exp result true boolean result a intersects b util tolerance assert equals exp result result
test of intersects method of class com
public void test remove system out println remove map iterator string character instance create instance while instance has next character c instance next instance remove
test of remove method of class com
public void test get previous system out println get insert previous linked circle list string instance new linked circle list string instance insert previous x string exp result x string result instance get previous assert equals exp result result
test of get previous method of class com
public void test intersects b system out println intersects b orthodrome a new orthodrome new point math pi 8 0 new point math pi 4 math pi 2 orthodrome b new orthodrome new point 0 math pi 4 new point 0 math pi 4 boolean exp result false boolean result a intersects b util tolerance assert equals exp result result
test of intersects method of class com
public void test constructor a throws ioexception system out println constructor a file dir new file base constructor a file collection instance new file collection dir gpx no wpt false set file exp result new hash set file exp result add new file dir 1180894 gpx exp result add new file dir 1192083 gpx exp result add new file dir 1202195 gpx exp result add new file dir 1321746 gpx exp result add new file dir 1560046 gpx set file result new hash set file instance assert equals true exp result equals result
test of constructor of class com
public void test remove next system out println remove next linked circle list string instance new linked circle list string instance insert next x string exp result x string result instance remove next assert equals exp result result
test of remove next method of class com
public void test intersects c system out println intersects c orthodrome a new orthodrome new point math pi 4 0 point origin orthodrome b new orthodrome new point 0 math pi 4 new point 0 math pi 4 boolean exp result true boolean result a intersects b util tolerance assert equals exp result result
test of intersects method of class com
public void test remove previous system out println remove previous linked circle list string instance new linked circle list string instance insert previous x string exp result x string result instance remove previous assert equals exp result result
test of remove previous method of class com
public void test size system out println size linked circle list string instance new linked circle list string assert equals 0 instance size instance insert next x assert equals 1 instance size instance remove next assert equals 0 instance size
test of size method of class com
public void test is empty system out println is empty linked circle list instance new linked circle list assert equals true instance is empty
test of is empty method of class com
public void test to string system out println to string point instance new point 0 0 0 0 string exp result 0 0 pi 0 0 pi string result instance to string assert equals exp result result
test of to string method of class com
public void test contains system out println contains linked circle list instance new linked circle list assert equals false instance contains x instance insert next x assert equals true instance contains x
test of contains method of class com
public void test get theta system out println get theta point instance new point 2 math pi 0 0 double exp result 0 0 double result instance get theta assert equals exp result result
test of get theta method of class com
public void test iterator a system out println iterator a linked circle list string instance new linked circle list string instance insert next z instance insert next y instance insert next x iterator string i instance iterator string s assert equals true i has next s i next assert equals x s assert equals true i has next s i next assert equals y s assert equals true i has next s i next assert equals z s assert equals false i has next
test of iterator method of class com
public void test get phi system out println get phi point instance new point 0 0 2 math pi double exp result 0 0 double result instance get phi assert equals exp result result
test of get phi method of class com
public void test to array system out println to array linked circle list instance new linked circle list instance insert next z instance insert next y instance insert next x object exp result x y z object result instance to array assert equals exp result length result length for int i 0 i exp result length i assert equals exp result i result i
test of to array method of class com
public void test equals a system out println equals a point p new point math pi 4 math pi 4 point instance new point math pi 4 2 math pi math pi 4 2 math pi boolean exp result true boolean result instance equals p assert equals exp result result
test of equals method of class com
public void test equals b system out println equals b point p new point 3 math pi 4 3 math pi 4 point instance new point 3 math pi 4 2 math pi 3 math pi 4 2 math pi boolean exp result true boolean result instance equals p assert equals exp result result
test of equals method of class com
public void test equals c system out println equals c point p new point math pi math pi 2 point instance new point 0 math pi 2 boolean exp result true boolean result instance equals p assert equals exp result result
test of equals method of class com
public void test add all system out println add all string ary x y z collection string coll arrays as list ary linked circle list string instance new linked circle list string instance add all coll object exp result ary object result instance to array assert equals exp result length result length for int i 0 i exp result length i assert equals exp result i result i
test of add all method of class com
public void test clear system out println clear string ary x y z collection string coll arrays as list ary linked circle list string instance new linked circle list string instance add all coll instance clear assert equals 0 instance size
test of clear method of class com
public void test rotate a system out println rotate a point axis new point math pi 2 0 double angle math pi 4 point instance new point 0 0 point exp result new point 0 math pi 4 point result instance rotate axis angle assert equals true exp result equals result util tolerance
test of rotate method of class com
public void test rotate b system out println rotate b point axis new point 0 3 math pi 4 double angle math pi 4 point instance new point math pi 3 math pi 4 point exp result new point math pi 12 math pi 4 point result instance rotate axis angle assert equals true exp result equals result util tolerance
test of rotate method of class com
public void paint jgraph graph graphics g if marquee bounds null overlay graph g false
called after the component was repainted after autoscroll
public void mouse pressed mouse event e start point e get point marquee bounds new rectangle2 d double start point get x start point get y 0 0 if e null if e get source instanceof jgraph throw new illegal argument exception marquee handler cannot handle event from unknown source e jgraph graph jgraph e get source if is marquee trigger event e graph previous cursor graph get cursor graph set cursor new cursor cursor crosshair cursor
start the marquee at the specified start point
public void update merge attributes notify parent group bounds null child updated
update attributes for this view and indicate to the parent this child has
public map change attributes map change if change null map undo attributes apply map change update return undo return null
applies code change code to the attributes of the view and calls
public void update super update bounds graph constants get bounds all attributes if bounds null bounds all attributes create rect default bounds graph constants set bounds all attributes bounds group bounds null
overrides the parent method to udpate the cached points
public rectangle2 d get bounds point2 d loc get location double x 0 double y 0 if loc null x loc get x y loc get y rectangle2 d bounds new rectangle2 d double x y 0 0 bounds set frame bounds get x size 2 bounds get y size 2 size size return bounds
returns the bounds for the port view
protected void update ports object roots default graph model get roots graph model list list default graph model get descendants graph model roots if list null array list result new array list iterator it list iterator while it has next object cell it next if graph model is port cell cell view port view get mapping cell false if port view null result add port view port view refresh get model this false ports new port view result size result to array ports
updates the cached array of ports
public void add port point2 d offset add port offset null
utility method to create a port for this cell
public void add port point2 d offset object user object default port port new default port user object if offset null add port else graph constants set offset port get attributes offset add port
utility method to create a port for this cell
public e get representative return elements set iterator next
returns an arbitrary object from the group
public void add e element this elements set add element
adds an element to the group
public int hash code int result this eq comparator equivalence hashcode this get representative this comparator context return result
uses a representative to calculate the group hashcode using
public boolean equivalence compare e arg1 e arg2 c context1 c context2 return true
always returns true
public boolean equivalence compare e arg1 e arg2 c context1 c context2 for equivalence comparator super e super c current comparator this chain if current comparator equivalence compare arg1 arg2 context1 context2 return false return true
implements logical and between the comparators results
public int equivalence hashcode e arg1 c context string buffer hash string buffer new string buffer for list iterator equivalence comparator super e super c iter this chain list iterator iter has next equivalence comparator super e super c current comparator iter next int current hash code current comparator equivalence hashcode arg1 context hash string buffer append current hash code add a delimeter only if needed for next if iter has next hash string buffer append return hash string buffer to string hash code
rehashes the concatenation of the results of all single hashcodes
public int equivalence hashcode v vertex graph v e context in out degrees in out get in out degrees context vertex hash it using the string hash use the format n n string buffer sb new string buffer sb append string value of in out in degree sb append to diffrentiate inner and outer sb append string value of in out out degree return sb to string hash code
hashes using the in out degree of a vertex
public boolean equals object obj in out degrees other in out degrees obj return this in degree other in degree this out degree other out degree
checks both in degree and out degree
public boolean equals by edge order graph ordering other graph boolean result this get labels edges set equals other graph get labels edges set return result
tests equality by order of edges
public string to string string buffer sb new string buffer sb append map vertex to order vertex will be printed in their order object vertex array new object this map vertex to order size set v key set this map vertex to order key set for v curr vertex key set integer index this map vertex to order get curr vertex vertex array index int value curr vertex sb append array util to string vertex array sb append labels order append this labels edges set to string return sb to string
this is the format example
public boolean equals object obj labels edge other edge labels edge obj if this source other edge source this target other edge target return true else return false
checks both source and target
private void init graph mapping int map size vertex list1 size map v v g1 to g2 new hash map v v map size map v v g2 to g1 new hash map v v map size for int i 0 i map size i v source this vertex list1 get i v target this vertex list2 get i g1 to g2 put source target g2 to g1 put target source this graph mapping new default graph mapping v e g1 to g2 g2 to g1 this graph1 this graph2
we currently have the vertexes array
private void init this next supplier new prefetch iterator isomorphism relation xxx hb 280106 i don t understand this warning yet new next functor this graph1 vertex set new linked hash set v this graph1 vertex set vertex permute iter will be null if there is no match this vertex permute iter create permutation iterator this graph1 vertex set this graph2 vertex set this lable graph1 new graph ordering v e this graph1 this graph1 vertex set this graph1 edge set this graph2 edge set new linked hash set e this graph2 edge set
inits needed data structures among them
public isomorphism relation next iso relation return next
return next element casted as isomorphism relation
public boolean is isomorphic return this next supplier is enumeration started empty
efficiency the value is known after the first check for isomorphism
protected void reload roots reorder roots object ordered cells default graph model get all graph model list new roots new array list for int i 0 i ordered cells length i cell view view get mapping ordered cells i false if view null view refresh get model this true if view get parent view null new roots add view roots new roots
completely reloads all roots from the model in the order returned by
private void restart permutation group int group index int old perm array this perm array group index get current arrays sort old perm array this perm array group index new integer permutation iter old perm array this perm array group index get next
restarts by creating a new one instead
public double get shortest path length v vertex fibonacci heap node queue entry v e node get seen data vertex if node null return double positive infinity return node get key
get the length of the shortest path known to the given vertex
public e get spanning tree edge v vertex fibonacci heap node queue entry v e node get seen data vertex if node null return null return node get data spanning tree edge
get the spanning tree edge reaching a vertex which has been seen already
private void decrement in degree v vertex modifiable integer in degree in degree map get vertex if in degree value 0 in degree value if in degree value 0 queue offer vertex
decrements the in degree of a vertex
protected d get seen data v vertex return seen get vertex
access the data stored for a seen vertex
public void set cross component traversal boolean cross component traversal this cross component traversal cross component traversal
sets the cross component traversal flag indicates whether to traverse
public boolean is cross component traversal return cross component traversal
test whether this iterator is set to traverse the graph across connected
protected boolean is seen vertex object vertex return seen contains key vertex
determines whether a vertex has been seen yet by this traversal
public void add traversal listener traversal listener v e l if traversal listeners contains l traversal listeners add l
adds the specified traversal listener to this iterator
protected d put seen data v vertex d data return seen put vertex data
stores iterator dependent data for a vertex that has been seen
public void remove traversal listener traversal listener v e l traversal listeners remove l
removes the specified traversal listener from this iterator
protected void finish vertex v vertex fire vertex finished create vertex traversal event vertex
called when a vertex has been finished meaning is dependent on traversal
protected void fire edge traversed edge traversal event v e e int len traversal listeners size for int i 0 i len i traversal listener v e l traversal listeners get i l edge traversed e
informs all listeners that a the specified edge was visited
protected void fire vertex traversed vertex traversal event v e int len traversal listeners size for int i 0 i len i traversal listener v e l traversal listeners get i l vertex traversed e
informs all listeners that a the specified vertex was visited
protected void fire vertex finished vertex traversal event v e int len traversal listeners size for int i 0 i len i traversal listener v e l traversal listeners get i l vertex finished e
informs all listeners that a the specified vertex was finished
public boolean is graph connected return lazy find connected sets size 1
test if the inspected graph is connected
abstract static class specifics vv ee returns the edges outgoing from the specified vertex in case of directed graph and the edge touching the specified vertex in case of undirected graph param vertex the vertex whose outgoing edges are to be returned return the edges outgoing from the specified vertex in case of directed graph and the edge touching the specified vertex in case of undirected graph public abstract set extends ee edges of vv vertex
provides unified interface for operations that are different in directed
public boolean path exists v source vertex v target vertex todo ignoring edge direction for directed graph may be confusing for directed graphs consider dijkstra s algorithm set source set connected set of source vertex return source set contains target vertex
tests if there is a path from the specified source vertex to the
protected void set edge local e edge this edge edge
sets the edge of this event
public int get hop count return this n hops
returns the number of hops or number of edges of the path
public e get prev edge return this prev edge
returns the edge reaching the target vertex of the path
public v get vertex return this vertex
returns the target vertex of the path
public int compare v v1 v v2 int degree1 graph degree of v1 int degree2 graph degree of v2 if degree1 degree2 ascending order degree1 degree2 ascending order return 1 else if degree1 degree2 ascending order degree1 degree2 ascending order return 1 else return 0
compare the degrees of code v1 code and code v2 code taking
public boolean detect cycles try execute null null catch cycle detected exception ex return true return false
performs yes no cycle detection on the entire graph
public boolean detect cycles containing vertex v v try execute null v catch cycle detected exception ex return true return false
performs yes no cycle detection on an individual vertex
protected double calculate path cost v vertex e edge v opposite vertex graphs get opposite vertex graph edge vertex we get the data of the previous pass bellman ford path element v e opposite prev data get prev seen data opposite vertex double path cost graph get edge weight edge if opposite prev data get vertex equals this start vertex if it s not the start vertex we add the cost of the previous pass path cost opposite prev data get cost return path cost
costs taken into account are the weights stored in code edge code
public boolean is strongly connected return strongly connected sets size 1
returns true if the graph of this code
protected boolean is seen vertex v vertex return this vertex data contains key vertex
determines whether a vertex has been seen yet by this traversal
private void relax vertex v vertex e edge assert valid edge edge double shortest path cost calculate path cost vertex edge bellman ford path element v e data create seen data vertex edge shortest path cost put seen data vertex data
upates data first time a vertex is reached by a path
public cell view get mapping object cell boolean create if cell null return null cell view view cell view mapping get cell if view null create is visible cell view cell view hidden mapping get cell if view null put mapping cell view hidden mapping remove cell else view factory create view graph model cell put mapping cell view view refresh get model this true create dependent views view update return view
returns the view for the specified cell
public void export adjacency matrix writer output undirected graph v e g print writer out new print writer output vertex name provider v name provider new integer name provider v for v from g vertex set assign ids in vertex set iteration order name provider get vertex name from for v from g vertex set export adjacency matrix vertex out name provider from graphs neighbor list of g from out flush
exports the specified graph into a plain text file format containing a
public void export adjacency matrix writer output directed graph v e g print writer out new print writer output vertex name provider v name provider new integer name provider v for v from g vertex set assign ids in vertex set iteration order name provider get vertex name from for v from g vertex set export adjacency matrix vertex out name provider from graphs successor list of g from out flush
exports the specified graph into a plain text file format containing a
public void clear next id 1 id map clear
clears all cached identifiers and resets the unique identifier counter
public string get vertex name v vertex integer id id map get vertex if id null id next id id map put vertex id return id to string
returns the string representation of the unique integer representing a
public void set default edge attributes attribute map default edge attributes this default edge attributes default edge attributes
sets the default edge attributes used for creating new jgraph edges
public attribute map get default edge attributes return default edge attributes
returns the default edge attributes used for creating new jgraph edges
public string get edge name e edge return edge to string
returns the string representation an edge
public void export output stream output graph v e g print stream out new print stream output for iterator v i g vertex set iterator i has next export vertex out i next for iterator e i g edge set iterator i has next export edge out i next g out flush
exports the specified graph into a visio csv file format
public string get vertex name v vertex return vertex to string
returns the string representation of the unique integer representing a
public string get edge name e edge integer id id map get edge if id null id next id id map put edge id return id to string
returns the string representation of an edge
public void set default vertex attributes attribute map default vertex attributes this default vertex attributes default vertex attributes
sets the default vertex attributes used for creating new jgraph vertices
public attribute map get default vertex attributes return default vertex attributes
returns the default vertex attributes used for creating new jgraph
private void reset random seed this randomizer set seed this randomizer seed
resets seed to generate the same random stream
public default edge get edge cell e j graph tedge return default edge edge to cell get j graph tedge
returns the jgraph edge cell that corresponds to the specified jgraph t
public default graph cell get vertex cell object j graph tvertex return default graph cell vertex to cell get j graph tvertex
returns the jgraph vertex cell that corresponds to the specified jgraph t
public boolean is enumeration started empty if this inner functor usage counter 0 if has more elements return false else return true else it is not the first time so use the saved value which was initilaizeed during a call to get next element from inner functor return flag is enumeration started empty
tests whether the enumeration started as an empty one
private boolean is dangling org jgraph graph edge j edge object j source get source vertex this j edge object j target get target vertex this j edge return cell to vertex contains key j source cell to vertex contains key j target
tests if the specified jgraph edge is dangling that is having at least
public int compare to modifiable integer another integer int this val this value int another val another integer value return this val another val 1 this val another val 0 1
compares two code modifiable integer code objects numerically
public int compare to object o return compare to modifiable integer o
compares this code modifiable integer code object to another object
public boolean equals object o if o instanceof modifiable integer return this value modifiable integer o value return false
compares this object to the specified object
public integer to integer return new integer this value
returns an code integer code object representing this code