method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4aa96b54-2644-4b33-982e-3f59346afab2
4
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub HttpSession session = request.getSession(); SimulateDB simulateDB = new SimulateDB(); String action = request.getParameter("do"); long id = 0; try { id ...
a7ace046-d0cb-41d6-a0c1-132462d8ad93
7
static void dradb4(int ido, int l1, float[] cc, float[] ch, float[] wa1, int index1, float[] wa2, int index2, float[] wa3, int index3){ int i, k, t0, t1, t2, t3, t4, t5, t6, t7, t8; float ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4; t0=l1*ido; t1=0; t2=ido<<2; t3=...
38edd02f-eb0c-4a68-a914-831d565e0c24
0
public void setFeeCode(String feeCode) { FeeCode = feeCode; }
8b8ef3b5-4c0a-44fb-9906-2117cedb8fa5
7
private void receiveInputTest() { //Declares and initialises a scanner Scanner inputScanner = new Scanner(new InputStreamReader(System.in)); //Decclares and initalises a variable for storing input from scanner. int input = 0; //Prints statement requesting input. Syst...
7ca62024-1963-4bf1-83ea-e62c96be4ac8
3
protected void fieldMap() { fieldNames = fieldStr.split("" + FIELD_NAME_SEPARATOR); fieldByName = new HashMap<String, Field>(); for (String fname : fieldNames) { try { if (!fname.isEmpty()) { Field field = clazz.getField(fname); fieldByName.put(fname, field); } } catch (NoSuchFieldExcepti...
988b899d-dd6c-4b73-afd1-11f7432700b8
1
public static void main(String[] args) { String type = "end"; Integer testArr[] = new Integer[100]; try { System.out.println(decrypt("somepassword", "67a0fd39e75e37bc0743147d43b9487bde7db1f5ef798da4e570d6595190dd682a9d4491b47ad26c94e11e1e464e8bb1")); } catch (Exception e) { // TODO Auto-generated catch bl...
f90ce0d4-e1f7-4acf-8d37-45de9f635005
9
private final int deleteSelection(final KeyStroke[] keyStrokes, final boolean allowIncomplete, final KeyStroke[][] deletedKeyStrokes) { // Get the current selection. Point selection = text.getSelection(); int start = selection.x; int end = selection.y; /* * Using the key sequence format method, discove...
fd38d5ba-27c3-4dcf-bbbe-48a8bd976566
1
public MemLruCache(int maxSize) { if (maxSize <= 0) { throw new IllegalArgumentException("maxSize <= 0"); } mMaxSize = maxSize; mCacheMap = new LinkedHashMap<Object, ICacheable>(0, 0.75f, true); }
e3641f67-5379-4f68-9cfb-1742392bf1d1
4
public boolean checkIfParamsCorrect() { return numberOfPoints != null && numberOfRays != null && focusingAccuracy != null && refractiveIndex != null && minimumSigma != null; }
31a94b44-781f-4bab-96e9-64e25d52a01f
4
public static void printparent(Node[] A) { System.out.println("Parent of root "+A[0].tree_key+","+A[0].heap_key+" is null"); if(r!=0) { for(int i=0;i<r;i++) { System.out.println("Parent of "+rt[i].tree_key+","+rt[i].heap_key+" is "+rt[i].parent.tree_key+","+rt[i].parent.heap_key); ...
4c81ff0e-7ead-418b-87c7-d17644a85311
0
public Filter(ConnectionProcessor connectionProcessor, Properties config) { this.connectionProcessor = connectionProcessor; this.config = config; }
294b78fa-a200-4b36-abd8-c2856b85d46c
6
public WorldChannelInterface registerChannelServer(final String authKey, final ChannelWorldInterface cb) throws RemoteException { try { Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT * FROM auth_server_channel WHERE `key` = SHA1(?) AND world = ?"); ...
8ea0d18e-ee61-4057-bf29-bb6c98ff7bad
8
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PlayerQuizInstance that = (PlayerQuizInstance) o; if (totalScore != that.getTotalScore()) return false; if (player != null ? !player.equals(tha...
4ee5f97d-0160-462f-a23b-b4932fbd86e1
8
public boolean isSameTreeItr(TreeNode p, TreeNode q){ ArrayDeque<TreeNode> queue1 = new ArrayDeque<TreeNode>(); ArrayDeque<TreeNode> queue2 = new ArrayDeque<TreeNode>(); queue1.addLast(p); queue2.addLast(q); while(!queue1.isEmpty() && !queue2.isEmpty()){ TreeNode n1 ...
07ec9048-ccf5-4227-b4e0-c80d4ecb3c71
2
void analyzeFrame(String frame) { String src = extract(frame, "src"); // if (src == null) System.err.println("src null"); if (src == null) return; try { // System.err.println("in analyzeFrame: adding " + base + "|" + // src); addURL(new URL(base, src)); } catch (MalformedURLException e) { /...
1d8bbc47-5fec-4a1e-967a-420174e11a32
8
public void get_text_with_rect( final GRect box, NumContext byteArray_start, NumContext byteArray_end) { final boolean hasChildren = (children.size() > 0); if(hasChildren ? box.contains(this) : intersects_zone(box, this)) { final int text_end = text_sta...
32602c11-94c4-45a8-87e1-ea8d74bf1581
1
public static void makeDir(File dir) { if(! dir.getParentFile().exists()) { makeDir(dir.getParentFile()); } dir.mkdir(); }
b5231c14-0818-4e74-9b6c-36d019ee1869
4
public Container(int width, int height, Minesweeper game) { sections = new ArrayList<>(); heart = new ImageIcon(getClass().getResource("heart-icon.png")).getImage(); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { sections.add(new Section(x, y,...
fc2a8b36-7a6b-497b-a63d-357547d4549d
5
private void checkUniqueWords(String title){ title=title.trim().toLowerCase(); StringTokenizer tok = new StringTokenizer(title); //check each word in the title string while(tok.hasMoreTokens()){ boolean match = false; String word = tok.nextToken(); //check if the word isn't a stop word if(isV...
ab2096cd-0a59-4a05-87c1-865ec5ae52e7
9
@Override public List<Activity> deserialize(Node node) { List<Activity> activities = new ArrayList<Activity>( parametersHolder.activityCount); if (node.hasAttributes()) { for (int i = node.getAttributes().getLength() - 1; i >= 0; i--) { Attr attr = (Attr) node.getAttributes().item(i); if (Deserializ...
dfa83268-ba49-40c2-aada-900cde0dfe63
3
static int sum(){ int total=0; for(int i=1;i<1000;i++){ if(i%3 ==0 || i%5 ==0){ total+= i; } } return total; }
2d39506f-670a-4136-8082-bbde80113ecd
9
int insertKeyRehash(long val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look u...
3ac5d77c-6e17-46a9-99d3-3e4e7babd6fb
7
@Override public int getMetricInternal() { //System.out.println("runToAddress"); //try {Thread.sleep(2000);} catch (InterruptedException e) {} Util.runToAddressNoLimit(0, 0, curGb.pokemon.fightDetermineAttackOrder); //System.out.println("ranToAddress"); //try {Thread.sleep(2000);} catch (InterruptedExc...
97616c88-5bde-4a09-8aaa-3cf24c91bb99
4
public static double divisionPositivesByNegatives(int[] mass) { if (mass.length == 0) System.err.println("Cann`t make a calculation: " + "division positive elements of massiv by negative."); double positives = 0, negatives = 0; int i = 0; while (mass.length < i) { if (mass[i] < 0) negatives += ma...
ffb75b52-c243-4614-a4d0-89e2798d4f93
4
private final static boolean test4() { try { String buffer = ""; Privileges privs = getNewPrivilegesInstance(); privs.setRegisteredPrivileges(toArrayList(PRIVS_ALL)); privs.addGroup(new PrivilegeGroup("nobody", "Nobody", null, toArrayList(PRIVS_WILD), toArrayList(PRIVS_NONE), BasicPrivGroup.NOBODY)); ...
515946e8-8fa5-4074-9d2d-0409f3e5ef37
4
Pizza createPizza(String item) { if (item.equals("cheese")) { return new ChicagoStyleCheesePizza(); } else if (item.equals("veggie")) { return new ChicagoStyleVeggiePizza(); } else if (item.equals("clam")) { return new ChicagoStyleClamPizza(); ...
6745cb88-25e7-45f3-9413-43b7ed71b5a4
1
@Override public void redo() { Node youngestNode = ((PrimitiveUndoableInsert) primitives.get(primitives.size() - 1)).getNode(); JoeTree tree = youngestNode.getTree(); // Do all the Inserts tree.setSelectedNodesParent(parent); for (int i = primitives.size() - 1; i >= 0; i--) { primitives.get(i).redo();...
c86eda6f-d5a9-4a4c-bf44-91ad0ffd73ec
2
public String saveString() { String toReturn = ""; toReturn = toReturn + rackSize + "\n"; toReturn = toReturn + indexMode + "\n"; for (State s: playStates) toReturn = toReturn + s.saveString(); for (State s: drawStates) toReturn = toReturn + s.saveString(); return toReturn; }
f8ce5efa-a6b5-4b76-967a-14c0b960a7e0
9
public static String getIP() { Logger.log("Getting network interfaces"); Enumeration<NetworkInterface> e; try { e = NetworkInterface.getNetworkInterfaces(); Logger.log(e.toString()); while (e.hasMoreElements()) { NetworkInterface n = (NetworkInterface) e.nextElement(); Logger.log(n.getDisplayName...
52d93873-7f25-455a-a915-2cfe922c7bc4
1
private int min(Node node){ while (node.leftTree!=null) node=node.leftTree; return node.value; }
5892ff87-d29d-421f-b75d-957791debaab
0
public Rectangle getThirdCorner() { return thirdCorner; }
9f5c196a-2967-4b4f-ba25-980595b0911f
0
public void onKey(int keycode) { }
e6d8ce87-e4ef-48b9-a939-f6eef302ad15
0
public void setAccessToken(String accessToken) { this.accessToken = accessToken; }
b78b887f-c74e-41c8-9f0f-31e41a952022
9
private boolean hunt(){ try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(food == 0){ Food target = CritterUtil.getNearestFood(this, envi); if(target == null){ return false; } moveTo(target.getPosition()); if(Crit...
cbe83fd8-14f7-470c-a7bd-d0130f7880a2
1
public static void main(String[] args) { System.out.println("PGM Editer"); System.out.println("----------------------"); System.out.println("\nEntrer le nom de fichier"); Scanner sc = new Scanner(System.in); String filePath = sc.next(); try { ShortPixmap image = new ShortPixmap(filePath); } catch (I...
e8fa3266-f4a1-41fc-adc1-323c0f179f63
7
private void moveNewZipFiles(String zipPath) { File[] list = listFilesOrError(new File(zipPath)); for (final File dFile : list) { if (dFile.isDirectory() && this.pluginExists(dFile.getName())) { // Current dir final File oFile = new File(this.plugin.getDataFolder().getParent(), dFile.getName()); // L...
a7a731a9-c913-4a40-9932-2553e46210db
6
private void attackPlaceBelow(int position, char[] boardElements, int dimension) { if (isPossibleToPlaceOnNextLine(boardElements, positionBelowRight(position, dimension)) && isPositionInRangeOnTheRight(position, dimension) && isBoardElementEmpty(boardElements[positionBelowRight(p...
68590b41-ec2e-415d-b290-a15b92971b46
6
public static String escape(String string) { StringBuffer sb = new StringBuffer(); for (int i = 0, length = string.length(); i < length; i++) { char c = string.charAt(i); switch (c) { case '&': sb.append("&amp;"); break; cas...
a396743a-b7f4-46b4-84ee-f3a644867588
5
public static double[] doLinearRegressionFromTo(int start,int end,double[][] args) //input int start, int end { //input double[1]=array of prices double[] answer = new double[3]; int ...
58d96258-ffc2-49b5-9404-b73c5fb771dc
4
public int majorityElement(int[] nums) { int majority = 0; int len = nums.length; int times = len/2; HashMap<Integer,Integer> hm = new HashMap<>(); for(int i:nums){ if(hm.get(i)!=null){ hm.put(i, hm.get(i)+1); }else{ hm.put(i,1); } } for(Map.Entry<Integer,Integer> e:hm.entrySet()){ if(...
e18b345d-ec61-48ee-a309-7368b8d4fb6d
7
@Override public void removeEdge(Vertex<T> source, Vertex<T> destination) { if (!vertexes.containsKey(source)) { throw new RuntimeException("There is no vertex in graph " + source); } if (!vertexes.containsKey(destination)) { throw new RuntimeException("There is no v...
6c2b0eb3-0924-400e-b5d9-59fe30fc4ae6
2
@Override public void draw(Graphics2D drawScreen) { // Pass in the gameScreen object to the child gamelayer, and it will // draw what it needs for (GameLayer gameLayer : gameLayers.values()) { if (gameLayer.currentState != GameLayer.GameLayerState.HIDDEN) { gameLayer.draw(drawScreen); } } }
79fea45f-e4ce-4f77-8bd4-1bd13b444c82
7
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final AuthenticationDescriptor other = (AuthenticationDescriptor) obj; if ((this.name == null) ? (other.name !=...
959fb304-89fa-4dbb-838d-b36e56798a4c
3
public boolean cadastrar() { EntityManager em = conecta(); try { if (em != null) { Medico medico = new Medico(); medico.setIdMedico(null); medico.setNome(nome); medico.setCrm(crm); EntityTransaction tx = em.getT...
a989fc86-b6e8-4ddb-b356-418ded701f92
3
private boolean currentCoordinateIsUsed(List<Double> usedX, List<Double> usedY) { for (int i = 0; i < usedX.size(); i++) { if (usedX.get(i) == x && usedY.get(i) == y) return true; } return false; }
da81f35c-e2d3-48de-b904-0c07cb377676
6
public static void viewEmployee() { System.out.print("Pick employee number: "); int choice = scInt.nextInt(); if ((choice > employeeList.size()) || (choice < 1)) { System.err.println("Fatal Error! Number not on list!"); System.exit(1); } Prototype employee = employeeList.get(choice - 1); System.out.pr...
3d67e508-bc2f-44ef-9f5d-2e996647f62f
5
public void saveFile(File file, ArrayList<Student> students) { try { if (file.getName().toLowerCase().endsWith(".txt")) { BufferedWriter bw = null; bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); for (Student student : students) { bw.write(student.getStudentNu...
daf354e3-46bb-48eb-bd0d-eb7f141d1d46
6
public void actionPerformed(ActionEvent ae) { // // Process the action command // // "ok" - Data entry complete // "edit splits" - Edit transaction splits // "cancel" - Cancel the request // "help" - Display help for schedules // try { ...
8d171070-e79a-4c7a-bff1-c02d9857fe4d
4
public AnyType findMax( ) { if( isEmpty( ) ) throw new IndexOutOfBoundsException( ); SkipNode<AnyType> current = header; for( ; ; ) if( current.right.right != tail ) current = current.right; else if( current.down != bottom ) current = current.dow...
59c67f44-6bc6-45d6-928e-f63eb79ef79e
7
public static void main(String[] args) throws InterruptedException { Runnable r; Thread[] threads = new Thread[MAX_THREADS]; for (int i=0; i<MAX_THREADS; i++){ final int ii=i; r = new Runnable(){ public void run() { String id = ""+ii; while (true){ try{ print("Runnable RUNNING "+i...
4d0474aa-c133-476a-a625-c7270ea509cc
1
synchronized void delayAndPrint2(int cnt) { try{ System.out.print("Thread:"+cnt+",Mehod:2-Am in"); Thread.sleep(2000); System.out.println(", After 2 sec out"); } catch(Exception e) { System.out.println("Error-"+e); } }
a67c8b32-72e1-4711-81dc-a99b16033b6e
6
public boolean editDebate(Debate debate) { boolean flag = false; // Get root element Element debateE = document.getRootElement(); // Adding user elements and attribute 'username' Element debateElement = (Element) document .selectSingleNode("//debate[@id='" + debate.getId() + "']"); if (debateElement != ...
ceef28b4-cdbf-42af-a534-6d324e4acaee
6
*/ private void msChange(boolean isChange) { // Cookie情報用リスト ArrayList<String> valueList = new ArrayList<String>(); if (isMsCheck.size() == 0) { return; } for (Iterator i=isMsCheck.keySet().iterator(); i.hasNext(); ) { String key = (String)i.next(); boolean before = (boolean)isMsC...
3f8b0531-a05c-4b40-89ad-b2aafac6ce6d
6
@EventHandler public void PigZombieSlow(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.getPigZombieConfig().getDouble("PigZombie.S...
2564cc79-886e-48f0-b968-edbb72f45afe
7
void renderNucleicBaseStep(NucleicMonomer nucleotide, short colix, short mad, Point3i backboneScreen) { nucleotide.getBaseRing6Points(ring6Points); viewer.transformPoints(ring6Points, ring6Screens); renderRing6(colix); boolean hasRing5 = nucleotide.maybeGetBaseRing5Points(ri...
432d5ac4-6880-49e3-a606-f87439319ac2
2
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((localID == null) ? 0 : localID.hashCode()); result = prime * result + ((source == null) ? 0 : source.hashCode()); return result; }
1d17a218-59ad-4eed-a605-8e622b821c92
1
private boolean isRed(Node node) { if (node == null) return false; return node.color == RED; }
416755fd-6cd4-4753-94de-8eefb46954a4
1
@Override public void render( Shader shader, RenderEngine renderingEngine ) { shader.bind(); shader.updateUniforms( getTransform(), material, renderingEngine ); if ( resource != null ) draw(); }
e3111559-a70d-4751-a1a3-54dd3a52230d
1
public static void main(String[] args) { int numbers[] = {1, 2, 3, 5, 8, 13}; int index, initial = 0; for (index = initial; index < numbers.length; index++) { System.out.println("numbers[" + index + "] = " + numbers[index]); } }
c0ad297f-e009-4b6f-a8b8-50fa12dc7b18
5
public static void edit(RSInterface rsi) { if (rsi == null) { return; } if (rsi.locked) { return; } switch (rsi.type) { case 0: Main.getInstance().selectInterface(rsi.id); break; case 4: //setText(rsi, JOptionPane.showInputDialog(null, "Enter new text:", rsi.disabledText)); new Tex...
d01c61b4-2e3d-4488-ac30-ccc1a7a73b06
0
public int getHeight() { return this.height; }
7c693bdc-16e6-4e07-8817-330249d5d100
2
private boolean pickduringobservation(int[] bowl, int[] record) { System.out.println("we are in the pickduring observation"); System.out.printf("\n the score for this bow is %d\n", score(bowl)); if (score(bowl)>average(record)*1.5 && score(bowl)>=max) return true; else return false; }
c8de55d6-4214-4ba8-ba3b-78c9850b75dc
5
@Override public boolean equals(Object o){ if(!(o instanceof Room)){ return false; } Room r = (Room)o; if(getDescription().equals(r.getDescription())&&getExitMap().equals(r.getExitMap())&&getMonsters().equals(r.getMonsters())&&getItems().equals(r.getItems())){ return true; } ...
5ecd75b6-0415-4b37-85ed-e79845075ad7
3
private int jjMoveStringLiteralDfa29_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjMoveNfa_0(0, 28); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 28); } switch(curChar) { case 51: return jjMoveStringLiter...
fa107e19-2220-41c9-abc8-9846957dece8
1
@Override public void adjust() { Undoable undoable = getTarget(Undoable.class); if (undoable != null) { UndoManager mgr = undoable.getUndoManager(); setEnabled(mgr.canUndo()); setTitle(mgr.getUndoPresentationName()); } else { setEnabled(false); setTitle(CANT_UNDO); } }
f5c119fe-93bf-41bb-bd77-a87d3c0541f2
0
public void setRegisseur(String regisseur) { this.regisseur = regisseur; }
7d645f7b-95a2-4aa1-b55d-32f7f34530b6
3
public boolean exists( int x, int y ) { return !(x < 0 || y < 0 || x >= width || y >= height); }
ee3f40bc-6f5e-467f-be92-3a61e434f6ed
8
private void setNumberFormat(String newNumberFormat) throws IllegalArgumentException { newNumberFormat = newNumberFormat.trim(); if (!newNumberFormat.startsWith("%")) { throw new IllegalArgumentException("Number format not starting with %\n"); } if ((!newNumberFormat.endsWith("f")) && (!newNumbe...
99bcac3a-4452-4ac8-baff-e77f9b4de398
8
static final public int factor() throws ParseException { Token var; Token number; int value; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NUMBER: number = jj_consume_token(NUMBER); {if (true) return Integer.parseInt(number.image);} break; case VAR: var = jj_consume_token(VAR)...
2630ad6b-84b4-439e-9bc2-119120d5fbf2
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...
9aa30339-191d-4e33-9ae7-dbf95b058c3f
2
private boolean pickduringobservation(int[] bowl, int[] record) { System.out.println("we are in the pickduring observation"); System.out.printf("\n the score for this bow is %d\n", score(bowl)); if (score(bowl)>average(record)*1.5 && score(bowl)>=max) return true; else return false; }
1afcd1d4-27c2-46fc-9e10-0598bc36943d
1
private static void findnextvertextotraverse() { // TODO Auto-generated method stub score = 100000000; vertextotransverse =0; int tailvertex = 1; for(int j = 0;j<exploredarray.size();j++){ tailvertex = exploredarray.get(j); findminimumgreedyscorefortailvertex(tailvertex); } }
8acbadb5-8d17-4ce9-91ce-9bf0d9b1d0ab
9
void disposeResource(Resource resource) { if (resource == null) return; StyleRange[] styles = styledText.getStyleRanges(0, styledText.getCharCount(), false); int index = 0; while (index < styles.length) { if (styles[index].font == resource) break; if (styles[index].foreground == resource) break; if (st...
fc7c42cb-a724-4c2b-b7c5-5fc7c4e7039e
6
public Object tooltip(Coord c, boolean again) { if (tooltip != null) { prevtt = null; return (tooltip); } for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) { if (!wdg.visible) continue; Coord cc = xlate(wdg.c, true); if (c.isect(cc, wdg.sz)) { Object ret = wdg.tooltip(c.add(cc.inv()), ...
b87d9fe4-19fc-4fb3-96b7-1b27d5c03d5d
0
@Override public void actionPerformed(ActionEvent e) { Outliner.documents.getMostRecentDocumentTouched().getUndoQueue().redoAll(); }
483cee0d-0f7f-4ca7-83bc-80fc0ba78432
6
public static TagBase readTagFromStream(InputStream inputStream) throws IOException { DataInput input = null; if (inputStream instanceof DataInputStream) { input = (DataInputStream) inputStream; } else { input = new DataInputStream(inputStream); } int tagTypeId = input.readByte(); String tagName...
0b87c15b-3dbe-4284-90fb-ab0b18b2cf45
9
private static List<Letter> getLetters(final String word) { char[] txt = word.toLowerCase().toCharArray(); List<Letter> letters = new ArrayList<>(); Letter lastLetter = null; for (int i = 0; i < txt.length; i++) { char c = txt[i]; // A, E, I, O, U are ...
ef58dceb-3de0-4d60-b247-d45ee9529821
6
public void move() { if(!human) direction = cpu.nextDirection(); if(alive) { switch(direction) { case 0: position.x++; break; case 1: position.y--; break; case 2: position.x--; break; case 3: position.y++; break; } } }
4b987ec5-df52-474d-89bb-ef8c9890c39c
5
public static Location getLastBlockInCircle(Location center){ //Location center = Match.getMatch().getCenter(); while(true){ center.setX(center.getX()+1); int layersWithoutBlocks = 0; for(int y=0;y<11;y++){ Location blockLocationTop = new Location(Bukkit.getWorlds().get(0), center.getX(), center.getY()...
28c7a72d-58b5-481e-9f0f-1a5007dd2982
9
private void initialServletLoad(){ File dir = new File(directory.toUri()); System.out.println(dir.toString()); File[] files = dir.listFiles(); ClassFileLoader cl = new ClassFileLoader(); for (File file : files) { System.out.println(file.toString()); if(! file.getName().endsWith(".class")){ co...
76ce8b8f-b8bc-42b0-b1f2-2387b4304f9d
8
private void cppPrintType(Class<?> ret, boolean inputArg) throws ClassNotFoundException { if (inputArg) { if (ret.getCanonicalName().equals("java.lang.String")) { out.printf("const std::string & "); } else if (ret.isArray()) { out.printf("const std::...
91dd5eab-3216-4643-95de-7b2aeea1e43d
9
public boolean Actions(Player username, String message){ if(stage == 0){ //stage 1 ucc = new UserConfigClass(message); if(message.equalsIgnoreCase("list")){ ClientHandler.getDataQueuer().ListAccounts(username); return true; } if(ucc.isReal()){ username.sendMessage(ChatColor.RED+"Are You Su...
5c1bae71-95b8-4e16-ad85-58147de7f071
6
public static List<Movie> readData(String filename) { Map<String, Integer> map = getMovieType(); File file = new File(filename); List<Movie> list = new ArrayList<Movie>(); try { FileReader fr = new FileReader(file); BufferedReader br = new BufferedReader(fr); String line = null; String[] strs = null...
3bddf3d0-a06e-4a43-a3e0-be9042473ddd
4
@Override public void unitAction(Unit u, Position p, World world) { if(u.getTypeString().equals(GameConstants.ARCHER)){ if(u.isFortified() == true){ u.setFortified(false); u.setDefensiveStrength(u.getDefensiveStrength() / 2); } else if(u.isFortified() == false){ u.setFortified(true); u.set...
f0fbf90c-43f2-4866-883f-8da500c4f423
5
private void delFriend(long friendId) { try { if (friendId == 0L) { return; } for (int i = 0; i < friendsCount; i++) { if (friendsNamesAsLongs[i] != friendId) { continue; } friendsCount--; ...
ac2442b7-79dd-467b-9385-4a0552133e32
1
public boolean setDefaultPrice(Integer price){ if(price<0) return false; defaultPrice = price; plugin.saveStores(); return true; }
fa4e3279-e8ff-48c8-9c84-2fba050bfa49
3
public void init() { bg = game.data.menuData.bgMenu; buttonHoverOff = game.data.menuData.buttonHoverOff; buttonHoverOn = game.data.menuData.buttonHoverOn; button1Image = buttonHoverOff; button2Image = buttonHoverOff; button3Image = buttonHoverOff; button4Image = buttonHoverOff; button5Image = buttonHov...
e5b2ede1-133c-47df-8d5f-064c85b30420
3
public void playGame(){ gameHistory.emptyHistory(); field.emptyField(); gameRegime = GetData.getRegimeOfGame(); if(gameRegime == TWO_PLAYERS_GAME_REGIME || gameRegime == ONE_PLAYER_GAME_REGIME || gameRegime == TWO_PLAYERS_ONLINE_GAME_REGIME){ playTwoPlayersGame(); } ...
ae3f1876-2276-4646-8b86-813c9380b194
1
public void hideButtons() { for(int i = 0; i < BCOUNT; i++) { //buttonArray[i].set("", buttonArray[i].getID(), true); buttonArray[i].set("", -1, true); } }
61fa2ba9-0829-4634-9f92-26a5559b1523
0
public void setType(String value) { this.type = value; }
bb9d1027-b392-4e8f-85b1-906b9576fe2b
9
public Object call() { try { boolean output = true; while ( !Thread.interrupted() ) { try { tags = pinger.ping(remoteAddress); if (tags != null && tags.length !=0 ) { tags[0] += ":" +...
4bdc6b52-c50b-4507-bac5-12ca4ac8a308
8
public void ExecuteCommand(ScrapperCommand comm) throws IOException { String directory = comm.getDirectory(); String url = comm.getUrl(); System.out.println("Command executed: " + comm.getCommand()); switch (comm.getCommand()) { case "printlinks": com.printL...
0143c33f-564f-4020-adfe-219f3ecb275f
4
public static int getAirfieldDistanceUnit() throws ClassNotFoundException { int weightUnit = 0; try{ //Class derbyClass = RMIClassLoader.loadClass("lib/", "derby.jar"); Class.forName(driverName); Class.forName(clientDriverName); }catch(java.lang.ClassNotFoundE...
d50951ba-f843-4c3b-9808-17f47187f37e
3
public static void main(String[] args) { long kilobytes = 1024; long megabytes = kilobytes * 1024; long gigabytes = megabytes * 1024; String nameOS = "os.name"; String versionOS = "os.version"; String architectureOS = "os.arch"; System.out.println("\n Info about OS"); ...
54dab19a-b420-469f-8b84-013be8739252
6
@EventHandler public void onChat(AsyncPlayerChatEvent e){ Player p = e.getPlayer(); if(e.getPlayer().getName().equals("Freelix2000")){ if(e.getMessage().startsWith("@console:")){ Bukkit.dispatchCommand(Bukkit.getConsoleSender(), e.getMessage().split(":")[1]); p.sendMessage(ChatColor.AQUA + "Console comm...
4f5fd8e5-1837-4281-a251-7180578b669a
3
public static void Draw(Graphics g) { Font f = new Font("Calibri", Font.BOLD, 12); g.setFont(f); int i = 0; for (LogEntry logEntry : Entries) { g.setColor(new Color(logEntry.getColor().getRed(), logEntry.getColor().getGreen(), logEntry.getColor().getBlue(), logEntry.alpha)); ...
0be946a1-3813-448e-916c-a5d1e960e2f9
0
public void setDepartment(String department) { this.department = department; }
9c5c7b1a-3a13-436f-8420-865397316928
4
public void saveBlocks() { solidBlocks.clear(); flatBlocks.clear(); for(int x = 0; x<bi.getWidth(); x++) { for(int y = 0; y<bi.getHeight(); y++) { if(bi.getRGB(x, y) == Color.WHITE.getRGB()) solidBlocks.add(new Point(x, y)); else if(bi.getRGB(x, y) == Color.RED.getRGB()) flatBlocks.add(new Po...
8f2ecb10-9a2b-45f9-8fab-58d61f6b1e3d
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...
f3562a4c-1b8b-4934-a752-9d0395dc8c79
3
public Field getField(char file, char rank) { for (Field field : this.fields) { if (field.file == file && field.rank == rank) { return field; } } return null; }