input
stringlengths
10
828
output
stringlengths
5
107
public void test kmldatabase5 boolean exception has been thrown false try database file new database route new route new route new route set name trial route new route add new waypoint waypoint1 first waypoint 2 2 0 1000 new route add new waypoint waypoint2 second waypoint 2 7 2 5 0 2000 file add route new route gpxexporter exporter new gpxexporter exporter export to kml file export database2 kml end try catch exception e exception has been thrown true end catch assert equals exception has been thrown false end test kmldatabase5
test export5 test the kml exporter when you want to export a route
public void set specific request properties http urlconnection connection if is empty connection set do output true try connection set request method post catch protocol exception pe
prepares the code http urlconnection code for post requests
public proxy int port proxy function proxy function this my port port this proxy function proxy function this is transparent false
constructs a code proxy code object
public cookie string name string value url url this name name this value value string host url get host domain host substring host index of fixme path url get file should be the same as path url get path jdk 1 3 if path length 0 path
constructs a code cookie code object from two
public boolean is max forwarded string max forwards get header max forwards if max forwards null return false else if integer parse int max forwards 0 return true else return false
checks the max forwards header of the code http request code
public void set specific request properties http urlconnection connection get is the default case anyway guess we don t have to do anything here
get is the default case anyway we dont have to do anything here
private void send notification socket socket string message string request description proxy function send notification socket message request description
a call back function
public void decrement max forwards http urlconnection connection string max forwards get header max forwards if max forwards null int max forwards integer parse int max forwards if max forwards 0 connection set request property max forwards integer to string max forwards
decrements the max forwards header of this code http request code
private void process request http request http request socket socket proxy function process request http request socket
a call back function
public void set specific request properties http urlconnection connection try connection set request method put catch protocol exception pe
prepares the code http urlconnection code for put requests
public void set specific request properties http urlconnection connection decrement max forwards connection try connection set request method trace catch protocol exception pe
prepares the code http urlconnection code for trace requests
public void set specific request properties http urlconnection connection try connection set request method delete catch protocol exception pe
prepares the code http urlconnection code for delete requests
public request line string requests first line throws malformed urlexception control request false parse line requests first line
constructs a code request line code object from a string
public void set specific request properties http urlconnection connection try connection set request method head catch protocol exception pe
prepares the code http urlconnection code for head requests
private void parse line string line throws malformed urlexception string tokenizer line tokenizer new string tokenizer line this method line tokenizer next token string uri string line tokenizer next token this uri new url uri string if uri string equals http proxy on off uri string equals http proxy on off control request true this version line tokenizer next token
tokenizes a code string code into three tokens and stores them in this
public void set specific request properties http urlconnection connection decrement max forwards connection try connection set request method options catch protocol exception pe
prepares the code http urlconnection code for options requests
public boolean equals request line request line return this method equals request line get method this uri equals request line get url
two code request line code objects are equal iff their methods and their
void parse cookies int equal sign pos string token name value string cookie string get header cookie if cookie string null return string tokenizer cookie string tokenizer new string tokenizer cookie string while cookie string tokenizer has more tokens token cookie string tokenizer next token if equal sign pos token index of 0 name token substring 0 equal sign pos value token substring equal sign pos 1 cookies put name new cookie name value request line get url protected void parse cookies
parses the value of the cookie key in the code hashtable headers code
public boolean is toggle return request line is toggle
used by the code proxy code class to determine whether it should
private void write blank line output stream stream throws ioexception stream write n get bytes
writes a blank line to the stream
public void run try in order to avoid type code we use double dispatch switch call request handle method for this http request xrequest handle xrequest switch http request call request handle method for this catch switch exception se proxy function send notification client socket se get message http request get url to string catch ioexception ioe proxy function send notification client socket ioe get message http request get url to string
implements the code run code method of code runnable code
public boolean matches matchable matchable try return matches evidence matchable catch class cast exception e throw new runtime exception internal error in otherwise expression tried to match an otherwise expression instances against something else than an evidence instance
for a given code matchable code returns code true code if
public appel behavior get behavior throws invalid ruleset exception return rule evaluation result get behavior
returns the behavior chosen when creating this
public prompt behavior get prompt behavior throws invalid ruleset exception return rule evaluation result get prompt behavior
returns the prompt behavior i
public policy get policy that triggered the rule return rule evaluation result get policy that triggered the rule
returns fixme a copy of the policy
public string get explanation throws invalid ruleset exception return new string buffer appel rule append rule evaluation result get rule description append from ruleset append ruleset get description append fired to string string rule that fired description rule evaluation result get rule description string ruleset description ruleset get description if rule that fired description equals return rule that fired description if ruleset description equals string buffer avoids copy operations on strings i guess return new string buffer an appel rule from the ruleset append ruleset description append fired to string return an appel rule fired
returns a natural language explanation string suitable for user
public persona get persona return rule evaluation result get persona
returns the persona specifying the data repository to be accessed or
protected appel expression or rule element element this element element
called by the subclasses constructors
public string get description throws invalid ruleset exception string description attribute value get attribute value description attribute name return description attribute value null description attribute value
gets the natural language description of the ruleset
public iterator iterator return connected element and pcdata expressions iterator
returns a new code java
private boolean matches evidence evidence throws invalid ruleset exception return matches evidence get uri of the requested source
returns code true code iff
private void initialize contained request expressions throws invalid ruleset exception contained request expressions new connected request expressions this
does the late initialization for the member
public shall prompt string prompt message appel behavior behavior this prompt message null please decide what to do prompt message fixme concept what will the buttons have as texts yes no block request
creates a new code shall prompt code instance
private appel behavior string string representation this string representation string representation
creates a new code appel behavior code instance
private shall prompt string prompt message this prompt message prompt message
creates a new code shall prompt code instance
public url get references base uri return references base uri
returns the base uri for data element references within enclosed
public uri get uri of the requested source return uri of the requested source
gets the uri of the requested source attribute of the evidence object
private string get attribute value string name throws invalid ruleset exception return get root element get attribute value name
returns the value of the attribute code name code if present if
public string to string return pcdata expression string
returns a string representation
public shant prompt
creates a new code shant prompt code instance
public boolean has been matched exactly return true
returns code true code iff the code evidence code object
private string get referenced data element return p3p namespaces get p3 pattribute value get element data ref attribute name
returns the name of the referenced data element as called in the
public appel behavior get behavior throws invalid ruleset exception string behavior attribute value get attribute value within namespace of the rule element behavior attribute name if p3 plogger is debug enabled p3 plogger debug rule attributes element get attributes if p3 plogger is debug enabled p3 plogger debug behavior attribute value behavior attribute value if behavior attribute value null throw new invalid ruleset exception no behavior attribute with correct namespace in rule return appel behavior get for string behavior attribute value
gets the behavior that shall be exhibited when this rule fires
protected string get name return attribute get name
returns the attributes name without namespace namespace prefix
public context policy reference pr string locators this policy reference pr this locators locators
straight forward construction of an code context code object
public prompt behavior get prompt behavior throws invalid ruleset exception return prompt behavior get for prompt attribute values get attribute value within namespace of the rule element prompt attribute name get attribute value within namespace of the rule element promptmsg attribute name get behavior
gets the prompt behavior that shall be exhibited when this rule fires
private string convert to java script writable string message if message null return no message availiable else return message replace n replace
replaces crlf and in the message
public java script date date string message string url string string function name this date date this message convert to java script writable message this name function name this url string url string
a straight forward constructor
protected void initialize contained p3p element expressions throws invalid ruleset exception contained p3p element expressions new connected p3p element and pcdata expressions this
does the late initialization for the member
public string to string return script language javascript n function name n win stats toolbar no location no directories no menubar no n win stats scrollbars yes width 350 height 175 n floater window open win stats n floater document open n floater document writeln body bgcolor yellow n floater document writeln h4 this message was generated by your p3 p appel user agent this date while processing request this url string h4 hr n floater document writeln h3 this message h3 n floater document writeln body n floater document close n n script
does the actual work
public string get description string description attribute value get attribute value within namespace of the rule element description attribute name return description attribute value null description attribute value
returns a natural language descrption of the rule taken
protected string get value return attribute get value
returns the attributes value might be null i guess
public persona get persona string persona attribute value get attribute value within namespace of the rule element persona attribute name if persona attribute value null return null else return new persona persona attribute value
returns this rules persona or code null code if no persona is specified
private boolean matches default value do the simplest thing that could possibly work simple int total number of default values default value table length for int i 0 i total number of default values i if my p3p element expression get name equals default value table i 0 get name equals default value table i 1 return value matches default value table i 2 there is no default value return false
returns code true code iff the attribute this
private policy get policy that triggered the rule evidence evidence return evidence get policy
gets the policy
private connected top level expressions get contained expressions throws invalid ruleset exception if contained expressions null initialize contained expressions late initialization return contained expressions
returns the top level expressions contained in this rule
public void set has been matched has been matched flag true
sets the code pcdata code instance to the
public string get policy location for request http request http request match object request new match object http request return get policy location request
returns the value of the code about code attribute of the
public string to string return pcdata string
returns a string representation
public void reset exact matching info set has not been matched
resets the information which is stored during the matching process
public string get policy location for cookie http request http request cookie cookie cookie match object cookie match object new cookie match object http request cookie return get policy location cookie match object
returns the value of the code about code attribute of the
public boolean has been matched exactly though not really seeming sensible for one object this has to be provided for implementing matchable return has been matched
returns code true code iff the code pcdata code object
private string get attribute value within namespace of the rule element string name return appel namespaces get appel attribute value element name
returns the value of the attribute appel code name code if present if
public boolean has been matched return has been matched flag
returns code true code iff the code pcdata code object
private void set has not been matched has been matched flag false
resets the code pcdata code instance to the
private boolean is recent http request http request document method call is recent try date now new date result recent result result recent requests get http request if recent result null return false else if recent result get expiry date before now recent requests remove http request return false else return true finally print done is recent private boolean is recent http request http request
checks the hashtable code recent requests code whether there is code result code
protected void file2dom file file throws jdomexception fixme shouldn t this method do some validation against an up to date schema or dtd document method call file2dom saxbuilder sax builder new saxbuilder jdom sax builder build file root element jdom get root element my namespace root element get namespace print done file2dom
reads a xml file a code java
private url locator string2 url string locator string host try if locator starts with http return new url locator else if locator starts with return new url file host locator file means this is an inline policy fixme does not seem adequate shouldn t this be the url on the net else if locator starts with return new url http host locator else return new url http host locator catch exception e if p3 plogger is debug enabled p3 plogger debug e get message return null private url locator string2 url string locator string host
turns a code string code into an code java
public expiry date get expiry date document method call get expiry date print done get expiry date return expiry date
returns the expiry date of this document
public document get jdom document method call get jdom print done get jdom return jdom
returns the underlying document
private void initialize contained expressions throws invalid ruleset exception contained expressions new connected top level expressions this
does the late initialization for the member code contained elements code
public iterator iterator return p3p elements and pcdatas iterator
returns a new code java
private result last decision http request http request document method call last decision print done last decision return result recent requests get http request
returns the last result for an http request
public void reset exact matching info iterator iterator iterator behold that this external iterator is indendent from other external iterators while iterator has next containable within ap3p element iterator next reset exact matching info
resets the information which is stored during the matching process
public boolean has been matched exactly iterator iterator iterator behold that this external iterator is indendent from other external iterators boolean res true while iterator has next containable within ap3p element next containable within ap3p element iterator next if p3 plogger is debug enabled p3 plogger debug testing next if it has been matched n res res next has been matched exactly attention dangerous actually here was res res next has been matched which can result in a infinite loop due to the short cut evalution semantics return res
returns code true code iff the code contained p3p elements code object
private boolean have valid policy url url document method call have valid policy date now new date try policy policy policy my policies get url if policy null return false else if policy get expiry date before now my policies remove url return false else return true finally print done have valid policy private boolean have valid policy url url
tests whether the hashtable code my policies code holds a
private void register http request http request result result document method call register print done register recent requests put http request result
registers a code http request code object and its code result code object
private boolean name equals name of p3p element p3p element optimize p3 p policy editor writes out ident contact instead of ident contact as standardized should this be considered here return p3p element has equal name get name
returns true iff the names
public p3p element get root p3p element throws invalid policy exception return p3p element create for element root element this
returns the policys root element as a code org
public policy collection file file url url throws p3 pdocument not constructable exception try this url url file2dom file handle expiry fill policies table catch jdomexception jdome throw new p3 pdocument not constructable exception jdome get message catch expiry in the past exception e throw new p3 pdocument not constructable exception e get message catch unparsable expiry element exception e throw new p3 pdocument not constructable exception e get message constructor
constructs a code policy collection code object from a file
private boolean attributes match p3p element p3p element throws invalid ruleset exception return get p3p attribute expressions match p3p element get attributes
returns true iff each attribute of this p3 p element
public policy collection element root element url url throws p3 pdocument not constructable exception document method call constructor this jdom new document root element this root element this jdom get root element this my namespace this root element get namespace this url url try handle expiry fill policies table catch expiry in the past exception e throw new p3 pdocument not constructable exception e get message catch unparsable expiry element exception e throw new p3 pdocument not constructable exception e get message finally print done constructor constructor
constructs a code policy collection code object from a code org
private boolean host recently visited string host document method call host recently visited try policy reference policy reference policy reference my policy references get host if policy reference null return false else if policy reference get expiry date before new date my policy references remove host return false else return true finally print done host recently visited private boolean host recently visited string host
tests whether the hashtable code my policy references code holds a
private void handle expiry throws expiry in the past exception unparsable expiry element exception element expiry element this root element get child expiry my namespace if expiry element null this expiry date new expiry date else this expiry date new expiry date expiry element
extracts the expiry date and stores it in code this
private void fill policies table list policy elements this root element get children policy my namespace iterator itr policy elements iterator while itr has next element policy element element itr next string name policy element get attribute value name custom data schema retriever data schema retriever new simple data schema retriever fixme change this for custom schema support policies put name new policy policy element this expiry date this url data schema retriever private void fill policies table
builds new code policy code objects from all code policy code elements
public policy get policy by name string name throws no such policy exception if name null policy policy policy policies get name if policy null throw new no such policy exception there is no policy called name else return policy else throw new null pointer exception null string as name of a policy provided this typically happens when a prf specifies a uri which wrongly lacks an anchor that is the name of the policy
returns the code policy code object if any found in code policies code
public string get referenced data element return p3p namespaces get p3 pattribute value get element data ref attribute name
returns the name of the referenced data element as called in the
public p3p elements and pcdatas get contained p3p elements throws invalid policy exception if contained p3p elements null initialize contained p3p elements late initialization if p3 plogger is debug enabled p3 plogger debug contained p3p elements returned contained p3p elements return contained p3p elements
returns the p3 p elements contained within this
private void initialize p3p attribute expressions throws invalid ruleset exception p3p attribute expressions new p3p attribute expressions this
does the late initialization for the member
private void remove explicit categories string p3p namespace uris p3p namespaces get p3p namespace uris for int i 0 i p3p namespace uris length i get element remove children categories element name namespace get namespace p3p namespace uris i
removes all categories subelements of this data element
private void insert explicit categories categories categories element categories element create categories element for categories get element add content categories element
inserts the given categories as subelements of a newly created categories
public category string name this name name
creates a new code category code instance
public explained category string name string explanation super name this explanation explanation
creates a new code explained category code instance
public element as element namespace namespace return new element get name namespace
returns an xml element representing this category
static private url get p3p base data schema uri try return new url data schema p3 p base data schema uri string catch malformed urlexception e throw new runtime exception internal error in class p3p data schema n data schema p3 p base data schema uri string was no valid url string
returns a code url code for the p3 p base data schema
private void ensure explicit categories throws invalid policy exception categories explicit categories new categories get element if explicit categories is empty throw new invalid policy exception no categories given for variable category data element get referenced data element if p3 plogger is debug enabled p3 plogger debug categories for variable category data element get referenced data element explicit categories
ensure that this data element supposed to be a variable data element
public element as element namespace namespace return new element get name namespace add content get explanation pcdata content
returns an xml element representing this category and its
public categories element data or data def or data struct element categories create list of the categories data or data def or data struct element
creates a new code categories code instance contained within
public categories categories new array list
creates a new code categories code instance which contains
private element create categories element for categories categories namespace data element namespace get element get namespace element res new element categories element name data element namespace iterator iterator categories iterator while iterator has next category category category iterator next res add content category as element data element namespace try xmloutputter outputter new xmloutputter if p3 plogger is debug enabled p3 plogger debug generated categories element outputter output string res catch ioexception e if p3 plogger is debug enabled p3 plogger debug ioexception occurred when outputting xml element n return res
returns a categories element containing the categories