method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9cfdfe0e-b9c0-418c-80ed-ec237ad28b56
4
@Override public Object getValue() { Object o = null; ; Formula f = (Formula) getParentRec(); if( f.isSharedFormula() ) { o = FormulaCalculator.calculateFormula( f.shared.instantiate( f ) ); // throw new UnsupportedOperationException ( // "Shared formulas must be instantiated for calculation"); }...
9f946f0c-13c4-481d-a1fc-d3191f42c932
1
protected File getFile(final String key) { return getProperty(key) == null ? null : new File(working_directory, getProperty(key)); }
168d896e-b470-44a2-b1c6-85db53edbfa5
4
private String getMeleeTier(ItemDefinition definition) { if (definition.wieldRequirements().size() >= 3) { return "HIGH_LEVEL"; } for (CombatSkillRequirement requirement : definition.wieldRequirements()) { if (requirement.getLevel() <= 45) { return "LOW_LEVEL"; } else if (requirement.getLevel() < 70...
accfa0d1-8bef-4410-a3d4-f60d431c25ff
3
public int maxProfit(int[] prices) { int[] A = prices; if (A.length < 2) return 0; int buy = 0; int sell = 1; int max = Math.max(A[sell] - A[buy], 0); while (sell < A.length) { max = Math.max(A[sell] - A[buy], max); if (A[sell] < A[buy...
0a100fc0-eb33-40cb-86d4-b80ae9b0d074
7
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
2ca23ed7-8383-40ad-84e2-ca37d8908e8a
2
public static void main(String args[]) { long begin=System.currentTimeMillis(); GetOutAuthorRelation getOutAuthorRelation = new GetOutAuthorRelation(); HashMap<String, Map<String, Integer>> map = getOutAuthorRelation .GetOutRelation(4); //86603 for (String key : map.keySet()) { Map<String, Integer> tmp...
2ffb8e36-b890-4a8f-9355-187b8121fe62
3
public void process(Object selectKey){ if(selectKey instanceof SelectionKey){ SelectionKey selectionKey = (SelectionKey)selectKey; Client key = Client.getSockector(selectionKey); if(key.getMessages(charBuffer)){ // 已完成握手,从客户端读取报刊 key.process();// 进行业务处理 } }else if(selectKey instanceof Client){// 直接发...
93b2c44a-d12f-4ecc-b135-af2db644423d
8
private void checkBlockMult( int operationType , boolean transA , boolean transB , Method method, final int heightA, final int widthA, final int widthB ) { boolean hasAlpha = method.getParameterTypes().length == 10; if( hasAlpha && operationType == -1 ) ...
407184d4-6698-4b2f-a2d6-b3723cde86f2
9
public static void main(String[] args) { int hashSize = 0; if (args.length == 0) { throw new IllegalArgumentException("Syntax: CountsWords Datei [hashSize][RSHash|JSHash]"); } if (args.length >= 1) file = args[0]; if (args.length >= 2) { try { hashSize = Integer.parseInt(args[1]); } catch...
472d9c1d-6855-4f05-9d4e-4a0994f431fd
9
private final static ArrayList<String> getRowColAndGapsTrimmed(String s) { if (s.indexOf('|') != -1) s = s.replaceAll("\\|", "]["); ArrayList<String> retList = new ArrayList<String>(Math.max(s.length() >> 2 + 1, 3)); // Aprox return length. int s0 = 0, s1 = 0; // '[' and ']' count. int st = 0; // Start of ...
87d49557-abac-47f5-9948-a22bee929110
3
private void btnAlterarProdutoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAlterarProdutoActionPerformed try { if (JOptionPane.showConfirmDialog(rootPane, "Deseja Salvar?") == 0) { carregaObjeto(); if (dao.Salvar(produto)) { ...
08239d7c-4724-460a-a2ca-4a519453ffc4
3
private void doEditCY(HttpServletRequest request, HttpServletResponse response, boolean isEditUser) throws ServletException, IOException { String chengYuanId = StringUtil.toString(request.getParameter("chengYuanId")); if(!StringUtil.isEmpty(chengYuanId)) { ChengYuan chengYuan = n...
5acc73a0-46d3-4e43-ad88-249885628eb8
9
public SpriteHuntArgs(Map<String, String> argMap) { boolean _hasErrors = false; String huntColor = "255,0,255"; if (argMap.containsKey("hunt")) { huntColor = argMap.get("hunt"); } Integer parsedHuntColor = parseHuntColor(huntColor); if (parsedHuntColor == null) { _...
a1f28566-d0e1-4349-9c32-0a12bcb8e0ea
4
@Override public Event next() { String input = null; try { input = br.readLine(); } catch (IOException e) { e.printStackTrace(); } //alters state if(input == null || input.equals("")){ return new DefaultState(as); } if(input.equalsIgnoreCase("add")){ return new AuctionCreateState(name, ...
7a2ae612-a92e-48d0-814d-b921b1391ba7
8
public Category decide(Game game) { if (game.getWhichRoll() == 3 || rnd.nextInt(4) == 0) { // Score the dice. int numAvailable = 0; int chosenColumn = -1; Category chosenCategory = null; for (int column = 0; column < 3; column++) { ScoreColumn scoreColumn = game.getCurrentPlaye...
17316538-c3c4-46ba-8d58-cc9e1c59d27c
5
@Override public int compareTo(Object other) { if (other instanceof Vortex) { Vortex otherVortex = (Vortex)other; if (otherVortex.dayDistance > this.dayDistance) { return 1; } else if (otherVortex.dayDistance < this.dayDistance) { return -1; } else { if (otherVortex.dayTravel > this.day...
a10c58d7-485b-4c0f-9f35-a693f24780aa
2
public int getWinner() { int player1Score = getScore(1); int player2Score = getScore(2); if (player1Score > player2Score) return 1; if (player2Score > player1Score) return 2; else return 3; }
a3a3afe2-936e-4680-9081-63668c8e6c13
9
private int processJsrRanges() { List<JsrRecord> lstJsrAll = new ArrayList<>(); // get all jsr ranges for (Entry<BasicBlock, BasicBlock> ent : subroutines.entrySet()) { BasicBlock jsr = ent.getKey(); BasicBlock ret = ent.getValue(); lstJsrAll.add(new JsrRecord(jsr, getJsrRange(jsr, ret)...
77c2e01c-83a4-4af8-af42-084ad57793d7
4
public Game.PlayerTurn getPlayerTurn() { boolean test = false; if (test || m_test) { System.out.println("Game :: getPlayerTurn() BEGIN"); } if (test || m_test) { System.out.println("Game :: getPlayerTurn() END"); } return m_playerTurn; }
7f8988be-264a-4956-be50-681f831a3455
2
public Tree additiveExpressionPro(){ Tree firstConditionalExpression = null, secondConditionalExpression = null; if((firstConditionalExpression = multiplicativeExpressionPro()) != null){ if((secondConditionalExpression = additiveExpressionDashPro(firstConditionalExpression)) != null){ return secondCondition...
523fb14a-4165-4bd9-8b0d-adaa91c79386
5
private int arrayState( char next ) { if ( next == ',' ) { buffer.pop(); next = nextValue(); } switch (next) { case END_ARRAY: { popState(); return returnValue( END_ARRAY, state ); } case '"': { ...
e7b8fefe-0864-4d9b-b394-5a2c6b497492
0
public void setCity(String city) { this.city = city; }
02c425b1-0f68-4032-bf5a-e6a28ac040eb
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof KeyWrapper)) return false; KeyWrapper other = (KeyWrapper) obj; if (cacheName == null) { if (other.cacheName != null) return false; } else if (!cacheName.equals(ot...
7445e467-9369-4d5e-9dca-ac3dddb0bdca
1
private void initGenes(){ //0 to n-1 for the cities, n to denote the seperator. Superfluous numbers are being ignored bitsPerAllele = (int) (Math.log(travelingSalesman.n)/Math.log(2)); //2n alleles, as we use pair permutations allelesCount = 2*travelingSalesman.n; bitsPerGene = (allelesCount*bitsPerAllele)...
84368a3d-b675-4563-adfd-94998930773e
7
public String[] someoneElse(boolean place) { try{ driver.get(baseUrl + "/content/lto/2013.html"); //global landing page driver.findElement(By.xpath("/html/body/div[2]/div/div/div/div/div/div/div[2]/ul/li/a")).click(); //Austrailia landing page - Order Now button driver.findElement(By.xpath("/...
2c6619eb-bc9f-4e2e-ad1c-1fc993eeb307
8
@Override public Object read(JsonReader in) throws IOException { JsonToken token = in.peek(); switch (token) { case BEGIN_ARRAY: List<Object> list = new ArrayList<Object>(); in.beginArray(); while (in.hasNext()) { list.add(read(in)); } in.endArray(); return list; ...
8ac52b7a-0ff7-421e-88f7-799897428c99
2
public void changeTable(String inFname, String outFname) throws IOException{ TextFile in = new TextFile(inFname, false); TextFile out = new TextFile(outFname, true); String[] els = in.readLineElems(TextFile.tab); getPosToSampleId(els); out.writelnTabDelimited(els); ...
2a0b385a-603f-473c-b1fd-9227e3375a2a
1
public void testSetHourOfDay_int2() { MutableDateTime test = new MutableDateTime(2002, 6, 9, 5, 6, 7, 8); try { test.setHourOfDay(24); fail(); } catch (IllegalArgumentException ex) {} assertEquals("2002-06-09T05:06:07.008+01:00", test.toString()); }
bf41b44a-a6d6-498f-b323-972c7ce43b09
2
@Override public void draw(Graphics2D g) { super.draw(g); g.drawString(""+Loading.index , 10, 10); //inventory space g.drawImage(img.getSubimage(0, 63, 200, 18), 150, GamePanel.HEIGHT - 25, null); for(int slot = 0; slot < player.getMaxSlots(); slot++){ ItemStack stack = player.getStackInSlot(slot);...
85be9fc9-b68a-48ef-8484-14412e64cc41
7
private void testDescendingOrder(int numRows, int numCols, boolean compact, boolean testArray ) { SimpleMatrix U,W,V; int minLength = Math.min(numRows,numCols); double singularValues[] = new double[minLength]; if( compact ) { U = SimpleMatrix.wrap(RandomMatrices.createOrtho...
8873907a-8f56-4784-b27b-f2701d341b75
6
public void run() { if(url != null) { // Obtain the results of the project's file feed if(readFeed()) { if(versionCheck(versionTitle)) { String fileLink = getFile(versionLink); ...
700016bb-0339-4883-87fa-f83620c09230
0
public void SetMean(double mean) { super.mean = mean; }
6c5cca3c-c6b9-402f-b040-ad7877c1516f
2
public Preferences(File prefsFile) { mFile = prefsFile; mPrefs = new Properties(); mNotifier = new Notifier(); if (mFile.exists()) { try (InputStream in = new FileInputStream(mFile)) { mPrefs.loadFromXML(in); } catch (Exception exception) { // Throw away anything we loaded, since the file must be ...
1abdc72e-8e1c-43cc-abac-6cd27233c0fa
9
public ArrayList<String> tempResultQuery(ArrayList<String> temp, String query) { ArrayList<String> tempResults = new ArrayList<String>(); if (temp.isEmpty()) { docIdResults.clear(); docIdResultsBoolean.clear(); parser.clearStemmerFile(); ArrayList<String> p1 = new ArrayList<String>(); ArrayList<S...
89db2302-c922-4c23-909f-57a4465cf6d8
6
@Test public void testSubgroupsOrder() { Collection<Symmetry4D> groups = Symmetry4D.getSymmetries(); int subgroupCounter; boolean isSubgroup; Collection<Rotation4D> groupMembers; Collection<? extends Symmetry<Point4D>> subgroups; for (Symmetry4D g : groups) { subgroupCounter = 0; ...
26bb1a02-2a9f-4e4a-9c38-c0a663b90cb4
5
public static void addObservers(Game.Builder b) { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); while (true) { printObservers(); /// int opt = getUserOption(br, 1, 4); /// switch (opt) { ...
0dcf687f-af75-4f32-bc68-2983d847c855
7
public void testInverted() { m_Filter = getFilter("1,4,2-3"); ((TimeSeriesTranslate)m_Filter).setInvertSelection(true); Instances result = useFilter(); // Number of attributes shouldn't change assertEquals(m_Instances.numAttributes(), result.numAttributes()); assertEquals(m_Instances.numInstance...
4883afa1-cf4b-4f88-bb36-6ed42134a667
9
public ShortestPaths getShortestPaths() { // Initialize level 0 of the weights pathWeights = new double[graph.vertices()][graph.vertices()][graph.vertices()]; for (int i = 0; i < graph.vertices() - 1; i++) { for (int j = 0; j < graph.vertices() - 1; j++) { if (i == j)...
da2e0790-b1dd-485f-98c4-bd51c54307f3
4
public static JMenuBar createMenuBar() { JMenuBar menuBarUpper = new JMenuBar(); //define and initialized menuBarUpper menuBarUpper.setBackground(new Color(windowColor)); f.setJMenuBar(menuBarUpper); //add the menuBarUpper to the frame JMenu fileMenu = new JMenu("File"); //create the "file" menu JMenu i...
aa01b09a-40f1-48a0-9f58-7e4e7fd912ba
0
public VirtualSequenceNode(Property p,PropertyTree parent,Property pPos,Property pTot) { super(p,parent); pPosition=pPos; pTotal=pTot; }
9846d14d-f4b6-4d15-8e77-3a9fe6477272
1
private void indent(final PrintWriter out, final int indent) { for (int i = 0; i < indent; i++) { out.print(" "); } }
b99844ba-dd1f-4ae5-bfba-66bbbf983c6c
8
public void draw(Graphics g, GameContainer gc) { gc.getGraphics().setBackground(sky); int minx = (int) -Math.ceil(drawx/16); int maxx = (int) (Math.ceil(LostAdventure.screenwidth/16))+minx+2; int miny = (int) -Math.ceil(drawy/16); int maxy = (int) (Math.ceil(LostAdventure.screen...
872e98fd-9393-4edc-b8cb-cbba2bc3e0a9
7
public ProfileInfo Get_DataObj(ProfileInfo DataObj) { //System.out.println("ProfileDAO.Get_DataObj()"); ProfileInfo profileObj = (ProfileInfo)DataObj; String sql = "select * from profile WHERE `Profile_Name`=?"; try { con = getConnection(); pstmt = con.prepareStatement(...
2a1ebc43-b239-43ed-aa8f-ad423b65e265
7
private int getScore(List<Integer[]> Hand){ int s = 0, a = 0; for (Integer[] i : Hand){ if (i[1] > 9) s += 10; else if (i[1] <= 9 && i[1] > 0) s += i[1] + 1; else if (i[1] == 0) a += 1; } for (int i = 0; i < a; i++){ if (s + 11 <= 21) s += ...
ce5540dd-e686-4ce7-813c-3b0d8c0a02ec
1
private int randomSwitchDirection() { int i; i = (int) Math.floor(Math.random() * 10 + 1); if (i > 5) { return -1; } else { return 1; } }
fbf1c30f-eead-4dce-9e46-2538f54aa638
7
private static int partie(mode type) { int a, b; int i; int rep[] = new int[2]; int faute; //générer des nombre au hasard a = generate(); b = generate(); faute = 0; //calculer la réponse attendu switch(type) { case ADDITION: rep[0] = a+b; break; case SOUSTRACTION: rep[0] = a-b; break; ...
37c2b10b-5242-4f53-823c-6b0de03a7921
9
boolean matchbracketclass(int c, int poff, int ec) { boolean sig = true; if (p.luaByte(poff + 1) == '^') { sig = false; poff++; } while (++poff < ec) { if (p.luaByte(poff) == L_ESC) { poff++; if (match_class(c, p.luaByte(poff))) return sig; } else if ((p.luaByte(poff + 1) == ...
a96286f1-92ff-408e-abdb-00b8b722af63
9
boolean allowMove(int dx, int dy) { int nx = x+dx; int ny = y+dy; int nx2 = x2+dx; int ny2 = y2+dy; int i; for (i = 0; i != sim.elmList.size(); i++) { CircuitElm ce = sim.getElm(i); if (ce.x == nx && ce.y == ny && ce.x2 == nx2 && ce.y2 == ny2) return false; if (ce.x == nx2 && ce.y == ny2 && ce.x2...
66a79dc7-f4b2-4099-a7b3-d45ef8e490ed
8
public void purchase(Integer key, Player player) { switch (key) { case KeyEvent.VK_1: if (player.decreaseCredits(shieldsPrice)) { shieldsPrice += player.getMaxHP()* 3; player.increaseMaxHP(5); player.setHitpoints(player.getM...
c9754b13-b6e1-40bc-aedd-d75f781fc92d
1
public static void printResult(String result, String ...spacer_str) { String spacer = getSingleDefault(spacer_str, "-"); int longest_line_length = 1; String[] lines = result.split("\n"); for (int l=0; l<lines.length; l++) { longest_line_length = Math.max(lon...
8effd2f7-b835-43ad-9777-1bb5055841bf
6
private void beginListening(String address, int port) { Socket s; try { s = new Socket(address, port); } catch (UnknownHostException ex) { onUnsuccessfulConnection(); return; } catch (IOException ex) { onUnsuccessfulConnection(); ...
ba50d6ad-1017-4a20-aaed-5318e9c8d57f
8
public static FilterConfig XML2java(Element root) { FilterConfig filterConfig = new FilterConfig(); Iterator rootIter = root.elementIterator(); while (rootIter.hasNext()) { Element element = (Element) rootIter.next(); if (element.getName().equals("source")) { filterConfig.setSource(PerserUtil.parserSou...
b5087434-375e-4872-b58d-9f2ff96b32ba
5
private static List<String> parse(String s) { List<String> keywords = new ArrayList<String>(); StringBuilder buff = new StringBuilder(); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (Character.isLetter(c) || Character.isDigit(c)) { buf...
c7df5245-ef38-404e-b316-f2ea4e75e7be
0
public void setResponse(Object response) { this.response = response; }
05b5b293-3d91-4ffd-938c-9ff9e983a55c
5
public long LCM(FactorTree other){ FactorTree lcm = new FactorTree(); for (long n : this.keySet()){ if (other.containsKey(n)){ int powerA = this.get(n); int powerB = other.get(n); int highest = (powerA<=powerB) ? powerB : powerA; ...
bde1909c-115f-4737-ae4a-f7fed69bfa44
3
public Traffic(int yStartingPos){ speed = (int)(Math.random() * 9 + 5); this.yStartingPos = yStartingPos; //randomly assign colours to each new car generated r = (int)(Math.random() * 255 + 1); g = (int)(Math.random() * 255 + 1); b = (int)(Math.random() * 255 + 1); trafficColor = new Color(r,g,b); r2 = (...
b498f906-f649-4bed-b374-fd53f2b5dd6a
9
public void execute() throws IOException { try { // Read the first 8192 bytes. // The full header should fit in here. // Apache's default header limit is 8KB. // Do NOT assume that a single read will get the entire header at once! ...
397dc659-f42b-4adf-92b2-729d4efb40af
3
private String[] strinArrayProp(Properties props, String name, String[] defaultValue) { List<String> values = new ArrayList<String>(); for (int i = 0; i < 50; ++i) { String val = props.getProperty(name + "." + i); if (val != null) { values.add(val); } ...
22c740e3-442f-403c-92d1-33c7d55dad6d
8
public void writeNested(Input child, Element input){ input.appendChild(input); if(child instanceof And){ And casted = (And) child; input.setAttribute("name", "And"); Boolean x = casted.isOptional(); input.setAttribute("optional", x.toString()); for(int i = 0; i < casted.getCondition...
05d2d20c-9c46-44fa-95a9-54820d1abfc1
1
static public void copyParamValues(Data source, Data dest) { double[] paramValueArray = new double[source.getParamValues().length]; for (int i = 0; i < paramValueArray.length; i++) { paramValueArray[i] = source.getParamValues()[i]; } dest.setParamValues(pa...
4e37308c-eecb-4f8e-bd52-59e5cc77c2fc
9
public static void main(String[] args) { // TODO code application logic here try{ //Server soket oluşturduk. ServerSocket sSocket=new ServerSocket(21500); System.out.printf("Server basladi."+" " + new Date()+"\n"); //bağlantı isteklerini dinlemeye aldık. ...
b50125b6-8c37-4c8e-a551-b3fa2516bb31
1
@Override public void stateChanged(ChangeEvent e) { JSlider source = (JSlider)e.getSource(); if (!source.getValueIsAdjusting()) { jeu.setTimerDifficulte(source.getValue()); level.setText(String.valueOf(source.getValue())); statistique.setNiv...
ab5cca48-2b00-4f6a-be29-b5ac1a6dca91
4
private int[] computeSkirt(TPoint[] points, int width) { int[] skirt = new int[width]; for (int i = 0; i < width; i++) { //impossibly high value int minY = 5; for (int j = 0; j < points.length; j++) { TPoint currentPoint = points[j]; // if point is in right column if (currentPoint.x == i) { ...
9bea1629-488c-426d-963e-07f0d6cc8577
4
public void move() { displacementX += xIncrement*constantAcc; displacementY += yIncrement*constantAcc; if (displacementX > box.resolution().width - 5 - 150 || displacementX < 0) { xIncrement = xIncrement *(-1); this.image=box.selectPokemon(); } if (displacementY >box.resolution().height - 30 - 150 || ...
7b196eb4-7811-45eb-9961-89e6d30e3856
6
int distToPiece(Space[] set, int n, Piece p){ int d = 0; for(int i=n-1;i>=0;i--){ if(set[i].getPiece()==p){ d=n-i; break; } } for(int i=n+1;i<set.length;i++){ if(set[i].getPiece()==p){ if(d==0 || i-n<d) d = i-n; break; } } return d; }
e3fbe42d-fa0d-455b-9154-6f373edba0b9
9
public void setColor(int color) { this.color = color; switch (color) { case EMPTY_BOLL: image = new ImageIcon(NULL_BOLL); break; case BIG_RED: image = new ImageIcon(BIG_RED_BOLL); break; case BIG_GREEN: image = new ImageIcon(BIG_GREEN_BOLL); break; case BIG_CYAN: image = new ImageIc...
4d174034-03de-4193-8380-69fc6a61d6ae
4
@Override public void mouseReleased(MouseEvent e) { switch(e.getButton()) { case MouseEvent.BUTTON1: //Left click //System.out.println("X: " + cX + ", Y: " + cY + "\t"); selected = Game.map.getUnit(pX, pY); if(Game.gui.canSelect(select...
b680c8d4-9c28-4898-b18e-ccdae9b06456
6
@EventHandler public void onSelectMob(PlayerInteractFakeMobEvent event) { Player player = event.getPlayer(); FakeMob mob = event.getMob(); if (Cache.selectedMobs.containsKey(player) && Cache.selectedMobs.get(player) == null) { Cache.selectedMobs.put(player, mob); player.sendMessage(ChatColor.GREEN + "Mob "...
582812d9-967a-4210-b953-af0a7f428e12
0
public void decrement() { count.decrementAndGet(); }
d543e4a3-eeb5-44ee-bc4a-06d9de5ee48d
8
public IndexedModel toIndexedModel(){ IndexedModel result = new IndexedModel(); IndexedModel normalModel = new IndexedModel(); HashMap<ObjIndex, Integer> resultIndexMap = new HashMap<ObjIndex, Integer>(); HashMap<Integer, Integer> normalIndexMap = new HashMap<Integer, Integer>(); ...
c5c49aab-66a4-45fb-81fc-03b89e29b061
0
public ServerCli(){ _commands.add(new Command("Show Computers")); _commands.add(new Command("Show Time")); _commands.add(new Command("Show Version")); _commands.add(new Command("Exit")); }
6cb7d2fd-3387-4740-822b-f9144e55879a
8
private ArrayList<Integer> getColours() { ArrayList<Integer> answer = new ArrayList<Integer>(); int i = 0; while(i != colourList.size() && (answer.size() != g.getSolutionSize())) { int j = 0; ArrayList<Integer> temp = new ArrayList<Integer>(); //Guess 4 of one colour while (j != g.ge...
702c1d02-4b15-4b36-900d-2a96d6778088
1
public void updateFileComboBox() { fileprojectNameComboBox.removeAllItems(); String[] file_projName_strArray = projectTableController.getProjNameComboBoxesData(); for(String str : file_projName_strArray) { fileprojectNameComboBox.addItem(str); } }
3a22a0ce-d217-4914-bbb2-0707285a08a7
8
@SuppressWarnings("resource") public static boolean registerInstance() { // returnValueOnError should be true if lenient (allows app to run on network error) or false if strict. boolean returnValueOnError = true; // try to open network socket // if success, listen to socket for new instance message, return tru...
8da50538-626f-48cc-b03f-ebb86d062a3b
6
public static void initializeCollisionGroups(Class<? extends GameObject> type, Class<? extends GameObject>[] list){ boolean isAbstract = Modifier.isAbstract(type.getModifiers()); System.out.println("\tInitializing group: " + type + " w/ " + list); if (isAbstract){ System.out.println("\t\tThis is an abstract ...
924a505f-f5a1-4929-9c9a-9b69c793e636
4
public Boolean pretarate() { if (this.txt_num_estado.getText().matches("[1-9][0-9]*") && this.txt_num_simbolo.getText().matches("[1-9][0-9]*")) { if (this.txt_num_estado.getText().length() != 0 && this.txt_num_simbolo.getText().length() != 0) { modelTable.setColumnCount(Integer.parse...
3ef9acf6-39d4-49cf-ac69-dced089897b4
2
@Override public boolean equals(Object o){ Time time = (Time) o; if (this.hour == time.hour && this.min == time.min){ return true; } return false; }
d47e7de1-7b2a-450f-8110-55f48e630705
3
@Override public final void update(final Observable o, final Object arg) { final HashMap<Program, Integer> unsorted = new HashMap<Program, Integer>(); final Vector<Entity> entities = new Vector<Entity>(field.getEntities()); for (final Entity entity : entities) { fina...
d2bc27c9-5f5b-45bf-b97a-f422cedb5e56
4
private Boolean validateEvent(String eventName, List<MMTFieldValueHeader> fieldValueElements) throws MMTInitializationException { Boolean retval = true; if (this.getProtoConfig() == null) { throw new MMTInitializationException("Initialization Exception: getProtoConfig() returns null. A valid...
030d6daf-e798-4007-957b-4c314643c81b
3
public static double erfc(double x) { double erfc = 1.0D; if (x != 0.0) { if (x == 1.0D / 0.0D) { erfc = 0.0D; } else { if (x >= 0) { erfc = 1.0D - Stat.incompleteGamma(0.5, x * x); } else { erfc = 1.0D + Stat.incompleteGamma(0.5, x * x); } } } return erfc; }
1fc3e751-d412-40a3-a8c1-edd864a60435
8
public void sendRequest(String resultObject, JSONRPC2Request jsonrpc2Request){ System.out.println(); System.out.println("Request: " +jsonrpc2Request.toJSONString()); String id = jsonrpc2Request.getID().toString(); URL serverURL = null; try { if(isDevelopment){ ...
b3a813b4-6311-4b85-bd98-797fc9536646
0
public static String getOutboundMessage(Packets packet, String data){ String returned; returned = packet.id + "|" + data; return returned; }
613532e3-0ff8-490f-9bae-a55e2d60fa86
6
@Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub synchronized (controller) { controller.notify(); } if ("VIEW LOG FILE".equals(start.getText())) { try { Runtime.getRuntime().exec( "notepad.exe src/Resurces/LogFile/Log.log"); } catch (IOE...
ae7dbbe3-e2fa-4fd3-b684-3d4d5a41d299
3
private void move() { if(endValuesIndex >= values.size()) { endValuesIndex++; return; } // select next // move start to next stop of values change int compare = values.get(startValuesIndex).getEnd().compareTo( ...
1d815441-370d-4e55-ae3b-e223788ef996
7
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub JSONObject jb = new JSONObject(); InputStreamReader reader = new InputStreamReader(request.getInputStream(), "utf-8"); String receivedString = ""; cha...
0d9b682c-0764-43be-989c-caafbbc4afda
8
public Atdl4jWidget<?> getAtdl4jWidgetForParameter( ParameterT aParameterRef ) { if ( ( aParameterRef != null ) && ( getAtdl4jWidgetWithParameterMap() != null ) ) { Collection<Atdl4jWidget<?>> tempAtdl4jWidgetWithParameterMapValues = (Collection<Atdl4jWidget<?>>) getAtdl4jWidgetWithParameterMap().values(); ...
d48dd4aa-5230-41d3-b1d5-b347cd42a174
8
public void paintSelectedIndex(Graphics g, Camera cam) { if (world != null && world.length > 0 && world[0] != null && world[0].length > 0) { // Draw index near selected tile: if (selectedTile_x >= 0 && selectedTile_x < world.length && selectedTile_y >= 0 && selectedTile_y < world[0].length) { Strin...
2f86c701-d35e-4e28-a219-a53411398684
9
@Override public Binary get(Object key) { if (!(key instanceof Binary)) return null; final Binary bKey = (Binary) key; final byte[] keyData = bKey.getValue(); final int keySize = keyData.length; final int hash = Math.abs(hashFunction.apply(keyDat...
62669c04-eceb-4566-a88d-f6707ecae646
5
public static void main(String[] args) { PixelFormat pixelFormat = new PixelFormat(8, 8, 8); ContextAttribs attribs = new ContextAttribs(3, 2) .withForwardCompatible(true).withProfileCore(true); try { Display.setDisplayMode(new DisplayMode(1280, 720)); Display.create(pixelFormat, attribs); } catch (LW...
0effbe68-d365-4ca4-aa6e-7319b0fdd326
6
public Boolean loadPlayer2() { boolean test = false; if (test || m_test) { System.out.println("Loader :: loadPlayer2() BEGIN"); } if (loadPlayer(getPlayer2File())) { setPlayer2(createPlayerType(m_playerInfo[PLAYER_TYPE_INDEX])); g...
4c13b31c-a342-449a-b5a0-41bcf7608422
1
public void add(int element) { if(manyItems == data.length) { ensureCapacity((manyItems + 1)*2); } data[manyItems] = element; manyItems++; }
bff54509-85a6-42ab-b98b-26e8b51fe689
7
@RequestMapping(value="/usuario/cadastrarUsuario", method=RequestMethod.POST) public String cadastrarUsuario(@Valid Usuario usuario, BindingResult result, ModelMap model){ String mensagem = null; if(result.hasFieldErrors("nome") || result.hasFieldErrors("sobrenome") || result.hasFieldErrors("email") || resul...
0ff91567-42c5-4283-8670-1ad498b59df8
6
@SuppressWarnings("unchecked") @Override public void insertElementAt(E element, int index) { int size = getSize(); for(index = 0; index < size; index++) { if(comparator != null) { E o = getElementAt(index); if(comparator.compare(o, element) > 0) break; } else { Comparable c = (C...
6fc5d7c2-8efc-4e86-b752-d8886f3e95af
7
@Override public void update(Observable observable, Object identifyer) { Warborn model = (Warborn)observable; if(identifyer!=null && identifyer.getClass()==Integer.class && (Integer)(identifyer)==1){ switch(model.getState()){ case STARTPHASE: new Thread(new StatePanel(model, frame, "Place Your Troops"))....
feee2956-7dcc-459a-b8a7-de8167768f63
4
public void zoneEventOccurred(String eventZone, int eventType) { if(Debug.localMouse) System.out.println("Event occurred of type: "+eventType+ " in zone: "+eventZone); double scaleFactor = 0.9; if(ZoneEvents.PRESS == eventType) { /* //----Horizontal scaling only testPanel.setLocation((int)...
5275d1fc-ac04-4a84-ade5-742f7f298dcf
6
private static int alphaBeta(Configuration conf, int alpha, int beta,byte depth,byte max){ if ((conf.whoWin() != 0) || (depth >= max)){ return evaluation(conf); } else{ int meilleur = Integer.MIN_VALUE; for (Configuration fconf : listeFils(conf)) { int suiv=-alphaBeta(fconf, -beta, -alpha, (byte) (de...
71af8e8d-ea65-490c-b73a-7e70b05f566d
7
public static <T extends Enum<?>> T lookup(Map<String, T> lookup, String name, boolean fuzzy) { String testName = name.replaceAll("[ _]", "").toLowerCase(); T type = lookup.get(testName); if (type != null) { return type; } if (!fuzzy) { return null; ...
3847a1bf-baba-4355-a5a2-7d416818f83e
4
@Override public STAFResult execute(RequestInfo reqInfo) { STAFResult result = super.execute(reqInfo); if (result.rc == STAFResult.Ok) { CommandAction command = null; String parsedCommandName = (parseResult.numInstances() >= 2) ? parseResult.instanceName(2).toUpperCase() : null; LOG.info("Looking for com...
211dc1fa-122e-4a4d-9315-966bba4d1c69
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final IslandLocation other = (IslandLocation) obj; if (!Objects.equals(this.location, other.location)) { ...
8935b49f-d009-46d2-a9dc-d000aabe5b2e
8
private void func_72145_a(World par1World, int par2, int par3, int par4, boolean par5, boolean par6, boolean par7, boolean par8) { if (par6 && !par8) { par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.10000000000000001D, (double)par4 + 0.5D, "random.click", 0.4F, 0.6F); ...