method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
88ebc7bb-b530-405f-b359-e0ac8668bcbb | 8 | public GetDataBySubjectPanel(JFrame frame, QueryDefinition query) throws Exception {
super(frame, query, new GetDataBySubject(query.getDocument()));
JTabbedPane panel = new JTabbedPane();
//
// Defines the "Subject IDs" tab.
/////////////////////////////
ItemSet<SubjectID> subItems = new ItemSet<Subject... |
f4645401-90ec-487a-afff-d4f6ce255d5a | 1 | public void notifyOfRowModification(Row row, Column column) {
for (OutlineModelListener listener : getCurrentListeners()) {
listener.rowWasModified(this, row, column);
}
} |
604cb77b-801b-4a09-a215-a867fc13cce1 | 0 | public static boolean verify(byte[] data, String publicKey, String sign)
throws Exception {
// 解密由base64编码的公钥
byte[] keyBytes = SecurityCoder.base64Decoder(publicKey);
// 构造X509EncodedKeySpec对象
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
// KEY_ALGORITHM 指定的加密算法
KeyFactory keyFactory... |
5b4849ac-1402-4571-b91a-cd7c98a74b92 | 4 | private void updateView() {
if (this.nodes == null || this.nodes.length > 1
|| !this.nodes[0].exists()) {
this.titleBorder.setTitle("-");
this.jzvStat.setStat(null);
this.taUpdate.setText("");
this.taChildData.setText("");
this.jbUpdate... |
54eb820f-3385-418a-8cc3-d0a5f2c1d3e4 | 9 | public void act() {
if (enabled) {
boolean last = hover;
boolean lastP = pressed;
if (Greenfoot.mouseMoved(this)) {
hover = true;
} else if (Greenfoot.mouseMoved(null)) {
hover = false;
}
if (Greenfoot.mousePressed(this)) {
pressed = true;
}
if (Greenfoot.mouseClicked(this) /* && h... |
098f5251-413d-48d8-9f7c-f0a3486e4908 | 0 | private void jLabel15MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel15MouseClicked
jTextPane1.insertIcon(new ImageIcon(getClass().getResource("/picture/3.jpg")));
pos.add(jTextPane1.getText().toString().length()-1);
pic.add("|");
}//GEN-LAST:event_jLabel15MouseCl... |
c3bf8680-64bd-4c7c-8b47-c3efed136b5a | 3 | private void calculateToExit()
{
int newDirection = 0;
if (getColumn() > HOME_COLUMN) {
newDirection = 3;
} else if (getColumn() < HOME_COLUMN) {
newDirection = 1;
} else if (getRow() > HOME_ROW) {
newDirection = 0;
} else {
isA... |
06592eaf-4a57-4261-8163-98e6979204b0 | 2 | public final String getFirstParameter(String name) {
List<String> list = getParameter(name);
if (list != null) {
return list.isEmpty() ? "" : list.get(0);
}
return null;
} |
eedd5e1b-4eca-40ed-9f8d-77a32b53f287 | 0 | public String getreasontext(){
return reason;
} |
ee60d7fd-fe21-4efe-a15e-3488894079e4 | 4 | public static void main(String[] args) {
if(args.length > 0){
String name = "./" + args[0];
File file = new File(name);
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(file));
String line... |
9479189e-bf18-484f-8398-d599e8d0e8c0 | 1 | @Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("I just did a guided attack!");
return random.nextInt((int) agility) * 2;
}
return 0;
} |
faeeb0f6-65d9-4dec-89ef-217a86f5c6e8 | 3 | public boolean isCellEditable(int row, int col)
{
if (col > 1 && row != getRowCount() - 1 || col == 0)
{
return true;
}
return false;
} |
b5658201-d2a7-4e69-86b2-9222c5ba7318 | 8 | public void updateInterface() {
ItemStack is = null;
this.inventory.clear();
if(this.sort_mode == DeckEditor.SORT_NUMBER) {
Collections.sort(this.deck);
} else if(this.sort_mode == DeckEditor.SORT_ABC) {
Collections.sort(this.deck, DeckEditor.SORTER_ABC);
} else if(this.sort_mode == DeckEditor.SORT_ATK)... |
bf6f969b-73f5-44f4-af5d-090b30b55887 | 5 | public int next() {
int nextPos = index;
char c = desc.charAt(nextPos);
if (c == '(') {
++index;
c = desc.charAt(++nextPos);
param = true;
}
if (c == ')') {
++index;
c = desc.char... |
c859a0e4-1950-4032-8b23-79122882c558 | 2 | public AlumnoBean loadId(AlumnoBean oAlumno) throws NumberFormatException {
try {
if (request.getParameter("id") != null) {
oAlumno.setId(Integer.parseInt(request.getParameter("id")));
} else {
oAlumno.setId(0);
}
} catch (NumberFormatE... |
034d742f-a845-4b6e-b141-d7e4c7af0058 | 5 | static void readFile(String filename) throws IOException {
Scanner reader = new Scanner(new FileReader(filename));
String currentLine = reader.next();
boolean read1 = true;
boolean read2 = false;
Vertice currentVertice;
while (reader.hasNext()) {
if (!reader.hasNext("arestas") && read1) {
curr... |
b200ce3c-f409-4975-90a4-15d7b28cc749 | 0 | @Override
public void execute(DebuggerVirtualMachine dvm) {
} |
eba77df3-8af2-4e81-8582-3741ab9eb0c9 | 2 | public static int getTotalAchievementRecord() {
int totalRecords = 0;
try {
String statement = new String("SELECT COUNT(id) FROM " + DBTable);
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
ResultSet rs = stmt.executeQuery();
if (rs.next())
totalRecords = rs.getInt("COUNT(id)... |
71d6b1e6-00d3-4aab-ba87-de3b8b6b732d | 5 | private byte[] createChecksum() {
try {
InputStream fis = new FileInputStream(file);
byte[] buffer = new byte[1024];
MessageDigest complete = MessageDigest.getInstance("MD5");
int numRead;
do {
numRead = fis.read(buffer);
... |
3971f458-fa1a-423c-ba2c-04e926f77e45 | 1 | public void input_samples(float[] s)
{
for (int i=31; i>=0; i--)
{
samples[i] = s[i]*eq[i];
}
} |
9373aa6e-ebd5-4128-86bc-fdfdf68f5373 | 0 | @Test
public void insertAddsAtTheBeginningOfList() {
l.insert(a);
l.insert(b);
assertEquals(b, l.min());
} |
4c0ec806-43f8-45f4-b1fc-68ad05661a58 | 2 | public void dumpInstruction(TabbedPrintWriter writer)
throws java.io.IOException {
if (label != null) {
writer.untab();
writer.println(label + ":");
writer.tab();
}
writer.print("switch (");
instr.dumpExpression(writer.EXPL_PAREN, writer);
writer.print(")");
writer.openBrace();
for (int i = 0;... |
bd9baa09-a91f-4d73-b8e1-059cce4a27bf | 6 | public static void main(String[] args){
try{
BufferedReader in=null;
if(args.length>0){
in = new BufferedReader(new FileReader(args[0]));
}
else{
in = new BufferedReader(new InputStreamReader(System.in));
}
ArrayList<String> input = new ArrayList<String>();
String inp = in.readLine();
... |
d5dc9591-f4a2-498f-bf4c-b379224fb076 | 6 | private boolean agregaCatalogo(HttpServletRequest request, HttpServletResponse response) throws IOException {
ConexionBD con = new ConexionBD();
String descripcion = request.getParameter("descripcion");
String catalogo = request.getParameter("elegirCatalogo");
String tipo_familia = reque... |
b801e751-7f1d-4d10-ad43-33c29762c404 | 7 | static final int method1382(int i, int i_6_) {
anInt2463++;
if (i != 6406) {
if (i != 6409) {
if (i == 32841)
return 1;
if (i != 6410) {
if (i == 6407)
return 3;
if ((i ^ 0xffffffff) == -6409)
return 4;
} else
return 2;
} else
return 1;
} else
return 1;
if (i_6_ ... |
3400628a-4d5c-4e50-bf12-2c0621ca677b | 0 | public Combination<Colors> getLastAttempt () {
Row lastRow = this.grid.get(grid.size() - 1);
return lastRow.getAttempt();
} |
1f6fcd6a-ee71-4763-bd2c-16fe962dbb26 | 1 | public void union(int p, int q) {
if (!connected(p, q)) {
int pRoot = this.getRoot(p);
int qRoot = this.getRoot(q);
id[pRoot] = qRoot;
}
} |
1f7a0d75-3e24-48ba-87b4-65297ea35bef | 1 | public int getSmart() { // method422
int i = payload[offset] & 0xff;
if (i < 0x80) {
return getUnsignedByte();
} else {
return getUnsignedShort() - 0x8000;
}
} |
34771a3a-ac2e-48f0-882a-7b0872879b26 | 9 | private void process_bmpcache2(RdpPacket_Localised data, int flags,
boolean compressed, Options option) throws RdesktopException,
IOException {
Bitmap bitmap;
int y;
int cache_id, cache_idx_low, width, height, Bpp;
int cache_idx, bufsize;
byte[] bmpdata, bitmap_id;
bitmap_id = new byte[8]; /* prevent... |
84731059-7620-48f3-ab5b-1fb98296d510 | 5 | private void buttonServerControllerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonServerControllerActionPerformed
if (!Server.isRunning) {
try {
server = new Server();
serverThread = new Thread(server);
serverThread.start();
... |
993001ed-3e7b-4305-99bd-d9dee78f37d6 | 4 | public PeakData(String[] data) {
clear();
peakNum = data.length;
if (data.length == 1) {
if (data[0].split("\t")[0].equals("0") && data[0].split("\t")[1].equals("0")) {
peakNum = 0;
}
}
mz = new double[peakNum];
intensity = new int[peakNum];
selectPeakFlag = new boolean[peakNum];
String[] w... |
05544151-a803-4008-973d-5d04c1cfb373 | 5 | protected void UnpackArchives(JProgressBar progressCurr,JProgressBar progressBarTotal)
{
for(int i=0;i<FileCount;i++)
{
System.out.println(i+" Unzip "+ FileList[i]);
try {
Utils.deleteDirectory(getWorkingDirectory() + File.separator + GlobalVar.itemsServers[GlobalVar.CurrentSe... |
931c4183-7f90-4ff4-8b1e-4ab40bbd8e02 | 9 | @Override
public boolean run() {
if (verbose) Timer.showStdErr("Checking database using CDS sequences");
// Load config
if (config == null) loadConfig();
// Read CDS form file
if (verbose) Timer.showStdErr("Reading CDSs from file '" + cdsFile + "'...");
readCdsFile(); // Load CDS
if (verbose) Timer.sho... |
1e86a735-3804-41b6-814d-0819bc76a590 | 0 | public String getHoraEncargo() {
return horaEncargo;
} |
1f20bb51-98af-4502-8504-0b0993818ad0 | 3 | public Game(CLayout layout, JPanel panelContainer ){
// Point to the files you would like to use for the display
// To switch levels all you have to do is change these three lines
String dir = layout.getDirectory("level");
if( layout.level1 ){
abovePath = dir + "Level1-Over.p... |
39d9acaf-5bff-4269-b63b-e13e43e7be2d | 2 | private void renderMenu(Graphics g){
FontUtils.drawCenter(TowerGame.ricasso30, "Peachtree Tower", 165, 60, 470, Color.white);
FontUtils.drawCenter(TowerGame.ricasso20, "Start Game", 165, 125, 470, Color.gray);
FontUtils.drawCenter(TowerGame.ricasso20, "Options", 165, 155, 470, Color.gray);
switch (main){
c... |
efe24bd6-a42a-423e-b9ca-9a4d7dd3044c | 5 | void hookExampleWidgetListeners () {
if (logging) {
Widget[] widgets = getExampleWidgets ();
for (int i = 0; i < widgets.length; i++) {
hookListeners (widgets [i]);
}
Item[] exampleItems = getExampleWidgetItems ();
for (int i = 0; i < exampleItems.length; i++) {
hookListeners (exampleItems [i])... |
c79c4eb1-25c7-4378-a6ee-7939fef5ef45 | 3 | private void genericTest(int rows, int columns,String chessPiecesStr,
String[] expectedRepresentationString){
List<Piece> pieces;
pieces = ChessTools.getPiecesFromString(chessPiecesStr);
Cell[] chessBoard;
... |
5506c8eb-7f9a-4115-83a2-7530fe4c1c6f | 4 | public boolean isConstExpression() {
if (target != null || src != null) {
return false;
}
if (lValue != null && rValue != null) {
return true;
}
return lValue != null;
} |
5627a8f5-26f8-4de1-b806-1ed53cce1182 | 9 | public static Keyword continueAntecedentsProof(ControlFrame frame, Keyword lastmove) {
{ Iterator iterator = ((Iterator)(KeyValueList.dynamicSlotValue(frame.dynamicSlots, Logic.SYM_STELLA_ITERATOR, null)));
boolean firsttimeP = iterator == null;
boolean reversepolarityP = frame.reversePolarityP;
... |
c4bc7afe-112d-4a37-8c78-8cb6aab4a8e5 | 5 | private void cull() {
Node child;
outer: for (Iterator<Node> i = children.iterator(); i.hasNext();) {
child = i.next();
for (Node otherChild : children) {
if (otherChild == child)
continue;
... |
9d0f6376-9219-43e5-889e-5102e50e8ef3 | 3 | public List<Account> findDeliquentAccounts() throws Exception {
ArrayList<Account> delinquentAccounts = new ArrayList<>();
List<Account> accounts = accountDao.findAllAccounts();
Date thirtyDaysAgo = daysAgo(30);
for (Account account : accounts) {
boolean owesMoney = account.... |
f5f6a7d8-f497-43e8-8ef4-9feec87f631d | 6 | public static PeopleData createNewPeopleData(String key, String value, UUID person_id) {
if (key != null && value != null && person_id != null) {
return new PeopleData(key, value, person_id);
} else if (key != null) {
return new PeopleData(key, null, person_id);
} else if... |
1834f6e3-85ef-4dcb-a4c5-c4b031c155ce | 7 | public void simulate() {
Gdx.app.log("Funding", funding+"");
if(!unused) {
Random r = new Random();
population+=(10000*funding*(1-(parent.getSurvivabiliy()/100.0f)));
Gdx.app.log("POPULUS", population+"pp");
if(r.nextFloat()<(1-(parent.getSurvivabiliy()/100.0f))) {
if(r.nextInt(100)<=40-(funding/10.0f)) ... |
7182b07d-4ccb-4ce2-a7ae-3eaf76fe6863 | 8 | private MenuScreen()
{
super("img/menu/bgmenu.png", "img/menu");
curseur = new CursorMenu("img/menu/cursor.png");
stage = new Stage();
curseur.setPosition(curseur.getX(), curseur.getY());
sprite = new Sprite(new Texture(Gdx.files.internal("img/menu/bgmenu2.png")));
sprite.setPosition(0, 0);
stage.addLis... |
b2ae0acc-a121-408d-ac3c-fe698f0cfaa4 | 3 | public SessionList getSessions(String asLastModified, int aiMaxSize) {
String lsParam = "";
if (aiMaxSize > 0) {
lsParam += "&max_size=" + Integer.toString(aiMaxSize);
}
if (UtilityMethods.isValidString(asLastModified)) {
lsParam += "&last_modified=" + asLastModif... |
86486311-617d-4f1d-b6d4-7c905077122c | 6 | private boolean camposNecesarios () {
if ((jTextField1.getText().length()==0) ||
(jTextField2.getText().length()==0) ||
(jTextField3.getText().length()==0) ||
(jTextField4.getText().length()==0) ||
(jTextField5.getText().length()==0) ||
(jTextField6.ge... |
39af83ca-6b4f-4e18-98c4-ada9113eedfc | 8 | public void main(){
Scanner s = new Scanner(System.in);
PiggyBank_HIWHD pb = new PiggyBank_HIWHD();
boolean cont = true;
while (cont){
System.out.println("1. Show total in bank.");
System.out.println("2. Add a penny.");
System.out.println("3. Add a nic... |
16516a8b-2d09-4a92-af55-dc6e34a46400 | 5 | public String longestPalindrome2(String s) {
if (s == null || s.length() == 0) {
return s;
}
mapping = new boolean[s.length()][s.length()];
calculated = new boolean[s.length()][s.length()];
for (int k = s.length() - 1; k >= 0; k--) {
for (int i = 0; i < s... |
67bdafed-0f09-472c-b382-7197a95973c5 | 4 | private void setupUndoRedo() {
// Listen for undo and redo events
doc.addUndoableEditListener(new UndoableEditListener() {
public void undoableEditHappened(UndoableEditEvent evt) {
undo.addEdit(evt.getEdit());
}
});
// Create an undo action and add it to the text component
lyricBox.getA... |
de26265a-f73f-4805-a3ff-2f1faae2cde8 | 6 | double test7( ) throws MiniDB_Exception{
double points = 0;
// IN_SOLUTION_START
MiniDB db = new MiniDB( "minidb.test7" );
BufMgr bm = db.getBufMgr();
int size = 8;
BPlusTree bpt = db.createNewBPlusTreeIndex( "table", "val", 8 );
int iters = 300;
java.util.Hashtable val2blk = new java.... |
ca1ee099-3987-47fe-a73a-0deff47b7ce9 | 6 | public void cargarArbol() {
int count = 0;
int aux = 1;
int entre = 0;
Enumeration e = root1.breadthFirstEnumeration();
while (e.hasMoreElements()) {
parent1 = (DefaultMutableTreeNode) e.nextElement();
if (count >= aux) {
CLS_ITEM_CONTA obj... |
38d46efe-d03a-4e2b-bb45-1bfb212ff1e8 | 5 | private void addClassesInFolder(List<String> classes, File folder, String packageName, boolean recurse) {
for (File f : folder.listFiles()) {
if (!f.isDirectory()) {
if (f.getName().endsWith(".class")) {
classes.add(packageName + "." + f.getName().substring(0, f.getName().length() - 6));
}
} else i... |
0992b574-b2fc-4141-a3bf-bc3d366c9aa0 | 3 | @Override
public Rule getSimmilarRule(Rule rule) {
List<Rule> possibleResults = new ArrayList<Rule>();
for (Rule r : rules) {
if (r.isSimmilar(rule)) {
possibleResults.add(r);
}
}
if (possibleResults.isEmpty()) {
return rule;
} else {
return possibleResults.get((new Random()).nextInt(possible... |
8064605c-0128-4100-9a8d-6c6f47353408 | 7 | private HashMap<String, String> transformAttributes(String string)
{
// Prepare the attribute-map!
HashMap<String, String> map = new HashMap<String, String>(2);
// Consume the String word by word...
while(string.length() > 0)
{
// Trim whitespaces, if there are any.
string = string.trim();
... |
e9a829c4-159f-4c49-b4ff-7c38910e0d25 | 8 | private void searchJyusyo1(String jyusyo1) {
comboTodoufuken.removeAllItems();
comboTodoufuken.addItem("絞り込み");
comboTodoufuken.setSelectedIndex(0);
lstM.clear();
//CSVファイルの読み込み
File csv = null;
try {
csv = new File("KEN_ALL.CSV");
Buffered... |
a50a5d66-bd3e-49bb-b0c6-47b182c15f4e | 2 | public void setHistoryLocation(int i) {
this.history_location = i;
if (this.history_location <= 0) {
this.prevButton.setEnabled(false);
} else {
this.prevButton.setEnabled(true);
}
//System.out.println(this.history_location + ":" + history.getSize());
if (this.history_location >= history.getSize() ... |
ee97c2d3-660e-472b-8cef-423756c6a312 | 2 | @Override
public void update(long deltaMs) {
switch(firingMode) {
case FIRE_AT_ACTOR_MODE:
targetActor();
break;
case FIRE_AT_LOCATION_MODE:
targetLocation();
break;
}
} |
0be888e6-f2b7-491f-8e3f-6cbf3ac94adc | 9 | public static void exhaustiveAntiGoalRefineAnalysis(RequirementGraph req_model, ActorAssociationGraph actor_model, int visual_type, int scope) throws IOException, ScriptException {
// first empty the potential security goal set.
req_model.ag_elems.clear();
req_model.ag_links.clear();
String expression_file =... |
a13d38fb-e53c-419b-9c35-79f991a6596f | 5 | private void loop(){
while(true){
try{
lastTime = curTime;
curTime = System.currentTimeMillis();
totalTime += curTime - lastTime;
if(totalTime > 1000){
totalTime -= 1000;
fps = frames;
frames = 0;
}
++frames;
beginTime = System.currentTimeMillis();
//Dra... |
b702a5b8-ff95-4e35-aa9c-2eb1f5ae40c8 | 7 | String checkSecurity(int iLevel, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request){
try {
Object o1 = session.getAttribute("UserID");
Object o2 = session.getAttribute("UserRights");
boolean bRedirect = false;
... |
d4172416-ca87-4eaf-af2b-6bfc64c93314 | 1 | protected void processWindowEvent(
WindowEvent event )
{
if ( event.getID() == WindowEvent.WINDOW_CLOSING )
actionExit();
super.processWindowEvent(event);
} |
d3dbdd55-74f0-4d42-b274-4405e74f833b | 1 | private static NodeList getNodeList() {
NodeList nList = null;
try {
File fXmlFile = new File(path);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
D... |
0596eb52-4769-4681-bff5-387085a66831 | 7 | public void connect() throws ConnectionException, IOException {
BufferedReader bufferedReader = null;
try {
bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(playlist)));
}
catch(IOException e) {
throw new ConnectionException(e);
}
String filename;
while((filename = buffe... |
c6c37b82-014c-4975-b60f-fa89a13c12ca | 7 | @Override
public void run() {
int found = 0;
int number = 11;
int answer = 0;
while(found < 11) {
if(PrimeUtil.isPrime(number)) {
String num = String.valueOf(number);
boolean allPrimes = true;
int i = 1;
while(i < num.length()) {
if(!PrimeUtil.isPrime(Long.valueOf(num.substring(i)).long... |
2cbeaaca-8bea-440b-b7be-06306c4788ce | 6 | public static void RememberMeSave(boolean state, int ID, String Username, int Code, String Password, String Ticks, String Destination){
Code = Code/LoginWindow.verificationcode;
String gameFolderPath, gameFilePath;
gameFolderPath = System.getenv().get("APPDATA") + "\\TFrame";
gameFilePath = gameFolderPath + "\\... |
453d522a-6c29-4a1d-b6d6-b21c186eb09b | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
ca53fd4a-c7ee-4ff3-8a74-490efa90d6ba | 1 | public LoadingFrame()
{
try {
setIconImage(ImageIO.read(new File("assets/Icon48.png")));
} catch (IOException ex) {
Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
}
setTitle("Map of Denmark");
setDefaultCloseOperat... |
106ddaee-e6d0-4721-9a93-ab57ef0aa618 | 1 | public void draw(Graphics2D g, TreeNode node) {
Color c = g.getColor();
if (isSelected(node))
g.setColor(c.darker());
super.draw(g, node);
g.setColor(c);
} |
bad2639c-f9ee-4354-a608-26ef0490d3cd | 1 | public static void main(String[] args) throws Exception {
ExecutorService exec = Executors.newCachedThreadPool();
ServerSocket server = new ServerSocket(8080);
InetSocketAddress isa = new InetSocketAddress("localhost", 8080);
SocketChannel sc1 = SocketChannel.open(isa);
SocketChannel sc2 = SocketChannel.open(... |
80cceea5-a239-4bda-bdc8-0e8f465cfebf | 8 | private static int doStatements(
DatabaseConnection connection,
String label,
Collection<String> statements,
boolean ignoreErrors,
boolean returnsNegative,
boolean expectingZero)
throws SQLException
{
int stmtC = 0;
for (String statement : stat... |
60891d80-6812-4d23-9662-61358b4d8ad1 | 1 | protected static String getLine(int length, char c) {
StringBuilder b = new StringBuilder();
for (; length > 0; length--) {
b.append(c);
}
return b.toString();
} |
38c95b30-776c-4e60-b752-2301070d4a46 | 9 | public void receive(Object obj) {
Event event = (Event) obj;
switch(event.type) {
case "assign player":
Helper.log("ConnectionToGameServer: RECEIVED ASSIGN PLAYER EVENT");
gameScreen.engine.player = (Player) event.data;
if (gameScreen.gui.user.username.equals(ThinkTankGUI.GUEST_ACCOUNT)) {
gameScre... |
3e2e57ae-94d4-4131-9fcb-a367844d5ebe | 3 | public static String displayInput(String question, String title) {
while (true) {
String s = JOptionPane.showInputDialog(null, question, title,
JOptionPane.PLAIN_MESSAGE);
if (s == null) {
System.exit(0);
}
if (s.length() > 0) {
return s;
}
}
} |
8511fe20-1094-4ea9-8572-39c49acd4d47 | 0 | public void fine(String message) {
log(Level.FINE, message);
} |
d4cf42b0-5a0f-4650-94f4-e4bddb604c46 | 1 | public static Game GetGame() throws Exception
{
if(game == null)
{
throw new Exception();
}
return game;
} |
5dacffc3-f064-4703-bd6a-7f810b198893 | 0 | public void setTrainingId(int trainingId) {
this.trainingId = trainingId;
} |
7aed0dea-7f7a-4365-b00f-4368705142af | 0 | @Test
public void testReplaceFood() {
System.out.println("replaceFood");
World instance = new World();
instance.generateRandomContestWorld();
instance.replaceFood();
int expResult = 0;
int result = instance.getFoodNum();
assertEquals(expResult, result... |
9f996ef9-d23c-4db5-9591-450bb2dc220c | 1 | public Object opt(String key) {
return key == null ? null : this.map.get(key);
} |
31a2117c-601b-45bf-8c3b-777f88c25576 | 2 | @Override
public Connection getConnection() {
if (connection == null) {
try {
InitialContext context = new InitialContext();
DataSource ds = ((DataSource) context.lookup("30Resource"));
connection = ds.getConnection();
} catch (NamingEx... |
c6dc97be-315c-4966-8a43-b72f44760c44 | 4 | public static int runToAddressR(int limit, Gameboy gbL, Gameboy gbR, int... addresses) {
if (!gbR.onFrameBoundaries) {
int add = dualStepUntilR(gbL, gbR, 0, 0, addresses);
if (add != 0)
return add;
}
int steps = 0;
while (steps < limit) {
int add = dualStepUntilR(gbL, gbR, 0, 0... |
7eb2cc74-fadd-44bf-b658-3459c94fc316 | 3 | public void mouseExited(MouseEvent e) {
if (!b.isEnabled()) return;
if (b instanceof javax.swing.JToggleButton && b.isSelected())
return;
b.setBorder(inactive);
b.setBorderPainted(false);
} |
f92eb88d-148e-41fb-90a9-5723d91f1452 | 6 | public String result(boolean gui){
if((house.isBusted()||
player.getHandValue()>house.getHandValue())
&&!player.isBusted())
return player.win();
else if(player.isBusted()||
!house.isBusted()&&
player.getHandValue()<house.getHandValue())
return player.lose();
else
return player... |
a037dace-18a0-404e-8e24-306e1f8078b5 | 3 | @Override
public int getRemainDays() throws ServiceException {
try {
UriBuilder builder = UriBuilder.fromPath(
baseResourceUri + REMAIN_DAYS_PATH);
URI uri = builder.build();
GetMethod getMethod = requestGetMethodFactory
.newPlainTe... |
8b0b25f7-8f0f-40f0-844a-d332b895a15e | 9 | void processBondCrossingUnderPBC() {
if (!(model instanceof MolecularModel))
return;
MoleculeCollection molecules = ((MolecularModel) model).molecules;
if (molecules.isEmpty())
return;
double x0 = getX();
double y0 = getY();
double dx = getWidth();
double dy = getHeight();
double x1 = x0 + dx;
d... |
50c51ba2-7fdd-4cb1-ac4d-0b9b6a6af543 | 7 | public void csvImport(String filename) {
try {
log.info("Importing from file \"{}\"", filename);
int inserted = 0, updated = 0;
db.beginTransaction();
try (CSVReader reader = new CSVReader(new InputStreamReader(new FileInputStream(filename), "UTF-8"))) {
... |
93bfddfd-e29a-43a9-9e87-5b6025727047 | 8 | public StrictBounds<OrderedElement<T>> findNewBound(Iterable<T> stream, long kOrder, Bounds<OrderedElement<T>> oldBounds) {
ArrayList<OrderedElement<T>> current = new ArrayList<>(levelSize);
List<ArrayList<OrderedElement<T>>> levels = new ArrayList<>(levelSize);
long elementOrder = 0;
lo... |
bea22bef-c656-4c88-8eb1-e007a17b9708 | 5 | public AnnotationVisitor visitParameterAnnotation(final int parameter,
final String desc, final boolean visible) {
if (!ClassReader.ANNOTATIONS) {
return null;
}
ByteVector bv = new ByteVector();
if ("Ljava/lang/Synthetic;".equals(desc)) {
// workaround for a bug in javac with synthetic parameters
/... |
f88acd44-a3e8-42f4-9937-885294012a0e | 9 | private boolean instrucaoRetorno() {
/*
<inst_retorno> ::= “retorno” <argumento_retorno> “;”
<argumento_retorno> ::= <valor> | <argumento> | “vazio”
//<valor> ::= <numero> | <booleano> | <char> | <cadeia>
<numero> ::= <inteiro> | <real>
<argumento> ... |
849798a2-1d1c-459b-8d5c-2a416e3962c6 | 9 | int insertKeyRehash(double val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look... |
a5069370-3b59-45e2-a23c-0306e03f0904 | 5 | protected void drawShape(DrawableItem di, Graphics2D g) {
Stroke oldstrk = null;
if (di.getIsSelected()) {
oldstrk = g.getStroke();
g.setStroke(new BasicStroke(2));
if (di instanceof PathItem) {
g.setStroke(new BasicStroke(((PathItem) di).getThickness... |
3db18aea-6dbe-454d-a306-e910e29feef7 | 3 | public static void main(String[] args)
{
EdgeWeightedDigraph G = new EdgeWeightedDigraph(new In(args[0]));
int s = Integer.parseInt(args[1]);
AcyclicLP sp = new AcyclicLP(G, s);
for (int t = 0; t < G.V(); t++)
{
System.out.print(s + " to " + t + " ("
+ String.format("%.2f", sp.distTo(t)) + ") : ");
... |
10fee4b4-3efb-43b6-957d-9d6e78fc9497 | 1 | public GenericDAO<Assignment> getAssignmentsDAO()
{
if (_assignmentsDAO == null)
{
_assignmentsDAO = new GenericDAO<Assignment>(Assignment.class);
}
return _assignmentsDAO;
} |
092473bb-8d73-44ae-b29d-96367e21d81c | 6 | public static void addToTeam(TeamType type, Player player) {
if (isInGameTeam(player)) {
ChatUtils.send(player, "Du bist schon in einem Team!");
return;
}
switch (type) {
case LOBBY:
lobby.add(player.getName());
break;
case INNOCENT:
lobby.remove(player.getName());
innocents.add(player.getNa... |
0f05156f-63c9-43b9-87e0-20c0b1f41291 | 2 | private Rama_Hoja buscarSacarEntreDesconectado(String pID){
Rama_Hoja resp = null;
for(Nodo<Rama_Hoja> iteradorTree = _compuertasDesconectadas.getHead(); iteradorTree != null; iteradorTree = iteradorTree.getSiguiente()){
if(iteradorTree.getDato().getIdentificador() == pID)
r... |
a86ab98b-ee4c-4635-a3f9-1c0bd62f1710 | 5 | public SecuredMessageTriggerBean executeProblem(SecuredMessageTriggerBean message) throws GranException {
String text = message.getDescription();
SecuredTaskBean task = message.getTask();
EggBasket<SecuredUDFValueBean, SecuredTaskBean> refs = AdapterManager.getInstance().getSecuredIndexAdapterMa... |
425db82a-7697-46fb-b778-506cf7c693a9 | 0 | public String getUrl(){
return url;
} |
51d32ad7-4b66-418c-8344-5adac4b51c8e | 9 | private static void gerarProfilesSeriais(List<Profile> profilesSeriais, List<File> listaTxt, List<File> listaBin, List<String> listaZip) {
long inicio;
long fim10;
long fim50;
long fim100;
Profile p;
for (int i = 0; i < ITERACOES; i++) {
for (File txt : listaTxt) {
inicio = Calendar.getInstance().get... |
df979fbf-d6da-4b5d-a29b-c2fd29a75916 | 6 | private int ssMedian5 (final int Td, final int PA, int v1, int v2, int v3, int v4, int v5) {
final int[] SA = this.SA;
final byte[] T = this.T;
int T_v1 = T[Td + SA[PA + SA[v1]]] & 0xff;
int T_v2 = T[Td + SA[PA + SA[v2]]] & 0xff;
int T_v3 = T[Td + SA[PA + SA[v3]]] & 0xff;
int T_v4 = T[Td + SA[PA + SA[v4]]... |
8012680a-439b-45ce-8be8-ac7b916926b1 | 2 | public int getMove() {
int currentMove = BASE_MOVE;
if (hasStatus(UnitStatus.Type.HASTED)) {
currentMove += Ability.HASTE.getProperty(Ability.Property.MOVE_BONUS);
}
if (hasStatus(UnitStatus.Type.SLOWED)) {
currentMove -= Ability.SLOW.getProperty(Ability.Property.MOVE_PENALTY);
}
return currentMove;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.