method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c058852e-c1a5-4674-a802-269aab7cb635
6
public void lisaa(Node node) { int num = 0; if (koko > 0) { while (true) { int uudesta = node.getValue(); int vertaus = jono[num].getValue(); //Tarkistaa onko käytettävä A* vai Dijkstraa if (type == 1) { u...
a597167a-0cbd-4e72-8a57-fbbcbf863ef3
0
@Before public void setUp() { g = new Graph(); v = new Vertex(0); e = new Edge(null, null); }
5f6358a8-9a6f-461d-9516-eb212050d54f
1
public static Commands fromString(String Str) { try { return valueOf(Str); } catch (Exception e){ return Commands.UNKNOWN; } }
74870f26-0185-4474-8a16-20b96188a9d0
0
public void setCityName(String cityName) { this.cityName.set(cityName); }
41e2d323-8fcc-452a-872b-586250fa91d8
7
static private boolean jj_3R_11() { Token xsp; xsp = jj_scanpos; if (jj_3_2()) { jj_scanpos = xsp; if (jj_3R_14()) { jj_scanpos = xsp; if (jj_3R_15()) { jj_scanpos = xsp; if (jj_3R_16()) { jj_scanpos = xsp; if (jj_3R_17()) { jj_scanpos = xsp; if (jj_3R_18()) { jj_...
8ad2bab3-c24c-4a85-b58a-00a62c2eb3b4
3
public Ingresar(JFrame ob,int i) { initComponents(); ImageIcon iconLogo = new ImageIcon(IMG.getImage("minifondo.png")); ImageIcon iconLogo2 = new ImageIcon(IMG.getImage("Label_nombre.png")); JLabel nombre= new JLabel(); nombre.setIcon(iconLogo2); jLabel1.setIcon(iconLogo)...
15293341-c6f5-47ba-aee1-69f1fbebd1e7
0
public void setCtrlPrincipal(CtrlPrincipal ctrlPrincipal) { this.ctrlPrincipal = ctrlPrincipal; }
14e02de9-4c5a-4a92-b569-d6f8921fb790
9
private static HashMap<Integer, Integer> parseBranches(final String branches) throws Exception { final HashMap<Integer, Integer> ans = new HashMap<Integer, Integer>(); if (branches.trim().isEmpty()) return ans; if (!branches.contains(")")) { final String[] csv = branches.split(","); for (int i ...
2baa2706-0884-4c73-9f88-c04525120db8
4
public void create(Equipos equipos) throws PreexistingEntityException, RollbackFailureException, Exception { EntityManager em = null; try { utx.begin(); em = getEntityManager(); em.persist(equipos); utx.commit(); } catch (Exception ex) { ...
7ed74efa-1996-45e1-9f58-a07d4d4ae6f8
3
public static void main (String args[]) throws Exception { BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); while (true) { String line = stdin.readLine(); StringTokenizer st = new StringTokenizer(line); String a = st.nextToken(); String b = st.nextToken(); int maxPositio...
6bb56420-a4bf-4247-bff4-82c6494cfa12
7
@Override protected boolean allocatePesForVm(String vmUid, List<Double> mipsShareRequested) { double totalRequestedMips = 0; // if the requested mips is bigger than the capacity of a single PE, we cap // the request to the PE's capacity List<Double> mipsShareRequestedCapped = new ArrayList<Double>(); double...
ce417ce7-eece-46f1-b258-122e033a0095
4
@Override public boolean equals(Object the_other) { boolean result = this == the_other; if (!result && the_other != null && the_other.getClass() == getClass()) { result = ((Point) the_other).x == x && ((Point) the_other).y == y; } return result; }
fed31c1e-1529-4efe-a1b3-10c7cc7c3bad
6
public void updateTop(){ if(top > 0){ for(int i=0; i<width+left-right; i++){ for(int j=0; j<top; j++){ drawDiamond(i, j); } } } else if(top < 0){ for(int i=left; i<width+left-right; i++){ for(...
bb9803cd-6103-47e7-9394-905233e0cc89
0
public int[] area() { return new int[]{x, x + w, y, y + h}; }
7681ebff-eedd-4329-81ee-1238bf232c19
0
public List<Uitlening> getUitleningen() { return uitleningen; }
e911632a-38da-4b91-a52e-64b747f6746c
2
public static String fixURL(String URL) { String temp; if(URL.toLowerCase().startsWith("http://") || URL.toLowerCase().startsWith("https://")) temp = URL; else temp = "http://" + URL; return temp; }
f642cb7a-6ae1-4e60-a524-eb187c545e5a
2
public static void main(String[] args) throws IOException { int portNumber = 7777;//Integer.parseInt(args[0]); ServerSocket serverSocket = new ServerSocket(portNumber); try { while (true){ Socket clientSocket = serverSocket.accept(); ...
61e5253a-bb00-45fd-b58b-496e4e965553
4
@Override public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) { try { if(args.length == 2) { String material = Material.matchMaterial(args[1]).toString(); if(material == null) { throw new IllegalArgumentException("Material not found."); } FileConfigurat...
85adc585-2598-4e98-9282-c3a1de65e608
2
public long getLong(String key) throws JSONException { Object object = get(key); try { return object instanceof Number ? ((Number)object).longValue() : Long.parseLong((String)object); } catch (Exception e) { throw new JSONException("JSONObj...
b71f231a-abef-4c29-80fd-fed73ef1500c
3
public static List<Emotion> constructEmotions(Response res) throws WeiboException { try { JSONArray list = res.asJSONArray(); int size = list.length(); List<Emotion> emotions = new ArrayList<Emotion>(size); for (int i = 0; i < size; i++) { emotions.add(new Emotion(list.getJSONObject(i))); } r...
16707e76-d045-4352-b028-0b4366d56a95
9
public byte[] build(boolean first, boolean withTcpHeader) { StringBuilder builder = new StringBuilder("Message built:"); int length = first ? 2 : 1; if (!withTcpHeader) length--; for (MessagePart part : parts) { length += part.length; } if (length > 0x7e * 4) ...
b6ad8be6-6e97-43f2-b7b1-ac02b5fbe6fb
4
protected void paintComponent(Graphics g) { if (thumbnail == null) { loadImage(); } if (thumbnail != null) { int x = getWidth()/2 - thumbnail.getIconWidth()/2; int y = getHeight()/2 - thumbnail.getIconHeight()/2; if (y < 0) { y = ...
5e014be0-ab2e-49ef-aa16-56cd202e5366
7
@Test public void testServerUseMessageQueueWithPauseAndResume() { LOGGER.log(Level.INFO, "----- STARTING TEST testServerUseMessageQueueWithPauseAndResume -----"); String client_hash = ""; try { server1.setUseMessageQueues(true); } catch (TimeoutException e) { ...
26da7cc4-57db-44e7-8cc2-2cd135d4b371
0
public synchronized void tap() { press(); release(); }
625947f3-19c5-49ba-a74e-a3fa55c69212
0
public int getType() { return type; }
93bcf8d2-4fda-48d8-99fb-56a82df22e8b
3
private String createUpdatedMessage() { long lastModified = getLastModified(); long diff = System.currentTimeMillis() - lastModified; if (diff < 10000) return "Updated just now!"; if (diff < (1000 * 60 * 5)) return "Updated not more than 5 minutes ago."; Calendar cal = Calendar.getInstance(); cal.set(...
747ad128-c280-4555-93fd-7db2ee70eed2
1
public Transition transit(Transition... transitions) { for (Transition transition : transitions) { transition.setStateFrom(stateTo); } return this; }
8f29037d-68b2-4450-b2ea-22fa0bf3e4d1
9
private int parseTag(boolean id3v1) throws IOException { int tagSize = 0; // ID3 v1 if (id3v1 && instream.seek(instream.length() - 128 - 32)) { if (instream.read(buf, 0, 128 + 32) == 128 + 32) { if (id3tag.checkID3V1(buf, 32)) { tagSize = 128; id3tag.parseID3V1(buf, 32); } } else retu...
2c17afce-aa96-4738-8c80-d520355fcfd6
8
public FeedbackArea() { setLayout(new BorderLayout()); setOpaque(false); JPanel p = new JPanel(new BorderLayout(5, 5)); p.setOpaque(false); add(p, BorderLayout.CENTER); displayPane = new TextBox("Loading......"); displayPane.setEditable(false); scroller = new JScrollPane(displayPane, JScrollPane.VER...
0a46a5a3-b464-41f4-9934-5022e58430e0
4
private String convertTimesToString() { //Variable Declarations DateManager dm = new DateManager(); //Store the proper amount of time all in the seconds variable and form the proper duration text. if (int_Weeks > 0) int_Seconds += int_Weeks*604800; if (int_Days > 0) int_Seconds += int_Days*86400;...
a8c31e14-cba3-4296-b449-3c9751c1f159
0
public String getClassName() { return className; }
8aa609ac-099d-46cc-9738-21e9bf1f94ae
4
@Before public void setUp() throws Exception { Configuration.initConfig("var/config.prop"); _connection = PGConnectionPool.getInstance().getConnection(); PreparedStatement ps = _connection.prepareStatement("TRUNCATE TABLE message, queue, client"); ps.execute(); ps = _connect...
41c902b1-5d8a-4198-93f3-39dbee7b36ac
8
private static List<InetAddress> getAddressList() { List addressList = new ArrayList(); try { for (Enumeration interfaces = NetworkInterface .getNetworkInterfaces(); interfaces.hasMoreElements();) { NetworkInterface networkInterface = (NetworkInterface) interfaces .nextElement(); if ((networkI...
607af851-8a8d-4339-ac28-4b0f8d82aa52
4
public static byte[] decodeFromFile( String filename ) { byte[] decodedData = null; Base64.InputStream bis = null; try { // Set up some useful variables java.io.File file = new java.io.File( filename ); byte[] buffer = null; int length = 0; int numBytes = 0; // Check for size of file if( ...
01ccc14b-1286-4b5b-9141-fdd5a1f3b248
7
public boolean matches(String s1, String s2) { if(s1.length()==0) return true; if(s2.length()==0) return false; if(Pattern.matches(s1, s2)) return true; if(s1.startsWith("*")&&(s1.endsWith("*"))) return s2.toUpperCase().indexOf(s1.toUpperCase().substring(1,s1.length()-1))>=0; else if(s1.startsW...
cb9e5c95-a631-4e43-9daa-4eca50d67c9e
8
private void printExp(Exp exp){ if(exp == null){ return; } if(exp instanceof BinaryExp){ Exp leftExp; if( (leftExp = ((BinaryExp) exp).getLeft()) != null){ printExp(leftExp); } System.out.print(" " + ((BinaryExp)exp).getOp() + " "); Exp rightExp; if( (rightExp = ((BinaryExp) exp).getRi...
5720268a-2966-4a3a-a835-e6801e9dc669
5
public static void BookFlightObject( String SelectedFlightType, int AdultSeats, int ChildSeats ) { try{ Globals.ActiveCustomer = Globals.ATA.CustomerArray[Globals.ActiveClientObjID]; } catch(ArrayIndexOutOfBoundsException e){ Globals.ActiveCustomer = new Customer(); } t...
4d0bfb03-c33d-4ab0-ae34-8acae9945ee4
7
public static void replicateFiles(String dataNodeName){ System.out.println("This Data node is dead " + dataNodeName); System.out.println("Starting the replication process."); // Retrieve the InpurFileInfo that is related to the Dead Data Node List<InputFileInfo> infoList = needValidations(dataNodeName); ...
32d173bb-ca44-4524-9d28-79546ff74ae9
6
public static void main(String[] argv) throws Exception { String coordName = "coordinator1"; String srv1Name = "server1"; String srv2Name = "server2"; Coordinator coordinator = new Coordinator(); Naming.rebind(coordName, coordinator); Server server1 = new Server(srv1Nam...
8648efe7-3760-4206-8b9b-216d8b62e536
1
public void exec() { if (WindowStack.getLastInstance() != null) { setParent(WindowStack.getLastInstance()); } move(200, 200); show(); }
03eb9b25-37d0-44c6-a73f-7f585e6f8d12
4
public void formSolve(){ int col = 0; vec = new Solve(); for (int i = 0; i < size; i++) vec.Colors.add(0); for (int a : bestSolve){ HashSet<Integer> set = sets.get(a); for (int i = 0; i < size; i++) if (set.contains(i)) ...
4f65c7e2-5825-439c-809d-378c66d71950
0
public static void main(String[] args) throws MalformedURLException, IOException, InterruptedException { Notificator notificator = new Notificator(); Thread thread = new Thread(notificator); thread.start(); }
81d49238-9edc-4a1b-8421-6101f2fe0805
6
@Override public Boolean isValid() { // ==> The objective must be minimization if (!this.objective.equals(Objective.MIN)) { return Boolean.FALSE; } Integer mandatorySize = null; if (this.constraints.size() > 0) { mandatorySize = this.constraints.get(0).getSize(); } for (Immutab...
4df0bc2e-f666-42db-a352-db6f4fdf6e6f
2
public static int toInt(GameSize a) { switch (a) { case C8: return 8; case C7: return 7; default: return 6; } }
3b6eb50e-2f77-4456-8381-42fa7dd0ea05
0
public Float getYMax() { return yMax; }
05592ecf-0d0e-402d-a5ce-c4498928a62b
2
public Proxy(){ sTrace.setDebug(DEBUG); String hostName = "lab30.cpt.haw-hamburg.de"; InetAddress address; try { address = InetAddress.getByName(hostName); externAccounts.add(new MailAccount("bai4rnpE", "FpHBfTgM", address, 11000)); } catch (UnknownHostException e) { sTrace.error("Unknown Host: " + h...
d9cb34ac-72e8-4567-98d7-59e739cb8385
2
public static void insertBorne(Borne borne) { PreparedStatement stat; try { stat = ConnexionDB.getConnection().prepareStatement("insert into borne (serialNumber,etat,fk_id_station) values (?,?,?)"); stat.setString(1, borne.getSerialNumber()); stat.setString(...
b4604968-b5b8-4ec9-9f18-ad65f768d921
4
private Animation GetStnAnimation(dir d){ Animation fm = null; switch(d){ case down: fm=stndbydown; break; case left: fm=stndbyleft; break; case right: fm=stndbyright; break; case up: fm=stndbyup; break; } return fm; }
168df05b-c864-498e-a301-6f59268c7aa7
9
@Override public boolean okMessage(Environmental host, CMMsg msg) { if(!super.okMessage(host,msg)) return false; if(affected instanceof Item) { if((msg.targetMinor()==CMMsg.TYP_ENTER) &&(msg.target() instanceof Room) &&(msg.source()==((Item)affected).owner()) &&(text().startsWith("DST;"))) { ...
33c1c72c-39bc-4bff-a00f-3cc3bed146da
9
@Test public void testImplicitConversions() { System.out.print(String.format("%12s\t", "from \\ to")); for (int i = 0; i < typesToTest.length; ++i) { System.out.print(String.format("%12s\t", names.get(i))); } Logger.log(""); for (int i = 0; i < typesToTest.length; ++i) { System.out.print(String.forma...
ae45df60-b497-42b7-9d40-7710095f9834
1
public ArrayList<Integer> getScoresForHole(int holeNumber) { ArrayList<Integer> holeScores = new ArrayList<Integer>(); for (String profile : scores.keySet()) { holeScores.add(scores.get(profile).get(holeNumber)); } return holeScores; }
8a6fc437-e7fd-4e46-81a9-c2145eec2540
3
public void preRender(Graphics2D g) { for (int i = 0; i < tiles.length; i++) { for (int j = 0; j < tiles[0].length; j++) { if (tiles[i][j].intersects(new Rectangle((int) (-c.getXOffset() - 64), (int) (-c.getYOffset() - 64), 448 * 2 + 128, 360 * 2 + 64))) { tiles[i][j].preRender(g); } } } }
d2909d9d-c7b4-4cf8-8732-b1604fa78d14
0
public static void main(String[] args) throws Exception { test(new SleepBlocked()); test(new IOBlocked(System.in)); test(new SynchronizedBlocked()); TimeUnit.SECONDS.sleep(3); System.out.println("Aborting with System.exit(0)"); System.exit(0); // ... since last 2 interrupts failed }
6dc0a1cc-e97d-4e23-86cf-bb4c3f9c5b44
5
protected static Ptg calcPV( Ptg[] operands ) { if( operands.length < 3 ) { return new PtgErr( PtgErr.ERROR_NULL ); } debugOperands( operands, "calcPV" ); double rate = operands[0].getDoubleVal(); double nper = operands[1].getDoubleVal(); double pmt = 0; // TODO: No specified error trapping? if( ...
4f62fa53-3e6b-4aee-b343-f0000889f7e8
2
private boolean corner(int i){ int[][] corners = { {0,0}, {0,2}, {2,0}, {2,2}, }; if(i<corners.length){ if(isEmpty(corners[i][0],corners[i][1])){ x = corners[i][0]; y = corners[i][1]; ...
1b29e4ac-16b7-483d-b3f8-2e76908528cc
3
public boolean hasCard(String str) { for (DevCard dev : hand) { if (dev.getSubType() == str || dev.getType() == str) return true; } return false; }
9a96666b-8ce3-4b29-9efb-06b72d9ee6b4
4
private int cutRod(int n) { if (n == 0) // base case return r[n]; // memoized result if (r[n] != Integer.MIN_VALUE) return r[n]; int max = Integer.MIN_VALUE; for (int i = 1; i <= n; i++) { int t = cutRod(n - i); if ( p[i] + t > max) { max = p[i] + t; cuts[n] = new String(i + " " + cut...
6dd8f065-8353-4e3f-9f9d-1ad070549033
7
public static boolean start(String programpath, String command, boolean printOutput, String possibleErrorString) throws IOException, InterruptedException { if (command == null) { command = ""; } boolean ret = true; output = ""; Runtime rt = Runtime.getRuntime();...
24a44ef1-bae3-4490-beb6-3c427669f151
7
private boolean checkConvergence(double oldLikelihood, double newLikelihood, int currentIteration, int maxIterations, double tolerance) { return ((tolerance > 0.0d && (Math.abs(oldLikelihood - newLikelihood) <= tolerance || (maxIterations > 0 && currentIteration >= maxIterations))) || (tolerance <= 0.0d && curr...
77e879f8-3eb8-40dd-82b7-478fa73c0a40
1
public Object invokeConstructor(Reference ref, Object[] params) throws InterpreterException, InvocationTargetException { if (isWhite(ref)) return super.invokeConstructor(ref, params); throw new InterpreterException("Creating new Object " + ref + "."); }
306ef988-8634-4903-8c60-c075925e4ad4
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final GroupOfStudents other = (GroupOfStudents) obj; if (!Objects.equals(this.speciality, other.speciality)) { ...
1a83de42-2b82-4afc-8b7c-acb825282503
2
private void initializeLogger() { this.log = Logger.getLogger(this.getClass().getName()); try { FileHandler fh = new FileHandler(this.getClass().getName().replace("class ", "") + ".log"); fh.setFormatter(new SimpleFormatter()); this.log.addHandler(fh); } catch (SecurityException e1) { // TODO Auto-gen...
a431ca45-5b98-4538-a93d-c1d8e68f8c59
3
public ExcData(Class excClass, String excDescription) { if (excClass == null || excDescription == null || excDescription.trim().isEmpty()) { throw new IllegalArgumentException(); } this.excClass = excClass; this.excDescription = excDescription; }
673915ae-dae9-4ec3-9c92-bbe2f0dad6b6
6
@Override public void initialize(URL arg0, ResourceBundle arg1) { imeOff(); clearIndicator(); errorMessage.setVisible(false); txtBarCode.focusedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean...
aa541915-5c59-4946-9472-9b980e5c27e4
8
protected Boolean booleanConvert(Object value) { if (value instanceof Boolean) { return (Boolean) value; } if (value instanceof Number) { return (Math.abs(((Number) value).doubleValue()) < Float.MIN_VALUE) ? Boolean.FALSE : Boolean.TRUE; }...
022acf16-2b05-421e-8c5e-b8ec872a5f6c
0
public MyRecursiveTask(int array[],int start, int end) { this.array=array; this.start=start; this.end=end; }
b29e642e-8997-48ab-9f1f-d77443d29118
9
@Override public void keyReleased(KeyEvent keyEvent) { // // si presiono flecha para abajo // if (keyEvent.getKeyCode() == KeyEvent.VK_S) { // iDireccionCrowbar = 1; // cambio la dirección hacia abajo // } // si presiono Space bar para arriba if (keyEvent.getKeyCode(...
2310a3a0-6475-41a6-a980-859ffe98f7e9
7
@Test public void fuzzyTest() { for(int test = 0; test < 100; test++) { final Random rng = new Random(42 + test); final ObjectArrayBuilder<Integer> builder = new ObjectArrayBuilder<>(); int size = 100_000, l = 0, n = 0; do { final int action = rng.nextInt(4); if(action == 0...
042ec22f-10a8-4a32-8354-1ba723416a23
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Bill other = (Bill) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; retur...
4705e981-35db-406f-8603-2e94614f3de7
2
public void move(Direction dir) { if(!isPerformingAction()) { Tile targetTile = level.getTile(tile, dir); if(targetTile.canEnter(this)) { setCurrentAction(Action.MOVE); facingDirection = dir; moveDirection = dir; moveToTile = targetTile; tile.onLeaving(this); onLeaving(tile); moveToT...
03515b11-e5b8-4155-9fe9-d2f33fbe4c02
2
public BinInclude(File file, boolean littleEndian) throws IllegalIncludeException { if(!file.exists()) { throw new IllegalIncludeException("File "+file+" does not exist"); } int bytesize = (int)file.length(); if(bytesize % 2 != 0) { throw new IllegalInclu...
9f0e5a97-3eab-4254-9e83-9640d9c17fbe
0
public KeyStroke getKey() { return KeyStroke.getKeyStroke('d'); }
15036c49-5704-4458-8183-451a50bb2624
4
private SourceDataLine getOutputLine(int channels, int rate) { if (outputLine == null || this.rate != rate || this.channels != channels) { if (outputLine != null) { outputLine.drain(); outputLine.stop(); outputLine.close(); } initJavaSound(channels, rate); outputLine.start(); } return ...
005bf415-fcac-4fdc-b3fe-ac6d53db9d63
1
public boolean subtypeOf(CtClass clazz) throws NotFoundException { return this == clazz || getName().equals(clazz.getName()); }
fbb11353-07d3-444d-aab4-b9293564fb59
8
public void mouseClicked(MouseEvent ee) { if ( ee.getX()>= 70 && ee.getX() <= 470 && ee.getY() >= 180 && ee.getY()<=280) { MainIdeal.main(null); setVisible(false); } if ( ee.getX()>= 70 && ee.getX() <= 470 && ee.getY() >= 320 && ee.getY()<=420) { new Output_main("! ߸ν!"); setVisible(false); ...
5b06a06d-ea19-46f1-932b-a3a9d9fe34d9
5
private ArrayList<String> words(String line, String stopwordsFileLocation){ if(stopwords.size() == 0) addStopwords(stopwordsFileLocation); ArrayList<String> result = new ArrayList<String>(); String[] words = line.split("[ \t\n,\\.\"!?$~()\\[\\]\\{\\}:;/\\\\<>+=%*]"); for(int i=0; i < words.length; i++){ ...
fbeeac6c-4455-4cc2-9c11-0c2cd480d2b0
4
public Descriptor compile(SymbolTable table){ Descriptor d = null; if(type instanceof IdentNode){ String s = ((IdentNode) type).getIdentName(); if(s.equals("integer")){ d = new SimpleTypeDescriptor(Type.INTEGER); } else if(s.equals("boolean")){ d = new SimpleTypeDescriptor(Type.BOOLEAN); }...
81a34b5c-2298-4850-bb6a-b403138e5179
8
public void paintComponent(Graphics g) { super.paintComponent(g); if (values == null || values.length == 0) return; double minValue = 0; double maxValue = 0; for (int i = 0; i < values.length; i++) { if (minValue > values[i]) minValue = values[i]; if (maxValue < values[i]) ...
ca9c2fee-8b27-45fe-a97d-b50ebb57e3e7
6
public int compareTo(Object o) { Handler second = (Handler) o; /* First sort by start offsets, highest address first... */ if (start.getAddr() != second.start.getAddr()) /* this subtraction is save since addresses are only 16 bit */ return second.start.getAddr() - start.getAddr(); /* * ...Seco...
288d905e-8d37-4444-836a-c7e1381ca149
6
final boolean method1174(boolean flag, byte byte0) { int i = anInt2197; int j = anInt2161; if (flag) { i = anInt2177; j = anInt2157; } if (i == -1) { return true; } boolean flag1 = true; if (!Class142_Sub27_Sub21_Sub1.aC...
b0a1e56e-59e6-429a-be98-3b161586c892
4
private void PlaceNodes(int HS, XmlNode node) { if (HS < 1) throw new RuntimeException("HS must be greater than 1"); if (node == null) throw new RuntimeException("node can not be null"); Random PlaceRandom = new Random(System.currentTimeMillis()); int x = (int) (Distribution.getUniformRandom(Place...
447e1716-447c-4900-b2a5-89c4b1ba5319
9
@Override public void actionPerformed(ActionEvent ae) { if (ae.getSource() == kaks) { peli.setPelaajienMaara(2); } if (ae.getSource() == kolme) { peli.setPelaajienMaara(3); } if (ae.getSource() == nelja) { peli.setPelaajienMaara(4); ...
39eb1aa9-c12b-4996-af47-7afd4a146320
8
private void handlePendingSimpleTypes() { for (Iterator<Entry<String, Map<String, String>>> it = pendingSimpleType.entrySet().iterator(); it.hasNext(); ) { Entry<String, Map<String, String>> entry = it.next(); String complexType = entry.getKey(); Map<String, String> attsWithPendingType = entry.getValue()...
0d9350d0-5e3b-4489-ba16-cca34f55eb69
5
public boolean split() { if (width < MINWIDTH || height < MINHEIGHT || b1 != null || b2 != null) { return false; } if (new Random().nextBoolean()) { return hsplit(); } else { return vsplit(); } }
e81cd43b-75fe-4207-9523-4939d1d97c81
6
public int removeMobs(ArrayList<Object> mobTypes, boolean removeAll) { int numMobs = 0; for (MMWorld world : MMComponent.getLimiter().getWorlds()) { for (LivingEntity entity : world.getWorld().getLivingEntities()) { MobType mob = MobType.valueOf(entity); ExtendedEntityType type = ExtendedEntityT...
9a12245c-dc71-4705-af15-e40487970bc0
7
private E findKey(BinaryTreeNode<E> current, E key) throws ValueException { if (root == null) {// empty tree return null; } if (!isComparable(current.data, key)) { System.out.print(current.toString()); System.out.print(key.toString()); throw new ValueException("Key is not comparable!"); } if (c...
a1629b17-f689-41b2-8108-90a58d065f90
5
public String replaceInsert(File mainFile) { String input = ""; try { Scanner in = new Scanner(mainFile); while (in.hasNext()) input += in.nextLine() + "\n"; } catch (FileNotFoundException e) { Main.error("file not found (" + mainFile.getName() + ")"); } Pattern p = Pattern.compile("#insert \"...
ac5a9596-4fb0-4592-8acb-bda8a68fd36f
8
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(false); String userPath = request.getServletPath(); if(userPath.equals("register")){ // hier sind...
9494abea-2bed-4b0c-bd2e-56014dafc0a8
0
public void setStatus(int status) { this.Status = status; }
acacd999-c2e9-4d99-a5ae-2b32a05603eb
2
@Override public int insertOne(String strTabla) throws Exception { ResultSet oResultSet; java.sql.PreparedStatement oPreparedStatement; int id = 0; try { String strSQL = "INSERT INTO " + strTabla + " (id) VALUES (null) "; oPreparedStatement = oConexionMySQL.pr...
c2bc4394-8923-4461-badd-2ec324260695
7
public void update(IObservable o) { if (myWorld.getGameOverStatus() && !newScoreRecorded) { int score = myWorld.getScore(); for (int i = 0; i < highScores.length; i++) { if (score > highScores[i]) { int temp = highScores[i]; highScores[i] = score; score = temp; i = 0; } } sco...
c54a66fd-0c6f-411d-bb7f-a963ca08f3b7
7
public void handle(Run run, TaskListener listener) { Logger logger = Logger.getLogger(Phase.class.getName()); logger.info("Run " + run.toString() + " entered phase " + this.toString()); Job job = run.getParent(); CiLightProperty property = (CiLightProperty) job.getProperty(CiLightPropert...
15a2b505-ca84-4469-92ff-20d3174c27fa
7
public Object nextValue() throws JSONException { char c = nextClean(); String string; switch (c) { case '"': case '\'': return nextString(c); case '{': back(); return new JSONObject(this); case '[': ...
c490a5fa-7cf8-41fa-b20e-bfc0741b64b5
9
public int place(Piece piece, int x, int y) { // flag !committed problem if (!committed) throw new RuntimeException("place commit problem"); committed = false; backup(); int result = PLACE_OK; int pieceX,pieceY; TPoint body[] = piece.getBody(); for(int i =0; i < body.length;i++) { pieceX = x+body[...
8f0aa2af-8fdc-4e9f-86a0-f6caaaa3b858
8
public AnnouncementTable(ArrayList<Announcement> ann){ super(); this.announcements = ann; this.setModel(new javax.swing.table.AbstractTableModel(){ @Override public int getRowCount(){ return announcements.size(); } @Override public int getColumnCount(){ return...
151cfd3b-f4f4-4b82-9a73-8c8e4b7868ad
2
public static void render(String msg, Screen screen, int x, int y, int color, int scale){ msg = msg.toUpperCase(); for(int i = 0; i<msg.length();i++){ int charindex = chars.indexOf(msg.charAt(i)); if(charindex>=0){ screen.render(x+i*8, y, charindex+30*32, color,0x00,scale);} } }
b84caa64-00d2-4a81-bd4e-66216b9baeac
2
private StockItem getStockItemByBarcode() { try { int code = Integer.parseInt(barCodeField.getText()); return model.getWarehouseTableModel().getItemById(code); } catch (NumberFormatException ex) { return null; } catch (NoSuchElementException ex) { ...
6ea3af64-e092-4a29-84d9-72f214ef2eef
7
public static String getLoggedUserName(HttpServletRequest request) throws SQLException { String savedLogin, savedHash; savedLogin = savedHash = null; Cookie[] cookies = request.getCookies(); if(cookies != null) { for(Cookie c : cookies) { String name ...
72d35385-a5cf-478d-ba3a-90d1f0d4ad9a
2
@Override public void validate(Object target, Errors errors) { // TODO Auto-generated method stub ProfileInfo profileInfo = (ProfileInfo)target; if( profileInfo.getProfileName()==null || profileInfo.getProfileName().trim().isEmpty()){ errors.rejectValue("profileName", "required"); } }
bb46a9b2-f246-499d-8a08-7b6834640e59
6
public static void renderModel(Model model) { for (Geometry curGeometry : model.geometryList) { glPushMatrix(); for (GeometryObject curGeometryObject : curGeometry.geometryObjectList) { Effect curEffect = model.materialEffectMap.get(curGeometryObject.materialReference); ...