input
stringlengths
10
828
output
stringlengths
5
107
public void remove method defmethod m get methods remove m protege defmethod retire method m
remove a method for this generic function
public void event happened jess event je throws jess exception if je get type jess event clear 0 constructs list clear selection todo bug in jess the following does not work because clear resets the mask engine add jess listener this int mask engine get event mask jess event clear engine set event mask mask
called when jess events occur
public void save traverse the jess definitions instances of jess definition and adjusts the set included flag according to saveability cls jess def jess tab get cls kb jess tab system classes jess definition if jess def null for iterator i jess def get instances iterator i has next instance inst instance i next inst set included jess tab system classes is saveable inst
called when the kb is about to be saved
final public void set focus m tf request focus
move focus to the input area
protected iterator list constructs return get engine list deftemplates
get a list of the jess constructs
protected string get name object o return deftemplate o get name
get the name of a jess construct
protected instance get instance object val if val instanceof deftemplate return jess tab system classes get instance deftemplate val return null
get the protege instance for a jess construct
public void kill stop flg true interrupt
kill the jess engine thread
public void add argument string name list class names int type throws jess exception if m has wildcard throw new jess exception defmessagehandler add argument the message handler this already has a wildcard argument name m arguments add new argument name class names type if type ru multivariable m has wildcard true
add a formal argument to this defmessage handler
public void add action funcall fc throws jess exception m actions add new funcall value fc
add an action to this deffunction
public void add value value val m actions add val
add a simple value to this deffunction
public void link fact type fact fact instance inst throws jess exception fact set slot value get isa slot name new value inst get direct type get name ru symbol fact set slot value get isa name slot name new value inst get direct type get name ru string
link a protege instance to a jess fact
private void delete generic function final defgeneric gf context context userfunction old gf get old function if old null context get engine add userfunction old else context get engine add userfunction new userfunction add dummy function to delete public string get name return gf get name public value call value vector vv context context throws jess exception throw new jess exception get name unimplemented function get name jess tab broadcast event jess tab event defgeneric jess tab event removed context get engine gf
delete the generic function by overwriting it with another function
private void print methods print writer strm defgeneric gf collection methods gf get methods for iterator j methods iterator j has next print method strm defmethod j next
print the methods of a generic function
private void print enter handler print writer strm defmessagehandler h for int i 0 i indent i strm print strm println h get name h get type name in class h get cls get name indent
print handler entry
private void print exit handler print writer strm defmessagehandler h indent for int i 0 i indent i strm print strm println h get name h get type name in class h get cls get name
print handler exit
public void remove frame listener frame o frame listener frame listener frame listener frame listeners get o if frame listener null frame listeners remove o o remove frame listener frame listener
remove frame listeners for a frame or typically instance
public void remove instance listener instance o instance listener instance listener instance listener instance listeners get o if instance listener null instance listeners remove o o remove instance listener instance listener
remove instance listeners for an instance
public void remove cls listener cls o cls listener cls listener cls listener cls listeners get o if cls listener null cls listeners remove o o remove cls listener cls listener
remove cls listeners for a protege class
private boolean is variable value val try return val type ru variable val variable value null equals ignore case variable catch jess exception ex return false
utility method that returns true of the value represents variable
public void test main object args new teste recupera o de clientes
script name b teste sanidade b
private bundle get bundle by id string id bundle bundle null try long id number long parse long id bundle bundle context get bundle id number catch number format exception nfe ignore return bundle
get a bundle identified by an id number
private void tail final buffered reader reader throws interrupted exception ioexception if number of lines 1 number of lines default number of lines if sleep interval 1 sleep interval default sleep interval linked list string lines new linked list string string line while line reader read line null lines add line if lines size number of lines lines remove first for string l lines system out println l if command is running as continuous while continuous thread sleep sleep interval while line reader read line null system out println line
prints the tail of the file url
public void release action action action throws exception do nothing by default stateful
release the used action
public reified type get actual type argument int i return all
access to a type argument
public void set strict final boolean strict this strict strict
if true a completion at argument index n will only succeed
public style bold unclean a intensity bold return this
mark text as bold
public style italic unclean a italic return this
mark text as italic
public style color color c unclean fg c return this
sets text color
public style background color c unclean bg c return this
sets background color
public boolean is delimiter final string buffer final int pos return is escaped buffer pos is delimiter char buffer pos
returns true if the specified character is a whitespace
public style inverse unclean a negative on return this
change foreground with background
public style invisible unclean a negative on return this
mark text as invisible
public boolean is clean return clean
is any values was set
public string apply string text return new ansi style a text reset to string return
apply style to given text
private ansi unclean clean false return style
sets dirty flag and return ansi object
public boolean is delimiter char string buffer int pos return character is whitespace buffer char at pos
the character is a delimiter if it is whitespace and the
protected file get history file string default history path new file system get property user home karaf karaf history to string return new file system get property karaf history default history path
subclasses can override to use a different history file
protected console create console command processor impl command processor input stream in print stream out print stream err terminal terminal throws exception return new console command processor in out err terminal null
allow sub classes of main to change the console implementation used
public boolean is multi scope mode return true
returns whether or not we are in multi scope mode
public void set echo character final character c this echo character c
set the echo character
public character get echo character return echo character
returns the echo character
private string last line string str if str null return int last str last index of n if last 0 return str substring last 1 str length return str
returns the text after the last n
private void put char final int c final boolean print throws ioexception buf write char c if print if mask null no masking print c else if mask null mask don t print anything else print mask draw buffer newline at wrap
output the specified character both to the buffer and the output stream
private void draw buffer final int clear throws ioexception debug draw buffer clear if buf cursor buf length clear 0 return char chars buf buffer substring buf cursor to char array if mask null arrays fill chars mask print chars clear ahead clear if terminal is ansi supported if chars length 0 don t ask it works back math max chars length 1 1 else back chars length flush
redraw the rest of the buffer from the cursor onwards
private void draw buffer throws ioexception draw buffer 0
redraw the rest of the buffer from the cursor onwards
private void clear ahead final int num throws ioexception if num 0 return if terminal is ansi supported print ansi sequence k return print blank extra characters print num we need to flush here so a clever console doesn t just ignore the redundancy of a space followed by a backspace flush reset the visual cursor back num flush
clear ahead the specified number of characters without moving the cursor
private void back final int num throws ioexception if num 0 return if terminal is ansi supported int width get terminal get width int cursor get cursor position debug back cursor num on width int curr row cursor num width int new row cursor width int new col cursor width 1 debug old row curr row new row new row if new row curr row print ansi sequence curr row new row a print ansi sequence new col g return print backspace num flush
move the visual cursor backwards without modifying the buffer cursor
private int backspace final int num throws ioexception if buf cursor 0 return 0 int count 0 int termwidth get terminal get width int lines get cursor position termwidth count move cursor 1 num 1 buf buffer delete buf cursor buf cursor count if get cursor position termwidth lines if terminal is ansi supported debug doing backspace redraw get cursor position on termwidth lines print ansi sequence k draw buffer count return count
issue em num em backspaces
public boolean backspace throws ioexception return backspace 1 1
issue a backspace
public int move cursor final int num throws ioexception int where num if buf cursor 0 where 0 return 0 if buf cursor buf buffer length where 0 return 0 if buf cursor where 0 where buf cursor else if buf cursor where buf buffer length where buf buffer length buf cursor move internal where return where
move the cursor i where i characters
private int clear echo final int c throws ioexception if the terminal is not echoing then ignore if terminal is echo enabled return 0 otherwise clear int num count echo characters char c back num draw buffer num return num
clear the echoed characters for the specified character code
private string builder get printable characters final char ch string builder sbuff new string builder if ch 32 if ch 127 sbuff append ch else if ch 127 sbuff append sbuff append else sbuff append m sbuff append if ch 128 32 if ch 128 127 sbuff append char ch 128 else sbuff append sbuff append else sbuff append sbuff append char ch 128 64 else sbuff append sbuff append char ch 64 return sbuff
return the number of characters that will be printed when the specified
public string read line throws ioexception return read line string null
read the next line and return the contents of the buffer
public string read line final character mask throws ioexception return read line null mask
read the next line with the specified character mask
public void fill detail record list string colums int size for int i 0 i size i colums add
method that creates an empty list of string that serves as detail record
private string read line final input stream in throws ioexception string builder buff new string builder if skip lf skip lf false int i stream buffer is empty in read stream buffer remove 0 if i 1 i r return buff to string else if i n ignore else buff append char i while true int i stream buffer is empty in read stream buffer remove 0 if i 1 i n return buff to string else if i r skip lf true return buff to string else buff append char i
read a line for unsupported terminals
public boolean add completer final completer completer return completers add completer
add the specified
public void add string url boolean should start running get watch urls size 0 if watch urls contains url watch urls add url counter increment and get if should start thread thread new thread this thread start
adds a bundle urls to the watch list
public void remove string url watch urls remove url counter increment and get
removes a bundle urls from the watch list
protected void set config property string key string value throws ioexception boolean done false for int i 0 i get config size i if get config get i starts with key get config set i java lang string format s s key value done true if done get config add get config add java lang string format s s key value new date
set a new key and value in the etc config
public boolean remove completer final completer completer return completers remove completer
remove the specified
public file get bundle external location file local repository bundle bundle try parser p new parser bundle get location substring 4 return new file local repository get path file separator p get artifact path catch malformed urlexception e logger error could not parse artifact path for bundle bundle get symbolic name e return null
returns the location of the bundle inside the local maven repository
protected void remove config property string key throws ioexception for int i 0 i get config size i if get config get i starts with key get config remove i
remove an existing key from the etc config
protected boolean wild card match string text string pattern string cards pattern split iterate over the cards for string card cards int idx text index of card card not detected in the text if idx 1 return false move ahead towards the right of the text text text substring idx card length return true
matches text using a pattern containing wildcards
public void stop running set false
stops the execution of the thread and releases the singleton instance
public node add child t value node node new node value this children add node return node
adds a child to this node
public boolean has ancestor t value if parent null return false else return value equals parent value parent has ancestor value
check if the node has an ancestor that represents the given value
private boolean complete throws ioexception debug tab for buf if completers size 0 return false list char sequence candidates new linked list char sequence string bufstr buf buffer to string int cursor buf cursor int position 1 for completer comp completers if position comp complete bufstr cursor candidates 1 break return candidates size 0 get completion handler complete this candidates position
use the completers to modify the buffer with the appropriate completions
public void run synchronized this started true finished false finish false final byte buf new byte buffer size int length try while length in read buf 0 finish out write buf 0 length if autoflush out flush out flush catch exception e synchronized this exception e finally if close when exhausted try out close catch ioexception e finished true synchronized this notify all
copies data from the input stream to the output stream
public void waiting for shutdown int delay wrapper manager signal stopping delay
call back method is called by the
public void start if output pump null thread thread new thread output pump thread set daemon true thread set name output pump for this name thread start if error pump null thread thread new thread error pump thread set daemon true thread set name error pump for this name thread start if input pump null thread thread new thread input pump thread set daemon true thread set name input pump for this name thread start
start pumping the streams
public void stop if output pump null try output pump stop output pump wait for catch interrupted exception e ignore if error pump null try error pump stop error pump wait for catch interrupted exception e ignore if input pump null input pump stop try err flush catch ioexception e try out flush catch ioexception e
stop pumping the streams
protected void create child output pump final input stream in final output stream out assert in null assert out null output pump create pump in out
create the pump to handle child output
protected void create child error pump final input stream in final output stream out assert in null assert out null error pump create pump in out
create the pump to handle error output
protected stream pumper create pump final input stream in final output stream out final boolean close when exhausted assert in null assert out null stream pumper pumper new stream pumper in out close when exhausted return pumper
creates a stream pumper to copy the given input stream to the
public void set history enabled final boolean enabled this history enabled enabled
whether or not to add new commands to the history buffer
public boolean is history enabled return history enabled
whether or not to add new commands to the history buffer
private boolean move history final boolean next throws ioexception if next history next return false else if next history previous return false set buffer history current return true
move up or down the history tree
private void print final int c throws ioexception if c t char chars new char tab width arrays fill chars out write chars return out write c
output the specified character to the output stream without manipulating the current buffer
public void execute throws mojo execution exception mojo failure exception try prepare uri uri file to uri repository repository new repository impl uri schema check repository uri analyze repository validate repository catch exception e throw new mojo execution exception string format unable to validate s s file get absolute path e get message e
the mojos main method
private void schema check repository repository uri uri try info validation of s uri feature validation util validate repository get uri catch exception e error failed to validate repository s schema validation fails fix errors to continue validation e uri
checks feature repository with xml schema
private void print final char buff throws ioexception int len 0 for char c buff if c t len tab width else len char chars if len buff length chars buff else chars new char len int pos 0 for char c buff if c t arrays fill chars pos pos tab width pos tab width else chars pos c pos out write chars
output the specified characters to the output stream without manipulating the current buffer
private int delete final int num throws ioexception todo try to use jansi for this commented out because of dwa 2949 if buf cursor 0 return 0 buf buffer delete buf cursor buf cursor 1 draw buffer 1 return 1
issue em num em deletes
public boolean kill line throws ioexception int cp buf cursor int len buf buffer length if cp len return false int num buf buffer length cp clear ahead num for int i 0 i num i buf buffer delete char at len i 1 return true
kill the buffer ahead of the current cursor position
public boolean clear screen throws ioexception if terminal is ansi supported return false send the ansi code to clear the screen print ansi sequence 2 j then send the ansi code to go to position 1 1 print ansi sequence 1 1 h redraw line return true
clear the screen by issuing the ansi clear screen code
public void beep throws ioexception if is bell enabled print keyboard bell need to flush so the console actually beeps flush
issue an audible keyboard bell if
private string extract protocol from local maven repo try return new url local repo get url get protocol catch malformed urlexception e basically this should not happen if it does though cancel the process throw new runtime exception repository url is not valid e
required because maven 3 returns null in
public void save throws exception output stream close
closes archive handle
public void create dump string name throws exception create dump false name
creates dump witch given name
public void create dump dump destination destination throws exception file log dir new file data log file list files log dir list files ok that s not the best way of doing that for file file list files file input stream input stream new file input stream file output stream output stream destination add log file get name copy input stream output stream
attach log entries from directory
private void copy input stream input stream output stream output stream throws ioexception byte buffer new byte 4096 int n 0 while 1 n input stream read buffer output stream write buffer 0 n
rewrites data from input stream to output stream
public void start super activate bundle context this class loader this get class get class loader this logger info label plugin activated
blueprint lifecycle callback methods
public void reset prompt line string prompt string buffer int cursor dest throws ioexception move cursor to end of line move to end backspace all text including prompt buf buffer append this prompt buf cursor this prompt length this prompt backspace all this prompt prompt redraw line set buffer buffer move cursor to destination 1 will move to end of line if cursor dest 0 cursor dest buffer length set cursor position cursor dest flush
erases the current line with the existing prompt then redraws the line
public int search backwards string search term int start index return search backwards search term start index false
search backward in history from a given position
public int search backwards string search term return search backwards search term history index
search backwards in history from the current position
private boolean is delimiter final char c return character is letter or digit c
checks to see if the specified character is a delimiter
protected void schedule runnable service service event event service reference reference event get service reference runnable service runnable bundle context get service reference string id string reference get property karaf timer task id property string period value string reference get property karaf timer task period property if period value null long period long parse long period value karaf timer task task new karaf timer task id service period scheduler schedule task
schedules the execution of the runnable service of the
protected void unschedule runnable service service event event service reference reference event get service reference string id string reference get property karaf timer task id property scheduler unschedule id
unschedules the execution of the runnable service of the
protected void refresh url features service admin string url throws exception try uri uri new uri url admin remove repository uri admin add repository uri catch exception e system out println could not refresh feature repository n e get message get chance to restore previous fix for karaf 4 admin restore repository new uri url
refreshes the url