text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public boolean condition(Event E) {
if (E instanceof ContextEvent){
ContextEvent event = (ContextEvent)E;
if (event.getContext() == context){
if (event.getContext().isEnabled()){
if(!event.getContext().isStalled()){
// Can't list duplicate entries for instructions re-executed due t... | 9 |
public static ArrayList<Command> addPossibleBoxCommandsForDirection(
dir direction, Field agentLocationInPlan, Field boxLocationInPlan,
Collection<Field> blockedFields) {
ArrayList<Command> possibleCommands = new ArrayList<Command>();
// Find possible pull commands
for (dir d : dir.values()) {
// we ca... | 8 |
@Override
public void stopService() {
for (Communicator comm : clients.getClients()) {
try {
comm.sendData(new Message(GlobalConstants.ID_SYS_MSG, SystemMessageHeaders.LOGOUT, null));
} catch (ConnectionException ex) {
LOG.warning("Client connection ti... | 6 |
public void InsertarImagen(ArrayList datos)
{
// Cambiamos todos los datos, que se puedan cambiar, a minúsculas
for(int i = 0 ; i < datos.size() ; i++)
{
try{datos.set(i, datos.get(i).toString().toLowerCase());}
catch(Exception e){}
}
biblioteca.insert... | 2 |
public void remove(CollidableObject collidableObject)
{
Iterator<CollidableObject> i= collidableList.iterator();
int index=0;
while (i.hasNext())
{
if (i.equals(collidableObject))
{
collidableList.remove(index);
break;
}
index++;
}
} | 2 |
@Test(expected = BeanstreamApiException.class)
public void invalidAmountVoidPayment() throws BeanstreamApiException {
CardPaymentRequest paymentRequest = getCreditCardPaymentRequest(
getRandomOrderId("PEDRO"), "90.00");
PaymentResponse response = null;
try {
response = beanstream.payments().makePayment(... | 3 |
private void showFeedbackArea(Map<String, Object> state) {
@SuppressWarnings("unchecked")
List<String> feedbackHistory = (List<String>)state.get(FEEDBACKHISTORY);
this.feedbackArea.clear();
if (feedbackHistory != null){
this.feedbackArea.add(this.createFeedbackPanel(feedbackHistory));
}
} | 1 |
public boolean isPalindrome(int x) {
if (x < 0) {
return false;
}
int digit = 0;
int num = x;
while (num != 0) {
digit++;
num /= 10;
}
int length = digit;
while (digit >= length / 2) {
num = x;
... | 6 |
public static void main(String[] args) {
System.out.println(NumberToText(100282));
} | 0 |
public Node encode(Object obj)
{
Node node = null;
if (obj != null)
{
String name = mxCodecRegistry.getName(obj);
mxObjectCodec enc = mxCodecRegistry.getCodec(name);
if (enc != null)
{
node = enc.encode(this, obj);
}
else
{
if (obj instanceof Node)
{
node = ((Node) obj).cl... | 3 |
public void print ()
{
out.println ("\n Table " + name);
out.print ("|-");
for (int i = 0; i < attribute.length; i++) {
out.print ("---------------");
}
out.println ("-|");
out.print ("| ");
for (String a : attribute) {
out.printf ("%1... | 9 |
public void setDeptId(int deptId) {
this.deptId = deptId;
} | 0 |
void initializeToolBar() {
toolbar = new JToolBar();
f_new = new JButton();
f_new.setIcon(new javax.swing.ImageIcon(getClass().getResource("/frontend/resources/new.png"))); // NOI18N
f_new.setToolTipText("New File");
f_new.setBorderPainted(false);
f_new.setFocusable(f... | 5 |
private String readNextLine() throws InvalidCommandException {
logger.trace("Attempting to read next line");
if (reader == null) {
if (!processQueue.isEmpty())
loadNextReader();
else
return null;
}
String line = null;
try {... | 5 |
public boolean execute()
{
long time = peersim.core.CommonState.getTime();
if ((time % epoch) == 0) {
initvar = -1.0;
}
/* Initialization */
final int len = Network.size();
IncrementalStats stats = new IncrementalStats();
/* Compute max, min, average */
for (int i=0; i < len; i++) {
Node node = Network.g... | 9 |
@Override
public Class<?> getDataType() {
return BlankData.class;
} | 1 |
@Test
public void testDeleteElement() {
int blockSize = 100;
int keySize = 4;
int numIndexPairs = 300;
AbstractBlockBasedIndex<?> index = createIndex(tempFolder, keySize, blockSize);
IndexPair[] indexPairs = new IndexPair[numIndexPairs];
for (int i = 0; i < numIndexPairs; i++) {
byte si... | 5 |
private static double[] generateWave(Double rate, double... freqMagPhase) {
double[] data = new double[TWO_POWER];
for (int fm = 0; fm < freqMagPhase.length; fm += 3) {
double frequency = freqMagPhase[fm];
double magnitude = freqMagPhase[fm + 1];
double phase = freqMagPhase[fm + 2];
for (int t = 0; t <... | 2 |
public void paint(Graphics g) {
Graphics g2d = (Graphics2D) g;
// g2d.drawString("Hello", 50, 50);
// g2d.fillOval(250, 250, diskSize, diskSize);
java.awt.Color white = java.awt.Color.WHITE;
java.awt.Color black = java.awt.Color.BLACK;
int initial_x = 50;
int initial_y = 50;
g2d.setColor(black);
for (... | 8 |
private static String toString(double value) {
String result = Double.toString(value);
if (result.endsWith(".0")) { //$NON-NLS-1$
result = result.substring(0, result.length() - 2);
}
return result;
} | 1 |
void parseETag() throws java.lang.Exception
{
String name;
name = readNmtoken(true);
if (name != currentElement) {
error("mismatched end tag", name, currentElement);
}
skipWhitespace();
require('>');
if (handler != null) {
handler.endEl... | 2 |
@Override
public int insertCustomer(Customer customer) {
String sql = "INSERT INTO customer (forename, surname, house_no, "
+ "street, postcode, email, balance, card_no, cust_password)"
+ " VALUES ('" + customer.getForename() + "', '"
+ customer.getSurname() + "', '"
+ cust... | 5 |
public void insertarIconos(){
if(contadorMinas==1)
this.setIcon (uno);
if(contadorMinas==2)
this.setIcon(dos);
if(contadorMinas==3)
this.setIcon(tres);
if(contadorMinas==4)
this.setIcon(cuatro);
if(contadorMinas==5)
this.setIcon(cinco);
if(contadorMinas==6)
this.setIcon(seis);
if(contado... | 8 |
public void gameLoop()
{
Scanner s = input;
boolean done = false;
MultiRummy nr = null;
gc = null;
nr = new MultiRummy();
System.out.printf("Connect address: %s\n", nr.getConnectString());
do
{
System.out.printf(">> ");
String cmd = s.nextLine();
int i;
Matcher m = null;
for (i ... | 9 |
@Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if(getValueAt(0, column)==null)
return String.class;
returnValue = getValueAt(0, column).getClass();
... | 3 |
public boolean equals(Object other) {
if (other == null)
return false;
if (other == this)
return true;
if (!(other instanceof Vector))
return false;
Vector otherVector = (Vector) other;
if (otherVector.x == x && otherVector.y == y)
return true;
return false;
} | 5 |
@Test(groups = { "Integer-Sorting", "Primitive Sort" })
public void testInsertionSortInt() {
Reporter.log("[ ** Insertion Sort ** ]\n");
try {
testSortIntegers = new InsertionSort<>(
primitiveShuffledArrayInt.clone());
Reporter.log("1. Unsorted Random Array\n");
timeKeeper = System.currentTimeMill... | 4 |
private static URL url(String str) {
try {
str = URLEncoder.encode(str, ENCODING);
} catch (UnsupportedEncodingException e) {
return null;
}
URL url = null;
try {
url = new URL(apiurl + apikey + "&target=" + lang + "&q=" + str);
} catch (MalformedURLException e) {
return null;
}
return url;
... | 2 |
public int colisionesMisDisparosConList(List list) {
int colisionesMortales = 0;
Iterator<Disparo> itDisparo = disparos.iterator();
try{
while(itDisparo.hasNext()){
Disparo disparo = itDisparo.next();
Iterator<Solido> itSolido = list.iterator(); ... | 9 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if((affected!=null)&&(affected instanceof MOB)&&(tickID==Tickable.TICKID_MOB))
{
final MOB mob=(MOB)affected;
if((target==null)
||(mob.location()!=target.location())
||(!CMLib.flags().canBeSeenBy(target,mob)))
{
aborted = true;
u... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
AbstractPuzzle other = (AbstractPuzzle) obj;
if (counter != other.counter) {
return false;
}
if (difficulty != other.dif... | 6 |
@Override
public void perform(ISConnection connection, Map<String, String> params) {
List<String> keys = new ArrayList<String>();
keys.add("folder");
keys.add("file");
keys.add("nazev");
keys.add("popis");
keys.add("njmeno");
keys.add("opt");
boolean ... | 9 |
@Override
public void run() {
try {
sendBlockMangerData();
} catch (Exception e) {
EIError.debugMsg("Error Receiving Block Manager Data..." + e.getMessage());
}
} | 1 |
protected boolean toggleFeature(Features feature) {
switch (feature.getValue()) {
case 1: return setRoad(!road);
case 2: return setRailroad(!railroad);
case 3: return setIrrigation(!irrigation);
case 4: return setVillage(!village);
case 5: return setCi... | 6 |
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
int leagueYear;
String LeagueTitle = request.getParameter("title1");
String LeagueSeason = request.getP... | 4 |
public int calLCSLength(char[] X, char[] Y){
if (X== null || Y == null ) return -1;
int m = X.length;
int n = Y.length;
c = new int[m+1][n+1];
b = new char[m+1][n+1];
for (int i = 0; i < m; i++) {
c[i][0] = 0;
}
for (int j = 0; j < n; j++) {... | 8 |
public void addForceFieldToConnection(ForceField forceField) {
if (forceField == null)
throw new IllegalArgumentException("The given forcefield for the forcefieldconnection can't be null!");
if (this.forceFields.contains(forceField))
throw new IllegalArgumentException("The given forcefield is already added in... | 2 |
@Override
public void Consultar() throws SQLException
{
try
{
Conexion.GetInstancia().Conectar();
ResultSet rs = Conexion.GetInstancia().EjecutarConsulta("SELECT TipProSer_Descuento,Des_Descuento,Porcen_Descuento FROM Descuento WHERE Id_Descuento ='"+ObDecuento.getId_Des... | 2 |
public void RemovePlayer(Player player) {
if (Creator.ID == player.ID && (CurrentGameStatus == GameStatus.WaitingForPlayer || CurrentGameStatus == GameStatus.FirstRoundPlacing) || Players.size() == 1)
Finish();
else
player.PlayerStatus = PlayerStatus.Undefined;
if (_spi... | 6 |
protected void setGapSequence(String newGapSequence, int whichGapSequence) {
int sLen = 0;
switch (whichGapSequence) {
case GAP_ONE:
sLen = m_s1_size;
break;
case GAP_TWO:
sLen = m_s2_size;
break;
default:
System.err.pr... | 8 |
@Test
public void out_a_car_when_in_a_car() {
Car car = new Car();
Ticket ticket = manager.in(car);
Assert.assertSame(manager.out(ticket), car);
} | 0 |
private static Comparator<ContentObject> getContentObjectSizeComparator() {
if (contentObjectSizeComparator == null) {
contentObjectSizeComparator = new Comparator<ContentObject>() {
@Override
public int compare(ContentObject o1, ContentObject o2) {
if (o1 == null || o2 == null || o1.getCoords() == nu... | 7 |
public JButton getButtonCancel(){
return buttonCancel;
} | 0 |
private int evalState(State s) {
if (me.equals("red"))
return s.getnRed() - s.getnBlue();
return s.getnBlue() - s.getnRed();
} | 1 |
public void playercommand(String commandWord,Command command,Parser parser,boolean wantToQuit) throws IOException{
if (commandWord.equals("help")) {
printHelp(parser);
} else if (commandWord.equals("quit")) {
wantToQuit = quit(command);
} else if (commandWord.equals("take")) {
playerTake(command);
} e... | 8 |
public static void main (String [] args) {
Socket s = null;
InputStreamReader input;
BufferedReader b;
PrintWriter p;
String result = null;
InputStreamReader stdin;
BufferedReader console;
String line = null;
try {
s = new Socket(Utils.REGISTRAR_ADDR, Utils.FAULTMNGR_PORT);
s.setKeep... | 3 |
public Enemy getEnemy(int ID){
ArrayList<Enemy> enemies = actualRoom.Enemies;
int i=0;
while(enemies.get(i).getEnemyID() != ID && i < enemies.size()) ++i;
if(i < enemies.size()) return enemies.get(i);
else return null;
} | 3 |
void removeDev (DeviceImpl dev)
{
synchronized (devices) {
DeviceImpl d = devices [dev.getAddress () - 1];
int i;
if (d == null || d != dev)
return;
i = d.getAddress () - 1;
devices [i] = null;
if (root == i) {
root = -1;
if (Linux.trace)
System.err.println ("bus root hu... | 7 |
public Vector[] generatePath() {
int xP = begin.getX(), yP = begin.getY();
Vector v = new Vector(begin, end);
Directions[] baseDirections = Direction.getDirectionByVector(v).isStraight() ? new Directions[] { Direction.getDirectionByVector(v) } : Direction.getDirectionByVector(v).split();
Directions xD = baseDir... | 9 |
public ModelInfo dupe()
{
ModelInfo mi = new ModelInfo();
if (author != null)
mi.author = new String(author);
if (name != null)
mi.name = new String(name);
if (source != null)
mi.source = new String(source);
if (modelNumber != null)
mi.modelNumber = new ... | 4 |
public void connexionServeur() throws IOException {
connexion.envoyer("INIT");
if((reponse = connexion.recevoir()).equals("200 READY")) {//200 READY
reponse = connexion.recevoir();//ID CONTROLEUR + JSON LIGNES
int idControleur = 0;
Main.controleur.setId(idControleur);
}
} | 1 |
@Override
public boolean isFull() {
for (int i = 0; i < buffer.length; ++i) {
if (buffer[i] == null) {
return false;
}
}
return true;
} | 2 |
public void IncrementTotalPassangersTransported()
{
//increment passenger onboard
totalPassengersTransported += 1;
} | 0 |
private void button_remove_red_listMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button_remove_red_listMousePressed
if(frame_index_selected!=-1)
{
if(current_frame==null)
{
Element new_frame = hitboxes_doc.createElement("Frame");
new_frame.setAttribute("n... | 6 |
public boolean findAtWest(int piece, int x, int y){
if(y==0 || b.get(x, y-1)==EMPTY_PIECE) return false;
else if(b.get(x, y-1)==piece) return true;
else return findAtWest(piece,x,y-1); // there is an opponent
} // end findAtWest | 3 |
final public void Assignment_expression() throws ParseException {
/*@bgen(jjtree) Assignment_expression */
SimpleNode jjtn000 = new SimpleNode(JJTASSIGNMENT_EXPRESSION);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
Le... | 8 |
public Object [][] getDatos(){
Object[][] data = new String[getCantidadElementos()][colum_names.length];
//realizamos la consulta sql y llenamos los datos en "Object"
try{
if (colum_names.length>=0){
r_con.Connection();
String c... | 5 |
private ArrayList<Couple> comptage()
{
ArrayList<Couple> resultats = new ArrayList();
ArrayList<String> lettre = new ArrayList();
for(int i=0; i<this.longueur_texte; i++)
{
if(lettre.isEmpty() == false)
{
int test = lettre.indexOf("" + this.text.charAt(i));
if(test != -1)
// Le cas o�test es... | 3 |
public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
for (; ; ) {
StringTokenizer st = new StringTokenizer(in.readLine().trim());
int P = parseInt(st.nextToken()), V = parseInt(st.nextToken()), E = parseInt(st.nextToken());
if(P=... | 8 |
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 int getState() {
return state;
} | 0 |
private PublicKey loadPublicKey(Object publicKeyObject, boolean isCert)
throws IOException, GeneralSecurityException {
PublicKey publicKey;
if (publicKeyObject instanceof PublicKey) {
publicKey = (PublicKey)publicKeyObject;
} else if (publicKeyObject instanceof X509Certificate... | 8 |
public Dot move(String[] grid, int current_r, int current_c, Direction direct) {
Dot newDot = null;
newDot = new Dot();
switch (direct) {
case UP:
newDot.rowNum = (current_r - 1);
newDot.columnNum = current_c;
break;
case D... | 8 |
public void render(Bitmap b) {
if(dir == 0) {
ImageManager.renderFromImage(entityType, b, (int)x, (int)y, ((animation_frame == 0) ? 1 : 0), 16);
} else if (dir == 1) {
ImageManager.renderFromImage(entityType, b, (int)x, (int)y, 2 + ((animation_frame == 0) ? 1 : 0), 16);
} else if (dir == 2) {
ImageManage... | 8 |
public void checkWin()
{
boolean win = true;
for(int i = 0; i<numEnemy; i++)
if(enemy[i].alive)
win = false;
if(win)
{
lp.level++;
lp.updateLabels();
numEnemy+=2;
reset();
}
} | 3 |
public static Ontology getOntologyObject(ExtendedIterator<Ontology> ontologies) {
Ontology o = null;
if (ontologies.hasNext()) {
o = ontologies.next();
}
if (ontologies.hasNext()) {
log.warn("More than one ontology object was found.");
}
return o;... | 2 |
public synchronized static String getPlayerStatus(String uIP) {
String msg = "GET_PLAYER_STATUS PLAYER_NOT_FOUND";
NodeList nList = doc.getElementsByTagName("player");
Element player = getPlayerElement(uIP, true);
if (nList != null && player != null) {
if (player.getParentNode().getNodeName()
.equals("... | 6 |
public void swapInventory(int from, int to) {
inventory.swapInventoryLocations(from, to);
if (registry.getGameController().multiplayerMode != registry.getGameController().multiplayerMode.NONE && registry.getNetworkThread() != null) {
if (registry.getNetworkThread().readyForUpdates()) {
... | 3 |
public void runGameTimedSpeedOptimised(Controller<MOVE> pacManController,Controller<EnumMap<GHOST,MOVE>> ghostController,boolean fixedTime,boolean visual)
{
Game game=new Game(0);
GameView gv=null;
if(visual)
gv=new GameView(game).showGame();
if(pacManController instanceof HumanController)... | 9 |
@Override
public void handleMessages(Inbox inbox) {
while (inbox.hasNext()) {
Message m = inbox.next();
if (m instanceof PackHello) {
statistic.countHeardMessagesTree();
PackHello msg = (PackHello) m;
System.out
.println("-------------MSG Hello arrive------------------");
System.out.pr... | 4 |
public boolean verifDeplacementValide(int x, int y, Jeu j){
// On teste si le voleur se déplace en diagonale ou en direction unique :
boolean directionUnique = (x == this.getPositionX() || y == this.getPositionY());
int nbCasesParcourues = 0; // nombre de cases nécessaires à parcourir pour arriv... | 4 |
public void setfocus(Widget w) {
if (focusctl) {
if (w != focused) {
Widget last = focused;
focused = w;
if (last != null)
last.hasfocus = false;
w.hasfocus = true;
if (last != null)
last.lostfocus();
w.gotfocus();
if ((ui != null) && ui.rwidgets.containsKey(w))
wdgmsg("f... | 7 |
@Override
public void init() {
running_as_applet = true;
acontext = getAppletContext();
String s = getParameter("jorbis.player.playlist");
playlistfile = s;
s = getParameter("jorbis.player.icestats");
if (s != null && s.equals("yes")) {
icestats = true;... | 5 |
public void setVille(String ville) {
this.ville = ville;
} | 0 |
private static String convertWithDriver(Object parameter) {
try {
return JSON.serialize(parameter);
} catch (Exception e) {
String message = "无法将参数[" + parameter + "]绑定到查询json字符串中";
throw new IllegalMongoShellException(message, e);
}
} | 1 |
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Map<String,String> fouten = new HashMap<>();
BigDecimal percentage = null;
try {
percentage = new BigDecimal(request.getParameter("percentage"));
if (percentage.compareTo(BigDeci... | 3 |
int peekInt() {
return ((Integer) peek()).intValue();
} | 0 |
public boolean canHaveAsBalance(BigInteger balance) {
return (balance != null) && (balance.compareTo(this.getCreditLimit()) >= 0);
} | 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 |
private void convertFileDataToArray(int i, String root) {
// for each time stage file construct array 85 fundamental data
// points for each symbol
float[][] data = new float[dbSet.size()][];
// for each time stage file construct array 7 technical data points
// for each symbol
float[][][] pdata = new float... | 6 |
public String toString(){
String s="";
for(int y=polyominos[0].length-1;y>=0;y--){
for(int x=0;x<polyominos.length;x++){
if(polyominos[x][y]==1)
s+="X";
else
s+="O";
}
s+="\n";
}
return s;
} | 3 |
public void paintComponent(Graphics g){
super.paintComponent(g);
if(rightHeld){
Driver.pView.imgNum = (Driver.pView.imgNum + 1) % Driver.pView.frameCount;
Driver.player.moveRight();
}
if( leftHeld){
Driver.player.moveLeft();
}
// Spawn enemies based on spawn frequency
if(((Driver.player.getDi... | 6 |
private int getMinIndex(List<Pair<Integer, mouseNode>> nodes, Pair<Integer, Integer> target, mouseNode init) {
if (nodes.isEmpty()) {
return -1;
}
int minValue = 99999;
int minPos = 0;
for (int i = 0; i < nodes.size(); i++) {
if (nodes.get(i).second == i... | 5 |
private void generateHardwareSetAlternativesGeneration(int generation) {
for (HardwareSet hws : project.getHardwareSets())
hws.generateHardwareSetAlternativesGeneration(generation);
} | 1 |
private void initBoard() {
int last = b.length-1;
for(int i = 0; i < b.length;i++) {
b[i][0] = 4;
b[i][last]=4;
b[0][i] = 4;
b[last][i] = 4;
}
for(int i = 1; i < last;i++) {
b[i][1] = 6;
b[i][last-1]=6;
b[1][i] = 6;
b[last-1][i] = 6;
}
for(int i = 2; i < last -1;i++) {
fo... | 4 |
public final ObjectProperty<ToggleGroup> toggleGroupProperty() {
if (null == toggleGroup) {
toggleGroup = new ObjectPropertyBase<ToggleGroup>() {
private ToggleGroup oldToggleGroup;
@Override protected void invalidated() {
final ToggleGroup toggleG... | 5 |
public double olbStart() {
sortResources();
sortClass();
calculateWeight();
dmMinminCost = new double[iSite][iCPUMaxNum];
dmMinminTime = new double[iSite][iCPUMaxNum];
double[] daMinminTimeBySite = new double[iSite];
boolean lastActivity;
// find the current cheapest site for the acitvities.
int k =... | 9 |
public void paint(Graphics g)
{
super.paint(g);
//Draw the individual elements
for (int i = 0; i < playerList.size(); i++){
g.drawImage(playerList.get(i).getImage(), playerList.get(i).getX(), playerList.get(i).getY(), this);
}
for (int i = 0; i < enemyList.size(); i++){
g.dra... | 4 |
private int getMinInd(int pos1, int pos2) {
return heap[pos1] <= heap[pos2] ? pos1 : pos2;
} | 1 |
public JPanel getWindowMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.windowMenu;
} | 1 |
@Override
public void endDocument() throws SAXException {
super.endDocument();
complete = true;
} | 0 |
public static void main(String [] args) {
try {
Stats ps = new Stats();
java.io.LineNumberReader r = new java.io.LineNumberReader(
new java.io.InputStreamReader(System.in));
String line;
while ((line = r.readLine()) != null) {
line = line.trim();
if (line.equals("") |... | 8 |
public Writer write(Writer writer) throws JSONException {
try {
boolean b = false;
int len = length();
writer.write('[');
for (int i = 0; i < len; i += 1) {
if (b) {
writer.write(',');
}
Obj... | 5 |
public UIFurnace(EntityPlayer p, TileEntityFurnace tileEntity, World world)
{
this.tile = tileEntity;
this.theWorld = world;
for(int i = 0 ; i < 10 ; i++)
{
this.slots[i] = new UIInventorySlot(BlockyMain.width / 2 - 16 - (32 * 4) - 12 + i * 32 + i + 3, BlockyMain.height / 2 - 32-50 - 3 - 32 - 20... | 5 |
private void bookRoomButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bookRoomButtonActionPerformed
if (roomTable.getSelectedRow() > -1) {
Room chosenRoom = null;
int selectedRowIndex = roomTable.getSelectedRow();
int roomNo = (Integer) roomTableModel.... | 6 |
private WorldCoordinate getOtherTrackLocation(WorldCoordinate otherCoord) {
SignalBlock other = getSignalAt(otherCoord);
if (other != null) {
WorldCoordinate track = other.getTrackLocation();
if (track != null)
trackCache.put(otherCoord, track);
return... | 2 |
public static void main(String[] args){
//initial stuff used in making the map
int x = 80; int y = 25; int dungeon_objects = 0;
//convert a string to a int, if there's more then one arg
if (args.length >= 1)
dungeon_objects = Integer.parseInt(args[0]);
if (args.length >= 2)
x = Integer.parseInt(args[1... | 4 |
private void runGibbsSampling() {
for (int i = 0; i < param.nIterations; ++i) {
for (int d = 0; d < param.D; ++d) {
int N = docs[d].length;
for (int n = 0; n < N; ++n) {
// Sample from p(z_i|z_-i, w)
sampleTopicAssignment(d, n);
}
}
if (i >= param.nBurnin) {
if (i == param.nBurnin
... | 9 |
public static void setController(MainController controller) {
mainController = controller;
} | 0 |
private List<Opdracht> leesOpdrachtenVanBestand() {
File file = new File("bestanden/opdrachten");
List<Opdracht> list = new ArrayList<Opdracht>();
if (file.exists()) {
try {
Scanner scanner = new Scanner(file);
while (scanner.hasNext()) {
String lijn = scanner.nextLine();
String[] velden = li... | 9 |
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.