text
stringlengths
14
410k
label
int32
0
9
public static void saveWindowOpt() { synchronized (window_props) { try { window_props.store(new FileOutputStream("windows.conf"), "Window config options"); } catch (IOException e) { System.out.println(e); } } }
1
protected void search(String fileName){ File file = new java.io.File(fileName + ".html.txt"); File fileHistory = new java.io.File(fileName + ".history.txt"); FileWriter fw = null; FileWriter fwHistory = null; try { fw = new FileWriter(file); fwHistory = new FileWriter(fileHistory); fw.write("Start: "...
9
public static void changeLendability(BookCopy bc, boolean lendable) { try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoComm...
4
public boolean canFeed(CommandSender sender) { if ( sender instanceof Player ) { return this.hasPermission((Player)sender, "SheepFeed.feed"); } return false; // can not feed from console }
1
@Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if(e.getSource() == comButton) { String name = comTextField.getText(); InfoDownload infodownload = new InfoDownload(); if(infodownload.init(name)) { infodownload.getinfo(); cc.add(new User(name)); loadCha...
3
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 void criarAtividade(Atividade atividade) throws SQLException, atividadeExistente { AtividadeDAO atividadeDAO = new AtividadeDAO(); Atividade atividadeExistente = null; atividadeExistente = atividadeDAO.SelectATividadePorNome(atividade.getNome()); if (atividadeExistente == null)...
1
@Override public void onBlockBreak(BlockBreakEvent event) { Block block = event.getBlock(); Player player = event.getPlayer(); if ((block.getTypeId() == 63) || (block.getTypeId() == 68)) { Sign thisSign = (Sign) block.getState(); if (thisSign.getLine(0).equals("[WebAuction]")) { if (!plugin.permission....
4
public boolean isConnected() { if (this.size() < 2) { return true; } final Iterator<T> iterator = this.iterator(); final T source = iterator.next(); Deque<T> queue = new LinkedList<>(); Set<T> visited = new HashSet<T>(); queu...
9
public TagExtracter(List<Line> tagLines) { StringBuilder sb = new StringBuilder(); TagClosureCreator.TagClosure itemsHolder = new TagClosureCreator().getHolder(); TagClosureCreator.TagClosure deleteHolder = new TagClosureCreator().getHolder(); for (Line line : tagLines) { sb...
9
static long getOffsetOfChunk(int []vsize, int[] csize, int []start) { int [] volume = new int [vsize.length]; int []dsize = new int [vsize.length +1]; dsize[vsize.length]=1; volume[0]=1; for(int i = 1; i < volume.length; i++) { volume[i] = volume[i-1]*vsize[i-1]; } for(int i = vsize.length -1 ; ...
4
public void chooseDeleteMethod(Scanner a_scan) { boolean wasDeleted = false; System.out .println("Please Select Deletion Method of Choice(1 or 2): " + "\n1)Delete by Name,\n2)Delete by techID)"); switch (getMenuChoiceNameOrId(a_scan)) { case 1: { String name; name = inputStudentName(a_scan); ...
4
@RequestMapping(Routes.exerciciosbasicosRoda) public String runExercise(HttpServletRequest request, Model model){ resolution = request.getParameter("resolution"); exercise.buildGrading(resolution); if (exercise.hasCompileErrors != true) { //exercicio.salvarBancoDeDados(codigoUsu...
4
private UsersReader() throws IOException { try { FileInputStream fin = new FileInputStream(MAP_DIR); ObjectInputStream oos = new ObjectInputStream(fin); userMap = (HashMap<Long, Integer>) oos.readObject(); oos.close(); } catch (Exception e) { e.printStackTrace(); } tr = new TreeMap<Integer, User...
4
public boolean tryRotate() { boolean valid = true; incrementTYPE(true); int[][] key = screen[row][col].key(); for (int i=0; i<3; i++) { int r = row+key[i][0]; int c = col+key[i][1]; if (r < 0 || r >= NUM_ROWS || c < 0 || c >= NUM_COLS || dead[r][c] == true) valid = false; } incrementTYPE...
7
private int countNeighbours(int col,int row){ int total = 0; total = getCell(col-1, row-1) ? total + 1 : total; total = getCell( col , row-1) ? total + 1 : total; total = getCell(col+1, row-1) ? total + 1 : total; total = getCell(col-1, row ) ? total + 1 : total; total = getCell(col+1, row ) ? total + 1 :...
8
public static <T> T getTrackObjectFuzzyAt(World world, int x, int y, int z, Class<T> type) { T object = getTrackObjectAt(world, x, y, z, type); if (object != null) return object; object = getTrackObjectAt(world, x, y + 1, z, type); if (object != null) return objec...
3
private void initSpritePanel() { File path = new File(Preference.getSpriteLocation()); path.mkdirs(); List<SpritePackage> packages = new ArrayList<SpritePackage>(); File[] dirs = path.listFiles(); for (int i = 0; i < dirs.length; i++) { File dir = dirs[i]; ...
9
private static MapPoint getTileAccordingToBuildingType(UnitTypes building) { MapPoint buildTile = null; boolean disableReportOfNoPlaceFound = false; // Bunker if (TerranBunker.getBuildingType().ordinal() == building.ordinal()) { buildTile = TerranBunker.findTileForBunker(); } // Supply Depot // if (T...
6
@Override public boolean activate() { if(Variables.banking) { return !ShadeLRC.fullInventory() && (Combat.getRock() == null || !Players.getLocal().isInCombat()); } else { return Inventory.getCount() < 21 && (Combat.getRock() == null || !Players.getLocal().isInCombat()); ...
5
@Override public int write(ResultSet rs) throws IOException,SQLException { ResultSetMetaData md = rs.getMetaData(); int colCount = md.getColumnCount(); for (int i = 1; i <= colCount; i++) { print(md.getColumnName(i) + "\t"); } println(); int rowCount = 0; while (rs.next()) { ++rowCount; for (int...
3
private static void testCase1(){ CellEntry[][] cell = new CellEntry[][]{ {CellEntry.white, CellEntry.inValid, CellEntry.white, CellEntry.inValid, CellEntry.white, CellEntry.inValid, CellEntry.white, CellEntry.inValid}, {CellEntry.inValid, CellEntry.white, CellEntry.inValid, CellEntry.empty, CellEntry.inValid, Ce...
1
private FileChannel findOrCreateNewLogFile() { long currentSyncTime = writer.getSyncTime(); resetCurrentChannel(currentMaxTxnTime); for (int i = 0; i < logFiles.size(); i++) { if (i == currentFilePosn) { continue; } FileChannel channel = logFiles.get(i).getChannel(); long size = 0; try...
8
public synchronized void addGameListener(GameListener listener) throws IllegalArgumentException { if (listenerCount > gameListeners.length) throw new IllegalArgumentException("Too many listeners"); this.gameListeners[listenerCount++] = listener; }
1
public static void encrypt(int[] value, int[] key) { int sum = 0; int delta = 0x9E3779B9; for (int i = 0; i < ENCRYPT_ROUNDS; i++) { value[0] += (((value[1] << 4) ^ (value[1] >> 5)) + value[1]) ^ (sum + key[sum & 3]); sum += delta; value[1] += (((value[0] << 4) ^ (value[0] >> 5)) + value[0]) ^ ...
1
protected List<String> getCraftableSpellRow(String spellName) { List<String> spellFound=null; final List<List<String>> recipes=loadRecipes(); for(final List<String> V : recipes) if(V.get(RCP_FINALNAME).equalsIgnoreCase(spellName)) { spellFound=V; break;} if(spellFound==null) for(final List<String> V :...
8
@Override public void keyPressed(KeyEvent e) { /** * If the P key is pressed, pause or unpause the game */ if (e.getKeyCode() == KeyEvent.VK_P) { if (gamePaused) { unpauseGame(); } else { pauseGame(); } } else if (e.getKeyCode() == KeyEvent.VK_Q) { GameEngine.getGameScreenManager().setG...
3
public void body() { // wait for a little while for about 3 seconds. // This to give a time for GridResource entities to register their // services to GIS (GridInformationService) entity. super.gridSimHold(3.0); LinkedList resList = super.getGridResourceList(); // in...
8
public boolean equals(Object instance) { if (instance instanceof PairNonOrdered<?>) { PairNonOrdered<?> other = (PairNonOrdered<?>)instance; return super.equals(other) || super.equals(other.reverse()); } return false; }
5
public JSONObject putOnce(String key, Object value) throws JSONException { if (key != null && value != null) { if (this.opt(key) != null) { throw new JSONException("Duplicate key \"" + key + "\""); } this.put(key, value); } return this; }
3
public void update(MainWindowModel mainWindowModel) { setNumberOfPoints(mainWindowModel.getNumberOfPoints()); setTimeStep(mainWindowModel.getTimeStep()); setTimePeriod(mainWindowModel.getTimePeriod()); setXMin(mainWindowModel.getXMin()); setXMax(mainWindowModel.getXMax()); ...
0
public MasterMindAI(int level) { int i = level; if (i > 5) { i = 5; } if (i < 0 ) { i = 0; } this.level = (level+5)*500; init(); }
2
void createControlGroup () { /* * Create the "Control" group. This is the group on the * right half of each example tab. It consists of the * "Style" group, the "Other" group and the "Size" group. */ controlGroup = new Group (tabFolderPage, SWT.NONE); controlGroup.setLayout (new GridLayout (2, tr...
9
@Override public void compute() { // A very simple AI boolean newShip = false; if (currentOpponentShip == null || currentOpponentShip.getMorphsByIds().size() == 0) { currentOpponentShip = findOpponentShip(); newShip = true; } // iterate over the user's ships and send them all engage the opponent ship ...
8
@Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; }
1
public static void printMatrix(double[][] matrix, String fp, String[] names, int[] perm, String format) throws FileNotFoundException { File f = new File(fp); FileUtils.makeSubDirsOnly(f); PrintWriter out = new PrintWriter(f); if (names != null) { out.print("#"); ...
9
private void setHeightRatio() { if(backup_orbit != null && orbit) { System.arraycopy(((DataBufferInt)backup_orbit.getRaster().getDataBuffer()).getData(), 0, ((DataBufferInt)image.getRaster().getDataBuffer()).getData(), 0, image_size * image_size); } main_panel.repaint(); St...
8
public Position<T> SearchNode(Position<T> root, T value) throws InvalidPositionException { BTPosition<T> BTroot = checkPosition(root); while (BTroot != null) { T currentV = BTroot.element(); if (currentV == value) break; if (comp.compare(currentV, value) > 0) BTroot = BTroot.getLeft(); else...
3
private void delay() { if (_packetDelay > 0) { try { Thread.sleep(_packetDelay); } catch (InterruptedException e) { // Do nothing. } } }
2
@Override public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals(classeString)) // Si on clic sur le boutton "Selectionner classe" on affiche les // équipements { selectionClasse(); } if(e.getActionCommand().equals(equipementString)) // ...
4
final void put(int i, Object object, long key, int i_5_) { try { anInt1092++; if (i_5_ > anInt1084) throw new IllegalStateException("s>cs"); method586(key); anInt1086 -= i_5_; while ((anInt1086 ^ 0xffffffff) > -1) { Class348_Sub42_Sub8 class348_sub42_sub8 = ((Class348_Sub42_Sub8) ...
5
private void updateHasOne(Object obj, String column, Map<String, Object> foreignKey) { StringBuilder sb = new StringBuilder(); sb.append("update " + obj.getClass().getSimpleName() + " set "); PreparedStatement stmt = null; Connection connection = null; try { PropertyDescriptor[] pd = handler.getPropert...
7
public void draw(Graphics2D g) { //Draw the background image so the board looks pretty. g.drawImage(boardImage, 0, 0, null); //We're gonna mess with the board so lets copy it. Board temp = copy(); //Determine where each piece is. String checkerColor, checkerType; for (int i = 0; i < SIZE; i++)...
9
public void run() { screen = createVolatileImage(pixel.width, pixel.height); //actually use the graphics card (less lag) render(); if(!debugMode) { int twoPlayers = JOptionPane.showConfirmDialog(null, "Play with 2 players?", "2 Players?", JOptionPane.YES_NO_OPTION); if(twoPlayers == 1) //they sai...
5
void setUp(int width) { for (int x = 0; x < width; x++) { for (int y = 0; y < width; y++) { Square square = squares[x][y]; if (uniform() < 0.5) { square.setDirty(true); } if (uniform() < 0.1) { square.setObstacle(true); } } } }
4
private void init() { int run_server = JOptionPane.showConfirmDialog(null, "Run the server ? "); if (run_server == 0) { server = new Server(this); client = new Client(this, "localhost"); client.start(); } else if (run_server == 1) { try { client = new Client(this, JOptionPane.showInputDialog(nu...
8
public Shape getShape(String shapeType){ if(shapeType == null){ return null; } if(shapeType.equalsIgnoreCase("CIRCLE")){ return new Circle(); } else if (shapeType.equalsIgnoreCase("RECTANGLE")){ return new Rectangle(); } else if...
4
public void visitEnd() { super.visitEnd(); if (fv != null) { fv.visitEnd(); } }
1
public void run() throws ParsingException { parseStack.push(new TerminalEntry(EOF)); parseStack.addToParseStack(ruleTable.find(startSymbol, startToken)); A = parseStack.peek(); getNextToken(); while ((A != null) && !A.isEof()) { A = parseStack.peek(); if (...
8
private Component cycle(Component currentComponent, int delta) { int index = -1; loop : for (int i = 0; i < m_Components.length; i++) { Component component = m_Components[i]; for (Component c = currentComponent; c != null; c = c.getParent()) { if (component == c) { index = i; break loop; } ...
8
private static Object dialog(WindowType window, MessageType messageType, String title, String message, JFrame parent) { int swingType; switch (messageType) { case WARN: swingType = JOptionPane.WARNING_MESSAGE; break; case QUESTION:...
5
public static int[][] mul(int[][] a, int[][] b) { int[][] result = new int[a.length][b.length]; for (int i = 0; i < a.length; i++) { for (int j = 0; j < a.length; j++) { result[i][j] = 0; for (int N = 0; N < a.length; N++) { result[i][j] +=...
3
public FeatureVector extract(String idref) throws IDrefNotInSentenceException, RootNotInPathException, FeatureValueNotCalculatedException { FeatureVector fv = new FeatureVector(); if (FeatureTypes.isUsedFeatureType("target")) fv.addFeature("target", extractTarget()); if (FeatureTypes.isUsedFeatureType("synC...
9
public boolean isValidSelection(DateModel<?> model) { if (model.isSelected()) { Calendar value = Calendar.getInstance(); value.set(model.getYear(), model.getMonth(), model.getDay()); value.set(Calendar.HOUR, 0); value.set(Calendar.MINUTE, 0); value.set...
7
@Override public void endElement ( String uri, String localName, String qName ) throws SAXException { if ( requestType.equals( Globals.requestStatus ) ) { if ( qName.equals( XMLTags.Status ) ) { return; } else { processStatusXml( qName ); } } else if ( requestType.equals( Globals.requestMemoryB...
8
private void initComponents() { setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); wordsInSectionLbl = new JLabel(); wordsPane = new JScrollPane(); wordsTable = new JTable(); editWordLbl = new JLabel(); motherLangWordTextField = new JTextField(); translation...
1
public static TransactionSet DoApriori(TransactionSet transSet,double minSupportLevel) { ItemSet initialItemSet = transSet.GetUniqueItems();//get all singular unique items and put them into a ItemSet object TransactionSet finalLargeItemSet = new TransactionSet(); // resultant large itemsets TransactionSet LargeIt...
5
@Override public void renderContents(float interpolation) { if(mainCollider != null) mainCollider.drawCollider(0xffffff); if(moveCollider != null) moveCollider.drawCollider(0xffffff); if(altMoveCollider != null) altMoveCollider.drawCollider(0x00ff00); if(rawMoveCollider != null) rawMoveCollid...
5
@Override public void getFromPane(User u) throws InvalidFieldException { String oID = u.getID(); u.setID(tfID.getText().trim()); GameData g = GameData.getCurrentGame(); if (!g.checkID(u, User.class)) { if (oID != null) u.setID(oID); throw new InvalidFieldException(Field.USER_ID_DUP, "Duplica...
2
public boolean similar(Object other) { try { if (!(other instanceof JSONObject)) { return false; } Set set = this.keySet(); if (!set.equals(((JSONObject)other).keySet())) { return false; } Iterator iterator =...
9
public AttackResult attack(Territory target){ //assumes that troop strength of attacking territory is > 1 Integer[] aDice, dDice; if(this.troopStrength > 3){ aDice = new Integer[3]; } else{ aDice = new Integer[this.troopStrength - 1]; } if(target.getTroopStrength() > 1){ dDice = new Integer[2]; ...
8
public static void main(String[] args) { ArrayList list = new ArrayList(); list.add("hello"); list.add(new Integer(2)); String str = (String)list.get(0); Integer in = (Integer)list.get(1); // String in1 = (String)list.get(1); java.lang.Integer cannot be cast to java.lang.String System.out.println(str);...
0
public void playGame(GUI gui, int matchNum, int totalMatches) { gui.initaliseWorldMap(world, matchNum, totalMatches); System.out.println("Total Food:" + world.getFoodNum()); try { // Sleep thread for 3 seconds between each game for the player to observe the results Thread...
2
public String getName() { return name; }
0
public boolean isChar() { char c = symbol; if ((c >= 65 && c <= 90) || (c >= 97 && c <= 122)) { return true; } return false; }
4
private void searchForControllers() { Controller[] controllers = ControllerEnvironment.getDefaultEnvironment().getControllers(); for(int i = 0; i < controllers.length; i++) { Controller controller = controllers[i]; if (controller.getType() == Controller.Type.STICK || ...
6
public static boolean equal(List<Partition> listA, List<Partition> listB) { if (listA.size() != listB.size()) { return false; } for (int index = 0; index < listA.size(); index++) { Partition a = listA.get(index); Partition b = listB.get(index); if ...
5
public static void main(String[] args) { if (args == null || args.length < 2) { printHelp(); throw new IllegalArgumentException("Minimum 2 file pathes needed"); } List<String> inputFileNames = new ArrayList<String>(); for (int i = 0; i < args.length - 1; i++ ) { inputFileNames.add(args...
8
private TreeNode Statement() { TreeNode tmp; int line = t.lineNumber; switch (t.id) { case Constants.ID: tmp = ExpressionSmt(); break; case Constants.RETURN: tmp = Return(); break; case Constants.READ: tmp = Read(); break; case Constants.WRITE: tmp = Write(); break; case Constan...
7
public void open(String[] onlines) { if (onlines == null || onlines.length == 0) return; DedicatedUI ui = null; String senderName = fPropertiesDB.getUserName(); String remoteIPAddress = null; // // Open only one dedicated ...
9
private String buildFullPath(Class<?> aClass, Method method) { int modifiers = method.getModifiers(); String modifier = "package-local"; if (Modifier.isPrivate(modifiers)) { modifier = "private"; } else if (Modifier.isProtected(modifiers)) { modifier = "protected...
4
public static Method getAccessor(Class<?> declaringClass, String accessorname) { Method res = null; if (declaringClass != null) { // check this class try { res = declaringClass.getDeclaredMethod(accessorname); } catch (NoSuchMethodException e) { // do nothing, keep iterating up } ...
4
private void loadLetterPoints() throws IOException, FileNotFoundException { BufferedReader in = null; try { in = new BufferedReader(new FileReader(POINTS_FILE)); String line; while((line = in.readLine())!=null){ line = line.trim(); int letterPoint = Integer.parseInt(line.substring(0, 2)); line ...
6
@Override public ArrayList<Lot> findLots(Map<String, String> params) { //проверка, что обязательные поля заполнены if (!params.containsKey(MechanicSales.findParams.ARRIVAL_AIRPORT) || !params.containsKey(MechanicSales.findParams.DEPARTURE_AIRPORT) || !params.containsK...
9
public ArrayList<GameObject> getAllAttached() { ArrayList<GameObject> result = new ArrayList<GameObject>(); for ( GameObject child : children ) result.addAll( child.getAllAttached() ); result.add( this ); return result; }
1
public boolean posNeg(int a, int b, boolean negative) { if ( a<0 && b<0 && negative) return true; if ( ( ( a<0 && b>0 ) || ( a>0 && b<0 ) ) && !negative ) return true; return false; }
8
public String toString() { String res = ""; for (int i = 0; i < this.hauteur; i++) { // Parcours le premier tableau for (int j = 0; j < this.largeur; j++) { // Parcours le second tableau switch (this.background[i][j]) { case MUR : res = res +"M"; break; case HERBE : res = res...
9
public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); w: while (scan.hasNext()) { int n = -1, con = 0; boolean[] a = new boolean[101]; Arrays.fill(a, false); ArrayList<Integer> ll = new ArrayList<Integer>(); HashSet<Integer> set = new HashSet<Integer>(); ...
6
@Override public EntidadBancaria get(int id) { PreparedStatement preparedStatement; EntidadBancaria entidadBancaria; ResultSet resultSet; Connection connection = connectionFactory.getConnection(); try { preparedStatement = connection.prepareStatement("SELECT * FRO...
3
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("N: "); sb.append(N); sb.append("\tP: "); sb.append(p); sb.append("\tQ: "); sb.append(q); sb.append("\n"); for(int i = 0; i < N; ++i) { for(int j = 0; j < N; ++j) { sb.append(Odometer.intToOdometer...
9
private static String[] formatEmpty(){ String[] cards = new String[60]; for(int i=0; i<60; i++){ cards[i]="Forest"; } return cards; }
1
private void calculatePosition(){ nx = Math.cos(Math.toRadians(moveAngle)); ny = Math.sin(Math.toRadians(moveAngle)); x+=speed*nx; y+=speed*ny; if(x>MainWindow.WIDTH) x = -getWidth(); if(y>MainWindow.HEIGHT) y = -getHeight(); if(x+getWidth()<0) x = MainWindow.WIDTH; if(y+getHeight()<0) y = MainWi...
4
private static void setDefaultLookAndFeel(){ try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (UnsupportedLookAndFeelException...
9
private boolean fsk2001000FreqHalf (CircularDataBuffer circBuf,WaveData waveData,int pos) { boolean out; int sp=(int)samplesPerSymbol/2; // First half double early[]=do64FFTHalfSymbolBinRequest (circBuf,pos,sp,lowBin,highBin); // Last half double late[]=do64FFTHalfSymbolBinRequest (circBuf,(pos+sp),sp,lowBi...
6
public static String encode(String value) { String encoded = null; try { encoded = URLEncoder.encode(value, "UTF-8"); } catch (UnsupportedEncodingException ignore) { } StringBuffer buf = new StringBuffer(encoded.length()); char focus; for (int i = 0; i...
8
public Hunter(Field field, Location newLocation) { this.field = field; setLocation(newLocation); }
0
protected void renderContinuousSegment() { /* A lazy but effective line drawing algorithm */ final int dX = points[1].x - points[0].x; final int dY = points[1].y - points[0].y; int absdX = Math.abs(dX); int absdY = Math.abs(dY); if ((dX == 0) && (dY == 0)) return; if (absdY > absdX) { final int inc...
9
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); if(session != null){ String sleeveInput = (String) session.getAttribute("sleeveInput"); String op...
9
public User(Socket s) throws IOException { socket = s; in = new BufferedReader(new InputStreamReader(socket.getInputStream())); // Включение автосброса буферов: out = new PrintWriter(new BufferedWriter(new OutputStreamWriter( socket.getOutputStream())), true); port = socket.getPort(); // Если какой ...
0
public void render() { root.renderAll(); for(GUI gui:guiLayer){ gui.render(); } }
1
@Override public void out() throws Exception { Object val = fa.getFieldValue(); // Object val = access; // if (ens.shouldFire()) { // DataflowEvent e = new DataflowEvent(ens.getController(), this, val); //// DataflowEvent e = new DataflowEvent(ens.getController(), this, ...
1
public Renderer.CommandHandler getHandler(String symbol) { if (handlers.containsKey(symbol)) return (CommandHandler) handlers.get(symbol); return null; }
1
private static boolean isWhitespace(char c) { return c == ' ' || c == '\t' || c == '\r' || c == '\n'; }
3
private void bindTexture(int texId) { if (texId == boundTex) { return; } glBindTexture(GL_TEXTURE_2D, texId); boundTex = texId; }
1
public void visitInsn(final int opcode){ // adds the instruction to the bytecode of the method code.putByte(opcode); // update currentBlock // Label currentBlock = this.currentBlock; if(currentBlock != null) { if(compute == FRAMES) { currentBlock.frame.execute(opcode, 0, null, null); } else { ...
6
public static String[] getIDs(Connection con, TableInfo tableInfo) { ArrayList<String> data = new ArrayList<String>(); try { PreparedStatement ps = con.prepareStatement("SELECT ID FROM " + tableInfo.tableName); ResultSet rs = ps.executeQuery(); while (rs.next()) data.add(rs.getString("ID")); ...
3
public Object render(Scope scope, Statement statement, int tokenIndex) throws PoslException { switch (state) { case NORMAL: case OPTIONAL: return scope.get(type, statement.get(tokenIndex)); case CONTEXT_PROPERTY: return scope.get((String) parameter); case SCOPE: return scope; // Collection is a...
8
public SlotType(String type) { reward = new HashMap<ItemStack,Integer>(); fireworks = new HashMap<ItemStack,Integer>(); wrg = new WeightedRandomGenerator(); String typeNode = "types."+type; String rewardNode = typeNode+".reward"; cost = Global.config().getInt(typeNode + ".cost"); Set<String> keys...
7
public GUIChat(DataInputStream in, DataOutputStream out, RequestChatHandler rq, ComingRequestChatHandler commingRq) { setResizable(false); this.rq = rq; this.commingRq = commingRq; read = in; write = out; fc = new JFileChooser(); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, ...
0
public String addingYear(String field, int before, int max) { String newField = ""; for(int i = 1; i <= field.length(); i++) { if(isNumber(field.substring(i - 1, i))) { newField = newField + field.substring(i - 1, i); } else ...
8