text
stringlengths
14
410k
label
int32
0
9
public static void main(String[] args) throws IOException { if (args.length != 1) { System.err.println("Usage: java KnockKnockServer <port number>"); System.exit(1); } int portNumber = Integer.parseInt(args[0]); try ( ServerSocket server...
4
public void update() { if (playing) { long time = System.currentTimeMillis(); if ( time - lastTime > frameDuration[currFrame] && finalFrame != 0) { currFrame++; lastTime = time; ...
7
@Override public List<Method> findMethodsCalled(String methodName, InputStream data) { ArrayList<Method> listMethods = new ArrayList<>(); XMLInputFactory xmlif = XMLInputFactory.newInstance(); try { XMLStreamReader xmlsr = xmlif.createXMLStreamReader(data); SAXBuilder builder = new SAXBuilder(); int e...
7
protected int upgradeHP() { if (upgrades == null) return 0 ; int numUsed = 0 ; for (int i = 0 ; i < upgrades.length ; i++) { if (upgrades[i] != null && upgradeStates[i] != STATE_INSTALL) numUsed++ ; } if (numUsed == 0) return 0 ; return (int) (baseIntegrity * UPGRADE_HP_BONUSES[numUsed]) ;...
5
public static JSONArray fetchByNumber(final String token, final String objType, final Long number) throws IOException { String url = ApiProperties.get().getUrl() + objType + "/number/" + number; String obj = fetchData(url).toString(); JSONObject jsonObject = new JSONObject(obj); JSONArray results = new JSON...
2
public List<Class<? extends Data>> getAllDataTypesFromEntity( long someId ) { // return new ArrayList<Class<? extends Data>>( _dataCenter.getDataCore().getEntity_Data_Table().get( someId ).keySet() ); }
2
private static final Object number(CharacterIterator it,StringBuilder buf) { int length = 0; boolean isFloatingPoint = false; buf.setLength(0); char c = it.current(); if (c == '-') { buf.append(c); c = it.next(); } length += addDigits(it,c,buf...
9
public final void initUI() { amiListe = new JComboBox<UserProfile>(); //liste déroulante servant à stocker les amis. panel = new JPanel(); //panel principal servant à stocker tous les autres éléments. getContentPane().add(panel); //On le rajoute à la fenêtre. /* Défini les caractéristiques du panel princ...
7
public double calculateCommission() { this.commision = 0; this.commision = this.speaker.getRate() * this.duration; int dayOfWeek = this.getDayOfWeek(this.eventDate); if(dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY) { this.commision = this.commision * 1.25; } // add transportation fee...
2
@Override public String toString() { String g = G().V() + " vertices " + G().E() + " edges\n"; for (int v = 0; v < G().V(); v++) { g += name(v) + "(" + v + "): "; for (int w : G().adj(v)) g += name(w) + "(" + w + "), "; g += "\n"; } return g; }
2
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed int isbn=Integer.parseInt(jTextField9.getText()); String title=jTextField10.getText(); int num=Integer.parseInt(jTextField23.getText()); ArrayList<Str...
8
@Override public Class<?> getColumnClass(int indiceColuna) { switch (indiceColuna) { case 0: return String.class; //fornecedor case 1: return String.class; //job case 2: return String.class; //setor origem case 3: ...
9
public TBShopFetcher(RequestWrapper requestWrapper) { super(requestWrapper); }
0
public static List<Event> load(){ Connection conn = null; Statement stat = null; ResultSet result = null; List<Event> list = new ArrayList<Event>(); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/gent?user=root&password=...
9
public List<String> complete(final String prefix, final int count) { // 1. Find the position of the prefix in the sorted set in Redis if (null == prefix) { return Collections.emptyList(); } int prefixLength = prefix.length(); Long start = redis.zrank(redisKey, prefix)...
9
private static <T extends Comparable<T>> void maxHeapify(T array[], int index, int heapSize){ int leftIndex = getLeftChildIndex(index); int rightIndex = getRightChildIndex(index); int largestIndex = index; if(leftIndex <= heapSize && array[index].compareTo(array[leftIndex]) == -1) largestIndex = leftIn...
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Designation)) { return false; } Designation other = (Designation) object; if ((this.id == null && other.id != n...
5
public void consume(final Throwable eMain) { SwingUtilities.invokeLater(new Runnable() { public void run() { Throwable e = getRootCause(eMain); // Get the last bit of the Java console stdout String outMsg = ""; if (stdoutDoc != null) { try { int nsave = 4000; int docLen = stdoutDoc.getLe...
8
public List getEntitiesWithinAABB(Class var1, AxisAlignedBB var2) { int var3 = MathHelper.floor_double((var2.minX - 2.0D) / 16.0D); int var4 = MathHelper.floor_double((var2.maxX + 2.0D) / 16.0D); int var5 = MathHelper.floor_double((var2.minZ - 2.0D) / 16.0D); int var6 = MathHelper.floor_...
3
public void insert(BinaryTreeNode n) { BinaryTreeNode runner = this.root; BinaryTreeNode parentPostion = null; while (runner != null) { parentPostion = runner; if (n.compareTo(runner) <= 0) { runner = runner.left; } else { runne...
4
private boolean load() { boolean returnval = true; try { if (locFile.exists() & locFile.canRead()) { BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(new FileInputStream(locFile), Charset.forName("UTF-8"))); ...
7
public boolean collisionCheck(int posX, int posY) { if(posX > this.posX && this.posX+width > posX && posY > this.posY && this.posY+height > posY) { return true; }else { return false; } }
4
@SuppressWarnings("unchecked") public static List<Card> deSerialiseCards(){ List<Card> deser_members = null; try { FileInputStream input_file = new FileInputStream("cards.ser"); ObjectInputStream input = new ObjectInputStream(input_file); deser_members = (List<Card>) input.readObject(); input.close();...
6
private boolean jj_2_20(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_20(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(19, xla); } }
1
private Node parseDecision() { Decision result = new Decision(this); Expression expr = new Expression(this); result.append(expr); while (offset < input.length()) { char c = input.charAt(offset); if (c == ')') { offset++; break; } else if (c == '|') { offset++; expr = new Expre...
4
public int setLoyalty(String playerName, double loyalty) { String SQL = "UPDATE " + tblSkills + " SET " + "`leadership` = ? WHERE `player` LIKE ? ;"; int updateSuccessful = 0; Connection con = getSQLConnection(); PreparedStatement statement = null; try { statement = con.prepareStatement(SQL); stateme...
4
public void render() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glBindTexture(GL_TEXTURE_2D, texture.id); glTranslatef(1*HouseGenerator.tWidth*globalWidth2*0.5f, 0f, 1*HouseGenerator.tDepth*globalHeight2*0.5f); glRotatef(-1, 0, 1, 0); glTranslatef(-1*HouseGenerator.tWidth*globalWidth2*0.5f, 0f,...
2
public int method544(int i, float f) { if(i == 0) { float f1 = (float)anIntArray668[0] + (float)(anIntArray668[1] - anIntArray668[0]) * f; f1 *= 0.003051758F; aFloat671 = (float)Math.pow(0.10000000000000001D, f1 / 20F); anInt672 = (int)(aFloat671 * 65536F); } if(anIntArray665[i] == 0) return 0; ...
7
public static IMac getInstance(String name) { if (name == null) { return null; } name = name.trim(); name = name.toLowerCase(); if (name.startsWith(HMAC_NAME_PREFIX)) { return HMacFactory.getInstance(name); } IMac result = null; if (name.equalsIgnoreCa...
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; SpanTermQuery other = (SpanTermQuery) obj; if (term == null) { if (other.term != null) return false; ...
6
public static void main(String args[]) throws Exception { try { String serverHostname = new String ("127.0.0.1"); if (args.length > 0) serverHostname = args[0]; BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in)); ...
4
@Override public void deserialize(Buffer buf) { cellId = buf.readShort(); if (cellId < 0 || cellId > 559) throw new RuntimeException("Forbidden value on cellId = " + cellId + ", it doesn't respect the following condition : cellId < 0 || cellId > 559"); objectGID = buf.readShort()...
3
protected void generateMoves(List<Movement> movesList, Piece piece) { /************** GENERACIÓN DE LOS MOVIMIENTOS *************/ bbPieceOccupation = bbPiecesOccupation[piece.index]; numPieces = Long.bitCount(bbPieceOccupation); for(int i = 0; i < numPieces; i++) { pieceSquar...
7
public static int[] computeBuying(int[] arr) { int[] results = { -1, -1, -1 }; // error check - only one data point if (arr.length == 1) { results[0] = results[1] = results[2] = 0; return results; } int min = 0; int max = 0; int prof = 0; int tempMin = 0; int tempMax = 0; int tempProf = 0; ...
5
public Map<Integer, Integer> getGeneSpans(String text) { Map<Integer, Integer> begin2end = new HashMap<Integer, Integer>(); Annotation document = new Annotation(text); pipeline.annotate(document); List<CoreMap> sentences = document.get(SentencesAnnotation.class); for (CoreMap sentence : sentences) {...
5
public TrainListFrame(Title myTitle, TrainSchedule TS, String filePath) throws IOException { setBackground(new Color(173, 216, 230)); setLayout(null); JButton btnUpload = new JButton("Upload another schedule"); btnUpload.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEven...
3
private static <T extends Comparable<T>, E> void printNodeInternal(List<Node<T,E>> nodes, int level, int maxLevel) { if (nodes.isEmpty() || isAllElementsNull(nodes)) return; int floor = maxLevel - level; int endgeLines = (int) Math.pow(2, (Math.max(floor - 1, 0))); int first...
9
public void testNeighbourshipSimple() { // the middle segment ("segmentB") has whether "segmentA" or "segmentC" // as its left or right neighbour (depending on orientation): assertTrue((segmentB.getNeighbour(0) == segmentA && segmentB .getNeighbour(1) == segmentC) || (segmentB.getNeighbour(0) == segmentC...
9
private int handleJumpBankRelative(int address, int jumpAddress, CPUState s, int jumpType, boolean reachable) { if(jumpAddress < 0x4000) // home bank jump return handleJumpFull(address,jumpAddress,s, jumpType, reachable); else if(jumpAddress >= 0x8000) // non-ROM jump System.out.pr...
6
public boolean isMt() { String iduc = id.toUpperCase(); return iduc.equals("M") // || iduc.startsWith("MT") // || (iduc.indexOf("MITO") >= 0) // ; }
2
public void printAllCombinationNonRecur(String number){ int[] answer=new int[number.length()]; for(int i=0;i<answer.length;i++){ answer[i]=0; } while(true){ for(int i=0;i<number.length();i++){ System.out.print(mapping[Integer.parseInt(number.substring(i,i+1))].charAt(answer[i])); } System.out.pr...
6
public static void main(String args[]) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } catch (InstantiationException e1) { e1.printStackTrace(); } catch (IllegalAccessException e1) { e1.printStackTrace(); } ...
4
public MOB getJudgeIfHere(MOB mob, MOB target, Room R) { LegalBehavior B=null; if(R!=null) B=CMLib.law().getLegalBehavior(R); final Area legalA=CMLib.law().getLegalObject(R); if((B!=null)&&(R!=null)) for(int i=0;i<R.numInhabitants();i++) { final MOB M=R.fetchInhabitant(i); if((M!=null)&&(M!=mo...
8
public TreeSet<Assign> extractBest(int num, TreeSet<Assign> used) { // Sanity check assert num <= numLectures : "Attempting to extract more assignments than possible"; HashMap<String, Assign> fixedAssignments = (HashMap<String, Assign>)environment.getFixedAssignments(); TreeSet<Assign> bestAssignments =...
5
private void initSegments(double With,double Height,double radius) { SegmentModel bsegments = new SegmentModel(base.getInterpolated(With,Height,radius)); segments = new SegmentModel[n]; double angle = 2*Math.PI/n; for (int i = 0; i<segments.length;i++){ segments[i] = Segment...
7
@Override public void paint( Graphics g ) { if( hdrImage == null ) { g.setColor(Color.BLACK); g.fillRect(0, 0, getWidth(), getHeight()); } else { int scale = 2; while( hdrImage.getWidth()*scale <= getWidth() && hdrImage.getHeight()*scale <= getHeight() ) { ++scale; } --scale; int left ...
9
private Point getTargetBlock(Point cur){ int cnt = 0; if (this.maze[cur.x][cur.y + 1] == false) {cnt++;} if (this.maze[cur.x][cur.y - 1] == false) {cnt++;} if (this.maze[cur.x + 1][cur.y] == false) {cnt++;} if (this.maze[cur.x - 1][cur.y] == false) {cnt++;} if (...
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 ClassNotFoundException, IOException { Worm w1 = new Worm(6, 'a'); System.out.println("w1 = " + w1); ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("worm.out")); out.writeObject("Worm storage\n"); out.writeObject...
0
private boolean _hasBeenModified() { File config_file = new File(ConfigurationManager.config_file_path); Long this_time = config_file.lastModified(); return (this_time > this.read_time); }
0
public static void sort(int[] array, int start, int end) { if(start >= end) { return; } int i = sortUtil(array, start, end); sort(array, start, i - 1); sort(array, i + 1, end); }
1
private Map<String, String> validateFields(Map<String, String> validationMap){ Map<String, String> resultsMap=new HashMap<String, String>(); int intValue=0; for( Map.Entry<String, String> entry:validationMap.entrySet()){ if(entry.getKey().equals("healthrec")){ try{ intValue=Integer.parseInt(entr...
8
@Override public void execute( CommandSender sender, String[] args ) { if ( !( sender.hasPermission( "bungeesuite.reload" ) || sender.hasPermission( "bungeesuite.admin" ) ) ) { if ( sender instanceof ProxiedPlayer ) { ProxiedPlayer p = ( ProxiedPlayer ) sender; p....
3
public Tool getCurrentTool(){ return currentTool; }
0
public ArrayList<Integer> generateWhitePawnDestinations( int position ) { ArrayList<Integer> destinations = new ArrayList<Integer>(); if ( !hasPieceMoved( pieceAt( position ) ) && squareEmpty( position + 16 ) && squareEmpty( position + 32 ) ) { destinations.add( position + 32 ); } if ( !squareEmp...
8
public boolean equals(Reaction R){ boolean result = (reactants.length==R.getReactants().length) && (products.length==R.getProducts().length); int i=0; boolean finish=false; while(result && !finish){ if(i<reactants.length){ result = (reactants[i...
5
private ArrayList<Chunk> getVillageChunks() { ArrayList<Chunk> villageChunks = new ArrayList<Chunk>(); chunksLock.readLock().lock(); try { for (Chunk c : chunks) { if (c.hasVillage()) { villageChunks.add(c); } } } finally { chunksLock.readLock().unlock(); } return villageChu...
2
public FileStream(RandomAccessFile source) throws OggFormatException, IOException { this.source=source; ArrayList po=new ArrayList(); int pageNumber=0; try { while(true) { po.add(new Long(this.source.getFilePointer())); // skip data if pageNumber>0 ...
8
public CtField getDeclaredField(String name) throws NotFoundException { CtField f = getDeclaredField2(name); if (f == null) throw new NotFoundException("field: " + name + " in " + getName()); else return f; }
1
private void copyRGBtoBGRA(ByteBuffer buffer, byte[] curLine) { if(transPixel != null) { byte tr = transPixel[1]; byte tg = transPixel[3]; byte tb = transPixel[5]; for(int i=1,n=curLine.length ; i<n ; i+=3) { byte r = curLine[i]; by...
6
public String determBacktrack(int start,int end){ String seq=""; int max = this.maxBasepairs[start][end]; if(start == end) return "."; if(start > end) return ""; if(isValidPair(start,end) && this.maxBasepairs[start+1][end-1]+1 == max) return "("+determBacktrack(start+1,end-1)+")"; if(this.maxBasepa...
8
static final public void expression() throws ParseException { simpleExpr(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case EGAL: case DIFF: case INF: case INFEGAL: case SUP: case SUPEGAL: opRel(); simpleExpr(); expression.testRel(); expression.executerOpRel(); ...
7
public int cardPosition(Game g, Rack r, int card) { int index = indexer.index(g, r, card); int newPlayState = index; int newPlayAction = playStates[index].getLeastVisited(); if (oldPlayState != -1) { playStates[oldPlayState].updateReward(playStates[newPlayState], oldPlayAction); } oldPlayState = ne...
2
public String validaFormulario() { String strMsg = ""; if (jrbAdaptativa.isSelected() == false && jrbCorretiva.isSelected() == false && jrbPerfectiva.isSelected() == false) { jrbAdaptativa.setForeground(Color.red); jrbCorretiva.setForeground(Color.red); jrbPerfectiva....
5
public void body() { logger.log(Level.INFO, super.get_name() + " is starting..."); boolean success = sendFailures(); if(success) { Sim_event ev = new Sim_event(); while (Sim_system.running()) { super.sim_get_next(ev); ...
3
ImportBinding[] getDefaultImports() { // initialize the default imports if necessary... share the default java.lang.* import Binding importBinding = environment.defaultPackage; // if (importBinding != null) // importBinding = ((PackageBinding) importBinding).getTypeOrPackage(JAVA_LANG[1]); // abort if java.lang ca...
9
public void build() throws Exception { if (build != null) { build.run(); } else { System.err.println(" No build file to run."); } }
1
public MyButton() { super(); setBorderPainted(false); setFocusPainted(false); addMouseListener(this); }
0
@Override public boolean equals(Object obj){ if (obj.getClass() != this.getClass()) { return false; } if (this == obj) { return true; } if (obj == null) { //DEBUG - System.out.println("Object is null"); return false; } //Cast other object to type Contact Contact otherContact = (Contact) obj...
6
public CFDao getCfDao() { return cfDao; }
0
public void onKeyPressed(int key) { if(key == Input.KEY_A) this.addFacing(new Vector2f(-1.0F, 0)); else if(key == Input.KEY_D) this.addFacing(new Vector2f(1.0F, 0)); else if(key == Input.KEY_W) this.addFacing(new Vector2f(0, -1.0F)); else if(key == Input.KEY_S) this.addFacing(new Vector2f(0, 1.0F))...
9
public void stop() { if (state < 2) return; if (Score.size() < settings.getInt(Setting.MinimumPlayers)) { String message = settings.getString(Setting.FinishMessageNotEnoughPlayers); message = message.replace("<World>", name); Util.Broadcast(message); } else { RewardManager.RewardWinners(this); ...
9
@Override public Set<ServerEndpointConfig> getEndpointConfigs(Set<Class<? extends Endpoint>> scanned) { Set<ServerEndpointConfig> result = new HashSet<>(); if (scanned.contains(UserEndpoint.class)) { result.add(ServerEndpointConfig.Builder.create(UserEndpoint.class, "/socket/listen").build()); result.add(S...
2
private void defaultStudent(HSSFRow row, CourseBean course) { HSSFCell cell = null; cell = row.getCell(0); Integer i = null; Long L = null; List<StudentBean> list = course.getStudents(); StudentBean student = new StudentBean(); String first = getCellValue(cell); if (first != null && first.length() > 0)...
8
public static SequenceIndex selectIsaPropositions(Cons pattern) { { Stella_Object renamed_Object = pattern.rest.rest.value; SequenceIndex index = Logic.unfilteredDependentIsaPropositions(renamed_Object); if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(index), Logic.SGT_LOGIC_PAGING_INDEX)) { ...
7
public void setFesCedula(long fesCedula) { this.fesCedula = fesCedula; }
0
public static HandshakeBuilder translateHandshakeHttp( ByteBuffer buf, Role role ) throws InvalidHandshakeException , IncompleteHandshakeException { HandshakeBuilder handshake; String line = readStringLine( buf ); if( line == null ) throw new IncompleteHandshakeException( buf.capacity() + 128 ); String[] f...
7
private String calculate(String x) throws MathParsingException { Matcher m; x = x.replaceAll("[ ]+", " "); // Cas de base : un chiffre if(this.regex(x, "^ [-]?[0-9.]+ $").matches()) return " " + x + " "; // Traitement des log m = this.regex(x, "^(.*)log ([-]?[0-9.]+)(.*)$"); if(m.matche...
7
public void rota(){ switch(orientacio){ case NORD: orientacio = Orientacio.EST; break; case EST: orientacio = Orientacio.SUD; break; case SUD: orientacio = Orientacio.OEST; break; ...
4
public void init() { // pocet portov a ich hodnoty in.print("* ports : " + ports.size()); ArrayList<Integer> portsz = new ArrayList<Integer>(); for (Integer i : ports) portsz.add(i); long seed = System.nanoTime(); Collections.shuffle(portsz, new Random(seed));...
3
private void writeJSON(Object value) throws JSONException { if (JSONObject.NULL.equals(value)) { write(zipNull, 3); } else if (Boolean.FALSE.equals(value)) { write(zipFalse, 3); } else if (Boolean.TRUE.equals(value)) { write(zipTrue, 3); } else { ...
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(ID())!=null) { mob.tell(target,null,null,L("<S-NAME> already <S...
8
public boolean isNearlyUpperTriagonal(double tolerance){ boolean test = true; for(int i=0; i<this.numberOfRows; i++){ for(int j=0; j<this.numberOfColumns; j++){ if(j<i && Math.abs(this.matrix[i][j])>Math.abs(tolerance))test = false; } } ret...
4
static final public void Q2() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case MULTIPLY: case DIVIDE: case MODULO: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case MULTIPLY: jj_consume_token(MULTIPLY); R(); Q2(); break; case DIVIDE: ...
8
public long startEvolution(long cycleLimit) { long cycle = 0; boolean finalForm = false; List <E>newList = null; A : while(cycle < cycleLimit && finalForm == false){ int maxFitness = problemSet.getProblems().size(); //calculate fitness values for(E c : candidates){ //c.checkViabilityAndReset...
8
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); switch (oContexto.getSearchingFor()) { case "hilo": { oContexto.setVista("jsp/hilo/list.jsp"); ...
4
private void flipColors(IntervalNode h) { // h must have opposite color of its two children assert (h != null) && (h.left != null) && (h.right != null); assert (!isRed(h) && isRed(h.left) && isRed(h.right)) || (isRed(h) && !isRed(h.left) && !isRed(h.right)); h.color = !h.color; h.left.color = !h.left.colo...
7
private void buildSpecialTrees(final Map catchBodies, final Map labelPos) { Tree tree; tree = new Tree(srcBlock, new OperandStack()); srcBlock.setTree(tree); tree = new Tree(snkBlock, new OperandStack()); snkBlock.setTree(tree); tree = new Tree(iniBlock, new OperandStack()); iniBlock.setTree(tree); ...
2
private void permuteImp(ArrayList<ArrayList<Integer>> res, ArrayList<Integer> tmp, int[] num, boolean[] visited) { //if all checked, return if (tmp.size() == num.length) { res.add(new ArrayList<Integer>(tmp)); return; } for (int i = 0; i < num.length; i++) { ...
5
public static boolean areMoreVariablesThatBelongInUsefulVariableSet( Grammar grammar, Set set) { if (getVariableThatBelongsInUsefulVariableSet(grammar, set) == null) return false; return true; }
1
@Override public void execute(VGDLSprite sprite1, VGDLSprite sprite2, Game game) { ArrayList<Integer> subtypes = game.getSubTypes(itype); for (Integer i: subtypes) { Iterator<VGDLSprite> spriteIt = game.getSpriteGroup(i); if (spriteIt != null) while (spriteIt.hasNext()) ...
4
public void paint(Graphics g){ //g.drawImage(this.bodypart.getIcon(), 0, 0, null); g.drawString(this.bodypart.getName(), 8, 18); g.setColor(Color.ORANGE); Upgrade[] upgrades = this.bodypart.getUpgrades(); for(int i = 0; i < upgrades.length; i++){ if(upgrades[i] == null) continue; g.drawString(upgrades[i...
2
public int deleteBook(String bookID) { try { // Erforderlicher SQL-Befehl String sqlStatement = "DELETE FROM bookworm_database.books WHERE id = " + bookID + ";"; // SQL-Befehl wird ausgeführt successful = mySQLDatabase.executeSQLUpdate(sqlStatement); return successful; } catch (Exception e) ...
1
protected void initialize() { _timer.start(); }
0
public Ul(HtmlMidNode parent, HtmlAttributeToken[] attrs){ super(parent, attrs); for(HtmlAttributeToken attr:attrs){ String v = attr.getAttrValue(); switch(attr.getAttrName()){ case "compact": compact = Compact.parse(this, v); break; case "type": type = Type.parse(this, v); break;...
3
public int getClueNumber(int x, int y) { int foundMines = 0; for(int j = y - 1; j <= y + 1; j++) { for(int i = x - 1; i <= x + 1; i++) { if(j == y && i == x) { continue; } else if(j < 0 || i < 0 || !(j < mineFieldGrid.length) || !(i < mineFieldGrid[j].length)) { continue; } else { ...
9
public static String stripEnd(String str, String stripChars) { int end; if (str == null || (end = str.length()) == 0) { return str; } if (stripChars == null) { while (end != 0 && Character.isWhitespace(str.charAt(end - 1))) { end--; } } else if (stripChars.length() == 0) { return str; } els...
8
public String fourthFieldTrans(String field, int min, int max) { String newField = ""; System.out.println("test"); if(field.substring(0, 1).equals("*")) { newField = "EVERY"; } else if(field.length() > 1) { if(!isWeekLetter(field.substr...
3
public Chunk(World w, int x, int y, int z) { data = new boolean[chunkW * chunkH * chunkD]; chunkX = x; chunkY = y; chunkZ = z; for (int xx = 0; xx < chunkW; xx++) { for (int yy = 0; yy < chunkH; yy++) { for (int zz = 0; zz < chunkD; zz++) { if(noiseGen(((float)xx + (float)chunkX), ((float)yy + (fl...
4
public Scan(String args[]) { // the constructor // open an input file if one specified on command line. // o.w., use standard input. try { if (args.length == 0) { InputStreamReader isr = new InputStreamReader(System.in); br = new BufferedReader(isr); ...
3