method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
8fa17103-5921-469f-9517-41c0981c0581
5
@Override public <T extends Serializable> void submit(Callable<T> job, IJob<T> callBack) throws RemoteException { // if no services are registered nothing can be computed if (services.size() == 0) callBack.setRefused(true); // iterate over services and search for a free one for (int i = nextServiceNumbe...
ddbdea61-af49-421e-9b01-1a574bfcddb0
1
public void move(float x, float y) { PhysicsComponent pc = (PhysicsComponent)getComponent("PhysicsComponent"); if(pc != null) { pc.setLocation(x, y); } }
6225da9c-7e17-4452-a5e9-547906106508
0
private Set<Card> tensFullWithThreeTwos() { return convertToCardSet("TS,2S,TC,3S,2D,TH,2H"); }
e4a45a70-8e4c-481f-9c8f-80e08871602e
7
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
477e2d86-0016-4f0b-aa95-13b44b3a4ce8
1
public ArrayList<Molecule> getMolecules() { ArrayList<Molecule> clone = new ArrayList<Molecule>(); for(Molecule mole : molecules) clone.add(mole); return clone; }
cb2b9e12-1197-4baa-b27b-3fc104976a7c
9
public static List<Class<?>> processDirectory(File directory) { ArrayList<Class<?>> classes = new ArrayList<Class<?>>(); log("Reading Directory '" + directory + "'"); try { // Get the list of the files contained in the package String[] files = directory.list(); for (int i = 0; i < files.length; i++) { ...
ee03f857-4eeb-4571-b12f-70455082fbe3
4
private static String asSeqString( final double[] data, final int size, final int length ) { StringBuilder out = new StringBuilder(); // int off = 0; // for (int i = 0; i < length; i++) { if (i > 0) out.append(DEFAULT_VECTORDE...
61c577b2-8b74-4461-9311-0efb80be713b
8
public Object[][] select(String table, String fields, String where) { //Permitira obtener la cantidada de registros de la consulta, //para poder determinar el array de objetos a devolver... int registros = 0; //Obtenemos los fields separados en los elementos de un array, por el split ...
587caee5-7218-492b-ac2a-39b655939312
0
public void SetMap(MyMap m_){ m=m_; }
0e1d519d-ff63-457f-a7a2-aa2db09d8c64
7
private boolean doKeyword(Segment line, int i, char c) { int i1 = i+1; boolean klassname = false; int len = i - lastKeyword; byte id = keywords.lookup(line,lastKeyword,len); if ( id == Token.NULL ) { klassname = true; for ( int at = lastKeyword; at < lastKeyword + len; at++ ) { char ch = line...
752f8d9d-3408-47e3-bf0d-80d55d8e9f5e
9
public void setCheckerBoard() { for (int x = 0; x < checkersSpaces.length; x++) { for (int y = 0; y < checkersSpaces.length; y++) { checkersSpaces[x][y] = new JButton(""); if (x % 2 == 0) { if (y % 2 == 0) { checkersSpaces[x][y].setBackground(Color.white); checkersSpaces[x][y].setEnabled(f...
02184c1f-5a5a-4e1d-9a16-b83d75a6fbf9
0
public Integer interpret(Context ctx) { return left.interpret(ctx) + right.interpret(ctx); }
649b42f3-e32f-40a9-8b9a-269612f694ce
7
static final int splitlines(CBytePtr a, int len, CLinePtr lr) { // Copy to preserve pass by value semantics. a = a.copyPtr(); // lr is passed by reference (**). int h, i; CBytePtr p = a.copyPtr(); CBytePtr b = a.copyPtr(); CBytePtr plast = a.copyPtrWithOffset(len - 1);...
b56438bb-1861-4410-b878-cbcfb2eb8a16
5
public CheckResultMessage check3(int day) { BigDecimal a1 = new BigDecimal(0); int r1 = get(6, 5); int c1 = get(7, 5); int r2 = get(12, 5); int c2 = get(11, 5); if (version.equals("2003")) { try { in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); a1 = getValue(r1 + day, c1 + 3...
d38e1a73-5801-4883-a302-dd1bbb656e42
9
private void createItemTable() { MouseAdapter mouseListener = new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { handleMouseEvent(e); } @Override public void mouseReleased(MouseEvent e) { handleMouseEvent(e); } private void handleMouseEvent(MouseEvent e...
32205f4a-da63-4078-9739-d40c69b568ed
0
@Test public void testGetS2() { System.out.println("getS2"); Flip instance = new Flip(3,6,9); int expResult = 9; int result = instance.getS2(); assertEquals(expResult, result); }
8461bc9c-e12b-4778-b64e-eb4c10f6ac5b
1
public void addInfoMessage(String i18nMessageKey, String defaultMessage) { if (this.infoMessages == null) { this.infoMessages = new ArrayList<BeamMeUpMQMessage>(2); } this.infoMessages.add(new BeamMeUpMQMessage(i18nMessageKey, defaultMessage)); }
133804da-4c06-44e0-8f9f-fa8a07542ee4
8
public synchronized void remove (int i0, int j0) // completely remove a group there { int s = State; varmaindown(); State = s; if (P.color(i0, j0) == 0) return; Action a; P.markgroup(i0, j0); int i, j; int c = P.color(i0, j0); Node n = Pos.node(); if (GF.getParameter("puresgf", true) && (n.cont...
3ea8c5c3-5a1c-4711-a7eb-9c96af71373a
5
protected int readBlock() { blockSize = read(); int n = 0; if (blockSize > 0) { try { int count = 0; while (n < blockSize) { count = in.read(block, n, blockSize - n); if (count == -1) break; n += count; ...
60892324-25eb-49a8-9ef2-f8535d557681
7
String checkSecurity(int iLevel, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request){ try { Object o1 = session.getAttribute("UserID"); Object o2 = session.getAttribute("UserRights"); boolean bRedirect = false; ...
9dd71b77-3b4c-48a1-b0a6-6d14c93b4158
2
@Override public String execute() { if (databaseContext.table != null) { return "no table"; } if (databaseContext.table.remove(arguments.get(1)) == null) { return "not found"; } else { return "removed"; } }
76ac474d-5eb0-4314-8918-a9ac72598ba5
8
public int maxValue(int maxWeight, Bags[] bags) { int[][] bestValues = new int[bags.length + 1][maxWeight + 1]; for (int j = 0; j <= maxWeight; j++) { for (int i = 0; i <= bags.length; i++) { if (i == 0 || j == 0) { bestValues[i][j] = 0; } else { if (bags[i - 1].getWeight() > j) { bestVal...
2b0d2dc9-5be5-476a-9aef-910c881d995d
6
public static Stella_Object accessPreparedStatementSlotValue(PreparedStatement self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Sdbc.SYM_SDBC_CONNECTION) { if (setvalueP) { self.connection = ((Connection)(value)); } else { value = self.connection; ...
1bc263f5-9144-4614-8f27-597f61a8067c
0
public ByteCodeLoader(String fileName) throws IOException { source = new BufferedReader(new FileReader(fileName)); }
16374a2e-ac26-4348-b85a-b39fcac18198
7
public boolean isValidArea(char[][] board) { int[] num = new int[10]; int mMax = board.length; int nMax = board[0].length; for(int m=0;m<mMax;m=m+3) { for(int n=0;n<nMax;n=n+3) { for(int i=0;i<num.length;i++) { num[i] = i+1; } ...
b2ad06f5-b394-475c-bcf6-40c9b7382144
6
public IDomainParser newParser(String tld) { switch (tld) { case "org.ua": return new OrgUaParser(); case "dn.ua": return new DnUaParser(); case "donetsk.ua": return new DnUaParser(); case "lg.ua": re...
8895d27f-d66c-44d8-97b6-d21607cbf48b
3
public EventCalendar(String title) { super(); // Construct the panels which make up the dialog p1 = new JPanel(); p2 = new JPanel(new GridLayout(7, 7)); JButton confirmButton = new JButton("OK"); add(p1, BorderLayout.NORTH); add(p2, BorderLayout.CENTER); add(confirmButton, BorderLayout.SOUTH); //...
49672eae-f9ed-4f41-b9cf-74f9288b721f
4
protected final void onButtonClick(Button var1) { if(var1.id == 0) { this.minecraft.setCurrentScreen(new OptionsScreen(this, this.minecraft.settings)); } if(var1.id == 1) { this.minecraft.setCurrentScreen(new GenerateLevelScreen(this)); } if(this.minecraft.session != nu...
d6c0ea3c-736c-4d1f-86ea-ac8bf902a899
9
public double associationClassesAttribute(double[][] counts){ List<Integer> supportSet = new ArrayList<Integer>(); List<Integer> not_supportSet = new ArrayList<Integer>(); double separability = 0; int numValues = counts.length; int numClasses = counts[0].length; int total = 0; double[]...
12b347e0-1454-4966-b953-2c0e19f99d55
8
private void graphToDB(Graph graph) { HashMap<String, String> names = new HashMap<String, String>(); for (String v : graph.getVertices()) { Visode o = db.find(v); String name = o == null ? v : String.valueOf(((OdeNode)o).getDisplayName()); names.put(v, name); } db.clear(); for (String v : graph.ge...
438d2afc-daf7-4a35-b70a-79f77a12d388
6
@Override public boolean executeScript(Path path) { // if the connection does not exist, fail if (conn == null) return false; File file = path.toFile(); InputStream in; try { in = new FileInputStream(file); } catch (FileNotFoundException e) { console.printf("failed: %s\n", e.getMessage()); ret...
b92dd226-e350-4c3f-8942-581d803579f3
1
@Test public void addTest() { for (int i = 0; i < TESTS; i++) { double x1 = rand.nextInt(); double y1 = rand.nextInt(); double x2 = rand.nextInt(); double y2 = rand.nextInt(); Vector v1 = new Vector(x1, y1); Vector v2 = new Vector(x2, y2); Vector res = new Vector(x1 + x2, y1 + y2); assertEqua...
9c652226-25f5-4b81-9cf6-6624eddb3abf
0
@Autowired public void setCfDao(CFDao cfDao) { this.cfDao = cfDao; }
37265144-fe23-4d5d-bda5-7e0f7ebfe778
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Personaggio other = (Personaggio) obj; if (danari != other.danari) return false; if (nome == null) { if (other.nome != null) return f...
3973641c-1f1b-4d2a-8836-ee70d9c3e764
1
void printList(ListNode head){ for(;head != null; head = head.next){ System.out.println(head.val); } }
6e03ed95-d23d-4665-8a18-641b66b28995
2
public int getAddressCount() { int count = broadcast() - network() + (isInclusiveHostCount() ? 1 : -1); return count < 0 ? 0 : count; }
89a8de34-3f4d-4051-a18c-d5d87dbce84c
9
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(STX); sb.append(FC); if (pan == null) { throw new NullPointerException("PAN cannot be null!"); } sb.append(pan); sb.append(FS); if (name =...
561bf8e8-7c2a-44fc-8bb0-1eaa4c5dfedd
6
long allocate(short type) throws IOException { if (type == Magic.FREE_PAGE) throw new Error("allocate of free page?"); // do we have something on the free list? long retval = header.getFirstOf(Magic.FREE_PAGE); boolean isNew = false; if (retval != 0)...
1caf9162-e8ed-475e-9349-7f8a9960a071
4
private HashMap getAllChessMan(){ //存放棋子和棋子相应的数量 HashMap<ChessMan,Integer> map =new HashMap<ChessMan,Integer>(); //棋盘总大小 int tempSize=this.size; //棋子的类型个数 int m = list.size()-1; //需要分配几次 int t = list.size(); //随机对象 Random random = new Random(); //一种类型棋子的数量 int n = 0; //已经分配的棋子总数 int s = 0; ...
85353c86-8dfd-4bc5-a4d7-bffd2ab53b36
0
public void setId(Integer id) { this.id = id; }
6ad40dbc-97dd-40c4-9053-e663ee32ba20
0
public State hasNotChosenCharactersState() { return hasNotChosenCharactersState; }
e3e7930f-082b-4e75-9738-5a5e712ec6b0
9
private void combineItems(Command command){ if(!command.hasNthWord(3)){ System.out.println("You need to combine more things"); } else { String segment1 = command.getNthSegment(1); String segment2 = command.getNthSegment(2); if(rooms.get(currentRoom).getIte...
d2a40ffa-6ff8-44af-9b22-48f788a791ec
5
public Face(String n)// ̹ ʱȭ ϴ°. ̹ ⺻, , ʺ ȼ 迭 . { try { image = ImageIO.read(new File(n)); width = image.getWidth(); height = image.getHeight(); if(width != 120 || height != 120) { resize(); image = ImageIO.read(new File("yame\\data\\temp"+BasicThings.temps+".jpg")); BasicThings.ori...
0896d75b-01e2-4c9a-ace7-bcbf862eddae
4
private void specialItemSpawner() throws Exception { // Gets random X,Y coordinates that will be on the bottom of the screen and make sure the word doesn't spawn off of it. randX = randLoc.getRand(530); randY = randLoc.getRand(150) + 150; // Gets a random number between 1 and 240. int randCheck = randLoc.get...
9d99b4b7-b8ea-4e4b-8c5f-0e3f38e394a6
0
public static byte[] encrypt(byte[] data, String password, byte[] salt) throws Exception { Key key = toKey(password); PBEParameterSpec paramSpec = new PBEParameterSpec(salt, 100); Cipher cipher = Cipher.getInstance(ALGORITHM); cipher.init(Cipher.ENCRYPT_MODE, key, paramSpec); return cipher.doFinal(data);...
5fdb5df2-d10a-48ff-92fb-57177b5d3e1e
5
@Override public void unmountSharedFolder(VirtualMachine virtualMachine, String shareName, String hostPath, String guestPath) throws Exception { if (status(virtualMachine) == VirtualMachineStatus.POWERED_OFF) { throw new Exception("Unable to unmount shared folder. Machine is not started."); } String ...
35edb15f-3879-4ada-8827-604dd0ab53f1
9
public static boolean verificaColuna(String coluna, Sorteio sorteio, Ticket ticket) { coluna = coluna.toLowerCase(); int contem = 0; double coluna2 = 0.0; if (coluna != null) { if (coluna.endsWith("b")) coluna2 = 0.0; if (coluna.endsWith("i")) coluna2 = 1.0; if (coluna.endsWith("n")) col...
1fb26c30-b2cf-48e6-acbe-ab53020c632b
1
@Override public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) { if (e.getDocument() == null) { setEnabled(false); } else { calculateEnabledState(e.getDocument().getTree()); } }
14a84166-f4e0-4f88-9e1f-1c34e302e0d8
8
public static void main(String[] args) { Scanner scan = new Scanner(System.in); int win = 0, total = 0; // multiple decks Deck deck = new Deck(2); try { while (true) { User user = new User(deck, scan); AI dealer = new AI(deck); ...
184910ed-1c34-4b0d-a2e5-ac78fbc3a055
5
public void printFullTaxonmyPerLine(List<TaxaNode[]> l, String filename){ for(TaxaNode[] hierarchy : l){ } OutputStream fis = null; BufferedWriter br = null; try { fis = new FileOutputStream(filename); br = new BufferedWriter(new OutputStreamWriter(fis, Charset.forName("UT...
797ccf83-573c-4d44-bb00-3573354ff0c4
9
public int[][] ComputePaths(GraphType g) { BaseEdgeVertexCopier gc = new BaseEdgeVertexCopier(); VertexType u; BaseEdge e; u = (VertexType) gc.convert(null); g.insertVertex(u); for (VertexType v : g) { if (v != u) { e = gc.convert(null, u, v...
d85a4a44-eea6-4e03-8f6c-4eba2ea07efe
7
@Override public int attack(final NPC npc, Entity target) { NPCCombatDefinitions defs = npc.getCombatDefinitions(); if(Utils.random(5) == 0) { //bury npc.setNextAnimation(new Animation(3314)); npc.setCantInteract(true); npc.getCombat().removeTarget(); final Player player = (Player) (target instanceof ...
473dc175-d20b-498d-a656-0c56dec91ecd
5
public void edit(Page page) throws NonexistentEntityException, Exception { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); page = em.merge(page); em.getTransaction().commit(); } catch (Exception ex) { ...
9b08f156-c47b-447f-9f55-d3870c341dad
5
@Override public Model getRotatedModel() { Model model = animation.getModel(); if (model == null) return null; int frameId = -1; if (animation.sequences != null) frameId = animation.sequences.frame2Ids[animationFrame]; Model rotatedModel = new Model(true, Animation.isNullFrame(frameId), false, mode...
309f24b6-f20b-4d2b-ac31-b8480d8fa13c
1
public void accept(final MethodVisitor mv) { AbstractInsnNode insn = first; while (insn != null) { insn.accept(mv); insn = insn.next; } }
215eabc6-ad53-4151-aa36-2d7520384c91
2
public static synchronized void enablePassThrough() { PASS_THROUGH = true; if (PENDING_FILES != null) { for (File file : PENDING_FILES) { open(file); } PENDING_FILES = null; } }
2accf12f-93cb-4ce2-a439-0c1c2e8b9304
6
@EventHandler public void blockRightClick(PlayerInteractEvent event) { SpoutBlock block = (SpoutBlock) event.getClickedBlock(); SpoutPlayer player = (SpoutPlayer) event.getPlayer(); if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { if (player.isSpoutCraftEnabled()) { if (block.getCustomBlock() == Re...
11d9c5fb-e096-4b88-84ae-16f903b5296a
9
@Override protected int findPrototypeId(String s) { int id; // #string_id_map# // #generated# Last update: 2007-05-09 08:15:15 EDT L0: { id = 0; String X = null; int c; L: switch (s.length()) { case 4: X="call";id=Id_call; break L; case 5: X="apply";id=Id_appl...
d05e0789-5a8c-438f-a860-061a60918ba4
3
@Override public void update(Membre obj) { PreparedStatement pst = null; try { pst = this.connect().prepareStatement("update Membre set status=?, nom=?, prenom=?, email=?, mdp=? where id=? ;"); pst.setString(1, obj.getStatus()); pst.setString(2, obj.getNomMembre()...
57f0d611-cca7-4169-bc2e-a5ea96154a6f
8
public ClusteringExternalPerformances(Map<Integer,String> indexToTrueState, Map<Integer,String> indexToCluster) { if( indexToTrueState == null) throw new IllegalArgumentException("Error: null indexes to true states map"); if( indexToTrueState.size() < 1) throw new IllegalArgumentException("Error: indexes t...
b8b9d921-ee0d-4714-a1ac-17cd39be7dd3
0
RLOGOntClasses() { this.uri = "http://persistence.uni-leipzig.org/nlp2rdf/ontologies/rlog#" + name(); }
929ca538-143f-4c2b-927b-959d9738f3e5
6
@Override public boolean execute(CommandSender sender, String[] args) { if (args.length == 2) { PermissionGroup pg; try { pg = plugin.getDataManager().getGroup(args[1]); } catch (DataLoadFailedException ex) { plugin.getLogger().log(Level.SE...
69b0164f-a9d9-4242-83c6-02b4d0f7e371
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Exame)) { return false; } Exame other = (Exame) object; if ((this.idExame == null && other.idExame != null) || ...
a158a0d0-8605-476f-bc45-35b08f3b6b34
4
double PythagTheorem(double A, double B, double C) { double D = 0; Scanner errorHandler = new Scanner(System.in); String solveForString = new String(); System.out.println("Please specify variable to solve for:\n"); if(errorHandler.hasNext()){ solveForString = errorHandler.toString(); char[] solv...
4feb5280-44d1-4b00-9f31-95f076910f42
5
private void updateFields(Event e) { String name = e == null ? "Enter event name..." : e.getName(); String loc = e == null ? "Enter event location..." : e.getLocation(); String desc = (e == null ? "Enter event description..." : ...
efda5c45-b4a1-486e-af6c-f420b8f768dc
4
public static String[][] getRank() { try { String[][] ranks = new String[10][2]; URL url = new URL("http://tc-server.redirectme.net:8080/classement.php"); InputStreamReader ipsr; ipsr = new InputStreamReader(url.openStream()); BufferedReader br = new BufferedReader(ipsr); String line = null; Stri...
cbfa34a2-08f7-4210-8b83-994fd2bc2c08
2
private IRemoteCallObject doCall(long connectionId, String command, Object params) throws Exception { ISocketServerConnection ssc = getConnectionById(connectionId); if (ssc == null) { catchException(this, new Exception("Call.Connection by index (" + connectionId + ") not found.")); } final IRemot...
5443a9aa-a372-4864-8232-84acb58b33ee
9
public Buff(int dur, Buffable b, int stackingType, BuffType buffType){ this.timeLeft = dur; this.duration = dur; this.stackingType = stackingType; this.buffType = buffType; this.owner = b; if(b!=null){ if(stackingType==STACKING_REFRESH){ ArrayList<Buff> destroy = new ArrayList<Buff>(); for(Buff b...
447969b6-337a-4fb5-ba04-74605a054823
9
public static void main(final String[] args) throws Exception { int i = 0; int flags = ClassReader.SKIP_DEBUG; boolean ok = true; if (args.length < 1 || args.length > 2) { ok = false; } if (ok && "-debug".equals(args[0])) { i = 1; flag...
04ce1e9f-2394-4eb9-ae1f-0e65b7f9e617
1
public static void main(String[] args) { File file = new File("/home/xander/test"); String[] names = file.list(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".txt"); } }); for (Str...
116c1987-36df-46c8-bc42-16c88bad46c4
1
public ClassFileLoader() { outputDir = new File("."); classpath = System.getProperty("java.class.path"); classpath += File.pathSeparator + System.getProperty("sun.boot.class.path"); if (ClassFileLoader.USE_SYSTEM_CLASSES) { classpath += File.pathSeparator + System.getProperty("java.sys.class.path");...
3f694e40-740c-4186-91fc-5e1158d96a2c
7
public static void main(String[] args) throws IOException { Scanner s = new Scanner(System.in); int n = s.nextInt(); int xmin = s.nextInt(); int ymin = s.nextInt(); int xmax = s.nextInt(); int ymax = s.nextInt(); int curarea = (ymax - ymin) * (xmax - xmin); ...
be4a2e63-76c8-42b1-b29d-6566275c0550
5
public static void main(String[] args) { QuickHull3D hull = new QuickHull3D(); QuickHull3DTest tester = new QuickHull3DTest(); hull = new QuickHull3D(); for (int i = 0; i < 100; i++) { double[] pnts = tester.randomCubedPoints(100, 1.0, 0.5); hull.setFromQhull(p...
ae8605d8-5ece-44d2-a769-905ca14ceb38
5
private LinkedList<Servicio> obtenerServicioSeleccionados() { LinkedList<Servicio> servicios = new LinkedList<>(); float precioServicio = 0; int idServicio = 0; if (this.cbBanqueteraEvento.isSelected()) { precioServicio = Float.parseFloat(this.txtBanqueteraEvento.getText())...
8e3795a1-2a43-4bbd-808f-604620f2a935
8
public ConnectDialog(ElphelVision parent) { Parent = parent; try { java.awt.EventQueue.invokeAndWait(new Runnable() { public void run() { bg = new javax.swing.JPanel(); TitleBackground = new javax.swing.JPanel(); Title = new javax.swing.JLabel(); Image = new javax.swing.JLabel(); ...
f7a567fc-2b7e-455f-8bd0-1b25fcce585d
9
public void requestNewBlockSequential(Peer peer){ if(this.done) return; boolean[] peerlist = peer.getBitfield(); for(int i = 0; i < this.recieved.length; i++){ if(!this.recieved[i] && peerlist[i]){ Piece p = this.pieces.get(i); if(p == null || p.complete() || p.blockWaiting()) continue; ...
5b2b75ab-98b8-49a8-99b8-fe2487986466
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...
8fa7ff08-aab2-499e-a387-ba794d149cb1
3
private int getItemStackIndex(Item item) { int ID = item.getID(); ItemStack stack; for (int i = 0; i < items.size(); i++) { stack = items.get(i); if (stack.getItemInStackID() == ID && stack.getAmount() < stack.getMaxStackSize()) return i; } ...
409506f9-a119-4664-a48b-dc70f2f5ca9b
2
public boolean isEqual(Position p) { boolean isOk = false; if((this.i == p.getI()) && (this.j == p.getJ())) isOk = true; return isOk; }
78c367c6-930c-4f44-bb1a-5bcbf73e13a0
4
private boolean checkTilePos(int xp, int yp){ if(xp <= 0 || yp <= 0 || xp >= width - 1|| yp >= height - 1) return false; //TODO: Detect if tile is in start and end rooms, return false if true. return true; }
3c25f905-4f45-4b7b-a848-e9c85b3a7211
2
public void run() { while (true){ lastTime = time; time = elapsedTime/60/60/24/365; deltaTime = time-lastTime; double sum = average*samples; sum += deltaTime; samples += 1; average = sum/samples; System.out.printf("Delta time: %f, Average time: %f\n", deltaTime, average); try { Thread.s...
9ccc87b2-7bf9-40c9-990b-5e5057cfa053
5
String parameterInfo(String methodRoot) { String typeName = null; Class returnType = getReturnType(methodRoot); boolean isArray = returnType.isArray(); if (isArray) { typeName = returnType.getComponentType().getName(); } else { typeName = returnType.getName(); } String typeNameString = typeName; i...
60634271-5348-4f6d-b244-b15dc8ac14e0
3
private Customer handleCashInLine(final String[] fields, final FilesParsed filesParsed) { final String customerNumber = fields[0]; ImportedCustomer existingClienCustomer = DbReader.getCustomer(customerNumber); final Customer existingCloudCustomer = CustomerApiService.getByNumber(Long.valueOf(customerNumber)); i...
a63ab301-5e57-494e-bdf2-e9284913b1f7
6
public int iConomyversion() { if (iConomyversion == 0) { try { if (packageExists(new String[]{"net.milkbowl.vault.economy.Economy"})) { iConomyversion = 2; plugin.getLoggerUtility().log("hooked into Vault", LoggerUtility.Level.DEBUG); ...
5ab8b0c0-9ae3-4b50-a3f0-d9a08499250f
2
static public boolean write(OutputStream os, CPArtwork a) { try { writeMagic(os); os.flush(); Deflater def = new Deflater(7); DeflaterOutputStream dos = new DeflaterOutputStream(os, def); // OutputStream dos = os; writeHeader(dos, a); for (Object l : a.layers) { writeLayer(dos, (CPLayer) l...
b7978fcc-d9f6-4455-87a6-8a4178b06529
5
private static CommandMap getCommandMap() { CommandMap commandMap = null; try { if (Bukkit.getPluginManager() instanceof SimplePluginManager) { Field f = SimplePluginManager.class.getDeclaredField("commandMap"); f.setAccessible(true); commandMap = (CommandMap) f.get(Bukkit.getPluginManager()); ...
867db33e-461f-4413-9e19-e69b0fc95d95
5
private void checkMain() { SymbolEntry mainEntry = SymbolTable.GLOBAL.get("main"); if (mainEntry == null) throw new SemanticsMainException("main function undeclared", null); FunctionType mainType; if (mainEntry.getType() instanceof FunctionType) { mainType = (FunctionType) mainEntry.getType(); } else { ...
b0d9e7e3-46e7-4a90-b904-3de81ff453fb
4
public int setEtat(String etat) { if(etat.equalsIgnoreCase(ConfigGlobale.etatHS) || etat.equalsIgnoreCase(ConfigGlobale.etatOK) || etat.equalsIgnoreCase(ConfigGlobale.etatOFF) || etat.equalsIgnoreCase(ConfigGlobale.etatMaintenance)){ this.etat = etat.toLowerCase(); return 0; } ...
119f2e6a-bb62-4a06-9242-b6e36a3ec9cc
9
private String[] getFilenames(String dirPath) { if (Globals.initDebug()) { showMe.showMe("\nin getFilenames"); } File pathDir = new File(dirPath); if (Globals.initDebug()) { showMe.showMe("\n\tpathDir=" + pathDir); } ArrayList<String> list = new A...
c58b1a27-c380-4e59-8ea9-48b4d3de9532
5
public void register(Object obj) { for (Method method : obj.getClass().getMethods()) { Command command = method.getAnnotation(Command.class); if (command != null) { String name = command.value().isEmpty() ? method.getName() : command.value(); name = name.startsWith("!") ? name : "!" + name; if (comm...
2a247607-deeb-42c0-907a-d567572f8d14
0
public int getColumns() { return columns; }
6c5b22af-98d0-4f01-8aed-b8ca5c741ebd
2
protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegi...
266f259f-1233-4f14-947a-4ba9c0f89d05
3
@Override public void serialize(Buffer buf) { short flag1 = 0; flag1 = BooleanByteWrapper.setFlag(flag1, 0, sex); flag1 = BooleanByteWrapper.setFlag(flag1, 1, isRideable); flag1 = BooleanByteWrapper.setFlag(flag1, 2, isWild); flag1 = BooleanByteWrapper.setFlag(flag1, 3, isFec...
707ea664-36b9-49af-ba14-ad407052f8d0
9
public static boolean isValidSerialization(String preorder) { Stack<String> stack = new Stack<>(); Stack<String> stack2 = new Stack<>(); String items[] = preorder.split(","); for (int i = 0; i < items.length; i++) { stack.push(items[i]); } if (stack.size() == 1) return stack.pop().equals("#") ? true :...
f167c557-47b9-414c-8c66-bd4ca0d77f40
8
public void localVariableHiding(LocalDeclaration local, Binding hiddenVariable, boolean isSpecialArgHidingField) { if (hiddenVariable instanceof LocalVariableBinding) { int id = (local instanceof Argument) ? IProblem.ArgumentHidingLocalVariable : IProblem.LocalVariableHidingLocalVariable; int severity = c...
ef94e3f4-4aba-4903-a26f-65ead8dc356b
0
@Override public void startSetup(Attributes atts) { // Set the Label setLabelText(atts.getValue(A_LABEL)); // Set the Preference Preference pref = (Preference) GUITreeLoader.getAncestorElementOfClass("com.organic.maynard.outliner.util.preferences.Preference"); setPreference(pref); }
bd24f0d1-5ae3-4c1b-a882-2aaa0f922746
8
@Override public Object evaluate(Context context) { Iterator<Term> i = terms.iterator(); Object value = i.next().operand.evaluate(context); while (i.hasNext()){ Term next = i.next(); switch (next.operator){ case LT: value = Operations.lt(value, next.operand.evaluate(context)); break; case LE...
7ece1cc9-7a7e-443e-97f4-6677baff2996
9
public void run(int action, int dbType, int realmMultiplier, int numOfRealmsToCreate) throws Exception { // initialize System.out.println("starting createandpopulate running action "+action); // get mongo connection MongoFactory mf = new MongoFactory(); Mongo mongo = mf.getConnection("192.168.23.28", 27...
c3166fc5-7e22-4202-af63-b38c8d722fa2
3
public static String read(InputStream is) { if (is == null) return null; StringBuffer strb = new StringBuffer(); char buff[] = new char[10240]; int len = 0; try { BufferedReader inFile = new BufferedReader(new InputStreamReader(is)); while ((len = inFile.read(buff)) >= 0) strb.append(buff, 0, len);...
a6744562-fa54-466b-92f2-01775a11cb67
0
@Override public String getCivilState() { return super.getCivilState(); }