method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c0bad1cc-1eb1-47e7-8509-5cc0424ac8f2
0
public void setURI(String value) { this.uri = value; }
020efca6-320b-492b-ba02-4d37b68a6d39
4
public void visitEnd() { if (!subroutineHeads.isEmpty()) { markSubroutines(); if (LOGGING) { log(mainSubroutine.toString()); Iterator it = subroutineHeads.values().iterator(); while (it.hasNext()) { Subroutine sub = (Subroutine) it.next(); log(sub.toString()); } } emitCode(); }...
f21a4867-18bb-4540-9f9d-12f0e76689f8
4
public void listTickers(){ List<String> tickers = new ArrayList<String>(); while(true){ this.tUI.printGuide1(); while(true){ String s = this.inputScanner.nextLine(); if(s.isEmpty()){ break; } tick...
b5815f6c-8933-45cd-8a46-50de071eb72e
3
protected String checkFolder(String folderPath) { File dir = new File(folderPath); if (!dir.exists()) { return("The music folder '"+folderPath+"' does not exist."); } else if (!dir.isDirectory()) { return("The music folder '"+folderPath+"' must be a directory."); } else if (!dir.canRead()) { return(...
32f60910-c7ed-42d6-9639-5722072c55cb
3
public Byte toByteHelper(Bits bits, Node currentNode) { if(currentNode == null){ //The byte we're looking for isn't in the tree. Return null. return (Byte) null; } // Determine if currentNode has data. if (currentNode.data != null) { // If it does, return that data. Yay. return (Byte) currentNode.da...
06d3a905-63b0-47d0-98e0-2eec8521e0c4
6
public void createTransitions(State currrentState, Boolean startState) { HashSet<Transition> outgoing = getOutgoingTransition(currrentState); State newSrcState = getMatchingState(currrentState); Block newSrcBlock = StateToBlock.get(currrentState); this.VisitedBlocks.add(newSrcBlock); for (Transition ...
88146844-3a6d-4752-a92c-2a8d16af09b0
1
private String getDescription() { String desc = "@BatchUpdate(" + this.getParsedSql().getOriginalExpression() + ")"; if (this.isReturnId()) { desc = desc + ",@ReturnId()"; } return desc; }
eb82d913-e8a2-46c3-98de-c6c549bb686c
3
public final String getMethodName(int identifier) { String mname = getReflectiveMethods()[identifier].getName(); int j = ClassMetaobject.methodPrefixLen; for (;;) { char c = mname.charAt(j++); if (c < '0' || '9' < c) break; } return mname....
d2e0d548-1e8c-479c-886f-5fd85d54eb4e
5
public E get(int i) { if (i >= size || i < 0) return null; Stack<Node> stack = new Stack<Node>(); int counter = 0; Node node = root; while (true) { if (node != null) { stack.push(node); node = node.left; } else { node = stack.pop(); if (counter++ == i) return node.data; ...
b280a65a-5246-41a7-8ea0-d9e6618bb9ac
5
public boolean checkGoal(State state) { for (int k = 0; k < state.getData().size(); k++) { for(int m = 0; m < state.getData().get(k).size(); m++) { if (state.getData().get(k).get(m).equals("$") || state.getData().get(k).get(m).equals(".")) { return false; } } } endTime = System.nanoTime(); ...
421499da-8f27-4ec9-9b66-a18fd4a2b721
2
public int recalculateLevel() { int addedlevels = 0; int requiredExp = getExpRequirement(level); while (exp >= requiredExp) { exp -= requiredExp; if (exp < 0) { exp = 0; } // so that experience is never below 0 addedlevels++; addLevel(); ...
7115ea48-e12b-4c75-b104-993c38765cc0
5
private List<Oeuvre> loadOeuvres() { List<Oeuvre> lu = new ArrayList<Oeuvre>(); try { // String req = "SELECT * FROM oeuvre"; String req = "SELECT * FROM OEUVRE"; Statement statement = DB.getConnexion().createStatement(); ResultSet rs = statement.executeQue...
9494e579-973f-42cd-859c-18b6b85b533a
1
public boolean setElement(int index, E element) { LinkedElement<E> elem = findElement(index); if (elem != null) { elem.setObj(element); return true; } return false; }
b30a700f-b7f4-412f-b6b3-edde171b1dbb
1
private void init(InputStream in) throws IOException { if (in == null) { throw new IOException("Couldn't find input source"); } bitStream = new BufferedInputStream(in); bitStream.mark(Integer.MAX_VALUE); }
325e07c7-0772-4f73-97a4-199aac91eee9
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...
202e4b12-0335-4dc9-bb9a-399908c4e1e6
4
boolean deelverzamelingVan(Verzameling V) { boolean deelverzameling = false; for(int i = 0; i < elementen.length; i++) { for(int j = 0; j < V.elementen.length; j++) { if(elementen[i] == V.elementen[j]) { deelverzameling = true; break; } else { deelverzameling = false; } } if(!de...
5164f003-0584-4ac9-9759-9765be724825
8
@Override public void tick() { if (strict) { boolean temp = false; for (boolean input : inputs) { if (input && temp) { output = false; return; } else if (input) { temp = true; } } } else { byte num = 0; for (boolean input : inputs) { if (input) { num++; } }...
7d2d652d-b6de-4cbd-ae45-db0af455cc0a
4
private String getMnemDataErrorMessage() { ArrayList<String> rawLines = currentMnemonic.getRawLines(); int noOfLines = rawLines.size(); int maxLineLength = 0; String msg = ""; for (String str : rawLines) { str = str.replaceAll("\\s+$", ""); if (str.length() > maxLineLength) maxLineLength = str.len...
2a5002d6-fd9f-4ed9-9831-ab499f88d2ab
3
public String[] kapaliMasaIsimleriGetir(){ ArrayList<String> s = new ArrayList<>(); for(int i=0;i<bilgisayarlar.size();i++){ if(bilgisayarlar.get(i).getAcilisSaati()==null){ s.add(bilgisayarlar.get(i).getMasaAdi()); } } String [] ss = new ...
83685242-ba8b-45b4-869f-8aae1988332a
0
public void addCategory(Category cat) { this.categories.add(cat); }
588d291d-8f2d-47e3-8d6d-913c872ddf1f
2
public String getChannelsAsToolTipText() { String text = ""; if (channels.size() > 1) { text = channels.toString(); text = text.substring(1, text.length() - 1).replace(", ", ","); text = text.replace(",", "<br>"); text = "<html>" + text + "</html>"; } else if (channels.size() == 1) { text = channel...
1998c388-dd57-4dec-9350-40f6e6ba841e
2
public Color getColor(String id) { Color color = Color.BLACK; for(int i=0;i<identity.size();i++) { if(identity.get(i).equals(id)) { color = colors.get(i)[0]; } } return color; }
e8702bd9-711a-46bc-baf2-3c853a597027
0
@Override public String getDesc() { return "Default"; }
455e4861-28d9-4f09-a24c-fbca6ad8ec2d
7
private void debug(int[] query) { // new SGM().run("Q3.4"); // new TJSGM().run("Q3.1"); // new PRM().run("Q3.1"); System.out.print("How many rounds you want? "); int round = scanner.nextInt(); TJSGM tjsgm = new TJSGM(); long[][][][] result = new long[1][round][query.length][4]; for (int j = 0; j < round;...
a095cdfd-0e0d-4589-8c18-7be117d52e30
2
public void cargarComboHorario(){ Usuario u = new Usuario(); ArrayList<String> listado = u.listarHorarios(); if(listado !=null){ for (int i = 0; i < listado.size(); i++) { Horario.addItem(listado.get(i)); } ...
07ce9f34-6c95-49ea-98bd-b4eea977563b
3
private void checkInvariants() { assert (wordsInUse == 0 || words[wordsInUse - 1] != 0); assert (wordsInUse >= 0 && wordsInUse <= words.length); assert (wordsInUse == words.length || words[wordsInUse] == 0); }
7768b099-b5c2-45cb-99a4-254f09671cd5
2
public Prefab(int x1, int y1, int x2, int y2){ this.x1 = x1; this.x2 = x2; this.y1 = y1; this.y2 = y2; if (x2 > x1){ width = x2 - x1; } else { width = x1 - x2; } if (y2 > y1){ height = y2 - y1; } else { height = y1 - y2; } height++; width++; }
bd6bd7b4-e486-4cd5-9c22-941223eb982f
8
public void update(double dt) { xPos+=xVel*dt; yPos+=yVel*dt; xVel+=xAccel*dt; yVel+=yAccel*dt; setAccel(dt); Ball b=null; for(int i=0;i<MainClass.balls.size();i++) { b=MainClass.balls.get(i); if(b!=null && id<b.id && collides(b)) { bounce(b,i); } } if(xPos-radius<MainClass.wa...
16bd8bf6-96a5-462e-b76d-0dc14486afa0
9
public Magic constructMagic(int i, LivingThing l) { if (i == 0) { String name = "Fire Magic 1"; Magic fire1 = new Magic(true, Color.ORANGE, l, 5, 3, 1, name); Damage fire1Dam = new Damage(5, 0, 0, 0, 0, 0, 0, 0, false, false, false); fire1.setDamage(fire1Dam); return fire1; } else if (i == 1) { S...
3ebc16ea-400d-4847-80ee-f612a362474c
7
private static boolean hasSubTags(Object obj, Class<?> objClass) throws XMLStreamException { for (Field field : Introspection.getFieldsWithAnnotation(objClass, XmlTag.class, true)) { try { Introspection.makeFieldAccessible(field); Object content = field.get(obj); if (content != null) { if (Collect...
1249c815-f3d8-49f4-b075-2873c5b11d1b
6
public static void main(String[] args) { Directories.foldervalidator(); try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); info.getClassName(); ...
25e672bc-124a-4937-8f71-3b045c7346bb
3
public int demaLookback( int optInTimePeriod ) { if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) ) optInTimePeriod = 30; else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) ) return -1; return emaLookback ( optInTimePeriod ) * 2; }
2724f8d4-979a-40b9-bf06-120e7db29e5f
1
public void reset() { countsValid = false; for(Class key : counters.keySet()) { Counter count = counters.get(key); count.reset(); } }
29805346-03f7-468f-a23f-5183078bea34
1
private void testValue(DateTimeField fieldA, DateTimeField fieldB, String method, long millis, long valueA, long valueB) { if (valueA != valueB) { failValue(fieldA, fieldB, method, millis, valueA, valueB); } }
dec05030-291e-4cf3-ad58-4960c6a03541
5
@Override public void validate() { if (getEmail().isEmpty()) { addActionError("Please Enter Email Address"); } else if (getPassword().isEmpty()) { addActionError("Please Enter Password"); } else{ User user = (User) myDao.getDbsession().get(User....
aa981e58-8fa5-4eba-b5b7-5cbd69cb6b68
1
public boolean isActivated(SkiPass sp) { Date currentDate = new Date(System.currentTimeMillis()); return (currentDate.before(sp.getActivationDate()) ? false : true); }
c91bda04-f915-4f00-90bf-eb5edee4e334
1
private static PaymentResponse read(String xml) throws InternalApiException { try { Persister persister = new Persister(); return persister.read(PaymentResponse.class, xml); } catch (Exception e) { throw new InternalApiException(e); } }
e499c74c-2a67-42a2-b086-bc11f6e2b666
6
public static void makeGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) { SpringLayout layout; try { layout = (SpringLayout)parent.getLayout(); } ...
e454f896-3ef5-4ada-9ab3-e21badd16901
9
@Override public void start() throws ConsoleException { if(isStarted) throw new ConsoleException("Console has already been run"); isStarted = true; completer.getStrings().clear(); completer.getStrings().addAll(commands.keySet()); String line; try { while(i...
af7829b7-ddac-4718-ab2c-2977a4b0275e
8
public static int getClosestColor(int red, int green, int blue) { if(red < 0 || red > 255) throw new IllegalArgumentException("getClosestColor: red is outside of valid range (0-255)"); if(green < 0 || green > 255) throw new IllegalArgumentException("getClosestColor: green is outs...
804452fb-7240-412d-ba59-98a8042d8ebe
4
private Map<String, Class<?>> getExtensionClasses() { Map<String, Class<?>> classes = cachedClasses.get(); if (classes == null) { synchronized (cachedClasses) { classes = cachedClasses.get(); if (classes == null) { classes = loadExtensionClasses(); cachedClasses.set(classes); } } } r...
434d2d34-949c-470f-a3d1-a833d750d182
2
private void save(final JFrame frame) { final JFileChooser chooser = new JFileChooser(new File(GuiUtils.CURRENT_DIRECTORY)); chooser.setSelectedFile(new File("scsync.config")); if (JFileChooser.APPROVE_OPTION == chooser.showSaveDialog(frame)) { final Gson gson = new GsonBuilder().setPrettyPrinting().serializeN...
a86ba93d-bbfe-4a18-91ac-d45ba661d6a6
5
public void mouseReleased(MouseEvent me) { if (this.isEnabled()) { if (tools.getSelectedDrawingTool() == Toolset.TOOL_SELECTION) { undo(); } if (!this.wasDragged) { if (selection.height != 0 && selection.widt...
eb5b1b55-e039-41f0-bb26-c6108904002c
3
public void removeDeadBodies() { for (int i = rigidBodies.size() - 1; i >= 0; i--) { RigidBody rigidBody = rigidBodies.get(i); if (rigidBody.getLifeTime() > 0 && rigidBody.getAge() > rigidBody.getLifeTime()) { physicsController.removeRigidBody(rigidBody); graphicsController.removeRigidBody(rigidBod...
dfe2452f-a220-428a-9900-01c3c67838f1
9
public String encode(String plain, String pass){ //initialize plaintext and password plainText = plain; password = pass; //generate P array from password KeyGenerator kg = new KeyGenerator(password); pArray = kg.getPArray(); //make sure the whole text is in pieces of 16 bytes or 128 bits (the block ...
6080f8c8-a3a5-43fe-bb75-74d9c6ab6145
0
public List findByContestId(Object contestId) { return findByProperty(CONTEST_ID, contestId); }
42d0f840-3a8f-4929-abdc-5d4a4889d174
0
public String getNombre() { return nombre; }
1c3a939d-a0af-4e6a-acdf-f65567a08045
6
public void remove(int key) { HashPrinter.tryRemove(key); /** Run along the array */ int runner = 0; int hash = (key % table.length); while (table[hash] != null && runner < table.length) { if (table[hash].getKey() == key) { break; } runner++; hash = ((key + runner * runner) % table.len...
f03b3229-cffc-469c-af2f-200d6d637ae0
4
public void setVar(List<?> list) { for(PVar e : this._var_) { e.parent(null); } this._var_.clear(); for(Object obj_e : list) { PVar e = (PVar) obj_e; if(e.parent() != null) { e.parent().removeChild(e); ...
d7e67d61-22fe-4376-be29-2629b334f248
4
public static boolean toggleMute(CommandSender s, Player p, String pName) { if (p == null) { if(!PlayerChat.plugin.Mute.contains(pName)) { Messenger.tell(s, pName + " is offline or does not exist."); return true; } else { PlayerChat.plugin.Mute.remove(pName); Messenger.tell(s, "You have unmu...
11ede1f5-053f-42aa-a16f-9dae6bc821f6
1
public static void main(String[] args) { ListNode head = new ListNode(1); ListNode tmpHead = head; for (int i = 2; i <= 5; ++i){ ListNode tmp = new ListNode(i); tmpHead.next = tmp; tmpHead = tmp; } Rotate_List rl = new Rotate_List(); L...
f2789aee-7f77-44ae-bb90-c3d4eaa3cc7a
1
private static void createFile(String filePathName) throws IOException { File file = new File(filePathName); boolean exists = file.exists(); if (!exists) { file.createNewFile(); } }
b1668d71-e858-41a2-a993-45ec62e8e890
9
protected void update(CheckedFrequencyTable freq, int symbol) throws IOException { // State check if (low >= high || (low & MASK) != low || (high & MASK) != high) throw new AssertionError("Low or high out of range"); long range = high - low + 1; if (range < MIN_RANGE || range > MAX_RANGE) throw new Assert...
94318c04-8dab-4588-b8ea-9644196d2be9
7
public void updateAvaliableTexturePacks() { ArrayList arraylist = new ArrayList(); selectedTexturePack = field_77314_a; arraylist.add(field_77314_a); Iterator iterator = func_77299_i().iterator(); do { if (!iterator.hasNext()) { ...
26d54687-0163-4b5a-bde5-a9e06c312a0a
4
public void StartGame(boolean isGameHost, int slots, HostGameTask hgt) throws InvalidKeyException, BadPaddingException, IllegalBlockSizeException, InvalidSubscriptionException, InterruptedException, IOException, InvalidKeySpecException, NoSuchAlgorithmException, NoSuchPaddingException, NoSuchProviderExce...
797f92f3-d050-42e7-8123-e18825e95fd0
0
public void setAsyncRunner(AsyncRunner asyncRunner) { this.asyncRunner = asyncRunner; }
94f0809b-c731-4ad4-8511-093cb0edab66
0
public void setIssuer(String value) { this.issuer = value; }
f3196ac4-5dce-4382-9fbe-bf4f2267e063
5
private void actualizarProcesos(){ if (!a.getNivel1().isEmpty()) { if ((a.getNivel1().get(0).getRafaga()<=a.getQuantum())) { a.getNivel1().remove(0); actualizarTabla1(); }else{ a.getNivel1().get(0).setRafaga(a.getNivel1().get(0).getRafaga()-a.getQuantum()...
429e4c30-cdf7-49e0-bc49-2db4f0f0ebd2
4
private int getLevelValue(String name) { while (true) { Integer levelValue = (Integer) name2levelMap.get(name); if (levelValue != null) return levelValue.intValue(); if (name.length() == 0) { break; } ...
edcf0869-594a-4eb7-a0cb-746b8f3b0576
9
public boolean isMatch2(String s, String p) { // Start typing your Java solution below // DO NOT write main() function if (p == null) return s == null; if (s == null) return false; if (p.length() == 0) return s.length() == 0; if (p.charAt(0) != '*') { if (s.length() > 0 && (s.charAt(0) =...
a096b1a0-bc64-40a8-86cd-0480cafacb4b
3
static double[][] multiply(double[][] A, double[][] B){ double[][] AB = new double[A.length][B[0].length]; for(int i = 0; i < A.length; i++){ for(int j = 0; j < B[i].length; j++){ for(int k = 0; k < B.length ; k++){ AB[i][j] += A[i][k]*B[k][j]; } } } return AB; }
d6e644b1-e3a8-4688-90c5-d5b198502a71
4
public Object getValueAt(int row, int col) { Ingredient i = (Ingredient)(data.get(row)); try { switch (col) { case 0 : return new Boolean(add[row]); case 1 : String t = data.get(row).getClass().getName(); return t.substring("ca.strangebrew.".length(),t.length()); ...
9f1cd95e-d0c9-4a9a-a2b3-7531a5b705a7
1
public synchronized List<Long> getNodesIds(int pos) { if (nodes.size() > pos) return nodes.get(pos); else return null; }
ad45eec0-e04b-411d-a204-c55f732a7ea7
6
public void connect(TreeLinkNode root) { if (root == null || root.getLeft() == null || root.getRight() == null) { return; } if (root.getLeft() != null) { root.getLeft().setNext(root.getRight()); } if (root.getRight() != null && root.getNext() != null) {...
99f87451-1366-413a-a518-1031f02cb93e
6
public void run() { try { int count = 0; String edge_id = null; while((edge_id == null) && (count < 30)) { edge_id = ControllerEngine.gdb.getResourceEdgeId(resource_id, inode_id, region, agent); Thread.sleep(1000); } if...
040a6a6c-0bdd-4224-94ba-b2fee51d54fc
4
public void mergeAddr(FlowBlock succ) { if (succ.nextByAddr == this || succ.prevByAddr == null) { /* * Merge succ with its nextByAddr. Note: succ.nextByAddr != null, * since this is on the nextByAddr chain. */ succ.nextByAddr.addr = succ.addr; succ.nextByAddr.length += succ.length; succ.nextB...
4936f664-e135-4cb1-9c56-3abce1506737
1
public Complex[] getWavefunctionCoeffs(int index, double energy) { ComplexMatrix mx = getPropagationMatrix(index, energy); if (index == 1) { return new Complex[]{Complex.fromDouble(0), mx.getElem(1, 0)}; } return new Complex[]{mx.getElem(0, 0), mx.getElem(1, 0)}; }
ad57039d-ed52-456b-a6a5-38fa3d210dfe
6
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { if (flavor.equals(FLAVORS[0])) { // RTF return new ByteArrayInputStream(data==null ? new byte[0] : data); } else if (flavor.equals(FLAVORS[1])) { // stringFlavor return data==null ? "" : RtfToText.getPlain...
de244a9f-9a38-4c15-9bc5-dc4a8962f417
0
public Manifest getManifest() { return _manifest; }
d49cf82a-05fe-48f6-97d2-880aed69c59b
3
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((decodedValue == null) ? 0 : decodedValue.hashCode()); result = prime * result + ((encodedValue == null) ? 0 : encodedValue.hashCode()); result = prime * result + ((symmetricKey == null) ? 0 : symmetricKey.hash...
bee5d9e3-90e3-4917-993f-b514f758a74d
7
public void checkOneLetterOff(String queueHead) { for(int i =0; i<allWords.size(); i++) { String currentWrd = allWords.get(i); //compares length and if greater than one skips the wordaddWords(); if(currentWrd.length() == queueHead.length() ) { //looks at length of word and compares chars num...
f9c46425-f6a8-4cfc-9061-06c3c519460b
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...
bd093cb1-bb79-4a9a-a5a5-0455bf01baae
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Physical target=this.getAnyTarget(mob,commands,givenTarget,Wearable.FILTER_ANY); if(target==null) return false; if(target instanceof Item) { } else if(target instanceof MOB) { ...
59ba1ebf-f5db-43ed-a701-6d2359c2b4a8
9
public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) { this.plugin = plugin; this.type = type; this.announce = announce; this.file = file; this.id = id; this.updateFolder = plugin.getServer().getUpdateFolder(); final File pluginFile...
d2747911-0d85-4ec0-a4f3-db382546f8ee
3
public boolean load(String audiofile) { try { setFilename(audiofile); sample = AudioSystem.getAudioInputStream(getURL(filename)); clip.open(sample); return true; } catch (IOException e) { return false; } catch (UnsupportedAudioFileException e) { return false; } catch (LineUnavailableException...
00af7965-fb27-45c3-90f4-ce80f1f43789
4
static public boolean isColliding(math.Supportable lhs, math.Supportable rhs){ List<Vector3f> simplex = new java.util.ArrayList<Vector3f>(); Vector3f support = getSupport(lhs,rhs,Vector3f.UNIT_X); simplex.add(support); Vector3f direction = support.negate(); int loopCounter = 0; ...
971442da-73c7-44f9-b27d-966bf1928b53
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...
0b693bb0-538a-46e2-bf9c-6413724d7dd5
1
public static void testMap(){ HashMap<String, String> map = new HashMap<String, String>(); HashMap<String, String> map1 = new HashMap<String, String>(); HashMap<String, String> map2= new HashMap<String, String>(); HashMap<String, String> map3 = new HashMap<String, String>(); HashMap<String, String> map4 = ...
957c8a79-4ca8-4eb3-8969-16f4575afc7b
9
private static CellRangeAddress mergeRegion(Doc doc) { String attr[][] = doc.getAttr(); Td td = (Td) doc; CellRangeAddress cra = null; int rowspan = 0; int colspan = 0; for (int x = 0; x < attr.length; x++) { if ("rowspan".equals(attr[x][0]) && (!"".equals(attr[x][1]))) { rowspan = Integer.parseInt(...
ed6c88e8-198a-411e-b1e2-dfd3fab7e6d7
1
public void updateCurrentQuiz() { try { String statement = new String("UPDATE " + DBTable + " SET " + "name=?, url=?, description=?, category=?, userid=?, israndom=?, isonepage=?, opfeedback=?, oppractice=?, raternumber=?, rating=?" + " WHERE qid=?"); PreparedStatement stmt = DBConnection.con.prepareS...
d92952fc-6614-46e0-8536-cde1f1cb39d4
9
protected boolean unsingMe(MOB mob, MOB invoker) { if(mob==null) return false; final Ability A=mob.fetchEffect(ID()); if((A instanceof Song) &&((invoker==null)||(A.invoker()==null)||(A.invoker()==invoker))) { final Song S=(Song)A; if(S.timeOut==0) S.timeOut = System.currentTimeMillis() +...
17f8f215-f3ff-47c1-b7c2-c37bc05eb6bf
1
public void testFormatAppend_PrinterParser_Printer_null_null_Parser() { PeriodPrinter printer = new PeriodFormatterBuilder().appendYears().appendLiteral("-").toPrinter(); PeriodParser parser = new PeriodFormatterBuilder().appendWeeks().appendLiteral("-").toParser(); PeriodFormatterBuilder bld = ...
7b3ac647-e047-46bf-9bb4-63e5d73f6d0a
1
private String loadKeyOfAction(String value) { if (actionMap == null) { actionMap = new HashMap<String, String>(); actionMap.put(propertiesLoader.loadProperty(Action.ADVANCE.getKey()), Action.ADVANCE.getKey()); actionMap.put(propertiesLoader.loadProperty(Action.LEFT.getKey()), Action.LEFT.getKey()); actio...
05c92146-b3ae-4671-a783-00c2875ca73a
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://downl...
928df08f-2d46-468f-9fb3-efd4f10ff1c7
5
private static void setColor(ColorType c, int newColor) { switch (c) { case PLAYER: currentPlayerColor = newColor; break; case WALL: currentWallColor = newColor; break; case SLOW_WALL: currentSlowWallColor = newColor; break; case OBJECT: break; case PROJECTILE: break; ...
fe05b265-b713-432e-a1ff-6de2941a4177
4
public static float arrayMax(float[] array){ if(array == null || array.length == 0) return 0; float max = 0; for(int i=0; i<array.length;i++){ if(array[i] > max){ max = array[i]; } } return max; }
78e8e535-32f4-4574-8c2f-b3120eb552ee
3
private static int initOriginal(final Display display, Composite inComposite) { final Composite originalCompsite = new Composite(inComposite, SWT.BORDER); int heightHint = 0; try { original = new Image(display, Resource.class.getResourceAsStream(IMAGE_PATH)); if (original.getImageData().depth != 8 && origi...
6de4a39c-c7f1-4ae6-b974-1e6614053e9d
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...
f7df89bd-e440-49f4-a73e-d3131d6d4a14
4
public boolean isFull() { boolean full = true; for (int x=0; x<3; x++) { for (int y=0; y<3; y++) { int[] pos = { x, y }; Player curr = getPlayerAtPosition(pos); if(curr==null) { // Emp...
252cb397-fff8-4d24-bb24-16779afd0af2
0
void turboBoost() { }
0898bd5c-3b11-433b-9e85-8ad9dcb46ada
3
public static ProtocolFileData getFileDataInBinary(byte[] fileInBytes, int length) throws TagFormatException { byte[] subStart = Arrays.copyOfRange(fileInBytes, 0, 11); byte[] subEnd = Arrays.copyOfRange(fileInBytes, length - 12, length); byte[] endOfTransfers = Arrays.copyOfRange(fileInBytes, 0, 16); byte...
d3c8cc44-1117-48de-a609-c8f16729a16e
4
private int lootArea() { int lootFound = 0; for (Survivor currentSurvivor : this.raidSettings.getTeam()) { final int X = currentSurvivor.getSkills().getScavengingSkill(), MIN = Skills.LEVEL_MIN, MAX = Skills.LEVEL_MAX; double coeff = 1 + ((X - MIN) / ((double) MAX - MIN)); double rand = BitingDeathGame.ge...
3671e401-5953-4a0d-8f66-f8d9e070a1a0
5
public static ArrayList<StringSequence> formatToStringSequence(ArrayList<String> input) { ArrayList <StringSequence> output = new ArrayList<StringSequence>(); String description= ""; StringBuffer currentSequence = new StringBuffer(); //String sequence=""; for(int i=0;i<input.size()...
f9aa8bcc-c595-4e6d-8ef6-b53f16ffba5f
0
public byte[] getPayload() { return payload; }
9a4f66f5-635f-4614-8f70-4fc97a2011bd
6
public boolean rankup(Player p) { if (!p.hasPermission(PERMISSION_RANKUP)) { p.sendMessage(translate("rankup.no-permission")); return false; } Rank current = ranks.getCurrentRank(perms, p); if (current == null) { p.sendMessage(translate("rankup.no-curr...
366f4ae7-5079-428f-b836-dae1c932cdd5
2
private URL makeUrl(String txt) { try { txt = URLEncoder.encode(txt.trim(), "UTF-8"); String url; url = GOOGLE_URL.replace("%lang%", lang.get()); url = url.replace("%txt%", txt); return new URL(url); } catch (MalformedURLException ex) { ...
dbb5f840-8a29-482b-8675-00225f61d10e
4
public T getCurrent() { if(type == TIMED_SEQUENCE) { if(elapsed >= delay) { sequence.pollFirst(); elapsed = 0; } return sequence.peekFirst(); } else if(type == RANDOM_SEQUENCE) { int r = Application.get().getRNG().ne...
a1611538-5db3-4dc9-9e75-cde95c6c8af3
9
public Matrix solve (Matrix B) { if (B.getRowDimension() != m) { throw new IllegalArgumentException("Matrix row dimensions must agree."); } if (!this.isNonsingular()) { throw new RuntimeException("Matrix is singular."); } // Copy right hand side with pivoting int n...
343e7ac7-8e31-4f2a-8dc2-8dded0fa443b
8
@Override public int hashCode() { int hash = 3; hash = 37 * hash + (this.tag_alter_preservation ? 1 : 0); hash = 37 * hash + (this.file_alter_preservation ? 1 : 0); hash = 37 * hash + (this.read_only ? 1 : 0); hash = 37 * hash + (this.grouping_identity_byte != null ? this.grouping_identity_byte ...
70a69058-611d-4279-88cc-3e4ce8b810cd
6
public int[] shuffle(int data[], int len) { if (len <= 1) { return null; } for (int i = 0; i < ROUNDS; i++) { int mid = (len - 1) / 2; int[] tmpData = new int[len]; for (int j = 0; j < len; j++) { if (j <= mid) { tmpData[2 * j] = data[j]; } else { tmpData[2 * j - len + 1] = data[j]...