method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d2d76d3c-d9d1-4db9-9843-2b458699165b
6
protected int getVersionIndex(String romId) { switch (romId) { case "BRBJ0": return 0; case "BRKJ0": return 1; case "BRBE0": case "BRBP0": return 2; case "BRKE0": case "BRKP0": return 3; default: throw new IllegalArgumentException("Unknown ROM ID \"" + romId + "\"."); ...
7ebe5d0b-683e-4a60-9968-7d4603d972d3
4
public static void main(String[] args) { Scanner number = new Scanner(System.in); System.out.println("Enter number to check Prime : "); int chk = number.nextInt(); int i; if( chk == 2){ System.out.println(chk +" Number is prime "); }else{ for( i=2; i<=chk-1; i++){ if...
b9abbd7d-b2cd-49ba-836a-22c53fece0be
8
@Override public void resize(BufferedImage srcImage, BufferedImage destImage) throws NullPointerException { super.performChecks(srcImage, destImage); int currentWidth = srcImage.getWidth(); int currentHeight = srcImage.getHeight(); final int targetWidth = destImage.getWidth(); final int targetHeigh...
0dea88ca-7527-4767-8039-e0c47c7a1282
8
private void generatePrimitiveWriter(CodeVisitor cw, Method method, String className) { String fieldName = makeFieldName(method); Class type = getClassOfMethodSubject(method); cw.visitVarInsn(ALOAD, 0); if (type == int.class...
6305c4cb-2137-463f-8c4b-6a30a46a3615
7
public static String plumpColumnName(final String kin, final Set<String> seen) { String k = kin.toUpperCase(); final int colonIndex = k.indexOf(':'); if(colonIndex>0) { // get rid of any trailing : type info k = k.substring(0,colonIndex); } k = stompMarks(k).replaceAll("\\W+"," ").trim().replaceAll("\\...
52cdd651-f72f-406a-bc33-fc1a4113bb65
9
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (response.isCommitted()) { return; } String uri = request.getRequestURI(); String context = request.getContextPath(); if (uri.endsWit...
b36a3fb7-fcc6-45a7-a3db-a4c06450c522
6
@SuppressWarnings("unchecked") @Override public void refreshView(Map<String, Map<String, Object>> state) { // Extract the maps from the state // Map<String, Object> mapState = state.get("mapState"), dayState = state .get("dayState"); LinkedList<Map<String, Object>> elementList = (LinkedList<Map<String, O...
ea377202-2d27-4568-a182-f5987808063c
3
public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int inpay=sc.nextInt(); int iapay=sc.nextInt(); if(iapay < inpay){ System.out.println("null"); return; } if((iapay-inpay)>100){ System.out.println("null"); return; } if(iapay ==...
ff044939-78a6-4ae9-87c7-5e676ce5c0c4
4
@Override public void setNegativeFlag(boolean flagIsOn) { try { Image img; if (flagIsOn) { img = ImageIO.read(getClass().getResource("/resources/vdk-light-colour.png")); if (!CECIL_RESOLUTION.equals(CECIL_RESOLUTION_HIGH)) { img = img.getScaledInstance(ICON_SMALL.width, ICON_SMALL.height, Image.SC...
ca8a36a6-82ed-49b8-b919-3717e31ce450
1
public void printInfos(Graphics g) { if (inEditor) level.printInfo(g, player.getPos(), player.getVisibility()); }
aaf73195-fe2e-40d1-83f0-c054b9a22a68
7
static void dradf4(int ido,int l1,float[] cc, float[] ch, float[] wa1, int index1, float[] wa2, int index2, float[] wa3, int index3){ int i,k,t0,t1,t2,t3,t4,t5,t6; float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; t0=l1*ido; t1=t0; t4=t1<<1; t2=t1+(t1<<1); ...
d33e81df-2e6f-4563-aa44-8b90985b9bcf
2
@Override public void run() { try { countDownLatch.await(); } catch (InterruptedException e) { e.printStackTrace(); } try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out...
6ec03f78-4b61-4c4c-9b18-c3b19407e2c6
2
public static void addFriendship(String username1, String username2) { User user1 = getUserByUsername(username1.trim()); if (user1 == null) { System.out.println("User " + username1 + " NOT FOUND"); } User user2 = getUserByUsername(username2.trim()); if (user2 == null) { System.out.println("User " + user...
36bc3df3-ad76-4a6c-a141-ac54497ae60f
6
public void run() { for (int id : Equipment.getAppearanceIds()) if (id != -1) equipIds.add(new PkItem(id, 1, false)); for (Item item : Inventory.getItems()) { if (item == null || item.getId() == -1) continue; PkItem pkItem = get(invItems, item.getId()); if (pkItem == null) invItems.add(new P...
ddfd3b70-d0a2-43c0-93d7-d30c35b16e02
1
public static Object getField(Field field, Object target) { try { return field.get(target); } catch (IllegalAccessException ex) { handleReflectionException(ex); throw new IllegalStateException( "Unexpected reflection exception - " + ex.getClass().getName() + ": " + ex.getMessage()); } }
435b62e8-9a32-4a0a-a7e8-c2bf395980da
5
@Override public int indexOf( Object elem ) { if( elem == null ) { for( int i = 0; i < size; i++ ) { if( elementData[i] == null ) { return i; } } } else { for( int i = 0; i < size; i++ ) { if( elem.equals( elementData[i] ) ) { return i; } } } return -1...
e97f8eaf-4369-43cd-8ba8-3f67850750ce
5
@Override public void actionPerformed(ActionEvent e) { GuiThreatSelection guiThreatSelection = GuiThreatSelection.getInstance(this); List<ThreatClass> threats = guiThreatSelection.getSelectedThreats(); if (guiThreatSelection.getComponentMenuItem() instanceof MenuItemApplet) { String url = JOptionPane.show...
281023a0-8926-4cf5-a60d-e9de714decbb
8
public void draw(Point point){ switch (selectedTool) { case IMAGE: createImage(point); break; case TEXT: createText(point); break; case LINE: drawLine(point); break; case RECTANGLE: drawRect(point); break; case ELLIPSE: drawEllipse(point); break; case MOVE: hand(point); ...
96cd7439-338e-4c82-944f-a49d53fb06d2
9
public KeyPair generate() { BigInteger p, q, n, d; // 1. Generate a prime p in the interval [2**(M-1), 2**M - 1], where // M = CEILING(L/2), and such that GCD(p, e) = 1 int M = (L+1)/2; BigInteger lower = TWO.pow(M-1); BigInteger upper = TWO.pow(M).subtract(ONE); byte[] kb = n...
44ab5c52-993d-4144-a137-1c73e453c432
6
@Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { if (!"/remoteConsole".equals(request.getPathInfo())) { // Not for us return false; } int contentLength = request.getContentL...
671e030e-377a-49b5-81e4-cdc340fc0d5b
6
@Test public void shaMethodTest() throws IOException { String result = null; TeleSignRequest tr; if(!timeouts && !isHttpsProtocolSet) tr = new TeleSignRequest("https://rest.telesign.com", "/v1/phoneid/standard/" + PHONE_NUMBER, "GET", CUSTOMER_ID, SECRET_KEY); else if(timeouts && !isHttpsProtocolSet) tr ...
7e573b73-66ea-4806-b605-2e8ac6ca1ec1
0
public void setCity(String city) { this.city = city; }
0837d6ad-85e4-46aa-b01d-26ca41b8f858
3
@Override public void deserialize(Buffer buf) { int limit = buf.readUShort(); positionsForChallengers = new short[limit]; for (int i = 0; i < limit; i++) { positionsForChallengers[i] = buf.readShort(); } limit = buf.readUShort(); positionsForDefenders = ne...
4ebe51cb-beb8-4c1e-9686-c22a4220e9aa
1
public void testUnmatchedOpenParenthesis() throws Exception { String openParenString = "(3 + 5"; try { new Expression(openParenString); fail("Did not throw exception"); } catch (MalformedParenthesisException mpe) {} }
56ba2bb7-f76e-4d2b-970c-198c6af72833
3
public void setUpComparisonBars() { overBars.clear(); underBars.clear(); float toScale = 0.05f; for (int i = 0; i < nbars; i++) { int over = beatMarket.histogram[i]; int under = marketBeat.histogram[i]; int absDiff = Math.abs(over - under); int top = (int) (frameH - SIDE_BUFFER - (int) (toScale * ...
6afc488e-d6c0-48f5-b333-684ac1d27d37
3
public void setEntityDead(Entity var1) { if (var1.riddenByEntity != null) { var1.riddenByEntity.mountEntity((Entity) null); } if (var1.ridingEntity != null) { var1.mountEntity((Entity) null); } var1.setEntityDead(); if (var1 instanceof EntityPlay...
baabcef7-e1f7-4690-bed5-8eea6b1c8167
3
public void setRefreshing(boolean refreshing) { if(refreshJob == null) { refreshJob = new RefreshJob(); } boolean prev = isRefreshing; isRefreshing = refreshing; if(refreshing && !prev) { Thread t = new Thread(refreshJob); t.start(); } }
13c6a4bf-a57c-4518-a1d4-a7d3c67fae6f
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Perifericos)) { return false; } Perifericos other = (Perifericos) object; if ((this.idPeriferico == null && oth...
ad5b3573-d3fd-4f32-93e1-0b83608a2d62
8
@Test public void testGetDescriptionFirstPhone() { Map<String, Object> descriptionFirstPhone = new HashMap<String, Object>(); descriptionFirstPhone.put("name", "Cink Five"); descriptionFirstPhone.put("brandName", "Wiko"); descriptionFirstPhone.put("screenSize", 5); descriptionFirstPhone.put("screenType", Scr...
2c46c569-f880-4ec2-a456-981d37d6123b
7
public static boolean distanciaUnaLetra (final String cad1, final String cad2){ if (cad1.length() == cad2.length() ){ final String cadena1 = cad1.toUpperCase(LOCALE_ES); final String cadena2 = cad2.toUpperCase(LOCALE_ES); for (int i = 0; i < cad1.length(); i++){ ...
fe028ac6-e7ea-4a3e-aa74-410067615423
9
public void fill(byte[] b) { int coordinate = 0; storagePointer = NumberUtils.byteArrayToInt(Arrays.copyOfRange(b, coordinate, coordinate + 4)); coordinate += 4; int parent_storagePointer = NumberUtils.byteArrayToInt(Arrays.copyOfRange( b, coordinate, coor...
a863b43f-3898-49ad-b92f-acf6efd4f597
6
public SampleResult runTest(JavaSamplerContext context) { SampleResult sampleResult = new SampleResult(); sampleResult.sampleStart(); String key = null ; if(keyRondom){ key = String.valueOf(String.valueOf(new Random().nextInt(keyNumLength)).hashCode()); }else{ key = String.valueOf(SequenceKey.getsequenc...
f21094a0-95b9-4387-bdf2-4b0a24950b6e
1
public void save(Map map){ File f = new File("assets/maps/" + map.getName()); try { biEx.save(map, f); } catch (IOException ex) { Logger.getLogger(MapLoader.class.getName()).log(Level.SEVERE, null, ex); } }
78fca4d2-3d58-4108-92a0-6a24c6d47ef2
3
* @return Returns true if the cell is bendable. */ public boolean isCellBendable(Object cell) { mxCellState state = view.getState(cell); Map<String, Object> style = (state != null) ? state.getStyle() : getCellStyle(cell); return isCellsBendable() && !isCellLocked(cell) && mxUtils.isTrue(style, mxCons...
77f7ef6d-020e-43b9-a855-82e2bd174f51
6
@Override protected Class<?> loadClass(String name, boolean resolve) { try { if ("outpost.sim.Player".equals(name) || "outpost.sim.Point".equals(name) || "outpost.sim.Pair".equals(name) || "outpost.sim.movePair".equals(name)) return parent.loadClass(name); ...
a311dfd8-9eaa-4190-aa13-200c47479e8d
7
@Override public void initialise() { for (int client = 0; client < 8; client++ ) { int arrival = masterAgent.agent.getClientPreference(client, TACAgent.ARRIVAL); int departure = masterAgent.agent.getClientPreference(client, TACAgent.DEPARTURE); int cheapAuctionNo = TACAgent.getAuctionFor(TAC...
78c1a32f-cfe5-40b8-bea8-f11881b25401
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...
c8e0f1f7-409c-418e-b4dd-1aeca703deb9
5
private void initToolbar(JToolBar toolBar) { //NEW BUTTON - creates a new simulation with a new turing machines JButton btnNew = createIconButton("/icons/ic_new.png", TOOLBAR_BUTTONSIZE); btnNew.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { TuringMachin...
f951c668-b56c-41ec-8caa-894857d23af0
1
public void read() throws IOException { if (!cached) { next(); } cached = false; }
7d9dc9ad-769c-4640-ad65-ed5035ebd99c
9
@Post public Representation accept(Representation entity) throws IOException { try { host = (getRequestAttributes().get("host") == null) ? host : ((String) getRequestAttributes().get("host")).trim(); port = (getRequestAttributes().get("port") == null) ? port : Integer.parseInt(((String) get...
d45cea0f-9a16-4b95-a2ed-813440e5fc34
2
private String createUserList() { FilmothekModel model = new FilmothekModel(); ArrayList<UserBean> users = model.getUsers(); String userList = "<select name='userID' size='1'>"; for (Iterator<UserBean> it = users.iterator(); it.hasNext();) { UserBean userBean = it.next(); ...
d084ff7c-e62c-4e12-a1ce-e05c5d2fb3fa
4
public Image[] getCells(ImageRetriever paramImageRetriever, int paramInt1, int paramInt2) { Integer localInteger = new Integer(paramInt1); if (this.animationList == null) this.animationList = new Hashtable(); Object localObject = this.animationList.get(localInteger); Image[] arrayOfImage; if...
d1e329cb-120c-4a4d-977b-29b187d9652c
4
@Override public String toString(){ StringBuilder sb = new StringBuilder(); // start line String name = this.getNameAndupspace(); if(null!=name){ sb.append(name); }else{ // please set directiveName return null; } for(int i=0;i<listParam.size();i++){ if(null != listParam.get(i)){ Strin...
fb1f4dad-6f4e-44f7-8e9c-68d5f0b4f826
7
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost,msg); if((affected instanceof Item) &&(((Item)affected).owner() instanceof Room) &&(((Room)((Item)affected).owner()).isContent((Item)affected)) &&(msg.sourceMinor()==CMMsg.TYP_SPEAK) &&(invoker!=null) ...
06bfd103-9817-4728-8ee1-d293e95791b6
9
private void treeClicked(MouseEvent e) { TreePath selPath = this.tree.getPathForLocation(e.getX(), e.getY()); if (selPath == null) return; DefaultMutableTreeNode node = (DefaultMutableTreeNode) selPath .getLastPathComponent(); Object userObj = node.getUserObj...
7a8cf494-5f08-4f97-a27c-1daa5d9f9cb7
5
public static int priority(String operator) { if (operator.equals("+") || operator.equals("-")) return 1; else if (operator.equals("*") || operator.equals("/")) return 2; else if (operator.equals("^")) return 3; else return 0; }
dca9ab5e-94f8-4054-9e37-becf231969b5
8
public int minCut(String s) { // Start typing your Java solution below // DO NOT write main() function int n = s.length(); if (n <= 1) return 0; boolean[][] res = new boolean[n][n]; int[] dp = new int[n]; for (int i = 0; i < n; i++) res[i][i] = true; // 第一层初始化 for (int i = 1; i < n; i++) { int ...
01f31ebf-33c4-4785-9923-0259c83951d5
6
@Test public void testInvert() { /* * Test with constant values. */ gf = new GF2N(283); PolynomialGF2N polyGF = new PolynomialGF2N(gf); Polynomial polynomial1 = new Polynomial(3); polynomial1.setElement(0, 195); polynomial1.setElement(1, 103); ...
f2ba11bf-98d4-4fa5-af2f-626cc5fec7e3
9
private void connectForest() { List forest = new ArrayList(); Stack stack = new Stack(); NodeList tree; graph.nodes.resetFlags(); for (int i = 0; i < graph.nodes.size(); i++) { Node neighbor, n = graph.nodes.getNode(i); if (n.flag) continue; tree = new NodeList(); stack.push(n); while (!sta...
bd73ac12-f994-4ced-ba33-22d17d6c8ba9
2
public static void listMembers(){ ArrayList<beansMiembro> listaMembers = null; listaMembers = ManejadorMiembros.getInstancia().getLista(); if(listaMembers.size() >= 0){ for(beansMiembro miembro : listaMembers){ mostrarMiembro(miembro, 0); verAdentro(miembro,1); } }else{ System.out.println("No ...
9310a969-a444-45ca-ab87-dcff90db17a6
7
private static void test(String input, String output, int v, String dir) { int n = input.length(); boolean[] voters = new boolean[n]; int i; /* convert the string into an array of booleans */ for (i = 0; i < n; i++) { voters[i] = (input.charAt(i) == 'A'); } Opinion.update(voters, v); /* check the outp...
382e8f1a-a0a9-4ca6-b04b-f9c55e4ba42b
2
public void doGet(HttpServletRequest request, HttpServletResponse response) { response.setContentType("text/html");//设置服务器响应的内容格式 // response.setCharacterEncoding("gb2312");//设置服务器响应的字符编码格式。 DButil ab = new DButil(); try { PrintWriter pw = response.getWriter(); St...
806675da-5ead-46c2-b030-6684fc124a34
9
public Type getType(Environment<Type> env) throws TypeIllegalException, TypeEnvironmentException { Token op = getChild(1).jjtGetFirstToken(); Type left = getChild(0).getType(env); Type right = getChild(2).getType(env); if (op.kind == PseuCoParserConstants.PLUSASSIGN) { if (right.getKind() == Type.STRING...
54de3e27-0a0a-462c-942c-cb82c3c60ffc
9
public static String guessEmotion(String s) { int sad = 0; int happy = 0; int angry = 0; String v = s.toLowerCase().trim(); String result = "I cant guess your emotion."; File file = new File("help/emo.txt"); ArrayList<String> emoTXT = IOTools.readFile(file); for (String n : emoTXT) { String args[] =...
5bc52335-dd5f-409c-8155-496c789ef0d6
5
@Override public ZemObject eval(Interpreter interpreter) { if(arguments.size() < 1){ return null; } Node node = arguments.get(0); UserFunction fun = null; if(node instanceof VariableNode){ fun = (UserFunction) interpreter.getSymbolTable().get(((Vari...
e3f99e2e-5a59-48bd-8763-cfd44aaec812
1
public static byte[] Kinverse(byte[] t, BigInteger n, int L) { byte[] output = new byte[L]; for (int i = 0; i < L; i++) { output[i] = t[(int) kappa(t.length, n, i + 1)]; } return output; }
87fdb8f2-0562-4e96-b816-607ce724d3f6
9
@Override public void parseXML(String xml) { final List<XMLLibrary.XMLTag> V=CMLib.xml().parseAllXML(xml); if((V==null)||(V.size()==0)) return; final List<XMLLibrary.XMLTag> xV=CMLib.xml().getContentsFromPieces(V,"AREAS"); root.clear(); String ID=null; String NUMS=null; if((xV!=null)&&(xV.size()>0)) ...
79d37aea-0cd1-4e37-bf52-0db494e1958e
6
public void doTraining(Team team) { // with injuries int nofPlayers = team.getNofPlayers(); for (int i = 0; i < nofPlayers; i++) { Player player = team.getPlayer(i); int ranRange; if (getEffort() == Effort.EASY) { ranRange = 230; } else if (getEffort() == Effort.NORMAL) { ranRange = 200; } ...
e21aa58d-40ec-4e44-abb0-1789d1f06fb3
0
public String getName() { return name; }
3b46148b-129d-4174-9131-73c8ca8305c8
4
@Override protected boolean shouldBlock(Entity e) { if (e instanceof Bullet) return false; if ((e instanceof Mob) && !(e instanceof RailDroid) && !((Mob) e).isNotFriendOf(owner)) return false; return e != owner; }
bd83bf74-99b4-4484-a02b-2023d5c8c5dc
5
@Override public void deserialize(Buffer buf) { alignmentSide = buf.readByte(); alignmentValue = buf.readByte(); if (alignmentValue < 0) throw new RuntimeException("Forbidden value on alignmentValue = " + alignmentValue + ", it doesn't respect the following condition : alignmentV...
25049d2c-7661-47ad-9a79-01580f895363
2
private static void createStone(int width, int height) { for(int x = 0; x < width; x++) { for(int y = stoneBoundary; y < height; y++) { blockSheet[x][y] = World.STONE; } } }
be66f4de-3aa5-489b-967a-bcdceb601c5c
6
public void printArray(PrintableStringWriter stream) { { two_D_array self = this; { int nofRows = self.nofRows; int nofColumns = self.nofColumns; int limit = 9; stream.print("|i|["); { int row = Stella.NULL_INTEGER; int iter000 = 0; int upperBound000 = nof...
e46a7851-aae0-4e9a-9104-2fa80d162452
9
int afterRoot() throws IOException { int n = in.next(); switch (n) { case ' ': case '\t': case '\r': case '\n': in.back(); String ws = parseWhitespace(in); if (!isIgnoreWhitespace()) { set(JSONEventType.WHITESPACE, ws, false); } return AFTER_ROOT; case -1: return -1; case '{': ca...
bd47505c-bec9-474c-bbe8-f4f0df0ae963
0
@Override public void setDataObject(IRemoteCallObjectData data) { this.data = data; }
4858bc9e-fe0d-4477-b830-fac654a6a9fa
7
public void setOptions(String[] options) throws Exception { String numFolds = Utils.getOption('F', options); if (numFolds.length() != 0) { setNumFolds(Integer.parseInt(numFolds)); } else { setNumFolds(0); } String numRuns = Utils.getOption('R', options); if (numRuns.length(...
7f0c27e0-f4bf-471e-a554-198cbb35171d
5
private void toPixel(int[][] matrix, int h, int w) { for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { double re = fd[j * h + i].re(); double im = fd[j * h + i].im(); int ii = 0, jj = 0; int temp = (int) (Math.sqrt(re * re + im * im) / 100); if (temp > 255) temp = 255; if ...
4a686dae-1c20-4b79-8701-9b24a96b8686
9
public Board boardEquiv() { Board b = new Board(); for (int x = 0; x < 8; x++) { for (int y = 0; y < 8; y++) { DerpyPiece p = arr[x][y]; boolean pieceColor = p.getColor(); Piece db = null; if (p instanceof DerpyBishop) { db = new Bishop(pieceColor); } else if (p instanceof DerpyBlank) ...
43262bad-99eb-4e31-923a-c7509763626f
9
int evaluateState(Checker[][] state) { int whiteNumber = 0; int blackNumber = 0; for (int row = 0; row < 8; row++) { for (int col = 0; col < 4; col++) { if (state[row][col] != null) { if (state[row][col].getColor() == 1) { w...
ee066a0a-afda-4e6c-8ab0-92547ce20fa1
1
public void setPrice(double price) { if (price <= 0) { throw new IllegalArgumentException("Price should be bigger than zero"); } this.price = price; }
556c1a93-263a-4842-a473-2fccc1d1a8ac
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DataStructure that = (DataStructure) o; if (calibrationKey != that.calibrationKey) return false; if (implementedChannels != that.implementedCha...
9e10eb66-21dc-4623-a0df-2b48aaed5f8f
9
public boolean deathChecker() { if (state == GestureState.LIFE || state == GestureState.DEATH) { // If hand is below shoulder if (usingLeftArm) { if ((GestureInfo.gesturePieces[GestureInfo.LEFT_ARM_ANGLE_DECREASING]) || (!GestureInfo.gesturePieces...
42129e2b-745f-4a9d-8a30-b6acfb8af94a
4
private void endAudio(String to) { if (to.equals("slide")) slide.addEntity(audio); else if (to.equals("quizslide")) quizSlide.addEntity(audio); else if (to.equals("scrollpane")) scrollPane.addEntity(audio); else if (to.equals("feedback")) quizSlide.addFeedback(audio); }
ec0f37d9-f563-4731-b977-510285603063
0
public Rectangle getSecondCorner() { return secondCorner; }
aaf9905e-de17-49fd-80fb-8dea0e59690d
9
@Override public void execute() { Socket s = null; try { while (!stop && !runningThread.isInterrupted()) { try { s = serverSocket.accept(); } catch (SocketException se) { log.info("Received a shutdown request: " + se); stop = true; } catch (IOException ioe) { log.error("IO-error...
ff6583e0-41c1-486e-937f-bc3e92b81574
3
public boolean login() { if(!loaded || username.isEmpty() || password.isEmpty()) return false; Users.addUser(this); logins++; loggedIn = true; save(); System.out.println(username+" has logged in."); return true; }
779af798-92b6-4363-907f-4cf45ec25fe1
5
public int longestValidParentheses(String s) { // Start typing your Java solution below // DO NOT write main() function char[] c = s.toCharArray(); Stack<Integer> store = new Stack<Integer>(); int[] right = new int[c.length]; int res = 0; for (int i = 0; i < c.le...
ab67b73f-1658-475c-bc50-35ebdd56d409
8
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Employee employee = (Employee) o; if (id != employee.id) return false; if (firstName != null ? !firstName.equals(employee.firstName) : employee...
3b0aedb8-356f-4afd-a9f8-a492bf7f6b8d
6
public static Object[] isSignatureOK(Map<String, String> docEndorserInfo, Node node) { try { DOMValidateContext context = createContext(node); XMLSignature signature = extractXmlSignature(context); boolean coreValidation = signature.validate(context); if (coreValidation) { KeyInfo keyInfo = si...
6bc4e2cf-3a0e-42d2-8208-b4298810fca0
9
public ArrayList<AbstractCookie> populateCookies(){ cookies = new ArrayList<AbstractCookie>(); for (int i = 0; i < this.getSize(); i++){ for(int k = 0; k < this.getSize(); k++) if(i == 0 && k == 0){ cookies.add(new PoisonCookie(i, k)); } else if(i == 0 && k == 1){ cookies.add(new BlueCo...
af81278f-bc2a-4800-a904-71f3ef600fe7
8
public void simulateBullyBotAttack(){ Planet source = null; Planet dest = null; // (1) Apply your strategy double sourceScore = Double.MIN_VALUE; double destScore = Double.MAX_VALUE; for (Planet planet : planets) { if(planet.Owner() == 2) {// skip planets with only one ship if (planet.NumShips...
e80bd90a-26e8-4d67-9262-fbf10c8a789b
8
public String execute(DeleteCalendarObject deleteCalendarObject) throws SQLException{ String answer = ""; resultSet = queryBuilder.selectFrom("Calendars").where("CalendarName", "=", deleteCalendarObject.getCalendarToDelete()).ExecuteQuery(); resultSet.next(); String calendarID = resultSet.getString("calendarID"...
ab52174c-03e4-44bd-ace2-c93f3bfe5cb9
4
public static void showMessageDialog(Component parentComponent, String htmlContent, String title, int messageType, Icon icon) { // for copying style JLabel label = new JLabel(); Font font = label.getFont(); // create some css from the label's font StringBuffer style = new St...
5f423301-cf67-4f52-96eb-64923f3f3ef8
2
private int getInt(String test) { int page; try { page = Integer.parseInt(test); if (page < 1) { page = 1; } } catch (NumberFormatException e) { page = 1; } return page; }
e80a66c0-b353-4f7c-b75a-dbdcabe05fb7
2
private void destruction() { System.out.println("TestTesT"); if (!connectionSocket.isClosed()) { try { connectionSocket.close(); } catch (IOException e) { } } }
6a383aed-752e-49bb-ac5e-9f61554a7627
5
public void setWireSeparation(double separation){ if(separation<=0.0D)throw new IllegalArgumentException("The wire separation, " + separation + ", must be greater than zero"); if(this.wireRadius!=-1.0D && separation<=2.0D*this.wireRadius)throw new IllegalArgumentException("The wire separation distance, ...
c7fd3cf2-821c-478d-b908-ae9f0b9843ca
6
public void addfromIndex(String file){ try{ Scanner readFrom =new Scanner(new InputStreamReader (new FileInputStream(file))); if(file.equals("yourindex.txt")){ if(readFrom.hasNextLine()==false){ JOptionPane.showMessageDialog(null, "The file is probably empty.\nPlease click on \"Add...
0e7c51c4-ca10-4294-bd8e-54a973dd32bb
0
public void advice(String msg) { System.out.println("Called ..." + LoggerUtils.getSig() + "; msg:" + msg); }
fd8fb2fb-2bf1-4c9a-ab6c-5a750d980926
8
private String whichBinary(String type) { for (int i = 0; i < Expression.binaryTypes.length; i++) { if (type.equals (Expression.binaryTypes[i])) { if(type.equals("plus")||type.equals("minus")||type.equals("times") ||type.equals("divided by")) { return "operator"; } else if(type.e...
3b4af078-cb21-4b69-963b-55bed51f9a21
9
public boolean equals(Object otherO) { if (otherO == null) { return false; } if (!(otherO instanceof Picture)) { return false; } Picture other = (Picture) otherO; if (image == null || other.image == null) { return image == other.image; } if (image.getWidth() != other....
46e08298-7912-418c-80e3-f521dd221919
6
@EventHandler public void onClick(PlayerInteractEvent e) { Action action = e.getAction(); if (action == Action.RIGHT_CLICK_BLOCK) { Player player = e.getPlayer(); Location loc = e.getClickedBlock().getLocation(); if (e.getClickedBlock().getType() == Material.SIGN || e.getClickedBlock().getType() == M...
bd699e29-2268-4d52-823a-c541c33d1291
6
private void createObjectSpawnRequest(int delayUntilRespawn, int id2, int face2, int type, int y, int type2, int z, int x, int delayUntilSpawn) { GameObjectSpawnRequest request = null; for (GameObjectSpawnRequest request2 = (GameObjectSpawnRequest) spawnObjectList .peekLast(); request2 != null; request2 =...
e8fe0e31-3f2c-4010-acf6-c6774974c161
2
@Override public String toString() { if(getVariableType() == VariableType.STRING) { return (String) variable; } else if(getVariableType() == VariableType.INTEGER) { return variable+ ""; } else { return "function"; } }
29833ba4-b12b-4a52-96a9-668cd79bb2a1
3
public JSONWriter array() throws JSONException { if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') { this.push(null); this.append("["); this.comma = false; return this; } throw new JSONException("Misplaced array."); }
c66581b6-8093-4edf-a48b-c787e22616be
3
private void doCollision(int pin1, int pin2, Vector3f distance, boolean clatter) { Debug.println("PhysicsEngine.doCollision()"); MovableObject[] pins = model.getPins(); MovableObject p1 = pins[pin1]; MovableObject p2 = pins[pin2]; Vector3f p1v = p1.getVelocity(); Vector3f p2v; float m1 = p1.getMass(); f...
1ed19570-7334-4cdd-95f5-cfd9060f5096
3
public int getIndex(ArrayList<Person> list) { String[] values = null; if (supplierComboBox.getSelectedItem() != null) { values = ((String) supplierComboBox.getSelectedItem()).split("\\t"); int index = 0; for (Person person : list) { if (person.getId() == Integer.parseInt(values[1].trim())) break; ...
93a7fea0-1b9e-4907-b2bb-d437c7f81d0a
0
public Path() { movement = new int[Game.map.width][Game.map.height]; pathColor = new Color(0, 75, 255, 128); attColor = new Color(255, 0, 0, 128); walkColor = new Color(0, 255, 144, 128); font = new Font("Arial", Font.PLAIN, 15); }
dd945b9b-1092-47b0-a32f-813af53e3643
7
@Override public Data execute(Data data) { String[] strings = data.getText().split(" "); Color color = Color.black; if (strings.length >= 1) { try { color = stringToColor(strings[1]); } catch (NoSuchFieldException e) { return null; } catch (SecurityException e) { e...
b2c830bd-c4bf-4ea2-9751-4dafa714388f
9
public void placeCollectableBlock(Player p, Color c){ //do check for collision with other world items String path = null; if(c == Color.red){ path = COLLLECTABLEBLOCK_RED_PATH; }else if(c == Color.green){ path = COLLLECTABLEBLOCK_GREEN_PATH; }else if(c == Color.blue){ path = COLLLECTABLEBLOCK_BLUE_PA...
5d80d77e-58a9-4686-ae71-358caf431047
1
public T pop() { if(nodes.size() == 0) return null; T t = nodes.get(0); nodes.remove(0); return t; }