text
stringlengths
14
410k
label
int32
0
9
public void initDBConnection() { try { if (connection != null) return; System.out.println("Creating Connection to Database..."); Class.forName("org.sqlite.JDBC"); connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH); if (!connection.isClosed()) System.out.println("...Connection es...
8
public static void main(String[] args) { CalcFrame calcFrame = new CalcFrame(); calcFrame.menuFrame(); }
0
public void parse_bill(String data_bill){ data_bill="p"+data_bill; isBill=false; //Service.WriteLog(data_bill); try { MyBill b = MyBill.valueOf(data_bill); switch (b) { case p020307810246090000000000: isBill=true; ...
9
public static Entreprise SelectEntrepriseById(int id) throws SQLException { String query = null; Entreprise entreprise = new Entreprise(); ResultSet resultat; try { query = "SELECT * from ENTREPRISE where ID_ENTREPRISE=? "; PreparedStatement pStatement = Connect...
2
public static void render(String msg, int x, int y, int color, float scale, boolean outline, Screen screen){ if(x == -1) x = (int) ((screen.width / 2) - ((msg.length() / 2) * (SPACING * scale))); if(y == -1) y = (int) ((screen.height / 2) - (SIZE * scale)); if(msg == null) System.err.println("Could not draw fo...
6
public static void convertPointFromScreen(Point pt, Component component) { while (component != null) { pt.x -= component.getX(); pt.y -= component.getY(); if (component instanceof Window) { break; } component = component.getParent(); } }
2
public double classifyInstance(Instance instance) throws Exception { double result; double[] dist; int index; switch (m_CombinationRule) { case AVERAGE_RULE: case PRODUCT_RULE: case MAJORITY_VOTING_RULE: case MIN_RULE: case MAX_RULE: dist = distributionForInstance(ins...
9
private void drawTile(int x, int y, TileType type, Graphics g) { /* * Because each type of tile is drawn differently, it's easiest * to just run through a switch statement rather than come up with some * overly complex code to handle everything. */ switch(type) { /* * A fruit is depicted as a sm...
7
public void paintComponent(Graphics g) { g.setColor(Colors.lightgrey); g.fillRect(scale, scale, length * scale, width * scale); g.drawImage(field, scale, scale, length * scale, width * scale, board); for (int x = 0; x < width; x++) { for (int y = 0; y < length; y++) { ...
9
@Override public boolean run(Camera camera, FrameBuffer buffer){ boolean doLoop; doLoop = true; adapter = new AdapterPhysics(world); long ticks = ticker.getTicks(); if (ticks > 0) { //рассчитываем все силы и считаем новые местоположения объектов ...
4
public float getUser_dailyRatio() { float ratio = (float)getUser_point_win()-(float)getUser_point_lost(); int nbdays = getUser_numberOfDay(); if(nbdays>0) ratio /= (float)nbdays; return ratio; }
1
private static int getMonitorExitSlot(StructuredBlock stmt) { if (stmt instanceof InstructionBlock) { Expression instr = ((InstructionBlock) stmt).getInstruction(); if (instr instanceof MonitorExitOperator) { MonitorExitOperator monExit = (MonitorExitOperator) instr; if (monExit.getFreeOperandCount() ==...
4
public String getAccountNumber() { for (int i = 0; i < 9; i++) { if (i == 0) { accountNumber = numbers[i].toString(); } else { accountNumber += numbers[i].toString(); } } if (amountOfPossibleNumbers > 1) { getMultipleAccountNumbers(); } if (possibleAccountNumbers.length == 1) { account...
4
public static void removeNode(Node n){ // remove the outgoing connections from neighbor to this nodes // TODO: This is really expensive! Can't we have a better data structure? // The problem so far is the 'getRandomNode' method Enumeration<Node> nodeEnumer = nodes.getNodeEnumeration(); while(nodeEnumer....
3
public boolean isIsomorphic( Graph other ) { Node current,otherCurrent; NodeQueue q = new NodeQueue(); NodeQueue otherQueue = new NodeQueue(); q.push( graph.start ); otherQueue.push( other.start ); current = graph.start; int numArcs = 0; otherCurrent = other.start; while ( !q.isEmpty() && !otherQueue...
7
public boolean deleteLink(int posicion) {//deletes the link on the position of the parameter if (posicion >= 0 && posicion <= links.getLength()) {//if position is in a valid range. links.remove(posicion);//deletes from links list the element of that position actual_links--;//reduces vari...
2
private void addStatisticsDisplayChoiceListener( final JComboBox<String> fieldsForStats) { fieldsForStats.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { int index = fieldsForStats.getSelectedIndex(); if (index == 82 && !averageDividend.isSelected(...
2
protected static String processGreek(String text) { text = text.replace("יוונית|", ""); String arr[] = text.split("\\|"); if (arr.length >= 2) { text = "<span data-transliterationLanguage=\"grc\">" + arr[1] + "</span>) <span lang=\"grc\">" + ar...
1
public BufferedImage getApplicationIconImage() { if (isMac()) { try { Class<?> nsDataClass = Class.forName("com.apple.cocoa.foundation.NSData"); Class<?> nsImageClass = Class.forName("com.apple.cocoa.application.NSImage"); Object application = getNSA...
9
public int compareTo(Object obj) { if (!(obj instanceof CmapSubtable)) { return -1; } CmapSubtable cms = (CmapSubtable) obj; if (platformID < cms.platformID) { return -1; } else if (platformID > cms.platformID) { ...
5
public void setIndent(int indent, boolean relative) throws RuntimeException { if (indent == 0 && !relative) { this.indentString = baseIndentString; } else if (indent > 0) { char[] ind = new char[indent]; Arrays.fill(ind, ' '); String offset = this.indentString.copyValueOf(ind); if ...
7
public TwoWordContextModel(File file) { super(file); wordTypes = new HashSet<String>(); Scanner scanner = null; try { scanner = new Scanner(file); } catch (FileNotFoundException e) { System.out.println("Error occured with: "+ file.getAbsolutePath()); System.out.println("Program will exit"); e.prin...
7
public QuestionDAOImpl(){ q = null; try { FileInputStream fileIn = new FileInputStream("question.ser"); ObjectInputStream in = new ObjectInputStream(fileIn); q = (Question) in.readObject(); in.close(); fileIn.close(); }catch(IOExcept...
2
public static void prev() { try { if(currentPlayback != null && prevTrack != null) { setCurrentTrack(prevTrack); play(); } } catch (MediaException e) { System.out.println("Invalid media type."); } }
3
private int theNumberOfMaterialIsAvailableForThisDay(Loan loan, GregorianCalendar calendar) { int quantity = this.getStock().getQuantity(loan.getName()); for (Loan l : this.getStock().getLoans()) { if (l.getName().equals(loan.getName())) { if (0 >= l.getStart(...
4
public void testAddResponses() throws Exception { Responses rsps=new Responses(10, true); System.out.println("rsps = " + rsps); assert !rsps.isDone(); for(int i=0; i < 5; i++) rsps.addResponse(new PingData(addrs[i], true, names[i], phys_addrs[i]), false); System.out.p...
8
protected String removeJavaScriptProtocol(String source) { //remove javascript: from inline events String result = source; Matcher matcher = eventJsProtocolPattern.matcher(source); if(matcher.matches()) { result = matcher.replaceFirst("$1"); } if(generateStatistics) { statistics.setPreservedSize...
2
private static void registerPluginForMimeType(String[] indexFiles, String mimeType, WebServerPlugin plugin, Map<String, String> commandLineOptions) { if (mimeType == null || plugin == null) { return; } if (indexFiles != null) { for (String filename : indexFiles) { ...
5
public void setDigitalizacion(int muestreo_1, int muestreo_2, int [] LUT){ int i = 0; int j = 0; int avanceJ = 0; int avanceI = 0; int pixel_i = 0; int pixel_j = 0; int muestreo_original_1 = muestreo_1; int muestreo_original_2 = muestreo_2; boolean visitado = false; Color color; for( ; i < muestr...
8
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 static void exportImageAsSpreadSheet(SegmentedImage image, String oName){ Workbook wb = new HSSFWorkbook(); dumpImageToSheet(image, wb); try{ FileOutputStream out = new FileOutputStream(oName + ".xls"); wb.write(out); out.close(); } catch (Exception e){ e.printStackTrace(); } }
1
public ProxiedPlayer getClosestPlayer(String player) { String name = player.toLowerCase(); for (ProxiedPlayer data : plugin.getProxy().getPlayers()) if (data.getName().toLowerCase().startsWith(name)) { return data; } return null; }
2
public final static boolean compareStringArraysIgnoreCase(final String[] A1, final String[] A2) { if(((A1==null)||(A1.length==0)) &&((A2==null)||(A2.length==0))) return true; if((A1==null)||(A2==null)) return false; if(A1.length!=A2.length) return false; for(int a1=0;a1<A1.length;a1++) { if(!A1...
9
public FileLineTO readFileLine() throws FileNotFoundException { FileLineTO fileLineTo = null; FileTO fileTo = null; LineTO lineTo = null; if (filenamePointer < 0) { if (filenameList.length > 0) { filenamePointer = 0;...
8
private TorrentInfoSection ( long pieceLength, List<Sha1Hash> pieceHashes, boolean priv, String baseDir, List<TorrentFileInfo> files, Sha1Hash hash, String name) { if ((baseDir == null | hash == null | name == null) || pieceHashes.contains(null) || files.contains(null)) { throw n...
5
@Override public Object nextElement() { if (!hasMoreElements()) {return null;} endIndex = text.indexOf(match,startIndex); if (endIndex == -1) { endIndex = text.length(); } String token = text.substring(startIndex,endIndex); startIndex = endIndex + matchLength; if (startIndex >= text.length())...
3
private void UpdateNomeEquipamento() { //ler o nome String nomeEquipamentoUpdate = jTextFieldNovoNomeEquipp.getText(); boolean jaExiste = false; if (nomeEquipamentoUpdate.equals("")) { JOptionPane.showMessageDialog(null, "DEVE preencher o campo do Nome", "CAMPO OBRIGATÓRIO"...
7
public int getyNopeus() { return yNopeus; }
0
@Test public void testGetResting() throws IOException { System.out.println("getResting"); AntBrain b = new AntBrain("cleverbrain1.brain"); Ant instance = new Ant(b,true,0); int expResult = 0; int result = instance.getResting(); assertEquals(expResult, result)...
0
@Override public Object getValueAt(int i, int i1) { SimpleMeal retrievedSimpleMeal = mealList.get(i); switch (i1) { case NAME_COLUMN: return retrievedSimpleMeal.getName(); case CALORIES_COLUMN: return retrievedSimpleMeal.getCalories(); ...
4
void createPassAutPage() { composite = new Composite(shlNewAccount, SWT.NONE); composite.setLayout(new FormLayout()); Label lblBeforeCreatingA = new Label(composite, SWT.NONE); FormData fd_lblBeforeCreatingA = new FormData(); fd_lblBeforeCreatingA.left = new FormAttachment(0, 10); fd_lblBeforeCreatingA....
3
public Auction(String title, String duration, String auctionType, String desc, String img, String lowPrice, String startPrice, String buyout, String delivery, Account seller, String category, String time) { titleInt = title; durationInt = duration; auctionTypeInt = auctionType; descInt = desc; i...
0
private JButton generateBut() { JButton but = new JButton( new ImageIcon(((new ImageIcon(this.getClass().getResource( "/Image/icon.jpg"))).getImage()).getScaledInstance(150, 130, java.awt.Image.SCALE_SMOOTH))); but.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ...
8
public String getClassString(ClassInfo clazz) { String name = clazz.getName(); if (cachedClassNames == null) /* We are not yet clean, return the full name */ return name; /* First look in our cache. */ String cached = (String) cachedClassNames.get(name); if (cached != null) return cached; int pkg...
6
public static void main(String... args) throws IOException { MyScanner sc = new MyScanner(); Map<Character, Integer> w = new HashMap<>(); //'Q', the rook — as 'R', the bishop — as'B', the knight — as 'N', the pawn — as 'P', the king — as 'K'. // the queen's weight is 9, ...
7
private final boolean doublec(int j) { if (j < 1) return false; if (b[j] != b[j-1]) return false; return cons(j); }
2
public void render() { BufferStrategy bs = getBufferStrategy(); if (bs == null) { createBufferStrategy(3); requestFocus(); return; } activeComponent.render(screen); Graphics g = bs.getDrawGraphics(); g.drawImage(image, 0, 0, getWidth(), getHeight(), null); g.dispose(); bs.show(); }
1
public static boolean canJump(int[] A) { int max = 0; for (int i = 0; i < A.length; i++) { if (max < i) return false; if (max >= A.length - 1) return true; if (i + A[i] > max) max = i + A[i]; } return false; }
4
@Override public void render(final Graphics g) { Image drawImage = ImageUtils.rotateImage(img, Math.toDegrees(rotationAngle)); int width = drawImage.getWidth(null); if (engineLeft) g.drawImage(ImageUtils.rotateImage(ImageLoader.ship_engine_left, Math.toDegrees(rotationAngle)), pos.x() - width / 2, pos.y...
3
public Result find(List<DBItem> searchOn){ File xml = new File("Databases/" + name + ".xml"); SAXBuilder builder = new SAXBuilder(); boolean findAll = searchOn == null ? true : false; try{ Document document = (Document) builder.build(xml); Element rootNode = document.getRootElement(); Res...
9
public void reissueWithResponse( long challenge, StopWatch watch ) { HttpURLConnection conn = null; try { byte[] encrypted_response = null; Signature signer = Signature.getInstance("SHA1withRSA"); signer.initSign(keys.getPrivate()); signer.update(ByteManip.ltob(challenge+1)); encrypted_respon...
5
public SoundBuffer readAll() { if( module == null ) { errorMessage( "Module null in method 'readAll'" ); return null; } // Check to make sure there is an audio format: if( myAudioFormat == null ) { errorMessage( "Audio Format null ...
7
public void testClient() { CameraClientThread cameraClient = new CameraClientThread(); cameraClient.start(); PathinfoThread pathinfoThread = new PathinfoThread(); pathinfoThread.start(); try { pathinfoThread.join(); cameraClient.join(); } catch (InterruptedException e) { // TODO Auto-generate...
1
@Override public String toString() { StringBuilder sb = new StringBuilder(); // start cell tag sb.append( "<" ); sb.append( tagName ); if ( className !=null && className.length()>0 ) { sb.append( " class=\"" ); sb.append( className ); ...
4
double getNiceLower( double ovalue ) { // Add some checks double gridFactor = 1.0; double mGridFactor = 1.0; double gridStep = this.gridStep; double mGridStep = this.labelStep; while ( gridStep < 10.0 ) { gridStep *= 10; gridFactor *= 10; } while ( mGridStep < 10.0 ) { mGridStep *= 10; ...
8
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 void populatePuzzle(String filename) throws IOException{ FileReader fr; BufferedReader buff; try{ fr = new FileReader(filename); buff = new BufferedReader(fr); String line = buff.readLine(); //one line in the file per row in the...
4
public InetSocketAddress getSocketAddress() { return this.address; }
0
public void stopCreatingCollection() { if (creatingCollection) { screenManager.removeImageButton("Add File"); screenManager.removeImageButton("Set Key"); screenManager.removeImageButton("Save Collection"); cp5.getController("enter collection name").setVisible(false); } creatingCollection = false; }
1
public void doit_wait() throws JRexecException { if(thread!=null) return; // ?? try { write(); byte[] b=new byte[1]; in.read(b, 0, 1); byte[] buf=new byte[1024]; if(b[0]==0){ // success while(true){ int len=in.read(buf, 0, buf.length); if(len==-1) break; //...
9
private void makeGrassRandom() { for (int i = 0; i < mapWidth; i++) { for (int k = 0; k < mapHeight; k++) { if (map[i][k] == Tile.grass) { boolean generateTile = new Random().nextBoolean(); if (generateTile) map[i][k] = Tile.grass2; } } } }
4
public static String inferDriverClassName(String url) { return match(url, name -> { switch (name) { case "h2": return "org.h2.Driver"; case "hsqldb": return "org.hsqldb.jdbc.JDBCDriver"; case "sqlite": return "org.sq...
8
private void balanceReplicas() throws Exception { int formerSize = replicas.size(); int numMembers = members.size(); List<Future<Object>> futureResponses = new ArrayList<>(); while (replicas.size() > (formerSize +1) * (numMembers - 1) / numMembers) { SignalInfo sInfo2; BlockingQueue<SignalInfo> list; ...
7
private void checkEnemies() { GameActor a = getOwningActor(); PhysicsComponent pc = (PhysicsComponent)a.getComponent("PhysicsComponent"); WeaponsComponent wc = (WeaponsComponent)a.getComponent("WeaponsComponent"); float cx = pc.getX(); float cy = pc.getY(); ...
6
public void writetoLocale(){ LoadLocaleConstants myLocale = new LoadLocaleConstants(); myLocale.writetoProperties(); }
0
public boolean titelErwerben( int indexTitel, int gold, ArrayList<Land> laendereien ) { // ist bereits König if ( this.titel.getTitel( this.indexTitel ).equals( "Koenig" ) ) { return false; } int titelKostet = titel.getGold() * indexTitel; // Titelkosten int benoetigteLaender = titel.getLandmin(...
3
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb = sb.append(this.indiceDeRegla).append(". ("); for (int i = 0; i < this.causantes.size(); i++) { String s = this.causantes.get(i); sb = sb.append(s); if ((this.causantes.size...
2
final public void LetExp() throws ParseException {/*@bgen(jjtree) LetExp */ SimpleNode jjtn000 = (SimpleNode)SimpleNode.jjtCreate(this, JJTLETEXP); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(LET); Variable(); jj_consume_token(EQUAL); Expression(); ...
8
private void generateElementsRankHints(PrintStream out) { Multimap<String, Element> rankMap = new Multimap<String, Element>(); for (Element element : repository.elements()) { String rank = element.getStyle("rank"); if(rank!=null) { rankMap.add(rank, element); ...
5
public ArrayList<Outbreak> createOutbreaksFromFile(String filename) throws IOException { ArrayList<Outbreak> myOutbreaks = new ArrayList<Outbreak>(); boolean useRandomLocation = false; try { CSVReader reader = new CSVReader(new FileReader(filename), '\t'); String[] nextLine; while ((nextLine = reader.rea...
3
private static int calculateFactor(double value) { int factor = 0; while (true) { if (factor == MAX_PRECISION - 1) { break; } double temp = value * pow(factor); if (temp >= MAX_VALUE.base) { break; } if (temp == (long) temp) { if (temp == (long) (temp / 10) * 10) { factor-...
5
public void DBReadFollowers(MOB mob, boolean bringToLife) { Room location=mob.location(); if(location==null) location=mob.getStartRoom(); final List<MOB> V=DBScanFollowers(mob.Name()); for(int v=0;v<V.size();v++) { final MOB newMOB=V.get(v); final Room room=(location==null)?newMOB.getStartRoom():loc...
8
@Override public boolean execute(MOB mob, List<String> commands, int metaFlags) throws java.io.IOException { if(!mob.isMonster()) { boolean quiet=false; if((commands!=null) &&(commands.size()>1) &&(commands.get(1).toUpperCase().equals("QUIET"))) { quiet=true; } if((mob.isAttributeSet(MO...
8
public boolean setEntriesSet(int row, boolean withBlocks) { entriesSet++; if (withBlocks && blocks != null) { if (blocks.size() == 1) { blocks.get(0).increaseEntriesSet(row); } else if (blocks.size() > 1) { ArrayList<Integer> indeces = new ArrayList<Integer>(); ...
9
public void RemoveListener() { if (UI.instance != null && UI.instance.menugrid != null && action.length > 1) UI.instance.menugrid.listeners.remove(action[1]); }
3
public void validate(Object param, Object value) { if (param instanceof String) { isLessThanEqualsToString((String) param, value); } else if (param instanceof Integer) { isLessThanEqualsToInteger((Integer) param, value); } else if (param instanceof Boolean) { throw new IllegalArgumentException(); } els...
4
public Set<Map.Entry<Double,Short>> entrySet() { return new AbstractSet<Map.Entry<Double,Short>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TDoubleShortMapDecorator.this.isEmpty(); } ...
8
public Point3f findPointOnPlane(char direction, int x, int y, float c) { if (tempMatrix4f == null) tempMatrix4f = new Matrix4f(); tempMatrix4f.setIdentity(); tempMatrix4f.invert(transformManager.matrixTransform); float xa = 0, ya = 0, za = 0; if (pmin == null) pmin = new Point3f(); pmin.set(transformM...
7
public void applyTerrain(Terrain terrain, Card card, boolean inverse) { MonsterCard mc = null; if (MonsterCard.class.isInstance(card)) { mc = MonsterCard.class.cast(card); if (terrain.favors.contains(mc.type)) { if (inverse) mc.bonus -= 500; else mc.bonus += 500; } else if (terrain.unfavo...
5
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=(givenTarget instanceof MOB)?(MOB)givenTarget:mob; if(target.fetchEffect(ID())!=null) { target.tell(L("You are no longer automatically detecting traps.")); target.delEffect(m...
7
public static void saveCategory(Target target) { String s = target.getNewTopic(); String s1 = target.getNewThat(); boolean flag; if(s == null) flag = false; else if(s.trim().length() == 0 || s.equals("*")) flag = false; else ...
9
public void addGateComponent(Component gateComponent) { flowLayoutGatesPanel.add(gateComponent); if(flowLayout) { flowLayoutGatesPanel.revalidate(); flowLayoutGatesPanel.repaint(); } else { Component[] components = nullLayoutGatesPanel.getComponents()...
7
public void analyseRecord(int id, byte[] record) throws IOException { ByteArrayInputStream bis = new ByteArrayInputStream(record); DataInputStream dis = new DataInputStream(bis); long trip_stamp = dis.readLong(); dis.readUTF(); dis.readByte(); // should be 0xFE long ts = dis.readLong(); if (collectedR...
9
public static void findYearDefects(Scanner ifile2, String defectYear) { int fieldCount = 0; int fieldsPerRecord = 2; String defectCount = ""; /* defect count listed for a given year */ String defectYearCount = ""; /* the defect count listed for defectYear */ boole...
4
private void updateBonds(State xcurr) { double pb = 0; int x = 0; int y = 0; for (int i = 0; i < _dim; i++) { for (int j = 0; j < _dim; j++) { coord: for (int k = 0; k < 1; k++) { if (k == 0) { //Spin...
8
public String[] parseCounterExampleWithChangeVariablesFromTrace(PreferenceMetaData pmd) throws FileNotFoundException, IOException { Set<String> variablesTrueInOutcome = new HashSet<String>(); BufferedReader reader = new BufferedReader (new FileReader(pmd.getCounterExampleFile())); String nextLine; try{ ...
8
private void remove() { for(int i = 0; i < entities.size(); i++) { if(entities.get(i).isRemoved()) { entities.remove(i); } } for(int i = 0; i < projectiles.size(); i++) { if(projectiles.get(i).isRemoved()) { projectiles.remove(i); } } for(int i = 0; i < particles.size(); i++) { if(partic...
8
public void stayAboard(Rider R) { final Room rideR=CMLib.map().roomLocation(rideable); if((rideR!=null) &&((CMLib.map().roomLocation(R)!=rideR) ||(R.riding()!=rideable))) { if(R.riding()!=null) R.setRiding(null); if(CMLib.map().roomLocation(R)!=rideR) if(R instanceof Item) rideR.moveItemT...
7
@Override public boolean activate() { //Inv full final boolean valid = workLeft(); if ((valid && (GraniteMiner.curState == GraniteMiner.Status.NONE))) { GraniteMiner.curState = THIS_STATE; } else if (!valid && (GraniteMiner.curState == THIS_STATE)) { GraniteM...
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Card card = (Card) o; if (value != card.value) return false; return true; }
4
private static String[] tokenize(String parOut) { List<String> tokens = new ArrayList<String>(); int current = 0; int length = parOut.length(); String token = new String(""); while (current < length) { char nextChar = parOut.charAt(current++); if (nextChar == '(') { if (!token.isEmpty()) { tokens...
8
private static ArrayList<ArrayList<Double>> collect_initial_conditions(String grid_file_address,FwyNetwork fwy) throws Exception { // create the list of initial densities to test ArrayList<ArrayList<Double>> all_ic = new ArrayList<ArrayList<Double>>(); try { // read grid points ...
8
public boolean acceptOffer(Request RequestX){ float cost = RequestX.getUnitPrice()*RequestX.getAsset(); String assetType = RequestX.getAssetType(); if(RequestX instanceof BuyRequest){ if((this.getAsset(RequestX.getAssetType())-RequestX.getAsset())<0){ //popup...
6
public BEValue bdecodeBytes() throws IOException { int c = this.getNextIndicator(); int num = c - '0'; if (num < 0 || num > 9) throw new InvalidBEncodingException("Number expected, not '" + (char)c + "'"); this.indicator = 0; c = this.read(); int i = c - '0'; while (i >= 0 && i <= 9) { // Th...
5
public void produceGoods() { new Thread("produkcja: " + this.getName()) { public void run() { while(population > 0) { consumeGoods(); if(isShoudProduce()) { for(Stock s : warehouse.storedGoods.values()) { Stock.StockType type = s.getType(); if(warehouse....
6
public int findMove(int index, int offset, int player) { int nextIndex = index + offset; if (indexIsOutOfBounds(nextIndex)) return INVALIDMOVE; else if (boardArray[nextIndex] == OPEN) return nextIndex; else if (boardArray[nextIndex] == opponent(player)) return findMove(nextIn...
3
private static void setAtribute(String row, Data d) { if (startWith(row, ATTRIBUTE)) { String data = pureData(row, ATTRIBUTE); Matcher m = null; if ((m = getMatcher("'([\\w0-9\\-_]+)'\\s+\\{(.*)\\}", row)).find()) { d.addAttribute(m.group(1), m.group(2).replaceAll("[\' ]", "") .split(",")); d....
3
public void addToConversation(Message input) { //Adding a single person to a conversation if (input.getCode() == 601) { if (Conversations.containsKey(input.ConversationID)) { Conversations.get(input.ConversationID).AddUser(input.User); GUI.updateConvoUsers(inp...
9
@Override public void caseAParanthesisHexp(AParanthesisHexp node) { inAParanthesisHexp(node); if(node.getRPar() != null) { node.getRPar().apply(this); } if(node.getExp() != null) { node.getExp().apply(this); } if(node.getLPa...
3
public String getAttributeFirstVal(String asName) { String lsVal = null; Attribute laAttr = getAttribute(asName); if (laAttr != null) { lsVal = laAttr.getVal(); } return lsVal; }
1