method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
24ed6c8d-c0a3-4fde-954a-41e9cd5dfd63 | 3 | public boolean wallCollision() {
return (x - r <= 0.0 || x + r >= 1.0 ||
y - r <= 0.0 || y + r >= 1.0);
} |
4cd1ca47-da3a-45c7-bf2b-c73f1023dc92 | 8 | public void setOptions(String[] options) throws Exception {
String mString = Utils.getOption('P', options);
if (mString.length() != 0) {
setPercent((double) Double.parseDouble(mString)); //setNumberOfAttributes((int) Integer.parseInt(mString));
} else {
setPercent(0);
mString = Utils.getOption('... |
cb1eb163-1c17-4c38-9a21-787f5f78e742 | 1 | public void addToStart(String value) {
ListElement current = new ListElement(value);
if (count == 0) {
head = current;
tail = current;
} else {
current.connectNext(head);
head = current;
}
count++;
} |
61e76e25-6436-4c8b-a8d2-417ef45ccad6 | 2 | public void run() {
while (!generator.isCanceled()) {
int val = generator.next();
if (val % 2 != 0) {
System.out.println(val + " not even!");
generator.cancel();
}
}
} |
b042ef7e-9069-4d03-adc7-6c5223332c61 | 6 | public boolean etsiSana(String sana) {
Node current = null;
// Haetaan juuresta sanan alkukirjaimen niminen solmu
for (int i = 0; i < juuri.size(); i++) {
if (juuri.get(i).getName() == sana.charAt(0)) {
current = juuri.get(i);
}
}
if (curre... |
c1fe277b-c1da-4e24-a8a2-3a5380ec4428 | 1 | public Rama_Hoja(String pLogicaCompuerta,String pID,Lista<String> listaHashCode){
this._nombre = pID;
this._logicaCompuerta = pLogicaCompuerta;
this.arrayIO = new Lista<>(listaHashCode);
if(pLogicaCompuerta == "IN")
this._ValorOutPut = 0;
else
thi... |
07cae067-a60a-4328-adb1-d4dbd98ca136 | 0 | protected ConvertController initializeController(ConvertPane pane,
SelectionDrawer drawer, Automaton automaton) {
return new PDAConvertController(pane, drawer,
(PushdownAutomaton) automaton);
} |
d525d007-18d1-4e6b-8316-7cc3fd576988 | 5 | public ArrayList<String> getOwnedResources() {
ArrayList<String> res = new ArrayList<String>();
if (resources.get("BRICK").intValue() > 0) {
res.add("BRICK");
}
if (resources.get("GRAIN").intValue() > 0) {
res.add("GRAIN");
}
if (resources.get("WOOL").intValue() > 0) {
res.add("WOOL");
}
if (r... |
7b9b4894-7ffc-436b-9b55-f4aee98f7bd3 | 0 | @Override
public void mouseReleased(MouseEvent e) {
unprocessedEvents.add(e);
mouse = e.getPoint();
} |
e83f3cda-5698-41fe-ac5c-ae7e17b62779 | 6 | public boolean isPalindrome(String s) {
int left = 0;
int right = s.length() - 1;
while (left < right) {
while (left < right && !Character.isLetterOrDigit(s.charAt(left))) {
left++;
}
while (left < right && !Character.isLetterOrDigit(s.charAt(right))) {
right--;
}
if (Character.toLowerCase(... |
c911f7c3-9d38-4933-b96d-1248fbe6ef12 | 0 | public UserIntroOutroView()
{
super("Intro and Outro edition view");
Toolkit toolkt = Toolkit.getDefaultToolkit();
Dimension screenSize = toolkt.getScreenSize();
this.setSize(374,500);
this.setLocation(screenSize.width/4, screenSize.height/4);
getContentPane().setLayout(null);
panel = new JPanel();... |
1de11190-61d7-4dcc-8d8e-223bc85590d4 | 1 | public SLKeyframe addDelay(float delay, Component... cmps) {
for (Component c : cmps) delays.put(c, delays.get(c) + delay);
return this;
} |
6ccc8b79-fdce-4512-b0f9-d773add09a9d | 4 | public void stablizeQueues()
{
for(int i = 0; i < ioQueue.size(); i++)
{
if(ioQueue.contains(ioQueue.get(i)))
{
for(int j = i+1; j < ioQueue.size(); j++)
{
if(ioQueue.get(j) == ioQueue.get(i))
{
ioQueue.remove(j);
break;
}
}
}
}
} |
b1ea1377-ca9b-4e76-94a8-2f41a885c13a | 4 | public void SetAImove(Coordinate move){
boolean test = false;
if (test || m_test) {
System.out.println("GameWindow :: SetAImove() BEGIN");
}
getDrawing().SetAImove(move);
if (test || m_test) {
System.out.println("GameWindow :: SetAImove() END");
}
} |
1b70a2aa-25ed-4572-973d-f1f9902d4b6e | 5 | public void load(String coastLineFile) throws IOException, Exception {
BufferedReader br;
br = new BufferedReader(new FileReader(coastLineFile));
String line;
while ((line = br.readLine()) != null) {
if (line.contains(">")) {
while (!nodeRefQueue.isEmpty()) {... |
d59a3e64-6091-4e0e-947b-0c5d56c7e2d4 | 6 | public static ArrayList<Instruction> parseFile(String file){
ArrayList<Instruction> instructionList = new ArrayList<Instruction>();
try {
BufferedReader br = new BufferedReader(new FileReader(file));
String ins;
while((ins = br.readLine()) != null){
ins.trim();
String[] insPart = ins.split(REGEXP_S... |
f9e86774-a977-45cb-806d-6b6df284ac31 | 2 | public static JSScriptInfo LoadScriptFromFile(File file) {
if (script_list.get(file.getName()) != null) {
if (script_list.get(file.getName()).olderThen(file)) {
script_list.get(file.getName()).LoadFromFile(file);
}
} else script_list.put(file.getName(), new JSScriptInfo(file));
return script_list.get(fi... |
3658f663-b755-4cbe-b044-b4c86b65751a | 3 | public void tick() {
if(caretBlink){
if(System.currentTimeMillis() - lastBlinkTime > blinkDelay){
caretBlink = !caretBlink;
lastBlinkTime = System.currentTimeMillis();
}
}else{
if(System.currentTimeMillis() - lastBlinkTime > blinkDelay){
caretBlink = !caretBlink;
lastBlinkTime = System.curr... |
007b80a9-d6f5-461e-a85c-c6592236d79c | 3 | public static void takeScreenshot(String fileName) {
int width = Display.getWidth();
int height = Display.getHeight();
glReadBuffer(GL_FRONT);
int bpp = 4; // Assuming a 32-bit display with a byte each for red, green, blue, and alpha.
ByteBuffer buffer = BufferUtils.createByteB... |
04e04fee-7d9c-4c37-ba6f-233b93d418e2 | 8 | private void init() {
password = new PasswordField("Password:");
password.setVisible(false);
final VerticalLayout layout = (VerticalLayout) this.getContent();
layout.setMargin(true);
layout.setSpacing(true);
password.setInputPrompt("Enter your password");
password.setSizeFull();
passwo... |
1ec365c2-1755-449a-87b3-4512552a6a5e | 4 | public static double gumbelMaxInverseCDF(double mu, double sigma, double prob) {
if (prob < 0.0 || prob > 1.0) throw new IllegalArgumentException("Entered cdf value, " + prob + ", must lie between 0 and 1 inclusive");
double icdf = 0.0D;
if (prob == 0.0) {
icdf = Double.NEGATIVE_INFINITY;
} else {
if (pr... |
4db4bf7a-b306-4477-9615-06e30ae54643 | 9 | public void actionPerformed(ActionEvent event) {
if(event.getActionCommand().equals("Cancel")){
node.highlight(false);
this.setVisible(false);
parent.redrawGUINow(); // needs blocking redrawing
}
else if(event.getActionCommand().equals("OK")){
try{
node.setPosition(new Position(Double.parseDouble(... |
10ad93cc-6579-40bf-8c8a-00825b79b66b | 3 | public boolean exitUp(ArrayList level, int x) {
boolean exitUp = false;
int[] exits = null;
for(int i = 0; i < level.size(); i++) {
exits = (int [])level.get(i);
if(exits[1] == x) {
if((exits[0] & Integer.parseInt("1", 16)) > 0) {
exitU... |
ad9b9e34-292f-4875-9850-d7f42c906c49 | 3 | @Override
public void mouseMoved(MouseEvent event) {
Cursor cursor = Cursor.getDefaultCursor();
int x = event.getX();
if (mOwner.overColumnDivider(x) != null) {
if (mOwner.allowColumnResize()) {
cursor = Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR);
}
} else if (mOwner.overColumn(x) != null) {
... |
00e1fd15-d6ee-4710-baa1-20e2d95854e3 | 3 | public boolean playerJoin(Player player) {
if (arenastate == ArenaState.STAT_OPEN) {
if (players.contains(player)) {
plugin.sendtoplayer(player, "Ѿھ");
return false;
}
if(players.size()>=maxplayer){
plugin.sendtoplayer(player, "˾");
return false;
}
plugin.sendtoplayer(player, ChatColor.... |
7f8d21f2-da33-4d61-81cd-b2410c95830f | 5 | public CheckResultMessage checkF07(int day) {
int r1 = get(10, 2);
int c1 = get(11, 2);
int r2 = get(13, 2);
int c2 = get(14, 2);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if (0 != getValue(r1 + 6, c1 + day, 2).abs().compare... |
4568401c-be0b-4191-9cd6-80ecdf66ad92 | 0 | protected JComponent initTreePanel() {
treeDrawer.hideAll();
treeDrawer.setNodePlacer(new LeafNodePlacer());
return treePanel;
} |
41346a02-e611-47eb-869f-48b48d7688ff | 3 | private void imprimir_cabecera(Stack pila, Token tokenReconocido) {
//Cabecera
System.out.print(padRight("Parsing Stack", 135));
System.out.print(padRight("Input", 20));
System.out.print("Acción");
//Salto de linea
System.out.println();
//Parsing Stack
... |
9b0615b1-b8d7-4a7e-be06-a3561fec8b44 | 5 | @Override
public String toString() {
long pos = pos();
buffer.position(0);
int[] bytes = Ln.toIntArray(getAllBytes());
buffer.position((int)pos);
int count = 0;
String out = "";
for (int i = 0 ; i < bytes.length && i < 1000 ; i++) {
out += Ln.printHex(bytes[i]);
if (i + 1 == pos) {
out += ">";
... |
b5420649-a86d-4360-9269-41cd68b9b96f | 9 | public static QuestionEquation decode(String str) throws DecodeException {
QuestionEquation res = null;
if (str.substring(0, 17).compareTo("#QuestionEquation") == 0) {
res = new QuestionEquation();
int i = 17;
if (str.charAt(i) == '<') {
while (str.cha... |
50b99125-ec1c-4fba-a7b6-48dec7678694 | 1 | public ContainsMethod( String name, Class<?>... argumentsType )
{
this.name = name;
this.argumentsType = argumentsType;
} |
00547115-ab5c-4139-9333-9b3b0ec121c6 | 5 | public static LogCategory swigToEnum(int swigValue) {
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) {
return swigValues[swigValue];
}
for (int i = 0; i < swigValues.length; i++) {
if (swigValues[i].swigValue == swigVa... |
02e1d55b-46a5-433d-91d2-61d1370d3720 | 7 | public void filterValues(double minValue, double maxValue) throws IOException {
for (int i = 0; i < rows; i++) {
double value = values.get(i);
if (!Double.isNaN(minValue) && !Double.isNaN(value) && minValue > value) {
values.set(i, Double.NaN);
}
i... |
f11b7852-0efb-4a7c-8d50-1e08408c0a8c | 5 | @Override
public void run() {
try {
String temp = mInput.readLine().toUpperCase();
boolean everythingOK = true;
if (temp.startsWith("GET")) {
// isolate mInput field between slash and space
int start = temp.indexOf('/') + 1;
int end = temp.indexOf(' ', start);
String field = temp.substring(... |
113584bc-8372-45d6-840a-95b2be7aff26 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CD other = (CD) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return tr... |
7b0352cd-3588-404b-9ee2-8c5f1babe69d | 2 | private Block copyBlock(final Block block) {
final Block copy = newBlock();
// Copy the stack from the end of the old block.
// But don't change it when instructions are added.
final Tree tree = new Tree(copy, block.tree().stack());
copy.setTree(tree);
// Fill the tree.
final Iterator stmts = block.tre... |
55abde0c-4ea8-4635-9fc5-a5f2eff8eeb7 | 8 | public Estatistica()
{
leitor = new Scanner(System.in);
String comandosDeConfig = leitor.nextLine();
/* Apos fazer a leitura e dividir a string em substrins separando-as pelas virgulas
* então manda para o switch fazer as conversões e atribuiçãoes, caso não seja pass... |
215eaf67-7df1-47c2-ad67-ad8407c6488c | 2 | public static void main(String[] args) {
int count = 1;
for(int i = 0; i < 7; i++){
for(int j = 0; j < count; j++){
System.out.print(count);
}
System.out.println();
count++;
}
} |
a285dda1-b333-4f02-be41-a7fc767f9f6a | 1 | public boolean isPlaying() {
synchronized (MP3Player.this) {
return !isPaused && !isStopped;
}
} |
0dcc0450-9678-4e9a-a20a-e300fc3b43bf | 1 | public static String multiplyString(String input, int number_of_times) {
StringBuffer s = new StringBuffer();
for (int i=0; i<number_of_times; i++) {
s.append(input);
}
return s.toString();
} |
32b5c296-615a-47c5-a9be-a7d1ecb636ef | 8 | public void run() throws IOException, ClassNotFoundException {
readConfig();
String asHostName = clientProperties.getProperty("as.hostname");
int asPortNumber = Integer.parseInt(clientProperties.getProperty("as.port"));
String clientName = clientProperties.getProperty("client.name");
... |
6874ceb8-49e6-4a14-ba28-cd1f1a0b6b36 | 2 | private static void producer(){
Random r = new Random();
while (true){
try {
que.put(r.nextInt(100));
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} |
e4a69897-080e-4bce-b96c-35f12633b4cd | 0 | @Test
public void deleteMinMultipleEntries() {
initializeWithABC();
l.delete();
assertEquals(b, l.min());
} |
f9ce9e72-3658-474e-9ff7-b8f03a59cad8 | 7 | public EntityType getType() {
if (isFalling()) {
if (moveTactic.getXOrientation() > 0) {
return EntityType.DOODLE_R_F;
}
if (moveTactic.getXOrientation() < 0) {
return EntityType.DOODLE_L_F;
}
return lastOrientation.equa... |
86fcbbd8-1817-4817-9cbe-904d2da521ee | 6 | private static boolean checkShouldLoop() { // Note[01];
System.out.print("\nThat was fun! Do you want to play again?"
+ "\nPlease enter 1 for Yes, 0 for No: ");
//Grab the first character of the user's response for if/else checking
char chkChar = keyboard01.next().charAt(0);
if (chkChar == '1' || ... |
aa06cf3b-b946-495a-abfd-7fdb281dfd63 | 3 | private void updatePlatterQuantities(int[] platter, int round) {
for (int i=0; i < platter.length; i++) {
if (round == FIRST) {
platter[i] -= r0_seen_fruit[i];
}
else {
platter[i] -= r1_seen_fruit[i];
}
if (platter[i] < ... |
7aea7d22-e19a-474e-8cda-8902376a9204 | 7 | public static Mapper constructMapperFromHeaderInfo(int iNESNumber) {
int mapperType = (iNESNumber & 0xFF) / 16;
Mapper mapper = null;
switch(mapperType) {
case 0: // NROM
mapper = new Mapper_000_NROM();
break;
case 1: // MMC1
... |
8c745508-cc43-404f-a49c-8175262301f9 | 0 | @Override
public void handler(String str) {
System.out.println(str);
} |
b87924a2-9447-45a8-bff2-7ff3530f2b9d | 6 | public static void main(String[] args) {
for(int i = 0; i < args.length; i++){
System.out.println(i + " : " + args[i]);
}
int rank = Integer.parseInt(args[0]);
int N = Integer.parseInt(args[1]);
int offset = Integer.parseInt(args[2]);
String folder = args[3];
try {
System.out.println("Start");
... |
30f2c253-2619-4a5a-9e5d-709beea2f1cb | 3 | public void serialize(ByteWriter bw) throws IOException {
int size = 2;
byte[][] b = new byte[size()][];
int i = 0;
for (ItemID j : this) {
ByteArrayOutputStream ba = new ByteArrayOutputStream();
ByteWriter w = new ByteWriter(ba);
j.serialize(w);
b[i++] = ba.toByteArray();
}
for (... |
b83a5485-fbfe-4645-92f9-1e2a10f773ca | 6 | public static final Editor createEditorForExtension(String extension,
JWP app) {
EditorActionManager eam = app.getEditorActionManager();
// Is it an HTML File?
for (int i = 0; i < HTMLEditor.FILE_EXTENSIONS.length; i++) {
if (extension.equals... |
11411d8a-13b9-4974-96ee-9b1b6bd74129 | 9 | @Override
public final void placeShip(ShipEnum s, Direction d, int startX, int startY) {
int length = 0;
int index = 0;
switch (s) {
case CARRIER: {
length = ShipInterface.CARRIERLENGTH;
index = BattleshipModel.CARRINDEX;
break;
}
case BATTLESHIP: {
length = ShipInterface.BATTLESHIPLENGTH;
... |
3fd30597-33a9-4f0c-bcb9-7ebba18c0e0d | 9 | public static void main(String [] args) throws Throwable {
if (args.length < 2) {
usage();
return;
}
Class stemClass = Class.forName("org.tartarus.snowball.ext." +
args[0] + "Stemmer");
SnowballStemmer stemmer = (SnowballStemmer) stemClass.newInstance();
Reader reader;
... |
8f05d253-fd36-4e47-a3dd-e54599da9a76 | 5 | private static int[] merge(int[] a, int l, int m, int h) {
int i = 0;
int j = l;
int[] b = new int[m+1];
while (j <= m) {
b[i] = a[j];
i++;
j++;
}
i=0;
int k = l;
while (k<j && j<=h) {
if (b[i]<a[j]) {
a[k] = b[i];
i++;
} else {
a[k] = a[j];
j++;
}
k++;
}
w... |
1033c5ad-d9ba-44be-867b-2fe0a68eaa71 | 5 | public MobSpawner spawnMob(Player player, int playerY, int heightRange, Location spawnLoc, boolean wideLoc, boolean tallLoc, int time, int lightLevel, Biome biome, Material materialBelow, Environment environment, boolean outsideSpawnLimits)
{
// Fetch all the mobs which we can spawn in this location
ArrayList<Mob... |
f8c5483f-9753-4311-8334-d61b58e08814 | 8 | @Override
public void keyReleased(KeyEvent k) {
if (!fieldInited)
return;
if (!isAlive()) {
this.lives = 3;
this.initField();
gameOverlay.clearLastDialog();
}
if (k.getKeyCode() == KeyEvent.VK_UP
|| k.getKeyCode() == KeyEvent.VK_KP_UP
|| k.getKeyCode() == KeyEvent.VK_DOWN
|| k.getKeyCod... |
37ad46c0-baea-4099-814e-8ba23476e399 | 8 | @Override
protected void setTextPosition(Graphics2D g2d) {
/**
* Get the font metrics and the bounding rectangle for the component's text
* for use calculating the text position.
*/
FontMetrics fm = g2d.getFontMetrics();
fm.stringWidth(componentText);
Rectangle2D r = fm.getStringBounds(c... |
66721fd2-5403-49b5-9f38-e7590e75157c | 9 | public int redTicket(int a, int b, int c) {
if ( a == b && b == c && c == 2 && a == c )
return 10;
if ( a == b && b == c && a == c )
return 5;
if ( a!=b && a!=c )
return 1;
else
return 0;
} |
18666e1b-f3b2-4db6-a369-111bb7653059 | 9 | private boolean r_Step_4() {
int among_var;
int v_1;
// (, line 91
// [, line 92
ket = cursor;
// substring, line 92
among_var = find_among_b(a_5, 19);
if (among_var == 0)
{
return false;
... |
b5559556-046b-4576-9392-4be93d63cca8 | 1 | @Override
public boolean init(List<String> argumentList, DebuggerVirtualMachine dvm) {
if (argumentList.size() > 0) {
UserInterface.println("This command takes no arguments.");
HelpCommand.displayHelp(this);
return false;
}
return true;
} |
a0e1f4c8-f1af-49db-88ac-8da43c063fe1 | 7 | private void updateSkylight_do()
{
Profiler.startSection("recheckGaps");
if (this.worldObj.doChunksNearChunkExist(this.xPosition * 16 + 8, 0, this.zPosition * 16 + 8, 16))
{
for (int var1 = 0; var1 < 16; ++var1)
{
for (int var2 = 0; var2 < 16; ++var2)... |
02bc644c-7124-453a-81a5-6940248f0811 | 0 | public OutlinerDocument getDocument() {return this.doc;} |
f283d74c-9d54-4cc2-859d-eacc0f3a507c | 9 | private void appendValue(
StringBuffer buf,
Hashtable oidSymbols,
DERObjectIdentifier oid,
String value)
{
String sym = (String)oidSymbols.get(oid);
if (sym != null)
{
buf.append(sym);
}
else
... |
967a2d47-51da-4a64-a405-f59f41e649d0 | 9 | private void printParametersToFile(int niteration) throws IOException
{
PrintWriter pw;
String szfile;
if (szoutfileID.equals(""))
{
szfile = szoutputdir+"/model_"+numstates+".txt";
pw = new PrintWriter(szfile);
}
else
{
szfile = szoutputdir+"/model_"+numstates+"_"+szoutfileID+".txt";
... |
382adeb5-2c95-456c-bb0c-f502f3530c0e | 3 | public static int countAlreadyUsed(Data myData){
int usedHjs = 0;
for(int subjectNo=0; subjectNo<12; subjectNo++){
for(int hj=0; hj<4; hj++){
if (myData.subjects[subjectNo].semesters[hj].usedState != Semester.UsedState.none){
usedHjs++;
}
... |
a2e7993b-e847-4d52-adc6-d3a496edf4f0 | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals... |
05d681b4-069b-482d-9f39-84a501891f68 | 0 | public SimpleStringProperty streetNameProperty() {
return streetName;
} |
93f2d1c0-f249-4a0f-ba7c-47ac850b24c2 | 0 | public void setParkAddress(String parkAddress) {
this.parkAddress = parkAddress;
} |
18219294-58a0-46b7-b38f-b442180c3088 | 7 | public void body()
{
// Gets the PE's rating for each Machine in the list.
// Assumed one Machine has same PE rating.
MachineList list = super.resource_.getMachineList();
int size = list.size();
machineRating_ = new int[size];
for (int i = 0; i < size; i++) {
... |
a80735e7-b44b-4221-b8c9-b2fe5423a390 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
for (i = 0; i < length; i += 1) {
c = next();
if (c == 0) {
return false;
}
circle[i] = c;
}
for (;;) {
j = offset... |
cb474708-2bcf-4ef3-b3c2-d3ddba86358d | 3 | public boolean checkPhase(int time)
{
if(time == Time.DAY)
{
return dayPhase;
}
else if(time == Time.DUSK)
{
return eveningPhase;
}
else if(time == Time.NIGHT)
{
return nightPhase;
}
else
{
return false;
}
} |
1d5901a9-0bfd-4e81-a7a2-bc3329b9d0ca | 1 | @Override
public void repaint(Rectangle bounds) {
if (mOwner != null) {
mOwner.repaintHeader(bounds);
}
} |
2145e152-9d01-4c59-a9f3-15b53e16b688 | 0 | public File getConfigFile() {
// I believe the easiest way to get the base folder (e.g craftbukkit set via -P) for plugins to use
// is to abuse the plugin object we already have
// plugin.getDataFolder() => base/plugins/PluginA/
// pluginsFolder => base/plugins/
// The base is n... |
b520bec6-a1e6-499f-813c-582ae916e78d | 5 | private String readUI() {
System.out.flush();
System.out.print("> ");
System.out.flush();
String data = null;
BufferedReader inputHandle = new BufferedReader(new InputStreamReader(System.in));
boolean wait = true;
while (wait) {
try {
if (inputHandle.ready()) {
wait = false;
} else {
... |
3f4da1f6-2d39-43e6-82ee-c7125cbea6e5 | 7 | public void printlnComment(String comment) {
if (this.strategy.isCommentingDisabled()) {
return;
}
if (!newLine) {
out.println();
}
out.print(this.strategy.getCommentStart());
out.print(' ');
for (int i = 0; i < comment.length(); i++) {
... |
cb0a8e62-96af-4e4d-8d69-870e8af745bb | 9 | public OBJModel(String fileName){
positions = new ArrayList<>();
texCoords = new ArrayList<>();
normals = new ArrayList<>();
indices = new ArrayList<>();
hasTexCoords = false;
hasNormals = false;
BufferedReader meshReader;
try{
meshReader = new BufferedReader(new FileReader(fileName));
Strin... |
13c3f875-49cc-494a-8813-fb3f023ea4b4 | 2 | void avancer(Voiture v) {
int i = 0;
while (i < vehicules.length && !v.equals(vehicules[i])) {
i++;
}
vehicules[i] = null;
vehicules[i + 1] = v;
} |
ecc38831-4b66-4e76-97e6-cbc276e40c37 | 4 | private void remove(int[] goawayvals){
for(int i = 0; i < terrain.length; i++){
for(int j = 0; j < terrain[0].length; j++){
for(int k : goawayvals){
if(terrain[i][j] == k){
terrain[i][j] = 0;
}
}
}
}
} |
1c3825de-11d9-4929-973e-3519dbf15dec | 0 | public Daytime getDaytime() {
return daytime;
} |
17acf28e-b698-44a9-bda7-ae97fa60da94 | 8 | public boolean isClash(TDTDateAndTime arg0) {
boolean isClashTDT = false;
if (arg0.isTimedTask() == true) {
if (!this.getStartDate().equals("null")
&& !this.getStartTime().equals("null")) {
// Handle cases when "this" task only have start date and time
if (this.getEndDate().equals("null")
&& t... |
98608a01-08cf-4872-9663-eab201bc4ed8 | 4 | protected void createSysTray(){
if(SystemTray.isSupported()){
SystemTray tray = SystemTray.getSystemTray();
BufferedImage bufImage = null;
try {
bufImage = ImageIO.read(getClass().getResourceAsStream(RED_ICON));
} catch (IOException e1) {
System.err.println("Couldn't load systray image");
}... |
487e5041-b00c-4154-93fb-16f95a88a1a3 | 4 | @Override
public void keyReleased(KeyEvent arg0) {
// TODO Auto-generated method stub
if (arg0.getKeyCode() == KeyEvent.VK_W)
{
this.canMove = true;
}
if (arg0.getKeyCode() == KeyEvent.VK_S)
{
this.canMove = true;
}
if (arg0.getKeyCode() == KeyEvent.VK_A)
{
this.canMove = true;
}
if (... |
50c6a46e-3a46-422f-8fe7-8b247b4b02b4 | 2 | private boolean block(){
for(ERow row : ERow.values()){
if(getRow(row) == 2){
//we need block
System.out.println("we need block");
return getFreeCell(row);
}
}
return false;
} |
77c91b4d-bebd-4bd7-86f4-cfc1c3209323 | 1 | static void print(int[] A){
for(int i=0;i<A.length;i++){
System.out.printf("%d ", A[i]);
}
System.out.println();
} |
5ac0630e-177b-4377-8d58-81372666aaa2 | 2 | private void updateRecentMenu()
{
menuRecent.removeAll();
for (int i = 0; i < recentList.size(); i++)
{
final JMenuItem item = new JMenuItem(recentList.getItem(i).toString());
item.addActionListener(new ActionListener()
{
@Override
... |
efd319a6-3aaf-4f92-a79b-30ca38bcecef | 0 | @AfterClass
public static void tearDownClass() throws Exception {
} |
c2fe3a62-6564-456b-b555-8447b43c0560 | 1 | public static boolean GetMouseDown(int mouseButton)
{
return GetMouse(mouseButton) && !m_lastMouse[mouseButton];
} |
299fcdd5-cdf3-49e4-a06f-14e2d3a5bd01 | 2 | public String toString() {
StringBuilder result = new StringBuilder("{");
for (Map.Entry<Class<?>, Integer> pair : entrySet()) {
result.append(pair.getKey().getSimpleName());
result.append("=");
result.append(pair.getValue());
result.append(", ");
}
result.delete(result.length() - 2, result.length()... |
fe72a221-9f49-4afb-9512-b354b662eec7 | 5 | public static void Nine(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*9;
}
int temp=(int)str.charAt(i)-(int)('0');
if(temp < 9 && temp... |
6c05a4b2-4416-457c-a600-9fd66ec47053 | 0 | public Harrish()
{
super("Harrish", 15000, 100, 3, 5, hs);
hs.setSkill(0, "GivesUp", -9000, 0, "Harrish gives up.");
hs.setSkill(1, "Motivation", 30, 200, "Harrish becomes motivated.");
hs.setSkill(2, "Cower", 20, 500, "Harrish cowers in fear.");
hs.setSkill(3, "Hide", 600, 1000, "Harrish hides, confusing hi... |
ada7d9ca-4a4f-415f-bd58-60140794f5b8 | 7 | public void keyPressed(KeyEvent evt) {
/** store old selection */
int newSelection = selection;
switch (evt.getKeyCode()) {
case KeyEvent.VK_UP:
case KeyEvent.VK_LEFT: newSelection -= 1; break;
case KeyEvent.VK_DOWN:
case KeyEvent.VK_RIGHT: newSele... |
2f75df47-a559-44b2-8150-2d2ac8f0f846 | 1 | public boolean isOpen() {
if (first + second < 10)
return true;
else
return false;
} |
60bc17e6-d542-427f-9f43-e3f26b159bc3 | 9 | public static int resolveInteiro(Escopo escopo, String esquerda, String operador, String direita) {
int valor1 = 0;
int valor2 = 0;
Variavel var1 = escopo.buscaVariavel(esquerda);
Variavel var2 = escopo.buscaVariavel(direita);
if (var1 != null) {
valor1 = ((Inteiro)var1).getValor();
} else {
try {
... |
a1926d64-1aaa-4b6f-95ab-dc66009adb06 | 3 | public void retrieve() {
if (FacesContext.getCurrentInstance().isPostback()) {
return;
}
if (this.id == null) {
this.groupBE = this.example;
} else {
this.groupBE = groupService.findGroup(id);
if (groupBE == null) {
groupBE = new GroupBE();
example = new GroupBE();
}
}
} |
121fbdfa-50e2-41ef-bfe7-a5b3b58b259e | 9 | void run(){
Scanner sc = new Scanner(System.in);
int A = sc.nextInt(), B = sc.nextInt(), K = sc.nextInt(), res = 0;
int[] a = new int[10], b = new int[10], w = new int[11], c = new int[10];
for(int i=0;i<10;i++){
a[i] = A%10; A/=10;
b[i] = B%10; B/=10;
}
for(int S=0;S<1<<10;S++){
int k = 0, C = 0;
... |
13f69957-0ba7-4dc3-9e7b-23a5eb9369bc | 1 | public BrainPanelTest() throws HeadlessException
{
super();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
JLayeredPane layeredPane = new JLayeredPane();
setLayeredPane(layeredPane);
final BrainPanel brainPanel = new BrainPanel();
layeredPane.add(brainPan... |
31aeab32-7d6d-4795-aad0-0cc1afa0806a | 1 | @Override
public void actionPerformed(ActionEvent ae) {
if(ae.getActionCommand().equals("save")) {
this.liveView.export();
this.workspace.export();
}
} |
ea65915d-a4b2-46de-874b-801ff94f6e1b | 1 | @BeforeClass
public static void before()
{
g1 = new Genotype(1, 2);
g2 = new Genotype(g1);
try {
g3 = new Genotype(g1,g2);
} catch (GenomSizeNotMatchException e) {
fail("Could not create genotype based on two other genotypes");
}
} |
7b50d3e1-5ba0-4414-9a39-3f79e41f4b15 | 9 | private void addRandomBoulders(IceMap map) {
int attempts = 0;
int maximumAttempts = 500;
int randomBoulders = (map.getWidth() * map.getHeight()) / 15;
while(randomBoulders > 0 && attempts < maximumAttempts){
int x = random.nextInt(map.getWidth());
int y = random.nextInt(map.getHeight());
... |
ce959d07-15d3-4c7c-a4d2-0afee5efcfd6 | 3 | public int getIndex(ArrayList<Person> list) {
String[] values = null;
if (comboBox.getSelectedItem() != null) {
values = ((String) comboBox.getSelectedItem()).split("\\t");
int index = 0;
for (Person person : list) {
if (person.getId() == Integer.parseInt(values[1].trim()))
break;
index++;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.