method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c593f33d-26f8-46e0-b6f2-67f81a89a581
9
public synchronized void initialize() { // Max team size Object cMax = plugin.getConfig().get("bombermine.ctfgame.max_team_players"); if(cMax instanceof Integer) { this.maxTeamPlayers = (Integer)cMax; } else if(cMax instanceof String) { try { this.maxTeamPlayers = new Integer(Integer.parseInt((Stri...
4574609a-568a-45ef-81d3-e0d05f22dce9
6
public void launchServer () throws IOException { DatagramSocket serverSocket = new DatagramSocket(UDPSERVER_PORT); while (!over) { byte[] receiveData = new byte[2048*8]; byte[] sendData = new byte[2048*8]; DatagramPacket receivePacket = new DatagramPacket(r...
38c3930c-460c-4260-aa3b-4e5e7b8837aa
8
private SimpleGraph<Integer, DefaultEdge> addCAIDAmap( String mapFilenameCAIDA) throws Exception { SimpleGraph<Integer, DefaultEdge> mergedInternetGraph = new SimpleGraph<Integer, DefaultEdge>( DefaultEdge.class); try { FileReader fr = new FileReader(mapFilenameCAIDA); BufferedReader br = new Buffere...
948d852f-0227-4539-9a74-b42b7d425c07
6
private void updateUnknown(DatabaseBE tempDB){ //see if is known, if is then search for company in companies, //if find, add transaction, if not add company and add transaction //if not known, add to backend and leave in unknown unknown.getTransactionList().current = unknown.getTransactionList().head; while ...
43c0cb1f-5e10-4772-9826-915331408d81
9
public synchronized void sendPSO(SecureMessagingWrapper wrapper, byte[] certData) throws CardServiceException { int maxBlock = 223; int blockSize = 223; int offset = 0; int length = certData.length; if (certData.length > maxBlock) { int numBlock = certData.length / blockSize; if (numBlock * blockSize...
ac9362ed-89ff-46b9-a516-5d26fd133a6e
1
private Tile getTileForTileGID(int tileId) { Tile tile = null; java.util.Map.Entry<Integer, TileSet> ts = findTileSetForTileGID(tileId); if (ts != null) { tile = ts.getValue().getTile(tileId - ts.getKey()); } return tile; }
7fa3d85a-bbf3-445c-af4f-d49840d9ee48
1
public static void runMalformedDecimalExpressionTest(String badExp) throws MalformedParenthesisException, InvalidOperandException, MalformedTokenException { try { new Expression(badExp); } catch (MalformedDecimalException mde) { } }
9525c220-bfa1-449d-8cfd-cf2ce55d5ca8
6
protected void renderName(EntityPlayer par1EntityPlayer, double par2, double par4, double par6) { if (Minecraft.isGuiEnabled() && par1EntityPlayer != this.renderManager.livingPlayer) { float var8 = 1.6F; float var9 = 0.016666668F * var8; float var10 = par1EntityPl...
86c876fe-ab8b-454f-b4ee-57508e1cfae5
8
public static <T> void filterListToMap(final Map<String, T> destinationMap, final String[] nameMapping, final List<? extends T> sourceList) { if( destinationMap == null ) { throw new NullPointerException("destinationMap should not be null"); } else if( nameMapping == null ) { throw new NullPointerException(...
95206c63-9892-4081-9511-2471c5aa910c
2
private int getNbrCost(String fromId) { for (NbrCostPair ncp : nbrList) { if (ncp.getNbr().getId().equalsIgnoreCase(fromId)) return ncp.getCost(); } return 0; }
ccfa90df-ab38-475e-a3c4-5f486103b3b1
3
public void start() { Integer newId = startID; do { int index = 0; for (int i = 0; i < nodes.size(); i++) { if (nodes.get(i).getId().equals(newId)) { index = i; break; } } ...
c80cf5c2-6ee8-4e7b-a452-c58252749252
6
public Iterator getBshIterator(Object obj) throws IllegalArgumentException { if (obj == null) throw new NullPointerException("Cannot iterate over null."); if (obj instanceof Enumeration) { final Enumeration enumeration = (Enumeration) obj; return new Iterator<Object>() { public boolean hasNext() { ...
a3c017cb-df04-4b71-b343-0e525ecb3440
4
private static void displayReviews(LinkedList<Review> reviews, boolean isMenu) { if (reviews.isEmpty()) { System.out.println("0 reviews"); } else { System.out.println(reviews.size() + " reviews"); } int menuItem = 1; for(Review review : reviews) { ...
d622917e-d2de-495d-a9ba-8d02c33863ad
5
public void run() { while (true) { while (!_soundRequests.isEmpty()) { Integer number = _soundRequests.poll(); DataSource soundsrc = null; try { soundsrc = new URLDataSource(new URL("file://" + baseDir + _filenames.get(number))); } catch (MalformedURLException e) { // TODO Auto-gen...
3a110fc5-e3f7-4480-ad72-4360d12cc6fd
2
public boolean isBlockSpinner(Block block) { Set<Integer> spinnersKeys = spinnersLocations.keySet(); for(Integer key : spinnersKeys) { SerializableLocation blockLocation = new SerializableLocation(block.getLocation()); if(spinnersLocations.get(key).equals(blockLocation)) return true; } return false; }
7a12cecc-3996-4a85-8a0d-9bc2e71c846b
7
final int method1753(int i, int j, int k) { if (anIntArray4683 == null || ~j > -1 || j > anIntArray4683.length) { return -1; } if (k != 0) { method1754(36, null); } if (anIntArrayArray4678[j] == null || i < 0 || ~i < ~anIntArrayArray4678[j].length) { ...
cc5d1f77-5afe-49b7-b72c-7fbe22566ac4
2
public static void unpackConfig(Archive container) { ObjectDefinition.buffer = new Stream(container.get("loc.dat")); Stream stream = new Stream(container.get("loc.idx")); int totalObjects = stream.getUnsignedShort(); ObjectDefinition.objectIndices = new int[totalObjects]; int i =...
b94bbe3a-4c35-43ba-9dba-e37912e47576
4
public ArrayList<Link> intersects(JXMapViewer mapViewer) { ArrayList<Link> clickedLinkArray = new ArrayList<Link>(); for (Link link : links) { if (mousePos != null) { for (Line2D line : link.getLines(mapViewer, mousePos)) { if (line.ptSegDist(mapViewer.get...
0b4298db-92a0-45e2-8b40-11df29adba24
1
public List<Object> getContent() { if (content == null) { content = new ArrayList<Object>(); } return this.content; }
31efd6b2-37ca-43e5-b349-f630889e50f3
8
@Override public void run() { int frames = 0; int tickCount = 0; double unprocessedSeconds = 0; double secondsPerTick = 1 / 60.0; long lastTime = System.nanoTime(); while (running) { long now = System.nanoTime(); long passedTime = now - lastTime; lastTime = now; if (passedTime < 0) passe...
6d67e588-0c94-4876-b22c-4a4c79f07928
1
@Override public Object getNextValue() { setMaximum(new Integer(tabbedPane.getComponentCount())); int n = getNumber().intValue(); if (n == tabbedPane.getComponentCount()) { return n; } return n+1; }
5824ae98-2d56-407f-a6f7-fa9af7845472
9
public Instances transform(Instances train) throws Exception{ Attribute classAttribute = (Attribute) train.classAttribute().copy(); Attribute bagLabel = (Attribute) train.attribute(0); double labelValue; Instances newData = train.attribute(1).relation().stringFreeStructure(); //insert a bag label...
11ecf023-bdc3-4022-951c-3745b8e8b7c2
5
public Option<Zipper<A>> deleteLeft() { return left.isEmpty() && right.isEmpty() ? Option.<Zipper<A>>none() : some(zipper(left.isEmpty() ? left : left.tail()._1(), left.isEmpty() ? right.head() : left.head(), left.isEmpty() ? right.tail()._1() ...
a9733337-ef18-45cc-aab0-9060c322c7bf
9
private byte[] unwrapResponseAPDU(byte[] rapdu, int len) throws GeneralSecurityException, IOException { long oldssc = ssc; try { if (rapdu == null || rapdu.length < 2 || len < 2) { throw new IllegalArgumentException("Invalid response APDU"); } cipher.init(Cipher.DECRYPT_MODE, ksEnc, ZERO_IV_PARAM_SP...
0b9ec0cb-425f-4c68-b1cc-1c7dbdf6824d
4
public static void main(String[] args) { Random r = new Random(); ArrayList<Integer> ArrayA = new ArrayList<Integer>(); ArrayA.add(r.nextInt(10)); ArrayA.add(r.nextInt(10)); ArrayA.add(r.nextInt(10)); ArrayA.add(r.nextInt(10)); ArrayA.add(r.nextInt(10)); ArrayA.add(r.nextInt(10)); ArrayA.add(r.nextInt...
f49fa0d7-e093-4256-b212-885f8b94405e
5
public static void bootup(){ while(true){ ask(); String type_data = systemSave.getType(); if(input == "CREATE"){ beginning.main(null); break; }else if(input == "LOAD"){ System.out.println("Save Files:"); if(type_data != null){ systemSave.main(null); }else{ System.out.prin...
d157d1b8-08e3-482a-9732-e9ef7833cad5
1
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { AboutView frame = new AboutView(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
bfc42d9a-e4f9-430f-a3d2-989858c8dd2f
7
public void mousePressed(MouseEvent mouseEvent) { Iterator<PComponent> it = components.iterator(); while (it.hasNext()) { PComponent comp = it.next(); if (shouldHandleMouse) { if (comp.shouldHandleMouse()) comp.mousePressed(mouseEvent); ...
d3605c6e-2f4c-4955-a6cf-0e2f81365c48
4
@Override public boolean inBounds(int x, int y) { if (x < 0 || x >= sizex || y < 0 || y >= sizey) { return false; } return true; }
9c2139fb-c9d0-4192-94e7-6da3e3a00e86
3
public void itemStateChanged(ItemEvent evt){//***Event if(evt.getStateChange() == ItemEvent.SELECTED){ if (evt.getSource() == cBoxYes){ que.setUserChoice(Q2_AskBrand.YES); }else if (evt.getSource() == cBoxNo) { que.setUserChoice(Q2_AskBrand.NO); } } ...
35848b45-732e-4638-9c46-c78e9bc5869a
2
private void buildRecord() { if (!built) { // Create Record r = new Record(); r.setAuthor("fake-author"); r.setCategory(new Category("fake-cat", 12)); r.setCatNo("fake-cat-no"); r.setDate(new Date()); r.setDiscogsNum(12); r.setFormat...
1dbc80b6-350a-4bb7-8cfa-812aad1bf607
8
public synchronized void writeChunk(int chunk[], int off, int len) throws IOException { if (chunk == null) { throw new NullPointerException(); } else if ((off < 0) || (off > chunk.length) || (len < 0) || ((off + len) > chunk.length) || ((off + len) < 0)) { throw n...
3e53dc04-c454-4044-b4c0-ef28151c7ba7
9
public int numDecodings(String s){ if (s == null) return 0; if (s.length() == 0) return 0; int[] f = new int[s.length() + 1]; f[0] = 1; if (s.charAt(0) == '0' ) return 0; else f[1] = 1; char c = s.charAt(0); for (int i = 2; i<=s.length(); i++) { int t = (c - '0')...
e743d84b-6a0d-4a2b-bf7f-192a2018c65e
5
protected Object readValue (Class type, Class elementType, Class defaultType) throws YamlException, ParserException, TokenizerException { String tag = null, anchor = null; Event event = parser.peekNextEvent(); switch (event.type) { case ALIAS: parser.getNextEvent(); anchor = ((AliasEvent)event).anchor;...
aaf6d2b7-d9f9-4d18-a7ae-42b114b23d04
4
public void shift(Direction direction, int i) { switch (direction) { case UP: y -= i; break; case DOWN: y += i; break; case LEFT: x -= i; break; case RIGHT: ...
f6298e82-9ca8-49fb-8cd2-1735b9cbf0c1
2
@Override public boolean equals(Object obj) { if (obj instanceof AbstractEntity) { return (getId() == null) ? super.equals(obj) : getId().equals(((AbstractEntity) obj).getId()); } return super.equals(obj); }
d66969f8-e1dd-4c08-92fa-d5874dcf4bf4
0
public void setSequence(long value) { this._sequence = value; }
2345b97c-c7ea-432e-80bf-4ddc9d5f2a03
1
public void salvarCliente(ClienteDTO clienteDTO){ clienteDTO.setDtNascimento(new Date()); Cliente cliente = ConverterUtil.convertToCliente(clienteDTO); try { FabricaDAO.getClienteDAO().save(cliente); } catch (Exception e) { throw new ClienteException(e); } }
594a7fb5-9e61-4532-a1a9-ae426090d85d
0
public void setBoilerStatus(int status) { this.boilerStatus = status; }
da546476-fcfe-4d0f-98a1-254b37451b57
2
public TableCellRenderer getCellRenderer(int row, int column) { int column2 = convertColumnIndexToModel(column); if (highlightRenderers != null) { TableCellRenderer ren = (TableCellRenderer) highlightRenderers .get(new Integer(singleIndex(row, column2))); if (ren != null) return ren; } return sup...
0b8b1b24-562e-4ecf-9f8b-b80f3f1c695d
1
private static boolean deletePrescription(Prescription bean, PreparedStatement stmt) throws SQLException{ stmt.setInt(1, bean.getPrescriptionID()); int affected=stmt.executeUpdate(); if(affected==1){ System.out.println("Prescription with ID "+bean.getPrescriptionID()+" has been Removed from database.");...
e77a2f21-277f-4530-9170-a9f540e8bdbc
8
private IoSample parseIoSample(IIntArrayInputStream ps) throws IOException { IoSample sample = new IoSample(this); // DIO 8 occupies the first bit of the adcHeader if (this.containsDigital()) { // at least one DIO line is active // next two bytes are DIO log.debug("Digital I/O was received"); ...
bdc4c530-cdaf-4ac3-8ebc-7460a431c5c5
4
public int run (CommandManager manager, Object... args) { String source = ""; if(args != null && args.length > 0){ source = (String)args[0]; } else //Take input { Scanner kb = new Scanner(System.in); //Prompt the user as it pertains to System.out.println("Please enter the source file path:");...
c1335a2d-10d6-47a5-87c3-e6a8b2e6a6bb
2
@Override public final Object getValueAt(final int rowIndex, final int columnIndex) { final Vector<Entry<Program, Integer>> entries = data; if (rowIndex >= entries.size()) { return null; } final Entry<Program, Integer> entry = entries.get(rowIndex); if (columnI...
362d5c29-037b-4d2d-a0cc-ac6aed06ba5e
7
public String toString() { final StringBuilder sb = new StringBuilder(); sb.append(table.getName()); sb.append(':'); try { sb.append(getSymbolString()); } catch (MaltChainedException e) { if (getLogger().isDebugEnabled()) { getLogger().debug("",e); } else { getLogger().error(e.getMessageChain...
5a6de6b9-73eb-4fa6-8bfe-22ae588f23d2
4
public void checkElements(double[][] A) throws IllegalArgumentException{ for ( int i = 0; i < A.length; i++ ){ for ( int j = 0; j < A[0].length; j++ ){ if ( A[i][j] < 0 || A[i][j] > 1.0 ) { throw new IllegalArgumentException("All matrix elements should be in range of [0.0,1.0]"); } } } }
c609330b-6321-4b16-859e-a5b5d228eeca
2
private int rangeCheck(int value, int begin, int end) { if (value > begin && value <= end) { // (begin,end] return value; } throw new IllegalArgumentException("Value [" + value + "] not in range ("+begin+","+end+"]"); }
ba51c5f9-effb-48a1-9a99-f55f934e9e2d
0
public final long getLength() { return length; }
be0dfff8-f54c-411e-ab57-c2d2df348c15
9
@Test public void testUpdateClaim() { StorageBroker storage = new StorageBroker(); Employee employee = storage.getEmployee(0, "12345"); if(employee == null) System.out.println("There is no employee"); ArrayList<Claim> claims = storage.getClaims(employee); System.o...
b144a000-2ddf-4579-9f73-3ed1a825324c
2
private void convertToCNF(CNFConverter converter, Production p) { if (!converter.isChomsky(p)) { Production temp[]=converter.replacements(p); for (int j=0; j<temp.length; j++) { p=temp[j]; convertToCNF(converter, p); } } else myTempCNF.add(p); }
b699a8f8-735c-4c8f-8735-f0e632aa2924
9
@EventHandler(priority=EventPriority.HIGH, ignoreCancelled=true) public void onAttack(EntityDamageByEntityEvent event) { if (event.getDamager() instanceof Player) { if (!(event.getEntity() instanceof Player)) { Debug.checkBroadcast("<onAttack> &aDefender is not a Player, allowing."); return; } else { ...
b862df95-aca8-40dc-9059-4ddf14e10cad
1
private boolean jj_2_69(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_69(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(68, xla); } }
a2ff253f-f96f-4887-85b3-51d19c5a55ad
3
public Version(final String version) { this.original = version; if (version == null) { this.major = null; this.minor = null; this.revision = null; this.type = null; this.build = null; return; } final Matcher m = Pa...
d3769bce-d29e-44e2-9b22-42fc20b8727d
1
@Override public boolean isObstacle(Element e) { if (e instanceof ForceFieldGenerator) return true; return false; }
7214b5d0-ee52-4b9d-9c5a-fbf2625809cf
1
public ArrayList viewServiceId() { ArrayList temp = new ArrayList(); Query q = em.createQuery("SELECT t from ServiceEntity t"); for (Object o : q.getResultList()) { ServiceEntity p = (ServiceEntity) o; temp.add(p.getId()); } return temp; }
88ac391d-1caa-4f0f-9ea7-fe7ae29e2b29
1
public void push(Type data) { if (size == stack.length) resize(2 * stack.length); stack[size] = data; size++; }
aecabea1-a4dd-44a6-92ce-ccd51294bd91
6
@Override public void accept(Metadata metadata, InputStream contentStream) { try { Method[] methods = this.type.getMethods(); Method match = null; for (Method method : methods) { if (method.getName().equals(metadata.getOperation())) { m...
c8ba1375-050e-433a-b203-d475e4d2fad4
4
public void drawInfo(Graphics g, int rX, int rY, int rW, int rH) { // tuto to mozno nie je uplne najrychljeise String[] ids = Canvas.shortenWrap(g, ((Integer) edge.from.getID()).toString() + ">" + ((Integer) edge.to.getID()).toString(), rW - 2, ">"); for (int i = 0; i < ids.leng...
d7a775a9-8726-4b74-b7da-b1aae5a9a8b2
3
public boolean fileCanCreateGrid(){ if(isSquareGrid()){ // System.out.println("is square"); if(allVehiclesAreLegal()){ // System.out.println("all vehicles legal"); if(gridHasUserCar()){ // System.out.println("has user car"); return true; } else { return false; } } else { retur...
304ac9ab-88e5-4d4c-b041-f7fd0e9f6154
6
private void calculatePathPoint() { //Alle möglichen Punkte finden Vector<float[]> Points = PathFinder.getPossiblePoints(Lines, position, PathFinder.getBestGoal(Lines, Goals, position, false)); //Moeglichst nicht den Punkt nehnmen, dessen Verbindungsgerade den kleinsten Winkel zum "Ausgangspunkt" hat i...
3dfe39d8-6dfa-42b1-b77c-1089efd95207
6
public void closeAll(){ if(rs!=null) try { rs.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(stmt!=null) try { stmt.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } ...
9fe7b3a1-5183-4ecd-abae-1750ba665a10
3
public static void addConnectedClient(String btName, String btAddress) { boolean wasAdded = false; for(int i = 0;i<=5;i++) { if(wasAdded == false) { if(clientsTable.getModel().getValueAt(i, 0) == null) { clientsTable.getModel().setValueAt(btName, i, 0); clientsTable.getModel().setValue...
353dd626-41cd-4c94-a6ee-a4da8d4e0425
9
public static String reduce_file_path(String path){ String newStr= new String(""); String []arr = path.split("/"); List<String> tmp = new ArrayList<String>(); int t=0; for(int i = 1;i<arr.length;i++){ if(arr[1].equals("..")){ tmp.add(""); bre...
01635793-6591-4f0e-a3d1-19bbb7c8a7f3
2
public void write(String message) throws IOException { synchronized (this) { if (this.socket.isClosed()) { this.shutdown(); return; } byte[] msg = message.getBytes(); //System.out.println("Sending to client"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); BufferedOutputSt...
94f1579f-d6bd-4362-a459-4dfff1c1e945
4
private void makeSolved() { gameBoard = new int[numOfTilesOnSide][numOfTilesOnSide]; int n = 1; for (int i = 0; i < numOfTilesOnSide; i++) { for (int j = 0; j < numOfTilesOnSide; j++) { if (i == (numOfTilesOnSide - 1) && j == (numOfTilesOnSide - 1)) { gameBoard[i][j] = 0; } else { gameB...
50b34266-7642-4110-84e9-0b87b7208677
9
public static void extractFromHTML(String theURL) throws URISyntaxException, ParserException { //******** //This extracts the price, publish date FilterBean thePriceFilter = new FilterBean(); HasAttributeFilter priceattr = new HasAttributeFilter("class", "renta_precio"); thePric...
d28673a8-6d06-4561-bd89-4cf838559b77
0
public int getFileModifiedMask() { return JNotify.FILE_MODIFIED; }
17f28cc4-2a8d-42da-b786-bb6ff689b8dd
2
@Override public Skin loadSkin(Path skinPath) { if (!FileUtil.control(skinPath)) { IllegalArgumentException iae = new IllegalArgumentException("The skindirectory is not existing!"); Main.handleUnhandableProblem(iae); } cleanModel(); Skin skin = null; ...
e779c1db-0ef6-4cb4-93a0-f76e8cbf023f
4
private static void generateRandomOre(World world, String block, int loops){ TileMap tm = world.tileMap; for(int i = 0; i < loops; i++){ BlockBreakable b = (BlockBreakable) Blocks.loadMapObjectFromString(block, tm, world); int x = new Random().nextInt(tm.getXRows()); int y = new Random().nextInt(tm.getYR...
efe5dbb4-94b9-4eb0-a9e6-21e1003f9241
2
private void initialise() throws IOException { //Configuration de la fenêtre setTitle("Utilitaire de création de maps"); setSize(frameWidth, frameHeight); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - fra...
72706224-2bbd-4039-a9f5-2e25c9eea1de
5
private int[] getBoundaryPositions(ByteBuffer b, byte[] boundary) { int matchcount = 0; int matchbyte = -1; List<Integer> matchbytes = new ArrayList<Integer>(); for (int i = 0; i < b.limit(); i++) { if (b.get(i) == boundary[matchcount]) { ...
b0500baf-05e6-47d6-ad91-9f7d90c0fc05
7
public void mouseReleased(MouseEvent e) { if(freezeboard) return; if(board.isGoalState()) { JOptionPane.showMessageDialog(null, "You won!"); freezeboard=true; } int modifier = (int) Math.floor(Point.distance(pressed.x,pressed.y,e.getX(),e.getY())/114); for(int i=0; i<board.numberOfPieces()...
612ad186-9a78-423a-9af2-238b456e7c01
1
public void actualizarLista() throws SQLException{ lineas = LineaAereaDAO.getInstance().getLineasAereas(); addElement("Todas las lineas"); for (LineaAerea lineaAerea : lineas) { addElement(lineaAerea.getCodigo()+" - "+lineaAerea.getNombre()); } ...
e0fc5989-0992-4de4-9b55-630eaba114e4
2
public Integer CountTotal(Map<?,Integer> shoppingCar){ int num = 0; for(int element:shoppingCar.values()){//所有書數量總和 num+=element; } return num; }
25528e50-e4df-42fc-a985-9413c8085853
0
public Square(int side) { this.side = side; }
fb06b4c1-9af9-4592-8ce8-cb2f3de47b82
0
@Basic @Column(name = "FUN_CONSUMO_ULTIMO_MES") public Integer getFunConsumoUltimoMes() { return funConsumoUltimoMes; }
c0c990c0-fe47-4f36-aee2-24c4699d97d9
7
public Room portal(String s, Player p){ Room b = null; if(p.hasItem(s)){ System.out.println("You cannot use the portal while you are holding it."); return p.getRoom(); } if (s.equals("Blue_Portal")){ for(int i = 0; i < rooms.size(); i++){ if (rooms.get(i).hasItem("Yellow_Portal")){ b = rooms....
4b97b547-5a0b-4c65-b3cd-fa41d5af268c
6
protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else ...
eac2c3c0-6e84-4f08-81e9-44189dab9a0e
2
static void collectPoint(Map<String,Point> pointMap,Set<Point> result,Point from,int difX,int difY){ Point point=pointMap.get((from.x+difX)+","+(from.y+difY)); if(point!=null && point.value>from.value) result.add(point); }
8d752a46-0370-4952-a8f8-75d6e8a69637
0
public void handleBoy(ParkBoy boy) { boy.setManaged(true); this.parkBoyList.add(boy); }
42bc4a10-1b8a-4a87-9eac-c8ac80741fd9
6
private static boolean isAlphaNumericCharacter(char c) { if((c >= ((int)'A') && c <= ((int)'Z')) || (c >= ((int)'a') && c <= ((int)'z')) || (c >= ((int)'0') && c <= ((int)'9'))) return true; return false; }
1c63cfb1-d8a4-4d51-931a-fcf6afc80fdb
2
private void giveBirth(List<Actor> newBears) { // New bears are born into adjacent locations. // Get a list of adjacent free locations. Field field = getField(); List<Location> free = field.getFreeAdjacentLocations(getLocation()); int births = breed(); for(int b = 0; ...
6a0e373e-33c6-45c7-ae38-46f2824482d6
1
public ServiceModule(String address, int port, int maxRef) { address_ = address; port_ = port; try { // hack to get the exception at initialization time Host host = new PGridHost(address_, port_); } catch (UnknownHostException e) { throw new IllegalArg...
95e3ba28-88c5-4474-9491-f6fa89f8535a
0
public String toString() { return "[descripion=" + description + ", partNumber=" + partNumber + "]"; }
4640a473-3ada-4a4d-88cd-1bec398c79f1
3
public static void main(String[] s) { //wap /* * * * * * * * * * * */ int i,j; for(i=1;i<=4;i++) { for( j=20;j>=i;j--){ System.out.print(" "); } for( j=i;j>=1;j--){ System.out.print("* "); } System.out.println(" "); } }
a57199e5-8665-4b7e-8512-777551da0ac4
7
public static void printRemoteClass(StringBuilder sb, RemoteClass remoteClass) { if (remoteClass.isAbstract()) { sb.append("abstract "); } sb.append("class "); sb.append(remoteClass.getName()); if (remoteClass.getExtends() != null) { sb.append(" extends "); sb.append(remoteClass....
836289d3-2e96-474c-a8f2-73439960c1ff
9
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PosCuentasPK that = (PosCuentasPK) o; if (cueCuentaConcatenada != null ? !cueCuentaConcatenada.equals(that.cueCuentaConcatenada) : that.cueCuentaConcat...
a6f60fdf-734c-4780-bd44-631fbe9aacd1
3
public static void safeWrite(CompoundTag tag, File file) throws IOException { File file2 = new File(file.getAbsolutePath() + "_tmp"); if (file2.exists()) file2.delete(); write(tag, file2); if (file.exists()) file.delete(); if (file.exists()) throw new IOException("Failed to delet...
ac0f8030-b79b-472c-b17f-90ce1efbfce9
3
@Override public void onCombatTick(int x, int y, Game game) { List<Entity> neighbors = ((SinglePlayerGame) game) .getSquareNeighbors(x, y, 1); for (Entity neighbor : neighbors) { if (neighbor.id == EntityType.warrior.id) { ((MortalEntity) neighbor).damage(...
2219481c-c31c-453d-b00e-d15cfe6ced20
0
public int load(int offset) { return this.push(runStack.get(framePointers.peek() + offset)); }
0bea98ae-5acd-404e-8f95-974ea88377d4
7
protected void updateIndexSetFor(int i, double C) throws Exception { /* m_I0a.delete(i); m_I0b.delete(i); m_I1.delete(i); m_I2.delete(i); m_I3.delete(i); */ if (m_alpha[i] == 0 && m_alphaStar[i] == 0) { //m_I1.insert(i); m_iSet[i] = I1; m_I0.delete(i); } else ...
e3d68032-84ef-401c-ba3d-a31d584822a0
9
private void parseArguments() { Arguments nextArgument = null; if (args != null) { for (String arg : args) { if (nextArgument != null) { switch (nextArgument) { case PROPERTY_1: fileA = arg; ...
0e0d832d-df10-46ec-ac53-f938259fc65f
4
private int addConstituents(Tree<L> tree, Set<Object> set, int start) { if (tree.isLeaf()) { if (punctuationTags.contains(tree.getLabel())) return 0; else return 1; } int end = start; for (Tree<L> child : tree.getChildren()) { int childSpan = addConsti...
0d3fa839-4dba-4840-95ee-d252ba5fe323
3
public IllegalOrphanException(List<String> messages) { super((messages != null && messages.size() > 0 ? messages.get(0) : null)); if (messages == null) { this.messages = new ArrayList<String>(); } else { this.messages = messages; } }
ab8d2930-7007-4a4a-9a31-e308785e1c21
9
int insertKeyRehash(int val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look un...
3a56a934-ad19-4ed3-b673-c7dfdf0d343c
4
protected void paintProvince(final Graphics2D g, int provId) { final String owner = mapPanel.getModel().getHistString(provId, "owner"); final String controller = (owner == null ? null : mapPanel.getModel().getHistString(provId, "controller")); if (owner == null) { mapPanel.p...
07cdeca8-795a-4076-8f21-a6579b7108d1
1
@Override public void render() { super.render(); if(item != null) { Texture tex = Application.get().getResourceManager().getTextureManager().getTexture(item.getSprite()); Renderer.get().draw(tex, x, y); Renderer.get().drawText("Cost:" + item.getValue(...
7796a39b-d4ce-4b32-a7cc-b4954d79afde
8
public static int evaluateExp(String s) { Stack nums = new Stack(); Stack ops = new Stack(); for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == '-' || s.charAt(i) == '+' || s.charAt(i) == '*' || s.charAt(i) == '/') { ...
28423c70-afd9-4106-9b18-f7e2404828b0
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...
b7a488c0-e52f-427a-ae4f-cc86eee83e8c
7
public void printTags(){ MapGenres genres = new MapGenres(); if (tags.isEmpty()) { System.out.println("** Aucun tag **"); return; } else { System.out.println("** Tags **"); } if (tags.get("author")!=null) System.out.println("*Auteur : " + tags.get("author")); if (tags.get("title")!=null) ...