text
stringlengths
14
410k
label
int32
0
9
public void removeOrganization(String key) { try { Organization org = organizations.get(key); // Delete all subOrganizations if ( !org.getAllSubOrganizations().isEmpty() && org.getAllSubOrganizations().size() > 0 ) { Enumeration<String> subOrgs = org.getAllSubOrganizations().keys(); whil...
8
public ArrayList<TreeNode> generateTrees(int n) { ArrayList<TreeNode>[] trees = new ArrayList[n +1]; trees[0] = new ArrayList<TreeNode>(); trees[0].add(null); if (n == 0) return trees[0]; trees[1] = new ArrayList<TreeNode>(); TreeNode node = new TreeNode(1); node.left = node.right =...
5
public static void main(String args[]){ Scanner sc = new Scanner(System.in); int N; while(true) { N = sc.nextInt(); if(N==0) break; String str = sc.next(); boolean zFound = false; if(str.contains("Z")) ...
9
public PropertyHandler(File propertyFile) { this.file = propertyFile; if (propertyFile.exists()) { FileInputStream inputStream = null; try { inputStream = new FileInputStream(propertyFile); this.properties.load(inputStream); } catch (...
4
public static List<Episode> getAllEpisodes(String urlString, int season) throws TvDbException { List<Episode> episodeList = new ArrayList<>(); Episode episode; NodeList nlEpisode; Node nEpisode; Element eEpisode; Document doc = DOMHelper.getEventDocFromUrl(urlString); ...
5
public static boolean mapAndEnqueueVariableP(Stella_Object variable, Stella_Object localvalue, KeyValueMap mapping) { if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(variable), Logic.SGT_LOGIC_PATTERN_VARIABLE)) { { PatternVariable variable000 = ((PatternVariable)(variable)); { Stella_Object m...
8
public CASResponse cas(String key, Object value, int ttlSec, long cas, long timeoutMiliSec) throws TimeoutException, com.quickserverlab.quickcached.client.MemcachedException{ try{ Future <net.spy.memcached.CASResponse> f = getCache(). asyncCAS(key, cas, ttlSec, value, getCache().getTranscoder()); try {...
9
@Override public String execute(SessionRequestContent request) throws ServletLogicException { String page = (String) request.getSessionAttribute(JSP_PAGE); resaveParamsCitySelected(request); request.setAttribute(JSP_CURR_ID_HOTEL, "0"); String currCity = request.getParameter(JSP_CUR...
3
private JFileChooser getJFileChooser(){ if (this.jFileChooser == null){ this.jFileChooser = new JFileChooser(); } return this.jFileChooser; }
1
@Test public void testOutputFutureMeetings() throws IOException { Calendar thisDate = new GregorianCalendar(2015,3,2); cm.addFutureMeeting(contacts, thisDate); cm.addNewPastMeeting(contacts, new GregorianCalendar(2013,5,3), "meeting"); cm.flush(); ObjectInputStream ois = new ObjectInputStream(new FileInputSt...
2
@Override public boolean equals(Object other) { if ((other == null) || !(other instanceof Pair<?,?>)) { return false; } return ((Pair<?, ?>)other).first.equals(first) && ((Pair<?, ?>)other).second.equals(second); }
9
public boolean upload(String sourceFile, String destFile, String group, UserToken token) { if (destFile.charAt(0) != '/') { destFile = "/" + destFile; } try { Envelope message = null, response = null; message = new Envelope("UPLOADF"); message.addObject(destFile); message.addObject(group); mes...
9
@Override public void method3() { System.out.println("ClassA method3()"); }
0
private ArrayList<Edge> getCoast() { try { //Get time, Connection and ResultSet Long time = System.currentTimeMillis(); Edge edge = null; String sql = "SELECT * FROM [jonovic_dk_db].[dbo].[correctedCoastLine];"; Connection con = cpds.getConnection(); ...
2
private void printDirectReplies( Long parentId ) throws IOException { convFileWriter.write(parentId.toString()); if( !adjacencyList.containsKey(parentId)) return; long numOfReplies = adjacencyList.get(parentId).size(); if(numOfReplies == 0) return; co...
4
private boolean checkPath(String path) { String[] parts = path.split("/"); if(parts.length != this.path.size()) return false; for(int i = 0; i < parts.length; i++) { PathPart pathPart = this.path.get(i); if(!pathPart.isVariable && !pathPart.name.equals(parts[i])) return false; } return true; }
4
public static double[] convert(List<Double> l) { double[] d = new double[l.size()]; for (int i = 0; i < d.length; i++) { d[i] = l.get(i); } return d; }
1
public int evalMove(Move m, State s, int depth) { if (depth == 0) { // cutting off search -> evaluate resulting state return evalState(s.tryMove(m), s); } else { // minimax-search // update the state State newstate = s.tryMove(m); // get a list of possible moves from newstate MyList moves =...
4
@SuppressWarnings("unchecked") public Action<Class<?>, Member> findAction(Action<Class<?>, Member> action) { try { VisitorAdapter<Class<?>, Member> v = new VisitorAdapter.ActionVisitor<Class<?>, Member>() { private String peek = getCommandLine().peek(); @Override public void visit(Action<C...
9
public mxICell decodeCell(Node node, boolean restoreStructures) { mxICell cell = null; if (node != null && node.getNodeType() == Node.ELEMENT_NODE) { // Tries to find a codec for the given node name. If that does // not return a codec then the node is the user object (an XML node // that contains the m...
7
private boolean fileToPjt(int dId, FileType fileTyp) throws InvalidFormatException, OpenXML4JException, XmlException, IOException, SAXException, ParserConfigurationException { boolean result = false; String strText = ""; // Auswahl Methode je nach Dateityp switch (fileTyp) { case DOC: { strText =...
8
public static <F,T> Adapter<F,T> getAdapter(Class<F> fromType, Class<T> toType) throws AdapterNotFoundException { if(fromType == null || toType == null) { throw getException(fromType, toType); } //If the types passed in are primitive, convert to wrapped types to find //the app...
7
public static boolean isSkeletonWarriorDiamond ( SkeletonWarriorDiamond MMSkeletonWarriorDiamond) { if (MMSkeletonWarriorDiamond instanceof Skeleton) { Skeleton SkeletonWarriorDiamond = (Skeleton) MMSkeletonWarriorDiamond; if (SkeletonWarriorDiamond.getEquipment().getChestpla...
2
private void jComboBoxTipoClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxTipoClienteActionPerformed try{ if(jComboBoxTipoCuenta.getSelectedIndex()==0 && jComboBoxTipoCliente.getSelectedIndex()==0){ tipoCuenta=1; tipoCliente=1; ...
7
public void printIO(){ String s = "I:"; for(int i=0; i<inputNo; i++) s+=" "+inputNodes[i].getActivation(); s+="\nO:"; for(int i=0; i<outputNo; i++) s+=" "+outputNodes[i].getYAccuali()*scale; s+="\nH:"; for(int i=0; i<outputNo; i++){ s+=" "+outputNodes[i].getActivation()*scale; } System.out.prin...
3
@Test public void testArrayOfArrays() throws Exception { PersistenceManager persist = new PersistenceManager(driver, database, login, password); persist.dropTable(Object.class); int arraySize = 5; ComplexObject co = new ComplexObject(); SimplestObject[][][] array = new SimplestObject[arraySize][arraySize]...
5
public boolean isInArea(Location l) { double x = l.getX(); double y = l.getY(); double z = l.getZ(); return x > minPoint.x && x < maxPoint.x && z > minPoint.z && z < maxPoint.z && y > minPoint.y && y < maxPoint.y; }
5
private void okActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okActionPerformed try { messageLabel.setText(""); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "system", "oracle"); Statement s = con.createStatement(); ...
6
private static void combine(int a[], int low, int mid, int high){ int lowPointer = low; int highPointer = high; int [] lower = new int[mid-low+1]; int [] higher = new int[high - mid-1 +1]; System.out.println("High : " + high + " Mid : " + mid + " Low : " + low); int count = 0; for(int i =low ...
9
private void destroyWall(EnvironmentWall wall, Line2D destroyedPart) { boolean originalWallUsed; double cellWidth, cellHeight, oldWallX2, oldWallY2, newWallX1, newWallY1, newWallX2, newWallY2; Vector2D wallDirection; EnvironmentWall newWall; wallDirection = wall.getWa...
7
public boolean shouldTurnOn(int x, int y) { for (ShapeWithRelativeCoordinates component : shapes) { int relativeX = x - component.topX; int relativeY = y - component.topY; if (component.shape instanceof Circle) { if (((Circle) component.shape).isPixelActivate...
7
public void writeWord(int word) throws IOException { if((word & 0xffff) != word) { throw new IllegalArgumentException("Argument is not a 16 bit word: "+word); } if(littleEndian) { out.write(word & 0x00ff); out.write((word & 0xff00) >> 8); } el...
2
public Trivia() { System.out.println("> loading challenges..."); easyTrivia = new ArrayList<Challenge>(); mediumTrivia = new ArrayList<Challenge>(); hardTrivia = new ArrayList<Challenge>(); gameChallenges = new ArrayList<Challenge>(); randy = new Random(); // read in each file, every odd line is a que...
8
private Object binarySearchNames(int firstIndex, int lastIndex, String name) { if (firstIndex > lastIndex) return NOT_FOUND; int pivot = firstIndex + ((lastIndex - firstIndex) / 2); pivot &= 0xFFFFFFFE; // Clear LSB to ensure even index //System.out.print("binarySearchNames [ " + fi...
5
public Contact(String firstName, String lastName, PhoneNumber... phoneNumbers) { super(NextIdGenerator.getNextId(Contact.class)); this.firstName = firstName; this.lastName = lastName; this.phoneNumbers = hasPhoneNumbers(phoneNumbers) ? null : Lists.newArrayList(Arrays.asList(phoneNumbers)); ensureRequiredFiel...
1
private String[] getCaps(final Plugin plugin) { final Class<? extends Plugin> spawnClass = plugin.getClass(); final Method[] methods = spawnClass.getMethods(); // Search for proper method for (final Method method : methods) { // Init methods will be marked by the correspon...
8
public void render(Screen screen) { Entity.sortMobsList(); for(int i = 0; i < Entity.getMobSize(); i++) { if(!(Entity.getIndexedMob(i).getIsOnStage()) && Entity.getIndexedMob(i).getYCoord() < SpriteSheets.mainStage.getYSheetSize() / 2) { Entity.getIndexedMob(i).render(screen); } } screen....
9
private void loadWordList( DefaultListModel data ){ UserDictionaryProvider provider = SpellChecker.getUserDictionaryProvider(); if( provider != null ) { Iterator<String> userWords = provider.getWords( SpellChecker.getCurrentLocale() ); if( userWords != null ) { Ar...
6
public void setTimestamp(Long timestamp) { this.timestamp = timestamp; }
0
private Method findMethodByPrefix(Class<?> sourceClass, String prefix, String postfix) { String shortName = listenerType.getName(); if (listenerType.getPackage() != null) { shortName = shortName.substring(listenerType.getPackage().getName() .length() + 1); ...
8
public final boolean method66(int i, Interface18 interface18) { anInt5438++; if (!(interface18 instanceof Class296)) { return false; } Class296 class296_3_ = (Class296) interface18; if (anInt5431 != class296_3_.anInt5431) { return false; } if (class296_3_.anInt5432 != anInt5432) { return false; ...
9
public void processBet(PackReplyOldBetHop message) { // faz o cal. do Sbet // faz a adicao do par <chave, valor> // chave = num de caminhos, valor = numero de nodos // descendentes com 'aquela' quantidade de caminho if(sonsPathMap.containsKey(message.getPath())){ sonsPathMap.put(message.getPath(), sonsPathM...
2
public void attPrepEnd(){ battle.setState(Battle.BATTLE_SUPPORT_PHASE); //we check if the player can add an influence token if (territory1.getTroup().getEffectif()>0 || territory1.getInfluenceToken() || (territory1 instanceof HomeLand && ((HomeLand) territory1).originalOwner(territory1.getFamily()))){ if(battl...
5
public int sandinate(int X, int Y, int R) { int toReturn = 0; // long time = System.nanoTime(); for (int i1 = Math.max(X-(R+1),0); i1 < Math.min(X+(R+1),w); i1 ++) { for (int i2 = Math.max(Y-(R+1),0); i2 < Math.min(Y+(R+1),h); i2 ++) ...
4
@Override public SondageReponse find(int id) { SondageReponse found = null; PreparedStatement pst = null; ResultSet rs = null; try { pst=this.connect().prepareStatement("select * from SondageReponse where id= ?"); pst.setInt(1, id); ...
6
public Period(int year, int month) { this.year = year; this.month = month; this.locations = new ArrayList<DataPoint>(); }
0
private void acquiereLock(Lock fistLock, Lock seconlock) throws InterruptedException { boolean gotFirstLock = false; boolean gotSecondLock = false; while (true) { try { gotFirstLock = fistLock.tryLock(); gotSecondLock = seconlock.tryLock(); } finally { if (gotFirstLock && gotSecondLock) { ...
5
private void receive() { receiver = new Thread() { @Override public void run() { while (true) { try { byte[] data = new byte[1024]; DatagramPacket packet = new DatagramPacket(data, data.length); ...
2
public void LueTiedotTiedostosta(){ String menossaMappiin = ""; try { menossaMappiin = kasittelija.lueTiedostoSanaKerrallaan(); } catch (NullPointerException e){ System.out.println("Nyt tapahtui jotain kummallista ja tiedostoa ei löydy"); //tähän jotain fiksua joskus ...
3
public static void main(String[] args) { // default values int portNumber = 1500; String serverAddress = "localhost"; String userName = "Anonymous"; // depending of the number of arguments provided we fall through switch(args.length) { // > javac Client username portNumber serverAddr case 3: serv...
9
private void jbtnClose_ActionPerformed() { if (this.socket != null && ! this.socket.isClosed()) { try { this.socket.close(); } catch(Exception e) { EzimMain.showError(e.getMessage()); EzimLogger.getInstance().warning(e.getMessage(), e); } } this.saveConf(); this.unregDispose();...
3
private void handleKeyPress(final int key) { switch (key) { case KeyEvent.VK_LEFT: player.setDirection(Player.Directions.WEST); break; case KeyEvent.VK_UP: player.setDirection(Player.Directions.NORTH); break; cas...
8
public static void generateCaseRuleWoSlot(Vector cases, Symbol className, Symbol slotName) { { int numCases = cases.length(); Surrogate kind = Logic.getDescription(className).surrogateValueInverse; List caseNames = List.newList(); Surrogate slot = Logic.getDescription(slotName).surrogateValueInver...
9
public synchronized boolean commitReservation(ReservationMessage message) { int resId = message.getReservationID(); ServerReservation sRes = null; String msg = "Reservation # " + resId + " cannot be committed because it "; // Tries to find the reservation in the lists if(reservTable.conta...
5
public Card.Suit chooseSuit(Deck deck, Card.Suit prevSuit, PlayerHuman playerHuman) { boolean shouldAvoid = false; for (Card i : playerHuman.lastCards) { if (playerHuman.cards.size() == 1 && i != null && i.num() == 1) shouldAvoid = true; } if (! shouldAvoid...
7
@Override public int attack(double agility, double luck) { if(random.nextInt(100) < luck) { System.out.println("I just rained hell fire!"); return random.nextInt((int) agility) * 2; } return 0; }
1
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Ship other = (Ship) obj; // just use the type so that you can have only one type // in a hash s...
3
public void dispose() { colorManager.dispose(); super.dispose(); }
0
@Override public void onUpdate(World apples) { if (radius>=maxradius) { alive = false; } switch (apples.random.nextInt(5)) { default: case 0: c = Color.red; break; case 1: c = Color.orange; ...
7
private void LoadDocuments(String str, String filepath) throws IOException { str = str.replace("\n", " "); str = str.replace("\r", " "); String[] docs = str.split("</DOC>"); for (int i = 0; i < docs.length; i++) { String s = docs[i].trim(); if (s.length() > 0) { try { Document d = ...
7
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { //first goal is to be able to receive and process //a well formatted XML moveTwo piggybacked on a POST //this gives me a raw stream to payload of Post requ...
1
private void sendeAenderungenAnAlle() throws RemoteException { ArrayList<ClientPaket> paketListe = new ArrayList<ClientPaket>(); for(String name : _connectedClients.keySet()) { paketListe.add(_spiel.packePaket(name)); } for(ClientPaket paket : paketListe) { ClientInterface client = _connectedClients...
3
public String searchByName(final String name) throws IOException { if (!notebookCache.containsKey(name)) { return null; } return notebookCache.get(name).toString(); }
1
private boolean method320(int i, int j, int k) { int l = anIntArrayArrayArray445[i][j][k]; if(l == -anInt448) return false; if(l == anInt448) return true; int i1 = j << 7; int j1 = k << 7; if(method324(i1 + 1, anIntArrayArrayArray440[i][j][k], j1 + 1) && method324((i1 + 128) - 1, anIntArrayArrayArray...
6
public static void startLoadingDataBase() { Thread loadDB = new Thread(new Runnable() { @Override public void run() { if (!Database.loaded) EarningsTest.db = new Database( EarningsTest.PATH_SOURCE.getText()); JComponentFactory.addReportsTab(); } }); loadDB.start(); }
1
private static XMPNode followXPathStep( XMPNode parentNode, XMPPathSegment nextStep, boolean createNodes) throws XMPException { XMPNode nextNode = null; int index = 0; int stepKind = nextStep.getKind(); if (stepKind == XMPPath.STRUCT_FIELD_STEP) { nextNode = findChildNode(parentNode, nextS...
9
public String getCp() { return cp; }
0
public synchronized void handleEachAndClassAbility(Map<String, AbilityMapping> ableMap, Map<String,Map<String,AbilityMapping>> allQualMap, String ID) { if(eachClassSet == null) { eachClassSet = new SLinkedList<AbilityMapping>(); final Map<String,AbilityMapping> eachMap=allQualMap.get("EACH"); final Map<St...
7
void moveinterpret (String s, boolean fromhere) { StringParser p = new StringParser(s); String c = p.parseword(); int p1 = p.parseint(); int p2 = p.parseint(); int p3 = p.parseint(); int p4 = p.parseint(); int p5 = p.parseint(); int p6 = p.parseint(); if (c.equals("board")) { PGF = new PartnerGo...
8
public static void smoosh(int[] ints) { // Fill in your solution here. (Ours is fourteen lines long, not counting // blank lines or lines already present in this file.) int inputlen=0; if(ints!=null) inputlen=ints.length; int i; for(i=(inputlen-1);i>0;i--){ if(ints[i]==ints[i-1]...
3
@Override public void execute(HttpServletRequest request, HttpServletResponse response) { String xmlPath = ResourceManager.INSTANCE .getPropertyRealPath("xml_path"); String categoriesXsltPath = ResourceManager.INSTANCE .getPropertyRealPath("categories_xslt"); String subcategoriesXsltPath = ResourceManage...
7
@Override public void run() { if (isFiltered) { return; } StringBuilder builder = new StringBuilder(); builder.append(visitTime); if (status == 200) { builder.append(",").append("ok"); builder.append(",").append(requestUrl); builder.append(",").append(requestMethod); builder.append(",").app...
7
public void usingKeySetAndIterator(Map<Integer, String> map){ Iterator<Integer> itr = map.keySet().iterator(); while(itr.hasNext()){ Integer intgr = itr.next(); System.out.println("Key: "+intgr); } }
1
public static ArrayList<Planet> forPlanet(PlanetWars pw){ // Tested ArrayList<Planet> asw = new ArrayList<Planet>(2); asw.add(null); asw.add(null); // Find the biggest fleet to attack with int maxShips = 0; for (Planet p : pw.MyPlanets()){ if (p.NumShips() > maxShips){ maxShips = p.NumShips(); ...
6
public boolean setSpeed(double vX, double vY) { if (Buffer.findSprite(this) != null) { Buffer.findSprite(this).setSpeed(vX, vY); return true; } else { return false; } }
1
public void run() { if(isMaster) { //wait for all participants, then initialize all files loadConfig(); System.out.println("Waiting on all participants..."); int participants = Integer.parseInt(filesystem_config.get("participants")); while (cServer.connections.size() < participants) { try { Th...
5
public static void main(String args[]) { List_Homework_database MList = new List_Homework_database(); /* 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...
6
public int evalRPN(String[] tokens) { Stack<Integer> ops = new Stack<>(); int eval = 0, op1 = 0, op2 = 0; for(String token : tokens) { if(token.equals("+") || token.equals("-") || token.equals("*") || token.equals("/")) { op2 = ops.pop(); op1 = ops.pop...
9
public static void Command(CommandSender sender, String[] args) { if(sender.hasPermission("gm.creative.others")) { Player target = Bukkit.getPlayer(args[1]); if(target != null) { if (target.getGameMode() != GameMode.CREATIVE) { target.setGameMode(GameMode.CREATIVE); if(sender instanceof ...
7
public void createChart() { pieChartModel=new PieChartModel(); setPriority("emerg"); Long emerg= getFacilityCount(); if(emerg!=0) pieChartModel.set("Emergency", emerg); setPriority("Alert"); Long alert= getFacilityCount(); if(alert!=0) pieChartModel.set("Alert",alert); setPriority("crit")...
8
@BeforeClass public static void init() { snzipExecutable = TestUtil.findSnzipExecutable(); if(snzipExecutable == null) { throw new IllegalStateException("No executable snzip file found in bin directory"); } testdataDirectory = TestUtil.directoriesToFile("resources", "testdata"); if(!testdataDirectory...
4
public void run() { while(true){ try{ Thread.sleep(200); } catch(InterruptedException e){ } Displayable curr = display.current; if(curr instanceof Screen) { Screen scr = (Screen) curr; if(scr.ticker != null){ String t = scr.ticker.getString(); t = t.substring(ste...
7
public boolean testReverse() throws PersistitException { setPhase("b"); _ex.clear().append(Key.AFTER); int index1 = _total - 1; int index2; while (_ex.previous() && !isStopped()) { index2 = (int) (_ex.getKey().decodeLong()); for (int i = index1; i > index...
9
public static boolean insertar(Recurso r) throws SQLException { // Deshabilitamos el autocommit para poder hacer rollback en caso de // error en alguna inserción (tocamos varias tablas) // ConnectionManager.connection.setAutoCommit(false); // Al insertar un nuevo recurso este se marca ...
4
private double run_model(Model model, List<Output> out, File folder, String simName, double[] x) throws Exception { Map<String, Object> parameter = model.getParameter(); Object comp = model.getComponent(); // spatial params ParameterData[] pd = Step.create(params, parameter); f...
5
static void setPlayerSelecting(String name, boolean b) { if(b){ if(!playersSelect.containsKey(name)) { Location[] locarray = new Location[2]; playersSelect.put(name, locarray); } } else { Protect.log.info("No more sel"); if(playersSelect.containsKey(name)) { playersSelect.remove(name); } } }
3
synchronized void backward(float[] in, float[] out){ if(_x.length<n/2){ _x=new float[n/2]; } if(_w.length<n/2){ _w=new float[n/2]; } float[] x=_x; float[] w=_w; int n2=n>>>1; int n4=n>>>2; int n8=n>>>3; // rotate + step 1 { int inO=1; int xO=0; ...
5
public String[] Myself(boolean place) { try{ driver.get(baseUrl + "/content/lto/2013.html"); //global landing page driver.findElement(By.xpath("/html/body/div[2]/div/div/div/div/div/div/div[3]/ul/li[10]/a")).click(); //Singapore landing page - Order Now button driver.findElement(By.xpath("/...
7
private void initNetwork(String name, double baudRate, Link link) { // Every GridSim entity with network has its own input/output channels. // Connect this entity "input" port to its input buffer "in_port" NetIO in = null; // Packet Level networking if (GridSimCore.NETWORK_T...
4
public void updateStaff(){ Scanner sc = new Scanner(System.in); boolean bol = false; do{ System.out.println("Enter the ID of the staff who need to be update:"); int employee_id = inputInteger(); Staff toUpdateStaff = staffManager.getStaffbyID(employee_id); System.out.println("Choose which one to updat...
8
@Override @SuppressWarnings("unchecked") public Object read(Class type, CommandInvocation invocation) throws ReaderException { if (invocation.getManager().hasReader(type)) { return invocation.getManager().read(type, type, invocation); } if (Enum.class.isAssignable...
8
public void resumeGame() throws InterruptedException { boolean test = false; if (test || m_test) { System.out.println("Game :: resumeGame() BEGIN"); } setWindow(new GameWindow(this)); setScores(); getWindow().displayPlayerTurn(m_playerTurn); getWindow().updateScore(m_pl...
5
@Override public boolean move(int x, int y, int xf, int yf) { if (canMove(x, y)) { for (int[] hint : getHints(x, y)) { if ((xf == hint[0]) && (yf == hint[1])) { //se arrivo in fondo, devo creare un damone if (((xf == 0) || (xf == 8 - 1)) &&...
7
private List<Position> getAdjacentPositions(Position pos, int width, int height) { ArrayList<Position> neighbours = new ArrayList<Position>(); for (Direction mov : Direction.values()) { Position newPos = mov.newPosition(pos); if (isValidPosition(newPos, width, height)) { neighbours.add(newPos); } } ...
2
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed Transferable clipboardContent = getToolkit().getSystemClipboard().getContents(this); if ((clipboardContent != null) && (clipboardContent.isDataFlavorSupported(DataFlavor.stri...
3
private void log(String prefix, String message) { String log = buildMessage(prefix, message); System.out.println(log); if (outputStream != null) { try { outputStream.write((log + "\r\n").getBytes()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace...
2
public Object trapMethodcall(int identifier, Object[] args) throws Throwable { try { Method[] m = getReflectiveMethods(); return m[identifier].invoke(null, args); } catch (java.lang.reflect.InvocationTargetException e) { throw e.getTargetException...
2
@Override protected void finalize() { if (resource.removeReference() && !fileName.isEmpty()) { loadedTextures.remove(fileName); } }
2
public String getKeyName() { return this.value; }
0
public void populateLibrary(int numSpecies, int numNodes, int numBondingSites){ Molecule nullMolecule = new Molecule(); if(!reuse){ library.add(new Network(0)); for(int i=1; i<numSpecies; i++){ library.add(new Network(numNodes, i, numBondingSites)); library.get(i).setMol(ne...
7