method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
33679a81-1d25-4862-9156-53905d3be292
7
public void render(Level level, ScreenEngine2D screen, int y0, int y1, int x0, int x1) { for (int y = y0; y < y1; y++) { for (int x = x0; x < x1; x++) { if(type.equals(LayerType.DEFAULT_LAYER)) { level.getTileLayer(this,x,y).render(x, y, screen, this); } else if(type.equals(LayerType.COLLISION_LAYER))...
fbc77f63-2604-477e-a918-712ed1eaf445
8
public static void main(String[] args) throws Exception { loadAll(); String source = "EidanSp/dota"; boolean findTopics = true; long curTime = System.currentTimeMillis(); long refreshRate = 300000; // 300k ms is 5 minutes DotaBot bot = new DotaBot(); connect(bot); //TwitterClient client = new...
df2f5efc-2acd-49da-9dcf-2f1657811dc7
4
private RGB[][] getBlockFromRef(int x, int y) { RGB[][] t = new RGB[16][16]; for(int i = 0; i < 16; i++) for(int j = 0; j < 16; j++) t[i][j] = new RGB(0,0,0); for(int yy = 0; yy < 16; yy++) { for(int xx = 0; xx < 16; xx++) { int[] rgb = new int[3]; rfr.getPixel(x+xx, y+yy, rgb); t[x...
f47641e0-9d16-4b85-95cd-f0b396ae4f6a
0
public FeatureCollection add(Feature feature) { features.add(feature); return this; }
71ae603b-d0cf-43b4-9269-ddc86c274386
7
private boolean clickInteractiveObject(int hash, int y, int x) { int objectId = hash >> 14 & 0x7fff; int config = worldController.getConfig(hash, x, y, plane); if (config == -1) return false; int type = config & 0x1f; int rotation = config >> 6 & 3; if (type == 10 || type == 11 || type == 22) { GameOb...
419fedf7-023d-4ea8-b115-95e04f7fac84
9
boolean handleOldJvm10Event(Event e) { int x = e.x, y = e.y, modifiers = e.modifiers; long time = e.when; modifiers = applyLeftMouse(modifiers); switch (e.id) { case Event.MOUSE_DOWN: xWhenPressed = x; yWhenPressed = y; modifiersWhenPressed10 = modifiers; mousePressed(time, x, y, modifie...
9efe1479-f6e1-4294-8570-3af0e49602c2
1
public boolean equals(Object object) { try { ProductionComparator c = (ProductionComparator) object; return c.start.equals(start); } catch (ClassCastException e) { return false; } }
ec052365-10b5-4daa-8ced-782feebacebc
8
public void setQuality(Fleet fleet) { for (int x = 0; x < size; x++) { for (int y = 0; y < size; y++) { if (!board[x][y].isHit()) { int quality = 0; int horLeft = countNoHitFields(x, y, Directions.LEFT); int horRight = countNoHitFields(x, y, Directions.RIGHT); int verDown = countNoHitFields...
92527843-ec97-412b-b5a5-a5a1a40fd5ea
5
public static StraightPathOptions swigToEnum(int swigValue) { if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) { return swigValues[swigValue]; } for (int i = 0; i < swigValues.length; i++) { if (swigValues[i].swigValue =...
0c999942-9aab-4900-9c03-281e9038182b
7
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Row)) return false; Row row = (Row) o; if (employeeID != row.employeeID) return false; if (department != null ? !department.equals(row.department) : row.depart...
8173487b-e381-4536-8386-1c49be8ecef3
8
private static void roberts() { ImageData imageData = original.getImageData(); int[][] ttt = new int[3][3]; ttt[0][0] = 0; ttt[0][1] = -1; ttt[0][2] = 0; ttt[1][0] = -1; ttt[1][1] = 0; ttt[1][2] = 1; ttt[2][0] = 0; ttt[2][1] = 1; ttt[2][2] = 0; int[][] sobelV = new int[3][3]; sobel...
f97927bd-0bd0-4417-8c88-fd1f338bd99c
3
public boolean run(){ serverSocket = null; logger.logMessage("Starting Server..."); while(true){ try { serverSocket = new ServerSocket(port); } catch (IOException e) { logger.logMessage(Level.SEVERE,"Could not listen on port: " + port,e); System.exit(-1); } logger.logMes...
b7c9ce7e-9e67-452e-93b5-57e5bcab86f5
7
public Resource getNearestResource(Tile tile, Dude dude) { int x = tile.getX(); int y = tile.getY(); int bestSquaredDistance = Integer.MAX_VALUE; Resource bestResource = null; for (Resource r : resources) { if (!dude.canMine(r)) continue; Tile restile = getTile(r.getX(), r.getY()); if (restile....
b63422b5-3ce4-41ce-bf38-37839b6c0a1f
0
public Node(int value) { this.value = value; this.nodeCnt=1; }
2180cda7-104b-4d7a-96ac-a6d4c1608e4a
4
@SuppressWarnings("CallToThreadDumpStack") private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed if(emp != null && !emp.isVisible()){ lPane.remove(emp); emp = null; } if (emp == null) { emp = new Fr...
dad19726-ddb3-4bf7-9d38-6aa989467bff
2
@Override public void setConnectionValues(GoogleDocs googleDocs, ConnectionValues values) { MetadataEntry entry = null; try { entry = this.getUserMetadata(googleDocs); } catch (ServiceException error) { throw new ApiException(ServiceExcepti...
d4cd781e-da2f-467c-812e-18f92975b16e
6
private void drawEast(Terrain[][] currentBoard, Entities[][] currentObjects, Graphics g) { //Starts getting a little trickier here. You have to flip the j and i for x, y, while //j corresponds to the inverse position in the arrays! *Whew* So much math! Location playerDir = boardState.getPlayerCoords(); for (...
bc1fab74-ae24-4fcb-8144-e546d747c0ed
2
public boolean equals(Object object) { if (object instanceof Guid && this.guid.equals(((Guid) object).guid)) { return true; } else return false; }
19486db4-ea30-4d4b-a5ba-9729e44edd66
1
public double[] nextDoubleArray() throws Exception { String[] line = reader.readLine().trim().split(" "); double[] out = new double[line.length]; for (int i = 0; i < line.length; i++) { out[i] = Double.valueOf(line[i]); } return out; }
fd332eb4-6380-4fcd-8f24-f6678105efe5
6
@Override public void run() { while(true){ try { // Create input and output streams for this client. ObjectInputStream is = new ObjectInputStream(clientSocket.getInputStream()); while (true) { ...
291fcbfe-145b-4b1f-bbbc-b0a3b567aaa6
4
public double[] run(double[] pixels) { for (int i = 0; i < pixels.length; i++) { input[i].setOutput(pixels[i]); } for (SigmoidNeuron neuron : hidden) { neuron.update(); } for (SigmoidNeuron neuron : output) { neuron.update(); } double[] results = new double[output.length]; for (int i = 0; i < o...
e1d6dc21-6c36-429f-96ce-61f0b59466a9
0
public String GenerateMsgID(){ return this.Emsnum+DateUtil.GetTimeString() + getFourNum(); }
982744bf-a3f0-43f0-8ac1-fd41b7fae813
4
final public int compareTo(Object rhs) { int rtn; TaFuncSignature that = (TaFuncSignature) rhs; if ((rtn = name.compareTo(that.name)) != 0) { return rtn; } else { if (inVarTypes.length != that.inVarTypes.length) { return inVarTypes.length - t...
928d61e3-907e-43b0-a469-284f0114a48a
1
public void onScannedRobot(ScannedRobotEvent event) { // If we currently have no target, target the scanned robot if (Observer.TARGET == null) { Observer.TARGET = event.getName(); } }
e203db51-03ad-4a51-a904-d3721a12093d
9
public static boolean esSolucionable(int[] estado){ int sum = 0; int[] posiciones = new int[16]; for (int i = 0; i < estado.length; i++) if (estado[i] != 0) posiciones[(estado[i]) - 1] = i + 1; else posiciones[15] = i + 1; for (int i = 0; i < estado.length; i++) { if (estado[i] == 0) if (((i/4) +...
58b5038c-e9ec-40e6-8f76-0ee158d601e4
7
@Override public Iterator<Map.Entry<byte[], byte[]>> iterator(){ return new Iterator<Map.Entry<byte[],byte[]>>() { BucketView nextBucket = new BucketView(0), prevBucket = null; int nextIdx = 0, nextSubIdx = -1, prevSubIdx = -1; { advance(); } private void advance(){ prevSubIdx = ...
76694470-95e8-4710-a08f-1e76b732a37e
1
@Override public int hashCode() { int hash = 3; hash = 97 * hash + (this.number != null ? this.number.hashCode() : 0); return hash; }
88c87e39-7007-4c6a-8e61-38a4c2678b1e
4
public static Player playerMatch(String name) { Player[] online = iConomy.getBukkitServer().getOnlinePlayers(); Player lastPlayer = null; for (Player player : online) { String playerName = player.getName(); if (playerName.equalsIgnoreCase(name)) { lastPlayer = player; break; ...
9682d88c-16e0-4880-84ff-dde425a30a08
0
public Set<String> getPermissions() { return this.permissions; }
1c8f8904-926d-4c04-9913-7d0853931cec
5
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (args.length != 1) { return false; } GameSession session = plugin.getGameManager().getGameSession(args[0]); if (session == null) { sender.sendMessage(plugin.getBroadcaster().styleMessage( "...
4bada189-7029-4a06-8382-6118f2760eb8
4
public Usuario logar(Usuario usuario) { try { for (Usuario user : usuarioDao.listarTodosUsuarios()) { if (usuario.getUsername().toUpperCase().equals(user.getUsername().toUpperCase()) && usuario.getSenha().equals(user.getSenha())) { return user; } } } catch (ValidationException e) { thro...
88fe0c98-07dd-4bb3-8e68-35562c3e3e67
7
public Board(List<Player> players){ //Add warps. study.setWarp(new int[]{0,3}, kitchen); kitchen.setWarp(new int[]{18,23}, study); conservatory.setWarp(new int[]{1,19}, lounge); lounge.setWarp(new int[]{23,5}, conservatory); //Each room is composed of rectangles declared above. Add each square in each rec...
bcb5cf37-0382-4a21-88da-8147c0d31ad7
0
public static void main(String[] args) { MycomplexLayout mycomplexLayout = new MycomplexLayout(); mycomplexLayout.go(); }
ffda2826-4552-4d41-a122-b06c115e0b64
8
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { UserManager UM = new UserManager(ds); String path = req.getRequestURI(); String[] pathComponents = path.split("/"); ArrayList<UserDetails> userList = new ArrayList<UserDetails>(); boolean querySucce...
c2ae563d-fbae-473b-aff7-ab6a94a9a012
5
public void loadXML(Node stepnode, List<DatabaseMeta> databases, Map<String, Counter> counters) throws KettleXMLException { try { inputField = XMLHandler.getTagValue(stepnode, "INPUT_FIELD"); Node classpathNode = XMLHandler.getSubNode(stepnode, "CLASSPATH"); if (classpathNode != null) { int nrfields...
c6d1a6ee-dc6e-4884-83c6-c96c92aa5677
7
private void resizeText() { value.setFont(Font.font("Open Sans", FontWeight.BOLD, size * 0.145)); if (value.getLayoutBounds().getWidth() > 0.38 * size) { double decrement = 0d; while (value.getLayoutBounds().getWidth() > 0.38 * size && value.getFont().getSize() > 0) { ...
bb70632a-90eb-4966-be87-aaf350cf8da7
4
private void storeStats() /* * The statistics: - the summed periods for all the iterations in this * interval (period is the amount of time a single frame iteration should * take), the actual elapsed time in this interval, the error between these * two numbers; * * - the total frame count, which is the to...
94d45db7-3212-48d5-94e7-dbb90ec89110
4
public void loadList(String fileName) { String line; BufferedReader inFile = null; HiddenMarkovModel hmm=new HiddenMarkovModel(myModel); try { InputStream in = new FileInputStream(fileName); InputStreamReader reader = new InputStreamReader(in, "UTF-8"); inFile = new BufferedRea...
17724740-4153-4dda-8092-6a8b951915cc
7
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Funcionario other = (Funcionario) obj; if (!Objects.equals(this.Expedientenome, other.Expedientenome)) { ...
d6713147-bae0-44a1-b90b-f110b6004783
9
public static void main(String[] args) { Bakery bakeryCtrl = new Bakery(Inventory.emptyInventory(), CustomerRoll.emptyRoll(), OrderList.emptyOrder()); /********************************************************************** * Gather user input to load the Scanners for inventory/cust...
ce031674-57ec-4c57-86ad-64d1c0e9afb5
4
@Override public byte[] convert() { ByteBuffer inBuf = ByteBuffer.wrap(data); inBuf.order(ByteOrder.BIG_ENDIAN); inBuf.clear(); ByteBuffer dataBuf = ByteBuffer.allocate(data.length * 2); dataBuf.order(ByteOrder.BIG_ENDIAN); dataBuf.clear(); while (inBuf.hasR...
2c3b6db2-c875-4306-8568-fe0dfac98744
9
public int getRowCount() { boolean isSummary = getUnitData().isSummary(); int rows = 0; if (workingProfessionals.getColonists() > 0) rows++; if (workingAmateurs > 0) rows++; if (!isSummary && otherWorkingAmateurs.getColonists() > 0) rows++; if (te...
7a8fa1fd-49dd-41d8-acfd-3e6d6b076304
0
public void put(String key, Object value) { symbols.put(key, new Binder(value, top, symbols.get(key))); top = key; }
8a93e73c-e8df-4458-8f86-0413058f56c2
9
public void anst(double AusgWert){ String zahl=String.valueOf(AusgWert)+" "; if (zahl.contains("-")&&zahl.contains(".")) zahl=zahl.substring(0,10); else if (zahl.contains("-")||zahl.contains(".")) zahl=zahl.substring(0,9); else zahl=zahl.substring(0,8); System.out.println(zahl); seg....
734921ee-7771-45c3-8ff8-b2ec47bc225f
4
private void printFinalPath(){ System.out.println(); int [][] tempMap = new int [25][50]; for (int i = 0; i < path.size(); i++){ Node temp = path.get (i); tempMap[temp.getY()][temp.getX()] = temp.getStartCost(); } tempMap[endY][endX] = -1; ...
8f0b3854-e587-4056-aeb9-e5d6ea4b70dc
1
public void addRelic(Relic relic) { if (!getRelics().contains(relic)) { getRelics().add(relic); } }
407c8802-119c-4582-bd6d-a3681efe1b4f
0
public boolean isCellEditable(int row, int column) { return false; }
0be1f7d4-545e-430c-831a-6fee3bf3eead
7
public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader( new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int tc = 1; for (String line ; (line = in.readLine()) != null ; tc++) { StringTokenizer st = new StringTokenizer(line); int A = Integ...
b9dce49f-b12d-46e2-a4b5-067d2260a4ec
3
public void cleanUpForQuit() { Signlink.reporterror = false; try { if (socketStream != null) { socketStream.close(); } } catch (Exception exception) { } socketStream = null; stopMidi(); if (mouseRecorder != null) { ...
06e34710-3fd5-4005-abdf-4d820ccc32b9
4
public void run() { //deserialize data and check the validity of message DHTMessage received = null; try { received = deserialize(packet.getData()); } catch(IOException ioe) { System.err.println("Error in data deserialization"); return; } catch(ClassNotFoundException cnfe) { System.err....
0b5313b7-6e57-4c91-af79-55a917fae89c
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...
6c2a588d-9579-4187-a909-721ddcf27986
4
public static int parsePositiveInt(String str) { if (str == null || (str = str.trim()).length() == 0) { return 0; } int result; try { result = Integer.parseInt(str); } catch (NumberFormatException ex) { return 0; } return (resu...
ac3cc4f2-8972-4f65-b15c-4b6a945eea2a
4
public String processInputDisconnect() throws IOException { InputStreamReader isr=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(isr); String inputLine = br.readLine(); String[] part = inputLine.split(" "); switch(Integer.decode(part[0])) { case 1: return loginBis(); ...
c2cf8bd7-55df-4338-8a9d-0a7521cac270
0
@Override public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) { calculateEnabledState((OutlinerDocument) e.getDocument()); }
d0aead17-3540-4ec7-a644-bebe74aea454
3
private void actionPlay( ) { DefaultMutableTreeNode selNd = getSelectedNode(); if ( selNd != null ) { int[] selIdxs = getNodeIndexList(selNd); if ( selIdxs.length == 2 ) { try { Clip clip = AudioSystem.getClip(); clip.open( AudioVector.toAudioInputStream( audioVectors.get(selIdxs[0])...
afa9b106-d9c8-40b6-85eb-dc85a2c4a7f9
3
@Override public void execute(P plugin, CommandHandler<P> handler, CommandSender sender, String label, String[] parameters) { int page = 1; if (parameters.length == 1) { String input = parameters[0]; try { page = Integer.parseInt(input); } catch (NumberFormatException exception) { plugin.d...
9679ebcf-dc89-4678-a09a-0abc4a63bc3a
7
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } NameData nd = (NameData) obj; boolean ...
2c1339ed-f698-444c-b4fc-148935ec3bab
1
@Override public void updatePhysics() { super.updatePhysics(); clock++; if(clock%(2*30) == 0) { vx = - vx; updateStateBasedOnVelocity(); } }
b384ed12-597a-471f-af29-ee2813e6ec18
5
public void bounce(Direction d) { if (d == null) return; switch (d) { case UP: v_y = Math.abs(v_y); break; case DOWN: v_y = -Math.abs(v_y); break; case LEFT: v_x = Math.abs(v_x); break; case RIGHT: v_x = -Math.abs(v_x); break; } }
9072b7f3-a731-444d-be00-e7b93d983ec6
1
public Iterator<Integer> calculateLosingScores(int numberOfTurns){ int numberOfScores = (numberOfTurns%2==0)? ((numberOfTurns/2)-1):(numberOfTurns/2); ArrayList<Integer> scores = new ArrayList<Integer>(); int multiplier = -1; return scores.iterator(); }
7d245041-4955-47c3-b04a-5a745e84dcac
9
public static UnitValue[] parseInsets(String s, boolean acceptPanel) { if (s.length() == 0 || s.equals("dialog") || s.equals("panel")) { if (acceptPanel == false) { throw new IllegalAccessError("Insets now allowed: " + s + "\n"); } boolean isPanel = s.startsWi...
6378fe2e-d178-4223-9cd3-9ff98820ac0f
6
private void drawCoordinateStroke(int x0, int y0, int x1, int y1) { for(int x = x0; x <= x1; x++) { for(int y = y0; y <= y1; y++) { if(x < width && x > 0 && y < height && y > 0) { image.setRGB(x, y, Color.black.getRGB()); ...
f2fdb28b-bd9e-422c-a212-63143f4d4e57
0
@Test public void test_DivisionByZero() throws DivideByZeroException { exception.expect(DivideByZeroException.class); simpleObject.divide(1,0); }
3d755ec4-25e8-4693-8840-c2c91feff04f
2
private static PixImage buffer2PixImage(BufferedImage bImage) { PixImage pImage = new PixImage(bImage.getWidth(), bImage.getHeight()); for (int x = 0; x < bImage.getWidth(); x++) { for (int y = 0; y < bImage.getHeight(); y++) { Color color = new Color(bImage.getRGB(x, y)); pImage.setPixel(x, y, (short) c...
26202fae-d892-4a46-9acf-d95f5435e051
0
@Override public void startSetup(Attributes atts) { super.startSetup(atts); TEXT = atts.getValue(A_TEXT); setEnabled(false); addActionListener(this); Outliner.documents.addUndoQueueListener(this); Outliner.documents.addDocumentRepositoryListener(this); }
beb2b9a3-884d-4f5a-af06-d9d3a131573c
2
public static LogoDocument fromFile(File file) throws IOException{ BufferedReader reader = new BufferedReader(new FileReader(file)); LogoDocument document = new LogoDocument(); for (String line = reader.readLine(); line != null;line = reader.readLine()){ try { document.insertString(document.getLength(...
95c3ac65-41b3-4c3d-b00b-3d2525d2c9c6
2
@Override protected void buildActions() { super.buildActions(); btnAddNew.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { clickSaveButton(); setPanelPerson(null, true); } }); btnGenID.addActionListener(new ActionListener() { @Overr...
62081248-d274-43e4-8b95-f0575db54302
3
private static void addStudentToTable() { String lName = new String(); String fName = new String(); lName = JOptionPane .showInputDialog("Please enter the last name of the student to add."); fName = JOptionPane.showInputDialog("Now enter his/her first name."); int indexOfStu = studentExists(lName, fName...
23bb744c-251e-4cee-ae59-cbae7158f8c8
6
private void setupParser () { // catch an illegal "nonsense" state. if (!prefixes && !namespaces) throw new IllegalStateException (); nsSupport.reset(); if (uris) nsSupport.setNamespaceDeclUris (true); if (entityResolver != null) { parser.setEntityResolver(entityResolver); } if (dtdHandler !...
9008488d-8ceb-4503-bbe3-07eb3a527dd7
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...
2b77f58f-d654-4593-aa70-1690e9c13758
6
public static String hits2str(ScoreDoc[] hits1, ScoreDoc[] hits2, int start, int end) throws IOException { StringBuilder sb = new StringBuilder(); int len1=hits1==null ? 0 : hits1.length; int len2=hits2==null ? 0 : hits2.length; if (end<=0) { end = Math.max(len1,len2); } sb.append("Hits...
f8916c33-f2a1-40a0-ae5e-a4f03950e7ce
9
final boolean method784(byte b, Interface17 interface17) { if (b <= 75) { aByteArray1057 = null; } anInt1073++; int i; if ((anInt1091 ^ 0xffffffff) == 0) { if (anInt1069 == -1) { return true; } i = interface17.method64(anInt1069, (byte) -42); } else { i = interface17.method65(anInt1091, -...
1393de29-547e-4927-b0d7-f1d070e17c00
0
@Override public String toString(){ return "Hero : " + hero.toString() + "\n"+ "Weapon : " + weaponSlot.toString() + "\n"+ "head armor : " + headArmorSlot.toString() + "\n" + "Body armor : " + bodyArmorSlot.toString() + "\n"; }
f94a6733-c915-4d67-abe4-5f4fdae45961
0
public BreadthFirstSearch(Graph graph) { this.graph = graph; this.adjacency = graph.getAdjacencyList(); this.vertices = graph.getVertices(); this.edges = graph.getEdges(); }
97f2d176-09a5-46d2-ac08-0f6f9e6732ab
3
protected void invalidate() { for(ComponentListener cl: componentListeners) cl.onComponentInvalidated(this); if(parent != null && parent instanceof AbstractContainer) { ((AbstractContainer)parent).invalidate(); } }
313a683a-cf38-4dd6-be85-02b0db7ccb22
5
private static int partition(int[] arr, int left, int right) { int pivot = arr[left]; while(left < right) { while(left < right && arr[right] >= pivot) right --; swap(arr, left, right); while(left < right && arr[left] <= pivot) left ++; swap(arr, left, right); } return right; }
5040e9b0-a12c-4d6c-9c8c-837c16498397
9
private void readLuminance() { int type = sourceImage.getType(); if (type == BufferedImage.TYPE_INT_RGB || type == BufferedImage.TYPE_INT_ARGB) { int[] pixels = (int[]) sourceImage.getData().getDataElements(0, 0, width, height, null); for (int i = 0; i < picsize; i++) { int p = pixels[i]; int r = (p &...
4192eef2-dfae-41db-8430-2f89d833c060
9
public ProposedApproach(File uniFile, File triFile) throws IOException, ProcessException { // Load unigram data. Unigram.Data unigramData = Unigram.read(WordrtPreproc.BINARY, new File[] {uniFile}); idMap = unigramData.unigramIDMap; freqs = unigramData.unigramCount; ...
ef1d53fa-bf7f-4a2a-b40f-b7393c719e54
8
public int func_27297_a(StatCrafting var1, StatCrafting var2) { int var3 = var1.func_25072_b(); int var4 = var2.func_25072_b(); StatBase var5 = null; StatBase var6 = null; if(this.slotStatsBlockGUI.field_27271_e == 2) { var5 = StatList.mineBlockStatArray[var3]; var6 = Sta...
85464cd5-57be-4cb2-aeb3-c41ca93888f9
9
public void events(int xLoc, int yLoc) { boolean auto = false; boolean special = false; if (xLoc == 11 && yLoc == 3) { auto = true; msg = new String[] { "There is something suspicious going on...", "the other bed hasnt been made", "but noone is in it!" }; //special = true; } // if (xLoc == 1 &&...
969a6528-7859-4492-9a49-990f3e781d13
4
private RGBColor parseHexColor(String colorStr) throws JTMXParseException { long value = 0; boolean fail = false; try { value = Long.parseLong(colorStr, 16); } catch (NumberFormatException e) { fail = true; } if (value < 0 || value > 0xFFFFFF) { fail = true; } if (fail) throw new JTMXParseExcep...
224da1c3-fa2d-4dea-8317-8fd48a77d19e
8
public ClassOptionSelectionPanel(Class<?> requiredType, String initialCLIString, String nullString) { // Class<?>[] classesFound = AutoClassDiscovery.findClassesOfType("moa", // requiredType); Class<?>[] classesFound = findSuitableClasses(requiredType); ...
189047a0-54df-4601-a959-5fad66829fde
4
private void addSave(Customer customer){ ArrayList<Customer> customers = new ArrayList<>(); try { FileInputStream fis = new FileInputStream("customerfile"); ObjectInputStream ois = new ObjectInputStream(fis); customers = (ArrayList) ois.readObject(); ...
1ee2cd25-a9f3-43fa-87d1-eda8a727fe25
4
@Override public ServerModel finishTurn(FinishTurnRequest request, CookieParams cookie) { ServerModel serverGameModel = serverModels.get(cookie.getGameID()); int owner=request.getPlayerIndex(); Player player = serverGameModel.getPlayers().get(owner); DevCards newCards=player.getNewDevCards(); DevCards old...
9b355ba7-56a0-4376-bbf8-b021576a51e6
1
@Override public void keyTyped(KeyEvent event) { if (!VALID_INPUTS.contains(event.getKeyChar())) { event.consume(); Toolkit.getDefaultToolkit().beep(); } }
085fd8f8-04b6-426b-93f0-73af15694f51
8
public void setWireframe(Wireframe wireframe){ if(wireframe != null){ this.wireframe = null; nameTextBox.setText(wireframe.getName()); multilineTextEntry.setText(wireframe.getName()); if(wireframe.getTypeOfWireframe().equals("Label")){ sizeLabel....
27aca57d-a8ca-49dc-8bb5-4ae0fc2e35a9
1
public void updateSubTypes() { if (!isVoid()) { subExpressions[0].setType(type); subExpressions[1].setType(Type.tSubType(type)); } }
1b1650b2-cf1c-493d-9495-cceba21f538c
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...
e3adc47f-0764-41ed-bfd7-1284d5999e62
5
@Override public Object getAsObject(FacesContext context, UIComponent component, String value) { if (value == null) { return null; } try { if (value != null && (value.equals("-") || value.equals(""))) { value = "-1"; } Colaborad...
4c5ea973-2f17-48d7-ad9f-37130e43c3ef
7
private int zeroExplore(int startPostion, int depth, int dicrection, int lastFoundPlayer, LongBoard state) { if(depth == 0) { return lastFoundPlayer; } long mask = 1l <<(startPostion + dicrection); if((state.boards[0] & mask) != 0) { if(la...
da61674c-0f0c-470a-a308-8ea4f04a94a9
7
private Object readJSON() throws JSONException { switch (read(3)) { case zipObject: return readObject(); case zipArrayString: return readArray(true); case zipArrayValue: return readArray(false); case zipEmptyObject: return new JSONO...
f7b80207-c252-4e5e-811e-36d7fe482dba
8
public void setInitialPaths(ArrayList<Plane> planes, LocationList[] allPlaneLocs) { //looks for straight-line path to each destination; assumes simultaneous start times for(int i = 0; i < planes.size(); i++) { allPlaneLocs[i] = new LocationList(); double distance = allPlaneLocs[i].flighttime; allPlan...
805fc59d-44fa-40d2-8c0e-cc597777af1b
7
@Override public void actionAuCombat(APersonnage persoPrincipal, APersonnage adversaire) { // Afin d'éviter des combats infinis si le personnage se soigne tout le temps, // fait en sorte que la probabilité que // personnage se soigne est de 2/3, et 1/3 il attaquera à la place Ran...
0a4f1036-9cc0-4299-9aa9-90f215ff15e4
1
public int retrieveId(String mess) { try { JSONObject obj = new JSONObject(mess); return obj.getInt("PacketID"); } catch (JSONException e) { } return 0; }
48b85e49-05e0-43a7-be56-d83c4db9c716
6
public static final boolean Remove(Inventory inventory, ItemStack item) { ItemStack[] stacks = inventory.getContents(); for (int i = 0; i < stacks.length; i++) { ItemStack s = stacks[i]; if (s == null) continue; if (s.getTypeId() == item.getTypeId() ...
78e94351-63c2-4322-b8a7-e3ab941b842b
9
public boolean isMatch(String s, String p) { // Start typing your Java solution below // DO NOT write main() function if (p.length() == 0) return (s.length() == 0); if (p.charAt(0) != '*') if (s.length() > 0 && (p.charAt(0) == '?' || s.charAt(0) == p.charAt(0))) return isMatch(s.substring(1), p....
e165489f-2cab-46be-a6e5-f042bea59114
0
public boolean getScrollableTracksViewportHeight() { return getPreferredSize().height < getParent().getSize().height; }
9c3d14a0-65e2-4e77-9eb9-08b2d3c930e4
5
private void listaDeCamposRegistro() { System.out.println("ENTROU3"); int contadorR = 0; if (tipoDoToken[1].equals(" }")) { for (int i = 0; i < listaDeBlocos.size(); i++) { String nomeRegistroC = listaDeBlocos.get(i).split("~")[1]; System.out.println("...
c1871af4-3d20-4392-9a62-13c275d9227c
7
@EventHandler(priority=EventPriority.HIGH, ignoreCancelled=true) public void onPlace(BlockPlaceEvent event) { if(!event.getBlock().getWorld().getName().equals(p.getWorld())) return; Player player = event.getPlayer(); Location loc = event.getBlock().getLocation(); Chunk c = loc.ge...
d33c5868-c139-40ba-a0a6-197e5494c635
2
public byte[] intEnBytes(int[] intable){ byte[] aRetourner=new byte[intable.length/8]; int curseurInt = 0; byte tmp = 0; for(int curseurOctet = 0;curseurOctet<aRetourner.length;curseurOctet++){ for(int curseurBits=0;curseurBits<8;curseurBits++){ tmp = (byte) (tmp + (byte) (intable[curseurInt]*Mat...