method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e11d4ba5-7e5c-49bc-8293-b365fea6063e
2
public void getBadWords() { List<String> badW = getConfig().getStringList("BannedWords"); Iterator<String> i = badW.iterator(); while (i.hasNext()) { String thisLine = i.next(); if (thisLine.indexOf(":") > 0) { String thisSplut[] = thisLine.split(":",2); wordList.put(thisSplut[0],thisSplut[1]); }...
7cc5a7e1-9f1e-4899-a0c8-d5e598ff3dc1
7
@SuppressWarnings("deprecation") @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if(label.equalsIgnoreCase("chunkdestroy") && sender.isOp()) { if(Bukkit.getWorld(args[0]) != null) { //get x and z and parse int x = 0; int z = 0; try{ ...
de118437-16cf-49f1-8132-b754c06f6254
4
@Override public void setMade(PlayerInterface player, int round, int made) { LOG.info(String.format("%s made %d tricks for round %d", player.getName(), made, round)); if (!data.containsKey(player)) { throw new IllegalArgumentException(PLAYER_NOT_IN_STATS); } if (!(data.ge...
057a213d-04cc-4e1e-bab8-84ac2613e0cf
8
public String getContentType() { if (!isFile()) { throw new IllegalStateException("not a file"); } String contentType; String extensions = file.getName(); int index = extensions.lastIndexOf("."); if (-1 == index) { // no extension conte...
784711d2-58e7-4360-9317-0881ed97a0c4
3
public static Font pixFont(String name, int style, int pixels) { int under = 0; int over = 0; int unrPixels = Empty.getGraphics().getFontMetrics(new Font(name, style, under)).getHeight(); int ovrPixels = Empty.getGraphics().getFontMetrics(new Font(name, style, over)).getHeight(); for (over = 1; ovrPixels < p...
1381227e-76c5-459e-b023-c3dee4774d1d
5
public synchronized void playerDisconnect(Channel channel) { if (channel.equals(channel1)) { try { if (channel2.isOpen()) channel2.write(MessageFactory.createGameOverMessage(1)); GameWorker.getInstance().setPlayerState(channel2, GameState.LOGIN); ...
6a297b5a-908c-43cc-859c-fe93bb8a84ae
7
public Class<?> getType(Bindings bindings, ELContext context) { if (!lvalue) { return null; } Object base = prefix.eval(bindings, context); if (base == null) { throw new PropertyNotFoundException(LocalMessages.get("error.property.base.null", prefix)); } Object property = getProperty(bindings, context)...
96383297-5790-4b5b-b900-46696d23783b
8
final public void Array_access_expression() throws ParseException { /*@bgen(jjtree) Array_access_expression */ SimpleNode jjtn000 = new SimpleNode(JJTARRAY_ACCESS_EXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { ...
5f9d40ca-35da-4b40-8c1b-8429398affaf
9
public static void clearPanel() { if (jTextField_Balance != null && jTextField_AccountName != null && jTextField_ServerName != null && jTextField_AssetName != null && jTextField_NymName != null && jTextField_AccountID != null && jTextField_AssetID != null && jTextField_ServerID ...
401b85e7-25c3-4d12-b2a7-a3e9e0a86046
1
private void encode(String name, String value) { try { query += URLEncoder.encode(name, "UTF-8"); query += "="; query += URLEncoder.encode(value, "UTF-8"); } catch (UnsupportedEncodingException ex) { throw new RuntimeException("Broken VM does not support U...
fdc780ab-c4c9-4d4b-97cb-02f67e342674
0
public void setDestination(List<Destination> destination) { this.destination = destination; }
b74d41f5-05cd-4e4b-b276-7d9225d4962b
0
public static Forme Z() { ArrayList<Vecteur> liste = new ArrayList<>(); liste.add(new Vecteur(0, 0)); liste.add(new Vecteur(1, 1)); liste.add(new Vecteur(0, 1)); liste.add(new Vecteur(1, 2)); Vecteur<Integer> _centre = new Vecteur(0, 1); return new Forme("Z", lis...
73b1f524-f75f-4f1a-b20f-05af8d59d897
3
@Test public void isInTopWorksCorrectly3() { setupHighScoreTest(); assertTrue(high.isInTop(3, 1100) && high.isInTop(3, 900) && high.isInTop(3, 400) && !high.isInTop(3, 1)); }
939a49a5-34c7-4a15-b0dc-1405ea7e6c75
8
public void doIUDOperation() { int decide = (int) (Math.random() * 100) % 3; ResultSet rs = null; try { switch (decide) { case 0: { //insert int numInsert = insertRow(insert); pw.println("[NsSampleWork] Thread id - "+thread_id+"; inserted "+numInsert+" row."); break; } cas...
a771bff3-acab-43a6-a46a-e8c60b44d3f3
1
public ByteVector putShort(final int s) { int length = this.length; if (length + 2 > data.length) { enlarge(2); } byte[] data = this.data; data[length++] = (byte) (s >>> 8); data[length++] = (byte) s; this.length = length; return this; }
b2b3cfc9-6d13-439d-a9a1-f0c950c4ca9f
4
protected Pizza createPizza(String item) { Pizza pizza = null; PizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory(); if (item.equals("cheese")) { pizza = new CheesePizza(ingredientFactory); pizza.setName("New York Style Cheese Pizza"); } else if (item.equals("veggie")) { ...
023916e1-dbd4-47ad-9a64-c36afaebaf04
0
public AdapterPhysics(World world) { this.world = world; this.numObjs = world.getSize(); this.gravityInteraction = new int[numObjs + 1]; this.sourceGravity = new int[numObjs + 1]; this.electromagneticInteraction = new int[numObjs + 1]; this.simulators = new ArrayList<Physics>(); this.objects = new ArrayLi...
1c03b4ba-a09f-45ed-a0e8-b334add01bdd
8
boolean isSpecial(int index, StringBuilder s){ if(index==s.length()){ ArrayDeque<Character> stack = new ArrayDeque<Character>(); for(int i=0; i<index; i++){ if(brackets.indexOf(s.charAt(i))%2==0) { //opening stack.push(s.charAt(i)); } e...
20807a9a-6338-4c75-839b-6e480e7a0540
6
public static void main(String[] args) { try { String inputFile = "SampleInput"; String specFile = "SampleSpec"; String output = "TableOut"; if(args.length == 2) { inputFile = args[0]; specFile = args[1]; } File f = new File(specFile); BufferedReader reader = new BufferedReader(...
f73058a0-8e6b-4399-b91a-b94b3e7b944b
8
public BedFile(File bedFile){ this.fileName = bedFile.getName(); //Upload the bed File try { BufferedReader br = new BufferedReader(new FileReader(bedFile)); String line; int id = 0; while((line = br.readLine()) != null){ String[] chunks = line.split("\\s"); String token = chu...
929b1c9c-da6a-4c33-9d63-96c5a16111d7
9
public String[] getForecastTimes() throws Exception { String[] times = new String[8]; try { layers++; BufferedReader br = new BufferedReader(new InputStreamReader( new URL(MakeURL.hourlyURL(zip, plusDays)).openStream())); // FileWriter fileWriter = new FileWriter("test.html", false); // PrintWrite...
aa59c110-7257-4976-99f6-5b42a97f5b8d
5
@Override public void load(){ try { BufferedReader reader=new BufferedReader(new FileReader(new File(filename))); while(true){ String currency = reader.readLine(); if(currency==null)break; if(!currency.contains(","))continue; ...
83251b8c-a0d9-401d-960d-8f33d96df2d7
8
public static void clipOrClashWithOldPredicateValue(Proposition proposition) { { Vector arguments = proposition.arguments; int countminustwo = arguments.length() - 2; { Proposition p = null; Iterator iter000 = Logic.allTrueDependentPropositions((arguments.theArray)[0], ((Surrogate)(proposition....
9e5607cd-b8f9-4e6f-8983-2155fa1fc04b
6
@Override public Formula getPreferedOffer (Formula offer, int snum) { Formula resultOffer = null; List<Formula> potentialOffer = getPotentialOffer(offer); analysePotentialOffers (potentialOffer); if (snum == 1) { Collections.sort(potentialOffer, new Comparator<Formula>(){ public int compare(Form...
e5e939ee-02e7-44a5-b6c2-2a1a9f669405
1
@Override public int hashCode() { int hash = 0; hash += (idSintomas != null ? idSintomas.hashCode() : 0); return hash; }
a06c0117-5471-4de7-8ab9-2e900a9879cb
2
private void copyFile(InputStream in, File file) { try { OutputStream out = new FileOutputStream(file); byte[] buf = new byte[1024]; int len; while((len=in.read(buf))>0){ out.write(buf,0,len); } out.close(); in.close(); } catch (Excep...
bb6d0a06-d4d3-42c6-bd01-1c2171001b3b
6
public void drawBlocks(Graphics2D g2d, float ox, float oy, float w, float h) { synchronized (Game.blocks) { for(int x = 0; x < Game.boardSizeX; x++) { for(int y = Game.boardSizeY - Game.currentBoardSizeY; y < Game.boardSizeY; y++) { drawBlock(g2d, ...
f2c27720-2137-41bd-8de1-eec52c9d1844
4
public Font(HtmlMidNode parent, HtmlAttributeToken[] attrs){ super(parent, attrs); for(HtmlAttributeToken attr:attrs){ String v = attr.getAttrValue(); switch(attr.getAttrName()){ case "color": color = Color.parse(this, v); break; case "face": face = Face.parse(this, v); break; ...
fa66f508-d5f3-4549-9d4f-0dab01802083
6
private float estimateSearchParams(SearchParamsBase searchParams) { int nn = 1; int SAMPLE_COUNT = 1000; assert (bestIndex != null); float speedup = 0; int samples = Math.min(data.length / 10, SAMPLE_COUNT); if (samples > 0) { double[][] testDataset = Utils.randomSample(data, samples, false); int[...
8b87747b-52b7-4c5b-a421-98f76dc9576b
5
public BigDecimal quartileSkewness_as_BigDecimal() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } BigDecimal skewness = BigDecimal.ZERO; switch (type) { case 1: case 12: BigDecimal[] ...
a6b9999c-1195-4f96-87e5-e763faed9dfc
6
public SemanticRec[] gen_cast_division(SemanticRec left, SemanticRec right) { Type leftType = getTypeFromSR(left); Type rightType = getTypeFromSR(right); SemanticRec[] arrRec = new SemanticRec[2]; boolean properCastL = false; boolean properCastR = false; if (leftTyp...
a4f52ddd-e8d5-4ebf-a1e1-0a4912b7fa05
4
public int getFrequency(T a) { if(!this.hasElement(a)) { return 0;} else { if(this.next!=null) { if(this.a.equals(a)) { return 1+this.next.getFrequency(a);} else { return this.next.getFrequency(a);} } else { if(this.a.equals(a)) { return 1;} ...
c8e5ac2d-79a7-4eed-a0e5-b59ccc7dffe6
0
public static String getRandomCookieValue() { String random = RandomStringUtils.randomAlphanumeric(60); return random; }
fd06455a-1c73-4c3e-a265-1517e52fcd52
5
public Expression simplify() { if (subExpressions[1] instanceof ConstOperator) { ConstOperator one = (ConstOperator) subExpressions[1]; if ((getOperatorIndex() == OPASSIGN_OP + ADD_OP || getOperatorIndex() == OPASSIGN_OP + SUB_OP) && one.isOne(subExpressions[0].getType())) { int op = (getOperato...
5b1a0fb9-0054-4856-853e-56f479701abc
5
@Override public Integer getIdFromDataBase() throws SQLException { Connection connection = ua.edu.odeku.pet.database.ConnectionDataBase.getConnection(); Statement statement = connection.createStatement(); if(nameProgQuestionType == null || nameProgQuestionType.isEmpty()){ return ...
6e258c60-6a93-4a32-9efc-4d1162ef0427
9
@Override protected void buildModel() throws Exception { for (int iter = 1; iter <= numIters; iter++) { errs = 0; loss = 0; // for each rated user-item (u,i) pair for (int u : trainMatrix.rows()) { SparseVector Ru = trainMatrix.row(u); for (VectorEntry ve : Ru) { // each rated item i ...
1b250064-178c-4a29-99b4-5fd44eac2fe3
7
protected static File[] createTempFiles(File file, File tempFolder, String... exts) throws IOException { File[] result = new File[exts.length + 1]; String path = file.getAbsolutePath(); //Check if entire path consists of ASCII characters boolean ascii = true; for (int n = 0; n < path.length(); n++) { ...
03189a97-a8cb-4fdc-8dd3-24c851a2bfcc
4
public Tile getTile(int y, int x) { if (x < 0 || x >= map[0].length || y < 0 || y >= map.length) { return null; } else { return map[y][x]; } }
83741a05-29b0-4ec4-9b00-a612aa218139
4
@EventHandler public void onBlockBreak(BlockBreakEvent event) { if (event.isCancelled()) return; Player player = event.getPlayer(); for (Player p : parentarena.getplayers()) { if ((Player) p == player) { event.setCancelled(true); return; } } if (player == parentarena.getboss()) { event....
4ac7a741-21ef-4816-9389-7ee262824e00
5
public IteratorString(Node node) { while (!(node instanceof LeafNodeString)) { InternalNodeString iNode = (InternalNodeString) node; if (!iNode.getChildren().isEmpty()) { node = iNode.getChildren().get(0); } } currentNode = (LeafNodeString) node; if (!currentNode.getKVPairs().isEmpty()) { curre...
a75b1dc6-71d1-45c9-b1e0-db72fd3ea563
1
@Override protected void verifyNode(Attributes attributes) { /* * locale="iw" type="binary_resource" * dictionaryResourceId="@raw/he_main" * autoTextResourceId="@xml/he_autotext" -- optional */ verifyValidAttribute(attributes, "locale"); verifyValidAttrib...
0438f223-1ce2-463f-84c2-345df283fca2
4
public static void save(String filename) { File file = new File(filename); String suffix = filename.substring(filename.lastIndexOf('.') + 1); // png files if (suffix.toLowerCase().equals("png")) { try { ImageIO.write(onscreenImage, suffix, file); } catch (IOExcep...
583113fa-bf3a-4f0b-931d-2cc26406c9c3
5
public static void main_test(String[] args) throws IOException { Socket kkSocket = null; PrintWriter out = null; BufferedReader in = null; try { kkSocket = new Socket("localhost", 4444); out = new PrintWriter(kkSocket.getOutputStream(), true); in = new BufferedReader(new InputStreamReader(kkSocket.ge...
6ce15e0e-a574-4825-9a14-0e8d868232dc
5
private void loginJButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_loginJButtonMouseClicked /* *If the login button is clicked then collect data entered in form and *login user. */ String email = emailJFrield.getText(); String password = new String(pa...
a02660ca-1c53-4b5d-89e1-e3b11d485183
2
public static String ClsDESCode(String hex){ DESUtils des=DESUtils.init(); String out=""; try{ byte[] dec = des.getDesCode(des.hex2byte(hex)); // out=new String(dec); int i = out.indexOf(0x00); if(i != -1){ out=out.substring(0,i); } } catch(Exception e){ e.printStackTrace(); out=nul...
7ccab2b2-ce1a-4863-9653-b9613d19feca
4
@Override public void actionPerformed(ActionEvent e) { switch(e.getActionCommand()){ case "return": CardLayout layout = (CardLayout) this.getParent().getLayout(); layout.show(this.getParent(), "MANAGE_ITEMS"); break; case "edit": //Set dailyFee and maxFee to zero if the textfields for them are empty ...
e60d346b-c3a7-41f2-a79f-e5b6c277eb69
0
public void setConsumerSecret(String consumerSecret) { this.consumerSecret = consumerSecret; }
5f22a598-6345-4f4e-ac13-cc5db1b9e337
3
public static void insertionSortV( ArrayList<Card> data ) { for (int i = 1; i < data.size(); i++) { Card val = data.get(i); for (int x = i; x > 0; x--) { Card val2 = data.get(x); if (val2.compareTo(data.get(x-1)) < 0) data.set( x, data.set( x-1, data.get(x) ) ); else break; } ...
62aa4373-6c2e-4245-a5aa-12149d526c76
7
public synchronized boolean addEvent (ObjectatEvent event) throws Exception { boolean success = false; if (hashMapOfKeys.containsKey(event.getKey())) { int eventIndex = hashMapOfKeys.get(event.getKey()); ObjectatEvent deduplicateEvent = arrayListOfEvents.get(eventIndex); if (!deduplicateEvent.getKey()....
dc6988d8-0905-49e1-a263-09db33a3fb96
4
public TreeMap<Double,Integer> sort(TreeMap<Double,Integer> identifiers, DatasetObject objectQuery, int k) { // System.out.println("Filtering result set"); java.util.Iterator<Double> s=identifiers.keySet().iterator(); // if(s.hasNext()) // s.next(); //skip first to eliminate query o...
092af229-37b3-47f5-9e8b-a33835b03558
2
private static int getFirstEmptySlot(InventoryItem[] targetInventory) { //If it finds nothing, return -1 int index = -1; //scan the targetInventory, looking for EmptyItem's for(int i = 0; i<targetInventory.length; i++) { //it if finds one, set the index as that and...
ec79775f-303e-4890-895d-d55e449e76e8
4
public void dijkstraFire(int s) { PriorityQueue<Edge> q = new PriorityQueue<Edge>(); q.add(new Edge(s, 0)); dis[s] = 0; while (!q.isEmpty()) { Edge cur = q.poll(); for (int i = 0; i < adj[cur.id].size(); i++) { Edge neigh = adj[cur.id].get(i); if (dis[cur.id] + neigh.w < dis[neigh.id]) { ...
43586f98-0287-46fc-853a-8a216f234ec0
0
public float getA() { return a; }
dc45fc3a-afaf-4144-93cb-4d3978d1d946
4
public String toJSONString() { StringBuilder json = new StringBuilder(); if ( sb.length() > 0 ) { int len = sb.length(); if ( sb.charAt(0)==' ' ) sb.replace(0,1,"&nbsp;"); if ( sb.charAt(len-1)==' ' ) sb.replace(len-1,len,"&...
a7a96f39-dbc0-4151-918a-ea63305b7ae1
7
private final void rasterize(int arg0) { if (Model.aBooleanArray1664[arg0]) { method485(arg0); return; } int j = facePointA[arg0]; int k = facePointB[arg0]; int l = facePointC[arg0]; Rasterizer.edgeRestricted = Model.edgeRestricted[arg0]; if (transparency == null) { Rasterizer.alpha = 0; } else...
28715b27-5d02-4a58-a7f9-e10d08898d0e
5
public AStar(Node start, Node goal, boolean useOwnCollections) { if (useOwnCollections) { open = new PriorityQueue<>(new Comparator<Node>() { @Override public int compare(Node o1, Node o2) { if (o2.getF(goalNode) < o1.getF(goalNode)) { ...
eba96a13-6fd8-42c1-88c7-73c4b807ebf7
3
private static void fw_write(String msg, String file) { //System.out.print(msg); FileWriter fwriter = null; try { fwriter = new FileWriter(file, true); } catch (Exception ex) { ex.printStackTrace(); System.out.println("Unwanted err...
b6779559-ef97-4673-9600-29a76a79b521
8
@Override public double getResult(double[] incoming) throws Exception { double result = Double.NaN; boolean found = false; for (int i = 0; i < m_fieldDefs.size(); i++) { Attribute a = m_fieldDefs.get(i); if (a.name().equals(m_fieldName)) { if (a.isNumeric()) { if (m_opT...
533484ff-fa56-4282-b10d-4d879c84f5fa
0
public String getName() { return name; }
ab38c4ef-3dc3-4309-955d-e6dda0a69e89
1
public void infiniteDynamite(boolean b) { infiniteDynamite = b; if(b) { robot.addDynamite(); } else { robot.useDynamite(); } }
7a8ae5fa-3798-430b-b2a0-cb45dfb88fe6
9
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...
4e5b76a8-4ebd-4770-9379-2a56de119ae2
8
public boolean onHit(Terrain terrain){ boolean blnHit = false; //Check bottom for(int i = 0; i <= dblWidth && !blnHit; i++){ blnHit = terrain.isSolid(position.X+i,position.Y+dblWidth+1); } //Check Top for(int i = 0; i <= dblWidth && !blnHit; i++){ blnHit = terrain.isSolid(position.X+i,position...
aafb6f9e-6368-438a-9851-d99500ee34e7
0
public static void main(String[] args) { Server server = new Server(8000); server.startServer(); }
e7d0665f-1fae-45cd-b9ad-41ce4e8ccf8b
1
public static void RemoveWorld(String name, Boolean save) { UnloadWorld(name, save); try { FileUtils.delete(new File(name)); } catch (IOException ex) { Log.info(String .format("[RemoveWorld] Error occurred while attempting to remove world: %s to %s", name)); ex.printStackTrace(); } }
d218aa34-396e-465d-9ed8-5ee351ad9c08
5
@SuppressWarnings("unchecked") public <T> T executeTask(Task<T> t) throws RemoteException440 { String methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); /* save all arguments into an array */ Object[] args = new Object[]{t}; Class<?>[] argsType = new Class<?>[]{Task.class}; /* decl...
11fe7a30-6adb-46bf-ab9c-3195a6efab62
4
public static HashMap<ABObject[], ContactDimension> ExtractDimentsion() { CDDictionary = new HashMap<ABObject[], ContactDimension>(); for (Map.Entry<ABObject[], ERA[]> entry : RADictionary.entrySet()) { ABObject[] key = entry.getKey(); ContactDimension cd = ContactDimension.NULL; if (C...
48962b58-89a9-48ea-877e-d20692c9c40d
2
public Activity findByName(String name) throws InstanceNotFoundException { for (Activity a : activities) { if (a.getName().equals(name)) { return a; } } throw new InstanceNotFoundException(name, "Activity"); }
4a60c32e-0321-4000-af3a-91d3b0fd7e3a
2
public void drawParticles(Graphics graphics) { for (int particleIndex = 0; particleIndex < particleArray.length; particleIndex++) { if (particleArray[particleIndex] != null) { particleArray[particleIndex].draw(graphics); } } }
03a6f6fe-25a8-4d28-ac7f-6915f248a361
8
private String getStoreReplacementSignature(int opcode) throws BadBytecode { switch (opcode) { case AASTORE: return "(Ljava/lang/Object;ILjava/lang/Object;)V"; case BASTORE: return "(Ljava/lang/Object;IB)V"; case CASTORE: return "(Ljava/lang/Object;IC)...
6a7cb1cb-f35f-43d4-aa98-591bde992080
4
private void getNextPoint() { if(pathmode == MODE_POINT) { calculatePathPoint(); } else if(pathmode == MODE_PRESEARCH) { if(cnum == PCol.getNumberOfChanges() && Pfad.getDistance() != 0) { destination = Pfad.getNextPoint(); } else { calculatePathPresearch(); } } else { ...
2bbb4611-be02-4ce9-8984-6f79ad869967
8
public void visitLdcInsn(final Object cst){ Item i = cw.newConstItem(cst); // Label currentBlock = this.currentBlock; if(currentBlock != null) { if(compute == FRAMES) { currentBlock.frame.execute(Opcodes.LDC, 0, cw, i); } else { int size; // computes the stack size variation if(i.type == C...
c3c0363f-237f-4c09-84c8-977b476c780c
3
public static void checkPelota(Jugador jugador, Pelota pelota){ if(pelota.isPosecion()==false){ if(pelota.getPosX()==jugador.getPosX() && pelota.getPosY()==jugador.getPosY()){ pelota.setPosecion(true); jugador.setTieneBalon(true); } } ...
f34f5d8a-b82d-4a85-9c68-e6b64cec244d
8
public char[] getCurrentIdentifierSource() { //return the token REAL source (aka unicodes are precomputed) char[] result; if (this.withoutUnicodePtr != 0) { //0 is used as a fast test flag so the real first char is in position 1 System.arraycopy( this.withoutUnicodeBuffer, 1, result = new char[this.wit...
a3482bf6-5bce-4789-bd87-bcfc6e8add04
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://downl...
fe685e37-0ee8-4159-a418-83d837c90597
8
public Beer getBeer(Brand brand) { if( brand == Brand.A && !beers_brand_A.isEmpty() ) { for(Beer beer : beers_brand_A) { if( beer.getState() == BeerState.ICED ) { int index = beers_brand_A.indexOf(beer); beer.setLocal(Local.OUTSIDE); beer.startTimeToWarm(); return beers_brand_A....
928bd3a2-39db-4a06-9d4a-072ce6eaabab
1
public void setIdCliente(int idCliente) throws ErroValidacaoException { if(idCliente < 0 ) { throw new ErroValidacaoException("O id não pode ser menor que 0 !"); } else { this.idCliente = idCliente; } }
a46e027b-be5b-42e5-8c93-99a94b69faac
5
@Test public void testMessageQueueSetTimeoutErrorEx() { LOGGER.log(Level.INFO, "----- STARTING TEST testMessageQueueSetTimeoutErrorEx -----"); boolean exception_other = false; String hash = ""; try { server1.setUseMessageQueues(true); } catch (TimeoutException e) ...
e6dc6c58-09ec-4466-aaff-b46f39cc75ae
6
public HashMap<Integer, Integer> queryOutNeighborsAndCombine(final Collection<Integer> queryVertices) { HashMap<Integer, Integer> results; List<Future<HashMap<Integer, Integer>>> queryFutures = new ArrayList<Future<HashMap<Integer, Integer>>>(); /* Check which ones are in cache */ long ...
a8e3ef24-084a-4499-b29c-0a0b0c851742
7
public final List<T> findPath(int oldX, int oldY, int newX, int newY) { // TODO check input openList = new LinkedList<T>(); closedList = new LinkedList<T>(); openList.add(nodes[oldX][oldY]); // add starting node to open list done = false; T current; while (!done)...
56ee313b-9efb-4428-9b56-9529c3d82d40
6
public static String detectIdentifier(String eadfile) throws FileNotFoundException, XMLStreamException, FactoryConfigurationError { FileInputStream fileInputStreamEAD = new FileInputStream(eadfile); XMLEventReader xmlEventReaderEAD = XMLInputFactory.newInstance() .createXMLEventReader(fileInputStreamEAD)...
154266cf-babe-4d76-bda0-3108d10902a6
1
@Override public AbstractActionPanel getAction() { if ( owner.getSelected() ) { return new ActionPanelSettler(); } else { return new ActionPanelBlank(); } }
7c1d0868-2e42-4c6b-a748-359888af4567
3
public JSONObject accumulate( String key, Object value ) throws JSONException { testValidity(value); Object object = opt(key); if (object == null) { put(key, value instanceof JSONArray ? new JSONArray().put(value) : value); } el...
c2b6dc04-9900-437c-9df5-499d1abe50df
1
public String GetIP(String logEntry) { Pattern pattern = Pattern.compile("IP: (.*)", Pattern.MULTILINE); Matcher matcher = pattern.matcher(logEntry); if(matcher.find()) return matcher.group(1); return ""; }
9d751341-c233-4e97-86e7-d785f6bbfe39
5
private static double hammingSimilarity(List<double[]> featuresCac1, List<double[]> featuresCac2) { int diff = 0; int sumAll = 0; if (featuresCac1.size() != featuresCac2.size()) return -1; for (int i = 0; i < featuresCac1.size(); ...
db54d2cf-9c98-4675-b565-f5dd9ca65b0c
4
private static int checkClassName(String clName, int i) throws IllegalArgumentException, StringIndexOutOfBoundsException { while (true) { char c = clName.charAt(i++); if (c == ';') return i; if (c != '/' && !Character.isJavaIdentifierPart(c)) throw new IllegalArgumentException("Illegal java class ...
73e76e4b-c99c-4287-a50c-1b5ebe29d491
7
final void method3984(int i, int i_95_, int i_96_, boolean[][] bools, boolean bool, int i_97_, int i_98_) { Class101_Sub1 class101_sub1 = ((SoftwareToolkit) aHa_Sub1_8217).aClass101_Sub1_7492; anInt8228 = i_97_; aFloat8212 = ((Class101_Sub1) class101_sub1).aFloat5672; aFloat8216 = ((Class101_Sub1) class10...
d3d3b1e2-05f1-42d2-b3ab-a3ee4e220a4f
4
public Model(Group root) { me.setFill(Color.YELLOW); x=20; y=20; this.children=root.getChildren(); World w; try { JAXBContext jc = JAXBContext.newInstance(World.class); w = (World) jc.createUnmarshaller().unmarshal(vijf.class.getR...
1759f102-01d9-4960-b61d-018eb8a9e195
4
private final boolean removeP(final K key) { final HashCounter hc = new HashCounter(key); final Hashtable<K,HashCounter> relocation = new Hashtable<K,HashCounter>(); for (Integer i : hc.hashs) { // remove from off table if (!off[i].remove(new Entry<K,V>(key))) { return false; } // add entires to relocati...
a4cbb544-704b-4661-9e6a-956efbd506f8
7
public void info(){ try{ if( file.exists() ){ System.out.println("Nombre: " + file.getName()); System.out.println("Path: " + file.getPath()); System.out.println("Absoluto: " + file.getAbsolutePath()); System.out.println("PAPA: " + file....
3b383e61-f2f3-47c2-8496-d50879b71438
2
public static void main(String[] args) { YesNoWindow y1 = new YesNoWindow(); y1.addMessage("Yes or No?","This is a test"); while (y1.visible) { try { Thread.sleep(15); } catch(Exception ignored) { } } System.out.println(y1.getYes()); }
cc40edd3-a05d-4e08-a25a-1e4e9c4eba9e
0
@Override public void mouseEntered(MouseEvent e) { unprocessedEvents.add(e); mouse = e.getPoint(); }
a4bfe48f-bf23-4c11-b247-e35624c2dc0c
1
public void ensureCapacity(int minimumCapacity) { int [] biggerArray; if(data.length < minimumCapacity) { biggerArray = new int [minimumCapacity]; System.arraycopy(data, 0, biggerArray, 0, manyItems); data = biggerArray; } }
773f9eb5-4fe0-495e-a4bd-a7faaeac9db3
8
public Object getValue(String key) { if (key.equalsIgnoreCase("state")) { switch (view.styleManager.getStyle()) { case StyleConstant.SPACE_FILLING: return t[0]; case StyleConstant.BALL_AND_STICK: return t[1]; case StyleConstant.WIRE_FRAME: return t[2]; case StyleConstant.STICK: return t...
73a4db93-79aa-46bd-a5f2-12893b5ca77d
6
public void move( int distance ){ switch ( direction ) { case UP: setLocation( new Point( x , y - distance ) ); break; case DOWN: setLocation( new Point( x , y + distance ) ); break; case LEFT: se...
dd0492aa-71dc-4eab-86c1-44222c93cfb3
9
@Override public void paintComponent(Graphics g) { super.paintComponent(g); // draw the point rectangles Point p; for (int i = 0; i < polypoints.size(); i++) { p = polypoints.get(i); g.fillRect(p.x - POINTSIZE2, p.y - POINTSIZE2, P...
25025a61-6432-48aa-85f0-0ef729627a08
3
public static void main(String[] args) { //first do global alignment bet gene and gen#0. readFile(); int rows=gene.length()+1;//gene on left of table(rows).need +1 for start cell int cols=gen[0].length()+1;//genome on top. these values start@1 table=new int[rows][cols];//allocates a large amt. of memory. fo...
b33fad05-2f6d-47d5-8d6a-4918c99f985e
5
public void handleMouseClickInput(MouseButtonEvent mouseEvent) { setMousePosition(mouseEvent); currentMouseButton = mouseEvent.button; if (currentMouseButton == Mouse.Button.LEFT) { if (Window.getCurrentScreen() instanceof GameScreen) { new FireAction().execute(); ...
f80a51e1-e440-4ad2-9b43-72107b8d6959
0
public void clear() { results.clear(); }
a14bc059-68ef-4bbf-ad80-71ad6d44e589
8
double getDistance0(Vector<Integer> cluster1, Vector<Integer> cluster2) { double fBestDist = Double.MAX_VALUE; switch (m_nLinkType) { case SINGLE: case NEIGHBOR_JOINING: case CENTROID: case COMPLETE: case ADJCOMLPETE: case AVERAGE: case MEAN: // set up two instances for distance function Instanc...
7af28990-b26f-4594-b9e0-3a1505f1f02e
7
static JFreeChart createChart(ArrayList<Cluster> clusters, HashMap<Integer, String> map, int size) { int clusterCount = 0; DefaultXYDataset dataset = new DefaultXYDataset(); if (clusters != null) { for (Cluster cluster : clusters) { ArrayList<DataPoint> patterns = new ArrayList<DataPoint>(); for(St...