method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f2652e79-2f0c-43b1-bea9-dc87afef1bee
0
public int getRoomNumber() { return roomNumber; }
8b70c52c-c9e6-4c38-9ee2-56392dc6d7ec
9
private static IDataTypeFactory getDataTypeFactoryForConnection(Connection connection) throws SQLException { DatabaseMetaData metaData = connection.getMetaData(); String databaseProductName = metaData.getDatabaseProductName().toLowerCase(); IDataTypeFactory dataTypeFactory = null; if (...
dbd1eb07-bd2d-475e-9cd9-8224f3e33e91
7
public void testEncodedSortability() { Random random = newRandom(); byte[] originalArray1 = new byte[MAX_RANDOM_BINARY_LENGTH]; ByteBuffer originalBuf1 = ByteBuffer.wrap(originalArray1); char[] originalString1 = new char[MAX_RANDOM_BINARY_LENGTH]; CharBuffer originalStringBuf1 = CharBuffer.wrap(orig...
46c790af-ae3b-49c1-8126-051765db0fa0
9
public static String generateHTML(File inputFile, String relativePath) { StringBuilder html = new StringBuilder(); html.append("<HTML>" + "<HEAD><TITLE>" + inputFile.getPath() + "</TITLE><HEAD><BODY>"); html.append("<META charset=\"utf-8\">"); html.append("<h1>" + inputFile.getPath() + "...
a73463e6-3981-400a-910b-988e8f7b653b
0
@Test public void testReadField_default() { Assert.assertEquals( "default", ReflectUtils.readField(new Bean(), "_field2") ); }
3d2d4932-5de0-4956-abf9-e7864bc5a5fb
7
public static void main (String[] args) { System.out.println ("HANTERA TAL"); System.out.println (); // inmatningsverktyg java.util.Scanner in = new java.util.Scanner (System.in); in.useLocale (java.util.Locale.US); // mata in ett antal tal double[] tal = new double[10]; ...
1501a969-87ab-485f-9c1e-cee043c96db7
1
@Override public void show() { // Lazy Instantiation if (!isInitialized()) { initialize(); } super.show(); }
3c87d172-ad0f-49cd-9108-8196a5d200bc
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TabelOutletGroup other = (TabelOutletGroup) obj; if (!Objects.equals(this.groupId, other.groupId)) { ...
8e7e899c-3291-41e5-92f0-ac6b967be1b9
1
public void fillInGenSet(Collection in, Collection gen) { if (gen != null) gen.add(local); super.fillInGenSet(in, gen); }
7b424fc1-131a-4f68-993d-7f1f9a9ca743
1
public void visitTypeInsn(final int opcode, final String type) { buf.setLength(0); buf.append(tab2).append(OPCODES[opcode]).append(' '); appendDescriptor(INTERNAL_NAME, type); buf.append('\n'); text.add(buf.toString()); if (mv != null) { mv.visitTypeInsn(opco...
4353c4fd-3308-4402-b111-80d2ba7c3dc7
5
private boolean checkPassword(Scanner in) throws FileNotFoundException { int incorrectCounter = 0; String getPassword = ""; if(!supportedBank.accountStatus(currentCustomer)) { System.out.println("Sorry this account is locked, " + "please call the bank"); return fals...
5fe2a389-6b11-43ed-812e-e3b5a5cf43f7
4
public String getVersionNumberFromWebPage() { ParserDelegator parserDelegator = new ParserDelegator(); ParserCallback parserCallback = new ParserCallback() { public void handleText(final char[] data, final int pos) {} public void handleStartTag(Tag tag, MutableAttrib...
cb438681-17aa-4275-b2bb-1c9be910746f
2
@Override public Set<String> searchAndPrint(Map<String, ClientData> map) { Set<String> names = map.keySet(); Set<String> onlineNames = Collections.synchronizedSet(new HashSet<String>()); for (String name : names) { if (!map.get(name).isCloseRequest()) { System.out.println(name); onlineNames.add(nam...
1cc9262a-2795-4c05-8e2d-1cbe2e8708b0
8
public void set_Status_value(int s) { lbl_Status_value.setText(String.valueOf(s)); if ((s & 0b00000001) == 1) { lbl_C_value.setText("1"); } else { lbl_C_value.setText("0"); } if ((s & 0b00000010) == 2) { lbl_DC_value.setText("1"); } else { lbl_DC_value.setText("0"); } if ((s & 0b00000100) =...
beb66dea-5f62-4fe7-a155-36d3542dbb12
9
public void Animate() { icon = images[states[number]]; if (number != 0) { return; } if (states[0] == 0) { states[0] = 1; for (int a = 1; a < 10; a++) { states[a] = 0; } } boolean flag = true; for (...
63219331-55ba-44a9-bfb5-ff5cbb0099c0
6
@Override public List<? extends Component> parse(String text) { ArrayList<Component> result = new ArrayList<>(); Pattern patternWord = Pattern.compile(ResourceManager.getInstance().getString(ResourceManager.REGEX_WORD)); Pattern patternPunctuation = Pattern.compile(ResourceManager.getInstanc...
c9996968-cdf1-48e8-a3ed-e1613dee0e6a
5
private void placeTeleporters() { final List<Position> tpPositions = new ArrayList<Position>(); while (getTeleporterCoverage(tpPositions) < COVERAGE) { final Position randomPos = getRandomPosition(); if (grid.validPosition(randomPos) && canHaveAsTeleporter(randomPos) && !tpPositions.contains(randomPos)) ...
9ccb60cf-8e59-407a-8174-ffce0ac2afd7
6
@Override @SuppressWarnings({"unchecked", "rawtypes", "null"}) public void decode(Object bean, CodedInputStream input) throws ConverterException { try { CodedInputStream inputItem = CodedInputStream.newInstance(input .readBytes().toByteArray()); Converter con...
210da114-bc91-44e4-9682-abe3094e3cde
7
protected final void writeByte(int adr, int data) { cycles++; schedule(cycles); // Locking only on fetch byte... // System.out.println("Writing byte at: " + Integer.toString(adr, 16) // + " = " + data); if (adr <= 1) { memory[adr] = data; int p = (memory[0] ^ 0xff) | memory[1]; ...
efb90856-a046-4e5f-8e85-95156a1c60d2
7
public Node<Integer> merge(Node<Integer> head1, Node<Integer> head2) { Node<Integer> head = null; Node<Integer> p = head; Node<Integer> p1 = head1; Node<Integer> p2 = head2; while (p1 != null && p2 != null) { if (p1.data <= p2.data) { if (head == null) { head = p1; p = head; } else { ...
445b7ac0-f913-4b1f-a488-fd4a9b49a229
5
public void createDialogControls(final Shell parent) { final Display display = parent.getDisplay(); // message Label message = new Label(parent, SWT.NONE); message.setText(GraphicsExample.getResourceString("GradientDlgMsg")); GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gridData.hor...
29d607eb-b729-4c73-834b-a555447cd44e
2
private void removeSkinPanel() { for (int i = 0; i < panSkin.getComponentCount(); i++) { Component c = panSkin.getComponent(i); if (c instanceof ModelPreview) { ((ModelPreview) panSkin.getComponent(i)).stop(); } } panSkin.removeAll(); }
ec2517b0-6885-4c37-8bea-fb82f6d96de2
9
public final boolean setParentNode(NodeState new_parent_node, String tag_name){ // nape parent node is null if( new_parent_node == null){ clearParentConnection(); return true; } // tagname is null if( tag_name == null ){ return false; } if( new_parent_node == this ){ /...
b7761aa6-6520-4db7-9da2-e9914136add4
6
private Object unmarshalClass(Class reflector, Node node) throws InstantiationException, IllegalAccessException, InvocationTargetException { Constructor cons = null; try { cons = reflector.getConstructor((Class[]) null); } catch (SecurityException e1) { ...
33614b15-dcc3-481e-a9ca-9460fb0076d5
2
private Node findMinNode() { Node n = sentinel.left(); if (n == null) { throw new NoSuchElementException("empty tree"); } while (n.left() != null) { n = n.left(); } splay(n); return n; }
3f8bf168-7b0e-490a-addc-1f3e4071322b
0
public static int getMap(HashMap<String,String> map,String key){ map = new HashMap<String,String>(); map.get(key); counter_get++; return counter_get; }
366fdd6a-178e-484a-b941-7d60006cbc70
4
public Solucao GerarVizinhoOneFlip(Solucao inicio){ Random gerador = new Random(); while(true){ int indice = gerador.nextInt(inicio.getColunas().size()-1); for(Integer entrada : inicio.getLinhasX().keySet()){ Coluna colx = inicio.getColunas().get(indice); ...
8d1c3c00-ec84-4e1a-9b16-d69cd5879fd2
7
public void selectAnswer() { String person = ""; Card cardPerson = null; String weapon = ""; Card cardWeapon = null; String room = ""; Card cardRoom = null; //pick the first 3 cards of different type. The set is a hashset, so should already have a random order //boolean to store if a card has been sele...
db43d2ab-a3cf-4b2b-b8a2-eeb79b7cc5bd
7
public Object nextContent() throws JSONException { char c; StringBuilder sb; do { c = next(); } while (Character.isWhitespace(c)); if (c == 0) { return null; } if (c == '<') { return XML.LT; } sb = new St...
bc64c4dc-11cc-4d85-93b9-fd0211e8c2b7
9
public static boolean writePCData2DB(String id, PCDataType type) { DruidPooledConnection connection = null; PreparedStatement preparedStatement = null; // 处理sql预编译对象 try { connection = mySQLPool.getConnection(); // 连上数据库 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-...
810c23ee-1e2e-4e2c-92a2-51dc1bdd36cc
6
public void chargerSauvegarde() { FileInputStream file; try { file = new FileInputStream("../sauvegarde.save"); ObjectInputStream output = new ObjectInputStream(file); BoutonBomberman[][] boutons = (BoutonBomberman[][]) output .readObject(); for (int largeur = 0; largeur < 15; largeur++) { for...
d0b2d686-874a-4e37-89bf-82f5f2977bf1
7
public void update(long elapsedTime) { super.update(elapsedTime); start += elapsedTime; if (movement != null && movement.get(index).size() > 2) { if (start / 100.0 > movement.get(index).get(0)) { start = 0; index++; index %= movement.size(); } moveX(movement.get(index).get(1)); moveY(movem...
07d550c1-33c5-499b-8d31-6574216337f6
1
public static void updateFournisseur(int idfournisseur, int idville, String nom, String adresse1, String adresse2) throws SQLException { String query = ""; try { query = " UPDATE FOURNISSEUR SET ID_VILLE=?,FOUNOM=?,FOUADRESSE1=?,FOUADRESSE2=? where ID_FOURNISSEUR=? "; PreparedSt...
d814f492-6953-44fd-bf23-200f5d745c9f
6
@Override public void paintComponent(Graphics g1) { super.paintComponent(g1); if (_field==null) { return; } System.out.println("Repainting Drawing"); System.out.println(_field.getWidth()+"|"+_field.getHeight()); final Graphics2D g=(Graphics2D)g1; g.se...
6c6a0411-bc50-4365-94c4-2ba6d8386fe7
2
public void setRef4(String ref) { if (ref != null && ref.length() > 256) throw new IllegalArgumentException("Ref cannot be longer than 256 characters!"); this.ref4 = ref; }
a35dd999-2cbc-42ef-9621-0e845c8b35e9
3
boolean isDiagonalAttackPlacementNotHarming(int position, char[] boardElements, int dimension) { return isAttackPlaceDiagonallyAboveLeftNotHarming(position, boardElements, dimension, attackPlacesOnTheLeft(position, dimension)) && isAttackPlaceDiagonallyAboveRightNotHarming(position, boardElements, d...
ca56787d-5f30-4c41-af5b-7dbea0d4867f
1
public static BufferedImage convertToType(BufferedImage sourceImage, int targetType) { BufferedImage image; // if the source image is already the target type, return the source image if (sourceImage.getType() == targetType) image = sourceImage; // otherwise create a new image of the tar...
0a7e532d-bc13-4ea0-b6eb-b8f996574e53
0
@Override public boolean supportsMoveability() {return false;}
c052dc9c-cacd-4a91-bea8-257e23a95ec3
4
public boolean isOpaque(Coordinate coord) { if (getCell(coord).getElementType() == ElementType.LEAF || getCell(coord).getElementType() == ElementType.LEAFWATER || getCell(coord).getElementType() == ElementType.TRUNK || getCell(coord).getElementType() == ElementType.WALL) return true; else return f...
2c85303a-2276-4cbf-85ea-9a2681ff8af9
6
public void setBombOff(int x, int y, int range) { int i = 0; //This is for destroying blocks within the range passed in, starts at 1 since //otherwise first loop will all break the exact same block you start on for (i = 1; i < range + 1; i++) { try { change...
e321999d-a27a-4661-91ab-95ada730a165
9
private void saveErrorListInarchive(Programa[] p1, Programa[] p2, int nThreads) throws IOException { cs = cs.getInstance(); errosDesconhecidos=new FileManager(cs); brokenLinks=new FileManager(cs); urlErrorServer=new FileManager(cs); urlBadGateway=new FileManager(cs); errosDesconhecidos.openFile("Erros...
e9ca63c9-6369-483e-957c-6a61c4a97ad0
1
public long getLong(int index) throws JSONException { Object o = get(index); return o instanceof Number ? ((Number)o).longValue() : (long)getDouble(index); }
41fd465c-f13f-49bf-9727-4a97544feaaf
1
public int getHeroSkillRechargeTimeLeft(HeroSlot heroSlot, SkillBarSkillSlot skillSlot) throws IOException { int skillRecharge = this.getHeroSkillRecharge(heroSlot, skillSlot); if (skillRecharge == 0) { return 0; } int timeStamp = this.getTimeStamp(); return skillR...
a144aff2-eb85-4f85-b48d-32f23eb75bd4
1
public int getCount(ArrayList<FilterBean> hmFilter) throws Exception { int pages; try { oMysql.conexion(enumTipoConexion); pages = oMysql.getCount("hilo", hmFilter); oMysql.desconexion(); return pages; } catch (Exception e) { throw new ...
20ac0f47-ecfe-4da3-898e-6dd8fb1abf59
6
public BaffleBoard(int numberOfBaffles) { /* * Initialize the board with empty values */ for (int row = 0; row < board.length; row++) for (int column = 0; column < board[0].length; column++) board[row][column] = Baffle.EMPTY; intGUI(); /* * Put in random baffles at random locations */ int...
945eadd7-4135-47b1-87f9-c335e7439abb
8
public E removeMin( ) { if ( size == 0 ) throw new NoSuchElementException("PriQueHeap.removeMinElement"); else { int hole = 1, child = 2; qe[0] = qe[1]; // qu[1] is now a proper hole while ( child+1 < size && ( qe[child ].compareTo(qe[size]) < 0 || qe[child+1].compareTo(q...
820d688e-9e65-4bd3-882c-5352934967d0
2
public Registrant getRegistrant(String asParam) { RegistrantList laRegList = get(RegistrantList.class, REST_URL_REGISTRATION + "/" + asParam); Registrant laReg = null; if (laRegList != null && laRegList.getRegistrantList() != null) { laReg = laRegList.getRegistrantLis...
280a8212-a7bc-4e87-85be-5f456eb89a9f
4
public static String[] firstAccept(String username) { String str[] = new String[3]; String s[]; int num = 0; try { BufferedReader reader = new BufferedReader(new FileReader(new File("E:\\doc\\"+ username + "_solvedproblem.txt"))); String line = reader.readLine(); s = line.split("\t...
d5a791e8-7c51-4e2e-a2a6-254708621f60
6
@Override public void run() { DistributedBackupSystem.fManager.updateRepDegree(fileID, chunkNo, addr, false); if(!DistributedBackupSystem.fManager.chunkCorrectRepDegree(fileID, chunkNo)) { int waitTime = (int)(Math.random() * 400); try { Thread.sleep(waitTime); } catch (InterruptedException e1) { ...
e1c5c522-4f34-43c8-9694-59fb94f89cb2
5
public void eliminar(String correo){ NodoCorreos q = this.inicio; NodoCorreos t = null; boolean band = true; while(q.getInfo() != correo && band){ if(q.getLiga() != null){ t = q; q = q.getLiga(); }else{ band = false; } } if(!band){ System.out.println("No se encuentra correo");...
ec1864af-bb39-4c16-b277-2d8276a7b7f5
0
public MethodParameter(String parameterName, String parameterType) { this.parameterName = parameterName; this.parameterType = parameterType; }
1e280957-b314-419e-b53c-ffadce288376
3
@Override public void sortArray() { this.arrayAccess = 0; this.comparisions = 0; T[] auxArray = array.clone(); for (T item : array) { count[keyMap.get(item) + 1]++; } for (int i = 0; i < radix; i++) { count[i + 1] += count[i]; } ...
83952e05-2dce-4f8a-8b57-8aa11b03a7a3
3
public void setSelectedItem(Object anItem) { selectedItem = (SingleTreeModel)anItem; Object[] listeners = listenerList.getListenerList(); ListDataEvent e = null; for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == ListDataListener.cla...
4637d240-9eaa-4906-8069-95743ef2b667
8
@Override public void mousePressed(MouseEvent me) { synchronized (_handObjects) { Iterator<BoardObject> iter = _handObjects.iterator(); while (iter.hasNext()) { BoardObject o = iter.next(); if (collides(o.getX(),o.getY(),o.getW(),o.getH(),me.getX(),me.getY(),3,3) && (o.getLoc() == CurrDisplay || ...
00ebaeb8-66fc-45a0-9aa9-8b8bab74309a
8
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { args = CommandLineTokenizer.tokenize(args); if (sender instanceof Player) { xAuthPlayer p = plugin.getPlyrMngr().getPlayer((Player) sender); if ((plugin.getConfig().getBoolean("registration.require-email") && args...
135afec4-bf68-4223-8a9c-4becaeb10ceb
0
public String getPass_code() { return pass_code; }
8025e519-3401-4b4b-a4f7-7c83d05b05b3
1
@Override public void messageReceived(IoSession session, Object message) throws Exception { if(message instanceof Message){ System.out.println(((Message) message).getBody()); } else{ System.out.println("Unknown message type received: " + message.getClass().toString()); ...
cfd9dee4-b0e3-4bde-94d1-e9abf0d9af9d
8
private static List<Part> layout(Part fp, int w) { List<Part> ret = new LinkedList<Part>(); List<Part> line = new LinkedList<Part>(); int x = 0, y = 0; int mw = 0, lh = 0; for (Part p = fp; p != null; p = p.next) { boolean lb = p instanceof New...
f0c75a9d-eacb-466c-b0d8-5dc50b1b273f
1
public ParseTree getParseTree(CommonTree ast) { parseTree = new ParseTree(); //Add the root node parseTree.value = ast.getText(); parseTree.attribute = EsperCompiler.getTokenName(Integer.parseInt(Integer.toString(ast.getType()))); //Add the children for (int i = 0; i < ast.getChildCount(); i++) pa...
b34c6312-4b53-4aa3-9192-09189653d25a
4
public void wilt(){ if(life<100 && ready ==1) { ready = 0; //if(random.nextInt(11) ==10) life -=1; for (cell cell : body) {cell.color= cell.color -= 255*255 + 256; //change color } } if( life<=0) { kill(); } }
312812ba-b01d-441a-bb22-7153c4faf48e
7
@Override public void moveCell(Object cell, double x, double y) { mxIGraphModel model = graph.getModel(); Object parent = model.getParent(cell); if (cell instanceof mxICell && parent instanceof mxICell) { int i = 0; double last = 0; int childCount = model.getChildCount(parent); // Finds index of...
2bef2221-fa5c-4170-85de-76a079869d03
1
public void setSessionAttribute(String attrName, Object attr) { if (this.sessionAttributes.containsKey(attrName)) { this.sessionAttributes.replace(attrName, attr); } else { this.sessionAttributes.put(attrName, attr); } }
02b0d7c8-c108-44c6-bff5-3e9d1fed5f3c
0
public int centre (int x1, int x2, String s) { int num = s.length(); int eachside = num/2; int middle = ((x2-x1)/2) + x1 ; return middle-(int)(9.5*eachside); }
60a04c26-756f-4bc4-9075-3b23acfa147a
6
private static void merge(int low, int middle, int high) { // Copy both parts into the helper array for (int i = low; i <= high; i++) { helper[i] = numbers[i]; } int i = low; int j = middle + 1; int k = low; // Copy the smallest values from either the left or the righ...
16554755-49ee-4a57-ba3a-c09b32749831
2
private Object lookupCache(ArrayList cache, int index) { if (index < cache.size()) { Object result = cache.get(index); if (result == UNDER_CONSTRUCTION) throw new RuntimeException("Unable to resolve circular reference in cache"); else return re...
af9b537a-ba3d-49d7-81a8-74388b89972b
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ResizingByteBuffer other = (ResizingByteBuffer) obj; for(int ix = 0 ; ix<this.index ; ix++ ) { if(buf[ix] != other.buf[ix]) return false;...
b6dd4824-f864-43eb-9634-bc1bce19995d
1
private static boolean deleteDrug(Drug bean, PreparedStatement stmt) throws SQLException{ stmt.setInt(1, bean.getDrugId()); int affected=stmt.executeUpdate(); if(affected==1){ System.out.println("Drug with ID "+bean.getDrugId()+" has been Removed from database."); } else { System.out.println("unabl...
5ac09927-fe6e-4d3e-80c8-2995b6aae5fe
3
public void fillListeners(Monitor m, List<StatProcessorListener> list, GlobalParams globalParams) throws Exception, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException { if (m.getListeners() == null) return; for (Monitor.Listeners.Listen l: m.getListeners().getL...
d61cf43f-7c04-41ff-af61-1a25a798866c
4
public void run() { while(true) { for (int i = 0; i < 4; i++) { semaphore.take(); System.out.println(threadIndex + ": " + i); try { sleep(1000); } catch (InterruptedException e) { e.printStackTrac...
699c018e-8781-45d0-b41d-ce65ec4c7678
5
void createExampleWidgets () { /* Compute the widget style */ int style = getDefaultStyle(); if (singleButton.getSelection ()) style |= SWT.SINGLE; if (multiButton.getSelection ()) style |= SWT.MULTI; if (horizontalButton.getSelection ()) style |= SWT.H_SCROLL; if (verticalButton.getSelection ()) style |...
f372eeac-49ff-43b2-b33b-8496614b9de0
4
public static void unpackConfig(Archive container) { Rasterizer.textureCount = 0; for (int i = 0; i < 50; i++) { try { Rasterizer.textures[i] = new IndexedSprite(container, String.valueOf(i), 0); if (Rasterizer.lowMem && Rasterizer.textures[i].trimWidth == 128) { Rasterizer.textures[i].shrink(); ...
e8ba84e9-43dc-44dc-9b60-fa7de723bbb2
4
public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) { return var1.isBlockNormalCube(var2 - 1, var3, var4)?true:(var1.isBlockNormalCube(var2 + 1, var3, var4)?true:(var1.isBlockNormalCube(var2, var3, var4 - 1)?true:(var1.isBlockNormalCube(var2, var3, var4 + 1)?true:this.func_31032_h(var1, var2,...
13e52601-9004-49ea-a93c-feda98ec3fa7
5
private String appendFormInString() { int i = 0; StringBuilder field = new StringBuilder(); for (Integer key : cardInFieldGame.keySet()) { if (!listeofcontains.contains(key)) { int fehlt = LEGHTFORSTRING - cardInFieldGame.get(key).getForm().toCharArray().length; int me = fehlt / 2; fehlt = fe...
7d35b273-6f94-4b39-96bc-712759ac5c27
0
public static Edge reverse(Edge edge) { return new Edge(edge.end, edge.start, edge.weight); }
8058226f-b38c-489d-b636-96908cdec17b
6
public static void loadTableData() { // load Address row data try{ AddressDB.createAddress("1455 Mother of Dragons Ln", "", "Dothraki Valley", "Westeros", "23543"); AddressDB.createAddress("997 W. King Slayer Ave.", "", "Kings Landing", "Westeros", "23543"); AddressDB.createAddress("45 N. Walker Way", "", ...
6e46f52f-2dfe-420e-8001-00268fed00d7
5
private void setMinMaxHistogramHighlight() { ArrayList<Float> variations = new ArrayList<Float>(); for (float[] timeSeries : timeSeriesCompayData.values()) { variations.add(timeSeries[categoryId]); } float min = min(variations); float max = max(variations); if ((int) (min * 1e7) == -1) min = Float.Na...
bba88b9b-fd60-4356-99a4-bfbdc0f9aed5
5
private void initializeLights(Document document) { NodeList lightList = document.getElementsByTagName("light"); for (int i = 0; i < lightList.getLength(); i++) { Element lightElement = (Element) lightList.item(i); // Set up light properties Light lightNode = null; LightObject lightObject = null; if...
a05424aa-01fe-4163-a879-54ebda102bb4
5
@Override public boolean _equals(TwitterSearch other) { List<TwitterEntry> e1 = getResults(); List<TwitterEntry> e2 = other.getResults(); if (e1 == null || e2 == null) { return false; } if (e1.size() != e2.size()) { return false; } ...
ada6a317-2978-4063-8e04-c5d81754e0ff
9
public void run(double frac) { long tstart = System.currentTimeMillis(); System.out.println("level layout: start="+tstart); Queue q = new Queue(); TupleSet src = m_vis.getGroup(Visualization.FOCUS_ITEMS); Iterator iter = src.tuples(); while (iter.hasNext()) { Tuple t = (Tuple)iter.next(); ...
a9556562-ab69-4871-bf1f-55252d958aa6
4
@Override public void run() { String[] cmd = new String[] { "tail", "-500f", "/home/maria/Templates/flumelogs/AOP.log" }; BufferedReader infoBr = null; String msg; try { Process process = new ProcessBuilder(cmd).start(); // infoBr = new BufferedReader(new InputStreamReader(process.getInputStream())); ...
a84d9dce-5fb8-4455-bf61-beb4ca72e5ff
2
public boolean productRemoval(String nomeProduto) { for(Product p : this.products) { if (p.getName().equals(nomeProduto)) { this.products.remove(p); return true; } } return false; }
c86f46e0-6044-4697-b9bd-35d91ae38f58
0
public static void main(String[] args) { Proxy1impl p1 = new Proxy1impl(); Proxy1InvocationHandler handler = new Proxy1InvocationHandler(); handler.setRealObj(p1); // Class<?> classType = handler.getClass(); Proxy1Iterface proxy1 = (Proxy1Iterface)Proxy.newProxyInstance(Proxy1Iterface.class.getCl...
9465f432-0b88-443d-9be1-14474b669b9f
8
public void run() { suspendRequested = false; stopRequested = false; state = VmState.RUNNING; while (!stopRequested) { if (activeAnts.size() == 0) { state = VmState.STOPPED_BY_SIM; break; } runCurrentAnt(); ...
212b8b13-a65e-4978-8948-b8eae60a2bda
3
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((this.attachment == null) ? 0 : this.attachment.hashCode()); result = prime * result + ((this.name == null) ? 0 : this.name.hashCode()); result = prime * result + ((this.term == null) ? 0 : this.term.hashCode()...
b4fb5fb5-0336-4901-b7e8-b63f3d4a1ab6
2
public void listLoot(Player p) { if(loot.isEmpty()) { p.sendMessage("Loot is empty."); return; } for(ItemStack item: loot) { p.sendMessage(item.getType().name()); } }
203b12b3-51e4-4db5-b0d4-96aa5057854f
5
public Object [][] getDatos(){ Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length]; //realizamos la consulta sql y llenamos los datos en "Object" try{ if (colum_names.length>=0){ r_con.Connection(); String c...
c9b06fb9-496f-4d12-b9c9-85d598d0f179
6
private static void inspectField(Inspector inspector, String[] cmd) { String fieldName = cmd[1]; try { Field field = inspector.getFieldByName(fieldName); if (field == null) { throw new NoSuchFieldException(); } if (field.getType().isPrimitive()) { System.err.println(field.get(inspector.getObjec...
c357d956-2009-4df9-83a0-f826ec3650af
0
public String usunOsobe() { Osoba osobaDoUsuniecia = osoby.getRowData(); oo.usunOsobe(osobaDoUsuniecia); return null; }
890b2cc2-a3c3-4188-a3f6-810a4c3f9b86
7
public static int change(int row, int col, int[] mm) { int c = ((mm[row] & (1 << col)) != 0 ? -1 : 1); if (col - 1 >= 0) { c += ((mm[row] & (1 << (col - 1))) != 0 ? -1 : 1); mm[row] ^= 1 << (col - 1); } if (col + 1 < 10) { c += ((mm[row] & (1 << (col + 1))) != 0 ? -1 : 1); mm[row] ^= 1 << (col + 1);...
c2dadc18-dae7-47ba-8c77-95df43d10e0f
1
@Override public int attack(double agility, double luck) { if(random.nextInt(100) < luck) { System.out.println("I just bashed the opponent!"); return random.nextInt((int) agility) * 2; } return 0; }
67486d16-953e-4377-b59e-4514e3bcd0bb
4
public void setVariavel(List<?> list) { for(PVariavel e : this._variavel_) { e.parent(null); } this._variavel_.clear(); for(Object obj_e : list) { PVariavel e = (PVariavel) obj_e; if(e.parent() != null) { ...
dce34b5a-c9ae-48cd-8cfc-7fc6a4295fb6
6
public static void makeGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) { SpringLayout layout; try { layout = (SpringLayout)parent.getLayout(); } ...
c98056c8-3b4b-486a-8a06-78790fba4f12
3
public void readAndBuild(){ Json json = new Json(); if(profile == null){ profile = new Profile(); } try { reader = new BufferedReader(new FileReader("../src/saveData/saveFile.json")); } catch (FileNotFoundException e) { initializeProfile(); System.out.println("Profile Initialized"); } t...
cb2db76e-968a-41f7-bce2-ac20aa1736cb
8
@Override public String doExecute() { addActionMessage("We have received a call for the OAuth Callback - need to figure out how to access stuff"); HttpServletRequest request = ServletActionContext.getRequest(); Enumeration<String> e = request.getAttributeNames(); while(e.hasMoreElements()) { String el...
54687c2b-eeb5-4f82-afcd-f7cd18a837ca
4
private boolean requestTransactionLiving(Request request) { if (!this.reqeustTransactionExists(request)) return false; // check the transaction status transactionEntity tempT = this.transInfo.get(request.transaction); switch (tempT.status) { case Running: ...
afbb9ab5-4bd5-4975-a40e-c80f2afdf43a
1
public static void main(String[] args) { List<Double> numbers = new ArrayList<>(); int size = 300; for (int i = 1; i <= size; i++) { numbers.add((double)i); } SquareTaskForkJoin taskForkJoin = new SquareTaskForkJoin(numbers); long before = System.nanoTime(); ...
85c18f22-5a9b-4636-8f81-5b7ba147c27e
2
public boolean buscar(E x){ boolean resp = false; for ( Nodo<E> tmp = cabeza; tmp != null; tmp = tmp.siguiente ) { if ( x.equals(tmp.dato) ) { resp = true; } } return resp; }
3cebbb0f-b82f-4cae-8123-28b4fcb8ece7
8
private void setLength(Object val) { /* XXX do we satisfy this? * 15.4.5.1 [[Put]](P, V): * 1. Call the [[CanPut]] method of A with name P. * 2. If Result(1) is false, return. * ? */ double d = ScriptRuntime.toNumber(val); long longVal = ScriptRuntim...
6091b16e-c74c-48fc-a451-9215b2978550
4
public Vector Collide(Entity a,Entity b)//A is this's (long lost) parent { Vector Coll = null; //All boxes //ISUSSE if(AABB(this,b.CollModel,a,b) != null)//Prelim { for(int i = 0;i< boxes.size();++i) { for(int is = 0;is< b.CollModel.boxes.size();++is) { Coll = AABB(a.CollModel.boxes.get(i)...
cc9354a4-d2f2-4b88-8746-056f15dec973
2
@Override public boolean colides(SchlangenKopf head) { if (!catched && super.colides(head)) { head.eatDiamant(this); return true; } return false; }