input
stringlengths
10
828
output
stringlengths
5
107
public void test obox equals try int params 0 0 1 1 0 temp poly new oriented box params assert equals unit square temp poly assert equals temp poly unit square assert true temp poly equals big square assert true big square equals temp poly params new int 1 1 1 1 180 temp poly new oriented box params assert equals unit square temp poly assert equals temp poly unit square assert true temp poly equals big square assert true big square equals temp poly catch illegal argument exception bdx assert true bdx get message false
tests the oriented boxs equality methods
public iterator get originals if originals size 0 return get polys else return originals iterator
gets the original list of polygons added to this
public boolean contains pnt point for iterator iter this get originals iter has next if convex polygon iter next contains point return true return false
tests to see if one of the subpolys contains the given point
public boolean current line is attribute return is attribute line current line to string true
checks to see if the line at which the vreader is pointing contains
protected void add poly poly list shape if shape instanceof convex polygon convex polygon con convex polygon shape if polys is empty polys add con area null bbox null return poly list attempt poly list subtract con this if attempt area less than con area add poly attempt bbox null else if attempt area equals con area polys add con composed true if area null rational plus area con area area bbox null else throw new runtime exception error while subtracting this from con else for iterator polys shape get polys polys has next add poly poly list polys next
sets this poly list into this unioned with the given shape
public int get fragmentation count poly list other iterator iter if composed if originals size 0 iter originals iterator else iter get polys else return intersects other 1 0 int count 0 while iter has next poly list curr poly list iter next if curr intersects other count return count
gets a count of how many original polygons
public boolean intersects poly list other if get bounding box intersects other get bounding box poly list new poly get intersection other if new poly null new poly area greater than 0 return true return false
tests to see if this region intersects the
public boolean current line is attribute boolean val return is attribute line current line to string val
checks to see if the line at which the vreader is pointing contains
public iterator get points return collections empty set iterator
gets the points in the polygon to be implemented
public boolean add vertex pnt p throws bad data exception throw new unsupported operation exception
adds the vertex to the polygon this represents this
public rational set to rational old bignum 0 old bignum 0 bignum 1 old bignum 1 return this
set this to the given value
public void test obox negative distance error oriented box obox new oriented box 259 206 29 49 178 bounding box bbox new bounding box 200 100 127 59 poly list cpoly1 obox get intersection bbox string s obox to string list of points intesects with bbox n to get cpoly1 n with areas bbox area obox area and cpoly1 area respectively assert true s cpoly1 area greater than 0 assert true s cpoly1 area less than 1421
tests the for a specific error that used to occur when
public rational set to long numerator bignum 0 big integer value of numerator bignum 1 big integer one return this
set this to the given value
private string enhance aline number int i if include paths empty return new integer i to string return include paths peek i
this adds the file name to the line number
public rational set to long numerator long denominator bignum 0 big integer value of numerator bignum 1 big integer value of denominator reduce return this
set this to the given value
public string to string if bignum 1 equals big integer one return bignum 0 to string else if bignum 1 equals big integer zero switch bignum 0 compare to big integer zero case 1 return inf case 0 return na n case 1 return inf default return bad value else return bignum 0 bignum 1
gets a string representation
private string enhance acharacter number int i int column number if include paths empty return null return include paths peek i column number
this adds the file name to the given line number column number pair
public int hash code return bignum 0 xor bignum 1 int value
get a hashcode for this number
public boolean equals object other if this other return true if other instanceof rational rational rother rational other return bignum 0 equals rother bignum 0 bignum 1 equals rother bignum 1 if other instanceof number return number other double value double value return false
tests the equality of two rationals or numbers
public boolean equals int other if bignum 1 equals big integer one return false else return bignum 0 equals big integer value of other
tests the equality of this rational with an int
private void simplify boolean started composed composed if composed if pieces size 0 pieces null composed false rect new rectangle else if pieces size 1 bounding box child bounding box pieces get first composed false if child null set to child else pieces clear else if pieces size 1 boolean changed false list iterator iter pieces list iterator 0 while iter has next if bounding box iter next area greater than 0 iter remove changed true if changed simplify if started composed composed init poly
call this after changing the rectangle in any way
public boolean is zero return bignum 0 equals big integer zero bignum 1 equals big integer zero
tests to see if the number is zero
static private int in out int inflag rational a hb rational b ha update inflag if a hb greater than 0 return p in else if b ha greater than 0 return q in else keep status quo return inflag
toggles in out flag
public bounding box set to bounding box other if other composed composed true if pieces null pieces new linked list else pieces clear iterator iter other pieces iterator while iter has next pieces add bounding box iter next clone else composed false if pieces null pieces null if other rect null rect x rect y rect width rect height 0 else if rect null rect x other rect x rect y other rect y rect width other rect width rect height other rect height else rect rectangle other rect clone bbox null return this
like an overloaded
public boolean is negative return bignum 0 compare to big integer zero 0
tests to see if the number is negative
public void set int x int y int width int height rect new rectangle x y width height init poly
sets code this code to refer to only the given bounding box
public boolean is positive return bignum 0 compare to big integer zero 0
tests to see if the number is positive
public string to string if composed return super to string return to string list of points
gets a string representation of the polygon
public bounding box copy if composed bounding box temp new bounding box temp set to this return temp else return new bounding box rect x rect y rect width rect height
like clone but returns the right type
public boolean less than int other return less than new rational other
checks to see if this is less than an int
public object clone return copy
copies the box es
public boolean greater than int other return this greater than new rational other
checks to see if this is greater than an int
public boolean greater than rational other return other less than this
checks to see if this is greater than another rational
public boolean contains pnt point if rect contains point point value if composed iterator iter pieces iterator bounding box temp while iter has next temp bounding box iter next if temp contains point return true return false else return true else return false
tests to see if any of the boxes contains the specified point
public boolean contains int x int y if bbox contains x y return contains new pnt x y else return false
tests to see if the point is within this region
public boolean less than equal to rational other return this greater than other
checks to see if this is less than or equal to another rational
public boolean greater than equal to rational other return this less than other
checks to see if this is greater than or equal to another rational
public boolean contains pnt point int length get number of verteces if length 1 return get vertex 0 equals point for int i 0 i length i pnt a get vertex i 1 pnt b get vertex i if util area sign a b point less than 0 return false return true
tests to see if the point is within this region
public string to string if composed string buffer s new string buffer append iterator iter pieces iterator while iter has next s append iter next s append return s to string else return rect x rect y rect width rect height
gets a parsable human readable version of the box es
public int compare to object o if o this return 0 else if o instanceof rational rational result new rational rational minus this rational o result return result is zero 0 result is positive 1 1 else double diff double value number o double value return diff 0 0 diff 0 1 1
compares to the other number
public double double value big integer quot and rem bignum 0 divide and remainder bignum 1 double retval quot and rem 0 double value quot and rem 1 quot and rem 1 multiply big integer value of integer max value divide bignum 1 retval quot and rem 1 double value integer max value return retval
gets the code double code approximation of this rational
public rational area if composed rational area new rational 0 iterator iter pieces iterator while iter has next rational plus area bounding box iter next area area return area else return new rational rect width rect height
calculates the area of the box es
public boolean equals object o if o this return true else if o instanceof bounding box bounding box other bounding box o if composed other composed return other rect equals rect else return area bounding box intersection this other area else return false
checks to see if the shapes are equal
public boolean equals object o if this o return true else if o instanceof circle circle other circle o return center equals other center other radius radius else return false
tests to see if this circle is the same one as the specified
public void set autopan boolean autopan this autopan autopan
turns on or off autopan
public pnt get center return new pnt center
returns the center of the circle
public string to string return center x center y radius
prints out the circle in the vi per format
public object clone return new circle this
copies the circle
public boolean contains pnt point component temp center minus point rational x distance sq new rational rational multiply temp x temp x x distance sq rational distance sq new rational rational multiply temp y temp y distance sq rational plus x distance sq distance sq distance sq return distance sq less than radius radius
tests to see if the given point is within the circle
public bounding box get bounding box return new bounding box center x int value radius center y int value radius radius 2 radius 2
gets the closest square surrounding the circle
public iterator get polys array list temp new array list 1 temp add this return temp iterator
gets all the component polygons of this set
public double area return math pi radius radius
approximates the area of the circle
public int int value return int math floor double value
gets the code int code approximation of this rational
public big integer floor return bignum 0 divide bignum 1
compute the floor as an integer
public void extend to contain bounding box other if composed other composed throw new arithmetic exception cannot extend composed bboxes rect x math min rect x other rect x rect width math max rect x rect width other rect x other rect width rect x rect y math min rect y other rect y rect height math max rect y rect height other rect y other rect height rect y bbox null
unions this with the specified box es and sets this to that union
public big integer ceiling big integer div and rem bignum 0 divide and remainder bignum 1 if div and rem 1 int value 0 return div and rem 0 return div and rem 0 add big integer one
compute the ceiling as an integer
public long long value return bignum 0 divide bignum 1 long value
gets the code long code approximation of this rational
public iterator get polys if composed return pieces iterator else array list temp new array list 1 temp add this return temp iterator
the get polys iterator returns a set of non overlapping polygons that
public rational negate bignum 0 bignum 0 negate return this
turns negates fraction upside down by negating its numerator
public rational reciprocate big integer temp bignum 1 bignum 1 bignum 0 bignum 0 temp if bignum 1 signum 0 bignum 0 bignum 0 negate bignum 1 bignum 1 negate return this
turns this fraction upside down by turning it to its reciprocal
public int get x if composed throw new arithmetic exception cannot get got composed bboxes return rect x
gets the x coordinate of the boxs origin
public rational abs bignum 0 bignum 0 abs bignum 1 bignum 1 abs return this
changes code this code to refer to its abolute value
public int get y if composed throw new arithmetic exception cannot get got composed bboxes return rect y
gets the y coordinate of the boxs origin
public rational square rational multiply this this this reduce needed to check for overflow return this
square a rational
public int get width if composed throw new arithmetic exception cannot get got composed bboxes return rect width
gets the width of the box
public int get height if composed throw new arithmetic exception cannot get got composed bboxes return rect height
gets the height of the box
public boolean equals object o if this o return true else if o instanceof attr config attr config ac attr config o return ac is dynamic is dynamic ac get attr type equals get attr type ac get attr name equals get attr name ac get params equals get params ac get default val null get default val null ac get default val equals get default val else return false
tests to see if this config is the same as the passed one
public boolean equals object o if o this return true else if o instanceof viper data viper data v viper data o if config info equals v get all configs sourcefiles mine this get sourcefiles node sourcefiles yours v get sourcefiles node return mine equals yours return false
checks to make sure that the viper data contains the same configuration
protected void drag activity step pinput event a event if autopan return auto pan a event
do auto panning even when the mouse is not moving
public rectangle get rectangle return rect
gets the original rectangle
public int hash code return config info hash code all files hash code
the xor of the hashes of the child nodes
public int hash code int h attr name hash code attr type hash code if is dynamic h h if params null h params hash code if default val null h default val hash code return h
returns a hash based on the name type
public int get rotation return 0
gets the rotation
public string to string return xml helper local name attr type attr name is dynamic static
returns the old skool gtf format
public pnt get centroid rational x new rational get x rational plus x new rational get width 2 x rational y new rational get y rational plus y new rational get height 2 y return new pnt x y
gets the center of the box
public boolean equals object o if this o return true else if o instanceof configs configs that configs o if this get number of children that get number of children iterator those that get children while those has next if config info contains those next return false return true else return false else return false
tests to see that the two viper schemata are equivalent
private void reset linked parent if this params instanceof linked attr value parser linked attr value parser this params set attr config this
updates the link to the current document root for relation type attributes
public boolean equals object o if this o return true else if o instanceof sourcefiles sourcefiles that sourcefiles o if this get number of children that get number of children for iterator iter get sourcefiles iter has next sourcefile curr sourcefile iter next media element rm curr get reference media string sf name rm get sourcefile name viper data that data viper data that get parent sourcefile compare to that data get sourcefile sf name if curr equals compare to return false return true return this get children equals sourcefiles o get children else return false
tests to see if the viper data set describes the
public int hash code return all files hash code
hashed on the file names
public object clone config impl i new config impl desc name desc type i attr nodes list linked list attr nodes clone iterator iter i attr nodes iterator while iter has next attr config impl ai attr config impl iter next ai parent i return i
returns a copy of this node unconnected to the parent but with
public boolean equals object o if this o return true else if o instanceof config config c config o if c get desc type get desc type c get desc name equals get desc name if c get number of children this get number of children return false else for iterator i this get attribute configs i has next if c has child attr config i next return false return true else return false else return false
checks to see that this descriptor class definition
public attr config cp parent config parent if parent this parent return this else attr config impl cp copy cp parent parent cp reset linked parent return cp
change the parent of this but since it is immutable returns the
public int hash code return get desc type get desc name hash code
since there can only be one of a given
public void set zoom double zoom amount instant where set zoom zoom amount where instant2pixel distance where
resets the zoom of the chronicle keeping the given instant at the same
public string to string return util get desc type get desc type get desc name
returns a old school gtf representation of the descriptor config
public viper data factory get type factory return type factory
gets the type name to valuewrapper object associated
public attr config cp attr name string name if name this attr name attr config impl cp copy cp attr name name return cp else return this
returns a copy with the new attribute name
public void set type factory viper data factory factory this type factory factory
sets the attribute value wrapper generator used while parsing
public int get attr config index attr config ac iterator iter attr nodes iterator int i 0 while iter has next if iter next equals ac return i throw new unknown attribute type exception unknown attribute for this ac
gets the index of the given config
public attr config cp attr type string str if this attr type str attr config impl cp copy cp attr type str return cp else return this
changes the attribute type by returning an altered copy
public viper data parse doc element e node list children e get child nodes viper data impl curr new viper data impl for int i 0 i children get length i node n children item i if n get node type node element node element child element children item i string tag n get node name trim if tag equals config parse config child curr else if tag equals data parse data child curr return curr
parses viper data from the given node
public int hash code return cfg hash code desc id
since the config and id together act as a primary key
public boolean is frame based return valid range is frame based
checks to see if the preferred instant type is
public attr config cp dynamic boolean val if this is dynamic val attr config impl cp copy cp is dynamic val return cp else return this
returns a new copy of the attribute config with the change
public string get old name return e get old name
gets the old name for the class of descriptors
public attr config cp default object o if this default val o attr config impl cp copy this default val this params set attribute value o cp return cp else return this
returns a copy of this with the default value changed
public string get new name return e get new name
gets the new name for the class of descriptors
public double get zoom amount if get view length 0 get minimum view length 0 return 0 return get view length get minimum view length
gets the current zoom ratio
public void set desc id int new id desc id new id
sets the descriptor id without generating an event
public int get ruler height return get underlay get ruler height
gets the hight of the ruler in pixels