method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
dff3d6ce-8e19-4d1b-9bfc-806fff8b6041 | 8 | @Override
public void mouseClicked(MouseEvent arg0) {
JButton button = (JButton) arg0.getSource();
if (button.getName().equalsIgnoreCase("back")){
KanjiMemo.showPanel(KanjiMemo.MAIN_SCENE);
} else if (button.getName().equalsIgnoreCase("undo")){
drawingPanel.undo();
} else if (button.getName().equa... |
e533bdfa-6309-45b9-8637-678eb5f3f178 | 5 | protected boolean existsOnServer( String urn ) throws IOException {
URL url = urlFor(urn);
if( induceHeadErrors ) throw new ServerError("Not a real error ha ha h", 599, null, "HEAD", url.toString());
HttpURLConnection urlCon = (HttpURLConnection)url.openConnection();
urlCon.setRequestMethod("HEAD");
url... |
ee1fe88b-0ac9-4a9f-8497-0811d1041a6c | 2 | private void selected(Object obj)
{
System.out.println("?");
System.out.println(obj);
System.out.println(selectedNo);
if (checkable) {
WidgetChooserButton button = (WidgetChooserButton)(layout.itemAt(selectedNo).widget());
if (obj != objects.get(selectedNo)) {
selectedNo = objects.indexOf(obj);
b... |
56f31d93-0a35-44b8-9953-a9c8d7cd5b6f | 9 | @Test
public static void testInfoQuery() throws Exception
{
String jobName = "TestInfoJob-" + System.currentTimeMillis() + Math.random();
final String PSV = "ECONOMODE";
final String on = "ON";
final String off = "OFF";
final String target;
ArrayList<Command> commands = new Ar... |
a5a6f8f5-5939-45d2-84bd-049ad60397d5 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Photo photo = (Photo) o;
if (src != null ? !src.equals(photo.src) : photo.src != null) return false;
return true;
} |
39ca5c81-c432-467d-a279-e8683f6de21b | 7 | private boolean readBlock() throws IOException {
if (this.debug) {
System.err.println("ReadBlock: blkIdx = " + this.currBlkIdx);
}
if (this.inStream == null) {
throw new IOException("reading from an output buffer");
}
this.currRecIdx = 0;
int of... |
43d894fd-4c62-4b31-b9b3-2d9a75ea4e25 | 9 | private int[] updateDateIndexAndFormat(String[] words) {
int indexDate1 = -1;
int indexDate2 = -1;
int toSkip = -1;
for (int i = 0; i < words.length; i++) {
if (i != toSkip) {
for (int j = 0; j < dateFormats.size(); j++) {
SimpleDateFormat ... |
52e6682e-8aa7-430e-bf30-5a9a77765628 | 6 | public void update() {
int xa = 0, ya = 0;
if (up) ya--;
if (down) ya++;
if (left) xa--;
if (right) xa++;
if (xa != 0 || ya != 0) move(xa,ya);
} |
7e74f05b-ccbc-4174-af47-04afc1f0c75e | 3 | @RequestMapping(value = {"search", "s"})
@ResponseBody
public Map search(
@RequestParam int page,
@RequestParam(value = "limit") int pageSize,
@RequestParam(required = false, defaultValue = "0") int specialtyId,
@RequestParam(required = false, defaultValue = "0") ... |
1ceeeec3-a440-4372-9337-3156f4e40dbf | 7 | public final void stopCutscene(Player player) {
if (player.getX() != endTile.getX() || player.getY() != endTile.getY()
|| player.getPlane() != endTile.getPlane())
player.setNextWorldTile(endTile);
if (hiddenMinimap())
player.getPackets().sendBlackOut(0); // unblack
player.getPackets().sendConfig(1241, 0... |
84ca4e73-3d0a-4533-91d0-89a4502f7b29 | 8 | @Override
Move makeMove() {
Move m = null;
if (!_started) {
while (true) {
String s = getGame().getMove();
if (s.equals("p")) {
break;
} else {
m = Move.create(s);
if (getBoard().i... |
6bcd9c32-fec6-44c6-96df-57c640ede288 | 1 | public Bank(int n, double initialBalance)
{
accounts = new double[n];
for (int i = 0; i < accounts.length; i++)
accounts[i] = initialBalance;
bankLock = new ReentrantLock();
sufficientFunds = bankLock.newCondition();
} |
4586046f-9b66-4905-9359-4cb6d12ddb09 | 7 | private static void loadUnpackedItemExamines() {
Logger.log("MusicHints", "Packing music hints...");
try {
BufferedReader in = new BufferedReader(
new FileReader(UNPACKED_PATH));
DataOutputStream out = new DataOutputStream(new FileOutputStream(
PACKED_PATH));
while (true) {
String line = in.r... |
de4d586f-09f7-41ad-8ef0-a66fb83c83bb | 2 | private boolean smaller(Rectangular base, Rectangular upper) {
if (base.length > upper.length && base.width > upper.width) return true;
return false;
} |
51939078-5e21-4c9e-8183-6365b0253e80 | 8 | public static void zigZagTraversal(TreeNode root) {
if (root == null)
return;
Stack<TreeNode> parents = new Stack<TreeNode>();
Stack<TreeNode> childs = new Stack<TreeNode>();
boolean forward = true;
parents.add(root);
while (!parents.empty()) {
TreeNode current = parents.peek();
parents.po... |
aac3dbf9-2c2c-4ec3-aa42-b59f1654a0f6 | 6 | private void sendContentToOutputDevice(Vector<JSONObject> contentToShow, String type){
//if care display is used
if(useXMPPConnection){
xmppConnection.sendContentToScreen(contentToShow, type);
}
//for debugging without care_screen or output on other devices such as robots
else{
Utils.printWithDate("Sent... |
cdbae341-4365-42ac-8641-4281deed3c63 | 8 | public boolean equals(Object x) {
if (!(x instanceof Entry))
return (false);
T[] a = arr.get();
if (a == null)
return (false);
Entry<?> e = (Entry<?>) x;
Object[] ea = e.arr.get();
if (ea == null)
ret... |
a1e64ca6-994a-47f7-91de-2c87b34a4e47 | 6 | public int trap(int[] A) {
int len = A.length;
int [] maxL = new int[len];
int [] maxR = new int[len];
int max = 0;
for(int i = 0; i < len; ++i){
maxL[i] = max;
if(max < A[i]) max = A[i];
}
max = 0;
for(int i = len - 1; i >= 0; --i... |
f809cf99-56f2-42cd-88ff-c7b544756e2a | 4 | public Utility(ModManager McLauncher) {
if(McLauncher!=null){
this.McLauncher = McLauncher;
gamePath = McLauncher.gamePath;
modPath = McLauncher.modPath;
con = McLauncher.con;
if(System.getProperty("os.name").toLowerCase().contains("windows")){
con.log("Log","OS Windows");
//OS="win";
... |
ca591b34-fd29-4794-af8b-ccc0f10b01a6 | 5 | @Override
protected boolean xhas_in ()
{
// If we are in the middle of reading the messages, there are
// definitely more parts available.
if (more_in)
return true;
// We may already have a message pre-fetched.
if (prefetched)
return true;
... |
4e46ed2f-1b16-4341-b5a9-580da6765d23 | 2 | public static void main(String[] args) {
boolean b = test1(0) && test2(2) && test3(2);
System.out.println("expression is " + b);
} |
5f80d981-0374-4234-8455-b63b48cbd250 | 9 | public IEntityImage createFile(String... dotStrings) throws IOException, InterruptedException {
dotStringFactory = new DotStringFactory(colorSequence, stringBounder, dotData);
shapeMap = new HashMap<IEntity, Shape>();
printGroups(null);
printEntities(getUnpackagedEntities());
// final Map<Link, Line> lineM... |
0fbaf41a-4d86-4bd3-844b-234545201517 | 5 | public static boolean zipFolder(File folder, String fileName){
boolean success = false;
if(!folder.isDirectory()){
return false;
}
if(fileName == null){
fileName = folder.getAbsolutePath()+ZIP_EXT;
}
ZipArchiveOutputStream zipOutput = null;
try {
zipOutput = new ZipArchiveOutputStream(new F... |
c27e99c6-1be1-4dba-a6ba-d436ce8b0cbc | 7 | private final void method2872(int i, int i_90_) {
anInt8918++;
for (Class348_Sub43 class348_sub43
= ((Class348_Sub43)
((Class348_Sub16_Sub1) aClass348_Sub16_Sub1_8958)
.aClass262_8848.getFirst(i + -2005674596));
class348_sub43 != null;
class348_sub43
= ((Class348_Sub43)
((Class348_Sub... |
97cdef5c-93c8-4583-811b-c238af5dbf7d | 6 | protected void addImpl(int index, int sublistIndex, int sublistOffset, T item) {
if (sublistIndex < headSublistIndex + (calculateSublistsUsed() >>> 1)) {
if (index == 0) {
addFirst(item);
} else {
CircularListInternal<T> prev = sublists.get(headSublistIndex);
if (sublistOffset ==... |
128ad794-3d8d-4ba7-a33c-31392a1710bf | 4 | public void render(){
for(int y = 0; y < map.length; y++){
for(int x = 0; x < map[0].length; x++){
int tile = map[x][y];
if(tile == Tile.GRASS)
screen.render(Tiles.GRASS, x * tileWidth, y * tileHeight);
else if(tile == Tile.WALL)
... |
067a0cf6-06ce-4272-adb0-e0a6bd00ef08 | 5 | public void save(){
if(this.getId() != null){
String q = "SELECT id, name " +
"FROM call_types " +
"WHERE id = ?";
try {
PreparedStatement statement = ru.vladambulance.call.Type.Type.getConnection().prepareStatement(q,
... |
abc1a218-a3e4-40e3-af9a-ae2b3a7b8829 | 3 | public Vector<BaseClass> getRankedClasses(int rank) {
Vector<BaseClass> bc = new Vector<>();
for (ClassMap item : _classMap) {
if (item.getRace().getName().equals(_race.getName())) {
if (item.getAverage() == rank) {
bc.add(item.getClassType());
... |
64c5aa5c-8325-4b8f-9f4a-003ad195c122 | 2 | static public int[] arraysDims(String[] arr) {
if (arr.length > 1) {
int[] idx = new int[arr.length - 1];
for (int i = 1; i < arr.length; i++) {
idx[i - 1] = Integer.parseInt(arr[i]);
}
return idx;
}
return null;
} |
53c23061-0034-415b-b822-b46338f126d7 | 1 | private int evaluateValueofBoardForWhite(Board board) {
int wValue = 0;
if (board.isWhiteWinner()) {
wValue += POINT_WON;
return wValue;
} else {
wValue = WhiteBlackPiecesDifferencePoints(board);
// wValue += BoardPositionPoints(board);
... |
22e8e762-15d3-46ac-ad48-9d5a846b37d4 | 9 | public ClassFile getClassFile2() {
ClassFile cfile = classfile;
if (cfile != null)
return cfile;
classPool.compress();
if (rawClassfile != null) {
try {
classfile = new ClassFile(new DataInputStream(
new... |
0af76ece-8fa2-4101-96b8-952f05ded421 | 6 | public void migrateToUUID() {
// Bail if no-one has ever been warned
// or this is a first run
if (!getConfig().contains("Warned")) {
return;
}
// Get all the currently warned players and put them in a HashMap
Map<String,Object> userList = getConfig().getConfigurationSection("Warned").getValues(fal... |
81a06b0d-dce2-4069-a0fb-0a23bca0e68c | 4 | public boolean isValidPassword(String userName, String password) {
try {
String pwdFromDB = loginDao.getUserPassword(userName);
if (null != pwdFromDB) {
if (pwdFromDB.equals(password)) {
return true;
}
}
} catch (Exception ex) {
if (!(ex instanceof DaoException)) {
ex.printStackTrace()... |
338b9acb-45e3-4ce9-bb60-05ef36d1f622 | 1 | public void setReachable() {
if (!reachable) {
reachable = true;
setSingleReachable();
}
} |
edf36d41-5df0-4e16-8d61-177744b0f24f | 5 | private void number() {
// Some preliminaries
int tempCharPos = charPos;
int x = nextChar;
tempString = "";
//tempString += (char)x;
// So if we are here, we have a number so, crunch numbers until a . or non number
while((x>= 48)&&(x <=57)){ // while x is an element of the set {0,1,2,3,4,5,6,7,8,9}
... |
e0bbb7fb-32ef-4962-bfc8-c27721dc1463 | 4 | @BeforeMethod
@Test(groups = { "Integer-Sorting", "Primitive Sort" })
public void testBubbleSortInt() {
Reporter.log("[ ** Bubble Sort ** ]\n");
try {
testSortIntegers = new BubbleSort<>(
primitiveShuffledArrayInt.clone());
Reporter.log("1. Unsorted Random Array\n");
timeKeeper = System.currentT... |
4e5a835f-75a9-4689-97fa-9bda6ec2f7f6 | 6 | public ArrayList<BookType> getAllBookType() {
ArrayList<BookType> ret = new ArrayList<BookType>();
Connection conn = null;
Statement st = null;
ResultSet rs = null;
try {
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/librarysystem?user=admin&password=123456");
st=conn.createStatement();
... |
dd28c0b1-f499-4f73-8a42-28bac9761f2d | 7 | public void buildingWeather(){
if (document != null) {
NodeList headerList = document.getElementsByTagName("header");
System.out.println("노드" + headerList.item(0).getChildNodes().getLength());
for (int i = 0; i< headerList.getLength(); i++){
// childNode
for (int k = 0; k < headerList.item(i).getChil... |
ed742c4c-e450-425b-9280-eeeaf0d8f06b | 2 | public static String getMenuKeyValueStr() {
String s = "";
for (int i = 0; i < getMenuKeySymbolCount(); i++) {
s += menuSymbols[i].name;
if (i < getMenuKeySymbolCount() - 1)
s += ", ";
}
return s;
} |
22018d2b-91a4-4c3d-97c7-7bf5882f91f7 | 6 | private Location getRandomLocation(String location)
throws DestinationInvalidException {
double random = Math.random();
boolean above = false;
int x, y, z;
World world;
// Will it be a positive or negative number
if (random > 0.45D)
above = true;
else
above = false;
x = getRandomNumberRange(1... |
b0ec3305-2371-4e90-a03a-9c41f98ab4c9 | 2 | private void createComboBox() {
comboBox = new JComboBox();
if (ProjectMainView.getCampaign().getQuizes().size()!=0) {
for (QuestPoint q : ProjectMainView.getCampaign().getQuizes()) {
comboBox.addItem(Integer.toString(q.getId()));
}
table.getColumnModel().getColumn(1);
}
comboBox.setVisible(false);... |
fe8e8946-d4fb-4fe3-ab4c-90e54f39a4e5 | 6 | public Typelignepl LignePl(Coords c) {
if (this.moveTo(Direction.UPLEFT).equals(c) || c.equals(this.moveTo(Direction.DOWNRIGHT))) {
return Typelignepl.DIAGONAL2;
} else if (this.moveTo(Direction.UPRIGHT).equals(c) || c.equals(this.moveTo(Direction.DOWNLEFT))) {
return Typelignepl.DIAGONAL1... |
256fbd01-2c5f-4db1-819f-b050791f74f9 | 9 | public boolean sameConfig(ComputerPlay compareComputer) {
int i=0;
if(compareComputer.hasChecksums() && hasChecksums() && !sameChecksum(compareComputer.checksums)) {
return false;
}
Vector<PlayRule> compareComputerPlayRules = compareComputer.getPlayRules();
for(PlayRule rule:playRules) {
PlayRule compar... |
1fa3ccd4-6c26-4bd9-b8a6-f9235b9dc671 | 8 | boolean traverseItem(boolean next) {
Control[] children = parent._getChildren();
int length = children.length;
int index = 0;
while (index < length) {
if (children[index] == this)
break;
index++;
}
/*
* It is possible (but unlikely), that application code could have
* disposed the widget in ... |
f14db456-f5da-417f-a02f-2b9be916ca7c | 4 | public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
if (cmd.getName().equalsIgnoreCase("kit")){
if (!(sender instanceof Player)) { // If sender isn't a player fail
sender.sendMessage("This command can Only be run by a player");
return false;
} else {
Playe... |
6bb4827f-7e4f-43c3-97dc-3024cbe61633 | 5 | public SimRace() {
cars = new Car[numberOfCars];
accident = new Accident(500, cars);
for (int i = 0; i < numberOfCars; i++) {
cars[i] = new Car(laps);
}
for (Car c : cars) {
c.start();
}
accident.run();
try {
for (int i = 0; i < cars.length; i++)
cars[i].join();
accident.join();
} ... |
94b56d90-6aa3-4f07-9540-bb6e52294fee | 1 | private JSlider getJSliderWordsCount() {
if (jSliderWordsCount == null) {
jSliderWordsCount = new JSlider();
jSliderWordsCount.setMinimum(5000);
jSliderWordsCount.setMaximum(150000);
jSliderWordsCount.setValue(50000);
jSliderWordsCount.addChangeListener(new ChangeListener() {
@Override
public v... |
3c4ae707-0ea1-400b-a309-09c805cb477a | 4 | public static void main(String [] args)
{
// initialize student and class configuration data
int studentNumber = 0;
String studentName = "blank";
String studentHandle = "000000";
String className = "297D/";
String configFileName = "./configBatch.txt";
// System.out.println("configFileName: " + ... |
6f0ac1a6-266f-42b6-8856-c85726db11ed | 6 | public static void main(String[] args) {
try {
HttpURLConnection getConnection = (HttpURLConnection) (new URL(SERVLET_ADDRESS)).openConnection();
getConnection.setDoOutput(true);
getConnection.setDoInput(true);
getConnection.setInstanceFollowRedirects(false);
... |
14632468-56fa-4154-9e67-76bd87a5ddf8 | 9 | public void solve(char[][] board) {
if(board==null || board.length<=1 || board[0].length<=1)
return;
//use flood fill method at edge rows and columns
//first and last rows
for(int i=0;i<board[0].length;i++)
{
fill(board,0,i); //flood fill starting from pos(0, i)
fill(... |
8670a6cd-2f3f-43c4-adf3-682609a99e0c | 1 | public void draw(Graphics2D g2d) {
if (!isOutOfScreen) {
g2d.drawImage(img_movingSquare, (int) x, (int) y, null);
}
} |
45e2ac2d-47c6-4b58-833a-03a1e700c6b9 | 8 | public void registrar(ProxyClient cliente, String password){
String id="";
//BufferedImage image = (BufferedImage)((Image) cliente.icon.getImage());
Image source = cliente.icon.getImage();
int w = source.getWidth(null);
int h = source.getHeight(null);
BufferedIma... |
925c4649-9b2d-48bd-8083-273ffb5ee69c | 1 | public void updateRow(int index, Object[] array) {
// data[rowIndex][columnIndex] = (String) aValue;
EntityTransaction userTransaction = manager.getTransaction();
userTransaction.begin();
Project updateRecord = projectService.updateProject((String) array[0],
(String) array[1], (String) array[2], (String) ar... |
47cb271e-d02c-4627-b4c8-239735097476 | 3 | public Node getNode(Node node, String nodeName) {
NodeList list = node.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
Node serverNode = list.item(i);
if (list.item(i).hasChildNodes() && list.item(i).getNodeName().equals(nodeName)) {
return serverNod... |
35a51bc3-4587-47dd-82d5-bd1f821ba552 | 4 | public void select(IWorkbenchPartReference toSelect) {
if(toSelect == null)
return;
clearSelection();
for (int i = 0; i < listItems.size(); i++) {
TabListItemWidget listItem = listItems.get(i);
if(listItem.has(toSelect)) {
selectedIndex = i;
if(selectedItem != null)
selectedItem.desele... |
9a5c2111-13c7-479d-aa61-850696507453 | 0 | public void addDownloadFileType(FileType fileType){
this.downloadFileTypes.add(fileType.getType());
} |
7852fa13-fdd1-4a78-b3d4-9382a02cc428 | 7 | public void reborn(int oldAgentId, int newAgentId) {
/*古い様式のtraitsリストの中に最古のtraitが入っていた場合は、preferenceLengthの値を更新する必要がある可能性がある*/
Trait oldTrait = traitMap.get(oldAgentId);
traitMap.remove(oldAgentId); //古い様式をHashMapから取り除く
if (oldTrait.containsValue(OLDEST_TRAIT_NUM)) {
final int INFINITE = 10000; //わざと不正に大きな... |
7a75b9f6-7407-494b-a714-61effd1cbeff | 5 | public Tile(int x, int y, int typeInt) {
tileX = x * 40;
tileY = y * 40;
type = typeInt;
r = new Rectangle();
if (type == 5) {
tileImage = StartingClass.tiledirt;
} else if (type == 8) {
tileImage = StartingClass.tilegrassTop;
} else if (type == 4) {
tileImage = StartingClass.tilegrassLeft;
... |
2ac91046-c529-42db-a289-538c46a7e6e1 | 7 | static final void method1760(int i, int i_0_, boolean bool, int i_1_,
byte i_2_, int i_3_, int i_4_, int i_5_) {
if (i_2_ > -85)
method1762(-14, 70, 13, -100);
anInt5940++;
if (((bool
? ((Class348_Sub51) BitmapTable.aClass348_Sub51_3959)
.aClass239_Sub26_7215.method1838(-32350)
: ((Clas... |
d88d106d-43de-4b2d-baee-6ab8fcc4065f | 3 | @Override
public boolean equals(Object o) {
if (o instanceof Matrix) {
Matrix m = (Matrix) o;
if (m.getWidth() == getWidth() && m.getHeight() == getHeight()) {
return Arrays.deepEquals(m.data, data);
}
}
return false;
} |
ac7e2360-e437-4694-b1ca-fa5d99c53cdb | 9 | public Queue<String> doubleOsevenXMLUnit(){
try {
path = new File(".").getCanonicalPath();
FileInputStream file =
new FileInputStream(new File(path + "/xml/papabicho.xml"));
DocumentBuilderFactory builderFactory =
DocumentBuilderFactory.newInstance();
... |
0f367f73-3392-42f2-8c84-180fb439ca79 | 0 | public String getArea() {
return Area;
} |
4d854c22-d6ea-4496-a20f-3280a81fd1ef | 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... |
65930d0d-edd2-4a7a-a07d-a6ec9afcac35 | 4 | public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors =new ActionErrors();
if (login.length()<3 && login.length()<30 )
{
errors.add("loginError", new ActionMessage("login.error"));
}
if (password.length()<3 && password.length()<30 )
{
errors.... |
0f045eb2-a85d-467c-a750-b6811413902a | 7 | public static Locale getLocale() {
XMLInputFactory xif = XMLInputFactory.newInstance();
XMLStreamReader in = null;
File options = FreeColDirectories.getClientOptionsFile();
if (options.canRead()) {
try {
in = xif.createXMLStreamReader(new FileInputStream(optio... |
3ccae520-fac7-44a2-a137-ddf87b3683d4 | 2 | private void checkFourOfAKind() {
for (int i = 0; i < 13; i++) {
if (getNumberOfValues(i) == 4) {
myEvaluation[0] = 8;
myEvaluation[1] = i;
myEvaluation[2] = i;
myEvaluation[3] = 0;// Find leftover card
break;
}
}
} |
52a3bdcf-23c1-402a-9a35-120c0953c08c | 0 | @After
public void tearDown()
throws Exception
{
scheduler.shutdown();
} |
c704b9b0-f6e3-47dd-83ed-fb687a0365f8 | 5 | public void night() {
// End of simulation
endOfSimulation = true;
for (int i = 0; i < grid.getWidth(); i++) {
for (int j = 0; j < grid.getDepth(); j++) {
if (getSubject(i, j) == null) {
continue;
}
if (getSubj... |
30db66bd-3e3e-4826-bfa5-fbf0b9ac1c36 | 7 | public boolean equals(Object _other)
{
if (_other == null) {
return false;
}
if (_other == this) {
return true;
}
if (!(_other instanceof BillPayeePk)) {
return false;
}
final BillPayeePk _cast = (BillPayeePk) _other;
if (billId != _cast.billId) {
return false;
}
if (userId ... |
dcd71aa5-9585-4e9d-a0b4-5f31cca41693 | 1 | private JTextField getTxFieldArtistName() {
if (txFieldArtistName == null) {
txFieldArtistName = new JTextField();
txFieldArtistName.setText("Eminem");
txFieldArtistName.setBounds(10, 42, 86, 20);
txFieldArtistName.setColumns(10);
}
return txFieldArtistName;
} |
faa5460d-55da-4e75-8cf1-72f7051447cc | 9 | private String determineCurrentCategoryDependingOnGameboardPosition() {
int currentPos = currentPlayer.getGameboardPositions();
if (currentPos == 0) return CATEGORY_POP;
if (currentPos == 4) return CATEGORY_POP;
if (currentPos == 8) return CATEGORY_POP;
if (currentPos == 1) return CATEGORY_SCIENCE;
if (c... |
4b445550-aa95-425b-8e3a-5697963512ec | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
cce2fde2-c690-4141-a8a2-96358472fea9 | 6 | final boolean method1534() {
boolean bool = Class348_Sub10.method2788() != 0;
if (!bool)
return false;
int i = anIntArray2726.length;
for (int i_42_ = 0; i_42_ < i; i_42_++)
anIntArray2721[i_42_] = anIntArray2726[i_42_];
int i_43_ = anIntArray2724[anInt2722 - 1];
int i_44_ = Class299.method2253(i_43_ - ... |
ad19cf71-c344-4ab7-8388-731c81898ff2 | 6 | @Override
public void removeVisitor(MapleCharacter visitor) {
final byte slot = getVisitorSlot(visitor);
boolean shouldUpdate = getFreeSlot() == -1;
if (slot != -1) {
broadcastToVisitors(PlayerShopPacket.shopVisitorLeave(slot));
switch (slot) {
case 1:
chr1 = new WeakReference(null);
bre... |
86c716bf-196a-4340-8eb2-c844d0255d07 | 3 | public void cadastraProfessor(String nome, String matricula)
throws ProfessorJaExisteException {
boolean teste = false;
for (Professor e : professores) {
if (e.getMatricula().equals(matricula)) {
teste = true;
break;
}
}
if (teste == false) {
Professor p = new Professor(nome, matricula);
... |
815f4a41-bc69-4234-9eec-b40dcf312d9d | 3 | private void getDataFromUserTable () {
try {
connection = DriverManager.getConnection(Utils.DB_URL);
statement = connection.createStatement();
resultSet = statement.executeQuery("SELECT id, name, date_created, date_lastlog FROM User");
while (resultSet.next()) {
... |
c3aada97-9e13-4857-9762-63cbbdf7ca85 | 6 | public boolean exist(char[][] board, String word) {
int m = board.length;
int n = board[0].length;
if( word.length() == 0 ) return false;
if( m * n < word.length() ) return false;
for ( int i = 0; i < m; i++ ) {
for ( int j = 0; j < n; j++ ) {
if( bo... |
92d2958f-056b-4730-9271-792f954146df | 6 | public static void main(String[] args) {
String line;
BufferedWriter bufferedWriter = null;
// try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in))) {
try (BufferedReader bufferedReader = new BufferedReader(new FileReader(inputFilePath))) {
... |
63cb494c-aa31-4079-8029-87ae67e26cb4 | 3 | private void getKeywordsInSentence(String sen, int index) {
Iterator<String> it = keywords.iterator();
while (it.hasNext()) {
String s = it.next();
if (sen.indexOf(s) != -1) {
if (!keywordExtracted.containsKey(s)) {
KeywordInfo ki = new KeywordInfo();
keywordExtracted.put(s, ki);
}
keywo... |
9a113edc-bb78-4665-8709-cd4a31057417 | 8 | public boolean hit(int upcard, int total, boolean soft) {
if (soft) {
return total < 18 || (total == 18 && (upcard >= 9 || upcard == 1));
} else {
if (total < 12) return true;
if (upcard > 6 || upcard == 1) return total <= 16;
if (total > 12) return false;
return upcard <= 3;
}
} |
6adb4caf-f881-4963-9313-1cec0315df95 | 2 | public static JSONObject toJSONObject(String string) throws JSONException {
JSONObject jo = new JSONObject();
HTTPTokener x = new HTTPTokener(string);
String token;
token = x.nextToken();
if (token.toUpperCase().startsWith("HTTP")) {
// Response
jo.p... |
b21deb4f-26b0-43b9-9069-7ebf52b17bed | 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 fe... |
acbc2cdb-698b-46a1-bb37-1be3d43c5c2c | 5 | public void givePlayerOfflineXP(Player player) {
String SQL = "SELECT * FROM " + tblOfflineGains + " WHERE `player` = ? AND `world` = ?";
// plugin.info("givePlayerOfflineXP: " + player.getName() + " in " +
// player.getWorld().getName());
boolean deleteEntries = false;
Connection con = getSQLConnection();... |
169c666d-f160-424f-971d-e86239f3bc82 | 2 | public MicromouseFrameworkGUI() {
super("Micromouse Framework GUI");
JPanel panel = new JPanel(true);
panel.setLayout(new BorderLayout());
/*
* GRID: NORTH
*/
JPanel p1 = new JPanel(new GridLayout(1, 6, 2, 2));
// make combo box
// - label
JTextField tit... |
b445bc14-1bfb-4960-afba-b0f38b165ebc | 6 | private static void writeResults(HashMap<Long,HashMap<String,Holder>> map) throws Exception
{
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(ConfigReader.getBurkholderiaDir()+
File.separator + "summary" + File.separator + "pivotedSNPS.txt")));
HashSet<String> strains= new HashSet<String>... |
10883cb7-16b5-4205-a7d9-d2f5aadafa7e | 7 | private static void addContigLayer(JsonObject root) throws Exception
{
List<JsonObject> list = new ArrayList<JsonObject>();
addNodeAndChildren(root, list);
System.out.println("Got " + list.size() + " flat nodes");
HashMap<Integer, List<JsonObject>> outerMap = new HashMap<Integer, List<JsonObject>>();
f... |
5b49c43b-3212-4c87-b032-4b666d396a6e | 4 | public static int drawMultiLineString(Graphics2D g2d, String text, int lineWidth, int x, int y) {
FontMetrics m = g2d.getFontMetrics();
int originalY = y;
if (m.stringWidth(text) < lineWidth) {
g2d.drawString(text, x, y);
} else {
String[] words = text.split(" ");
String currentLine = words[0];
for... |
85619b67-93bd-4137-a438-82a09e608444 | 5 | @Override
public boolean isDiagonalObstacle(Element elementPassingThrough, Element otherDiagonalElement) {
if (otherDiagonalElement instanceof LightTrailPart && isConnectedTo((LightTrailPart) otherDiagonalElement))
return true;
if (otherDiagonalElement instanceof Player && this.getPlayer().equals(otherDiagonalE... |
6beffd57-6f67-4752-9110-55330662080b | 8 | public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
ChatColor yellow = ChatColor.YELLOW;
ChatColor red = ChatColor.RED;
if(args.length < 1) {
if(sender instanceof Player) {
Player player = (Player) sender;
if(player.hasPermission("CrazyFeet.crazymagic... |
7d5eae7b-9173-401c-ae97-249af376b419 | 0 | public static Campaign getCampaign() {
return campaign;
} |
6141ef77-efdf-4232-860e-d95f00252ef7 | 2 | public Node getHeadNode(int linkedListLength){
if(linkedListLength<=0){
return null;
}
node.setData(count);
node.setNextNode(null);
prevNode = node;
for(int i=2;i<=linkedListLength;i++){
count++;
currNode = new Node();
currNode.setData(count);
currNode.setNextNode(null);
prevN... |
01d639ed-926d-499f-8a49-a84e64cb6543 | 8 | public void serve() {
if (preSubmitted.isEmpty() && activeEngines.isEmpty()) {
return;
}
if (!preSubmitted.isEmpty()) {
Iterator<Engine> it = preSubmitted.iterator();
while (it.hasNext()) {
Engine engine = it.next();
if (!engine... |
ea19d5d3-c30e-4743-b422-4043cdcaf777 | 0 | public DataProvider()
{
this.datasets = new ArrayList<DataSet>();
} |
4bb1c1e4-36d2-4cdc-b926-32973d1d06af | 5 | @SuppressWarnings("unused")
public void move(){
if(!motionLock){
double stepX;
double stepY;
double angle;
stepX = new Random().nextInt(3);
stepY = new Random().nextInt(3);
while(!(posX + stepX > 0) &&
!(posX + stepX < settings.screenWidth - 40) &&
!(posY + stepY > 0) &&
!(posY + ste... |
ceb4af40-f3d3-40fd-91a4-0f69f56440d0 | 5 | public static List<List<Integer>> generate(int numRows) {
List<List<Integer>> res = new ArrayList<List<Integer>>();
for (int i = 0; i < numRows; i++) {
List<Integer> l = new ArrayList<Integer>();
for (int j = 0; j < i + 1; j++) {
if (0 == i || 0 == j || i == j) {
l.ad... |
aa0aab5d-ce0f-4715-bcd5-783f185e440d | 7 | public void kasitteleKayttajanKomento()
{
switch(kayttajanKomento)
{
case SIIRTO_VASEMMALLE: siirraTetriminoa(Suunta.VASEN); break;
case SIIRTO_OIKEALLE: siirraTetriminoa(Suunta.OIKEA); break;
case KAANTAMINEN: kaannaTetriminoa(Suunta.OIKEA); break;
... |
3cd72eb2-9b7e-49f1-9048-01d51bdf36a6 | 9 | private void validateOveractivePolling(
final int index,
final StubConnection conn,
final StubConnection previous) {
BOSHClient session = client.get();
if (session == null || previous == null) {
// No established session
return;
}
... |
2800f88b-092f-41b9-9a5b-79f2ccd97ea3 | 3 | protected void endGame(int status) {
if(gameEnded) {
this.running = false;
}
else {
gameEnded = true;
if(pauseScreen != null && !pauseScreen.isDestroyed()) {
pauseScreen.canDraw = false;
pauseScreen.destroy();
}
... |
a6064157-c4d4-49e4-b437-1e97b72e0cce | 6 | private void getAllRooms(){
Document doc = getXmlFile();
NodeList nList = doc.getElementsByTagName("Location");
if(debugConsole){
System.out.println("Locations in XML-File");
System.out.println("-------------------");
System.out.println("");
System.out.println("Number : "+nList.getLength());
Syste... |
1ac13c73-26cb-4a33-b79c-c553867b5394 | 2 | public int lastIndexOf(Attributes attributeList) {
for (int i = size - 1; i >= 0; i--) {
if (attributeLists[i] == attributeList) {
return i;
}
}
return -1;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.