method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1c82a138-03c7-4075-ad88-f4fbcb781cf9
6
@Override public void postUpdate() { if(!underTrap){ xPos = 12*Math.cos((direction-90.0)/180*Math.PI); yPos = 12*Math.sin((direction-90.0)/180*Math.PI); if(onBattle && canon.getId()==2){ listElements.addElement(new Bullet(x-xPos,y-yPos, direction)); } if(onBattle && canon.getId()==6){ listElemen...
6684ec9b-7b4a-4150-bed5-4296798db353
9
public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[54]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 28; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { i...
4df69c4d-795e-446f-86a0-5d1e871414a1
1
public Dungeon(Point location) { this.location = location; active = false; random = new Random(); max_floors = random.nextInt(10) + 5;//max 15 min 5 size = 100; floor = 0; floors = new ArrayList<DungeonFloor>(); for (int c = 0; c < max_floors; c++) { ...
c58a0075-eaa6-4dea-9d41-89de6d761532
1
public static void rejectFriendRequest(int senderID, int receiverID) { try { String statement = new String("UPDATE " + DBTable + " SET isRejected = true " + "WHERE uid1 = ? and uid2 = ? and isConfirmed = false and isRejected = false"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); ...
4d3f1ea4-a8f0-4f18-a8b6-8e22d8b5138c
7
private void gameSetup() { // BUILD THE BOARD mother.setBounds(0, 0, WIDTH, HEIGHT-30); GridLayout gl = new GridLayout(11, 11); board = new JPanel(gl); board.setBounds(0, 0, WIDTH, HEIGHT-30); // Add all spaces to the board int topPos = 20; int leftPos = 19; int rightPos = 31; int botPos = 9; ...
1c5efd85-a5fc-44e6-a8ba-8bc3a56a081e
2
public String print() { String output = "Empty Shape"; if( PointList != null ) { output = "Shape - " + PointList.size() + "Points"; for( Point n: PointList ) { output = output + n.print(); } } return output; }
353b930c-5c44-47e2-b29e-9dc78efbbf15
1
private String queryResultsToXMLStringInternal(CycObject query, CycObject mt, InferenceParameters queryProperties, CycList xmlSpec) throws UnknownHostException, IOException, CycApiException { String xmlSpecString = (xmlSpec == null) ? ":default" : xmlSpec.stringApiValue(); ...
4fca9cdb-72b7-4b67-a748-aa576dea6973
2
public static void moveUpText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) { Node currentNode = textArea.node; // Get Prev Node Node prevNode = tree.getPrevNode(currentNode); if (prevNode == null) { return; } // Record the EditingNode and CursorPosition tree.setEdit...
180b5c90-5c02-4e60-8451-77141d2d5210
3
public void shiftRight(boolean isJump){ reDrawIndex += 5; if(reDrawIndex > files.size()-1){ reDrawIndex = reDrawIndex - files.size(); } if(isJump){ listPosition += 5; if(listPosition > files.size()-1){ listPosition = listPosition - files.size(); } } }
ce1453bf-2c0f-4ab0-bd1b-a6f340246110
8
public void draw(Graphics g){ if(pDir == 0){ if(HUD.inventory[0].getItemNum() != 0) g.drawImage(HUD.inventory[0].getPicDown(), playerRect.x+15-HUD.inventory[0].width-1, playerRect.y+15-2, null); g.drawImage(monkDown, playerRect.x, playerRect.y, null); } if(pDir == 1){ if(HUD.inventory[0].getItemNu...
78237cd4-fb4b-46dc-be5d-0439dc4d0e1f
6
protected void updateModelForces(float deltaTime) { boolean wasIntersection = true; for (int n = 0; wasIntersection & n <= 5; n++) { n++; wasIntersection = false; for (int i = 0; i < models.size() - 1; i++) for (int j = i + 1; j < models.size(); j++) {...
6f424b11-71e8-43df-83d4-e9f2ba4050dd
4
public void hit(ArrayList<Tank> tanks){ for(Tank tank:tanks){ if(tank.inside(this) && tank.getId()!=id && tank.isAlive() ){ this.setAlive(false); } } }
5874ea2d-6915-4581-93f2-0c8957d1e47d
4
public void mutate(double lineProb, Random rand) { for (ArrayList<WorkUnit> personWorkList : personWorkLists) { if (rand.nextDouble() < lineProb) { int indexA = rand.nextInt(projectSize); int indexB = rand.nextInt(projectSize); if (indexA == indexB) { if (indexB == projectSize - 1) index...
0a253aae-f0c5-4bea-9357-4647d624ff88
8
public String whichBinary(String type) { for (int i = 0; i < Expression.binaryTypes.length; i++) { if (type.equals (Expression.binaryTypes[i])) { if(type.equals("plus")||type.equals("minus")||type.equals("times") ||type.equals("divided by")) { return "operator"; } else if(type.eq...
968a8372-58b3-4cc2-945d-46b708145adc
8
protected Nodo reducirArbol(int dato) { if(super.raiz.getOpt1() != null) { if(super.raiz.getOpt1().getDato() == dato) return super.raiz.getOpt1(); } if(super.raiz.getOpt2() != null) { if(super.raiz.getOpt2().getDato() == dato) ...
413a47e5-d38a-4105-8aeb-87062f493d4f
5
public void handleInput() { if((InputHandler.isPressed(InputHandler.W)) && (currentOption > 0)) { currentOption--; } else if((InputHandler.isPressed(InputHandler.S)) && currentOption < options.length - 1) { currentOption++; } else if(InputHandler.isPressed(InputHandler.SPACE)) { select(); } }
fc7dfcf0-bcf1-406e-b39c-274395fab52e
5
public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (true) { System.out.println("Please enter 3 numbers"); int first = sc.nextInt(); int second = sc.nextInt(); int third = sc.nextInt(); if (first == 0 && second == 0 && third == 0) { break; } if ((first + s...
43d09981-ba82-4192-9f1e-e97c202fdd58
3
public void setupContent() { /* * Other stuff Being created here */ JPanel empty = new JPanel(); empty.setBorder(new EmptyBorder(0, 0, 20, 0)); empty.setOpaque(false); JPanel info = new JPanel(); info.add(statusLabel); info.setBorder(new EmptyBorder(0, 0, 10, 0)); info.setOpaque(false); JLabe...
5ac76229-6355-4673-a859-afd8747837c1
2
@Override public String getMessageFromTest() { if (isCorrectSoFar) { return SUCCESS_STRING; } else { final String errorString = expectedProgramBehaviorCopy.getErrorString(); if ("".equals(errorString)) { throw new IllegalStateException("message fro...
99053a04-f8d9-4a2a-b35e-fc8ef4de50ab
1
public String getSourceFile() { SourceFileAttribute sf = (SourceFileAttribute)getAttribute(SourceFileAttribute.tag); if (sf == null) return null; else return sf.getFileName(); }
445aa883-9830-43a0-b980-ce662228514b
7
public static byte[] getBytes(Object o) { if (o instanceof String) { return ((String)o).getBytes(); } else if (o instanceof byte[]) { return (byte[])o; } else if (o instanceof Serializable) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ...
695df690-2373-4eae-b5de-5a4c5c7260c2
5
private void updateStates() { State aux; for (State m : successors) { aux = states.get(m.puzzle.getKey()); if (aux != null) { if (aux.opened) { if (m.getStartDistance() < aux.getStartDistance()) { openedStates.remove(aux...
84e19180-049d-4d2d-9865-31cde3ff62d3
5
public ListNode reverseBetween2(ListNode head, int m, int n) { // Note: The Solution object is instantiated only once and is reused by each test case. if ( m == n || n == 1){ return head; } ListNode tmpHead = new ListNode(0); tmpHead.next = head; ListNode tmp ...
9b553dd3-3e6b-4d19-816a-a520bc96ea1e
9
public void patientPersonalInfo(PatientInfo patient, JTextField[] tfPatient, JTextPane tp, JTextPane[] patientTP) { StringBuffer info = new StringBuffer(); if (tp == null && patientTP == null) { tfPatient[2].setText(patient.getBdate().toString()); tfPatient[3].setText(patient.ge...
8fc31022-0460-461b-b424-1b37e573a913
7
public int LCAutil(Node node,int a,int b){ if(node == null){ System.out.println("root is coming as null"); return -1; } if( (node.value >= a && node.value <= b ) ){ if( findNodes(node, a) && findNodes(node, b) ){ return node.value; } else{ return -1; } } ...
ecae79d7-2add-4c39-8870-9e52b3d5aaa9
5
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { FullHttpResponse response; String requestUri; if (msg instanceof HttpRequest) { HttpRequest req = (HttpRequest) msg; boolean keepAlive = isKeepAlive(req); ...
95aa58df-6176-46ed-89ef-8be8a39cb974
5
private static boolean reachableFromSource(Vertex from, HashMap<Vertex, Vertex> predecessors) { HashSet<Vertex> visited = new HashSet<Vertex>(); Vertex source = new Vertex(0, 0); Vertex aVertex = new Vertex(from.posX, from.posY); Vertex me; boolean exit = false; while(predecessors.get(aVertex...
80ddf5e5-2476-41d4-a4cc-3a8cfb98d751
4
@Override public void onEnable() { Mc_IrcBotCommands irccommands = new Mc_IrcBotCommands(this); Mc_PlayerCommands playercommands = new Mc_PlayerCommands(this); getCommand("ircbot").setExecutor(irccommands); getCommand("irc").setExecutor(playercommands); IrcPlayerLi...
854a42ec-a07d-4a3c-a59b-f0782554d44e
6
public void gameAssists() { Collections.shuffle(assists); for (int i = 0; i < 20; i++) { Collections.shuffle(assists); if(assists.get(0) == team.get(0).name) { astC++; } if(assists.get(0) == team.get(1).name) { astPF++; } if(assists.get(0) == team.get(2).name) { astSF++; } if(a...
1a57c4b9-8aa0-4fd2-987a-225c176e1c4f
7
private static List<String> tokenize(String bencodedString) throws DecoderException { List<String> tokenList = new ArrayList<String>(); Matcher m = DECODE_PATTERN.matcher(bencodedString); while(m.find()) { String extractedToken = bencodedString.substring(m.start(), m.end()); if(extractedToken.equals(Bencodi...
166b5e81-ed12-4542-83a5-20cfcdb9cac8
8
public void movePlayer(String direction){ if (direction.equals("up")){ if (canMove(direction)){ location = location - size; } } else if (direction.equals("down")){ if (canMove(direction)){ location = location + size; } }else if (direction.equals("left")){ if (canMove(direction)){ ...
5086cfeb-76d6-4c3a-a525-aff13fe73dff
8
public static boolean isWhiteSpaceChar( char tc ) { if( tc == '\u0009' || tc == '\r' || tc == '\n' || tc == '\u000b' || tc == '\u000c' || tc == '\u0000' || tc == '\u00a0' || tc == ' ' ) { return true; } else { return false; } }
d84350c5-e649-45c2-8f86-38d1526f13f3
5
public static int[] plusOne(int[] digits) { int[] res = new int[digits.length + 1]; boolean isin = false; for (int i = digits.length - 1; i >= 0; i--) { int t = 0; if (i == digits.length - 1 || isin) t = digits[i] + 1; else t = digits[i]; res[i + 1] = t % 10; ...
45824f95-99a1-468c-acf6-cf29a4a3a902
4
private Level findCorrespondingLevel(String levelName, SortedSet<Level> levels) throws CorrespondingLevelNotExistsException { if (null == levelName || "".equals(levelName)) { throw new CorrespondingLevelNotExistsException(); } for ...
71b16f1c-e771-47eb-8956-9f91fdc5efce
7
public static void startupPropagate() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Stella.$CONTEXT$, ((Mo...
95124445-4b61-4a2b-b063-4cfe7bd9f8d9
2
public static void readFile(String filePath) throws Exception { instructionString = new ArrayList<String>(); try { BufferedReader inputf = new BufferedReader(new FileReader(filePath)); String tmp = null; while ((tmp = inputf.readLine()) != null) { tmp = tmp.trim(); instructionString.add(tmp); ...
84a653e4-ed16-4236-89fd-6d01e450bec6
8
public Room getReleaseRoom(Law laws, Area myArea, MOB criminal, LegalWarrant W) { Room room=null; if((criminal.isMonster())&&(criminal.getStartRoom()!=null)) room=criminal.getStartRoom(); else { if((laws.releaseRooms().size()==0)||(laws.releaseRooms().get(0).equals("@"))) return myArea.getMetroMap()....
f27742d0-7698-4931-8ef7-41a32d7d52bf
6
public static boolean readBoolean(String label) { String line = null; boolean finished = false; boolean ret = false; BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); try { while(!finished) { System.out.print(label+" [j/n]: "); line = stdin.readLine().toLowerCase(); ...
89983737-9ee3-449f-b783-e203f375cf04
5
public static byte[] base64decode(String s) { int delta = s.endsWith("==") ? 2 : s.endsWith("=") ? 1 : 0; byte[] buffer = new byte[s.length() * 3 / 4 - delta]; int mask = 0xFF; int index = 0; for (int i = 0; i < s.length(); i += 4) { int c0 = toInt[s.charAt(i)]; ...
9c6c974d-aa3c-43f4-9b38-01c0128f9536
7
private void physicsInvaders() { Invader invader; invader = invaders[0][0]; if (invader.getX() < 5) { invaderSpeedX = invaderSpeedX * -1; invaderLimit = true; } invader = invaders[COLUMNS - 1][ROWS - 1]; if (invader.getX() + invader.getTexture().getW() > Window.getW() - 5) { invaderSpeedX = invader...
0ca9597d-8510-45c9-835c-42e5be8d5f30
3
public void removeDeadFlyUps() { List<FlyUp> toDelete = new ArrayList<FlyUp>(); for(FlyUp fly:flyups) { if(fly.timeSinceCreation() >= 3300) toDelete.add(fly); } for(FlyUp fly:toDelete) { flyups.remove(fly); } }
07b3c73f-5ef2-4ee1-b031-bdeb9fac9dab
3
public void checkGuess(char guess) { if (word.contains(Character.toString(guess))) { for (int i = 0; i < length; i++) { char temp = word.charAt(i); if (temp == guess) { placeholder.set(i, guess); } } } else { wrongLetters.add(guess); } }
aeb85165-12c6-4db9-9858-686bf72a7671
0
public void setCsaFechaHora(Date csaFechaHora) { this.csaFechaHora = csaFechaHora; }
3df5bfbc-e758-4f7f-a86a-1234dfad499c
8
public String addBinaryII(String a, String b) { StringBuilder sb = new StringBuilder(); int i = a.length() - 1, j = b.length() - 1; int l = 0; while (i >= 0 && j >= 0) { int numa = Character.getNumericValue(a.charAt(i)); int numb = Character.getNumericValue(b.charAt(j)); int sum = numa + numb + l; l...
db8c4094-af5f-4f70-a263-e4311272ab9b
5
@Override public boolean queueBuffer( byte[] buffer ) { // Stream buffers can only be queued for streaming sources: if( errorCheck( channelType != SoundSystemConfig.TYPE_STREAMING, "Buffers may only be queued for streaming sources." ) ) return false; ...
41303921-723d-4fd0-a967-f14c905650ed
6
public static Stella_Object accessInputFileStreamSlotValue(InputFileStream self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Stella.SYM_STELLA_FILENAME) { if (setvalueP) { self.filename = ((StringWrapper)(value)).wrapperValue; } else { value = StringW...
72a9f7f0-c889-415d-9c7e-c9fcd9640890
3
public Forecasts getForecast() { try { crs = qb.selectFrom("forecast").where("msg_type", "=", "forecast").executeQuery(); while(crs.next()){ String date = crs.getString("day"); String temperature = crs.getString("temperature"); String weatherDescription = crs.getString("summary"); forecasts.for...
20ca8fed-5d6b-4930-9b69-34fbb8d6ab72
5
@Override public String getPropertyValues() { String var; if(Math.abs(variance) < EPS) var = ""; else var = " (var=" +variance +")"; if(min != UNDEFINED) { if(max != UNDEFINED) { if(min == max) { return min +getUnit() +var; } else { return "[" +min +", " +max +"]" +getUnit() +var; ...
d1e7fda8-bc7c-4729-b6b4-45bae61272da
0
private void setControlsEnabled(Boolean enabled) { mainWindowView.getNumberOfPointsTextField().setEnabled(enabled); mainWindowView.getIntegrationMethodsComboBox().setEnabled(enabled); mainWindowView.getAngleComboBox().setEnabled(enabled); mainWindowView.getxMaxTextField().setEnabled(enab...
440af4e8-163e-448d-934d-3647ed784699
0
public String getPassword() { return password; }
06befb11-521a-42fc-b071-b49acb2d65c4
1
private void createCurrCity(SessionRequestContent request) { City currCity = (City) request.getSessionAttribute(JSP_CURRENT_CITY); if (currCity == null) { currCity = new City(); currCity.setCountry(new Country()); currCity.setDescription(new Description()); } ...
4494ade5-48e0-4fcc-90d2-82500697a49b
3
public void push(PriorityItem o) { LinkedList.Node p = (LinkedList.Node)l.getFirstNode(); if(p == null) { l.add(o); return; } while(((PriorityItem)p.value).compareTo(o) < 0 && p.next != null) { p = p.next; } l.addAfter(o, p); }
08e7b744-33dd-4e5a-98b2-724836626b72
1
public static int[] getArr(int n){ int [] array = new int[n]; Random random = new Random(); System.out.println("*******************unsort array NO:"+n+"************"); for(int i =0; i < n;i++){ array[i] = random.nextInt(100); System.out.print(array[i]+" "); } System.out.println(); return array; }
e1639b24-93ab-4365-8cdf-e13a495782bc
1
public boolean isJoinable(String channel) { this.channel = channel; if (ChannelsConfig.getChannels().getBoolean("channels." + channel + ".joinable") == true) { return true; } else { return false; } }
5d7f3135-d6df-4988-bacf-ba9e1e01b202
1
public int getBufferDmg() { int dmgFromBuffers = 0; for (GameAction action: getBuffers()) { dmgFromBuffers += action.getExtraDmg(); } extraDmg = dmgFromBuffers; return dmgFromBuffers; }
dd8fa791-8649-4777-8cf1-cf455358fbe2
2
@Test public void dequeueReturnsObjectsInCorrectOrder() { int[] expected = new int[100]; for (int i = 0; i < expected.length; i++) { expected[i] = i; q.enqueue(i); } int[] actual = new int[100]; for (int i = 0; i < actual.length; i++) { act...
b83bac61-01fa-4d12-b310-771e0692619a
0
public void setCueMovto(String cueMovto) { this.cueMovto = cueMovto; }
c013568c-0c79-44ed-86e9-5e0b06afaa16
3
private void txt_num_fileFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txt_num_fileFocusLost System.out.println("a dejado de ser focuseado\n"); if (txt_num_file.getText().length() > 0) { try { boolean existe; existe = TicketDAO....
3067b043-653b-4270-b07b-09b317f0e15d
8
public void sendData(String data) { if(connected) { try { if(sock.isClosed()) disconnectFromURL(); else if(!sock.isConnected()) disconnectFromURL(); else { final byte[] bytes=Telnet.peruseInput(data); if(bytes!=null) { out.write(bytes); if((bytes.lengt...
4fdbf42d-14b9-49f9-8917-b5249b2d55c2
9
public void testChain1() { TreeNode key = new TreeNode("leaf"); TreeNode tree = mkChain(new TreeNode[]{ key }); setTree(tree); Question1 originalTree = ((Question2)answer).tree; try { Map result = synchronizeTree(((Question2)answer).convertTree()); if (res...
d53cb7d7-5a1c-4e2a-a293-851d6696057a
9
public String toGetSourceString(OgnlContext context, Object target) { if (target == null) throw new UnsupportedCompilationException("Current target is null, can't compile."); try { Object value = getValueBody(context, target); if...
78c29cf6-e6ac-439b-8be8-cb31e0862703
2
public <T extends Component> Collection<T> getAllComponentsOfType( Class<T> componentType) { synchronized (componentStores) { HashMap<UUID, ? extends Component> store = componentStores .get(componentType); if (store == null) { return new L...
2f65f87f-f9e8-43d3-9977-9ba5d6db1571
9
public String convert(String s, int nRows) { int len = s.length(); if ((nRows==1)||(len<nRows)) return s; int block = nRows*2-2; int nBlock = (len+block-len%block)/block; int[][] location = new int[nRows][nBlock*(nRows-1)]; // reseting the location...
598a9fc3-3c9d-46a2-99fd-09e18be4764b
1
public void execute () { Double cyclops = null; try { CycAccess cycAccess = new CycAccess(); System.out.println("Loading benchmarks.lisp"); String script = "(load \"" + benchmarkFilePath + "\")"; cycAccess.converseVoid(script); script = "(bench...
138492d8-dc47-4511-a69e-62b389f1d591
6
@Override public void input(float delta) { float movAmt = speed * delta; if (Input.getKey(forwardKey)) move(getTransform().getRot().getForward(), movAmt); if (Input.getKey(backKey)) move(getTransform().getRot().getForward(), -movAmt); if (Input.getKey(leftKey)) move(getTransform().getRot().getLeft(),...
c22f7c6b-f0e7-4db0-b247-dc121eac3535
8
private void selectRandomNumber() { phr1 = ""; phr2 = ""; int tmp = getRand(nrPhr1_9000); if (tmp != -1) { phr1 += nrPhr1_9000[tmp]; phr1 += conPhr1[2]; phr2 += nrPhr2_9000[tmp]; phr2 += conPhr2[2]; } tmp = getRand(nrPhr1_900); if (tmp != -1) { phr1 += nrPhr1_900[tmp]; phr1 += co...
904ad6ba-4b76-4365-a6bd-65a0f7e253a0
0
public void setCliente(Cliente cliente) { this.cliente = cliente; }
e9bc0582-e8c8-4f13-ae41-f25890dbfec9
1
public Game(int unit) { this.unit.value = unit; Dimension spielgrenzeSize = new Dimension(FIELD_DIMENSION.width, FIELD_DIMENSION.height); Spielgrenze spielgrenze = new Spielgrenze( new Rectangle(new Point(0, 0), spielgrenzeSize), this.unit); schlange = new SchlangenKopf( n...
2ea3c5a4-8724-4c50-b29f-4fd1b4c1d68e
0
public ReferenceList createReferenceList() { return new ReferenceList(); }
8fe21c4a-c479-42c3-8804-8f199882aca6
3
public int createShader(String filename, int shaderType) throws Exception { int shader = 0; try { shader = ARBShaderObjects.glCreateShaderObjectARB(shaderType); if (shader == 0) return 0; ARBShaderObjects.glShaderSourceARB(shader, readFileAsString(filename)); ARBShaderObjects.glCompileShaderA...
8bbdc50b-aab1-4282-8012-68f5fd4d556f
1
private void drawLoopLine() { parent.noStroke(); parent.fill(0); parent.rect(controlButtons.get(0).getX() + 40, controlButtons.get(2).getY() + 80, 320, 5); /* ArrayList<Integer> tempTimes = loop.getTimes(); for(LoopNode node : graphedInputs){ float distance = 320.0f * ((float) note / (float)loop.getE...
945e3d96-d167-4194-8623-2e4dae4f3cb8
3
public static int attemptGetEntryFieldByNumberInput(List<Integer> fieldList, String input) { int intInput; try { intInput = Integer.valueOf(input); } catch (NumberFormatException e) { return -1; } if (intInput > -1 && intInput < fieldList.size()) return intInput; return -1; }
24ed3301-96c7-40c8-95d7-5f2c2f5c3963
8
private void moveMonth(int numberToMove) { if (DEBUG) log("Beginning moveMonth(int numberToMove) method"); if (DEBUG) log("1. Clone today"); if (DEBUG) log(" Current date: " + date(currentCalendar)); Calendar temp = (Calendar)currentCalendar.clone(); if (DEBUG) log("2. Add " + number...
5f2c2e35-8cf3-4124-990c-08afb88f1a1f
8
public void Update(GameTime gameTime) { mMenu.Update(); if (!mMenu.IsMenuItemSelected()) { mMenu.SelectMenuItem(new Vector2(mInput.GetMouseX(), GameProperties.WindowHeight() - mInput.GetMouseY())); if (mInput.IsMouseHit(0)) { switch(mMenu.GetSelected()) { case 0: { UnLoad(...
f977f187-f15a-4411-913f-02126742c9d9
5
@Override public void update(final int delta) { if (!entitiesToAdd.isEmpty()) { entities.addAll(entitiesToAdd); entitiesToAdd.clear(); } List<Entity> deadEntites = null; for (Entity e : entities) { e.update(delta); if (!e.isAlive()) { if (deadEntites == null) deadEntites = new ArrayList...
98be801d-ab83-406b-a3c1-1e589ac28acb
5
private void firstLogin() { boolean flag = true; String tip = "请输入账号"; while(flag) { String input = JOptionPane.showInputDialog(null, tip, "", WIDTH); if(input==null) { if(user_name==null) continue; else break; } ...
d1bbd9b8-3dac-4d52-bcf6-888a432b3876
2
protected void doTestCycAccess9(CycAccess cycAccess) { long startMilliseconds = System.currentTimeMillis(); try { CycConstant brazil = cycAccess.getKnownConstantByGuid(BRAZIL_GUID_STRING); CycConstant country = cycAccess.getKnownConstantByGuid(COUNTRY_GUID_STRING); CycConstant worldGeographyM...
14cd2560-768c-4aef-a46a-ea0dfe2a28a0
1
void actionDeleteCurrent() { Form form = (Form) tabPanel.getSelectedComponent(); boolean delete = MessageDialog.confirmQuestion("Odstranění serveru", "Potvrďte odstranění serveru " + form.getTitle() + ".", this); if (delete) { int serverId = tabPanel.getSelec...
46c4e260-67bb-4c4b-a6e9-45f4ceb468cd
1
public boolean nextMatch(int userID){ this.scoreList = this.runningMatch.getScoreList(); this.finishedMatches.add(this.runningMatch); if(upcomingMatches.peek() != null){ this.runningMatch = upcomingMatches.poll(); this.runningMatch.setLeftUser(alstLeftUser.toArray(new Integer[0])); this.runningMatch.set...
73388991-41a0-4617-b962-0f9f7a16f4e9
5
public ArrayList<UndoableItem> redoFunction() { ArrayList<UndoableItem> toReturn = new ArrayList<>(); if (redoStack.isEmpty()) { return null; } else { ArrayList<UndoableItem> cur = (ArrayList<UndoableItem>) this.redoStack.pop(); this.undoStack.push(cur); ...
d9e9de74-dc21-4096-b5d4-4ffeffb3f46d
9
@Test public void test1() throws PersistitException { System.out.print("test1 "); final Exchange ex = _persistit.getExchange("persistit", "TransactionTest1", true); ex.removeAll(); final Transaction txn = ex.getTransaction(); txn.begin(); try { for (int...
4ed7d445-c705-46a6-bef7-dd02b3fcf647
3
@Override public boolean urunSil(int urunID) { /* HbmIslemler hbm = new HbmIslemler(); * */ try { /* return hbm.sil(urunID, Urun.class); * */ Urun urun = urunBul(urunID); if(urun != null){ if(urunler.remove(u...
e468e50a-20f8-48b6-8aa6-38a6e5cefd04
9
public static boolean analysisVMXM(AnalysisOutput o, List<AnalysisOutput> candidates) throws MorphException { int idxXVerb = VerbUtil.endsWithXVerb(o.getStem()); if(idxXVerb==-1) return false; o.setXverb(o.getStem().substring(idxXVerb)); String eogan = o.getStem().substring(0,idxXVerb); ...
56e3e0ec-d302-447c-9fe3-9100b1bc4fcf
2
@Override public List<TransMode> load(Criteria criteria, GenericLoadQuery loadGeneric, Connection conn) throws DaoQueryException { int pageSize = 10; List paramList = new ArrayList<>(); StringBuilder sb = new StringBuilder(WHERE); String queryStr = new QueryMapper() { @O...
48ffe659-1980-494b-b94f-fc3dd218e5ed
7
public static void printFormulaInfo() { System.out.println("*********************************\nVariable Information"); //print out the variables for(int i = 1; i < variables.size(); i++) { Variable v = variables.get(i); System.out.println(v.getName() + "\tAssignment:" + (v.getAssignment()==Variable.U...
db695f2d-cfc3-4084-9e25-3c75328d443e
6
public static int[] find(int[] arr, int windowSize, boolean print) { if(arr==null || arr.length==0) { return new int[]{}; } int[] result = new int[arr.length]; int idx = 0; MyQueueWithMaxMin<Integer> queue = new MyQueueWithMaxMin<Integer>(arr.length); int i=0; queue.offer(arr[i++]); if(i<arr.leng...
949dc8b2-c0fa-4246-bc8b-42aaf4b817b4
4
private static String verifyUrlPagination(String url,ArrayList<String> exclusionKeyWords) { if (!url.toLowerCase().startsWith("http")) { return null; } try { new URL(url); } catch (MalformedURLException e) { Logger.getLogger(Crawler.class).debug("Exception :"+e.getMessage() + " Description :"+ e.to...
d96be819-a4e7-4831-a9ff-2a37d7378f09
1
public void run(){ int data; while(true){ data = buffer.consume(); } }
3c13aced-3daf-4e5e-87ed-1fec805684df
5
protected String getNestedUsage(String[] args, int level, Method method, T player) throws CommandException { StringBuilder command = new StringBuilder(); command.append("/"); for (int i = 0; i <= level; ++i) { command.append(args[i] + " "); } Map<Strin...
e36c8dc6-39b8-4107-ae84-f76c99000f56
3
public Tela() { initComponents(); //JFileChooser configure txt jFileChooser1.setAcceptAllFileFilterUsed(false); FileFilter filter = new FileNameExtensionFilter("TXT File","txt"); jFileChooser1.setFileFilter(filter); jFileChooser1.setControlButtonsAreShown(false)...
4e540b52-ed04-4b47-9f91-83cb504f0b37
7
public int[][] generateMatrix(int n) { int[][] matrix = new int[n][n]; int[] layerTotal = new int[n/2 + 1]; layerTotal[0] = 0; // layer length outside current index for (int i = 0; i < n; i++) { int v = Math.min(i, n - i - 1); if (i > 0 && i < n/2 + 1) { ...
da25984b-cf44-4eb8-8571-a6a60ffd49ef
8
public Number multiplyNumbers(Number a, Number b) throws NumberClassNotFoundException { Number product = null; if (a instanceof Double && b instanceof Double) { product = new Double(roundDouble(a.doubleValue() * b.doubleValue())); } else if (a instanceof Integer && b instanceof In...
c9d75b29-9d23-4781-a696-5191841245a6
9
private void processCNumber(AnalyzeContext context){ if(nStart == -1 && nEnd == -1){//初始状态 if(CharacterUtil.CHAR_CHINESE == context.getCurrentCharType() && ChnNumberChars.contains(context.getCurrentChar())){ //记录数词的起始、结束位置 nStart = context.getCursor(); nEnd = context.getCursor(); } }else{//正在...
7129303e-1766-43c9-9423-4a3ace00d1a1
7
public static String longestTwoUniqueSubStr(String str){ List<String> chars = new ArrayList<String>(); String maxSubString = ""; String current = ""; int i=0; for(char c: str.toCharArray()){ chars.clear(); chars.add(c + ""); current = c + ""; for(int j = i+1; j <str.length(); j++){ if(char...
b12f4868-8018-4dd9-bd41-9c33fc61bccc
4
public static void cobrirLinhas(Coluna naoincluir, Solucao solucao){ for(Coluna col : solucao.getColunas()){ if(col.getNome()!= naoincluir.getNome()){ ArrayList<Integer> valores_cobertos_pela_coluna = col.getCobertura(); for(Integer linha : valores_cobertos_pela_colun...
71af74ab-e849-4953-9a4e-8043a3c69422
3
public HTTPResponse handle(HTTPRequest req) { { Iterator<Plugin> it = plugins.iterator(); while ( it.hasNext() ) { Plugin thisPlugin = it.next(); if ( thisPlugin.handles(req) ) return thisPlugin.handle(req); } } String debugData = req.getMethod()+" "+req.getPath()+"<br>"; debugData ...
b2d9cf85-59bd-4412-968d-ad0d792cdc8c
4
public void updatePos() { if(--time >= 0) { for (int i = 0; i < Map.getHeight(); i++) { for (int j = 0; j < Map.getWidth(); j++) { if (Utils.distance(j, i, px, py) == radius - time) Map.addAttack(new Attack(j, i, father)); }...
fc76ad3e-f3ec-4200-80cb-36693b9e4aac
9
@SuppressWarnings("rawtypes") public List loadList(final List<Long> ids) { if (ids == null || ids.isEmpty()) return new ArrayList(0); // 因为要保持有序,所以按照id顺序创建对象 List<POJO> prjs = new ArrayList<POJO>(ids.size()) { private static final long serialVersionUID = 1L; ...
43a2b9e6-5c47-446f-87e8-503755e2a37b
2
public void addClientEvent(int event){ for (Team team : playmode.getTeams()) { for (User user : team.getUser()) { ArrayList<Integer> events = userIDtoClientEvents.get(user.getID()); events.add(event); userIDtoClientEvents.put(user.getID(), events); } } }
ada5b8eb-fc46-43fa-9db2-617d96833300
2
public Object invoke(Object proxy, Method m, Object[] args) throws Throwable { Object result; try { System.out.println("before method " + m.getName()); result = m.invoke(obj, args); result = interceptor.around(result); } catch (InvocationTargetExce...