text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public void populateChunk(RealChunk chunk, Random random, int chunkX, int chunkZ) {
World world = noise.getWorld();
// cover the ground
int y = groundLevel + 1;
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
// only plant in the right place
Material surface = chunk.g... | 9 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Restart other = (Restart) obj;
if (!Objects.equals(this.name1, other.name1)) {
return false;
... | 4 |
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
} | 1 |
private void setPoints(TreeNode node, int depth, int thisDepth,
int[] width, int[] widthSofar) {
// Scale points along ([0,1], [0,1]).
float x = (float) (widthSofar[thisDepth] + 1)
/ (float) (width[thisDepth] + 1);
float y = (float) (thisDepth + 1) / (float) (depth + 2);
nodeToPoint.put(node, new Point2D... | 1 |
public void run() {
MatrixChecker mc = new MatrixChecker();
int[] a = new int[]{1,2,3};
int[] b = new int[]{1,2,1};
System.out.println("is "+a+" sym? " + mc.isSymmetrical(a));
System.out.println("is "+b+" sym? " + mc.isSymmetrical(b));
a = new int[]{1,2,2,3};
b =... | 1 |
public TileMap loadNextMap() {
TileMap map = null;
currentMap++;
while (map == null) {
try {
if (currentMap > 1) currentMap = 1;
map = loadMap("assets/maps/map" + currentMap + ".txt");
}
catch (IOException ex) {
map... | 3 |
private String validateResponseCode(Number number) {
int rcode = number.intValue();
if (rcode >= 200 && rcode <= 299) {
return null;
}
return "Unexpected HTTP response";
} | 2 |
@Override
public void removeItem(int index, int amount) {
for (int slot = 0; slot < getCapacity(); slot ++) {
if (getItems()[slot] == null) {
continue;
}
if (getItems()[slot].getIndex() == index) {
if (getItems()[slot].getAmount() > amount && ItemDefinition.getDefinitions()[index].isStackable()) {
... | 5 |
public Node<T> getPredecessor(Node<T> node) {
if (node.getLeft() != null) {
node = node.getLeft();
while (node.getRight() != null)
node = node.getRight();
return node;
}
Node<T> temp = node.getParent();
while (temp != null && node == temp.getLeft()) {
node = temp;
t... | 4 |
public FilterSequence(SoundFilter[] filters) {
this.filters = filters;
} | 0 |
private void showFile(File file){
BufferedReader infile = null; // declare buffered stream
// get file name from the text field
String inLine;
jtfFile.setText(file.getName());
try {
// create a buffered stream
infile = new BufferedReader(new FileReader(file));
// read a line
inLine = ... | 6 |
@EventHandler
public void EndermanSpeed(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getEndermanConfig().getDouble("Enderman.Spe... | 6 |
public static List<FavoritesTag> constructTag(Response res) throws WeiboException {
try {
JSONArray list = res.asJSONObject().getJSONArray("tags");
int size = list.length();
List<FavoritesTag> tags = new ArrayList<FavoritesTag>(size);
for (int i = 0; i < size; i++) {
tags.add(new FavoritesTag(list.get... | 3 |
@Override
public void add_first_index_child(Sentence_tree child){
Sentence_tree[] new_children = new Sentence_tree[this.children.length + 1];
for(int i = 0; i < this.children.length; i++){
new_children[i + 1] = this.children[i];
}
new_children[0] = child;
child.parent = this;
this.children = new_childre... | 1 |
public String getIP() {
String ipAddress = "";
try {
// return socket.getInetAddress().toString();
InetAddress IP = InetAddress.getLocalHost();
ipAddress = IP.getHostAddress();
} catch (UnknownHostException ex) {
Logger.getLogger(Client.cla... | 1 |
public static void STARTUP_SAMPLE_CONTENTS() {
{ Object OLD_$MODULE$_000 = Stella.$MODULE$.get();
Object OLD_$CONTEXT$_000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/STELLA/XML-OBJECTS/SAMPLE", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.se... | 6 |
@POST
@Consumes(MediaType.LIBROS_API_RESENA)
@Produces(MediaType.LIBROS_API_RESENA)
public Resena createResena(@PathParam("idlibro") String idlibro,
Resena resena) {
String username = security.getUserPrincipal().getName();
Connection conn = null;
Statement stmt = null;
try {
conn = ds.getConnection();
... | 5 |
@Override
public boolean wipeTable(String table) {
//Connection connection = null;
Statement statement = null;
String query = null;
try {
if (!this.checkTable(table)) {
this.writeError("Error wiping table: \"" + table + "\" does not exist.", true);
return false;
}
//connection = open();
//t... | 3 |
private void parseValue(String line, int lineNum) {
// skip a comment line
if (line.startsWith(COMMENT)) {
return;
}
String[] sp = line.split("\\s+"); // split the fields based on a space
int len = 0; // length of a string
int index = 0; // the i... | 4 |
private boolean _jspx_meth_c_forEach_1(PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// c:forEach
org.apache.taglibs.standard.tag.rt.core.ForEachTag _jspx_th_c_forEach_1 = (org.apache.taglibs.stand... | 6 |
public void doAll() {
ListSelectionModel model = editingGrammarView.getSelectionModel();
while (need.length != 0) {
model.clearSelection();
for (int i = 0; i < need.length; i++)
model.addSelectionInterval(need[i], need[i]);
convertSelected();
}
mainLabel.setText("All productions completed.");
edi... | 2 |
public void update(double delta) {
components.removeAll(componentsToRemove);
componentsToRemove.clear();
Iterator<EntityComponent> it = components.iterator();
while (it.hasNext()) {
it.next().update(delta);
}
} | 1 |
public int size() {
int size = 0;
switch (_Type) {
case STRING:
size = TMS.size();
break;
case INTEGER:
size = TMI.size();
break;
default:
break;
}
return size;
} | 2 |
public Discount(double minimum, double value, DiscountType typeFlag){
if(minimum < 0) throw new IllegalArgumentException("Minimum purchase amount required cannot be negative.");
if(value <= 0) throw new IllegalArgumentException("Discount value cannot be 0 or below.");
if(value >= 1 && typeFlag == Discount.Discoun... | 4 |
public void discardCards(int numberOfPlayer, List<card> discard)
{
/* discardCards
* discardCards makes it so then cards that are discarded from the hand are placed into the discard pile
* @param (int numberOfPlayer) An int 1-4, which is respective to the players number
* @param (List<card> discard) contain... | 8 |
private boolean jj_3R_13() {
if (jj_scan_token(SET_LITERAL_VARIABLE)) return true;
if (jj_3R_18()) return true;
if (jj_scan_token(ASSIGN)) return true;
Token xsp;
xsp = jj_scanpos;
if (jj_3_65()) {
jj_scanpos = xsp;
if (jj_3_66()) return true;
}
return false;
} | 5 |
static byte[] toBase64(byte[] buf, int start, int length){
byte[] tmp=new byte[length*2];
int i,j,k;
int foo=(length/3)*3+start;
i=0;
for(j=start; j<foo; j+=3){
k=(buf[j]>>>2)&0x3f;
tmp[i++]=b64[k];
k=(buf[j]&0x03)<<4|(buf[j+1]>>>4)&0x0f;
tmp[i++]=b64[k];
k=(buf[j... | 3 |
public static Type canonicalize(Type type) {
if (type instanceof Class) {
Class<?> c = (Class<?>) type;
return c.isArray() ? new GenericArrayTypeImpl(canonicalize(c.getComponentType())) : c;
} else if (type instanceof ParameterizedType) {
ParameterizedType p = (ParameterizedType) type;
... | 7 |
public int send(int clientId, String message) throws CouldNotSendPacketException {
synchronized(CONNECTION_LOCK) {
Packet packet = Packet.createApplicationPacket(clientId, message);
//if the client isn't connected then throw an exception
if(!clients.containsKey(clientId)) {
logger.fine("Could not send m... | 1 |
private BrowserType(String name) {
this.name = name;
} | 0 |
private void analyseMinAddressableUnit(String line) throws AssemblerException {
if (line.trim().length() == 0)
return;
if(foundMinAdrUnit)
throw new AssemblerException("MinAddressableUnit error: Minimum addressable unit already specified.");
foundMinAdrUnit = true;
line = line.trim();
boolean legi... | 4 |
@Override
public void createHardLink(String source, String destination) throws PathNotFoundException, SourceAlreadyExistsException, AccessDeniedException, UnsupportedFeatureException {
if (hardlinks)
{
if (innerFs.pathExists(source))
throw new SourceAlreadyExistsException();
if (!innerFs.pathExists(d... | 8 |
private void plankSwitchWait() {
int logID = Planker.logID;
int plankID = Planker.plankID;
int plankPrice = Planker.plankPrice;
switch (plankSet) {
case 0:
while (plankSet == 0) {
Time.sleep(100);
}
case 1:
logID = 1511;
plankID = 960;
plankPrice = 100;
break;
case 2:
logID = 152... | 6 |
public boolean incluir(int pos, ContaCorrente conta)
{
if (pos <= capacidade - 1 && pos >= 0)
{
if (this.aContas[pos] != null)
{
for (int i=this.capacidade-2; i > pos - 1; i --)
this.aContas[i+1] = this.aContas[i];
this.aCon... | 7 |
public static String toPureHtml(WebPage wp){
final StringBuffer result = new StringBuffer();
try {
final URL linkUrl = new URL(wp.getUrl());
final HttpURLConnection httpConnection = (java.net.HttpURLConnection) linkUrl.openConnection();
httpConnection.connect();
final java.io.InputStream urlStream = htt... | 4 |
@Override
public String executeCommands (Object object){
String gameStatus = Game.PLAYING;
do {
try{
this.display();
String command = this.getCommand();
switch (command) {
case "O":
// ... | 6 |
public void nouvellePartie() {
int vainqueur = -1;
this.joueurCourant = 0;
while ((vainqueur == -1) && !plateau.estPlein()) {
boolean coupValide = true;
do {
interfacep4.affichageJoueur(
joueurs[this.joueurCourant].obtenirNom(),
joueurs[this.joueurCourant].obtenirCouleur());
} while (!co... | 6 |
private void setTransform(int row, int col, Rectangle2D box) {
Texture texture = SpriteList.get(frame).getTexture();
transform.clear();
transform.textureOffsets = new Vector4f();
transform.color = new Vector4f(1f, 1f, 1f, opacity);
switch(row) {
case 0:
transform.y = box.getY() - (frameSize / 3);
t... | 6 |
public void populateURL()
{
String c_url;
int i;
//Storing the urls parsed in this vector.. stop when length >=crawlDepth*maxURLCount
Iterator it;
//URL of string has been populated initially..
//Set initial crawled count to URLs crawled via the google API
syn... | 9 |
@Override
public void mouseReleased(MouseEvent event) {
//Handle tile clicks.
if (event.getSource() instanceof Tile) {
Tile sourceTile = (Tile)event.getSource();
if(match.isInProgress() &&
//Make sure the mouse was released while still on the tile,
//by checking the event's positi... | 6 |
@Override
public synchronized void fire(Event event) {
for (EventListener<? extends Event> listener : listeners) {
if (listener.canHandle(event)) {
listener.handleGeneric(event);
}
}
} | 3 |
public void paint(Graphics2D g, float vx0, float vy0, float vx1, float vy1) {
if (!isActive()) {
g.drawImage(backgroundImage, 0, (int) vy1 - backgroundImage.getHeight(), null);
return;
}
viewportMinX = vx0 + viewBorderX;
viewportMaxX = vx1... | 9 |
public void setLocals(final LocalDebugInfo[] locals) {
if (locals == null) {
for (int i = 0; i < attrs.length; i++) {
if (this.locals == attrs[i]) {
final Attribute[] a = attrs;
attrs = new Attribute[a.length - 1];
System.arraycopy(a, 0, attrs, 0, i);
System.arraycopy(a, i + 1, attrs, i, at... | 4 |
public Vector2D pursuit(SpriteV2 spriteV2){
Vector2D toTarget = spriteV2.getPosition().minus(parent.getPosition());
double relativeHeading = parent.heading.dotProduct(spriteV2.heading);
if( (toTarget.dotProduct(parent.heading) > 0) && (relativeHeading < -0.95) ){
return seek(spriteV2.position);
}else{
... | 2 |
protected void createContents() {
shlSatellitedemo = new Shell();
shlSatellitedemo.setSize(607, 435);
shlSatellitedemo.setText("SatelliteDemo");
shlSatellitedemo.setLayout(new GridLayout(1, false));
Composite topComposite = new Composite(shlSatellitedemo, SWT.NONE);
GridLayout gl_topComposite = new GridL... | 8 |
public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
StringTokenizer st = new StringTokenizer(in.readLine());
int n = Integer.parseInt(st.nextToken());
k = Integer.parseInt(st.nextToken());
... | 8 |
public static void createWindow(int width, int height, String title, boolean fullscreen)
{
Display.setTitle(title);
try
{
if(fullscreen)
Display.setFullscreen(true);
else
Display.setDisplayMode(new DisplayMode(width, height));
Display.create();
Keyboard.create();
Mouse.create();
}
... | 5 |
public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... | 9 |
public int getAmount() {
return this.duplicates.size();
} | 0 |
public Transition getTransitionForProduction(Production production) {
String lhs = production.getLHS();
String rhs = production.getRHS();
Transition transition = new PDATransition(INTERMEDIATE_STATE,
INTERMEDIATE_STATE, "", lhs, rhs);
return transition;
} | 0 |
public void setOptions(String[] options) throws Exception {
String tmpStr;
String[] spec;
String classname;
tmpStr = Utils.getOption('W', options);
if (tmpStr.length() > 0) {
spec = Utils.splitOptions(tmpStr);
if (spec.length == 0)
throw new IllegalArgumentException... | 8 |
private boolean runCommand(String cmd) {
try {
String[] bashCmd = {
"/bin/sh",
"-c",
cmd};
Process p = Runtime.getRuntime().exec(bashCmd);
BufferedReader reader = new BufferedReader(new InputStreamReader(
p.getInputStream()));
String line = reader.readLine();
while (line != null) {
... | 3 |
public void load() {
try {
BufferedReader reader = new BufferedReader(new FileReader(path));
String line;
while ((line=reader.readLine()) != null) {
if (line.startsWith("rendermode")) optRendermode = line.split(" ")[1];
else if (line.startsWith("platform")) optPlatform = line.split(" ")[1];
else ... | 8 |
public void mousedown(MouseEvent ev, Coord c, int button) {
setmods(ev);
lcc = mc = c;
if (mousegrab == null)
root.mousedown(c, button);
else
mousegrab.mousedown(wdgxlate(c, mousegrab), button);
} | 1 |
private void gameInfo()
{
// If there is draw
if (p1.getPoints() == p2.getPoints())
{
System.out.println("DRAW");
}
// If both of players FIRED UP
else if (p1.getPoints() > Game.GOAL
&& p2.getPoints() > Game.GOAL)
{
Syst... | 8 |
@Override
public void actionPerformed(ActionEvent ae) {
try {
String op = ae.getActionCommand();
switch(op){
case "Salvar":
execSalvarXml();
break;
case "Cancelar":
... | 3 |
public void newTab(boolean isPublic, String name, boolean selfOpened)
{
try
{
boolean exist = false;
boolean ownName = false;
if (name.equals(cc.getMyName()))
{
cc.addPublicMessage("Error: Unable to open private chat with yourself!");
tabbedPane.setSelectedIndex(0);
ownName = true;
}
... | 8 |
private void loadNextReader() throws InvalidCommandException {
if (!processQueue.isEmpty()) {
try {
if (reader != null)
reader.close();
} catch (IOException e) {
}
try {
logger.trace("Obtaining next reader");
... | 4 |
public Result execute(Command command) {
Set<AccountDTO> accountDTOget = (Set<AccountDTO>) command.getCommandSource();
Set<MessageStatuss> messageStatuss = new HashSet<MessageStatuss>();
List<Account> accountId = new ArrayList<Account>();
for (Iterator<AccountDTO> it = accountDTOget.iter... | 2 |
protected void applyActiveChanges() {
boolean changed = false;
for (int i = 0; i < changes.size(); i++) {
if (changes.get(i).isActivation()) {
changes.get(i).apply(courseModel);
changes.remove(i);
changeSelected.remove(i);
i--;
changed = true;
}
}
if (changed)
finishModification();
... | 3 |
private void splitOrderbys(String orderby){
if(orderby != null && orderby.length() > 0){
orderby = orderby.trim();
String[] orderbys = orderby.split(",");
for(String order : orderbys){
order = order.trim();
String[] orders = order.split(" ");
String trend = orders[orders.length - 1];
boolean ... | 8 |
public String readLine() {
try {
if (readeru != null) {
final StringBuffer rv = new StringBuffer(8192);
int temp = readeru.read();
/* remember a line can terminate with any of the following: \r, \n, or \r\n */
if (stripTheLineSeparator && temp == '\n') {
temp = readeru.read();
... | 8 |
public double subirEstacion() {
if (frecuencia){
fm = fm + 0.2;
if (fm >107.9) {
fm = 89.7;
}
return fm;
} else {
am = am + 10;
if (am > 1610){
am = 530;
... | 3 |
@Override
public Concurso inserir(IEntidade entidade) throws SQLException {
if (entidade instanceof Concurso) {
Concurso concurso = (Concurso) entidade;
Connection connection = ConnectionFactory.getConnection();
String sql = " INSERT INTO concurso ( ";
sql ... | 7 |
private No insere(No h, Chave chave, Valor valor, int ht) {
int j;
Entrada t = new Entrada(chave, valor, null);
// no externo
if (ht == 0) {
for (j = 0; j < h.numFilhos; j++) {
if (menor(chave, h.filhos[j].chave)) break;
}
}
// no... | 9 |
public void run() {
Object arr[] = {this, target};
try {
// wait untill destroy after war launch
sleep(delayFromStart * War.TIME_INTERVAL);
synchronized (destructor) {
try {
for (WarEventListener l : allListeners) {
l.addedLauncherToDestroy(destructor.getDestructo... | 6 |
@Override
public void paint(Graphics window) {
window.setColor(Color.WHITE);
window.fillRect(0, 0, 230, 370);
window.setColor(Color.BLACK);
window.drawRect(0,0,230,173);
window.drawLine(115,0,115,173);
window.drawRect(39,58,38,58); //Spot for armor
if(equipped[0]!=null){window.drawIm... | 8 |
public int compare(String o1, String o2)
{
String s1 = (String)o1;
String s2 = (String)o2;
int thisMarker = 0;
int thatMarker = 0;
int s1Length = s1.length();
int s2Length = s2.length();
while (thisMarker < s1Length && thatMarker < s2Length)
{
... | 8 |
@Override
public double getYRotation()
{
double lowest = 9001;
double highest = 0;
int y = 0;
if (getRotationAngle() == 90)
y = 20;
if (getRotationAngle() == 270)
y = -20;
for (Block block : blockArray)
{
if (block.getYValue() > highest)
highest = block.getYValue();
if (block.getYValue()... | 5 |
public SpellCheckerSuggestion[] findSuggestions(String word){
boolean notSorted = true;
SpellCheckerSuggestion temp;
SpellCheckerSuggestion[] suggestions = new SpellCheckerSuggestion[10];
int index = bsCheck(word).getIndex();
// If word is at the beginning of a dictionary
... | 8 |
public void tick() throws Exception
{
if(isSolid == true)
{
if(Main.Character.getBoundsBottom(Main.Frame.getWidth(), Main.Frame.getHeight()).intersects(getBounds()))
{
Main.Character.setVelY(0);
Main.Character.canMoveDown = false;
}
else if(Main.Character.getBoundsTop(Main.Frame.getWidth(),... | 5 |
protected final void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
final HttpSession session = request.getSession(true);
final String idString = request.getParameter("id");
if (idString == null) {
this.getServletContext().getRequestDispatch... | 4 |
final public boolean imc_startup( boolean force,
String loginName,
String host,
String email,
String web,
String hub,
int port,
String passclient,
String passsrvr,
List<CMChannel> imc2Channels)
{
if( imc_active != IA... | 9 |
private CommandResponse doPost(String jsonObject, HttpURLConnection connection, Class<?> responseType){
CommandResponse result = null;
int responseCode;
String responseMessage = "";
Map<String, List<String>> responseHeaders;
try {
connection.setRequestMethod("POST");
connection.setDoInput(true);
co... | 6 |
public static <GInput, GOutput, GValue> Field<GInput, GValue> navigatedField(final Converter<? super GInput, ? extends GOutput> converter,
final Field<? super GOutput, GValue> field) throws NullPointerException {
if (converter == null) throw new NullPointerException("converter = null");
if (field == null) throw n... | 5 |
public static void main(String[] args) throws IOException {
Files.walkFileTree(Paths.get("/home/xander/"), new SimpleFileVisitor<Path>(){
public FileVisitResult visitFile(Path p, BasicFileAttributes attributes) {
if (p.getFileName().toString().equals("a.out")) {
S... | 1 |
public void setSkill1(SkillsMain skill12) {
this.skill1 = skill12;
} | 0 |
private void removeRender(Member e) {
switch (e.getType().toLowerCase()) {
case "decoration":
remove(RenderLayer.DECORATION, e);
break;
case "item":
remove(RenderLayer.DECORATION, e);
break;
case "zone":
remove(RenderLayer.DECORATION, e);
break;
case "container":
remove(RenderLayer.DECORA... | 6 |
public static int minDistance(String word1, String word2) {
if (word1 == null || word2 == null) {
return 0;
}
int length1 = word1.length();
int length2 = word2.length();
if (length1 == 0) {
return length2;
}
if (length2 == 0) {
... | 9 |
public static void main(String[] args) {
SingletonClass singleton = SingletonClass.getInstance();
System.out.println(singleton);
} | 0 |
protected void execute() {
if (m_timer == null){
if (Robot.driveTrain.getRightCurrent() < 20 && Robot.driveTrain.getLeftCurrent() < 20){
Robot.driveTrain.voltageDrive(-7, -7);
}else{
if(Timer.getFPGATimestamp()-m_startTime > 0.8){
... | 5 |
private Entry parseText(String content, Date theDate) {
ArrayList<String> tempTopics = new ArrayList<>();
ArrayList<Scripture> tempScriptures = new ArrayList<>();
//parse the topics out of the file
for (Topic compareTopic : topicsList) {
String topic = compareTopic.g... | 7 |
private static boolean isComment(String row) {
return row == null || row.startsWith(COMMENT_TOKEN);
} | 1 |
@Override
protected double doSolve() {
double min = getMin();
double max = getMax();
// [x1, x2] is the bracketing interval in each iteration
// x3 is the midpoint of [x1, x2]
// x is the new root approximation and an endpoint of the new interval
double x1 = min;
... | 9 |
public int size() {
if (!beforeFirst) {
throw new RuntimeException("next already called; to get remaining item count use itemsLeft");
}
if ((candidates == null) || (candidates.isEmpty())) {
return 0;
}
return candidates.size();
} | 3 |
public void setaddress(String address)
{
this.address = address;
} | 0 |
public void setFileFilterExclude(String fileFilterExclude) {
this.fileFilterExclude = fileFilterExclude;
} | 0 |
private void handleCommand(String command) {
if (command.equals("end")) {
close(false);
} else if (command.equals("restart")) {
close(true);
} else if (command.startsWith("ban")) {
bot.getRoom().Users.banUser(command.substring(4), "Banned");
bot.bootUser(bot.getRoom().Users
.getByName(com... | 3 |
public static void main(String[] args) {
Scanner inputScanner = null;
try {
inputScanner = new Scanner(new File(args[0]));
} catch (FileNotFoundException e) {
System.err.println("Invalid input file.");
}
LinkedList<String> input = new LinkedList<String>();
int numResults = Integer.parseInt(inputScanne... | 5 |
private void disableCheckBoxMenuItems(JCheckBoxMenuItem... items) {
for (JCheckBoxMenuItem checkBoxMenuItem : items) {
checkBoxMenuItem.setState(false);
}
} | 1 |
public Pair<Livraison, PlageHoraire> rechercheLivraisonParNoeud(Noeud noeudAdr){
if(this.testItineraireCharger()){
for(PlageHoraire ph : this.plagesHoraire){
Livraison liv = ph.rechercheLivraison(noeudAdr);
if(liv != null){
return new Pair<Livraison, PlageHoraire>(liv, ph);
}
}
}
return nul... | 3 |
public void init(LinesGame linesGame) {
_linesGame = linesGame;
_random = new Random();
initSettings();
_lineDirections = new ArrayList<Point>();
_lineDirections.add(new Point(1, 0));
_lineDirections.add(new Point(0, 1));
_lineDirections.add(new Point(1, 1));
_lineDirections.add(new Point(1, -1));... | 3 |
public AbstractHash(final int num) { this.num = num; } | 0 |
public void init()
{
//Sprites
SpriteLoader loader = new SpriteLoader();
BufferedImage spriteGrid = loader.load("/sprite.png");
BufferedImage damageGrid = loader.load("/damage.png");
BufferedImage cursorGrid = loader.load("/cursor.png");
BufferedImage tileG... | 1 |
public static void main(String[] args) {
int n = 1000; // number of nodes per graph
int f1 = 2; // number of features for the first graph
int f2 = 3; // numer of features for the se... | 9 |
public static void repaintGrid() {
if (game != null) {
game.gameGrid.repaintGrid();
game.holdGrid.repaintGrid();
for (int i = 0; i < QUEUE_SIZE; ++i) {
game.inQueueGrid[i].repaintGrid();
}
}
MainFrame.getThis().repaint();
MainFrame.getThis().revalidate();
} | 2 |
public String readFile() {
if (!file.exists()) {
JOptionPane.showMessageDialog(responsibleWindow, "Savefile: " + file.getName() + " did not exist.");
return "";
}
String fileContent = "";
try {
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) {
fileContent += scanner.nextLin... | 3 |
public static void main(String[] args)
{
HashMap map = new HashMap();
for (int i = 0; i < args.length; i++)
{
if ( map.get(args[i]) == null)
{
map.put(args[i],new Integer(1));
}
else{
int int1 = ((Integer)map.get(args[i])).intValue();
int1 = int1 + 1;
map.put(args[i], n... | 3 |
@Override
public void update(float dt) {
if (heroOnPlatform) {
if (wordMatchFound) {
currentState = PlatformState.OK;
} else {
currentState = PlatformState.WRONG;
}
heroOnPlatform = false;
wordMatchFound = false;
} else
// System.out.println(currentState);
if (currentState != PlatformStat... | 4 |
public RegistrationServlet() {
super();
// TODO Auto-generated constructor stub
} | 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.