method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
329d4ca1-6324-466d-a69d-a5b6f511aff9
2
public void paintPoints(Graphics2D g2d) { // this paints the points for(FunctionSubpanel sub : Client.equationPanel.functionList){ g2d.setColor(sub.graphColor); for(int i = 0; i < sub.getPointsList().size(); i++){ g2d.fillOval(sub.getPointsList().get(i).getX() + (int)(thi...
92f82848-7fa5-4ded-aa78-a4e8d866f630
0
@Test @TestLink(internalId = 4) public void testSuccessInternal() { assertTrue(true); }
da7f092e-119d-4204-b752-cdcd14cc1a69
2
public Result run(Reader expressionReader) throws GeneralException, ExceptionWithPosition { TransitionMatrix trMatrix = getTransitionMatrix(); States state = trMatrix.getStartState(); while (!expressionReader.isEnd()) { state =evaluateState(state, expressionReader); if (...
5c04bb20-90db-428b-963b-1bd59d62fed9
2
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) { myController.transitionCreate(first, state); } first = null; getView().repaint(); }
19a89637-2f42-4be5-b629-ef3b8bd431e6
8
public void load() { initFields(); if (verbose) Timer.showStdErr("Counting lines from '" + fileName + "'"); size = Gpr.countLines(fileName); if (hasTitle) size--; if (verbose) Timer.showStdErr("Done. " + size + " data lines."); // Initialize all array objects initArrays(size); // Read file if (verb...
313a73d9-ab69-4b57-b26f-445aeae5a9bd
5
public boolean transactionIngEquals() { return dateEquals() && nameEquals() && oppositeAccountEquals() && amountEquals() && isFromEquals() && typeEquals(); }
964c2ae1-2a31-4151-93ab-a557c0fe9589
0
public static Activator getDefault() { return plugin; }
f3604d29-ea75-4c1b-89bc-8c704edc069e
2
@Override protected Void doInBackground() throws Exception { final int BUFFER_SIZE = 10000; Client client = new Client(BUFFER_SIZE, BUFFER_SIZE); client.getKryo().register(PacketLogin.class); client.getKryo().register(PacketLoginResponse.class); client.getKryo().register(Pac...
19f888c5-2f3b-43f1-9877-3de6a653a252
4
public void notifyBeatObservers(int code) { for (BeatObserver observer : beatObservers) { if (code == Constants.BEAT_EVENT_CODE) { observer.updateBeat(); } else if (code == Constants.STARTED_EVENT_CODE) { observer.updateStarted(); } else if (co...
c0f8f1ba-e37d-4e5b-817c-c30cf7d31676
1
public int totalNQueens(int n) { if (n <= 0) return res; int[] occ = new int[n]; Arrays.fill(occ, Integer.MIN_VALUE); totalNQueensDFS(0, n, occ); return res; }
582c276a-7b05-4b4f-b774-7bfc79cd9e8e
2
public Bag getDiscsWithSpeed(int speed) { LOGGER.log(Level.INFO, "Getting discs with speed " + speed); Bag discBag = new Bag(); for (int i = 0; i < discs.size(); i++) { if (discs.get(i).getSpeed() == speed) { discBag.addDisc(discs.get(i)); } } ...
9877fe03-d284-4e49-8e48-b39c4d70b696
1
private static int initImage2(final Display display, Composite inComposite) { int heightHint = 0; final Composite original = new Composite(inComposite, SWT.BORDER); try { //image2 = new Image(display, new FileInputStream(image2Path)); image2 = new Image(display, Resource.class.getResourceAsStream(image2Path...
51e51cff-be11-4b03-8b75-0e1ccc26d33c
2
public void print_extraction_method(Hashtable<String, LinkedList<Triple<String,String,String>>> relations) throws IOException { w.write("Number of relations: " + relations.size()+"\n"); System.out.println("Number of relations: " + relations.size()); LinkedList<Tuple<String, LinkedList<Triple<String,String,String>...
2034d894-c663-4f04-bcd8-81c1e26afa05
3
int findIndex(T val) { int lb = 0; int ub = this.core.size(); // Invariant: // +-------+------+-------+ // | < val | ? | > val | // +-------+------+-------+ // 0 lb ub length while (lb < ub) { // Find the midpoint in a relatively safe way (assum...
ac14173e-d79f-408a-8acd-afec679cb02b
5
@EventHandler public void SpectatorQuit(PlayerQuitEvent event){ Player p = event.getPlayer(); String pname = p.getName(); for(i = 0; i < plugin.Watching.size(); i++){ if(plugin.Watching.get(i)!= null){ if(plugin.Watching.get(i).contains(pname)){ plugin.Watching.get(i).remove(pname); String[] Spa...
8f4dcc2d-7c37-40fe-b9fe-2634747bbb15
1
public void addOption(CmdLineOption option) { for (String name : option.getNames()) { mOptions.put(name, option); } }
b7200184-83fc-4f4f-b796-de34d3b15b73
9
private void createControl(JPanel eventControlsPanel, final Event currentEvent, final String prefixLabel, final String suffixLabel, final int dataFieldSize, final int argumentIndex) { if (null != prefixLabel) { eventControlsPane...
c36c4311-d3df-4cda-96c8-7b34bb2610a9
5
public void actionPerformed(ActionEvent ae) { // // Process the action command // // "ok" - Data entry is complete // "cancel" - Cancel the request // "help" - Display help for categories // try { String action = ae.getActionCommand(); ...
fe7b6b58-2222-4ad1-a8a8-f0fc3e3193f1
6
double getValue( int tblPos, long[] timestamps ) { long time = timestamps[tblPos]; // Out of range if ( time > xVal2 || time < xVal1 ) return Double.NaN; // Hrule if ( yVal1 == yVal2 ) return yVal1; // Vrule if ( yVal1 == Double.MIN_VALUE && yVal2 == Double.MAX_VALUE ) return Double.NaN...
7a717117-413b-4abc-801e-4017013d8dd3
7
@Override public void run() { String responseLine; String[] boardarray = {"TEMPORARY","TEMPORARY","TEMPORARY","TEMPORARY","TEMPORARY","TEMPORARY","TEMPORARY","TEMPORARY","TEMPORARY","TEMPORARY","TEMPORARY","TEMPORARY","TEMPORARY","TEMPORARY","TEMPORARY"}; String temp; ...
1b7cb075-8155-4abb-b1cc-d3bf663c0057
2
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // luodaan olio businessluokasta TiedoteService service = new TiedoteService(); // haetaan mitä buttonia painettiin String action = request.getParame...
ce341500-2d06-4b7d-a7cc-26972629eb8c
7
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof NeutralLoss)) return false; NeutralLoss that = (NeutralLoss) o; if (Double.compare(that.avgMass, avgMass) != 0) return false; if (Double.compare(that.monoMass, monoMass) != 0) return ...
33d50b20-6c98-4e80-a98d-623b50e6b119
4
public void pintarTablero(){ for(int i=0; i<filas; i++){ for(int j=0; j<columnas; j++){ //Si encuentra una ficha de la maquina, pinta el boton correspondiente con su color if(this.menuJuegoNuevo.devolverJuegoNuevo().devolverTablero4R().posicionFicha(i,j) == 2){ ...
be938b24-97ec-4300-af79-0dfa8fb08f7f
3
public int getNumberOfItems(char type) { int number = 0; for (int i = 0; i < field.length; i++) { for (int j = 0; j < field[0].length; j++) { if (type == getItemType(new Position(i, j))) { number++; } } } return ...
e39c4aca-283d-42f3-a76f-982e9e7cf749
2
public void displayNameList(String[] names) { System.out.println("\n\t______________________________________________________________________"); System.out.println("\n\tHere are the two players in this game."); for (int i = 0; i < names.length; i++) { if (names[i] == null) { ...
696441fe-c1d8-49d1-b1c1-09c2d09a8ec5
2
private void threeInARow(boolean on) { for(int x = 1; x <=3; x++) { myLED.move(); if(on) myLED.putBeeper(); } myLED.move(); }
e8ccd923-2fbb-49fb-9d4f-19890160ada5
0
private Xpp3Dom createElementWithText(String elementName, String text) { final Xpp3Dom element = new Xpp3Dom(elementName); element.setValue(text); return element; }
817267ca-3652-49d8-8472-32654284408c
0
public Product(PartA partA, PartB partB, PartC partC) { this.partA = partA; this.partB = partB; this.partC = partC; }
22a1362c-bd28-4dd7-8dec-3d03b2f21b27
6
@EventHandler public void GiantHunger(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getGiantConfig().getDouble("Giant.Hunger.Dodg...
a8f025b9-5ca3-43a1-bb1f-55447bb5450d
2
public void readSource(String input) { StringBuilder sb = new StringBuilder(); try { FileInputStream fis = new FileInputStream(input); DataInputStream dis = new DataInputStream(fis); BufferedReader br = new BufferedReader(new InputStreamReader(dis)); String line; while ((lin...
d1e9c15f-8fa0-4c41-8ec3-f569b67e33a3
6
public void renderTiles(Screen screen, int xOffset, int yOffset) { if (xOffset < 0) xOffset = 0; if (xOffset > ((width << 3) - screen.width)) xOffset = ((width << 3) - screen.width); if (yOffset < 0) yOffset = 0; if (yOffset > ((height << 3) - screen.height)) yOffset = ((height << 3) - screen.height...
44b9c194-6259-4ccf-9bdd-899ee06310a9
5
@Override public void say(String toSay) { int fileNum = 0; for (String s : cut(conform(toSay))) { try { download( BASE_URL + "?tl=" + lang + "&q=" + s, TEMP_PATH+"part"+fileNum++ + ".mp3"); } catch (IOException e) { e.printStackTrace(); } } Player p = null; File f = nu...
d80a6ba9-cfa2-457e-9d80-c7dc7eb1154f
2
public void actionPerformed() { switch(type) { case KEYPRESS: break; case PLAYER_TOUCH: read(); break; default: break; } }
978a8d3e-9a7d-4f51-bcb9-1276cf44c173
6
public static void makstest() { int[] a = {8, 3, 5, 7, 9, 6, 10, 2, 1, 4}; int[] b = {645, 143, 231, 65, 213, 8987, 1, 287, 15, 659}; int[] c = {0, 2, 40, 6, 9, 1, 8, 65, 2, 4}; // maksverdien 10 er i posisjon 6 if(a[tredjeMaks(a)[0]]!=a[6]||a[tredjeMaks(a)[1]]!=a[4]|| ...
a4bce6b1-ce10-48e3-a756-e82d522a5b5f
7
public static boolean computedPredicateP(Proposition goal) { { GeneralizedSymbol operator = goal.operator; Description description = null; if (operator == Logic.SGT_PL_KERNEL_KB_HOLDS) { { Stella_Object relationarg = Logic.argumentBoundTo((goal.arguments.theArray)[0]); if ((relationa...
52bf58e5-98b5-40b2-a0c9-22d0fe525c46
8
void writeResponse(final DataOutputStream outputStream, final Status status, final AddressType addressType, final InetAddress boundAddress, final byte[] hostname, final int port) throws IOException { byte[] safeAddress = null; if (boundAddress == null) { if (addressType == AddressType.IP_V6) { safe...
8069a06d-4bd1-4102-ab2b-f45c03ec7ffb
4
public ArrayList<Forecast> getForecast() throws SQLException{ QueryBuilder qb = new QueryBuilder(); Date date = new Date(); // Current date & time long maxTimeNoUpdate = 3600; // Maximum one hour with no update ArrayList<Forecast> forecastFromDB = new ArrayList(); long date1 =...
c1f5e311-45f2-4c8b-ba34-89a6c4a81b1f
5
public void blob(Message msg) { while (!msg.eom()) { switch (msg.uint8()) { case GMSG_TIME: Timer.server = msg.int32(); ; Timer.local = System.currentTimeMillis() / 1000; break; case GMSG_...
b2c3d335-5e29-496e-a341-3fc98aae5f24
9
private static WorldSetup loadWorldSetupFromFile(String worldFile) { WorldSetup[] worldSetups = null; try { worldSetups = WorldSetup.parseFromFile(worldFile, MyKara.class, WORLD_SETUP_TITLE_KEY, KARA_DIRECTION_KEY); if (worldSetups == null || worldSetups.length == 0) { if (worldSetups == null ||...
750bf646-5127-42cf-a5db-7979ae49170f
4
public static long numberByPermutation(int[] p) { int n = p.length; long[] fact = new long[n]; fact[0] = 1; for (int i = 1; i < n; i++) { fact[i] = i * fact[i - 1]; } long res = 0; for (int i = 0; i < n; i++) { int a = p[i]; for...
9cf9ee65-192b-49d7-a536-684980298137
3
@Override public void keyPressed(KeyEvent k) { super.keyPressed(k); Method action = keyMapping.get(k.getKeyCode()); if (action == null) { System.gc(); return; } try { action.invoke(board); board.repaint(); } catch (Invoc...
7a08c219-5e4b-49a2-ac0f-80b137026550
6
public boolean gotoState(final String str_state, Object... cl_data) { // attempt to get the new state FSMState lcl_newState = mcla_states.get(str_state); if (lcl_newState == null) { BTLog.debug(this, "gotoState", "No state found for " + str_state); return false; } FSMState lcl_currentState = null; ...
0e205860-5b30-4e24-81c6-75160b60d9c0
2
@Override public int sizeOf( T[] v ) { if (v == null) { return Compress.NULL_SIZE; } int size = Compress.NULL_SIZE; for (int i = 0; i < v.length; i++) { size += reflect.sizeOf( v[i] ); } return siz...
d85f0769-87a9-44c8-8269-821732406ef7
3
public Section getModel(int section_ID) { Section section=new Section(); try { StringBuffer sql = new StringBuffer(""); sql.append("SELECT Section_ID,Exam_ID,Section_Name,TimeLimit"); sql.append(" FROM `Section`"); sql.append(" where Section_I...
150cb3af-1e80-45cc-b1af-2ef70a6044f2
3
public static boolean getPassword(OTPassword theOutput) { if (null == password) { return false; } StringBuilder str = new StringBuilder(); for (int i = 0; i < password.length; i++) { str.append(password[i]); } if (str.length() > 0) { th...
a0595624-b34a-4ee4-8bb4-8944adfdfd58
4
private Vector3D[] createCartPlane(float[] o) { Vector3D[] vector = new Vector3D[4]; for (int i = 0; i < 4; i++) { vector[i] = new Vector3D(0,0,0); } if(o[Y] != 0){ vector[0].setX(-maxX); vector[0].setY((o[D] - (o[X] * -maxX) - (o[Z] * maxZ)) * (1/o[Y])); vector[0].setZ(maxZ); vector[1].setX(-maxX)...
37bb436a-40a8-43d3-8348-cb6c5863ab96
5
public String getModVersion(String modName){ JSONParser parser = new JSONParser(); try { Object obj; if(modName.equals("base")){ obj = parser.parse(new FileReader(gamePath + "/data/base/info.json")); } else if(modName.contains(".zip")){ getJsonFromZip(modPath + modName); obj = parser.pa...
d346b0cf-4808-4126-9e76-7c1429a0d820
0
public String getCurrentDate() { return currentDate; }
4714b8f4-034a-4569-b652-7edc4cac20b9
9
public Object getValueAt(int row, int col) { ReturnMsg msg = data.get(row); if (col == 0) { return msg.getGuess(); } else { if (msg.isDone()) { if (msg.isError()) { if (col == 1) { return msg.toString(); } return ""; } else { int common = msg.getCommon(); int correct =...
9a9b4ea8-918e-4468-be11-67292819db90
0
void sumTotalAmount(int amount) { totalAmount = BigDecimal.valueOf(totalAmount).add(BigDecimal.valueOf(amount)).intValue(); totalAmountProperty.set(String.format("%,d", totalAmount)); }
db9b7de5-51e6-46df-8249-e4495eaa2c50
2
public static String decodeURIComponent(String s) { if (s == null) { return null; } String result = null; try { result = URLDecoder.decode(s, "UTF-8"); } // This exception should never occur. catch (UnsupportedEncodingException e) { result = s; } ...
59c44efd-a8ef-4d22-8f71-490f0232980d
6
public void sanityCheck() { if (DEBUG) { // check heights[] is correct for (int i = 0; i < width; i++) { int chHeight = checkColumnHeight(i); if (chHeight != heights[i]) { throw new RuntimeException("Heights[] incorrect"); } } // check widths is correct for (int j = 0; j < heig...
3acbe4f4-58db-4aa1-9290-c9ca526beaf6
3
public void run(){ running = true; final int LOGIN_PORT = 4711; try { ServerSocket loginServerSocket = new ServerSocket(LOGIN_PORT); ServerDataBaseManager sDBM = new ServerDataBaseManager(); while(true){ if(running){ new LoginServerExecutionThread(loginServerSocket.accept(), sDBM).start(); }...
fb57a926-e246-428d-a7c6-475c1dafb221
4
public static void main(String[] args) { String serviceName = null; String serverIp = null; int serverPort = 0; if (args.length != 3) { System.out.println("Usage: java test.test3Client <ServiceName> <ServerIp> <ServerPort>"); return; } else { serviceName = args[0]; serverIp = args[1]; serverPo...
dec35ad0-1be1-4bc3-9e6b-712341052697
7
protected int widestDim(double[][] nodeRanges, double[][] universe) { final int classIdx = m_Instances.classIndex(); double widest = 0.0; int w = -1; if (m_NormalizeDimWidths) { for (int i = 0; i < nodeRanges.length; i++) { double newWidest = nodeRanges[i][m_DistanceFunction.R_WIDTH] / un...
3fb12675-95a4-460c-afc7-e7b444aa787d
5
@Override public Object parseClass(Class<?> c, Object o, MainView view) { Method methods[] = c.getMethods(); for(int i = 0; i < methods.length; i++){ try{ if(methods[i].isAnnotationPresent(InitializePlugin.class)){ if(o == null){ o = c.newInstance(); Log.getLogger().log(Level.INFO, "In...
233a9f9e-3456-4496-af31-b6784dd40be3
9
private void addContents() throws DocumentException, IOException { this.getDocument().addTitle("Карта вызова скорой медицинской помощи"); Paragraph preface = new Paragraph(); preface.setAlignment(Element.ALIGN_RIGHT); Chunk chunk = new Chunk( "Приложение N 3\n" + ...
e679ece8-a18a-4196-8bd6-a22390fd3dbe
5
private void init() { Pixmap pm = new Pixmap(Gdx.files.internal("images/cursorImage.png")); Gdx.input.setCursorImage(pm, 0, 0); // pm.dispose(); // video ------------------------------------------------ spriteSheet = new Texture("images/sprites.png"); flappyBirdFrames = new Sprite[4]; flappyBirdFrames...
23b72549-23b3-4a47-9810-819c2418525b
1
public Builder mass(double receivedMass) { if (receivedMass < 0) { log.warn("Wrong Mass. receivedMass ={}", receivedMass); throw new IllegalArgumentException("Mass must be > 0 received value = " + receivedMass); } this.mass = receivedMass; ...
fe341a6d-4ca0-476f-87e6-50fadee532f6
9
public static void DoTurn(PlanetWars pw) { //notice that a PlanetWars object called pw is passed as a parameter which you could use //if you want to know what this object does, then read PlanetWars.java //create a source planet, if you want to know what this object does, then read Planet.java Planet...
97b8a2be-3c49-4098-9a8c-22d4bd239495
6
public void onMessage(Application.Request message) { System.out.println(message); if (Requests.QUIT.equals(message)) { dispatch(Events.SHUTDOWN); } if (Requests.SetTeam.class.isInstance(message)) { Requests.SetTeam set = Requests.SetTeam.class.cast(message); ...
991d46ed-6637-495a-9ba7-35ea13967fb7
8
private void assemble() { if(sourceFile == null) { printError("-i : No source file specified"); } if(assembler == null) { printError("-f : No format specified"); } print("...Assembling " + sourceFile.getName()); as...
02d03280-aa84-4471-8945-4c7469c40e3b
5
public void exportAnimation(File file, int delay) { AnimatedGifEncoder encoder = new AnimatedGifEncoder(); encoder.setRepeat(0); encoder.setDelay(delay); Color transparentColour = new Color(255, 0, 128); encoder.setTransparent(transparentColour); encoder.start(file.getPat...
8c234495-8782-4ced-a72f-2ed79afe8e9a
0
public String getImportEncoding() { return (String) importEncodingComboBox.getSelectedItem(); }
21737824-852c-4b71-97a5-c04160b99756
3
@Test public void getStudentBookingByDateTest() { Booking b = null; Student s = null; try { b = bookingService.find(0); s = b.getStudent(); } catch (InstanceNotFoundException e) { assertTrue("Booking not found", false); } List<Booking> lb = bookingService.getStudentBookingsByDate(s, b.getDat...
6c42341c-40a1-4d82-a86a-a24e8c40c9a3
2
public int getNumberOfAlive(){ int res = 0; for (Being being: beings){ if (being.isHuman()){ res++; } } return res; }
32210141-e626-455e-b99b-38e902e8664b
6
public float priorityFor(Actor actor) { if (stage >= STAGE_DONE || ! canTalk(other)) return 0 ; float value = actor.mind.relationValue(other), novelty = actor.mind.relationNovelty(other), solitude = actor.mind.solitude() ; novelty *= (actor.traits.scaleLevel(INQUISITIVE) + 1) / 2f...
fddb16ee-de25-4e57-9c8c-ed6d19252434
8
public static Cons getQueryPatternEvaluators(Surrogate relationref) { { Cons evaluatorforms = Stella.NIL; { MemoizationTable memoTable000 = null; Cons memoizedEntry000 = null; Stella_Object memoizedValue000 = null; if (Stella.$MEMOIZATION_ENABLEDp$) { memoTable000 = ((Memoi...
7fc13c67-1e20-47cc-b46f-330aca44559a
9
public Texture getTexture() { ImageComponent2D[] scaledImageComponents = null; BufferedImage[] scaledBufferedImages = null; if (tex == null) { int width; int height; if (forcePowerOfTwo) { width = getClosestPowerOf2(bufferedImage.getWidth()); height ...
94464fbe-303a-4946-b1b7-cdf756c9198d
0
public static void main(String[] args) { ValidatePreorderTree validatePreorderTree=new ValidatePreorderTree(); String s="1,#,#"; System.out.println(validatePreorderTree.isValidSerialization(s)); }
4f645d1c-5935-4a31-8588-9224e2355ecc
6
public void run() { while (true) { try { ClientPlayer.bX = in.readInt(); ClientPlayer.bY = in.readInt(); ClientPlayer.sYPos = in.readInt(); ClientPlayer.serverScore = in.readInt(); ClientPlayer.clientScore = in.readInt(); } catch (IOException e) { System.out.println("Disconnected from Se...
3f84ce33-078b-46ad-b79d-34d8a205b3dd
2
public static UnparsedConfigurationData getData(String name){ try{ URL oracle = new URL("http://www.wdfatv.net/olywar/output.php?user=" + name); BufferedReader in = new BufferedReader(new InputStreamReader(oracle.openStream())); return new UnparsedConfigurationData(in.readLine().replaceAll("/","#...
f9a7cdaf-da7a-4a1a-8945-4e3e3ed12e10
8
@Override public int getTrainingCost(MOB mob, int abilityCode, boolean quiet) { final int curStat=mob.baseCharStats().getRacialStat(mob, abilityCode); final String list = CMProps.getVar(CMProps.Str.STATCOSTS); final int maxStat = CMProps.getIntVar(CMProps.Int.BASEMAXSTAT)+mob.charStats().getStat(CharStats.CODES...
1aba13bc-0c5d-4510-b4af-526b407bd7fe
2
public static ArrayList<Status> showAll() { ArrayList<Status> status = new ArrayList<Status>(); Database db = dbconnect(); try { db.prepare("SELECT * FROM ticket_status ORDER BY StatusID"); ResultSet rs = db.executeQuery(); while(rs.next()) { status.add(StatusObject(rs)); } ...
f7ceb426-25a1-45e5-8526-defe4133d537
4
public void performEvent(SimulationEvent reaction, int times) { String initState = reaction.getInitialState().getStateName(); String finalState= reaction.getFinalState().getStateName(); if ( (initState.equals(states[0].getStateName())) && (finalState.equals(states[1].getSta...
dcae14c3-d624-47ee-a6b6-1ce256063af8
3
private void processEntry(final ZipInputStream zis, final ZipEntry ze, final ContentHandlerFactory handlerFactory) { ContentHandler handler = handlerFactory.createContentHandler(); try { // if (CODE2ASM.equals(command)) { // read bytecode and process it // // with TraceClassVisitor // ClassReader cr = ...
8e310c4c-8196-4bb2-9d52-4be8a25b30d5
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
73c6f471-9d62-4d5b-8128-2db7da39f286
4
public JSONWriter key(String string) throws JSONException { if (string == null) { throw new JSONException("Null key."); } if (this.mode == 'k') { try { this.stack[this.top - 1].putOnce(string, Boolean.TRUE); if (this.comma) { ...
024501d2-0e5c-4906-9a6e-c486f975a0bf
6
private boolean check(int[][] coordinates) { for(int i=0;i<4;i++) { if (coordinates[i][0]<0 || coordinates[i][0]>=board.getNumberOfRows()) return false; if (coordinates[i][1]<0 || coordinates[i][1]>=board.getNumberOfColumns()) return false; if (board.getCell(coordinates[i][0]...
ef0c8799-5e3a-44ae-be0e-886330be34d2
9
private static final void drawCircleFootprint(Graphics graphics, int xc, int yc, int thickness) { // Declares and intialise helper variables final List<Integer[]> edges1stOctant, edges2ndOctant, edgesQuadrant; edgesQuadrant = new ArrayList<>(); edges2ndOctant = new ArrayList...
02b68302-2cc0-4b5a-b335-6637905aaacc
6
@EventHandler public void PigZombieNausea(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getPigZombieConfig().getDouble("PigZombie...
0e822b79-34e9-418a-be6d-543f49492ece
7
public static TreeNode preorder(TreeNode root) { if (null != root) { if (null == root.left && null == root.right) return root; TreeNode right = root.right; TreeNode leftend = null; if (null != root.left) { leftend = preorder(root.left); root.right = root.left; root.lef...
72062ad2-b55d-4257-8410-4c9907e53113
3
protected void processGISResourceList(Sim_event ev) { if (ev == null || ev.get_data() == null) { return; } Integer id = (Integer) ev.get_data(); int tag = AbstractGIS.GIS_INQUIRY_RESOURCE_RESULT; /***** // Debug info System.out.println(super.get_name()...
483c0540-0c32-403c-91c9-d16bbcd7ca77
9
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if (qName.equals("rowset")) { if (roles) { roles = false; } else if (grantableRoles) { grantableRoles = false; } else if (rolesAtHQ) { rolesAtHQ = false; } else if (grantableRolesAtHQ) { gra...
a56c7271-4fe0-4940-9366-ef188a3c3ac1
8
private void begin() { Scanner scn = new Scanner(System.in); int qTc = Integer.parseInt(scn.nextLine()); for ( int tc = 1; tc <= qTc; tc++ ) { int dim = Integer.parseInt(scn.nextLine()); char matrix[][] = new char[dim][]; for ( int l = 0; l < dim; l++ ) { matrix[l] = new char[dim]; String line = ...
32dc6c81-98cd-4795-b3ca-5ab8b5b2ab60
3
private void setAPR(Loan loan) throws LoanEntryException { String apr_str = readAPR(); // APR in decimal point double interest = 0d; try { interest = Double.parseDouble(apr_str); if (interest < 0) { throw new LoanEntr...
789747d2-71cb-41a2-a754-86b20346fc01
3
private void peopleTableMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_peopleTableMousePressed if(peopleTable.rowAtPoint(evt.getPoint()) == -1){ personModel.fireTableDataChanged(); //purkkaviritys, koska personTable.clearSelection() //jättää solun valinnan ...
7df9ee4d-b94b-4c2c-848f-dec74e335496
0
public void setjLabel4(JLabel jLabel4) { this.jLabel4 = jLabel4; }
59d12934-12f2-43e5-b62f-c31744fca14f
1
public static DownloadStatus parseStatusObject(Object object) throws InvalidRpcDataException { String stringStatus = StringParser.parseStringObject(object); try { return DownloadStatus.valueOf(stringStatus.toUpperCase()); } catch (IllegalArgumentException e) { return Do...
c18629fd-447c-4fe9-ad49-4547ee7be385
0
public ClientStatus(String account, String ipaddress, ServerHandleConnect serverHandleConnect) { this.account = account; this.ipaddress = ipaddress; this.curconnected = 1; this.serverHandleConnectList.add(serverHandleConnect); }
afdd2a41-a72a-4f42-9235-e75abb871933
6
public SumProduct(ChainMRFPotentials p) { this.potentials = p; int n = this.potentials.chainLength(); int k = this.potentials.numXValues(); this.descXtoF = new double[n+1][k+1][1]; this.descFtoX = new double[n+1][k+1][1]; this.ascXtoF = new double[n+1][k+1][1]; this.ascFtoX = new double[n+1][k+1][1]...
a7602012-fbc8-4097-a8c6-15ed5b91c46d
2
public static void addCollection( Class<?> c ) { Integer id = Integer.valueOf( typeFlagMap.size() ); typeFlagMap.put( c, id ); flagTypeMap.put( id, c ); try { constructorMap.put( id, c.getConstructor() ); } catch (Exception e) { ...
2b623cf9-3764-41c9-89cd-e35b51ff530a
3
public static DAOFactory getDAOFactory(Persistance bdd) { DAOFactory daoF = null; switch (bdd) { case MYSQL: daoF = new MySQLDAOFactory(); break; case ORACLE: daoF = null; break; ...
fc3607d6-0465-4b4c-9100-4e75a8a34035
6
private Component buildSideBar() { JComponent tree = new JTree(createSampleTreeModel()); MouseListener treeListener = new MouseListener() { public void mouseClicked(MouseEvent e) { JTree tree = (JTree)e.getComponent(); TreePath selectionPath = tree.getSelectionPath(); if(selectionPath == ...
b4795c70-61b8-4ba6-9464-05c1ea2b9c33
9
protected void loadFields(com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { super.loadFields(__in, __typeMapper); __in.peekTag(); if (__typeMapper.isElement(__in, CreatedBy__typeInfo)) { ...
e3556fb0-2057-47fc-a367-51f03ca95062
4
public int median(int[] a) { int temp; int asize = a.length; // sort the array in increasing order for (int i = 0; i < asize; i++) for (int j = i + 1; j < asize; j++) if (a[i] > a[j]) { temp = a[i]; a[i] = a[j]; a[j] = temp; } // if it's odd if (asize % 2 == 1) return a[asize / ...
87e45152-8e98-4c47-b878-887a935a2a07
6
public void revealWin() { for (int x = 0; x <= 9; x++) { for (int y = 0; y <= 9; y++) { if ((blockBoard[x][y] instanceof Blank || blockBoard[x][y] instanceof Treasure) && !blockBoard[x][y].isAlreadyChecked()) boardButtons[x][y].doClick(); else if (blockBoard[x][y] instanceof Mines) { bo...
28085971-7478-40b1-a414-76b6799abd42
9
public static Drawer createDrawer(DrawerSetting drawerSetting, Drawer parentDrawer) throws ClassNotFoundException,IllegalAccessException,InstantiationException,ClassCastException { Drawer result = null; Class<?> drawerClass = Class.forName(drawerSetting.getClassName()); Object drawerObject = drawerClass.newIns...
c1eb2ce0-40fe-4230-b73e-986a6feb8b8b
6
public void checkManufacturerInNamesForBreadMakers() { List<Item> allBreadMakersList = new ArrayList<Item>(); while (true) { allBreadMakersList.addAll(grabItems()); if (hasNext()) { next(); } else { break; } } System.out.println(allBreadMakersList); List<String> manufacturerNames = getAll...
3848a817-ccba-4319-ab2b-ef66c00890ca
5
public void drawName(UnicodeFont font) { int yOffSet = 0; String[] words = name.split(" "); for (int i = 0; i < words.length; i++) { // if (orientation != Tile.LEFT) // font.drawString(x,y + yOffSet, word, Color.black); // else // font.drawString(x + (length - barLength) , y + y...