method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f43607b8-4604-4718-8691-e547c9cf5a4e | 9 | public void createBankAccount(CommandSender sender, String name, String player)
{
Bank bank = iConomy.getBank(name);
if (!iConomy.hasAccount(player)) {
Messaging.send(sender, this.Template.color("error.bank.account.none"));
return;
}
Account account = iConomy.getAccount(player);... |
e452dc60-b1a2-4598-b541-6d98ec3e2b44 | 7 | private void updateView() {
/* Siuntėjo/gavėjo grupė */
int index = 0;
if (textRadio.isSelected()) {
index = 1;
} else if (imageRadio.isSelected()) {
index = 2;
}
/* Pakeičiamas siuntėjas/gavėjas */
currentSender = senders[index];
... |
0262a578-22f3-4d19-86a1-1df5c0696dc1 | 5 | static final boolean method2354(LocationMode class364, int i) {
anInt3954++;
if (i != -1)
method2355(-93, (byte) 115, true, null, -92, -67, 6);
if (Class367_Sub8.aClass364_7361 != class364
&& Class26.aClass364_382 != class364
&& Class108.aClass364_1657 != class364
&& class364 != Class342.aClass36... |
2b85792b-c7eb-407c-bc49-69009d4e7309 | 0 | public SingleTaskQueue(TaskExecutor<T> taskExecutor) {
this.taskExecutor = taskExecutor;
} |
51bc92db-ab81-473c-8b03-f563c59f2ba1 | 3 | public int getHealthyPeople() {
int persons = 0;
for (int i = 0; i < items.size(); i++) {
if (items.get(i) instanceof Person) {
if(! items.get(i).dying() ) persons++;
}
}
return persons;
} |
678be985-3fb9-4400-bdf7-21a7c473e5e5 | 1 | public boolean Step(int direction)
{
boolean result = super.Step(direction); // call Moveables Step
if(result) // Check if we were able to move?
{
client.setEye(this); //Update eye.
return true;
}
return false;// Otherwise return false
} |
dcf63297-8016-4ff4-a821-97441872c80f | 9 | public void demarrer(Client joueur) {
int choiceInt = -1;
boolean wrong = true;
System.out.println("Bienvenue dans l'hôtel\nQue voulez-vous faire?");
System.out.println("Votre solde est de " + joueur.soldeDuCompte + "€");
System.out.println("Bienvenue à l'hotel du Casino"
... |
7e4754c0-0258-4fab-a2c7-e40ee0c63978 | 9 | private static void getCmdsPlayer(Player player) {
m.player(player, "&a____________[ &6DoOdy Commands &a]____________");
m.player(player, "&a____________[ &6Short: /dm, /duty &a]____________");
if (player.isOp() || player.hasPermission("doody.duty")) {
m.player(player, "&6/doody &bon &fTurns on Duty Mode.");
... |
f6021959-2ed6-40be-af60-5a08c3120090 | 7 | public final boolean equals(Object par1Obj)
{
if (!(par1Obj instanceof LongHashMapEntry))
{
return false;
}
else
{
LongHashMapEntry var2 = (LongHashMapEntry)par1Obj;
Long var3 = Long.valueOf(this.getKey());
Long var4 = Long.valu... |
3ed9b414-2c22-4e9d-a3a5-4f7e06272abe | 5 | private void attack(){
if (attackTime >= attackSpeed && isHooked){
attackTime = 0;
int k = ms.getDmg();
int levelP = hookedPlayer.getInfo().getLevel();
int levelM = ms.getLevel();
float pierce = (levelM - levelP) * Balance.PIERCE_REDUCT;
if (pierce < 0){
pierce = 0;
}
float reduct = hooked... |
0c3dab2d-9dad-4ec7-bb4a-f37c1f388a20 | 1 | protected boolean isFinished() {
return _hasChanged && !Robot.tomahawk.isForward();
} |
a8a06743-00c0-4fe9-9db2-43fff6d3336f | 6 | public boolean canSellerLogout() {
String serviceName;
Set<String> services = this.matchingUsers.keySet();
Iterator<String> serviceIt = services.iterator();
HashMap<String, String> userStatuses;
while (serviceIt.hasNext()) {
serviceName = serviceIt.next();
if (!this.matchingUsers.isEmpty())... |
70f06760-e5e9-48b1-8c0a-ece3d84df45a | 7 | private void populate()
{
Random rand = Randomizer.getRandom();
field.clear();
for(int row = 0; row < field.getDepth(); row++) {
for(int col = 0; col < field.getWidth(); col++) {
if(rand.nextDouble() <= FOX_CREATION_PROBABILITY) {
Location loca... |
b7201fa1-3ad4-49c7-80db-e8c52bc3a14c | 4 | public static void main(String[] args) {
try{
System.out.println("Start time ms:" +System.currentTimeMillis());
if(args.length>=1){
min_support = Integer.parseInt(args[0]);
System.out.println("Using Min Support of "+min_support);
}
Vector<String> candidates = new Vector<String>();
MongoClient ... |
0d1db0e5-1e9a-4a44-b02a-2c1633bd7e1e | 4 | public static Mapper parseMapTask(String mapTaskDetailsJsp, boolean needMetrics) {
Document mapDetails = HtmlFetcher.getHtml(mapTaskDetailsJsp);
Element tr = null;
for(Element elem : mapDetails.getElementsByTag("tbody").first().children()) {
if(elem.child(2).text().equals("SUCCEEDED")) {
tr = elem;
... |
cc407e9e-2ff5-453c-968d-0116df506bdc | 7 | public static Object[][] getData(String csvFile) throws Exception {
int numberOfLines = countLines(new File(csvFile));
if (numberOfLines == -1) {
throw new Exception("File not found exception");
}
BufferedReader br = null;
String line = "", csvSplitBy = ",";
... |
058a5059-7daa-44bf-a549-f2b92d70fa22 | 7 | public void advanceX(Direction direction) {
if(limitToScreenBounds) {
if(direction == Direction.LEFT) {
if((this.x - speed) < 0) {
// Prevent movement, object is at min screen bounds
return;
}
} else if(direction == Direction.RIGHT) {
if((this.x + speed) > (this.panelWidth - this.width)) {... |
6b199ebb-d1be-4e8e-a6e7-6b028493664e | 3 | private Class<?> compileSource0(String className, String sourceCode) throws Exception {
List<MemorySourceJavaFileObject> compUnits = new ArrayList<MemorySourceJavaFileObject>(1);
compUnits.add(new MemorySourceJavaFileObject(className + ".java", sourceCode));
DiagnosticCollector<JavaFileObject> diag = new Di... |
3b2dabd4-4847-4a8e-884a-c70ddf1b5ed0 | 5 | public static Map toMap(JSONObject json, String key) {
if (null == json) {
return null;
}
if (!StringUtils.isEmpty(key) && !json.has(key)) {
return null;
}
Map jsonMap = new HashMap();
JSONObject convertible = StringUtils.isEmpty(key) ? json
: (JSONObject) json.get(key);
Iterator keysIterator = ... |
0dc95c20-a352-485f-b502-1ea000011e43 | 3 | public static String getFileHeader(InputStream is) {
byte[] b = new byte[28];
try {
is.read(b);
} catch (IOException e) {
LOGGER.info("InputStream Reading Error!");
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
LOGGER.info("InputStream Closing Error!"... |
cf57bd6d-ec5f-4392-be94-4d88fff736bf | 4 | private String getJSONString() throws UBLFetchException {
InputStream inputStream = null;
try {
inputStream = m_ublLocation.openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder jsonStringBuilder = new StringBuild... |
b1f97e75-8097-46a9-ab50-8c89af82807a | 2 | @Override
public void actionPerformed(ActionEvent event) {
if ((event.getSource().equals(btnOk)) || (event.getSource().equals(btnCancel))) {
modalResult = (event.getActionCommand().equals("ok"));
setVisible(false);
}
} |
8b06563f-a334-4e86-ae8b-aaf628c6d798 | 6 | private Fraction reduce()
{
Fraction result = new Fraction();
int common = 0;
// get absolute values for numerator and denominator
int num = Math.abs(numerator);
int den = Math.abs(denominator);
// figure out which is less, numerator or denominator
if (num > den)
co... |
e27df9d8-95e8-48c1-ab8b-928f80a4e7ea | 5 | @Override
public void flush()
{
// Only a streaming source can be flushed, because only streaming
// sources have queued buffers:
if( channelType != SoundSystemConfig.TYPE_STREAMING )
return;
// determine how many buffers have been queued:
int queued ... |
1592411a-b2f3-4d3f-8a36-72ea80a29f86 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
e7242301-5aee-443a-8115-972f44bab56b | 1 | @Override
public void addPropertyFilter(String key, PropertyFilter filter) {
PropertyFilterChain filter_chain = getPropertyFilterChain(key);
if (filter_chain == null) {
filter_chain = new PropertyFilterChainImpl();
setPropertyFilterChain(key, filter_chain);
}
filter_chain.addFilter(filter);
} |
859f4da9-0f66-4402-acdf-05806df6c5a3 | 3 | private void createContent() {
content = new JEditorPane();
content.setContentType("text/html");
content.setEditable(false);
setNicerFont(content);
content.addHyperlinkListener( new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEven... |
deb099ce-a705-432c-a5f3-33938078281b | 9 | private void treatmentPage(){
TTP_remark.setText(null);
TreatmentRec treatmentRec = new TreatmentRec(db,patient,doctorID);
if (patient != null){
patient.addTreatmentRec(treatmentRec);
TTP_remark.setText(patient.getTreatmentRec(patient.getTreatmentRecSize()-1).getCondition());
patient.getTreatmen... |
29f6aa88-4269-458b-a151-8682e636c3c8 | 1 | public static LayerBox getInstance() {
if (instance_ == null) instance_ = new LayerBox();
return instance_;
} |
ae642ce2-4976-4fca-a3e3-4e04cbb81e00 | 4 | public final Path getPath(final String titleMsg, final FileFilter filter,
final File initialDirectory) {
final JFileChooser chooser;
final JLabel title = new JLabel(titleMsg);
this.mainFrame.isAlwaysOnTop();
chooser = new JFileChooser(initialDirectory);
chooser.setDialogTitle(title.getText());
chooser.se... |
684c71ad-a7b9-4dd3-a471-dd2b8d32e70d | 1 | public static void listEmployees(EntityManager entityManager) {
TypedQuery<Employee> query = entityManager.createQuery(
"select e from Employee e", Employee.class);
List<Employee> resultList = query.getResultList();
entityManager.close();
for (Employee employee : resultList) {
System.out.println(employ... |
3581153f-13c7-4cb5-ae77-1ed96e9cee28 | 1 | public void updateMenu() {
_highScoreInt.setText(String.valueOf(Fenetre._score.getHigh()));
_currentScoreInt.setText(String.valueOf(Fenetre._score.getCurrent()));
remove(_next);
remove(_credits);
if (Fenetre._level.nextLvlExist()) {
add(_next);
} else {
add(_credits);
}
} |
000c3b85-e457-45bb-8e9c-0e4f057ecc44 | 5 | public static ArrayList<Song> initialDownload(String userName)
{
ArrayList<Song> allSongs=new ArrayList<Song>();
ArrayList<String> dates= new ArrayList<String>();
ArrayList<String> names= new ArrayList<String>();
ArrayList<String> artists = new ArrayList<String>();
Elements dateList;
Elements nameList;
E... |
d1445192-981a-4d90-b6d2-fe7654507b33 | 5 | @Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equalsIgnoreCase("polymorph Mad Cow") && npc != null && player != null)
{
if (MAD_COW_POLYMORPH.containsKey(npc.getNpcId()))
{
// remove the feed info from the previous mob
if (_FeedInfo.get(npc.getObjectId(... |
924bc7e8-27f2-460d-88f6-ba380c89beca | 1 | public static Point extractPoint(String buffer) {
int[] values = extractIntegers(buffer);
if (values.length == 2) {
return new Point(values[0], values[1]);
}
return null;
} |
7b491073-b2e8-4c28-a67c-366a32a9ced2 | 6 | private static Paint createButtonPaint(AbstractButton button, int lineBorderWidth, boolean isDarkColorScheme) {
boolean isPressed = button.getModel().isPressed();
Color topPressedColor = isDarkColorScheme ? WidgetBaseColors.DARK_ACTIVE_SELECTED_TOP_COLOR : WidgetBaseColors.LIGHT_ACTIVE_SELECTED_TOP_COL... |
7522e279-56e7-4618-b485-f9f11c0b61a2 | 3 | private void goLeft(ColorPatch patch, int x, int y) {
if ( --x >= 0 ) {
Color color = pixel(x, y);
if ( isIncluded(x, y) ) {
if ( patch.getColor().distance(color, Color.RGB_DISTANCE) < tolerance ) {
patch.add(color);
goLeft(patch, x, y);
}
}
exclude(x, y);
}
} |
842970b3-64ca-471c-a160-8b7157ec31a1 | 9 | private void processKeyRelease(KeyEvent e) {
int keyCode = e.getKeyCode();
keys[keyCode] = false;
if (gameController.isNewCharacterOpen()) {
} else if (keyCode == Settings.buttonMoveLeft) {
keyLeftPressed = false;
if (!keyRightPressed) {
gameCont... |
c6cacd1e-c363-428a-898e-c0f0f2804623 | 1 | public synchronized void clearAll() {
for (Key key : keys) {
key.clear();
}
} |
6e8cfe25-0afd-4cbf-bdb5-ca4fc2c1375f | 8 | public static boolean generatorCollectionP(Stella_Object collection) {
if (((Boolean)(Logic.$REVERSEPOLARITYp$.get())).booleanValue() &&
(!Logic.closedTermP(collection))) {
return (false);
}
{ Surrogate testValue000 = Stella_Object.safePrimaryType(collection);
if (Surrogate.subtypeOfP(t... |
161e673d-a445-43d3-915e-837413774cd9 | 0 | @Override
public String getPostalCode() {
return super.getPostalCode();
} |
19032d4e-26af-4147-9699-d8ac831377ec | 8 | @SuppressWarnings("deprecation")
public static boolean czyGraczMaItemy(String p) {
boolean czyMa = true;
Player pp = Bukkit.getPlayer(p);
if (!pp.getInventory().contains(new ItemStack(Material.DIAMOND, 64))) {
czyMa = false;
}
if (!pp.getInventory().contains(new ItemStack(Material.GOLD_INGOT, 64))) {
... |
824cac3c-ad7e-4803-8340-56f4a55eee37 | 0 | public Document getDocument() {return this.doc;} |
63c34ae6-0db0-42e0-b123-2f8c93941377 | 1 | public boolean shouldPaint(){
return myKeeper == null ? true: !myKeeper.sensitive;
} |
415b54f3-aa8b-44e9-aad7-48cd6486b413 | 7 | public void loadConfig() {
boolean bSaveFile = false;
if (m_Plugin.getDataFolder().exists() == false) {
m_Plugin.getDataFolder().mkdir();
}
File configFile = new File(m_Plugin.getDataFolder(), m_ConfigFile);
if (configFile.exists() == true) {
try {
... |
b45d45aa-f02e-4939-83c5-e259b47f047b | 9 | public static Object[] decodeValues(String str) throws DecodeException {
Object[] res;
int i=0;
int beginning = i;
while (str.charAt(i) != '>') {
i++;
}
String[] types = str.substring(beginning, i).split(":");
i++;
beginning = i;
... |
3e53cc96-3e7c-472d-8c11-ced4d43beb28 | 7 | public void execute(DocumentMap dm) {
init(dm);
while (true) {
if ((limit != 0) && (candidates.size() == limit)) {
return;
}
candidate = indexGlobal.nextSubscript(candidate);
if (candidate.equals("")) {
break;
}
... |
5b030627-b26e-4872-a761-7c694ab0a6b8 | 5 | @Override
public void execute(ByteStream stream) {
int i = 0;
while (true) {
if (this.amount >= 0 && i >= this.amount) {
break;
}
if (this.until != null) {
if (Arrays.equals(stream.readBytes(this.until.length),
this.until)) {
break;
} else {
stream.advance(-this.until.length);
... |
12c21573-cb98-48ff-9ec3-240dea656f37 | 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... |
29e3a524-cd29-47d6-9f68-3c4463d04eb2 | 1 | @Override
public ArrayList<String> getItems(String userId) {
System.out.println("Hello from SessionBean getItems");
ArrayList<String> items = new ArrayList<String>();
TypedQuery<Item> itemsByUserQuery = emgr.createNamedQuery(
"Item.findAllByUser", Item.class);
itemsByUserQuery.setParameter("userName", user... |
83b73202-999f-4399-bebe-6cb032cce694 | 4 | public boolean setTimer(Timer t) {
boolean test = false;
if (test || m_test) {
System.out.println("FileManager :: setTimer() BEGIN");
}
m_timer = t;
if (test || m_test) {
System.out.println("FileManager :: setTimer() END");
}
return true;
} |
14114f0e-946b-4a96-8909-32fdd93362cf | 6 | private final void method653() {
synchronized (this) {
for (int i = 0; i < anInt5387; i++) {
int i_629_ = anIntArray5356[i];
anIntArray5356[i] = anIntArray5312[i];
anIntArray5312[i] = -i_629_;
if (aClass360Array5360[i] != null) {
i_629_ = ((Class360) aClass360Array5360[i]).anInt4430;
((Class36... |
73a95a6a-1f7d-4bec-9a49-1917f58cc355 | 5 | final boolean method2121(int i, Source source, int i_3_) {
anInt4745++;
if (i != 25625)
method2126((byte) -74);
if (i_3_ > anInt4739) {
method2126((byte) -36);
if (anInt4746 <= 0)
throw new RuntimeException("ARGH!");
OpenGL.glBindBufferARB(anInt4755, anInt4746);
OpenGL.glBufferDataARBa(anI... |
643cee26-dae7-4019-91a8-2baa82cbed93 | 5 | static public String ParseSrcPos() {
if (Pos == null) {
return null;
}
if (Pos.length() >= 3) {
String srcpos = Pos.subSequence(0, 3).toString();
if (ParsePosition.IsPos(srcpos)) {
Pos = Pos.subSequence(3, Pos.length()).toString();
return srcpos;
... |
09deff1e-3301-4ad4-a623-92db409ddcd3 | 8 | @Override
public void ParseIn(Connection Main, Server Environment)
{
Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom);
if (Room == null)
{
return;
}
RoomItem Item = Room.GetItem(Main.DecodeInt());
if (Item == null)
{
... |
86259d12-f176-4e15-9a73-4f8ec8148690 | 2 | public void addAllNewProductionsToGrammar(Grammar oldGrammar,
Grammar newGrammar, VariableDependencyGraph graph) {
GrammarChecker gc = new GrammarChecker();
String[] variables = oldGrammar.getVariables();
for (int k = 0; k < variables.length; k++) {
String v1 = variables[k];
String[] dep = getDependencie... |
1e8f4a71-5e51-4374-afe1-904f0dc6d332 | 8 | public static int is_periodic(String suc) throws ArrayIndexOutOfBoundsException{
int i, begin, end, beginAux, endAux, repetitions;
begin=0;
for (i = 1; i < suc.length(); i++) {
repetitions=1;
if (suc.charAt(0) == suc.charAt(i)){
end=i;
... |
3a042596-3735-4c52-916c-9c37cc479422 | 4 | public void setup( String filename ,METSMetadata gmd ) throws Exception {
super.setup( filename, gmd );
BufferedReader fin = new BufferedReader(new InputStreamReader( new FileInputStream( filename ) ) ) ;
String inchi1 = fin.readLine();
String inchi2 = fin.readLine();
fin.close();
if( inchi1 != null && inchi1... |
52f269a4-5dbc-4ca9-96e7-c08efd27333d | 6 | public void enterToDatabase(ArrayList<File> songs){
for(int i=0; i<songs.size(); i++){
File song = songs.get(i);
String artist = tagger.getArtist(song);
String title = tagger.getTitle(song);
String bpm = tagger.getBPM(song);
String album = tagger.getAlbum(song);
boolean badartist = true;
boolean ... |
a45ba5b4-e4c6-40ed-8470-90b03224c56a | 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... |
ec50b2fa-f70c-4712-834a-ca0182f3eeee | 0 | public static void main(String[] args) throws Exception {
ExecutorService exec = Executors.newCachedThreadPool();
ServerSocket server = new ServerSocket(8080);
InputStream socketInput = new Socket("localhost", 8080).getInputStream();
exec.execute(new IOBlocked(socketInput));
exec.execute(new IOBlocked(System.... |
4f2e5764-dd53-4259-b94d-45f836a582ee | 2 | public GameMap getIndex(World world) {
for (GameMap map : this.maps.values()) {
if (map.getWorld() == world) {
return map;
}
}
return null;
} |
00ca1abc-e1e6-4fa6-9910-f362b7e38e5d | 7 | @Test
public void onKahdenPotenssiToimii() {
assertEquals(true, h.onKahdenPotenssi(4)
&& h.onKahdenPotenssi(16)
&& h.onKahdenPotenssi(25)
&& h.onKahdenPotenssi(36)
&& h.onKahdenPotenssi(49)
&& h.onKahdenPotenssi(64)
... |
bea8104e-9be4-48bd-b291-8e32f54ddcce | 0 | public void setStatus(int status) {
Status = status;
} |
6ca1888d-4275-47d1-b23c-205a257f898d | 5 | @Override
public void init()
{
super.init();
int offset = 0;
grbit = ByteTools.readInt( getByteAt( offset++ ), getByteAt( offset++ ), getByteAt( offset++ ), getByteAt(
offset++ ) );
short strLen = ByteTools.readShort( getByteAt( offset ), getByteAt( offset + 1 ) );
byte strGrbit = getByteAt( offset + 2... |
168327d1-ecdd-42d5-89aa-b33a127da165 | 2 | @Override
public Course deleteCourse(long courseId) {
for(int i = 0; i < courses.size(); i++){
if(courses.get(i).getId() == courseId){
return courses.remove(i);
}
}
return null;
} |
bdeeab34-0111-4de8-880f-bae3081890f2 | 8 | public static Stella_Object access_PLModuleFile_Slot_Value(PLModuleFile self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == GuiServer.SYM_GUI_SERVER_KBName) {
if (setvalueP) {
self.KBName = ((StringWrapper)(value)).wrapperValue;
}
else {
value = StringW... |
742ad0d6-5bac-4e91-b156-d311e6919539 | 9 | @Override
public void sort(int[] array) {
if (bucketCount <= 0) {
throw new IllegalArgumentException("Invalid bucket count");
}
if (array.length <= 1) {
return;
}
int high = array[0];
int low = array[0];
for (int i = 1; i < array.length... |
16dcb648-a17a-4b74-8ac1-ddc60f54b2da | 4 | public void enviarConsulta(String db, String query) {
String queryJSON = QueryManager.crearQuery(db, query);
try {
socketConServidor = new Socket(servidor, puerto);
DataInputStream ois = new DataInputStream(
socketConServidor.getInputStream());
DataOutputStream oos = new DataOutputStream(
socketC... |
522218b9-0d35-452b-ac3b-ef4936c35be9 | 5 | public void readOrders() {
String line;
if (fileName == null) {
System.err.println("No file name set for order list. Data read aborted.");
return;
}
try {
File file = new File(fileName);
Scanner scanner = new Scanner(file, "iso-8859-1");
... |
9b384518-7147-48f6-94e8-6fdabd09edde | 9 | private static Player askSelectExistingPlayer(List<Player> selectedPlayers) {
System.out.println("Please select one of the existing players:");
List<Integer> selectedPlayerNumbers = new ArrayList<>();
for (Map.Entry<Integer, Player> entry : players.entrySet()) {
if (!selectedPlayers.... |
b46ad57d-c56f-4055-a299-85d559163801 | 5 | public Game() {// Constructor
UPF.f.addKeyListener(this);
UPF.f.requestFocusInWindow();
// Background
sBackground = new JLabel(new ImageIcon("resources/gameBKG.jpg"));
sBackground.setBounds(14, 46, 253, 445);
// Return to menu button
toMenu = new JButton("Menu");
toMenu.setFont(menuFont);
toMenu.se... |
570cfcc3-d70e-45d5-8079-7c0c379ecb11 | 8 | public void doNext() {
CombatLog log;
int dmg;
double procChance;
Alteration voltaicSlash = engine.getPlayer().getAlterations().get("voltaicSlash");
MathTools math = new MathTools();
log = CombatLog.getInstance();
log.write(engine.getTimeStr() + this.getName() + " ");
dmg = engine.spellDamage(1.85,0.... |
8244f93d-296c-46ab-becb-1b800ce16768 | 5 | private void itmMnuAtividadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itmMnuAtividadeActionPerformed
// Menu - Cadastro > ItemMenu - Atividade
UsuarioBO userBO = new UsuarioBO();
Usuario Encarregadoexistente = null;
try {
Encarregadoexistente = use... |
7a40b3ef-123d-4ec2-a743-11f748061dc9 | 4 | public static void main(String [] args){
List<Thread> threads= new ArrayList<Thread>();
/**
* 500 threads are created to perform this adding up
*/
for(int i=0; i<500; i++){
Runnable task=new MyRunnable(10000000L + i);
Thread worker=new Thread(task);
... |
d7eaa03d-1885-4916-bf47-1c36b9085388 | 7 | public void doEvent(int eventNumber){
if(eventNumber >= MIN_DIALOG || eventNumber <= MAX_DIALOG){
displayNextDialog(eventNumber);
}else if(eventNumber == 101){
//do something
}else if(eventNumber >= 102 || eventNumber <= 110){
areaTransitionEvent(eventNumber);
}else if(eventNumber >= 111 || eventNumber... |
b307aee8-0d21-46cf-939d-309311660462 | 4 | public boolean isSorted() {
int length = this.array.length, i;
length--;
for (i = 0; i < length; i++) {
if (this.array[i].compareTo(this.array[i + 1]) < 0
|| this.array[i].equals(this.array[i + 1])) {
continue;
} else {
... |
56d66374-342b-4fb5-9fa6-5226c18fb7cb | 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... |
f6e9e65e-3f66-4ac3-a76f-ee997861141b | 3 | public Value get(Key key) {
Node current = root;
int cmp = key.compareTo((Key) root);
while (current != null) {
if (cmp > 0) {
current = root.right();
} else if (cmp < 0) {
current = root.left();
} else {
return (Value) current.getValue();
}
}
return null;
} |
fa4bf388-65be-4d54-864a-026af5adc404 | 8 | protected Method getAccessor(Object obj, Field field, boolean isGetter)
{
String name = field.getName();
name = name.substring(0, 1).toUpperCase() + name.substring(1);
if (!isGetter)
{
name = "set" + name;
}
else if (boolean.class.isAssignableFrom(field.getType()))
{
name = "is" + name;
}
else... |
e57ec5d2-571f-4327-83a1-8cd6c6b734ae | 3 | private void assignPosToPif() {
int index = 0;
for (pif p : PIF) {
int pos = 0;
if (p.code == 0) {
pos = getSTPosition(p.token, identifiersST);
pif n = new pif();
n.code = p.code;
n.token = p.token;
n.positionST = pos;
PIF.set(index, n);
} else if (p.code == 1) {
pos = getSTPos... |
f2c48bf9-80c8-479b-b2fb-a8962bd178b7 | 5 | private void verifyNodeBasics(Attributes attributes) {
/* id="7263630a-3284-4f46-8137-eef38adb5649"
* nameResId="@string/keyboard"
* description="Created by Menny Even Danan"
* index="1"
*/
String id = attributes.getValue("id");
if ( id == null... |
3fc84b4a-34a3-427c-a539-2730509934fe | 3 | public void resizeAll()
{
File[] files = new File(inputDirectory).listFiles();
for (int i = 0; i < files.length; i++)
{
try
{
if (files[i].getName().endsWith(".jpg"))
{
resize(files[i]);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
} |
ad6607fb-1c38-4a7f-a795-a9b4fd5fd5ce | 1 | public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest req, HttpServletResponse resl)
{
HttpSession session = req.getSession();
LogonForm user = (LogonForm) session.getAttribute("user");
if(user != null )
{
session.removeAttribute("user");
session.invalidate();
r... |
19353d1a-54fb-4ac5-99cd-df6e985f8939 | 6 | final public boolean delete(final K key) {
int index = computeHash(keyData(key)) % size ;
if (index < 0) index += size ;
if (table[index] == null)
return false ;
Entry <K, V> link = table[index] ;
if (link.next == null) {
table[index] = null ;
return true ;
}
Entry <K, V> p... |
ce093938-4fe3-43d6-bae8-8a453508392d | 6 | private static Farbe waehleFarbe(int spielerAnzahl) {
Farbe farbe = null;
if (spielerAnzahl > 2 || Farbe.ROT.isIstFrei()
&& Farbe.BLAU.isIstFrei() && Farbe.GRUEN.isIstFrei()
&& Farbe.SCHWARZ.isIstFrei()) {
farbe = farbeAussuchen();
if (farbe.isIstFrei()) {
farbe.setIstFrei(false);
} else {
... |
6f6806ae-633b-4215-ba9b-09fabeefe0db | 1 | private char nextChar()
{
if (hasInput())
return input.charAt(position++);
else
return (char) -1;
} |
3cace519-3346-4373-ba2b-5588f6071546 | 2 | public boolean isGetClass() {
MethodAnalyzer mana = getMethodAnalyzer();
if (mana == null)
return false;
SyntheticAnalyzer synth = getMethodAnalyzer().getSynthetic();
return (synth != null && synth.getKind() == SyntheticAnalyzer.GETCLASS);
} |
57f341d8-ce1f-440f-8c9f-a234ac8226c3 | 9 | @SuppressWarnings("rawtypes")
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
TKey other = (TKey) obj... |
03db4088-e22e-4adb-a78f-549d8aec2057 | 1 | public double getDouble(){
try{
return Double.parseDouble( value );
}
catch( NumberFormatException ex ){
throw new XException( ex );
}
} |
6b71dd56-0b41-4b5c-892b-46d808275afc | 6 | public String parseAtcocode( InputStream in ) throws JsonParseException {
JsonParser jp = null;
try {
jp = jsonFactory.createParser( in );
while ( jp.nextToken() != JsonToken.END_OBJECT ) {
String fieldName = jp.getCurrentName();
if ( "atcocode"... |
b0fc0f41-7108-4448-a1a4-6b02b0797d7b | 7 | public static void main(String[] args)
{
if (args.length < 2)
{
System.out.println("Number of Argument " + args.length +" is smaller than 2! Exiting!!");
System.exit(0);
}
URL url = null;
InputStream inputStream = null;
FileWriter fileWriter ... |
add1e725-e09a-4cc3-9243-792631a206fb | 4 | private void removeAVL(TreeNode startingNode, String searchingKey) {
currentSearchHeight++;
if (startingNode == null) {
System.out.println("\nKey " + searchingKey + " not found.");
} else {
if (startingNode.value.compareTo(searchingKey) > 0) {
removeAVL(st... |
3024a8a8-f763-4c29-b982-c2b226f0c5ec | 7 | public void insertarOrdenado(int dato) {
if (this.estaOrdenada()) {
Nodo nuevo = new Nodo(dato);
Nodo nodo = this.nodoInicial;
if (this.nodoInicial == null)
this.nodoInicial = new Nodo(dato);
else {
if (dato <= nodo.getDato())
this.insertarInicio(dato);
else
while (nodo != null) {
... |
dcaf3be3-6cbf-4088-854e-8de993eff903 | 9 | public void DescargarParche(){
try{
FileReader ArchivoConfiguracion = new FileReader("Configuracion.txt");
BufferedReader _ArchivoConfiguracion = new BufferedReader(ArchivoConfiguracion);
String LineaInformacion = "";
String RutaCarpetaWoW = "";
int Li... |
3afa1a1b-8285-49ba-bb04-b3d9fada5d93 | 2 | public static void main(String args[]) {
Thread t = Thread.currentThread();
System.out.println("Current thread: " + t);
// change the name of the thread
t.setName("My Thread");
System.out.println("After name change: " + t);
try {
for(int n = 5; n > 0; n--) {
System.out.println(n);
Thread.sleep(100... |
a209b629-06f5-431b-8196-41de2c932194 | 0 | @Test
public void gameStateTransitionTest() {
City_Graph city_graph2 = new City_Graph();
city_graph2.loadMap("res/test.mp");
Move move = new Move("R 2");
city_graph2 = city_graph2.gameStateTransition(move);
assertEquals(city_graph2.convertGameStateToString(),"CNRR");
} |
fcf1f9db-6efb-4a24-87f8-95603d6643f1 | 9 | public Queue<String> tanqueXMLUnit (){
try {
path = new File(".").getCanonicalPath();
FileInputStream file =
new FileInputStream(new File(path + "/xml/papabicho.xml"));
DocumentBuilderFactory builderFactory =
DocumentBuilderFactory.newInstance();
Do... |
ca7b6e84-1585-411a-94ef-982a86b911e7 | 1 | private static boolean insertPatient(Patient bean, PreparedStatement stmt) throws SQLException{
stmt.setString(1, bean.getFirstName());
stmt.setString(2, bean.getLastName());
stmt.setDate(3, bean.getDob());
stmt.setString(4, bean.getPrimaryDoc());
stmt.setString(5, bean.getPhone());
stmt.setString(6, bean.... |
17330ec5-7bbe-440f-8b4b-be426531a386 | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Coordinate other = (Coordinate) obj;
if (c != other.c)
return false;
if (r != other.r)
return false;
return true;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.