method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
befa7c35-470c-44da-8f34-3067d3829b8b
4
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); if(histograma == null) { return; } // Valor maximo do histograma int max = histograma.getMaxValue(); Graphics2D g2d = (Graphics2D) g.create(); // Tamanho do histograma s...
7201e88e-2705-4570-adb3-029ce04cda24
7
@Override public boolean equals(Object obj) { if(this == obj) { return true; } if(obj == null) { return false; } if(getClass() != obj.getClass()) { return false; } Diff other = (Diff) obj; if(operation != other.operation) { return false; } if(text == null) ...
f3e0f364-5841-45d3-900b-81dffa2c2dac
0
public String getGivenBy() { return givenBy; }
2a2c77ea-4057-48ae-9613-989801e4a690
6
private static List<PositionalEdit> getPositionalEdits(Profile pieces, Map<String, Tree> built, Map<String, String> childToParent) { pieces = pieces.clone(); built = Utilities.cloneMap(built); childToParent = Utilities.cloneMap(childToParent); List<PositionalEdit> edits = new ArrayList<PositionalEdit>(); ...
ec0ef1fd-e96d-40bb-9ac1-b4bb897b6f78
0
public Paddle(int x, int y, int width, int height) { this.x = x; this.y = y; this.width = width; this.height = height; }
0c2d56ab-cb10-47de-bc24-7bf638b86b57
3
public Map(byte[] data, Sprite sprite, BufferedReader br) throws IOException { this.sprite = sprite; x = width = data[0]; y = height = data[1]; grid = new Tile[x][y]; if(data.length < x * y + 2) { System.out.println("Invalid map file..."); re...
aa0ecce7-9adf-451a-9213-b5fc4b1d8ce4
8
private void spawnParticles() { double tempXA = (-this.xa + (this.xa < 0 ? Math.random() : -Math.random())) / 4; double tempYA = (-this.ya + (this.ya < 0 ? Math.random() : -Math.random())) / 4; int openingLength = 5; int particleLife = (int) (Math.random() * 20 + 10); int xo = 0; int yo = 0; if(Math...
dfaea5c5-557b-4d99-abc7-4eb339b330c1
8
private String getAmbiguousTemporalConclusionString(String label, Map<Literal, TreeMap<Temporal, Map<ConclusionType, Set<String>>>> conclusions) { if (null == conclusions || conclusions.size() == 0) return null; String sep = null; StringBuilder sb = new StringBuilder(); if (null != label && !"".equals(label....
1fb4c86d-7cb4-4bc4-907c-1e4c37b90f19
7
public void mouseReleased(MouseEvent e) { if(this.laf.bh.ccol.getState()==false) { Color c = null; Graphics g; xf=e.getX(); yf=e.getY(); switch(this.laf.bh.couleur.getSelectedIndex()) { case 0: c=Color.BLU...
4244223b-8743-4b2c-a8d8-63abf6dae571
7
public static String formatMessage(String message, String target) { String formattedMessage = ""; boolean validCommand = false; String command = ""; int commandIndex = -1; if(message.startsWith("/")) { try { command = message.substring(1, message.indexOf(" ")); } catch (StringIndexOutOfBoundsEx...
1b5964d9-65e8-425f-9c14-4932b7948a7d
0
protected Class getTransitionClass() { return automata.vdg.VDGTransition.class; }
3b4e5d2f-dcd4-44bb-bc72-daf7e6ad1dba
3
private void dropParticles() { for (int i = 25; i < 34; i++) { for (int j = 15; j < 50; j++) { for (int k = 0; k < 5; k++) { particles.add(new Particle(new Vector3(i, j, k), 1f)); } } } }
26ad0be2-e729-4e14-8a80-5cf6181f616c
5
public static void drawNode(Graphics g, int x, int y, int width, int height, NodeType nt, boolean highlight) { Image skin = null; switch(nt) { case normal: { skin = node_normal; break; } case root: { skin = node_root; break; } case global: { skin = node_global; ...
191d15d4-6a11-4d22-aafa-87501e443c79
1
public BufferedImage getIcon(){ BufferedImage icon = null; try { //URL url = getClass().getResource("/Icons/"+this.name.replaceAll("\\s","").toLowerCase()+".png"); URL url = getClass().getResource("/Icons/empty.png"); icon = ImageIO.read(new File(url.getPath())); } catch (IOException e) {} return icon;...
244ce201-5863-43d3-ac89-32f9cd8b3557
8
private void init() throws ApplicationException, IOException { if (config == null) { config = loadConfigFromClasspath(); } if (port == 0) { try { port = Integer.parseInt(config.getProperty("port")); } catch (NumberFormatException | NullPointerException ex) { port = DEFAULT...
e4bd0b34-4ecd-40df-9456-17df2d355bf3
6
public static void createSnpFile(String genomeName, String outFile) throws IOException { Config config = new Config(genomeName, Gpr.HOME + "/snpEff/" + Config.DEFAULT_CONFIG_FILE); config.loadSnpEffectPredictor(); Random rand = new Random(20140205); StringBuilder out = new StringBuilder(); int count = 0; ...
5a903340-08c6-4102-b82c-1b0f80c76559
6
private void flip(final double ANGLE_STEP) { currentAngle += ANGLE_STEP; if (Double.compare(currentAngle, 180) >= 0) { currentAngle = 0; flapTextBack.setOpacity(0); flapTextFront.setOpacity(1); currentSelectionIndex++; if (currentSelectionIndex...
fb57bd9a-b9db-436d-ba37-fd23e6205a47
9
public String getParameterString(){ String retString = super.getParameterString(); try{ if(sourceText!=null) retString+="&sourceText="+sourceText; if(showSourceText!=null) retString+="&showSourceText="+(showSourceText?"1":"0"); if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8"); ...
7ec99d76-90e2-4add-9da8-227f90cc4561
5
public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); ArrayList<Integer> begin = new ArrayList<Integer>(); ArrayList<Integer> three = new ArrayList<Integer>(); ArrayList<Integer> two = new ArrayList<Int...
815e16fb-ece0-4b63-b1ba-a0195ba56aac
0
@Override public void remove() { this.armorItem = (BodyArmor) ItemFactory.create().buyItem(Constants.BASIC_BODY_ARMOR); }
f967b171-92b1-4acf-b484-2a21e11643bf
6
public void DVD() { pcIncrease(); if ((getXF().get().equals("00") || getXF().get().equals("10")) && (getRF().get().equals("00") || getRF().get().equals("10"))) { if (SelectRegister().get().equals("00000000000000000000")||SelectRegister().get().equals("10000000000000000000")){ ...
b26247bf-c4c6-4750-9cfc-350bb8383b9b
6
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Role role = (Role) o; if (idrole != role.idrole) return false; if (name != null ? !name.equals(role.name) : role.name != null) return false; ...
471b739c-3030-48d3-be61-8db108bc8621
5
public static String timeToString(long time) { String result = ""; if(time < MINUTE) result += time + "s"; else { if(time/MINUTE < MINUTE) { result += (long)Math.floor(time/MINUTE) + "m"; if(dv(time,MINUTE) != 0) result ...
645d38ab-a4c4-4a50-b699-e4bac2e0a41a
8
public void displayToSome(String str, String[] chatters) throws IOException{ //change String[] chatters to ArrayList<String> without the last name (the sender) ArrayList<String> names = new ArrayList<String>(); for(int i=0;i<chatters.length-1;i++){ names.add(chatters[i]); } //Create string of recipient names...
2070152a-352f-4e4a-aa1c-c235ba402e25
3
public ListNode partition(ListNode head, int x) { if (head == null) return null; ListNode preHead1 = new ListNode(0); ListNode preHead2 = new ListNode(0); ListNode p1 = preHead1; ListNode p2 = preHead2; while (head != null) { if (head.val < x) ...
1bc0201e-2dc7-4897-8485-4d74111f1b67
0
public void setFile(MultipartFile file) { this.file = file; }
0510e027-9cde-4b69-ade9-4563df61d775
0
public void reset() { count = 0; }
40007c1e-e206-4664-abcf-0712ec0ab6e4
3
@Override public void insertUpdate(DocumentEvent e) { if(progress.isVisible()) { progress.setVisible(false); } else if(correct.isVisible()) { correct.setVisible(false); } else if(error.isVisible()) { error.setVisible(false); } }
3faba6bc-dd11-495b-ade9-31afa0bc5d07
5
public final void uniform(final IOHandler io, final NameScheme scheme) { final List<Integer> idcs = new ArrayList<>(this.instruments.keySet()); java.util.Collections.sort(idcs); if (this.idxMap == null) { this.idxMap = new HashMap<>(); this.numMap = new HashMap<>(); } if (this.indices.isEmpty()) { fo...
a17f7d1e-db00-42a9-a392-9f3380c63878
2
@Override public void noticeMessageReceived(String sender, String message) { message = sender + ": " + message; appendNotice(message); AbstractTab tab = InputHandler.getActiveTab(); if ( tab.getServerTab().equals(this) && !tab.equals(this) ) tab.appendNotice(message); ...
81ab0fe8-c2e6-4924-a14a-cd8e0d3ffd0d
7
public final boolean method8(byte i) { anInt8351++; if (!super.method8((byte) -125)) return false; Class369_Sub3 class369_sub3 = (Class369_Sub3) ((Class5) this).aClass369_4635; if (!((Class5) this).aClass45_4632 .getArchiveLoaded(((Class369_Sub3) class369_sub3).anInt8599)) return false; if (!((Cl...
f58fc8d4-a00f-4bd6-9db5-7a0e19db2357
5
static final String method3546(byte[] is, int i, int i_0_, int i_1_) { anInt7349++; char[] cs = new char[i_0_]; int i_2_ = 0; for (int i_3_ = i; (i_0_ ^ 0xffffffff) < (i_3_ ^ 0xffffffff); i_3_++) { int i_4_ = 0xff & is[i_3_ + i_1_]; if (i_4_ != 0) { if (i_4_ >= 128 && i_4_ < 160) { int i_5_ = Clas...
26569cea-02bd-4d1b-8209-48bcbfdd2960
0
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { }
3083eb2b-27e4-43af-8365-c94144f18538
8
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed // declare JFileChooser JFileChooser fileChooser = new JFileChooser(); // let the user choose the destination file if (fileChooser.showSaveDialog(this) == JFileChooser.APP...
8d1b9e38-4857-4734-9f0c-88f999fe07f9
2
public List<Tiedote> haeEtusivunTiedotteet() throws DAOPoikkeus { ArrayList<Tiedote> etusivuntiedotteet = new ArrayList<Tiedote>(); // avataan yhteys Connection yhteys = avaaYhteys(); try { // Haetaan tietokannasta tuotteet String sql = "SELECT tiedoteID, pvm, otsikko, tiedote FROM Tiedotteet ORD...
324cbcc0-042f-4425-8e3f-c3ea51a4b0e9
1
@Override public List<Integer> save(List<City> beans, GenericSaveQuery saveGeneric, Connection conn) throws DaoQueryException { try { return saveGeneric.sendQuery(SAVE_QUERY, conn, Params.fill(beans, (City bean) -> { Object[] objects = new Object[4]; objects[0] = ...
c3457e70-72b5-497b-8d68-50d8d3259743
7
public void login() { try { this.con = new C("http://lixian.vip.xunlei.com/task.html"); Document doc = this.con.get(); String url = "http://login.xunlei.com/sec2login/"; this.con.url("http://login.xunlei.com/check?u=sel0537504&cachetime=" + System.currentTimeMillis()).get(); String vcode =...
3c76db18-fe2d-4f16-a36c-0f8e7214b509
5
private static String encryptPassword(String password) { /* Declare local variables to be used in generating hashed password*/ String hashPassword = ""; int numberOfIterations = 7535; char[] passwordChar = password.toCharArray(); byte[] saltBytes = new byte[16]; /* Thi...
f6dfbb9f-eb72-4c16-b894-dfde40139e7b
9
public static PackedImage convolve(PackedImage img, Kernel kernel) { PackedImage outImg = new PackedImage(img.rows(), img.cols()); int imgRowVal, imgColVal; double sum; int kernelRowConstant = (kernel.rows()-1)/2; int kernelColConstant = (kernel.cols()-1)/2; for (int iRow = 0; iRow < img.rows(); iRow++) { ...
ee4d97ab-4aa5-403f-9713-9ee98b5c039c
0
public void setReplacements(Vector replacements) {this.replacements = replacements;}
3b03cb37-2fa9-4122-9dde-5747d7a6f9c6
3
public void loadRules(String rulesDir) throws Exception { this.rulesList.clear(); File dir = new File(rulesDir); if (!dir.exists() || !dir.isDirectory()) { throw new Exception("Cannot load rules from rules directory!"); } File[] rules = dir....
e3faa4fb-d55b-4a34-b60b-8bd1f69838c4
4
public BBZoomLevelFormat(int zoomLevel, SeekableStream fis, long fileOffset, long dataSize, boolean isLowToHigh, int uncompressBufSize) { // store file access info this.zoomLevel = zoomLevel; this.fis = fis; zoomFormatOffset = fileOffset; zoomDataSize ...
9434c90d-629a-4dec-bd86-f6a34f3694cc
9
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Rectangle viewRect =...
e781c4f3-613f-426f-ad0a-862ce21fb119
7
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } FirmwareVersion other = (FirmwareVersion) obj; if (firmwareVersionHardwareRev != other.firmwareVersionHardwareRev) { retu...
bf29d362-78f3-4f8e-9618-4cee90ec628d
5
public static String removeFormatting(String line) { int length = line.length(); StringBuffer buffer = new StringBuffer(); for (int i = 0; i < length; i++) { char ch = line.charAt(i); if (ch == '\u000f' || ch == '\u0002' || ch == '\u001f' || ch == '\u0016') { ...
e502b142-a3dc-4f15-b016-cd9a806a608a
2
public static String getName(Titulo titulo){ String sql="SELECT * FROM titulo WHERE idtitulo = '"+titulo.getId()+"'"; if(!BD.getInstance().sqlSelect(sql)){ return null; } if(!BD.getInstance().sqlFetch()){ return null; } return BD.getInstance()....
93f37498-fa06-42ed-a220-06a7da5f7dbf
6
private void learnAutomata() { String counterexample = ""; Automata<String> guessedAutomata = null; // While the guessed automata we have does not equal the // 'secret' (to be learned) automata held by the teacher while (!counterexample.equals("Confirm")) { printTable(); String closed = ch...
9d9b487c-e9aa-4dc6-be2f-f2a0e0c1e9ee
1
public void runTest() { System.out.println(name + ": "); try { long start = System.nanoTime(); test(); double duration = System.nanoTime() - start; System.out.format("% 2f\n", duration / 1.0e9); } catch (IOException e) {...
0e52e9a3-7622-4d05-a07b-4ac60da1e957
7
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { if((activated) &&(CMLib.dice().rollPercentage()<25) &&(affected instanceof MOB) &&(msg.amISource((MOB)affected)) &&(msg.sourceMinor()==CMMsg.TYP_THROW) &&(msg.tool() instanceof Item) &&(msg.target() instanceof MOB)) helpP...
5169f762-44d2-45c0-92d2-c83f8e0b6afe
6
public static String escape(String string) { StringBuffer sb = new StringBuffer(); for (int i = 0, length = string.length(); i < length; i++) { char c = string.charAt(i); switch (c) { case '&': sb.append("&amp;"); break; cas...
1ca70159-35ac-498b-98d6-128eb8ffd7b1
6
@Override public TCliente mostrarCliente(int ID) throws Exception { Statement query = null; Connection connection = null; TCliente ret = null; TClienteNormal normal = new TClienteNormal(); TClienteVip vip = new TClienteVip(); //baja lógica de cliente (solo en la tabla...
122ff078-ff66-4403-be6f-a52aa20be850
6
private void loadMap(String filename) throws IOException { ArrayList<String> lines = new ArrayList<String>(); int width = 0; int height = 0; BufferedReader reader = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream(filename))); while (true) { String line = reader.readLine(); ...
eb254c44-0a1e-4867-8296-de9c67d36ee1
2
public void erase(int index) { // quick clear if removing only entry in tree if(tree.size() <= 1){ tree.clear(); return; } // Copy last item into current item tree.elementAt(index).copy(tree.elementAt(tree.size()-1)); update_weights(index); tree.removeElementAt(tree.size()-1); ...
aa767eb3-a7df-403e-affc-a9be3fcff7c6
0
public void addFreeItems(){ Collections.sort(this.freeItems, Collections.reverseOrder()); this.firstFitItems(this.freeItems); this.freeItems.clear(); }
8fd0e75c-dac8-4eb0-8ad3-f0e77d957df8
9
public Haarniska kysyPelaajanHahmonHaarniskaa() { String syotettyValinta = "ei valittu"; Haarniska pelaajanHahmonHaarniska = HaarniskaVarasto.luoKevytHaarniska(); boolean validiHaarniskaValinta = false; System.out.println("Valitse hahmosi haarniska numerolla:"); System.out.prin...
3c347d9e-83f7-43e3-bdf5-ad0471f75414
8
public static List<DomElement> $(String selector, String content){ //System.out.println(content); String[] selectors = selector.split("\\s"); if(selectors.length==1){//单一的选择器模式 return singleSelector(selectors[0], content); }else if(selectors.length==2){//子孙选择器模式,儿子,孙子,全有 //先找出第一个选择器所满足的dom元素 List...
745f8148-cbb9-43c2-89ba-920f8718d4f3
1
public void report(Thread th, Throwable t) { Report r = new Report(t); r.props.putAll(props); r.props.put("thnm", th.getName()); r.props.put("thcl", th.getClass().getName()); synchronized(errors) { errors.add(r); errors.notifyAll(); } try { r.join(); } catch(InterruptedExce...
cfe1d09c-89ce-406b-86ff-9eeb5f25b577
5
@Override public User findById(int id) { User user = null; try { connection = getConnection(); ptmt = connection.prepareStatement(QUERY_SELECT + " WHERE id =?;"); ptmt.setInt(1, id); resultSet = ptmt.executeQuery(); resultSet.next(); ...
87b196a6-5218-47bf-88ea-ee884d6e95a4
5
private ApplicationLogger( String name, long appStartupTime, int lvl, Formatter format ) { try { if( fileHandler == null ) { String filename = new SimpleDateFormat( "yyyy_MM_dd__HH_mm_ss" ).format(new Date(appStartupTime...
5ed2d781-cab6-4bae-9c80-7c87f88f4153
1
public QuestionChecklist(final ArrayList<Question> questions,int max){ this.max = max; checklist = new HashMap<Integer,Question>(); answeredQuestions = 0; int i = 0; for(Question q:questions){ checklist.put(i, q); i++; } }
4d50d680-43ca-4475-abbd-93ec2440a34f
2
public FamilyAsSpouseProxy(Family family, Person subject) { this.family = family; this.subject = subject; spouse = subject.equals(family.getHusband()) ? family.getWife() : family.getHusband(); Name name = spouse.getName(); text = name != null ? name.getFullName() : "(UNKNOWN)"; }
959f6f64-deea-423b-88c5-32386191bb79
1
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { ClientLoginView window = new ClientLoginView(null); window.frmProgrammingContestSystem.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
920d99f6-b013-4177-b42f-d916c61517ac
7
void removeDev (DeviceImpl dev) { synchronized (devices) { DeviceImpl d = devices [dev.getAddress () - 1]; int i; if (d == null || d != dev) return; i = d.getAddress () - 1; devices [i] = null; if (root == i) { root = -1; if (Windows.trace) System.err.println ("bus root ...
53789f56-624d-4f88-b2a3-e898f904e967
6
public int getBlockMetadata(int par1, int par2, int par3) { if (par1 >= -30000000 && par3 >= -30000000 && par1 < 30000000 && par3 < 30000000) { if (par2 < 0) { return 0; } else if (par2 >= 256) { return 0; ...
5c084674-d64a-4639-96ee-70dc21f1bc7c
4
private String getFunctionFromTruthTable(boolean truthT[], int nbrVar) { String function = ""; int k = 65; for (int i = 0; i < truthT.length; i++) { k = 65; if (truthT[i]) { for (int j = 0; j < nbrVar; j++) { if ((i % ((int) Math.pow(2, nbrVar - j))) < ((int) Math .pow(2, nbrVar - j - 1))) ...
29f6e407-a597-4b83-948b-3486bc59c100
9
* @param mes the messsage */ private void handleMONOPOLYPICK(StringConnection c, SOCMonopolyPick mes) { if (c != null) { SOCGame ga = gameList.getGameData(mes.getGame()); if (ga != null) { ga.takeMonitor(); try ...
09084bc1-8444-45ad-8a1c-58e8a489c60e
8
public static double[] lsolve(double[][] A, double[] b) { int N = b.length; for (int p = 0; p < N; p++) { // find pivot row and swap int max = p; for (int i = p + 1; i < N; i++) { if (Math.abs(A[i][p]) > Math.abs(A[max][p])) { max = i; } } double[] temp = A[p]; A[p] = A[max]; A[m...
e218dc37-91d5-40f3-b81f-ff3b8fd4da03
9
public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException { if (request == null) { throw new IllegalArgumentException("HTTP request may not be null"); } String method = request.getRequestLine().getMethod(); if (me...
ec745b70-a78c-4b64-9794-b5791610085d
6
public String compress(String message){ initDictionary(); String ret = ""; for(int i = 0 ; i < message.length();i++){ int j = i; int temp = -1; boolean found = true; String subject = new String(); for( ;j < message.length(); j++){ ...
7b6b5e0f-5bc4-4d64-84ed-529520b6e581
5
private final void method992(int i, int i_73_) { aHa_Sub2_8430.method3738(-15039, 1); anInt8441++; aHa_Sub2_8430.method3771((byte) -82, aClass258_Sub3_Sub1_8434); aHa_Sub2_8430.method3729(aHa_Sub2_8430.method3781((byte) 17, i), (byte) -61, 7681); aHa_Sub2_8430.method3762(34167, 768, (byte) -87, 1); if (i_73_...
817719bc-f005-4532-87f4-cf8416fc79b6
0
public List<Speaker> findSpeakersByEventBranchId(final Long eventBranchId) { return new ArrayList<Speaker>(); }
d52a2b13-ecc6-4dc4-818b-466c5323060b
4
public static void decryptDataFile(DataInputStream is, SecretKey secretKey, String outFile) { try { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); // Cipher cipher = Cipher.getInstance("AES"); // Initialisierung byte[] v = new byte[16]; ...
c327126e-c306-4d5e-ad6e-147907f9572c
9
@Override public boolean equals(Object o) { if (o == this) return true; if (o == null || !(o instanceof InvocationExprent)) return false; InvocationExprent it = (InvocationExprent)o; return InterpreterUtil.equalObjects(name, it.getName()) && InterpreterUtil.equalObjects(classname, it.getCl...
45c4a20c-9dc0-4133-b0e5-08aab3d6a6ac
3
void eventHandling() { this.browseButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int res = Delete.this.fileChooser.showOpenDialog(Delete.this.mainPanel); if (res == JFileChooser.APPROVE_OPTION) { Delete.this.deleteField.setText(Delete.this.f...
51e9d01c-47fd-4ed5-ad0a-123dcaa9769a
5
void updateScrollBars() { if (horizScroll == null || vertScroll == null || horizScroll.getValueIsAdjusting() || vertScroll.getValueIsAdjusting() ) { return; } if (img == null) { horizScroll.setEnabled(false); vertScroll.setEnabled(false); } Rectangle visibleRect = getRefreshArea(new CPRect(i...
0fbb91af-83f7-45aa-bc01-e0fc4303eaae
3
public static List<SchoolSearch> constructSchoolSearch(Response res) throws WeiboException { try { JSONArray list = res.asJSONArray(); int size = list.length(); List<SchoolSearch> schools = new ArrayList<SchoolSearch>(size); for (int i = 0; i < size; i++) { schools.add(new SchoolSearch(list.getJSON...
4f97645b-7936-4596-b2d1-a8ae87aa5a33
5
public static void main(String[] args) { Human Ion = new Human("Ion"); Bear Marin = new Bear("Marin"); Ion.markTerritory(); try { Ion.eat(); } catch (MyFirstException e) { System.out.println("Exception at eat(): " + e.getMessage()); } try { String file = null; Ion.read(file); } catch (M...
18bc4d39-0e3a-40c7-b480-9a3f89e4c02e
5
private int minimax(int m, int dt, Board b, boolean max) { int bestValue; int val; if (dt == 0 || findPossibleMoves(max, b).length == 0) { return getRating(max, b, m); } else if (max == true) { bestValue = Integer.MIN_VALUE; for (int i : findPoss...
978d7741-91f1-46e3-8e89-47791c6dc38e
9
private void jj_rescan_token() { jj_rescan = true; for (int i = 0; i < 5; i++) { try { JJCalls p = jj_2_rtns[i]; do { if (p.gen > jj_gen) { jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; ...
4cbc763c-5644-4043-be2d-d9c3b1f77e09
0
public String getLabel() { return label; }
b1f9ab8a-fb19-4256-b6a8-1fba68c71092
7
public static void editIntonationsFile(){ if(editingTunings){ return; } editingTunings = true; catchKeyboard = false; final JFrame editframe = new JFrame(programName+" - "+tuningfilename); editframe.setVisible(false); editframe.addFocusListener(blockKeysFocusListener); editframe.setDefaultCloseOperation(JF...
5b0d67f1-228b-4fd3-9faa-5327ac8d7309
3
public static void main(String[] args) { double integral = 0; double integralprev = 0; double sum = 0; do { iterCount++; integral = function(a) + function(b); xi = a; sum = 0; for (int i = 1; i < n; i++) { xi ...
f5c63873-44f1-46e3-ae3c-e7bc70345d57
9
static byte apu_dpcm(dpcm_t chan) { int freq, bit_pos; /* reg0: 7=irq gen, 6=looping, 3-0=pointer to clock table ** reg1: output dc level, 7 bits unsigned ** reg2: 8 bits of 64-byte aligned address offset : $C000 + (value * 64) ** reg3: length, (value * 16) + 1 */ ...
f23e2537-d9d1-4d51-9d96-1a4870bddbb3
3
public JComboBox<Object> addComboBox( Object[] vals, Object preselected, int gridx, int gridy, int gridw ) { updateGridCoords(gridx,gridy,gridw); JComboBox<Object> cb = null; if( vals == null ) cb = new JComboBox<Object>(); else cb = new JComboBox<Object>(vals); Dimension d ...
ba740d50-82e0-427c-b6b7-95a492debd5e
5
public void configure( JobConf job ) { confJsonStr = job.get( "confJsonStr" ); if( confJsonStr == null ) { LOG.info( "confJsonStr is null" ); return; } LOG.debug( confJsonStr ); confMap = JSON.decode( confJsonStr ); //LOG.debug( JSON.encode( confMap, true ) ); try { if( confMap.containsKey( "rrd" ) ) { Map r...
edf3d9ba-2393-4d1b-b02b-c16bba25ce5d
5
public Map<OperationResourceInfo, ClassResourceInfo> getUrlMapping() { if ( urlMapping == null ) { urlMapping = new LinkedHashMap<OperationResourceInfo, ClassResourceInfo>(); List<? extends Controller> controllers = getControllers(); for ( Controller controller : controllers ) { Method[] methods = contro...
2c24c6e7-256f-4165-976e-6854b32aa25b
1
public void subtract(UnitsValue<?> other) { mValue -= mUnits.convert(other.mUnits, other.mValue); }
e4ff6543-9a10-464b-ad29-a3d8ef78fec7
1
public void openDevice(int index){ //Opens the device takes in index you want to use deviceIndex = index; //Sets the index to the parameter try { //beginning of a try catch block captor = JpcapCaptor.openDevice(devices[index], 1028, false, 20 ); //Opens the selected device } catch (IOException e) { //catche...
79941b74-bbf3-4908-a37a-d355fe2a1382
3
public void drawSprite(Graphics g) { if (isActive()) { if (image == null) { // the sprite has no image g.setColor(Color.yellow); // draw a yellow circle instead g.fillOval(locx, locy, SIZE, SIZE); g.setColor(Color.black); } else { if (isLooping) image = player.getCurrentImage(); g.drawI...
41c140f6-e85d-429e-8203-5269ab9562cf
3
public boolean passable(int x, int y) { return (x >= 0 && y >= 0 && x < width && y < height); }
56b40d43-2ab5-4126-99bf-3ec47416ce26
4
public Direction reversed() { switch ( this ) { case DOWNLEFT: return UPLEFT; case DOWNRIGHT: return UPRIGHT; case UPLEFT: return DOWNLEFT; case UPRIGHT: return DOWNRIGHT; default: return th...
c6b46c7d-cd26-4cd8-be10-06def60edbb5
8
public static void main( String[ ] args ) throws IOException { BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) ); String line = ""; StringBuilder out = new StringBuilder( ); while ( (line = in.readLine( )) != null && line.length( ) != 0 ) { if(line.equals( "0" )) break; i...
267aaeea-16e1-4488-b9f4-488a76b3eb50
3
@Override public boolean createTable(String query) { Connection connection = open(); Statement statement = null; try { if (query.equals("") || query == null) { this.writeError("SQL Create Table query empty.", true); return false; } statement = connection.createStatement(); statement.execu...
d765c7aa-4a9e-4ff3-920b-7e63c933a72e
7
public void permutation(int start){ int range = ((permArray.length)/2); if (start<range){ //does multi perms for (int i = start; i < range; i++){ for (int j = range; j < (permArray.length); j++){ if (permArray[i]==1 && permArray[j]==0){ swap(i, j); StringBuilder strArray = new Strin...
c792f5f6-1cb8-4fe0-b2bd-2a6f80e9a01e
2
public String getInterfaceMethodrefType(int index) { InterfaceMethodrefInfo minfo = (InterfaceMethodrefInfo)getItem(index); if (minfo == null) return null; else { NameAndTypeInfo n = (NameAndTypeInfo)getItem(minfo.nameAndTypeIndex); ...
307d4879-0dba-4ac4-9e85-259050fbec44
6
public void drawScene(Graphics g){ int startPosition = (this.stageNum - 1) * 40 ; //50 + i * 40 , 50 + i * 40 g.setColor(Color.black); g.fillRect((this.stageNum - 1) * 40 - 70, (this.stageNum - 1) * 40, 500, 300); for( int i = 0; i<array.length; i++){ for( int j = 0; j<array[i].length(); j++){ switc...
940c51d2-76b8-4639-88d5-ce65dca082b3
0
@Override public String toString() { return String.format( "inSubPackage(%s)", this.targetPackageName ); }
b78e277d-2f02-40f7-846f-05d1f2ac05b9
7
* @param carrier The <code>Unit</code> to load onto. * @return True if the load succeeded. */ private boolean loadGoods(Goods goods, Unit carrier) { if (carrier.isInEurope() && goods.getLocation() instanceof Europe) { if (!carrier.getOwner().canTrade(goods)) return false; r...
3f82f5c5-0df2-4c31-b6ae-03ed6787b238
8
protected void translateState(mxCellState parentState, mxCellState state, double dx, double dy) { if (state != null) { mxGraph graph = graphComponent.getGraph(); mxIGraphModel model = graph.getModel(); Object cell = state.getCell(); if (model.isVertex(cell)) { state.getView().updateCellState...
1a5ace74-cb36-4083-bf57-015d76d82bca
0
@Override public Logger getParentLogger() throws SQLFeatureNotSupportedException { return null; }