text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static int canCompleteCircuit(int[] gas, int[] cost) {
if (gas.length != cost.length)
return -1;
int getgas = 0;
int count = 0;
int i = 0;
int k = 0;
for (i = gas.length - 1; i >= 0; i--) {
// getgas = 0;
// count = 0;
getgas = getgas + gas[i] - cost[i];
count++;
if (gas[i] - cost... | 8 |
public boolean isSelected() {
// try{
// return unselect.isDisplayed();
// }catch(Exception e){
// return false;
// }
// return (unselect.size()==0);
for (ComboboxItem ci : comboItems) {
if (ci.isSelected())
return true;
}
return false;
} | 2 |
public void go(){
b.moveTo(p);
} | 0 |
public static void aTurn() {
if (move.equals(a1.move1.getName())) {
System.out.println("\n" + a1.getName() + " uses " + a1.move1.getName() + "!");
// System.out.println(a1.move1.getType().getTypeName() + " " + b1.getType().getTypeName());
b1.hp -= (pAttack.pAttack(a1.move1.getDamage(), a1.getAtt(), b1.... | 4 |
private ArrayList<InetAddress> getServerIP() {
ArrayList<InetAddress> serverIPs = new ArrayList<InetAddress>();
Properties prop = new Properties();
InputStream input = null;
try {
input = new FileInputStream("serverIP.properties");
// load a properties file
prop.load(input);
// get the property valu... | 5 |
public void uimsg(int id, String msg, Object... args) {
Widget wdg;
synchronized (this) {
wdg = widgets.get(id);
}
if (wdg != null) {
wdg.uimsg(msg.intern(), args);
JSBotUtils.OnWidgetUpdate(wdg, id, msg.intern(), args);
}
else
throw (new UIException("Uimsg to non-existent widget " + id, msg,
... | 1 |
public Point3 plus(Point3 p){
return new Point3(this.x + p.x, this.y + p.y, this.z + p.z);
} | 0 |
public Map<Integer, RFNode> getInitialList(List<TPoint> pointList, boolean prune) {
Map<Integer, RFNode> map = Maps.newHashMap();
for (int i = 0; i < pointList.size(); i++) {
RFNode node = new RFNode(i, pointList.get(i), 0);
map.put(i, node);
}
if (!prune) {
... | 9 |
protected void onApiReady(){
storageDataList=new StorageDataList(storageControler,storageKey);
VerticalPanel main=new VerticalPanel();
RootPanel.get().add(main);
//ImageBundle use that!
//clear.cache.gif sometime,often failed
final Image img=new Image("http://www.xucker.jpn.org/test/re... | 8 |
public void onEnable(){
this.loadConfig();
this.loadDependencies();
try {
Metrics metrics = new Metrics(this);
metrics.start();
} catch (IOException e) {
this.log("Couldn't connect to http://mcstats.org");
}
try {
getCommand("xraylookup").setExecutor(new LookupCommand(this));
getComman... | 3 |
private Object fetchFieldValue(T t, String accessorMethod,
Object actualValue) {
try {
actualValue = t.getClass().getMethod(accessorMethod).invoke(t);
} catch (IllegalArgumentException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (SecurityException e1) {
// TODO Auto-gener... | 5 |
protected Integer getTreeHeight(int root,LinkedList<Integer>[] graph,int threshold){
LinkedList<Integer> stack=new LinkedList<Integer>();
boolean[] visited=new boolean[graph.length];
int height=0;
stack.push(root);
stack.push(-1);
visited[root]=true;
while (!stack... | 6 |
public void setLink(boolean input, int val) throws Exception {
m_input = input;
if (input) {
m_type = PURE_INPUT;
}
else {
m_type = PURE_OUTPUT;
}
if (val < 0 || (input && val > m_instances.numAttributes())
|| (!input && m_instances.classAttribute().isNominal()
&... | 7 |
public void copyDirectory(File srcPath, File dstPath)
throws IOException {
if (srcPath.isDirectory()) {
if (!dstPath.exists()) {
dstPath.mkdir();
}
String files[] = srcPath.list();
for (int i = 0; i < files.length; i++) {
... | 8 |
public ArrayList<String> getImageNames() {
ArrayList<String> imageNames = new ArrayList<String>();
if (DIR.isDirectory()) {
for (File f : DIR.listFiles(IMAGE_FILTER)) {
BufferedImage img = null;
try {
img = ImageIO.read(f);
... | 3 |
public void schrijfOpdrachtenNaarBestand(OpdrachtCatalogus opdrachtCatalogus) {
File fileWrite = new File("bestanden/opdrachten");
try {
// Wegschrijven
FileWriter writer = new FileWriter(fileWrite, false);
for (int i = 0; i < opdrachtCatalogus.getOpdrachten().size(); i++) {
Opdracht opdracht = opdrach... | 5 |
public void clearEnemy(Enemy e) {
for (MapTile[] tileRow : navigationGraph) {
for (MapTile tile : tileRow) {
if (tile != null && tile.getEnemy() == e) {
tile.setEnemy(null);
}
}
}
} | 4 |
public void stopRunning()
{
System.out.println("Audio stopRunning called");
try{isRunning = false;
audio.setVisible(false);
audio.validate();
} catch(Exception e){}
} | 1 |
@Override
public int compare(Drillable one, Drillable two) {
Date date1 = one.getPractice() == null ? null : one.getPractice().getAdded();
Date date2 = two.getPractice() == null ? null : two.getPractice().getAdded();
if (date1 == null && date2 == null) {
return 0;
}
if (date1 == null) {
return -1;
... | 6 |
public void renderSheet(int xp, int yp, SpriteSheet sheet, boolean fixed) {
if (fixed) {
xp -= xOffset;
yp -= yOffset;
}
for (int y = 0; y < sheet.HEIGHT; y++) {
int ya = y + yp;
for (int x = 0; x < sheet.WIDTH; x++) {
int xa = x + xp;
if (xa < 0 || xa >= width || ya < 0 || ya >= height) conti... | 8 |
public boolean equals(Object obj)
{
if(!(obj instanceof ResultPanelWorkSpace))
return false;
ResultPanelWorkSpace sp = (ResultPanelWorkSpace)obj;
// non basic checks
return sp.findText.equals(findText)
&& sp.sizeColumns == sizeColumns
&& sp.expandLobs == expandLobs
&& sp.fontSize == fontSize
... | 6 |
@Override
public void keyPressed(KeyEvent arg0) {
boolean status = false;
detect = true;
if (Screen.done){
detect = false;
Screen.restart();
}
if (detect){
if (!alreadyPressed(arg0.getKeyChar())){
System.out.println("Key: " + arg0.getKeyChar() + " pressed");
if (KeyChecker.compareLetters(arg... | 6 |
private void merge(T[] a, int lo, int mid, int hi)
{
// new aux is created everytime merge is called
@SuppressWarnings("unchecked")
T[] aux = (T[]) new Comparable[a.length];
// i and j is used to point to the currently processing element in the
// first and 2nd half respectively
int i = lo, j = mid + 1;
... | 5 |
private static float getMaxArcCost(ZoneGeographique zone) {
float maxArcCost = 0;
for (Noeud noeud : zone.getNoeuds()) {
for (Troncon troncon: noeud.getSortants()) {
float cost = troncon.getCost();
maxArcCost = cost > maxArcCost ? cost : maxArcCost;
... | 3 |
private short receiveData(APDU apdu, byte[] data) {
byte[] buffer = apdu.getBuffer();
short lc = (short)(buffer[ISO7816.OFFSET_LC] & 0x00FF);
short l;
short len;
if (lc > 254) {
ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
}
l = apdu.setIncomingAndR... | 2 |
private void populateQueues() {
String sgeRoot = Configuration.getConfig(Configuration.CONFIG_SGE_ROOT);
String arch = "";
Process p = null;
try {
p = Runtime.getRuntime().exec(sgeRoot + "/util/arch");
InputStream is = p.getInputStream();
byte [] buf... | 7 |
public void populateWorld(int numMolecules, int numSpecies){
int rand;
Molecule nullMolecule = new Molecule();
bucket.add(nullMolecule);
for(int i=1; i<numMolecules; i++){
progress("Spawning...", i, numMolecules);
rand = (int) (Math.random()*(double)(numSpecies-1)) + 1;
... | 1 |
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.print("Enter your integer here: ");
int yourInt = s.nextInt();
int fibonacci = 1;
int f1 = 1;
int f2 = 1;
if(yourInt <= 2){
fibonacci = 1;
... | 2 |
public static boolean isPositiveSentiment ( String str ) {
if ( positiveHashMap.containsKey(str) ) return true;
else return false;
} | 1 |
public static MenuHint getInstance(Color bg, String text) {
if (MenuHint.instance == null) {
MenuHint.instance = new MenuHint(bg, text);
} else {
comboboxHint.setBackground(bg);
comboboxHint.setText(text);
}
return instance;
} | 1 |
private boolean inMap(int x, int y)
{
return x >= 0 && y >= 0 && x < width && y < height;
} | 3 |
private synchronized void createFriendLink( final Map<KeyRegistrationRecord, Set<KeyRegistrationRecord>> topology, final KeyRegistrationRecord a, final KeyRegistrationRecord b, boolean writeToDB ) {
Set<KeyRegistrationRecord> a_peers = topology.get(a);
Set<KeyRegistrationRecord> b_peers = topology.get(b);
a_pe... | 3 |
private void addIfNotNullAndLatestNotSame(TimelineItem item) {
if (size() != 0) {
if (get(size() - 1).equals(item)) return;
}
for (Stat st: item.getStats()) {
if (st == null) return;
}
add(item);
} | 4 |
private void findExpressionType ( )
{
boolean isKeyType = false;
for ( int i = 0; i < container.length; i++ )
{
String element = Grammer.findExpression ( container[i] );
if ( !"".equals ( element ) )
{
if (true == parseType ( element ))
... | 7 |
public XElement addAttribute( XAttribute attribute ){
if( attribute == null )
throw new NullPointerException( "attribute must not be null" );
if( getAttribute( attribute.getName() ) != null ){
throw new IllegalArgumentException( "attribute '" + attribute.getName() + "' has ... | 2 |
static public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[14];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 7; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
... | 8 |
private void generateSite() {
int street = 1, step = 0;
int[] siteNum = new int[] {0,4,2,2,3,2,3}; // Refer to Vocab.CellTypeName
// create 8 streets, 4*((4+6)||(5+5)||(6+4))
int randStMaxNo = 0, randSiteType = 0;
for (int i = 0; i < 4; i++) {
randStMaxNo = Helper.rand(3) + 4;
// create a street
for... | 9 |
@Override
public int observed(String sequence) {
int count = 0;
// Count CHH in this sequence
char bases[] = sequence.toUpperCase().toCharArray();
for( int i = 0; i < bases.length - 2; i++ )
if( (bases[i] == 'C') && (bases[i + 1] != 'G') && (bases[i + 2] != 'G') ) count++;
return count;
} | 4 |
public void loadDrops() {
try {
int[][][] npcDrops = new int [12000][][];
int[][][] rareDrops2 = new int [12000][][];
int[] itemRarity = new int [12000];
File f = new File("./Data/cfg/NPCDrops.TSM");
Scanner s = new Scanner(f);
while (s.hasNextLine()) {
String line = s.nextLine();
if (line.s... | 6 |
private JSONWriter append(String s) throws JSONException {
if (s == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write(',');
... | 7 |
public static void main(String[] args) {
LeMensagensXML leMsgs = new LeMensagensXML();
List<Discussao> discussoes = leMsgs.leituraXML();
int contaReferencias = 0;
for(Discussao discussao:(List<Discussao>) discussoes)
{
try {
List<Mensagem> mensagens = TratamentoTextual.executaTratamentosDiscussao(discu... | 9 |
@Override
public double arvo() throws IllegalStateException {
if (!super.laskettavatAsetettu()) {
throw new IllegalStateException();
}
return super.getEtujasen().arvo() * super.getTakajasen().arvo();
} | 1 |
static public boolean isScalar (Class c) {
return c.isPrimitive() || c == String.class || c == Integer.class || c == Boolean.class || c == Float.class
|| c == Long.class || c == Double.class || c == Short.class || c == Byte.class || c == Character.class;
} | 9 |
public ArrayList<String> restoreIpAddresses2(String s) {
// Start typing your Java solution below
// DO NOT write main() function
ArrayList<String> result = new ArrayList<String>();
if (s.length() < 4 || s.length() > 16) {
return result;
}
for (int i = 1; i <= s.length(); i++) {
if (!isValid(s, 0, i))... | 9 |
public void closeConnection()
{
try
{
if (conn != null)
{
conn.close();
//DriverManager.getConnection(dbURL + ";shutdown=true");
}
}
catch (SQLException sqlExcept)
{
sqlExcep... | 2 |
public void addReservation(Reservation res)
{
Connection con = null;
PreparedStatement pstmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
... | 6 |
@Override
public void executeTask() {
System.out.println(this.getClass().getSimpleName() + " EXECUTING");
if (m_ServerSocket == null) {
try {
m_ServerSocket = new ServerSocket(PORT);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
do {
... | 6 |
public void reset()
{
view.getThreadRunner().stop();
step = 0;
actors.clear();
populate();
// Show the starting state in the view.
view.showStatus(step, field);
} | 0 |
public void setSalt(PBKDF2ParameterType.Salt value) {
this.salt = value;
} | 0 |
public Vector2 getShooterMount(Dimension boardSize) {
switch (this) {
case LEFT:
return new Vector2(1, boardSize.getHeight() / 2);
case RIGHT:
return new Vector2(boardSize.getWidth() - 1, boardSize.getHeight() / 2);
default:
throw new IllegalStateException();
}
} | 2 |
private void doMovement() {
// Do minimal risk movement
Vector target = state.robotPosition.clone();
Vector bestTarget = state.robotPosition;
double angle = 0;
double bestRisk = calculateRisk(bestTarget);
double enemyDistance = state.robotPosition.distance(getTargetPosition());
// a little dynamic dista... | 8 |
public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... | 6 |
public IncomingListener(IncomingHandler handler)
{
this.handler = handler;
try {
sock = new ServerSocket(Config.CHATPORT);
} catch (IOException e) {
e.printStackTrace();
}
start();
} | 1 |
public int depthOfNode(treeNode node, HashMap<treeNode, Integer> nodesDepth) {
count++;
if (node == null)
return 0;
// already calculated.
if (nodesDepth.containsKey(node))
return nodesDepth.get(node);
int leftDepth = depthOfNode(node.leftLeaf, nodesDepth);
int rightDepth = depthOfNode(node.rightLea... | 3 |
public void setId(int id) {
this.id = id;
} | 0 |
private final static int readInt(InputStream is) throws IOException {
byte b[] = read(is, 4);
return ((b[0] & 0xFF) << 24) +
((b[1] & 0xFF) << 16) +
((b[2] & 0xFF) << 8) +
((b[3] & 0xFF));
} | 0 |
@Override
public Object produceDataset(Map params) throws DatasetProduceException {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
try {
ArrayList<bConsulta2> obja = jConsultaWeb.getMediaHoras2(
params.get("data_in").toString(),
pa... | 3 |
private void renderBoard(Graphics2D g, List<List<Card>> gameBoard) {
double x = X_BOARD_OFFSET + CARD_WIDTH * 2 + CARD_X_GAP * 2;
double y = Y_BOARD_OFFSET + CARD_HEIGHT / 2;
if (gameBoard.size() == 0) {
//Game not inited yet
return;
}
for (int i = 0; i ... | 6 |
public int[] battle(int[] attackerResults, int[] defenderResults) {
int[] result = new int[6];
result[0]=0; // worked or not
result[1]=0; // no of armies attacker lost
result[2]=0; // no of armies defender lost
result[3]=0; // did you win
result[4]=0; // min move
result[5]=0; // max move
if (gameState... | 9 |
public void setDifficulty(Difficulty difficulty) {
this.difficulty = difficulty;
switch (difficulty.getDifficulty()) {
case "medium":
this.numberOfMines = 40;
this.boardWidth = 16;
this.boardHeight = boardWidth;
break;
... | 2 |
private void createOrderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createOrderButtonActionPerformed
Date startDate = null;
Date endDate = null;
if (startDateTextField.getText().length() == 10 &&
startDateTextField.getText().charAt(2) == '-' &&
... | 8 |
public void setOptions(String[] options) throws Exception {
resetOptions();
String positiveIndexString = Utils.getOption('P', options);
String maxItemsString = Utils.getOption('I', options);
String numRulesString = Utils.getOption('N', options);
String minMetricString = Utils.getOption('C', options)... | 8 |
public static int getSideGrassTexture(IBlockAccess blockAccess, int x, int y, int z, int side) {
if (!isBetterGrass()) {
return 3;
} else {
if (isBetterGrassFancy()) {
--y;
switch (side) {
case 2:
--z;
... | 7 |
void setFileName(String newName) {
fileName = newName;
if (new File(fileName).exists()) {
exists = true;
return;
}
if (!newName.endsWith(".properties")) {
File f2 = new File(newName + ".properties");
if (f2.exists()) {
exists = true;
fileName = newName + ".properties";
return;
}
}
... | 3 |
@RequestMapping(method = RequestMethod.PUT, value = "{id}")
public void finishTask(@PathVariable("id") Integer id, @RequestParam String action) {
switch (Action.valueOf(action)) {
case FINISH:
tasksService.finishById(id);
break;
}
} | 1 |
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 String join(List<? extends Object> os, String seprator) {
StringBuilder sb = new StringBuilder();
os.stream().forEach((Object o) -> {
sb.append(seprator).append(o.toString());
});
return sb.length() > 0 ? sb.substring(1) : "";
} | 2 |
public void saveWordList() {
ArrayList<String> tempList = new ArrayList<String>();
// Write a new list
for (Map.Entry<String, String> entry : wordList.entrySet()) {
String thisWord = entry.getKey();
String thisReplace = entry.getValue();
String writeMe = (thisReplace.length() > 0) ? thisWord+":"+th... | 2 |
static public String getPrefixScriptPathSuffixString(
Map<String, String> paths,
String pre,
String suf,
boolean appendSrcBase,
boolean unixStyle) {
StringBuilder builder = new StringBuilder();
Iterator it = paths.keySet().iterator();
while (it.hasNext()) {
... | 5 |
public String getPrice() {
return this.price;
} | 0 |
@SuppressWarnings("unchecked")
public Object invoke(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
if (type == Type.FORWARD) {
request.getRequestDispatcher(target).forward(request, response);
} else if (type == Type.REDIRECT || type == Ty... | 9 |
private void nameCheck()
{
if (namer.text().isEmpty()) {
namer.setText("Czerwony");
}
if (nameb.text().isEmpty()) {
nameb.setText("Niebieski");
}
} | 2 |
@Override
public void startDocument () {} | 0 |
public static void init() {
if (initialized) {
return;
}
Method method;
try {
method = Event.class.getDeclaredMethod("createHiddenHelper");
method.setAccessible(true);
eventHelper = (IHiddenEventHelper) method.invoke(null);
method.setAccessible(false);
method = Bullet.class.getDeclaredMethod... | 9 |
public void toBytecode(DataOutputStream out)
throws CannotCompileException, IOException
{
if (!hasConstructor)
try {
inheritAllConstructors();
hasConstructor = true;
}
catch (NotFoundException e) {
throw new CannotCo... | 2 |
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String input = scan.nextLine().replaceAll("[\\s+/\\\\()]", "|");
String[] words = input.split("\\|+");
ArrayList<String> correctWords = new ArrayList<String>();
for (String word : words) {
... | 8 |
public UnitController(final GameCore mCore, final String unitName, int xpos, int ypos, final MapState mMap ) throws SlickException
{
Log.info("Constructing Map Control for unit " + unitName);
this.mMap = mMap;
this.x = xpos;
this.y = ypos;
this.unitName = unitName;
this.mCore = mCore;
Propert... | 8 |
@Override
public void run(){
try {
home = null;
numMsg=test1.getnumMesg();
try {
home = new Robot();
} catch (AWTException ex) {
Logger.getLogger(ThreadTe... | 8 |
public void error(String message)
{
updateUploadInfo("error");
} | 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.v... | 6 |
public static List<String> splitFixedText(final List<ColumnMetaData> columnMetaData, final String lineToParse,
final boolean preserveLeadingWhitespace, final boolean preserveTrailingWhitespace) {
final List<String> splitResult = new ArrayList<String>();
int recPosition = 1;
for (fina... | 3 |
@Override
public void keyPressed(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_RIGHT) {
right = true;
}
else if(e.getKeyCode() == KeyEvent.VK_LEFT) {
left = true;
}
else if(e.getKeyCode() == KeyEvent.VK_UP) {
up = true;
}
else if(e.getKeyCode() == KeyEvent.VK_DOWN) {
down = true;
}
} | 4 |
public Token OpcodeIMMIMM() throws ParseException {
Token t;
switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
case SBIC:
t = jj_consume_token(SBIC);
break;
case SBIS:
t = jj_consume_token(SBIS);
break;
case BR... | 7 |
private void setTipo(String tipo) {
for (int i = 0; i < this.tipos.length; i++) {
if (this.tipos[i][0].equals(tipo)) {
this.tipo = this.tipos[i][1];
this.tamanho = this.tipos[i][2];
return;
}
}
} | 2 |
private void insererNoeud(NoeudRN z)
{
NoeudRN y= null, x= racine;
while(x != sentinelle){
y= x;
if(z.compareTo(x) == 1)
x= x.getGauche();
else
x= x.getDroit();
}
z.setPere(y);
if(y == null){
racine= z;
racine.setPere(sentinelle);
}
else if (z.compareTo(y) == 1)
y.setGauche(z);
... | 4 |
public static void main(String[] args) {
// TODO Auto-generated method stub
String currentDirectory = System.getProperty("user.dir");
String singlecountrycsvfile = currentDirectory + "/src/weather/UnitedStates.csv";
Map<String, Integer>allMenMustDie = new HashMap<String, Integer>();
... | 7 |
private int findNearestPair(double key, double secondaryKey) {
int low = 0;
int high = m_NumValues;
int middle = 0;
while (low < high) {
middle = (low + high) / 2;
double current = m_CondValues[middle];
if (current == key) {
double secondary = m_Values[middle];
if (secondary == sec... | 7 |
public void resume() {
++resume_count;
} | 0 |
public static DataTarget outputDataFrom(final Object object) throws IOException {
if (object instanceof DataTarget) return (DataTarget)object;
if (object instanceof File) return IO._outputDataFrom_((File)object);
if (object instanceof RandomAccessFile) return IO._outputDataFrom_((RandomAccessFile)object);
if (o... | 8 |
public void setElapsedTime(long elapsedTime)
{
this.elapsedTime = elapsedTime;
} | 0 |
boolean isAttackPlaceVerticallyAboveNotHarming(int position, char[] boardElements, int dimension, int numberOfLinesAbove) {
while (numberOfLinesAbove > 0) {
if (isPossibleToPlaceOnPreviousLine(elementVerticallyAbove(dimension, position, numberOfLinesAbove))
&& isBoardElementAnoth... | 3 |
public boolean equals (Professionnel pro)
{
boolean exists = false;
if ((this.getNom().equals(pro.getNom())) && (this.getPrenom().equals(pro.getPrenom())) && (this.getCivilite().equals(pro.getCivilite())) && (this.getAdresse().equals(pro.getAdresse()))
&& (this.getTelB().equals(pro.getTel... | 8 |
public void update() {
Stack<Projectile> removalStack = new Stack<Projectile>();
Stack<Ship> removalStack2 = new Stack<Ship>();
//update ships
for (Ship ship : ships) {
ship.update();
if(!ship.isAlive()){
removalStack2.add(ship);
}
... | 6 |
@Override
public void actionPerformed(ActionEvent event) {
PrintProxy proxy = getTarget(PrintProxy.class);
if (proxy != null) {
PrintManager mgr = proxy.getPrintManager();
if (mgr != null) {
mgr.pageSetup(proxy);
} else {
WindowUtils.showError(UIUtilities.getComponentForDialog(proxy), NO_PRINTER_S... | 2 |
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int arr[] = new int[10001];
for (int i = 1; i * i <= 10000; i++)
arr[i * i] = 1;
for (int cont = 1; cont < 4; cont++)
for (int i = 1; i <= 10000; i++)
if (arr[i] == 1)
... | 9 |
* @param rows The rows.
* @return <code>true</code> if the contents of the drag can be dropped into this outline.
*/
protected boolean isRowDragAcceptable(DropTargetDragEvent dtde, Row[] rows) {
return rows.length > 0 && mModel.getRows().contains(rows[0]);
} | 1 |
private int jjMoveStringLiteralDfa21_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjMoveNfa_0(0, 20);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return jjMoveNfa_0(0, 20);
}
switch(curChar)
{
case 48:
return jjMoveStringLiter... | 5 |
private String pasteFromClipboard(){
String result = "";
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
//odd: the Object param of getContents is not currently used
Transferable contents = clipboard.getContents(null);
boolean hasTransferableText =
... | 4 |
public HTMLViewerDialog() {
super(false, false, false, INITIAL_WIDTH, INITIAL_HEIGHT, MINIMUM_WIDTH, MINIMUM_HEIGHT);
Outliner.html_viewer = this;
} | 0 |
public boolean shouldSwap(final LocalExpr expr) {
final UseInformation UI = (UseInformation) useInfoMap.get(expr);
if (UI == null) {
if (StackOptimizer.DEBUG) {
System.err
.println("Error in StackOptimizer.onStack: parameter not found in useInfoMap");
}
return false;
}
return (onStack(expr... | 3 |
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.