id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
833348e6-7894-4ea4-8817-673121615438 | public void processTry(int number); |
83159bc2-f9c2-4348-87f5-f786ed16d9a5 | public void setPresenterImpl(PresenterInterface presenterImpl) {
this.presenterImpl = presenterImpl;
} |
33bc446a-4766-4b3e-91e0-13148413b5d5 | abstract public Parent getViewRoot(); |
d7ad0391-31f9-4512-a585-0844b612d587 | @Override
public void initialize(URL url, ResourceBundle resourceBundle) {
attempts = tryHistory.getItems();
// ustawić w scene builderze dla przycisku nazwe _New game i wtedy ponizsze zadziala jako skrot alt-n,
// jesli sie nie myle to bedzie wywolane to co jest w SB w onAction lub ustawio... |
50597a6b-aca9-4aa1-b4e6-afcfc1846a67 | @Override
public Parent getViewRoot() {
return root;
} |
6001a818-0299-4d11-9432-438221b0e024 | @FXML
private void handleTextField() {
Integer n = null;
try {
n = Integer.parseInt(number_textfield.getText());
} catch (NumberFormatException e) {
return;
}
presenterImpl.processTry(n);
} |
118f9e08-64c9-4241-b92a-916caa9527ee | public void setFieldsActive(boolean state) {
number_textfield.clear();
number_textfield.setEditable(state);
number_textfield.setDisable(!state);
} |
f67e7d1e-94ba-4140-b223-12dfbffb7a9f | public void clearAtteptsHistory() {
attempts.clear();
} |
6a376cd6-5e55-4606-8e27-5f3f81442c3d | public void showInfo(String msg) {
info_label.setText(msg);
} |
2cc81db2-5e83-4e95-a927-b480a9093ea8 | public void addTryHistory(String m) {
attempts.add(m);
tryHistory.scrollTo(attempts.size());
} |
8815eeb4-ddbc-4ebd-8367-8f61fb4f01d4 | @FXML
private void handleKoniec() {
presenterImpl.applicationExitShowConfirmDialog();
} |
ad807110-7a9e-46e4-90f5-ba31d6139d57 | @FXML
private void handleNewGame() {
presenterImpl.newGame();
} |
4eac007d-60aa-4ddf-933a-a37df0aa1a54 | public void animate() {
// bNewGame.toFront();
bNewGame.getTransforms().add(new Shear(0.7, 0));
scaleTransition = ScaleTransitionBuilder.create()
.node(bNewGame)
.duration(Duration.seconds(2))
.toX(3)
.toY(3)
.cycleCo... |
08199327-64ab-4fce-bd77-71742317a0e1 | public CloseAppDialog(Stage owner, String title){
root = new BorderPane();
stage = this;
this.owner = owner;
initModality( Modality.APPLICATION_MODAL );
initOwner( owner );
initStyle( StageStyle.UTILITY );
setTitle( title );
setContents();
} |
843ad84b-524d-4282-9e07-636572058386 | public void setContents(){
Scene scene = new Scene(root,150,150);
setScene(scene);
Group groupInDialog = new Group();
groupInDialog.getChildren().add( new Label("Really Exit ?") );
root.setCenter( groupInDialog );
Button yes = new Button( "Yes" );
yes.setOnAct... |
8f787062-45b6-4b33-89aa-9290f4ac802b | @Override
public void handle(ActionEvent paramT) {
buttonOkPressed=true;
stage.close(); // Closing the pop up.
// owner.close(); // Closing the parent stage also.
presenterImpl.applicationExit();
} |
a84f453d-c04f-4e2a-b60d-28e250f5e922 | @Override
public void handle(ActionEvent paramT) {
buttonOkPressed=false;
stage.close(); // Closing the pop up only
} |
e8caff04-0fbf-4668-8191-17bdaff0d227 | public boolean isButtonOkPressed() {
return buttonOkPressed;
} |
f53eb62a-b312-450c-8127-f3d0cfd1fdf7 | @Override
public Parent getViewRoot() {
return root;
} |
ab0aef62-3d15-4704-b21e-c62212ee3c87 | public void uploadAndUnzipFile (String directory,String uploadFile,String deployModel)
{
FileUpload fu = new FileUpload();
ChannelSftp sftp=fu.connect(server_ip, server_port, user_name, password);
System.out.println("开始上传文件");
fu.upload(directory, uploadFile, sftp);
System.... |
071dac3d-6a5e-4f82-aa39-c653457d4531 | public FileUploadThread (String directory,String uploadFile,String deployModel) {
this.directory = directory;
this.uploadFile = uploadFile;
this.deployModel = deployModel;
} |
e4819c7c-3fec-4881-b775-ed4cc373bb32 | public void run() {
try {
Thread.sleep(5000);
new AutoDeployment().uploadAndUnzipFile(directory,uploadFile,deployModel);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
86be47e1-7784-4f9e-93d9-d7888e2ece0b | public String getSERVER_IP() {
return SERVER_IP;
} |
55a1b9b6-9dee-4fa6-a459-a1711c569ac4 | public void setSERVER_IP(String SERVER_IP) {
this.SERVER_IP = SERVER_IP;
} |
120d5ac9-8a54-4d83-a784-48e6bd881f2c | public String getSERVER_POR() {
return SERVER_POR;
} |
e1607c7a-6fa6-46b6-b51f-8d7700bd5f2d | public void setSERVER_POR(String SERVER_POR) {
this.SERVER_POR = SERVER_POR;
} |
1b6738af-86e6-428e-b8b7-982dd72ecb36 | public String getUSER_NAME() {
return USER_NAME;
} |
28beb537-0fa2-4801-85bf-77123344679a | public void setUSER_NAME(String USER_NAME) {
this.USER_NAME = USER_NAME;
} |
6e3e383f-c7a1-4f90-83a3-b75a5ce8b825 | public String getPASSWORD() {
return PASSWORD;
} |
bd06bf86-b869-4157-a4bb-053a0cf06be0 | public void setPASSWORD(String PASSWORD) {
this.PASSWORD = PASSWORD;
} |
5fe7138c-28f8-4ab5-878d-8dc7b78fc25a | public Connection establishConnection(String server_ip){
Connection conn = null;
try {
conn = new Connection(server_ip);
conn.connect(); // 连接
}
catch (IOException e) {
e.printStackTrace();
}
finally {
}
return co... |
afad7f74-7e7a-4c9a-9459-bcd4a71d5761 | public int unZipFile(Connection conn,String user_name,String password,String filename,String directory,String deployModel){
Session session = null;
int ret = -1;
try {
if (conn.authenticateWithPassword(user_name, password)) { // 认证
session = conn.openSession(); ... |
d21c9f72-d3bd-4b84-afbc-3d606a44ea4e | public static void main (String args[]) throws Exception {
SystemParam param = new SystemParam();
param.setSERVER_IP("10.1.30.5");
param.setSERVER_POR("22");
param.setUSER_NAME("weblogic");
param.setPASSWORD("weblogic");
XMLEncoder encoder = new XMLEncoder(
... |
03a9fd16-9492-44ac-85e4-bbe6cf61dc77 | public static boolean isNumeric(String str){
Pattern pattern = Pattern.compile("[0-9]*");
return pattern.matcher(str).matches();
} |
a0c6bb9c-c635-47ec-a858-19eafac83770 | public FileProgressMonitor(long fileSize) {
this.fileSize = fileSize;
} |
311b8770-b4fb-4ced-9f51-9b231336eb31 | @Override
public void run() {
if (!isEnd()) { // 判断传输是否已结束
System.out.println("Transfering is in progress.");
long transfered = getTransfered();
if (transfered != fileSize) { // 判断当前已传输数据大小是否等于文件总大小
System.out.println("Current transfered: " + transfered + ... |
fa652784-7e4e-4709-aa35-3163ec199e74 | public void stop() {
System.out.println("Try to stop progress monitor.");
if (timer != null) {
timer.cancel();
timer.purge();
timer = null;
isScheduled = false;
}
System.out.println("Progress monitor stoped.");
} |
a28f038c-92ca-4d31-a4bd-6108bb9a1950 | public void start() {
System.out.println("Try to start progress monitor.");
if (timer == null) {
timer = new Timer();
}
timer.schedule(this, 1000, progressInterval);
isScheduled = true;
System.out.println("Progress monitor started.");
} |
626f2a27-a8b4-4e33-91c5-c1bc9d8d5f55 | private void sendProgressMessage(long transfered) {
if (fileSize != 0) {
double d = ((double)transfered * 100)/(double)fileSize;
DecimalFormat df = new DecimalFormat( "#.##");
System.out.println("Sending progress message: " + df.format(d) + "%");
} else {
... |
9f7d1f39-547f-4b61-80e7-67371cc448e8 | public boolean count(long count) {
if (isEnd()) return false;
if (!isScheduled) {
start();
}
add(count);
return true;
} |
2ca5fe50-20fe-479d-b0b0-098ebc944249 | public void end() {
setEnd(true);
System.out.println("transfering end.");
} |
264bc175-0269-4600-808d-8ee2b9078a2b | private synchronized void add(long count) {
transfered = transfered + count;
} |
a2e1d2b5-0341-4245-886d-244a0e0922e6 | private synchronized long getTransfered() {
return transfered;
} |
b96739f9-c678-4a06-a6d5-bc32d72f24e5 | public synchronized void setTransfered(long transfered) {
this.transfered = transfered;
} |
189e543f-b78c-48f6-acc3-49f9f0f225b8 | private synchronized void setEnd(boolean isEnd) {
this.isEnd = isEnd;
} |
bc44d7bd-3925-496a-a920-23230d1aadca | private synchronized boolean isEnd() {
return isEnd;
} |
ec4ae618-4296-43b9-8d30-b5548f5606b6 | public void init(int op, String src, String dest, long max) {
// Not used for putting InputStream
} |
ccbd1b4f-e6d9-4f0c-b1df-97eeb1f2f27c | public ConsoleTextArea(InputStream[] inStreams) {
for(int i = 0; i < inStreams.length; ++i)
startConsoleReaderThread(inStreams[i]);
} // ConsoleTextArea() |
da8c5c49-28bd-4b06-b0c1-6e0cfc349454 | public ConsoleTextArea() throws IOException {
final LoopedStreams ls = new LoopedStreams();
// 重定向System.out和System.err
PrintStream ps = new PrintStream(ls.getOutputStream());
System.setOut(ps);
System.setErr(ps);
startConsoleReaderThread(ls.getInputStream());
} // Co... |
9a88728d-1a95-4ac5-80ef-8d4edc91d462 | private void startConsoleReaderThread(
InputStream inStream) {
final BufferedReader br =
new BufferedReader(new InputStreamReader(inStream));
new Thread(new Runnable() {
public void run() {
StringBuffer sb = new StringBuffer();
try ... |
e176de83-ddc9-435e-b441-accecfa84a93 | public void run() {
StringBuffer sb = new StringBuffer();
try {
String s;
Document doc = getDocument();
while((s = br.readLine()) != null) {
boolean caretAtEnd = false;
caretAtEnd ... |
980233f5-c029-404f-a833-aaac51130cb4 | public ChannelSftp connect(String server_ip, int server_port, String user_name,
String password) {
ChannelSftp sftp = null;
try {
JSch jsch = new JSch();
jsch.getSession(user_name, server_ip, server_port);
Session sshSession = jsch.getSe... |
cf3d2a64-8f66-441f-8ad2-1856027ad43f | public void upload(String directory, String uploadFile, ChannelSftp sftp) {
try {
sftp.cd(directory);
File file=new File(uploadFile);
FileInputStream fis = new FileInputStream(file);
System.out.println("文件size:"+String.valueOf(fis.available()/1000)+"k");
... |
afb8e993-6165-4ae4-963f-447625c79444 | public void download(String directory, String downloadFile,String saveFile, ChannelSftp sftp) {
try {
sftp.cd(directory);
File file=new File(saveFile);
sftp.get(downloadFile, new FileOutputStream(file));
} catch (Exception e) {
e.printStackTrace();
... |
b82102a2-40cb-4fc6-9874-a12b84b59371 | public void delete(String directory, String deleteFile, ChannelSftp sftp) {
try {
sftp.cd(directory);
sftp.rm(deleteFile);
} catch (Exception e) {
e.printStackTrace();
}
} |
f64cdb4c-5650-40d6-9bda-44342bfc7f2b | public Vector listFiles(String directory, ChannelSftp sftp) throws SftpException{
return sftp.ls(directory);
} |
a5b5081d-a485-495d-a3c2-f9dfb0b70c45 | public void close() {
keepRunning = false;
try {
super.close();
pipedOS.close();
}
catch(IOException e) {
// 记录错误或其他处理
// 为简单计,此处我们直接结束
... |
b2c50aed-1887-4dc0-9881-e1cf534ff8c3 | public void close() {
keepRunning = false;
try {
super.close();
}
catch(IOException e) {
// 记录错误或其他处理
// 为简单计,此处我们直接结束
System.exit(1);
}
} |
24369e62-fdbd-4f6c-a911-bb9be46b69b5 | public LoopedStreams() throws IOException {
pipedOS.connect(pipedIS);
startByteArrayReaderThread();
} // LoopedStreams() |
edf87dde-d304-4a7c-8c5f-af0d99f573f0 | public InputStream getInputStream() {
return pipedIS;
} // getInputStream() |
610b90ea-ebd3-479d-baeb-c7957844569a | public OutputStream getOutputStream() {
return byteArrayOS;
} // getOutputStream() |
00c10d65-214e-43cb-84c8-d805f7d7ba3d | private void startByteArrayReaderThread() {
new Thread(new Runnable() {
public void run() {
while(keepRunning) {
// 检查流里面的字节数
if(byteArrayOS.size() > 0) {
byte[] buffer = null;
synchronized(byteAr... |
e1cc87cb-4bab-41c9-90da-f17f03a9e969 | public void run() {
while(keepRunning) {
// 检查流里面的字节数
if(byteArrayOS.size() > 0) {
byte[] buffer = null;
synchronized(byteArrayOS) {
buffer = byteArrayOS.toByteArray();
... |
5533e2a8-1002-40d2-8b8b-d6a911be0b7b | public JTabbedPane SystemParmFrame() {
server_ip_label.setBounds(10, 10, 70, 20);
server_ip.setBounds(75, 10, 200, 20);
server_port_label.setBounds(10, 35, 70, 20);
server_port.setBounds(75, 35, 200, 20);
username_label.setBounds(10, 60, 70, 20);
username.setBounds(75... |
4f048ac9-5a7e-4ca8-8751-e58a99889048 | public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(SaveButton)) {
}
} |
e0dbf5f1-e107-44c5-9166-1b07387eb101 | public MainFrame() {
double lx = Toolkit.getDefaultToolkit().getScreenSize().getWidth();
double ly = Toolkit.getDefaultToolkit().getScreenSize().getHeight();
frame.setLocation(new Point((int) (lx / 2) - 150, (int) (ly / 2) - 150));// 设定窗口出现位置
frame.setSize(480, 370);// 设定窗口大小
... |
81d47630-bda1-4c7c-b5d9-fa906638963e | public void actionPerformed (ActionEvent e) {
if (e.getSource().equals(about)) {
JOptionPane.showMessageDialog(frame, "OpsPlat运维平台 V0.1 alpha", "关于", 2);
}
} |
69272dd0-fd73-4849-8de7-e0b80c609d42 | public static void main(String[] args){
new MainFrame();
} |
aa2d908b-0d64-49cc-a829-39ed9e489477 | public Container AutoDeploymentFrame() {
jfc.setCurrentDirectory(new File("d://"));// 文件选择器的初始目录定为d盘
//设定组件布局
choseFile.setBounds(10, 10, 70, 20);
filePath.setBounds(75, 10, 200, 20);
choseButton.setBounds(280, 10, 50, 20);
serverDir.setBounds(... |
8cebb3d3-39b7-407b-bd76-ce997695e364 | public void actionPerformed (ActionEvent e) {
// 绑定到选择文件,先择文件事件
if (e.getSource().equals(choseButton)) {
jfc.setFileSelectionMode(0);// 设定只能选择到文件
int state = jfc.showOpenDialog(null);// 此句是打开文件选择器界面的触发语句
if (state == 1) {
return... |
e0d95441-b6d9-4ef5-ad0c-633b36a0c47d | public Container AppLogViewFrame() {
log_path_label.setBounds(10, 10, 70, 20);
log_path.setBounds(75, 10, 200, 20);
log_name_label.setBounds(10, 35, 70, 20);
log_name.setBounds(75, 35, 200, 20);
line_num_label.setBounds(10, 60, 70, 20);
line_nu... |
be1bf2c8-16c4-4bb6-aa89-6c9c9146b7ab | public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(OKButton)) {
String directory = log_path.getText();
String logFile = log_name.getText();
String lineNumStr = line_num.getText();
if(directory.equals("")){
... |
b8c2053a-1f73-44ac-ad7c-7f1c8ef6211f | public LogViewThread(String directory,String logFile,int lineNum){
this.directory = directory;
this.logFile = logFile;
this.lineNum = lineNum;
} |
da2466e4-69e4-446e-9921-6faf5721db81 | public void run() {
try {
Thread.sleep(5000);
InterceptLog lc = new InterceptLog();
Connection conn = lc.establishConnection(server_ip);
new InterceptLog().InterceptLog( conn, user_name, password, logFile, directory, lineNum);
} catch (InterruptedException... |
82bc01b4-d986-4b39-b455-5a04262c6e84 | public Connection establishConnection(String server_ip){
Connection conn = null;
try {
conn = new Connection(server_ip);
conn.connect(); // 连接
}
catch (IOException e) {
e.printStackTrace();
}
finally {
}
return conn;
... |
c3777790-7d25-403d-ab24-5697ea9fa00d | public int InterceptLog(Connection conn,String user_name,String password,String filename,String directory,int lineNum) {
Session session = null;
int ret = -1;
try {
if (conn.authenticateWithPassword(user_name, password)) { // 认证
session = conn.openSession(); ... |
9a066b9b-3d83-48af-bfc6-67a063d6e6d9 | public Element() {
this.poids = 1;
} |
ca57df00-4f3e-4569-9e6a-765be18a5093 | public void setPere(Noeud pere) {
this.pere = pere;
} |
a9286c6d-797d-4279-9a47-92bf593edda2 | public void setSuiv(Element suiv) {
this.suiv = suiv;
} |
7b5fe815-9abd-4647-971b-7d26eea156a5 | public Noeud getPere() {
return pere;
} |
fb072b97-d7f5-4d0d-928b-f950d3d4b6d9 | public int getPoids() {
return poids;
} |
48caaedb-9c11-4d94-af86-81a6cf06b660 | public void setPoids(int poids) {
this.poids = poids;
} |
77c30d3a-3bf6-4e88-9be8-acab6896abe8 | public Element getSuiv() {
return suiv;
} |
ff2fc5c9-67c3-45a2-a90f-072c823044b3 | public void incrPoids() {
this.poids++;
} |
b4da1b84-fcbb-40a0-b4c8-234b0ec9e464 | public boolean estFilsGauche() {
return this == this.getPere().getFilsGauche();
} |
9463871f-ab08-4bb8-a516-d179eb064340 | public static void compression(String texte, OutputStream out)
throws IOException {
// initialise l'arbre avec la feuille '#'
ArbreHuffman arbre = new ArbreHuffman();
GestionnaireBit gestion = new GestionnaireBit();
for (char symbole : texte.toCharArray()) {
if (arbre.estPresent(symbole) && symbole != '... |
c2e04fbc-811c-4313-8eff-bec8520bbffe | public static void compression(File file, OutputStream out)
throws IOException {
final int length = (int) file.length();
final char[] buffer = new char[length];
final FileReader fr = new FileReader(file);
int offset = 0;
while (offset < length) {
int read = fr.read(buffer, offset, length - offset);
o... |
c21d47c9-3098-4545-8c7f-6990aaf5f3dc | public static String decompression(InputStream in) throws IOException {
StringBuilder str = new StringBuilder();
ArbreHuffman arbre = new ArbreHuffman();
// lecture des 4 premiers octets pour connaitre la taille
int longueurDuTexte = 0;
for (int i = 0; i < 4; i++) {
longueurDuTexte += (in.read() << (24 - ... |
6cb9d363-77a1-4281-bc04-73feb7b45653 | public static void decompression(InputStream in, File out)
throws IOException {
FileWriter fw = new FileWriter(out);
fw.write(decompression(in));
fw.flush();
} |
b7b50a7f-7cd4-48b9-ba9f-4674233a970c | public static void main(String[] args) throws IOException {
File f = new File("test.vbgz");
Huffman.compression("abrac###adabra", new FileOutputStream(f));
System.out.println(Huffman.decompression(new FileInputStream(new File("test.vbgz"))));
} |
323d3193-0be0-4f6e-b5d3-19abd3e2df4a | public GestionnaireBit() {
liste = new LinkedList<Byte>();
current = 0;
indexCurrent = 0;
} |
0bddc960-063c-499f-9494-6a103fb3282c | public void transmettreSymbole(char symbole) {
transmettreChemin(byteToBooleanList((byte) symbole));
} |
efb9f64b-897e-4afb-81e2-bcb6cba2f8dd | public void transmettreChemin(Collection<Boolean> chemin) {
for (Boolean b : chemin) {
if (b) {
Byte comp = (byte) (1 << (7 - indexCurrent));
current = (byte) (current.byteValue() | (byte) comp);
}
if (++indexCurrent == 8) {
liste.add(current);
indexCurrent = 0;
current = 0;
}
}
... |
e4a8af67-ff07-4be2-bf2c-7e354a1b1d1a | public void finirTransmission(int nbTransmissions) {
if (indexCurrent != 0) {
liste.add(current);
}
for (int i = 0; i < 4; i++) {
byte b = (byte) (nbTransmissions << (3 - i) * 8 >> 24);
liste.push(b);
}
} |
d4f11a3c-b2ba-4d11-b2bd-a2a6bcd225e9 | public void ecrireDansFichier(OutputStream out) throws IOException {
for (Byte b : liste) {
out.write(new byte[] { b });
}
out.close();
} |
599d5506-d154-4fff-ac45-69cff71ca02f | public static Collection<Boolean> byteToBooleanList(byte b) {
Collection<Boolean> tmp = new ArrayList<Boolean>();
// on parcourt le caract�re pour construire la liste
char comp = 1 << 7;
for (int i = 0; i < 8; i++) {
tmp.add((b & comp) != 0);
comp >>= 1;
}
return tmp;
} |
eb5d60d0-42ff-4d9b-ae18-cdb0fb9ccb7a | public static char booleanListToChar(LinkedList<Boolean> bitList) {
char c = 0;
for (int i = 0; i < 8; i++) {
boolean b = bitList.pop();
if (b)
c |= (1 << (7 - i));
}
return c;
} |
f67e1378-164e-4382-a436-88c116efc0b6 | public static void showBits(Collection<Boolean> bitList) {
for (boolean b : bitList) {
System.out.print(b ? "1" : "0");
}
} |
c8eeef20-837e-431f-8e1c-5f06f7e5ecab | public Feuille(char symbole) {
super();
this.symbole = symbole;
} |
c7cc611b-e6e7-4056-a9db-abdc4a9c7e77 | public char getSymbole() {
return symbole;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.