method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b08e8978-f631-4b95-a9d9-3e8047f28912
4
public final TLParser.orExpr_return orExpr() throws RecognitionException { TLParser.orExpr_return retval = new TLParser.orExpr_return(); retval.start = input.LT(1); Object root_0 = null; Token string_literal109=null; TLParser.andExpr_return andExpr108 = null; TLParser....
21dbfb6f-c271-41a7-b3d2-34aafed09ca2
3
private void processLogout() { // resetLogout try { if (socketStream != null) { socketStream.close(); } } catch (Exception exception) { } socketStream = null; loggedIn = false; loginScreenState = 0; // myUsername = ""; ...
7181b0f0-a030-4eb8-b435-b06df6d35833
4
public byte[] toByteArray(){ ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutput out = null; try { out = new ObjectOutputStream(bos); out.writeObject(this); return bos.toByteArray(); }catch(Exception e){e.printStackTrace(); return null;} finally { try {if (out != null) {out.c...
c592a21a-f03c-4a71-9e30-88529d6c0ea4
6
@Override public void run() { while (true) { Input msg = m.get(); DataOutputStream out; int[] msgarr = msg.getMessage(); Iterator<Socket> it = allConnections.iterator(); while (it.hasNext()) { Socket s = it.next(); if (!s.equals(msg.getSocket())) { try { out = new DataOutputStream(...
c3aeb341-c9c3-4ddf-a19e-285efeb1b1f7
4
public void visitIincInsn(final int var, final int increment) { if (var > 255 || increment > 127 || increment < -128) { minSize += 6; maxSize += 6; } else { minSize += 3; maxSize += 3; } if (mv != null) { mv.visitIincInsn(var, i...
6ceb77cc-2b87-454a-bf8c-4794a9daf914
2
public AnnotationVisitor visitAnnotation( final String name, final String desc) { buf.setLength(0); appendComa(valueNumber++); if (name != null) { buf.append(name).append('='); } buf.append('@'); appendDescriptor(FIELD_DESCRIPTOR, desc); ...
2fe157ed-9674-4dba-99bb-b06a2cd901b3
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Persona other = (Persona) obj; if (this.ci != other.ci) { return false; } if ...
4778057e-523c-4dc7-99b4-2d00b49d4d7e
8
private void renderShadow(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderEngine var10 = this.renderManager.renderEngine; var10.bindTexture(var10....
318ec080-daa4-42cf-bdc6-1a1ed42ce227
9
public static AIMove toAvoid(AIHockeyist hockeyist, AIPoint target) { AIManager manager = AIManager.getInstance(); AIRectangle rink = manager.getRink(); double maxDistance = 130; AIPuck puck = manager.getPuck(); List<AIHockeyist> opponents = new ArrayList<AIHockeyist>(); ...
d4b43a5c-9c62-4373-982d-1b402657b97d
0
public int getAxisCount() { return axes.size(); }
0725d8f4-b855-4255-8b51-0a0eb12eda9f
4
private void removeBallFromStrand(CurrentBall b) { switch(b.getStrand()) { case 0: inPlayOne.remove(b); break; case 1: inPlayTwo.remove(b); break; case 2: inPlayThree.remove(b); break; case 3: inPlayFour.remove(b); break; } }
f5f0f152-2b71-44dd-97c4-42c57b2e5ca9
0
public void setArea(String area2) { this.area = area2; }
f3f4e824-b286-44a0-99b3-347bd6a2ed02
5
public void draw(){ if(render){ if(interaction) sortingTriangle.draw(); for (FBOTextBox cell : cells.values()) { cell.draw(); } for (LineElement line : lines.values()) { line.draw(); } for (Button button : buttons.values()) { button.draw(); } } }
203e4ba5-87e1-4fff-b2d5-9259a8f18abf
0
public void setPass_code(String passCode) { pass_code = passCode; }
d2081082-d92a-4fb2-992b-6270a99a3b87
1
public String cut(String[] args, int end, String separator) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < end; i++) { builder.append(args[i] + separator); } return builder.toString(); }
d9547425-8620-4877-bbb9-29d2b4a44f9a
1
private void clearDragState() { if (mDragState != null) { boolean forHeader = mDragState.isHeaderFocus(); boolean forContents = mDragState.isContentsFocus(); mDragState = null; redrawDragHighlight(forHeader, forContents); } mAlternateDragDestination = null; }
0b55c259-1d27-4c4c-ae95-f482996defb2
3
static double[][] derivativeMatrix(int degree){ double[][] matrix = new double[degree + 1][degree + 1]; for(int i = 0; i < matrix.length; i++){ for(int j =0; j < matrix.length; j++){ if(i == j-1){ matrix[i][j] = i + 1; }else{ matrix[i][j] = 0; } } } return matrix; }
54625660-4758-4fce-a4bd-d86e3d8b3530
4
void checkExclusivity( BitSet[] barray ) throws Exception { for ( int i=0;i<barray.length;i++ ) { for ( int j=0;j<barray.length;j++ ) { if ( i != j ) { BitSet bs = new BitSet(); bs.or( barray[i] ); ...
0f965f13-87b4-457f-9f67-c2ca183a271d
2
public void calcTargets(int index, int step) { int numOfSteps = step; calcAdjacencies(index); visited.set(index, true); for (int i = 0; i < adjMatrix.get(index).size(); i++) { visited.set(adjMatrix.get(index).get(i), true); if (numOfSteps == 1) { targets.add(adjMatrix.get(index).get(i)); } else ...
54ff4ce1-ac51-493d-8b3c-1a425d6f5602
0
@Override public boolean isAdminConnection() { return isAdmin; }
64b73cb6-18f7-44cf-9b79-675749dc640c
2
public static ArrayList<LoyaltyProgram> getProgramsForMerchant(Merchant merchant){ SQLiteJDBC db = new SQLiteJDBC(); ArrayList<LoyaltyProgram> loyaltyPrograms = new ArrayList<LoyaltyProgram>(); String sql = String.format("SELECT id FROM loyalty_programs WHERE merchant ='%d'", me...
0bc77f93-138d-4342-9f52-9b9305dee429
0
public SimpleCreature bear() { foodLevel /= 2; SimpleCreature clone = new SimpleCreature(foodLevel); return clone; }
e9ca90a5-38cd-4af5-b89b-590b2c54ac76
7
public void ExportPosts(String questionsFile, String answersFile, List<ClassDocumentation> docs) { //List<PostInfo> list = ExportQuestions(questionsFile, tag); //ExportAnswers(answersFile, list); try { FileWriter fwAnswers = new FileWriter(answersFile); FileWriter fwQuestions = new FileWriter(questionsFi...
2e5346dc-a1c6-485c-a6ea-e16159ecd2be
5
protected void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { HttpSession session = req.getSession(true); User user = (User)session.getAttribute("currentSessionUser"); String currCat = (String)req.getParameter("category"); String filter = (String)req.getParamet...
64e9e695-00ee-4517-9a22-8f390377f14d
7
public int[] parseMap(BufferedImage mapa) { int[] pixels = new int[width * height]; int[] m = new int[width * height]; int indice; int y; int x; mapa.getRGB(0, 0, width, height, pixels, 0, 15); for (y = 0; y < height; y++) { for (x = ...
718d1118-efeb-46e8-9cc3-e984ef90b3b6
3
public void removePoint(GraphPoint gp) { Iterator<Map.Entry<Integer, GraphLine>> it = this.lines.entrySet().iterator(); GraphLine gl; while (it.hasNext()) { gl = it.next().getValue(); if (gl.getFirst().getId() == gp.getId() || gl.getSecond().getId() == gp.getId()) { ...
df9f73f0-bf1a-4e71-b647-542f96c157c3
3
public void generateSequence() { for (int i = 0; i < val; i++) { sequence[i] = random.nextInt(max - min + 1) + min; } Arrays.sort(sequence); int actualSum = sequence[0] + sequence[1]; for (int i = 2; i < val; i++) { if (actualSum >= sequence[i]) { sequence[i] = actualSum + random.nextInt(100 - 0 + 1...
03ec3057-6b96-4bac-96d9-79f91d1fd663
4
@Override public boolean equals(Object obj) { if (obj == null) return false; if (obj == this) return true; if (!(obj instanceof Quote)) return false; Quote t = (Quote) obj; return new String(name).equals(t.getName()) && ne...
0950fe38-2736-4a3b-8c3d-06da85be40d5
1
public List<BencodeType> decode(InputStream inputStream) throws IOException, BencodeParseException { BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream); List<BencodeType> parsedValues = new ArrayList<BencodeType>(); int currentByte; while ((currentByte = readW...
e3592b37-df0a-4dc2-b424-1f700590f940
6
public EntradaBean load(EntradaBean oEntrada) throws NumberFormatException, ParseException { try { if ((request.getParameter("titulo") != null)) { oEntrada.setTitulo(request.getParameter("titulo")); } if ((request.getParameter("contenido") != null...
fdfc824d-50d2-40bc-a538-5d928bfa25d1
3
public static void main(String[] args) { final GUIScreen guiScreen = new TestTerminalFactory(args).createGUIScreen(); guiScreen.getScreen().startScreen(); final Window window1 = new Window("List box window"); //window1.addComponent(new Widget(1, 1)); Panel mainPanel...
c9a18651-0aea-4f5d-9c92-d056619b5035
0
public String getName() { return name; }
d20b6950-8fa0-4ad3-aa6a-7eda0f88f66e
0
public City getSecondCity(){ return second_city; }
7be31975-1924-492b-831e-ae074b631c79
0
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); name = (String)stream.readObject(); state = StateModule.valueOf((String)stream.readObject()); exception = (Exception)stream.readObject(); }
f58158c2-f272-4289-9137-06fb02c01c81
4
public String getSuitAsString() { switch(suit) { case SPADES: return "Spades"; case HEARTS: return "Hearts"; case DIAMONDS: return "Diamonds"; case CLUBS: return "Clubs"; default: return "Not a valid suit for a regular 4-suit deck of cards"; } }
c21597af-6e04-4fae-abf2-641324ea1f8a
4
private byte[] getDataBinary(TextArea area) { String s = ""; try { s = area.getDocument().getText(0, area.getDocument().getLength()); } catch (BadLocationException e) { e.printStackTrace(); } final int sLen = s.length(); // 1/(Number of bits in a byte) times as many bytes as there are bits byte[]...
888857e9-1834-43a3-a8aa-4e3d35a375ba
5
private boolean filterPacket(Packet packet) { // check equality to all filter keywords for (String filter : filters) { if (!packet.toString().contains(filter)) return false; } // do size comparison for the bounds if (compareSize) { if (!(...
1a030c91-4ac2-454a-8c87-a821520dbda5
9
private boolean checkRoundAbout(Point p1, Point p2, Point p3, int ID1, int ID2) { if (!(pipesQuantity[ID1] >= 1 && pipesQuantity[ID2] >= 1)) return false; if (!(pipesQuantity[PipesID.CROSS.getID()] >= 1)) return false; if (!board.isOutOfBoard(new Point(p1.x, p1.y)) && board.getElemIn(p1.y, p1.x) ins...
56c1518c-2541-4e6e-b61d-7d8f3b7fc64c
7
public static void resolveAll(ArrayList<GameObject> objects) { boolean hadIssue = true; for(int k=0; k<3; k++) { hadIssue = false; for(int i=0;i<objects.size();i++) { if(objects.get(i).isCollidable()) { GameObject o = objects.get(i); ...
494f2e0c-055a-426b-8622-e0744fce05f1
1
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((orientation == null) ? 0 : orientation.hashCode()); result = prime * result + (int) (x ^ (x >>> 32)); result = prime * result + (int) (y ^ (y >>> 32)); return result; }
8af95fba-6372-403b-97a1-124da29fabd9
0
public int getMinuto() { return minuto; }
7c1bcf5e-8a77-4e91-a880-d9dd6a9d2b6f
2
@Override protected void onJoin(String channel, String sender, String login, String hostname) { ChannelEventsListener listener = getChannelEventsListener(channel); if (listener != null) listener.userJoined(sender); else if (serverEventsListener != null) serverEventsLi...
5592f1b4-11fc-43d3-9507-432f439c3152
3
public static String convertPolyline(final Polyline POLYLINE) { final StringBuilder fxPath = new StringBuilder(); final int size = POLYLINE.getPoints().size(); if (size % 2 == 0) { List<Double> coordinates = POLYLINE.getPoints(); for (int i = 0 ; i < size ...
cf7ed313-fca8-4237-9ca8-c915f0cd0dbc
5
public void move() { Vector3d velocity = new Vector3d(cameraXP - cameraXN, 0, cameraZP - cameraZN); velocity.normalize(); if (Double.isNaN(velocity.x)) { velocity = new Vector3d(); } position.add(velocity); if (position.x < -maxX) { position.x = -maxX; } else if (position.x > maxX) { position...
d60bba5b-c41f-401b-8b85-02186bbd4a37
7
public static Rule_COLON parse(ParserContext context) { context.push("COLON"); boolean parsed = true; int s0 = context.index; ArrayList<Rule> e0 = new ArrayList<Rule>(); Rule rule; parsed = false; if (!parsed) { { ArrayList<Rule> e1 = new ArrayList<Rule>(); int ...
350dc86f-c5b4-48b5-a978-33d515d8d97d
7
public static MultiChoiceMultiAnswerQuestion getMultiChoiceMultiAnswerQuestionByXMLElem( XMLElement root, Quiz quiz, int pos) { int quizID = quiz.quizID; int position = pos; Object question = null; Object answer = null; double score = 10; ArrayList<String> answerList = new ArrayList<String>(); ArrayLis...
f12cfa47-d31c-41b3-8e9e-237c5a7de1f6
6
public ProductList() { allCondiments(); allBeverages(); BeverageComponent coffeeMenu = new Menu("COFFEE MENU", "Coffee"); BeverageComponent hotCocoMenu = new Menu("HOT COCO", "Hot Chocolate"); BeverageComponent teaMenu = new Menu("TEA MENU", "Tea"); BeverageComponent soupMenu = new Menu("SOUP MENU", "Soup"...
1cac041b-078d-4e62-8391-8cc7f5816398
4
public static void moveTextRightText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) { Node currentNode = textArea.node; int start = textArea.getSelectionStart(); int end = textArea.getSelectionEnd(); String selected_text = textArea.getSelectedText(); // Abort if no selecti...
592b0ac9-f881-40e8-befe-5ee1d9b6e6f5
4
public int buffer(int size){ // first, clear out any space that has been previously returned if(returned!=0){ fill-=returned; if(fill>0){ System.arraycopy(data, returned, data, 0, fill); } returned=0; } if(size>storage-fill){ // We need to extend the internal buffe...
2d21a749-285c-4129-96d5-6a513859f178
7
protected double objectiveFunction(double[] x){ double nll = 0; // -LogLikelihood for(int i=0; i<m_Classes.length; i++){ // ith bag int nI = m_Data[i][0].length; // numInstances in ith bag double bag = 0.0; // NLL of pos bag for(int j=0; j<nI; j++){ double ins=0.0; ...
55d15206-7150-49ce-8cfb-29767d8aa09d
3
public Move getInput() { //returns next integer from System.in scanner = new Scanner(System.in); while (1 == 1) { //run until a move is selected properly int input = scanner.nextInt();//scan the user's choice switch (input) { //different cases for each integer choice, if a case is not here, does...
570d9c75-7783-4d63-a551-cdd4dfb0f27c
2
private List<String> listFiles(String location) { List<String> output = new ArrayList<>(); output.add("error"); try { output = selectedDevice.getFileSystem().list(location, true); if (debug) logger.log(Level.DEBUG, "ADB (ls) output: " + "\n" + output); ...
795ecfee-1b91-4a0f-88c0-352416743148
4
private static byte[] insertGapCore1(byte[] code, int where, int gapLength, boolean exclusive, ExceptionTable etable, CodeAttribute ca) throws BadBytecode, AlignmentException { int codeLength = code.length; byt...
221d4634-dfbd-4613-88ab-9b485124e64b
9
public Status getStatus() { if ( error_ != null ) { return Status.EXCEPTION; } else if ( response_ != null ) { String status = response_.getStatus(); if ( Response.OK_STATUS.equals( status ) ) { return Status.OK; } else ...
4e1475a2-4628-43db-b4db-20e0d91b8c12
0
public void setPrecision( String precision ) { this.precision = precision; }
b848599f-6e99-4ed6-a927-66a541bfaa60
4
public void snapBBoxToGrid(double gridsnapx,double gridsnapy, boolean snap_right, boolean snap_bottom) { JGRectangle bbox = getTileBBox(); double bx = x + bbox.x; double by = y + bbox.y; if (snap_right) bx += bbox.width; if (snap_bottom) by += bbox.height; double bxs = eng.snapToGridX(bx,gridsnapx); dou...
94124d57-57ad-4d44-bce3-8285eb5b0176
9
public static void textPack(byte packedData[], java.lang.String text) { if(text.length() > 80) text = text.substring(0, 80); text = text.toLowerCase(); int carryOverNibble = -1; int ofs = 0; for(int idx = 0; idx < text.length(); idx++) { char c = text.charAt(idx); int tableIdx = 0; for(int i = 0; i...
3718a245-7f53-4dd6-8e40-0b56fbec73f7
3
public static void main(String[] args){ int count =0; for(int i=1;i<101;i++){ for(int j=0;j<=i;j++){ if(biggerThan1M(i,j)) count++; } } System.out.println(count); }
1bb21cd9-8ee0-4515-873e-2ea5c2236ccc
0
public int getaField1() { return aField1; }
5da095de-4f15-4669-b13a-85fa6e90829b
5
private boolean[][] getIsPalindrome(String s) { boolean[][] isPalindrome = new boolean[s.length()][s.length()]; for (int i = 0; i < s.length(); i++) { isPalindrome[i][i] = true; } for (int i = 0; i < s.length() - 1; i++) { isPalindrome[i][i + 1] = (s.charAt(i) == s.charAt(i + 1)); } for (int length ...
858282c6-4656-4146-99d5-c2e1bea7317d
7
public static int min(int depth, int alpha, int beta, ChessPiece[][] board) { if (depth == 0) return evaluate(board); int min = Integer.MAX_VALUE; Set<ChessPiece> moves; ChessPiece selected; ChessPiece old_piece; int score; for(int i = 0; i < 8; i++) { for(int j = 0; j < 8; j++) { selected = boa...
9314398b-ec49-444f-8991-10a81211e936
1
@Override public String toString() { String s = ""; s += this.pelaajanAlkusijainti + "\n"; for (Este este : esteet) { s += este.toString() + "\n"; } return s; }
4f81a17f-2ce0-4f69-9879-c3865d63d9a5
9
protected LoginResult charcrFactionNext(final LoginSessionImpl loginObj, final Session session) { final MOB mob=loginObj.mob; Faction F= null; while((F==null)||(CMSecurity.isFactionDisabled(F.factionID()))) { loginObj.index++; if(loginObj.index>=CMLib.factions().numFactions()) { loginObj.state=Log...
028348f7-7c19-41d3-93b6-4874d06834e5
0
synchronized public void addClock() { this.clock++; }
6dc4338b-ecf2-46a2-98e3-716d101dadf3
7
@Override public void paintComponent(Graphics g) { super.paintComponent(g); //draw board for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if((j + i) % 2 == 0) g.setColor(new Color(218,165,32)); else g.setColor(new Color(238,232,170)); if(board[i][j] == clickedPiece) g.set...
0515204e-4e0b-4a0c-96cf-0c5b2ae3d1c8
9
public static void main(String[] args) { if (args.length == 2) { File fileOrDir = new File(args[0]); File outputFile = new File(args[1]); try { if (fileOrDir.exists()) { List<String> comments = new ArrayList<String>(); File[] files; if (fileOrDir.isDirectory()) { ...
60784b7f-c578-453b-980d-7d1b3a92d408
4
public static void deleteLogFile() { if(DEBUG) { File file = new File(LOGFILE); if(file.exists() && file.isFile()) { if(file.length() > MAXSIZE ) { file.delete(); } } } }
14db13e7-3c3c-4ced-abd2-86d8e88e2794
6
private void dfs(Digraph G, int v) { marked[v] = true; preorder[v] = pre++; stack1.push(v); stack2.push(v); for (int w : G.adj(v)) { if (!marked[w]) dfs(G, w); else if (id[w] == -1) { while (preorder[stack2.peek()] > preorder[w]) ...
1aac70d8-7ea9-48bc-a576-24728d9dca2d
7
int count(char[] a){ int n = a.length; int[][] dp = new int[n+1][n+1]; int i=0; Arrays.fill(dp[0], 1); for(int e=1; e<=n; e++){ if(a[e-1]=='.') continue; i++; if(a[e-1]=='D'){ for(int j=1; j<=n; j++) { dp[i][...
131bc9e7-a7ca-47f5-8a22-debef250d2c2
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...
f152c936-8ed8-4b0e-9dbe-eba436240903
3
public JSONObject accumulate(String key, Object value) throws JSONException { testValidity(value); Object object = this.opt(key); if (object == null) { this.put(key, value instanceof JSONArray ? new JSONArray().put(value) : value); ...
c2aa8ae5-0ec0-4b38-8320-a0b20099cd01
7
private static void test2_2() throws FileNotFoundException { String test1 = "new game\n"+"pick up cell key\n" +"examine cell key\n"+"quit\n"+"yes\n"; HashMap<Integer, String> output = new HashMap<Integer, String>(); boolean passed = true; try { in = new ByteArrayInputStream(test1.getBytes()); System....
122bf040-dae3-4f6a-aa81-b2da881432fe
1
public Collection domChildren(final Block block) { if (domEdgeModCount != edgeModCount) { computeDominators(); } return block.domChildren(); }
caf8b833-9d75-488c-a187-0fa26f8c023f
5
public EquationElement Solve(EquationElement eq, String resultKey){ //List<EquationElement> keys = new ArrayList<EquationElement>(); List<String> keys = new ArrayList<String>(); for (EquationElement temp : eq.getMembers()) { if (temp.getOperation().toLowerCase().equals("element")){ //if(eq.getMembers()...
acae7b2d-f334-462f-b51e-79767bd87632
9
static final boolean method164(int i, int i_0_, byte i_1_, int i_2_) { anInt5195++; if (!Class348_Sub40_Sub23.aBoolean9307 || !Class23.aBoolean351) return false; if ((Class225.anInt2946 ^ 0xffffffff) > -101) return false; int i_3_ = Class354.anIntArrayArrayArray4356[i][i_0_][i_2_]; if ((-FileOnDisk.anInt...
bcb5e717-0ac8-4492-991b-6116a048ffd8
2
public static boolean isValidPassword(String password) { if (password == null) return false; return password.length() >= 6 && password.length() <= 16; }
e0083b54-962d-4b13-a6f6-bc5f99ecde91
1
private void addEXP(int a) { exp += a; if(exp >= 100) { exp -= 100; lv++; } }
d652a601-d895-4b03-9099-6318f390f6ae
9
private void getReport() { // Reports r = new Reports(parent,evt.getActionCommand()); // r.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); // r.setVisible(true); String select = "select id, "+ // "account_no ," + "first_name||' '|...
192bb84a-6a0b-41b7-bf89-9a89d0250b3d
9
@Override public Block.ExitStatus evaluate(IdentifierMap values) { boolean normalTermination = true; while (true) { Value conditionValue = condition.evaluate(values); if (conditionValue instanceof BooleanValue) { if (conditionValue == BooleanValue.TRUE) { if (block == null) throw new...
ea4b7804-a651-4fb4-9871-354516842d62
8
public void printPerson(String catId) { List<DicCat> catList = this.getCatList(); DicCat dicCat = null; for( DicCat dc : catList ) { if( dc.id.equals(catId) ) { dicCat = dc; } } catList = new ArrayList<DicCat>(); setParent(dicCat, 0, catList); BufferedReader br = null; String line = null; ...
d9291404-7bab-4af4-9588-28979321c768
7
public IngViewFrame(JFrame parent) { super(parent); selected = null; this.setBounds(100, 100, 553, 300); ipanels = new ArrayList<FoodPanelRB>(); setTitle("Hozzávalók"); setResizable(false); getContentPane().setLayout(null); scrollPane = new JScrollPane(); scrollPane .setHorizontalScrollBarPolicy(...
60a16989-7415-4922-a8c1-cfbf4f0d7dce
5
public void runShell() { exitShell = false; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { while (!exitShell) { System.out.print(">> "); String line = br.readLine(); String args[] = line.split(" "); if (args.length < 1) { showShellHelp(); } else { ...
8786f553-f872-4cc1-a44c-22d0902a75a4
3
public int damageCalc(int d, int dmgType){ float dmg; if (dmgType == -1){ return d; }else{ dmg = d * Data.elementDamage[type-1][dmgType-1]; } float dmgRdu; //dmg reduction float tempArmor = armor - armorRedu; if (tempArmor >= 0){ ...
6f34e5e1-cfbd-403f-bd30-e64ab1810ce9
8
public void connect(TreeLinkNode root) { if (root==null){ return; } TreeLinkNode NextRoot = root.next; TreeLinkNode temp = null; while (NextRoot!=null){ if(NextRoot.left!=null){ temp = NextRoot.left; break; } ...
e86950ed-4e3b-468d-8abc-5e3d25deaaeb
8
public GameCourt(JLabel points, JLabel lives, JLabel highScore){ // creates border around the court area, JComponent method setBorder(BorderFactory.createLineBorder(Color.BLACK)); // The timer is an object which triggers an action periodically // with the given INTERVAL. One registers an Ac...
14714750-f410-435e-8118-405d7f449b0b
3
public void plot() { final double[] data = new double[measures.size()]; int n = 0; double sum = 0.0; double min = 0.0; for(Double d0 : measures) { double h = d0; min = n == 0 ? h : Math.min(h, min); data[n++] = h; sum += h; ...
85928d33-dc99-400d-acf3-218485409be0
5
public JSONObject increment(String key) throws JSONException { Object value = this.opt(key); if (value == null) { this.put(key, 1); } else if (value instanceof Integer) { this.put(key, ((Integer)value).intValue() + 1); } else if (value instanceof Long) { ...
67acabff-b7e4-4c6a-9da6-2ef5215ae962
6
@Override public void eventDispatched(AWTEvent ev) { // We are interested in MouseEvents only if (!(ev instanceof MouseEvent)) { return; } MouseEvent me = (MouseEvent) ev; Component src = me.getComponent(); switch (me.getID()) { case MouseEvent.MOUSE_PRESSED: ...
04537673-619e-4f17-bf7c-c0853fa68e7d
6
public static sNode findLoopStart(sNode head){ //Implement the fast/slow runner method. If loop exists, guaratneed to overlap sNode fast = head; sNode slow = head; while(fast != null && fast.next != null){ fast = fast.next.next; slow = slow.next; if(f...
b8904612-d079-4a5c-aae1-529e87257452
4
public void read(String filename) throws IOException { // initialise the graph graph = new Graph(); // load the file File file = new File(filename); Scanner in = new Scanner(file); // get the top line String[] topLine = in.nextLine().split(" ");...
dc73c7c3-de9d-4cb2-b3f1-945158d58997
3
public NegativeBinomial(int r, double p) throws ParameterException { if (r < 1 || p < 0 || p > 1) { throw new ParameterException("Negative binomial r >= 1, 0 <= p <= 1."); } else { this.r = r; this.p = p; geom = new Geometric(1 - p); } }
88534cf3-6b19-4a83-8ab4-00dca21c7e8b
8
public void renderTextCharacter(int xp, int yp, Sprite sprite, int color, boolean fixed) { if(fixed) { xp -= xOffset; yp -= yOffset; } for(int y = 0; y < sprite.getHeight(); y++) { int ya = y + yp; for(int x = 0; x < sprite.getWidth(); x++) { int xa = x + xp; if(xa < 0 || xa >= width |...
2361a98a-a9d1-4154-8c18-8dc746d9918f
4
public void send(Message m) { String message = m.getMessage(); if (message.startsWith(Protocol.SEND)) { message = message.replace(Protocol.SEND, ""); String[] userAndMessage = message.split("#", 2); if (userAndMessage[0].equals("*")) { notifyUsers(Prot...
88aebcbf-e2aa-45e9-add9-aee7dcda86dc
9
protected void printTopWordsDistribution(int topK, String topWordFile) { Arrays.fill(m_sstat, 0); System.out.println("print top words"); for (_Doc d : m_trainSet) { for (int i = 0; i < number_of_topics; i++) m_sstat[i] += m_logSpace ? Math.exp(d.m_topics[i]) : d.m_topics[i]; } Utils.L1Normaliza...
ab866acc-332b-4182-b466-9513e53eb783
0
public int getGreen(){ return _green.get(); }
8c7cfd69-9107-4410-b0e6-9bd96e53a576
0
@Override public int getConnectionsCount() { return getConnections().size(); }
e2d1798d-f1e3-4eec-84d6-ab8a335adc3a
5
@Override public void keyReleased(KeyEvent key) { switch (key.getKeyCode()) { case KeyEvent.VK_UP: System.out.println("released: Key Up"); break; case KeyEvent.VK_DOWN: System.out.println("released: Key Down"); break; case KeyEvent.VK_LEFT: moveLeft = false; ball.move(moveRight, moveLeft); ...
9f0cf950-8a0f-480d-ab5e-0dc5f1ac1186
2
@Override public void run() { while(true){ this.repaint(); try { Thread.sleep(200); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
6f44587a-3c9a-4447-89f1-27bec4aa1f29
9
private static final String toHumanReadable(final long bytes) { double d = bytes; int f = 0; while ((d >= 1024) && (f < 60)) { d /= 1024; f += 10; } final DecimalFormat df = new DecimalFormat("#.##"); final DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(Locale.US); df.setDecimalFormatSy...
8c01c1ea-22f9-4f6e-ab82-5e12586477e0
2
public ACSModel(){ listeners = new ArrayList<ModelChangeListener>(); quick_launch_files = new File[QUICK_SLOTS]; client_connected = false; psw_enable = false; password = ""; salt = ""; serv_name = SERV_NAME; port = DEFAULT_PORT; client_ip = "---.---.---.---"; server_ip = "---.---.---.-...