method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
243c57b6-6665-4d50-9a66-a4be72a190cb | 2 | public int getIndex(String ID)
{
for (int i = 0; i < rows.size(); i++)
if (ID.equals((String) (rows.get(i)[1])))
return i;
return -1;
} |
4d9d0d7e-15bb-4a90-b339-405d49006c74 | 0 | public void setFunCedula(Long funCedula) {
this.funCedula = funCedula;
} |
e05598ad-862a-4d43-b70e-bee1f9d40ec4 | 9 | public boolean similar(Object other) {
try {
if (!(other instanceof JSONObject)) {
return false;
}
Set set = this.keySet();
if (!set.equals(((JSONObject)other).keySet())) {
return false;
}
Iterator iterator =... |
456e9358-a46d-4883-82f6-210d02813911 | 7 | public static int runToAddressOrNextInputFrameLimit(State initial, int move, int limit, int... addresses) {
int expectedRet = -2;
if ((move & 0b00001111) == 0) {
expectedRet = runToAddressOrNextInputFrameHiOrLoLimit(initial, curGb.rom.readJoypadInputHi, limit, addresses);
return expectedRet;
} e... |
52c45eb2-b074-4d9f-9637-422ccd4e8859 | 8 | protected static String trimSpacesOnly(String s)
{
while(s.startsWith(" ")||s.startsWith("\t")||s.startsWith("\n")||s.startsWith("\r"))
s=s.substring(1);
while(s.endsWith(" ")||s.endsWith("\t")||s.endsWith("\n")||s.endsWith("\r"))
s=s.substring(0,s.length()-1);
return s;
} |
b36e0cfd-f9b4-4b26-8ce5-4c4459507157 | 2 | public void addDstore(int n) {
if (n < 4)
addOpcode(71 + n); // dstore_<n>
else if (n < 0x100) {
addOpcode(DSTORE); // dstore
add(n);
}
else {
addOpcode(WIDE);
addOpcode(DSTORE);
addIndex(n);
... |
5620fe47-230d-4a4b-bbe7-670cc9a9ae87 | 5 | public void checkAnonymousClasses() {
if (methodFlag != CONSTRUCTOR
|| (Options.options & Options.OPTION_ANON) == 0)
return;
InnerClassInfo outer = getOuterClassInfo(getClassInfo());
if (outer != null && (outer.outer == null || outer.name == null)) {
methodAnalyzer.addAnonymousConstructor(this);
}
} |
3627ae6e-e7e8-435e-97fa-646902e5a6cc | 3 | private double findItem(String string, float value) {
for(int x=0; x<craftWidth; x++){
for(int y=0; y<craftHeight; y++){
//System.out.println(x + ", " + y);
if((itemGrid[x][y].getPreName() + itemGrid[x][y].getName()).equals(string)){
return value;
}
}
}
return 0;
} |
f971627a-4a03-4f5e-8ee6-852db8b970aa | 8 | public static void eachBoatTakeActions(int time, boolean night) {
Iterator<Boat> iter = River.boats.iterator();
ArrayList<Boat> boatsToBeRemoved = new ArrayList<Boat>();
while (iter.hasNext()) {
Boat currentBoat = iter.next();
currentBoat.minutesTraveled += God.UNIT;
if (!currentBoat.inCamp) {
curr... |
d35fb8b8-0701-41a2-921b-32489266c9d1 | 4 | public static void main(String[] args) {
Socket clientSocket;
BufferedReader inFromUser;
DataOutputStream outToServer;
BufferedReader inFromServer;
String writeUser;
String messageToServer;
try {
clientSocket = initSocket(HOST, PORT);
outT... |
c76c8028-91ef-4862-b57a-1d363f9132eb | 7 | public static int discrete(double[] a) {
double EPSILON = 1E-14;
double sum = 0.0;
for (int i = 0; i < a.length; i++) {
if (a[i] < 0.0) throw new IllegalArgumentException("array entry " + i + " is negative: " + a[i]);
sum = sum + a[i];
}
if (sum > 1.0 + EP... |
08ad83ef-bcc8-40f9-b50f-a7d88dd511f2 | 1 | int countTailingZero(int n) {
int res = 0;
while (n > 0) {
res += n / 5;
n /= 5;
}
return res;
} |
f4787ec8-077b-409f-b296-9318fdd85889 | 8 | private boolean r_instrum() {
int among_var;
// (, line 76
// [, line 77
ket = cursor;
// substring, line 77
among_var = find_among_b(a_3, 2);
if (among_var == 0)
{
... |
afd9fdd9-cc45-483f-bb6e-b0cbca665116 | 6 | public boolean loadDataFiles(String filePath, String dataType) {
File folder = new File(filePath);
LoadDataWithHibernate obj2 = new LoadDataWithHibernate();
String filename = "";
File[] listOfFiles = folder.listFiles();
int count = 0;
try {
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfF... |
deee2da5-300a-448b-a4e2-ca68b0f91c2d | 4 | @Override
public boolean create(Hotelier x)
{
String req = "INSERT INTO hotelier ( email, motdepasse, siteweb, nomentreprise)\n"
+"select \""+x.getEmail()+"\", \""+x.getMotDePasse()+"\", \""+x.getSiteweb()+"\", \""+x.getNomEntreprise()+"\" from dual\n"
... |
a19afeb6-5670-4b4c-940d-75227336156f | 0 | public void setVue(VueMenu vue) {
this.vue = vue;
} |
7a36fee0-407a-434d-bc8a-246e2d26befb | 6 | public void loadHexFile(String hexFile) throws Exception {
String strLine;
int lineNumber = 0;
FileInputStream fstream = new FileInputStream(hexFile);
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
while ((strLine = br.readLine()) !=... |
0d58128f-9a99-4d89-a48c-f015ebafed0a | 2 | public int charAt(int x) {
for(int i=start+1; i<end; i++) {
if(x < tm().getAdvanceBetween(start, i))
return i - start - 1;
}
return -1;
} |
62161623-038e-4970-a6c8-07405a2331e7 | 0 | public JNotifyListener getListener() {
return listener;
} |
feded9e4-fa5a-47c0-be99-bc7c6a17d951 | 8 | public Construct createConstruct(String uri, GenericTreeNode<SyntaxTreeElement> node)
{
String className = config.getConstructClassName(uri);
if(className == null) {
return null;
}
@SuppressWarnings("rawtypes")
Class constructClass;
Constructor constructor;
try {
constructClass = Class.forName(cla... |
edbda91d-3353-414d-aef8-246d52c3c084 | 8 | static float lpc_from_data(float[] data, float[] lpc, int n, int m){
float[] aut=new float[m+1];
float error;
int i, j;
// autocorrelation, p+1 lag coefficients
j=m+1;
while(j--!=0){
float d=0;
for(i=j; i<n; i++)
d+=data[i]*data[i-j];
aut[j]=d;
}
// Generate ... |
9aae266f-5932-43ef-83a6-b1d0e77b3cb2 | 4 | public void enableEdit() {
disableEdit();
nameField.setEnabled(true);
nameField.setText(list.getSelectedValue().substring(0, list.getSelectedValue().indexOf(';')));
switch(list.getSelectedValue().charAt(list.getSelectedValue().indexOf(';') + 1)) {
case 'S':
stringField.setEnabled(true);
stringField.s... |
941fe2e7-5e80-4944-96a9-276ecd208453 | 3 | @Override
public Funcionario listById(int codigo) {
Connection con = null;
PreparedStatement pstm = null;
ResultSet rs = null;
Funcionario f = new Funcionario();
try {
con = ConnectionFactory.getConnection();
pstm = con.prepareStatement(LISTBYID);
... |
92d3956a-4858-4613-a9f9-c17c275eaccc | 8 | void mover() {
int cabezaAnterior = inicioSnake + longSnake - 1;
cabezaAnterior =cabezaAnterior %(ancho*alto);
int cabeza = inicioSnake + longSnake;
cabeza = cabeza %(ancho*alto);
switch(direccion) {
case DERECHA:
snakeX[cabeza] = snakeX[cabezaAnterior... |
93a5e8af-3c3f-4bac-95fb-5e8482082219 | 4 | public static int berechneEinkommensteuer(int wert) {
if (wert <= 0) {
return 0;
} else {
int steuer = 0;
if (wert > ONEHUNDREDTWENTYTHOUSAND) {
steuer += ((wert - ONEHUNDREDTWENTYTHOUSAND) / HUNDRED) * FIFTY;
wert -= (wert - ONEHUNDRED... |
86d7b376-02d4-4e7d-b023-9c5fbec7110f | 9 | public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... |
5eb45b78-4a0d-422a-bd49-518ac18d50c6 | 4 | public void startGame() {
started = true;
orderMark = Mark.RED;
size = order.size();
if (size == 2) {
order.put(Mark.GREEN, order.get(Mark.YELLOW));
order.remove(Mark.YELLOW);
order.get(Mark.GREEN).setMark(Mark.GREEN);
}
if (!server) {
gameGameGUI = new GameGUI(board, this);
}
if (order.get(... |
77238189-379f-4b83-9c8b-de027f798092 | 4 | public boolean ifTextMsgContentIllegal(String content) {
return content.contains("<") || content.contains(">") || content.contains("[") || content.contains("]") || content.contains("/");
} |
d79a63ea-d977-4df5-a9aa-10035ac7505a | 7 | public static void Eleven(String str){
int result=0;
if(str.length() == 2)
System.out.println(0);
else{
for(int i=2;i<str.length();i++){
int num=str.length()-i-1;
int multi=1;
for(int j=0;j<num;j++)
{
multi=multi*11;
}
int temp=0;
if(str.charAt(i) == 'A' || str.charAt(i) == ... |
3f76e26f-57c2-49fc-8f9f-0fc99a7fe687 | 1 | @Test
public void testReserveInvalidIsbn()
{ int x;
try {
assertEquals(new Book().Reserve(123,1111111),0);
} catch (IOException e) {
System.out.println("Invalid data");
}
} |
e2564884-97cf-466f-93a6-19c544867b76 | 9 | public static void main(String[] args) {
int port = -1;
String host = null;
if (args.length>=3) {
name = args[0];
host = args[1];
try {
port = Integer.parseInt(args[2]);
} catch (Exception e) { port = -1; }
}
if (port==(-1)) {
io.p("What server would you like to connect to... |
bf8acb37-2eca-4b61-92ab-eebfc43157bf | 4 | private void jButton2ActionPerformed() {
String identityOfStreamer = JOptionPane.showInputDialog(null, "Enter the streamer's ID.\n" +
"http://twitch.tv/riotgames id is riotgames");
if (identityOfStreamer == null || identityOfStreamer.isEmpty() ) { return; }
String nameOfStreamer ... |
353fb8ef-7122-4d46-89f4-37b11823f899 | 4 | public void flipCard(int row, int col){
if (prevSelectedCardRow == -1 && prevSelectedCardCol == -1){
prevSelectedCardRow = row;
prevSelectedCardCol = col;
cards[row][col].setShowing(true);
updateButtons();
}
else if ( prevSelectedCardRow !... |
036755c5-38ae-4703-850d-b86ebe349ab3 | 3 | public void save(){
try {
File file = new File(getDataFolder() + "/names.txt");
boolean createFile = file.createNewFile();
if(createFile){
getLogger().info("Creating a file called names.txt");
}
PrintWriter write = new PrintWriter(file,... |
03464e7f-b50c-4b74-9e57-a881f10e581f | 4 | @Override
public void mouseReleased(MouseEvent e)
{
if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed()
&& current != null)
{
mxGraph graph = graphComponent.getGraph();
double scale = graph.getView().getScale();
mxPoint tr = graph.getView().getTranslate();
current.setX(current.getX() ... |
18a15eb5-b7fc-473b-95e8-acb02ded7353 | 6 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
ServletContext sc = this.getServletConfig().getServletContext();
String localPath = sc.getInitParameter("ottzRimagePath");
HttpSession session... |
1d315e67-8134-44ed-9755-47fc1fc708a0 | 8 | private Component cycle(Component currentComponent, int delta) {
int index = -1;
loop : for (int i = 0; i < m_Components.length; i++) {
Component component = m_Components[i];
for (Component c = currentComponent; c != null; c = c.getParent()) {
if (component == c) {
index = i;
break loop;
}
... |
4bd7622f-e398-4a4c-86a8-be9267876417 | 4 | private int typeID(Object item) {
int id=OP.typeIDObject(item);
if (id<8) return id;
if (item instanceof String) return 8;
if (item instanceof Class) return 9;
if (item instanceof Member) return 10;
return -1;
}; |
2d6d00f3-fe46-4156-b410-93c29985e64a | 6 | public Cycle(int a, int b, int c) {
int[] p = new int[] { a + 1, b + 1, c + 1 };
boolean asc, desc;
for (int i = 0; i <= 2; i++) {
asc = desc = true;
for (int j = 0; j <= 1; j++)
if (p[(i + j + 1) % 3] > p[(i + j) % 3])
desc = false;
else if (p[(i + j + 1) % 3] < p[(i + j) % 3])
a... |
8b1b5843-31e0-4316-a4e8-b7ea1c8c0bea | 0 | public int size() {
return size;
} |
9f32fc7d-151f-46db-81f5-dbc2b1580e00 | 6 | @Override
public void run() {
// System.out.println("download meta data");// TODO
try (Socket peerSocket = new Socket(peerIp, peerPort);
OutputStream output = peerSocket.getOutputStream();
InputStream input = peerSocket.getInputStream()) {
byte[] handshakeM... |
b79e7478-ca0e-4c08-8f7a-86d909cbeff4 | 1 | private int calculateExponent(int[] binaryNumber) {
int exponent = 0;
for(int i = 1; i < 9; i++){
exponent = exponent + binaryNumber[i] * (int) Math.pow(2, 8 - i);
}
return exponent;
} |
ca6c9259-2e8b-4951-b5eb-652c959a6319 | 2 | public Mirror (String gridDates, String gridStr) {
height = Integer.parseInt(gridDates.split(" ")[0]);
width = Integer.parseInt(gridDates.split(" ")[1]);
distance = Integer.parseInt(gridDates.split(" ")[2]);
grid = new byte[height][width];
for (int row = 0; row < height; row++) {
for (int column = 0; colum... |
78e32743-f022-4b07-9779-c7bfa4407446 | 9 | private static Expression parseFunction()
{
System.out.println("解析函数表达式");
int opType = CurrentToken.type;
eat( opType );
eat( TokenType.OpenParen );
Expression exp = parseAddExpression();
eat( TokenType.CloseParen );
switch ( opType )
{
case To... |
5a64973d-8b72-4d70-bb3f-707f437294e3 | 5 | protected int readBlock() {
blockSize = read();
int n = 0;
if (blockSize > 0) {
try {
int count = 0;
while (n < blockSize) {
count = in.read(block, n, blockSize - n);
if (count == -1)
break;
n += count;
... |
56cd7a97-babc-46aa-b87f-ac59ebdef97c | 4 | @Override
public int getPreferredHeight(Row row, Column column) {
Font font = getFont(row, column);
int minHeight = TextDrawing.getPreferredSize(font, "Mg").height; //$NON-NLS-1$
int height = TextDrawing.getPreferredSize(font, getPresentationText(row, column)).height;
StdImage icon = row == null ? column.getIc... |
5831fbae-ea09-4c50-8f0a-4813e3f633e1 | 8 | public void canDetectImplementor() {
ClassInstrumentationCommand cic = new ClassInstrumentationCommand();
//cic.setIncludeClassRegEx("org.hsqldb.jdbc.jdbcStatement");
cic.setIncludeClassRegEx(ConnectionTestUtils.TEST_CLASS_TO_INSTRUMENT_1);
IAgentCommand commandArray[] = { cic };
HostPort hostPort = new Ho... |
7b94cea2-88eb-4b73-9e4d-f2b827323bc1 | 9 | private int stablePartition(int[] array, int[] temp, int lowindex, int highindex, boolean reversed) {
Compare firstcond, secondcond;
if (reversed){
firstcond = new Compare(Compare.type.GREATERTHAN);
secondcond = new Compare(Compare.type.LESSTHAN);
}
else{
firstcond = new Compare(Compare.type.LESSTHAN);... |
39e2a777-633e-4811-a3b2-6f9b66927e08 | 5 | public void updateView(Tetromino tetromino){
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
JLabel cell = (JLabel) getComponent(j * 4 + i);
if(i < tetromino.getWidth() && j < tetromino.getHeight() && tetromino.hasSquareAt(i, j)){
cell... |
a5d03221-1aa6-47d5-8fcc-8044164f179d | 1 | public void initTiles() {
tiles = new Tile[ROW * ROW];
for (int i = 0; i < tiles.length; i++) {
tiles[i] = Tile.ZERO;
}
addTile();
addTile();
host.statusBar.setText("");
} |
0be358bb-61be-4970-a174-14b4a4d7a8df | 7 | public static void main(String[] args) {
final long startTime = System.currentTimeMillis();
final MFDFitnessFunction fitnessFunction = new MFDFitnessFunction();
final int[] symptoms = new int[NUMBER_OF_SYMPTOMS];
final StringBuilder sb = new StringBuilder();
final ArrayList<Chro... |
70fd8320-49ee-40e7-bc2d-dd8620214d8e | 1 | @RequestMapping("/listar")
public ModelAndView listarProductos() {
Stock stock = Stock.getInstance();
Map<String, Integer> mapStock = stock.obtenerStock();
Set<String> setStock = mapStock.keySet();
List<Producto> productList = new ArrayList<Producto>();
for (Iterator<String> iterator = setStock.ite... |
7b4cb615-1520-4c7a-9a24-b44b921c16ef | 4 | private boolean read()
{
try {
final URLConnection conn = this.url.openConnection();
conn.setConnectTimeout(5000);
if (this.apiKey != null) {
conn.addRequestProperty("X-API-Key", this.apiKey);
}
conn.addRequestProperty("User-Agent"... |
043e80a8-14e5-49e8-9422-dfc3b600d720 | 6 | @Override
public void run() {
try {
executing = true; // OK, we are running
osCmd.start();
Thread.sleep(defaultWaitTime); // Allow some time for the thread to start
// Wait for command to start
while (!osCmd.isStarted() && isExecuting())
Thread.sleep(defaultWaitTime);
// Wait for stdin to b... |
8a5e8246-3f1a-49b8-9d5c-3d95d138b6fb | 5 | public void save() {
//Save markets
//Clear the plugin pointer to null
for( Market market : markets.values() )
market.setPlugin(null);
try{
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(Conf.dataFolder + "markets.bin"));
oos.writeObject(markets);
oos.flush();
oos.clos... |
a5d443b4-f26c-43da-a5a0-2048fecbd4a9 | 8 | public static DHParameters getParams(int group) {
BigInteger p = DHParameters.GROUP_2;
BigInteger g = DHParameters.DH_G;
if (group == 1) {
p = DHParameters.GROUP_1;
g = DHParameters.GROUP1_G;
} else if (group == 2)
p = DHParameters.GROUP_2;
else if (group == 3)
p = DHParameters.GROUP_5;
else if... |
8aaaafd7-64c1-4cc7-9947-939eeed117c6 | 4 | public boolean valido() {
if (login == null || login.isEmpty()) {
return false;
}
if (senha == null || senha.isEmpty()) {
return false;
}
return true;
} |
4d5e285d-0d59-46dd-9a09-5ec0e5a99a1c | 5 | public SimulationMap(String mapName, int walkingDistancePerSec, int startId,
Collection<Person> people, int dotsPerMeter, Collection<Sensor> sr, SQLiteConnection db){
this.mapName = mapName;
this.people = people;
this.sensors = sr;
this.walkingSpeedPerSec = walkingD... |
4949a514-8a52-471a-b0b8-c190c575e4c5 | 0 | private void initPopulation(){
IntStream.range(0, size)
.forEach(_i -> individuals.add(makeRandomChromo.apply(rand)));
} |
8b27f1cc-2b68-4c14-8329-1bf297f94397 | 6 | public ListNode swapPairs(ListNode head) {
if (head == null)
return null;
if (head.next == null)
return head;
ListNode prev = null;
ListNode slow = head;
ListNode fast = head.next;
while (fast != null && slow != fast) {
slow.next = fa... |
99dba538-fb22-48db-b2d1-c696249b7b24 | 1 | public void testConstructor_RI_RI7() throws Throwable {
DateTime dt1 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
DateTime dt2 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
try {
new MutableInterval(dt1, dt2);
fail();
} catch (IllegalArgumentException ex) {}
} |
1e113652-c50d-4b54-83c7-3cabec018003 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PeriodHardConstraint other = (PeriodHardConstraint) obj;
if (constraint != other.constraint)
return false;
if (e1Id != other.e1Id)
return... |
ecececa6-a9b6-4f8b-a3c0-8ba944e33e6e | 1 | @SuppressWarnings("unchecked")
@Override
public <T> T adaptTo(Class<T> type) {
if(type.equals(NoteElement.class)) {
return (T) this;
}
return null;
} |
3c925f1e-f100-4053-8d46-3989c9dc1059 | 8 | private static String canonicalize(final SortedMap<String, String> sortedParamMap) {
if (sortedParamMap == null || sortedParamMap.isEmpty()) {
return "";
}
final StringBuffer sb = new StringBuffer(100);
for (Map.Entry<String, String> pair : sortedParamMap.entrySet()) {
final String key = pair.getKey().to... |
768d566e-d9ca-43bd-a277-b9a1fffa17e3 | 6 | public static void main( String[] argv ) {
try {
String[] stopMarks = new String[] {
"%MARK_0%",
"%MARK_A%",
"%MARK_B%",
"%MARK_C%"
};
String data =
stopMarks[0] +
"This " +
stopMarks[3] +
" is a " +
stopMarks[2] +
" very simple " +
stopMarks[1] +
" test.";
List<byte... |
0c2d0dd4-8721-402f-931f-d777453110fb | 2 | private void deleteContact() {
if (ek != null) {
int response = JOptionPane.showConfirmDialog(this,
"M\u00F6chten Sie den Kontakt wirklich l\u00F6schen?");
if (response == JOptionPane.YES_OPTION) {
ekd.delete(ek);
displayFirst();
}
}
} |
2a04b740-59de-498a-8850-bf0a774f11fd | 1 | private int max(Node node){
while (node.rightTree!=null) node=node.rightTree;
return node.value;
} |
4e8b5718-27ad-451e-b4f4-c6e14cfba320 | 6 | protected BulkBean buildGetBulkBean(Introspector is, Class<?> clazz, String[] fields, Class[] args) {
if (fields.length != args.length) {
throw new BeanMappingException("fields and args size is not match!");
}
String[] getters = new String[fields.length];
String[] setters = ... |
4927c64d-1bbc-4822-a6b4-98812369a2a5 | 6 | @SuppressWarnings("unchecked")
String getComponentsChapter(Collection<Class<?>> comps) {
StringBuffer db = new StringBuffer();
// Model component
db.append("<chapter>");
db.append("<title>" + b.getString("model") + "</title>");
Class mai = comps.iter... |
f488bad5-079c-47fb-9eae-bb853875a2a7 | 7 | public XYSeries getPairwiseDifsDistribution() {
ArrayList<Point2D> ser = new ArrayList<Point2D>();
int count = 0;
int total = seqs.size()*(seqs.size()-1)/2;
int step = total/10+1;
int[] hist = new int[seqs.getMaxSeqLength()];
for (int i=0; i<seqs.size(); i++) {
for(int j=i+1; j<seqs.size(); j++) {
... |
ce978ad2-1264-4f66-9b15-47bcf9f9b3dd | 7 | public JSONObject postAnswerTag(int USER_ID,int QUESTION_ID,String ANSWER)
{
try {
Class.forName(JDBC_DRIVER);
conn=DriverManager.getConnection(DB_URL,USER,PASS);
stmt=conn.createStatement();
json=new JSONObject();
//String SQL="insert into ANSWERS(USER_ID,QUESTION_ID,AN... |
765cbdac-94d7-4171-ac68-94f3960dcec6 | 9 | public void alarm ()
{ long now=System.currentTimeMillis();
if (B.maincolor()>0) BlackRun=(int)((now-CurrentTime)/1000);
else WhiteRun=(int)((now-CurrentTime)/1000);
if (Col>0 && BlackTime-BlackRun<0)
{ if (BlackMoves<0)
{ BlackMoves=ExtraMoves;
BlackTime=ExtraTime; BlackRun=0;
CurrentTime=now;
}... |
b590d552-180e-4f45-8d18-66e71c5b0818 | 3 | protected String getProcessingInstructionValue (Node contNode, String key) throws ParseException {
String strValue = null;
NodeList nl = contNode.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
if (nl.item(i).getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
... |
7d97d380-5a9d-48bd-815c-99ffb0c1a27d | 8 | public static String nthPowerString(int base, int power) {
String nthPowerString = "";
int originalNumber;
int calculatedNumber;
int onesDigit; //the ones digit of calculatednumber
String carryDigits = ""; //carry digits will be added at the end
if (base < 10 && base > 0)... |
abec3c7e-5d76-47b2-9f9b-e1f29c6723a6 | 3 | public boolean canChunkExist(int var1, int var2) {
byte var3 = 15;
return var1 >= this.curChunkX - var3 && var2 >= this.curChunkY - var3 && var1 <= this.curChunkX + var3 && var2 <= this.curChunkY + var3;
} |
5d4ce8f9-f0e0-4902-8d08-144b5531e69a | 0 | public void tick()
{
} |
89fc40d0-68ff-4d8e-8cc5-6d2da592807f | 2 | @Override
public List Listar() {
Session session = null;
List<Equipo> equipo = null;
try {
session = NewHibernateUtil.getSessionFactory().openSession();
Query query = session.createQuery("from Equipo");
equipo = (List<Equipo>) query.list();
... |
fcbbe855-5462-4a9d-a688-4bdd295cb8a8 | 5 | public StaffListGUI() {
//Get size of screen without taskbar
screenSize = Toolkit.getDefaultToolkit().getScreenSize();
screenMax = Toolkit.getDefaultToolkit().getScreenInsets(bookDialog.getGraphicsConfiguration());
taskbarSize = screenMax.bottom;
screenWidth = (int)screenSize.getWidth();
screenHei... |
0efd6290-4e4f-4784-8504-28d1e63475b8 | 2 | @Override
public void draw(Graphics g) {
if(visible){
g.drawImage(background, rect.x, rect.y, null);
for(GuiComponent c: components){
c.draw(g);
}
}
} |
a3253577-ed3c-4983-a278-93d87e0b0053 | 8 | public boolean hasNext() {
if (matcher == null) {
return false;
}
if (delim != null || match != null) {
return true;
}
if (matcher.find()) {
if (returnDelims) {
delim = input.subSequence(lastEnd, matcher.start()).toString();
... |
72a19e86-39b5-483b-8ffd-7fb7de00165c | 1 | public void addComp(JComponent... comp ) {
JPanel shell = JComponentFactory.makePanel(JComponentFactory.HORIZONTAL);
for(JComponent a : comp)
shell.add(a);
parts.add(shell);
updateParts();
} |
ced0d69d-ed63-4eaa-af3b-f182fe7f8d48 | 5 | public boolean checkCollision(Player.Direction direction, int x, int y, int width, int height){
int xIndex = 0;
int yIndex = 0;
switch(direction){
case Up:
xIndex = x / GRID_SIZE;
yIndex = (y - height/2) / GRID_SIZE;
break;
case Down:
xIndex = x / GRID_SIZE;
yIndex = (y + height/2) / GRID_SI... |
33da3f6e-162b-4c20-aaa5-fc7c47b50d8b | 2 | public static int getMstxInfoCount() {
int result = 0;
Connection con = null;
Statement st = null;
ResultSet rs = null;
try {
con = DBUtil.getConnection();
st = con.createStatement();
rs = st.executeQuery("select count(mid) from mstx_info");
if (rs.next()) {
result = rs.getInt(1);
}
} cat... |
a91c77f2-0e55-43d6-9643-600dda184415 | 0 | public ConnectionBundle() {
chl = new ArrayList<ConnectionHandler>();
/**
* Initially one party has access to the fields.
*/
accessSemaphore = new Semaphore(1);
inputBuffer = new LinkedList<DCPackage>();
inputAvailable = new Semaphore(0);
netStatBuffer = new LinkedList<NetStatPackage>();
status... |
640ada47-5347-4f22-9dd1-01fe081fded1 | 0 | public String getTelephone() {
return telephone;
} |
57822c6b-d555-416f-b6a3-c781af75f53a | 0 | public UDPClientThread(int size){
this.size=size;
} |
6640cd68-3005-479f-b34a-5005c294fb76 | 6 | @EventHandler
public void MagmaCubeFastDigging(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getMagmaCubeConfig().getDouble("Magm... |
14118b68-8cf8-4f11-93bf-0d81cc6d821b | 4 | public void run() {
try {
if (BenchmarkClient.available.tryAcquire()){
Socket clientSocket = new Socket(hostname, portnumber);
PrintStream out = new PrintStream(clientSocket.getOutputStream(), true);
Scanner in = new Scanner(clientSocket.getInputS... |
e1a96eba-95dc-4fd2-ac35-1186e67d3b93 | 0 | public void showSplashScreen() {
Dimension screenSize = tk.getScreenSize();
//setBackground(BORDERCOLOR);
int w = imgWidth + (BORDERSIZE * 2);
int h = imgHeight + (BORDERSIZE * 2);
int x = (screenSize.width - w) / 2;
int y = (screenSize.height - h) / 2;
setBounds(x, y, w, h);
setVisible(true);
} |
1054d1e7-818c-4ead-a278-e098b0b77037 | 0 | public Transition getTransition(int row) {
return transitions[row];
} |
e16a350d-d804-44d3-a875-ea4072696b66 | 8 | public String[] setListByType() {
System.err.println("setListByType()");
if (typeIndex == 0 && Utils.sList != null) {
String[] a = new String[Utils.sList.length-1];
for (int i = 1; i < Utils.sList.length; i++) {
System.out.println("i=" + i);
System.out.println(Utils.sList[i].getValue());
a[i-1] = ... |
c17fbeb6-32b4-4b28-8235-0f281af145e7 | 2 | public void mysql2mongo(String src_db,String tar_db){
MySqlConnector mySqlConnector = new MySqlConnector();
mysql_conn = mySqlConnector.getConnection(src_db);
PropertiesReader p = PropertiesReader.getInstance();
MongoConnector mongoConnector = new MongoConnector();
Mongo mongo... |
eb877aa8-f02a-416e-a1cc-fb4eca73c64e | 9 | protected DropAction doAcceptDrop(Point p, DockingWindow window) {
DropAction da = acceptChildDrop(p, window);
if (da != null)
return da;
float f = isHorizontal() ? (float) p.y / getHeight() : (float) p.x / getWidth();
if (f <= 0.33f) {
Direction splitDir = isHorizontal() ? Direction.UP :... |
80b30786-8d6e-425a-ae53-80107af7b01a | 7 | public boolean setZombiePositions() {
// TODO Auto-generated method stub
for(int i = 0; i < zombieList.size(); i++)
{
//get posiiton point from zombie
Point position = zombieList.get(i).getPosition();
//if the zombie tag didn't have an x and y
if(position.x == -1 && position.y == -1)
{
//get a... |
c9669c67-da6e-4825-baf3-a3c2da283f9e | 3 | public String getTooltipExtraText(Province current) {
if (!editor.Main.map.isLand(current.getId()))
return "";
final String owner = mapPanel.getModel().getHistString(current.getId(), "owner");
if (owner == null || owner.length() == 0)
return "";
return "O... |
9e8cc682-7337-4f05-837e-e2192705bfe0 | 2 | public int countOccurrences(int target)
{
int answer;
int index;
answer = 0;
for(index = 0; index < manyItems ; index++)
{
if(target == data[index])
{
answer++;
}
}
return answer;
} |
e767a3a8-3a87-47e3-8b1b-a5b1cd70c97c | 0 | public int getCoefiente() {
return coefiente;
} |
ad758446-26b3-4493-9d1e-b772cfc1a21b | 6 | @PayloadRoot(localPart = REQUEST_LOCAL_NAME, namespace = NAMESPACE_URI)
@ResponsePayload
public AddListResponse processSubscription( @RequestPayload AddListRequest genericRequest) {
try {
logger.debug("Received subscription request");
try {
logger.debug("Delegate to service");
logger.debug("Gener... |
2a20d664-718b-4439-a985-bce290dfe015 | 2 | @Override
public ArrayList<UsuarioBean> getPage(int intRegsPerPag, int intPage, ArrayList<FilterBean> hmFilter, HashMap<String, String> hmOrder) throws Exception {
ArrayList<Integer> arrId;
ArrayList<UsuarioBean> arrUsuario = new ArrayList<>();
try {
oMysql.conexion(enumTipoConex... |
afc696b1-2f7b-4b16-a87b-7018d2a090bd | 0 | public ClothHeadArmor() {
this.name = Constants.CLOTH_HEAD_ARMOR;
this.defenseScore = 11;
this.money = 350;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.