method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
12c13d65-171a-4c28-8fdd-4f25ab3086ad
4
public void addUnvisitedUrl(String url) { if (null != url && !"".equals(url.trim()) && !visitedUrl.contains(url) && !unVisitedUrl.contians(url)) { unVisitedUrl.enQueue(url); } }
3c2305af-82e9-4749-923b-b9fff38f4c7d
9
public static void onRepaint(Graphics g) { try { Iterator<PComponent> it = components.iterator(); while(it.hasNext()) { PComponent comp = it.next(); if(comp == null) continue; if (shouldDraw) { if (comp.shouldPaint()...
f80d9d59-05ad-4e09-97e9-93ccc16711aa
2
private void txtAnsKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtAnsKeyPressed if (evt.getKeyCode() == KeyEvent.VK_ENTER) { RegisterUserWorker ruw = new RegisterUserWorker(this, this.username, this.password, this.key, txtAns.getText()); ruw.execute(); this.se...
00766969-c574-4b18-bea7-4c5a053acd53
5
protected String createApiPostData(final Map<String, String> params) { // TODO Make a version that allows forcing a param to be sent last final StringBuilder result = new StringBuilder(); boolean first = true; if (params != null) { for (final Map.Entry<String, String> param : params.entrySet()) { if (par...
f20fc3ee-0543-4537-b95d-2c78d8195fc8
1
public int getSize() { // the size is in byte 0 of 'off' for primitive types (buf == null) return buf == null ? (off & 0xFF) : 1; }
0d2077e6-d3c0-4ea5-ba70-81449765d226
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TownChunk other = (TownChunk) obj; if (this.x != other.x) { return false; } i...
7fa9f5cd-178f-4e9e-9d2b-e2adb38f3bf2
6
public Class getGetClass(GetExecutor getExecutor, Class srcRefClass, Class getResultClass) { // 设置为自动提取的targetClasss if (getExecutor instanceof MapGetExecutor) { if (getResultClass != null) { return getResultClass;// 优先设置为getResult的class对象 } } else if (get...
35730899-73cf-4619-bce2-2b1810a606ef
7
public static Packet readPacket(DataInputStream par0DataInputStream, boolean par1) throws IOException { int i = 0; Packet packet = null; try { i = par0DataInputStream.read(); if (i == -1) { return null; } ...
9899b5c4-c8e7-4b6e-a575-c24bc85082c9
6
public static String unescape(String string) { int length = string.length(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; ++i) { char c = string.charAt(i); if (c == '+') { c = ' '; } else if (c == '%' && i + 2 < length) { ...
f98e50b1-2809-4c3e-8b12-5a984e88883e
6
@SuppressWarnings("unchecked") private <T> T invokeMethodChain(Object object, Object[][] methodCalls) throws Exception { for (Object[] methodCall : methodCalls) { String methodName = (String) methodCall[0]; int parameterCount = (methodCall.length - 1) / 2; ...
b0634671-395f-4dd7-b09e-34e40db03936
9
public static ArrayList<ArrayList<Point>> FloodfillLabelPoints(final BoolMatrix B, final String phenotype, final String filename, final BooleanFlag stop){ ArrayList<ArrayList<Point>> blobs=new ArrayList<ArrayList<Point>>(); final BoolMatrix D=new BoolMatrix(B.getWidth(),B.getHeight()); pictureiterator: { for (...
a2482f13-b6df-49d8-975d-5d66b360cbda
1
public HaltInstr(Opcode opcode) { super(opcode); if (this.OPCODE.getValue() != 13) { //HALT instruction can only accept HALT opcode. throw new IllegalStateException("Invalid opcode for this instruction type!"); } }
0e32d92d-45fa-4fe9-9aaa-880038699c5b
8
private void dumpTimeSeries(TS1Series series) { DateFormat formatter = new SimpleDateFormat("yyyy MMM dd HH:mm"); String[] months = (new DateFormatSymbols()).getShortMonths(); /* * Iterator eventIter = series.eventIterator(); if (eventIter.hasNext()) * System.out.println...
463c01b5-5ac7-4fa1-8ef9-9fe98c591923
1
protected JDialog createDialog(Component parent) { Frame frame = parent instanceof Frame ? (Frame) parent : (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent); JDialog dialog = new JDialog(frame, ("Select Font"), true); Action okAction = new DialogOKAction(dialog); ...
1bf60d94-d52e-4836-88ab-422d46465f01
3
public double calculaSalto(Nodo n) { Nodo l = estado.mapa.getNode(n.id); int dist = 0; if (n.score < 0) { l.score = -10; return -10; } if (visitados.contains(n)) { n.score = -5; l.score = -5; return n.score; } visitados.add(estado.getActual()); n.score = 9999; dist = this.memoria.getDis...
83b90e65-d0a0-4886-85f3-67fa6667f1cb
9
@Test public void testConstructor_IllegalArgumentException() { boolean exceptionThrown = false; try { new PaymentRequest(null, 1, "buyer", "seller", Currency.BTC, 12, System.currentTimeMillis()); } catch (IllegalArgumentException e) { exceptionThrown = true; } assertTrue(exceptionThrown); exceptionT...
1d0c182f-b235-4104-8d15-30ed7aa3a926
2
@Override protected Class<? extends Number> translateReturnType(Class<?> clazz) { //COUNT always returns Long return Long.class; }
5d50395c-2bb1-486c-8b12-858903ecf5d5
1
public void visitForceChildren(final TreeVisitor visitor) { if (visitor.reverse()) { object.visit(visitor); } else { object.visit(visitor); } }
f0e679ee-c0fc-49b2-acbb-24694c21b963
4
public float getMinimumDifference_as_float(){ float diff = 0.0F; if(this.type==2 || this.type==3){ ArrayMaths am = this.sort(); float[] sorted = am.getArray_as_float(); diff = sorted[1] - sorted[0]; float minDiff = diff; for(int i=1; i<this.len...
f450554c-37c6-4539-b0b5-bad382471dfe
8
public WorldTimeConverter() { // lbStatus = new JLabel("time converter"); calendar = Calendar.getInstance(); timeZones = TimeZone.getAvailableIDs(); Arrays.sort(timeZones); tz = calendar.getTimeZone(); setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); setLayout(new GridLayout(4, 3, 0, 0))...
10eed47b-f942-4b2b-8a7e-7d70a134da80
3
public void escribir(String rutaFichero, LinkedHashMap<Integer, ?> map, Dato dato) { switch (dato) { case PERSONA: escribirPersonaXStream(rutaFichero, (LinkedHashMap<Integer, Persona>) map); break; case COMPRA: escribirComprasXStream(rutaFi...
c691cc74-45a8-4edd-850e-5576efe7b9ba
6
public void func_50031_b(String par1Str) { String var2 = ""; String var3 = ChatAllowedCharacters.filerAllowedCharacters(par1Str); int var4 = this.field_50042_o < this.field_50048_p ? this.field_50042_o : this.field_50048_p; int var5 = this.field_50042_o < this.field_50048_p ? this.fi...
f9555437-3b1c-4b15-82f7-caf86b216b94
3
private void printHistory(boolean isSuccessful) { try (Writer out = new OutputStreamWriter(dataOutput, "UTF8")) { if (isSuccessful) { downloadHistory.append("Files were loaded \n"); } else { downloadHistory.append("Error in downloading files \n"); } out.write(downloadHistory.toString()); ...
d53c03cd-cd85-40b9-897b-7a76672e5165
4
public int getState(){ if(flag) return Spot.FLAG; if(!opened) return Spot.CLOSED; if(opened && bomb) return Spot.BOMB; return getBombCount(); }
b0eb1191-b2da-478d-9183-1b2b10bc7e4b
4
private long getCPtrAddRefAskData(AskData element) { // Whenever adding a reference to the list, I remove it first (if already there.) // That way we never store more than one reference per actual contained object. // for(int intIndex = 0; intIndex < elementList.size(); intIndex++) { Object theObject = elementLi...
7323099b-fa5a-4ed0-847e-1a507e54213a
3
public BufferedImage getBufferedImage() { if (bufferedImage == null) { bufferedImage = new BufferedImage(getWidth(), getHeight(), 1); } for (int x = 0; x < getWidth(); x++) { for (int y = 0; y < getHeight(); y++) { bufferedImage.setRGB(x, y, getPixel(x, y)); } } return bufferedImage; }
b6399a97-d748-4d40-b348-d4df6692d6cc
4
public static List<String> decodificarRespuesta(String queryRespuesta) { List<String> resultado = new ArrayList<String>(); JSONParser parser = new JSONParser(); try { Object objQuery = parser.parse(queryRespuesta); JSONObject queryJSON = (JSONObject) objQuery; JSONObject query = (JSONObject) queryJSON.ge...
7c4eebe3-f5d6-4a3e-9dff-5bff201446e8
1
@Override public void setFieldState(boolean hit, int x, int y) { Field tolook = getFields()[y][x]; if (hit) { tolook.setBattleState(eFieldBattleState.Hit); } else { tolook.setBattleState(eFieldBattleState.Missed); } }
487fd22e-507c-4af4-b65e-8cf84c6942ad
8
public void acceptDataSet(DataSetEvent e) { if (m_splitThread == null) { final Instances dataSet = new Instances(e.getDataSet()); m_splitThread = new Thread() { public void run() { try { dataSet.randomize(new Random(m_randomSeed)); int trainSize = (int)Math.round(d...
18cd988d-d860-4ff0-b823-42a28825ea56
4
private static PDFObject getDestFromString(PDFObject str, PDFObject root) throws IOException { // find the names object in the root node PDFObject names = root.getDictRef("Names"); if (names != null) { // find the dests entry in the names dictionary PDFObject ...
a10e8c85-9a6d-44be-8201-701e3d468902
7
@Override public void setValueAt(Object newValue, int row, int column) { if (!linkable) { return; } final Object oldValue = getValueAt(row, column); final boolean changed; if (newValue == null) { changed = (newValue != oldValue); } else { ...
11d50a1a-87cd-49a6-979a-0b9028969990
8
public void render(int xScroll, int yScroll){ remove();//removes all entities that are no longer relevant // This will set the screen to not go over the corners of the map if (xScroll < 0){xScroll = 0;} if (xScroll > (width << 3) - screen.getWidth()){xScroll = (width << 3) - screen.getWidth();} if (yScroll ...
ade0c702-6af1-4949-b364-4f99df8ec7dc
6
private HbaseDao() throws Exception{ config = HBaseConfiguration.create(); String zookeeperUrl = PropLoader.getUrl(); String[] znodes = zookeeperUrl.split(","); StringBuilder quorum = new StringBuilder(); String zookeeperPort = ""; for(int i=0;i<znodes.length;i+...
87754e95-8346-423c-bbd9-2799e1815a01
6
@Override public void remove(int i, int j) throws BadLocationException { int k = getSelectionStart(); if (k > 0) { k--; } String s = getMatch(getText(0, k)); if (!isStrict && s == null) { super.remove(i, j); } else { super.remove(0, getLength()); super.insertString(0, s, null); ...
fb605f64-2f6e-41ea-b77d-a839a3056c0e
9
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String customername = request.getParameter("customername"); Strin...
f12e0cc9-738e-4257-8c88-b25eeda88bb2
3
public static void print(TreeNode root) { if (null != root) { System.out.println(root.val + "[" + (null == root.left ? "null" : root.left.val) + "," + (null == root.right ? "null" : root.right.val) + "]"); print(root.left); print(root.right); } }
4044073b-2cad-4c66-8bfd-254a007d60c5
0
@Override public String toString(){ //if () return "\nRECARGO "+super.toString(); }
c15e2194-2377-4fff-8f99-824a110531bf
7
@Override public void executeMsg(Environmental myHost, CMMsg msg) { super.executeMsg(myHost, msg); if((msg.source()==affected) && (msg.tool() instanceof Social) && (msg.target() instanceof MOB) && (msg.tool().Name().equals(socialName)) && (msg.source() != msg.target()) && (!doneMobs.contains(msg.target...
ee9c3bed-02d2-45e2-936e-75dff59dbabd
1
public void visitBlock(final Block block) { println(); println(block); final Handler handler = (Handler) block.graph().handlersMap() .get(block); if (handler != null) { println("catches " + handler.catchType()); println("protects " + handler.protectedBlocks()); } block.visitChildren(this); }
02a6cb57-a832-4e8b-9cbb-6a1c6a6547e0
9
public static int getPages(String tabla, List campos, List where, int limite) throws Exception { int result = 0; String orden = ""; String cond = ""; if (limite == 0) { limite = 1; } try { if (con != null) { Statement stm = con.crea...
315064ec-85fe-4d2d-b66d-ca4637b63cef
3
public void paintShape(Graphics2D g2) { if (color != null) { label.setForeground(new java.awt.Color((int) color.getRed(), (int) color.getGreen(), (int) color.getBlue())); Dimension dim = label.getPreferredSize(); if (dim.width > 0 && dim.height > 0) ...
89283946-f32e-4c58-861e-de7bdb547eaf
4
public Fieldset(HtmlMidNode parent, HtmlAttributeToken[] attrs){ super(parent, attrs); for(HtmlAttributeToken attr:attrs){ String v = attr.getAttrValue(); switch(attr.getAttrName()){ case "disabled": disabled = Disabled.parse(this, v); break; case "form": form = Form.parse(this, v); ...
708b0738-c37e-47fc-bc8a-dde9f59bea31
3
private void setRGBColor(Color color) { int red = color.getRed(); int green = color.getGreen(); int blue = color.getBlue(); boxRed.setForeground(new Color(red, 0, 0)); boxGreen.setForeground(new Color(0, green, 0)); boxBlue.set...
5c498ba5-7b76-4234-9d42-cea4ef4a105d
7
@Override public boolean activate() { return (!validate(Constants.WAITFOR_WIDGET) && !validate(Constants.SELECTION_WIDGET) && Inventory.contains(Settings.bar.getFirstId()) && !Bank.isOpen() && ( Constants.FALADOR_FURNACE_AREA.contains(Players.getLocal()) || Constants.EDGEVILLE_FUR...
726815aa-d11c-4301-82ff-4f66e510097d
0
@Override public String getDesc() { return "SoulBurn"; }
5d79fc9b-c98f-4dfc-b6ea-2cf7d425e816
1
@Override public void mousePressed(MouseEvent e) { //if (spawnMenuItem.isEnabled()) { int newX = (int) Math.round(e.getX() / (double) game.getPixelSize()); int newY = (int) Math.round(e.getY() / (double) game.getPixelSize()); if (game.isInBounds(newY, newX)) { erase = gam...
d79d780b-6e0e-4e38-9313-b62f09f4eef2
2
public int numTreesDP(int n, Integer [] DP) { if(DP[n] != null) { return DP[n]; } DP[n] = 0; for(int i = 1; i <= n; ++i){ int l = numTreesDP(i-1, DP); int r = numTreesDP(n-i, DP); DP[n] += l * r; } return DP[n]; }
8e59f84b-b2ac-4bee-bd45-54b4250518e1
0
@Override public BeerReadOnly addBeer(BeerRequest beerRequest) { BeerEntity beerEntity = BeerEntity.createBeerWithNameAndDescription(beerRequest.getName(), beerRequest.getDescription()); return persistenceService.save(beerEntity); }
dac6cb10-be42-4c73-972d-b26bc4604089
5
public void update() { Vector3f direction = Transform.getCamera().getPos().sub(transform.getTranslation()); float distance = direction.length(); Vector3f orientation = direction.div(distance); transform.getTranslation().setY(0.0f); faceCam(orientation); switch (state)...
e536f51d-9088-453b-98df-082c2b3dabf2
1
public JSONObject getJSONObject(int index) throws JSONException { Object object = this.get(index); if (object instanceof JSONObject) { return (JSONObject) object; } throw new JSONException("JSONArray[" + index + "] is not a JSONObject."); }
49c08554-861d-4f69-8f98-c5b93ba353e4
3
public static double getWeaponDamageMod(AttackType atk_type, WeaponMaterial mat_type) { switch (atk_type) { case SLASH: return WeaponMaterial.getDamageModSlash(mat_type); case BASH: return WeaponMaterial.getDamageModBash(mat_type); case PIERCE...
ee8df024-1abc-4565-ba22-d2b78b338983
3
public int compareTo(Eisenstein that) { if(this.equals(that)) return 0; else if(this.norm2() == that.norm2()) return this.argument() > that.argument()? 1: -1; else return this.norm2()-that.norm2(); }
d72dc402-d403-44fe-990d-3076e371251a
1
public void query(String query){ try { stmt = conn.createStatement(); query.replace("TABLE_NAME", table_name); stmt.execute(query); stmt.close(); }catch (SQLException sqlExcept) { sqlExcept.printStackTrace(); } }
7b9cd0b9-61ce-4509-9055-e9f203fd0988
0
public int Count() { //get the number of person on the stop return ((int)busStop.size()); }
ce98e3b1-1b72-47ba-9cf9-32642692ed3f
4
private void rotate() { //orient++; if (orient%4==0) { litPositions=new int[][] {{0,0,1}, {0,1,1}, {0,1,0}}; } if (orient%4==1) { litPositions=new int[][] {{0,0,0}, {1,1,0}, {0,1,1}}; } if (orient%4==2) { litPositions=new int[][] ...
3ba9dc61-44f8-4c7c-a068-5a493ee8ae3c
2
private final int log2(int n) { if (n <= 2) return 1; int log2 = 2; n--; while (n > 3) { n >>= 1; log2++; } return log2; }
1a73e967-55a1-4979-8fd2-a89f402fbccd
7
private String toString(V value) { if (value == null) { return null; } if (value instanceof String) { return (String) value; } if (value instanceof Boolean) { return ((Boolean) value).booleanValue() ? "1" : "0"; } if (value instanceof Date) { return new SimpleDateForm...
904c96e8-7d77-4192-9986-26c271edc0f7
3
public static void main(String[] args) { // TODO code application logic here //ConexaoMySql conexao = new ConexaoMySql(); String strTexto = new String(); String strOpt = new String(); strOpt = JOptionPane.showInputDialog(null,"Deseja incluir ou excluir? (I/E) "); if ("I"....
c8bf4796-6261-4317-8660-e12fcb1b83cc
8
public void testPingPong () throws IOException { final Data dataTCP = new Data(); populateData(dataTCP, true); final Data dataUDP = new Data(); populateData(dataUDP, false); final Server server = new Server(16384, 8192); server.getKryo().setRegistrationRequired(false); startEndPoint(server); server.bin...
e53380dd-7add-4160-a842-829acd918e85
0
public void start() { t.start(); }
9e8994ae-c279-4a83-8b33-c964d82db198
3
public static void main(String[] args) throws Exception { //Search item ArrayList<SearchResult> searchItem = GrandExchange.searchItem("(4)"); if (searchItem != null) for (SearchResult sr : searchItem) System.out.println(sr); //Single item SingleItem item = GrandExchange.getItem(11694); if(it...
7b766374-6c66-4885-88bf-6578ea0777f0
9
public void generateResource(ResourceDef.Resource resource, PrintWriter pw) { if (resource.text == null) { throw new BuildException( "Resource '" + resource.name + "' has no message"); } String text = resource.text.cdata; String comment = ResourceGen.g...
d0ee6c57-cd58-4009-9447-ba75707a1fa8
9
private static boolean TestState(eGameState r2, eColor c) { if (r2 == eGameState.SAME || (r2 == eGameState.CHECK_MATE_B && c == eColor.Black) || (r2 == eGameState.CHECK_MATE_W && c == eColor.White) || (r2 == eGameState.CHECK_KING_B && c == eColor.Black) || (r2 == eGameState.CHECK_KING_W && c == eColor.White))...
00f0136c-7dcd-4657-8a0d-0d5fc98673d7
2
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try{ response.setContentType("text/html"); PrintWriter out = response.getWriter(); HttpSession session = request.getSession(); session.removeAttribute("message"); String oldpwd=req...
b789733e-ceba-42cd-a050-7066b01e4d86
9
private void printDAG(){ System.out.println("=== Input data: ==="); for(DataItem d:originalDataItems){ System.out.println("=> Name:" + d.getName()+" (Id:"+d.getId()+") , size: " + d.getSize()); } System.out.println("=== Entry tasks: ==="); for(Task t:entryTasks){ System.out.println("=> Id:" + t.getI...
67d64b83-571d-4f57-bb7c-a37f4414a816
8
public Pos convert(char c){ switch(c){ case 'R': return Pos.ROBOT; case 'L': return Pos.LIFT_C; case 'O': return Pos.LIFT_O; case '.': return Pos.EARTH; case '#': return Pos.WALL; case 'x': return Pos.DIAMOND; case ' ': return Pos.EMPTY; case '*': return Pos.ROCK; default:...
38107dbb-9a53-421f-a105-3316a0efd6eb
5
public OlogClientImpl create() throws Exception { if (this.protocol.equalsIgnoreCase("http")) { //$NON-NLS-1$ this.clientConfig = new DefaultClientConfig(); } else if (this.protocol.equalsIgnoreCase("https")) { //$NON-NLS-1$ if (this.clientConfig == null) { SSLContext sslContext = null; try { ...
3d16f6aa-8662-4b51-98e3-1fdec702a162
2
void mapIn(String in, Object comp, String comp_in) { if (comp == ca.getComponent()) { throw new ComponentException("cannot connect 'In' with itself for " + in); } ComponentAccess ac_dest = lookup(comp); FieldAccess destAccess = (FieldAccess) ac_dest.input(comp_in); checkFA(destAccess, comp, comp_in); ...
3b6120fd-2c96-49f3-afdf-9083978d4c36
3
private void showHelp() { JDialog dialog = new JDialog(this, resources.getString("dialog.help.title")); final JEditorPane helpText = new JEditorPane(); try { URL url = getClass().getResource("GridWorldHelp.html"); helpText.setPage(url); } catch (Exception e) { helpText.s...
48db08f0-f282-4a76-8950-f31679d7cb51
8
private void readBuffer(long timeout, long startTime, SelectionKey readKey, ByteBuffer buffer) throws IOException { boolean firstTime = true; while (currentTime() - startTime < timeout && buffer.position() != buffer.capacity()) { if (!firstTime) { long waitDuration = startTim...
7e44a69d-7c0d-4de4-8331-39ccb149bd4d
5
public static int quien(Jugador player, Equipo equipoD){ int x1=player.getPosX(), y1=player.getPosY(); double[] dis=new double[11]; for(int i=0;i<11;i++){ int x2=equipoD.getJugadorX(i).getPosX(), y2=equipoD.getJugadorX(i).getPosY(); dis[i]=Math.sqrt(Math.pow((x1-x2),2)+Ma...
ffb18ddd-0f4a-45fb-8da2-3a5d4fe076ae
1
public Unit getUnit(int x, int y) { if(inMap(x, y)) //Make sure unit is in map { return grid[x][y].getUnit(); } return null; }
c964a1fa-1934-438a-bcd4-46a950db718b
4
public SignalAspect determineAspect(WorldCoordinate otherCoord) { if (isWaitingForRetest() || isBeingPaired()) return SignalAspect.BLINK_YELLOW; if (!isPaired()) return SignalAspect.BLINK_RED; SignalAspect otherAspect = SignalAspect.GREEN; SignalBlock other = getS...
6e572acb-fe9a-4160-88f6-78085fbe58b8
6
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; RequestToken that = (RequestToken) o; if (httpClient != null ? !httpClient.equals(that.httpClient) : that.h...
a8f8bba2-b29e-45b6-93a8-e32ce703157e
8
public void parkVehicle(Vehicle v, int time, int intendedDuration) throws SimulationException, VehicleException { if (v instanceof Car && ((Car) v).isSmall() == false && spacesAvailable(v) == true) { v.enterParkedState(time, intendedDuration); spaces.add(v); incomingVehicleMonitor(v); } else if (v ...
c380e033-15d4-4a28-afa1-6ddd050750d6
7
private void jTree1ValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_jTree1ValueChanged // TODO add your handling code here: projectsCbo.removeAllItems(); elementsCbo.removeAllItems(); assetCbo.removeAllItems(); DefaultMutableTreeNode pnode2 = ne...
5f24d6a8-dd38-498e-89a6-68110c414e0a
8
public boolean isTrue(State state, String[] params) { ObjectInstance space = state.getObject(params[1]); // Since no subgoal for this ingredient is applicable to the switch action, ignore it! if (this.subgoal == null) { return false; } String subgoalClassName = this.subgoal.getGoal().getClassName(); i...
48419470-9eab-4ca0-a3e7-22257188a119
0
public CheckResultMessage checkDayofMonth4() { return checkReport1.checkDayofMonth4(); }
56de76cc-9692-4bf6-a6a6-b08519792879
0
public void IncrementPriority() { //increment priority level at the stop priority += 1; }
913e8e6d-9a4a-4a03-9cee-81e9015bdd27
8
@Override protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof HttpRequest){ receivedBytes = msg.toString().length(); HttpRequest req = (HttpRequest) msg; // Handle a bad requests. if (!req.getDecoderResult...
d622ebcf-0406-41e1-be85-00c98ae271ef
8
private static boolean a2 (int i, int j, BufferedImage image) { boolean left = ((image.getRGB(i-1, j-1) == BLACK) || (image.getRGB(i-1, j ) == BLACK) || (image.getRGB(i-1, j+1) == BLACK)); boolean with = ((image.getRGB(i, j-1) == WHITE) && ...
e378aa3c-1620-4e88-a856-30844e181186
6
protected void tunnel(final Socket internal, final Socket external) { this.logger.info("Established tunnel between " + StringUtils.formatSocket(internal) + " and " + StringUtils.formatSocket(external)); this.executor.execute(new TunnelThread(external, internal)); try { SocketUtils.copy(internal, ext...
217c7aeb-41e7-48f1-b015-25fadde99c30
0
public void setDirs(int north, int south, int east, int west){ this.north = north; this.south = south; this.east = east; this.west = west; }
c37fb406-a847-4deb-9a7c-42b47075ce46
9
public void run() { final String methodName = "run"; while (running) { try { // If no work is currently available, then wait until there is some... try { synchronized (workAvailable) { if (running & messageQueue.isEmpty() && completeQueue.isEmpty()) { // @TRACE 704=wait for work...
96b310ad-23df-4f15-b30e-1087827ab718
0
public void kill() { this.alive = false; }
ae83ed93-0997-4f41-b7a8-414fe42dd5c3
9
public DiceModule() { super("DICE", "v1.0", "Adds dice rolling."); addCommand("ROLL", new BotAction() { @Override public void execute(String[] params, String sender, String recipient) { java.util.Random rng = new java.util.Random(); int sides = 6; int count = 1; if (params.length > 0 && !para...
89c1015c-e0b4-4752-921f-6663cebe1a1e
1
@Test public void testEmptyTagPaymentStatus() throws Exception { System.out.println("ApiCommandsFacadeImplTest ---> testEmptyTagPaymentStatus"); File file = new File( "src/test/java/ru/arsenalpay/api/unit/support/api_empty_field_payment_status_response.xml" ); InputS...
4218d986-2d2f-46dc-bdc3-63a7fd81f260
2
public int getInt(String key) throws JSONException { Object object = this.get(key); try { return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object); } catch (Exception e) { throw new JSONException("JSONObject[" ...
0d45fc49-bc66-4526-b921-bd2539b59284
7
public static void majTypeCaddie (String val, Vector<Caddie> toInsert) throws BDException { String requete = "update config set type_cad ="; if (val.compareTo("PERSISTANT") == 0) requete+="'P'"; else if (val.compareTo("VOLATILE") == 0) requete+="'V'"; else requete+=val; Statement stmt = null; Prep...
b7804622-c3ee-49b0-8955-b5c221f2248a
7
private void correctOpinionClusters(ArrayList<OpinionCluster> ocs) { OpinionCluster o1,o2; ArrayList<OpinionCluster> toRemove = new ArrayList<OpinionCluster>(); ArrayList<OpinionCluster> toAdd = new ArrayList<OpinionCluster>(); for(int i = 0; i < ocs.size(); i++) { o1 = ocs.get(i); for(int j = i+1; j < oc...
228a0a5d-7750-40f9-a568-26900fc1b331
0
public static int nextGreaterPowerOf2(int number) { return 1 << greater2PowersExponent(number); }
52de7b6c-de7f-4a1d-a2b3-2d92f6e29cf6
2
public Deck(){ int[] suitList = {1,2,3,4}; int[] valueList = {1,2,3,4,5,6,7,8,9,10,11,12,13}; for (int suit : suitList){ for (int value : valueList){ deck.add(new Card(value,suit)); } } }
9c1f4e33-50ed-43af-95b2-12777084c65f
9
private String makeAbsolute(String url, String link) { if (link.matches("http://.*")) { return link; } if (link.matches("/.*") && url.matches(".*$[^/]")) { return url + "/" + link; } if (link.matches("[^/].*") && url.matches(".*[^/]")) { return url + "/" + link; } if (link....
1ee57c73-4354-494e-9561-d070f66add89
4
@Override protected Result doInvoke(Invocation invocation) throws Throwable { Socket socket = new Socket(tpURL.getHost(), tpURL.getPort()); Result result = null; try { ObjectInputStream ois = new ObjectInputStream(socket.getInputStream()); ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStr...
e4aab40d-a16a-4b01-bc8b-f556e1f06e00
3
public synchronized int getAmount() { int retVal = amount; if (retVal != 0) { if (state == STATE_RELEASED) { amount = 0; } else if (behavior == DETECT_INITAL_PRESS_ONLY) { state = STATE_WAITING_FOR_RELEASE; amount = 0; ...
007fed86-bb8a-406a-bb75-2af9f3e6c9a4
5
private void acknowledge(NetMessage n) { ReplyMessage r = n.getReplyMessage(); switch (r.getType()) { case NAME_AVAIL: chatMenu.nameConfirmed(r.getString(),r.getStatus()); break; case NAME_SET: if (r.getStatus()) connection.send(NetMessage.newBuilder() .setType(MessageType.JOIN_CHAT) .b...
79684ef4-7a47-4e47-8fc0-daf35782e13f
1
public int getFuelPercent() { if(fuelCapacity <= 100) { double factor = 100 / fuelCapacity; // System.out.print("Factor = " + factor); double result = ((fuelLevel * factor) / (fuelCapacity * factor)) * 100; // System.out.println(", Result = " + result); return (int) result; } else { double resul...
c233a5e9-8a58-4591-952d-39ec3ef1bf05
1
public boolean equals(Object o){ return this.x == ((Point) o).getX() && this.y == ((Point) o).getY(); }
c165355a-e35e-4a80-89ee-e3434e74c0fa
4
@Override public void mouseMoved(MouseEvent e) { if (parts.isEmpty()) { setToolTipText("null"); } else { float sum = getPartSum(); Iterator<Entry<String, Integer>> it = parts.entrySet().iterator(); float last = 0; while (it.hasNext()) { Entry<String, Integer> entry = it.next(); ...
920043cd-341e-4313-8e6a-addc9493334b
7
@Override public void putAll(Map<? extends K, ? extends Double> m) { int n = m.size(); if (n == 0) return; if (n > threshold) // conservatively pre-expand resize(capacity(n)); for (Entry<? extends K, ? extends Double> e : m.entrySet()) put(e.getKe...