method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6cf55de9-c035-49d9-9712-1933f44cfa96
4
public V remove(E arg0) { V retV = null; for(int i = 0; i < size; i++) if(data[i].Key.equals(arg0)){ retV = data[i].Value; if(i == size-1){ data[i] = null; } else { for(int j = i; j < size-1; j++){ data[j] = data[j+1];//Shifting all the elements to the right of the removed ...
d38b6b9f-4926-4aed-b9a8-6ea4184ac5ed
1
public void start() { for ( TweetProcWorker worker : tweetProcWorkers ) { worker.start(); } twitterSearchWorker.start(); Logger.log( TAG, "server started." ); }
6665c0da-7797-48c3-b188-4a0a322e0443
3
public static JSONObject toJSONObject(String string) throws JSONException { String name; JSONObject jo = new JSONObject(); Object value; JSONTokener x = new JSONTokener(string); jo.put("name", x.nextTo('=')); x.next('='); jo.put("value", x.next...
bc2f63b8-a0d3-4b2e-9157-4dfee24d0d28
6
public static Cons cppTranslateCondition(Cons condition, boolean symbolcasep) { { Cons translatedactions = Cons.cons(Stella.SYM_STELLA_CPP_STATEMENTS, Cons.cppTranslateListOfTrees(condition.rest).concatenate(Stella.NIL, Stella.NIL)); Stella_Object keys = condition.value; Stella_Object translatedkeys = n...
9f7c0727-47a1-4158-a3e3-99fe5241fe39
3
@Before public void setUp() throws Exception { DetectorFactory.clear(); LangProfile profile_en = new LangProfile("en"); for (String w : TRAINING_EN.split(" ")) profile_en.add(w); DetectorFactory.addProfile(profile_en, 3); LangProfile profile_fr = new Lan...
7926adc5-ddea-4aeb-9618-7c9abd3b9538
7
@Override public String getName() { StringBuilder builder = new StringBuilder(); builder.append(super.getName()); if (this._parameterTypes != null && this._parameterTypes.size() > 0) { Type type = this._parameterTypes.get(0); builder.append("(").append(type.getName()); for (int i = 1; i...
0697990a-d6c7-45c1-b009-263f01f19b44
9
public static void checkExtensions(int[] elements, int k) { if (k == 0) { return; } for (int i = 0; i <= elements.length; i++) { int[] newElements = Arrays.copyOf(elements, elements.length + 1); for (int j = 0; j < elements.length; j++) { if (n...
4c67586d-ad95-4a21-a807-db5e3f9c9898
8
public int minXDistance(int x) { if (type == TYPE_POLY) { int p=10000; for (int i=0; i<poly.npoints; i++) { int np=poly.xpoints[i]; if (Math.abs(x-np) < Math.abs(x-p)) p=np; } return p; } else if (type == TYPE_RECT) { int[] points =...
09d8ecba-b448-4fa4-8136-b46c3e439979
0
private StringChecker() { }
a12d9065-83e4-42f0-8b59-2ebb837610ff
9
private ProxyConfig() { //Check Java Properties //Java System Properties always override these settings proxyIsSet = readProperties(System.getProperties()); if(proxyIsSet) return; //Attempt to Read proxy properties for this app try { File f = new File(Boot.getU...
001789f3-2d51-4cdc-bf51-ae0592a0731d
8
private void avoidFromEdge(int[][] currentTokens) { //move currentTokens to the right if they are at right edge while (x0 < 0 || x1 < 0 || x2 < 0 || x3 < 0) { currentTokens[0][0]++; currentTokens[1][0]++; currentTokens[2][0]++; currentTokens[3][0]++; ...
15107e65-8b60-4d89-bc59-b760a6c08ea7
4
private static void ProcessArray1() { double[] myList = {1.9, 2.9, 3.4, 3.5}; // Print all the array elements for (int i = 0; i < myList.length; i++) { System.out.println(myList[i] + " "); } // Summing all elements double total = 0; for (int i = 0; i < myList.leng...
02a15552-d091-471e-bf3b-65871ae0ab70
3
protected final void init() { double d = 1D/slices; double cur = 0D; double tcur = 0D; double td = d*16; Vector height = new Vector(0, 0, 4); FloatBuffer vertices = FloatBuffer.allocate(slices * 4 * 4 * 3); FloatBuffer normals = FloatBuffer.allocate(slices * 4...
5387d78a-ddde-4ac1-b8d0-d2c48e2af12a
4
public ArrayList<Move> getJumpMoves(Board currentBoard, boolean onlyChainable, Checker checker) { //List of possible moves. ArrayList<Move> moves = new ArrayList<Move>(); //Add all jump moves to the list. moves.add(new JumpForwardLeft(currentBoard, checker)); moves.add(new JumpForwardRight(currentBoard, ch...
fcc022bf-59c9-4139-8ea5-bffcd0cd2389
8
protected ElementInfo getElementFromPath(ElementInfo oldDocElement, List<ElementInfo> paths) { if (paths == null || paths.isEmpty()) { return null; } if(paths.size()==1){ return oldDocElement; } ElementInfo parent = oldDocElement; for (int j = 1; j < paths.size(); j++) { ElementInfo path = paths...
507c6e5d-b066-48dc-bc64-91cbbcd4ecbd
5
public static Estado getById(int id){ if(PREPARADO.ID==id)return PREPARADO; else if(CARGANDO.ID==id)return CARGANDO; else if(JUGANDO.ID==id)return JUGANDO; else if(PAUSADO.ID==id)return PAUSADO; else if(PERDIDO.ID==id)return PERDIDO; else return GA...
1f57a516-fbef-4081-83cd-e7f3760dc470
0
public String getContactName() { return contactName; }
6de0c83b-b4a8-4cc5-977c-3a3f398075de
6
@EventHandler public void ZombieResistance(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getZombieConfig().getDouble("Zombie.Resi...
b3ec38bf-83d7-4d25-a4bf-91a251751383
6
public void charactersCardFromInt(int inputCharacters) { switch (inputCharacters) { case 1: this.character =(Characters.Colonel_Mustard); break; case 2: this.character =(Characters.Miss_Scarlett); break; case 3: this.character =(Ch...
e1ce507c-b04b-4801-9b11-538cb8b617ad
0
public void setDeaths(int deaths) { this.deaths = deaths; getPlayer().sendPluginMessage(The5zigMod.getInstance(), "5ZIG", ("/s/deaths=" + deaths).getBytes()); }
9c5028a3-4aa2-44d9-8da4-a25b7631f904
2
public void setDirection(Point direction) { if (direction.equals(invertDirection(this.direction))) { if (invertedBevoreMoves >= INVERT_FREQUENCY_MAX) { this.direction = invertDirection(getLastGlied().getDirection()); invert(); } } else { this.direction = direction; } }
1fde1d11-4632-42fb-9b8f-1ccc90e884ee
9
public static Atom newAtom(Object value) { if (value instanceof Boolean) { return AtomBoolean.createAtomBoolean(((Boolean) value).booleanValue()); } else if (value.toString().equals(AtomBoolean.T) || value.toString().equals(AtomBoolean.F)) { return AtomBoolean.createAtomBoolean(v...
46d34976-a254-4f12-839f-cb9450d68e27
6
@Override public void publish(Map<String, Object> objects, Element model) throws NoSuchObjectException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { // Create element at path Element e = DocumentHelper.makeElement(model, mPath); // Content if (null != mContent) { ...
2a224feb-37f3-49c7-bc60-b5fa5e7bff61
5
@Override public void rewind() { switch( channelType ) { case SoundSystemConfig.TYPE_NORMAL: if( clip != null ) { boolean rePlay = clip.isRunning(); clip.stop(); clip.setFramePosition(0); ...
124b9a98-94e4-40f5-aede-1295ff0c7ffe
9
void run(){ Scanner sc = new Scanner(System.in); int T = sc.nextInt(), M = 150; sc.nextLine(); while(T--!=0){ char[] s = sc.nextLine().toCharArray(), t = sc.nextLine().toCharArray(); sc.nextLine(); Set<Integer> set = new HashSet<Integer>(); int x = 100, y = 100; set.add(x*M+y); for(char c:s){ ...
b9d94038-ded2-4cf0-b001-e69500ab6f86
9
public void execute(String path){ File dir = new File(path+"/dataSet/"); int noOfFiles=dir.listFiles().length; StopWord stp = new StopWord(); new File(path+"/data/").mkdir(); Stemmer stem=new Stemmer(); System.out.println(noOfFiles); for(int i=1;i<=noOfFiles;i++){ try { BufferedReader br =...
e133d29e-7d8f-4428-b558-2d2c21124ead
4
public void addQuerystring(String queryString) { if (queryString != null && queryString.length() > 0) { for (String param : queryString.split(PARAM_SEPARATOR)) { String pair[] = param.split(PAIR_SEPARATOR); String key = OAuthEncoder.decode(pair[0]); String value = pair.leng...
fcece65c-9bcf-405d-8fee-27e57b360e61
8
private void calculateAttachment(Player player, World world) { Map<String, PermissionAttachment> attachments = permissions .get(player); PermissionAttachment attachment = attachments.get("group"); Map<String, Map<String, Boolean>> playerPermissions = dataProvider .getPlayerPermissions(player.getName(), w...
a35ac702-d1fa-47be-a9cd-dc3321155be4
7
public String[] Myself(boolean place) { try{ driver.get(baseUrl + "/content/lto/2013.html"); //global landing page driver.findElement(By.xpath("/html/body/div[2]/div/div/div/div/div/div/div[2]/ul/li/a")).click(); //Austrailia landing page - Order Now button driver.findElement(By.xpath("/htm...
4f64d549-9d26-44ff-aa8f-db5ec9a97f70
6
public static Word chooseSampledBestScoreWord(ArrayList<Word> words, Lexicon lex, SubSeqCounter counter) { // First get the normalization denominator double scoreSum = 0; for (Word w : words) { scoreSum += lex.getScore(w, counter); } // Then normalize double[] normScores = new double[words.size()]; ...
e93a8ac6-7b56-4b4d-bf6c-ee1a09cde384
5
public static JsonElement parse(JsonReader reader) throws JsonParseException { boolean isEmpty = true; try { reader.peek(); isEmpty = false; return TypeAdapters.JSON_ELEMENT.read(reader); } catch (EOFException e) { /* * For compatibility with JSON 1.5 and earlier, we return a ...
d2cbdd01-69a3-4dd3-9fc4-dc9f20e1dc1d
4
public String getAttributeExpandedValue(String name, String aname) { Object attribute[] = getAttribute(name, aname); if (attribute == null) { return null; } else if (attribute[4] == null && attribute[1] != null) { try { pushString(null, (char) 0 + (Str...
22de6dfe-d44e-47b6-b396-e7bf90e5b748
7
public Discretize(Element discretize, FieldMetaInfo.Optype opType, ArrayList<Attribute> fieldDefs) throws Exception { super(opType, fieldDefs); /* if (m_opType == FieldMetaInfo.Optype.CONTINUOUS) { throw new Exception("[Discretize] must have a categorical or ordinal optype"); } */ m_fi...
f0ab5788-3a2d-4502-9ad4-03c7ae5bf47d
9
public boolean canAppend(HistoryCell last) { return ((last.action == U.BasicAction.Delete && this.action == U.BasicAction.Delete && // ((last.x1 == this.x1 || last.x1 == this.x2) && last.y1 == this.y1))// || (last.action == U.BasicAction.Insert && this.action == U.BasicAction.Insert && // ((last.x1 ...
f9a3cd5f-e478-4acb-a106-8d2c32e6e732
4
private void say(Command command) { if (!command.hasSecondWord()) { System.out.println("Say what?\n"); return; } String phrase = command.getSecondWord(); // check who's in a nearby room. Character nearbyCharacter = checkWhoIsNear(); if (n...
79a14799-522a-4660-a5cb-53af175cfc28
9
public Object readMetaBean(Element node) throws Exception { Object result; Vector children; Element child; int i; String name; Vector inputs; Vector outputs; Vector coords; MetaBean bean; // for deb...
9f218020-c5c4-4cd6-a64e-5b969ede30ab
6
public static void vendingMachine(char a, int n){ int price = 0; if(a == 'w' || a == 'W') { price = 10; checkPayment(price, n, a); } else if (a == 'j' || a == 'J') { price = 15; checkPayment(price, n, a); } else if ( a == 'c' || a == 'C') { price = 12; checkPayment(price, n, a); ...
fed6d3d0-e793-4ef1-921a-483bc12a2a50
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Client client = (Client) o; if (id != client.id) return false; if (!login.equals(client.login)) return false; if (!name.equals(client.n...
3cad3625-cef4-4d2e-ac42-1f05075685df
2
public void insertBefore(String src) throws CannotCompileException { edited = true; ConstPool cp = getConstPool(); CodeAttribute ca = iterator.get(); Javac jv = new Javac(thisClass); Bytecode b = jv.getBytecode(); b.setStackDepth(1); b.setMaxLocals(ca.getMaxLocal...
ce78a049-fe88-404e-b241-4beec5931c99
5
@Test(expected = BadNextValueException.class) public void testInfixToPostfix10() throws BadNextValueException, DAIllegalArgumentException, DAIndexOutOfBoundsException, ShouldNotBeHereException, UnmatchingParenthesisException { try { infix.addLast("+"); infix.addLast("("); infix.addLast(")"); QueueI...
890eebea-29c8-470e-b641-0b2a95db885c
8
private static void method1(int sum, int count) { int id = 0; int page = 0; ZapposAPI api = new ZapposAPI(); boolean flag = false; List<Product> products = new ArrayList<Product>(); /* Download product information page by page */ while (true) { try { /* download the page */ List<Product> curpag...
b634f571-6d6a-4875-a487-4415856a738c
0
public static String getDest_host() { return dest_host; }
6e0c33b2-ddc6-407e-bebd-dec3f9647537
1
@Override public byte[] save(JoeTree tree, DocumentInfo docInfo) { StringBuffer buf = prepareFile(tree, docInfo); try { return buf.toString().getBytes(PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_ENCODING_TYPE)); } catch (UnsupportedEncodingException e) { e.printStackTrace(); r...
c2364a58-59ca-4d89-bde3-4da960a26d76
7
byte show(boolean on) { JOptionPane op = new JOptionPane(); op.setLayout(new BorderLayout(5, 5)); final JDialog d = op.createDialog(view, "Steering Options"); if (on) { JPanel p = new JPanel(); p.setBorder(BorderFactory.createTitledBorder("Interaction Mode")); op.add(p, BorderLayout.NORTH); Butt...
812dc1b1-752d-4cf6-b3a8-cf5f104b06bd
5
private List<?> listToMessage(List<?> values) { if (values.isEmpty() || !(values.get(0) instanceof Message)) { return values; } List<Object> messages = new ArrayList<>(); for (Object operation : values) { messages.add(((Message) operation).toMessage()); } return messa...
e1df7bcd-b629-4b2e-8158-5a21a92b74b2
1
public <T extends NMEASentence> T get( Class<? extends NMEASentence> classObj ) { return (T)data.get( classObj ); }
25eee02d-eb1b-4762-9416-47fef87b093c
9
public void write(TProtocol oprot) throws TException { validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(CURRENT_TIME_FIELD_DESC); oprot.writeI64(this.currentTime); oprot.writeFieldEnd(); if (this.authenticationToken != null) { oprot.writeFieldBegin(AUTHENTICATION_TOK...
90681732-a34b-4d06-a23d-0e38dbc20888
7
public Object getValueAt(int rowIndex, int columnIndex) { Consumption consumption = consumptionList.get(rowIndex); switch (columnIndex) { case 0: return consumption.getId(); case 1: return consumption.getCreateAt(); case 2: ...
a0b327fb-5ce9-45cd-95d5-195756cbb089
2
void readProteinFileTxt() { // Load file String proteinData = Gpr.readFile(proteinFile); String proteinLines[] = proteinData.split("\n"); // Parse each line int lineNum = 1; for (String proteinLine : proteinLines) { // Split tab separated fields String field[] = proteinLine.split("\\s+"); // Pars...
5f1774ea-2905-497a-b4bf-28825945cc23
9
public boolean getTokenHandler(Envelope message, Envelope response) { //check the number of contents if(message.getObjContents().size() < 4) { cEngine.writeAESEncrypted(genAndPrintErrorEnvelope("Message too short"), aesKey, output); return false;//go back and wait for a new message } Integer reqMsgNu...
b3dc80bb-92b1-49f4-9fe9-2f05daa7857e
9
public void tick(InputHandler input) { if(input.keys[KeyEvent.VK_A]) { this.xa -= ACCELERATION; } else if(input.keys[KeyEvent.VK_D]) { this.xa += ACCELERATION; } boolean jumped = false; if(input.keys[KeyEvent.VK_W]) { if(onGround) { this.ya -= JUMP; jumped = true; } else this.ya -= ...
3677733a-c061-46c5-b8dd-e2ec26599d48
8
public void run() { int[] testArray = null; for (int i = 0; i < loops; i++) { // Get new random array and copy it for all the sorting algorithms, // Arrays.sort tests the original testArray testArray = randomizeArray(); if (bubble) { int[...
ebee2982-0697-41db-ab19-81bd8d13889d
8
@Override public void loadFromString(String contents) throws InvalidConfigurationException { Map<?, ?> input; try { input = (Map<?, ?>) yaml.load(contents); } catch (YAMLException e) { throw new InvalidConfigurationException(e); } catch (ClassCastException e)...
59682e67-fd1f-422d-a2b1-3d97004a4c7d
2
public boolean hasNext() throws IOException { while (!tokenizer.hasMoreTokens()) { String line = reader.readLine(); if (line == null) { return false; } tokenizer = new StringTokenizer(line); } return ...
a30206c4-9802-4172-8c0b-dde60e90fa17
2
private static String stringOfPixImage(PixImage image) { StringBuffer sb = new StringBuffer(image.getWidth() * image.getHeight() * 3 * 2); for (int y = 0; y < image.getHeight(); y++) { for (int x = 0; x < image.getWidth(); x++) { sb.append(colorToString(image.getRed(x, y))); sb.append(colorToString(i...
e73f02c8-a4a7-43aa-83cb-50d10ba14bb9
7
public ArrayList<Nucleotides> getNucleotideSequences() { if (nucleotideSequences == null) { nucleotideSequences = new ArrayList<Nucleotides>(); try { BufferedReader br = new BufferedReader(new FileReader(sequenceFile)); String line = br.readLine(); String sequenceDescription = null; StringBuffe...
a27a3492-78b7-4bac-99a9-7d2e396b0c88
7
private char[] _readFile(String filename) { ArrayList<Character> buffer = new ArrayList<Character>(); // Check validity of filename if( filename == null || filename.length() == 0 ) { return null; } // setup reader FileInputStream fin = null; ...
414750bf-3675-4147-96e4-2abfac301273
8
public boolean handleMaterialAcceleration(AxisAlignedBB var1, Material var2, Entity var3) { int var4 = MathHelper.floor_double(var1.minX); int var5 = MathHelper.floor_double(var1.maxX + 1.0D); int var6 = MathHelper.floor_double(var1.minY); int var7 = MathHelper.floor_double(var1.maxY + 1...
3b7ff629-e15c-445d-a94a-778fb9098e78
6
public String generateSHA1(String fileName) { int n = 0; byte[] buffer = new byte[8192]; MessageDigest digest; try { digest = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException e) { digest = null; e.prin...
2664c838-f62e-463d-9548-93bf7d7a2ca2
1
public static byte[] convertBinaryStringToByteArray(String binaryString) { byte[] bytes = new BigInteger(binaryString.replace(" ", ""), 2).toByteArray(); // als eerste bit == 1 wordt een extra byte met allemaal nullen toegevoegd if (binaryString.charAt(0) == '1') { return Arrays.cop...
60408ad7-bc4b-490d-8c51-18bf34fe759f
6
private void doSlotChange() { // first thing first - move the slot final I expiredSlot = currentSlot; try { currentSlot = config.getSlotSupplier().get(); } catch (final Exception e) { LOG.error("Slot creation failed: {}", e.getMessage()); } // com...
f148592c-0e6d-4ea8-b632-30ab8bdc5819
7
public Token next() { int tokenType; try { tokenType = tokenizer.nextToken(); switch (tokenType) { case StreamTokenizer.TT_WORD: if (member(tokenizer.sval, keywords)) { lastToken = new Token(TokenType.KEYWORD, t...
21ccaac7-4028-4a92-b073-2f09f361d381
2
@Override public void addAgent() { Random rand = new Random(); for(Integer i = 0;i<((EnvironnementSegregation)environment).nb_agent;i++){ int x,y; do{ x = rand.nextInt(environment.taille_envi); y = rand.nextInt(environment.taille_envi); }while(environment.grille[x][y] != null); AgentHurbain ag...
70d1d640-3498-4812-8c42-239c20f56670
6
public void damageDetection () { if (character.equals("P1")) { P2AttackArea getHit = (P2AttackArea)getOneIntersectingObject(P2AttackArea.class); if (getHit != null) { hurt = true; hitpoint-= getHit.damageDealt(); if ...
d37c062d-1f97-4282-9213-160e8b0c6ae3
2
public String toString() { StringBuilder sb = new StringBuilder(); int i = 1; sb.append(" ID : " + id); sb.append("\n Name : " + name); sb.append("\nGrades : "); if(grades != null) for(double q : grades) sb.append("\n Grade " + (i++) + " : " + q); else sb.append("\nNo grades registered"); ...
3c454795-dcff-4a6a-bbb3-784903a0d944
2
public static double getUserBalance(String username, ArrayList<User> users) { for (User u : users) { if (u.getUsername().equalsIgnoreCase(username)) { return u.getBalance(); } } return 0; }
b6c12b7f-abc2-4ea2-bed6-a3dda946794b
2
public static String addSegment(String path, String segment) { path = clean(path); segment = clean(segment); String theFirst = firstSegment(segment); if(isArraySegment(theFirst) || path == EMPTY_STRING) { path = path + segment; }else{ path = path + DOT + segment; } return copy(path); }
d6f9304a-5ef9-4cdc-be44-7731497a3c8b
4
public static void setupPiece(final HantoPieceType aPiece, final HantoMove moveType, final int moveDist){ switch(aPiece){ case BUTTERFLY: butterflyMoveType = moveType; butterflyMoveDist = moveDist; break; case CRAB: crabMoveType = moveType; crabMoveDist = moveDist; break; case HORSE: hor...
d310f076-b86c-466a-af74-d26eb4c62927
7
public void keyPressed(KeyEvent e) { //System.out.println("Key = " + e.getKeyChar() + " = " + e.getKeyCode()); key = e.getKeyCode(); if (key == 32) space = true; else if (key == 38) up = true; else if (key == 37) left = tr...
e7903ee5-a352-46a3-8704-4c9071a8b757
3
public static List<Integer> getPrestigeData(String prestige, int id){ ArrayList<Integer> l = new ArrayList<Integer>(); if(prestige.equals("kensai")){ l.add(kensaiMaxEnhancementTier.get(id)); l.add(kensaiCostPerTier.get(id)); l.add(prestigeNeedSpent.get(id)); l.add(prestigeNeedClassLevel.get(id)); }...
dde0f9c6-7181-48c7-9d26-b900bb93049f
5
@Override public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("Terminate Match Upload")) { //Terminate Scouting Button was Pressed //Check if Good Quit or not if(MainUploadGUI.numConnected == numFinished) { //Nullify Communication Threads for(int k = 0;k<=5;k+...
3f465011-ba1c-420a-8393-709fa15198d4
8
void dataBufferFlush() throws java.lang.Exception { if (dataBufferPos > 0) { switch (currentElementContent) { case CONTENT_UNDECLARED: case CONTENT_EMPTY: // do nothing break; case CONTENT_MIXED: ...
37a3da12-b213-4534-a5c8-6b1b597a3473
7
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!sender.hasPermission(PERM_CLAIM)) { Util.sendMessage("&cYou don't have permission to claim chunks!", sender.getName()); return true; } if (!(sender instanceof Player)) return false; Player playe...
6209e4b2-8845-492a-ada1-bb88443552e7
7
private ArrayList<ServerStatus> readout(Node array[]){ ArrayList<ServerStatus> tServerList = new ArrayList<ServerStatus>(); String realm = ""; for (Node item: array){ String output = ""; if(item.getText().trim().contains(cSubcategorie)){ output += "---------- " + item.toPlainTex...
ff7b02ed-86e0-42c2-95c6-49a4e2223766
4
public void interactSlot(Inventory inv, int slot){ if (inv.getItemInSlot(slot) != null && grabbed == null){ this.inventory = inv; this.slotID = slot; grabbed = inventory.getItemInSlot(slotID); inventory.setItemInSlot(slotID, null); } else if (grabbed != null && inv.getItemInSlot(slot) == null){ inv.s...
f2246915-b1aa-4a9b-a749-8dd0d8a19a54
9
public static void dec(double a[][], int n, double aux[], int p[]) { int i, k, k1, pk, d; double r, s, eps; double v[] = new double[n + 1]; pk = 0; r = -1.0; for (i = 1; i <= n; i++) { s = Math.sqrt(Basic.mattam(1, n, i, i, a, a)); if (s > r) r = s; v[i] = 1.0 / s; } eps = aux[2] * r; d...
55a89739-e03b-4802-8cfb-622839da35fb
8
public static boolean writeUserSelectedFile() { if (fileDialog == null) fileDialog = new JFileChooser(); fileDialog.setDialogTitle("Select File for Output"); File selectedFile; while (true) { int option = fileDialog.showSaveDialog(null); if (option != JFileChooser.APPR...
1e7783d0-613c-4a2a-9e9e-2eaaeb583a6c
9
@SuppressWarnings("rawtypes") private PacketType(Class... classes) { opcode = (byte) nextOpcode++; packets[opcode] = this; params = new Class[classes.length]; int thisPacketLength = 0; for (int i = 0; i < classes.length; i++) { Class fieldType = classes[i]; ...
5a271ff9-849d-40a0-b42c-6c1ac50fc705
1
public static void main(String args[]){ Scanner in = new Scanner(System.in); System.out.println("Enter Number"); String input = in.nextLine(); int i = 0; String output = ""; while(i < input.length()){ output = output+input.charAt(i)+" "; i++; ...
1365e3c9-2cb4-49b4-9d39-fbfb97036587
9
public boolean topicExpertiseKOL(String userName, String passWord, String fName, String lName, String OLID) throws Exception { DataLibrary lib = new DataLibrary(); String topicDescription = ""; String topicFrequency = ""; System.out.println(configuration.selenium.getTitle()); if (configuration...
122da3c6-64e6-47f9-88a5-b04b14849976
1
public static Global getInstance() { if (instance == null) { instance = new Global(); } return instance; }
4593bd0a-a561-44e9-84a7-bb521ff668a4
6
public static boolean Authorize(final String user, final String pass) { try { LHost = InetAddress.getLocalHost(); } catch (UnknownHostException ex) { print(ex.toString()); } // new Thread() { // @Override // public void run() { ...
5f51ac56-9f87-4253-9c76-fbe6d1f3318d
3
public void printInstruction(Writer w) throws Exception { if(isDeleted()) { throw new Exception("Deleted instruction printed as part of CFG"); } w.write(Integer.toString(number) + ": " + opcode.toString()); if(color != null) { w.write(" " + color.toString() + " :="); ...
06290ca9-670a-4234-a614-8e8f7ef6e692
9
private void decodeHeader(BufferedReader in, Map<String, String> pre, Map<String, String> parms, Map<String, String> headers) throws ResponseException { try { // Read the request line String inLine = in.readLine(); if (inLine == null) { ...
3c429354-25eb-429f-b49d-4e983720eed1
0
String serializeToJson(ParticipantItf car) { // Retrieve the AutoBean controller AutoBean<ParticipantItf> bean = AutoBeanUtils.getAutoBean(car); return AutoBeanCodex.encode(bean).getPayload(); }
b8cc8a5d-a0dc-478c-a997-2983e2ac5408
7
public static ArrayList testConnection(String dbmsName, String dbName) throws Exception { java.sql.DatabaseMetaData dbMetaData = null; Connection conn = null; ArrayList<String> tableList = new ArrayList<String>(); Properties fileProps = getFileProperties(); Properties conn...
c1928fa1-452e-4294-ab2b-3ce331f6f93c
6
@Test public void componentsAreNotNull() { assertTrue(rp.getEntities() != null && rp.getInput() != null && rp.getScore() != null && rp.getTimer() != null && rp.getSettings() != null && rp.getHighScore() != null && rp.getLanguage() != null); }
dcc14f89-721f-4085-a22b-af0a8e23c349
4
public boolean isAValidDirection(int newDirection) { boolean ok = exits.substring(newDirection, newDirection + 1).equals("0"); if (newDirection == 2 && column > 13 && column < 16 && row == 12) { ok = false; } return ok; }
2d7bc428-7af5-4839-845e-711b071284ee
5
@Override public Class<?> getColumnClass(int columnIndex) { switch (columnIndex){ case(0) : return Integer.class; case(1) : return String.class; case(2) : return Integer.class; cas...
0673ba5e-2b72-4e88-a8da-55e1fa83e5db
4
private void decrypt(InputStream in, OutputStream out) throws Exception { try { in = decryptFileStream(in, out); } catch (BadPaddingException ex) { Logger.addMessage("Exception in decrypt(): " + ex); } catch (IOException ex) { Logger.addMessage("Exception in d...
6622ad40-9b41-4eb9-8a41-5a2bc43f19ac
1
void ctrlOff(){ try{ Robot r = new Robot(); r.keyRelease(KeyEvent.VK_CONTROL); }catch(Exception e){ System.out.println(e); } jButton54.setBackground(Color.white); jButton54.setForeground(Color.black); isCtrl = false; }
9a1fa46c-4668-4d6f-9e4d-a61206264a50
5
@Override public void happen(int rollResult) { // For testing purposes only // TODO: Change this so it affects all players in the Gardens, Graveyard, Patio, Tower, Balcony, or room with an outside-facing window if ((rollResult >= 3) && (rollResult <= 4)){ Game.getInstance().getCurrentCharacter().decrementSpee...
2eee5606-babb-474a-87ed-c2789eda6188
2
public FileSystemFindFileContentsHandler(String query, FindReplaceResultsModel results, boolean isRegexp, boolean ignoreCase, String lineEnding) { super(lineEnding, FileContentsHandler.MODE_ARRAYS, Preferences.getPreferenceString(Preferences.OPEN_ENCODING).cur); //super(lineEnding); this.results = results; this...
270a97c8-b1b1-4174-bf92-8fd67e41a81b
5
public void logout() { if(getGameState() != GameState.LOGIN){ if(ctx.players.getLocalPlayer().isInCombat()) { long curr = System.currentTimeMillis(); while(System.currentTimeMillis() - curr < 5000 && ctx.players.getLocalPlayer().isInCombat()) { Utils.sleep(20); // wait up to 5 seconds for combat to e...
ff1a2100-cad0-4a9a-87e1-b1af030b60cb
6
public JPanel getPanel(){ final JPanel panel = new JPanel(new BorderLayout()); panel.setBorder(BorderFactory.createTitledBorder("Reading repetition")); // Create items that will be in this JPanel //final JCheckBox checkbox = new JCheckBox("Repeat line", isMessagesToBeRepeated); /...
6a6e12a0-9e12-44ba-8f3c-cae02f06b243
0
private FileTools() {}
b49d0a1b-0582-4dde-9b3e-9df435eda12c
7
public boolean itemModelsCached(int gender) { int primaryModel = maleEquip1; int secondaryModel = maleEquip2; int emblem = maleEmblem; if (gender == 1) { primaryModel = maleEquips1; secondaryModel = femaleEquip2; emblem = femaleEmblem; } if (primaryModel == -1) { return true; } boolean equip...
2a178a72-5ffa-4227-85d9-9dfde7d9d47a
9
ArrayList<Node> getPath( int[][] x, ArrayList<Point> p, int xx, int yy) { System.out.println("making path from matrix"); int size=p.size(); ArrayList<Integer> queue=new ArrayList<Integer>(); queue.add(0); ArrayList<Node> path=new ArrayList<Node>(); ArrayList<Integer>[] parentq=new ArrayList[size]; int ...
62459a15-9e1c-478c-a748-070c3d3a1439
3
@Override public void keyPressed(KeyEvent keyEvent) { if (!bPausa) { if (keyEvent.getKeyCode() == KeyEvent.VK_LEFT) { iDireccion = 1; } if (keyEvent.getKeyCode() == KeyEvent.VK_RIGHT) { iDireccion = 2; } } }
806dbf1a-5a59-42af-9315-268d504f73df
4
private void init(char[][] data) { if (data.length != map.length || data[0].length != map[0].length) { throw new IllegalArgumentException("data array " + "does not match level size!"); } for (int col = 0; col < cols; col++) { for (int row = 0;...