text
stringlengths
14
410k
label
int32
0
9
public int getClosestColor(int c) { if (c == 0) return 0; int bestInd = 0; float bestDif = Util.colorDiff(pal[0], c); for (int i = 0; i < pal.length; i++) { float d = Util.colorDiff(pal[i], c); if (d < bestDif) { ...
3
public static void _pf_mark_area(Coord start, Coord end) { Coord s1 = start.sub(MapView.tilefy_ns(start)); Coord s2 = end.sub(MapView.tilefy_ns(end));// .add(MCache.tileSize); // Coord s1 = new Coord(start.x, start.y); // Coord s2 = new Coord(end.x, end.y); // Coord st_trans = st...
8
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 UninstallApplicationMenu(Logger logger, boolean debug, ADBController adbController, SettingsManager settings, LangFileParser parser, Device device) { initComponents(); this.setLocationRelativeTo(null); this.setIconImage(new ImageIcon(this.getClass().getResource("/eu/m4gkbeatz/androidtoolk...
1
public void showColorKmean(int K, boolean useNativeColors) { try { Kmean kmean; if(useNativeColors) kmean = new Kmean(portableMap.getHeight(), portableMap.getWidth(), 3, portableMap.getColorData()); else kmean = new Kmean(portableMap.getHeight(), portableMap.getWidth(), 3, null); kmean.setK(K); ...
4
@Override public void update(int mouseX, int mouseY, boolean pressed) { if(this.x <= mouseX && mouseX <= this.x+this.width && this.y <= mouseY && mouseY <= this.y+this.height) if(pressed) this.state = 2; else this.state = 1; else this.state = 0; super.update(mouseX, mouseY, pressed); }
5
private BaseObject GetNearestObjectByMat( Enums.GMaterials material ) { if (visible_objs.size() == 0) return null; BaseObject obj = null; for (BaseObject element : visible_objs) { if (element != null && element.GetMatCountByType(material) > 0) {...
6
public boolean doubleUp(int upcard, int total, boolean soft) { if (upcard == 1) return false; if (soft) { return upcard <= 6 && total <= 18 && total + 2*upcard >= 23; } else { return total <= 11 && total >= 9 && upcard != 10 && (total != 9 || upcard >= 7); } }
8
public void addFieldFilter(String fieldName, String pattern) { if (!fieldFilters.containsKey(fieldName)) { fieldFilters.put(fieldName, new LinkedList<String>()); } fieldFilters.get(fieldName).add(pattern); }
1
public JSONObject getBefehl() { JSONObject now = null; try { JSONObject file = new JSONObject(read()); if (file.getJSONArray("Befehl").length() == 0) { return null; } now = file.getJSONArray("Befehl").getJSONObject(0); file.getJSONArray("Befehl").remove(0); write(file.toString()); } catch...
3
public void run(File subjectSortedInput, File indexOutput) { try { IndexWriter indexWriter = new IndexWriter(indexOutput); NQuadParser parserIn = new NQuadParser(subjectSortedInput); PrintStream out = new PrintStream(indexOutput); while (parserIn.hasNext()) { NQuad nq = parserIn.next(); if ((nq.ob...
8
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
private void writeFiles(DataOutputStream dataOut, TempFileInfo[] fileToWrite, int resolution) throws IOException, FileNotFoundException { final int sizeOfBuffer = 1024; byte[] byteTempArray = new byte[sizeOfBuffer]; for (TempFileInfo info3 : fileToWrite) { ...
6
@Override protected boolean isValidUrl(String url) { if ((url.startsWith(URL_PREFIX_HTTPS) || url.startsWith(URL_PREFIX_HTTP)) && !url.endsWith("/")) { //$NON-NLS-1$ try { new URL(url); return true; } catch (MalformedURLException e) { } } return false; }
4
public String deleteblogDetails() { FacesMessage doneMessage = null; String outcome = null; blogDelegate.deleteByKey(this.blogId); doneMessage = new FacesMessage("Deleted Successfully "); outcome = "/admin/success"; FacesContext.getCurrentInstance().addMessage(null, do...
0
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficiencyCheck(mob,0,auto); if(!success) mob.tell(L("Your plant senses fail you.")); else {...
7
public static void createAppdataFolder() { File appdata = new File(System.getenv("APPDATA") + "\\CatSigner"); if (!appdata.exists() || !appdata.isDirectory()) { appdata.mkdirs(); System.out.println("AppData folder is created successfully!"); } else { System.out.println("Skipping creation of AppDat...
2
@Override protected void setStatementParameters(PreparedStatement preparedStatement, WhereClause whereClause) throws IOException { int index = 0; for (WhereConstraint constraint : whereClause.getWhereConstraints()) { for (Object parameter : constraint.getParameters()) { if (parameter == null) { ...
9
public static void main(String args[]) { try{ Socket socket=new Socket("127.0.0.1",6888); //向本机的6888端口发出客户请求 BufferedReader sin=new BufferedReader(new InputStreamReader(System.in)); //由系统标准输入设备构造BufferedReader对象 PrintWriter os=new PrintWriter(socket.getOutput...
2
public boolean push(final LocalExpr expr) { final Boolean b = (Boolean) pushes.get(expr); return (b != null) && b.booleanValue(); }
1
private String currentCategory() { if (places[currentPlayer] == 0) return "Pop"; if (places[currentPlayer] == 4) return "Pop"; if (places[currentPlayer] == 8) return "Pop"; if (places[currentPlayer] == 1) return "Science"; if (places[currentPlayer] == 5) return "Science"; ...
9
public PackDetails(String packName, String keyboardSourceFile, String dictionarySourceFile, String themeSourceFile) { PackageName = packName; KeyboardSourceCodeFile = keyboardSourceFile != null && keyboardSourceFile.startsWith(".") ? PackageName ...
6
@EventHandler public void onBlockBreak(BlockBreakEvent event) { BlockState block = event.getBlock().getState(); if (block instanceof Sign) { Sign sign = (Sign) block; if (!sign.getLine(0).equals("[Class]")) return; World world = event.getBlock().getWorld(); ...
5
private byte[] generateCode(String encodedSource) { boolean hasScript = (scriptOrFnNodes[0].getType() == Token.SCRIPT); boolean hasFunctions = (scriptOrFnNodes.length > 1 || !hasScript); String sourceFile = null; if (compilerEnv.isGenerateDebugInfo()) { sourceFile = scri...
9
@Override public void remove(int i, int j) throws BadLocationException { if(!this.autoCompletion) { super.remove(i, j); return; } int k = getSelectionStart(); if(k > 0) k--; if(getText(0, k).equals("")) { super.remove(0, getLength()); return; } String s...
8
@Override public void i3channelSilence(MOB mob, String channel) { if((mob==null)||(!i3online())) return; if((channel==null) ||(channel.length()==0) ||(Intermud.getLocalChannel(channel).length()==0)) { mob.tell(L("You must specify an actual channel name.")); return; } if(Intermud.removeFak...
7
private Set<Point> generateDoors(Room room, Direction existingDirection) { Set<Point> doors = new LinkedHashSet<Point>(); for (Direction direction : Direction.values()) { if (direction == existingDirection) continue; if (generator.nextDouble() <= generationProbability) {...
3
public void testThatDequeueOnEmptyThrowsIndexOutOfBoundsException() { boolean exceptionOccurred = false; try { Agent o = q.dequeue(); } catch (java.util.NoSuchElementException e) { exceptionOccurred = true; } Assert.assertTrue(exceptionOccurred); }
1
public void drawState(Graphics g, Automaton automaton, State state, Point point, Color color) { super.drawState(g, automaton, state, point, color); drawStateOutput(g, state, point, color); }
0
final int method2679(int i, int i_7_, int i_8_) { anInt4232++; if (i_8_ != 1595) return 38; int i_9_ = (Class348_Sub42_Sub8_Sub2.windowHeight <= i ? i : Class348_Sub42_Sub8_Sub2.windowHeight); if (Class186_Sub1.aClass341_5808 == this) return 0; if (this == Class237_Sub1.aClass341_5821) return ...
5
public void init() { boolean debug = CommandLine.booleanVariable("debug"); if (debug) { // Enable debug logging Logger logger = Logger.getLogger("com.reuters.rfa"); logger.setLevel(Level.FINE); Handler[] handlers = logger.getHandlers(); ...
6
@Test public void fillMap () { String map = "ghi\n"; map += "def\n"; map += "abc\n"; System.out.println (map); char[][] myMap = new char[3][3]; int row = 2, col = 0; for (int i = 0; i < map.length (); i++) { char c = map.charAt (i); if (c == '\n') { ...
6
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException { player = new Player(320 / 2, 240 / 2, this); player.init(gc, sbg); worldEntities.add(player); for(int x = 0; x < sizeX; x++) { for(int y = 0; y < sizeY; y++) { if(data[x][y] == wall) { worldTiles.add(new WallTile(x*til...
5
public int getSecondID(){ return second_city.getID(); }
0
@SuppressWarnings("unchecked") @Override public T deleteAt(int index) throws DAIndexOutOfBoundsException { T returner = null; if((index >= 0) && (index <= size - 1)) { returner = (T)array[index]; // starts at index and shifts every object down by 1 System.arraycopy(array, index + 1, array, in...
4
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 ht...
7
@Override public void startSetup(Attributes atts) { super.startSetup(atts); addActionListener(this); }
0
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (!(obj instanceof AbstractFreightCarriage)) return false; AbstractFreightCarriage other = (AbstractFreightCarriage) obj; if (curCapacity != other.curCapacity) return false; if (m...
5
public void tick(){ if (x + xa>0 && x + xa <GamePanel.WIDTH - width) { x = x + xa; } if (collision2()) { BlockModeState.block = new FallingBlocks(Random(15, 120),Random(15, 120)); FallingBlocks.lives--; Sound.playBlockHit(); } if (collision3()) { BlockModeState.block2 = new FallingBlocks(Rand...
7
public boolean baca(String no_beli){ boolean adaKesalahan = false; Connection cn = null; this.no_beli = no_beli; listKwitansi = null; try{ Class.forName(Koneksi.driver); } catch (Exception ex){ adaKesalahan = true; JOptionPane.showMessageDialog(null,"JDBC Drive...
8
public int compare(String o1, String o2) { String s1 = (String)o1; String s2 = (String)o2; int thisMarker = 0; int thatMarker = 0; int s1Length = s1.length(); int s2Length = s2.length(); while (thisMarker < s1Length && thatMarker < s2Length) { ...
8
private boolean jj_3_7() { if (jj_3R_25()) return true; return false; }
1
@Override protected ElementHandler createHandler(String name) { if ("name".equals(name)) { return new StringValueBuilder(parentContext, new FinishCallback<String>() { @Override public void handle(String value) { CSGOperationNodeBuilder.this.op...
9
public void setCanonicalizationMethod(CanonicalizationMethodType value) { this.canonicalizationMethod = value; }
0
public void drawCW(Bitmap bitmap, int xo, int yo) { for (int y = 0; y < bitmap.width; y++) { int yy = y + yo; if (yy < 0 || yy >= this.height) continue; for (int x = 0; x < bitmap.height; x++) { int xx = bitmap.height - x + xo; if (xx < 0 || xx >= this.width) continue; int color = bitmap...
7
public static void DBClose() { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } }
1
public ExtDecimal negate() { if (type == Type.NUMBER) { return new ExtDecimal(content.negate()); } else if (type == Type.POSITIVEZERO) { return new ExtDecimal(Type.NEGATIVEZERO); } else if (type == Type.NEGATIVEZERO) { return new ExtDecimal(Type.POSITIVEZERO);...
5
public Address getAddress(Class<?> clazz) { ArrayList<Address> adrList = addresses.get(clazz); if (adrList != null) { return adrList.get(random.nextInt(adrList.size())); /* TODO smart balancing */ } else { return null; } }
2
public static void main(String[] args) throws IOException { theme = new Theme(); MetalLookAndFeel.setCurrentTheme(theme); try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } catch (ClassNotFoundException ex) { Logger.getLogger(TODOManager....
4
public static void insertActionLog( int uid, int bid, int auctionID, int actionType, String summary, String description ) throws DatabaseException { Connection conn = null; ResultSet rs = null; PreparedStatement ps = null; long nowTimeMillis = (new Date()).getTime(); String q = "INSERT INTO action...
7
private HashSet<Integer> selectSample(Hashtable<Integer,List<Integer>> coi, int sampleRate){ HashSet<Integer> res = new HashSet<Integer>(); List<Integer> lst_aux = new ArrayList<Integer>(); Enumeration<Integer> e = coi.keys(); while(e.hasMoreElements()){ lst_aux.add(e.next...
9
@EventHandler public void onDropItem(PlayerDropItemEvent e) { if (e.getPlayer().getGameMode() != GameMode.CREATIVE) { if (!plugin.getConfig().getBoolean("can-drop-hat-item")) { if (e.getItemDrop().getItemStack().equals(ItemStackUtil.getHatItem())) { e.getItemDrop().remove(); e.getPlayer().getInvento...
3
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { loggedInUser = (User) request.getSession().getAttribute("user"); //Check is user is logged in for session if (loggedInUser == null) { response.sendRedirect(request.getContextPath() + "/l...
3
public static boolean startsWithIgnoreCase(String str, String prefix) { if (str == null || prefix == null || prefix.length() > str.length()) { return false; } final char[] inputCharArray = str.toCharArray(); final char[] prefixCharArray = prefix.toCharArray(); for (i...
5
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<html><body>"); // Retrieving the username and password ...
8
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == nextPlayer) { // check if human is done if (( (HumanPlayer) game.getPlayers().get(0)) .getHumanMustFinish()) { JOptionPane.showMessageDialog(game, "You need to finish your turn!", "Next Player", JOptionPane.INFORMATION_MESSA...
5
private static String pluralityValue( ArrayList<HashMap<String, String>> examples, String goalAttribute) { Set<String> set = new HashSet<String>(); for (HashMap<String, String> example : examples) { set.add(example.get(goalAttribute)); } int largestFreq = 0; String value = ""; for (String s : set) { ...
3
private int getNextNode() { int id = -1; int value = Integer.MAX_VALUE; for(int i = 0; i < nodes.size(); i++) { if(!nodes.get(i).isVisited() && nodes.get(i).getValue() < value) { id = i; value = nodes.get(i).getValue(); } } return id; }
3
public AbstractAttributesPanel() { model = new AttributeTableModel(this); setModel(model); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // Setup Remove Column TableColumn removeColumn = getColumnModel().getColumn(0); removeColumn.setMinWidth(80); removeColumn.setMaxWidth(80); removeCo...
0
public static int[] getNeighboorsSlow(final int nb) { final int result[] = new int[36]; final int v1 = nb % 10; int root = nb - v1; int cpt = 0; for (int i = 0; i < 10; i++) { final int candidat = root + i; if (candidat == nb) { continue; } result[cpt++] = candidat; } final int v2 = (nb /...
8
public int GetCLCooking(int ItemID) { if (ItemID == 10758) { return 100; } if (ItemID == 10760) { return 100; } if (ItemID == -1) { return 1; } String ItemName = GetItemName(ItemID); if (ItemName.startsWith("Cooking cape")) { return 100; } if (ItemName.startsWith("Cooking hood")) { return 1...
5
@Override public String getDesc() { return "Default"; }
0
public Preferences() throws FileNotFoundException, IOException { initComponents(); /* Load saved preferences if there are any */ File prefFile = new File(System.getProperty("user.home") + "/Documents/AcerX/settingsYM.txt"); if (prefFile.exists()) { BufferedReader pre...
1
public String displayToilets( char charForFreeToilet, char charForTrappedToilet, char charForOccupiedToilet, int widthBetween ) { String status = ""; for( int i = 0; i<urinalCount(); i++ ) { switch( urinalVOs.get( i ).getStatus() ) { case FREE_SAVE: status += generateSpaces( widthBetween ) + ...
4
private void dropTable(String sql, StringTokenizer tokenizer) throws Exception { try { // Get table name String tableName = tokenizer.nextToken(); // Check for the semicolon String tok = tokenizer.nextToken(); if (!tok.equals(";")) { throw new NoSuchElementException(); } // Check if ther...
6
@Override public void run() { String insert="insert into TermIDList (term,IDList) values(?,?)"; String IDList=""; int count=0; try { PreparedStatement statement = sqLconnection.conn .prepareStatement(insert); while(rsSet.next()) { String term=rsSet.getString("term"); ResultSet rs=null; ...
4
protected static void modificar(){ //leer hasta encontrar que fila quiero modificar try{ BufferedReader stdin=Files.newBufferedReader(path, java.nio.charset.StandardCharsets.UTF_8); String linea=""; while((linea=stdin.readLine())!=null){ String [] part=linea.split(";"); } ...
2
private static int getTableIndex(float[] elem, float threshold) { int tableIndex = 0; if(elem[0] < threshold) { tableIndex |= 1; } if(elem[1] < threshold) { tableIndex |= 2; } if(elem[2] < threshold) { tableI...
8
public double getMaxMemory (){ double maxMemory = 0; for(int i = 0; i<memory.length; i++){ if(memory[i]>maxMemory) maxMemory = memory[i]; } return maxMemory; }
2
public String toString() { return super.toString() + ": \"" + getLabel() + "\""; }
0
public boolean isBlockIndirectlyGettingPowered(int var1, int var2, int var3) { return this.isBlockIndirectlyProvidingPowerTo(var1, var2 - 1, var3, 0) ? true : (this.isBlockIndirectlyProvidingPowerTo(var1, var2 + 1, var3, 1) ? true : (this.isBlockIndirectlyProvidingPowerTo(var1, var2, var3 - 1, 2) ? true : (this...
5
public boolean insertTicket(Ticket tic) throws SQLException{ Connection con = getConnection(); ArrayList<Ticket> ticket = getTicket(tic); if (ticket.size()!=0) { return false; } con.createStatement().executeUpdate("INSERT INTO ticket("+campos_ticket+") VALUES('" ...
1
String ChangeEmissionFilter(int Current_Item){ int Move_Item=Current_Item;//-Global.Emi_Previous_Item; //if (Move_Item<0) {Move_Item=Move_Item+6;} String CI=Integer.toString(Current_Item); //Global.Emi_Previous_Item=Current_Item; try{ if (Move_Item...
7
void run(){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(), W = sc.nextInt(), K = 0; int[] w = new int[15], f = new int[15], s = new int[n+1]; for(int i=1;i<=n;i++){ int k = sc.nextInt(); while(k--!=0){ w[K] = sc.nextInt(); s[i]+=1<<K; f[K++] = i; } } int[] sum = ne...
9
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int page=1; if(request.getParameter("page")!=null){ page=Integer.parseInt(request.getParameter("page")); } request.setAttribute("page", page); String name=""; if( request.ge...
9
InternalTestLinkId(final Long id) { super(id); }
0
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int size = Integer.parseInt(line); for (int i = 0;...
7
public int compareTo( Object obj ) { if( obj == null ) { return( 1 ); } else if( obj instanceof GenKbTagByNameIdxKey ) { GenKbTagByNameIdxKey rhs = (GenKbTagByNameIdxKey)obj; if( getRequiredTenantId() < rhs.getRequiredTenantId() ) { return( -1 ); } else if( getRequiredTenantId() > rhs.getRequir...
9
public static void saveAttunment(String player, String bWorld, double x, double y, double z, float yaw, float pitch) throws SQLException { String table = Config.sqlPrefix + "Attunements_v2"; Connection con = getConnection(); PreparedStatement statement = null; int success = 0; String query = "UPDATE `" + ta...
2
protected void computeRect(Raster[] sources, WritableRaster dest, Rectangle destRect) { int formatTag = MediaLibAccessor.findCompatibleTag(sources,dest); MediaLibAccessor srcAccessor1 = new MediaLibAccessor(sources[0], destRect...
9
public void renderPlayer(EntityPlayer par1EntityPlayer, double par2, double par4, double par6, float par8, float par9) { ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); modelArmorChestplate.heldItemRight = modelArmor.heldItemRight = modelBipedMain.heldItemRight = itemstack == null...
7
private void handleEnterEvent(MouseEvent event) { gotEnterAfterExit = true; ArrayList exitables = new ArrayList(enteredComponents); ArrayList enterables = new ArrayList(); Component c = (Component) event.getSource(); while (c != null) { if (hoverableComponents.contains(c)) { exitable...
7
public boolean equals(User user){ return name.equals(user.getName()) && password.equals(user.getPassword()) && interest.equals(user.getInterest()) && followed.equals(user.getFollowed()) && followers.equals(user.getFollowers()); }
4
@Override public void remoteSignal(String from, String method, String url) { // TODO Auto-generated method stub String[] urlSplits = url.split(","); String sourceUrl = urlSplits[0]; String[] sourceUrlSplits = sourceUrl.split("/"); String type = sourceUrlSplits[sourceUrlSplits.length - 2]; String id = sourc...
6
public void loadChannelHooks() { for(Map.Entry<String, Channel> entry : channels.entrySet()) { if(!(config.contains("channels." + entry.getKey() + ".linkedChannels"))) { continue; } List<String> links = config.getStringList("channels." ...
8
public void traverse(Node child,DefaultMutableTreeNode parent){ int type = child.getNodeType(); if(type == Node.ELEMENT_NODE){ Element elm = (Element)child; DefaultMutableTreeNode node = new DefaultMutableTreeNode("<" + elm.getTagName() + ">"); parent.add(node); ...
5
public static <T extends DC> Set<DC> dMax(Set<Pair<T,T>> phiMax) { if(phiMax!=null) { if(phiMax.getNext()!=null) { return new Set(phiMax.getFst().fst().delta(phiMax.getFst().snd()).diff(),dMax(phiMax.getNext())); } else { return new Set(phiMax.getFst().fst().delta(phiMax.getFst().snd()).di...
2
private void copyAndClose(InputStream inputStream, FileOutputStream outputStream) throws IOException { byte[] buffer = new byte[2048]; int read; try { while((read=inputStream.read(buffer))>0) { outputStream.write(buffer, 0, read); } } final...
1
public cellPicker(){ cellpick = new JComboBox(Cells); MBOTPick = new JComboBox(MBOTCells); jack = new JLabel("Born"); jill = new JLabel("Survives"); rulab = new JLabel(); //labels for wolfram rules wlab[0] = new JLabel("111"); wlab[1] = new JLabel("110"); wlab[2] = new JLabel("101"); wlab[3] = new JLabel("100...
6
public static OSType getOperatingSystemType() { if (detectedOS == null) { String OS = System.getProperty("os.name", "generic").toLowerCase(); if ((OS.indexOf("mac") >= 0) || (OS.indexOf("darwin") >= 0)) { detectedOS = OSType.MacOS; } else if (OS.indexOf("win") >= 0) { detectedOS = ...
5
public void addAll(IntArrayBag addend) { ensureCapacity(manyItems + addend.manyItems); System.arraycopy(addend.data, 0, data, manyItems, addend.manyItems); manyItems += addend.manyItems; }
0
public DataBase getGameData(TreeItem item){ if(item == null || item == rootItem){ return null; } DatabaseTreeItem dataItem = (DatabaseTreeItem) item; DataBase data = dataItem.gameData; if(data == null){ File file = new File(ProjectMgr.get...
4
static boolean isPiece(int i, int j) { return isWhitePiece(i, j) || isBlackPiece(i, j); }
1
public final CompilationUnitContext compilationUnit() throws RecognitionException { CompilationUnitContext _localctx = new CompilationUnitContext(_ctx, getState()); enterRule(_localctx, 0, RULE_compilationUnit); int _la; try { enterOuterAlt(_localctx, 1); { setState(195); switch ( getInterpreter().a...
7
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
static void input(double[][] matrix){ for(int i = 0; i < matrix.length; i++){ for(int j = 0; j < matrix[i].length; j++){ matrix[i][j] = scan.nextDouble(); } } }
2
private void printAll(TreeNode root, TreeNode parent, Node parentNode, int i) { Node p; int parentPosition = getRectNextLeft(i); if (root != null && parent == null) { p = makeNode(String.valueOf(root.key), new Point(parentPosition, getRectNextTop(0)), Node.COLOR_PARENT, i); ...
4
public static AttackType getAttackType(WeaponType type) { switch (type) { case mel_sword: return AttackType.SLASH; case mel_hammer: return AttackType.BASH; case rng_bow: return AttackType.PIERCE; } return Attack...
3
public void action() { BoundBox r; r = new BoundBox( entity.boundingBox.x, entity.boundingBox.y, entity.sprite.getWidth(), entity.sprite.getHeight()); entity.setBounds(r); entity.location = new Point2D.Double(r.getCenterX(),...
5
@Override public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_UP: Game.VK_UP = true; break; case KeyEvent.VK_DOWN: Game.VK_DOWN = true; break; case KeyEvent.VK_LEFT: Game.VK_LEFT = true; break; case KeyEvent.VK_RIGHT: Game.VK_RIGHT = true; break; } }
4