method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6706eec4-5668-4226-8063-ae363d5645c8
5
public void plot(int n){ if(n>2)throw new IllegalArgumentException("Argument n, " + n +", must be less than 3"); double[] xAxis = new double[this.length]; for(int i=0; i<this.length; i++)xAxis[i] = i; double[] yAxis = this.getArray_as_double(); PlotGraph pg = new PlotGraph(xAx...
edb0e4bd-02c8-4579-ab81-91f4c239e0fd
4
public static void main(String[] args) throws IOException { // TODO Auto-generated method stub out.println("Please enter the maze you would like to run:"); String input = "src/MazeReadIn/trickySearch";//console().readLine(); String output = input+"Solution"; Maze myMaze = ReadMaze.parseMaze(input); // classNa...
c619388c-1b3c-4a08-a43b-81c510f7ac93
9
public void update(Observable obs, Object obj) { // System.out.println("Refreshing..."); display = (String)obj; if (type == "cards" && type == display) { // System.out.println("Notified cards list."); removeAllElements(); for (i = 0; i < model.getCardsList().size(); i++) { add...
6214b624-6873-4ca7-a36b-47c78eed1c17
6
private void calcScale(){ int n = 0, s = 0, e = 0, w = 0; for (ImageData iData : anim.getFrames()){ if (n < iData.getAnchor().y) n = iData.getAnchor().y; if (w < iData.getAnchor().x) w = iData.getAnchor().x; if (s < iData.getHeight() - iData.getAnchor().y) s = iData.getHeight() - iData.getAnc...
319efafe-889a-4dd6-a696-2257d366d5f2
4
private boolean open_connection(Packet app_pack) throws InterruptedException { //conexão já foi aberta if (this.in_connection) return true; //destino inalcançável Packet packet = build_raw_TCP_packet(app_pack); if (packet == null) return false; TCP transport = (TCP) packet.getTransport(); tra...
50b94e6d-b489-4459-9148-3eba90b4c87f
8
@EventHandler public void onInventoryClose(InventoryCloseEvent event){ //We don't care about players other than the owner if(!event.getPlayer().equals(owner)) return; //We don't care about non-chest interactions if(!event.getInventory().getType().equals(InventoryType.CHEST)) return; if(event.getInvento...
fb04145c-34bd-4300-a7fe-ae9e88345e07
0
public XmlDaoFactory() throws DaoException { super(new UserImplXml(), new MessageImplXml()); }
c1d7e868-b042-457b-aa52-578d927148e9
8
@Override public void run() { try { // check if the URL is still accessible! this.soundFile.openConnection().connect(); this.soundFile.openStream().close(); } catch (Exception e) { return; } AudioInputStream audioInputStream = null; ...
55499608-1a78-4226-a907-72543e3c6a46
7
public void upgrade(boolean button) { if (level < 3) { power = power + Math.round(power * .2f); range = range + Math.round(range * .2f); if (attackRate > 0){ attackRate-=3; if (attackRate <= 0){ attackRate = 1;...
4047674a-f0c9-4e26-8384-147cd78b3fcc
4
public static ArrayList<Pair> findPairBySum(int[] arr,int sum){ int[] tmp = arr.clone(); Arrays.sort(tmp); ArrayList<Pair> list = new ArrayList<Pair>(); for(int i=0;i<tmp.length-1;i++){ int j = tmp.length-1; while(j>=0&&tmp[j]+tmp[i]>=sum){ if(tmp[j]+tmp[i]==sum){ list.add(new Pair(tmp[i],t...
26ef56e7-77f2-4c17-b538-9cca887db194
7
public void markComplete(CompileUnit cu) { synchronized (previous) { String key = cu.key(); if (this.hasRun.containsKey(key)) { error.writeline("Command: " + key + " has already run!"); } this.hasRun.put(key, cu); if (!readyForMarking || !this.toRun.containsKey(key) || cu.getPhase() != this) {...
06b76789-36eb-4af2-8a3d-11bd1c87a70b
5
@Override //tells what timer sent the event and operates accordingly public void actionPerformed(ActionEvent e) { if (!this.firstMove){ if (e.getSource() == this.moveTimer) moveAllIcons(); else if (e.getSource() == this.ghostTimer) releaseGhosts(); else if (e.getSource() == this.deathTimer) han...
db4f7400-8545-4785-a2f4-1cb857182fb2
1
static Tex getqtex(int q) { synchronized (qmap) { if (qmap.containsKey(q)) { return qmap.get(q); } else { BufferedImage img = Text.render(Integer.toString(q)).img; img = Utils.outline2(img, outcol, true); Tex tex = new TexI(img); qmap.put(q, tex); return tex; } } }
e7f51b03-6042-42af-bb2f-5b8e25a950da
3
public static boolean addstudent(String name) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { boolean result = false; Connection con = getcon(); try { String stusql = "insert into testtable (name) values(?)"; PreparedStatement...
a1966837-b0c5-4106-992a-49a06e7c41e5
1
protected void setID(int id) { if (("q" + this.id).equals(name)) name = null; this.id = id; getAutomaton() .distributeStateEvent( new AutomataStateEvent(getAutomaton(), this, false, false, true)); }
0d737d56-be5e-4e4b-b501-72b6486af581
8
public final static String determineEOLN(final CharSequence str) { if(str!=null) for(int i=0;i<str.length();i++) { if(str.charAt(i)=='\n') { if((i<str.length()-1)&&(str.charAt(i+1)=='\r')) return "\n\r"; return "\n"; } else if(str.charAt(i)=='\r') { if((i<str.length()-1)&&(str....
ce4c07d4-fe0b-4db9-8aea-5e9e9b192295
4
public double rawItemMinimum(int index){ if(!this.dataPreprocessed)this.preprocessData(); if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive"); if(!this.variancesCalculated)t...
11e9b4f7-c1d4-43b8-9824-423966ce1f66
4
private static void doCompareTest() { try { System.out.print("Testing compare command "); String folderName = TEST_DATA+File.separator+BLESSED_DAMOZEL; File folder = new File( folderName ); String mvdName = createTestMVD( folder ); File mvdFile = new File( mvdName ); Random rand = new Random( Sys...
7e985a8a-b880-45ed-be20-24da06f5de46
0
public Animal getVictim(int index) { return victims.get(index); }
50e45bf1-b937-40c3-8760-73c6c911e418
6
@Override public String toJson(int tabs) { StringBuilder b = new StringBuilder(); for (int c = 0; c < tabs; c++) { b.append("\t"); } tabs++; b.append("{"); boolean prev = false; for (Entry<String, Object> entry : this.objs.entrySet()) { if (prev) { b.append(", \n"); ...
d705d690-f0f2-426a-92d9-661700a2fbec
1
private String getStringValue(final Field field, final Object object) { Object result = getRawValue(field, object); if (result == null) { result = ""; } return result.toString(); }
3af010eb-7d56-41b7-969f-ba0455a7b78c
2
protected void setCod(String cod) throws Exception{ if(cod.length()<5 || cod.length()>20){ throw new Exception("El codigo tiene que tener minimo 5 caracteres y menos de 20 caracteres."); }else{ this.cod = cod; } }
0d9c98f3-4a2f-4d4b-95d6-a7d7b2011087
4
private int countOfLocalVars() { int count = 0; for (Variable var: variables) if (!var.isParameter()) count++; for (ScopeObject child: children) { if (!child.isFunctionScope()) count += child.countOfLocalVars(); } return count; }
f5feacd0-0610-4bdf-868d-9ab83a45ed39
6
public static void insertMessage(String newMessage, int ID){ Connection conn = null; PreparedStatement ps = null; try{ String msg = newMessage; conn = DBConnection.getConnection(); //Scanner scanner = new Scanner(System.in); //System.out.println("Type in your message!"); //String mes...
4913560f-39aa-4220-ba29-249d9d06970b
1
public ClientReceiveThread(Registry r, GameController gc, DatagramSocket s, String a, int p) { registry = r; gameController = gc; socket = s; try { address = InetAddress.getByName(a); } catch (IOException e) { e.printStackTrace(); System.out.pr...
f185596b-ba72-46bd-abf3-7c3bcd59163f
1
public void play(String p) { try { audioInputStream = AudioSystem.getAudioInputStream(new File(Main.loc + p)); af = audioInputStream.getFormat(); size = (int) (af.getFrameSize() * audioInputStream.getFrameLength()); audio = new byte[size]; info = new DataLine.Info(Clip.class, af, size); audio...
eaf97cfc-9522-4466-a285-b76f7007b8f0
2
public ConfigurationLoader(LogOre plugin) { this.plugin = plugin; this.plugin.saveDefaultConfig(); this.yaml = this.plugin.getConfig(); for (ConfigValues conf : ConfigValues.values()) { if (!this.yaml.isSet(conf.getPath())) { this.yaml.set(conf.getPath(), conf...
ddbb5d3d-fa17-4fc0-8910-c19e54f0393f
9
private WriteBatch enqueue(WriteCommand writeCommand, boolean sync) throws IOException { WriteBatch result = null; this.enqueueLock.lock(); try { this.startAppendThreadIfNessary(); if (this.nextWriteBatch == null) { result = this.newWriteBatch(writeCommand...
901da181-9422-4643-8654-41673afd84b8
4
public boolean equals(Object var1) { if(!(var1 instanceof NextTickListEntry)) { return false; } else { NextTickListEntry var2 = (NextTickListEntry)var1; return this.xCoord == var2.xCoord && this.yCoord == var2.yCoord && this.zCoord == var2.zCoord && this.blockID == var2.blockID; ...
487d86df-11a0-4b2f-88fc-9202050bf34a
4
public static int[] features(final String features) { if (features.length() == 0) return null; List<Integer> buffer = new ArrayList<Integer>(); String[] elements = features.split(FEATURE_SEPERATOR); for (String e : elements) { String f = e.trim(); if (f.le...
458dce8c-effb-45c9-8401-cff52b947a43
9
public static void printKifQuantification(Proposition self) { { OutputStream stream = ((OutputStream)(Logic.$PRINTLOGICALFORMSTREAM$.get())); Proposition tail = ((Proposition)((self.arguments.theArray)[0])); Proposition head = ((self.arguments.length() == 2) ? ((Proposition)((self.arguments.theArray)[1]...
4aa82ccc-f697-41e0-afd4-fbf7d400d8fc
1
private File openSourceFile(){ File javaFile = null; JFileChooser openDialog = new JFileChooser(); FileNameExtensionFilter openFilter = new FileNameExtensionFilter("Java source file *.java","java"); openDialog.setFileFilter(openFilter); int ret = openDialog.showDialog(null, "Open...
b8fad9c0-0077-4f58-aed9-c99cbde70346
7
public void glow(int index) { if (alpha[index] < maximum[index] && increasing[index]) { alpha[index] += rate[index]; } if (alpha[index] > maximum[index]) { alpha[index] = maximum[index]; } if (alpha[index] == maximum[index]) { increasing[index] = false; } if (alpha[index] > minimum[index] && !inc...
0b8139ab-172f-4657-b65d-36e5181a88c9
0
public AdministrationFacade() { }
f05544ef-daea-4358-9db5-39063324763f
6
public LinkedList<BMPAgent> getBMPAgents(){ LinkedList<BMPAgent> _agents = new LinkedList<BMPAgent>(); XmlIO _xmlio = new XmlIO(); _xmlio.readFile(_filename+".xml"); Document _doc = _xmlio.getDocument(); NodeList _xmlNodes = _doc.getElementsByTagName("agent"); for(int i=0;i<_xmlNodes.getLength();i+...
0b3b7bf1-e9ed-4eac-9c0a-f57719e683ec
5
private void executeRoutine() { String str=routine.get(routinespot); if(str.equalsIgnoreCase("N")) { moveNorth(3); } else if(str.equalsIgnoreCase("W")) { moveWest(3); } else if(str.equalsIgnoreCase("E")) { ...
6d7d5762-0e5c-41fd-8a16-fc80de581732
6
public void regenApple(){ x = new Random().nextInt(Snake.wa); y = new Random().nextInt(Snake.ha); color = Color.RED; if(new Random().nextInt(10)==0) color = Color.YELLOW; if(new Random().nextInt(15)==0) color = Color.GRAY; if(new Random().nextInt(5)==0) color = Color.GREEN; for(SnakePart s...
6577f6dd-1677-4747-bb14-e5d8c2a64470
8
private final String getMethodSourceCode( CtMethod iFunctionMethod, String internalReferenceName, CtClass targetObjectCtClass, Class firstArgumentTypeClass ) throws Exception{ CtClass params[] = iFunctionMethod.getParameterTypes(); CtClass exceptions[] = iFunctionMethod.getExc...
b3ab6b08-8664-4eab-b3fe-b57b55e735f4
9
private void jButtonConsultarAgenciasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonConsultarAgenciasActionPerformed if ((!"".equals(jTextDestino.getText()))&&(jTextPrecioAlojamiento.getValue()!=null)&&(jTextPrecioTransporte.getValue()!=null)) { jLabelAdvertenciaDestino.se...
27802fb4-ba3a-47df-954c-fa56a881fe6e
7
public static void evaluateStdin( HashMap < String , HashMap < Integer , Double > > relevance_judgments, HashMap < String , HashMap < Integer , Double > > relevance_judgments_2, InputStream path){ // only consider one query per call StringBuffer input = new StringBuffer(); ...
9c6f5d7b-0603-4936-aa10-1f16341b0500
9
private Map<Double, Map<Double, Integer>> process(ResultSet resampleSet, int repct) throws SQLException { Map<Double, Map<Double, Integer>> map = new TreeMap<Double, Map<Double, Integer>>(); while (resampleSet.next()) { double err = resampleSet.getDouble(errorType); if (err >= errorCutoff) { continue...
a8a9bdf9-42bd-4642-8602-4bfa0def4adf
7
protected void analyzeResources(String folder, FileInfo info) throws IOException { String text = FileUtil.read(new File(folder, info.getFilename())); for (String line : text.split("\\\n")) { String parts[] = line.trim().split(" "); if (parts.length >= 2) { if (parts[0].equals("bgload")) { info.ad...
77ebeebf-7825-4999-8f6d-834acc554f38
7
private static void genPrime(int n) { if (n < 1000) { n = 1000; } boolean[] oldPrimes = bitmap; boolean[] newPrimes = new boolean[n + 1]; for (int i = 0; i <= max; i++) { newPrimes[i] = oldPrimes[i]; } for (int i = max; i <= n; i++) { newPrimes[i] = true; } int sqrt = (int) (Math.sqrt(n) + 1)...
3fd22a0f-05e2-4052-9f84-da1a6ac876cb
5
private void updateTabla(){ //** pido los datos a la tabla Object[][] vcta = this.getDatos(); //** se colocan los datos en la tabla DefaultTableModel datos = new DefaultTableModel(); tabla.setModel(datos); ...
2e4735b4-c78a-4812-bf75-b299c4f5422d
3
public LocationSet[] deleteIndex(LocationSet[] o, int i) { if (o.length > 1) { LocationSet[] newEnd = new LocationSet[o.length - 1]; for (int x = 0; x < i; x++) { newEnd[x] = o[x]; } for (int x = i; x < o.length - 1; x++) ...
cf17657b-90d9-4441-a25a-e1f10464cde2
1
protected void sendListOfNotices(String target, List<String> output) { for ( String line : output ) sendNotice(target, line); }
70f299ef-104d-4cf1-9b0a-e84837a0c771
8
@Override protected int pruneCache() { int count = 0; CacheObject<K,V> comin = null; // remove expired items and find cached object with minimal access count Iterator<CacheObject<K,V>> values = cacheMap.values().iterator(); while (values.hasNext()) { CacheObject<K,V> co = values.next(); if (co.i...
58c952b2-4898-4dde-a7fe-07e6e00730e1
0
protected final Failure getCurrentFailure() { return currentFailure.get(); }
2b5dd491-6252-443a-8e43-fd15795fb5ee
6
public ListNode removeNthFromEnd(ListNode head, int n) { if (n==0){ return head; } ListNode temp = head; ArrayList<ListNode> list = new ArrayList<ListNode>(); while (temp !=null){ list.add(temp); temp = temp.next; } int total = ...
4d0cbf7f-f30d-495d-8e66-ee59d17ca8a0
4
public void left() { boolean needAddTile = false; for (int i : _0123) { // get i-th line Tile[] origin = getLine(i); // get the line have been moved to left Tile[] afterMove = moveLine(origin); // get the the line after Tile[] merge...
481f1190-ffb3-428a-be4b-c8d172c2ec12
1
private boolean jj_3R_95() { if (jj_scan_token(LEFTPARENTHESES)) return true; return false; }
b1e45364-fa8d-4d3f-843a-0a7013f87141
0
@Before public void init(){ city_graph.loadMap("res/test_zettel2_1.mp"); }
8062d398-814d-4456-a21a-cfe78bbb7a7e
9
@Override public void render(Graphics g, int displayWidth, int displayHeight) { g.setColor(Color.gray); // render pitch BufferedImage pitch = ImageManager.getImage("pitch"); BufferedImage goal = ImageManager.getImage("goal"); g.fillRect(offset-5, offset-5, pitch.getWidth() + 10, pitch.getHeight() + 10); g...
a44fcbf7-abb9-4c89-a9d5-bd39b39b35d5
3
public Creep getCreep(){ int ID = (id-1) / 3; int creepId = (id-1) % 3 + 1; if (ID == 0){ //air return new AirCreep (creepId); }else if (ID == 1){ //water return new WaterCreep (creepId); }else if (ID == 2){ //fire return new ...
3fbb8a8d-c4b6-4254-8c4e-f1289905b99e
5
public Point pickMove(List<Point> possibleMoves) { Collections.shuffle(possibleMoves); Point mostDesired = null; for (Point p : possibleMoves) { if (mostDesired == null || (mostDesired != null && _worldMemory.get(mostDesired).getKey() == null)) { mostDesired = p; } else if (mostDesired != null) { ...
4a1e8518-dd95-4da0-ad69-6255ca10e70d
8
public List<List<Integer>> zigzagLevelOrder(TreeNode root) { boolean left2right = true; List<List<Integer>> result = new ArrayList<List<Integer>>(); Stack<TreeNode> current = new Stack<TreeNode>(); if (root == null) return result; current.push(root); while (!current.empty()) { Stack<TreeNode> next ...
d6e38442-7ae1-4e31-908b-ac14e5cc864a
5
public void removeStock(String symbol) throws StockNotExistException, IllegalQuantityException { boolean stockIsExisist = false; int StockSymbolIndex = 0; // find the index of symbol for (int i = 0; i < portfolioSize; i++) { if (symbol.equals(this.stocksStatus[i].getSymbol())) { stockIsExisist = true...
b45374f6-b5f4-4c4e-acbb-286dc0e805a0
3
private void delAll(AutoCodeConfig config) { if(config == null){ throw new RuntimeException("Invalid Param config"); } if(config.getComponents() == null ){ throw new ComponentNotFoundException("Can't Found any component,please check your configurations!"); } ...
de2416be-e630-4512-87fb-32ce262427dc
3
private boolean validateCardNumber(String cardNumber) { if (cardNumber == null || cardNumber.isEmpty()) { return false; } if (new org.apache.commons.validator.routines.CreditCardValidator() .isValid(cardNumber)) { return true; } else { addMessage(new FacesMessage("Die Kartennummer ist ungültig."));...
a801cd8d-5796-4ff7-9a45-f70c6bd0e7c7
5
private void forproc(){ mustbe(TK.FOR); gcprint("for("); String id = tok.string; Entry iv = null; // index variable in symtab if( is(TK.ID) ) { iv = lvalue_id(tok.string, tok.lineNumber); iv.setIsIV(true); // mark Entry as IV scan(); } ...
ed3b8da6-932c-4d5b-82c8-44bb2fd738a4
1
public void printByWidth() { if (root == null) System.out.println("Tree is empty"); else { BinaryTree[] mas = new BinaryTree[amount]; int counter = 0; mas[counter] = root; byWidth(mas, counter, counter); System.out.println(); } }
82c05c2b-11bf-424a-881f-e1cb1901bb6d
0
@Override public void iconifyFrame(JInternalFrame f) { //System.out.println("iconifyFrame"); super.iconifyFrame(f); f.getDesktopIcon().setSize(ICON_WIDTH,ICON_HEIGHT); }
8d7bd72c-858a-4584-8429-bc3a145a50f4
9
protected void writeString(String text) throws IOException { out.write('"'); for (char c : text.toCharArray()) { switch (c) { case '"': case '\\': case '/': out.write('\\'); out.write(c); break; c...
67730beb-0ab9-48bb-ad58-0de2a0563d7a
9
public static AABRI initBinaryTreeFromFile(String pathToFile) { // Fail fast if (pathToFile == null || pathToFile.isEmpty()) { throw new RuntimeException("Le chemin du fichier ne dois pas être vide !"); } AABRI AABRI = new AABRI(); // Tableau qui va contenir en pos...
dbc9bef1-a8f3-4942-9d98-fd152b1ea81c
7
public static ProbabilityDistribution respond(ProbabilityDistribution pd, PricingPolicy policy, PricingPolicy baseline, double awareness, double sensitivity, String responseType) { double w = 2; double[] previousHist = pd.getHistogram(); double[] newHist = new double[Constants.MIN_IN_DAY]; double...
ab618019-7bc6-46a8-a5b8-232011a17cb8
1
public List<Object> getContent() { if (content == null) { content = new ArrayList<Object>(); } return this.content; }
5fbba33f-bd67-496d-82d5-eebbec8150bd
5
public Launcher() throws IOException { super("Oberien view.Launcher"); versions = OberienURL.getVersions(); JMenuBar mb = new JMenuBar(); JMenu options = new JMenu("Options"); JMenuItem redownload = new JMenuItem("Redownload whole game"); redownload.addActionListener(this); redownload.setActionCommand(...
444dfabc-14fa-43cd-a16f-8af27dc51c70
4
private void rebuildRecentFeed(Integer uid){ TreeMap<Long,Integer> topFeed=new TreeMap<>(); TreeSet<Integer> subscribeList=subscribeMap.get(uid); for(Integer userId : subscribeList){ TreeMap<Long,Integer> treeMap=postFeedMap.get(userId); topFeed=mergeRecentFeed(topFeed,tr...
66740f49-9ee8-4249-931a-24511e9454e7
2
public static void closeSocketSilently(Socket s) { if (s != null) { try { s.close(); } catch (IOException e2) { e2.printStackTrace(); } } }
9d498040-fd13-4c63-a074-bdfe87170dc9
0
public String getEndTime () { return endTime; }
d605da71-104e-4538-9e85-addc3c711053
4
private static boolean isPtp (Configuration config) throws IOException { int count = config.getNumInterfaces (); for (int i = 0; i < count; i++) { Interface info = config.getInterface (i, 0); if (info.getInterfaceClass () == 6 && info.getInterfaceSubClass () == 1 && info.getInterfacePro...
5d4600cb-1bdf-4046-a4e3-81d83d6fba37
9
public Object readMetaBean(Element node) throws Exception { Object result; Vector children; Element child; int i; String name; Vector inputs; Vector outputs; Vector coords; MetaBean bean; // for deb...
2485a8d6-28fc-4865-9c37-4df656b5260a
3
public void markBomb(int aX, int aY) { MaskValue mask = mField.getMaskValue(aX, aY); if ( !mask.isOpen()) { if (mask.isNothing()) mField.setMask(aX, aY, mField.getMasks().getFlag().getId()); else if (mask.isFlag()) mField.setMask(aX, aY, mField.getMasks().getQuestion().getId()); else mField.setMask(aX, ...
93e39dde-5b33-4e8f-8394-34521a2d615a
9
private boolean validaTabela() { int inicios = 0; int finais = 0; for (int i = 0; i < modeloTabelaAF.getItens().size(); i++) { if (((Boolean) modeloTabelaAF.getItens().get(i).get(0))) { inicios++; } if (((Boolean) modeloTabelaAF.getItens().get(i).get(1))) { finais++; } } if (inicios != 1 &...
21d37a73-2f19-4e09-85f1-3c588afcccd2
8
private void makewt(int nw) { int j, nwh, nw0, nw1; float delta, wn4r, wk1r, wk1i, wk3r, wk3i; float delta2, deltaj, deltaj3; ip[0] = nw; ip[1] = 1; if (nw > 2) { nwh = nw >> 1; delta = (float)(0.785398163397448278999490867136046290 / nwh); ...
9da8e8b5-d0be-4dc1-9fc5-1b395c548125
9
public void handleRequest( final HttpServerConnection conn, final HttpContext context) throws IOException, HttpException { context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn); HttpResponse response = null; try { HttpRequest request = conn.receiveR...
dfff2cfc-d4a9-480d-82c6-41986996d430
7
public HGLiveHandle atomRefresh(HGLiveHandle handle, Object atom, boolean replace) { if (handle.getRef() == atom) return handle; // same atom, nothing to do if (closing) { if (handle instanceof WeakHandle) ((WeakHandle)handle).clear(); else ((TempLiveHandle)handle).setRef(atom); ret...
bd4dc0a4-3378-4fb1-ba54-bd04ed4b886e
1
@Override public String execute() { if (databaseContext.table != null) { return Integer.toString(databaseContext.table.size()); } else { return "no table"; } }
b4632a81-5607-44b9-a550-5741a4e1a436
9
public static void main(String[] args) { machines = null; singleMachine = null; dispensers = null; singleDispenser = null; foodItem = null; container = openSave(); machines = container.getMachines(); // Thread shutdown = new Thread(); // shutdown. // Runtime.getRuntime().addShutdownHook(new Thread()...
fa6ee93d-2ef0-4f55-9c39-c91d8b38aec7
5
public static Square load(byte x, byte y) throws SpriteException, CompressionException { int xi = MathUtils.uByteToInt(x), yi = MathUtils.uByteToInt(y); if (sprite == null) { throw new SpriteException(); } if (squares == null) { squares = new Square[sprite.getWidth()][sprite.getHeight()]; } if ...
f397fc3a-00af-4166-84fc-ce2561d06f83
0
public JLabel getjLabel6() { return jLabel6; }
a3d559f8-f88c-496a-8a65-6e68d9d6e1e2
1
public boolean opEquals(Operator o) { return (o instanceof ConvertOperator) && type == o.type; }
9aeac32f-82fc-4b93-8ee2-f1b0a55302c7
0
public static void main(String [] args) { StaticParent obj = new StaticChild(); obj.staticGet(); obj.dynamicGet(); }
770b158b-5b6c-4167-af23-c8de9e069bd5
3
private static String char2Ascii(char c) { if (c > 255) { StringBuilder sb = new StringBuilder(); sb.append(PREFIX); int code = (c >> 8); String tmp = Integer.toHexString(code); if (tmp.length() == 1) { sb.append("0"); } ...
87f6ac5a-3a2d-4ebc-97f6-375579d0facc
0
public String getName() { return name; }
3371d0c7-9cc7-4963-b301-2f775da9620d
5
@EventHandler public void eventPerformed(TransactionEvent e) { String playerName = e.getOwner(); String itemName = e.getItem().toString(); int quantity = e.getItemAmount(); // Get all of the online players Player[] onlinePlayers = Bukkit.getOnlinePlayers(); boolean isOnline = false; for (int i =...
a1689ef6-4e77-42e8-b244-8d3aede2e485
9
public boolean isMatch(String s, String p) { if (s.length() == 0) { return isEmptyOrStar(p); } if (p.length() == 0) { return false; } char s1 = s.charAt(0); char p1 = p.charAt(0), p2 = '0'; if (p.length() > 1) { p2 = p.charAt(1)...
b3234744-a12b-4b1a-8f53-137d67de1652
7
public static void main(String[] args) { // création d'une liste List<AR> maListeAR = new ArrayList<AR>(); List<AS> maListeAS = new ArrayList<AS>(); /* //Chemin d'accès document Winows pc portable String backslash= System.getProperty("file.separator") ; String monFichierTarif = "C:"+backslash+"Users"...
17bfd406-109b-40b0-88b2-a1b24433a7b1
7
static final void method1895(int i, byte[] is, int i_16_, int i_17_, int i_18_, int i_19_, byte[] is_20_, int i_21_, byte i_22_) { try { anInt3198++; int i_23_ = -(i_21_ >> 375931490); i_21_ = -(0x3 & i_21_); if (i_22_ != 121) aClass229_3196 = null; for (int i_24_ = -i_16_; (i_24_ ...
8c4aa03e-83ad-411c-ab18-cb869b88affa
2
public void drawBoundaries(Graphics2D gI) { if (Render.drawChunkBoundaries) { if (village == null) { gI.setColor(Color.black); } else { gI.setColor(Village.chunkBoundColor); } gI.drawRect(0, 0, Chunk.getPixelLength()-1, Chunk.getPixelLength()-1); } }
d03b2885-6ab3-4a19-b0b7-5e18a76cc8b0
5
public static ArrayList<Book> getAllRentedBooks() { try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ArrayList<Book> bookList = new ArrayList<B...
d4137153-0715-4792-bfa0-6b98faead904
4
@Override public void onReply(int num, String value, String msg) { switch(num){ case IRCNumericReplies.RPL_NAMREPLY: if(value.startsWith(main.getNick() + " = #"+channelName)){ userList.removeAllElements(); String [] users = msg.split(" "); for(String item : users) if(!item.equals(main.g...
c23adc77-500b-44bc-8d37-2e208328b71b
8
protected String[] _list(Object filter) { Cache<String, ReplCache.Value<Metadata>> internal_cache=cache.getL2Cache(); Set<String> keys=internal_cache.getInternalMap().keySet(); if(keys == null) return null; Collection<String> list=new ArrayList<>(keys.size()); for(Str...
b5470250-2c97-4701-9ece-953e489bd222
7
@Override public void draw(Graphics g) { int x = this.column * Board.CELL_SIZE; int y = this.row * Board.CELL_SIZE; g.setColor(Color.GRAY); g.fillRect(x, y, Board.CELL_SIZE, Board.CELL_SIZE); if (roomInitial == 'X'){ g.setColor(Color.RED.darker().darker()); g.fill...
153148ea-64a6-48d7-9031-9b3401721663
0
public void loadOp() throws DataLoadFailedException { dataHolder.loadOp(); }
fc1d3155-3967-4813-a21c-5fe81ec1723e
0
public static Date getEndOfTheDay(Date date) { String value = date2String(date, "yyyy-MM-dd 23:59:59"); return string2Date(value); }
2d4c5e6f-5eb3-4a37-988d-753ffe118a53
0
public static void main(String[] args) { Thread t = new Thread(new LiftOff()); t.start(); System.out.println("Waiting for LiftOff"); }
afa79efd-3a41-413d-ba62-fc47d555a2db
7
public ArrayList<Long> eratostenes(long n) { ArrayList<Boolean> array = new ArrayList<Boolean>(); ArrayList<Long> primos = new ArrayList<Long>(); // Inizializar Array for(int i=0; i <= n; i++){ if(i < 2) array.add(true); else array.add(fal...
f79e0b59-bba5-48cf-866c-f326b8d1eb58
9
@Override public void keyReleased(KeyEvent e){//reset the X/Y-add int key = e.getKeyCode(); if(key == KeyEvent.VK_LEFT || key == KeyEvent.VK_A){ xAdd = 0; left = false; } if(key == KeyEvent.VK_RIGHT || key == KeyEvent.VK_D){ xAdd = 0; ...
66b61ba8-d3f2-4fb5-8fac-42f5199f22a0
9
private void followPath() { // try to clean up behind self MazeState curState = MazeLocalizer.fromWorldToMazeState(curPose); if (lastState != curState) { clearFakeWallsAround(lastState); lastState = curState; } final double Kp = 1;// switch between 1.2 and 2 RealPose2D correctedPoseRelStar...