method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
8c87ef2f-2d21-4589-9991-cc90b4668d7e
1
public static void deleteQuizCreatedHistory(Quiz quiz) { try { String statement = new String("DELETE FROM " + DBTable + " WHERE qid=?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, quiz.quizID); stmt.executeUpdate(); } catch (SQLException e) { e.printStackTra...
01300ae3-5b61-4007-85d0-099568bf3e3a
9
private void scan() { if (currentBlock >= 0) { return; } if (maxDistance != 0 && currentDistance > maxDistanceInt) { end = true; return; } if (end) { return; } currentDistance++; secondError += secondStep; ...
0dd2d67a-dd2c-49df-a053-e41eeb8b7619
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Usuario other = (Usuario) obj; if (login == null) { if (other.login != null) return false; } else if (!login.equals(other.login)) ret...
72ace72d-c5b7-4901-b142-8c3c9cdeed60
2
public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { if (str == null) { return; } char[] upper = str.toCharArray(); for (int i = 0; i < upper.length; i++) { upper[i] = Character.toUpperC...
9f9e6f8a-78c2-4d78-a071-d2f45ea2cd55
2
public void changeStage(String ref, float x, float y) { //Ensemble.get().setFading(backgroundTrack, 3); if(!map.isTown()) { Save.get().saveTempField(this); } scene = ref; loadStage(ref); player.setX(x); player.setY(y); player.updateBox(); if(map.isTown()) Save.get().clearField(); //addScene...
790fa82f-084e-4568-ae82-11f71a2fc0ba
4
private boolean fileIsAudiofileName(String fileName) { if(fileName.endsWith(".MP3") || fileName.endsWith(".mp3") || fileName.endsWith(".wav") || fileName.endsWith(".WAV")){ System.out.println("Sound found " + fileName); return true; } return false; }
b81d4a03-57d8-42a7-b909-aeae10d85890
7
public void login(ActionEvent actionEvent) { if (("test".equalsIgnoreCase(getUsername()) && "test".equals(getPassword())) || ("aslan".equalsIgnoreCase(getUsername()) && "aslan".equals(getPassword())) || ("fat".equalsIgnoreCase(getUsername()) && "fat".equals(getPassword())) ) { try { FacesCont...
44fdbaf8-e3e1-40a0-b767-8352fe2445dd
3
public void start() { String line = null; StringBuffer sb = new StringBuffer(); try { while ((line = br.readLine()) != null) { if (cb != null) cb.onLine(line); sb.append(line); } } catch (IOException e) { } }
2763d80c-f9f1-4a3b-8dda-e6263edb998b
4
private DefaultMutableTreeNode findDescendantNode(DefaultMutableTreeNode node, Region region) { // GO THROUGH ALL OF node's CHILDREN for (int i = 0; i < node.getChildCount(); i++) { DefaultMutableTreeNode childNode = (DefaultMutableTreeNode)node.getChildAt(i); Region ...
db58bb5a-0338-4193-bda7-af776773289e
8
public Holdable removeStackedItem(Character itemID, int count) throws InvalidKeyException { Holdable item; Holdable returnItem; if(weapons.containsKey(itemID)) { item = weapons.get(itemID); // If the item is stackable then just reduce the stack count returnItem = item.reduceStack(count); // Only if th...
c0d460f0-fcef-4870-a299-c82d53c16569
4
public void subsample(int numberOfPoints, boolean averageY) { int xx[] = new int[numberOfPoints]; int count[] = new int[numberOfPoints]; int yy[] = new int[numberOfPoints]; for( int i = 0; i < x.length; i++ ) { int j = i * numberOfPoints / x.length; xx[j] += x[i]; yy[j] += y[i]; count[j]++; } ...
e943a8b8-a5a4-4ec8-a970-468cee3fc3ea
3
private boolean writePlane(int[] src, byte[] tmp, int width, int height) { try { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { tmp[x] = (byte)src[y * width + x]; } dos.write(tmp); } return true; } catch (Exception e) { e.printStackTrace(); return ...
1e500b52-5a98-4ee5-bef1-c4ba2eb6fbfa
5
@Override public void init (AbstractQueue<QueueElement> docq, Properties props) { this.docq = docq; this.props = props; outputProperties.setProperty(OutputKeys.INDENT, "yes"); outputProperties.setProperty(OutputKeys.METHOD, "xml"); outputProperties.setProperty(Output...
ce7fb5b7-8c90-44ce-903b-aa9edf4371ed
0
public EatAction(Being eater, Being victim) { this.victim = victim; this.eater = eater; }
f3dcc755-fc9b-49de-bb3f-45ea917b1437
9
public static void startupHttpServer() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/HTTP", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Stella.$CONTEXT$, ((Mo...
84f45af9-570a-4df0-9556-16dead57e449
8
public boolean canJump(int[] A) { if (A.length == 1) return true; if (A[0] >= (A.length - 1)) return true; int maxlength = A[0]; for (int i = 0; i < A.length - 1; i++) { if (maxlength >= i && (i + A[i]) >= A.length - 1) return true; if (maxlength <= i && A[i] == 0) return false; if ((i + ...
4f3520e7-710e-4f03-8639-c09724b77c33
3
public void buildTreePane() { if (tree != null && treePane != null) { rebuildTreeList(); return; } try { getTreeList(); createTree(); treeScroll = new JScrollPane(tree); treePane = new JInternalFrame("Children", false, false, false, false); treePane.setVisible(true); treePane.setSize(225, ...
d69f1680-3114-4fe9-bd01-c68b58131d68
3
@Override public void delete(Joueur obj) { PreparedStatement pst = null; try { pst = this.connect().prepareStatement("DELETE FROM Joueur where id=?;"); pst.setInt(1, obj.getIdJoueur()); pst.executeUpdate(); System.out.println("sup...
3a3df8bc-5403-4503-a9b4-88c47af39b8b
9
public static void main(final String[] args) throws Exception { int i = 0; int flags = ClassReader.SKIP_DEBUG; boolean ok = true; if (args.length < 1 || args.length > 2) { ok = false; } if (ok && "-debug".equals(args[0])) { i = 1; flags = 0; if (args.length != 2) { ok = false; } } if...
e11ca69f-483b-4ef0-bcf4-14ce72d08bff
1
@SuppressWarnings("unchecked") List<Operation> getFeedbackOperationVerify(String coderId, String guesserId, String feedback, Map<String, Object> lastState) { List<Operation> guessMove = new ArrayList<Operation>(); guessMove.add(new SetTurn(coderId)); guessMove.add(new Set(CURRENTMOVE,VERIFY)); L...
624210c8-b6e1-4838-a678-2139a36421f1
4
public SudokuBoard getBoardSize(String sizeParameter) { if (sizeParameter.equals(Arguments.SIZE_4x4)) {return new SudokuBoard(SudokuBoard.SMALL); } if (sizeParameter.equals(Arguments.SIZE_9x9)) {return new SudokuBoard(SudokuBoard.REGULAR); } if (sizeParameter.equals(Arguments.SIZE_16x16)) {return new S...
9b23053d-9db2-4856-8bbf-955d0b15a40f
5
public List<String> findItinerary(String[][] tickets) { if(tickets==null || tickets.length==0) return new ArrayList<String>(); Map<String,List<String>> reachablePoints=new HashMap<String, List<String>>(); Map<String,Integer> reachableCnt=new HashMap<String, Integer>(); for(int i=0;i<tick...
9a6511b9-fc27-4bf1-a6f2-00050f19377b
6
protected void installListeners() { super.installListeners(); if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) { focusListener = new FocusListener() { public void focusGained(FocusEvent e) { if (getComponent() != null) { org...
5d9dd3a9-3d55-426e-bc98-5056c477be3c
1
public void Start() { if(m_isRunning) return; Run(); }
228479e1-b8fd-4db2-b2a2-4b6ca86c5e7d
4
public void addField(Column c) { // Check if the column pk is already exist if(c.getName().equals(this.getNamePK())){ int i=0; while(!this.setNamePK(this.getNamePK() + String.valueOf(i))){ i++; } } // Check if any name is repeated List<Column> fields = this.getFields(); for(Column col: fields){...
f884cf65-c595-4468-a552-f26f4443f2e3
1
public ConsoleData getConsoleData() { ConsoleData cd = (ConsoleData)extra.get(ConsoleData.signature); if (cd == null) { cd = new ConsoleData(); extra.put(ConsoleData.signature, cd); } return cd; }
3c2bdc3c-e10c-45ca-998f-254f3969aa41
1
public void ImprimirImp(){ NodosListaProceso aux = PrimerNodo; System.out.println("Nombre de laimpresora\n__\t__________________\n"); while (aux!=null) { System.out.println(aux.nombreProceso+" "); aux = aux.siguiente; } }
11fa52e0-7a33-4dca-8eed-999221d5e8c4
8
private static void compilerTest(File file) throws Exception { // Compile to .java try { JavaCompiler.compile(file, new PrintWriter(new BufferedWriter(new FileWriter("temp/Main.java")))); } catch (Exception ex) { System.err.println("Failed to compile to Java: " + file.getName()); ex.printStackTrace(Syste...
478bfbf1-0455-44bb-9eef-62cdf18e2fa7
0
public int getGreen(){ return _green; }
e15a34a4-b592-4f5e-9af7-321324b00ac2
6
public static void transform(Op opNew) { List<Op> redo = new ArrayList<Op>(); StateVector vecNew = opNew.getStateVec(); for (int i = hBuffer.size() - 1; i >= 0; i--) { Op op = hBuffer.get(i); StateVector vecTmp = op.getStateVec(); if (!isTotalOrdering(vecTmp, ...
a11a02db-6aff-48da-878f-31c42888dc3b
1
@Override public void keyPressed( KeyEvent e ) { for( KeyListener listener : listeners( KeyListener.class )){ listener.keyPressed( e ); } }
6f53f501-eec0-40d8-8a84-2682343a7763
5
public Image arithmetic(Image im1, Image im2, int width, int height, int op, boolean r, boolean g, boolean b, boolean clip) { /* im1 = source image 1. im2 = source image 2. width = width of images (they are the same size) height = height of i...
4dc23733-80cc-4f5a-8c8d-50d60a2072bf
2
public String pad(Object obj, int len){ String str = obj.toString(); // if(len < str.length()){ StringBuilder sb = new StringBuilder(str); if(len > sb.length()){ while(len > sb.length()){ sb.append(asciiChar); } str = sb.toString(); // System.out.println(str); } else{ str = s...
0ddf58d4-8d06-4ad0-8803-ee50f4327dcb
0
public E delMin() { final E returnValue = (E) heap.get(0); heapSize--; heap.set(0, heap.get(heapSize)); heap.delete(heapSize); heapify(0); return returnValue; }
6d5b8be3-a7c8-40d7-94aa-66c744e07207
8
private String cleanFact(String catfact) { StringBuilder sb = new StringBuilder(); boolean escaping = false; boolean unicodeSeq = false; char[] unicodeDigits = new char[4]; int unicodeSeqCount = 0; for (int i = 0; i < catfact.length(); i++) { char c = catfact.charAt(i); if (!escaping) { if (c == '...
1fd674e3-b2d3-4a35-911b-3fa6d5f217be
8
void outerHtmlHead(StringBuilder accum, int depth, Document.OutputSettings out) { if (accum.length() > 0 && out.prettyPrint() && (tag.formatAsBlock() || (parent() != null && parent().tag().formatAsBlock()) || out.outline()) ) //换行并调整缩进 indent(accum, depth, out); a...
b195ca33-6eba-4584-82d9-bfc2fbab52a1
1
private void setResponse() { try{ ButtonModel bm = AnswerButtons.getSelection(); String selectedind = bm.getActionCommand(); selectedAnswers.put(quiz.questionList.get(qIndex).dbId, Integer.parseInt(selectedind)); } catch (NullPointerException npe) { ...
8e633964-aba1-4be4-a22e-35ef882db82a
4
public void run() throws CantRunRaidException { if (this.raidSettings.getDestination() == null) throw new CantRunRaidException(CantRunRaidBecause.DESTINATION_NULL); if (this.raidSettings.getTeam() == null || this.raidSettings.getTeam().isEmpty()) throw new CantRunRaidException(CantRunRaidBecause.NO_SURVIVORS...
1670bfc5-cb26-470a-98fc-3bfe3bd27ee3
4
private Hotelier createHotelier(HttpServletRequest request) throws Exception{ String email = request.getParameter("email"), motDePasse = request.getParameter("motdepasse"), motDePasse2 = request.getParameter("motdepasse2"), siteweb = request.getParameter("siteweb...
d7e20cb0-be85-4eb4-94df-ea1d809fece5
3
@Override public void actionPerformed(ActionEvent e) { String kp = e.getActionCommand(); switch (kp) { case "Host": System.out.println("Host Game"); InetAddress address = null; try { address = InetAddress.getLocalHost(); } catch (UnknownHostException e1) { e1.printStackTrace(); } I...
c985360d-34c0-4f64-a625-1683cc31f46c
0
public static Direction selectDirection() { return Direction.values()[randomDirection()]; }
8d0cea3d-2b72-41b6-9745-3e89ab669de2
3
private static void registerSerializableClasses(ArrayList<Class<? extends ConfigurationSerializable>> serializable) { for(Class<? extends ConfigurationSerializable> clazz : serializable) { ConfigurationSerialization.registerClass(clazz); } }
95b905f5-98f2-4633-9a63-deb8cdbd9e4a
2
public double[][] getGridD2ydx1dx2(){ double[][] ret = new double[this.nPoints][this.mPoints]; for(int i=0; i<this.nPoints; i++){ for(int j=0; j<this.mPoints; j++){ ret[this.x1indices[i]][this.x2indices[j]] = this.d2ydx1dx2[i][j]; } ...
dc990725-b62b-4355-a2b1-58c80d6dec11
0
public static void main(String[] args) { }
964349a2-765d-42c5-a3b8-bc454158178e
9
private String getReport(){ Factory f = new Factory(); StringBuilder sb = new StringBuilder(); try{ ArrayList<User> users = f.getUsers(); for(User u : users){ appendLine(sb, "User: " + u.toString()); if(u.isClient()){ ArrayList<WorkoutPlan> uPlans = f.getWorkoutPlansForUser(u); appendLi...
2554d4b7-9bac-440a-b46e-86bbd68c00a7
2
@Override public void execute() { final NPC bearSeller = NPCs.getNearest(Constants.BEAR_FUR_SELLER); if (bearSeller != null) { if (!bearSeller.isOnScreen()) { MCamera.turnTo(bearSeller, 50); } else { bearSeller.interact("Talk-to"); } } }
f0bdde31-6e89-48f5-8200-d8b723592765
8
protected void showMainScreen(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, UnsupportedEncodingException { // set the encoding, otherwise database is encoded wrongly request.setCharacterEncoding("UTF-8"); HttpSession session = request.getSession(); AdminU...
842fc2b9-f954-4c0f-9840-191a9cf40983
5
public void projectileDie() { for (int i = 0; i < projectiles.size(); i++) { if (projectiles.get(i).x < 0 || projectiles.get(i).y < 0 || projectiles.get(i).x > 1260 || projectiles.get(i).y > 920) { projectiles.remove(i); } } }
c8e06f75-17dd-4fae-a90f-5e3d624d5bee
9
private static int[] merge(int[] left, int[] right) { int[] merged = new int[left.length+right.length]; int leftHead =0; int rightHead = 0; for(int i=0; i<left.length+right.length; i++) { if(rightHead < right.length && leftHead<left.length && left[leftHead]<right[rightHead]) { ...
fe810de1-7ec9-46df-afd2-07d469a65f49
9
final private boolean jj_3R_19() { Token xsp; xsp = jj_scanpos; if (jj_3R_33()) { jj_scanpos = xsp; if (jj_3R_34()) { jj_scanpos = xsp; if (jj_3R_35()) { jj_scanpos = xsp; if (jj_3R_36()) { jj_scanpos = xsp; if (jj_3R_37()) { jj_scanpos = xsp; if (jj_3R_38()) { jj...
aea4d1a0-c371-42fa-9013-81aec1cc2048
9
public void onEnable(){ blacklistLocation=new File(getDataFolder().getAbsolutePath()+"/words.txt"); whitelistLocation=new File(getDataFolder().getAbsolutePath()+"/whitelist.txt"); userdataLocation=new File(getDataFolder().getAbsolutePath()+"/userData.yml"); initConfig(); initUserData(); copyWordList(); co...
8907960f-bac4-409e-98f3-7c7b55f2b4ff
6
private Automaton readAutomaton(File file) { try { BufferedReader reader = new BufferedReader(new FileReader(file)); // Read the automaton type. String line = reader.readLine().trim(); if (line.equals(FINITE_AUTOMATON_CODE)) return readFA(reader); if (line.equals(PUSHDOWN_AUTOMATON_CODE)) retur...
69940bdf-c108-421f-9e95-914f7c3361c9
6
private Assertion assertAreEqual(Stack<Command> expected, Stack<Command> actual) { boolean passed = false; String info = "Assertion failed for unknown reasons"; if (expected != null && actual != null) { if (expected.size() != actual.size()) { passed = false; info = "The act...
bcf2ff32-6a9a-464b-9bd3-fe558eefb2a9
6
static String HardwareLiteral (String toParse, String label, byte wordLength) { byte decimalValue = 0; byte labelLength; byte significance; String binary32; StringBuffer expression; labelLength = (byte)label.length(); if (toParse.startsWith(label)) { try { decimalValue = Byte.parseByte(...
c5f04db8-4de0-4654-9ec8-a873e48162a3
4
public Location getLocationAtDirection(Direction direction) { switch (direction) { case UP: return new Location(column, row - 1); case DOWN: return new Location(column, row + 1); case LEFT: return new Location(column - 1, row); ...
ca44b6cf-45f8-491a-bc4b-2f5b85267c89
5
static private int jjMoveStringLiteralDfa7_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(5, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(6, active0); return 7; } switch(curChar) { cas...
8e6ffce1-26b6-48d8-8605-3be00df65c7d
6
private void removeOld() throws FileStorageException { final FileSystemService fileSystemService = new FileSystemService(); final Properties expirationDates = systemInformation.getExpirationDates(); final Set<String> keys = expirationDates.stringPropertyNames(); for (String key : keys) {...
6297e891-21c9-4766-be36-3d50c340bf9a
1
private String createDelete() { String param = ""; for(Column col : keyColumns){ param += col.getColName() + " = #{" + col.getFldName() + "} AND "; } param = param.substring( 0, param.length() - 5 ); StringBuilder sb = new StringBuilder(); sb.append( "\...
e14a6a9c-d686-4dc3-9bd5-9a1c443634ff
8
public static void handleEvent(int eventId) { // Do nothing because same screen is being selected if(eventId == 1) { System.out.println("Exit Ship Shop Thrusters to Main Ship Shop Menu selected"); Main.ShipShopThrustersMenu.setVisible(false); Main.ShipShopThrustersMenu.setEnabled(false); Main.ShipSho...
52d7f9fb-806f-4b56-ac0a-0787314fe8f5
5
public String getColors(){ String output = ""; if(white){ output += "W"; } if(blue){ output += "U"; } if(black){ output += "B"; } if(red){ output += "R"; } if(green){ output += "G"; } return output; }
2ded0a87-5065-4082-a894-a6a99e39f562
6
private void checkBrowserLoading() { // браузер терминала if (( (new File("/usr/local/bin/chrome_ps.sh").exists()) && this.getRuntime("/usr/local/bin/chrome_ps.sh").equals("0"))) { this.doRuntime("sh "+ terminalDir+"/browser.sh"); this.ok = false; } // б...
c879d483-918b-4803-b98a-5f77d7a6368a
7
public void paintLists() { for (int i = 0; i < spaceJunk.size(); i++) { SpaceJunk a = spaceJunk.get(i); if (distanceToShip((int) a.xPosition, (int) a.yPosition) < Game.RESOLUTION_WIDTH) { a.paint(offg, cameraOffsetX, cameraOffsetY); } ...
c94c5680-64c9-445e-8eaf-d1135de8d965
0
public int getStatus() { return status; }
0c64cf04-72e5-495f-81d5-77e4d5dc7c70
0
protected boolean step() { controller.step(); return true; }
2646890e-40cb-43b5-9b43-5a5950286c86
6
Byte getToken( char tokenChar ) { switch ( tokenChar ) { case 'l': lineCount++; endLf = true; return TKN_ALF; case 'L': return TKN_AL; case 'r': lineCount++; endLf = true; return TKN_ARF; case 'R': return TKN_AR; case 'c': lineCount++; endLf = true; return...
b9c33bc0-fb9f-44ae-9348-4d3b45445930
1
public void setTexture(String texturePath){ this.texturePath = texturePath; try { texture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream(texturePath)); } catch (IOException e) { e.printStackTrace(); } }
aebdc247-7afb-419e-a4b8-b62db6f9093c
2
@Override public void doIt() { // hole Log-Dateien File path = new File(this.path + Output.DIR_LOG); final Pattern pattern = Pattern.compile(".+" + Pattern.quote(LogFile.FILE_EXTENSION) + "$"); File[] list = path.listFiles(new FileFilter() { @Override public boolean accept(File filename) { re...
8f1a7d57-4125-4396-a15e-33e2a202f0e8
2
public static Reponse reponse(int id, Utilisateur utilisateur) { Reponse rep = ReponseRepo.get().un(id); if (rep != null && !rep.getSujet().peutConsulter(utilisateur)) throw new InterditException("Vous n'avez pas les droits requis pour consulter cette réponse"); return rep; }
b4afee71-e718-4489-8658-6ec9eccf4915
5
public void generateChoiceKrit(int fahrplanID, String fahrplanName) { boolean szVorhanden = false; if (this.szenarienVerbergen.getOpacity() != 1) { FadeTransition fb = new FadeTransition(Duration.millis(1500), this.szenarienVerbergen); fb.setFromValue(0.0); fb.setToValue(1.0); fb.setAutoReverse(t...
5b997c1b-70f7-4f67-9e16-fe8aef117fae
0
public String getPassword() { return password; }
5a26964b-40ca-4709-9c0e-f2a63f28284a
2
public static LinkedList<String> computeIntersection(LinkedList<String> A, LinkedList<String> B) { LinkedList<String> intersection = new LinkedList<String>(); for( int i = 0; i <A.size(); i++) { String item = A.get(i); if(B.contains(item)) { int...
cf9c44bd-88c9-417f-9039-bc7872be38ab
4
public void recalculate(String IPkey, String IPComing, ArrayList<String> comingConnections){ ArrayList<String[]> tempArray = (ArrayList<String[]>)routingTable.get(IPkey); String[] tempStringArray = null; for(int i=0; i<tempArray.size(); i++){ tempStringArray = tempArray.get(i); ...
5b4351e8-19ba-4577-b2bb-55bd675a4b25
3
private void saveLinks(ArrayList<Link> linkMap) throws ForceErrorException { int iCounter = 0; for (Link link : linkMap) { if (iCounter > Bot.linksFromUrl) { break; } if (Bot.datamodel.saveLink(link.getUrl())) { iCounter++; } } }
dc2e6290-67fa-4e02-acfd-573a80e16eb9
3
public static void main(String[] args) throws InterruptedException { List<FutureTask<Integer>> list = new ArrayList<FutureTask<Integer>>( Arrays.asList(new FutureTask<Integer>(new WordLengthCallable()), new FutureTask<Integer>(new WordLengthCallable()), new Future...
f2a6a6e5-9136-4764-9707-d5d32591704b
3
public static void detectPressedKey(){ int[] keys = {Keyboard.KEY_1, Keyboard.KEY_2, Keyboard.KEY_3,Keyboard.KEY_4,Keyboard.KEY_5,Keyboard.KEY_6,Keyboard.KEY_7,Keyboard.KEY_8,Keyboard.KEY_9}; boolean found = false; for(int i = 0; i < keys.length; i++){ if(Keyboard.isKeyDown(keys[i])){ selectedSlo...
2b284d8f-6ec4-4468-8204-ef1ebd21a487
8
private void grow(int extra, int[] values, int[] max, boolean fill) { int count = 1 + (values.length - 1) / 2; int[] tv = new int[count]; int[] tm = new int[count]; for (int i = 0; i < count; i++) { tv[i] = values[i * 2]; tm[i] = max[i * 2]; } extra = distribute(extra, tv, tm); for (int i = 0; i < c...
af23d8ac-dd65-43a4-b8a1-5336dce382d7
1
@Override public void removeInheritence(String inher) { do { inheritence.remove(inher); } while (inheritence.contains(inher)); }
10885a30-5778-47f0-9d95-044c3e0b65f7
3
@Override public void init(boolean isServer) { if(!isServer) { PlayerEntity.loadResources(); PillarEntity.loadResources(); } tiles = new Tile[8][6]; for(int x = 0; x < tiles.length; x++) for(int y = 0; y < tiles[x].length; y++) tiles[x][y] = new Tile(this, x, y); entities = new ArrayList<Entit...
bf75f6ad-463d-4cf8-92b4-23aa5b3329f4
3
public static <T extends IComponent> void getAllChildrenTComponents(Entity entity, Class<T> clazz, List<T> componentList) { Children childrenComponent = entity.getComponent(Children.class); // Our base test, stop recursion if we no longer have children if (childrenComponent == null) { return; } for (Enti...
779253d5-ddf0-49d0-853a-c847c6751df4
5
private int puolisonPaikallaToistaSukupuolta(boolean mies) { int pisteita = 0; try { if (paikka.getPuolisonPaikka() != null) { if (paikka.getPuolisonPaikka().getSitsaaja().isMies()) { if (mies == false) { pisteita += 500; ...
82da9ae2-5ef1-4b20-b511-16e04e9ca071
2
public static double getAtomicWeight(Atom currentAtom) { double atomWeight = 0; String atomType = Character.toString(currentAtom.getAtomType() .charAt(0)); String[] atomTypeArray = { "H", "N", "C", "O", "S" }; double[] atomWeightArray = { 1.00794, 14.0067, 12.0107, 15.9994, 32.065 }; for (int i = 0; i <...
b7bf2837-de91-48f1-a4b4-4ae6d28a47a5
1
public Node getViewWithoutRootContainer() { final ObservableList<Node> children = getView().getChildrenUnmodifiable(); if (children.isEmpty()) { return null; } return children.listIterator().next(); }
b9630159-dba1-4940-a75e-2476a2ca2349
7
private final boolean cvc(int i) { if (i < 2 || !cons(i) || cons(i-1) || !cons(i-2)) return false; { int ch = b[i]; if (ch == 'w' || ch == 'x' || ch == 'y') return false; } return true; }
ed9b2ea5-ef92-4f4e-ba0a-f8a210aee63c
5
private void printChessBoard(int rows,int columns, Cell[] boardCells){ String errorMsg; for(int currentRow = 0; currentRow < rows; currentRow++){ for(int currentColumn = 0; currentColumn < columns; currentColumn++){ int position = currentRow...
de37cba1-62cf-48e1-9f4a-748a7f3e2b4d
6
private void ParseElements(Node parentElement) { Node child = parentElement.getFirstChild(); while (child != null) { String nodeName = child.getNodeName(); if (nodeName == "condition") { conditions.add(new Condition(child)); } else if (nodeName == "print") { message = child.getFirstChild().g...
03085444-e8b9-4e75-ad47-73953073ea5b
1
public boolean canHaveAsBalance(BigInteger balance) { return (balance != null) && (balance.compareTo(this.getCreditLimit()) >= 0); }
eca7eb14-a019-4c01-be90-e5f11beb0869
1
public T borrow() { initPool(); T object = queue.poll(); if (object == null) { object = create(); } return object; }
5591b493-cd22-40aa-a151-e5328f110262
0
@Override public void fatalError(SAXParseException e) { System.out.println("SAXParserException Fatal Error: " + e.getMessage()); this.errorOccurred = true; }
08a0b3eb-5047-4045-9eac-76aec73dfab5
1
public void kasitteleLauseke() throws IllegalStateException, IllegalArgumentException { while (paikkaSisaltyySyotteeseen()) { kasitteleSeuraava(); } lauseke.suljeLohko(); }
f977e44e-74f0-42d3-a0d6-a23b15c04765
7
public ArrayList<ArrayList<Integer>> combine(int n, int k) { ArrayList<ArrayList<Integer>> rst = new ArrayList<ArrayList<Integer>>(); int[] tmp = new int[k]; for (int i =0; i< k ;i++) tmp[i] = i + 1; while (true) { ArrayList<Integer> ele = new ArrayList<Integer>(); for (int i : tmp)...
4ba4051e-e22f-406a-a317-2301e10253c5
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(target,null,null,L("<S-NAME> <S-IS-...
c4bead0b-abc6-4429-be0e-631da42c6301
2
public synchronized void recordAndAddSequenceNumberToOutgoingPacket(Packet packet) { //ignore null packets if(packet == null) return; //add sequence number to packet lastSentPacketSequenceNumber = Packet.nextSequenceNumber(lastSentPacketSequenceNumber); packet.setSequenceNumber(lastSentPacketSequenceNumbe...
736b0c01-8362-4883-984c-b1499bfec9b3
3
private static int findMax(boolean useX, ArrayList<Point> convexHull) { int max = 0; int index = -1; for (int i = 0; i < convexHull.size(); i++) { int val = useX ? convexHull.get(i).x : convexHull.get(i).y; if (max < val) { max = val; index = i; } } return index; }
4d93dc0a-5c10-4314-a3d1-0e74d98388cf
0
public Items getItem() { return this.item; }
74ea940b-d958-48f8-aa3d-498b4aa5f432
2
public void combat(Personnage heros, Personnage ennemi) { Random rand = new Random(); int randomDefensePercentage = rand.nextInt(50)+1; int defense = heros.getDef() - (heros.getDef()*randomDefensePercentage)/100; int degats = ennemi.getAtk(); int dommage = degats-defense; if(dommage>0) { heros.setV...
5952fc8c-c07d-42df-af88-d97575be832c
1
public static void printByteArray(byte[] bytes) { for (byte b : bytes) { System.out.print(Integer.toBinaryString(b & 255 | 256).substring(1) + " "); } System.out.println(); }
0c0579cd-0eb9-4f20-9b5b-bf8bbcff697c
2
public Transition getTransitionForProduction(Production production) { ProductionChecker pc = new ProductionChecker(); String lhs = production.getLHS(); State from = getStateForVariable(lhs); /** if of the form A->xB */ if (ProductionChecker.isRightLinearProductionWithVariable(production)) { String[] varia...
1f5d7aec-3a7d-4aaf-9918-ad7c1a1a2739
9
public void checkfold() { for (Widget wdg = child; wdg != null; wdg = wdg.next) { if ((wdg == cbtn) || (wdg == fbtn)) continue; if (folded) { if (wdg.visible) { wdg.hide(); wfolded.add(wdg); } ...
ceac8dfe-1b9c-4ec7-be93-1a1f5c84f2dc
7
public void run() { while(listening) { try { // listen on request as server // byte[] bufReceived = new byte[BUFFER_SIZE]; DatagramPacket serverPacket = new DatagramPacket(bufReceived, bufReceived.length); serverSocket.receive(serverPac...
36676965-b0d0-4e8e-99a3-dcfc31dac796
6
@Override public void paintShape(mxGraphics2DCanvas canvas, String text, mxCellState state, Map<String, Object> style) { mxLightweightLabel textRenderer = mxLightweightLabel .getSharedInstance(); CellRendererPane rendererPane = canvas.getRendererPane(); Rectangle rect = state.getLabelBounds().getRectangl...