method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d3fdb6af-d464-4686-8fac-37fda032056f
9
public static Object getFieldArrayValue(java.lang.reflect.Field _p, Object _o, int _i[]) { int n, k; Object o = null; n = (_i == null) ? 0 : _i.length; try { if (_p.getType().equals(java.lang.Integer.TYPE)) { o = new Integer(_p.getInt(_o)); } else if (_p.getType().equals(java.lang.Double.TYPE)) { ...
585e94c0-4849-4db1-aff4-5428bbf7ce28
0
public String getModel() { return model; }
393b760f-67e3-49e2-8623-c8695bc97d83
9
@Override public void doGet(SimpleServletRequest request, SimpleServletResponse response) throws HTTPException { final String[] url = request.getUrlPath().split("/"); if (url.length > 0) { String macroName = url[url.length - 1]; final int x = macroName.indexOf('?'); if (x > 0) macroName = macroName...
af2789b2-dd7f-4272-860d-56d4712ad306
5
private boolean zzRefill() throws java.io.IOException { /* first: make room (if you can) */ if (zzStartRead > 0) { System.arraycopy(zzBuffer, zzStartRead, zzBuffer, 0, zzEndRead-zzStartRead); /* translate stored positions */ zzEndRead-= zzStartRe...
6299d32d-0f00-4db5-a7a6-590069d8c77e
9
private static ColorCode color2ColorCode(Color c) throws Exception { if (c == Color.RED) return ColorCode.Red; else if (c == Color.BLUE) return ColorCode.Blue; else if (c == Color.GREEN) return ColorCode.Green; else if ((c.getRGB()&0xffffff) == 0xff4800) return ColorCode.Orange; else if (c == Colo...
1c0ab34e-fbf7-4168-8cf2-63bdcfeefd2c
0
public int getId() { return this.id; }
d6ad2bd2-7b44-4751-8271-30dbc7c25fe2
6
public BoardCell pickLocation(Set<BoardCell> target){ BoardCell targetCell = null; Random roller = new Random(); ArrayList<BoardCell> doors = new ArrayList<BoardCell>(); ArrayList<BoardCell> nonDoors = new ArrayList<BoardCell>(); //pick target, doors have first priority for(BoardCell b : target) { if(b.i...
a6364890-7b62-4f13-a60b-a156ac228a4f
6
private double sigmaFunction3(double sigma, double psi){ // bisection method for psi(delta) double psiLow = 0.0D; double pFuncLow = this.psiFunctionQ(psiLow, psi, sigma); double psiHigh = psi; double pFuncHigh = this.psiFunctionQ(psiHigh, psi, sigma); if(pFuncHigh*pFuncLo...
83528f57-f7e1-4dad-a032-ca3b4c81197a
7
public void run() { DbConnection dbConn = new DbConnection(); Connection conn = dbConn.getConnection(); try { while (true) { DataQuery sqlQuery = ThreadStorage.pollSqlQueries(); if (sqlQuery == null && ThreadStorage.isEndQueries()) { break; } else if (sqlQuery != null) { Statement stmt ...
2ef26dd0-e890-47e0-8d89-79f924e81037
4
private boolean searchAction() { // impossible (otherwise -> logic error) assert(lastSearchText != null && !lastSearchText.isEmpty()); if (lastSearchText == null || lastSearchText.isEmpty()) { return false; } TreeItem foundItem = search(); GlobalSearch.this.lastFoundItem = ((VCNTreeItem)found...
c197cf37-cf59-4ab7-bac0-d34ea765de6f
7
public boolean run() { if (!smooth) { robot.mouseMove((int) endPoint.getX(), (int) endPoint.getY()); } else { Point currentMousePosition = MouseInfo.getPointerInfo().getLocation(); int startX = (int) currentMousePosition.getX(); int startY = (int) currentMousePosition.getY(); int ...
2d626d95-458a-4106-bedb-353c0fc9902d
5
public void setCursor(int mode, boolean animate) { //System.out.println("Set cursor: "+mode+" animate: "+animate); Toolkit toolkit = Toolkit.getDefaultToolkit(); Image newCursor = null; switch(mode){ case CURSOR_HAND: newCursor = toolkit.getImage(getClass().getResource("resources/hand.png")); break; ...
b8ab917c-7cb0-42a6-a1d3-d025bb7ed02a
0
public void testApp() { assertTrue( true ); }
0bab536d-5216-4ac7-9ac4-df79434d0cca
8
public static Value build(Element value_ele){ String type = ""; if(value_ele!=null){ type = value_ele.attributeValue("type"); } if(StringUtils.isBlank(type)){ return new ExpValue(); } if(R.value.sql.equals(type)){ SqlValue sqlValue = ne...
3b350169-f797-4c5c-8acf-855ef8c1a34b
0
public void add(Throwable thr) { exceptions.add(thr); }
3d164f4d-17ee-4c46-bd1a-d57aab3d490b
2
public Vote getVoteByPlayer(String name){ for(int i = 0; i < votes.size(); i++){ if(votes.get(i).getPlayer().equalsIgnoreCase(name)){ return votes.get(i); } } return null; }
7831d8d2-4f82-4a3f-b1c7-dd24a486c359
3
private double getDoubleArg(String base, int argNumber) throws Exception{ int currentIndex = 0; int argCount = 0; while(currentIndex < base.length()){ int nextComma = base.indexOf(',', currentIndex); if (nextComma < 0) { nextComma = base.length(); } if (argCount == argNumber){ return Double....
b325d102-5191-49e5-8f61-47d0c4c40211
1
public GraphTrimmer(String graphDir, String outDir, File activeUsers, int maxUserFileSize) throws IOException { fileList = new File(graphDir).listFiles(); buffArr = new byte[maxUserFileSize]; this.outDir = outDir; set = new TreeSet<Long>(); BufferedReader reader = new BufferedReader(new FileReader(activeUs...
588f1cfd-a445-4500-809f-74fffdc6c9b2
1
public static void main(String[] argv) { if (argv.length < 2) { System.out.println("Incorrect parameters.\nUsage: java -jar lab0.jar <config_filename> <local_name>"); } else { System.out.println("== MessagePasser [wkanchan + ytobioka] ==\n" + "Usage:\n" + "s <dest> <kind>\tSend <dest> a message with a kind...
d4e3b7b8-02c8-4a93-9a43-7d472a4a644b
5
public static void disposeImages() { // dispose loaded images { for (Image image : m_imageMap.values()) { image.dispose(); } m_imageMap.clear(); } // dispose decorated images for (int i = 0; i < m_decoratedImageMap.length; i++) { Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decora...
2ff2e80b-0a73-4df5-a0d4-9529c868f501
6
@Override public void valueChanged(TreeSelectionEvent e) { Object obj = ((DefaultMutableTreeNode)(e.getPath().getLastPathComponent())). getUserObject(); if (obj.equals(oldTreeObject)) { //oldTreeObject=null; return; } else oldTreeObject = obj; String quote =null; int index=0; if (obj instanceof EndN...
8f54baa9-4768-4b36-ac83-c1765af0d408
3
private boolean insidePicture(final int x, final int y) { return x >= 0 && x < width && y >= 0 && y < height; }
98ae6442-e39f-4ec0-a3c7-ea8d04062ac7
4
private static boolean isPermutate(long a, long b) { int[] ac = new int[10]; int[] bc = new int[10]; for (char c : Long.toString(a).toCharArray()) { ac[Integer.parseInt(c + "")]++; } for (char c : Long.toString(b).toCharArray()) { bc[Integer.parseInt(c + "")]++; } for (int i = 0; i < 10; i++) { i...
cd011099-4711-47c3-bb9e-ce4aa5b2f11b
5
public final static void completeTrade(final MapleCharacter c) { final MapleTrade local = c.getTrade(); final MapleTrade partner = local.getPartner(); if (partner == null || local.locked) { return; } local.locked = true; // Locking the trade partner.getChr().getClient().getSession().write(MaplePacketCreator...
1a6d9421-a1dc-426c-b431-f22d6785d8b0
0
public JTextField getTimeStepTextField() { return timeStepTextField; }
7c81a21d-f38c-4eb5-b02e-bdb73b4e2671
4
@Override public void autoscroll(Point pt) { Insets insets = getAutoscrollInsets(); Dimension size = getSize(); if (pt.x < insets.left) { pt.x -= AUTO_SCROLL_MARGIN; } else if (pt.x > size.width - insets.right) { pt.x += AUTO_SCROLL_MARGIN; } if (pt.y < insets.top) { pt.y -= AUTO_SCROLL_MARGIN; ...
7f718ff1-c9e3-4de5-be7c-ad0f7f640b72
6
boolean Sit_Down(float dt) { int i; int legup=0; float scale=1.0f; // we've planted all feet, lower the body to the ground if( body.pos.z > 0 ) body.pos.z -= 2 * scale * dt; else { for( i = 0; i < 6; ++i ) { // raise feet Vector3f ls = new Vector3f( legs[i].ankle_joint.pos ); ...
87f43016-bf0b-4d02-b045-c0b640808e3a
6
@Override public void execute(CommandSender sender, String[] arg1) { if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) { sender.sendMessage(plugin.NO_PERMISSION); return; } if (arg1.length < 1) { sender.sendMessage(ChatColor.RED + "/" + plugin.warp + " (name)"); return; } else if (plugin...
70408e51-2ce0-4a42-ad45-ef02d93c0125
5
public ArrayList<Integer> inorderTraversal(treeNode root) { ArrayList<Integer> valsInOrder = new ArrayList<Integer>(); Stack<treeNode> nodesInOrder = new Stack<treeNode>(); ArrayList<treeNode> visited = new ArrayList<treeNode>(); if (root == null) return valsInOrder; // push root to stack as starting poi...
d76766ac-7f22-4144-91a3-030dbb06273e
4
public void turnRight() { if(speedX > 0) { speedX = 0; speedY = -speedOfSnake; } else if(speedX < 0){ speedX = 0; speedY = speedOfSnake; } else if(speedY > 0) { speedY = 0; speedX = speedOfSnake; } else if(speedY < 0) { speedY = 0; speedX = -speedOfSnake; } }
2f31ca6c-e139-4c4b-b46c-22e6aa7061a0
6
public int[][] fillArray(final int size) { int[][] data = new int[size][size]; int i = 1; int j = 1; for (int element = 0; element < size * size; element++) { data[i - 1][j - 1] = element; if ((i + j) % 2 == 0) { // Even stripes if ...
4a241b80-b88c-4a57-8b99-7d6dc7937a80
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final RecipientProcess other = (RecipientProcess) obj; if (processIdentifier == null)...
25b45e63-fbb2-441b-bc00-0bd14ad8e230
5
public static double[] takePosition(int day,double[] bestParams,String fileName,int lineNumber,double[] Prices,double money,double shares){ double longAve =0; double shortAve =0; for(int i=day-(int)bestParams[0];i<day;i++){longAve=longAve+Prices[i];} for(int i=day-(int)...
f515fd25-74bc-45e0-90f8-698daa36b3ca
0
protected void setMaxFPS(int _maxFPS) { this.maxFPS = _maxFPS; }
82dc75e0-2a45-460b-9916-285fa3cf6737
5
public static void main(String[] args) { Scanner s = new Scanner(System.in); double num1, num2, result; String operation; boolean error = false; System.out.println("This program will perform a calculation on 2 numbers you input."); System.out.pr...
178157d2-07e8-40f4-b482-c2ae738b5a57
7
public SpikeCollection findDuplicatedSpikes(Spike spike, long time, long timeBuffer, MonitoredAS as, double duplicationPercentage) { SpikeCollection duplicatedSpikes = new SpikeCollection(); for (MonitoredAS pair : allUpdates.keySet()) { SingleASspikes asSpikes = allUpdates.get(pair); for (long second =...
2ccfa20d-e3d0-48b8-8b8d-3c5d73794bcb
0
public TopPanel() { setBorder(DefaultUIProvider.getDefaultEmptyBorder()); BoxLayout boxLayout = new BoxLayout(this, BoxLayout.X_AXIS); setLayout(boxLayout); setMaximumSize(new Dimension(Integer.MAX_VALUE, MAX_HEIGHT)); QuestionCostLabel questionCostLabel = new QuestionCost...
edf762a4-f3ce-4eea-a932-3a27f2f78d4d
8
public List<OpenCellIdCell> parseCells(String fullFileName, int maxMeasurements, int minMeasurements, double r) { List<OpenCellIdCell> cells = null; try(JsonParser jp = new MappingJsonFactory().createJsonParser(new File(fullFileName))){ JsonNode cellsNode = jp.readValueAsTree().get("cells"); cells ...
4298b5dd-dad5-4428-b265-95ff10fa0439
2
@Override public Object promptForAnswer() { String[] choices = InputHandler.getString("Enter the correct order in the form \"3 2 1 4\":").split("\\s"); int[] intChoices = new int[choices.length]; for (int i=0; i<choices.length; i++){ try{ intChoices[i]=Integer.parseInt(choices[i]); }catch(NumberFormatE...
229f918c-4607-4279-8043-618512b99a0b
8
@Override public void e(float sideMot, float forMot) { if (this.passenger == null || !(this.passenger instanceof EntityHuman)) { super.e(sideMot, forMot); this.W = 0.5F; // Make sure the entity can walk over half slabs, // instead of jumping return; } EntityHuman human = (EntityHuman) this.passe...
71e42fe0-bf06-4af3-8955-4836600200a0
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; WpassignPK other = (WpassignPK) obj; if (proj_ID != other.proj_ID) return...
a7c8e73a-3c7d-4f75-93a8-5b99a362b19b
7
public static void main(String [] args) { double win_w = 3.5, win_h = 3.0, delta = 0.0; int ppu = 1200, passes = 32; try { if (args.length <= 0 || args.length > 3) { throw new Exception (); } if (args.length > 0) { delta = Double.parseDouble(args[0]); } if (args.length > 1) { ppu ...
ff1f4e3c-d02b-4b19-b0dd-a2c542cf1926
5
public static MediaCopy getMediaCopy(int mediaCopyId){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { Statement stmnt = conn.createS...
6048823c-0cf1-4a07-bbdc-39acc326ca2f
7
@Override public void init(GameContainer arg0) throws SlickException { Music goodMusic; menu=false; arg0.setMouseCursor(new Image("res/Video Game Tiles - Pixel by Pixel/Cursor.png"), 0, 0); step1 = new Sound("res/sound/Step.wav"); step2 = new Sound("res/sound/Step2.wav"); lasersfx = new Sound("res/sound/La...
272a18dc-771f-4a81-9918-130e4b551d53
4
private ClassInfo canonizeIfaceRef(ClassInfo clazz, Reference ref) { while (clazz != null) { if (clazz.findMethod(ref.getName(), ref.getType()) != null) return clazz; ClassInfo[] ifaces = clazz.getInterfaces(); for (int i = 0; i < ifaces.length; i++) { ClassInfo realClass = canonizeIfaceRef(ifaces[i]...
4be8730e-e45a-448d-bded-01e304eddc8b
8
private void merge(int[] theArray, int[] leftArray, int[] rightArray, SorterParams.SortDirection sortDir) { int i = 0; int l = 0; int r = 0; //merge smaller element into resulting array while(l < leftArray.length && r < rightArray.length) { if(sortDir == ...
d5ed1d5c-a766-4af1-b4fd-91bba452de98
2
private void bDtodouble(){ this.responses0 = new double[this.nGroups][]; for(int i=0; i<this.nGroups; i++){ this.responses0[i] = new double[this.nResponsesPerGroup[i]]; for(int j=0; j<this.nResponsesPerGroup[i]; j++){ this.responses0[i][j] = this.responsesBD[i][j...
b216e303-ef08-4f46-a213-fdd214229031
8
private void readRotResFile (String resFile, String AAtypes[], int rotNums[], int numResults, int numResidues){ BufferedReader bufread = null; try { File file = new File(resFile); FileReader fr = new FileReader(file); bufread = new BufferedReader(fr); } catch (FileNotFoundException e) { Syst...
924dc270-b7d6-40d6-996b-d8b12a7a56cc
5
private void fillTheRest() { if (beepersPresent()) { while (frontIsClear()) { move(); if (frontIsClear()) { move(); putBeeper(); } } } else { while (frontIsClear()) { move(); putBeeper(); if (frontIsClear()) { move(); } } } }
96a22d09-797b-4319-ab29-deba275f2622
6
private boolean checkWinInHorizontalAndVerticalLines (IPlayer player) { int leftLineCount = 0; int topLineCount = 0; for (int i=0; i<SIZE_OF_MATRIX; i++) { for (int k=0; k<SIZE_OF_MATRIX; k++) { if (matrix[i][k] == player.getMark()) { leftLin...
b3794885-3b40-4ba1-acd8-f80dedf3d15e
3
public void mouseReleased(MouseEvent event) { // Did we even start at a state? if (first == null) return; State state = getDrawer().stateAtPoint(event.getPoint()); if (state != null) { if (creator instanceof TMTransitionCreator) { TMTransitionCreator tmCreator = (TMTransitionCreator) creator; tmCr...
18645212-ddc9-4258-85ee-c5977ad60e15
3
public static void log(String whatToLog, String tag){ if(!DEBUG_MODE){ return; } for(String tempTag: TAGS){ if(tempTag.equalsIgnoreCase(tag)){ System.out.println(tag.toUpperCase() + ": " + whatToLog); } } }
2a433d22-43d8-4068-ba7a-9ef089d0b33a
0
public int calcula(int n, int k){ e.setN(n); e.setK(k); return e.getCoefiente(); }
f0175a29-5bb7-4b42-a5eb-e0a283821aa6
8
protected Value getValueByPoint(Point p) { if (valueCircles != null && p != null) { for (int i = 0; i < valueCircles.length; i++) { Point vc = valueCircles[i]; if (vc != null) { if ( (p.getX() > vc.getX() - POINT_SIZE.width) && (p.getX() < vc.getX() + POINT_SIZE.width) ) { ...
c89daeb4-d357-4c58-bd68-7ab88cb58ada
9
private boolean r_combo_suffix() { int among_var; int v_1; // test, line 91 v_1 = limit - cursor; // (, line 91 // [, line 92 ket = cursor; // substring, line 92 ...
6d10c824-d113-470f-8088-9a41f45dc018
9
public String convertHarga(int harga){ // jadi tar kalo 50000 jadi 50.000 dst... // harga = 444; int ribuan[] = new int[10]; int counter=0; String temphasil=""; while(harga/1000!=0){ ribuan[counter] = harga%1000; counter++; //temphasil = temphasil + ribuan+"."; harga = ...
0c6a9191-e873-4c76-91f6-c805e947afe0
7
public void propagate_lookaheads(terminal_set incoming) throws internal_error { boolean change = false; /* if we don't need to propagate, then bail out now */ if (!needs_propagation && (incoming == null || incoming.empty())) return; /* if we have null incoming, treat as an empty set */ ...
6621e4f5-bd15-4817-8bf3-2cecfb03f39c
6
@Test public void mapTest() { String[] test = {"campany","20","ford","rob","forest"}; String[] expecteds = {"campany","20","ford","rot","forest"}; Tuple<?>[] tt = new Tuple<?>[test.length]; for (int i = 0; i < test.length; i++) { if(i == 1){ NumberTuple ntup = new NumberTuple(); ntup.setValue(Intege...
ca7ffb03-3fac-4380-9503-87fefea1c14e
7
public void update() { if(state.equals(RowerState.Resting)) { heartRate -= RECOVERY_RATE; if(heartRate < INITIAL_HEARTRATE) heartRate = INITIAL_HEARTRATE; } else if(state.equals(RowerState.Rowing)) { heartRate += EXERTION_RATE; if(heartRate > MAX_HEARTRATE) { setState(RowerState.BurntOut); } ...
f83b9817-a8c2-43ae-8b9a-ae61947db3dc
4
protected static Ptg calcIsNonText( Ptg[] operands ) { Ptg[] allops = PtgCalculator.getAllComponents( operands ); if( allops.length > 1 ) { return new PtgBool( false ); } // blanks return true for this test if( allops[0].isBlank() ) { return new PtgBool( true ); } Object o = operands[0].getValu...
1d949ef6-5464-4913-899a-ae47b70ebf8a
1
public DrawableItem addItem(DrawableItem item) { if (item == null) { return null; } items.add(item); /* if (item instanceof PathItem) { ((PathItem) item).getLayer().setActive(true); }*/ repaint(); return item; }
ec933f1e-6697-4c90-bcf1-1f111366f4d4
9
public void reloadData() { // read node info try (BufferedReader br = new BufferedReader(new FileReader( "mapinfo.txt"))) { mapString = new StringBuffer(""); neighborhoodString = new StringBuffer(""); this.mapInfo.clear(); String sCurrentLine; while ((sCurrentLine = br.readLine()) != null) { ...
d4a70346-0a6c-4954-9bba-2aee0f1ae9b7
8
public void resizeWebcomicPane() { boolean tooLargeWidth, tooLargeHeight; int webcomicWidth = this.webcomicImageIcon.getIconWidth(); int webcomicHeight = this.webcomicImageIcon.getIconHeight(); tooLargeWidth = webcomicWidth > this.maxWidthWebcomicPane ? true : false; tooLargeHeight = webcomicHeight > th...
8bf41c3d-03a5-4e97-a486-8eb7cb16549d
1
public static void main(String args[]) { Random rand = new Random(); CycleFactory[] factoriesArray = {new BicycleFactory(), new TricycleFactory(), new UnicycleFactory()}; for (int i=0; i<5; i++) { factoriesArray[rand.nextInt(3)].getCycle().ride(); } }
9d47bad2-4bd3-4cdf-808e-0dfc1fd597f6
8
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); int nTest = Integer.parseInt(in.readLine().trim()); for (int i = 0; i < nTest; i++) { int n = Integer.parseInt(in.readLine().trim()); ...
dc41d265-38ab-4e03-91dd-c7d9f00dd842
2
static double[][] subtract(double[][] matrix1, double[][] matrix2){ double[][] diff = new double[matrix1.length][matrix1[0].length]; for(int i = 0; i < diff.length; i++) for(int j = 0; j < diff[0].length; j++) diff[i][j] = matrix1[i][j] - matrix2[i][j]; return diff; }
fd31f5a2-b2a9-4bab-af13-2bf4d275e7ec
0
public PentominosLauncherApplet() { launchButton = new JButton("Launch Pentominos"); setContentPane(launchButton); launchButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { doLaunchButton(); } }); }
3f7d24f2-6edd-4cb0-97fb-1af6301f8c8f
6
private void copyRGBtoRGBA(ByteBuffer buffer, byte[] curLine) { if(transPixel != null) { byte tr = transPixel[1]; byte tg = transPixel[3]; byte tb = transPixel[5]; for(int i=1,n=curLine.length ; i<n ; i+=3) { byte r = curLine[i]; by...
30e8183b-0f22-47d5-aa53-3f4182f89b42
2
private static boolean onlyZeros(Integer[] in) { for (int item : in) { if (item > 0) { return false; } } return true; }
673f3fd6-fa9e-485e-a647-e4beb1fd36e2
9
public static String executeHttpGet(String url) { System.out.println("url:" + url); InputStream in = null; BufferedReader reader = null; String result = null; HttpGet request = null; try { request = new HttpGet(url); HttpResponse r = client.execute...
41eaf046-e3c2-453f-acc6-322dee3892ae
8
@Override public void run(){ try{ o = sock.getOutputStream(); i = sock.getInputStream(); while(running()){ if(!buffer.isEmpty()){ String message = buffer.remove(0); write(message); o.flush(); //Risk.showMessage(message); System.out.println("Message written"); } if(i.avai...
c5bc08c1-4c24-4599-b747-fc99185d6ece
9
@Override public void setMove(Move move, int slot) { if (slot == MOVE_ONE) { move1 = new MoveWithPP(move); } else if (slot == MOVE_TWO) { move2 = new MoveWithPP(move); } else if (slot == MOVE_THREE) { move3 = new MoveWithPP(move); } else if (slot == MOVE_FOUR) { move4 = new MoveWithPP(move); } el...
52750422-454a-49a5-8290-542fbc314f75
2
public void closeMessageSocket() { out.close(); try { in.close(); } catch (IOException e) { System.err.println(e.getMessage()); e.printStackTrace(); } try { socket.close(); } catch (IOException e) { System.err.println("Socket cannot closed"); System.err.println(e.getMessage()); ...
ba77db55-c717-4fa6-8d82-20d732dcbb7e
0
public void setImage (ImageIcon icon){ this.setIcon(icon); }
2aaf9e45-bd5d-4601-8163-8e2233e5c7f0
3
@Test public void testGetOnePersonAsJson() { System.out.println("getOnePersonsAsJSON"); Person p1 = new Person("John", "McLaren", "myMail@hotmail.com", "57895879", new Student("Third")); String p1AsJson = trans.toJson(p1, Person.class); instance.addPersonFromGson(p1AsJson); P...
79e0f4a4-5ecd-421e-a7b6-526e85a6609d
1
void checkModify() throws RuntimeException { if (isFrozen()) throw new RuntimeException(getName() + " class is frozen"); // isModified() must return true after this method is invoked. }
10230c2e-1de8-4f69-beea-f4f631c9ff27
2
public static void main(String[] args) { String a = "abc"; if (a == (a+"d")) { System.out.println("links are equal"); } else { System.out.println("links are NOT equal"); } String c = "ab"; String b = "ab"; String r = (c.equals(b)) ? "Equals!" : "Not equals!"; System.out.println(r); O...
9fc9ee45-d75e-4ae7-8502-49a2bf0a8b18
8
public LtrGrade(Double numGrade) { // gets a letter from percentage if(numGrade == 0) { actualLetter = ""; gradePronoun = ""; }else { if (numGrade >= .90) { actualLetter = "A"; gradePronoun = "an"; } else if (.8 <= numGrade && numGrade < .9) { actualLetter = "B"; gradePronoun = "a"; }...
44036cf6-2dfc-4566-9694-52b3555d56dc
4
public void body() { int resourceID[] = new int[this.totalResource_]; double resourceCost[] = new double[this.totalResource_]; String resourceName[] = new String[this.totalResource_]; LinkedList resList; ResourceCharacteristics resChar; // waiting to get list of res...
9c611634-0885-43d3-b0d4-305a7a2039a6
1
public void setSelect(boolean select) { this.selected = select; this.setColor(getSelect() ? this.SELECT_COLOR : this.NOSELECT_COLOR); this.getGraphElement().getGraph().setSelectGraphElement(this.getGraphElement(), select); //this.stateChange(); }
b2e5ac92-d0ee-46a2-ba44-0306eee713e9
1
public void Salir() { try { servidor.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
a48ccc23-ca6e-41fc-b705-cc4922491a70
7
public void initialize() throws Exception { if (m_baseExperiment == null) { throw new Exception("No base experiment specified!"); } m_experimentAborted = false; m_finishedCount = 0; m_failedCount = 0; m_RunNumber = getRunLower(); m_DatasetNumber = 0; m_PropertyNumber = 0; m_Cu...
31b5aaf3-19f4-4b08-ac1d-3f48b73e326e
4
public static Connection getConnection() { try { if (connection == null || connection.isClosed()) { Class.forName("com.mysql.jdbc.Driver"); String url = "jdbc:mysql://localhost:3306/pi"; String user = "root"; ...
8ef11cfa-ba99-48a7-84f6-4ec5108ca97c
6
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Constituent)) return false; final Constituent constituent = (Constituent) o; if (end != constituent.end) return false; if (start != constituent.start) return false; if (label != null ? !label.equals(constituent.la...
077ebb3b-520a-4a99-9e3e-93fc342ee2b7
0
public List<PosListaPrecio> getListaPrecios(int posID){ logger.info("posID = " + posID); return getHibernateTemplate().find("from PosListaPrecio where pcaPosId = ? and pcaEstado <> 'A'", posID); }
2b2747ca-b7ac-4bc7-b8c9-9f1fd0354cfb
4
public treeNode getNextRightSibling(treeNode curNode) { treeNode parent = curNode.parent; if (parent == null) // curNode is root , no right sibling return null; if (parent.leftLeaf == curNode) return parent.rightLeaf; treeNode parentRightSibling = getNextRightSibling(parent); if (parentRightSibling !...
e2c7a643-a6e8-4d0e-85a9-d697bff45110
0
public static FormulaEvaluator getFormulaEvaluator(Workbook workbook) { return workbook.getCreationHelper().createFormulaEvaluator(); }
9a824cbc-9e4b-4ed0-9358-4a1a7a20090d
8
public CourseworkTests(Set<Question> answers) { if (answers == null) return; for (Question ans: answers) { if (ans != null && ans instanceof Question1) { FeedbackSuite question1 = new Question1Tests((Question1)(ans)); runThread(question1); this...
2549500b-d015-4c49-91d9-fcb3d66306e5
8
public List<PingjiaoStatusVO> getPingjiaoStatus(String grade, String semester, String course_name, String professionalName, String executiveClass, int beginPage, int endPage) { PingjiaoDAO dao = new PingjiaoDAO(); if (course_name != null && course_name.equals("总计")) { course_name = "all"; } else if (cour...
b21e25ce-3bd7-4144-82c1-757febbfa640
7
@Override public boolean isMine(Environmental env) { if (env instanceof Item) { if (inventory.contains(env)) return true; return false; } else if (env instanceof MOB) { if (isFollowedBy((MOB) env)) return true; return false; } else if (env instanceof Ability) { if (abilitys....
11d9a18b-442f-4544-8d7d-c035f088e616
3
@Override public void clearPairing(WorldCoordinate other) { printDebugPair("Signal Block pair cleared. ", other); if (SignalTools.printSignalDebug) { // logTrace(DEBUG_LEVEL, 10, "Signal Block code Path"); int x = other.x; int y = other.y; int z = other...
0e36e817-919f-4fcc-84ca-8507d904e598
1
public void onEvent(Event event) { // If this event happens to be a ScannedRobotEvent... if (event instanceof ScannedRobotEvent) { onScannedRobot((ScannedRobotEvent) event); } }
42b11f49-84da-4d50-81a9-e4d753f1db14
6
public synchronized boolean canTrade(int p1, int p2, Trade t) { catanui.BoardObject.type[] ins = t.getIns(); catanui.BoardObject.type[] outs = t.getOuts(); // player 1 has ins and player 2 has outs for(int i=0; i<ins.length; i++) { if(ins[i] != null && !_players.get(p1).getHand().contains(ins[i])) { ...
55259102-3ee5-439f-a2f6-6e66ea5633ee
5
@SuppressWarnings("null") public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter pw = response.getWriter(); pw.println("<html>"); pw.println("<head><title>Dead Recommender</title></title>"); pw.p...
65a31608-972c-49e0-b798-6197c4db8f06
0
public void collide(CarPhysics other) { solidObject.collide(other.solidObject); }
671490fe-efcb-4a72-b5f5-de1c9fd995b7
4
public void setEndian(int endian) { if(this.endian==BIG_ENDIAN && endian==LITTLE_ENDIAN) { bitIndex=0; byteIndex++; } else if(this.endian==LITTLE_ENDIAN && endian==BIG_ENDIAN) { bitIndex=7; byteIndex++; } this.endian=endian; }
4ad9a5a3-f9ed-43ef-9cf0-c1e78a171caa
0
public void setPassword(String password) { this.password = password; }
f110b3f7-f0d1-4525-a883-df00d7a17690
7
public static <T> T bindable(final Class<T> superClass, final Object... constructorParameters) { Enhancer enhancer = new Enhancer(); enhancer.setSuperclass(superClass); enhancer.setCallback(new BoundTypeInterceptor<T>()); Class<?>[] argumentTypes = new Class<?>[constructorParameters.length]; for(int i=0; i...
29390084-c2cd-46b9-b7ab-dd5560b4806d
3
private ArrayList<Couple> comptage() { ArrayList<Couple> resultats = new ArrayList(); ArrayList<String> lettre = new ArrayList(); for(int i=0; i<this.longueur_texte; i++) { if(lettre.isEmpty() == false) { int test = lettre.indexOf("" + this.text.charAt(i)); if(test != -1) // Le cas o�test es...
6bdc5b82-ad76-4f8c-8ceb-a7e3633676c9
9
@Deprecated public static void main(String[] args) { Scanner sc = new Scanner(System.in); Client client = new Client("raphael", 30001, 30000, "192.168.99.230"); boolean running = true; while (running) { System.out.println("-register"); System.out.println("-unregister"); System.out.println("-list");...