method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1a317df1-1194-4623-891f-84b72e2aa41f
3
@Override public void invokeNext(Request request, Response response, ValveContext valveContext) throws ValveException { int subscript = stage; stage = stage + 1; // Invoke the requested Valve for the current request thread if (subscript < valves.length) { valves[subscript].invoke(this); } else ...
523c4c5c-3f06-460b-a0d4-bee8580c6783
7
public static Float getQuality(String value) { if (value==null) return __zero; int qe=value.indexOf(";"); if (qe++<0 || qe==value.length()) return __one; if (value.charAt(qe++)=='q') { qe++; Map.Entry entry=__q...
b65e4a0d-3e19-47c0-a76c-149e1bacc7f3
6
@Override public TheatersListReplyMessage listRequest(int zone) throws RemoteException{ LinkedList<Theater> listTheaters = cache.getAllTheaters(zone); TheatersListReplyMessage reply = null; if(listTheaters != null && listTheaters.size() > 0){ reply = new TheatersListReplyMessage(zone, listTheaters); ...
c8860310-636b-4fd9-b28c-3c0d6908984d
3
@Override public GameState[] allActions(GameState state, Card card, int time) { GameState[] states = new GameState[1]; states[0] = state; if(time == Time.DAY) { states[0] = carpenterDayAll(new GameState(state), card); } else if(time == Time.DUSK) { PickTreasure temp = new PickTreasure(); s...
9a1a5db5-01ee-4f36-ab7b-49d9ba601f94
2
public LocalInfo findLocal(String name) { for (int i = 0; i < count; i++) if (locals[i].getName().equals(name)) return locals[i]; return null; }
e0a67104-4a09-4079-a8ad-dd499e3b22f5
2
public static void main(String[] args) { System.setProperty("org.lwjgl.librarypath", System.getProperty("user.dir") + "/natives"); System.setProperty("resources", System.getProperty("user.dir") + "/resources"); System.setProperty("saves", System.getProperty("user.dir") + "/Saved Games"); try { Theater.ini...
b4cc1468-b85f-46e0-8dab-270082c02b34
6
public static void main(String[] args) throws IOException, MazeException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); String line = input.readLine(); StringTokenizer st = new StringTokenizer(line); int rows = Integer.parseInt(st.nextToken()); int columns = Integer.parseInt(st...
14bd4499-ca2e-4080-9668-00569007037f
0
public void load() { Bukkit.getPluginManager().registerEvents(playerListener, plugin); Bukkit.getPluginManager().registerEvents(entityListener, plugin); Bukkit.getPluginManager().registerEvents(worldListener, plugin); Bukkit.getPluginManager().registerEvents(consoleListener, plugin); ...
f39475fd-e9c9-47ab-8899-7244183233ad
5
private boolean processFile(boolean encode) throws IOException { mcipher = new MonoCipher(keyField.getText()); char[] buffArray = new char[textFile.length]; if(encode) for(int i = 0; i < textFile.length; i++) buffArray[i] = mcipher.encode(textFile[i]); el...
6c88420a-1f18-46d0-90ab-b3a93fc3ef9d
3
private void addLauncherToArray(Node launcher, Node rootNode) throws SecurityException, IOException { if (launcher instanceof Element) { String id = launcher.getAttributes().getNamedItem("id") .getNodeValue(); if (launcher.getNodeName().equals("launcher")) { boolean isHidden = Boolean.parseBoolean(l...
fa7d19a8-0850-424b-a8f7-454142b6d616
3
@Deprecated public ResultSet retry(String query) { try { return this.getConnection().createStatement().executeQuery(query); } catch (SQLException e) { if (e.getMessage().toLowerCase().contains("locking") || e.getMessage().toLowerCase().contains("locked")) { this.writeError("Please close your previous Res...
6c54b995-2953-40ec-9600-0360650eabfb
4
public boolean isVowel(int i) { return is(i, "a") || is(i, "e") || is(i, "i") || is(i, "o") || is(i, "u"); }
b7c7ab3b-8d5b-465c-b6a6-bf212d0512e9
6
static boolean validNeighbours(int i, int j){ boolean b= true; for(int k = i-5;k<=i+5;k++) for(int p = j-5;p<=j+5;p++) if(k!= i || p != j) if(map[k][p] == 2 || map[k][p] == 5) b= false; ...
cd73ab45-2901-4de8-b26e-50f9e82cd354
5
public SSLSocketChannel2( SocketChannel channel , SSLEngine sslEngine , ExecutorService exec , SelectionKey key ) throws IOException { if( channel == null || sslEngine == null || exec == null ) throw new IllegalArgumentException( "parameter must not be null" ); this.socketChannel = channel; this.sslEngine = s...
7a3fc84a-413b-4a3b-b4e0-a50aceda8d55
3
private void setAndCheckCodeLength(WebDriver driver){ // dropdown WebElement dropDown = driver.findElement(By.xpath("//select[@name='CodeLength']")); // /option[1] // options WebElement selection1 = driver.findElement(By.xpath("//select[@name='CodeLength']/option["+1 + "]")); WebElement selection2 = driver...
a8a566c5-23c8-4a35-9445-0cef9c7f3456
2
public String loadPaciente() { Map parametros = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String idPac = parametros.get("idPaciente").toString(); Integer id = Integer.parseInt(idPac); int i; for (i = 0; i < pacientesBean.size(); i++) { ...
98348373-d017-4ced-a942-6f4dc9976928
1
public void testFactory_standardPeriodIn_RPeriod() { assertEquals(0, Single.standardPeriodIn((ReadablePeriod) null, DateTimeConstants.MILLIS_PER_DAY)); assertEquals(0, Single.standardPeriodIn(Period.ZERO, DateTimeConstants.MILLIS_PER_DAY)); assertEquals(1, Single.standardPeriodIn(new Period(0, 0...
d0df0b2e-5777-4eb1-9f30-210a82c12ac7
6
public String getColumnName(int i) throws Exception { String colName = null; if (i == 0) colName = "userName"; else if (i == 1) colName = "password"; else if (i == 2) colName = "firstName"; else if (i == 3) colName = "lastName"; else if (i == 4) colName = "email"; el...
4f2dc7ff-a6c8-4301-a892-6f10cfa173c2
4
private String getAttributeTextNote(int index) { String note = "..."; switch (index) { case (0): note = "Score: The amount of votes a question received."; break; case (1): note = "Answer Count: The quantity of answers a question received."; break; case (2): note = "Debate: The amount of \"talk\...
b8053e87-c5fd-4098-ab08-f366bf144f9c
8
public ArrayList<ArrayList<Integer>> pathSum(TreeNode root, int sum) { ArrayList<ArrayList<Integer>> res = new ArrayList<ArrayList<Integer>>(); if(root == null) return res; ArrayList<ArrayList<Integer>> listleft, listright; if(root.left==null && root.right==null) { if(sum==ro...
3cd254b8-337e-4620-92ec-d94751b895aa
2
public void showGeneralHelp(CommandSender sender, String cmdName, int page, String format) { for (Subcommand c : cmdMap.values()) { if (c.getName().startsWith(cmdName)) { sender.sendMessage(String.format(format, c.getLabel(), c.getDescription())); } } }
5a068256-9256-4f7f-93ac-cc0aff195236
3
public boolean isRedstone(Block b) { Material t = b.getType(); if ( t.equals(Material.REDSTONE_WIRE) || t.equals(Material.REDSTONE_TORCH_ON) || t.equals(Material.REDSTONE_TORCH_OFF) ) return true; return false; }
04bab570-4ca8-4b89-b9ce-5864294f130b
2
@Override public void visitCallMethodExpr(ClassNode c, MethodNode m, CallMethodExpr expr) { for (CallGraph graph : CallGraphBuilder.GRAPHS.keySet()) { CallGraph other = CallGraphBuilder.GRAPHS.get(graph); if (other.method().name() == expr.method().name()) { System.out.println("cme "+other.method().name()...
5cdd7b53-7958-4c8a-ab81-097c4bbbd3ff
1
public static void main(String[] args) { Scanner s = new Scanner(System.in); String text; System.out.println("Please enter a text to transform into a palindrome: "); text = s.nextLine(); System.out.println("Your palindrome is:"); System.out.println(); ...
c3a62d7e-8425-492a-9a6f-e8325f1afdb8
3
private static void consume_d(GraphicsState graphicState, Stack stack, Shapes shapes) { // collectTokenFrequency(PdfOps.d_TOKEN); float dashPhase; float[] dashArray; try { // pop dashPhase off the stack dashPhase = Math.abs(((Number) stack.pop()).floatValue()); ...
a1abeec0-a840-45f3-8f93-6e2f5dedf83a
9
private static void quickSort(int[] array, int low, int high) { if (array == null || array.length == 0) return; if (low >= high) return; int middle = low + (high - low) / 2; int pivot = array[middle]; int i = low, j = high; while (i <= j) ...
c9ba9c5d-5e98-4653-b26b-8266c8690a46
0
public void setNewGraph(LaenderGraph new_city_graph) { this.laenderGraph = new_city_graph; // repaint(); }
c5fd0ab5-d981-4b73-9ee8-bd91b6f455c1
7
private boolean processCommand(Command command) throws IOException { boolean wantToQuit = false; if (command.isUnknown()) { System.out.println("I don't know what you mean..."); return false; } String commandWord = command.getCommandWord(); joueur.playercommand(commandWord, command, parser, wantToQuit)...
90936f14-f49d-40ba-ac77-6296ff9f899f
7
public void radix_sort(int[] src){ //取最大值 int max = src[0]; for (int i = 0; i < src.length; i++) { max = src[i] > max ? src[i] : max; } //取最大值的位数 int w = 0; while (max>0){ max/=10; w++; } //创建十个队列,用二维数组模拟 ...
75d2ebd6-a4a0-4d2b-bfea-f472b169eeb7
4
private Coordinate getRightPoint(Ladder ladder, Coordinate leftPoint) { int rightX = leftPoint.getX() + 1; int rightY; int i = 0; while (true) { System.out.println("getRightPoint" + rightX + ", " + i); if (getBarInsertionPermission() && isEmptyPoint(ladder, rightX, i)) { rightY = i; System.out.pri...
7dbe2483-d2ed-4157-bd19-88960ecea65e
8
@SuppressWarnings("deprecation") public void processRequest(OMMSolicitedItemEvent event) { OMMMsg msg = event.getMsg(); int msgType = msg.getMsgType(); Token token = event.getRequestToken(); switch (msgType) { case OMMMsg.MsgType.REQUEST: { ...
d4ac2e0c-7e34-4f1d-b713-e92adfd8c38f
9
public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int TC = sc.nextInt(); for (int T = 0; T < TC; T++) { int N = sc.nextInt(); int M = sc.nextInt(); DisjointSet ds = new DisjointS...
4ce043c9-3a3d-4519-9e89-f226ff48e6b6
8
private static String escapeJSON(String text) { StringBuilder builder = new StringBuilder(); builder.append('"'); for (int index = 0; index < text.length(); index++) { char chr = text.charAt(index); switch (chr) { case '"': case '\\': ...
1111d46c-5ada-4d33-b6f9-8ae53693978d
7
public void setSprite(BufferedImage p) { p = ImageManipulator.cropImage(p, 0); if (falling) { switch ((int) (Math.random() * 6)) { case 0: p = ImageManipulator.adjustRGB(p, .5, 1, 1); break; case 1: p...
dd298cd9-b6ed-4126-b844-5b63d784cc74
3
public boolean isLoaded(){ Iterator<Entry<Integer, Boolean>> it = userIDtoMatchLoaded.entrySet().iterator(); while(it.hasNext()){ if(!it.next().getValue()){ return false; } it.remove(); } if(!running){ running = true; startServerLoop(); } return true; }
c9d947b0-3160-4477-8994-a896a07250f7
4
@Override public Formula generateOffer (Formula offer, int snum) { Formula responseOffer = getPreferedOffer(offer, snum); if (responseOffer != null) { addHistoryFormula(responseOffer); } if (offer != null && offer.equals(responseOffer) && offer.getPrice() <= responseOffer.getThreshold()) responseOffer...
34a284f3-a0b5-4ca8-80c9-1329719c2656
9
public void fined() { int sum = 0, current = 0, fine = 0, fineRemaining = 0; boolean isFailed = true; // suppose true // Calculate value in all street for (int i = 0; i < Map.length; i++) { if ((Game.mapWithInfo.route[i].street == Game.mapWithInfo.route[location].street) && (Game.mapWithInfo.route[i].own...
6db64f1d-64bd-43b3-8925-d507b7351ee1
7
public boolean areValid() { try { if (logger.isTraceEnabled()) { logger.trace("Validating server configuration..."); } String address = Settings.INSTANCE.getValueFor(Settings.SERVER_ADDRESS); Pattern ipPattern = Pattern.compile("^([01]?\\d\\d?|2[0...
d4d453ca-e2a2-4b49-9190-2b1a6c2d77d4
6
protected byte[] getBytes(String path) throws java.io.IOException, ClassNotFoundException { byte[] b = null; if (codebases == null) { // reading from resources in the classpath b = getBytesFromResource(path); if (b != null) return b; } else { for (int i = 0; i < codebases.length; i++...
e43e83e4-b9d3-4bfa-a4c3-0251c3f61de7
6
public boolean containsPlayers(int[] pl){ boolean found = false; for(int p:pl) { found = false; for(int s : sentinel) { if(s==p) { found = true; } } for(int s : scourge...
2af610ae-960c-44a4-8b5c-2c3516ea2407
3
public ArrayList<ArrayList<Integer>> permute(int[] num) { ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>(); result.add(new ArrayList<Integer>()); for (int i = 0; i < num.length; i++) { ArrayList<ArrayList<Integer>> current = new Array...
aee91737-83bb-468b-9016-2b8e719f1937
2
private void Initialise(){ // Fill Vector with all possible game states for round one. AllStates = new ArrayList<GameState>(); int[] Perms = new int[NumWolves + 1]; for(int i = 0; i < Perms.length; i++){ Perms[i] = i + 1; } boolean p = false; do { AllStates.add(new GameState(Perms, NumPlay...
08112b5b-b61f-4096-893b-5030c23377ef
7
public static void main(String[] args){ SOP("==========Chapter 1 Arrays and Strings==="); SOP("To run: java c1 [function name] [function arguments]"); SOP("Example: java c1 q1 abcdef"); SOP(""); SOP("Possible functions:"); SOP("q1\tQuestion 1"); SOP("q2\tQuestion ...
555d0432-2b35-4242-9af4-dbf894d8d2f7
3
public void genMSTSlow() { clearNodeEdges(); final long startTime = System.currentTimeMillis(); long totalTime = 0; long tempTime = 0; System.out.println("Connecting "+nodes.size()+" nodes optimally"); genComboEdges(); tempTime = System.currentTimeMillis() - startTime - totalTime; total...
94bbcd46-519c-4590-bd3f-7a532815d0f2
0
@Test public void testLoadURL() { // String ergebnisstring1 = "testseite Hallo ich bin ein Body"; // // String ergebnisstring2 = // // "Das B�se � Wikipedia Das B�se aus Wikipedia, der freien Enzyklop�die Wechseln zu: Navigation, Suche Dieser Artikel behandelt den philosophischen Begriff"; // // String teststrin...
a571d0b6-7bce-459d-ae1b-f3b81457b4e9
6
private Response callDB(Request request) { FileStorage instance = FileStorage.getInstance(); long id; try { id = getID(request); } catch (Exception e) { return new Response(Response.Code.BAD_REQUEST, null); } Request...
1cc0117d-14e6-4cc4-a83b-e21d0ea8fa62
2
@Override public boolean accept(File file) { for(String name : names) { if(file.getName().toLowerCase().contains(name.toLowerCase())) { return true; } } return false; }
830f4c3b-0502-4dc0-a87c-852a16a27bdb
3
private void handleP2selection(ActionEvent e) { for (int i = 0; i < fighters.length; i++) { JButton button = view.getP2Array()[i]; if (view.getSelection()[i] == 2) view.setSelection(i, 0); if (button.equals(e.getSource())) { System.out.println("P2 button " + i); view.setSelection(i, 2); } } ...
a029a3da-4fd2-4251-ae5a-055286d20864
5
@Override public int decidePlay(int turns, int drawn, boolean fromDiscard) { int rval = -1; createPlayHistory(drawn); if (!USE_RAND && net_play_count < RAND_LIMIT && games_played > RAND_ROUNDS){ playNet.compute(play_instance.inputs); rval = playNet.getOutput()-1; } else{ rand_count++; net_play...
a50cb2d5-fcc4-42ec-a7de-30c7b4568384
5
@Override public List<Player> findWinner() { sortHands(); // Find the top score List<Player> winners = new ArrayList<Player>(); for (int i = currentPlayers.size() - 1; i >= 0; i--) { if (Hand.getHandValue_TwoCard(currentPlayers .get(currentPlayers.size() - 1).getHands().get(0)) == Hand .getHandVa...
6734c3e4-8440-44c4-b6f5-2979f3fb0503
0
protected void input(String string) { controller.initialize(string); }
13ebdd3f-d87c-4044-885f-e05fd0e9b3b7
0
public void setId(long Id) { this.Id = Id; }
d8b17d0b-3bea-461c-b24e-e29c184693f8
8
public boolean isFinished(){ /* I.S. B terdefinisi * F.S. Mengembalikan nilai true jika kondisi akhir permainan tercapai, yaitu saat pemain berhasil meletakkan PathCard di sebelah GoalCard yang merupakan GoldCard. */ boolean[][] check = new boolean[6][10]; boolean berakhir; int i, j; P...
204346e4-5fd9-427f-99ca-b4df7219ced5
9
private void seissMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_seissMouseClicked // TODO add your handling code here: try { if (conexion == true && enviando == 0) { enviando = 1; int opciones; if (esinicio != 0 && 6 <= esinic...
3aaead5b-6243-403f-8e11-744f8806e7a8
3
private ArrayList<ByteRange> modifyFile(int fileSize, int ... bytesStart) throws IOException { ArrayList<ByteRange> ranges = new ArrayList<ByteRange>(); for (int byteStart : bytesStart) { int byteEnd; if (byteStart == -1 || byteStart == 0) { byteEnd = getModificationSize(); } else { byteEnd = b...
593a4f58-b22a-4a4c-8006-7b531e66ba31
3
private static int tryAll(Board bd, Move m, int myColor, int oppColor, int currDepth, int maxDepth, int cutoff){ int currVal, maxVal = -1000; MoveIterator it2 = new MoveIterator(bd, oppColor); Move currMove; while((currMove = it2.getNext()) != null) { currVal = scoreMove(bd, currMove, myColo...
05ea7f5a-e34f-4e4b-a526-dc41667c86eb
1
public boolean hasNext() throws Exception { if (!tokenizer.hasMoreTokens()) { tokenizer = new StringTokenizer(reader.readLine().trim()); return hasNext(); } return true; }
42e75aa2-9dde-4adf-8dad-ad580a732510
4
private String getXPathResult(InputStream xmlStream, String xPathStatement) { String result = ""; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder; builder = factory.newDocumentBuilder(); Document doc = builder.pars...
38c27d9d-5c84-4e0c-ab9a-97c87041e240
9
public void startElement(int nameCode, int typeCode, int locationId, int properties) throws XPathException { defaultNamespaceStack.push(startTag.getAttribute(defaultNamespaceCode)); if (emptyStylesheetElement) { depthOfHole++; return; } if (depthOfHole == 0) { ...
9bc95375-1fa5-4fe5-910c-a1d34ab84ef1
3
private static int eval_5cards( int c1, int c2, int c3, int c4, int c5 ) throws RuntimeException { int q; // the rank short s; q = (c1|c2|c3|c4|c5) >> 16; /* check for Flushes and StraightFlushes - */ if ( (c1 & c2 & c3 & c4 & c5 & 0xF000) != 0 ) { s = flushes[q]; if(s == 0)...
1a79e750-481e-4824-9188-58e9a274cdeb
4
@Override public void baseDirectory(String baseDirectory) throws IOException { super.baseDirectory(baseDirectory); if (baseDirectory != null) { try { ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(new FileInputStream(fileName()))); list().clear(); list().ad...
f3422fb8-46db-4434-a344-37922fde2b8b
1
public void setBold(boolean isBold) { this.isBold = isBold; if (isBold) { makeBold(); } else { makePlain(); } }
9ce17242-9a43-4999-a3a5-1f04a3609744
2
private void selectSingleScorePanel(AnswerSide answerSide) { if (answerSide == AnswerSide.LEFT) setSelected(leftScorePanel); else if (answerSide == AnswerSide.RIGHT) setSelected(rightScorePanel); }
4b04994e-4e58-45bd-bbf6-031792a97398
6
public void paint1(Graphics g) { g.setColor(Color.white); //Verifica que los objetos existan if (pokebar[0] != null && pika != null ) { if (info) { g.drawImage(infoImagen, 0, 0, getWidth(), getHeight(), this); } else { ...
2d6bf36a-a5f3-417b-9f8f-8c606450ee7f
6
public Map<String,String> codage(ArrayList<Couple> tableauProb){ //init tableau ArrayList<Couple> tableauP = new ArrayList<Couple>(); tableauP = copyList(tableauProb); Map<String,String> tableauCode = new HashMap(); for (Couple c : tableauP){ tableauCode.put(c.caractere, ""); } //tri tableau de pro...
1e1bad0a-b85c-42c9-9223-8ad086f24203
9
public static void main(String[] args) { if(args.length == 0) { showUsage(); return; } String src = null; String dst = null; boolean batchMode = false; for(int i = 0; i < args.length; i++) { if(args[i].equals("--batch")) batchMode = true; else if(src == null) src = args[i]; ...
960c1faf-3d55-4b41-a768-6e981871dabe
4
@Override public boolean isInFrontOfPlaceable(Rectangle r) { Placeable placeable = null; try { for (String key : placeables.keySet()) { placeable = (Placeable) placeables.get(key); if (placeable != null) { if (placeable.getPerimeter()....
64feacc2-1c18-48dc-a269-387e9f815783
0
public void setDataBase(){ // dataBase = data; algoTreeView = new JTree(loadModelTreeView()); scrollTreeView = new JScrollPane(algoTreeView); addNodeListener(); algoTreeView.expandPath(new TreePath(sort.getPath())); algoTreeView.expandPath(new TreePath(search.getPath()))...
7d5e7952-da42-4184-83a6-7fe02e1a97e2
7
public void deleteValue(String subject, String variable) { int subjectIndex = subjects.indexOf(subject); if (subjectIndex == -1) return; Vector<?> valVector = (values.elementAt(subjectIndex)); Vector<?> varVector = (variables.elementAt(subjectIndex)); int valueIndex = varVector.indexOf(variable) ; if ...
bebe3f01-45fe-4817-af6e-8457f1ccde76
3
@Override public void caseASeExplogSenaoComando(ASeExplogSenaoComando node) { inASeExplogSenaoComando(node); if(node.getExpLogica() != null) { node.getExpLogica().apply(this); } { List<PComando> copy = new ArrayList<PComando>(node.getSeV()); ...
a0bf31ae-2284-4075-b598-8d14e74ee373
8
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); String[] line; while((line = br.readLine().split(" ")) != null) { if("0".equals(line[0]) && "0".eq...
39cc2a4b-b046-4759-8290-4ab1fb06e163
4
@Override public void draw(Graphics2D g) { try { if (Game.world.selectedEntity != null && Game.world.selectedEntity instanceof Struct && ((Struct) Game.world.selectedEntity).guiPoint != null) ((Struct) Game.world.selectedEntity).drawGUI(g); } catch (NullPointerException e) {} }
f31bb5c4-59f3-4869-95f2-1236237308a8
2
@Override public boolean equals(Object foo) { if (foo instanceof Location) { Location fooLocation = (Location) foo; return fooLocation.getX() == x && fooLocation.getY() == y; } return super.equals(foo); }
0f9786d9-2955-4190-a736-60f62eb0be8a
2
@Override public Set<Candidate> getCandidates() { // maybe there is a smarter way with casting if (type == DnDElectionType.REFERENDUM) throw new RuntimeException("There are no Candidates for a referendum. Just yes/no"); Set<Candidate> set = new HashSet<Candidate>(); Iterator<User> it = candidateSet.iterator...
fc30b541-7448-4843-b4c1-6c1b3d0f6bb3
1
public boolean canHaveAsBalance(BigInteger balance) { return (balance != null) && (balance.compareTo(this.getCreditLimit()) >= 0); }
c65d1c65-d127-4a0e-8e61-0139a73e1a07
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TipoApartamento other = (TipoApartamento) obj; if (this.IdTipoApartamento != other.IdTipoApartamento && (...
31dbcb2c-4b00-42c7-b656-2692f2235665
6
public org.omg.CORBA.Any callOperation (String operation, RTT.corba.CAnyArgumentsHolder args) throws RTT.corba.CNoSuchNameException, RTT.corba.CWrongNumbArgException, RTT.corba.CWrongTypeArgException, RTT.corba.CCallInterrupted { org.omg.CORBA.portable.InputStream $in = null; try { ...
aeb9da0b-720c-463c-b789-bacde2cd10cf
9
private void initListeners() { // If ximEnabled is true, enable/disable Japanese input on focus gained/lost. addFocusListener(new FocusListener() { // NOTE only works in japanese environment. // See // <a href="http://java-house.jp/ml/archive/j-h-b/024510.html">JHB:2...
99289abb-c89b-486f-a660-1ea46306a4d7
8
private void updateTable() { Field f; String name, storageType, defaultValue, sectionName; ResultSet result = getColumnProperties(dataTable); for (int i = 0; i < Record.getMasterFieldListSize(); i++) { f = Record.getMasterField(i); name = f.getName(); storageType = f.getStorageType(); defaultValue =...
d5f23473-d571-49af-8bdd-fcb5469c96c9
3
private static Font getAppropriateFont(String text, int width, int height) { int i = height; Font font = new Font("Arial", Font.PLAIN, i); FontRenderContext context = new FontRenderContext(null, false, false); Rectangle2D bounds = font.getStringBounds(text, context); while (i > 1 && (bounds.getWidth() > w...
4dcc9e17-ca98-4cde-8609-761fde995241
1
public void visitIntInsn(final int opcode, final int operand) { buf.setLength(0); buf.append("mv.visitIntInsn(") .append(OPCODES[opcode]) .append(", ") .append(opcode == Opcodes.NEWARRAY ? TYPES[operand] : Integer .toString(operand)).append(");\n"); text.add(buf.toString()); }
719fbdaa-4fb3-4af5-9332-682ea0a0d519
9
public String simplifyPath(String path) { if (path == null) return null; if (path.length() == 0) return ""; LinkedList<String> levels = new LinkedList<String>(); String[] s = path.split("/"); for (int i = 0; i < s.length; i +...
1e9a1892-33a7-4fbc-a302-02428ab501f7
7
public boolean updateQ(NodeVariable x, NodeFunction f, PostService postservice) { NodeFunction function = null; /*System.out.println(""); System.out.println("Sono nella updateQ della variabile "+x.getId() +"per la funzione "+f.getId());*/ LinkedList<MessageR> rmessages = new LinkedList<M...
bbba62b3-61df-49ac-81a3-4f222b64baef
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 OptionMapping)) { return false; } OptionMapping other = (OptionMapping) object; if ((this.id == null && other.i...
4c2b6aa5-acdf-450f-b62d-c8c366c94a33
0
public HeadArmorSlots() { this.armorItem = (HeadArmor) ItemFactory.create().buyItem(Constants.BASIC_HEAD_ARMOR); }
88ac4f51-e861-45db-9881-8e53c5f91d21
1
public boolean isRefresh() { if(frame == null) buildGUI(); return refresh.isSelected(); }
8a073cd3-b606-433c-97ae-1029154726a4
2
public void addVotingUser(int userId) throws ErrorAddingUserException { try { String q = "insert into VotingUser values (?);"; PreparedStatement st = conn.prepareStatement(q); st.setInt(1, userId); st.executeUpdate(); conn.commit(); } catch(SQL...
d16f6095-2fef-44de-ae06-c0ff605eef40
5
@Override public void paintComponent(Graphics g) { super.paintComponent(g); Color dipcolor = new Color(33, 49, 255); Color pincolor = Color.lightGray; Color slidecolor = new Color(0, 0, 120); Color switchcolor = Color.lightGray; if (this.circuit.selected == this) { dipcolor = Color.yellow; pincolor...
36154922-adfc-4e9f-989b-1cf6081ee919
7
protected Insets getShapedBorderInsets(Component c) { return new Insets(1, (isBottomLeftRounded(c) ? 4 : 1) + (topLeftRounded ? (leftSlope <= 0.5f ? 4 : 1) : 0) + (int) (leftSlope * leftHeight), drawBottomLine ? 1 : 0, ...
f475a47c-005b-460c-ac7b-7e7f16616fe1
6
@Override public boolean containsValue(V value) { for (Entry<K, V> entry : this.array) { if (entry == null) { continue; } if (entry.next == null) { if (entry.data.equals(value)) { return true; } ...
0a75ad66-ae0e-47f1-9b77-fed3cbd3b2d4
2
public void deselectAll() { Iterator<Map.Entry<Integer, GraphPoint>> it1 = points.entrySet().iterator(); while (it1.hasNext()) { it1.next().getValue().getComponent().setSelect(false); } Iterator<Map.Entry<Integer, GraphLine>> it2 = lines.entrySet().iterator(); while (...
74f2e651-02c5-4caf-b312-eb8396b9eb24
0
public void setApellidos(String apellidos) { this.apellidos = apellidos; }
689bbbab-62b8-40c0-a141-5600b8c88814
8
final public String Expression() throws ParseException { String exp; exp = getSingleExpression(); label_9: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case KW_AND: case KW_OR: ; break; default: jj_la1[21] = jj_gen; break label_9; } ...
aeab6512-1ee0-4090-a43e-2e337636ed75
8
public static List<String> breadthFirstSearch(Graph graph, String start, String goal) { HashMap<String,Vertex> vertices = graph.getVertices(); // get all the vertices if(!vertices.containsKey(start) || !vertices.containsKey(goal)){ // System.out.println("Goal: " + goal + " " + vertices.containsKey(goal)); ...
8b02fa7a-04c1-45d6-b6cd-70530504ba82
7
@Override public void draw() { if (this.player.isInWormHole()) { StringRenderer.drawCenteredString(Lang.getLocal("game.wormhole.in"), this.xSize / 2, 20, 15, true, new Color(218, 36, 40)); } if (this.state == TurnState.START) { StringRenderer.drawString(this.player.name + ", It's your turn!", 25, 0, ...
dd21e8f0-5f9d-450b-bfdb-a33378e96c7b
3
public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } if ((this.getISBN() == ((BookEditorPick) obj).getISBN())) { return true; } return false; }
8cd09937-e9d2-43cf-8039-8e88a755aaee
8
public static void printReservationLengthReport(AirbnbReservationCollection anAirbnbReservationCollection) { System.out.println("---------------------------------"); System.out.println("Reservation Length Summary Report"); System.out.println("---------------------------------\n"); int startYear = AirbnbGloba...
c44e398a-7ef2-43a0-8dab-711896e46497
6
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); CmProfesionales cmProfesionales; try { cmProfesionales = em.get...
931895d6-568f-4d3a-b640-20763e00ffd2
0
public SchlangenGlied getNextGlied() { return nextGlied; }
9addd719-2e7b-4e7d-aee4-f7b0e1e19cc1
1
@Override public void draw(Graphics graphics, int x, int y) { if (this.fontmetrics == null) { this.fontmetrics = graphics.getFontMetrics(this.font); } // TODO set the font before drawing graphics.drawString(this.str, x, y); }