text
stringlengths
14
410k
label
int32
0
9
public String toString() { return "[" + grades[0] + " " + grades[1] + " " + grades[2] + "]" ; }
0
private boolean range(int x, int y ,int[] original_color,int range) { int rgb[] = new int[3]; if(rgb[0] >= original_color[0] +range || rgb[0] <= original_color[0] - range || rgb[1] >= original_color[1] +range || rgb[1] <= original_color[1] -range || rgb[2] >= original_color[2] +range || rgb[2] <= original_...
6
private boolean isNameUnique(FileProtocol protocolToCheck) { for (int i = 0, limit = protocols.size(); i < limit; i++) { FileProtocol protocol = (FileProtocol) protocols.get(i); if (protocol.getName().equals(protocolToCheck.getName())) { return false; } } return true; }
2
@Override public void run() { initializeLogger(); BufferedReader commandReader = new BufferedReader( new InputStreamReader(System.in)); String commandLine; while (true) { commandLine = readLine(commandReader); String[] commandArgument = commandLine.split(" "); this.log.info("split command line: "...
3
public boolean setmin(int min) { if(min>0&&min<60) { _min=min; return true; } else return false; }
2
public location(String id){ super(id); }
0
public IDGrabber(String link) { this.link = link; }
0
public void displayMessage(String message, int type) { StyledDocument doc = chatWindow.getStyledDocument(); SimpleAttributeSet keyWord = new SimpleAttributeSet(); StyleConstants.setForeground(keyWord, Color.BLUE); final String finalmessage; String prefix = null; if (type ...
6
public ArrayList<TeamObject> readTeamObject() { ArrayList<TeamObject> match = new ArrayList<TeamObject>(); try { CsvReader teams = new CsvReader(path); teams.readHeaders(); while (teams.readRecord()) { TeamObject read = new...
3
private void calcImageSizes() { double labelRatio = (double) getWidth() / (double) getHeight(); double imageRatio = (double) image.imagewidth / (double) image.imageheight; if (labelRatio <= imageRatio) { imagePosX = 0; imageSizeX = getWidth(); } else { imageSizeX = (int) (getWidth() * (imageRat...
2
public double mean() { //************************** return this.mean; //************************** /* double sum = 0; for (int i = 0; i < inputbuffersize ; i++) { sum=sum+i; } return (sum / inputbuffersize); */ ...
0
private static String getStringFromDocument(Document doc) { try { DOMSource domSource = new DOMSource(doc); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory tf = TransformerFactory.newInstance(); ...
1
public static int deleteRoom(String name) { int del = 0; Iterator<SavedRoom> rmit = Roomy.savedRooms.iterator(); while(rmit.hasNext()) { SavedRoom sv = rmit.next(); if (sv.getName().equalsIgnoreCase(name)) { int index = Roomy.savedRooms.indexOf(sv); if (index >=0) { rmit.remove(); del...
3
static final void updateLocalPlayerMovement() { Class142_Sub27_Sub3.incomingVector.initBitAccess(); int updateFlag = Class142_Sub27_Sub3.incomingVector.readBits(1); if (updateFlag == 0) { return; } int movementFlag = Class142_Sub27_Sub3.incomingVector.readBits(2); ...
9
@Override public void quickPlay( boolean priority, boolean toStream, boolean toLoop, String sourcename, FilenameURL filenameURL, float x, float y, float z, int attModel, float distOrRoll, boolean temporary ) { SoundBuffer b...
6
private String readString() throws JSONException { Kim kim; int from = 0; int thru = 0; int previousFrom = none; int previousThru = 0; if (bit()) { return getAndTick(this.stringkeep, this.bitreader).toString(); } byte[] bytes = new byte[65536];...
9
@Override public int createRenderTarget(int width, int height, int texId) { int fbo = glGenFramebuffersEXT(); FramebufferData data = new FramebufferData(width, height); framebuffers.put(fbo, data); if (texId != 0 && texId != -1) { bindRenderTarget(fbo); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, ...
2
public String toDot() { StringBuilder s = new StringBuilder(); s.append("digraph {\n"); s.append("\tnode [shape=point, color=white, fontcolor=white]; start;\n"); s.append("\tnode [shape=circle, color=black, fontcolor=black];\n"); //a roundabout way of collecting transitions... HashMap<Tuple, ArrayList<Ch...
8
public int hashCode() { return (int)(9 *((hardness == null) ? 0 : hardness.hashCode())); }
1
@Deprecated public static ComplexMatrix multyply2x2(ComplexMatrix a, ComplexMatrix b) { try { return new ComplexMatrix(new Complex[][]{ { a.getElem(0, 0).times(b.getElem(0, 0)) .add(a.getElem(0, 1).times(b.getEle...
1
public Writer write(Writer writer) throws JSONException { try { boolean b = false; Iterator keys = keys(); writer.write('{'); while (keys.hasNext()) { if (b) { writer.write(','); } Object k = ke...
5
@Override public void eigenschaftUpdate() { //early out, wenn wir gerade laden. if(_leveldaten == null) return; RaumBearbeitenPanel bearbeitenPanel = _ui.getBearbeitenPanel(); if(_ui.getMap().buttonAusgewaehlt() && bearbeitenPanel != null) { Raum raum = bearbeitenPanel.getRaum(); RaumEigenschafte...
5
private void playerDead(int coordX, int coordY) { timerUtils.stopTimer(); System.out.println("You are dead."); cellArray[coordX][coordY].type = Cell.CellType.MINEEXPLODED; this.playerIsDead = true; for (int x = 0; x < sizeX; ++x) { for (int y = 0; y < sizeY; ++y) { if (cellArray[x][y].type == Cell....
8
public void loadCfg(String fileName) throws Exception { // load config synchronized(hostCache) { Properties p = new Properties(); p.load(new FileInputStream(fileName)); for (Object k: p.keySet()) { String key = (String)k; String value = p.getProperty(key); // build host record from value Ho...
4
public LocaleBtnPreview(SkinPropertiesVO skin, JPanel parent) { if (skin == null) { IllegalArgumentException iae = new IllegalArgumentException("Wrong parameter!"); throw iae; } this.skin = skin; }
1
public static void main(String[] args) { long max = 0; long maxindex = 0; for (int i = 1; i < 1e6; i++) { // System.out.println(i); long temp = trace(i); if (temp > max) { maxindex = i; max = temp; } } System.out.println(maxindex); }
2
public void synchronizeMenus() { // Get SubMenu Items OutlinerSubMenuItem openMenuItem = (OutlinerSubMenuItem) GUITreeLoader.reg.get(GUITreeComponentRegistry.OPEN_MENU_ITEM); OutlinerSubMenuItem importMenuItem = (OutlinerSubMenuItem) GUITreeLoader.reg.get(GUITreeComponentRegistry.IMPORT_MENU_ITEM); OutlinerSubM...
2
private static void testIsSolved() { // In this test, you'll want to create a new 2D Color array and // reassign the ColumnPuzzle's array in order to test isSolved(). // There are two tests here. You should add other test cases. int tests = 0; int failed = 0; printHeade...
4
private void zzScanError(int errorCode) { String message; try { message = ZZ_ERROR_MSG[errorCode]; } catch (ArrayIndexOutOfBoundsException e) { message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; } throw new Error(message); }
1
public void combat(){ int combatDamage = 0; for(Creature c : p1.getCritters()) if(c.canAtk()) combatDamage += c.getPower(); //System.out.println("Combat Damage " + combatDamage); p1.damage(combatDamage); }
2
void negateBatteryAtPos(int[] changepos) { ArrayList<String> usedAlready = new ArrayList<>(); int currentSlot = 0; // the current slot: if a repeat is encountered it doesn't count as a slot. for (int i = Competition.getInstance().getNextCodeRedMatch(); i < Competition.getInstance().getNextCodeRe...
4
public boolean subscribe() throws Exception { Message message = connection.receive(); System.out.println(message.getPayloadBuffer().toString()); String[] tmp; tmp = message.getPayloadBuffer().toString().split(" ", 2); message.ack(); if(firstMsg == false) {msgP...
5
public static void main(String[] args) { Distance d1 = new Distance(10, "mm"); Distance d2 = new Distance(2.5, "cm"); Distance d3 = d1.add(d2); Point p1 = new Point(new Distance(10, "mm"), new Distance(15, "mm")); Point p2 = new Point(new Distance(30, "mm"), new Distance(50, "mm")); Point p3 = new Point(ne...
1
public void validate(Object paramValue, Object value) { if (paramValue instanceof String) { isGreaterThanString((String) paramValue, value); } else if (paramValue instanceof Integer) { isGreaterThanInteger((Integer) paramValue, value); } else if (paramValue instanceof Boolean) { throw new IllegalArgument...
4
public PokemonManager getInstance() { if(instance == null) instance = new PokemonManager(); return instance; }
1
public boolean canJump(int[] A) { int n = A.length; if (n==0){ return false; } boolean[] result = new boolean[n]; result[0]=true; for (int k=1;k<0;k++){ result[k]= false; } for(int i = 1;i<n;i++){ for (int j=0;j<i;j++){ ...
6
public static void main(String argv[]) { Frame frame = new Frame(GlobalOptions.copyright); Window win = new Window(frame); String cp = System.getProperty("java.class.path"); if (cp != null) win.setClassPath(cp.replace(File.pathSeparatorChar, Decompiler.altPathSeparatorChar)); String cls = win.getClas...
1
private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked if (jTable1.getModel().getValueAt(jTable1.getSelectedRow(), jTable1.getSelectedColumn()) == null) { killButton.setEnabled(false); return; } else killButton.setEna...
1
private void compileTypeDeclarations(Program program) throws ParseException, IOException { while (tokenizer.tokenType() == Tokenizer.KEYWORD) { // type or const switch (tokenizer.keyword()) { case Tokenizer.KW_TYPE: compileType(); break; case Tokenizer.KW_CONS...
5
public String calculateDepositedAmountAgainstCostOfSoda(BigDecimal costOfSoda, BrandsOfSoda soda, int compared, boolean hasStock) { if (workingBalance.equals(new BigDecimal(ZERO_DOLLARS)) && hasStock) { return MESSAGE_PLEASE_INSERT_PROPER_AMOUNT_PREFIX + costOfSoda.toString() + CENTS; } ...
7
@Override public void addTextBack() { Element textBack = text.getOwnerDocument().createElement("path"); String d = "M"; for (Coordinate c : geometry.getCoordinates()) { if(d.length()>1){ d=d+" L"; } d = d + " " + c.x + "," + c.y; } textBack.setAttribute("d", d); textBack.setAttribute("style", ...
2
protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxN...
9
public Sprite findSpriteAtCanvasLocation(int x, int y) { for (Police p : level.getPolices()) { if (p.containsPoint(x + INTERSECTION_RADIUS, y + INTERSECTION_RADIUS)) { return p; } } for (Zombie z : level.getZombies()) { ...
6
public void DoTimeStep() { // Add ships to each non-neutral planet according to its growth rate. for (Planet p : planets) { if (p.Owner() > 0) { p.AddShips(p.GrowthRate()); } } // Advance all fleets by one time step. for (Fleet f : fleets) { f.TimeStep(); } // Determine the result of any batt...
8
int get(Token id) { switch(id) { case PosY: switch(this) { case TrainStation: case ArkhamAsylum: case BankOfArkham: return 88; case Docks: return 1016; default: return 0; } case PosX: switch(this) { case TrainStation: return 263; case BankOfArkham: return 511...
9
private void paintInvasores(Graphics2D g2d){ for (Invasor i : invasores) { if(i.isVivo()) i.paint(g2d); } }
2
private int splitData(int startIndex, int endIndex) { // find pivot element with median-of-three heuristic int middleIndex = (startIndex + endIndex) >> 1; int lastButOneIndex = endIndex - 2; swap(middleIndex, lastButOneIndex); compareAndSwap(startIndex, lastButOneIndex); compareAndSwap(startIndex, end...
6
private void doInit() throws UnknownHostException, IOException { remoteClientCall = new RemoteClientCall(serverIP, port); remoteClientCall.setIdleTimeout(idleTimeout); remoteClientCall.init(); remoteClientCall.addExceptionListener(new IExceptionListener() { @Override public boolean OnExce...
0
public boolean during(Temporal temporal) { if (null == temporal) return false; if (this == temporal) return true; if (isTimeInstance()) { if (temporal.isTimeInstance()) return startTime == temporal.startTime; return !(startTime < temporal.startTime || temporal.endTime <= endTime); } else return !(startTim...
6
public Item onItemRightClick(Level level) { Random r = new Random(); int attackx = level.player.x; int attackz = level.player.z; int hitChance = level.player.getSkill(PlayerSkill.MELEE); boolean hit = r.nextInt(100) <= hitChance; if (level.player.rot == 0) attackz++; ...
7
public static void main(String[] args) { if (args.length != 1) { System.err.println("usage: java Registrar [integer]"); System.exit(1); } int n = Integer.parseInt(args[0]); Registrar server = new Registrar(n); Utils.out(server.pid, String.format("Registrar started n = %d.", n)); ServerSocket server...
4
private void doDrawing(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.red); Dimension size = getSize(); Insets insets = getInsets(); int w = size.width - insets.left - insets.right; int h = size.height - insets.top - insets.bottom; int middle = w >> 1; g2d.setColor(C...
4
private boolean processLine(String line){ for(int i = 0; i < line.length(); ++i){ char c = line.charAt(i); if(c != ' ' && c != '|' && c != '-' && c != 'x') return false; List<GridType> list = grid.get(grid.size()-1); if(c == ' ') list.add(GridType.Empty); else if(c == 'x'){ starting...
7
@Override public byte[] runBinaryMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp) throws HTTPServerException { final ByteArrayOutputStream bout=new ByteArrayOutputStream(); try { synchronized(sync) { final boolean imageRequest=httpReq.isUrlParameter("IMAGE"); if(imageRequest) { ...
9
public static void reloadChat( String readUTF ) throws SQLException, IOException { ByteArrayOutputStream b = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream( b ); try { out.writeUTF( "Reload" ); } catch ( IOException e ) { e.printStackTrac...
4
public String stExternalEmailYahooLogin(int dataId,int ExpVal,String flow ) { int actVal=1000; String returnVal=null; hm.clear(); hm=STFunctionLibrary.stMakeData(dataId, "Login"); String emailadrs = hm.get("EmailAddress"); String password = hm.get("Password...
9
public Customer getCustomererById(int id){ for(Person person : customerList){ if(person.getId()==id){ return (Customer)person; } } return null; }
2
public void enqueue(Object item) { if(first == null) { last = new Node(item); first = last; } else { last.next = new Node(item); last = last.next; } size++; }
1
public void runOnce() throws InterruptedException { Collections.shuffle(agents); for (AgentAbs agent : agents) { environment = agent.run(environment); } vue.grille(); Thread.sleep(environment.wait_time); agents = new ArrayList<AgentAbs>(); for (int y = 0; y < environment.taille_envi; y++) { for (...
4
private static final void handleEntry( String entry, final String path, final Collection<ClassPathHandler> handlers, final ClassLoader classLoader, final ErrorHandler errorHandler ) { if ( !entry.endsWith( CLASS_EXTENSION ...
4
public static String trimString(String str, int length) { if (str == null) { return ""; } else if (str.length() > length) { return str.substring(0, length - 3) + "..."; } else { return str; } }
2
private Main() { System.setOut(new Logger(System.out)); System.setErr(new Logger(System.err)); System.out.println("Home Directory: " + System.getProperty("user.home")); System.out.println("Current Directory: " + System.getProperty("user.dir")); Runtime.getRuntime().addShutdownHook(new ShutdownHook()); Sy...
3
public static void main(String[] s) { //wap to find square root of 64 without using inbuilt function and arithmetics int x=64; //in binary 1000000 int y=x>>3; // in binary 1000 System.out.println("the square root of 64 is "+y); }
0
private void topPossibleMoves(Piece piece, Position position) { int x1 = position.getPositionX(); int y1 = position.getPositionY(); if(y1 >= 0 && y1 < 7) { boolean pieceNotFound = true; for (int i = y1 + 1; pieceNotFound && (i < maxHeight) && (board.getChessBoardSquare(x1, i).getPiece().getPieceC...
7
@Override public void actionPerformed(ActionEvent e) { saveAsOutlinerDocument((OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched(), getProtocol()); }
0
public static Configuration getConfiguration() { return configuration; }
0
private void writeNameValuePair(String uri, String localName, String qualifiedName, String value) throws SAXException { try { writeName(uri, localName, qualifiedName); output.write("=".getBytes("UTF-8")); output.write("\"".getBytes("UTF-8")); if (value != null) { ...
7
private IUIAction getObjectForCmd(String cmd) { for(Iterator<String> it = commands.keySet().iterator(); it.hasNext();) { String actVal = it.next(); if(actVal.equalsIgnoreCase(cmd)) { return commands.get(actVal); } } return null; }
2
public static void main(String[] args) { GasVehicle gasolineVehicle = new GasVehicle(); gasolineVehicle.makeTrip(); System.out.printf("Efficiency of Gas Vehicle (miles/gallon): %.02f%n", gasolineVehicle.getMilesPerGallon()); ElectricVehicle electricVehicle = new ElectricVehicle(); electricVehicle.makeTrip...
2
public void setFilePath(String name){ fileName = name; }
0
public void setInitRes() { switch (type) { case 1: // TYPE_VEG_FAIBLE resInterne = ConstantesAgents.RES_INT_VEG_FAIBLE; resExterne = ConstantesAgents.RES_EXT_VEG_FAIBLE; break; case 3: // TYPE_VEG_MOY resInterne = ConstantesAgents.RES_INT_VEG_MOY; resExterne = ConstantesAgents.RES_EXT_VEG_MOY; ...
4
public Animation checkAnimationState(Animation animation){ if(dead){ return death; } if (type == Type.CAT){ if (animation == dogAnimLeftWalking){ return catAnimLeftWalking; } else if (animation == dogAnimRightWalking){ return catAnimRightWalking; } else if (animation == dogAnimLeftSta...
8
private void CHASE(Vector3f direction, float distance) { double time = (double)Time.getTime()/(double)(Time.SECOND); double timeDecimals = time - (double)((int)time); if(timeDecimals < 0.25) material.setTexture(textures.get(0)); else if(timeDecimals < 0.5) ma...
7
public Currency search(String string) throws CurrencyNotFoundException, MultipleCurrencyException { for (Currency currency : set) { if (currency.getCode().equalsIgnoreCase(string)) return currency; if (currency.getSymbol().equalsIgnoreCase(string)) return currency; if (curren...
6
private void printArray(ArrayList<Integer> theGuess2, boolean useInt) { int i = 0; while (i != theGuess2.size()) { int colour = theGuess2.get(i); if (useInt) { System.out.print(colour + " "); } else { if (colour == RED) { System.out.print("red "); } else if (colour == BLUE) { S...
8
public boolean add(Object element) { if (element == null) throw new NullPointerException(); for (int i = 0; i < count; i++) { if (element.equals(elementObjects[i])) return false; } if (count == elementObjects.length) { Object[] newArray = new Object[(count + 1) * 3 / 2]; System.arraycopy(eleme...
4
static public String numberToString(Number n) throws JSONException { if (n == null) { throw new JSONException("Null pointer"); } testValidity(n); // Shave off trailing zeros and decimal point, if possible. String s = n.toString(); if (s.indexOf('.') > 0 ...
6
public static String getMessage(int skill) { switch (skill) { case Skills.AGILITY: return "deftness and precision"; case Skills.CONSTRUCTION: return "buildings and security"; case Skills.COOKING: return "fire and preparation"; case Skills.FISHING: return "life and cultivation"; case Skills.FLETC...
8
public TiltForDistance(double power,Distance distance) { super(power, _targetFromDistance(distance)); _distance = distance; }
0
public void sincronizaVentas(){ PhpposAppConfigEntity idPos = getAppConfig("id_pos"); for (PhpposSalesEntity movimientoPos : getMovimientosPos()) { String tipoMovimiento = getTipoMovimientoPos(movimientoPos.getTipoMovimiento()); logger.info("tipoMovimiento = " + tipoMovimiento ...
4
public ConsoleVisualizer(GameBoard gameBoard) { this.gameBoard = gameBoard; printBoard(); GameResult result = GameResult.UNDETERMINED; while (result == GameResult.UNDETERMINED) { MoveDirection direction = getPlayerMove(); if (gameBoard.canMove(direction)) { result = gameBoard.move(direction); } ...
3
public static UserBean login(UserBean bean) { Statement stmt = null; String username = bean.getUsername(); String password = bean.getPassword(); String searchQuery = "select * from users where username='" + username + "' AND password='" + password + "'"; try { currentCon = ConnectionManager.get...
9
private static boolean deleteDrug(Drug bean, PreparedStatement stmt) throws SQLException{ stmt.setInt(1, bean.getDrugId()); int affected=stmt.executeUpdate(); if(affected==1){ System.out.println("Drug with ID "+bean.getDrugId()+" has been Removed from database."); } else { System.out.println("unabl...
1
public void updateArchNodes(int k) throws IOException{ for(int j=1; j<=archN; j++){ hiddenLayers[k]=j; if(k==0) //for(int l=0; l < hiddenLayersNo; l++) System.out.print(hiddenLayers[l]); testArchitecture(); //in if if(k-1>=0) updateArchNodes(k-1); } }
3
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Person)) return false; Person person = (Person) o; if (!email.equals(person.email)) return false; if (!first_name.equals(person.first_name)) return false; if (!last_name.equal...
5
@Override @SideOnly(Side.CLIENT) public void updateProgressBar(int id, int value) { switch (id) { case 0: te.progress = value; break; case 1: te.burnRemaining = value; break; case 2: te.currentFuelBurn = va...
3
static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[18]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 18; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { ...
8
public void print(String name) { for (int i = 0; i < 20; i++) { System.out.printf("%s %s\n", name, i); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } }
2
protected void onEvent(Entity e) { if (method == null) { Class<?> cls = e.getClass(); while (true) { if (cls == Entity.class) return; try { Method m = cls.getDeclaredMethod(methodName); m.setAccessible(true); m.invoke(e); return; } catch (NoSuchMethodException e1) { cls = cl...
7
private static EventDetailShopInfo getEventShopInfo(int eventId) throws HibernateException { EventDetailShopInfo eventDetailShopInfo = null; Session session = HibernateUtil.getSessionFactory().getCurrentSession(); try { // Begin unit of work session.beginTransaction(); // get the event String hql ...
4
private BranchGroup createRootBranch(){ BranchGroup rootGroup = new BranchGroup(); BranchGroup cubeGroup = new BranchGroup(); TransformGroup transGroup = new TransformGroup(); transGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); transGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_...
5
private void chargerFichier() throws Exception { // On ouvre le fichier InputStream flux = new FileInputStream(nomFichier); InputStreamReader fluxEntree = new InputStreamReader(flux); BufferedReader buffer = new BufferedReader(fluxEntree); String ligne; // Variable perme...
9
private static ArrayList<Long> getTimesServed(String hostname) { ArrayList<Long> times = records.get(hostname); return (times == null) ? new ArrayList<Long>() : times; }
1
public void decreaseCounter(){ movementkeycounter--; if (movementkeycounter==0){ isMoving = false; } }
1
private final void method4005(r_Sub1 var_r_Sub1, int i, int i_21_, int i_22_) { anInt8310++; if (i_22_ != 21722) fa(16, 8, null); int[] is = ((s_Sub3) this).anIntArrayArrayArray8321[i_21_][i]; int[] is_23_ = ((s_Sub3) this).anIntArrayArrayArray8313[i_21_][i]; int i_24_ = is.length; if (Class30.anIntArr...
5
public static String binarySearch(RandomAccessFile raf, String keyword, long startseek, long endseek) { //RandomAccessFile raf = new RandomAccessFile(file, "r"); //System.out.println("Binary Search "+keyword); if(startseek>=endseek) { //System.out.println("Start is more now"); return ""; } long m...
8
private static long doWork(Sort12 sorter, String document, int numwords, boolean doPrint ) { long start, end; // now read in words int nwords = 0; ArrayList<String> unsorted = new ArrayList<String>(numwords); // get the start time long totalTime = 0; try { // open up the document FileI...
8
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d.drawImage(walls, 0...
7
private static void sink(Comparable[] a, int k, int N){ //bounds error check: are there still children in array //k is parent idx while(2*k <= N){ int j = 2*k; //idx j is child of parent k //pick the smaller of the 2 children if( j < N && less(a, ...
4
public int isHit(int pdmg) { System.out.println("DMG:"+pdmg); System.out.println("DEF:"+def); int toDo = (pdmg-def); if (toDo <= 0) { //stays the same toDo=0; } else if(toDo > 0) { curHP = curHP-toDo; if(curHP < (-2*maxHP)) { System.out.println("OVERKILL"); curHP =...
5