text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void playGame() {
boolean isAlive = true;
printWelcome();
printHelp();
while (!game.hasWon() && isAlive) {
printScreen();
System.out.println("Cheese collected: " + game.getCheeseCount() + " of 5");
Coordinate move;
do {
move = resolveInput(getInput());
} while (!game.validMove(move));
... | 6 |
@Override
public Item swap(Item newItem) {
Item temp = null;
try{
temp = armorItem;
armorItem = null;
armorItem = (BodyArmor) newItem;
return temp;
}catch(Exception e){
armorItem = (BodyArmor) temp; // swap fail, return to original
return newItem;
}
} | 1 |
private int ParseGameState(String s) {
planets.clear();
fleets.clear();
int planetID = 0;
String[] lines = s.split("\n");
for (int i = 0; i < lines.length; ++i) {
String line = lines[i];
int commentBegin = line.indexOf('#');
if (commentBegin >=... | 8 |
@Override
protected Event doExecute(RequestContext req) throws Exception {
boolean rslt = true;
SecurityChallenge challenge = (SecurityChallenge) req.getFlowScope().get(LookupSecurityQuestionAction.SECURITY_CHALLENGE_ATTRIBUTE);
if (challenge != null) {
List<Sec... | 5 |
public boolean AddUser(String PlayerName, Location loc, ArrayList<String> players, String Mod){
File file = new File(getDataFolder(),"Plates.prop");
if(PlayerName == null || loc == null || players.isEmpty() || Mod == null){
return false;
}
String string = PlayerName +":"+loc.getWorld().getName()+","+ loc.get... | 6 |
public void filtrarContratos() {
try {
String filtro = panelInformacion.getTextoFiltro();
int tipoFiltro = panelInformacion.getTipoFiltro();
if(!filtro.trim().equals("")) {
if(tipoFiltro == Contrato.FILTRO_ID_DUENIO ||
tipoFiltro == ... | 9 |
@Override
public void setPhone(String phone) {
super.setPhone(phone);
} | 0 |
@Override
public int compare(AndroidMethod m1, AndroidMethod m2) {
if(m1.getCategory() == null && m2.getCategory() == null)
return 0;
else if(m1.getCategory() == null)
return 1;
else if(m2.getCategory() == null)
return -1;
else
return m1.getCategory().compareTo(m2.getCategory());
} | 4 |
public boolean isPrime(int num) {
for (int i = 2; i < num; i++) {
if (num % i == 0) {
return false;
}
}
return true;
} | 2 |
public void test_DateTime_withHourZero_Gaza() {
DateTime dt = new DateTime(2007, 4, 1, 8, 0, 0, 0, MOCK_GAZA);
assertEquals("2007-04-01T08:00:00.000+03:00", dt.toString());
try {
dt.withHourOfDay(0);
fail();
} catch (IllegalFieldValueException ex) {
//... | 1 |
public static boolean extract(LauncherAPI api, GameFile source, File dest,
int min, int max, boolean recursive) throws Exception
{
final String[] exts = source.getFileName()
.substring(source.getFileName().indexOf('.', 0) + 1)
.split("\\.");
File ... | 6 |
String codons() {
char seq[] = chromoSequence.toCharArray();
char seqNew[] = chromoNewSequence.toCharArray();
codonsOld = "";
codonsNew = "";
int codonIdx = 0;
int i = 0;
int step = transcript.isStrandPlus() ? 1 : -1;
char codonOld[] = new char[3];
char codonNew[] = new char[3];
for (Exon ex : tran... | 7 |
private void deleteData() {
if(model.getRowCount() == 0) {
// 削除するものがなければ抜ける
return;
}
// 警告ダイアログ
int opt = Dialogs.showQuestionDialog("本当に削除しますか?", "");
if(opt != Dialogs.OK_OPTION) {
// OK が選択されなければ何もしない
return;
}
// 現在行を削除
model.removeRow(nowDataRow);
// 削除された行の次にあたる行を表示する
// 最終行を... | 5 |
public boolean left() {
for(boolean[] position : emplacement.getCoordoneeJeu())
if(position[0] == true)
return false;
for(boolean[] position : emplacement.getCoordoneeJeu())
for(int x=0; x<emplacement.getNombreColonne(); x++)
if (position[... | 5 |
public boolean validate() throws IllegalStateException {
if(populationSize<parentSize){
throw new IllegalStateException("Liczba populacji mniejsza od liczby rodziców");
}
if(populationSize==0||parentSize==0){
throw new IllegalStateException("Liczba populacji lub rodziców ... | 6 |
@Override
public void save() {
try {
saveFile.createNewFile();
fo = new FileOutputStream(saveFile);
JAXB.marshal(dataholder, fo);
} catch (FileNotFoundException e) {
} catch (IOException e) {
}
} | 2 |
public static ParseResult parseXmlAttribute( char[] chars, int offset ) throws XMLParseException {
offset = skipWhitespace(chars, offset);
switch( chars[offset] ) {
case( '>' ): case( '/' ): return new ParseResult(null, offset);
}
ParseResult nameParseResult = parseXmlText(chars, offset, '=');
String name =... | 5 |
public boolean hasNext() {
if(empty) return false;
// first check if current data block can be read for next
if(bedFeatureIndex < bedFeatureList.size())
return true;
// need to fetch next data block
else if(leafItemIndex < leafHitList.size())
r... | 3 |
public static void main(String[] args) {
Scanner inputType = new Scanner(System.in);
while (true) {
try {
TypeTable table = new TypeTable("table.csv");
System.out.println("***********************... | 7 |
private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... | 5 |
public int numDistinct(String S, String T) {
// Start typing your Java solution below
// DO NOT write main() function
int m = S.length();
int n = T.length();
if (n == 0 || m < n)
return 0;
int[][] res = new int[n + 1][m + 1];
for (int i = m; i >= 0; i--)
res[n][i] = 1; // 额外初始化一层,方便统一处理
for (int i... | 6 |
private void firstBeepers() {
if (facingEast()) {
if (rightIsClear()) {
turnRight();
move();
if (noBeepersPresent()) {
turnAround();
move();
putBeeper();
turnRight();
} else {
turnAround();
move();
turnRight();
}
}
} else {
turnLeft();
move();
if... | 4 |
public float getDistanceBetween(Node node1, Node node2) {
// if the nodes are on top or next to each other, return 1
if (node1.getX() == node2.getX() || node1.getY() == node2.getY())
return 1 * (mapHeight + mapWith);
else
return (float) 1.7 * (mapHeight + mapWith);
} | 2 |
static Set<Point> getCirclePoints(int r, int cx, int cy) {
Set<Point> points = new HashSet<Point>();
points.add(new Point(cx + r, cy));
points.add(new Point(cx - r, cy));
points.add(new Point(cx, cy + r));
points.add(new Point(cx, cy - r));
int y = r;
for(int x = 1; x <= y; ++x) {
y = (int) Math.round(... | 1 |
private void openHttpsPostConnection(final String urlStr, final byte[] data, final int sampleRate) {
new Thread () {
public void run() {
HttpsURLConnection httpConn = null;
ByteBuffer buff = ByteBuffer.wrap(data);
byte[] destdata = new byte[2048];
int resCode = -1;
OutputStream out = null;
... | 9 |
public static void main(String[] args) {
setCloseTime(Calendar.getInstance());
setOpenTime(Calendar.getInstance());
//** Setup the members with gender and homeclub
for(int i=0;i<max_members;i++){
mp.put(i,new Member(i, getGender(), getClub(null)));
}
System.out.println("Generating stats... "); //mp.... | 9 |
protected void onOk() {
try {
iteracoes = Integer.parseInt(txtIterations.getText());
} catch (NumberFormatException e) {
iteracoes = 0;
}
if (iteracoes < 1) {
JOptionPane.showMessageDialog(this,
"You must define at least one intera... | 6 |
protected void end() {
Robot.tilter.stop();
} | 0 |
public int delete() {
if (size == 1) {
int helpvalue = root.value;
root = null;
return helpvalue;
}
int returnedvalue = root.value;
Binarynode help = root;
help.value = root.value;
String binary = Integer.toBinaryString(size);
... | 4 |
public void actualizarTurnosBD() {
conexion.conectar();
for (Turno turno : turnos) {
if (turno.getDescripcion() != null && turno.getDuración() != 0) {
String sql = "UPDATE turno SET estado = true, descripcion='" + turno.getDescripcion() + "',"
+ " dura... | 3 |
@Test
public void testGetNextCard() throws Exception {
Shoe shoe = new Shoe(1, 0);
Map<String, Integer> seenCards = new HashMap<String, Integer>();
for(int i = 0; i < 52; i++) {
Card card = shoe.getNextCard();
if(seenCards.containsKey(card.toString())) {
... | 9 |
public Persona actualizarLicencias(Persona p) {
Persona persona = personas.get(p.getCi());
List<LicenciaConductor> eliminar = new ArrayList<>();
for (LicenciaConductor vieja : persona.getLicenciasDeConducir()) {
boolean remover = true;
for (LicenciaConductor nueva : p.ge... | 9 |
public Controller() {
try {
bar = new OtpNode("java", "cake");
mbox = bar.createMbox();
} catch (IOException ex) {
Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
}
ok = new OtpErlangAtom("ok");
// new Thread(new Runna... | 1 |
private void explode(int damage){
if(absoluteHitPosition.tileType == TileType.ROCK
|| absoluteHitPosition.tileType == TileType.VOID
|| absoluteHitPosition.tileType == TileType.SPAWN){
Debug.warn("Mortar hit " + absoluteHitPosition.tileType + " tile, did not explode");
return;
}
int baseDamage = dam... | 9 |
public CircleAccumulator(boolean[][] edgeImage, int minRadius, int maxRadius) {
if(edgeImage.length < 1 || edgeImage[0].length < 1) throw new IllegalArgumentException("edgeImage must have positive dimensions");
if(minRadius >= maxRadius) throw new IllegalArgumentException("minRadius must be less than maxRadius");
... | 3 |
public int terminateRental(DrivingLicense drivingLicense){
String typeOfCar = "";
int fuelToFillTank = 0;
int distanceTravelled = 0;
Car c = AbstractCar.getInstance(typeOfCar, RegistrationNumber.getInstance(extracted(registrationNumber).getLetterIdentifier(), extracted(registrationNumber).getNumberIdentifier())... | 2 |
public int right(){
int movedNr = 0;
for(int i=0;i<getX();i++){
ArrayList<Integer> merged = new ArrayList<Integer>(2); //list of all tiles which are already merged and are not allowed to be merged again
for(int u=getY()-1;u>0;u--){//go from right to left
int cv = u-1;
if(cells[i][cv] != 0){
Boole... | 8 |
private byte[] compressBytes(byte[] orginal) {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
try {
GZIPOutputStream gzip = new GZIPOutputStream(byteStream);
gzip.write(orginal);
gzip.close();
} catch (IOException e) {
this.parent.server.Log("Error compressing level!");
e.printStac... | 1 |
public void addTask(Task item) {
try {
String filepath = System.getProperty("user.home")
+ "/.TODO-group9/savedata.xml";
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse(filepath); ... | 7 |
public String iniciarProduccion() {
double materiaPrima = getCantMateriaPrima();
String averia = "";
String msj = "";
if(isActivo()){
if(modoOperacion == 'C'){
while (getCantMateriaPrima() > 0) {
materiaPrima = materiaPrima - getMoldeEnvases().obtenerPorcMateria();
setCantMateriaPrima(materiaP... | 6 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
comboCliente = new javax.swing.JComboBox();
tfProcesso... | 4 |
public void handleSaveMachineButton(){
String name = JOptionPane.showInputDialog(this,"Machine name?",null);
if(name == null){
}
else if(name.trim().length() > 0){
File savingDir = new File("Saved");
if (!savingDir.exists()){
savingDir.mkdirs();
}
Fil... | 8 |
public int GetOffBusTicks()
{
//get the tick time person got off the bus
return offBusTicks;
} | 0 |
public boolean isPushTwoTransition(Transition transition) {
PDATransition trans = (PDATransition) transition;
String toPush = trans.getStringToPush();
if (toPush.length() != 2)
return false;
/*
* String input = trans.getInputToRead(); if(input.length() != 1) return
* false;
*/
String toPop = trans... | 2 |
public static Integer versionCompare(String str1, String str2) {
String[] vals1 = str1.split("\\.");
String[] vals2 = str2.split("\\.");
int idx = 0;
// set index to first non-equal ordinal or length of shortest version
// string
while (idx < vals1.length && idx < vals2.length && vals1[idx].eq... | 5 |
private void pasteUrlFromClipboard() {
if (Config.getInstance().getAddURLAutoPaste()) {
String text = getPasteString();
URL url = getUrlFromString(text);
if (url != null) {
view.setUrlText(url.toString());
}
}
} | 2 |
private void render(Graphics2D graphics) {
for (Tile[] tileArray : tiles) {
for (Tile tile : tileArray) {
tile.render(graphics);
}
}
} | 2 |
private void removeFile() {
JFrame frame = new JFrame();
// if there is at least one file parsed
if( fileIndex.numOfFilesParsed() != 0 ) {
// get the file name to remove
String fileName = (String) JOptionPane.... | 4 |
private void extractJar(File file, String path) throws Exception
{
final int initialPercentage = launcher.getPercentage();
final JarFile jarFile = new JarFile(file);
Enumeration<JarEntry> entries = jarFile.entries();
int totalSizeExtract = 0;
while (entries.hasMoreEl... | 9 |
@Override
public void put(Key key, Value val)
{
if (N > M * 10)
resize(2 * M);
if (val == null)
{
delete(key);
return;
}
int i = hash(key);
if (!st[i].contains(key)) // Note: More efficient than contains(key) as
// duplicate calculation of hash(key) not
// involved
N++;
s... | 3 |
@Override
public void exportDone(JComponent c, Transferable data, int action)
{
initialImportCount = 1;
if (c instanceof mxGraphComponent
&& data instanceof mxGraphTransferable)
{
// Requires that the graph handler resets the location to null if the drag leaves the
// component. This is the conditi... | 4 |
public boolean partidoCompleto() {
return (listaJugadores.size()==10) && listaJugadores.stream().allMatch(j->j.getModo() instanceof Estandar);
} | 1 |
public ExponentialTerm(double base) {
_base = base;
} | 0 |
@Override
public void keyPressed(KeyEvent arg0) {
switch(arg0.getKeyCode()){
case KeyEvent.VK_UP:
upArrow = true;
break;
case KeyEvent.VK_DOWN:
downArrow = true;
break;
case KeyEvent.VK_LEFT:
leftArrow = true;
break;
case KeyEvent.VK_RIGHT:
rightArrow = true;
break;
}... | 4 |
private void parseResponse(String rawResponce, GoogleResponse googleResponce) {
if (rawResponce == null || googleResponce == null)
return;
String responce1 = StringUtil.substringBetween(rawResponce, "[", "]");
boolean confident = true;
if (responce1 == null || responce1.equals("")) {
confident = false;
... | 9 |
public void clickPlayGame(ArrayList<MainMenuHeroSlot> heroies) {
//Initializes main menu for game play
MainMenuGame.MainMenuGame.main(new String [0], heroies);
//Once game is played reset the game so he can play again
gumballMachine.setState(gumballMachine.hasNotChosenCharactersState());
} | 0 |
public int getPort() {
return this.port;
} | 0 |
@Override
public Object getValueAt(int i, int i1) {
Tenant t = tenants.get(i); //To change body of generated methods, choose Tools | Templates.
switch (i1) {
case 0:
return t.getId();
case 1:
return t.getName();
... | 7 |
public List<Prize> execute() throws IOException {
FileInputStream fis = new FileInputStream(new File(inputFile));
XSSFWorkbook wb = new XSSFWorkbook(fis);
XSSFSheet sheet = wb.getSheet(MAGIC);
Iterator<Row> it = sheet.iterator();
while (it.hasNext()) {
Row row = it.next();
String category = getCellStrin... | 8 |
public void uploadDirectory(FTPFile srcDir, FTPFile dstDir)
throws IOException, FtpWorkflowException, FtpIOException {
if (!srcDir.isDirectory())
throw new FtpFileNotFoundException("Uploading: " + srcDir.getName()
+ " is not possible, it's not a directory!");
... | 4 |
public String getSourceLine(int lineNumber) {
return sourceLines.get(lineNumber).getSourceLine();
} | 0 |
@Override
public void mouseReleased(MouseEvent e)
{
super.mouseReleased(e);
if (e.getButton() == MouseEvent.BUTTON1)
addVertex(draggedToX, draggedToY);
else if (e.getButton() == MouseEvent.BUTTON2)
removeVertex(draggedToVertex);
else if (e.getButton() == M... | 3 |
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof IterableComparator)) {
return false;
}
final IterableComparator<?> other = (IterableComparator<?>) obj;
if (iteratorComparator == null) {
if (other.i... | 8 |
@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, acce... | 2 |
public static int[][] getArray() {
int [][] num={{1,2,3},{4,5},{2}};
for(int i = 0; i < num.length; i++) {
for(int j = 0; j < num[i].length; j++)
System.out.println(num[i][j]);
}
return num;
} | 2 |
public static TreeSet<Integer> primeSieve(int limit) {
boolean[] numberList = new boolean[limit + 1];
TreeSet<Integer> primeList = new TreeSet<>();
for(int i = 2; i <= limit; i++) {
numberList[i] = true;
}
for(int i = 2; i * i <= limit; i++) {
if(numberL... | 6 |
public boolean delete(T item) {
if(current != null) {
if(current == current.getNext() && current.getData().equals(item)) {
current = null;
return true;
} else {
Link<T> cur = current;
Link<T> prev = null;
whi... | 7 |
public Builder(final Object paramValue) {
this.value = null;
this.paramValue = paramValue;
} | 0 |
public void run()
{
try
{
this.MReading.acquire();
if(this.counter == 0)
this.MWriting.acquire();
this.counter++;
this.MReading.release();
System.out.println("Lecture");
Thread.sleep(1000);
this.MReading.acquire();
this.counter--;
if(this.counter == 0)
this.MWriting.re... | 3 |
public void pack() {
boolean isrunestone = cap.text.equals("Runestone");
Coord max = new Coord(0, 0);
for (Widget wdg = child; wdg != null; wdg = wdg.next) {
if ((wdg == cbtn) || (wdg == fbtn))
continue;
if ((isrunestone) && (wdg instanceof Label)) {
Label lbl = (Label) wdg;
lbl.settext(GoogleTr... | 7 |
@Override
public Object get( ByteBuffer in )
{
byte nil = in.get();
if (nil == Compress.NULL)
{
return null;
}
try
{
Object o = constructor.newInstance();
for (int i = 0; i < fields.length; i++)
{
... | 3 |
public Cookies(Cookie[] cookies) {
// TODO Auto-generated constructor stub
this.cookies = cookies;
} | 0 |
public boolean equip(final int... ids) {
Item item;
if (ctx.bank.opened()) {
item = ctx.bank.backpack.select().id(ids).poll();
} else {
item = ctx.backpack.select().id(ids).poll();
if (item.id() > -1) {
if (!ctx.hud.opened(Hud.Window.BACKPACK) && ctx.hud.open(Hud.Window.BACKPACK)) {
ctx.sleep(40... | 9 |
public void handleInput() {
if (Keys.isPressed(Keys.ESCAPE)) gsm.setPaused(true);
if (player.getHealth() == 0) return;
player.setUp(Keys.keyState[Keys.UP]);
player.setDown(Keys.keyState[Keys.DOWN]);
player.setLeft(Keys.keyState[Keys.LEFT] || Keys.keyState[Keys.A]);
player.setRight(Keys.keyState[Keys.RIGHT] ... | 6 |
public void execute( JobExecutionContext context )
throws JobExecutionException
{
this.invocationsA++;
} | 0 |
@Override
public void run() {
if (Updater.this.url != null) {
// Obtain the results of the project's file feed
if (Updater.this.read()) {
if (Updater.this.versionCheck(Updater.this.versionName)) {
if ((Updater.this.versionLi... | 6 |
@Override
public void move(long ticks, FrameBuffer buffer){} | 0 |
public boolean addSpawnedMob(Mob mob, MobReference mobRef)
{
if (!mobRef.isValid())
return false;
// Add the mob to the regions limit
if (maxAliveLimiter != null && !maxAliveLimiter.add(mobRef))
return false;
// Add the mob to its grouped limit
if (groupedMaxAliveLimiters != null && mob.regionLim... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {// 非空性
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Point p = (Point) obj;
return this.x == p.x && this.y == p.y;
} | 4 |
public int maxSubArray3(int[] A) {// O(1) space
int last = 0;
int max = A[0];
for (int i = 0; i < A.length; i++) {
if (last >= 0)
last += A[i];
else
last = A[i];
max = Math.max(last, max); // keep track of the largest sum
}
return max;
} | 2 |
public String getWinningTeam(String matchName){
for(String teamName: TEAM_NAMES){
if(teamIsWipedOut(matchName, teamName)){
return teamName.equalsIgnoreCase(TEAM_NAMES[0]) ? TEAM_NAMES[1] : TEAM_NAMES[0];
}
}
return null;
} | 3 |
public Vector3f normalized()
{
float length = this.length();
if ( length == 0 )
return new Vector3f( 0, 0, 0 );
return ( new Vector3f( x / length, y / length, z / length ) );
} | 1 |
private boolean decode5(ByteArrayOutputStream baos)
throws PDFParseException {
// stream ends in ~>
int[] five = new int[5];
int i;
for (i = 0; i < 5; i++) {
five[i] = nextChar();
if (five[i] == '~') {
if (nextChar() == '>') {
... | 9 |
public MyClient(){
super(header);
gameState = 0;
Container c = getContentPane();
c.setLayout(null);
Border loweredbevel, raisedbevel;
loweredbevel = BorderFactory.createLoweredBevelBorder();
raisedbevel = BorderFactory.createRaisedBevelBorder();
imgHolder = new JLabel(new ImageIcon("images\\Kashiwazak... | 6 |
public static Operation createOperation(int operation) {
Operation opt = null;
switch (operation) {
case OPERATION_ADD:
opt = new OperationAdd();
break;
case OPERATION_SUB:
opt = new OperationSub();
break;
case OPERATION_MUL:
... | 4 |
public boolean opEquals(Operator o) {
return (o instanceof OuterLocalOperator && ((OuterLocalOperator) o).local
.getSlot() == local.getSlot());
} | 1 |
private final Path generateMap(final Object name, final Object title) {
final Path map = this.midi.getParent().resolve(
this.midi.getFilename() + ".map");
final OutputStream out = this.io.openOut(map.toFile());
final String style = this.STYLE.value();
this.io.writeln(out, String.format("Name: %s", title));... | 8 |
public PROJECTView(SingleFrameApplication app) {
super(app);
initComponents();
//below code remove the required components from frame
filefield.setVisible(false);
filelabel.setVisible(false);
passfield.setVisible(false);
passlabel.setVisible(false);
brows... | 7 |
public void setDiscount(int index, float discount){
this.discount[index]=discount;
} | 0 |
private boolean isObstructed() {
if (pastLeftEdge()) {
return true;
}
if (pastRightEdge()) {
return true;
}
int[][] rotation = currentDroppingBlock.getCurrentRotation();
for(int i = 0; i < rotation.length; i++) {
for (int j = 0; j < rot... | 7 |
public T getFoo()
{
return foo;
} | 0 |
public void removeOnetimeLocals() {
StructuredBlock[] subBlocks = getSubBlocks();
for (int i = 0; i < subBlocks.length; i++)
subBlocks[i].removeOnetimeLocals();
} | 1 |
boolean isAttackPlaceVerticallyBelowNotHarming(int position, char[] boardElements, int dimension, int numberOfLinesBelow) {
while (numberOfLinesBelow > 0) {
if (isPossibleToPlaceOnNextLine(boardElements, elementVerticallyBelow(dimension, position, numberOfLinesBelow))
&& isBoardE... | 3 |
public final void visitMethodInsn(final int opcode, final String owner,
final String name, final String desc) {
AttributesImpl attrs = new AttributesImpl();
if (opcode != Opcodes.INVOKEDYNAMIC) {
attrs.addAttribute("", "owner", "owner", "", owner);
}
attrs.addAttribute("", "name", "name", "", name);
att... | 1 |
public Contents contents() {
return new Contents();
} | 0 |
@Test
public void resolve() {
int i = 1;
long sum = 0;
long limit = 4 * 1000 * 1000;
while (true) {
long value = f(i);
if (value > limit) {
print(sum);
break;
} else if (value % 2 == 0) {
sum += value;
}
i++;
}
} | 3 |
public static void main(String[] args) {
/*
* Порахувати опір ланки яка скл. з двох резисторів, що можуть бути з"єднані
* або послідовно, або паралельно.
*/
System.out.print("Введіть опір 1 >> ");
Scanner in = new Scanner (System.in);
int r1 = in.nextInt();
System.out.print("Введіть опір 2 >> ");
... | 2 |
public void act(List<Actor> newRabbits)
{
if (isZiek) {
timeToDie--;
if(timeToDie<0) {
setDead();
}
}
incrementAge();
if(isAlive()) {
giveBirth(newRabbits);
// kijken of het konijntje andere konijnen kan besmetten
if(isZiek) {
... | 5 |
void workerUpdate(File dir, boolean force) {
if (dir == null) return;
if ((!force) && (workerNextDir != null) && (workerNextDir.equals(dir))) return;
synchronized(workerLock) {
workerNextDir = dir;
workerStopped = false;
workerCancelled = true;
workerLock.notifyAll();
}
if (workerThread == null) ... | 5 |
public int getA() {
return this.a;
} | 0 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.