text
stringlengths
14
410k
label
int32
0
9
public int getBaseLevel(int skill) { int[] skills = ctx.getClient().getSkillBases(); if (skills == null || skills.length == 0 || skill < 0 || skill >= skills.length) { return -1; } return skills[skill]; }
4
@Override public void removeProperty(String path) { if (path.startsWith(".")) path = path.substring(1); // VERY EXPENSIVE MemoryConfiguration temp = new MemoryConfiguration(); setOptions(temp); Map<String, Object> values = config.getValues(true); if (values.containsKey(path)) values.remove(path); else{ ...
8
public void mouseExited(MouseEvent mouseEvent) { Iterator<PComponent> it = components.iterator(); while (it.hasNext()) { PComponent comp = it.next(); if (shouldHandleMouse) { if (comp.shouldHandleMouse()) comp.mouseExited(mouseEvent); ...
7
public void startNewLevel() { spaceReleased = false; // Create sprite objects ferdie = new CapnFerdinandLongwhiskers(this, capt, 50, 249); doggies = new ArrayList<RoyalNavySeadog>(); Random rm = new Random(); for (int i = 0; i < level*5; i++) { bo...
6
@Override public Map<String, Object> extract(RequestAttributes attributes, boolean trace, boolean log) { System.out.println("extract"); Map<String, Object> map = super.extract(attributes, trace, log); System.out.println(map); return map; }
0
public Solution search(State init, int goalN, String strategy, boolean visualize) { GenericSearch searcher = null; switch (strategy) { case "DF": searcher = new DFSSearch(this, visualize); break; case "BF": searcher = new BFSSearch(this, visualize); break; case "ID": searcher = new IDSearch(thi...
7
public void putAll( Map<? extends Integer, ? extends V> map ) { Iterator<? extends Entry<? extends Integer,? extends V>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Integer,? extends V> e = it.next(); this.put( e.getKey(), e.getValue() ...
8
private void asignarEtiquetasEImagenes() { _columnasImage.actualizarPregunta("<html>"+_preguntas.get(_posicion).getPregunta()+"</html>"); for (int i = 0; i < _columnaBRevuelta.size(); i++) { _columnasImage.asignarImagen(_columnaBRevuelta.get(i).getRespuesta(), i); _columnasImage....
4
public void setPower(double power) { if (power < 0 && getPotValue() >= FULL_FORWARD_POSITION || power > 0 && getPotValue() < FULL_BACKWARD_POSITION || Math.abs(power) < .1) { power = 0; } motor.set(power); }
5
public Layer getLayer() { return layer; }
0
public String getOption( String op ) { // TODO: auto, lblAlign, lblOffset if( op.equals( "crossesAt" ) ) { return String.valueOf( catCross ); } if( op.equals( "orientation" ) ) { return (fReverse) ? "maxMin" : "minMax"; } if( op.equals( "crosses" ) ) { if( fMaxCross ) { return "max"; ...
8
public static void main(String[] args) throws Exception { System.setProperty("webdriver.chrome.driver", "D:\\Download\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); driver.manage().window().maximize(); File bankNames = new File("E:\...
7
private void busqAsuntoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_busqAsuntoActionPerformed // TODO add your handling code here: CitaPorAsunto cA = new CitaPorAsunto(); while (cA.extraerAsunto().length()==0 && JOptionPane.showConfirmDialog(this, cA, "Buscar una cita por asunto"...
5
private void initPilotList() { try{ RecentLaunchSelections recent = RecentLaunchSelections.getRecentLaunchSelections(); pilotNames = DatabaseUtilities.DatabaseDataObjectUtilities.getPilots(); List<Pilot> recentPilots = recent.getRecentPilot(); for (int i = 0; i < ...
4
public long CurrentFilePosition() { long position; try { position = file.getFilePointer(); } catch (IOException ioe) { position = -1; } return position; }
1
@Override public void run() { try { // Eclipse doesn't support System.console() BufferedReader console = new BufferedReader(new InputStreamReader(System.in)); ConfigManager config = NetBase.theNetBase().config(); try { ElapsedTime.clear(); String targetIP = config.getProperty("net.server.ip");...
9
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...
6
public static void main(String[] args) throws Exception { List<SeperatorDefinition> seps = new ArrayList<SeperatorDefinition>(); buildCoreSet(Release.ReturnToRavnica, seps); buildBasicSet(Release.Magic2013, seps); buildBasicMultiColor(Release.Magic2013, seps); buildBasic...
4
public URL getURL() throws MalformedURLException { URL url = null; try { url = new URL(getURLString()); } catch (MalformedURLException mue) { throw mue; } return url; }
1
protected void fireEditingStopped() { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == CellEd...
2
Options(SmallWorld sw, GUICanvas cv, MenuItem mi) { smallWorld = sw; menuItem = mi; canvas = cv; // Set up layout. setSize(300,650); gridBag = new GridBagLayout(); setLayout(gridBag); c = new GridBagConstraints(); c.anchor = GridBagConstraints.SOUTHWEST; c.inset...
0
public void ajouter(Entree e,String s) throws DoubleDeclarationException { if(listeBloc.get(region_actuelle).containsKey(e) && listeBloc.get(region_actuelle).get(e).getType().equals(s)){ GestionnaireSemantique.getInstance().add(new DoubleDeclarationException(" a la ligne "+e.getLine()+" : "+e.getNom...
5
private Decal getFreeDecal() { long min=Long.MAX_VALUE; Decal decal=null; for (int i=0; i<MAX_DECALS; i++) { if (!decals[i].getVisibility()) { return decals[i]; } if (decals[i].getDecalID()<min) { min=decals[i].getDecalID(); decal=decals[...
3
public void selectPreviousRow() { int rowCount = activityListModel.getRowCount(); if (previousRow >= 0 && rowCount > 0) { if (rowCount > previousRow) { tblActivities.getSelectionModel().setSelectionInterval(previousRow, previousRow); } else if (rowCount == previousRow) { tblActivities.getSelectionM...
4
public boolean matches( Class<?> clazz ) { return true; }
1
public CuttingResult getReward(Tilia x){ int side = x.getSide(); //Check if you have computed this before if(!tabel.containsKey(side)){ ArrayList<Integer> pieces = new ArrayList<Integer>(); pieces.add(x.getSide()); // First two variables in CuttingResult are not used ...
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Card other = (Card) obj; if (this.value != other.value && (this.value == null || !this.value.equals(other...
8
void getServer() { try { ServerSocket serverSocket=new ServerSocket(9999); //׽ System.out.println("׽~"); while(true) { Socket socket=serverSocket.accept(); //ȴ new write_Thread(socket).start(); //߳ socketMan.add(socket); // ׽ socketMan.sendClientCount(); //ǰ׽ } }catch(Exception e){ e....
2
private void readObject(ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException { stream.defaultReadObject(); isProperList = stream.readBoolean(); if (!isProperList) { dottedElement = (E) stream.readObject(); } }
1
private int checkHtml(final StringBuilder out, final String in, int start) { final StringBuilder temp = new StringBuilder(); int pos; // Check for auto links temp.setLength(0); pos = Utils.readUntil(temp, in, start + 1, ':', ' ', '>', '\n'); if(pos != -1 && in.charAt...
9
public int somme() { int s = 0; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { s += (matrixb[i][j] ? 1 : 0); } } return s; }
3
public void setDefaultsForNodeType() { CyRow row1, row2; CyNode node = nodeView.getModel(); double port1EfficiencyVal = 1.0; int numOfInputsVal = 1; double timeRampVal = 1.0; double relativeConcVal = 1.0; double decayVal = 0.0001; double initialOutputVal = 0.0; double intOutputNodeThreshVal = 0.5; ...
6
public int threeSumClosest(int[] num, int target) { int record = 0; int min = Integer.MAX_VALUE; int length = num.length; Arrays.sort(num); for (int i = 0; i < length; i++) { //except num[0], start is the second number, end is the last number int start ...
9
public Object invokeConstructor(Reference ref, Object[] params) throws InterpreterException, InvocationTargetException { Constructor c; try { String[] paramTypeSigs = TypeSignature.getParameterTypes(ref .getType()); Class clazz = TypeSignature.getClass(ref.getClazz()); Class[] paramTypes = new Clas...
7
static void insertion_sort(int num[]) { int number; for (int i=0;i<num.length-1;i++) { number=num[i+1]; for(int j=i;j>=0;j--) { if(number<num[j]) { num[j+1]=num[j]; num[j]=number; } } } for (int i:num) { System.out.println(i); } }
4
protected String getRightNowTimeStr(final String dateDep, final String secDep, final String dep) { final String month = (Calendar.getInstance().get(Calendar.MONTH) + 1) > 9 // ? String.valueOf(Calendar.getInstance().get(Calendar.MONTH) + 1) // : "0" + (Calendar.getInstance().get(Calendar.MONTH) + 1); return ...
1
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onFoodLevelChange(FoodLevelChangeEvent event) { Entity entity = event.getEntity(); if (entity instanceof Player) { xAuthPlayer xp = plyrMngr.getPlayer(((Player) entity).getName()); if (plyrMngr.isRestricted(xp, event)) eve...
2
public void setOpenEnded( OpenEndedConnectionStrategy openEnded ) { if( openEnded == null ){ openEnded = OpenEndedConnectionStrategy.NULL; } this.openEnded.endConnecting(); this.openEnded.setParent( null ); this.openEnded = openEnded; this.openEnded.setParent( site ); }
1
public void createService(String serviceType, String description, String roomNumber) throws ParseException { //finding roomnumber int rmNumber = Integer.parseInt(roomNumber); Query q = em.createQuery("SELECT t from RoomEntity t"); for (Object o : q.getResultList()) { RoomEnt...
2
private void addComponents(boolean check) { this.add(numberOfFilesLabel); this.add(lineOfCodeLabel); this.add(commentsLabel); this.add(blankLinesLabel); this.add(totalLinesLabel); if (check) { this.add(codeShareLabel); } }
1
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { System.out.println("用户名-------------"+username); UserLogin userLogin = null; if(username != null && !"".equals(username)&& username.indexOf("@") > 0){ userLogin = UserLoginDao.findByEmail(...
5
private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) { switch(hiByte) { case 0: return ((jjbitVec4[i2] & l2) != 0L); case 48: return ((jjbitVec5[i2] & l2) != 0L); case 49: return ((jjbitVec6[i2] & l2) != 0L); case 51: re...
6
@Override protected boolean doSmall() { Tile obeliskRandom; final GameObject obelisk = ctx.objects.select().id(OBELISK).nearest().poll(); if (obelisk.valid()) { obeliskRandom = ITile.randomize(obelisk.tile(), 2, 2); } else { obeliskRandom = locationAttribute.getObeliskRandom(ctx); } if (obeliskRand...
5
public long getThreadUptime() { return threadUptime; }
0
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; WatchKey other = (WatchKey) obj; if (folderPath == null) { if (other.folderPath != null) return false; } else if (!folderPath.equals(oth...
6
public static int[] path(int[] queue) { int esimene = queue[0]; int[] resultPath = new int[queue.length]; resultPath[0] = esimene; int i = 0; int j = 0; int u = 0; for (int k : queue) { if (k < esimene) { i++; } else if (k > esimene) { j++; } else { u++; } } int[] vaiksemad =...
9
public void discard(Card card) { // remove card from hand if (players[turn].getHand().remove(card)) { discard.add(card); sendAll(PacketCreator.discardNotify(card)); } else { out.println("Discard Error. Card " + card + " was not in player's hand."); System.exit(1); return; } // send foot if...
8
public ArticleInfo getArticleInfo(String articleUrl) throws IOException { String id = getId(articleUrl); String type = null; String source = null; Integer year = null; Integer month = null; final HttpRequest request = requestFactory.buildGetRequest(new GenericUrl(articleU...
8
public static void sort_words(String s) { String[] words = s.replace(',', ' ').replaceAll("\\s+", " ").split(" "); Arrays.sort(words); for (String word : words) { System.out.println(word); } }
1
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Status other = (Status) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; r...
6
@Override public void actionPerformed(ActionEvent actionEvent) { try { if(actionEvent.getSource() == fileTransferActive) { if(fileTransferActive.getText().compareTo(FTA_START) == 0) { iface.startService(ServiceName.FileTransferActive); fileTr...
9
public EditorToolBar(final BasicGraphEditor editor, int orientation) { super(orientation); setBorder(BorderFactory.createCompoundBorder(BorderFactory .createEmptyBorder(3, 3, 3, 3), getBorder())); setFloatable(false); add(editor.bind("New", new NewAction(), "/com/mxgraph/examples/swing/images/new.gif"...
7
public CijferOverzichtPanel() { setLayout(new BorderLayout(0, 0)); JList list = new JList(vakLijst); list.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { JList list = (JList) evt.getSource(); if (evt.getClickCount() == 1) { int index = list.locationToIndex(evt.get...
9
public void actionPerformed(ActionEvent e) { String[] cmd = e.getActionCommand().split(" "); switch (cmd[0]) { // lexically listed case "Accept": gui.acceptAnswer(); break; case "Dictionary": (new Dictionary()).run(); break; case "Exit": System.exit(0); break; case "Game": ...
9
private int search(TreeNode root, String query, int d, int length){ if(root == null) return length; if(root.value != null) length = d; if(d == query.length()) return length; char c = query.charAt(d); return search(root.next[c], query, d + 1, length); }
3
public boolean playSpecialTile(String name, Location loc){ Player p = getPlayer(name); if(!p.equals(getCurrentPlayer())){ return false;//not your turn! } if(!gameBoard.isValidLocation(loc) || gameBoard.hasTile(loc) || loc.getTile() == null || !(loc.getTile() instanceof SpecialTile)){ return fa...
6
private void addInsideCurve(int end, int newRadius) { if (restricted.isSelected()) { int sectionBeginning = road.sectionBeginning(); road.addInsideCurve(end, false, newRadius); if (sectionLongerThanSmax(end, sectionBeginning)) return; } else { road.addInsideCurve(end, true, newRadius); } }
2
private void insertRec(TreeNode preNode, TreeNode node) { if(preNode.val > node.val){ if(preNode.left == null) preNode.left = node; else insertRec(preNode.left,node); }else{ if(preNode.right == null) preNode.right = node; else insertRec(preNode.right,node); } }
3
@Override public int getMetricInternal() { int add = EflUtil.runToAddressLimit(0, 0, 10, curGb.pokemon.owPlayerInputCheckAAddress); // after IsSpriteOrSignInFrontOfPlayer call if(add == 0) { System.out.println("OverworldInteract: IsSpriteOrSignInFrontOfPlayer call not found"); return 0; } int id =...
4
public void paintComponent(Graphics g){ super.paintComponent(g); this.g=g; for (int i=0; i<model.getAssociationList().size(); i++){ drawAssociation(i,g); } for (int i=0; i<model.objectsListSize(); i++){ int positionX=model.getObjectUmlAtIndex(i).getX(); int positionY=model.getObjectUmlAtI...
8
public void handleEntityDamageByEntity(EntityDamageByEntityEvent e) { if(!isStarted) { e.setCancelled(true); return; } Snowball s = (Snowball)e.getDamager(); Player player = (Player)e.getEntity(); Player shooter = (Player)s.getShooter(); World w = ...
5
private void flattenAppend(Object value) { if(value==null) return; if(value instanceof Object[]) { for( Object o : (Object[])value) flattenAppend(o); } else if(value instanceof Collection<?>) { for( Object o : (Collection<?>)value) ...
7
public void start(){ timer.start(); downloadThread = new Thread(new Runnable() { @Override public void run() { BufferedInputStream in = null; FileOutputStream fout = null; long downloaded = 0; for(FileDownloadItem info : items){ try { if(!info.getSaveFile().g...
7
public static double max(double[] vals) { double max = vals[0]; for (double v : vals) { if (v > max) { max = v; } } return max; }
2
public void testClearTarget() { out.println("clearTarget"); final int MAXEXP = 5; final int STEPS = 10; instance = new TabuIndex(MAXEXP); String[] tgts = new String[MAXEXP]; String[] srcs = new String[MAXEXP]; for (int i = 0; i < MAXEXP; ++i) { srcs...
8
@Override public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException { testLevel.Render(); for(int i = 0 ; i < this.fish.size() ; i++) { this.fish.get(i).render(g); } player.render(g); //GUI g.setColor(Color.black); g.drawString(("Fish eaten: " + this.player.ge...
1
public static String makeSpace( int spaceCount, String word ) { int i = spaceCount - word.length(); String spaces = " "; while ( i > 0 ) { spaces = spaces.concat( " " ); i--; } return spaces; }
1
public List<RequestWrapper> getReferRequestWrappers() { return referRequestWrappers; }
0
public String addHost() { try { URL whatismyip = new URL("http://checkip.amazonaws.com/"); BufferedReader in = new BufferedReader(new InputStreamReader( whatismyip.openStream())); String ip = in.readLine(); //you get the IP as a String //System.out.println(ip); ...
5
public static void main(String args[]){ File fileForParse = new File("/home/desiresdesigner/ITMO/ИсследоваиеАлгоитмовПартионирования/3 HashMap/4del"); double sum = 0; double number = 0; try { BufferedReader in = new BufferedReader(new FileReader(fileForParse.getAbsoluteFile(...
3
public void processCommands() { try { if (!commands.isEmpty()) { while (step == false && index < commands.size()) { parseLine(commands.get(index)); index++; } if (index >= commands.size()) frame.postMessage("Drawing Complete. " + "No further drawing commands available.\n"); } ...
6
public void setArea(String area) { Area = area; }
0
public int inserir(Livro l){ Connection conn = null; PreparedStatement pstm = null; int retorno = -1; try{ conn = ConnectionFactory.getConnection(); pstm = conn.prepareStatement(INSERT, Statement.RETURN_GENERATED_KEYS); pstm.setString(1, l.getTitulo())...
3
private String seekMatchingWords(String keywordWord, LinkedList<String> word, LinkedList<String> possibleWord) { for(int j = 0; j < word.size(); j++) { if(keywordWord.equals(word.get(j))) { return word.get(j); } } int shortestDistance = 3; String wordWithShortestDistance = ""; for(int j = 0; j < poss...
4
public void readTable(Map table) { Identifier rep = getRepresentative(); if (!rep.wasAliased) { String newAlias = (String) table.get(getFullName()); if (newAlias != null) { rep.wasAliased = true; rep.setAlias(newAlias); } } for (Iterator i = getChilds(); i.hasNext();) ((Identifier) i.next())...
3
public float distance(final float xp, final float yp) { final float xd = (xp < xpos) ? (xpos - xp) : ((xp > xmax) ? (xp - xmax) : 0), yd = (yp < ypos) ? (ypos - yp) : ((yp > ymax) ? (yp - ymax) : 0) ; return (float) Math.sqrt((xd * xd) + (yd * yd)) ; }
4
public String readUnicodeString() throws IOException { int off = 0; int len = readInt(); byte[] s = new byte[len]; while (off < len) { off += read(s, off, len - off); } String retval = new String(s, "UTF-8"); if (trace == API_TRACE_DETAILED) { debugNote("...
2
private boolean smashQuest(Quest q, int id){ if(q.getID() == 5 && q.isStarted()){ if(engine.getPlayer().getBounds().intersects(new Rectangle(320,244,96,96)) && engine.getPlayer().isAttacking()) { System.out.println("hej"); // conditions is fulfilled q.setNumberDone(100); q.updateStatus(); e...
4
public static String diceText(int id) { switch (id) { case 15086: return "a six-sided"; case 15088: return "two six-sided"; case 15090: return "an eight-sided"; case 15092: return "a ten-sided"; case 15094: return "a twelve-sided"; case 15096: return "a a twenty-sided"; case 15098: ...
8
public static User getLatest(Connection con) { User user = null; try { ResultSet result = con.createStatement().executeQuery( "SELECT ID FROM " + tableInfo.tableName + " ORDER BY LastLog DESC { LIMIT 1 }"); result.next(); user = new User(con, result.getString(1)); result.close(); } catch(S...
2
public static boolean[][] trim( boolean[][] m ){ int minx = m.length; int miny = m[0].length; int maxx = 0; int maxy = 0; for (int x = 0; x < m.length; x++) { for (int y = 0; y < m[0].length; y++) { if( !m[x][y] ){ continue; } if( x < minx ) minx = x; if( y < miny ) miny = y; if( ...
9
private static List<String> getFieldNameWithListDataType(){ List<String> result = new ArrayList<>(); //CompanyA, refer 1.1 Field[] fields2 = CompanyA.class.getDeclaredFields(); for(Field f : fields2){ // use equals to compare the data type. if(f.getType().equals(List.class)){ result.add(f.ge...
2
public void checkCollisions() throws SlickException{ // loop all pickables for (Iterator<Pickable> iterator = pickables.iterator(); iterator.hasNext();) { Pickable p = iterator.next(); if (p.getBounds().intersects(player.getBounds())) { if(!p.value.equals("exit")){ level.destroyColors(p.value);...
6
public SelectIterable(Iterable<T> source, Selector<T, TResult> selector) { this._source = source; this._selector = selector; }
0
public PriorityQueue<Node> makeChildren(){ PriorityQueue<Node> newChildren = new PriorityQueue<Node>(); Person p = currentPeople.get(0); // System.out.println("*********************Person: " + p.getName()); for(int i = 0; i < data.size(); i++){ if(p.getHeadsGroup() != null || p.getHeadsProject() != n...
8
public String testStop(String appKey, String userKey, String testId) { try { appKey = URLEncoder.encode(appKey, "UTF-8"); userKey = URLEncoder.encode(userKey, "UTF-8"); testId = URLEncoder.encode(testId, "UTF-8"); } catch (UnsupportedEncodingException e) { ...
1
static public byte[] decode(final String base32) { int i, index, lookup, offset, digit; byte[] bytes = new byte[base32.length() * 5 / 8]; for (i = 0, index = 0, offset = 0; i < base32.length(); i++) { lookup = base32.charAt(i) - '0'; /* Skip chars outside the lookup tab...
8
public static Reference getReference(String className, String name, String type) { int hash = className.hashCode() ^ name.hashCode() ^ type.hashCode(); Iterator iter = unifier.iterateHashCode(hash); while (iter.hasNext()) { Reference ref = (Reference) iter.next(); if (ref.clazz.equals(className) && ref.n...
4
public void findMinimumVertexCover() { for(int i=1;i<=leftVertices;i++) { if(Pair[i]!=0) //Vertices part of matching { ArrayList<Integer> adjacencyList = biGraph.getOutEdges(i); for(int n : adjacencyList) { if(rightFreeVertices.contains(n)) { leftVertexCoverVertices.add(i); ...
8
public Account(double intitialBalance) { if (intitialBalance > 0) balance = intitialBalance; }
1
@SuppressWarnings("unused") private ArrayList<String> getSimilarLengthResults(String first, int diff) { // Sanity checks if (first == null) return new ArrayList<String>(); if (overkill == null || overkill.isEmpty()) return new ArrayList<String>(); ArrayList<String> sls = new ArrayList<String>(); int s...
8
public void renderColorFont(Image i, int xp, int yp, int tileId, int tileWidth, int color) { xp -= xOff; yp -= yOff; int tw = i.getWidth() / tileWidth; int xt = tileId % tw; int yt = tileId / tw; int tileOffset = xt * tileWidth + yt * tileWidth * i.width; for (int y = 0; y < tileWidth; y++) { if ...
8
@Override public boolean execute(RuleExecutorParam param) { Rule rule = param.getRule(); List<String> values = Util.getValue(param, rule); if (values == null || values.isEmpty()) { return false; } boolean retValue = true; for (String value : values) { String compareValue = rule.getValue(); if (rul...
6
public boolean contains(int x, int y) { return x >= 0 && y >= 0 && x < bounds.width && y < bounds.height; }
3
@Override public boolean inputUp(float x, float y) { if (enabled && visible && getBounds().contains(x, y)) { if (callback != null) callback.onButtonEvent(this, DynamicButtonCallback.UP); return true; } return false; }
4
public Sprite getSpriteCollision(Ship ship) { // run through the list of Sprites LinkedList <Sprite> sprites = map.getSprites(); for (int i = 0; i < sprites.size(); i++) { Sprite otherSprite = (Sprite)sprites.get(i); if (isCollision(ship, otherSprite)) { ...
2
public static Skolem nthRestComputation(Skolem list, IntegerWrapper narg) { if (!(Logic.enumeratedListP(list))) { return (null); } { int n = narg.wrapperValue; Vector elements = list.definingProposition.arguments; int nelements = elements.length() - 1; List restelements = List.newLis...
7
static void testInput() { // otetaan sata ensimmaista, jarjestetaan characterClassin // mukaan, ja piirretaan iso kuva, josta voi tarkistaa, etta // samat numeroa esittavat kuvat tulevat perakkain. Vector<Image> I100 = new Vector<Image>(); for (int i = 0; i < 100; ++i) { ...
6
@SuppressWarnings("unchecked") public boolean removePhoto(String filename, String album) { if (GuiView.control.getCurrentUser().getAlbumList().get(album).getPhotoList().containsKey(filename)) { Iterator it = GuiView.control.getCurrentUser().getAlbumList().entrySet().iterator(); while (it.hasNext()) { M...
3
public static List<ImageBit> cover(ImageBit ib, ImageBit[][] list, int blockWidth, int blockHeight, BlockType blockType) { // TODO Auto-generated method stub int baseX = ib.getX(); int baseY = ib.getY(); List<ImageBit> coverBits = new LinkedList<ImageBit>(); for (int i = 0; i < blockWidth; i++) { // F...
8