blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8e16cc93f992a2a15aea5b666a850dadd609543b
|
10b95051fdac38825bca1df8f01e8a631ae63be8
|
/java_classes/classes-dex2jar_FILES/com/keepassdroid/view/GroupAddEntryView.java
|
26b359df0724aa3ce84635ac0fa6abf21c0dd64b
|
[] |
no_license
|
pankajsy/android-reverse-engineering
|
8c6cde02eb2cb363070282524af6ade60aef23be
|
44a5392ff3f77b2138569b7a704611d5db862622
|
refs/heads/master
| 2021-03-27T10:37:53.924353 | 2019-03-07T04:32:56 | 2019-03-07T04:32:56 | 75,222,582 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 847 |
java
|
package com.keepassdroid.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.RelativeLayout;
public class GroupAddEntryView
extends RelativeLayout
{
public GroupAddEntryView(Context paramContext)
{
this(paramContext, null);
}
public GroupAddEntryView(Context paramContext, AttributeSet paramAttributeSet)
{
super(paramContext, paramAttributeSet);
inflate(paramContext);
}
private void inflate(Context paramContext)
{
((LayoutInflater)paramContext.getSystemService("layout_inflater")).inflate(2130903055, this);
}
}
/* Location: /home/pankaj/reverse_engineering/dex2jar-2.0/classes-dex2jar.jar!/com/keepassdroid/view/GroupAddEntryView.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|
[
"[email protected]"
] | |
9604fc6ae7e365c6a968287ee79b847bf27b9eac
|
c1d500656b6950509aaddcc1166331e0f1d345ce
|
/PokemonGame/Form4Pokemon.java
|
bc316ca56f86033cbe85fb39a712ce66ec65602c
|
[] |
no_license
|
Gam1999/PokemonGame-by-Java
|
65092972bb154486aef05c40bf9f1dd3ea8d59c5
|
0d55e0f3eb890e6835746e51253d813ac7c31b1e
|
refs/heads/main
| 2023-07-14T00:33:25.487860 | 2021-08-25T15:47:58 | 2021-08-25T15:47:58 | 399,868,367 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 10,811 |
java
|
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import java.io.FileInputStream;
public class Form4Pokemon extends JFrame {
private int wildPokemon = (int)(Math.random());
private ImageIcon ImageIcon;
private ImagePanel panel;
private JButton button;
Pikachu pikachu = new Pikachu();
Charmender charmender = new Charmender();
Bulbasaur bulbasaur = new Bulbasaur();
public Form4Pokemon(){
// Create Form Frame
setTitle("Pokemon Game");
setSize(1000, 600);
setLocation(400, 280);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(null);
//Color
Color aliceBlue = new Color(245,255,250);
getContentPane().setBackground(aliceBlue);
//imageicon tiTLE
ImageIcon = new ImageIcon("boll.png");
Image Image = ImageIcon.getImage();
this.setIconImage(Image);
panel = new ImagePanel(new ImageIcon("man.png").getImage());
panel.setLayout(null);
panel.setBounds(700, 100, 950, 1500);//x y w h
this.getContentPane().add(panel);
panel = new ImagePanel(new ImageIcon("pikachu.png").getImage());
panel.setLayout(null);
panel.setBounds(30, 195, 450, 260);//x y w h
this.getContentPane().add(panel);
panel = new ImagePanel(new ImageIcon("charmender.png").getImage());
panel.setLayout(null);
panel.setBounds(360, 210, 540, 540);//x y w h
this.getContentPane().add(panel);
panel = new ImagePanel(new ImageIcon("Bulbasaur.png").getImage());
panel.setLayout(null);
panel.setBounds(590, 210, 140, 140);//x y w h
this.getContentPane().add(panel);
panel = new ImagePanel(new ImageIcon("Berry.png").getImage());
panel.setLayout(null);
panel.setBounds(70, 400, 119, 90);//x y w h
this.getContentPane().add(panel);
panel = new ImagePanel(new ImageIcon("dawn.png").getImage());
panel.setLayout(null);
panel.setBounds(440, 46, 119, 190);//x y w h
this.getContentPane().add(panel);
panel = new ImagePanel(new ImageIcon("Egg.png").getImage());
panel.setLayout(null);
panel.setBounds(20, 46, 140, 160);//x y w h
this.getContentPane().add(panel);
panel = new ImagePanel(new ImageIcon("dawn.png").getImage());
panel.setLayout(null);
panel.setBounds(250, 79, 119, 190);//x y w h
this.getContentPane().add(panel);
panel = new ImagePanel(new ImageIcon("dawn.png").getImage());
panel.setLayout(null);
panel.setBounds(600, 79, 119, 190);//x y w h
this.getContentPane().add(panel);
panel = new ImagePanel(new ImageIcon("bird.png").getImage());
panel.setLayout(null);
panel.setBounds(90, 160, 119, 60);//x y w h
this.getContentPane().add(panel);
panel = new ImagePanel(new ImageIcon("bird1.png").getImage());
panel.setLayout(null);
panel.setBounds(740, 90, 119, 60);//x y w h
this.getContentPane().add(panel);
Berry();
statusPikachu();
attactPikachu();
reNamePikachu();
statusCharmender();
attactCharmender();
reNameCharmender();
statusBulbasaur();
attactBulbasaur();
reNameBulbasaur();
pokemonEgg();
}
public void Berry(){
button = new JButton("Berry");
button.setBackground ( Color.BLACK );
button.setForeground ( Color.WHITE );
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// Check Checkbox 1
System.out.println("Pikachu");
JOptionPane.showMessageDialog(null,
"Pikachu MP: " + pikachu.getMpEatBerry());
}
});
button.setBounds(70, 495, 89, 23);
getContentPane().add(button);
}
public int checklevelUpPikachu(){
if(pikachu.getExp() >= 110){
pikachu.getL();
pikachu.setL(1);
pikachu.getExpZero();
}
return pikachu.getLevelUp();
}
public void statusPikachu(){
// Button
button = new JButton("Status Pikachu");
button.setBackground ( Color.BLACK );
button.setForeground ( Color.WHITE );
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// Check Checkbox 1
System.out.println("Pikachu");
JOptionPane.showMessageDialog(null,
"Name: "+pikachu.getName()+ "\n"+
"HP: "+ pikachu.HP()+ "\n" +
"MP: "+pikachu.getMp()+ "\n"+
"Level: " +checklevelUpPikachu());
}
});
button.setBounds(180, 375, 120, 23);
getContentPane().add(button);
}
public void attactPikachu(){
button = new JButton("Attack");
button.setBackground ( Color.BLACK );
button.setForeground ( Color.WHITE );
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// Check Checkbox 1
System.out.println("Pikachu");
JOptionPane.showMessageDialog(null,
""+pikachu.getNamepikachu()+ "\n"+
"HP: " + pikachu.HP()+ "\n"+
"MP: " + pikachu.getMpAttack() +"\n"+
"EXP: " + pikachu.getExp()+ "\n"+
"Level: " +checklevelUpPikachu());
}
});
button.setBounds(179, 416, 120, 23);
getContentPane().add(button);
}
public void reNamePikachu(){
// Text Field
// Text Field
final JTextField txt = new JTextField();
txt.setBounds(179, 460, 120, 20);
getContentPane().add(txt);
txt.setColumns(10);
// Label
final JLabel lbl = new JLabel();
lbl.setBounds(103, 120, 144, 14);
getContentPane().add(lbl);
// Button
button = new JButton("Rename");
button.setBackground ( Color.BLACK );
button.setForeground ( Color.WHITE );
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
txt.setText(pikachu.getName());
}
});
button.setBounds(179, 495, 120, 23);
getContentPane().add(button);
}
public void statusCharmender(){
// Button
button = new JButton("Status Charmender");
button.setBackground ( Color.BLACK );
button.setForeground ( Color.WHITE );
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// Check Checkbox 1
System.out.println("Charmender");
JOptionPane.showMessageDialog(null,
"Name: "+charmender.getName()+ "\n"+
"HP: " + charmender.HP()+ "\n"+
"MP: "+charmender.getMp()+ "\n"+
"Level: " +checklevelUpPikachu());
}
});
button.setBounds(340, 375, 180, 23);
getContentPane().add(button);
}
public void attactCharmender(){
button = new JButton("Attack");
button.setBackground ( Color.BLACK );
button.setForeground ( Color.WHITE );
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// Check Checkbox 1
System.out.println("Pikachu");
JOptionPane.showMessageDialog(null,
""+charmender.getName()+ "\n"+
"HP: " + charmender.HP()+ "\n"+
"MP: " + charmender.getMpAttack() +"\n"+
"EXP: " + charmender.getExp()+ "\n"+
"Level: " +checklevelUpPikachu());
}
});
button.setBounds(340, 410, 180, 23);
getContentPane().add(button);
}
public int checklevelUpCharmender(){
if(charmender.getExp() >= 110){
charmender.getL();
charmender.setL(1);
charmender.getExpZero();
}
return charmender.getLevelUp();
}
public void reNameCharmender(){
// Text Field
final JTextField txt = new JTextField();
txt.setBounds(340, 460, 180, 23);
getContentPane().add(txt);
txt.setColumns(10);
// Label
final JLabel lbl = new JLabel();
lbl.setBounds(120, 460, 180, 23);
getContentPane().add(lbl);
// Button
button = new JButton("Rename");
button.setBackground ( Color.BLACK );
button.setForeground ( Color.WHITE );
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
txt.setText(charmender.getName());
}
});
button.setBounds(340, 495, 180, 23);
getContentPane().add(button);
}
public int checklevelUpBulbasaur(){
if(bulbasaur.getExp() >= 110){
bulbasaur.getL();
bulbasaur.setL(1);
bulbasaur.getExpZero();
}
return bulbasaur.getLevelUp();
}
public void statusBulbasaur(){
// Button
button = new JButton("Status Bulbasaur");
button.setBackground ( Color.BLACK );
button.setForeground ( Color.WHITE );
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// Check Checkbox 1
System.out.println("Bulbasaur");
JOptionPane.showMessageDialog(null,
"Name: "+bulbasaur.getName()+ "\n"+
"HP: "+ bulbasaur.HP()+ "\n" +
"MP: "+bulbasaur.getMp()+ "\n"+
"Level: " +checklevelUpPikachu());
}
});
button.setBounds(580, 375, 170, 23);
getContentPane().add(button);
}
public void attactBulbasaur(){
button= new JButton("Attack");
button.setBackground ( Color.BLACK );
button.setForeground ( Color.WHITE );
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// Check Checkbox 1
System.out.println("Bulbasaur");
JOptionPane.showMessageDialog(null,
""+bulbasaur.getNameBulbasaur()+ "\n"+
"HP: " + bulbasaur.HP()+ "\n"+
"MP: " + bulbasaur.getMpAttack() +"\n"+
"EXP: " + bulbasaur.getExp()+ "\n"+
"Level: " +checklevelUpPikachu());
}
});
button.setBounds(579, 416, 170, 23);
getContentPane().add(button);
}
public void reNameBulbasaur(){
// Text Field
// Text Field
final JTextField txt = new JTextField();
txt.setBounds(579, 460, 170, 20);
getContentPane().add(txt);
txt.setColumns(10);
// Label
final JLabel lbl = new JLabel();
lbl.setBounds(503, 170, 144, 14);
getContentPane().add(lbl);
// Button
button = new JButton("Rename");
button.setBackground ( Color.BLACK );
button.setForeground ( Color.WHITE );
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
txt.setText(bulbasaur.getName());
}
});
button.setBounds(579, 495, 170, 23);
getContentPane().add(button);
}
public void pokemonEgg(){
// Create Button
button = new JButton("Egg");
button.setBackground ( Color.BLACK );
button.setForeground ( Color.WHITE );
button.setBounds(10, 90, 60, 20);
// Create Event for Button
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
// New Form
eggPokemon eggpokemon = new eggPokemon();
eggpokemon.setVisible(true);
// Hide Current Form
setVisible(false);
eggpokemon.setResizable(false);
}
});
getContentPane().add(button);
}
}
|
[
"[email protected]"
] | |
d03071bd6cbaafafa48fa1065f14fe798344adcc
|
bd2d395dbdaa9d468bd918945b024d2cd3042669
|
/TaxPerson/src/taxfactory/BasicCommodityTax.java
|
266a99b9a8dd178327a1bf347702eafcd882fa3a
|
[] |
no_license
|
sreepal/InterviewQuestions
|
7f2d0ba9c19ba5d69f4a715c49e85b0c5f91b1dd
|
f471e0816f3c9ab299491dadf21bb76d8fd3d43c
|
refs/heads/master
| 2021-01-16T21:32:56.351479 | 2016-05-13T07:22:42 | 2016-05-13T07:22:42 | 58,670,830 | 0 | 0 | null | 2016-05-12T19:30:27 | 2016-05-12T19:30:27 | null |
UTF-8
|
Java
| false | false | 744 |
java
|
package taxfactory;
import java.util.HashMap;
//Concrete BasicCommodityTax Class code
public class BasicCommodityTax implements TaxCalculation {
@Override
public double getCost(String commondity) {
double taxRate= 0.01;
/* This is how to declare HashMap */
HashMap<String,Integer > hmap = new HashMap<String,Integer>();
/*Adding elements to HashMap*/
hmap.put("milk", 40);
hmap.put("bread", 20);
hmap.put("water", 60);
double taxValue=hmap.get(commondity)*taxRate;
double totalCost=hmap.get(commondity)+taxValue;
//System.out.println("Basic commodity cost with tax ::: "+totalCost);
// TODO Auto-generated method stub
return totalCost;
}
}
|
[
"[email protected]"
] | |
8b97ac9025332ceb5decffc8c6aa4a56038ac6d1
|
96d3edfffd5771a819f51f1936f520314f1b2bd9
|
/workspacejava/Ex_0820/src/ex4_work/Gugudan.java
|
b2e6f3fa3f5af4a393fca215be2e778d706a2cfd
|
[] |
no_license
|
ckd0dn/web
|
547cd08f382526d1cc5a4f4acc0841f9645428f3
|
6b9c3213d80dd046feffdcf1c85122838a1cf0d0
|
refs/heads/master
| 2023-03-17T20:18:50.702544 | 2021-03-09T08:43:29 | 2021-03-09T08:43:29 | 312,524,409 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 180 |
java
|
package ex4_work;
public class Gugudan {
public void showTable(int n) {
for (int i = 1; i <= 9; i++) {
System.out.printf( "%d * %d = %d\n",n, i, n*i);
}
}
}
|
[
"[email protected]"
] | |
a07d3e5967b20620f3ec5d4da01fe776ba1f1e00
|
43ea6b8fd54f76e49f6e8ed8ec443336cf7db8ac
|
/uva/UVa10195_TheKnightsOfTheRoundTable.java
|
add4e5cd41e9aef6c66d354bb09835d908fd95b1
|
[] |
no_license
|
mirzainayat92/competitive-programming
|
68f6c0a5a10cf8d8f14040a385e22e53d03beb70
|
2d737fb6f69256f62ea5454888f5687f1814ea7b
|
refs/heads/master
| 2020-12-22T20:45:48.789657 | 2018-03-15T03:52:48 | 2018-03-15T03:52:48 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,079 |
java
|
package uva;
/* USER: 46724 (sfmunera) */
/* PROBLEM: 1136 (10195 - The Knights Of The Round Table) */
/* SUBMISSION: 09301883 */
/* SUBMISSION TIME: 2011-09-26 16:45:47 */
/* LANGUAGE: 2 */
import java.util.*;
import java.io.*;
public class UVa10195_TheKnightsOfTheRoundTable {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line;
StringTokenizer stk;
while ((line = in.readLine()) != null) {
stk = new StringTokenizer(line);
double a = Double.parseDouble(stk.nextToken());
double b = Double.parseDouble(stk.nextToken());
double c = Double.parseDouble(stk.nextToken());
double r = 0.0;
if (Math.abs(a) >= 1e-9 && Math.abs(b) >= 1e-9 && Math.abs(c) >= 1e-9) {
double s = (a + b + c) / 2.0;
double A = Math.sqrt(s * (s - a) * (s - b) * (s - c));
r = 2.0 * A / (a + b + c);
}
System.out.printf(Locale.ENGLISH, "The radius of the round table is: %.3f%n", r);
}
in.close();
System.exit(0);
}
}
|
[
"[email protected]"
] | |
53c63332840438cc0037f76b51a4688a06ea153a
|
2e0f92dd6b626a1a081cb93be2dd65586ae75bb2
|
/src/qa/allot/stabilityVerification/core/helpers/PolicyInstanceClassification.java
|
949996de514ca22941792318b195665df3b42d96
|
[] |
no_license
|
vbronshtein/StabilityVerification16
|
29c6974a75a0a045c4b99e74fcbf2916e5e9f218
|
ee830079a1ae13353110b044b0ca3fc8ca300b07
|
refs/heads/master
| 2020-03-25T04:54:58.765799 | 2018-08-03T15:16:00 | 2018-08-03T15:16:00 | 143,420,035 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,704 |
java
|
package qa.allot.stabilityVerification.core.helpers;
import java.util.List;
import qa.allot.stabilityVerification.core.policy.LineInstance;
import qa.allot.stabilityVerification.core.policy.PipeInstance;
import qa.allot.stabilityVerification.core.policy.PolicyInstance;
import qa.allot.stabilityVerification.core.policy.VcInstance;
public class PolicyInstanceClassification {
public PolicyInstanceClassification() {
super();
}
/**
* Method Classify all VC to Pipes and all pipes to lines
*
*/
public void poliClasification(List<PolicyInstance> policyInstances) {
for (PolicyInstance policyInstance : policyInstances) {
//VCs classification to Pipes
if (policyInstance instanceof VcInstance) {
VcInstance vcInstance = (VcInstance) policyInstance;
for (PolicyInstance policyInstance2 : policyInstances) {
if (policyInstance2 instanceof PipeInstance
&& policyInstance.getLineName().equals(policyInstance2.getLineName())
&& policyInstance.getPipeName().equals(policyInstance2.getPipeName())) {
PipeInstance pipeInstance = (PipeInstance) policyInstance2;
pipeInstance.adToVcList(vcInstance);
break;
}
}
} else if (policyInstance instanceof PipeInstance) {
PipeInstance pipeInstance = (PipeInstance) policyInstance;
for (PolicyInstance policyInstance2 : policyInstances) {
if (policyInstance2 instanceof LineInstance
&& policyInstance2.getLineName().equals(policyInstance.getLineName())) {
LineInstance lineInstance = (LineInstance) policyInstance2;
lineInstance.addToPipeInstances(pipeInstance);
break;
}
}
}
}
}
}
|
[
"[email protected]"
] | |
81af91ee1f032a7b8c6ab23495d2ff2b955c2751
|
980a4702cf5396ab54cb0e9282055e1e2d3edd1d
|
/nd4j/nd4j-backends/nd4j-api-parent/nd4j-native-api/src/main/java/org/nd4j/nativeblas/OpaqueConstantDataBuffer.java
|
8e198c18624bcf2adced0177fa43cb91e9dabfc4
|
[
"LicenseRef-scancode-generic-cla",
"Apache-2.0",
"MIT",
"BSD-3-Clause"
] |
permissive
|
pxiuqin/deeplearning4j
|
5d7abea2102ad3c8d6455803f7afc5e7641062a1
|
e11ddf3c24d355b43d36431687b807c8561aaae4
|
refs/heads/master
| 2022-12-02T00:09:48.450622 | 2020-08-13T10:32:14 | 2020-08-13T10:32:14 | 277,511,646 | 1 | 0 |
Apache-2.0
| 2020-08-13T10:32:16 | 2020-07-06T10:28:22 | null |
UTF-8
|
Java
| false | false | 979 |
java
|
/*******************************************************************************
* Copyright (c) 2015-2019 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
package org.nd4j.nativeblas;
import org.bytedeco.javacpp.Pointer;
/**
*
* @author saudet
*/
public class OpaqueConstantDataBuffer extends Pointer {
public OpaqueConstantDataBuffer(Pointer p) { super(p); }
}
|
[
"[email protected]"
] | |
b9fdbbad0d634082bccaff9c989b6c23fdd8ea22
|
e08968256ae2f27e51bf3041c71965a23948fb06
|
/src/Crossover.java
|
a630a525063019f5764f5b3673e2d66342cc7832
|
[] |
no_license
|
AlexisMundu-zz/Decryption-with-Genetic-Algorithm
|
dcec203ce330b330a06c563cca4c80cfc5b152d5
|
c0df3ec634cfd5406f2c01a806484d070ab998ed
|
refs/heads/master
| 2021-10-07T06:36:13.997096 | 2018-12-03T16:45:03 | 2018-12-03T16:45:03 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 309 |
java
|
public abstract class Crossover <T> {
/**
* Genetic operator which combines the genetic information of two parents to generate 2 new offsprings
* Offsprings replace the parents
* @param genotype1
* @param genotype2
*/
public abstract void cross(Genotype<T> genotype1, Genotype<T> genotype2);
}
|
[
"[email protected]"
] | |
fa955c8023e987d6101d6f9bff8c6ba70e491c04
|
1f19aec2ecfd756934898cf0ad2758ee18d9eca2
|
/u-1/u-11/u-11-111/u-11-111-1112/u-11-111-1112-11113-111111/u-11-111-1112-11113-111111-f173.java
|
c694b23feadcc845df3c9e51cecf566d0dc3e6ee
|
[] |
no_license
|
apertureatf/perftest
|
f6c6e69efad59265197f43af5072aa7af8393a34
|
584257a0c1ada22e5486052c11395858a87b20d5
|
refs/heads/master
| 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 106 |
java
|
mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
7018625784108
|
[
"[email protected]"
] | |
2e74d06f3ae155283f2a5d3421d06811b01faadb
|
0858d209a707cefc20b5fdb74acdca45730bc39c
|
/app/src/main/java/com/example/yls/jsongson/Student.java
|
01b599a11bdf98827c73f5fc81978429786e6b52
|
[] |
no_license
|
zjh1003/JsonGson
|
d199bb1f8bde01b108e7e5353fe3ff30e04b1bf9
|
6f2ab667a7c5051508487e4a7e11f45e79cacad2
|
refs/heads/master
| 2021-01-11T14:05:31.040560 | 2017-06-21T03:25:26 | 2017-06-21T03:25:26 | 94,958,720 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 662 |
java
|
package com.example.yls.jsongson;
/**
* Created by yls on 2017/3/2.
*/
public class Student {
int id;
String name;
int age;
// 快捷键 ALT+Insert
public Student(int id, String name, int age){
this.id =id;
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
|
[
"[email protected]"
] | |
34107828e9c4cd8789cbe990e18ba95816182968
|
edabb15cb09ce6cb3a0f2d4d1dfe17850b5d8554
|
/src/main/java/ru/fsrar/wegais/ttnsingle_v2/WayBillTypeV2.java
|
613774c513cd36465ac1a20a1918723cd4d94a49
|
[
"MIT"
] |
permissive
|
ytimesru/kkm-pc-client
|
74f7eecd30fb1ef1f29c43a85ecbf18a78935646
|
899a6f00b2067a5d0823fd3d468be693af1dbdba
|
refs/heads/master
| 2021-01-25T09:10:42.038884 | 2018-08-11T20:07:11 | 2018-08-11T20:07:11 | 93,795,952 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 19,433 |
java
|
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2018.06.05 at 08:50:12 PM SAMT
//
package ru.fsrar.wegais.ttnsingle_v2;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;
import ru.fsrar.wegais.clientref_v2.OrgInfoRusV2;
import ru.fsrar.wegais.clientref_v2.OrgInfoV2;
/**
* Товарно-Транспортная Накладная
*
* <p>Java class for WayBillType_v2 complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="WayBillType_v2">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Identity" type="{http://fsrar.ru/WEGAIS/Common}IdentityType" minOccurs="0"/>
* <element name="Header">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <all>
* <element name="Type" type="{http://fsrar.ru/WEGAIS/TTNSingle_v2}WbType"/>
* <element name="NUMBER" type="{http://fsrar.ru/WEGAIS/Common}NoEmptyString50"/>
* <element name="Date" type="{http://fsrar.ru/WEGAIS/Common}DateNoTime"/>
* <element name="ShippingDate" type="{http://fsrar.ru/WEGAIS/Common}DateNoTime"/>
* <element name="Transport" type="{http://fsrar.ru/WEGAIS/TTNSingle_v2}TransportType" minOccurs="0"/>
* <element name="Shipper" type="{http://fsrar.ru/WEGAIS/ClientRef_v2}OrgInfoRus_v2"/>
* <element name="Consignee" type="{http://fsrar.ru/WEGAIS/ClientRef_v2}OrgInfo_v2"/>
* <element name="Base" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* </restriction>
* </simpleType>
* </element>
* <element name="Note" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* </restriction>
* </simpleType>
* </element>
* <element name="VarField1" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* </restriction>
* </simpleType>
* </element>
* <element name="VarField2" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* </restriction>
* </simpleType>
* </element>
* <element name="VarField3" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* </restriction>
* </simpleType>
* </element>
* </all>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="Content">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Position" type="{http://fsrar.ru/WEGAIS/TTNSingle_v2}PositionType" maxOccurs="unbounded"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "WayBillType_v2", propOrder = {
"identity",
"header",
"content"
})
public class WayBillTypeV2 {
@XmlElement(name = "Identity")
protected String identity;
@XmlElement(name = "Header", required = true)
protected WayBillTypeV2 .Header header;
@XmlElement(name = "Content", required = true)
protected WayBillTypeV2 .Content content;
/**
* Gets the value of the identity property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIdentity() {
return identity;
}
/**
* Sets the value of the identity property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIdentity(String value) {
this.identity = value;
}
/**
* Gets the value of the header property.
*
* @return
* possible object is
* {@link WayBillTypeV2 .Header }
*
*/
public WayBillTypeV2 .Header getHeader() {
return header;
}
/**
* Sets the value of the header property.
*
* @param value
* allowed object is
* {@link WayBillTypeV2 .Header }
*
*/
public void setHeader(WayBillTypeV2 .Header value) {
this.header = value;
}
/**
* Gets the value of the content property.
*
* @return
* possible object is
* {@link WayBillTypeV2 .Content }
*
*/
public WayBillTypeV2 .Content getContent() {
return content;
}
/**
* Sets the value of the content property.
*
* @param value
* allowed object is
* {@link WayBillTypeV2 .Content }
*
*/
public void setContent(WayBillTypeV2 .Content value) {
this.content = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Position" type="{http://fsrar.ru/WEGAIS/TTNSingle_v2}PositionType" maxOccurs="unbounded"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"position"
})
public static class Content {
@XmlElement(name = "Position", required = true)
protected List<PositionType> position;
/**
* Gets the value of the position property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the position property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPosition().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link PositionType }
*
*
*/
public List<PositionType> getPosition() {
if (position == null) {
position = new ArrayList<PositionType>();
}
return this.position;
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <all>
* <element name="Type" type="{http://fsrar.ru/WEGAIS/TTNSingle_v2}WbType"/>
* <element name="NUMBER" type="{http://fsrar.ru/WEGAIS/Common}NoEmptyString50"/>
* <element name="Date" type="{http://fsrar.ru/WEGAIS/Common}DateNoTime"/>
* <element name="ShippingDate" type="{http://fsrar.ru/WEGAIS/Common}DateNoTime"/>
* <element name="Transport" type="{http://fsrar.ru/WEGAIS/TTNSingle_v2}TransportType" minOccurs="0"/>
* <element name="Shipper" type="{http://fsrar.ru/WEGAIS/ClientRef_v2}OrgInfoRus_v2"/>
* <element name="Consignee" type="{http://fsrar.ru/WEGAIS/ClientRef_v2}OrgInfo_v2"/>
* <element name="Base" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* </restriction>
* </simpleType>
* </element>
* <element name="Note" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="200"/>
* </restriction>
* </simpleType>
* </element>
* <element name="VarField1" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* </restriction>
* </simpleType>
* </element>
* <element name="VarField2" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* </restriction>
* </simpleType>
* </element>
* <element name="VarField3" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* </restriction>
* </simpleType>
* </element>
* </all>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
})
public static class Header {
@XmlElement(name = "Type", required = true, defaultValue = "WBInvoiceFromMe")
@XmlSchemaType(name = "string")
protected WbType type;
@XmlElement(name = "NUMBER", required = true)
protected String number;
@XmlElement(name = "Date", required = true)
@XmlSchemaType(name = "date")
protected XMLGregorianCalendar date;
@XmlElement(name = "ShippingDate", required = true)
@XmlSchemaType(name = "date")
protected XMLGregorianCalendar shippingDate;
@XmlElement(name = "Transport")
protected TransportType transport;
@XmlElement(name = "Shipper", required = true)
protected OrgInfoRusV2 shipper;
@XmlElement(name = "Consignee", required = true)
protected OrgInfoV2 consignee;
@XmlElement(name = "Base")
protected String base;
@XmlElement(name = "Note")
protected String note;
@XmlElement(name = "VarField1")
protected String varField1;
@XmlElement(name = "VarField2")
protected String varField2;
@XmlElement(name = "VarField3")
protected String varField3;
/**
* Gets the value of the type property.
*
* @return
* possible object is
* {@link WbType }
*
*/
public WbType getType() {
return type;
}
/**
* Sets the value of the type property.
*
* @param value
* allowed object is
* {@link WbType }
*
*/
public void setType(WbType value) {
this.type = value;
}
/**
* Gets the value of the number property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNUMBER() {
return number;
}
/**
* Sets the value of the number property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNUMBER(String value) {
this.number = value;
}
/**
* Gets the value of the date property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getDate() {
return date;
}
/**
* Sets the value of the date property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setDate(XMLGregorianCalendar value) {
this.date = value;
}
/**
* Gets the value of the shippingDate property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getShippingDate() {
return shippingDate;
}
/**
* Sets the value of the shippingDate property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setShippingDate(XMLGregorianCalendar value) {
this.shippingDate = value;
}
/**
* Gets the value of the transport property.
*
* @return
* possible object is
* {@link TransportType }
*
*/
public TransportType getTransport() {
return transport;
}
/**
* Sets the value of the transport property.
*
* @param value
* allowed object is
* {@link TransportType }
*
*/
public void setTransport(TransportType value) {
this.transport = value;
}
/**
* Gets the value of the shipper property.
*
* @return
* possible object is
* {@link OrgInfoRusV2 }
*
*/
public OrgInfoRusV2 getShipper() {
return shipper;
}
/**
* Sets the value of the shipper property.
*
* @param value
* allowed object is
* {@link OrgInfoRusV2 }
*
*/
public void setShipper(OrgInfoRusV2 value) {
this.shipper = value;
}
/**
* Gets the value of the consignee property.
*
* @return
* possible object is
* {@link OrgInfoV2 }
*
*/
public OrgInfoV2 getConsignee() {
return consignee;
}
/**
* Sets the value of the consignee property.
*
* @param value
* allowed object is
* {@link OrgInfoV2 }
*
*/
public void setConsignee(OrgInfoV2 value) {
this.consignee = value;
}
/**
* Gets the value of the base property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBase() {
return base;
}
/**
* Sets the value of the base property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBase(String value) {
this.base = value;
}
/**
* Gets the value of the note property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNote() {
return note;
}
/**
* Sets the value of the note property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNote(String value) {
this.note = value;
}
/**
* Gets the value of the varField1 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVarField1() {
return varField1;
}
/**
* Sets the value of the varField1 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVarField1(String value) {
this.varField1 = value;
}
/**
* Gets the value of the varField2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVarField2() {
return varField2;
}
/**
* Sets the value of the varField2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVarField2(String value) {
this.varField2 = value;
}
/**
* Gets the value of the varField3 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVarField3() {
return varField3;
}
/**
* Sets the value of the varField3 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVarField3(String value) {
this.varField3 = value;
}
}
}
|
[
"[email protected]"
] | |
a8dc6cf4c51c47cb3a50bba7054bb16d0f6c6c67
|
2a71eee26fa3313c7aa988042719aeb24d6c1ea4
|
/CoFHCore/src/main/java/cofh/lib/block/TileBlockActive.java
|
4013c1b85f50dacf847c5c8c673dd94500a70887
|
[] |
no_license
|
dizzyd/1.15
|
64b797494e707b8c90a339d0548f841b7cf08002
|
fe938d66c5412bfe8067d91ecfdf559c528ec60d
|
refs/heads/master
| 2022-12-09T07:47:47.685447 | 2020-08-09T03:41:34 | 2020-08-09T03:41:34 | 286,322,082 | 0 | 0 | null | 2020-08-09T21:48:16 | 2020-08-09T21:48:16 | null |
UTF-8
|
Java
| false | false | 868 |
java
|
package cofh.lib.block;
import cofh.lib.tileentity.TileCoFH;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.state.StateContainer;
import java.util.function.Supplier;
import static cofh.lib.util.constants.Constants.ACTIVE;
public class TileBlockActive extends TileBlockCoFH {
public TileBlockActive(Properties builder, Supplier<? extends TileCoFH> supplier) {
super(builder, supplier);
this.setDefaultState(this.stateContainer.getBaseState().with(ACTIVE, false));
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder);
builder.add(ACTIVE);
}
@Override
public int getLightValue(BlockState state) {
return state.get(ACTIVE) ? super.getLightValue(state) : 0;
}
}
|
[
"[email protected]"
] | |
100844b11f2f312432dfe8e5bf751e236b9941b5
|
270916a70f0d2269dbdb186e1635744db4ebb6cc
|
/notes/5-6/src/BinaryTree.java
|
117cb8cfa54d351ab81c396cbd14de9ac940b7e1
|
[] |
no_license
|
cheng1212y/DATA-STRUCTURE
|
55db3daf0304803eadca490132449b91df46d404
|
da6c90eb32f19b6e8ed46a9bda4adbfe47d7e232
|
refs/heads/master
| 2022-12-06T04:23:44.169251 | 2020-08-23T11:12:39 | 2020-08-23T11:12:39 | 286,170,780 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,024 |
java
|
/**
* @Description: 二叉树的遍历、计算结点、深度
* @Author: Cheng
* @Create: 2020-05-15 20:09
**/
class Node {
public char val; //值为字符ABC
public Node left;//左孩子-》左子树
public Node right;//右孩子-》右子树
public Node(char val) {
this.val = val;
}
}
public class BinaryTree {
public Node buildTree() {
Node A = new Node('A');
Node B = new Node('B');
Node C = new Node('C');
Node D = new Node('D');
Node E = new Node('E');
Node F = new Node('F');
Node G = new Node('G');
Node H = new Node('H');
A.left = B;
A.right = C;
B.left = D;
B.right = E;
E.right = H;
C.left = F;
C.right = G;
return A;
}
/** 1、前序遍历 递归来实现*/
public void preOrderTraversal(Node root){
if(root == null) {
return;
}
System.out.print(root.val +" ");
preOrderTraversal(root.left);
preOrderTraversal(root.right);
}
/** 2、中序遍历 递归来实现*/
public void inOrderTraversal(Node root){
if(root == null) {
return;
}
inOrderTraversal(root.left);
System.out.print(root.val+" ");
inOrderTraversal(root.right);
}
/** 3、后序遍历 递归来实现*/
public void postOrderTraversal(Node root){
if(root == null) {
return;
}
postOrderTraversal(root.left);
postOrderTraversal(root.right);
System.out.print(root.val+" ");
}
/**4、 遍历思路-求结点个数*/
static int size = 0;
public void getSize1(Node root) {
if(root == null) {
return ;
}
size++; //不为空的结点
getSize1(root.left);
getSize1(root.right);
}
// 子问题思路-求结点个数 左数个数+右数个数+1
public int getSize2(Node root){
if(root == null) {
return 0;
}
int a = getSize2(root.left);
int b = getSize2(root.right);
return a+b+1;
}
/**5、遍历思路-求叶子结点个数 */
static int leafSize = 0;
public void getLeafSize1(Node root) {
if(root == null) {
return ;
}
if (root.left == null && root.right == null) {
leafSize++; //叶子节点的 左右孩子为空
}
getLeafSize1(root.left);
getLeafSize1(root.right);
}
// 子问题思路-求叶子结点个数
public int getLeafSize2(Node root) {
if(root == null) {
return 0;
}
if (root.left == null && root.right == null) {
return 1;
}
int a = getLeafSize2(root.left);
int b = getLeafSize2(root.right);
return a+b ;
}
/**6、子问题思路-求第 k 层结点个数*/
public int getKLevelSize(Node root ,int k) {
if (root == null) {
return 0;
}
else if ( k == 1) {
return 1;
}
else {
return getKLevelSize( root.right , k-1) +
getKLevelSize(root.left , k-1);
}
}
/**7、获取二叉树最大深度*/
public int getHeight(Node root) {
if (root == null) {
return 0;
}
int left = getHeight(root.left); //需要保存 左右树的高度
int right = getHeight(root.right); //否则在三目运算符中+1的时候递归会再次计算 产生超时
return left > right ? left + 1 : right + 1;
}
/**8、查找 val 所在结点,没有找到返回 null*/
// 按照 根 -> 左子树 -> 右子树的顺序进行查找
// 一旦找到,立即返回,不需要继续在其他位置查找
public Node find(Node root, char val) {
if (root == null) {
return null;
}
//1、判断根节点是否是查找的数字val
if (root.val == val) {
return root;
}
//2、左边找 左边全部递归完成后 去右边找
Node left = find(root.left, val);
if (left != null) {
return left;
}
//3、右边找
Node right = find(root.right, val);
if (right != null) {
return right;
}
//两边都没找到
return null;
}
}
|
[
"[email protected]"
] | |
00b2bf58828b0ce9d06f18b44c7b85e93cfc1a75
|
c00ef84295ea3cfc2b7a17632628169c620314a3
|
/GuitarV3.0/src/main/java/cn/edu/cumt/dao/DataAccess.java
|
fbafc82deaf6ae3440b863f78c869cdf8e1c4fbd
|
[] |
no_license
|
caraona/Guitar3.0
|
cfaed9e3e53cbfedb71ba69723ea97683eac7269
|
9bb3479b44396586d22d69bd09f88d0a0799f195
|
refs/heads/master
| 2021-01-23T05:56:29.990899 | 2017-06-01T01:12:29 | 2017-06-01T01:12:29 | 93,002,405 | 0 | 0 | null | null | null | null |
ISO-8859-4
|
Java
| false | false | 1,111 |
java
|
package cn.edu.cumt.dao;
import cn.edu.cumt.sqliteDao.impl.GuitarDaoImpl;
import cn.edu.cumt.sqliteDao.impl.GuitarSpecDaoImpl;
public class DataAccess {
// private static String daoName = "mysqlDao";
private static String daoName = "sqliteDao";
/**
* ´´ÔėGuitarDao
* @return
*/
public static GuitarDao createGuitarDao(){
GuitarDao guitarDao = null;
try {
Object o = Class.forName("cn.edu.cumt." + daoName + ".impl.GuitarDaoImpl").newInstance();
guitarDao = (GuitarDaoImpl) o;
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e ) {
e.printStackTrace();
}
return guitarDao;
}
/**
* ´´ÔėGuitarSpecDao
* @return
*/
public static GuitarSpecDao createGuitarSpecDao(){
GuitarSpecDao guitarSpecDao = null;
try {
Object o = Class.forName("cn.edu.cumt." + daoName + ".impl.GuitarSpecDaoImpl").newInstance();
guitarSpecDao = (GuitarSpecDaoImpl) o;
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
e.printStackTrace();
}
return guitarSpecDao;
}
}
|
[
"[email protected]"
] | |
89cef9a610d6005f480fdc91a3881ae138ebc85c
|
85ac76ef311928ce4ccbc34d4774586ac65ef9d7
|
/ipa/TestIPA/src/main/java/MutantInjectionArtifacts/JID/JID2.java
|
70402fcdf9420551070d1ba9f4f51600e6e4afbc
|
[] |
no_license
|
gdevanla/jmint3
|
94ff094fa14b2e325e173d80cbe640fcf46cd6dc
|
bf84e8983c12d1e03a408649e9a4afc5860a2cd7
|
refs/heads/master
| 2021-01-23T05:30:33.243930 | 2014-01-24T19:32:19 | 2014-01-24T19:32:19 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 513 |
java
|
// This is a mutant program.
// Author : ysma
package MutantInjectionArtifacts.JID;
public class JID2
{
public int instancevar = (int) (((Math.random())*2000)+1);
public static int staticVar;
public JID2()
{
}
public JID2( int x )
{
instancevar = (int) ((Math.random() + 1) * 10);
}
public int getSomeInstanceVar()
{
int zz = this.instancevar;
return zz;
}
public int getStaticVar()
{
return JID2.staticVar;
}
}
|
[
"sed#lok"
] |
sed#lok
|
ee4d94ec36709d3be37383d319dd2a9442090e83
|
5956be48881ae28149e7feedde3b63853a126cf8
|
/library_sms_pay/src/main/java/com/y7/smspay/sdk/util/HttpURLConnectionUtils.java
|
3cbab53e9a509913dd21eba70a9b23042b38b231
|
[] |
no_license
|
jv-lee/Yuan7Game
|
b10a701fa919e6674e4c99a2f4435ba48583a1a5
|
63c7278a0f1cbe4c5d697ee001672eb853e08f36
|
refs/heads/master
| 2021-01-02T22:33:12.382699 | 2017-08-11T11:07:52 | 2017-08-11T11:08:25 | 99,334,339 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,167 |
java
|
package com.y7.smspay.sdk.util;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* 主要功能:HttpURLConnection网络工具类
*
* @Prject: CommonUtilLibrary
* @Package: com.jingewenku.abrahamcaijin.commonutil
* @author: AbrahamCaiJin
* @date: 2017年05月22日 14:13
* @Copyright: 个人版权所有
* @Company:
* @version: 1.0.0
*/
public class HttpURLConnectionUtils {
private static final int TIMEOUT_IN_MILLIONS = 5000;
public interface CallBack {
void onRequestComplete(String result);
}
/**
* 异步的Get请求
* @param urlStr
* @param callBack
*/
public static void doGetAsyn(final String urlStr, final CallBack callBack) {
new Thread() {
public void run() {
try {
String result = doGet(urlStr);
if (callBack != null) {
callBack.onRequestComplete(result);
}
} catch (Exception e) {
e.printStackTrace();
}
};
}.start();
}
/**
* 异步的Post请求
*
* @param urlStr
*
* @param params
*
* @param callBack
*
* @throws Exception
*/
public static void doPostAsyn(final String urlStr, final String params,final CallBack callBack) throws Exception {
new Thread() {
public void run() {
try {
String result = doPost(urlStr, params);
if (callBack != null) {
callBack.onRequestComplete(result);
}
} catch (Exception e) {
e.printStackTrace();
}
};
}.start();
}
/**
* Get请求,获得返回数据
* @param urlStr
* @return
* @throws Exception
*/
public static String doGet(String urlStr) {
URL url = null;
HttpURLConnection conn = null;
InputStream is = null;
ByteArrayOutputStream baos = null;
try {
url = new URL(urlStr);
conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(TIMEOUT_IN_MILLIONS);
conn.setConnectTimeout(TIMEOUT_IN_MILLIONS);
conn.setRequestMethod("GET");
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
if (conn.getResponseCode() == 200) {
is = conn.getInputStream();
baos = new ByteArrayOutputStream();
int len = -1;
byte[] buf = new byte[128];
while ((len = is.read(buf)) != -1) {
baos.write(buf, 0, len);
}
baos.flush();
return baos.toString();
} else {
throw new RuntimeException(" responseCode is not 200 ... ");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (is != null)
is.close();
} catch (IOException e) {
}
try {
if (baos != null)
baos.close();
} catch (IOException e) {
}
conn.disconnect();
}
return null;
}
/**
* 向指定 URL 发送POST方法的请求
*
* @param url
* 发送请求的 URL
* @param param
* 请求参数,请求参数应该是 name1=value1&name2=value2 的形式
* @return 代表远程资源的响应结果
* @throws Exception
*/
public static String doPost(String url, String param) {
PrintWriter out = null;
BufferedReader in = null;
String result = "";
try {
URL realUrl = new URL(url); // 打开和URL之间的连接
HttpURLConnection conn = (HttpURLConnection) realUrl
.openConnection(); // 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded"); // 设置内容类型
conn.setRequestProperty("charset", "utf-8"); // 设置字符编码
conn.setUseCaches(false); // 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);// 设置是否从httpUrlConnection读入,默认情况下是true;
conn.setReadTimeout(TIMEOUT_IN_MILLIONS); // 将读超时设置为指定的超时,以毫秒为单位。
conn.setConnectTimeout(TIMEOUT_IN_MILLIONS); // 设置一个指定的超时值(以毫秒为单位)
if (param != null && !param.trim().equals("")) { // 获取URLConnection对象对应的输出流
out = new PrintWriter(conn.getOutputStream()); // 发送请求参数
out.print(param);
// flush输出流的缓冲
out.flush();
}
// 定义BufferedReader输入流来读取URL的响应
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
} catch (Exception e) {
e.printStackTrace();
}
// 使用finally块来关闭输出流和输入流
finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result;
}
}
|
[
"[email protected]"
] | |
5b1e1e35e3e557ba1b50cc3197c1d41a526f1395
|
6a1b4aa7b3210cf8732e6122af73b8f8e73dd40f
|
/ecsite/src/com/internousdev/ecsite/dao/UserCreateCompleteDAO.java
|
87d405156453e509c2567e7f749b5195b648cadc
|
[] |
no_license
|
kinoshita02/my-ecsite
|
ee6c38cbfd5ae5576e542a523ed59ee8288f5060
|
16ba0f736aa7c330dd2f574c30dbd6ba4c42c8dc
|
refs/heads/master
| 2020-05-02T17:35:19.427840 | 2019-03-28T02:02:29 | 2019-03-28T02:02:29 | 178,103,547 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 920 |
java
|
package com.internousdev.ecsite.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import com.internousdev.ecsite.util.DBConnector;
import com.internousdev.ecsite.util.DateUtil;
public class UserCreateCompleteDAO {
public void createUser(String userId, String password, String name){
DBConnector db=new DBConnector();
Connection con=db.getConnection();
DateUtil date=new DateUtil();
String sql="insert into login_user_transaction(login_id, login_pass, user_name, insert_date)"
+" values(?,?,?,?)";
try{
PreparedStatement ps=con.prepareStatement(sql);
ps.setString(1, userId);
ps.setString(2, password);
ps.setString(3, name);
ps.setString(4, date.getDate());
ps.execute();
} catch(Exception e){
e.printStackTrace();
} finally{
try{
con.close();
} catch(SQLException e){
e.printStackTrace();
}
}
}
}
|
[
"[email protected]"
] | |
607c5ec48e0d7f708ff1ae466a664b6df5ef5a4e
|
8c54afa4b2243ba8527b760ea439e35ecb6c3342
|
/Chapter9/src/template/Car.java
|
c427ae082b2ab12a5ca11e9a0b281caffaa0b580
|
[] |
no_license
|
saeminakim/java_basic
|
1cddd32d3f42848b2512021cdaf63f5f6f8ed7f8
|
9f5246aef5951325a7f6be493af9e208137ee383
|
refs/heads/master
| 2023-08-11T16:32:31.665269 | 2021-09-28T07:31:22 | 2021-09-28T07:31:22 | 399,723,675 | 0 | 0 | null | null | null | null |
UHC
|
Java
| false | false | 785 |
java
|
package template;
public abstract class Car {
public abstract void drive(); //차종에 따라 달리는 방법이 다를 수 있으니 여기서 구현 x
public abstract void stop();
public abstract void wiper();
public void washCar() {} // 구현코드 없이 선언해놓고 하위 클래스에서 필요에 따라 재정의해서 사용할 수 있음 hook method
public void startCar() {
System.out.println("시동을 켭니다.");
}
public void turnOff() {
System.out.println("시동을 끕니다.");
}
// template method
public final void run() {
// 일련의 시나리오는 재정의되면 안되기 때문에 final로 선언
// 하위 클래스에서 재정의 불가
startCar();
drive();
wiper();
stop();
washCar();
turnOff();
}
}
|
[
"[email protected]"
] | |
df82bb37f7f0fab1910848ed8cf61d0146a2decd
|
7b73756ba240202ea92f8f0c5c51c8343c0efa5f
|
/classes5/rym.java
|
2b9b49b1c275bb3c3d51d9e824535b72909d971f
|
[] |
no_license
|
meeidol-luo/qooq
|
588a4ca6d8ad579b28dec66ec8084399fb0991ef
|
e723920ac555e99d5325b1d4024552383713c28d
|
refs/heads/master
| 2020-03-27T03:16:06.616300 | 2016-10-08T07:33:58 | 2016-10-08T07:33:58 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,636 |
java
|
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.filemanager.app.FileManagerEngine;
import com.tencent.mobileqq.filemanager.core.FileManagerNotifyCenter;
import com.tencent.mobileqq.filemanager.core.OnlineFileSessionWorker;
import com.tencent.mobileqq.filemanager.data.FileManagerEntity;
import com.tencent.mobileqq.filemanager.util.FileManagerUtil;
import com.tencent.mobileqq.hotpatch.NotVerifyClass;
import com.tencent.qphone.base.util.QLog;
public class rym
extends ryd
{
public rym(OnlineFileSessionWorker paramOnlineFileSessionWorker)
{
super(paramOnlineFileSessionWorker);
boolean bool = NotVerifyClass.DO_VERIFY_CLASS;
}
protected String a()
{
return "StateExcepInvalidWhenChangeToOff";
}
protected void a(int paramInt1, int paramInt2)
{
b(paramInt1, paramInt2);
OnlineFileSessionWorker.b(this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker, 11, 11);
OnlineFileSessionWorker.c(this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker, 11, 14);
QLog.i("OnlineFileSessionWorker<FileAssistant>", 1, "OLfilesession[" + this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker.h + "] state change :(" + this.jdField_a_of_type_Ryd.a() + "->StateUploadingWhenChangeToOff)");
this.jdField_a_of_type_Ryd = new rzd(this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker);
}
protected boolean a()
{
if (this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker.jdField_a_of_type_ComTencentMobileqqFilemanagerDataFileManagerEntity == null)
{
QLog.e("OnlineFileSessionWorker<FileAssistant>", 1, "OLfilesession[" + this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker.h + "]. recvOnLineFile entity is null");
return false;
}
OnlineFileSessionWorker.b(this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker, 9, 12);
OnlineFileSessionWorker.c(this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker, 9, 12);
QLog.i("OnlineFileSessionWorker<FileAssistant>", 1, "OLfilesession[" + this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker.h + "] state change :(" + this.jdField_a_of_type_Ryd.a() + "->StateExcepInvalidWhenRecv)");
this.jdField_a_of_type_Ryd = new ryo(this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker);
return true;
}
protected boolean a(int paramInt, String paramString, long paramLong)
{
FileManagerEntity localFileManagerEntity = this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker.jdField_a_of_type_ComTencentMobileqqFilemanagerDataFileManagerEntity;
if (localFileManagerEntity == null)
{
QLog.e("OnlineFileSessionWorker<FileAssistant>", 1, "OLfilesession[" + this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker.h + "]. recvOnLineFile entity is null");
return false;
}
localFileManagerEntity.Uuid = new String(paramString);
localFileManagerEntity.fProgress = 0.0F;
if ((FileManagerUtil.a(localFileManagerEntity.fileName) == 0) && (localFileManagerEntity.Uuid != null) && (localFileManagerEntity.Uuid.length() != 0)) {
this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker.jdField_a_of_type_ComTencentMobileqqAppQQAppInterface.a().a(localFileManagerEntity.Uuid, 3, false, localFileManagerEntity);
}
localFileManagerEntity.setCloudType(1);
OnlineFileSessionWorker.b(this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker, 11, 13);
OnlineFileSessionWorker.c(this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker, 11, 13);
QLog.i("OnlineFileSessionWorker<FileAssistant>", 1, "OLfilesession[" + this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker.h + "] state change :(" + this.jdField_a_of_type_Ryd.a() + "->StateUploadoneWhenChangeToOff)");
this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker.jdField_a_of_type_ComTencentMobileqqAppQQAppInterface.a().a(true, 22, new Object[] { Long.valueOf(localFileManagerEntity.nSessionId), Long.valueOf(localFileManagerEntity.nOLfileSessionId) });
this.jdField_a_of_type_Ryd = new rzg(this.jdField_a_of_type_ComTencentMobileqqFilemanagerCoreOnlineFileSessionWorker);
return true;
}
}
/* Location: E:\apk\QQ_91\classes5-dex2jar.jar!\rym.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|
[
"[email protected]"
] | |
ede4c4a22449664b5f3c5951dd608a8a987111fa
|
574919cb1f5cd54d37914387e6726eb497d41529
|
/trapezoidArea.java
|
43a15934adc1a27c41e4c0b65abaf60aa5b0f142
|
[] |
no_license
|
demitech1024/apcsa-trapezoid
|
1e93b0c1247f57d2eb837cd6f2536d17b09bc9cf
|
ae9695a445bcc0284d56492c8f325c98ec02c490
|
refs/heads/master
| 2020-08-05T05:24:34.242171 | 2019-10-02T18:33:04 | 2019-10-02T18:33:04 | 212,412,513 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 643 |
java
|
import java.util.Scanner;
public class trapezoidArea {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.print("\nEnter a top for the trapezoid : ");
double top = s.nextDouble();
System.out.print("\nEnter a bottom for the trapezoid : ");
double bottom = s.nextDouble();
System.out.print("\nEnter a height for the trapezoid : ");
double height = s.nextDouble();
double area = ((top + bottom) / 2) * height;
System.out.printf("\nThe area of the trapezoid is %,.1f.\n\n", area);
s.close();
}
}
|
[
"[email protected]"
] | |
f18b277ceabd120e848b2cf7a4b5f2f0c42a981b
|
1ca86d5d065372093c5f2eae3b1a146dc0ba4725
|
/core-java-modules/core-java-perf/src/main/java/com/surya/memoryleaks/staticfields/StaticFieldsDemo.java
|
692fea66b1021967b4ace1f1f2c886305bb40225
|
[] |
no_license
|
Suryakanta97/DemoExample
|
1e05d7f13a9bc30f581a69ce811fc4c6c97f2a6e
|
5c6b831948e612bdc2d9d578a581df964ef89bfb
|
refs/heads/main
| 2023-08-10T17:30:32.397265 | 2021-09-22T16:18:42 | 2021-09-22T16:18:42 | 391,087,435 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 555 |
java
|
package com.surya.memoryleaks.staticfields;
import java.util.ArrayList;
import java.util.List;
public class StaticFieldsDemo {
public static List<Double> list = new ArrayList<>();
public void populateList() {
for (int i = 0; i < 10000000; i++) {
list.add(Math.random());
}
System.out.println("Debug Point 2");
}
public static void main(String[] args) {
System.out.println("Debug Point 1");
new StaticFieldsDemo().populateList();
System.out.println("Debug Point 3");
}
}
|
[
"[email protected]"
] | |
939b3aeeade04aee801f5b3820af001dda023b69
|
238ed5a13579aa1ac3591dbab83b8288a340482c
|
/Leetcode9/src/XOfAKindInADeckOfCards.java
|
49bef8c79142fc445fa9a53763348395f39ecc31
|
[] |
no_license
|
verginiaa/Leetcode
|
7df55dbfe0e181d9fc41e349e2595e8852b871f7
|
07ad4d2a3dd7dea1240a2af62b07434316f58751
|
refs/heads/master
| 2023-03-03T17:36:50.185099 | 2021-02-04T11:53:31 | 2021-02-04T11:53:31 | 315,642,047 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 601 |
java
|
import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;
public class XOfAKindInADeckOfCards {
public boolean hasGroupsSizeX(int[] deck) {
int[] count = new int[10000];
for (int c: deck)
count[c]++;
int g = -1;
for (int i = 0; i < 10000; ++i)
if (count[i] > 0) {
if (g == -1)
g = count[i];
else
g = gcd(g, count[i]);
}
return g >= 2;
}
public int gcd(int x, int y) {
return x == 0 ? y : gcd(y%x, x);
}
}
|
[
"[email protected]"
] | |
45901b3582784c9015e8b161f0be7502d25bc343
|
72f763d138d244ce5834f5cdd4cbefb4b4239ad6
|
/app/src/main/java/com/appli/nyx/formx/preference/PrefsManager.java
|
6ab6260b1fba59f887f8ffd6f71b5e97db322324
|
[] |
no_license
|
tchipi88/FormX
|
1542d944cf6a42678eacce9394d255736dec5a8c
|
3a1a0d73b001b09dbce4d5c4691488d21961180b
|
refs/heads/master
| 2023-02-25T03:51:25.512625 | 2020-05-24T19:06:28 | 2020-05-24T19:06:28 | 333,015,989 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,476 |
java
|
package com.appli.nyx.formx.preference;
import org.androidannotations.annotations.EBean;
import org.androidannotations.annotations.sharedpreferences.Pref;
@EBean
public class PrefsManager {
@Pref
protected Prefs_ prefs_;
public String getFirebaseToken() {
return prefs_.firebaseToken().get();
}
public void setFirebaseToken(String token) {
prefs_.edit().firebaseToken().put(token).apply();
}
public String getCurrentUserEmail() {
return prefs_.currentUserEmail().get();
}
public void setCurrentUserEmail(String email) {
prefs_.edit().currentUserEmail().put(email).apply();
}
public String getCurrentUserName() {
return prefs_.currentUserName().get();
}
public void setCurrentUserName(String name) {
prefs_.edit().currentUserName().put(name).apply();
}
public boolean isFirstLaunch() {
return prefs_.firstLaunch().getOr(true);
}
public void setFirstLaunch(boolean firstLaunch) {
prefs_.edit().firstLaunch().put(firstLaunch).apply();
}
public void clearSessionPrefs() {
setCurrentUserName(null);
setCurrentUserEmail(null);
}
public boolean isNotifications() {
return prefs_.notifications().getOr(true);
}
public void setNotifications(boolean isLogged) {
prefs_.edit().notifications().put(isLogged).apply();
}
//TODO
public boolean isProfilComplete() {
return prefs_.isProfilComplete().getOr(false);
}
public void setProfilComplete(boolean value) {
prefs_.edit().isProfilComplete().put(value).apply();
}
}
|
[
"[email protected]"
] | |
70f365a4de1fcf239c220105bef2a410ea878592
|
93373a77a20937f928fcd447eba16bb7ced139ac
|
/practice/hasa/SmartPhone.java
|
e56defc56137e240cfb3f38bdf2ecfa0f8ac3823
|
[] |
no_license
|
TY-Sudharshan-BS/corejava
|
b506314eecac71a1a38fa550267d34dccfe4b22c
|
50afe92d5ba4f0cc426a06a2abb7353d6305b6da
|
refs/heads/master
| 2023-03-28T12:27:04.035687 | 2021-03-25T12:54:20 | 2021-03-25T12:54:20 | 351,423,431 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 396 |
java
|
package com.tyss.practice.hasa;
public class SmartPhone {
String brand;
long imei;
String model_name;
Battery battery;
Sim sim;
Rom rom;
public SmartPhone(String brand, long imei, String model_name, Battery battery, Sim sim, Rom rom) {
super();
this.brand = brand;
this.imei = imei;
this.model_name = model_name;
this.battery = battery;
this.sim = sim;
this.rom = rom;
}
}
|
[
"[email protected]"
] | |
135eb952a164d6b7d3e782039e281786b7e38de9
|
1b0798cf742c140e2f85e56e796a8e3fffd77f42
|
/src/brickbreak/Breaker.java
|
3302dddeacfbc99d8154c3c8f2a91bcccbf04d25
|
[] |
no_license
|
TheDryck/BrickBreaker
|
fea8b65391df4f2294f91154ff790177da4b30cd
|
785513f814d11fe59a371f89bd0f0093576882e9
|
refs/heads/master
| 2020-07-12T10:43:49.691920 | 2019-08-27T21:52:50 | 2019-08-27T21:52:50 | 204,796,387 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,416 |
java
|
package brickbreak;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.Timer;
import javax.swing.JPanel;
public class Breaker extends JPanel implements KeyListener, ActionListener{
private boolean play = false;
private int score = 0;
private int totalBricks = 21;
private Timer time;
private int delay = 8;
private int sliderStart = 310;
private int ballposX = 120;
private int ballposY = 350;
private int balldirX = -1;
private int balldirY = -2;
private MapGen map;
public Breaker() {
addKeyListener(this);
setFocusable(true);
setFocusTraversalKeysEnabled(false);
map = new MapGen(3, 7);
time = new Timer(delay,this);
time.start();
}
public void paint(Graphics g) {
//Background
g.setColor(Color.black);
g.fillRect(1, 1, 692, 592);
//Borders
g.setColor(Color.yellow);
g.fillRect(0, 0, 3, 592);
g.fillRect(0, 0, 692, 3);
g.fillRect(691, 0, 3, 592);
//Slider
g.setColor(Color.green);
g.fillRect(sliderStart, 550, 100, 8);
//Ball
g.setColor(Color.cyan);
g.fillOval(ballposX, ballposY, 20, 20);
//Bricks
map.draw((Graphics2D)g);
//Score
g.setColor(Color.white);
g.setFont(new Font("serif", Font.BOLD, 25));
g.drawString(""+ score, 590, 30);
if(ballposY > 570) {
play = false;
balldirX = 0;
balldirY = 0;
g.setColor(Color.red);
g.setFont(new Font("serif", Font.BOLD, 35));
g.drawString("Game Over: Fatality!!", 190, 300);
g.setFont(new Font("serif", Font.BOLD, 20));
g.drawString("Press Enter to restart", 230, 350);
}
if(totalBricks <= 0) {
play = false;
balldirX = 0;
balldirY = 0;
g.setColor(Color.red);
g.setFont(new Font("serif", Font.BOLD, 35));
g.drawString("Victory!!", 260, 300);
g.setFont(new Font("serif", Font.BOLD, 20));
g.drawString("Press Enter to Restart", 230, 350);
}
g.dispose();
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
time.start();
if(play == true) {
if(new Rectangle(ballposX,ballposY, 20, 20).intersects(new Rectangle(sliderStart, 550, 100, 8))) {
balldirY = -balldirY;
}
A: for(int i = 0; i<map.map.length; i++) {
for(int j = 0; j<map.map[0].length; j++) {
if(map.map[i][j] > 0) {
int brickX = j*map.brickWidth + 80;
int brickY = i*map.brickHeight + 50;
int brickWidth = map.brickWidth;
int brickHeight = map.brickHeight;
Rectangle rectangle = new Rectangle(brickX, brickY, brickWidth, brickHeight);
Rectangle ballRectangle = new Rectangle(ballposX, ballposY, 20, 20);
Rectangle brickRectangle = rectangle;
if(ballRectangle.intersects(brickRectangle)) {
map.setBrickVal(0, i, j);
totalBricks--;
score += 5;
if(ballposX + 19 <= brickRectangle.x || ballposX + 1 >= brickRectangle.x + brickRectangle.width) {
balldirX = -balldirX;
}else {
balldirY = -balldirY;
}
break A;
}
}
}
}
ballposX += balldirX;
ballposY += balldirY;
if(ballposY < 0) {
balldirY = -balldirY;
}
if(ballposX < 0) {
balldirX = -balldirX;
}
if(ballposX > 670) {
balldirX = -balldirX;
}
}
repaint();
}
@Override
public void keyTyped(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyPressed(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_RIGHT) {
if(sliderStart >= 600) {
sliderStart = 600;
}else {
moveRight();
}
}
if(e.getKeyCode() == KeyEvent.VK_LEFT) {
if(sliderStart <= 10) {
sliderStart = 10;
}else {
moveLeft();
}
}
if(e.getKeyCode() == KeyEvent.VK_ENTER) {
if(!play) {
play = true;
ballposX = 120;
ballposY = 350;
balldirX = -1;
balldirY = -2;
sliderStart = 310;
score = 0;
totalBricks = 21;
map = new MapGen(3, 7);
repaint();
}
}
}
public void moveRight() {
play = true;
sliderStart += 20;
}
public void moveLeft() {
play = true;
sliderStart -= 20;
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
}
|
[
"[email protected]"
] | |
d5186c33db679991aa2538d346a39444c301bd6a
|
eb27fa1a9533519771ed53eae1d07bc098425cf3
|
/src/main/java/cn/modules/sys/controller/SysRoleController.java
|
4f9bdef7b063b24dd483de958675330448c4703c
|
[] |
no_license
|
JiancongLee/Anze
|
1f0d7875bcfacb493c324b44fec7316f384d0711
|
1d94e7121e07417fce4c04f514d8d54f701c9971
|
refs/heads/master
| 2022-12-10T18:56:59.706709 | 2019-06-04T06:55:19 | 2019-06-04T06:55:19 | 167,913,424 | 0 | 1 | null | 2022-12-06T00:39:58 | 2019-01-28T06:52:18 |
Java
|
UTF-8
|
Java
| false | false | 3,774 |
java
|
package cn.modules.sys.controller;
import cn.base.AbstractController;
import cn.common.annotation.SysLog;
import cn.common.constant.Constant;
import cn.common.utils.PageUtils;
import cn.common.utils.Result;
import cn.common.validator.ValidatorUtils;
import cn.common.vo.TreeVo;
import cn.modules.sys.entity.SysRoleEntity;
import cn.modules.sys.service.SysRoleMenuService;
import cn.modules.sys.service.SysRoleService;
import com.google.common.collect.Lists;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 角色管理
*
* @author chenshun
* @email [email protected]
* @date 2016年11月8日 下午2:18:33
*/
@RestController
@RequestMapping("/sys/role")
public class SysRoleController extends AbstractController {
@Autowired
private SysRoleService sysRoleService;
@Autowired
private SysRoleMenuService sysRoleMenuService;
/**
* 角色列表
*/
@GetMapping("/list")
@RequiresPermissions("sys:role:list")
public Result list(@RequestParam Map<String, Object> params){
//如果不是超级管理员,则只查询自己创建的角色列表
if(getUserId() != Constant.SUPER_ADMIN){
params.put("createUserId", getUserId());
}
PageUtils page = sysRoleService.queryPage(params);
return Result.ok().put("page", page);
}
/**
* 角色列表
*/
@GetMapping("/select")
@RequiresPermissions("sys:role:select")
public Result select(){
Map<String, Object> map = new HashMap<>();
//如果不是超级管理员,则只查询自己所拥有的角色列表
if(getUserId() != Constant.SUPER_ADMIN){
map.put("createUserId", getUserId());
}
List<SysRoleEntity> list = sysRoleService.selectByMap(map);
return Result.ok().put("list", list);
}
/**
* 角色列表
*/
@GetMapping("/all")
public Result all(){
Map<String, Object> map = new HashMap<>();
//如果不是超级管理员,则只查询自己所拥有的角色列表
if(getUserId() != Constant.SUPER_ADMIN){
map.put("createUserId", getUserId());
}
List<SysRoleEntity> list = sysRoleService.selectByMap(map);
List<TreeVo> treeVos = Lists.newArrayList();
list.forEach(sysRoleEntity -> {
TreeVo treeVo = new TreeVo(String.valueOf(sysRoleEntity.getRoleId()),sysRoleEntity.getRoleName(),null,false);
treeVos.add(treeVo);
});
return Result.ok().put("list", treeVos);
}
/**
* 角色信息
*/
@GetMapping("/info/{roleId}")
@RequiresPermissions("sys:role:info")
public Result info(@PathVariable("roleId") Long roleId){
SysRoleEntity role = sysRoleService.selectById(roleId);
//查询角色对应的菜单
List<Long> menuIdList = sysRoleMenuService.queryMenuIdList(roleId);
role.setMenuIdList(menuIdList);
return Result.ok().put("role", role);
}
/**
* 保存角色
*/
@SysLog("保存角色")
@PostMapping("/save")
@RequiresPermissions("sys:role:save")
public Result save(@RequestBody SysRoleEntity role){
ValidatorUtils.validateEntity(role);
role.setCreateUserId(getUserId());
sysRoleService.save(role);
return Result.ok();
}
/**
* 修改角色
*/
@SysLog("修改角色")
@PostMapping("/update")
@RequiresPermissions("sys:role:update")
public Result update(@RequestBody SysRoleEntity role){
ValidatorUtils.validateEntity(role);
role.setCreateUserId(getUserId());
sysRoleService.update(role);
return Result.ok();
}
/**
* 删除角色
*/
@SysLog("删除角色")
@PostMapping("/delete")
@RequiresPermissions("sys:role:delete")
public Result delete(@RequestBody Long[] roleIds){
sysRoleService.deleteBatch(roleIds);
return Result.ok();
}
}
|
[
"[email protected]"
] | |
2cb57ca1895ae554853cf9b471e6844d3e3e56f3
|
0b80d92f029cdf716941674ce41ba2e514741984
|
/src/main/java/com/github/guennishueftgold/trapezeapi/ShortStationInfo.java
|
5a1daa4428a508dc338188a0e22808341458ee43
|
[] |
no_license
|
GuennisHueftgold/TrapezeApi
|
b0e6301b3d972cb0a75b8d33758bcb1b75829455
|
b31fe3c4b56b9a4e0f0cb310bcd8efcda3fa770b
|
refs/heads/master
| 2021-09-04T06:25:36.215284 | 2018-01-04T16:21:26 | 2018-01-04T16:21:26 | 115,356,935 | 0 | 0 | null | 2018-01-16T17:30:27 | 2017-12-25T18:43:12 |
Java
|
UTF-8
|
Java
| false | false | 4,181 |
java
|
package com.github.guennishueftgold.trapezeapi;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.util.Objects;
public final class ShortStationInfo {
private final String mId;
private final String mStopName;
private final String mStopShortName;
private ShortStationInfo(Builder builder) {
this.mId = builder.mId;
this.mStopName = builder.mStopName;
this.mStopShortName = builder.mStopShortName;
}
public String getId() {
return mId;
}
public String getStopName() {
return mStopName;
}
public String getStopShortName() {
return mStopShortName;
}
@Override
public String toString() {
return "ShortStationInfo{" +
"mId='" + mId + '\'' +
", mStopName='" + mStopName + '\'' +
", mStopShortName='" + mStopShortName + '\'' +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ShortStationInfo that = (ShortStationInfo) o;
return Objects.equals(mId, that.mId) &&
Objects.equals(mStopName, that.mStopName) &&
Objects.equals(mStopShortName, that.mStopShortName);
}
@Override
public int hashCode() {
return Objects.hash(mId, mStopName, mStopShortName);
}
public static class Builder {
private String mId;
private String mStopName;
private String mStopShortName;
public String getId() {
return mId;
}
public Builder setId(String id) {
mId = id;
return this;
}
public String getStopName() {
return mStopName;
}
public Builder setStopName(String stopName) {
mStopName = stopName;
return this;
}
public String getStopShortName() {
return mStopShortName;
}
public Builder setStopShortName(String stopShortName) {
mStopShortName = stopShortName;
return this;
}
public ShortStationInfo build() {
return new ShortStationInfo(this);
}
}
static class Converter extends TypeAdapter<ShortStationInfo> {
private final static String NAME_ID = "id", NAME_NAME = "name", NAME_NUMBER = "number";
@Override
public void write(JsonWriter out, ShortStationInfo value) throws IOException {
if (value == null) {
out.nullValue();
return;
}
out.beginObject();
out.name(NAME_NAME)
.value(value.getStopName());
out.name(NAME_ID)
.value(value.getId());
out.name(NAME_NUMBER)
.value(value.getStopShortName());
out.endObject();
}
@Override
public ShortStationInfo read(JsonReader in) throws IOException {
if (in.peek() == JsonToken.NULL) {
in.skipValue();
return null;
}
in.beginObject();
String name;
Builder builder = new Builder();
while (in.hasNext()) {
name = in.nextName();
if (NAME_NAME.equalsIgnoreCase(name) && in.peek() == JsonToken.STRING) {
builder.setStopName(in.nextString());
} else if (NAME_ID.equalsIgnoreCase(name) && in.peek() == JsonToken.STRING) {
builder.setId(in.nextString());
} else if (NAME_NUMBER.equalsIgnoreCase(name) && in.peek() == JsonToken.STRING) {
builder.setStopShortName(in.nextString());
} else {
Logger.reportUnknownName(this, name, in.peek());
in.skipValue();
}
}
in.endObject();
return builder.build();
}
}
}
|
[
"[email protected]"
] | |
87341808ea6047df395915fc6ff0cd2db89eeb64
|
ef830bb18e1f432122e1c9523d4c807c9ef077a5
|
/src/main/java/com/taobao/api/domain/Materialitemswlbwmsstockpruductprocessingnotify.java
|
4c9a4e89a3db88a63879aa388d99ee7af30a7f10
|
[] |
no_license
|
daiyuok/TopSecuritySdk
|
bb424c5808bd103079cbbbfcb56689a73259a24d
|
8ac8eb48b88158a741c820a940564fd0b876e9db
|
refs/heads/master
| 2021-01-22T06:49:05.025064 | 2017-03-01T06:19:42 | 2017-03-01T06:19:42 | 81,789,925 | 2 | 2 | null | null | null | null |
UTF-8
|
Java
| false | false | 699 |
java
|
package com.taobao.api.domain;
import com.taobao.api.internal.mapping.ApiField;
import com.taobao.api.TaobaoObject;
/**
* 原料商品列表
*
* @author top auto create
* @since 1.0, null
*/
public class Materialitemswlbwmsstockpruductprocessingnotify extends TaobaoObject {
private static final long serialVersionUID = 3883481541674949946L;
/**
* 商品列表
*/
@ApiField("order_item")
private Orderitemwlbwmsstockpruductprocessingnotify orderItem;
public Orderitemwlbwmsstockpruductprocessingnotify getOrderItem() {
return this.orderItem;
}
public void setOrderItem(Orderitemwlbwmsstockpruductprocessingnotify orderItem) {
this.orderItem = orderItem;
}
}
|
[
"[email protected]"
] | |
846b0d195d84a8adbbdbbc0a2797d6f114ca2add
|
254c40b7a140723b10fc331b6f22f5aabf585f6a
|
/src/java/br/com/hotelProf/dao/FabricaConexao.java
|
98d55a45e7d286af37d2d0a87c1c5e7193b4b6b6
|
[] |
no_license
|
cel055/PISenac2Semestre2016Admin
|
14ed5cca560822ee065702bd7e73391e1f84ac38
|
52dace2febbf423d94107a721dd2acab1e0fce58
|
refs/heads/master
| 2021-01-11T19:16:03.751495 | 2017-01-18T13:35:43 | 2017-01-18T13:35:43 | 79,343,082 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,424 |
java
|
package br.com.hotelProf.dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class FabricaConexao {
public static Connection getConnection() throws Exception {
try {
Class.forName("com.mysql.jdbc.Driver");
return DriverManager.getConnection("jdbc:mysql://localhost:3306/hotelSenac", "root", "");
} catch (ClassNotFoundException | SQLException ex) {
throw new Exception(ex.getMessage());
}
}
private static void close(Connection conn, Statement stmt,
ResultSet rs) throws Exception {
try {
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
if (conn != null) {
conn.close();
}
} catch (Exception e) {
throw new Exception(e.getMessage());
}
}
public static void closeConnection(Connection conn, Statement stmt,
ResultSet rs) throws Exception {
close(conn, stmt, rs);
}
public static void closeConnection(Connection conn,
Statement stmt) throws Exception {
close(conn, stmt, null);
}
public static void closeConnection(Connection conn) throws Exception {
close(conn, null, null);
}
}
|
[
"[email protected]"
] | |
dc25f7f9aad00e2b93343782d88ee0f73ef72a06
|
b8e9a2b9314c3111c4eaa364cc9742e4eec6a79a
|
/src/Game2048.java
|
419014b92608f53da8cde97d7daac25a48355fef
|
[] |
no_license
|
PanBukowski/Learning2048
|
aa248cf8c5db2375ddd7bf1679da95ab972bebaf
|
92e9ffac37fc70587d006f7afc41629bcc94913d
|
refs/heads/master
| 2021-07-07T01:33:21.425313 | 2017-10-02T19:14:26 | 2017-10-02T19:14:26 | 103,351,599 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,839 |
java
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
public class Game2048 {
static int[][] board;
static boolean still_in_game = true;
public static void main(String[] args) throws IOException {
initialize();
while(still_in_game) {
//Add random tile to the game 2 or 4.
addRandomTile();
print();
//Select your move via console
move();
still_in_game=false;
check();
}
System.out.println("Game Over.");
//System.out.println("Your score is: ");
}
private static void initialize() {
board = new int[4][4];
}
private static void move() throws IOException {
String move = null;
while(true) {
//Wraping InputStreamReader with BufferedReader
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Select your move W/A/S/D:");
move = input.readLine();
if(move.equals("W") || move.equals("w")) {
moveUP();
break;
}
if(move.equals("A") || move.equals("a")) {
moveLEFT();
break;
}
if(move.equals("S") || move.equals("s")) {
moveDOWN();
break;
}
if(move.equals("D") || move.equals("d")) {
moveRIGHT();
break;
}
else {
System.out.println("Invalid move");
}
}
}
private static void moveRIGHT() {
//sorting board in right direction
int[] line = new int[4];
for(int i=0;i<board.length;i++) {
for(int j=0;j<board.length;j++) {
line[line.length-j-1]=board[i][j];
}
line = sort(line);
for(int j=0;j<board.length;j++) {
board[i][j]=line[line.length-j-1];
}
}
}
private static void moveDOWN() {
//sorting board in dwon direction
int[] line = new int[4];
for(int i=0;i<board.length;i++) {
for(int j=0;j<board.length;j++) {
line[line.length-j-1]=board[j][i];
}
line = sort(line);
for(int j=0;j<board.length;j++) {
board[j][i]=line[line.length-j-1];
}
}
}
private static void moveLEFT() {
//sorting board in left direction
int[] line = new int[4];
for(int i=0;i<board.length;i++) {
for(int j=0;j<board.length;j++) {
line[j]=board[i][j];
}
line = sort(line);
for(int j=0;j<board.length;j++) {
board[i][j]=line[j];
}
}
}
private static void moveUP() {
//sorting board in up direction
int[] line = new int[4];
for(int i=0;i<board.length;i++) {
for(int j=0;j<board.length;j++) {
line[j]=board[j][i];
}
line = sort(line);
for(int j=0;j<board.length;j++) {
board[j][i]=line[j];
}
}
}
private static int[] sort(int[] line) {
int[] before = new int[4];
int[] after = line;
do {
for(int i=0;i<after.length;i++) {
before[i]=after[i];
}
for(int i=1;i<after.length;i++) {
if(before[i-1]==0 && before[i]!=0) {
after[i-1]=after[i];
after[i]=0;
}
if(before[i-1]==before[i] && before[i]!=0) {
after[i-1]++;
after[i]=0;
}
}
}while(!Arrays.equals(after, before));
return after;
}
private static void addRandomTile() {
//Generate random value then replace random 0 on board with that
Random rand = new Random();
int x,y,val;
val=rand.nextInt(2)+1;
do{
x=rand.nextInt(4);
y=rand.nextInt(4);
}
while(board[x][y]!=0);
board[x][y]=val;
}
private static void check() {
//Check for available place to set next tile
for(int i=0;i<board.length;i++) {
for(int j=0;j<board[i].length;j++) {
if(board[i][j]==0) {
still_in_game=true;
}
}
}
}
private static void print() {
String line = "";
for(int i=0;i<board.length;i++) {
for(int j=0;j<board[i].length;j++) {
if(board[i][j]==0) {
line = line + board[i][j] + "\t";
}else {
line = line + (int) Math.pow(2, board[i][j]) + "\t";
}
}
line = line + "\n";
}
System.out.println(line);
}
}
|
[
"[email protected]"
] | |
0a280a5aa95a08b37baf469d267c9eac1e5c8f62
|
1fc5018279d42992f0935f64cfc70600e3149cba
|
/DevGames/app/src/main/java/baecon/devgames/model/Duplication.java
|
688ff9287c43a55b91fc6f880046a9e04647f121
|
[] |
no_license
|
MHHollink/ICTLAB_DevGames-App-v1
|
da1a6654774bd255f354b4ce2c88fe07cf01d6a0
|
669bd81264c8c32ed50353add9ffb95a51a8bcba
|
refs/heads/master
| 2021-01-20T11:45:42.129061 | 2016-05-26T11:13:18 | 2016-05-26T11:13:18 | 54,200,844 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,195 |
java
|
package baecon.devgames.model;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import java.io.Serializable;
import baecon.devgames.database.DBHelper;
/**
* Created by Marcel on 27-4-2016.
*/
@DatabaseTable(tableName = DBHelper.Tables.DUPLICATIONS)
public class Duplication extends AbsSynchronizable implements Serializable {
public static class Column {
public static final String PUSHED_IN = "pushedIn";
}
@DatabaseField(columnName = Column.PUSHED_IN, foreign = true, foreignAutoRefresh = true)
private Push pushedIn;
public Duplication() {
// Empty for ORM lite
}
public Duplication(Long id, Push pushedIn) {
super(id);
this.pushedIn = pushedIn;
}
public Push getPushedIn() {
return pushedIn;
}
public void setPushedIn(Push pushedIn) {
this.pushedIn = pushedIn;
}
@Override
public boolean contentEquals(Object other) {
return false;
} // TODO: 09-5-2016
@Override
public String toString() {
return "Duplication{" +
"pushedIn=" + pushedIn +
"} " + super.toString();
}
}
|
[
"[email protected]"
] | |
1eec867acffc245e16e4f3bf91c00d89c84ccd3c
|
73669bce6e190288e442498fec7ea9d01877fab8
|
/APCSPrograms/Light copy.java
|
51bca9072f2efd98463d4217da1c57515c81b2f5
|
[] |
no_license
|
pybeebee/JavaPractice
|
1ba2d831a041424e863469cdfa6d34cc77d9d055
|
ab5e137ce2ed91e3e43e1e6302360fe06337bd30
|
refs/heads/master
| 2016-09-06T05:29:38.438391 | 2015-09-13T00:24:15 | 2015-09-13T00:24:15 | 42,022,903 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 9,331 |
java
|
/*
* AP CS MOOC
* Term 2 - Assignment 2, Part 1: Light
* A class which represents a single light bulb.
* February 22, 2015
* Gabrielle Kaili-May Liu
*/
public class Light
/* Variables that will be initialized in the Light constructors.*/
{
private boolean on;
boolean burntOut;
String color = "";
public Light()
/* Default constructor that sets the bulb to on, not burnt out, and "white".*/
{
on = true;
burntOut = false;
color = "white";
}
public Light(boolean o, boolean b, String c)
/* This constructor sets the variable "on" to the parameter o.
* The burntOut variable is set to the parameter b. If burntOut
* is true, on is set to false, no matter what value is stored in o.
* The color variable is set to the parameter c only if c is "red", "green"
* or "blue". The constructor ignores the case of the value in c. If c holds
* any value other than "red", "green" or "blue", the constructor sets
* color to "white".
*/
{
burntOut = b;
String cv = c.toLowerCase();
if (burntOut == true){
on = false;
}
else{
on = o;}
if (cv.equals("red")){
color = cv;
}
else if (cv.equals("green")){
color = cv;
}
else if (cv.equals("blue")){
color = cv;
}
else{
color = "white";
}
}
/* The toString method returns a String with the Light in the format:
* off red burnt out
* on green not burnt out
* Notice there is one space between "off"/"on" and the value for color,
* and a tab before the "burnt out" or "not burnt out".
*/
public String toString()
{
String lswitch = "";
String burnstate = "";
String LightInfoString = "";
if (on==true){
lswitch = "on";
burnstate = "not burnt out";
}
if (burntOut==true){
burnstate = "burnt out";
lswitch = "off";
}
if (on==false&&burntOut==false){
lswitch = "off";
burnstate = "not burnt out";
}
LightInfoString = lswitch + " " + color + "\t" + burnstate;
return LightInfoString;
}
public void flip()
/* This method changes the bulb from on to off, or vice versa.
* If the burntOut variable is true, then the on variable may only be set to false.
*/
{
if (burntOut==false){
if (on==true){
on = false;
}
else if (on==false){
on = true;
}
}
else if (burntOut==true){
on = false;
}
}
public String getColor()
/* The getColor method returns the color of the bulb.*/
{
String colorstring = color;
return colorstring;
}
public void setColor(String c)
/* The setColor method sets the color of the Light. The color variable is
* set to c only if c is "red", "green" or "blue". The method ignore the
* case of the value in c. If c holds any value other than "red", "green"
* or "blue", color will be set to "white".*/
{
String vc = c.toLowerCase();
if (vc.equals("red")){
color = vc;
}
else if (vc.equals("green")){
color = vc;
}
else if (vc.equals("blue")){
color = vc;
}
else{
color = "white";
}
}
public boolean isOn()
/* The isOn method returns true if on, false otherwise.*/
{
if (on==true){
return true;
}
return false;
}
public void burnOut()
/* The burnOut method sets the variable burntOut to true.*/
{
burntOut = true;
on = false;
}
public static void main(String[] args)
{
/* The main method allows you to run Light on its own, with a built-in tester. */
//*************************************************************************
// 1. Test Light()
//*************************************************************************
Light light1 = new Light();
System.out.println("1. Test Light()");
testLight(light1, true, false, "white", "on white\tnot burnt out");
//*************************************************************************
// 2. Test Light(boolean b, boolean o, String c)
//*************************************************************************
System.out.println("\n2. Test Light(boolean b, boolean o, String c)");
Light light2 = new Light(true, true, "GreeN");
// Notice that since the light bulb is "burnt out", the value of "on"
// gets set to false. Also, the color should get saved in all lower case
// as "green", not "GreeN".
testLight(light2, false, true, "green", "off green\tburnt out");
//*************************************************************************
// 3. Test burnOut()
//*************************************************************************
System.out.println("\n3. Test burnOut()");
// light1 is not burnt out. Lets call burnOut on light1 and make sure it gets burnt out and turned off
light1.burnOut();
testLight(light1, false, true, "white", "off white\tburnt out");
//*************************************************************************
// 4. Test flip()
//*************************************************************************
System.out.println("\n4. Test flip()");
Light light3 = new Light();
// light3 is currently on and not burnt out. Lets flip the light off and on and see if it works properly.
System.out.println("light3 is on");
testLight(light3, true, false, "white", "on white\tnot burnt out");
light3.flip();
System.out.println("now light3 should be off");
testLight(light3, false, false, "white", "off white\tnot burnt out");
light3.flip();
System.out.println("now light3 should be back on");
testLight(light3, true, false, "white", "on white\tnot burnt out");
// Try to flip light1 on - this should fail since light1 is burnt out. light1 should stay off
System.out.println("light1 is burned out and off, we can't flip it on");
light1.flip();
testLight(light1, false, true, "white", "off white\tburnt out");
//*************************************************************************
// 5. Test isOn()
//*************************************************************************
System.out.println("\n5. Test isOn()");
// We know light1 is off, and light3 is on. Verify that the method isOn reports this correctly.
if (!light1.isOn())
{
System.out.println("*** PASS: isOn() working properly");
}
else
{
System.out.println("*** FAIL: isOn() not working properly");
}
if (light3.isOn())
{
System.out.println("*** PASS: isOn() working properly");
}
else
{
System.out.println("*** FAIL: isOn() not working properly");
}
//*************************************************************************
// 6. Test getColor()
//*************************************************************************
System.out.println("\n6. Test getColor()");
if (light1.getColor().equals("white"))
{
System.out.println("*** PASS: getColor() working properly");
}
else
{
System.out.println("*** FAIL: problem with getColor()");
}
//*************************************************************************
// 7. Test setColor(String)
//*************************************************************************
System.out.println("\n7. Test setColor(String)");
light1.setColor("red");
System.out.println("*** " + testLightColor(light1, "red"));
light1.setColor("BLUE"); // should set light to blue
System.out.println("*** " + testLightColor(light1, "blue"));
light1.setColor("yellow"); // yellow is not allowed, should set light to white
System.out.println("*** " + testLightColor(light1, "white"));
}
// Private helper methods
private static void testLight(Light light, boolean o, boolean b, String c,
String string)
{
System.out.println("*** " + testLightOn(light, o));
System.out.println("*** " + testLightburntOut(light, b));
System.out.println("*** " + testLightColor(light, c));
System.out.println("*** " + testLightToString(light, string));
}
private static String testLightOn(Light bulb, boolean o)
{
if ((bulb.on && !o) || (!bulb.on && o))
{
return "FAIL: on is not set correctly. on should be set to "
+ o + ", but it is set to " + bulb.on + ".";
}
else
{
return "PASS: on is set correctly (" + bulb.on + ")";
}
}
private static String testLightburntOut(Light light, boolean b)
{
if ((light.burntOut && !b) || (!light.burntOut && b))
{
return "FAIL: burntOut is not set correctly (burntOut should be set to "
+ b + ", but it is set to " + light.burntOut + ")";
}
else
{
return "PASS: burntOut is set correctly (" + light.burntOut + ")";
}
}
private static String testLightColor(Light light, String c)
{
if (!light.color.equals(c))
{
return "FAIL: color is not set correctly (color should be set to "
+ c + ", but it is set to " + light.color + ")";
}
else
{
return "PASS: color is set correctly (" + light.color + ")";
}
}
private static String testLightToString(Light light, String string)
{
String output;
if (light.toString().equals(string))
{
output = "PASS: toString produced the correct output";
}
else
{
output = "FAIL: toString does not work as expected";
}
return output + " (" + light.toString() + ")";
}
}
|
[
"[email protected]"
] | |
764e30ccbe1f8da7790113fcb12e208e9e6785ec
|
f906550506b0193dbd3e4aa2f8e6e8433220099f
|
/Lab4e/app/src/main/java/com/example/pgutierrezd/lab4e/MainActivity.java
|
b252e3ed5e240746bd162420d25ef424d378d16f
|
[] |
no_license
|
PabloDxCode/EjemplosAndroid
|
f449d656cd0fb13fd2877b042b1fe7b5b59589c1
|
43cdbec57f90a4dc9059d31a02591965017fced8
|
refs/heads/master
| 2021-01-12T18:25:52.396464 | 2016-10-19T17:43:53 | 2016-10-19T17:43:53 | 71,375,393 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,541 |
java
|
package com.example.pgutierrezd.lab4e;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
TextView seleccionado;
AutoCompleteTextView edit;
String[] items = {
"Pablo","Arcadio","Ivan","Paty","Josue","Emmanuel","Bernardo","Virginia",
"Jose","Manuel","Virgilio","Emma","Arcelia"
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
seleccionado = (TextView) findViewById(R.id.seleccionado);
edit = (AutoCompleteTextView) findViewById(R.id.edit);
edit.addTextChangedListener(new EditWatcher());
ArrayAdapter<String> adapter;
adapter = new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line,items);
edit.setAdapter(adapter);
}
private class EditWatcher implements TextWatcher{
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
seleccionado.setText(edit.getText());
}
@Override
public void afterTextChanged(Editable editable) {
}
}
}
|
[
"[email protected]"
] | |
777796b75069ec8a1cbd0891085eff4544e7cb8b
|
26147bfed4a17b77acbc3745a04eefb4e7abe5f9
|
/Chapter61/twoLargestElements.java
|
ba9fa29a20bb1c4ec2c40d1a5513ca8e92b5a224
|
[] |
no_license
|
Cassidy-Christian/apcs-exercises
|
7944710eadc00c6538bf475e055090394a174804
|
9b6a0ba271a23fa578b190c40f44d042038a5705
|
refs/heads/master
| 2020-07-11T10:11:29.594377 | 2020-06-09T19:22:10 | 2020-06-09T19:22:10 | 204,510,447 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 754 |
java
|
import java.io.* ;
class twoLargestElements
{
public static void main ( String[] args )
{
int[] data = {3, 1, 5, 7, 4, 12, -3, 8, -2};
// declare and initialize variables for the two largest
int max= data[0];
int max2=data[1];
// compute the two largest
for ( int index=0; index < data.length; index++)
{
if ( data[ index ] > max ) {
max2=max; // examine the current element
max = data[ index ]; // if it is the largest so far, change max
}
else if ( data[ index] > max2 ){ // examine the current element
max2 = data[ index]; }
}
// write out the two largest
System.out.println( max );
System.out.println( max2 );
}
}
|
[
"[email protected]"
] | |
ae447a30caa1201de2f11e3feeb23779349e8cd2
|
d2e16f1f85f7e6c0a3ddc3fbe11039c11d51b3f0
|
/aljoin-web/src/main/java/aljoin/web/controller/act/ActFixedFormController.java
|
a653a346d9d604bede2422a8dbdb9fac35849db3
|
[] |
no_license
|
jqmtony/micro-service-mybatis
|
7cfda24851146473f563995f0073ca14260e0e26
|
cef9da0a6c4b46189e48f290072fe32c4b7a6bb3
|
refs/heads/master
| 2020-03-20T02:05:08.773021 | 2018-05-03T05:09:27 | 2018-05-03T05:09:27 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 17,214 |
java
|
package aljoin.web.controller.act;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.activiti.engine.HistoryService;
import org.activiti.engine.TaskService;
import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.impl.task.TaskDefinition;
import org.activiti.engine.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import aljoin.act.dao.entity.ActAljoinBpmnRun;
import aljoin.act.iservice.ActActivitiService;
import aljoin.act.iservice.ActAljoinBpmnRunService;
import aljoin.act.service.ActFixedFormServiceImpl;
import aljoin.aut.dao.entity.AutUser;
import aljoin.aut.iservice.AutUserService;
import aljoin.aut.security.CustomUser;
import aljoin.dao.config.Where;
import aljoin.object.CustomerTaskDefinition;
import aljoin.object.FixedFormProcessLog;
import aljoin.object.RetMsg;
import aljoin.web.controller.BaseController;
import aljoin.web.service.act.ActFixedFormWebService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
/**
*
* 固定表单流程审批(控制器).
*
* @author:wangj
*
* @date: 2017-11-07
*/
@Controller
@RequestMapping(value = "/act/actFixedForm", method = RequestMethod.POST)
@Api(value = "固定表单流程审批Controller", description = "固定表单流程审批相关接口")
public class ActFixedFormController extends BaseController {
private final static Logger logger = LoggerFactory.getLogger(ActFixedFormController.class);
@Resource
private ActFixedFormServiceImpl actFixedFormService;
@Resource
private TaskService taskService;
@Resource
private AutUserService autUserService;
@Resource
private ActAljoinBpmnRunService actAljoinBpmnRunService;
@Resource
private ActActivitiService actActivitiService;
@Resource
private HistoryService historyService;
@Resource
private ActFixedFormWebService actFixFormWebService;
@Resource
private ActFixedFormWebService actFixedFormWebService;
/**
*
* 根据任务ID查询流程是否被签收
*
* @return:RetMsg
*
* @author:wangj
*
* @date:2017-11-06
*/
@RequestMapping(value = "/isClaim")
@ResponseBody
@ApiOperation("根据任务ID查询流程是否被签收")
public RetMsg isClaim(HttpServletRequest request, HttpServletResponse response, String taskId,
String processInstanceId) {
RetMsg retMsg = new RetMsg();
try {
CustomUser user = getCustomDetail();
retMsg = actFixedFormService.isClaim(taskId, processInstanceId, user.getUserId() + "");
} catch (Exception e) {
logger.error("", e);
retMsg.setCode(1);
retMsg.setMessage("操作失败");
}
return retMsg;
}
/**
*
* 根据任务ID查询流程是否被签收
*
* @return:RetMsg
*
* @author:wangj
*
* @date:2017-11-06
*/
@RequestMapping(value = "/isIoaClaim")
@ResponseBody
@ApiOperation("根据任务ID查询流程是否被签收")
public RetMsg isIoaClaim(HttpServletRequest request, HttpServletResponse response, String taskId,
String processInstanceId) {
RetMsg retMsg = new RetMsg();
try {
CustomUser user = getCustomDetail();
retMsg = actFixedFormService.isIoaClaim(taskId, processInstanceId, user.getUserId() + "");
} catch (Exception e) {
logger.error("", e);
retMsg.setCode(1);
retMsg.setMessage("操作失败");
}
return retMsg;
}
/**
*
* 根据任务ID查询下一个流程节点信息
*
* @return:RetMsg
*
* @author:wangj
*
* @date:2017-11-06
*/
@RequestMapping(value = "/getNextTaskInfo", method = RequestMethod.GET)
@ApiImplicitParam(name = "taskId", value = "任务ID", required = true, dataType = "string", paramType = "query")
@ResponseBody
@ApiOperation("根据任务ID查询下一个流程节点信息")
public RetMsg getNextTaskInfo(String taskId) {
RetMsg retMsg = new RetMsg();
try {
retMsg = actFixedFormService.getNextTaskInfo(taskId);
} catch (Exception e) {
logger.error("", e);
retMsg.setCode(1);
retMsg.setMessage("操作失败");
}
return retMsg;
}
/**
*
* 填写意见
*
* @return:RetMsg
*
* @author:wangj
*
* @date:2017-11-06
*/
@RequestMapping(value = "/addComment")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "任务ID", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "message", value = "意见", required = true, dataType = "int", paramType = "query") })
@ResponseBody
@ApiOperation("填写意见")
public RetMsg addComment(String taskId, String message) {
RetMsg retMsg = new RetMsg();
try {
retMsg = actFixedFormService.addComment(taskId, message);
} catch (Exception e) {
logger.error("", e);
retMsg.setCode(1);
retMsg.setMessage("操作失败");
}
return retMsg;
}
/**
*
* 输出流程图
*
* @return:void
*
* @author:zhongjy
*
* @date:2017年9月11日 下午5:34:17
*/
@RequestMapping(value = "/showImg", method = RequestMethod.GET)
@ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "任务ID", required = true, dataType = "string", paramType = "query") })
@ApiOperation("流程图")
public void showImg(HttpServletRequest request, HttpServletResponse response, String taskId) {
try {
actFixedFormService.showImg(request, response, taskId);
} catch (Exception e) {
logger.error("", e);
}
}
/**
*
* 获得上一节点信息
*
* @return:RetMsg
*
* @author:wangj
*
* @date:2017-11-07
*/
@RequestMapping(value = "/getPreTaskInfo")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "任务ID", required = true, dataType = "string", paramType = "query") })
@ResponseBody
@ApiOperation("获得上一节点信息")
public RetMsg getPreTaskInfo(String taskId) {
RetMsg retMsg = new RetMsg();
try {
retMsg = actFixedFormService.getPreTaskInfo(taskId);
} catch (Exception e) {
logger.error("", e);
retMsg.setCode(1);
retMsg.setMessage(e.getMessage());
}
return retMsg;
}
/**
*
* 回退
*
* @return:RetMsg
*
* @author:wangj
*
* @date:2017-11-07
*/
@RequestMapping(value = "/jump2Task2")
@ApiImplicitParams({
@ApiImplicitParam(name = "processInstanceId", value = "流程实例ID", required = true, dataType = "string", paramType = "query") })
@ResponseBody
@ApiOperation("回退")
public RetMsg jump2Task2(String processInstanceId) {
RetMsg retMsg = new RetMsg();
try {
retMsg = actFixFormWebService.jump2Task2(processInstanceId, getCustomDetail().getUserId());
} catch (Exception e) {
logger.error("", e);
retMsg.setCode(1);
retMsg.setMessage("操作失败");
}
return retMsg;
}
/**
*
* 输出流程图
*
* @return:void
*
* @author:huangw
*
* @date:2017年12月06日 下午5:34:17
*/
@RequestMapping(value = "/showHisImg", method = RequestMethod.GET)
@ApiImplicitParams({
@ApiImplicitParam(name = "processInstanceId", value = "实例ID", required = true, dataType = "string", paramType = "query") })
@ApiOperation("流程图")
public void showHisImg(HttpServletRequest request, HttpServletResponse response, String processInstanceId) {
try {
actFixedFormService.showHisImg(request, response, processInstanceId);
} catch (Exception e) {
logger.error("", e);
}
}
/**
*
* 撤回
*
* @return:RetMsg
*
* @author:wangj
*
* @date:2017-12-11
*/
@RequestMapping(value = "/revoke")
@ApiImplicitParams({
@ApiImplicitParam(name = "processInstanceId", value = "流程实例ID", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "taskId", value = "任务ID", required = true, dataType = "string", paramType = "query") })
@ResponseBody
@ApiOperation("撤回")
public RetMsg revoke(String processInstanceId, String taskId) {
RetMsg retMsg = new RetMsg();
try {
CustomUser user = getCustomDetail();
retMsg = actFixedFormWebService.revoke(processInstanceId, taskId, String.valueOf(user.getUserId()));
} catch (Exception e) {
logger.error("", e);
retMsg.setCode(1);
retMsg.setMessage("操作失败");
}
return retMsg;
}
/**
*
* 退回操作获得上一节点信息:可以退回的允许情况如下: (1)自由流程可以退回(2)对于非自由流程,
* 当前活动节点只有一个并且上级节点只有一个的可以退回
*
* @return:RetMsg
*
* @author:zhongjy
*
* @date:2017年11月28日 下午8:18:14
*/
@RequestMapping(value = "/getPreTaskInfo2")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "任务ID", required = true, dataType = "string", paramType = "query") })
@ResponseBody
@ApiOperation("获得上一节点信息(通过流程轨迹)")
public RetMsg getPreTaskInfo(HttpServletRequest request, HttpServletResponse response) {
String taskId = request.getParameter("taskId");
String bpmnId = request.getParameter("bpmnId");
RetMsg retMsg = new RetMsg();
Map<String, String> retMap = new HashMap<String, String>();
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
try {
if (StringUtils.isEmpty(taskId)) {
throw new Exception("无上级节点,不能撤回");
}
ActAljoinBpmnRun bpmnRun = actAljoinBpmnRunService.selectById(bpmnId);
if (bpmnRun.getIsFree() == 1) {
// (1)自由流程可以退回
List<HistoricActivityInstance> activities = historyService.createHistoricActivityInstanceQuery()
.processInstanceId(task.getProcessInstanceId()).finished()
.orderByHistoricActivityInstanceEndTime().desc().list();
if (activities.size() > 0) {
retMap.put("activityKey", activities.get(0).getActivityId());
retMap.put("activityName", activities.get(0).getActivityName());
retMap.put("userId", activities.get(0).getAssignee());
if (StringUtils.isNotEmpty(activities.get(0).getAssignee())) {
AutUser user = autUserService.selectById(Long.parseLong(activities.get(0).getAssignee()));
retMap.put("userFullName", user.getFullName());
}
} else {
throw new Exception("无上级节点,不能撤回");
}
} else {
// (2)对于非自由流程,当前活动节点只有一个并且上级节点只有一个的可以退回
// 获取上一个节点(有可能有多个)
List<TaskDefinition> defList = actActivitiService.getPreTaskInfo(task.getTaskDefinitionKey(),
task.getProcessInstanceId());
if (defList.size() != 1) {
throw new Exception("流程不满足撤回条件:无或含有多个上级任务节点");
} else {
// 在判断当前流程实例是否同时存在活动节点
List<Task> taskList =
// taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()).list();
taskService.createTaskQuery().executionId(task.getExecutionId()).list();
if (taskList.size() == 1) {
// 满足条件
retMap.put("activityKey", defList.get(0).getKey());
retMap.put("activityName", defList.get(0).getNameExpression().getExpressionText());
// 查询出是谁办理了的
List<HistoricTaskInstance> hisTaskList = historyService.createHistoricTaskInstanceQuery()
.processInstanceId(task.getProcessInstanceId())
.taskDefinitionKey(defList.get(0).getKey()).orderByHistoricTaskInstanceEndTime().desc()
.list();
if (hisTaskList.size() == 0) {
// 如果是任务重找不到通过连线关系的上级节点,就到历史活动节点查新
List<HistoricActivityInstance> activityInstanceList = historyService
.createHistoricActivityInstanceQuery()
.processInstanceId(task.getProcessInstanceId()).activityType("userTask").finished()
.orderByHistoricActivityInstanceEndTime().desc().list();
if (activityInstanceList.size() > 0) {
HistoricActivityInstance activityInstance = activityInstanceList.get(0);
retMap.put("activityKey", activityInstance.getActivityId());
retMap.put("activityName", activityInstance.getActivityName());
retMap.put("userId", activityInstance.getAssignee());
if (StringUtils.isNotEmpty(activityInstance.getAssignee())) {
AutUser user = autUserService.selectById(activityInstance.getAssignee());
retMap.put("userFullName", user.getFullName());
}
}
} else {
// 通过连线获取的上级任务
HistoricTaskInstance hisTask = hisTaskList.get(0);
retMap.put("userId", hisTask.getAssignee());
if (StringUtils.isNotEmpty(hisTask.getAssignee())) {
AutUser user = autUserService.selectById(hisTask.getAssignee());
retMap.put("userFullName", user.getFullName());
}
}
} else if (taskList.size() > 1) {
throw new Exception("流程不满足撤回条件:含有多个真正办理的任务节点");
} else {
throw new Exception("无上级节点,不能撤回");
}
}
}
if (retMap.get("activityKey") != null && retMap.get("activityKey").startsWith("StartEvent_")) {
throw new Exception("不允许撤回到开始");
}
retMsg.setCode(0);
retMsg.setObject(retMap);
} catch (Exception e) {
logger.error("", e);
retMsg.setCode(1);
retMsg.setMessage(e.getMessage());
}
return retMsg;
}
/**
*
* 流程实例id查流程图
*
* @return:void
*
* @author:wangj
*
* @date:2017年9月11日 下午5:34:17
*/
@RequestMapping(value = "/showImgfromproInsId", method = RequestMethod.GET)
@ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "任务ID", required = true, dataType = "string", paramType = "query") })
@ApiOperation("流程图")
public void showImgfromproInsId(HttpServletRequest request, HttpServletResponse response,
String processInstanceId) {
try {
actFixedFormService.showImgfromproInsId(request, response, processInstanceId);
} catch (Exception e) {
logger.error("", e);
}
}
/**
*
* 获得上一节点信息(修改版)
*
* @return:RetMsg
*
* @author:wangj
*
* @date:2017-11-07
*/
@RequestMapping(value = "/getPreTaskInfo4fix")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "任务ID", required = true, dataType = "string", paramType = "query") })
@ResponseBody
@ApiOperation("获得上一节点信息")
public RetMsg getPreTaskInfo2(String taskId) {
RetMsg retMsg = new RetMsg();
try {
retMsg = actFixedFormService.getPreTaskInfo2(taskId);
if (retMsg.getCode() != 0)
return retMsg;
else {
@SuppressWarnings("unchecked")
List<CustomerTaskDefinition> defitionList = (List<CustomerTaskDefinition>) retMsg.getObject();
List<String> asignee = new ArrayList<String>();
if (!defitionList.isEmpty()) {
for (CustomerTaskDefinition customerTaskDefinition : defitionList) {
List<String> taskAssignee = Arrays.asList(customerTaskDefinition.getAssignee().split(";"));
asignee.addAll(taskAssignee);
}
}
if (!asignee.isEmpty()) {
Where<AutUser> userWhere = new Where<AutUser>();
userWhere.setSqlSelect("id,user_name,full_name");
if (asignee.size() > 1) {
userWhere.in("id", asignee);
} else {
userWhere.eq("id", asignee.get(0));
}
List<AutUser> userList = autUserService.selectList(userWhere);
for (CustomerTaskDefinition customerTaskDefinition : defitionList) {
for (AutUser autUser : userList) {
if(customerTaskDefinition.getAssignee().equals(String.valueOf(autUser.getId()))){
customerTaskDefinition.setAssigneeName(autUser.getFullName());
}
}
}
}
retMsg.setObject(defitionList);
}
} catch (Exception e) {
logger.error("", e);
retMsg.setCode(1);
retMsg.setMessage(e.getMessage());
}
return retMsg;
}
/**
*
* 流程日志
*
* @return:void
*
* @author:wangj
*
* @date:2017年9月11日 下午5:34:17
*/
@RequestMapping(value="/getLog")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskId",value = "任务ID",required = true,dataType = "string",paramType = "query"),
@ApiImplicitParam(name = "processInstanceId",value = "流程实例ID",required = true,dataType = "string",paramType = "query")
})
@ResponseBody
@ApiOperation("流程日志")
public List<FixedFormProcessLog> getLog(String taskId, String processName, String processInstanceId){
List<FixedFormProcessLog> list = new ArrayList<FixedFormProcessLog>();
try {
list = actFixedFormService.getActivityLog(taskId,processInstanceId);
}catch (Exception e){
logger.error("", e);
}
return list;
}
}
|
[
"[email protected]"
] | |
94c94d7331e5c5687210a786ed71adf55ed08bbd
|
3bd0a991ca69f13e804822e15d5c77c1eccfe4f3
|
/data_structure/SingleLinkedList.java
|
d370321ac774b532e39a354df31e3edb4279e21f
|
[] |
no_license
|
Mfarzana/cracking_the_coding_interview
|
be48787f08e077371b536eeacb6472a69e6c39fc
|
023289853b89f5358bb93c3f11fac5cb54b6ffde
|
refs/heads/main
| 2023-01-29T18:47:05.089397 | 2020-12-08T14:08:38 | 2020-12-08T14:08:38 | 306,018,681 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,170 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package data_structure;
/**
*
* @author Farzana
*/
public class SingleLinkedList {
public static void main(String args[]){
Node node=new Node(10);
node.appendToTail(12);
node.appendToTail(20);
node.appendToTail(21);
node.appendToTail(22);
node.appendToTail(23);
System.out.println(" add to linkdelist");
Node head=node;
node.print(node);
Node newNode=node.deleteNode(head, 21);
System.out.println("\n delete value from linkedlist ");
node.print(node);
}
}
class Node{ // end Node
int data;
Node next=null;
public Node(int d){
data=d;
}
// Creating a LinkedList
void appendToTail(int d){
Node end=new Node(d);
Node n=this;
while(n.next!=null){
n=n.next;
}
n.next=end;
}
//Deleting a node form a single linkedlist
Node deleteNode(Node head, int d ){
Node n=head;
if(head.data==d)
return head.next;
while(n.next!=null){
if(n.next.data==d){
n.next=n.next.next;
return head;
}
n=n.next;
}
return head;
}
// Print LinkedList
void print(Node n){
while(n!=null){
System.out.print(" > "+n.data);
n=n.next;
}
}
}// end Node
|
[
"[email protected]"
] | |
9e03a296dd9b9be52832b8bbcd12c40f2f064442
|
cd35b30896ec4b14420135c4ce50a1cce85b0c3a
|
/src/main/java/gal/springangular/config/MongoConfig.java
|
4528c6495563a2d1c8137a36f41db675e2e8260a
|
[] |
no_license
|
agavshin/samples
|
6fc0e5939338943e0acab3c0d94d9c230304d1ba
|
e65e5bc8c3f30f49cc0bbce91ac12221da0f4c83
|
refs/heads/master
| 2020-03-23T11:11:47.268163 | 2018-07-18T21:03:18 | 2018-07-18T21:03:18 | 141,489,784 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 281 |
java
|
package gal.springangular.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
@Configuration
@EnableMongoRepositories("gal.springangular.repository")
public class MongoConfig {
}
|
[
"[email protected]"
] | |
5a18c4e618c1ebf960f95d732090e9c5a7e09eb0
|
a0d0f1aaa5fb27454a0b90cf136c3fec2993445f
|
/app/src/main/java/com/example/memo/higherorlower/MainActivity.java
|
92191c6a2408955202052815082fbd4eab01316a
|
[] |
no_license
|
memocool/Higher_Or_Lower_App
|
e54fe1e56aa195d66e4e76a47b0440603e2790dc
|
005c4b4204227c84c83d7ad67a43c53c74f5480c
|
refs/heads/master
| 2021-01-01T03:48:38.894753 | 2016-04-20T12:39:48 | 2016-04-20T12:39:48 | 56,685,639 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,275 |
java
|
package com.example.memo.higherorlower;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import java.util.Random;
public class MainActivity extends AppCompatActivity {
int randomNumber;
public void checkGuess(View view){
EditText guessedNumber = (EditText) findViewById(R.id.guessedNumber);
String guessNumberString = guessedNumber.getText().toString();
int guessedNumberint = Integer.parseInt(guessNumberString);
if (guessedNumberint > randomNumber ) {
Toast.makeText(getApplicationContext(),"Too high",Toast.LENGTH_LONG).show();
} else if (guessedNumberint < randomNumber) {
Toast.makeText(getApplicationContext(),"Too Low",Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(),"Correct , well done ;)",Toast.LENGTH_LONG).show();
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Random randomGenrator = new Random();
randomNumber = randomGenrator.nextInt(21);
}}
|
[
"[email protected]"
] | |
58c86cbc0faa96b0271e51fd27a8ec85b420730b
|
5fa3175a2b3bf6bec7ab73fee21bb35bc53ecfed
|
/src/main/java/ru/hh/school/testframework/db/Database.java
|
df9be0f5fe0f22f75da7a6c2a531ac29d71c20ec
|
[] |
no_license
|
hh-project17/testframework
|
b3745d216f2419841d5cea2fd99655a4b7fec492
|
0bb5efb8ac459c68807cbc95238a82fe1a214299
|
refs/heads/master
| 2021-01-20T06:11:57.597675 | 2017-05-02T22:23:44 | 2017-05-02T22:23:44 | 89,851,168 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,034 |
java
|
package ru.hh.school.testframework.db;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.FileSystemResource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.init.ScriptUtils;
import org.sqlite.SQLiteDataSource;
import ru.hh.school.testframework.util.PropertyLoader;
import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;
public class Database {
private static final Logger LOG = LoggerFactory.getLogger(Database.class);
private final DataSource dataSource;
private final JdbcTemplate jdbcTemplate;
public Database() {
Properties props = PropertyLoader.load();
dataSource = new SQLiteDataSource();
((SQLiteDataSource)dataSource).setUrl(props.getProperty("db.url"));
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
public void cleanCoreTables() {
LOG.info("Running reset.sql script");
try {
ScriptUtils.executeSqlScript(dataSource.getConnection(),
new FileSystemResource("src/main/resources/sql/reset.sql"));
} catch (SQLException e) {
LOG.error("Can't execute reset sql script");
}
}
public boolean isRecordPresent(Tables table, Map<String, String> whereParams) {
String query = String.format("SELECT * FROM %s WHERE %s;", table, getWhereParamsAsString(whereParams));
LOG.info("Sending query '{}'", query);
List<Map<String, Object>> result = jdbcTemplate.queryForList(query);
LOG.info("Result = '{}'", result);
return !result.isEmpty();
}
private String getWhereParamsAsString(Map<String, String> whereParams) {
return whereParams.entrySet()
.stream()
.map(entry -> String.format("%s='%s'", entry.getKey(), entry.getValue()))
.collect(Collectors.joining(" and "));
}
}
|
[
"[email protected]"
] | |
97678f4597b9a3ace411ca84a17690081b0e4456
|
04aec9ccd2dade85d8cf8cb874e1f16e7a340a96
|
/src/main/java/com/noteit/app/demo/repositories/NoteRepository.java
|
619514cf8aab0294d6c9e77ec21aaae502eb7856
|
[] |
no_license
|
Sweng29/NoteItApp-Arittek
|
8c2678c1ae597fbe3ba57a135a2d1a01205de68e
|
851126f7e3b31630a2c3cd9bf608a18c8409a3f3
|
refs/heads/master
| 2020-07-07T09:33:17.120781 | 2019-08-20T06:47:30 | 2019-08-20T06:47:30 | 203,316,054 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 278 |
java
|
package com.noteit.app.demo.repositories;
import com.noteit.app.demo.models.Note;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface NoteRepository extends JpaRepository<Note, Long> {
}
|
[
"[email protected]"
] | |
4649a91e4f5c6c54647653ae720b20c28d09ecf6
|
557689137996eca291ab741d7e33b9f110653aa5
|
/Julia/Classes/Extension.uc
|
e699571b794a7d67244502b948a4ad75d1ac378b
|
[
"MIT"
] |
permissive
|
SWAT4Developers/swat-julia
|
923c8fd1451f07042fbd619207754c03c0521642
|
e5a18005659da0f35f84e5b8e3f293c0f01febcb
|
refs/heads/master
| 2021-01-24T21:08:19.602554 | 2014-10-18T14:30:37 | 2014-10-18T14:35:07 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,576 |
uc
|
class Extension extends SwatGame.SwatMutator;
/**
* Copyright (c) 2014 Sergei Khoroshilov <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* Extension version
* @type string
*/
var string Version;
/**
* Extension title
* @type string
*/
var string Title;
/**
* Reference to the Core superobject
* @type class'Core'
*/
var Core Core;
/**
* Reference to the extension's Locale instance
* @type class'Locale'
*/
var Locale Locale;
/**
* @type class<Locale>
*/
var class<Locale> LocaleClass;
/**
* Indicate whether an extension is enabled
* @type bool
*/
var config bool Enabled;
/**
* Check whether the extension is disabled
*
* @return void
*/
public function PreBeginPlay()
{
Super.PreBeginPlay();
self.Disable('Tick');
if (Level.NetMode == NM_ListenServer || Level.NetMode == NM_DedicatedServer)
{
if (Level.Game != None && SwatGameInfo(Level.Game) != None)
{
if (self.Enabled)
{
return;
}
}
}
self.Destroy();
}
/**
* Get the reference to the Julia's Core instance
*
* @return void
*/
public function BeginPlay()
{
Super.BeginPlay();
self.Core = self.GetCoreInstance();
if (self.Core == None)
{
log(self $ " was unable to find the Julia.Core instance");
self.Destroy();
}
if (self.LocaleClass != None)
{
self.Locale = Spawn(self.LocaleClass);
}
log("Julia/" $ self.Title $ " (version " $ self.Version $ ") has been initialized");
self.SetTimer(class'Core'.const.DELTA, true);
}
/**
* Attempt to find the Julia's Core instance in the list of server actors
*
* @return class'Core'
*/
protected function Core GetCoreInstance()
{
local Core Core;
foreach DynamicActors(class'Julia.Core', Core)
{
return Core;
}
return None;
}
/**
* Return the extension title
*
* @return string
*/
final public function string GetTitle()
{
return self.Title;
}
/**
* Return the extension version
*
* @return string
*/
final public function string GetVersion()
{
return self.Version;
}
event Destroyed()
{
self.Core = None;
self.LocaleClass = None;
if (self.Locale != None)
{
self.Locale.Destroy();
self.Locale = None;
}
log(self $ ": Julia/" $ self.Title $ " is about to be destroyed");
Super.Destroyed();
}
defaultproperties
{
Title="undefined";
Version="unknown";
LocaleClass=None;
}
/* vim: set ft=java: */
|
[
"[email protected]"
] | |
062da39011ce210824a65be9f2e00ad638596ab7
|
5302d8ce665a232fa2a6f3fd1eeb1e5c6af8c720
|
/app/src/main/java/com/jiuwang/buyer/util/ImageUtil.java
|
57a43ce4b41a0a9fea7c3d00cc9ec6a60f71ddbf
|
[] |
no_license
|
lihj1988/JiuCode
|
8802804da7f2254c688dba65849093ff6d74728c
|
1c778d09330959fa8ace99e0c4f18bacc8e35565
|
refs/heads/master
| 2022-02-28T22:41:11.069503 | 2019-09-19T02:42:13 | 2019-09-19T02:42:13 | 192,491,952 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,547 |
java
|
package com.jiuwang.buyer.util;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.net.Uri;
import android.os.Environment;
import android.provider.MediaStore;
import android.util.Base64;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class ImageUtil {
/*
* 作用:获取图片缩略图
* 更新:2016-04-16
*/
public static Bitmap getSmall(String path) {
//获取图片角度
int degree = 0;
ExifInterface exif = null;
try {
exif = new ExifInterface(path);
} catch (IOException e) {
e.printStackTrace();
}
if (exif != null) {
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
degree = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
degree = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
degree = 270;
break;
}
}
//生成BITMAP对象
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(path, options);
int height = options.outHeight;
int width = options.outWidth;
int inSampleSize = 1;
if (height > 800 || width > 480) {
int heightRatio = Math.round((float) height / (float) 800);
int widthRatio = Math.round((float) width / (float) 480);
inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
}
options.inSampleSize = inSampleSize;
options.inJustDecodeBounds = false;
Bitmap bitmap = BitmapFactory.decodeFile(path, options);
//根据角度旋转图片
Matrix matrix = new Matrix();
matrix.postRotate(degree);
return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}
/*
* 作用:获取本机图片
* 更新:2016-04-16
*/
public static Bitmap getLocal(String path) {
try {
FileInputStream fis = new FileInputStream(path);
return BitmapFactory.decodeStream(fis);
} catch (FileNotFoundException e) {
e.printStackTrace();
return null;
}
}
/*
* 作用:String 转成 Bitmap
* 更新:2016-04-16
*/
public static Bitmap toBitmap(String str) {
Bitmap bitmap;
try {
byte[] bitmapArray;
bitmapArray = Base64.decode(str, Base64.DEFAULT);
bitmap = BitmapFactory.decodeByteArray(bitmapArray, 0, bitmapArray.length);
return bitmap;
} catch (Exception e) {
return null;
}
}
/*
* 作用:图片转成 String
* 更新:2016-04-16
*/
public static String toString(String path) {
try {
Bitmap bitmap = getSmall(path);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 50, stream);
byte[] b = stream.toByteArray();
return Base64.encodeToString(b, Base64.DEFAULT);
} catch (NullPointerException e) {
e.printStackTrace();
return "null";
}
}
public static void saveImageToGallery(Context context, Bitmap bmp,String imageName) {
// 首先保存图片 创建文件夹
// 获取内置SD卡路径
String sdCardPath = Environment.getExternalStorageDirectory().getPath();
// 图片文件路径
File file = new File(sdCardPath);
File[] files = file.listFiles();
for (int i = 0; i < files.length; i++) {
File file1 = files[i];
String name = file1.getName();
if (name.endsWith(imageName)) {
boolean flag = file1.delete();
LogUtils.e("1111", "删除 + " + flag);
}
}
//图片文件名称
String fileName = sdCardPath + "/"+imageName;
file = new File(fileName);
try {
FileOutputStream fos = new FileOutputStream(file);
bmp.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
} catch (Exception e) {
LogUtils.e("111", e.getMessage());
e.printStackTrace();
}
// 其次把文件插入到系统图库
String path = file.getAbsolutePath();
try {
MediaStore.Images.Media.insertImage(context.getContentResolver(), path, fileName, null);
} catch (FileNotFoundException e) {
LogUtils.e("333", e.getMessage());
e.printStackTrace();
}
// 最后通知图库更新
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
Uri uri = Uri.fromFile(file);
intent.setData(uri);
context.sendBroadcast(intent);
file.delete();
MyToastView.showToast("保存成功", context);
}
}
|
[
"[email protected]"
] | |
7381d0c9a1b8ed59daccbac8b98289c4a2844c34
|
c0e4430afc85ab61f93bbcda31f6fb479e539140
|
/src/main/java/iyunu/NewTLOL/model/gift/instance/SevenGift.java
|
683a3b2f7b87a678d26397951de71ed40c470b4b
|
[] |
no_license
|
Liuguozhu/MyWork
|
68e0b5bca566b16f7da59f229e493875d3b7a943
|
86a6c7eac8cf50e839a4ce018e399d7e26648a33
|
refs/heads/master
| 2021-05-29T18:14:28.386853 | 2015-08-28T09:14:49 | 2015-08-28T09:30:21 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,945 |
java
|
package iyunu.NewTLOL.model.gift.instance;
import iyunu.NewTLOL.model.monster.MonsterDropItem;
import java.util.ArrayList;
import java.util.List;
/**
* @function VIP奖励
* @author fhy
*/
public class SevenGift {
/** 天数 **/
private int id;
/** 普通物品 **/
private List<MonsterDropItem> commonItems = new ArrayList<MonsterDropItem>();//
/** VIP物品 **/
private List<MonsterDropItem> vipItems = new ArrayList<MonsterDropItem>();//
/** 普通伙伴 **/
private List<MonsterDropItem> commonP = new ArrayList<MonsterDropItem>();//
/** VIP伙伴 **/
private List<MonsterDropItem> vipP = new ArrayList<MonsterDropItem>();//
/**
* @return the id
*/
public int getId() {
return id;
}
/**
* @param id
* the id to set
*/
public void setId(int id) {
this.id = id;
}
/**
* @return the commonItems
*/
public List<MonsterDropItem> getCommonItems() {
return commonItems;
}
/**
* @param commonItems
* the commonItems to set
*/
public void setCommonItems(List<MonsterDropItem> commonItems) {
this.commonItems = commonItems;
}
/**
* @return the vipItems
*/
public List<MonsterDropItem> getVipItems() {
return vipItems;
}
/**
* @param vipItems
* the vipItems to set
*/
public void setVipItems(List<MonsterDropItem> vipItems) {
this.vipItems = vipItems;
}
/**
* @return the commonP
*/
public List<MonsterDropItem> getCommonP() {
return commonP;
}
/**
* @param commonP
* the commonP to set
*/
public void setCommonP(List<MonsterDropItem> commonP) {
this.commonP = commonP;
}
/**
* @return the vipP
*/
public List<MonsterDropItem> getVipP() {
return vipP;
}
/**
* @param vipP
* the vipP to set
*/
public void setVipP(List<MonsterDropItem> vipP) {
this.vipP = vipP;
}
}
|
[
"[email protected]"
] | |
8856de6edcb8114aa68a64945095423984201ba4
|
b233709fe4834335a682a2cbb5ca91954f1e8384
|
/message_processor/src/com/spn/benchmark/messaging/processor/MessageConfigurator.java
|
e7408b100f0a85a306e5661d740df185248b83e4
|
[] |
no_license
|
bes1002t/Broker_Benchmarks
|
89f209929c2b28c88b8f9458405ebc9a3830fedd
|
ffa2d8742464b2622a625335e174ff845aad39df
|
refs/heads/master
| 2021-07-06T23:39:10.625811 | 2017-01-11T10:18:24 | 2017-01-11T10:18:24 | 66,070,577 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 842 |
java
|
package com.spn.benchmark.messaging.processor;
public class MessageConfigurator {
/**
* Configure how many messages will be sent
*/
// public static final int MAX_COUNT = 200;
// public static final int MAX_COUNT = 2000;
public static final int MAX_COUNT = 20000;
// public static final int MAX_COUNT = 2000000;
/**
* Configure the size of a message in byte
*/
// public static final int MESSAGE_SIZE = 15000000;
public static final int MESSAGE_SIZE = 0;
/**
* Char that seperates the JSON in different parts
*/
public static final String SEPERATOR = ";";
/**
* Constant to calculate seconds from milliseconds
*/
public static final double TIME_FACTOR = 1000000;
/**
* Constant that will be added to MAX_COUNT to trigger JVM optimization
*/
public static final int OPTIMIZATION_FACTOR = (MAX_COUNT / 2);
}
|
[
"[email protected]"
] | |
3b365d2ea25873871053e88c9a8a10e1d62a4446
|
ec5b120375c5257ea1ae823236f7752335ef1e45
|
/src/test/java/com/runner/TestRunner.java
|
80bdb0ceb63ee5fed8a9e026b6786f41295cdc46
|
[] |
no_license
|
AbarajithaMurugan/adacfullcucumber
|
8a462ee2a9ae0b3d31041096c922da4c61b2cfc2
|
62379238644bd22689cc47336421b902fff95487
|
refs/heads/master
| 2023-03-23T04:46:20.643680 | 2021-03-09T04:43:29 | 2021-03-09T04:43:29 | 345,885,224 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,159 |
java
|
package com.runner;
import org.junit.AfterClass;
import org.junit.runner.RunWith;
import com.BaseClass.UtilityClass;
import com.BaseClass.jvmreport;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features="src\\test\\resources\\Features\\adac.feature",monochrome=true,glue="com.step",
plugin= {"pretty","html:C:\\Users\\Navin Vishal M\\Downloads\\Abara's\\eclipse\\configuration\\AdactinFullCucumber\\Reports\\HTML",
"junit:C:\\Users\\Navin Vishal M\\Downloads\\Abara's\\eclipse\\configuration\\AdactinFullCucumber\\Reports\\XML\\adac.xml",
"json:C:\\Users\\Navin Vishal M\\Downloads\\Abara's\\eclipse\\configuration\\AdactinFullCucumber\\Reports\\JSON\\adac.json"
,"json:C:\\\\Users\\\\Navin Vishal M\\\\Downloads\\\\Abara's\\\\eclipse\\\\configuration\\\\AdactinFullCucumber\\\\Reports\\\\JVMreport\\\\adac.json"
,"rerun:target\\fail.txt"
})
public class TestRunner extends UtilityClass{
@AfterClass
public static void report() {
jvmreport.report("C:\\Users\\Navin Vishal M\\Downloads\\Abara's\\eclipse\\configuration\\AdactinFullCucumber\\Reports\\JVMreport\\adac.json");
}
}
|
[
"[email protected]"
] | |
d066761c788fbef8da353e2ca62dcc5c7251bdd6
|
41f79b1c6ef0c793914d99a55b3805f39e3ea8e3
|
/src/org/broad/igv/graph/GraphPanel2.java
|
ae52e082c73415b7b001891d0c9f1d8161e29185
|
[
"MIT",
"LGPL-2.1-or-later",
"LGPL-2.1-only"
] |
permissive
|
nrgene/NRGene-IGV
|
35bf50a07341ff0bf26eabbea55d10e8fa9fcdd0
|
4ac9ffcd6f9fcbe318e9e85d9820783afbabf5fc
|
refs/heads/master
| 2023-09-02T12:48:20.171109 | 2021-02-03T10:26:44 | 2021-02-03T10:26:44 | 162,590,091 | 2 | 1 |
MIT
| 2023-08-16T11:47:31 | 2018-12-20T14:26:46 |
Java
|
UTF-8
|
Java
| false | false | 3,270 |
java
|
/*
* Copyright (c) 2007-2011 by The Broad Institute of MIT and Harvard. All Rights Reserved.
*
* This software is licensed under the terms of the GNU Lesser General Public License (LGPL),
* Version 2.1 which is available at http://www.opensource.org/licenses/lgpl-2.1.php.
*
* THE SOFTWARE IS PROVIDED "AS IS." THE BROAD AND MIT MAKE NO REPRESENTATIONS OR
* WARRANTES OF ANY KIND CONCERNING THE SOFTWARE, EXPRESS OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, WHETHER
* OR NOT DISCOVERABLE. IN NO EVENT SHALL THE BROAD OR MIT, OR THEIR RESPECTIVE
* TRUSTEES, DIRECTORS, OFFICERS, EMPLOYEES, AND AFFILIATES BE LIABLE FOR ANY DAMAGES
* OF ANY KIND, INCLUDING, WITHOUT LIMITATION, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
* ECONOMIC DAMAGES OR INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF WHETHER
* THE BROAD OR MIT SHALL BE ADVISED, SHALL HAVE OTHER REASON TO KNOW, OR IN FACT
* SHALL KNOW OF THE POSSIBILITY OF THE FOREGOING.
*/
package org.broad.igv.graph;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JPanel;
/**
* @author jrobinso
* @date Oct 12, 2010
*/
public class GraphPanel2 extends JPanel {
private Graph graph;
int topMargin = 50;
int leftMargin = 20;
int nodeWidth = 5;
int nodeHeight = 5;
int ySpacing = 20;
public void setGraph(Graph graph) {
this.graph = graph;
}
@Override
protected void paintComponent(Graphics graphics) {
Graphics2D g = (Graphics2D) graphics;
// Just paint nodes (no edges)
if (graph != null) {
// Set X scale to fit graph in panel
float dx = graph.getMaxX() - graph.getMinX();
float scale = (getWidth() - 2 * leftMargin) / dx;
for (Node node : graph.getNodes()) {
int pixelX = getXPosition(scale, node.getCellX());
int pixelY = getYPosition(node);
g.setColor(Color.BLUE);
g.fillRect(pixelX, pixelY, nodeWidth, nodeHeight);
}
// Paint edges
for (SubGraph sg : graph.getSubGraphs()) {
for (Edge edge : sg.getEdges()) {
// Parent right position
Node parent = edge.getParent();
int px1 = getXPosition(scale, parent.getCellX()) + nodeWidth;
int py1 = getYPosition(parent) + nodeHeight / 2;
// Child left position
Node child = edge.getChild();
int px2 = getXPosition(scale, child.getCellX());
int py2 = getYPosition(child) + nodeHeight / 2;
g.setColor(edge.getColor());
g.drawLine(px1, py1, px2, py2);
g.setColor(Color.red);
g.fillRect(px2 - 1, py2 - 1, 2, 2);
}
}
}
}
private int getYPosition(Node node) {
return topMargin + node.getCellY() * ySpacing;
}
private int getXPosition(float scale, int x) {
return leftMargin + (int) (scale * (x - graph.getMinX()));
}
}
|
[
"[email protected]"
] | |
84946b5a9424d5a2bf0ddb02848fbf895c1a1597
|
f434beab72e31b6649f91c1e4836d3eab296c113
|
/Soldesk/src/Gwangae_yeonsanja.java
|
db5f6544e5a2412b45c6b334b835109c4e1983b8
|
[] |
no_license
|
janggoonlee/java
|
bce68380ca9b386f2b98252fb94f596da24134e8
|
66d8b2777d2d45e4dcbe0f26bc91f3dcc99f341e
|
refs/heads/main
| 2023-03-15T06:30:32.778298 | 2021-03-09T10:02:39 | 2021-03-09T10:02:39 | 327,224,682 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 727 |
java
|
public class Gwangae_yeonsanja {
public static void main(String[] args) {
///관계 연산자 if,for,while 에 사용 true / false 로만 적용
// == 같다, !=같지않다, >< 크다/작다, >=/<= 크거나 같다 / 작거나 같다.
int a = 100, b = 200;
System.out.println("a == b = "+(a == b)+" 이다.");//false
System.out.println("a != b = "+(a != b)+" 이다.");//true
System.out.println("a > b = "+(a > b)+" 이다.");//false
System.out.println("a < b = "+(a < b)+" 이다.");//true
System.out.println("a >= b = "+(a >= b)+" 이다.");//false
System.out.println("a <= b = "+(a <= b)+" 이다.");//true
System.out.println("a = b = "+(a = b)+" 이다."); //200 ==,= 사용주의!
}
}
|
[
"[email protected]"
] | |
56440290b271d2702f2289a109a0c09c2f3884b1
|
68e7af9e50b37c1fbeb9eeafccbd0f3f0defd370
|
/src/main/java/om/metamorph/exceptions/ConstraintExceptionMapper.java
|
61c53365f40a9b2aa8c174df54ac2efcaab9e47c
|
[] |
no_license
|
sabri916/cleanJersey
|
aba1514d3ea435a11539ec2f3e511854fa32b2c7
|
8a7175ad414036f2e6c288479550f67f8c1976ff
|
refs/heads/master
| 2023-04-08T12:46:56.268393 | 2020-02-16T18:13:39 | 2020-02-16T18:13:39 | 240,941,232 | 0 | 0 | null | 2023-03-22T21:23:29 | 2020-02-16T18:15:45 |
Java
|
UTF-8
|
Java
| false | false | 1,197 |
java
|
package om.metamorph.exceptions;
import om.metamorph.envelopes.ErrorEnvelopeModel;
import om.metamorph.envelopes.ErrorListEnvelopeModel;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@Provider
public class ConstraintExceptionMapper implements ExceptionMapper<ConstraintViolationException> {
@Override
public Response toResponse(ConstraintViolationException e) {
ErrorListEnvelopeModel errorListEnvelopeModel = new ErrorListEnvelopeModel();
List<ErrorEnvelopeModel> errors = new ArrayList<>();
Set<ConstraintViolation<?>> violations = e.getConstraintViolations();
for (ConstraintViolation<?> violation : violations) {/*
errorListEnvelopeModel.getErrorListEnvelopeModels()
.add(new ErrorEnvelopeModel(422, violation.getMessage()));*/
errors.add(new ErrorEnvelopeModel(422, violation.getMessage()));
}
return Response.status(422).entity(errors).build();
}
}
|
[
"[email protected]"
] | |
ca2457355f8b2d8fb2fc40a2df14fe3c448e64e0
|
d5aa64f48a6b08ad157d1bb6de1cc0827f3b722c
|
/code/src/test/java/com/purdynet/siqproduct/BaseTest.java
|
f72cf1219650ff1356f479018f88b465b27a3e0d
|
[] |
no_license
|
dnpurdy/catalog-app
|
fd42478527f1f85d53475241f3fa71f84289ff94
|
586ba9ecb383ecb71980f59e7c75c29a8578ceab
|
refs/heads/master
| 2020-03-18T16:39:45.521623 | 2018-07-18T17:15:02 | 2018-07-18T17:15:02 | 134,978,912 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 264 |
java
|
package com.purdynet.siqproduct;
import org.junit.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class BaseTest {
protected Logger logger = LoggerFactory.getLogger(this.getClass());
@Before
public void setUp() {}
}
|
[
"[email protected]"
] | |
21caf4f4aeba046cd7c213d8b016b0a5fe17b1e1
|
594e79dd88010f2495ce4b031a4c639f0ed39511
|
/src/main/java/com/doctor/commons/mail/EmailAttachment.java
|
8e2ead1172bd05f0216bc01ba8bc638c5f3e8663
|
[
"Apache-2.0"
] |
permissive
|
sdcuike/beaver
|
7d3099529dccb9cdd8b125e6ffb27e9e661bc211
|
f16c5797063090057dc6674536c5f449d73426c9
|
refs/heads/master
| 2021-01-23T04:39:38.656878 | 2017-02-17T03:41:18 | 2017-02-17T03:41:18 | 68,785,941 | 1 | 3 | null | null | null | null |
UTF-8
|
Java
| false | false | 923 |
java
|
package com.doctor.commons.mail;
import java.util.UUID;
import javax.activation.DataSource;
import com.doctor.beaver.annotation.ThreadSafe;
/**
* 邮箱附件
*
* @author sdcuike
* <p>
* Created on 2016.11.04
* <p>
*/
@ThreadSafe
public abstract class EmailAttachment {
protected final String name;
protected final String contentId;
protected EmailAttachment(String name) {
this(name, UUID.randomUUID().toString());
}
protected EmailAttachment(String name, String contentId) {
this.name = name;
this.contentId = contentId;
}
public String getName() {
return name;
}
public String getContentId() {
return contentId;
}
public abstract DataSource getDataSource();
@Override
public String toString() {
return "EmailAttachment [name=" + name + ", contentId=" + contentId + "]";
}
}
|
[
"[email protected]"
] | |
e55d6d56623cfd1af25cd5c4fa23f0104fb17a09
|
89ce74f7132847612aded67ff6468cb5d6a15112
|
/src/test/java/j7orm/test/testsuite/ibmdb2/IBMDB2Config.java
|
1ec65f43b43fc441b9f724a815e3f098bf9aed7f
|
[
"Apache-2.0"
] |
permissive
|
marcoromagnolo/j7ORM
|
3e1d31825a09d04869799e7b7fc624546269d7f2
|
ffb508bf27bc63676c850e56f172a66de9d186b0
|
refs/heads/master
| 2021-05-10T09:21:45.891379 | 2018-01-25T14:27:56 | 2018-01-25T14:27:56 | 118,923,452 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 963 |
java
|
/**
* Copyright 2016 Marco Romagnolo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package j7orm.test.testsuite.ibmdb2;
import j7orm.test.testcase.DefaultDBConfig;
import j7orm.type.DBType;
/**
* @author Marco Romagnolo
*/
public class IBMDB2Config extends DefaultDBConfig {
public IBMDB2Config() {
super(DBType.IBMDB2, DefaultDBConfig.HOST, 50000, DefaultDBConfig.HOST, DefaultDBConfig.USER, DefaultDBConfig.PASSWORD);
}
}
|
[
"[email protected]"
] | |
0905b5f5c1a0604b98475e25131d01efe10dd206
|
df882bde8a8b3b4a85ee16003bfc520230e2d4d0
|
/app/src/main/java/com/capstone/JobR/DBA/board/BoardVO.java
|
6ba8e881113a6b2fd8b81c538e944830573d130c
|
[] |
no_license
|
jya018/JobR_Android
|
07d03b1c1e14e6e1b91e883ec4e3290d92ac4260
|
548739df46f2d303488975b8902fdb051cf12d05
|
refs/heads/main
| 2023-06-13T23:29:54.150992 | 2021-07-19T07:01:30 | 2021-07-19T07:01:30 | 380,097,554 | 0 | 2 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,422 |
java
|
package com.capstone.JobR.DBA.board;
import java.io.Serializable;
public class BoardVO implements Serializable {
private int boardNum;
private String boardName; //
private String boardCont; //
private String nickname; //
private String boardDate;
private int view;
private int good;
private String boardSort;
public BoardVO(String boardName, String boardCont, String nickname, String boardSort) {
this.boardName = boardName;
this.boardCont = boardCont;
this.nickname = nickname;
this.boardSort = boardSort;
}
public BoardVO(String boardName, String boardCont) {
this.boardNum = boardNum;
this.boardName = boardName;
this.boardCont = boardCont;
}
@Override
public String toString() {
return "BoardVO{" +
"boardNum=" + boardNum +
", boardName='" + boardName + '\'' +
", boardCont='" + boardCont + '\'' +
", nickname='" + nickname + '\'' +
", boardDate='" + boardDate + '\'' +
", view=" + view +
", good=" + good +
", boardSort='" + boardSort + '\'' +
'}';
}
public int getBoardNum() {
return boardNum;
}
public void setBoardNum(int boardNum) {
this.boardNum = boardNum;
}
public String getBoardName() {
return boardName;
}
public void setBoardName(String boardName) {
this.boardName = boardName;
}
public String getBoardCont() {
return boardCont;
}
public void setBoardCont(String boardCont) {
this.boardCont = boardCont;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getBoardDate() {
return boardDate;
}
public void setBoardDate(String boardDate) {
this.boardDate = boardDate;
}
public int getView() {
return view;
}
public void setView(int view) {
this.view = view;
}
public int getGood() {
return good;
}
public void setGood(int good) {
this.good = good;
}
public String getBoardSort() {
return boardSort;
}
public void setBoardSort(String boardSort) {
this.boardSort = boardSort;
}
}
|
[
"[email protected]"
] | |
956565e815b39b5e743ee7f164a0458321c6b286
|
3df3ac06841caaf82810b5491c19f6c02de8a44d
|
/mmm/src/test/java/Repository/TestStudentiRepositoryInFile.java
|
0b2499a4e85d5d299cc1c10b33afed93b5c49144
|
[] |
no_license
|
salajanalex/VVSS
|
8f0a4b4b33f34dd14b2a339b0e74d4ce2f3eb597
|
73a3e3b7590e2b0e68ea5c0791af8e32b658026e
|
refs/heads/master
| 2020-03-12T16:24:36.667994 | 2018-04-23T15:58:28 | 2018-04-23T15:58:28 | 130,715,427 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,953 |
java
|
package Repository;
import static org.junit.Assert.*;
import java.io.*;
import Domain.HasID;
import org.junit.Before;
import org.junit.Test;
import Domain.Student;
import ValidatorsAndExceptions.ValidatorStudent;
public class TestStudentiRepositoryInFile extends TestRepositoryInFile {
StudentRepositoryInFile el;
public StudentRepositoryInFile fill(){
PrintWriter pw;
try {
pw = new PrintWriter("src\\test\\java\\testResources\\StudentiTest.txt");
pw.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ValidatorStudent validatorStudent = new ValidatorStudent();
StudentRepositoryInFile studentiRepo = new StudentRepositoryInFile("src\\test\\java\\testResources\\StudentiTest.txt",
validatorStudent);
toFindFirst = new Student(1,"Robert",1,"robert@yahoo","Andrei");
studentiRepo.createInstance("1|Robert|1|robert@yahoo|Andrei");
studentiRepo.createInstance("2|Roby|1|roby@yahoo|Andrei");
studentiRepo.createInstance("3|Andrei|1|andrei@yahoo|Serban");
size = 3;
toAdd = new Student(4,"Roby",721,"[email protected]","Serban");
elem = studentiRepo;
elemTata = studentiRepo;
return studentiRepo;
}
@Test
public void testUpdate() {
el = fill();
Student student= el.findOne(2);
student.setEmail("[email protected]");
el.update(student);;
assertEquals("[email protected]", el.findOne(2).getEmail());
}
@Test
public void testCreateInstance() {
el = fill();
el.createInstance("112|Andrei|1|andrei@yahoo|Serban");
HasID student=el.findOne(112);
assertEquals((Integer)112, (Integer)student.getID());
}
@Test
public void testWriteInstance()//
{
el= fill();
String fileName = "src\\test\\java\\testResources\\StudentiTest.txt";
try(BufferedWriter writer=new BufferedWriter(new FileWriter(fileName))){
Student student = new Student(2, "Andrei", 3, "andrei@yahoo", "Serban");
el.delete(1);
el.delete(2);
el.delete(3);
el.add(student);
BufferedReader reader = new BufferedReader(new FileReader(fileName));
String rez = reader.readLine();
assertEquals(rez,"2|Andrei|3|andrei@yahoo|Serban");
}
catch (Exception e)
{
assertEquals(true,false);
}
}
//Error!------------------------------------------------------------------------
@Test
public void testCreateInstanceError1()// structura stringului nu e buna
{
el = fill();
try{
el.createInstance("112|Andrei|1|andrei@yahoo|Serban|2");
assertEquals(true,false);
}
catch (RepositoryException e)
{
RepositoryException expected = new RepositoryException("Input line does not match!");
assertEquals(expected.toString(),e.toString());
}
}
@Test
public void testCreateInstanceError2() //
{
el = fill();
try{
el.createInstance("112|Andrei|eee|andrei@yahoo|2");
assertEquals(true,false);
}
catch (RepositoryException e)
{
RepositoryException expected = new RepositoryException("Create instance Error!");
assertEquals(expected.toString(),e.toString());
}
}
@Test
public void testWriteInstanceError()
{
el= fill();
try {
Student student = new Student(2, "Andrei", 3, "andrei@yahoo", "Serban");
el.writeInstace(null, student);
assertEquals(true,false);
}
catch (RepositoryException e)
{
RepositoryException expected = new RepositoryException();
expected = new RepositoryException("WriteInstance Error!");
assertEquals(expected.toString(),e.toString());
}
}
@Test
public void testWriteToFileError()
{
ValidatorStudent validator = new ValidatorStudent();
try {
StudentRepositoryInFile stud = fill();
stud.setFileName(null);
Student stude = new Student(4,"Roby",721,"[email protected]","Serban");
stud.add(stude);
assertEquals(true,false);
}
catch(RepositoryException e){
RepositoryException expect = new RepositoryException("Can't write to file\n");
assertEquals(expect.toString(),e.toString());
}
}
}
|
[
"[email protected]"
] | |
c729ba7dcdccf606e59cea68886334fdd6d5600c
|
448396ee748a9c40aeeff4895ce0c0563a7b2ab4
|
/bboxdb-network-proxy/src/main/java/org/bboxdb/networkproxy/handler/CloseHandler.java
|
6431bd453c8473d1f4bbf339d75af127790387fd
|
[
"CC-BY-SA-2.0",
"Apache-2.0"
] |
permissive
|
jnidzwetzki/bboxdb
|
f5fe59678136fb2faccaec35f1fd9d9ec37e4a86
|
47d3da97e605cb2b8f6fb4a004596b458a024da2
|
refs/heads/master
| 2023-09-06T03:00:48.554009 | 2023-08-09T18:34:04 | 2023-08-09T18:34:04 | 45,732,002 | 52 | 10 |
Apache-2.0
| 2023-09-08T04:30:48 | 2015-11-07T10:28:59 |
Java
|
UTF-8
|
Java
| false | false | 1,548 |
java
|
/*******************************************************************************
*
* Copyright (C) 2015-2022 the BBoxDB project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*******************************************************************************/
package org.bboxdb.networkproxy.handler;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.bboxdb.network.client.BBoxDBCluster;
import org.bboxdb.networkproxy.ProxyConst;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CloseHandler implements ProxyCommandHandler {
/**
* The Logger
*/
private final static Logger logger = LoggerFactory.getLogger(CloseHandler.class);
@Override
public void handleCommand(final BBoxDBCluster bboxdbClient, final InputStream socketInputStream,
final OutputStream socketOutputStream) throws IOException {
logger.info("Got close call");
socketOutputStream.write(ProxyConst.RESULT_OK);
Thread.currentThread().interrupt();
}
}
|
[
"[email protected]"
] | |
c02190db20a254cb15fca3be1be033a6d9bffbca
|
bf4c38f33e9352d9fae0f1581862677af21ab5ca
|
/IoT2/fr.inria.diverse.iot2.iot2/src/fr/inria/diverse/iot2/iot2/iot2/impl/Statement_BlockImpl.java
|
fa63a5fe1d9dac14a5c069dd2ab66ec9c57544a0
|
[] |
no_license
|
diverse-project/melange-examples
|
c0a2b7ecb0659a22e21e1c18202b3682579c7ffa
|
f6b809429a625104f68f0d8321dd10861de724bf
|
refs/heads/master
| 2021-01-19T06:29:01.262950 | 2017-06-28T13:09:43 | 2017-06-28T13:09:43 | 95,668,567 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,260 |
java
|
/**
*/
package fr.inria.diverse.iot2.iot2.iot2.impl;
import fr.inria.diverse.iot2.iot2.iot2.Block;
import fr.inria.diverse.iot2.iot2.iot2.Iot2Package;
import fr.inria.diverse.iot2.iot2.iot2.Statement_Block;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Statement Block</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link fr.inria.diverse.iot2.iot2.iot2.impl.Statement_BlockImpl#getBlock <em>Block</em>}</li>
* </ul>
*
* @generated
*/
public class Statement_BlockImpl extends StatementImpl implements Statement_Block {
/**
* The cached value of the '{@link #getBlock() <em>Block</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBlock()
* @generated
* @ordered
*/
protected Block block;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Statement_BlockImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return Iot2Package.Literals.STATEMENT_BLOCK;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Block getBlock() {
return block;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetBlock(Block newBlock, NotificationChain msgs) {
Block oldBlock = block;
block = newBlock;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Iot2Package.STATEMENT_BLOCK__BLOCK, oldBlock, newBlock);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBlock(Block newBlock) {
if (newBlock != block) {
NotificationChain msgs = null;
if (block != null)
msgs = ((InternalEObject)block).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Iot2Package.STATEMENT_BLOCK__BLOCK, null, msgs);
if (newBlock != null)
msgs = ((InternalEObject)newBlock).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Iot2Package.STATEMENT_BLOCK__BLOCK, null, msgs);
msgs = basicSetBlock(newBlock, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, Iot2Package.STATEMENT_BLOCK__BLOCK, newBlock, newBlock));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case Iot2Package.STATEMENT_BLOCK__BLOCK:
return basicSetBlock(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case Iot2Package.STATEMENT_BLOCK__BLOCK:
return getBlock();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case Iot2Package.STATEMENT_BLOCK__BLOCK:
setBlock((Block)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case Iot2Package.STATEMENT_BLOCK__BLOCK:
setBlock((Block)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case Iot2Package.STATEMENT_BLOCK__BLOCK:
return block != null;
}
return super.eIsSet(featureID);
}
} //Statement_BlockImpl
|
[
"[email protected]"
] | |
a9a902978638a46047b71116d46aaaa33998e0c5
|
d71fc6f733e494f35f1ea855f25c5e830efea632
|
/extension/binding/fabric3-activemq/src/main/java/org/fabric3/binding/activemq/broker/MBeanServerWrapper.java
|
ef2453cfb971cde41d2124654771a76e9b6a0464
|
[
"Apache-2.0"
] |
permissive
|
carecon/fabric3-core
|
d92ba6aa847386ee491d16f7802619ee1f65f493
|
14a6c6cd5d7d3cabf92e670ac89432a5f522c518
|
refs/heads/master
| 2020-04-02T19:54:51.148466 | 2018-12-06T19:56:50 | 2018-12-06T19:56:50 | 154,750,871 | 0 | 0 | null | 2018-10-25T23:39:54 | 2018-10-25T23:39:54 | null |
UTF-8
|
Java
| false | false | 16,948 |
java
|
/*
* Fabric3
* Copyright (c) 2009-2015 Metaform Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.fabric3.binding.activemq.broker;
import javax.management.Attribute;
import javax.management.AttributeList;
import javax.management.AttributeNotFoundException;
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
import javax.management.IntrospectionException;
import javax.management.InvalidAttributeValueException;
import javax.management.ListenerNotFoundException;
import javax.management.MBeanException;
import javax.management.MBeanInfo;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.NotCompliantMBeanException;
import javax.management.NotificationFilter;
import javax.management.NotificationListener;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
import javax.management.OperationsException;
import javax.management.QueryExp;
import javax.management.ReflectionException;
import javax.management.StandardMBean;
import javax.management.loading.ClassLoaderRepository;
import java.io.ObjectInputStream;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.activemq.broker.jmx.BrokerView;
import org.apache.activemq.broker.jmx.ConnectionView;
import org.apache.activemq.broker.jmx.ConnectorView;
import org.apache.activemq.broker.jmx.JmsConnectorView;
import org.apache.activemq.broker.jmx.NetworkBridgeView;
import org.apache.activemq.broker.jmx.NetworkConnectorView;
import org.apache.activemq.broker.jmx.ProxyConnectorView;
import org.apache.activemq.broker.jmx.QueueView;
import org.apache.activemq.broker.jmx.SubscriptionView;
import org.apache.activemq.broker.jmx.TopicView;
import org.apache.activemq.util.JMXSupport;
/**
* Maps from ActiveMQ to Fabric3 JMX MBean naming conventions.
*/
public class MBeanServerWrapper implements MBeanServer {
private static final String DOMAIN = "fabric3";
private String brokerName;
private MBeanServer delegate;
Map<ObjectName, ObjectName> mappings = new ConcurrentHashMap<>();
public MBeanServerWrapper(String brokerName, MBeanServer delegate) {
this.brokerName = brokerName.replace(":", ".");
this.delegate = delegate;
}
public ObjectInstance createMBean(String className, ObjectName name)
throws ReflectionException, InstanceAlreadyExistsException, MBeanException, NotCompliantMBeanException {
return delegate.createMBean(className, name);
}
public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName)
throws ReflectionException, InstanceAlreadyExistsException, MBeanException, NotCompliantMBeanException,
InstanceNotFoundException {
return delegate.createMBean(className, name, loaderName);
}
public ObjectInstance createMBean(String className, ObjectName name, Object[] params, String[] signature)
throws ReflectionException, InstanceAlreadyExistsException, MBeanException, NotCompliantMBeanException {
return delegate.createMBean(className, name, params, signature);
}
public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature)
throws ReflectionException, InstanceAlreadyExistsException, MBeanException, NotCompliantMBeanException,
InstanceNotFoundException {
return delegate.createMBean(className, name, loaderName, params, signature);
}
public ObjectInstance registerMBean(Object object, ObjectName original)
throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
ObjectName name = convertName(original, object);
if (delegate.isRegistered(name)) {
try {
delegate.unregisterMBean(name);
} catch (InstanceNotFoundException e) {
throw new MBeanRegistrationException(e);
}
}
mappings.put(original, name);
return delegate.registerMBean(object, name);
}
public void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException {
ObjectName mapped = mappings.remove(name);
if (mapped == null) {
throw new InstanceNotFoundException(name.toString());
}
delegate.unregisterMBean(mapped);
}
public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException {
return delegate.getObjectInstance(name);
}
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) {
return delegate.queryMBeans(name, query);
}
public Set<ObjectName> queryNames(ObjectName name, QueryExp query) {
return delegate.queryNames(name, query);
}
public boolean isRegistered(ObjectName original) {
ObjectName name = mappings.get(original);
return name != null && delegate.isRegistered(name);
}
public Integer getMBeanCount() {
return delegate.getMBeanCount();
}
public Object getAttribute(ObjectName name, String attribute)
throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException {
return delegate.getAttribute(name, attribute);
}
public AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException {
return delegate.getAttributes(name, attributes);
}
public void setAttribute(ObjectName name, Attribute attribute)
throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
delegate.setAttribute(name, attribute);
}
public AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException {
return delegate.setAttributes(name, attributes);
}
public Object invoke(ObjectName name, String operationName, Object[] params, String[] signature)
throws InstanceNotFoundException, MBeanException, ReflectionException {
return delegate.invoke(name, operationName, params, signature);
}
public String getDefaultDomain() {
return delegate.getDefaultDomain();
}
public String[] getDomains() {
return delegate.getDomains();
}
public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback)
throws InstanceNotFoundException {
delegate.addNotificationListener(name, listener, filter, handback);
}
public void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback)
throws InstanceNotFoundException {
delegate.addNotificationListener(name, listener, filter, handback);
}
public void removeNotificationListener(ObjectName name, ObjectName listener) throws InstanceNotFoundException, ListenerNotFoundException {
delegate.removeNotificationListener(name, listener);
}
public void removeNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback)
throws InstanceNotFoundException, ListenerNotFoundException {
delegate.removeNotificationListener(name, listener, filter, handback);
}
public void removeNotificationListener(ObjectName name, NotificationListener listener)
throws InstanceNotFoundException, ListenerNotFoundException {
delegate.removeNotificationListener(name, listener);
}
public void removeNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback)
throws InstanceNotFoundException, ListenerNotFoundException {
delegate.removeNotificationListener(name, listener, filter, handback);
}
public MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException, IntrospectionException, ReflectionException {
return delegate.getMBeanInfo(name);
}
public boolean isInstanceOf(ObjectName name, String className) throws InstanceNotFoundException {
return delegate.isInstanceOf(name, className);
}
public Object instantiate(String className) throws ReflectionException, MBeanException {
return delegate.instantiate(className);
}
public Object instantiate(String className, ObjectName loaderName) throws ReflectionException, MBeanException, InstanceNotFoundException {
return delegate.instantiate(className, loaderName);
}
public Object instantiate(String className, Object[] params, String[] signature) throws ReflectionException, MBeanException {
return delegate.instantiate(className, params, signature);
}
public Object instantiate(String className, ObjectName loaderName, Object[] params, String[] signature)
throws ReflectionException, MBeanException, InstanceNotFoundException {
return delegate.instantiate(className, loaderName, params, signature);
}
public ObjectInputStream deserialize(ObjectName name, byte[] data) throws OperationsException {
return delegate.deserialize(name, data);
}
public ObjectInputStream deserialize(String className, byte[] data) throws OperationsException, ReflectionException {
return delegate.deserialize(className, data);
}
public ObjectInputStream deserialize(String className, ObjectName loaderName, byte[] data) throws OperationsException, ReflectionException {
return delegate.deserialize(className, loaderName, data);
}
public ClassLoader getClassLoaderFor(ObjectName mbeanName) throws InstanceNotFoundException {
return delegate.getClassLoaderFor(mbeanName);
}
public ClassLoader getClassLoader(ObjectName loaderName) throws InstanceNotFoundException {
return delegate.getClassLoader(loaderName);
}
public ClassLoaderRepository getClassLoaderRepository() {
return delegate.getClassLoaderRepository();
}
private ObjectName convertName(ObjectName name, Object object) throws MBeanRegistrationException {
if (!(object instanceof StandardMBean)){
return name;
}
Object implementation = ((StandardMBean)object).getImplementation();
if (implementation instanceof BrokerView) {
try {
name = new ObjectName(DOMAIN + ":SubDomain=runtime, type=resource, group=ActiveMQ, brokerName=" + brokerName + ", subgroup=Broker");
} catch (MalformedObjectNameException e) {
throw new MBeanRegistrationException(e);
}
} else if (implementation instanceof ConnectionView) {
try {
String connectionName = name.getKeyProperty("Connection");
String connectorName = name.getKeyProperty("ConnectorName");
if (connectionName != null) {
name = new ObjectName(DOMAIN + ":SubDomain=runtime, type=resource, group=ActiveMQ, brokerName=" + brokerName
+ ", subgroup=connections, connection=" + connectionName + ", ConnectorName=" + connectorName);
} else {
String propertyName = name.getKeyProperty("Name");
name = new ObjectName(DOMAIN + ":SubDomain=runtime, type=resource, group=ActiveMQ, brokerName=" + brokerName
+ ", subgroup=connections, Name=" + propertyName + ", ConnectorName=" + connectorName);
}
} catch (MalformedObjectNameException e) {
throw new MBeanRegistrationException(e);
}
} else if (implementation instanceof ConnectorView) {
try {
String connectorName = name.getKeyProperty("ConnectorName");
name = new ObjectName(DOMAIN + ":SubDomain=runtime, type=resource, group=ActiveMQ, brokerName=" + brokerName
+ ", subgroup=connectors, connectorName=" + connectorName);
} catch (MalformedObjectNameException e) {
throw new MBeanRegistrationException(e);
}
} else if (implementation instanceof SubscriptionView) {
SubscriptionView view = (SubscriptionView) implementation;
String destinationType;
if (view.isDestinationQueue()) {
destinationType = "queues";
} else {
destinationType = "topics";
}
try {
name = new ObjectName(DOMAIN + ":SubDomain=runtime, type=resource, group=ActiveMQ, brokerName=" + brokerName
+ ", subgroup=subscriptions, desintantionType=" + destinationType
+ ", destinationName=" + JMXSupport.encodeObjectNamePart(view.getDestinationName())
+ ", cliendId=" + JMXSupport.encodeObjectNamePart(view.getClientId())
+ ", consumerId=" + view.getSubcriptionId());
} catch (MalformedObjectNameException e) {
throw new MBeanRegistrationException(e);
}
} else if (implementation instanceof JmsConnectorView) {
String connectorName = name.getKeyProperty("JmsConnectorName");
try {
name = new ObjectName(DOMAIN + ":SubDomain=runtime, type=resource, group=ActiveMQ, brokerName=" + brokerName
+ ", subgroup=JMS connectors, jmsConnectorName=" + connectorName);
} catch (MalformedObjectNameException e) {
throw new MBeanRegistrationException(e);
}
} else if (implementation instanceof NetworkBridgeView) {
String bridgeName = name.getKeyProperty("Name");
try {
name = new ObjectName(DOMAIN + ":SubDomain=runtime, type=resource, group=ActiveMQ, brokerName=" + brokerName
+ ", subgroup=network bridges, bridgeName=" + bridgeName);
} catch (MalformedObjectNameException e) {
throw new MBeanRegistrationException(e);
}
} else if (implementation instanceof NetworkConnectorView) {
NetworkConnectorView view = (NetworkConnectorView) implementation;
try {
name = new ObjectName(DOMAIN + ":SubDomain=runtime, type=resource, group=ActiveMQ, brokerName=" + brokerName
+ ", subgroup=network connectors, connectorName=" + JMXSupport.encodeObjectNamePart(view.getName()));
} catch (MalformedObjectNameException e) {
throw new MBeanRegistrationException(e);
}
} else if (implementation instanceof ProxyConnectorView) {
String connectorName = name.getKeyProperty("ProxyConnectorName");
try {
name = new ObjectName(DOMAIN + ":SubDomain=runtime, type=resource, group=ActiveMQ, brokerName=" + brokerName
+ ", subgroup=proxy connectors, proxyConnectorName=" + connectorName);
} catch (MalformedObjectNameException e) {
throw new MBeanRegistrationException(e);
}
} else if (implementation instanceof QueueView) {
QueueView view = (QueueView) implementation;
try {
name = new ObjectName(DOMAIN + ":SubDomain=runtime, type=resource, group=ActiveMQ, brokerName="
+ brokerName + ", subgroup=queues, queueName=" + JMXSupport.encodeObjectNamePart(view.getName()));
} catch (MalformedObjectNameException e) {
throw new MBeanRegistrationException(e);
}
} else if (implementation instanceof TopicView) {
TopicView view = (TopicView) implementation;
try {
name = new ObjectName(DOMAIN + ":SubDomain=runtime, type=resource, group=ActiveMQ, brokerName="
+ brokerName + ", subgroup=topics, queueName=" + JMXSupport.encodeObjectNamePart(view.getName()));
} catch (MalformedObjectNameException e) {
throw new MBeanRegistrationException(e);
}
}
return name;
}
}
|
[
"[email protected]"
] | |
65d03d2955e3b1d8f2b60cb82d26f0106c365534
|
6eaa054906ec11c372a5826b52f4df549f039906
|
/src/java/jdbc/All_in_one_7.java
|
62f59d99af8aca842d68599293624ffff580de4d
|
[] |
no_license
|
Kavan-Patel/Advance_Java
|
fdbe0a23f532c073ea4f447f36bc47b4a9c03ef1
|
b123b7766b4df03c308737479f5c260d05bc34c1
|
refs/heads/master
| 2020-04-23T00:21:47.867401 | 2020-02-17T03:42:54 | 2020-02-17T03:42:54 | 170,776,893 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,956 |
java
|
/*
* CopyRight @ykcode || do not use whole of any part of code
*/
package jdbc;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.Scanner;
/**
*
* @author kavan
*/
public class All_in_one_7 {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
MyConnection con=new MyConnection();
Scanner sc=new Scanner(System.in);
int d = 0;
do{
ResultSet rs=con.SelectData("select * from marksheet");
ResultSetMetaData mtdt=rs.getMetaData();
for (int i = 1; i <=mtdt.getColumnCount(); i++) {
if(!mtdt.getColumnName(i).equals("marksheetid"))
{
System.out.print(mtdt.getColumnName(i).toUpperCase()+"\t\t");
}
}
System.out.println("");
while(rs.next())
{
for (int i = 1; i <=mtdt.getColumnCount(); i++) {
if(!mtdt.getColumnName(i).equals("marksheetid"))
{
System.out.print(rs.getString(i)+"\t\t");
}
}
System.out.println("");
}
System.out.println("1.Select");
System.out.println("2.Insert");
System.out.println("3.Update");
System.out.println("4.Delete");
System.out.println("5.Exit");
System.out.print("Enter your choice::");
int choice=sc.nextInt();
switch(choice)
{
case 1:
{
System.out.print("Enter rollno which you want to select:");
int rollno=sc.nextInt();
ResultSet rsselect=con.SelectData("select * from marksheet where rollno="+rollno);
ResultSetMetaData mtdts=rsselect.getMetaData();
for (int i = 1; i <=mtdts.getColumnCount(); i++) {
if(!mtdts.getColumnName(i).equals("marksheetid"))
{
System.out.print(mtdts.getColumnName(i).toUpperCase()+"\t\t");
}
}
System.out.println("");
while(rsselect.next())
{
for (int i = 1; i <=mtdts.getColumnCount(); i++) {
if(!mtdts.getColumnName(i).equals("marksheetid"))
{
System.out.print(rsselect.getString(i)+"\t\t");
}
}
System.out.println("");
}
break;
}
case 2:
{
System.out.println("Enter The Details of new entry");
System.out.println("Enter Rollno");
int rollno=sc.nextInt();
System.out.println("Enter Name");
String name=sc.next();
System.out.println("Enter Maths");
int maths=sc.nextInt();
System.out.println("Enter Science");
int science=sc.nextInt();
System.out.println("Enter English");
int english=sc.nextInt();
con.Ins_Upd_Del("insert into marksheet (rollno,name,maths,science,english)values("+rollno+",'"+name+"',"+maths+","+science+","+english+")");
break;
}
case 3:
{
System.out.println("Enter The rollno which you want to update");
int rollno=sc.nextInt();
System.out.println("Enter new name");
String name=sc.next();
System.out.println("Enter new maths marks");
int maths=sc.nextInt();
System.out.println("Enter new science marks");
int science=sc.nextInt();
System.out.println("Enter new english marks");
int english=sc.nextInt();
con.Ins_Upd_Del("update marksheet set rollno="+rollno+",name='"+name+"',maths="+maths+",science="+science+",english="+english+" where rollno="+rollno);
break;
}
case 4:
{
System.out.println("Enter The rollno which you want to delete");
int rollno=sc.nextInt();
con.Ins_Upd_Del("delete from marksheet where rollno="+rollno);
break;
}
case 5:
{
System.out.println("Enter 1 for exit");
d=sc.nextInt();
break;
}
default:
{
System.out.println("Invalid choice");
}
}
}while(d==0);
}
}
|
[
"[email protected]"
] | |
d9ae1f0d24272f6c3c8ac4dae97b03b1dba6fad6
|
85dadd5db0325fb8cdc7b63653de6b1bc011259a
|
/ExercicioGeneration/src/Repeticao/ExercicioTres.java
|
9a659b9eb854768872d92b54afeedf0aa1148edb
|
[] |
no_license
|
BeatrizRodrigues/Generation
|
f520e3f10483b5b92df40a694bcec44eb3cfb492
|
f963fbeb4f74db6ef14a39fdf66d737b0994ebef
|
refs/heads/main
| 2023-06-18T14:55:02.741489 | 2021-07-22T13:32:46 | 2021-07-22T13:32:46 | 372,842,400 | 0 | 0 | null | null | null | null |
WINDOWS-1250
|
Java
| false | false | 807 |
java
|
package Repeticao;
/*Solicitar a idade de várias pessoas e imprimir: Total de pessoas com menos de
21 anos. Total de pessoas com mais de 50 anos. O programa termina quando
idade for =-99.*/
import java.util.Scanner;
public class ExercicioTres {
public static void main(String[] args) {
Scanner ler = new Scanner(System.in);
int n=0, idade=0, total21=0, total50=0;
while(idade!=-99) {
System.out.println("Entre com a idade ");
idade = ler.nextInt();
n++;
if(idade < 21 && idade > 0) {
total21++;
}
if(idade > 50) {
total50++;
}
}
System.out.println("Quantidade de idades inseridas - "+(n-1));
System.out.println("Quantidade de idades menores de 21 anos - "+total21);
System.out.println("Quantidade de idades maiores de 50 anos - "+total50);
}
}
|
[
"[email protected]"
] | |
6616e00efa1e312db3e8522a964010c163ffe9fd
|
7120f0438c1a4a20d67e88c822a601ad61ef5c4d
|
/zyr-web/src/main/java/com/zgm/zen/state/example3/CloseingState.java
|
0df921231f4716178dc335745395e9013c5b532f
|
[] |
no_license
|
zgmzyr/zyr
|
f94dea3d7f7f962b6df5e18185d3e61d77dc009a
|
fea3c44fe6fbe0c110805487096f203fcb8b823b
|
refs/heads/master
| 2021-01-17T15:09:02.961884 | 2016-06-26T08:38:14 | 2016-06-26T08:38:14 | 9,864,102 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 586 |
java
|
package com.zgm.zen.state.example3;
public class CloseingState extends LiftState {
@Override
public void close() {
System.out.println("电梯门关闭!");
}
@Override
public void open() {
super.context.setLiftState(Context.openningState);
super.context.getLiftState().open();
}
@Override
public void run() {
super.context.setLiftState(Context.runningState);
super.context.getLiftState().run();
}
@Override
public void stop() {
super.context.setLiftState(Context.stoppingState);
super.context.getLiftState().stop();
}
}
|
[
"Administrator@zgm"
] |
Administrator@zgm
|
be7af93e1eceb2023f9d476c1382dcc1a3d70c74
|
5f6e7fb5a8344b2a26511cfe4482b246bcc3054c
|
/app/src/main/java/com/siddik/siddiksummer2017/audio/BaseBean.java
|
fbd5be2373186fcbe525e5d8b6f7f11bfe09e279
|
[] |
no_license
|
alhassansiddik/SiddikSummer2017
|
95dfd6b7ae356a9e63aa709205652ad5e59b1687
|
9eee6f6482b02730894fbde01aa9040f469d3735
|
refs/heads/master
| 2020-06-02T16:41:44.248249 | 2017-07-03T05:31:13 | 2017-07-03T05:31:13 | 94,099,024 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 322 |
java
|
package com.siddik.siddiksummer2017.audio;
import java.io.Serializable;
/**
* Created by Sidleh on 6/21/2017.
*/
public class BaseBean implements Serializable{
private String name;
public String getName() {
return name;
}
public void setName(String name){
this.name = name;
}
}
|
[
"[email protected]"
] | |
1cc278d8b071defa4943ffc4c347eb8081449525
|
de493475f41c3b4991169d4d57a0f08198fb8759
|
/Football_Scores-master/app/src/main/java/barqsoft/footballscores/api/HomeTeam.java
|
e3bfaea4b0017c809e2a9b3d9b5593d05be67583
|
[] |
no_license
|
aldefy/NanodegreeSuperDuo
|
b9bde1cc8fb54a08e25a8a5dc32540cb92fbb392
|
c433a1ffbb0c97a1793b1aa83d6a0be7fd217c79
|
refs/heads/master
| 2021-01-10T14:23:11.000991 | 2016-02-15T05:00:06 | 2016-02-15T05:00:06 | 48,974,510 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 374 |
java
|
package barqsoft.footballscores.api;
/**
* Created by aditlal on 01/02/16.
*/
public class HomeTeam {
private String href;
public String getHref ()
{
return href;
}
public void setHref (String href)
{
this.href = href;
}
@Override
public String toString()
{
return "ClassPojo [href = "+href+"]";
}
}
|
[
"[email protected]"
] | |
5367fd549b0a3f7e57bf558aae999a10b8bfaf28
|
756cde994b7d77b3d56b2abcb6f38626725130a4
|
/LabAssignment1/src/main/java/com/cg/EmployeeClient.java
|
cd8d9997b92bf8f037e6266ca08a96bf9baad7cc
|
[] |
no_license
|
SudheshnaKaki/Springs
|
60a462a232aa98d3048fccd176c2c17c91610d83
|
9a5425464b73a36e37cc233fa7fa4086fdba2085
|
refs/heads/master
| 2020-04-07T02:28:00.177721 | 2018-11-22T12:29:55 | 2018-11-22T12:29:55 | 157,977,541 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 798 |
java
|
package com.cg;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class EmployeeClient {
public static void main(String[] args) {
ApplicationContext factory = new ClassPathXmlApplicationContext("employee.xml");
Employee employee = (Employee) factory.getBean("employee");
/*System.out.println("Employee Details\n----------------");
System.out.println("Employee id:"+employee.getEmployeeId());
System.out.println("Employee name:"+employee.getEmployeeName());
System.out.println("Employee salary:"+employee.getSalary());
System.out.println("Employee businessUnit:"+employee.getBusinessUnit());
System.out.println("Employee Age:"+employee.getAge());*/
System.out.println(employee);
}
}
|
[
"[email protected]"
] | |
985214b5a739dc4b91cd378ab21e6dc3f192f47a
|
5984adbfd381aed9da814eb08777338f03820b17
|
/week-09/day-02/src/main/java/com/greenfoxacademy/groot/controllers/GuardianController.java
|
5ac77f84b8d72ea527023638cbdbe26a32c9d70e
|
[] |
no_license
|
green-fox-academy/bjakfalvy
|
b12814893158a3bc1a9d740a16f4f6d106f81318
|
af16f0b937dc2bbb72f8322830b5787378c23531
|
refs/heads/master
| 2020-03-25T00:04:31.195824 | 2018-10-31T11:01:37 | 2018-10-31T11:01:37 | 143,167,817 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 234 |
java
|
package com.greenfoxacademy.groot.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class GuardianController {
@GetMapping("/groot")
}
|
[
"[email protected]"
] | |
75da6ff805df8d8f689bd39a8bf7c1d1d25529b6
|
a1b7e630dcbcc72d89ad155c7d6a2f5b25a5233b
|
/JavaSE-8/src/tr/com/cihan/java/networking/socket/tcp/KnockKnockProtocol.java
|
d04b66dc15bb87af1303ea487dbd85fcfc344553
|
[] |
no_license
|
cihanbulut1979/java-examples
|
b5768f8c0698aeadf2595318dce28bb148d16d19
|
419f7ac15f73eef6da7a3ec5c14582a9dba10aa9
|
refs/heads/master
| 2021-11-26T02:25:50.320196 | 2021-11-11T13:01:14 | 2021-11-11T13:01:14 | 169,397,011 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,737 |
java
|
package tr.com.cihan.java.networking.socket.tcp;
public class KnockKnockProtocol {
private static final int WAITING = 0;
private static final int SENTKNOCKKNOCK = 1;
private static final int SENTCLUE = 2;
private static final int ANOTHER = 3;
private static final int NUMJOKES = 5;
private int state = WAITING;
private int currentJoke = 0;
private String[] clues = { "Turnip", "Little Old Lady", "Atch", "Who", "Who" };
private String[] answers = { "Turnip the heat, it's cold in here!", "I didn't know you could yodel!", "Bless you!",
"Is there an owl in here?", "Is there an echo in here?" };
public String processInput(String theInput) {
String theOutput = null;
if (state == WAITING) {
theOutput = "Knock! Knock!";
state = SENTKNOCKKNOCK;
} else if (state == SENTKNOCKKNOCK) {
if (theInput.equalsIgnoreCase("Who's there?")) {
theOutput = clues[currentJoke];
state = SENTCLUE;
} else {
theOutput = "You're supposed to say \"Who's there?\"! " + "Try again. Knock! Knock!";
}
} else if (state == SENTCLUE) {
if (theInput.equalsIgnoreCase(clues[currentJoke] + " who?")) {
theOutput = answers[currentJoke] + " Want another? (y/n)";
state = ANOTHER;
} else {
theOutput = "You're supposed to say \"" + clues[currentJoke] + " who?\"" + "! Try again. Knock! Knock!";
state = SENTKNOCKKNOCK;
}
} else if (state == ANOTHER) {
if (theInput.equalsIgnoreCase("y")) {
theOutput = "Knock! Knock!";
if (currentJoke == (NUMJOKES - 1))
currentJoke = 0;
else
currentJoke++;
state = SENTKNOCKKNOCK;
} else {
theOutput = "Bye.";
state = WAITING;
}
}
return theOutput;
}
}
|
[
"[email protected]"
] | |
f268d50a26099dabe43f974b23fbb63547f0f482
|
bd1daf45cf784a20e181ade564cac252eb2bc8fa
|
/src/main/java/com/chantake/MituyaProject/MBean/Debug.java
|
6f298ff469870d6a6300ad8366e193716931598a
|
[] |
no_license
|
N-Magi/MituyaProject
|
98e7ba9b79bd59346adb257d78692d9363f8ac43
|
205e85407452efe250ed4ffc47668911c0bbe2c5
|
refs/heads/master
| 2021-06-13T10:21:03.049428 | 2017-01-29T15:24:28 | 2017-01-29T15:24:28 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,624 |
java
|
/*
* MituyaProject
* Copyright (C) 2011-2015 chantake <http://328mss.com/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.chantake.MituyaProject.MBean;
import com.chantake.MituyaProject.Exception.PlayerOfflineException;
import com.chantake.MituyaProject.MituyaProject;
import com.chantake.MituyaProject.Parameter.Parameter328;
import com.chantake.MituyaProject.World.Jackpot;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ExperienceOrb;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
/**
*
* @author fumitti
*/
public class Debug implements DebugMBean {
public List<Chunk> ll2 = new LinkedList<>();
private final MituyaProject plugin;
public Debug(MituyaProject plugin) {
this.plugin = plugin;
}
@Override
public int getEntitys() {
int i = 0;
for (World wr : plugin.getWorldManager().getWorlds()) {
i = +wr.getEntities().size();
}
return i;
}
@Override
public int getLivingEntitys() {
int i = 0;
for (World wr : plugin.getWorldManager().getWorlds()) {
i = +wr.getLivingEntities().size();
}
return i;
}
public List<Chunk> getLl2() {
return ll2;
}
@Override
public int getLoadedChunks() {
return ll2.size();
}
@Override
public int getOnlineUser() {
return plugin.getServer().getOnlinePlayers().size();
}
@Override
public void Selfdestruct(String name, int amount) {
try {
Player player = plugin.getInstanceManager().matchSingleInstance(name).getPlayer();
player.getWorld().createExplosion(player.getLocation(), amount, false);
}
catch (PlayerOfflineException ex) {
Logger.getLogger(Debug.class.getName()).log(Level.SEVERE, null, ex);
}
}
@Override
public void AMMOAIRDROP(String name, int amount) {
try {
Player player = plugin.getInstanceManager().matchSingleInstance(name).getPlayer();
Location location = player.getLocation();
location.setY(256);
ThrownPotion potion = (ThrownPotion)location.getWorld().spawnEntity(location, EntityType.SPLASH_POTION);
// Now apply whatever to the potion
Collection<PotionEffect> effects = potion.getEffects();
effects.clear();
effects.add(new PotionEffect(PotionEffectType.HEAL, 10, amount));
potion.setShooter(player);
}
catch (PlayerOfflineException ex) {
Logger.getLogger(Debug.class.getName()).log(Level.SEVERE, null, ex);
}
}
@Override
public void fireinthehole(String name, int amount, boolean napa) {
try {
Player player = plugin.getInstanceManager().matchSingleInstance(name).getPlayer();
Location location = player.getLocation();
location.setY(location.getY() + 10);
TNTPrimed spawn = (TNTPrimed)location.getWorld().spawnEntity(location, EntityType.PRIMED_TNT);
spawn.setFuseTicks(amount);
spawn.setIsIncendiary(napa);
spawn.setYield(amount);
spawn.setVelocity(new Vector(0, -10, 0));
}
catch (PlayerOfflineException ex) {
Logger.getLogger(Debug.class.getName()).log(Level.SEVERE, null, ex);
}
}
@Override
public void ExperienceOrbAIRDROP(String name, int amount, int exp) {
try {
Player player = plugin.getInstanceManager().matchSingleInstance(name).getPlayer();
Location location = player.getLocation();
location.setY(256);
for (int i = 0; i < amount; i++) {
ExperienceOrb spawn = (ExperienceOrb)location.getWorld().spawnEntity(location, EntityType.EXPERIENCE_ORB);
spawn.setExperience(exp);
}
}
catch (PlayerOfflineException ex) {
Logger.getLogger(Debug.class.getName()).log(Level.SEVERE, null, ex);
}
}
@Override
public void fireball(String name, int amount, boolean naparm) {
try {
Player player = plugin.getInstanceManager().matchSingleInstance(name).getPlayer();
Location location = player.getLocation();
location.setY(location.getY() - 2);
Fireball spawn = (Fireball)location.getWorld().spawnEntity(location, EntityType.FIREBALL);
spawn.setDirection(player.getEyeLocation().getDirection());
spawn.setIsIncendiary(naparm);
spawn.setYield(amount);
spawn.setVelocity(new Vector(0, -10, 0));
}
catch (PlayerOfflineException ex) {
Logger.getLogger(Debug.class.getName()).log(Level.SEVERE, null, ex);
}
}
@Override
public int getLimitJackpot1() {
return Jackpot.LimitJackpot1;
}
@Override
public int getjackpot2() {
return Jackpot.jackpot2;
}
@Override
public int getLimitJackpot2() {
return Jackpot.LimitJackpot2;
}
@Override
public void setLimitJackpot1(int a) {
Jackpot.LimitJackpot1 = a;
}
@Override
public void setjackpot2(int a) {
Jackpot.jackpot2 = a;
}
@Override
public void setLimitJackpot2(int a) {
Jackpot.LimitJackpot2 = a;
}
@Override
public long getJackpot() {
return Parameter328.jackpot;
}
@Override
public void setJackpot(long i) {
Parameter328.jackpot = i;
}
@Override
public void bottiPlayer(String name) {
try {
Player player = plugin.getInstanceManager().matchSingleInstance(name).getPlayer();
player.getServer().getOnlinePlayers();
for (Player pl : player.getServer().getOnlinePlayers()) {
player.hidePlayer(pl);
}
}
catch (PlayerOfflineException ex) {
}
}
@Override
public void unbochiPlayer(String name) {
try {
Player player = plugin.getInstanceManager().matchSingleInstance(name).getPlayer();
player.getServer().getOnlinePlayers();
for (Player pl : player.getServer().getOnlinePlayers()) {
player.showPlayer(pl);
}
}
catch (PlayerOfflineException ex) {
}
}
}
|
[
"[email protected]"
] | |
bc94e71980863108b41ae42af49a93f255abb362
|
6d1212795f83ef48e71980047507c09ec69d3053
|
/app/src/test/java/com/meroapp/marksheetapplication/ExampleUnitTest.java
|
abfcab048cc6d80ebbc9ab4df8e30b50f0801637
|
[] |
no_license
|
ashokbishwokarma96/MarkSheetApplication
|
b06af0d92133c0d88e150d6cb7b4fb1cf7ded494
|
bdd38c4add7540c63e554e27357ff9745f274ac7
|
refs/heads/master
| 2020-08-01T23:10:37.791252 | 2019-09-26T18:04:18 | 2019-09-26T18:04:18 | 211,151,250 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 393 |
java
|
package com.meroapp.marksheetapplication;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
|
[
"[email protected]"
] | |
d7c896a1e93887a9d014b391efd408cbaa3078e9
|
271819ce7ffb8ab456b25414b7e9f0cfdb9bcfb5
|
/src/be/re/xml/DOMToContentHandler.java
|
6a17390f8cc70f0af325cb1c6df542efe0177060
|
[] |
no_license
|
ggeurts/css2xmlfo
|
dece42d74188cd143818714277a851f6b1632ec7
|
1522d447881dd3c83575d0da1c242e0ec83c2c37
|
refs/heads/master
| 2016-09-03T07:24:28.376205 | 2014-12-15T18:16:12 | 2014-12-15T18:16:12 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,127 |
java
|
package be.re.xml;
import java.util.ArrayList;
import java.util.List;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.ProcessingInstruction;
import org.w3c.dom.Text;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.XMLFilter;
import org.xml.sax.helpers.AttributesImpl;
import org.xml.sax.helpers.XMLFilterImpl;
/**
* With this class a DOM document can be fed into a SAX chain.
*
* @author Werner Donn\u00e9
*/
public class DOMToContentHandler
{
/**
* Extracts the attributes of an element for use in a SAX-environment. It
* leaves out namespace declarations, which are emitted as events.
*/
public static Attributes createAttributes(Element element)
{
AttributesImpl attributes = new AttributesImpl();
NamedNodeMap map = element.getAttributes();
for (int i = 0; i < map.getLength(); ++i)
{
Attr attribute = (Attr) map.item(i);
if (attribute.getNamespaceURI() != null)
{
attributes.addAttribute(
attribute.getNamespaceURI(),
attribute.getLocalName(),
attribute.getPrefix() != null
? (attribute.getPrefix() + ":" + attribute.getLocalName())
: attribute.getLocalName(),
"CDATA",
attribute.getValue());
}
else
{
if (!"xmlns".equals(attribute.getName())
&& !attribute.getName().startsWith("xmlns:"))
{
attributes.addAttribute(
"",
attribute.getName(),
attribute.getName(),
"CDATA",
attribute.getValue());
}
}
}
return attributes;
}
/**
* Runs a complete DOM-document through a <code>ContentHandler</code>.
*/
public static void documentToContentHandler(Document document, ContentHandler handler) throws SAXException
{
XMLFilterImpl h = realHandler(handler);
h.startDocument();
elementToContentHandler(document.getDocumentElement(), h);
h.endDocument();
}
/**
* Runs a complete DOM-element through a <code>ContentHandler</code>.
*/
public static void elementToContentHandler(Element element, ContentHandler handler) throws SAXException
{
elementToContentHandler(element, realHandler(handler));
}
private static void elementToContentHandler(Element element, XMLFilterImpl handler) throws SAXException
{
String[] prefixes = startPrefixMappings(element, handler);
startElement(element, handler);
siblingsToContentHandler(element.getFirstChild(), handler);
endElement(element, handler);
for (int i = prefixes.length - 1; i >= 0; --i)
{
handler.endPrefixMapping(prefixes[i]);
}
}
public static void endElement(Element element, ContentHandler handler) throws SAXException
{
if (element.getNamespaceURI() != null)
{
handler.endElement(
element.getNamespaceURI(),
element.getLocalName(),
element.getPrefix() != null
? (element.getPrefix() + ":" + element.getLocalName())
: element.getLocalName());
}
else
{
handler.endElement("", element.getTagName(), element.getTagName());
}
}
/**
* Puts an <code>XMLFilterImpl</code> in front of <code>handler</code> in
* order to provide the possiblity to the latter to insert an
* <code>Accumulator</code> dynamically.
*/
private static XMLFilterImpl realHandler(ContentHandler handler)
{
XMLFilterImpl result = new XMLFilterImpl();
result.setContentHandler(handler);
if (handler instanceof XMLFilter)
{
((XMLFilter) handler).setParent(result);
}
return result;
}
/**
* Runs a complete sibling list through a <code>ContentHandler</code>
* starting with <code>node</code>.
*/
public static void siblingsToContentHandler(Node node, ContentHandler handler) throws SAXException
{
siblingsToContentHandler(node, realHandler(handler));
}
private static void siblingsToContentHandler(Node node, XMLFilterImpl handler) throws SAXException
{
if (node == null)
{
return;
}
switch (node.getNodeType())
{
case Node.ELEMENT_NODE:
elementToContentHandler((Element) node, handler);
break;
case Node.PROCESSING_INSTRUCTION_NODE:
handler.processingInstruction(
((ProcessingInstruction) node).getTarget(),
((ProcessingInstruction) node).getData());
break;
case Node.TEXT_NODE:
{
char[] chars = ((Text) node).getData().toCharArray();
handler.characters(chars, 0, chars.length);
}
break;
}
siblingsToContentHandler(node.getNextSibling(), handler);
}
public static void startElement(Element element, ContentHandler handler) throws SAXException
{
if (element.getNamespaceURI() != null)
{
handler.startElement(
element.getNamespaceURI(),
element.getLocalName(),
element.getPrefix() != null
? (element.getPrefix() + ":" + element.getLocalName())
: element.getLocalName(),
createAttributes(element));
}
else
{
handler.startElement(
"",
element.getTagName(),
element.getTagName(),
createAttributes(element));
}
}
private static String[] startPrefixMappings(Element element, ContentHandler handler) throws SAXException
{
NamedNodeMap map = element.getAttributes();
List<String> result = new ArrayList<>();
for (int i = 0; i < map.getLength(); ++i)
{
Attr attribute = (Attr) map.item(i);
String name = attribute.getName();
if (name.startsWith("xmlns"))
{
String prefix = name.startsWith("xmlns:")
? name.substring(name.indexOf(':') + 1)
: "";
result.add(prefix);
handler.startPrefixMapping(prefix, attribute.getValue());
}
}
return result.toArray(new String[result.size()]);
}
} // DOMToContentHandler
|
[
"[email protected]"
] | |
d618a3f7a3da8881207e511e5aafd73c3e20da46
|
e44b6d0dd79279e9be56d835b2010bc663baa363
|
/eGs_epro_sbdc/src/main/java/com/eunwoosoft/ipro/noti/service/IproTrmService.java
|
b665e96e7a265c595ae536d1cd3ee6d171be20bd
|
[] |
no_license
|
son99you/cloud_test
|
7d17248cd08f72584316f65b32131924020bfef8
|
61908c06f1be209daf619bbfb3a1c36c2d363d08
|
refs/heads/master
| 2023-09-05T00:46:13.831590 | 2021-11-23T07:18:00 | 2021-11-23T07:18:00 | 430,992,584 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,237 |
java
|
package com.eunwoosoft.ipro.noti.service;
import com.eunwoosoft.frwk.fol.dto.FwkTransferObject;
import com.eunwoosoft.frwk.prl.request.FwkParameterMap;
/**
*
* com.eunwoosoft.ipro.trm.service
* IprotrmService.java
*
* @Author : JuYeon_Lee
* @Date : 2018. 3. 15.
*
*/
public interface IproTrmService {
static final String TRM_LIST = "trmList";
static final String TRM_LIST_TOTCNT = "trmListTotCnt";
static final String TRM_DETAIL = "trmDetail";
static final String USR_INFO_DETAIL = "usrInfoDetail";
FwkTransferObject trmListWithPgng(final FwkParameterMap parameterMap);
FwkTransferObject trmDetail(final FwkParameterMap parameterMap);
FwkTransferObject trmRegist(final FwkParameterMap parameterMap) throws Exception;
FwkTransferObject trmDelete(final FwkParameterMap parameterMap) throws Exception;
FwkTransferObject trmUpdt(final FwkParameterMap parameterMap)throws Exception;
FwkTransferObject usrInfoDetail(final FwkParameterMap parameterMap);
FwkTransferObject trmDataAll(final FwkParameterMap parameterMap);
FwkTransferObject trmCnt(final FwkParameterMap parameterMap);
FwkTransferObject trmListExcelDwld(final FwkParameterMap parameterMap);
}
|
[
"[email protected]"
] | |
efbc8a528e7215646d6b0c48892cb4a889246dbe
|
f37237793d54add244cbc496f095365a597e5917
|
/app/src/main/java/br/com/aloliveira/ceep/ui/recyclerview/adapter/listener/OnItemClickListener.java
|
8036a6dd202085797f50b2e7db18449940be1d94
|
[
"MIT"
] |
permissive
|
Alefros/alura-android-java-bloco-notas
|
2fdcc331d2298eec5a0bc5f3ff48ae7398de667b
|
4b4dd9396742a364168e2e3a44f927d29f3b49a1
|
refs/heads/master
| 2023-05-13T02:20:17.708336 | 2021-05-31T03:42:05 | 2021-05-31T03:42:05 | 281,013,075 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 197 |
java
|
package br.com.aloliveira.ceep.ui.recyclerview.adapter.listener;
import br.com.aloliveira.ceep.model.Nota;
public interface OnItemClickListener {
void onItemClick(Nota nota, int posicao);
}
|
[
"[email protected]"
] | |
ee8f0e1cc91038591977e20431bd174c4c7a9e42
|
ece372495202be631e176c12bf4bdbd157ae7146
|
/pet-clinic-data/src/main/java/com/spring/model/Speciality.java
|
2e207696a267d322ae8e2326e36901a601528c6f
|
[] |
no_license
|
MikePaz/SpringProject
|
72072c3e7ca0c0da3a5fdb0cd4c37a2344205c66
|
8e0e9aa52975dcbaacc76a354f3123a88ce316ed
|
refs/heads/master
| 2020-08-03T09:35:56.146536 | 2019-09-30T14:21:33 | 2019-09-30T14:21:33 | 211,703,760 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 447 |
java
|
package com.spring.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "specialities")
public class Speciality extends BaseEntity {
@Column(name = "description")
private String description;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
|
[
"[email protected]"
] | |
7f9a16d56c97a41d03f44ad0330414f5013394b4
|
32697b77c4a4c197bf3bfaf9d5639967b6c67b27
|
/src/processor/register/Registers.java
|
be8c50597af6b1fadea4b0e760123e674ff7e573
|
[] |
no_license
|
Zax337/5DV118-assign2
|
f43297ca7d9c9de7b2089b9a7dbaadb8d3c13d41
|
cbb1b95afbf8dd5bf0c066d5dc2dba11467ea59b
|
refs/heads/master
| 2020-05-20T05:17:43.245013 | 2013-01-07T10:25:33 | 2013-01-07T10:25:33 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,248 |
java
|
/**
*
*/
package processor.register;
import instruction.Instruction;
import java.util.HashMap;
import processor.controls.Control;
/**
* @author Acid Flow
*
*/
public class Registers {
private static final int NB_REGISTER = 32;
private static final int[] MUST_BE_PRESERVED = {16,17,18,19,20,21,22,23,28,29,30};
public static final HashMap<String, Integer> REGISTERS = new HashMap<String, Integer>();
public static final HashMap<Integer, String> REGISTERS_INT = new HashMap<Integer, String>();
// Hashmap initialisation
static{
REGISTERS.put("$zero", 0); REGISTERS_INT.put(0, "$zero"); // Constant 0
REGISTERS.put("$at", 1); REGISTERS_INT.put(1,"$at"); // Assembler temporary
REGISTERS.put("$v0", 2); REGISTERS_INT.put(2,"$v0"); // values for functiuon returns and expression evaluation
REGISTERS.put("$v1", 3); REGISTERS_INT.put(3,"$v1");
REGISTERS.put("$a0", 4); REGISTERS_INT.put(4,"$a0"); // Function arguments
REGISTERS.put("$a1", 5); REGISTERS_INT.put(5,"$a1");
REGISTERS.put("$a2", 6); REGISTERS_INT.put(6,"$a2");
REGISTERS.put("$a3", 7); REGISTERS_INT.put(7,"$a3");
REGISTERS.put("$t0", 8); REGISTERS_INT.put(8,"$t0"); // Temporaries
REGISTERS.put("$t1", 9); REGISTERS_INT.put(9,"$t1");
REGISTERS.put("$t2", 10); REGISTERS_INT.put(10,"$t2");
REGISTERS.put("$t3", 11); REGISTERS_INT.put(11,"$t3");
REGISTERS.put("$t4", 12); REGISTERS_INT.put(12,"$t4");
REGISTERS.put("$t5", 13); REGISTERS_INT.put(13,"$t5");
REGISTERS.put("$t6", 14); REGISTERS_INT.put(14,"$t6");
REGISTERS.put("$t7", 15); REGISTERS_INT.put(15,"$t7");
REGISTERS.put("$s0", 16); REGISTERS_INT.put(16,"$s0"); // Saved temporaries
REGISTERS.put("$s1", 17); REGISTERS_INT.put(17,"$s1");
REGISTERS.put("$s2", 18); REGISTERS_INT.put(18,"$s2");
REGISTERS.put("$s3", 19); REGISTERS_INT.put(19,"$s3");
REGISTERS.put("$s4", 20); REGISTERS_INT.put(20,"$s4");
REGISTERS.put("$s5", 21); REGISTERS_INT.put(21,"$s5");
REGISTERS.put("$s6", 22); REGISTERS_INT.put(22,"$s6");
REGISTERS.put("$s7", 23); REGISTERS_INT.put(23,"$s7");
REGISTERS.put("$t8", 24); REGISTERS_INT.put(24,"$t8"); // Temporaries
REGISTERS.put("$t9", 25); REGISTERS_INT.put(25,"$t9");
REGISTERS.put("$k0", 26); REGISTERS_INT.put(26,"$k0"); // Reserved for OS kernel
REGISTERS.put("$k1", 27); REGISTERS_INT.put(27,"$k1");
REGISTERS.put("$gp", 28); REGISTERS_INT.put(28,"$gp"); // Global pointer
REGISTERS.put("$sp", 29); REGISTERS_INT.put(29,"$sp"); // Stack pointer
REGISTERS.put("$fp", 30); REGISTERS_INT.put(30,"$fp"); // Frame pointer
REGISTERS.put("$ra", 31); REGISTERS_INT.put(31,"$ra"); // Return address
}
private int[] _registerValues;
private int _inputReadRegister1;
private int _inputReadRegister2;
private int _inputWriteRegister;
private int _inputWriteData;
private int _outputReadData1;
private int _outputReadData2;
private int _lastChanged;
public Registers(){
_registerValues = new int[NB_REGISTER];
initRegisters();
_lastChanged = -1;
}
public int[] getRegistersValues(){
return _registerValues;
}
public void setInputReadRegister1(int completeInstruction){
_inputReadRegister1 = Integer.parseInt(Instruction.extendToMaxBits(Integer.toBinaryString(completeInstruction), 32).substring(6,11), 2);
}
public void setInputReadRegister2(int completeInstruction){
_inputReadRegister2 = Integer.parseInt(Instruction.extendToMaxBits(Integer.toBinaryString(completeInstruction), 32).substring(11,16), 2);
}
public void setInputWriteRegister(int completeInstruction, Control c){
if(!c.isRegDst()){
_inputWriteRegister = Integer.parseInt(Instruction.extendToMaxBits(Integer.toBinaryString(completeInstruction), 32).substring(11,16), 2);
}else{
_inputWriteRegister = Integer.parseInt(Instruction.extendToMaxBits(Integer.toBinaryString(completeInstruction), 32).substring(16,21), 2);
}
}
public void setOuputReadData1(){
_outputReadData1 = _registerValues[_inputReadRegister1];
}
public void setOuputReadData2(){
_outputReadData2 = _registerValues[_inputReadRegister2];
}
public int getOutputReadData1(){
return _outputReadData1;
}
public int getOutputReadData2(){
return _outputReadData2;
}
public void setInputWriteData(int data){
_inputWriteData = data;
}
public void writeData(Control c){
if(c.isRegWrite()){
_registerValues[_inputWriteRegister] = _inputWriteData;
_lastChanged = _inputWriteRegister;
}else{
_lastChanged = -1;
}
}
public int getLastChanged(){
return _lastChanged;
}
/**
* Set the register value
* @param regNumber register name
* @param value value to store in register
* @throws IllegalArgumentException if the register must be preserved
*/
public void setRegisterValue(String regName, int value) throws IllegalArgumentException{
if(REGISTERS.containsKey(regName)){
int regNumber = REGISTERS.get(regName);
setRegisterValue(regNumber, value);
}else{
throw new IllegalArgumentException("Register :" + regName + " is not a valid register");
}
}
/**
* Set the register value
* @param regNumber register number
* @param value value to store in register
* @throws IllegalArgumentException if the register must be preserved
*/
public void setRegisterValue(int regNumber, int value) throws IllegalArgumentException{
if(mustBePreserved(regNumber)){
throw new IllegalArgumentException("Register "+ regNumber + " must be preserved by callee");
}else{
_registerValues[regNumber] = value;
}
}
public void reset(){
initRegisters();
_lastChanged = -1;
}
/**
* Initialize registers to 0
*/
private void initRegisters(){
for(int i = 0; i < NB_REGISTER; i++){
_registerValues[i] = 0;
}
}
/**
* Check if the register reg must be preserved by callee
* @param reg register number
* @return true if the callee must preserve the register reg, false otherwise
*/
private boolean mustBePreserved(int reg){
for(int i = 0; i < MUST_BE_PRESERVED.length; i++){
if(MUST_BE_PRESERVED[i] == reg){
return true;
}
}
return false;
}
}
|
[
"[email protected]"
] | |
096a59d2150a70f7ea10bd9e426ed9e87ba15128
|
30fee0305b1a435b60111611dca028812818957d
|
/testing/src/trivialDateServerAndClient/DateClient.java
|
48d360879b303490b6c08aeb6cd2cfc4fe84e1a0
|
[] |
no_license
|
alexace013/for-testing
|
9a2ee9a50cfee5bd482781e441b62c3dd68d3362
|
713bdf8cbc227456be193d421297445fbbf9aa5e
|
refs/heads/master
| 2021-01-22T04:40:33.673192 | 2016-01-03T15:11:18 | 2016-01-03T15:11:18 | 42,043,727 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 797 |
java
|
package trivialDateServerAndClient;
import javax.swing.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
/**
* Created by alexander on 09.09.15.
*/
public class DateClient {
public static void main(String[] args) throws IOException {
String serverAddress = JOptionPane.showInputDialog(
"Enter IP Address of a machine is\n" +
"running the date service on port 3095: ");
Socket socket = new Socket(serverAddress, 3095);
BufferedReader input =
new BufferedReader(new InputStreamReader(socket.getInputStream()));
String answer = input.readLine();
JOptionPane.showMessageDialog(null, answer);
System.exit(0);
}
}
|
[
"[email protected]"
] | |
742e498f2955b77cceaae96b6ba1a123fcf580ec
|
d7d25035fbe9fb7ce5c60c0c52b893615994d9c3
|
/BrutalChess/src/brutalchess/online/Client.java
|
97c1a2a2bd0d156a81f649158b903e3fe9c7350d
|
[] |
no_license
|
Barush/Chess-project
|
eaefc2bc2b325be650ad33450a37bbfa8543be5b
|
6d15b7aa813262468591e43b06c7cd2343111eea
|
refs/heads/master
| 2016-09-11T12:28:22.180508 | 2014-06-18T07:39:58 | 2014-06-18T07:39:58 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,345 |
java
|
package brutalchess.online;
import static brutalchess.Const.*;
import brutalchess.basis.Game;
import java.net.*;
import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author Canes
*/
public class Client extends Online implements Runnable{
protected String host;
protected int port;
public Client(Game game, String addressString){
super(game);
String[] info = addressString.split(":");
// this is client
host = info[0];
port = Integer.parseInt(info[1]);
}
@Override
public void run(){
InetAddress address;
try {
address = InetAddress.getByName(host);
try {
socket = new Socket(address, port);
sendMsg(CONNECTMESSAGE);
dbg("Socket created! Sending message...");
} catch (IOException ex) {
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
dbg("BULLSHIT!");
}
} catch (UnknownHostException ex) {
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
dbg("BULLSHIT!");
}
// get Color from host
int color = Integer.parseInt( listenFor() );
dbg("Got color from server: "+ (char) color);
if (color == BLACK || color == WHITE){
game.setLocalColor(color);
} else {
throw new RuntimeException("Host didnt respond which color I should be");
}
super.init();
}
}
|
[
"[email protected]"
] | |
ead1efc1a66d630c3d2bea2e9ecc8c6a6aa70b82
|
b451359e83a898e2a15d672e2e18f7286ab83574
|
/Module1-5/src/Tomashchuk_Anna/LabWork_2_5_Initialization_sections/Lab254/MyInit.java
|
099316a829efba2426d9209fa7fc500398ef6991
|
[] |
no_license
|
PBaranovskyi/brain_acad_2019
|
33dfd328c1b8244a6d2f9d9e186c3b82231418b1
|
8ff8b47b0eee608ed364fed67b26fadec7f2470b
|
refs/heads/master
| 2022-12-21T12:20:28.616342 | 2019-11-19T13:41:18 | 2019-11-19T13:41:18 | 188,457,127 | 0 | 0 | null | 2022-12-10T05:42:48 | 2019-05-24T16:45:53 |
Java
|
UTF-8
|
Java
| false | false | 842 |
java
|
package Tomashchuk_Anna.LabWork_2_5_Initialization_sections.Lab254;
import java.util.Arrays;
public class MyInit {
private static int[] arr1;
private static int[] arr2;
static {
// non-static initialization block
arr1 = new int[10]; //Size of array is 10
for (int i = 0; i < arr1.length; i++) {
// arr[i] = a++;
arr1[i] = (int) (100 * Math.random());
}
}
static {
// non-static initialization block
arr2 = new int[10]; //Size of array is 10
for (int i = 0; i < arr2.length; i++) {
// arr[i] = a++;
arr2[i] = (int) (100 * Math.random());
}
}
public static void main(String[] args) {
System.out.println(Arrays.toString(arr1));
System.out.println(Arrays.toString(arr2));
}
}
|
[
"[email protected]"
] | |
38425225e564c2a78e8a559103d2a2a78fac2565
|
f6cd37b57d594626d0bfe64897b9908895c18ba8
|
/DailyFashionAdvice/app/src/main/java/com/sobremesa/waywt/models/RemoteObject.java
|
eac60459dce39d61db18fb2c08ffc7969ccf8199
|
[] |
no_license
|
meilers/dailyfashionadvice_android
|
aad9c588f47da7f928c468898763db3215dbe145
|
f805c6fbbcf3fdd86042c2919a59be7969ce4df8
|
refs/heads/master
| 2021-01-23T13:58:55.262899 | 2014-11-07T04:52:35 | 2014-11-07T04:52:35 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 369 |
java
|
package com.sobremesa.waywt.models;
/**
* Created by Michael on 2014-03-11.
*/
public abstract class RemoteObject {
public enum SyncStatus
{
NO_CHANGES, QUEUED_TO_SYNC, TEMP /* NO SYNCING */
}
public abstract String getIdentifier();
public String getIdentifier2() { return ""; };
public String getIdentifier3() { return ""; };
}
|
[
"[email protected]"
] | |
9164dd68aeb9c913b2b160033eb4d3406458a027
|
d732f6152dea903fb5aa1f93757525bf62e38344
|
/src/main/java/net/finmath/initialmargin/isdasimm/changedfinmath/products/indices/LinearCombinationIndex.java
|
7653b7d50a840f14eaae051a67b76a460b361483
|
[] |
no_license
|
volOI/finmath-forward-initial-margin
|
bb647191caff81475fa0ca82f4216e4771e17026
|
a1543a5f4d2339b1fc86377c5dcdc9b05b804e3b
|
refs/heads/master
| 2020-03-11T18:52:26.676628 | 2018-03-18T10:44:32 | 2018-03-18T10:44:32 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,046 |
java
|
/*
* Created on 06.12.2009
*
* (c) Copyright Christian P. Fries, Germany. All rights reserved. Contact: [email protected].
*/
package net.finmath.initialmargin.isdasimm.changedfinmath.products.indices;
import java.util.Set;
import net.finmath.exception.CalculationException;
import net.finmath.initialmargin.isdasimm.changedfinmath.LIBORModelMonteCarloSimulationInterface;
import net.finmath.initialmargin.isdasimm.changedfinmath.products.components.AbstractProductComponent;
//import net.finmath.montecarlo.interestrate.LIBORModelMonteCarloSimulationInterface;
//import net.finmath.montecarlo.interestrate.products.components.AbstractProductComponent;
import net.finmath.stochastic.RandomVariableInterface;
/**
* A linear combination index paying scaling1 * index1(t) + scaling2 * index2(t)
*
* @author Christian Fries
*/
public class LinearCombinationIndex extends AbstractIndex {
private static final long serialVersionUID = -8181742829635380940L;
private AbstractProductComponent index1;
private AbstractProductComponent index2;
private double scaling1;
private double scaling2;
/**
* Create a linear combination index paying scaling1 * index1(t) + scaling2 * index2(t)
*
* @param scaling1 Scaling for first index.
* @param index1 First index.
* @param scaling2 Scaling for second index.
* @param index2 Second index.
*/
public LinearCombinationIndex(double scaling1, AbstractProductComponent index1, double scaling2, AbstractProductComponent index2) {
super();
this.scaling1 = scaling1;
this.index1 = index1;
this.scaling2 = scaling2;
this.index2 = index2;
}
@Override
public RandomVariableInterface getValue(double evaluationTime, LIBORModelMonteCarloSimulationInterface model) throws CalculationException {
return index1.getValue(evaluationTime, model).mult(scaling1)
.addProduct(index2.getValue(evaluationTime, model),scaling2);
}
/**
* Returns the index 1.
*
* @return the index 1.
*/
public AbstractProductComponent getIndex1() {
return index1;
}
/**
* Returns the index 2.
*
* @return the index 2
*/
public AbstractProductComponent getIndex2() {
return index2;
}
/**
* Returns the scaling 1.
*
* @return the scaling 1
*/
public double getScaling1() {
return scaling1;
}
/**
* Returns the scaling 2.
*
* @return the scaling 2
*/
public double getScaling2() {
return scaling2;
}
@Override
public Set<String> queryUnderlyings() {
Set<String> underlyingNames = index1.queryUnderlyings();
Set<String> underlyingNames2 = index2.queryUnderlyings();
if(underlyingNames2 != null) {
if(underlyingNames != null) underlyingNames.addAll(underlyingNames2);
else underlyingNames = underlyingNames2;
}
return underlyingNames;
}
@Override
public String toString() {
return "LinearCombinationIndex [index1=" + index1 + ", index2="
+ index2 + ", scaling1=" + scaling1 + ", scaling2=" + scaling2
+ ", toString()=" + super.toString() + "]";
}
}
|
[
"[email protected]"
] | |
9ca4f2e097fc85dbd3543b09bb03395542957f99
|
a293e165739ac52f0ac2bf44d20787f94428b850
|
/app/src/main/java/ayp/aug/photogallerynerd/PhotoPageFragment.java
|
6305ad261f347d280fe203b4bb37c2bda2647765
|
[] |
no_license
|
tanaphonble/photo_gallery_nerd
|
429c59b31839f1eb272e608ad9bae27fbc0f72cb
|
9b2ffdc1acbbc4c689ffe3c482e4636dc6cc7cb6
|
refs/heads/master
| 2020-07-05T09:16:41.820135 | 2016-09-17T08:24:49 | 2016-09-17T08:24:49 | 66,180,600 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,686 |
java
|
package ayp.aug.photogallerynerd;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
/**
* Created by Tanaphon on 9/17/2016.
*/
public class PhotoPageFragment extends VisibleFragment {
private static final String TAG = "PhotoPageFragment";
private static final String ARG_URI = "photo_page_url";
private Uri mUri;
private WebView mWebView;
private ProgressBar mProgressBar;
public static PhotoPageFragment newInstance(Uri uri) {
Bundle args = new Bundle();
args.putParcelable(ARG_URI, uri);
PhotoPageFragment photoPageFragment = new PhotoPageFragment();
photoPageFragment.setArguments(args);
return photoPageFragment;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mUri = getArguments().getParcelable(ARG_URI);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_photo_page, container, false);
mWebView = (WebView) v.findViewById(R.id.fragment_photo_page_web_view);
mProgressBar = (ProgressBar) v.findViewById(R.id.fragment_photo_page_progress_bar);
mProgressBar.setMax(100);
mWebView.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
if (newProgress == 100)
mProgressBar.setVisibility(View.GONE);
else {
mProgressBar.setVisibility(View.VISIBLE);
mProgressBar.setProgress(newProgress);
}
}
@Override
public void onReceivedTitle(WebView view, String title) {
AppCompatActivity activity = (AppCompatActivity) getActivity();
activity.getSupportActionBar().setTitle(title);
}
});
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return false;
}
});
mWebView.loadUrl(mUri.toString());
return v;
}
}
|
[
"[email protected]"
] | |
40178d8c3a56327917f20e7031f74a253d8af9a2
|
65250fc1727471445276cb1f8915264200c0b0db
|
/Attribute.java
|
56e53b84d1d079c7511be9b2bb6dc196db4512bb
|
[] |
no_license
|
gigly222/ID3_Tree
|
ef4ba816809f8c81e1bb6b2a8f0c27b3625fa53b
|
a8def2944fe55f77b68a7039c61943a738ee6b90
|
refs/heads/master
| 2021-01-23T05:44:56.501253 | 2017-05-31T16:14:05 | 2017-05-31T16:14:05 | 92,986,770 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 646 |
java
|
public class Attribute {
public int attributePosition;
public String attributeName;
// Constructor to create a new Attribute
public Attribute(String name, int value){
attributeName = name; //Name of attribute
attributePosition = value; //Position in Array
}
//Setters and Getters
public int getattributePosition() {
return attributePosition;
}
public String getAttributeName() {
return attributeName; //get entire record array. Does not include target label
}
public String toString() {
return "Attribute (Name =" + attributeName
+ ", position =" + attributePosition + ")";
}
}
|
[
"[email protected]"
] | |
a4c65c43235d0e19d75d051be626851c560e2ef3
|
987b4a0e2124d2c308e886115ff7bda347e820f7
|
/后端/backstage/java/javas1/demo1/java_IDE/day5/src/day11/Demo02BufferedOutputStream.java
|
c449e19a161157374f45724766373a03ac490925
|
[
"MIT"
] |
permissive
|
togethter/learnDic
|
48606e0afbb08b77c49c135cdd4238f0011fcfc9
|
f1d0623ff96e24d67aa150ea45862d1cf52b75f3
|
refs/heads/master
| 2021-06-13T06:08:08.235217 | 2021-03-14T15:45:09 | 2021-03-14T15:45:09 | 163,981,843 | 0 | 0 |
MIT
| 2019-06-21T14:37:03 | 2019-01-03T14:15:27 | null |
UTF-8
|
Java
| false | false | 2,555 |
java
|
package day11;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
/*
java.io.bufferedOutputStream extends OutputStream
BufferedOutputStream
继承自父类共性成员方法:
void write(int c) 写入单个字符
void write(char[] cbuf) 写入字符数组
abstract void write(char[] cbuf,int off,int len) 写入字符数组的某一部分 off数组的开始索引,len写的字符的个数
void write(String str)写入字符串
void write(String str,int off,int len)写入字符串的某一部分,off字符串的开始索引,len写的字符个数
void flush()刷新该流的缓冲
void close()关闭此流,但要先刷新他
构造方法 BufferedOutputStream(OutputStream out) 创建一个新的缓冲输出流,以将数据写入底层的输出流
BufferedOutputStream(OutputStream out,int size) 创建一个新的缓冲输出流,以将具有指定缓冲区大小的数据写入底层的输出流
参数 OutputStream: 字节输出流
我们可以传递FileOutstream,缓冲流会给FileOutstream增加一个缓冲区,提高FileOutstream的写入效率
int size:指定缓冲流内部缓冲区的大小,不指定默认
使用步骤(重点)
1、创建FileOutputStream对象,构造方法中绑定要输出的目的地
2、创建BufferedOutputStream对象,构造方法创建FileOutstream对象,提高FileOutstream对象的效率
3、使用BufferedOutputStream对象的方法write,把数据写入到内部缓冲区中
4、使用BufferedOutputStream对象的方法flush,内部缓冲区的数据,刷新到文件中
5、释放资源(先调用flush刷新数据,第四部可以省略)
*/
public class Demo02BufferedOutputStream {
public static void main(String[] args) throws IOException {
// 1、创建FileOutputStream对象,构造方法中绑定要输出的目的地
FileOutputStream fos = new FileOutputStream("6.txt");
// 2、创建BufferedOutputStream对象,构造方法创建FileOutstream对象,提高FileOutstream对象的效率
BufferedOutputStream bos = new BufferedOutputStream(fos);
// 3、使用BufferedOutputStream对象的方法write,把数据写入到内部缓冲区中
bos.write("我把数据写入到内部缓冲区中".getBytes());
// 4、使用BufferedOutputStream对象的方法flush,内部缓冲区的数据,刷新到文件中
bos.flush();
// 5、释放资源(先调用flush刷新数据,第四部可以省略)
bos.close();
}
}
|
[
"[email protected]"
] | |
23c54fe5917cbb3f9eecc4a976bbc1a141b351ea
|
f7cc8938ccf25a514c6a6ccdfb4dcc49f80b5c12
|
/microvibe-booster/booster-core/src/main/java/io/microvibe/booster/commons/utils/property/ListBuilder.java
|
5a12f7ab16f69f6419570791bb45ecdeea2e1c9c
|
[
"Apache-2.0"
] |
permissive
|
microsignal/vibe
|
6f8b8d91aa6fa0dfc7020ca023ea8c3cb0d82e37
|
4b3e2d5b5a6f3b3e021276b7e496d6eaa1b7b665
|
refs/heads/master
| 2021-09-25T13:07:16.911688 | 2018-10-22T05:14:14 | 2018-10-22T05:14:14 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,707 |
java
|
package io.microvibe.booster.commons.utils.property;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
final class ListBuilder extends AbstractBuilder<List<Object>> implements PropertyBuilder<List<Object>> {
private List<Object> list;
private Class<?> clazz;
public ListBuilder(List<Object> list, Class<?> clazz) {
init(list, clazz);
}
public ListBuilder(List<Object> list, Class<?> clazz, int size) {
init(list, clazz, size);
}
public void init(List<Object> list, Class<?> clazz) {
init(list, clazz, -1);
}
public void init(List<Object> list, Class<?> clazz, int size) {
if (list == null) {
this.list = new ArrayList<Object>();
} else {
this.list = list;
}
if (clazz == null) {
this.clazz = LinkedHashMap.class;
} else {
this.clazz = clazz;
}
for (int i = this.list.size(); i < size; i++) {
this.list.add(newOne());
}
}
private Object newOne() {
try {
return clazz.newInstance();
} catch (Exception e) {
throw new IllegalArgumentException(e);
}
}
private Object getIndexObj(int i) {
Object one;
if (list.size() <= i) {
one = newOne();
list.add(one);
} else {
one = list.get(i);
}
return one;
}
@SuppressWarnings({"rawtypes"})
@Override
public void exec(Seriation seriation) {
Object orig = seriation.orig;
if (orig != null) {
if (orig instanceof Collection) {
int i = 0;
for (Object o : (Collection) orig) {
Object val = PropertyUtil.getPathProperty(o, seriation.origProperty);
if (val != null || !seriation.ignoredNull) {
Object one = getIndexObj(i);
PropertyUtil.setPathProperty(one, seriation.destProperty, val);
}
i++;
}
} else if (orig.getClass().isArray()) {
int len = Array.getLength(orig);
for (int i = 0; i < len; i++) {
Object o = Array.get(orig, i);
Object val = PropertyUtil.getPathProperty(o, seriation.origProperty);
if (val != null || !seriation.ignoredNull) {
Object one = getIndexObj(i);
PropertyUtil.setPathProperty(one, seriation.destProperty, val);
}
}
} else {
for (Object one : list) {
Object val = PropertyUtil.getPathProperty(orig, seriation.origProperty);
if (val != null || !seriation.ignoredNull) {
PropertyUtil.setPathProperty(one, seriation.destProperty, val);
}
}
}
} else {
for (Object one : list) {
if (seriation.propertyValue != null || !seriation.ignoredNull) {
PropertyUtil.setPathProperty(one, seriation.destProperty, seriation.propertyValue);
}
}
}
}
@Override
public List<Object> done() {
exec();
return list;
}
}
|
[
"[email protected]"
] | |
133c7bb42a4494a3bb5dcc2bff16a08623780e43
|
2cd600a9acdc42ad6e90e370d46212e3d5c77339
|
/sp_11_webapp/src/main/java/kr/goott/app/DBCP.java
|
80ca3f57b973c15fb639e925fa2a8e513264b391
|
[] |
no_license
|
hwikang/WebSpring
|
c266e47f03c3c5f3e339e925178735503b002d0d
|
0a552f84e64a77ee5e13264e76d8be8fb51e2208
|
refs/heads/master
| 2020-04-30T20:28:41.985796 | 2019-05-08T04:36:25 | 2019-05-08T04:36:25 | 177,067,678 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 915 |
java
|
package kr.goott.app;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
public class DBCP {
protected Connection conn;
protected PreparedStatement pstmt;
protected ResultSet rs;
public DBCP() {
}
public void getConn() {
try {
Context initCtx = new InitialContext();
Context ctx = (Context)initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)ctx.lookup("jdbc/myoracle");
conn = ds.getConnection();
} catch (Exception e) {
System.out.println("db connection error");
e.printStackTrace();
}
}
public void getClose() {
try {
if(rs!=null)rs.close();
if(pstmt!=null)pstmt.close();
if(conn!=null)conn.close();
} catch (Exception e) {
System.out.println("db close error");
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
728efa38694294740c28b1c6ca49bedc0ccb9d61
|
ab0f2c6a8759d2faad9de5b5cd01a81fffb8442b
|
/newsee-dev-platform/newsee-dev-platform-pojo/src/main/java/com/newsee/devplatform/entity/JeCoreResourcecolumn.java
|
71796a9fa51bac168eb9c7209734b9130a5db386
|
[] |
no_license
|
un-knower/ns
|
2e96eaed33a8cde70dbf5914764a2c61841858c9
|
a4b05880b4de1587f62d7af05d1d46e9e0cd27e7
|
refs/heads/master
| 2020-04-11T11:30:31.954717 | 2018-08-10T09:01:32 | 2018-08-10T09:01:32 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 27,208 |
java
|
/*
* Copyright(c) 2017 杭州新视窗信息技术有限公司 All rights reserved.
* 【收费宝】项目代码
*/
package com.newsee.devplatform.entity;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
/**
* 功能的列表资源
* @version 1.0
* @author
*/
public class JeCoreResourcecolumn implements Serializable {
private static final long serialVersionUID = 1L;
/** 列ID */
@ApiModelProperty(value = "列ID")
private String jeCoreResourcecolumnId;
/** 功能ID */
@ApiModelProperty(value = "功能ID")
private String resourcecolumnFuncinfoId;
/** 列居中 */
@ApiModelProperty(value = "列居中")
private String resourcecolumnAlign;
/** 是否为空 */
@ApiModelProperty(value = "是否为空")
private String resourcecolumnAllowblank;
/** 是否编辑 */
@ApiModelProperty(value = "是否编辑")
private String resourcecolumnAllowedit;
/** 选中样式 */
@ApiModelProperty(value = "选中样式")
private String resourcecolumnCheckedcls;
/** 编码 */
@ApiModelProperty(value = "编码")
private String resourcecolumnCode;
/** 高亮策略中的color */
@ApiModelProperty(value = "高亮策略中的color")
private String resourcecolumnColor1;
/** 字典策略中的color */
@ApiModelProperty(value = "字典策略中的color")
private String resourcecolumnColor2;
/** 列查询类型 */
@ApiModelProperty(value = "列查询类型")
private String resourcecolumnColumnquerytype;
/** 列提示 */
@ApiModelProperty(value = "列提示")
private String resourcecolumnColumntip;
/** 配置信息 */
@ApiModelProperty(value = "配置信息")
private String resourcecolumnConfiginfo;
/** 是否拥转换器conversion */
@ApiModelProperty(value = "是否拥转换器conversion")
private String resourcecolumnConversion;
/** 时间格式 */
@ApiModelProperty(value = "时间格式")
private String resourcecolumnDateformat;
/** 字典编码 */
@ApiModelProperty(value = "字典编码")
private String resourcecolumnDdcode;
/** 描述 */
@ApiModelProperty(value = "描述")
private String resourcecolumnDescription;
/** 启用图标 */
@ApiModelProperty(value = "启用图标")
private String resourcecolumnEnableicon;
/** 启用批量更新 */
@ApiModelProperty(value = "启用批量更新")
private String resourcecolumnEnableupdate;
/** 列表排序字段 */
@ApiModelProperty(value = "列表排序字段")
private java.math.BigDecimal resourcecolumnFieldorderindex;
/** 编码 */
@ApiModelProperty(value = "编码")
private String resourcecolumnFkcode;
/** 比例 */
@ApiModelProperty(value = "比例")
private String resourcecolumnFlex;
/** 字典策略中的color */
@ApiModelProperty(value = "字典策略中的color")
private String resourcecolumnFontcolor;
/** 分组 */
@ApiModelProperty(value = "分组")
private String resourcecolumnGroup;
/** 是否隐藏 */
@ApiModelProperty(value = "是否隐藏")
private String resourcecolumnHidden;
/** 隐藏编辑提示 */
@ApiModelProperty(value = "隐藏编辑提示")
private String resourcecolumnHidetitlecls;
/** 是否拥转换器highlighting */
@ApiModelProperty(value = "是否拥转换器highlighting")
private String resourcecolumnHighlighting;
/** 是否超链接 */
@ApiModelProperty(value = "是否超链接")
private String resourcecolumnHyperlink;
/** 是否导入 */
@ApiModelProperty(value = "是否导入")
private String resourcecolumnIfimpl;
/** 是否索引 */
@ApiModelProperty(value = "是否索引")
private String resourcecolumnIndex;
/** 是否在字典中取 */
@ApiModelProperty(value = "是否在字典中取")
private String resourcecolumnIsdd;
/** 是否主键 */
@ApiModelProperty(value = "是否主键")
private String resourcecolumnIspk;
/** 监听事件 */
@ApiModelProperty(value = "监听事件")
private String resourcecolumnJslistener;
/** 关键字查询组建名称 */
@ApiModelProperty(value = "关键字查询组建名称")
private String resourcecolumnKeyword;
/** 分步加载 */
@ApiModelProperty(value = "分步加载")
private String resourcecolumnLazyload;
/** 链接方法 */
@ApiModelProperty(value = "链接方法")
private String resourcecolumnLinkmethod;
/** 锁定列 */
@ApiModelProperty(value = "锁定列")
private String resourcecolumnLocked;
/** 最大值 */
@ApiModelProperty(value = "最大值")
private Integer resourcecolumnMaxvalue;
/** 合并单元格 */
@ApiModelProperty(value = "合并单元格")
private String resourcecolumnMerge;
/** 最小值 */
@ApiModelProperty(value = "最小值")
private Integer resourcecolumnMinvalue;
/** 多表头 */
@ApiModelProperty(value = "多表头")
private String resourcecolumnMorecolumn;
/** 多表头名称 */
@ApiModelProperty(value = "多表头名称")
private String resourcecolumnMorecolumnname;
/** 多行显示 */
@ApiModelProperty(value = "多行显示")
private String resourcecolumnMultirows;
/** 名称 */
@ApiModelProperty(value = "名称")
private String resourcecolumnName;
/** 英文名 */
@ApiModelProperty(value = "英文名")
private String resourcecolumnNameEn;
/** 产品扩展功能ID */
@ApiModelProperty(value = "产品扩展功能ID")
private String resourcecolumnNewfuncid;
/** 是否排序 */
@ApiModelProperty(value = "是否排序")
private String resourcecolumnOrder;
/** 查询排序 */
@ApiModelProperty(value = "查询排序")
private Integer resourcecolumnQueryindex;
/** 查询信息 */
@ApiModelProperty(value = "查询信息")
private String resourcecolumnQueryinfo;
/** 查询类型 */
@ApiModelProperty(value = "查询类型")
private String resourcecolumnQuerytype;
/** 是否快速查询 */
@ApiModelProperty(value = "是否快速查询")
private String resourcecolumnQuickquery;
/** 快速查询时查询类型 */
@ApiModelProperty(value = "快速查询时查询类型")
private String resourcecolumnQuickquerytype;
/** 右边框色 */
@ApiModelProperty(value = "右边框色")
private String resourcecolumnRbordercolor;
/** 编辑时全选 */
@ApiModelProperty(value = "编辑时全选")
private String resourcecolumnSelectonfocus;
/** 总统计描述 */
@ApiModelProperty(value = "总统计描述")
private String resourcecolumnStatistallmsg;
/** 统计描述 */
@ApiModelProperty(value = "统计描述")
private String resourcecolumnStatisticsmsg;
/** 统计类型 */
@ApiModelProperty(value = "统计类型")
private String resourcecolumnStatisticstype;
/** 步长 */
@ApiModelProperty(value = "步长")
private Integer resourcecolumnStep;
/** 统计数字格式 */
@ApiModelProperty(value = "统计数字格式")
private String resourcecolumnSummaryformat;
/** 系统模式 */
@ApiModelProperty(value = "系统模式")
private String resourcecolumnSysmode;
/** 策略 */
@ApiModelProperty(value = "策略")
private String resourcecolumnTactics;
/** 颜色 */
@ApiModelProperty(value = "颜色")
private String resourcecolumnTitlecolor;
/** 补选中样式 */
@ApiModelProperty(value = "补选中样式")
private String resourcecolumnUncheckedcls;
/** 默认值 */
@ApiModelProperty(value = "默认值")
private String resourcecolumnValue;
/** 校验信息 */
@ApiModelProperty(value = "校验信息")
private String resourcecolumnVtype;
/** 宽度 */
@ApiModelProperty(value = "宽度")
private String resourcecolumnWidth;
/** 英文宽度 */
@ApiModelProperty(value = "英文宽度")
private String resourcecolumnWidthEn;
/** 类型 */
@ApiModelProperty(value = "类型")
private String resourcecolumnXtype;
/** 审核标记 */
@ApiModelProperty(value = "审核标记")
private String syAudflag;
/** 登记者所在部门编码 */
@ApiModelProperty(value = "登记者所在部门编码")
private String syCreateorg;
/** 登记者所在部门 */
@ApiModelProperty(value = "登记者所在部门")
private String syCreateorgname;
/** 登记时间 */
@ApiModelProperty(value = "登记时间")
private String syCreatetime;
/** 登记人编码 */
@ApiModelProperty(value = "登记人编码")
private String syCreateuser;
/** 登记人 */
@ApiModelProperty(value = "登记人")
private String syCreateusername;
/** 是否启用本条数据 */
@ApiModelProperty(value = "是否启用本条数据")
private String syFlag;
/** 表单上传虚字段 */
@ApiModelProperty(value = "表单上传虚字段")
private String syFormuploadfiles;
/** 修改人部门编码 */
@ApiModelProperty(value = "修改人部门编码")
private String syModifyorg;
/** 修改人部门 */
@ApiModelProperty(value = "修改人部门")
private String syModifyorgname;
/** 修改时间 */
@ApiModelProperty(value = "修改时间")
private String syModifytime;
/** 修改人编码 */
@ApiModelProperty(value = "修改人编码")
private String syModifyuser;
/** 修改人 */
@ApiModelProperty(value = "修改人")
private String syModifyusername;
/** 排序字段 */
@ApiModelProperty(value = "排序字段")
private Integer syOrderindex;
/** 流程定义ID */
@ApiModelProperty(value = "流程定义ID")
private String syPdid;
/** 流程实例ID */
@ApiModelProperty(value = "流程实例ID")
private String syPiid;
/** 拼音简写 */
@ApiModelProperty(value = "拼音简写")
private String syPyjz;
/** 拼音全称 */
@ApiModelProperty(value = "拼音全称")
private String syPyqc;
/** 数据状态 */
@ApiModelProperty(value = "数据状态")
private String syStatus;
public void setJeCoreResourcecolumnId(String jeCoreResourcecolumnId) {
this.jeCoreResourcecolumnId = jeCoreResourcecolumnId;
}
public String getJeCoreResourcecolumnId() {
return jeCoreResourcecolumnId;
}
public void setResourcecolumnFuncinfoId(String resourcecolumnFuncinfoId) {
this.resourcecolumnFuncinfoId = resourcecolumnFuncinfoId;
}
public String getResourcecolumnFuncinfoId() {
return resourcecolumnFuncinfoId;
}
public void setResourcecolumnAlign(String resourcecolumnAlign) {
this.resourcecolumnAlign = resourcecolumnAlign;
}
public String getResourcecolumnAlign() {
return resourcecolumnAlign;
}
public void setResourcecolumnAllowblank(String resourcecolumnAllowblank) {
this.resourcecolumnAllowblank = resourcecolumnAllowblank;
}
public String getResourcecolumnAllowblank() {
return resourcecolumnAllowblank;
}
public void setResourcecolumnAllowedit(String resourcecolumnAllowedit) {
this.resourcecolumnAllowedit = resourcecolumnAllowedit;
}
public String getResourcecolumnAllowedit() {
return resourcecolumnAllowedit;
}
public void setResourcecolumnCheckedcls(String resourcecolumnCheckedcls) {
this.resourcecolumnCheckedcls = resourcecolumnCheckedcls;
}
public String getResourcecolumnCheckedcls() {
return resourcecolumnCheckedcls;
}
public void setResourcecolumnCode(String resourcecolumnCode) {
this.resourcecolumnCode = resourcecolumnCode;
}
public String getResourcecolumnCode() {
return resourcecolumnCode;
}
public void setResourcecolumnColor1(String resourcecolumnColor1) {
this.resourcecolumnColor1 = resourcecolumnColor1;
}
public String getResourcecolumnColor1() {
return resourcecolumnColor1;
}
public void setResourcecolumnColor2(String resourcecolumnColor2) {
this.resourcecolumnColor2 = resourcecolumnColor2;
}
public String getResourcecolumnColor2() {
return resourcecolumnColor2;
}
public void setResourcecolumnColumnquerytype(String resourcecolumnColumnquerytype) {
this.resourcecolumnColumnquerytype = resourcecolumnColumnquerytype;
}
public String getResourcecolumnColumnquerytype() {
return resourcecolumnColumnquerytype;
}
public void setResourcecolumnColumntip(String resourcecolumnColumntip) {
this.resourcecolumnColumntip = resourcecolumnColumntip;
}
public String getResourcecolumnColumntip() {
return resourcecolumnColumntip;
}
public void setResourcecolumnConfiginfo(String resourcecolumnConfiginfo) {
this.resourcecolumnConfiginfo = resourcecolumnConfiginfo;
}
public String getResourcecolumnConfiginfo() {
return resourcecolumnConfiginfo;
}
public void setResourcecolumnConversion(String resourcecolumnConversion) {
this.resourcecolumnConversion = resourcecolumnConversion;
}
public String getResourcecolumnConversion() {
return resourcecolumnConversion;
}
public void setResourcecolumnDateformat(String resourcecolumnDateformat) {
this.resourcecolumnDateformat = resourcecolumnDateformat;
}
public String getResourcecolumnDateformat() {
return resourcecolumnDateformat;
}
public void setResourcecolumnDdcode(String resourcecolumnDdcode) {
this.resourcecolumnDdcode = resourcecolumnDdcode;
}
public String getResourcecolumnDdcode() {
return resourcecolumnDdcode;
}
public void setResourcecolumnDescription(String resourcecolumnDescription) {
this.resourcecolumnDescription = resourcecolumnDescription;
}
public String getResourcecolumnDescription() {
return resourcecolumnDescription;
}
public void setResourcecolumnEnableicon(String resourcecolumnEnableicon) {
this.resourcecolumnEnableicon = resourcecolumnEnableicon;
}
public String getResourcecolumnEnableicon() {
return resourcecolumnEnableicon;
}
public void setResourcecolumnEnableupdate(String resourcecolumnEnableupdate) {
this.resourcecolumnEnableupdate = resourcecolumnEnableupdate;
}
public String getResourcecolumnEnableupdate() {
return resourcecolumnEnableupdate;
}
public void setResourcecolumnFieldorderindex(java.math.BigDecimal resourcecolumnFieldorderindex) {
this.resourcecolumnFieldorderindex = resourcecolumnFieldorderindex;
}
public java.math.BigDecimal getResourcecolumnFieldorderindex() {
return resourcecolumnFieldorderindex;
}
public void setResourcecolumnFkcode(String resourcecolumnFkcode) {
this.resourcecolumnFkcode = resourcecolumnFkcode;
}
public String getResourcecolumnFkcode() {
return resourcecolumnFkcode;
}
public void setResourcecolumnFlex(String resourcecolumnFlex) {
this.resourcecolumnFlex = resourcecolumnFlex;
}
public String getResourcecolumnFlex() {
return resourcecolumnFlex;
}
public void setResourcecolumnFontcolor(String resourcecolumnFontcolor) {
this.resourcecolumnFontcolor = resourcecolumnFontcolor;
}
public String getResourcecolumnFontcolor() {
return resourcecolumnFontcolor;
}
public void setResourcecolumnGroup(String resourcecolumnGroup) {
this.resourcecolumnGroup = resourcecolumnGroup;
}
public String getResourcecolumnGroup() {
return resourcecolumnGroup;
}
public void setResourcecolumnHidden(String resourcecolumnHidden) {
this.resourcecolumnHidden = resourcecolumnHidden;
}
public String getResourcecolumnHidden() {
return resourcecolumnHidden;
}
public void setResourcecolumnHidetitlecls(String resourcecolumnHidetitlecls) {
this.resourcecolumnHidetitlecls = resourcecolumnHidetitlecls;
}
public String getResourcecolumnHidetitlecls() {
return resourcecolumnHidetitlecls;
}
public void setResourcecolumnHighlighting(String resourcecolumnHighlighting) {
this.resourcecolumnHighlighting = resourcecolumnHighlighting;
}
public String getResourcecolumnHighlighting() {
return resourcecolumnHighlighting;
}
public void setResourcecolumnHyperlink(String resourcecolumnHyperlink) {
this.resourcecolumnHyperlink = resourcecolumnHyperlink;
}
public String getResourcecolumnHyperlink() {
return resourcecolumnHyperlink;
}
public void setResourcecolumnIfimpl(String resourcecolumnIfimpl) {
this.resourcecolumnIfimpl = resourcecolumnIfimpl;
}
public String getResourcecolumnIfimpl() {
return resourcecolumnIfimpl;
}
public void setResourcecolumnIndex(String resourcecolumnIndex) {
this.resourcecolumnIndex = resourcecolumnIndex;
}
public String getResourcecolumnIndex() {
return resourcecolumnIndex;
}
public void setResourcecolumnIsdd(String resourcecolumnIsdd) {
this.resourcecolumnIsdd = resourcecolumnIsdd;
}
public String getResourcecolumnIsdd() {
return resourcecolumnIsdd;
}
public void setResourcecolumnIspk(String resourcecolumnIspk) {
this.resourcecolumnIspk = resourcecolumnIspk;
}
public String getResourcecolumnIspk() {
return resourcecolumnIspk;
}
public void setResourcecolumnJslistener(String resourcecolumnJslistener) {
this.resourcecolumnJslistener = resourcecolumnJslistener;
}
public String getResourcecolumnJslistener() {
return resourcecolumnJslistener;
}
public void setResourcecolumnKeyword(String resourcecolumnKeyword) {
this.resourcecolumnKeyword = resourcecolumnKeyword;
}
public String getResourcecolumnKeyword() {
return resourcecolumnKeyword;
}
public void setResourcecolumnLazyload(String resourcecolumnLazyload) {
this.resourcecolumnLazyload = resourcecolumnLazyload;
}
public String getResourcecolumnLazyload() {
return resourcecolumnLazyload;
}
public void setResourcecolumnLinkmethod(String resourcecolumnLinkmethod) {
this.resourcecolumnLinkmethod = resourcecolumnLinkmethod;
}
public String getResourcecolumnLinkmethod() {
return resourcecolumnLinkmethod;
}
public void setResourcecolumnLocked(String resourcecolumnLocked) {
this.resourcecolumnLocked = resourcecolumnLocked;
}
public String getResourcecolumnLocked() {
return resourcecolumnLocked;
}
public void setResourcecolumnMaxvalue(Integer resourcecolumnMaxvalue) {
this.resourcecolumnMaxvalue = resourcecolumnMaxvalue;
}
public Integer getResourcecolumnMaxvalue() {
return resourcecolumnMaxvalue;
}
public void setResourcecolumnMerge(String resourcecolumnMerge) {
this.resourcecolumnMerge = resourcecolumnMerge;
}
public String getResourcecolumnMerge() {
return resourcecolumnMerge;
}
public void setResourcecolumnMinvalue(Integer resourcecolumnMinvalue) {
this.resourcecolumnMinvalue = resourcecolumnMinvalue;
}
public Integer getResourcecolumnMinvalue() {
return resourcecolumnMinvalue;
}
public void setResourcecolumnMorecolumn(String resourcecolumnMorecolumn) {
this.resourcecolumnMorecolumn = resourcecolumnMorecolumn;
}
public String getResourcecolumnMorecolumn() {
return resourcecolumnMorecolumn;
}
public void setResourcecolumnMorecolumnname(String resourcecolumnMorecolumnname) {
this.resourcecolumnMorecolumnname = resourcecolumnMorecolumnname;
}
public String getResourcecolumnMorecolumnname() {
return resourcecolumnMorecolumnname;
}
public void setResourcecolumnMultirows(String resourcecolumnMultirows) {
this.resourcecolumnMultirows = resourcecolumnMultirows;
}
public String getResourcecolumnMultirows() {
return resourcecolumnMultirows;
}
public void setResourcecolumnName(String resourcecolumnName) {
this.resourcecolumnName = resourcecolumnName;
}
public String getResourcecolumnName() {
return resourcecolumnName;
}
public void setResourcecolumnNameEn(String resourcecolumnNameEn) {
this.resourcecolumnNameEn = resourcecolumnNameEn;
}
public String getResourcecolumnNameEn() {
return resourcecolumnNameEn;
}
public void setResourcecolumnNewfuncid(String resourcecolumnNewfuncid) {
this.resourcecolumnNewfuncid = resourcecolumnNewfuncid;
}
public String getResourcecolumnNewfuncid() {
return resourcecolumnNewfuncid;
}
public void setResourcecolumnOrder(String resourcecolumnOrder) {
this.resourcecolumnOrder = resourcecolumnOrder;
}
public String getResourcecolumnOrder() {
return resourcecolumnOrder;
}
public void setResourcecolumnQueryindex(Integer resourcecolumnQueryindex) {
this.resourcecolumnQueryindex = resourcecolumnQueryindex;
}
public Integer getResourcecolumnQueryindex() {
return resourcecolumnQueryindex;
}
public void setResourcecolumnQueryinfo(String resourcecolumnQueryinfo) {
this.resourcecolumnQueryinfo = resourcecolumnQueryinfo;
}
public String getResourcecolumnQueryinfo() {
return resourcecolumnQueryinfo;
}
public void setResourcecolumnQuerytype(String resourcecolumnQuerytype) {
this.resourcecolumnQuerytype = resourcecolumnQuerytype;
}
public String getResourcecolumnQuerytype() {
return resourcecolumnQuerytype;
}
public void setResourcecolumnQuickquery(String resourcecolumnQuickquery) {
this.resourcecolumnQuickquery = resourcecolumnQuickquery;
}
public String getResourcecolumnQuickquery() {
return resourcecolumnQuickquery;
}
public void setResourcecolumnQuickquerytype(String resourcecolumnQuickquerytype) {
this.resourcecolumnQuickquerytype = resourcecolumnQuickquerytype;
}
public String getResourcecolumnQuickquerytype() {
return resourcecolumnQuickquerytype;
}
public void setResourcecolumnRbordercolor(String resourcecolumnRbordercolor) {
this.resourcecolumnRbordercolor = resourcecolumnRbordercolor;
}
public String getResourcecolumnRbordercolor() {
return resourcecolumnRbordercolor;
}
public void setResourcecolumnSelectonfocus(String resourcecolumnSelectonfocus) {
this.resourcecolumnSelectonfocus = resourcecolumnSelectonfocus;
}
public String getResourcecolumnSelectonfocus() {
return resourcecolumnSelectonfocus;
}
public void setResourcecolumnStatistallmsg(String resourcecolumnStatistallmsg) {
this.resourcecolumnStatistallmsg = resourcecolumnStatistallmsg;
}
public String getResourcecolumnStatistallmsg() {
return resourcecolumnStatistallmsg;
}
public void setResourcecolumnStatisticsmsg(String resourcecolumnStatisticsmsg) {
this.resourcecolumnStatisticsmsg = resourcecolumnStatisticsmsg;
}
public String getResourcecolumnStatisticsmsg() {
return resourcecolumnStatisticsmsg;
}
public void setResourcecolumnStatisticstype(String resourcecolumnStatisticstype) {
this.resourcecolumnStatisticstype = resourcecolumnStatisticstype;
}
public String getResourcecolumnStatisticstype() {
return resourcecolumnStatisticstype;
}
public void setResourcecolumnStep(Integer resourcecolumnStep) {
this.resourcecolumnStep = resourcecolumnStep;
}
public Integer getResourcecolumnStep() {
return resourcecolumnStep;
}
public void setResourcecolumnSummaryformat(String resourcecolumnSummaryformat) {
this.resourcecolumnSummaryformat = resourcecolumnSummaryformat;
}
public String getResourcecolumnSummaryformat() {
return resourcecolumnSummaryformat;
}
public void setResourcecolumnSysmode(String resourcecolumnSysmode) {
this.resourcecolumnSysmode = resourcecolumnSysmode;
}
public String getResourcecolumnSysmode() {
return resourcecolumnSysmode;
}
public void setResourcecolumnTactics(String resourcecolumnTactics) {
this.resourcecolumnTactics = resourcecolumnTactics;
}
public String getResourcecolumnTactics() {
return resourcecolumnTactics;
}
public void setResourcecolumnTitlecolor(String resourcecolumnTitlecolor) {
this.resourcecolumnTitlecolor = resourcecolumnTitlecolor;
}
public String getResourcecolumnTitlecolor() {
return resourcecolumnTitlecolor;
}
public void setResourcecolumnUncheckedcls(String resourcecolumnUncheckedcls) {
this.resourcecolumnUncheckedcls = resourcecolumnUncheckedcls;
}
public String getResourcecolumnUncheckedcls() {
return resourcecolumnUncheckedcls;
}
public void setResourcecolumnValue(String resourcecolumnValue) {
this.resourcecolumnValue = resourcecolumnValue;
}
public String getResourcecolumnValue() {
return resourcecolumnValue;
}
public void setResourcecolumnVtype(String resourcecolumnVtype) {
this.resourcecolumnVtype = resourcecolumnVtype;
}
public String getResourcecolumnVtype() {
return resourcecolumnVtype;
}
public void setResourcecolumnWidth(String resourcecolumnWidth) {
this.resourcecolumnWidth = resourcecolumnWidth;
}
public String getResourcecolumnWidth() {
return resourcecolumnWidth;
}
public void setResourcecolumnWidthEn(String resourcecolumnWidthEn) {
this.resourcecolumnWidthEn = resourcecolumnWidthEn;
}
public String getResourcecolumnWidthEn() {
return resourcecolumnWidthEn;
}
public void setResourcecolumnXtype(String resourcecolumnXtype) {
this.resourcecolumnXtype = resourcecolumnXtype;
}
public String getResourcecolumnXtype() {
return resourcecolumnXtype;
}
public void setSyAudflag(String syAudflag) {
this.syAudflag = syAudflag;
}
public String getSyAudflag() {
return syAudflag;
}
public void setSyCreateorg(String syCreateorg) {
this.syCreateorg = syCreateorg;
}
public String getSyCreateorg() {
return syCreateorg;
}
public void setSyCreateorgname(String syCreateorgname) {
this.syCreateorgname = syCreateorgname;
}
public String getSyCreateorgname() {
return syCreateorgname;
}
public void setSyCreatetime(String syCreatetime) {
this.syCreatetime = syCreatetime;
}
public String getSyCreatetime() {
return syCreatetime;
}
public void setSyCreateuser(String syCreateuser) {
this.syCreateuser = syCreateuser;
}
public String getSyCreateuser() {
return syCreateuser;
}
public void setSyCreateusername(String syCreateusername) {
this.syCreateusername = syCreateusername;
}
public String getSyCreateusername() {
return syCreateusername;
}
public void setSyFlag(String syFlag) {
this.syFlag = syFlag;
}
public String getSyFlag() {
return syFlag;
}
public void setSyFormuploadfiles(String syFormuploadfiles) {
this.syFormuploadfiles = syFormuploadfiles;
}
public String getSyFormuploadfiles() {
return syFormuploadfiles;
}
public void setSyModifyorg(String syModifyorg) {
this.syModifyorg = syModifyorg;
}
public String getSyModifyorg() {
return syModifyorg;
}
public void setSyModifyorgname(String syModifyorgname) {
this.syModifyorgname = syModifyorgname;
}
public String getSyModifyorgname() {
return syModifyorgname;
}
public void setSyModifytime(String syModifytime) {
this.syModifytime = syModifytime;
}
public String getSyModifytime() {
return syModifytime;
}
public void setSyModifyuser(String syModifyuser) {
this.syModifyuser = syModifyuser;
}
public String getSyModifyuser() {
return syModifyuser;
}
public void setSyModifyusername(String syModifyusername) {
this.syModifyusername = syModifyusername;
}
public String getSyModifyusername() {
return syModifyusername;
}
public void setSyOrderindex(Integer syOrderindex) {
this.syOrderindex = syOrderindex;
}
public Integer getSyOrderindex() {
return syOrderindex;
}
public void setSyPdid(String syPdid) {
this.syPdid = syPdid;
}
public String getSyPdid() {
return syPdid;
}
public void setSyPiid(String syPiid) {
this.syPiid = syPiid;
}
public String getSyPiid() {
return syPiid;
}
public void setSyPyjz(String syPyjz) {
this.syPyjz = syPyjz;
}
public String getSyPyjz() {
return syPyjz;
}
public void setSyPyqc(String syPyqc) {
this.syPyqc = syPyqc;
}
public String getSyPyqc() {
return syPyqc;
}
public void setSyStatus(String syStatus) {
this.syStatus = syStatus;
}
public String getSyStatus() {
return syStatus;
}
}
|
[
"[email protected]"
] | |
c2ee8d7ab0ff3e793e510d9307f6f84e78d5b014
|
c1d20e33891deb190d096f5a5ea0cf426b257069
|
/newserver1/newserver1/src/com/mayhem/rs2/content/shopping/impl/Hunterskillshop.java
|
eb99d2b103a35ef00cb2d0052e00bb8a291b9475
|
[] |
no_license
|
premierscape/NS1
|
72a5d3a3f2d5c09886b1b26f166a6c2b27ac695d
|
0fb88b155b2abbb98fe3d88bb287012bbcbb8bf9
|
refs/heads/master
| 2020-04-07T00:46:08.175508 | 2018-11-16T20:06:10 | 2018-11-16T20:06:10 | 157,917,810 | 0 | 0 | null | 2018-11-16T20:44:52 | 2018-11-16T20:25:56 |
Java
|
UTF-8
|
Java
| false | false | 3,368 |
java
|
package com.mayhem.rs2.content.shopping.impl;
import com.mayhem.rs2.content.interfaces.InterfaceHandler;
import com.mayhem.rs2.content.interfaces.impl.QuestTab;
import com.mayhem.rs2.content.shopping.Shop;
import com.mayhem.rs2.entity.item.Item;
import com.mayhem.rs2.entity.player.Player;
import com.mayhem.rs2.entity.player.net.out.impl.SendMessage;
/**
* Puro store
*
* @author Divine
*/
public class Hunterskillshop extends Shop {
/**
* Id of Puro shop
*/
public static final int SHOP_ID = 351;
/**
* Price of items in Puro point store
*
* @param id
* @return
*/
public static final int getPrice(int id) {
switch (id) {
case 10045:
return 80;
case 10043:
return 80;
case 10041:
return 80;
case 10039:
return 100;
case 10037:
return 100;
case 10035:
return 100;
case 10075:
return 100;
case 10069:
return 200;
case 10071:
return 350;
case 11259:
return 250;
case 2528:
return 50;
case 2990:
return 75;
case 2991:
return 150;
case 2992:
return 150;
case 2993:
return 200;
case 2994:
return 250;
case 2995:
return 300;
case 10051:
return 75;
case 10049:
return 75;
case 10047:
return 75;
case 9957:
return 75;
case 10023:
return 250;
}
return 2147483647;
}
/**
* All items in puro shop
*/
public Hunterskillshop() {
super(SHOP_ID, new Item[] {
new Item(10045),
new Item(10043),
new Item(10041),
new Item(10051),
new Item(10049),
new Item(10047),
new Item(10039),
new Item(10037),
new Item(10035),
new Item(10075),
new Item(11259),
new Item(10069),
new Item(10071),
new Item(2990),
new Item(2991),
new Item(2992),
new Item(2993),
new Item(2994),
new Item(2995),
new Item(9957),
new Item(10023)
},
false, "Puro point Shop");
}
@Override
public void buy(Player player, int slot, int id, int amount) {
if (!hasItem(slot, id))
return;
if (get(slot).getAmount() == 0)
return;
if (amount > get(slot).getAmount()) {
amount = get(slot).getAmount();
}
Item buying = new Item(id, amount);
if (!player.getInventory().hasSpaceFor(buying)) {
if (!buying.getDefinition().isStackable()) {
int slots = player.getInventory().getFreeSlots();
if (slots > 0) {
buying.setAmount(slots);
amount = slots;
} else {
player.getClient().queueOutgoingPacket(new SendMessage("You do not have enough inventory space to buy this item."));
}
} else {
player.getClient().queueOutgoingPacket(new SendMessage("You do not have enough inventory space to buy this item."));
return;
}
}
if (player.getpuroPoints() < amount * getPrice(id)) {
player.getClient().queueOutgoingPacket(new SendMessage("You do not have enough Puro points to buy that."));
return;
}
player.setpuroPoints(player.getpuroPoints() - amount * getPrice(id));
//InterfaceHandler.writeText(new QuestTab(player));
player.getInventory().add(buying);
update();
}
@Override
public int getBuyPrice(int id) {
return 0;
}
@Override
public String getCurrencyName() {
return "Hunter Points";
}
@Override
public int getSellPrice(int id) {
return getPrice(id);
}
@Override
public boolean sell(Player player, int id, int amount) {
player.getClient().queueOutgoingPacket(new SendMessage("You cannot sell items to this shop."));
return false;
}
}
|
[
"[email protected]"
] | |
77d16113e71295c82407c9c0cb19bd1ee029f798
|
0464afc7fd9bbe6f4557681c57ad625a5b3d0bee
|
/src/model/commands/turtle_commands/ID.java
|
fcf8572e16d690310d0cf2ff9f045144b23fd1b5
|
[
"MIT"
] |
permissive
|
eddieyang97/Slogo
|
7c0a41aca73b80c7538e91c4ac68c9b682b23fd2
|
7d91b0ed9d893d98a41cfdf17312665669a4d7ce
|
refs/heads/master
| 2020-08-02T23:42:36.803055 | 2019-09-28T19:11:29 | 2019-09-28T19:11:29 | 211,547,222 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 335 |
java
|
package model.commands.turtle_commands;
import model.Turtle;
import model.TurtleTracker;
/**
*
* @author jeffreyli
* returns ID of current active turtle
*/
public class ID extends TurtleAction {
public ID(TurtleTracker t) {
super(t, 0);
}
@Override
public double actOn(Turtle t, int index) {
return t.getID();
}
}
|
[
"[email protected]"
] | |
2d48f2739d3b3a4996258295490d0ca5dbd3590d
|
6a28685fd4c5cab18f9245e93b59d96a527a0b5b
|
/src/main/java/org/wefine/spring/web/service/CalendarService.java
|
bec5af0591c9a64faf799c02696782f6cbbd13a7
|
[
"MIT"
] |
permissive
|
wefine/spring-security-calendar
|
a0c97f92246f8dde56ecda49156d2b67b739cd09
|
bb7ce3380996b1fb0fecd13debd7f64f64bcc830
|
refs/heads/master
| 2021-01-12T17:07:57.365450 | 2016-10-24T05:29:06 | 2016-10-24T05:29:06 | 71,515,184 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,264 |
java
|
package org.wefine.spring.web.service;
import org.wefine.spring.jooq.tables.pojos.Users;
import org.wefine.spring.jooq.tables.pojos.Events;
import org.springframework.dao.EmptyResultDataAccessException;
import java.util.List;
public interface CalendarService {
/**
* Gets a {@link Users} for a specific {@link Users#getId()}.
*
* @param id
* the {@link Users#getId()} of the {@link Users} to find.
* @return a {@link Users} for the given id. Cannot be null.
* @throws EmptyResultDataAccessException
* if the {@link Users} cannot be found
*/
Users getUser(Long id);
/**
* Finds a given {@link Users} by email address.
*
* @param email
* the email address to use to find a {@link Users}. Cannot be null.
* @return a {@link Users} for the given email or null if one could not be found.
* @throws IllegalArgumentException
* if email is null.
*/
Users findUserByEmail(String email);
/**
* Finds any {@link Users} that has an email that starts with {@code partialEmail}.
*
* @param partialEmail
* the email address to use to find {@link Users}s. Cannot be null or empty String.
* @return a List of {@link Users}s that have an email that starts with given partialEmail. The returned
* value will never be null. If no results are found an empty List will be returned.
* @throws IllegalArgumentException
* if email is null or empty String.
*/
List<Users> findUsersByEmail(String partialEmail);
/**
* Creates a new {@link Users}.
*
* @param user
* the new {@link Users} to create. The {@link Users#getId()} must be null.
* @return the new {@link Users#getId()}.
* @throws IllegalArgumentException
* if {@link Users#getId()} is non-null.
*/
Long createUser(Users user);
/**
* Given an id gets an {@link Events}.
*
* @param EventsId
* the {@link Events#getId()}
* @return the {@link Events}. Cannot be null.
* @throws RuntimeException
* if the {@link Events} cannot be found.
*/
Events getEvent(Long EventsId);
/**
* Creates a {@link Events} and returns the new id for that {@link Events}.
*
* @param Events
* the {@link Events} to create. Note that the {@link Events#getId()} should be null.
* @return the new id for the {@link Events}
* @throws RuntimeException
* if {@link Events#getId()} is non-null.
*/
Long createEvent(Events Events);
/**
* Finds the {@link Events}'s that are intended for the {@link Users}.
*
* @param userId
* the {@link Users#getId()} to obtain {@link Events}'s for.
* @return a non-null {@link List} of {@link Events}'s intended for the specified {@link Users}. If the
* {@link Users} does not exist an empty List will be returned.
*/
List<Events> findForUser(Long userId);
/**
* Gets all the available {@link Events}'s.
*
* @return a non-null {@link List} of {@link Events}'s
*/
List<Events> getEvents();
}
|
[
"[email protected]"
] | |
c6448334f3251dacb8204e2319dec9e4a416eece
|
1c88a96a435d27e15156bef6a9a2df3f28088f48
|
/AMapApiV2Demo/src/com/amapv2/cn/apis/route/RouteSearchAdapter.java
|
1d57acf93e9b61d38ec2fab6c92216ef7309f131
|
[] |
no_license
|
RayMonChina/water_xingcheng
|
f56aa7569e97f92dafb5da84b1653bf4ed3e2785
|
2176c38dcfa6f4954970727886b75641b13e4a72
|
refs/heads/master
| 2021-08-31T23:03:26.139602 | 2017-12-23T09:03:12 | 2017-12-23T09:03:12 | 109,460,142 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,563 |
java
|
package com.amapv2.cn.apis.route;
import java.util.List;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.amap.api.search.poisearch.PoiItem;
import com.amapv2.cn.apis.R;
public class RouteSearchAdapter extends BaseAdapter {
private Context context;
private List<PoiItem> poiItems = null;
private LayoutInflater mInflater;
public RouteSearchAdapter(Context context, List<PoiItem> poiItems) {
this.context = context;
this.poiItems = poiItems;
mInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return poiItems.size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = mInflater.inflate(R.layout.poi_result_list, null);
}
TextView PoiName = ((TextView) convertView.findViewById(R.id.poiName));
TextView poiAddress = (TextView) convertView
.findViewById(R.id.poiAddress);
PoiName.setText(poiItems.get(position).getTitle());
String address = null;
if (poiItems.get(position).getSnippet() != null) {
address = poiItems.get(position).getSnippet();
} else {
address = "中国";
}
poiAddress.setText("地址:" + address);
return convertView;
}
}
|
[
"[email protected]"
] | |
07a184578a94b890657f4bf4baf77ead93f8da17
|
4c3ebb90f71af6cbc37c1c300d2d788b70c30bad
|
/src/main/java/cn/hmxz/common/utils/MessageUtils.java
|
d55d5f32abd2e6e7b4b76ed40f692f9fe39eb2f1
|
[
"Apache-2.0"
] |
permissive
|
MrRabblt/wx-api
|
34bea147d75bb3617c2c0562fb4bac8cd19692ac
|
6baf86451fced59933f9b897025b8962858b6dec
|
refs/heads/master
| 2023-03-21T16:32:46.991464 | 2021-03-10T07:58:32 | 2021-03-10T07:58:32 | 346,550,751 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 710 |
java
|
package cn.hmxz.common.utils;
import cn.hmxz.common.utils.spring.SpringUtils;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
/**
* 获取i18n资源文件
*
* @author copote
*/
public class MessageUtils
{
/**
* 根据消息键和参数 获取消息 委托给spring messageSource
*
* @param code 消息键
* @param args 参数
* @return 获取国际化翻译值
*/
public static String message(String code, Object... args)
{
MessageSource messageSource = SpringUtils.getBean(MessageSource.class);
return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
}
}
|
[
"[email protected]"
] | |
a3c198b6e2f1eaa626e199f020218b7415f06154
|
d567a2898502420d917da8e935bca10735b4bb31
|
/src/Towers.java
|
c5787ae7eb50b46b752f588f33a72b151cdf1b8b
|
[] |
no_license
|
valeo88/cses-training
|
6c7fed5a12051b37a4c6a176405352d9ea4f24a5
|
decd31881b4b12403077068844c59e1e63bff005
|
refs/heads/master
| 2020-08-29T12:50:08.169240 | 2019-12-25T07:53:14 | 2019-12-25T07:53:14 | 218,036,632 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,219 |
java
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
/**
*
You are given n cubes in a certain order, and your task is to build towers using them.
Whenever two cubes are one on top of the other, the upper cube must be smaller than the lower cube.
You must process the cubes in the given order.
You can always either place the cube on top of an existing tower, or begin a new tower.
What is the minimum possible number of towers?
Input
The first input line contains an integer n: the number of cubes.
The next line contains n integers k1,k2,…,kn: the sizes of the cubes.
Output
Print one integer: the minimum number of towers.
* */
public class Towers {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
final int n = Integer.parseInt(st.nextToken());
List<Integer> ss = new ArrayList<>();
st = new StringTokenizer(br.readLine());
for (int i = 0; i < n; i++) {
int curr = Integer.parseInt(st.nextToken());
int ub = upperBound(ss, curr);
if (ub >= ss.size()) {
ss.add(curr);
} else {
ss.set(ub, curr);
//ss.sort(Integer::compareTo);
}
}
System.out.println(ss.size());
}
public static <T> int upperBound(List<? extends Comparable<? super T>> list, T value) {
final int size = list.size();
int start = 0;
int end = size-1;
if (end < 0) return 0;
int mid = (start + end) >>> 1;
while (true) {
int cmp = list.get(mid).compareTo(value);
if (cmp == 0 || cmp < 0) {
start = mid + 1;
if (end < start)
return mid < size - 1 ? mid + 1 : size;
} else {
end = mid - 1;
if (end < start)
return mid;
}
mid = (start + end) >>> 1;
}
}
}
|
[
"[email protected]"
] | |
5cff37367fe15aee7c0476a160ada8230cd7fd2c
|
b2c3d5220f78a770081288759d7e1a00a0519c6f
|
/task-processor/src/main/java/wsht/runtime/expressions/sbql/qres/result/IntegerResult.java
|
9817ab99b732d5cfd824f07b39f7e69bf1b726d3
|
[] |
no_license
|
konradrussa/ws-humantask
|
2733b3a9e7316a2effd0b5c5946806447a59c50c
|
7bec846945bc2fb75a6d725a607209735daa8bb5
|
refs/heads/master
| 2016-09-11T04:54:04.099998 | 2013-05-02T13:45:21 | 2013-05-02T13:45:21 | 37,924,697 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 424 |
java
|
package wsht.runtime.expressions.sbql.qres.result;
public class IntegerResult extends AbstractQueryResult {
private Integer value;
public IntegerResult(){}
public IntegerResult(Integer value) {
super();
this.value = value;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
@Override
public String toString() {
return ""+ value;
}
}
|
[
"[email protected]"
] | |
4b7d935faf0dc88959a7324a940bef4556981c59
|
4c703df6fdc0596b78b1e178a6245396152d1d35
|
/src/main/java/org/bdc/dcm/netty/coder/http/HttpDecoder.java
|
c0300e8fc585941d1c780e513138c23e60a7bf40
|
[] |
no_license
|
lightechnology/dcm
|
38dba899f583dae62de8b089e9ab89e92dfff8de
|
758e16055f4ab5257441b433b1e0baa67ff18206
|
refs/heads/master
| 2020-12-02T18:12:41.391243 | 2017-08-30T10:56:56 | 2017-08-30T10:56:56 | 96,495,486 | 1 | 1 | null | 2017-08-30T08:36:30 | 2017-07-07T03:28:02 |
Java
|
UTF-8
|
Java
| false | false | 757 |
java
|
package org.bdc.dcm.netty.coder.http;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.HttpContent;
import java.util.List;
import org.bdc.dcm.data.coder.intf.DataDecoder;
import org.bdc.dcm.data.log.HttpContent4Log;
import org.bdc.dcm.netty.NettyBoot;
import org.bdc.dcm.netty.coder.Decoder;
import org.slf4j.Logger;
public abstract class HttpDecoder extends Decoder<HttpContent> {
public HttpDecoder(Logger logger, NettyBoot nettyBoot, DataDecoder<HttpContent> decoder) {
super(new HttpContent4Log(TAG, logger), nettyBoot, decoder);
}
@Override
protected void decode(ChannelHandlerContext ctx, HttpContent msg,
List<Object> out) throws Exception {
doDecode(ctx, msg, out);
}
}
|
[
"[email protected]"
] | |
b9963f11e8d2c67bb6825dd97ac910806c13b71e
|
53eafd3a76435e50439958794a2263a4aadb7d18
|
/springSource/src/org/springframework/jndi/JndiLocatorSupport.java
|
9335a8cf7549e874f3f22da195013783d3a7f2c3
|
[] |
no_license
|
fqg05007/springCN
|
b8b39eabc1227efe4b03e2e2706872cdb748a2f5
|
45d8fce1c613764ee2d0d8fcfb49c566817b1e69
|
refs/heads/master
| 2020-06-12T23:24:22.438726 | 2016-12-03T15:45:45 | 2016-12-03T15:45:45 | 75,480,248 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,646 |
java
|
/*
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.jndi;
import javax.naming.NamingException;
import org.springframework.util.Assert;
/**
* Convenient superclass for classes that can locate any number of JNDI objects.
* Derives from JndiAccessor to inherit the "jndiTemplate" and "jndiEnvironment"
* bean properties.
*
* <p>JNDI names may or may not include the "java:comp/env/" prefix expected
* by J2EE applications when accessing a locally mapped (ENC - Environmental
* Naming Context) resource. If it doesn't, the "java:comp/env/" prefix will
* be prepended if the "resourceRef" property is true (the default is
* <strong>false</strong>) and no other scheme (e.g. "java:") is given.
*
* @author Juergen Hoeller
* @since 1.1
* @see #setJndiTemplate
* @see #setJndiEnvironment
* @see #setResourceRef
*/
public abstract class JndiLocatorSupport extends JndiAccessor {
/** JNDI prefix used in a J2EE container */
public static final String CONTAINER_PREFIX = "java:comp/env/";
private boolean resourceRef = false;
/**
* Set whether the lookup occurs in a J2EE container, i.e. if the prefix
* "java:comp/env/" needs to be added if the JNDI name doesn't already
* contain it. Default is "false".
* <p>Note: Will only get applied if no other scheme (e.g. "java:") is given.
*/
public void setResourceRef(boolean resourceRef) {
this.resourceRef = resourceRef;
}
/**
* Return whether the lookup occurs in a J2EE container.
*/
public boolean isResourceRef() {
return this.resourceRef;
}
/**
* Perform an actual JNDI lookup for the given name via the JndiTemplate.
* <p>If the name doesn't begin with "java:comp/env/", this prefix is added
* if "resourceRef" is set to "true".
* @param jndiName the JNDI name to look up
* @return the obtained object
* @throws NamingException if the JNDI lookup failed
* @see #setResourceRef
*/
protected Object lookup(String jndiName) throws NamingException {
return lookup(jndiName, null);
}
/**
* Perform an actual JNDI lookup for the given name via the JndiTemplate.
* <p>If the name doesn't begin with "java:comp/env/", this prefix is added
* if "resourceRef" is set to "true".
* @param jndiName the JNDI name to look up
* @param requiredType the required type of the object
* @return the obtained object
* @throws NamingException if the JNDI lookup failed
* @see #setResourceRef
*/
protected Object lookup(String jndiName, Class requiredType) throws NamingException {
Assert.notNull(jndiName, "'jndiName' must not be null");
String convertedName = convertJndiName(jndiName);
Object jndiObject = null;
try {
jndiObject = getJndiTemplate().lookup(convertedName, requiredType);
}
catch (NamingException ex) {
if (!convertedName.equals(jndiName)) {
// Try fallback to originally specified name...
if (logger.isDebugEnabled()) {
logger.debug("Converted JNDI name [" + convertedName +
"] not found - trying original name [" + jndiName + "]. " + ex);
}
jndiObject = getJndiTemplate().lookup(jndiName, requiredType);
}
else {
throw ex;
}
}
if (logger.isDebugEnabled()) {
logger.debug("Located object with JNDI name [" + convertedName + "]");
}
return jndiObject;
}
/**
* Convert the given JNDI name into the actual JNDI name to use.
* <p>The default implementation applies the "java:comp/env/" prefix if
* "resourceRef" is "true" and no other scheme (e.g. "java:") is given.
* @param jndiName the original JNDI name
* @return the JNDI name to use
* @see #CONTAINER_PREFIX
* @see #setResourceRef
*/
protected String convertJndiName(String jndiName) {
// Prepend container prefix if not already specified and no other scheme given.
if (isResourceRef() && !jndiName.startsWith(CONTAINER_PREFIX) && jndiName.indexOf(':') == -1) {
jndiName = CONTAINER_PREFIX + jndiName;
}
return jndiName;
}
}
|
[
"[email protected]"
] | |
a5b9e1e060cf170f518343d629f35ef83948d5fc
|
76abd91970bb5dd7583d935cebd69e2c7c6ff63b
|
/src/main/java/com/gcexe/qqdata/persistence/dao/MobileVirustypeProvinceStatHistoryMapper.java
|
0051f6f89a9a9ce706c5172398d2b4cf70f4758f
|
[] |
no_license
|
00110000-one/tendata
|
41979a20ebc3ed56ebb12e3fdd0ff9d3c1699423
|
0d67d11f2710735d7e7ef2a0f107cdc9d09b5120
|
refs/heads/master
| 2022-03-30T08:38:58.757548 | 2018-04-23T06:12:44 | 2018-04-23T06:12:44 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 740 |
java
|
package com.gcexe.qqdata.persistence.dao;
import java.util.List;
import com.gcexe.qqdata.persistence.entity.MobileVirustypeProvinceStatHistoryKey;
import com.gcexe.qqdata.persistence.statistics.VirusTypeStatistics;
public interface MobileVirustypeProvinceStatHistoryMapper {
int deleteByPrimaryKey(MobileVirustypeProvinceStatHistoryKey key);
int insert(MobileVirustypeProvinceStatHistoryKey record);
int insertSelective(MobileVirustypeProvinceStatHistoryKey record);
List<VirusTypeStatistics> getMobileVirusTypeStatistics();
int getDayNum();
int getDayMobileVirusStatistics();
int getYestodayMobileVirusStatistics();
int getWeekMobileVirusStatistics();
int getUpWeekMobileVirusStatistics();
}
|
[
"[email protected]"
] | |
e4fe18236a7a702f856fb4fa1d8a0549adeb11e5
|
17e8438486cb3e3073966ca2c14956d3ba9209ea
|
/dso/tags/3.3.0/code/base/deploy/src/com/tc/server/TCServerImpl.java
|
097b405882964f2947a0477103af59f30d66c90f
|
[] |
no_license
|
sirinath/Terracotta
|
fedfc2c4f0f06c990f94b8b6c3b9c93293334345
|
00a7662b9cf530dfdb43f2dd821fa559e998c892
|
refs/heads/master
| 2021-01-23T05:41:52.414211 | 2015-07-02T15:21:54 | 2015-07-02T15:21:54 | 38,613,711 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 26,717 |
java
|
/*
* All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright
* notice. All rights reserved.
*/
package com.tc.server;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.security.Constraint;
import org.mortbay.jetty.security.ConstraintMapping;
import org.mortbay.jetty.security.HashUserRealm;
import org.mortbay.jetty.security.SecurityHandler;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.DefaultServlet;
import org.mortbay.jetty.servlet.ServletHandler;
import org.mortbay.jetty.servlet.ServletHolder;
import com.tc.async.api.ConfigurationContext;
import com.tc.async.api.SEDA;
import com.tc.async.api.Sink;
import com.tc.async.api.Stage;
import com.tc.async.api.StageManager;
import com.tc.config.Directories;
import com.tc.config.schema.ActiveServerGroupConfig;
import com.tc.config.schema.L2Info;
import com.tc.config.schema.NewCommonL2Config;
import com.tc.config.schema.NewHaConfig;
import com.tc.config.schema.ServerGroupInfo;
import com.tc.config.schema.dynamic.ConfigItem;
import com.tc.config.schema.messaging.http.ConfigServlet;
import com.tc.config.schema.messaging.http.GroupInfoServlet;
import com.tc.config.schema.setup.ConfigurationSetupException;
import com.tc.config.schema.setup.L2TVSConfigurationSetupManager;
import com.tc.l2.state.StateManager;
import com.tc.lang.StartupHelper;
import com.tc.lang.TCThreadGroup;
import com.tc.lang.ThrowableHandler;
import com.tc.lang.StartupHelper.StartupAction;
import com.tc.license.AbstractLicenseResolverFactory;
import com.tc.logging.CustomerLogging;
import com.tc.logging.TCLogger;
import com.tc.logging.TCLogging;
import com.tc.management.beans.L2MBeanNames;
import com.tc.management.beans.L2State;
import com.tc.management.beans.TCServerInfo;
import com.tc.net.GroupID;
import com.tc.net.OrderedGroupIDs;
import com.tc.net.protocol.transport.ConnectionPolicy;
import com.tc.net.protocol.transport.ConnectionPolicyImpl;
import com.tc.object.config.schema.NewL2DSOConfig;
import com.tc.objectserver.core.api.ServerConfigurationContext;
import com.tc.objectserver.core.impl.ServerManagementContext;
import com.tc.objectserver.dgc.impl.GCStatsEventPublisher;
import com.tc.objectserver.impl.DistributedObjectServer;
import com.tc.objectserver.mgmt.ObjectStatsRecorder;
import com.tc.operatorevent.TerracottaOperatorEventHistoryProvider;
import com.tc.properties.TCProperties;
import com.tc.properties.TCPropertiesConsts;
import com.tc.properties.TCPropertiesImpl;
import com.tc.servlets.L1ReconnectPropertiesServlet;
import com.tc.statistics.StatisticsGathererSubSystem;
import com.tc.statistics.beans.StatisticsMBeanNames;
import com.tc.statistics.beans.impl.StatisticsLocalGathererMBeanImpl;
import com.tc.stats.DSO;
import com.tc.stats.DSOMBean;
import com.tc.util.Assert;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import javax.management.InstanceAlreadyExistsException;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
import javax.management.NotCompliantMBeanException;
public class TCServerImpl extends SEDA implements TCServer {
public static final String VERSION_SERVLET_PATH = "/version";
public static final String CONFIG_SERVLET_PATH = "/config";
public static final String GROUP_INFO_SERVLET_PATH = "/groupinfo";
public static final String STATISTICS_GATHERER_SERVLET_PREFIX = "/statistics-gatherer";
public static final String STATISTICS_GATHERER_SERVLET_PATH = STATISTICS_GATHERER_SERVLET_PREFIX
+ "/*";
public static final String L1_RECONNECT_PROPERTIES_FROML2_SERVELET_PATH = "/l1reconnectproperties";
public static final String HTTP_AUTHENTICATION_ROLE_STATISTICS = "statistics";
private static final TCLogger logger = TCLogging
.getLogger(TCServer.class);
private static final TCLogger consoleLogger = CustomerLogging
.getConsoleLogger();
private volatile long startTime = -1;
private volatile long activateTime = -1;
protected DistributedObjectServer dsoServer;
private Server httpServer;
private TerracottaConnector terracottaConnector;
private StatisticsGathererSubSystem statisticsGathererSubSystem;
private final Object stateLock = new Object();
private final L2State state = new L2State();
private final L2TVSConfigurationSetupManager configurationSetupManager;
protected final ConnectionPolicy connectionPolicy;
private boolean shutdown = false;
/**
* This should only be used for tests.
*/
public TCServerImpl(final L2TVSConfigurationSetupManager configurationSetupManager) {
this(configurationSetupManager, new TCThreadGroup(new ThrowableHandler(TCLogging.getLogger(TCServer.class))));
}
public TCServerImpl(final L2TVSConfigurationSetupManager configurationSetupManager, final TCThreadGroup threadGroup) {
this(configurationSetupManager, threadGroup, new ConnectionPolicyImpl(Integer.MAX_VALUE));
}
public TCServerImpl(final L2TVSConfigurationSetupManager manager, final TCThreadGroup group,
final ConnectionPolicy connectionPolicy) {
super(group, LinkedBlockingQueue.class.getName());
this.connectionPolicy = connectionPolicy;
Assert.assertNotNull(manager);
this.configurationSetupManager = manager;
this.statisticsGathererSubSystem = new StatisticsGathererSubSystem();
if (!this.statisticsGathererSubSystem.setup(manager.commonl2Config())) {
notifyShutdown();
System.exit(1);
}
}
private static OrderedGroupIDs createOrderedGroupIds(ActiveServerGroupConfig[] groupArray) {
GroupID[] gids = new GroupID[groupArray.length];
for (int i = 0; i < groupArray.length; i++) {
gids[i] = groupArray[i].getGroupId();
}
return new OrderedGroupIDs(gids);
}
public ServerGroupInfo[] serverGroups() {
L2Info[] l2Infos = infoForAllL2s();
ActiveServerGroupConfig[] groupArray = this.configurationSetupManager.activeServerGroupsConfig()
.getActiveServerGroupArray();
OrderedGroupIDs orderedGroupsIds = createOrderedGroupIds(groupArray);
GroupID coordinatorId = orderedGroupsIds.getActiveCoordinatorGroup();
ServerGroupInfo[] result = new ServerGroupInfo[groupArray.length];
for (int i = 0; i < groupArray.length; i++) {
ActiveServerGroupConfig groupInfo = groupArray[i];
GroupID groupId = groupInfo.getGroupId();
List<L2Info> memberList = new ArrayList<L2Info>();
for (L2Info l2Info : l2Infos) {
if (groupInfo.isMember(l2Info.name())) {
memberList.add(l2Info);
}
}
result[i] = new ServerGroupInfo(memberList.toArray(new L2Info[0]), groupInfo.getGroupName(), groupId.toInt(),
coordinatorId.equals(groupId));
}
return result;
}
public L2Info[] infoForAllL2s() {
String[] allKnownL2s = this.configurationSetupManager.allCurrentlyKnownServers();
L2Info[] out = new L2Info[allKnownL2s.length];
for (int i = 0; i < out.length; ++i) {
try {
NewCommonL2Config config = this.configurationSetupManager.commonL2ConfigFor(allKnownL2s[i]);
String name = allKnownL2s[i];
if (name == null) {
name = L2Info.IMPLICIT_L2_NAME;
}
String host = config.host().getString();
if (StringUtils.isBlank(host)) {
host = name;
}
out[i] = new L2Info(name, host, config.jmxPort().getBindPort());
} catch (ConfigurationSetupException cse) {
throw Assert.failure("This should be impossible here", cse);
}
}
return out;
}
public String getDescriptionOfCapabilities() {
return AbstractLicenseResolverFactory.getCapabilities().getLicensedCapabilitiesAsString();
}
/**
* I realize this is wrong, since the server can still be starting but we'll have to deal with the whole stopping
* issue later, and there's the TCStop feature which should be removed.
*/
public void stop() {
synchronized (this.stateLock) {
if (!this.state.isStartState()) {
stopServer();
logger.info("Server stopped.");
} else {
logger.warn("Server in incorrect state (" + this.state.getState() + ") to be stopped.");
}
}
}
public void start() {
synchronized (this.stateLock) {
if (this.state.isStartState()) {
try {
startServer();
} catch (Throwable t) {
if (t instanceof RuntimeException) { throw (RuntimeException) t; }
throw new RuntimeException(t);
}
} else {
logger.warn("Server in incorrect state (" + this.state.getState() + ") to be started.");
}
}
}
public boolean canShutdown() {
return (!this.state.isStartState() || (this.dsoServer != null && this.dsoServer.isBlocking()))
&& !this.state.isStopState();
}
public synchronized void shutdown() {
if (canShutdown()) {
this.state.setState(StateManager.STOP_STATE);
consoleLogger.info("Server exiting...");
notifyShutdown();
Runtime.getRuntime().exit(0);
} else {
logger.warn("Server in incorrect state (" + this.state.getState() + ") to be shutdown.");
}
}
public long getStartTime() {
return this.startTime;
}
public void updateActivateTime() {
if (this.activateTime == -1) {
this.activateTime = System.currentTimeMillis();
}
}
public long getActivateTime() {
return this.activateTime;
}
public boolean isGarbageCollectionEnabled() {
return this.configurationSetupManager.dsoL2Config().garbageCollectionEnabled().getBoolean();
}
public int getGarbageCollectionInterval() {
return this.configurationSetupManager.dsoL2Config().garbageCollectionInterval().getInt();
}
public String getConfig() {
try {
InputStream is = this.configurationSetupManager.rawConfigFile();
return IOUtils.toString(is);
} catch (IOException ioe) {
return ioe.getLocalizedMessage();
}
}
public String getPersistenceMode() {
NewL2DSOConfig dsoL2Config = this.configurationSetupManager.dsoL2Config();
ConfigItem persistenceModel = dsoL2Config != null ? dsoL2Config.persistenceMode() : null;
return persistenceModel != null ? persistenceModel.getObject().toString() : "temporary-swap-only";
}
public String getFailoverMode() {
NewHaConfig haConfig = this.configurationSetupManager.haConfig();
String haMode = haConfig != null ? haConfig.haMode() : null;
return haMode != null ? haMode : "no failover";
}
public int getDSOListenPort() {
if (this.dsoServer != null) { return this.dsoServer.getListenPort(); }
throw new IllegalStateException("DSO Server not running");
}
public int getDSOGroupPort() {
if (this.dsoServer != null) { return this.dsoServer.getGroupPort(); }
throw new IllegalStateException("DSO Server not running");
}
public DistributedObjectServer getDSOServer() {
return this.dsoServer;
}
public boolean isStarted() {
return !this.state.isStartState();
}
public boolean isActive() {
return this.state.isActiveCoordinator();
}
public boolean isStopped() {
// XXX:: introduce a new state when stop is officially supported.
return this.state.isStartState();
}
@Override
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("Server: ").append(super.toString()).append("\n");
if (isActive()) {
buf.append("Active since ").append(new Date(getStartTime())).append("\n");
} else if (isStarted()) {
buf.append("Started at ").append(new Date(getStartTime())).append("\n");
} else {
buf.append("Server is stopped").append("\n");
}
return buf.toString();
}
private void stopServer() {
// XXX: I have no idea if order of operations is correct here?
if (logger.isDebugEnabled()) {
consoleLogger.debug("Stopping TC server...");
}
if (this.statisticsGathererSubSystem != null) {
try {
this.statisticsGathererSubSystem.cleanup();
} catch (Exception e) {
logger.error("Error shutting down statistics gatherer", e);
} finally {
this.statisticsGathererSubSystem = null;
}
}
if (this.terracottaConnector != null) {
try {
this.terracottaConnector.shutdown();
} catch (Exception e) {
logger.error("Error shutting down terracotta connector", e);
} finally {
this.terracottaConnector = null;
}
}
try {
getStageManager().stopAll();
} catch (Exception e) {
logger.error("Error shutting down stage manager", e);
}
if (this.httpServer != null) {
if (logger.isDebugEnabled()) {
logger.debug("Shutting down HTTP server...");
}
try {
this.httpServer.stop();
} catch (Exception e) {
logger.error("Error shutting down HTTP server", e);
} finally {
this.httpServer = null;
}
}
// this stops the jmx server then dso server
if (this.dsoServer != null) {
try {
this.dsoServer.quickStop();
} catch (Exception e) {
logger.error("Error shutting down DSO server", e);
} finally {
this.dsoServer = null;
}
}
}
private class StartAction implements StartupAction {
public void execute() throws Throwable {
if (logger.isDebugEnabled()) {
logger.debug("Starting Terracotta server instance...");
}
TCServerImpl.this.startTime = System.currentTimeMillis();
NewCommonL2Config commonL2Config = TCServerImpl.this.configurationSetupManager.commonl2Config();
if (Runtime.getRuntime().maxMemory() != Long.MAX_VALUE) {
consoleLogger.info("Available Max Runtime Memory: " + (Runtime.getRuntime().maxMemory() / 1024 / 1024) + "MB");
}
TCServerImpl.this.terracottaConnector = new TerracottaConnector();
startHTTPServer(commonL2Config, TCServerImpl.this.terracottaConnector);
Stage stage = getStageManager().createStage("dso-http-bridge",
new HttpConnectionHandler(TCServerImpl.this.terracottaConnector), 1,
100);
stage.start(new NullContext(getStageManager()));
// the following code starts the jmx server as well
startDSOServer(stage.getSink());
if (isActive()) {
updateActivateTime();
if (TCServerImpl.this.activationListener != null) {
TCServerImpl.this.activationListener.serverActivated();
}
}
if (updateCheckEnabled()) {
UpdateCheckAction.start(TCServerImpl.this, updateCheckPeriodDays());
}
String l2Identifier = TCServerImpl.this.configurationSetupManager.getL2Identifier();
if (l2Identifier != null) {
logger.info("Server started as " + l2Identifier);
}
}
}
private boolean updateCheckEnabled() {
String s = System.getenv("TC_UPDATE_CHECK_ENABLED");
boolean checkEnabled = (s == null) || Boolean.parseBoolean(s);
return checkEnabled && this.configurationSetupManager.updateCheckConfig().isEnabled().getBoolean();
}
private int updateCheckPeriodDays() {
return this.configurationSetupManager.updateCheckConfig().periodDays().getInt();
}
protected void startServer() throws Exception {
new StartupHelper(getThreadGroup(), new StartAction()).startUp();
}
private void startDSOServer(final Sink httpSink) throws Exception {
Assert.assertTrue(this.state.isStartState());
TCProperties tcProps = TCPropertiesImpl.getProperties();
ObjectStatsRecorder objectStatsRecorder = new ObjectStatsRecorder(tcProps
.getBoolean(TCPropertiesConsts.L2_OBJECTMANAGER_FAULT_LOGGING_ENABLED), tcProps
.getBoolean(TCPropertiesConsts.L2_OBJECTMANAGER_REQUEST_LOGGING_ENABLED), tcProps
.getBoolean(TCPropertiesConsts.L2_OBJECTMANAGER_FLUSH_LOGGING_ENABLED), tcProps
.getBoolean(TCPropertiesConsts.L2_TRANSACTIONMANAGER_LOGGING_PRINT_BROADCAST_STATS), tcProps
.getBoolean(TCPropertiesConsts.L2_OBJECTMANAGER_PERSISTOR_LOGGING_ENABLED));
this.dsoServer = createDistributedObjectServer(this.configurationSetupManager, this.connectionPolicy, httpSink,
new TCServerInfo(this, this.state, objectStatsRecorder),
objectStatsRecorder, this.state, this);
this.dsoServer.start();
registerDSOServer();
}
protected DistributedObjectServer createDistributedObjectServer(L2TVSConfigurationSetupManager configSetupManager,
ConnectionPolicy policy, Sink httpSink,
TCServerInfo serverInfo,
ObjectStatsRecorder objectStatsRecorder,
L2State l2State, TCServerImpl serverImpl) {
return new DistributedObjectServer(configSetupManager, getThreadGroup(), policy, httpSink, serverInfo,
objectStatsRecorder, l2State, this, this);
}
private void startHTTPServer(final NewCommonL2Config commonL2Config, final TerracottaConnector tcConnector)
throws Exception {
this.httpServer = new Server();
this.httpServer.addConnector(tcConnector);
Context context = new Context(null, "/", Context.NO_SESSIONS | Context.SECURITY);
if (commonL2Config.httpAuthentication()) {
Constraint constraint = new Constraint();
constraint.setName(Constraint.__BASIC_AUTH);
constraint.setRoles(new String[] { HTTP_AUTHENTICATION_ROLE_STATISTICS });
constraint.setAuthenticate(true);
ConstraintMapping cm = new ConstraintMapping();
cm.setConstraint(constraint);
cm.setPathSpec(STATISTICS_GATHERER_SERVLET_PATH);
SecurityHandler sh = new SecurityHandler();
sh.setUserRealm(new HashUserRealm("Terracotta Statistics Gatherer", commonL2Config
.httpAuthenticationUserRealmFile()));
sh.setConstraintMappings(new ConstraintMapping[] { cm });
context.addHandler(sh);
logger.info("HTTP Authentication enabled for path '" + STATISTICS_GATHERER_SERVLET_PATH
+ "', using user realm file '" + commonL2Config.httpAuthenticationUserRealmFile() + "'");
}
context.setAttribute(ConfigServlet.CONFIG_ATTRIBUTE, this.configurationSetupManager);
context.setAttribute(GroupInfoServlet.GROUP_INFO_ATTRIBUTE, this.configurationSetupManager);
final boolean cvtRestEnabled = TCPropertiesImpl.getProperties()
.getBoolean(TCPropertiesConsts.CVT_REST_INTERFACE_ENABLED, true);
if (cvtRestEnabled) {
context.setAttribute(StatisticsGathererServlet.GATHERER_ATTRIBUTE, this.statisticsGathererSubSystem);
}
ServletHandler servletHandler = new ServletHandler();
/**
* We usually don't serve up any files, just hook in a few servlets. The ResourceBase can't be null though.
*/
File tcInstallDir;
try {
tcInstallDir = Directories.getInstallationRoot();
} catch (FileNotFoundException e) {
// if an error occurs during the retrieval of the installation root, just set it to null
// so that the fallback mechanism can be used
tcInstallDir = null;
}
File userDir = new File(System.getProperty("user.dir"));
boolean tcInstallDirValid = false;
File resourceBaseDir = userDir;
if (tcInstallDir != null && tcInstallDir.exists() && tcInstallDir.isDirectory() && tcInstallDir.canRead()) {
tcInstallDirValid = true;
resourceBaseDir = tcInstallDir;
}
context.setResourceBase(resourceBaseDir.getAbsolutePath());
createAndAddServlet(servletHandler, VersionServlet.class.getName(), VERSION_SERVLET_PATH);
createAndAddServlet(servletHandler, ConfigServlet.class.getName(), CONFIG_SERVLET_PATH);
createAndAddServlet(servletHandler, GroupInfoServlet.class.getName(), GROUP_INFO_SERVLET_PATH);
if (cvtRestEnabled) {
createAndAddServlet(servletHandler, StatisticsGathererServlet.class.getName(), STATISTICS_GATHERER_SERVLET_PATH);
}
createAndAddServlet(servletHandler, L1ReconnectPropertiesServlet.class.getName(),
L1_RECONNECT_PROPERTIES_FROML2_SERVELET_PATH);
if (TCPropertiesImpl.getProperties().getBoolean(TCPropertiesConsts.HTTP_DEFAULT_SERVLET_ENABLED, false)) {
if (!tcInstallDirValid) {
String msg = "Default HTTP servlet with file serving NOT enabled because the '"
+ Directories.TC_INSTALL_ROOT_PROPERTY_NAME + "' system property is invalid.";
consoleLogger.warn(msg);
logger.warn(msg);
} else {
boolean aliases = TCPropertiesImpl.getProperties()
.getBoolean(TCPropertiesConsts.HTTP_DEFAULT_SERVLET_ATTRIBUTE_ALIASES, false);
boolean dirallowed = TCPropertiesImpl.getProperties()
.getBoolean(TCPropertiesConsts.HTTP_DEFAULT_SERVLET_ATTRIBUTE_DIR_ALLOWED, false);
context.setAttribute("aliases", aliases);
context.setAttribute("dirAllowed", dirallowed);
createAndAddServlet(servletHandler, DefaultServlet.class.getName(), "/");
String msg = "Default HTTP servlet with file serving enabled for '" + resourceBaseDir.getCanonicalPath()
+ "' (aliases = '" + aliases + "', dirallowed = '" + dirallowed + "')";
consoleLogger.info(msg);
logger.info(msg);
}
}
context.setServletHandler(servletHandler);
this.httpServer.addHandler(context);
try {
this.httpServer.start();
} catch (Exception e) {
consoleLogger.warn("Couldn't start HTTP server", e);
throw e;
}
}
private static void createAndAddServlet(final ServletHandler servletHandler, final String servletClassName,
final String path) {
ServletHolder holder = servletHandler.addServletWithMapping(servletClassName, path);
holder.setInitParameter("scratchdir", "jsp"); // avoid jetty from creating a "jsp" directory
servletHandler.addServlet(holder);
}
public void dump() {
if (this.dsoServer != null) {
this.dsoServer.dump();
}
}
private void registerDSOServer() throws InstanceAlreadyExistsException, MBeanRegistrationException,
NotCompliantMBeanException, NullPointerException {
ServerManagementContext mgmtContext = this.dsoServer.getManagementContext();
ServerConfigurationContext configContext = this.dsoServer.getContext();
MBeanServer mBeanServer = this.dsoServer.getMBeanServer();
registerDSOMBeans(mgmtContext, configContext, mBeanServer);
mBeanServer.registerMBean(mgmtContext.getDSOAppEventsMBean(), L2MBeanNames.DSO_APP_EVENTS);
StatisticsLocalGathererMBeanImpl local_gatherer = new StatisticsLocalGathererMBeanImpl(
this.statisticsGathererSubSystem,
this.configurationSetupManager
.commonl2Config(),
this.configurationSetupManager
.dsoL2Config());
mBeanServer.registerMBean(local_gatherer, StatisticsMBeanNames.STATISTICS_GATHERER);
}
protected void registerDSOMBeans(ServerManagementContext mgmtContext, ServerConfigurationContext configContext,
MBeanServer mBeanServer) throws NotCompliantMBeanException,
InstanceAlreadyExistsException, MBeanRegistrationException {
GCStatsEventPublisher gcStatsPublisher = this.dsoServer.getGcStatsEventPublisher();
TerracottaOperatorEventHistoryProvider operatorEventHistoryProvider = this.dsoServer.getOperatorEventsHistoryProvider();
DSOMBean dso = new DSO(mgmtContext, configContext, mBeanServer, gcStatsPublisher, operatorEventHistoryProvider);
mBeanServer.registerMBean(dso, L2MBeanNames.DSO);
}
// TODO: check that this is not needed then remove
private TCServerActivationListener activationListener;
public void setActivationListener(final TCServerActivationListener listener) {
this.activationListener = listener;
}
private static class NullContext implements ConfigurationContext {
private final StageManager manager;
public NullContext(final StageManager manager) {
this.manager = manager;
}
public TCLogger getLogger(final Class clazz) {
return TCLogging.getLogger(clazz);
}
public Stage getStage(final String name) {
return this.manager.getStage(name);
}
}
public void startBeanShell(final int port) {
if (this.dsoServer != null) {
this.dsoServer.startBeanShell(port);
}
}
private synchronized void notifyShutdown() {
shutdown = true;
notifyAll();
}
public synchronized void waitUntilShutdown() {
while (!shutdown) {
try {
wait();
} catch (InterruptedException e) {
throw new AssertionError(e);
}
}
}
public void reloadConfiguration() throws ConfigurationSetupException {
dsoServer.reloadConfiguration();
}
}
|
[
"hhuynh@7fc7bbf3-cf45-46d4-be06-341739edd864"
] |
hhuynh@7fc7bbf3-cf45-46d4-be06-341739edd864
|
5d79ad92d4bde28c588f9f360e59e3d4d50db789
|
ceeb584dd26ad0aab3fd3260526e4bb144473b1e
|
/Composite/Store.java
|
1d74d84f55a038378238eec10c573eb3000ac6d0
|
[] |
no_license
|
achyutdev/Design-pattern
|
375fe161171fa0b62d9853c1eecb3adb2989564b
|
bd13da0d65b4b0a32963868386059fd6996bcb63
|
refs/heads/master
| 2021-01-20T19:13:45.842837 | 2016-08-01T02:10:04 | 2016-08-01T02:10:04 | 63,186,774 | 0 | 0 | null | 2016-08-01T02:10:05 | 2016-07-12T19:30:27 |
Java
|
UTF-8
|
Java
| false | false | 196 |
java
|
package lab;
public class Store {
ProductCatalog allCatalog;
public Store(ProductCatalog catalog){
this.allCatalog = catalog;
}
public void printCatalog(){
allCatalog.print();
}
}
|
[
"[email protected]"
] | |
c95d41d40e3113a921e94a7125d91afb8c345dd5
|
c1935c2c52716bf388d2377609d1b71130176311
|
/MSocketEverything/msocketSource/msocket1/src/edu/umass/cs/gigapaxos/PaxosInstanceStateMachine.java
|
f81e657d275511e06e1357dadfd18a21c22f1828
|
[
"Apache-2.0"
] |
permissive
|
cyjing/mengThesis
|
a40b95edd8c12cef62a06df5c53934215a11b2d2
|
7afe312c0866da6cfe99183e22bfda647002c380
|
refs/heads/master
| 2021-01-17T18:23:48.194128 | 2016-06-02T09:16:43 | 2016-06-02T09:16:43 | 60,248,170 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 95,517 |
java
|
/*
* Copyright (c) 2015 University of Massachusetts
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*
* Initial developer(s): V. Arun
*/
package edu.umass.cs.gigapaxos;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.json.JSONException;
import org.json.JSONObject;
import edu.umass.cs.gigapaxos.PaxosConfig.PC;
import edu.umass.cs.gigapaxos.interfaces.ClientRequest;
import edu.umass.cs.gigapaxos.interfaces.Replicable;
import edu.umass.cs.gigapaxos.interfaces.Request;
import edu.umass.cs.gigapaxos.interfaces.SummarizableRequest;
import edu.umass.cs.gigapaxos.paxospackets.AcceptPacket;
import edu.umass.cs.gigapaxos.paxospackets.AcceptReplyPacket;
import edu.umass.cs.gigapaxos.paxospackets.BatchedAcceptReply;
import edu.umass.cs.gigapaxos.paxospackets.BatchedCommit;
import edu.umass.cs.gigapaxos.paxospackets.PValuePacket;
import edu.umass.cs.gigapaxos.paxospackets.PaxosPacket;
import edu.umass.cs.gigapaxos.paxospackets.PreparePacket;
import edu.umass.cs.gigapaxos.paxospackets.PrepareReplyPacket;
import edu.umass.cs.gigapaxos.paxospackets.ProposalPacket;
import edu.umass.cs.gigapaxos.paxospackets.RequestPacket;
import edu.umass.cs.gigapaxos.paxospackets.StatePacket;
import edu.umass.cs.gigapaxos.paxospackets.SyncDecisionsPacket;
import edu.umass.cs.gigapaxos.paxospackets.PaxosPacket.PaxosPacketType;
import edu.umass.cs.gigapaxos.paxosutil.Ballot;
import edu.umass.cs.gigapaxos.paxosutil.HotRestoreInfo;
import edu.umass.cs.gigapaxos.paxosutil.IntegerMap;
import edu.umass.cs.gigapaxos.paxosutil.LogMessagingTask;
import edu.umass.cs.gigapaxos.paxosutil.MessagingTask;
import edu.umass.cs.gigapaxos.paxosutil.PaxosInstanceCreationException;
import edu.umass.cs.gigapaxos.paxosutil.PrepareReplyAssembler;
import edu.umass.cs.gigapaxos.paxosutil.RequestInstrumenter;
import edu.umass.cs.gigapaxos.paxosutil.SlotBallotState;
import edu.umass.cs.gigapaxos.testing.TESTPaxosConfig.TC;
import edu.umass.cs.nio.NIOTransport;
import edu.umass.cs.reconfiguration.reconfigurationutils.RequestParseException;
import edu.umass.cs.utils.Config;
import edu.umass.cs.utils.Keyable;
import edu.umass.cs.utils.Pausable;
import edu.umass.cs.utils.Util;
import edu.umass.cs.utils.DelayProfiler;
/**
* @author V. Arun
*
* This class is the top-level paxos class per instance or paxos group
* on a machine. This class is "protected" as the only way to use it
* will be through the corresponding PaxosManager even if there is just
* one paxos application running on the machine.
* <p>
*
* This class delegates much of the interesting paxos actions to
* PaxosAcceptorState and PaxosCoordinator. It delegates all messaging
* to PaxosManager's PaxosMessenger. It is "managed", i.e., its paxos
* group is created and its incoming packets are demultiplexed, by its
* PaxosManager. It's logging is handled by an implementation of
* AbstractPaxosLogger.
* <p>
*
* The high-level organization is best reflected in handlePaxosMessage,
* a method that delegates processing to the acceptor or coordinator and
* gets back a messaging task, e.g., receiving a prepare message will
* probably result in a prepare-reply messaging task, and so on.
* <p>
*
* Space: An inactive PaxosInstanceStateMachine, i.e., whose
* corresponding application is currently not processing any requests,
* uses ~225B *total*. Here is the breakdown: PaxosInstanceStateMachine
* final fields: ~80B PaxosAcceptor: ~90B PaxosCoordinatorState: ~60B
* Even in an inactive paxos instance, the total *total* space is much
* more because of PaxosManager (that internally uses FailureDetection)
* etc., but all that state is not incurred per paxos application, just
* per machine. Thus, if we have S=10 machines and N=10M applications
* each using paxos with K=10 replicas one each at each machine, each
* machine has 10M PaxosInstanceStateMachine instances that will use
* about 2.25GB (10M*225B). The amount of space used by PaxosManager and
* others is small and depends only on S, not N or K.
* <p>
*
* When actively processing requests, the total space per paxos instance
* can easily go up to thousands of bytes. But we are unlikely to be
* processing requests across even hundreds of thousands of different
* applications simultaneously if each request finishes executing in
* under a second. For example, if a single server's execution
* throughput is 10K requests/sec and each request takes 100ms to finish
* executing (including paxos coordination), then the number of active
* *requests* at a machine is on average ~100K. The number of active
* paxos instances at that machine is at most the number of active
* requests at that machine.
*
*/
public class PaxosInstanceStateMachine implements Keyable<String>, Pausable {
/*
* If false, the paxosID is represented as a byte[], so we must invoke
* getPaxosID() as infrequently as possible.
*/
private static final boolean PAXOS_ID_AS_STRING = false;
// must be >= 1, does not depend on anything else
protected static final int INTER_CHECKPOINT_INTERVAL = Config
.getGlobalInt(PaxosConfig.PC.CHECKPOINT_INTERVAL);// 100;
// out-of-order-ness prompting synchronization, must be >=1
protected static final int SYNC_THRESHOLD = 4 * INTER_CHECKPOINT_INTERVAL;
// max decisions gap when reached will prompt checkpoint transfer
protected static final int MAX_SYNC_DECISIONS_GAP = INTER_CHECKPOINT_INTERVAL;
// minimum interval before another sync decisions request can be issued
protected static final long MIN_RESYNC_DELAY = 1000;
private static final boolean ENABLE_INSTRUMENTATION = Config
.getGlobalBoolean(PC.ENABLE_INSTRUMENTATION);
private static final boolean instrument() {
return ENABLE_INSTRUMENTATION;
}
private static final boolean instrument(boolean flag) {
return flag && ENABLE_INSTRUMENTATION;
}
private static final boolean instrument(int n) {
return ENABLE_INSTRUMENTATION && Util.oneIn(n);
}
private static final void instrumentDelay(toLog field, long startTime) {
if(field.log()) DelayProfiler.updateDelay(field.toString(), startTime);
}
private static final void instrumentDelay(toLog field, long startTime, int n) {
if(field.log()) DelayProfiler.updateDelay(field.toString(), startTime, n);
}
private static enum SyncMode {
DEFAULT_SYNC, FORCE_SYNC, SYNC_TO_PAUSE
};
/*
* Enabling this will slow down instance creation for null initialState as
* an initial checkpoint will still be made. It will make no difference if
* initialState is non-null as checkpointing non-null initial state is
* necessary for safety.
*
* The default setting must be true. Not allowing null checkpoints can cause
* reconfiguration to stall as there is no way for the new epoch to
* distinguish between no previous epoch final state and null previous epoch
* final state.
*/
protected static final boolean ENABLE_NULL_CHECKPOINT_STATE = true;
/************ final Paxos state that is unchangeable after creation ***************/
private final int[] groupMembers;
// Object to allow easy testing across byte[] and String
private final Object paxosID;
private final int version;
private final PaxosManager<?> paxosManager;
//private final InterfaceReplicable clientRequestHandler;
/************ Non-final paxos state that is changeable after creation *******************/
// uses ~125B of empty space when not actively processing requests
private PaxosAcceptor paxosState = null;
// uses just a single pointer's worth of space unless I am a coordinator
private PaxosCoordinator coordinator = null;
/************ End of non-final paxos state ***********************************************/
// static, so does not count towards space.
private static Logger log = (PaxosManager.getLogger());
PaxosInstanceStateMachine(String groupId, int version, int id,
Set<Integer> gms, Replicable app, String initialState,
PaxosManager<?> pm, final HotRestoreInfo hri, boolean missedBirthing) {
/*
* Final assignments: A paxos instance is born with a paxosID, version
* this instance's node ID, the application request handler, the paxos
* manager, and the group members.
*/
this.paxosID = PAXOS_ID_AS_STRING ? groupId : groupId.getBytes();
this.version = version;
//this.clientRequestHandler = app;
this.paxosManager = pm;
assert (gms != null && gms.size() > 0);
Arrays.sort(this.groupMembers = Util.setToIntArray(gms));
/**************** End of final assignments *******************/
/*
* All non-final state is store in PaxosInstanceState (for acceptors) or
* in PaxosCoordinatorState (for coordinators) that inherits from
* PaxosInstanceState.
*/
if (pm != null && hri == null)
initiateRecovery(initialState, missedBirthing);
else if ((hri != null) && hotRestore(hri)) {
if (initialState != null) // batched creation
this.putInitialState(initialState);
} else if (pm == null)
testingNoRecovery(); // used only for testing size
assert (hri == null || initialState == null || hri.isCreateHRI()) : "Can not specify initial state for existing, paused paxos instance";
incrInstanceCount(); // for instrumentation
// log creation only if the number of instances is small
log.log((hri == null && notManyInstances()) ? Level.INFO : Level.FINER,
"Node{0} initialized paxos {1} {2} with members {3}; {4} {5} {6}",
new Object[] {
this.getNodeID(),
(this.paxosState.getBallotCoordLog() == this.getMyID() ? "coordinator"
: "acceptor"),
this.getPaxosIDVersion(),
Util.arrayOfIntToString(groupMembers),
this.paxosState,
this.coordinator,
(initialState == null ? "{recovered_state=["
+ Util.prefix(this.getCheckpointState(), 64)
: "{initial_state=[" + initialState) + "]}" });
}
/**
* @return Version or epoch number corresponding to this reconfigurable
* paxos instance.
*/
protected int getVersion() {
return this.version;
}
// one of only two public methods
public String getKey() {
return this.getPaxosID();
}
public String toString() {
return this.getNodeState();
}
protected String toStringLong() {
return this.getNodeState() + this.paxosState + (this.coordinator!=null ?this.coordinator:"");
}
/**
* @return Paxos instance name concatenated with the version number.
*/
protected String getPaxosIDVersion() {
return this.getPaxosID() + ":" + this.getVersion();
}
protected String getPaxosID() {
return (paxosID instanceof String ? (String) paxosID : new String(
(byte[]) paxosID));
}
protected int[] getMembers() {
return this.groupMembers;
}
protected String getNodeID() {
return this.paxosManager != null ? this.paxosManager.intToString(this
.getMyID()) : "" + getMyID();
}
protected Replicable getApp() {
return this.paxosManager.getApp(this.getPaxosID()); // this.clientRequestHandler;
}
protected PaxosManager<?> getPaxosManager() {
return this.paxosManager;
}
protected int getMyID() {
return (this.paxosManager != null ? this.paxosManager.getMyID() : -1);
}
/**
* isStopped()==true means that this paxos instance is dead and completely
* harmless (even if the underlying object has not been garbage collected by
* the JVM. In particular, it can NOT make the app execute requests or send
* out paxos messages to the external world.
*
* @return Whether this paxos instance has been stopped.
*/
protected boolean isStopped() {
return this.paxosState.isStopped();
}
/**
* Forces a synchronization wait. PaxosManager needs this to ensure that an
* ongoing stop is fully executed.
*
* @return True.
*/
protected synchronized boolean synchronizedNoop() {
return true;
}
// not synchronized as coordinator can die anytime anyway
protected boolean forceStop() {
if (!this.paxosState.isStopped())
decrInstanceCount(); // for instrumentation
PaxosCoordinator.forceStop(this.coordinator);
this.coordinator = null;
this.paxosState.forceStop(); //
return true;
}
private boolean nullCheckpointStateEnabled() {
return this.paxosManager.isNullCheckpointStateEnabled();
}
// removes all database and app state and can not be recovered anymore
protected boolean kill(boolean clean) {
// paxosState must be typically already stopped here
this.forceStop();
if (clean // clean kill implies reset app state
&& this.updateState(this.getPaxosID(), null)
// and remove database state
&& AbstractPaxosLogger.kill(this.paxosManager.getPaxosLogger(),
getPaxosID(), this.getVersion()))
// paxos instance is "lost" now
log.log(Level.INFO, "Paxos instance {0} cleanly terminated.",
new Object[] { this });
else
// unclean "crash"
log.severe(this
+ " crashing paxos instance "
+ getPaxosIDVersion()
+ " likely because of an error while executing an application request. "
+ "A paxos instance for "
+ getPaxosIDVersion()
+ " or a higher version must either be explicitly (re-)created "
+ "or this \"crashed\" instance will recover safely upon a reboot.");
return true;
}
private boolean updateState(String paxosID, String state) {
for (int i = 0; !this.getApp().restore(getPaxosID(),
null); i++)
if (waitRetry(RETRY_TIMEOUT) && i < RETRY_LIMIT)
log.warning(this
+ " unable to delete application state; retrying");
else
throw new RuntimeException("Node" + getNodeID()
+ " unable to delete " + this.getPaxosIDVersion());
return true;
}
private static final long RETRY_TIMEOUT = Config.getGlobalLong(PC.HANDLE_REQUEST_RETRY_INTERVAL);
private static final int RETRY_LIMIT = Config.getGlobalInt(PC.HANDLE_REQUEST_RETRY_LIMIT);
private static boolean waitRetry(long timeout) {
try {
Thread.sleep(timeout);
} catch (InterruptedException e) {
e.printStackTrace();
}
return true;
}
protected void setActive() {
this.paxosState.setActive();
}
protected boolean isActive() {
return this.paxosState.isActive();
}
private String getCheckpointState() {
SlotBallotState sbs = this.paxosManager != null ? this.paxosManager
.getPaxosLogger()
.getSlotBallotState(getPaxosID(), getVersion()) : null;
return sbs != null ? sbs.state : null;
}
/**
* This is the main entry point into this class and is used by
* {@link PaxosManager} to supply incoming packets.
*
* @param obj
* JSONObject or RequestPacket.
* @throws JSONException
*/
protected void handlePaxosMessage(Object obj) throws JSONException {
this.handlePaxosMessage(obj, SyncMode.DEFAULT_SYNC);
}
/**
* For legacy reasons, this method still accepts JSONObject in addition to
* PaxosPacket as the first argument.
*
* FIXME: The first argument will be explicitly turned into PaxosPacket
* soon.
*
* @param obj
* @param mode
* @throws JSONException
*/
private void handlePaxosMessage(Object obj, SyncMode mode)
throws JSONException {
long methodEntryTime = System.currentTimeMillis();
JSONObject json = obj != null && obj instanceof JSONObject ? (JSONObject) obj
: null;
assert (json == null);
PaxosPacket pp = obj != null && obj instanceof PaxosPacket ? (PaxosPacket) obj
: null;
assert (obj != null || !mode.equals(SyncMode.DEFAULT_SYNC));
// every packet here must have a version, so we don't check has()
if (json != null
&& json.getInt(PaxosPacket.Keys.V.toString()) != this
.getVersion())
return;
if (pp != null && pp.getVersion() != this.getVersion())
return;
/*
* Note: Because incoming messages may be handled concurrently, some
* messages may continue to get processed for a little while after a
* stop has been executed and even after isStopped() is true (because
* isStopped() was false when those messages came in here). But that is
* okay coz these messages can not spawn unsafe outgoing messages (as
* messaging is turned off for all but DECISION or CHECKPOINT_STATE
* packets) and can not change any disk state.
*/
if (this.paxosState.isStopped()) {
log.log(Level.INFO, "{0} stopped; dropping {1}", new Object[] {
this, (pp != null ? pp.getSummary() : json) });
return;
}
// recovery means we won't send any replies
boolean recovery = json != null ? PaxosPacket.isRecovery(json)
: pp != null ? PaxosPacket.isRecovery(pp) : false;
/*
* The reason we should not process regular messages until this instance
* has rolled forward is that it might respond to a prepare with a list
* of accepts fetched from disk that may be inconsistent with its
* acceptor state.
*/
if (!this.paxosManager.hasRecovered(this) && !recovery)
return; // only process recovery message during rollForward
PaxosPacketType msgType = json != null ? PaxosPacket
.getPaxosPacketType(json) : pp != null ? pp.getType()
: PaxosPacketType.NO_TYPE;
log.log(Level.FINEST, "{0} received {1}:{2}", new Object[] { this,
msgType, obj });
boolean isPoke = msgType.equals(PaxosPacketType.NO_TYPE);
if (!isPoke)
this.markActive();
else
log.log(Level.FINER, "{0} received NO_TYPE poke {1};",
new Object[] { this, mode });
MessagingTask[] mtasks = new MessagingTask[3];
/*
* Check for coordinator'ing upon *every* message except poke messages.
* Pokes are primarily for sync'ing decisions and could be also used to
* resend accepts. There is little reason to send prepares proactively
* if no new activity is happening.
*/
mtasks[0] = (!recovery ?
// check run for coordinator if not active
(!PaxosCoordinator.isActive(this.coordinator)
// ignore pokes unless not caught up
&& (!isPoke || !PaxosCoordinator.caughtUp(this.coordinator))) ? checkRunForCoordinator()
// else reissue long waiting accepts
: this.pokeLocalCoordinator()
// neither during recovery
: null);
MessagingTask mtask = null;
MessagingTask[] batchedTasks = null;
switch (msgType) {
case REQUEST:
batchedTasks = handleRequest(json != null ? new RequestPacket(json)
: (RequestPacket) pp);
// send RequestPacket to current coordinator
break;
// replica --> coordinator
case PROPOSAL:
batchedTasks = handleProposal(json != null ? new ProposalPacket(json)
: (ProposalPacket) pp);
// unicast ProposalPacket to coordinator or multicast AcceptPacket
break;
// coordinator --> replica
case DECISION:
mtask = handleCommittedRequest(json != null ? new PValuePacket(json)
: (PValuePacket) pp);
// send nothing, but log decision
break;
case BATCHED_COMMIT:
mtask = handleBatchedCommit(json != null ? new BatchedCommit(json)
: (BatchedCommit) pp);
// send nothing, but log decision
break;
// coordinator --> replica
case PREPARE:
mtask = handlePrepare(json != null ? new PreparePacket(json)
: (PreparePacket) pp);
// send PreparePacket prepare reply to coordinator
break;
// replica --> coordinator
case PREPARE_REPLY:
mtask = handlePrepareReply(json != null ? new PrepareReplyPacket(
json) : (PrepareReplyPacket) pp);
// send AcceptPacket[] to all
break;
// coordinator --> replica
case ACCEPT:
batchedTasks = handleAccept(json != null ? new AcceptPacket(json)
: (AcceptPacket) pp);
// send AcceptReplyPacket to coordinator
break;
// replica --> coordinator
case ACCEPT_REPLY:
mtask = handleAcceptReply(json != null ? new AcceptReplyPacket(json)
: (AcceptReplyPacket) pp);
// send PValuePacket decision to all
break;
case BATCHED_ACCEPT_REPLY:
batchedTasks = handleBatchedAcceptReply(json != null ? new BatchedAcceptReply(
json) : (BatchedAcceptReply) pp);
// send PValuePacket decisions to all
break;
case SYNC_DECISIONS:
mtask = handleSyncDecisionsPacket(json != null ? new SyncDecisionsPacket(
json) : (SyncDecisionsPacket) pp);
// send SynchronizeReplyPacket to sender
break;
case CHECKPOINT_STATE:
mtask = handleCheckpoint(json != null ? new StatePacket(json)
: (StatePacket) pp);
break;
case NO_TYPE: // not a real packet
// sync if needed on poke
mtasks[0] = (mtasks[0] != null) ? mtasks[0] : this
.fixLongDecisionGaps(null, mode);
break;
default:
assert (false) : "Paxos instance received an unrecognizable packet: "
+ json;
}
mtasks[1] = mtask;
// special case for method returning array of messaging tasks
if (batchedTasks != null) {
mtasks[1] = batchedTasks[0];
mtasks[2] = batchedTasks[1];
}
instrumentDelay(toLog.handlePaxosMessage, methodEntryTime);
this.checkIfTrapped(pp, mtasks[1]); // just to print a warning
if (!recovery) {
this.sendMessagingTask(mtasks);
}
}
/************** Start of private methods ****************/
/*
* Invoked both when a paxos instance is first created and when it recovers
* after a crash. It is all the same as far as the paxos instance is
* concerned (provided we ensure that the app state after executing the
* first request (slot 0) is checkpointed, which we do).
*/
private boolean initiateRecovery(String initialState, boolean missedBirthing) {
String pid = this.getPaxosID();
// only place where version is checked
SlotBallotState slotBallot = this.paxosManager.getPaxosLogger()
.getSlotBallotState(pid, this.getVersion());
if (slotBallot != null) {
log.log(Level.FINE, "{0} recovered state: {1}", new Object[] {
this, (slotBallot != null ? slotBallot.state : "NULL") });
// check membership
if (!slotBallot.members.equals(this.paxosManager
.getStringNodesFromIntArray(groupMembers)))
throw new PaxosInstanceCreationException(
"Paxos instance exists with a different replica group: "
+ (slotBallot.members));
// update app state
if (!this.getApp().restore(pid, slotBallot.state))
throw new PaxosInstanceCreationException(
"Unable to update app state with " + slotBallot.state);
}
this.coordinator = null;//new PaxosCoordinator(); // just a shell class
// initial coordinator is assumed, not prepared
if (slotBallot == null && roundRobinCoordinator(0) == this.getMyID())
this.coordinator = PaxosCoordinator.createCoordinator(0, this.getMyID(), getMembers(),
(initialState != null || nullCheckpointStateEnabled() ? 1
: 0), true); // slotBallot==null
/*
* Note: We don't have to create coordinator state here. It will get
* created if needed when the first external (non-recovery) packet is
* received. But we create the very first coordinator here as otherwise
* it is possible that no coordinator gets elected as follows: the
* lowest ID node wakes up and either upon an external or self-poke
* message sends a prepare, but gets no responses because no other node
* is up yet. In this case, the other nodes when they boot up will not
* run for coordinator, and the lowest ID node will not resend its
* prepare if no more requests come, so the first request could be stuck
* in its pre-active queue for a long time.
*/
// allow null state without null checkpoints just for memory testing
if (slotBallot == null && initialState == null
&& !this.paxosManager.isNullCheckpointStateEnabled()
&& !Config.getGlobalBoolean(TC.MEMORY_TESTING))
throw new PaxosInstanceCreationException(
"A paxos instance with null initial state can be"
+ " created only if null checkpoints are enabled");
/*
* If this is a "missed-birthing" instance creation, we still set the
* acceptor nextSlot to 0 but don't checkpoint initialState. In fact,
* initialState better be null here in that case as we can't possibly
* have an initialState with missed birthing.
*/
assert (!(missedBirthing && initialState != null));
/*
* If it is possible for there to be no initial state checkpoint, under
* missed birthing, an acceptor may incorrectly report its gcSlot as -1,
* and if a majority do so (because that majority consists all of missed
* birthers), a coordinator may propose a proposal for slot 0 even
* though an initial state does exist, which would end up overwriting
* the initial state. So we can not support ambiguity in whether there
* is initial state or not. If we force initial state checkpoints (even
* null state checkpoints) to always exist, missed birthers can always
* set the initial gcSlot to 0. The exception and assert above imply the
* assertion below.
*/
assert (!missedBirthing || this.paxosManager
.isNullCheckpointStateEnabled());
this.paxosState = new PaxosAcceptor(
slotBallot != null ? slotBallot.ballotnum : 0,
slotBallot != null ? slotBallot.coordinator : this
.roundRobinCoordinator(0),
slotBallot != null ? (slotBallot.slot + 1) : 0, null);
if (slotBallot == null && !missedBirthing)
this.putInitialState(initialState);
if (missedBirthing)
this.paxosState.setGCSlotAfterPuttingInitialSlot();
if (slotBallot == null)
// TESTPaxosConfig.setRecovered(this.getMyID(), pid, true)
;
return true; // return value will be ignored
}
private boolean hotRestore(HotRestoreInfo hri) {
// called from constructor only, hence assert
assert (this.paxosState == null && this.coordinator == null);
log.log(Level.FINE, "{0} hot restoring with {1}", new Object[] { this,
hri });
//this.coordinator = new PaxosCoordinator();
this.coordinator = PaxosCoordinator.hotRestore(this.coordinator, hri);
this.paxosState = new PaxosAcceptor(hri.accBallot.ballotNumber,
hri.accBallot.coordinatorID, hri.accSlot, hri);
this.paxosState.setActive(); // no recovery
this.markActive(); // to prevent immediate re-pause
return true;
}
private boolean putInitialState(String initialState) {
if (this.getPaxosManager() == null
|| (initialState == null && !nullCheckpointStateEnabled()))
return false;
this.handleCheckpoint(new StatePacket(initialBallot(), 0, initialState));
this.paxosState.setGCSlotAfterPuttingInitialSlot();
return true;
}
private Ballot initialBallot() {
return new Ballot(0, this.roundRobinCoordinator(0));
}
/*
* The one method for all message sending. Protected coz the logger also
* calls this.
*/
protected void sendMessagingTask(MessagingTask mtask) {
if (mtask == null || mtask.isEmpty())
return;
if (this.paxosState != null
&& this.paxosState.isStopped()
&& !mtask.msgs[0].getType().equals(PaxosPacketType.DECISION)
&& !mtask.msgs[0].getType().equals(
PaxosPacketType.CHECKPOINT_STATE))
return;
// if (TESTPaxosConfig.isCrashed(this.getMyID()))return;
log.log(Level.FINEST, "{0} sending: {1}", new Object[] { this, mtask });
mtask.putPaxosIDVersion(this.getPaxosID(), this.getVersion());
try {
// assert(this.paxosState.isActive());
paxosManager.send(mtask);
} catch (IOException ioe) {
log.severe(this + " encountered IOException while sending " + mtask);
ioe.printStackTrace();
/*
* We can't throw this exception upward because it will get sent all
* the way back up to PacketDemultiplexer whose incoming packet
* initiated this whole chain of events. It seems silly for
* PacketDemultiplexer to throw an IOException caused by the sends
* resulting from processing that packet. So we should handle this
* exception right here. But what should we do? We can ignore it as
* the network does not need to be reliable anyway. Revisit as
* needed.
*/
} catch (JSONException je) {
/* Same thing for other exceptions. Nothing useful to do here */
log.severe(this + " encountered JSONException while sending "
+ mtask);
je.printStackTrace();
}
}
private void sendMessagingTask(MessagingTask[] mtasks) throws JSONException {
for (MessagingTask mtask : mtasks)
this.sendMessagingTask(mtask);
}
// will send a noop message to self to force event-driven actions
protected void poke(boolean forceSync) {
try {
log.log(Level.FINE, "{0} being poked", new Object[] { this });
this.handlePaxosMessage(null, forceSync ? SyncMode.FORCE_SYNC
: SyncMode.SYNC_TO_PAUSE);
} catch (JSONException je) {
je.printStackTrace();
}
}
private static final boolean BATCHING_ENABLED = Config.getGlobalBoolean(PC.BATCHING_ENABLED);
/*
* "Phase0" Event: Received a request from a client.
*
* Action: Call handleProposal which will send the corresponding proposal to
* the current coordinator.
*/
private MessagingTask[] handleRequest(RequestPacket request) {
log.log(Level.FINE,
"{0}{1}{2}",
new Object[] { this, " Phase0/CLIENT_REQUEST: ",
request.getSummary(log.isLoggable(Level.FINE)) });
RequestInstrumenter.received(request, request.getClientID(),
this.getMyID());
if (!BATCHING_ENABLED || request.getEntryReplica()==IntegerMap.NULL_INT_NODE) {
// returned count must be 1 here
//this.paxosManager.incrNumOutstanding(request.setEntryReplicaAndReturnCount(getMyID()));
this.paxosManager.incrNumOutstanding(request);
}
// slot number here does not matter
return handleProposal(request);
}
/*
* "Phase0"->Phase2a: Event: Received a proposal [request, slot] from any
* node.
*
* Action: If a non-coordinator node receives a proposal, send to the
* coordinator. Otherwise, propose it to acceptors with a good slot number
* (thereby initiating phase2a for this request).
*
* Return: A send either to a coordinator of the proposal or to all replicas
* of the proposal with a good slot number.
*/
private MessagingTask[] handleProposal(RequestPacket proposal) {
assert (proposal.getEntryReplica() != -1) : proposal;
// could be multicast to all or unicast to coordinator
MessagingTask[] mtasks = new MessagingTask[2];
RequestInstrumenter.received(proposal, proposal.getForwarderID(),
this.getMyID());
if (PaxosCoordinator.exists(this.coordinator, this.paxosState.getBallot())) {
// multicast ACCEPT to all
AcceptPacket multicastAccept = null;
proposal.addDebugInfoDeep("a");
multicastAccept = PaxosCoordinator.propose(this.coordinator,this.groupMembers,
proposal);
mtasks[0] = multicastAccept != null ? new MessagingTask(
this.groupMembers, multicastAccept) : null; // multicast
if (multicastAccept != null) {
RequestInstrumenter.sent(multicastAccept, this.getMyID(), -1);
log.log(Level.FINER,
"{0} issuing accept {1} ",
new Object[] {
this,
multicastAccept.getSummary(log
.isLoggable(Level.FINER)) });
}
} else { // else unicast to current coordinator
log.log(Level.FINER,
"{0} is not the coordinator; forwarding to {1}: {2}",
new Object[] { this, this.paxosState.getBallotCoordLog(),
proposal.getSummary(log.isLoggable(Level.FINER)) });
int coordinator = this.paxosState.getBallotCoord();
mtasks[0] = new MessagingTask(
this.paxosManager.isNodeUp(coordinator) ? coordinator
// send to next coordinator if current seems dead
: (coordinator = this.getNextCoordinator(
this.paxosState.getBallot().ballotNumber + 1,
groupMembers)), proposal.setForwarderID(this
.getMyID())); // unicast
if (proposal.isPingPonging() || coordinator==this.getMyID()) {
if (proposal.isPingPonging())
log.warning(this + " dropping ping-ponging proposal: "
+ proposal.getSummary() + " forwarded by "
+ proposal.getForwarderID());
log.log(Level.INFO,
"{0} force running for coordinator; forwardCount={1}; debugInfo = {2}; coordinator={3}",
new Object[] { this, proposal.getForwardCount(),
proposal.getDebugInfo(), coordinator });
mtasks[1] = new MessagingTask(getMyID(), mtasks[0].msgs);
mtasks[0] = this.checkRunForCoordinator(true);
} else // forwarding
proposal.addDebugInfo("f", coordinator);
}
return mtasks;
}
/*
* Phase1a Event: Received a prepare request for a ballot, i.e. that
* ballot's coordinator is acquiring proposing rights for all slot numbers
* (lowest uncommitted up to infinity)
*
* Action: This node needs to check if it has accepted a higher numbered
* ballot already and if not, it can accept this ballot, thereby promising
* not to accept any lower ballots.
*
* Return: Send prepare reply with proposal values previously accepted to
* the sender (the received ballot's coordinator).
*/
private MessagingTask handlePrepare(PreparePacket prepare) {
paxosManager.heardFrom(prepare.ballot.coordinatorID); // FD optimization
Ballot prevBallot = this.paxosState.getBallot();
PrepareReplyPacket prepareReply = this.paxosState.handlePrepare(
prepare, this.paxosManager.getMyID());
if (prepareReply == null)
return null; // can happen only if acceptor is stopped
if (prepare.isRecovery())
return null; // no need to get accepted pvalues from disk during
// recovery as networking is disabled anyway
// may also need to look into disk if ACCEPTED_PROPOSALS_ON_DISK is true
if (PaxosAcceptor.GET_ACCEPTED_PVALUES_FROM_DISK
// no need to gather pvalues if NACKing anyway
&& prepareReply.ballot.compareTo(prepare.ballot) == 0)
prepareReply.accepted.putAll(this.paxosManager.getPaxosLogger()
.getLoggedAccepts(this.getPaxosID(), this.getVersion(),
prepare.firstUndecidedSlot));
for (PValuePacket pvalue : prepareReply.accepted.values())
// if I accepted a pvalue, my acceptor ballot must reflect it
assert (this.paxosState.getBallot().compareTo(pvalue.ballot) >= 0) : this
+ ":" + pvalue;
log.log(Level.FINE,
"{0} {1} {2} with {3}",
new Object[] {
this,
prepareReply.ballot.compareTo(prepare.ballot) > 0 ? "preempting"
: "acking", prepare.ballot,
prepareReply.getSummary(log.isLoggable(Level.FINE)) });
MessagingTask mtask = prevBallot.compareTo(prepareReply.ballot) < 0 ?
// log only if not already logged (if my ballot got upgraded)
new LogMessagingTask(prepare.ballot.coordinatorID,
// ensures large prepare replies are fragmented
PrepareReplyAssembler.fragment(prepareReply), prepare)
// else just send prepareReply
: new MessagingTask(prepare.ballot.coordinatorID, PrepareReplyAssembler.fragment(prepareReply));
for (PaxosPacket pp : mtask.msgs)
assert (((PrepareReplyPacket) pp).getLengthEstimate() < NIOTransport.MAX_PAYLOAD_SIZE) : Util
.suicide(this
+ " trying to return unfragmented prepare reply of size "
+ ((PrepareReplyPacket) pp).getLengthEstimate()
+ " : " + pp.getSummary() + "; prevBallot = "
+ prevBallot);
return mtask;
}
/*
* Phase1b Event: Received a reply to my ballot preparation request.
*
* Action: If the reply contains a higher ballot, we must resign. Otherwise,
* if we acquired a majority with the receipt of this reply, send all
* previously accepted (but uncommitted) requests reported in the prepare
* replies, each in its highest reported ballot, to all replicas. These are
* the proposals that get carried over across a ballot change and must be
* re-proposed.
*
* Return: A list of messages each of which has to be multicast (proposed)
* to all replicas.
*/
private MessagingTask handlePrepareReply(PrepareReplyPacket prepareReply) {
// necessary to defragment first for safety
if ((prepareReply = PrepareReplyAssembler.processIncoming(prepareReply)) == null) {
return null;
}
this.paxosManager.heardFrom(prepareReply.acceptor); // FD optimization,
MessagingTask mtask = null;
ArrayList<ProposalPacket> preActiveProposals = null;
ArrayList<AcceptPacket> acceptList = null;
if ((preActiveProposals = PaxosCoordinator.getPreActivesIfPreempted(this.coordinator,
prepareReply, this.groupMembers)) != null) {
log.log(Level.INFO, "{0} ({1}) election PREEMPTED by {2}",
new Object[] { this, PaxosCoordinator.getBallotStr(this.coordinator),
prepareReply.ballot });
this.coordinator = null;
if (!preActiveProposals.isEmpty())
mtask = new MessagingTask(prepareReply.ballot.coordinatorID,
(preActiveProposals.toArray(new PaxosPacket[0])));
} else if ((acceptList = PaxosCoordinator.handlePrepareReply(this.coordinator,
prepareReply, this.groupMembers)) != null
&& !acceptList.isEmpty()) {
mtask = new MessagingTask(this.groupMembers,
((acceptList).toArray(new PaxosPacket[0])));
log.log(Level.INFO, "{0} elected coordinator; sending {1}",
new Object[] { this, mtask });
} else
log.log(Level.FINE, "{0} received prepare reply {1}", new Object[] { this,
prepareReply.getSummary(log.isLoggable(Level.INFO)) });
return mtask; // Could be unicast or multicast
}
/*
* Phase2a Event: Received an accept message for a proposal with some
* ballot.
*
* Action: Send back current or updated ballot to the ballot's coordinator.
*/
private static final boolean EXECUTE_UPON_ACCEPT = Config.getGlobalBoolean(PC.EXECUTE_UPON_ACCEPT);
private MessagingTask[] handleAccept(AcceptPacket accept) {
this.paxosManager.heardFrom(accept.ballot.coordinatorID); // FD
RequestInstrumenter.received(accept, accept.sender, this.getMyID());
if(Util.oneIn(10)) DelayProfiler.updateMovAvg("#batched", accept.batchSize()+1);
if ((this.paxosState.getAccept(accept.slot) == null)
&& (this.paxosState.getSlot() - accept.slot <= 0))
this.paxosManager.incrNumOutstanding(accept.addDebugInfoDeep("a")); // stats
if(EXECUTE_UPON_ACCEPT) { // only for testing
PaxosInstanceStateMachine.execute(this, getPaxosManager(), this.getApp(), accept, false);
if(Util.oneIn(10)) log.info(DelayProfiler.getStats());
//return null;
}
// have acceptor handle accept
Ballot ballot = null;
PValuePacket prev = this.paxosState.getAccept(accept.slot);
try {
ballot = !EXECUTE_UPON_ACCEPT ? this.paxosState
.acceptAndUpdateBallot(accept, this.getMyID())
: this.paxosState.getBallot();
} catch (Error e) {
log.severe(this + " : " + e.getMessage());
Util.suicide(e.getMessage());
}
if (ballot == null)
return null; // can happen only if acceptor is stopped.
this.garbageCollectAccepted(accept.getMedianCheckpointedSlot());
if (accept.isRecovery())
return null; // recovery ACCEPTS do not need any reply
AcceptReplyPacket acceptReply = new AcceptReplyPacket(this.getMyID(),
ballot, accept.slot,
lastCheckpointSlot(this.paxosState.getSlot() - 1, accept.getPaxosID()),
accept.requestID);
// no logging if NACking anyway
AcceptPacket toLog = (accept.ballot.compareTo(ballot) >= 0
// no logging if already garbage collected or previously accepted
&& accept.slot - this.paxosState.getGCSlot() > 0 && (prev == null || prev.ballot
.compareTo(accept.ballot) < 0)) ? accept : null;
MessagingTask acceptReplyTask = accept.isRecovery() ? new LogMessagingTask(
toLog) : toLog != null ? new LogMessagingTask(accept.sender,
acceptReply, toLog) : new MessagingTask(accept.sender,
acceptReply);
RequestInstrumenter.sent(acceptReply, this.getMyID(), accept.sender);
// might release some meta-commits
PValuePacket reconstructedDecision = this.paxosState
.reconstructDecision(accept.slot);
MessagingTask commitTask = reconstructedDecision != null ? this
.handleCommittedRequest(reconstructedDecision) : null;
MessagingTask[] mtasks = { acceptReplyTask, commitTask };
return mtasks;
}
/*
* We don't need to implement this. Accept logs are pruned while
* checkpointing anyway, which is enough. Worse, it is probably inefficient
* to touch the disk for GC upon every new gcSlot (potentially every accept
* and decision).
*/
private void garbageCollectAccepted(int gcSlot) {
}
/*
* Phase2b Event: Received a reply to an accept request, i.e. to a request
* to accept a proposal from the coordinator.
*
* Action: If this reply results in a majority for the corresponding
* proposal, commit the request and notify all. If this preempts a proposal
* being coordinated because it contains a higher ballot, forward to the
* preempting coordinator in the higher ballot reported.
*
* Return: The committed proposal if any to be multicast to all replicas, or
* the preempted proposal if any to be unicast to the preempting
* coordinator. Null if neither.
*/
private MessagingTask handleAcceptReply(AcceptReplyPacket acceptReply) {
this.paxosManager.heardFrom(acceptReply.acceptor); // FD optimization
RequestInstrumenter.received(acceptReply, acceptReply.acceptor,
this.getMyID());
PValuePacket committedPValue = PaxosCoordinator.handleAcceptReply(this.coordinator,
this.groupMembers, acceptReply);
if(!PaxosCoordinator.exists(this.coordinator)) this.coordinator=null;
if (committedPValue == null)
return null;
MessagingTask multicastDecision = null;
// separate variables only for code readability
MessagingTask unicastPreempted = null;
// could also call handleCommittedRequest below
if (committedPValue.getType() == PaxosPacket.PaxosPacketType.DECISION) {
committedPValue.addDebugInfo("d");
// this.handleCommittedRequest(committedPValue);
multicastDecision = new MessagingTask(this.groupMembers,
committedPValue); // inform everyone of the decision
log.log(Level.FINE,
"{0} announcing decision {1}",
new Object[] {
this,
committedPValue.getSummary(log
.isLoggable(Level.FINE)) });
if (instrument(Integer.MAX_VALUE)) {
DelayProfiler.updateCount("PAXOS_DECISIONS", 1);
DelayProfiler.updateCount("CLIENT_COMMITS",
committedPValue.batchSize() + 1);
}
} else if (committedPValue.getType() == PaxosPacket.PaxosPacketType.PREEMPTED) {
/*
* Could drop the request, but we forward the preempted proposal as
* a no-op to the new coordinator for testing purposes. The new(er)
* coordinator information is within acceptReply. Note that our
* coordinator status may still be active and it will be so until
* all of its requests have been preempted. Note also that our local
* acceptor might still think we are the coordinator. The only
* evidence of a new coordinator is in acceptReply that must have
* reported a higher ballot if we are here, hence the assert.
*
* Warning: Can not forward the preempted request as-is to the new
* coordinator as this can result in multiple executions of a
* request. Although the multiple executions will have different
* slot numbers and will not violate paxos safety, this is extremely
* undesirable for most applications.
*/
assert (committedPValue.ballot.compareTo(acceptReply.ballot) < 0) : (committedPValue
+ " >= " + acceptReply);
if (!committedPValue.isNoop() || shouldForwardNoops()) {
// forward only if not already a no-op
unicastPreempted = new MessagingTask(
acceptReply.ballot.coordinatorID, committedPValue
.makeNoop().setForwarderID(this.getMyID()));
committedPValue.addDebugInfo("f");
log.log(Level.INFO,
"{0} forwarding preempted request as no-op to node {1}:{2}",
new Object[] { this, acceptReply.ballot.coordinatorID,
committedPValue.getSummary() });
} else {
/*
* FIXME: How to ensure that all replicas decrement the
* outstanding count here? That itself needs agreement or
* per-instance state. We also can't just reset outstanding
* count coz then we will be indefinitely undercounting. More
* generally, message losses mean that the outstanding count
* will not be accurate. Maintaining it is easy either with
* per-instance state or with a queue of outstanding request
* IDs; the latter is probably better as we can simply
* periodically either drop the outstanding queue or use
* GCConcurrentHashMap for maintaining it.
*/
//this.paxosManager.decrNumOutstanding(committedPValue.batchSize()+1);
log.log(Level.WARNING,
"{0} dropping no-op preempted by coordinator {1}: {2}",
new Object[] { this, acceptReply.ballot.coordinatorID,
committedPValue.getSummary() });
}
}
if(EXECUTE_UPON_ACCEPT) return null;
return committedPValue.getType() == PaxosPacket.PaxosPacketType.DECISION ? multicastDecision
: unicastPreempted;
}
/*
* Each accept reply can generate a decision here, so we need to batch the
* resulting decisions into a single messaging task. Some of these can be
* preempted pvalues as well, so we need to sort them out too (sigh!).
* Probably need a cleaner design here.
*/
private MessagingTask[] handleBatchedAcceptReply(
BatchedAcceptReply batchedAR) {
this.paxosManager.heardFrom(batchedAR.acceptor);
ArrayList<MessagingTask> preempts = new ArrayList<MessagingTask>();
ArrayList<MessagingTask> decisions = new ArrayList<MessagingTask>();
Integer[] acceptedSlots = batchedAR.getAcceptedSlots();
// DelayProfiler.updateCount("BATCHED_ACCEPT_REPLIES", 1);
// sort out decisions from preempted proposals
for (Integer slot : acceptedSlots) {
MessagingTask mtask = this.handleAcceptReply(new AcceptReplyPacket(
batchedAR.acceptor, batchedAR.ballot, slot,
batchedAR.maxCheckpointedSlot, batchedAR));
assert (mtask == null || mtask.msgs.length == 1);
if (mtask != null)
if (((PValuePacket) mtask.msgs[0]).getType().equals(
PaxosPacket.PaxosPacketType.PREEMPTED))
preempts.add(mtask);
else if (((PValuePacket) mtask.msgs[0]).getType().equals(
PaxosPacket.PaxosPacketType.DECISION))
decisions.add(mtask);
else
assert (false);
}
// batch each of the two into single messaging task
PaxosPacket[] decisionMsgs = new PaxosPacket[decisions.size()];
PaxosPacket[] preemptsMsgs = new PaxosPacket[preempts.size()];
for (int i = 0; i < decisions.size(); i++)
decisionMsgs[i] = decisions.get(i).msgs[0];
for (int i = 0; i < preempts.size(); i++)
preemptsMsgs[i] = preempts.get(i).msgs[0];
MessagingTask decisionsMTask = new MessagingTask(this.groupMembers,
decisionMsgs);
MessagingTask preemptsMTask = new MessagingTask(this.groupMembers,
preemptsMsgs);
assert (preempts.isEmpty());
MessagingTask[] mtasks = { decisionsMTask, preemptsMTask };
return mtasks;
}
// whether to "save" a noop, i.e., an already preempted request
private static final boolean shouldForwardNoops() {
return false;
}
private static boolean BATCHED_COMMITS = Config
.getGlobalBoolean(PC.BATCHED_COMMITS);
/*
* Phase3 Event: Received notification about a committed proposal.
*
* Action: This method is responsible for executing a committed request. For
* this, it needs to call a handler implementing the PaxosInterface
* interface.
*/
private static final boolean LOG_META_DECISIONS = Config.getGlobalBoolean(PC.LOG_META_DECISIONS);
private MessagingTask handleCommittedRequest(PValuePacket committed) {
assert (committed.getPaxosID() != null);
RequestInstrumenter.received(committed, committed.ballot.coordinatorID,
this.getMyID());
if (instrument(!BATCHED_COMMITS)
&& committed.ballot.coordinatorID != this.getMyID())
DelayProfiler.updateCount("COMMITS", 1);
if (!committed.isCoalescable() && !committed.isRecovery()
&& committed.ballot.coordinatorID != getMyID())
log.log(Level.INFO, "{0} received syncd decision {1}",
new Object[] { this, committed.getSummary() });
PValuePacket correspondingAccept = null;
// log, extract from or add to acceptor, and execute the request at app
if (!committed.isRecovery())
AbstractPaxosLogger
.logDecision(
this.paxosManager.getPaxosLogger(),
// only log meta decision if we have the accept
LOG_META_DECISIONS
&& (correspondingAccept = this.paxosState
.getAccept(committed.slot)) != null
&& correspondingAccept.ballot
.compareTo(committed.ballot) >= 0 ? committed
.getMetaDecision() : committed);
MessagingTask mtask = this.extractExecuteAndCheckpoint(committed);
if (this.paxosState.getSlot() - committed.slot < 0)
log.log(Level.FINE,
"{0} expecting {1}; received out-of-order commit {2} {3}",
new Object[] { this, this.paxosState.getSlotLog(),
committed.slot,
committed.getSummary(log.isLoggable(Level.FINE)) });
return mtask;
}
private MessagingTask handleBatchedCommit(BatchedCommit batchedCommit) {
assert (BATCHED_COMMITS);
// batched commits can only come directly from the coordinator
this.paxosManager.heardFrom(batchedCommit.ballot.coordinatorID); // FD
MessagingTask mtask = null;
//if (instrument()) DelayProfiler.updateCount("META_COMMITS", 1);
for (Integer slot : batchedCommit.getCommittedSlots()) {
// check if we have the corresponding accept
PValuePacket accept = this.paxosState.getAccept(slot);
MessagingTask curTask = null;
if (accept != null && accept.ballot.equals(batchedCommit.ballot)) {
log.log(Level.FINE,
"{0} found decision for slot {1} upon receiving {2}",
new Object[] {
this,
slot,
batchedCommit.getSummary(log
.isLoggable(Level.FINE)) });
// keep overwriting mtask with the most recent non-null mtask
curTask = this
.handleCommittedRequest(new PValuePacket(accept)
.makeDecision(batchedCommit
.getMedianCheckpointedSlot()));
} else if (BATCHED_COMMITS) {
log.log(Level.FINE,
"{0} received slot {1} batched decision {2}, generating placeholder",
new Object[] {
this,
slot,
batchedCommit.getSummary(log
.isLoggable(Level.FINE)) });
// make up a placeholder decision
curTask = this
.handleCommittedRequest((PValuePacket) new PValuePacket(
batchedCommit.ballot, new ProposalPacket(slot,
new RequestPacket(0, null, false)))
.makeDecision(
batchedCommit
.getMedianCheckpointedSlot())
.putPaxosID(getPaxosID(), getVersion()));
}
if (curTask != null)
mtask = curTask;
}
return mtask;
}
private static final boolean DISABLE_SYNC_DECISIONS=Config.getGlobalBoolean(PC.DISABLE_SYNC_DECISIONS);
/*
* Typically invoked by handleCommittedRequest above. Also invoked at
* instance creation time if outOfOrderLimit low to deal with the
* progress-wise unsatisfying scenario where a paxos instance gets created
* just after other replicas have committed the first few decisions; if so,
* the newly starting replica will have no reason to suspect that anything
* is missing and may never catch up if no other decisions get committed
* (say, because the paxos instance gets stopped before any more decisions).
* It is good to prevent such scenarios (even though they don't affect
* safety), so we have shouldSync always return true at creation time i.e.,
* expected slot is 0 or 1.
*
* forceSync is used only in the beginning in the case of missedBirthing.
*/
private MessagingTask fixLongDecisionGaps(PValuePacket committed,
SyncMode syncMode) {
MessagingTask fixGapsRequest = null;
if (this.paxosState.canSync(this.paxosManager.getMinResyncDelay())
&& (this.shouldSync((committed != null ? committed.slot
: this.paxosState.getMaxCommittedSlot()), this
.getPaxosManager().getOutOfOrderLimit(), syncMode))) {
fixGapsRequest = this
.requestMissingDecisions(committed != null ? committed.ballot.coordinatorID
: this.paxosState.getBallotCoord());
if (fixGapsRequest != null) {
log.log(Level.INFO,
"{0} sending {1}; maxCommittedSlot = {2}; ",
new Object[] { this, fixGapsRequest,
this.paxosState.getMaxCommittedSlot() });
this.paxosState.justSyncd();
}
}
return fixGapsRequest;
}
private MessagingTask fixLongDecisionGaps(PValuePacket committed) {
return this.fixLongDecisionGaps(committed, SyncMode.DEFAULT_SYNC);
}
protected boolean isLongIdle() {
return this.paxosState.isLongIdle();
}
private boolean checkIfTrapped(PaxosPacket incoming, MessagingTask mtask) {
if (this.isStopped() && mtask != null) {
log.log(Level.FINE,
"{0} DROPPING message {1} trapped inside stopped instance",
new Object[] { this, incoming, mtask });
return true;
}
return false;
}
private static enum toLog {
EEC(false, 100), handlePaxosMessage(false, 100);
final boolean log;
final int sampleInt;
toLog(boolean log, int sampleInt) {
this.log = log;
this.sampleInt = sampleInt;
}
boolean log() {
return this.log && instrument(sampleInt);
}
};
/*
* The three actions--(1) extracting the next slot request from the
* acceptor, (2) having the app execute the request, and (3) checkpoint if
* needed--need to happen atomically. If the app throws an error while
* executing the request, we need to retry until successful, otherwise, the
* replicated state machine will be stuck. So, essentially, the app has to
* support atomicity or the operations have to be idempotent for correctness
* of the replicated state machine.
*
* This method is protected, not private, because it needs to be called by
* the logger after it is done logging the committed request. Having the
* logger call this method is only space-efficient design alternative.
*/
protected /*synchronized*/ MessagingTask extractExecuteAndCheckpoint(
PValuePacket loggedDecision) {
long methodEntryTime = System.currentTimeMillis();
int execCount = 0;
if (this.paxosState.isStopped())
return null;
PValuePacket inorderDecision = null;
synchronized (this) {
// extract next in-order decision
while ((inorderDecision = this.paxosState
.putAndRemoveNextExecutable(loggedDecision)) != null) {
log.log(inorderDecision.isStopRequest() ? Level.INFO
: Level.FINE, "{0} received in-order commit {1} {2}",
new Object[] { this, inorderDecision.slot,
inorderDecision.getSummary() });
String pid = this.getPaxosID();
/*
* Execute it until successful, we are *by design* stuck
* otherwise. Execution must be atomic with extraction and
* possible checkpointing below.
*/
if (!EXECUTE_UPON_ACCEPT) // used for testing
if (execute(this, this.paxosManager,
this.getApp(), inorderDecision,
inorderDecision.isRecovery()))
// +1 for each batch, not for each constituent
// requestValue
execCount++;
// unclean kill
else if (this.forceStop())
break; // this.paxosManager.kill(this, false);
updateRequestBatcher(inorderDecision, loggedDecision == null);
// getState must be atomic with the execution
if (shouldCheckpoint(inorderDecision)
&& !inorderDecision.isRecovery())
AbstractPaxosLogger
.checkpoint(
this.paxosManager.getPaxosLogger(),
inorderDecision.isStopRequest(),
pid,
this.version,
this.paxosManager
.getStringNodesFromIntArray(this.groupMembers),
inorderDecision.slot, this.paxosState
.getBallot(),
this.getApp().checkpoint(pid),
this.paxosState.getGCSlot());
/*
* If stop request, copy epoch final state and kill self. If
* copy is not successful, we could get stuck trying to create
* future versions for this paxosID.
*/
if (inorderDecision.isStopRequest()
&& this.paxosManager.getPaxosLogger()
.copyEpochFinalCheckpointState(getPaxosID(),
getVersion())
&& logStop(inorderDecision.getEntryTime()))
// this.paxosManager.kill(this, true);
break;
}
this.paxosState.assertSlotInvariant();
}
/*
* The kill has been moved out of the synchronized block above as the
* synchronizing on this is unecessary and creates a potential deadlock
* with scenarios like pause where paxosManger is first locked and then
* this instance's acceptor is locked if in the future we make the
* PaxosAcceptor inherit from PaxosInstanceStateMachine.
*/
if (this.isStopped())
this.paxosManager.kill(this, true);
if (loggedDecision != null && !loggedDecision.isRecovery())
instrumentDelay(toLog.EEC, methodEntryTime, execCount);
return loggedDecision != null && !loggedDecision.isRecovery() ? this
.fixLongDecisionGaps(loggedDecision) : null;
}
private void updateRequestBatcher(PValuePacket inorderDecision,
boolean handledCP) {
/*
* Use entry time only if I am entry replica so that we don't have to
* worry about clock synchronization; only if not under recovery; and
* only if the decision was received directly as opposed to via
* handleCheckpoint.
*
* FIXME: should probably exclude all sync decision responses, not just
* immediately after handleCheckpoint.
*/
if (inorderDecision.getEntryReplica() == getMyID()
&& !inorderDecision.isRecovery() && !handledCP) {
assert(inorderDecision.getEntryTime() <= System.currentTimeMillis()) : inorderDecision.getEntryTime();
RequestBatcher.updateSleepDuration(inorderDecision.getEntryTime());
}
}
/**
* Helper method used above in EEC as well as by PaxosManager for emulating
* unreplicated execution for testing purposes.
*
* protected only so that PaxosManager can call this directly to test
* emulateUnreplicated mode.
*/
protected static boolean execute(PaxosInstanceStateMachine pism,
PaxosManager<?> paxosManager, Replicable app,
RequestPacket decision, boolean doNotReplyToClient) {
int myEntries = 0;
for (RequestPacket requestPacket : decision.getRequestPackets()) {
boolean executed = false;
int retries = 0;
do {
try {
/*
* Note: The conversion below is an important reason for
* paxos applications to use RequestPacket as opposed to
* propose(String requestValue,...). Otherwise, we have to
* unnecessarily encapsulate the string first in a
* RequestPacket in PaxosManager and then convert the string
* back to InterfaceRequest using the app's getRequest
* method.
*/
Request request =
// don't convert to and from string unnecessarily
!requestPacket.shouldReturnRequestValue() ? requestPacket
// ask app to translate string to InterfaceRequest
: getInterfaceRequest(app,
requestPacket.getRequestValue());
log.log(Level.FINE,
"{0} executing (in-order) decision {1}",
new Object[] {
pism,
PaxosManager.getLogger().isLoggable(
Level.FINE) ? (request instanceof SummarizableRequest ?
((SummarizableRequest) request)
.getSummary() : requestPacket
.getSummary())
: null });
if (!((decision instanceof PValuePacket) && ((PValuePacket) decision)
.isRecovery())
&& instrument(4 * getCPI(
paxosManager.getInterCheckpointInterval(),
decision.getPaxosID())))
log.log(Level.INFO, "{0}",
new Object[] { DelayProfiler.getStats() });
executed = app
.execute(
request,
// do not reply if recovery or not entry replica
(doNotReplyToClient
|| (requestPacket.getEntryReplica() != paxosManager
.getMyID())));
paxosManager.executed(requestPacket);
assert (requestPacket.getEntryReplica() > 0) : requestPacket;
if(requestPacket.getEntryReplica()==paxosManager.getMyID()) myEntries++;
if (requestPacket.getEntryReplica() == paxosManager
.getMyID()
&& !doNotReplyToClient
// can be null if app returns null
&& request != null
&& request instanceof ClientRequest) {
RequestInstrumenter.remove(requestPacket.requestID);
ClientRequest clientRequest = ((ClientRequest) request);
ClientRequest response = clientRequest
.getResponse();
if (clientRequest.getClientAddress() != null
&& response != null) {
paxosManager.send(clientRequest.getClientAddress(),
response);
}
}
// don't try any more if stopped
if (pism != null && pism.isStopped())
return true;
} catch (Exception e) {
// must swallow any and all exceptions
e.printStackTrace();
}
if (!executed)
log.severe("App failed to execute request, retrying: "
+ decision.requestValue);
/*
* We have to keep trying to execute until executed to preserve
* safety. We have removed the decision from the acceptor and
* there is no going back on that by design (as we assume that
* invariant at many places). One option here is to kill this
* paxos instance after a limited number of retries. The benefit
* of doing that is that we can free up this thread. But it is
* better to not delete the state on disk just yet as kill()
* would do by default.
*/
if (++retries > RETRY_LIMIT)
return false;
} while (!executed && waitRetry(RETRY_TIMEOUT));
}
// decrease outstanding count double counting myEntry requests
if (!doNotReplyToClient)
paxosManager
.decrNumOutstanding(decision.batchSize() + 1 + myEntries);
return true;
}
// Like EEC but invoked upon checkpoint transfer
private synchronized MessagingTask handleCheckpoint(StatePacket statePacket) {
if (statePacket.slotNumber >= this.paxosState.getSlot()) {
// put checkpoint in app (like execute)
if (!this.getApp().restore(getPaxosID(),
statePacket.state))
return null;
// update acceptor (like extract)
this.paxosState.jumpSlot(statePacket.slotNumber + 1);
// put checkpoint in logger (like checkpoint)
AbstractPaxosLogger.checkpoint(
this.paxosManager.getPaxosLogger(),
statePacket.slotNumber==0,
this.getPaxosID(), this.version,
this.paxosManager.getStringNodesFromIntArray(groupMembers),
statePacket.slotNumber, statePacket.ballot,
// could also just use statePacket.state here
this.getApp().checkpoint(getPaxosID()),
this.paxosState.getGCSlot());
/*
* A transferred checkpoint is almost definitely not a final
* checkpoint as final checkpoints are ephemeral. Even if it is a
* final checkpoint, safety is maintained. Just that this replica
* may not know that this paxos instance is stopped.
*/
log.log(statePacket.slotNumber > 0 ? Level.INFO : Level.FINE,
"{0} inserted {1} checkpoint through handleCheckpoint; next slot = {2}",
new Object[] { this,
statePacket.slotNumber == 0 ? "initial state" : "",
this.paxosState.getSlotLog() });
}
// coz otherwise we can get stuck as assertSlotInvariant() may not hold
return extractExecuteAndCheckpoint(null);
}
/*
* This method is called by PaxosManager.hibernate that blocks on the
* checkpoint operation to finish (unlike regular checkpoints that are
* asynchronously handled by a helper thread). But hibernate is currently
* not really used as pause suffices. And PaxosManager methods are likely
* called by an executor task anyway, so blocking should be harmless.
*/
protected synchronized boolean tryForcedCheckpointAndStop() {
boolean checkpointed = false;
// Ugly nesting, not sure how else to do this correctly
synchronized (this.paxosState) {
synchronized (this.coordinator!=null ? this.coordinator : this.paxosState) {
int cpSlot = this.paxosState.getSlot() - 1;
if (this.paxosState.caughtUp() && PaxosCoordinator.caughtUp(this.coordinator)) {
String pid = this.getPaxosID();
AbstractPaxosLogger.checkpoint(this.paxosManager
.getPaxosLogger(), true,
pid,
this.getVersion(),
this.paxosManager
.getStringNodesFromIntArray(this.groupMembers),
cpSlot, this.paxosState.getBallot(),
this.getApp().checkpoint(pid),
this.paxosState.getGCSlot());
checkpointed = true;
log.log(Level.INFO,
"{0} forcing checkpoint at slot {1}; garbage collected "
+ "accepts up to slot {2}; max_committed_slot = {3} {4}",
new Object[] {
this,
cpSlot,
this.paxosState.getGCSlot(),
this.paxosState.getMaxCommittedSlot(),
(this.paxosState.getBallotCoordLog() == this
.getMyID() ? "; maxCommittedFrontier="
+ PaxosCoordinator
.getMajorityCommittedSlot(this.coordinator)
: "") });
this.forceStop();
}
}
}
return checkpointed;
}
/*
* Needs to be synchronized so that extractExecuteAndCheckpoint does not
* happen concurrently. Likewise handleCheckpoint.
*/
protected synchronized boolean forceCheckpoint() {
String pid = this.getPaxosID();
int cpSlot = this.paxosState.getSlot() - 1;
AbstractPaxosLogger.checkpoint(this.paxosManager.getPaxosLogger(), true,
pid,
this.getVersion(),
this.paxosManager
.getStringNodesFromIntArray(this.groupMembers),
cpSlot, this.paxosState.getBallot(),
this.getApp().checkpoint(pid),
this.paxosState.getGCSlot());
// need to acquire these without locking
int gcSlot = this.paxosState.getGCSlot();
int maxCommittedSlot = this.paxosState.getMaxCommittedSlot();
String maxCommittedFrontier = (this.paxosState.getBallotCoordLog() == this
.getMyID() ? "; maxCommittedFrontier="
+ PaxosCoordinator.getMajorityCommittedSlot(this.coordinator) : "");
log.log(Level.INFO,
"{0} forcing checkpoint at slot {1}; garbage collected accepts up to slot {2}; max committed slot = {3} {4}",
new Object[] { this, cpSlot, gcSlot, maxCommittedSlot,
maxCommittedFrontier });
return true;
}
/*
* A note on locking: The PaxosManager lock is typically the first to get
* acquired if it ever appears in a chain of locks with one exception as
* noted in the invariants below.
*
* Invariants: There must be no lock chain
*
* !!! PaxosManager -> PaxosInstanceStateMachine
*
* because there is *by design* a lock chain
*
* --> PaxosInstanceStateMachine -> PaxosManager
*
* when this instance is being stopped.
*
* There must be no lock chains as follows (an invariant is easy to adhere
* to or rather impossible to violate by design because acceptor and
* coordinator are unaware of and have no references to PaxosManager):
*
* !!! nothing -> PaxosAcceptor -> PaxosManager
*
* !!! nothing -> PaxosCoordinator -> PaxosManager
*
* because there are lock chains of the form
*
* --> PaxosManager -> PaxosAcceptor or PaxosCoordinator
*/
/*
* Same as tryForcedCheckpointAndStop but without the checkpoint.
*
* Why this method is not synchronized: when this paxos instance is
* executing a request that takes a long time, this method might
* concurrently try to pause it and even succeed (!), say, because the
* decision being executed has been extracted and the acceptor looks all
* nicely caught up. Is this a problem? The forceStop in this method will
* stop the acceptor, but the thread executing EEC will go ahead and
* complete the execution and even checkpoint and kill if it is a stop
* request. The fact that the acceptor is in a stopped state won't matter
* for the current decision being executed. After that, the loop in EEC will
* break and return, so no harm done. When this instance gets eventually
* unpaused, it would seem exactly like just after having executed that last
* decision, so no harm done.
*
* Conversely, this method might lock paxosState first and then EEC might
* get invoked. If so, the program counter could enter the synchronized EEC
* method but will block on paxosState.isStopped until this tryPause method
* finishes. If tryPuase is unsuccessful, nothing has changed, so no harm
* done. Else if tryPause successfully pauses, isStopped will return true
* and EEC will become a noop, so no harm done.
*
* Note: If we make this method synchronized, the deactivator thread could
* be blocked on this instance for a long time.
*/
protected HotRestoreInfo tryPause() {
//boolean paused = false;
HotRestoreInfo hri = null;
synchronized (this.paxosState) {
// Ugly nesting, not sure how else to do this correctly
synchronized (this.coordinator !=null ? this.coordinator : this.paxosState) {
if (this.paxosState.caughtUp() && PaxosCoordinator.caughtUp(this.coordinator)) {
hri = new HotRestoreInfo(this.getPaxosID(),
this.getVersion(), this.groupMembers,
this.paxosState.getSlot(),
this.paxosState.getBallot(),
this.paxosState.getGCSlot(),
PaxosCoordinator.getBallot(this.coordinator),
PaxosCoordinator.getNextProposalSlot(this.coordinator),
PaxosCoordinator.getNodeSlots(this.coordinator));
log.log(Level.FINE, "{0} pausing [{1}]", new Object[] {
this, hri });
//if (paused = this.paxosManager.getPaxosLogger().pause(
// getPaxosID(), hri.toString()))
this.forceStop();
} else
log.log(Level.FINE,
"{0} not pausing because it is not caught up: {1} {2}",
new Object[] { this, this.paxosState,
this.coordinator });
}
}
return hri;
}
private boolean shouldCheckpoint(PValuePacket decision) {
return (decision.slot
% getCPI(
this.paxosManager.getInterCheckpointInterval(),
decision.getPaxosID()) == 0 || decision.isStopRequest());
}
private static Request getInterfaceRequest(
Replicable app, String value) {
try {
return app.getRequest(value);
} catch (RequestParseException e) {
e.printStackTrace();
}
return null;
}
/*************************** End of phase 3 methods ********************************/
/********************** Start of failure detection and recovery methods *****************/
/*
* FIXED: If a majority miss a prepare, the coordinator may never get
* elected as follows. The minority of acceptors who did receive the prepare
* will assume the prepare's sender as the current coordinator. The rest
* might still think the previous coordinator is the current coordinator.
* All acceptors could be thinking that their up, so nobody will bother
* running for coordinator. To break this impasse, we need to resend the
* prepare. This has been now incorporated in the handleMessage that quickly
* checks upon every message if we need to "(re)run for coordinator" (for
* the same ballot) if we have been waiting for too long (having neither
* received a prepare majority nor a preemption) for the ballot to complete.
*/
/*
* Checks whether current ballot coordinator is alive. If not, it checks if
* it should try to be the nest coordinator and if so, it becomes the next
* coordinator. This method can be called any time safely by any thread.
*/
private MessagingTask checkRunForCoordinator() {
return this.checkRunForCoordinator(false);
}
private MessagingTask checkRunForCoordinator(boolean forceRun) {
Ballot curBallot = this.paxosState.getBallot();
MessagingTask multicastPrepare = null;
boolean lastCoordinatorLongDead = this.paxosManager
.lastCoordinatorLongDead(curBallot.coordinatorID);
//if(Util.oneIn(20)) log.info(this + " node " + curBallot.coordinatorID + " lastCoordinatorLongDead = " + lastCoordinatorLongDead);
/*
* curBallot is my acceptor's ballot; "my acceptor's coordinator" is
* that ballot's coordinator.
*
* If I am not already a coordinator with a ballot at least as high as
* my acceptor's ballot's coordinator
*
* AND
*
* I didn't run too recently
*
* AND
*
* (I am my acceptor's coordinator OR (my acceptor's coordinator is dead
* AND (I am next in line OR the current coordinator has been dead for a
* really long time)))
*
* OR forceRun
*/
if ((
/*
* I am not already a coordinator with a ballot at least as high as my
* acceptor's ballot's coordinator && I didn't run too recently
*/
!PaxosCoordinator.exists(this.coordinator, curBallot) && !PaxosCoordinator.ranRecently(this.coordinator) &&
// I am my acceptor's coordinator (can happen during recovery)
(curBallot.coordinatorID == this.getMyID() ||
// my acceptor's coordinator is dead
(!this.paxosManager.isNodeUp(curBallot.coordinatorID) &&
// I am next in line
(this.getMyID() == getNextCoordinator(curBallot.ballotNumber + 1,
this.groupMembers) ||
// current coordinator has been long dead
lastCoordinatorLongDead))))
|| forceRun) {
/*
* We normally round-robin across nodes for electing coordinators,
* e.g., node 7 will try to become coordinator in ballotnum such
* that ballotnum%7==0 if it suspects that the current coordinator
* is dead. But it is more robust to check if it has been a long
* time since we heard anything from the current coordinator and if
* so, try to become a coordinator ourself even though it is not our
* turn. Otherwise, weird partitions can result in loss of liveness,
* e.g., the next-in-line coordinator thinks the current coordinator
* is up but most everyone else thinks the current coordinator is
* down. Or the next-in-line coordinator itself could be dead. The
* downside of this lastCoordinatorLongDead check is that many nodes
* might near simultaneously try to become coordinator with no one
* succeeding for a while, but this is unlikely to be a problem if
* we rely on the deterministic round-robin rule in the common case
* and rely on the lasCoordinatorLongDead with a longer timeout
* (much longer than the typical node failure detection timeout).
*/
// to avoid invoking synchronized method inside log
log.log(Level.INFO,
"{0} running for coordinator as node {1} {2}",
new Object[] {
this,
curBallot.coordinatorID,
(curBallot.coordinatorID != this.getMyID() ? " seems dead (last pinged "
+ (this.paxosManager
.getDeadTime(curBallot.coordinatorID) / 1000)
+ " secs back)"
: " has not yet initialized its coordinator") });
Ballot newBallot = new Ballot(curBallot.ballotNumber + 1,
this.getMyID());
if ((this.coordinator = PaxosCoordinator.makeCoordinator(this.coordinator, newBallot.ballotNumber,
newBallot.coordinatorID, this.groupMembers,
this.paxosState.getSlot(), false)) != null) {
multicastPrepare = new MessagingTask(this.groupMembers,
new PreparePacket(newBallot, this.paxosState.getSlot()));
}
} else if (PaxosCoordinator.waitingTooLong(this.coordinator)) {
assert (!PaxosCoordinator.waitingTooLong(this.coordinator)) : this + " "
+ this.coordinator;
log.log(Level.WARNING,
"{0} resending timed out PREPARE {1}; "
+ "this is only needed under high congestion or reconfigurations",
new Object[] { this, PaxosCoordinator.getBallot(this.coordinator) });
Ballot newBallot = PaxosCoordinator.remakeCoordinator(this.coordinator, groupMembers);
if (newBallot != null) {
multicastPrepare = new MessagingTask(this.groupMembers,
new PreparePacket(newBallot, this.paxosState.getSlot()));
}
} else if (!this.paxosManager.isNodeUp(curBallot.coordinatorID)
&& !PaxosCoordinator.exists(this.coordinator,curBallot)) // not my job
log.log(Level.FINE,
"{0} thinks current coordinator {1} is {2} dead, the next-in-line is {3}{4}",
new Object[] {
this,
curBallot.coordinatorID,
(lastCoordinatorLongDead ? "*long*" : ""),
getNextCoordinator(curBallot.ballotNumber + 1,
this.groupMembers),
(PaxosCoordinator.ranRecently(this.coordinator) ? ", and I ran too recently to try again"
: "") });
return multicastPrepare;
}
private String getBallots() {
return "[C:("
+ (this.coordinator != null ? this.coordinator.getBallotStr()
: "null")
+ "), A:("
+ (this.paxosState != null ? this.paxosState.getBallotSlot()
: "null") + ")]";
}
private String getNodeState() {
return "Node" + this.getNodeID() + ":" + this.getPaxosIDVersion() + ":"
+ this.getBallots();
}
/*
* Computes the next coordinator as the node with the smallest ID that is
* still up. We could plug in any deterministic policy here. But this policy
* should somehow take into account whether nodes are up or down. Otherwise,
* paxos will be stuck if both the current and the next-in-line coordinator
* are both dead.
*
* It is important to choose the coordinator in a deterministic way when
* recovering, e.g., the lowest numbered node. Otherwise different nodes may
* have different impressions of who the coordinator is with unreliable
* failure detectors, but no one other than the current coordinator may
* actually ever run for coordinator. E.g., with three nodes 100, 101, 102,
* if 102 thinks 101 is the coordinator, and the other two start by assuming
* 100 is the coordinator, then 102's accept replies will keep preempting
* 100's accepts but 101 may never run for coordinator as it has no reason
* to think there is any problem with 100.
*/
private int getNextCoordinator(int ballotnum, int[] members,
boolean recovery) {
for (int i = 1; i < members.length; i++)
assert (members[i - 1] < members[i]);
assert(!recovery);
return roundRobinCoordinator(ballotnum);
}
private int getNextCoordinator(int ballotnum, int[] members) {
return this.getNextCoordinator(ballotnum, members, false);
}
private int roundRobinCoordinator(int ballotnum) {
return roundRobinCoordinator(getPaxosID(), this.groupMembers, ballotnum);
}
protected static int roundRobinCoordinator(String paxosID, int[] members, int ballotnum) {
// to load balance coordinatorship across groups
int randomOffset = paxosID.hashCode();
return members[(Math.abs(ballotnum + randomOffset))% members.length];
}
/*
* FIXED: If a majority miss an accept, but any messages are still being
* received at all, then the loss will eventually get fixed by a check
* similar to checkRunForCoordinator that upon receipt of every message will
* poke the local coordinator to recommander the next-in-line accept if the
* accept has been waiting for too long (for a majority or preemption). Both
* the prepare and accept waiting checks are quick O(1) operations.
*/
private MessagingTask pokeLocalCoordinator() {
AcceptPacket accept = PaxosCoordinator
.reissueAcceptIfWaitingTooLong(this.coordinator, this.paxosState.getSlot());
if (accept != null)
log.log(Level.INFO, "{0} resending timed out ACCEPT {1}",
new Object[] { this, accept.getSummary() });
else
log.log(Level.FINEST, "{0} coordinator {1} is good for now",
new Object[] { this, this.coordinator });
MessagingTask reAccept = (accept != null ? new MessagingTask(
this.groupMembers, accept) : null);
return reAccept;
}
private boolean logStop(long createTime) {
if (instrument())
DelayProfiler.updateDelay("stopCoordinationTime", createTime);
log.log(Level.INFO, "{0} >>>>STOPPED||||||||||", new Object[] { this });
return true;
}
/*
* Event: Received or locally generated a sync request. Action: Send a sync
* reply containing missing committed requests to the requester. If the
* requester is myself, multicast to all.
*/
private MessagingTask requestMissingDecisions(int coordinatorID) {
ArrayList<Integer> missingSlotNumbers = this.paxosState
.getMissingCommittedSlots(this.paxosManager
.getMaxSyncDecisionsGap());
// initially we might want to send an empty sync request
if (missingSlotNumbers == null)
return null; // if stopped
else if (missingSlotNumbers.isEmpty())
missingSlotNumbers.add(this.paxosState.getSlot());
int maxDecision = this.paxosState.getMaxCommittedSlot();
SyncDecisionsPacket srp = new SyncDecisionsPacket(this.getMyID(),
maxDecision, missingSlotNumbers, this.isMissingTooMuch());
int requestee = COORD_DONT_LOG_DECISIONS ? randomNonCoordOther(coordinatorID)
: randomOther();
// send sync request to coordinator or random other node
MessagingTask mtask = requestee != this.getMyID() ? new MessagingTask(
requestee, srp) : null;
// new MessagingTask(otherGroupMembers(), srp);
return mtask;
}
private static final boolean COORD_DONT_LOG_DECISIONS = Config
.getGlobalBoolean(PC.COORD_DONT_LOG_DECISIONS);
/*
* We normally sync decisions if the gap between the maximum decision slot
* and the expected slot is at least as high as the threshold. But we also
* sync in the beginning when the expected slot is 0 (if we disable null
* checkpoints) or 1 and there is either a nonzero gap or simply if the
* threshold is 1. The initial nonzero gap is an understandable
* optimization. But we also sync in the special case when the threshold is
* low and this paxos instance has just gotten created (even when there is
* no gap) because it is possible that other replicas have committed
* decisions that I don't even know have happened. This optimizaiton is not
* necessary for safety, but it is useful for liveness especially in the
* case when an epoch start (in reconfiguration) is not considered complete
* until all replicas have committed the first decision (as in the special
* case of reconfigurator node reconfigurations).
*/
private static final int INITIAL_SYNC_THRESHOLD = 1;
private boolean shouldSync(int maxDecisionSlot, int threshold,
SyncMode syncMode) {
if(DISABLE_SYNC_DECISIONS) return false;
int expectedSlot = this.paxosState.getSlot();
boolean nonzeroGap = maxDecisionSlot - expectedSlot > 0;
boolean smallGapThreshold = threshold <= INITIAL_SYNC_THRESHOLD;
return
// typical legitimate sync criterion
(maxDecisionSlot - expectedSlot >= threshold)
// sync decisions initially if nonzer gap or small threshold
|| ((expectedSlot == 0 || expectedSlot == 1) && (nonzeroGap || smallGapThreshold))
// non-zero gap and syncMode is SYNC_IF_NONZERO_GAP
|| (nonzeroGap && SyncMode.SYNC_TO_PAUSE.equals(syncMode))
// force sync
|| SyncMode.FORCE_SYNC.equals(syncMode);
}
private boolean shouldSync(int maxDecisionSlot, int threshold) {
return shouldSync(maxDecisionSlot, threshold, SyncMode.DEFAULT_SYNC);
}
private boolean isMissingTooMuch() {
return this.shouldSync(this.paxosState.getMaxCommittedSlot(),
this.paxosManager.getMaxSyncDecisionsGap());
}
// point here is really to request initial state
protected MessagingTask requestZerothMissingDecision() {
ArrayList<Integer> missingSlotNumbers = new ArrayList<Integer>();
missingSlotNumbers.add(0);
SyncDecisionsPacket srp = new SyncDecisionsPacket(this.getMyID(), 1,
missingSlotNumbers, true);
log.log(Level.INFO, "{0} requesting missing zeroth checkpoint",
new Object[] { this, });
// send sync request to coordinator or multicast to others if I am
// coordinator
MessagingTask mtask = this.paxosState.getBallotCoord() != this
.getMyID() ? new MessagingTask(
this.paxosState.getBallotCoord(), srp) : new MessagingTask(
otherGroupMembers(), srp);
return mtask;
}
// Utility method to get members except myself
protected int[] otherGroupMembers() {
int[] others = new int[this.groupMembers.length - 1];
int j = 0;
for (int i = 0; i < this.groupMembers.length; i++) {
if (this.groupMembers[i] != this.getMyID())
others[j++] = this.groupMembers[i];
}
return others;
}
// random member other than coordinator and self
private int randomNonCoordOther(int coordinator) {
if (this.groupMembers.length == 1)
return this.getMyID(); // no other
if (this.groupMembers.length == 2 && getMyID() != coordinator)
return coordinator; // no other option
// else other exists
int retval = coordinator;
// need at least 3 members for this loop to make sense
while ((retval == getMyID() || retval == coordinator))
retval = this.groupMembers[(int) (Math.random() * this.groupMembers.length)];
return retval;
}
private int randomOther() {
if (this.groupMembers.length == 1)
return this.getMyID(); // no other
int retval = getMyID();
// need at least 2 members for this loop to make sense
while (retval == getMyID() && this.groupMembers.length > 1)
retval = this.groupMembers[(int) (Math.random() * this.groupMembers.length)];
return retval;
}
/*
* Event: Received a sync reply packet with a list of missing committed
* requests Action: Send back all missing committed requests from the log to
* the sender (replier).
*
* We could try to send some from acceptor memory instead of the log, but in
* general, it is not worth the effort. Furthermore, if the sync gap is too
* much, do a checkpoint transfer.
*/
private MessagingTask handleSyncDecisionsPacket(
SyncDecisionsPacket syncReply) throws JSONException {
int minMissingSlot = syncReply.missingSlotNumbers.get(0);
log.log(Level.FINE,
"{0} handling sync decisions request {1} when maxCommittedSlot = {2}",
new Object[] { this, syncReply.getSummary(),
this.paxosState.getMaxCommittedSlot() });
if (this.paxosState.getMaxCommittedSlot() - minMissingSlot < 0)
return null; // I am worse than you
// get checkpoint if minMissingSlot > last checkpointed slot
MessagingTask checkpoint = null;
if (minMissingSlot - lastCheckpointSlot(this.paxosState.getSlot(), syncReply.getPaxosID()) <= 0) {
checkpoint = handleCheckpointRequest(syncReply);
if (checkpoint != null)
// only get decisions beyond checkpoint
minMissingSlot = ((StatePacket) (checkpoint.msgs[0])).slotNumber + 1;
}
// try to get decisions from memory first
HashMap<Integer, PValuePacket> missingDecisionsMap = new HashMap<Integer, PValuePacket>();
for (PValuePacket pvalue : this.paxosState
.getCommitted(syncReply.missingSlotNumbers))
missingDecisionsMap.put(pvalue.slot, pvalue.setNoCoalesce());
// get decisions from database as unlikely to have all of them in memory
ArrayList<PValuePacket> missingDecisions = this.paxosManager
.getPaxosLogger()
.getLoggedDecisions(
this.getPaxosID(),
this.getVersion(),
minMissingSlot,
/*
* If maxDecision <= minMissingSlot, sender is probably
* doing a creation sync. But we need min < max for the
* database query to return nonzero results, so we
* adjust up the max if needed. Note that
* getMaxCommittedSlot() at this node may not be greater
* than minMissingDecision either. For example, the
* sender may be all caught up at slot 0 and request a
* creation sync for 1 and this node may have committed
* up to 1; if so, it should return decision 1.
*/
syncReply.maxDecisionSlot > minMissingSlot ? syncReply.maxDecisionSlot
: Math.max(
minMissingSlot + 1,
this.paxosState.getMaxCommittedSlot() + 1));
// filter non-missing from database decisions
if(syncReply.maxDecisionSlot > minMissingSlot)
for (Iterator<PValuePacket> pvalueIterator = missingDecisions
.iterator(); pvalueIterator.hasNext();) {
PValuePacket pvalue = pvalueIterator.next();
if (!syncReply.missingSlotNumbers.contains(pvalue.slot))
pvalueIterator.remove(); // filter non-missing
else
pvalue.setNoCoalesce(); // send as-is, no compacting
// isRecovery() true only in rollForward
assert (!pvalue.isRecovery());
}
// copy over database decisions not in memory
for (PValuePacket pvalue : missingDecisions)
if (!missingDecisionsMap.containsKey(pvalue.slot))
missingDecisionsMap.put(pvalue.slot, pvalue);
// replace meta decisions with actual decisions
getActualDecisions(missingDecisionsMap);
assert(missingDecisionsMap.isEmpty() || missingDecisionsMap.values()
.toArray(new PaxosPacket[0]).length > 0) : missingDecisions;
for (PValuePacket pvalue : missingDecisionsMap.values()) {
pvalue.setNoCoalesce();
assert (pvalue.hasRequestValue());
}
// the list of missing decisions to be sent
MessagingTask unicasts = missingDecisionsMap.isEmpty() ? null
: new MessagingTask(syncReply.nodeID,
(missingDecisionsMap.values()
.toArray(new PaxosPacket[0])));
log.log(Level.INFO,
"{0} sending {1} missing decision(s) to node {2} in response to {3}",
new Object[] { this,
unicasts == null ? 0 : unicasts.msgs.length,
syncReply.nodeID, syncReply.getSummary() });
if (checkpoint != null)
log.log(Level.INFO,
"{0} sending checkpoint for slot {1} to node {2} in response to {3}",
new Object[] { this, minMissingSlot - 1, syncReply.nodeID,
syncReply.getSummary() });
// combine checkpoint and missing decisions in unicasts
MessagingTask mtask =
// both nonempty => combine
(checkpoint != null && unicasts != null && !checkpoint.isEmpty() && !unicasts
.isEmpty()) ? mtask = new MessagingTask(syncReply.nodeID,
MessagingTask
.toPaxosPacketArray(checkpoint.msgs, unicasts.msgs)) :
// nonempty checkpoint
(checkpoint != null && !checkpoint.isEmpty()) ? checkpoint :
// unicasts (possibly also empty or null)
unicasts;
log.log(Level.FINE, "{0} sending mtask: ", new Object[] { this, mtask });
return mtask;
}
/* We reconstruct decisions from logged accepts. This is safe because
* we only log a decision with a meta request value when we already
* have previously accepted the corresponding accept.
*/
private void getActualDecisions(HashMap<Integer, PValuePacket> missing) {
if(missing.isEmpty()) return;
Integer minSlot = null, maxSlot = null;
// find meta value commits
for (Integer slot : missing.keySet()) {
if (missing.get(slot).isMetaValue()) {
if(minSlot==null) minSlot = (maxSlot = slot);
if(slot - minSlot < 0) minSlot = slot;
if(slot - maxSlot > 0) maxSlot = slot;
}
}
if (minSlot == null
|| (minSlot - this.paxosState.getMaxAcceptedSlot() > 0))
return; // nothing to do
// get logged accepts for meta commit slots
Map<Integer, PValuePacket> accepts = this.paxosManager.getPaxosLogger()
.getLoggedAccepts(this.getPaxosID(), this.getVersion(),
minSlot, maxSlot + 1);
// reconstruct decision from accept
for (PValuePacket pvalue : accepts.values())
if (missing.containsKey(pvalue.slot)
&& missing.get(pvalue.slot).isMetaValue())
missing.put(pvalue.slot,
pvalue.makeDecision(pvalue.getMedianCheckpointedSlot()));
// remove remaining meta value decisions
for (Iterator<PValuePacket> pvalueIter = missing.values().iterator(); pvalueIter
.hasNext();) {
PValuePacket decision = pvalueIter.next();
if (decision.isMetaValue()) {
if (this.paxosState.getSlot() - decision.slot > 0)
log.log(Level.INFO,
"{0} has no body for executed meta-decision {1}",
new Object[] { this, decision });
pvalueIter.remove();
}
}
}
private int lastCheckpointSlot(int slot, String paxosID) {
return lastCheckpointSlot(slot,
getCPI(this.paxosManager.getInterCheckpointInterval(), this.getPaxosID()));
}
private static int lastCheckpointSlot(int slot, int checkpointInterval) {
int lcp = slot - slot % checkpointInterval;
if (lcp < 0 && ((lcp -= checkpointInterval) > 0)) // wraparound-arithmetic
lcp = lastCheckpointSlot(Integer.MAX_VALUE, checkpointInterval);
return lcp;
}
/*
* Event: Received a request for a recent checkpoint presumably from a
* replica that has recovered after a long down time. Action: Send
* checkpoint to requester.
*/
private MessagingTask handleCheckpointRequest(SyncDecisionsPacket syncReply) {
/*
* The assertion below does not mean that the state we actually get will
* be at lastCheckpointSlot() or higher because, even though getSlot()
* has gotten updated, the checkpoint to disk may not yet have finished.
* We have no way of knowing other than reading the disk. So we first do
* a read to check if the checkpointSlot is at least higher than the
* minMissingSlot in syncReply. If the state is tiny, this will double
* the state fetching overhead as we are doing two database reads.
*/
assert (syncReply.missingSlotNumbers.get(0)
- lastCheckpointSlot(this.paxosState.getSlot(), syncReply.getPaxosID()) <= 0);
int checkpointSlot = this.paxosManager.getPaxosLogger()
.getCheckpointSlot(getPaxosID());
StatePacket statePacket = (checkpointSlot >= syncReply.missingSlotNumbers
.get(0) ? StatePacket.getStatePacket(this.paxosManager
.getPaxosLogger().getSlotBallotState(this.getPaxosID())) : null);
if (statePacket != null)
log.log(Level.INFO,
"{0} sending checkpoint to node {1}: {2}",
new Object[] { this, syncReply.nodeID,
statePacket.getSummary() });
else {
String myStatus = (!PaxosCoordinator.exists(this.coordinator) ? "[acceptor]"
: PaxosCoordinator.isActive(this.coordinator) ? "[coordinator]"
: "[preactive-coordinator]");
log.info(this + myStatus + " has no state (yet) for "
+ syncReply.getSummary());
}
return statePacket != null ? new MessagingTask(syncReply.nodeID,
statePacket) : null;
}
/*************** End of failure detection and recovery methods ***************/
/************************ Start of testing and instrumentation methods *****************/
/*
* Used only to test paxos instance size. We really need a paxosManager to
* do anything real with paxos.
*/
private void testingNoRecovery() {
int initSlot = 0;
this.coordinator = null;//new PaxosCoordinator();
if (this.groupMembers[0] == this.getMyID())
this.coordinator = PaxosCoordinator.makeCoordinator(this.coordinator, 0, this.groupMembers[0], groupMembers,
initSlot, true);
this.paxosState = new PaxosAcceptor(0, this.groupMembers[0], initSlot,
null);
}
private static int CREATION_LOG_THRESHOLD = 100000;
private static int creationCount = 0;
private static void incrInstanceCount() {
creationCount++;
}
protected static void decrInstanceCount() {
creationCount--;
}
// only an approximate count for instrumentation purposes
private static int getInstanceCount() {
return creationCount;
}
private static boolean notManyInstances() {
return getInstanceCount() < CREATION_LOG_THRESHOLD;
}
protected void testingInit(int load) {
this.coordinator.testingInitCoord(load);
this.paxosState.testingInitInstance(load);
}
protected void garbageCollectDecisions(int slot) {
this.paxosState.garbageCollectDecisions(slot);
}
@Override
public boolean isPausable() {
return this.paxosState.isLongIdle();
}
protected PaxosInstanceStateMachine markActive() {
this.paxosState.justActive();
return this;
}
private static double CPI_NOISE = Config.getGlobalDouble(PC.CPI_NOISE);
private static int getCPI(int cpi, String paxosID) {
return (int) (cpi * (1 - CPI_NOISE) + (Math.abs(paxosID.hashCode()) % cpi)
* 2 * CPI_NOISE);
}
}
|
[
"[email protected]"
] | |
82360e34a43200c9c3e5d49f53ec13018ad70c06
|
214cec44c86942de3f1a522fd0a13298bd185944
|
/unit/core/unit/AUnit.java
|
431bb3caf7ab3128b2025d38aba1a39588acbed7
|
[] |
no_license
|
richardtynan/thornsec-gui
|
3875676348adfbcbcc75bd4ea1bb81d72733db16
|
0655689ca13fbca90b9f723b8661f8f4ebaeaf6d
|
refs/heads/master
| 2021-01-21T15:26:17.230960 | 2017-07-01T21:39:19 | 2017-07-01T21:39:19 | 95,389,586 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,842 |
java
|
package core.unit;
import java.util.Vector;
import core.iface.IProfile;
import core.iface.IUnit;
import core.model.NetworkModel;
public abstract class AUnit implements IUnit {
protected String server;
protected NetworkModel model;
protected String label;
protected String precondition;
protected String config;
protected String audit;
public AUnit(String label, String precondition, String config, String audit) {
this.label = label;
this.precondition = precondition;
this.config = config;
this.audit = audit;
}
public String getLabel() {
return label;
}
public Vector<IProfile> getUnits(String server, NetworkModel networkModel) {
return null;
}
public String genAudit(boolean quiet) {
String auditString = getLabel() + "=0;\n";
auditString += this.getAudit();
auditString += "if [ \"$" + getLabel() + "\" = \"1\" ] ; then\n";
if (!quiet)
auditString += "\techo pass " + getLabel() + "\n";
auditString += "\t" + "((pass++))\n";
auditString += "else\n";
if (!quiet)
auditString += "\techo fail " + getLabel() + "\n";
auditString += "\t" + "((fail++))\n";
auditString += "\t" + "fail_string=\"$fail_string\n" + getLabel() + "\"\n";
auditString += "fi ;";
return auditString;
}
public String genConfig() {
String configString = this.getAudit();
configString += "if [ \"$" + getLabel() + "\" != \"1\" ] ; then\n";
configString += "if [ \"$" + getPrecondition() + "\" = \"1\" ] ; then\n";
configString += "\t" + "echo 'fail " + getLabel() + " CONFIGURING'\n";
configString += "\t" + getConfig() + "\n";
configString += "\t" + "echo 'fail " + getLabel() + " RETESTING'\n";
configString += this.genAudit(false);
configString += "else\n";
configString += "\t" + getLabel() + "=0;\n";
configString += "\t" + "echo 'fail " + getLabel() + " PRECONDITION FAILED " + getPrecondition() + "'\n";
configString += "fi ;\n";
configString += "else\n";
configString += "\techo pass " + getLabel() + "\n";
configString += "\t" + "((pass++))\n";
configString += "fi ;\n";
return configString;
}
public String genDryRun() {
String dryrunString = this.getAudit();
dryrunString += "if [ \"$" + getLabel() + "\" != \"1\" ] ; then\n";
dryrunString += "\t" + "echo 'fail " + getLabel() + " DRYRUN'\n";
dryrunString += "\t" + "echo '" + getConfig() + "';\n";
dryrunString += this.getDryRun();
dryrunString += "\t" + "((fail++))\n";
dryrunString += "\t" + "fail_string=\"$fail_string\n" + getLabel() + "\"\n";
dryrunString += "else\n";
dryrunString += "\techo pass " + getLabel() + "\n";
dryrunString += "\t" + "((pass++))\n";
dryrunString += "fi ;\n";
return dryrunString;
}
protected abstract String getAudit();
protected abstract String getPrecondition();
protected abstract String getConfig();
protected abstract String getDryRun();
}
|
[
"[email protected]"
] | |
37e16cee1b19b74b1f6bd1e8a00ad3aedee7d9ad
|
f2787c8f7dff5b6d2c3b58d2cbf7c927afb2bfb9
|
/src/Task/ReadFile.java
|
19f8182f9fbb543ad2a0026284a833bef3135fed
|
[] |
no_license
|
lavalojan/XMLToJavaObject
|
dd43b79a7c5712c176188d9f2c2a2b175637e1d4
|
233db0af0486406ff85692f51183af14f5716b50
|
refs/heads/master
| 2021-01-01T04:09:10.949130 | 2017-07-24T14:51:05 | 2017-07-24T14:51:05 | 97,132,837 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,048 |
java
|
package Task;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
public class ReadFile {
private String xmlFile;
// private String inputFile;
private ArrayList<HashMap> hashmap;
private String msgFile;
private String msgId;
private String inputFile;
private String selectedLine;
public void setLine(String selectedLine) {
this.selectedLine = selectedLine;
}
public void setMsgId(String file) {
this.msgFile = "files/"+file;
}
public void setXmlFile(String file) {
this.xmlFile = "files/"+file;
}
public void setInputFile(String file) {
this.inputFile = file;
}
public HashMap<String, String> covertToObject() throws JAXBException {
HashMap<String, String> hm2 = new HashMap<String, String>();
try {
File file = new File(xmlFile);
JAXBContext jaxbContext = JAXBContext.newInstance(Msgs.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
Msgs msgs = (Msgs) jaxbUnmarshaller.unmarshal(file);
File file2 = new File(msgFile);
JAXBContext jaxbContext2 = JAXBContext.newInstance(RdConfig.class);
Unmarshaller jaxbUnmarshaller2 = jaxbContext2.createUnmarshaller();
RdConfig rdConfig = (RdConfig) jaxbUnmarshaller2.unmarshal(file2);
this.msgId = rdConfig.getMsgIdforMatchingStr(selectedLine);
List<Msg> listmsg = msgs.getmsg();
if (msgId != "") {
for (Msg m : listmsg) {
List<Element> list = m.getelements().get(0).getElement();
if (msgId.equals(m.getId())) {
for (Element e : list) {
try {
hm2.put(" " + e.getelname(),
selectedLine.substring(Integer.parseInt(e.getstpos()), e.getenmsg()));
} catch (Exception err) {
System.out.println(err);
}
}
}
}
}
} catch (Exception err) {
System.err.println(err);
}
// System.out.println();
return hm2;
}
// public ArrayList<HashMap> createhashmap() throws JAXBException,
// NumberFormatException, IOException {
// ArrayList<HashMap> hashmap = new ArrayList<HashMap>();
// ArrayList<String> error = new ArrayList<String>();
//
// try {
// File file = new File(xmlFile);
// JAXBContext jaxbContext = JAXBContext.newInstance(Msgs.class);
// Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
// Msgs msgs = (Msgs) jaxbUnmarshaller.unmarshal(file);
//
// File file2 = new File(msgFile);
// JAXBContext jaxbContext2 = JAXBContext.newInstance(RdConfig.class);
// Unmarshaller jaxbUnmarshaller2 = jaxbContext2.createUnmarshaller();
// RdConfig rdConfig = (RdConfig) jaxbUnmarshaller2.unmarshal(file2);
// // Main main=new Main();
// FileReader fr = new FileReader(inputFile);
// BufferedReader br = new BufferedReader(fr);
//
// String sCurrentLine;
// List<Msg> listmsg = msgs.getmsg();
// int a = 0;
//
// while ((sCurrentLine = br.readLine()) != null) {
//
// a = a + 1;
// this.msgId = rdConfig.getMsgIdforMatchingStr(sCurrentLine);
// HashMap<String, String> hm = new HashMap<String, String>();
// if (msgId != "") {
// for (Msg m : listmsg) {
// List<Element> list = m.getelements().get(0).getElement();
// if (msgId.equals(m.getId())) {
// // HashMap<String, String> hm = new HashMap<String,
// // String>();
//
// for (Element e : list) {
// try {
// hm.put(" " + e.getelname(),
// sCurrentLine.substring(Integer.parseInt(e.getstpos()), e.getenmsg()));
// } catch (Exception err) {
// error.add("line " + a + " " + e.getelname() + " " + e.getenmsg() + " "
// + e.getstpos());
// System.out.println(err);
// }
// }
// if (hashmap.contains(hm)) {
//
// } else {
// hashmap.add(hm);
// }
// }
//
// }
//
// } else {
// hm.put("", "no");
// hashmap.add(hm);
// }
// msgId = null;
// }
// System.out.print(error);
//
// } catch (Exception err) {
// System.err.println(err);
// }
// return hashmap;
// }
}
|
[
"[email protected]"
] | |
a267fd5eb2bedb3e1bd51f4504d6ec6b5eb3ecd7
|
c7df5077b4966513e8280dbb6f00fabc730e9529
|
/src/main/java/com/yin/pattern/decorator/LongHairWoman.java
|
459ca69316492347f5d3b6272fec427362758ca7
|
[] |
no_license
|
guanqunyin/DesignPattern
|
c95726d5bf1ecad29761287cac1ee35ccaea4a88
|
bde9b46b3d2ab1d9afac73ba8346e851fec2c6c9
|
refs/heads/master
| 2020-08-03T16:01:10.298983 | 2019-11-13T09:41:28 | 2019-11-13T09:41:28 | 211,808,025 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 350 |
java
|
package com.yin.pattern.decorator;
class LongHairWoman extends SimpleWoman{
private SimpleWoman simpleWoman;
LongHairWoman() {
}
public LongHairWoman(SimpleWoman simpleWoman) {
this.simpleWoman = simpleWoman;
}
public void print() {
simpleWoman.print();
System.out.println("长头发");
}
}
|
[
"[email protected]"
] | |
c5bc9d321bf3ba7f90f3f8891ad0d7c0466964d9
|
cc59bbccd7dc50db9d7153999b90d4e16bca8278
|
/dbus-stream/dbus-stream-common/src/main/java/com/creditease/dbus/stream/common/appender/enums/Command.java
|
3d1693dd0115441e0549b5ab8af7c95eed3dd6e0
|
[
"Apache-2.0"
] |
permissive
|
cammette/DBus
|
e9c834610a5326875162d782217525537a0fb85c
|
905c8b1a8ab09f7f4d7d36394fbec72318aa88eb
|
refs/heads/master
| 2020-03-12T21:24:26.532577 | 2018-04-20T06:07:13 | 2018-04-20T06:07:13 | 130,827,392 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,148 |
java
|
/*-
* <<
* DBus
* ==
* Copyright (C) 2016 - 2017 Bridata
* ==
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* >>
*/
package com.creditease.dbus.stream.common.appender.enums;
import com.creditease.dbus.commons.PropertiesHolder;
import com.creditease.dbus.commons.exception.UnintializedException;
import com.creditease.dbus.stream.common.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
/**
* 命令枚举
* Created by Shrimp on 16/6/13.
*/
public enum Command {
UNKNOWN_CMD,
PAUSE_APPENDER_DATA_TOPIC, // 暂停appender所有data topic
RESUME_APPENDER, // 继续appender所有data topic
FULL_DATA_PULL_REQ, // 拉全量枚举
HEART_BEAT, // 心跳
SPLIT_ACK,
META_SYNC, // 同步meta信息
APPENDER_TOPIC_RESUME, // 继续某个topic
AVRO_SCHEMA,
MONITOR_ALARM, // 监控报警,停止伪心跳
DATA_INCREMENT_TERMINATION, // 停止发送消息到kafka后发给wormhole的termination消息
META_EVENT_WARNING, // meta变更兼容性事件警告命令
APPENDER_RELOAD_CONFIG; // 重新加载配置
private static Logger logger = LoggerFactory.getLogger(Command.class);
private static boolean initialized = false;
private static Map<String, Command> cmds = new HashMap<>();
private static Map<String, Command> nameCmds = new HashMap<>();
static {
for (Command command : Command.values()) {
nameCmds.put(command.name().toLowerCase(), command);
}
}
public static void initialize() {
cmds.put($(Constants.ConfigureKey.FULLDATA_REQUEST_SRC), FULL_DATA_PULL_REQ);
cmds.put($(Constants.ConfigureKey.HEARTBEAT_SRC), HEART_BEAT);
cmds.put($(Constants.ConfigureKey.META_EVENT_SRC), META_SYNC);
logger.info("Command initialize {}", cmds.toString());
initialized = true;
}
public static Command parse(String cmd) {
if(!initialized) {
throw new UnintializedException("Command has not initialized!");
}
cmd = cmd.toLowerCase();
if(cmds.containsKey(cmd)) {
return cmds.get(cmd);
} else if(nameCmds.containsKey(cmd)) {
return nameCmds.get(cmd);
}
return UNKNOWN_CMD;
}
private static String $(String key) {
return PropertiesHolder.getProperties(Constants.Properties.CONFIGURE, key).toLowerCase();
}
public static void main(String[] args) {
System.out.println(Command.FULL_DATA_PULL_REQ);
}
}
|
[
"[email protected]"
] | |
5368bc93098629e1292ef597c27e26b8a726efac
|
3ac15d50e9b5132da301570a2ba058388009adf1
|
/src/test/java/com/training/todolist/TodolistApplicationTests.java
|
618db4ff061c130b35f83009f34af0ff2cff4e59
|
[] |
no_license
|
ernestcky/my-todo-list-backend
|
7f019151c3455181685979647894f9682a4831a8
|
583b89e7cff34dfb509402f563fcc5bce309c6d2
|
refs/heads/master
| 2023-01-24T20:32:19.919999 | 2020-12-10T17:25:33 | 2020-12-10T17:25:33 | 320,323,619 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 215 |
java
|
package com.training.todolist;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class TodolistApplicationTests {
@Test
void contextLoads() {
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.