text stringlengths 14 410k | label int32 0 9 |
|---|---|
protected void defineWorld(int worldType) {
world = new HashMap<Position,Tile>();
String[] layout;
if ( worldType == 1 ) {
layout = new String[] {
"...ooMooooo.....",
"..ohhoooofffoo..",
".oooooMooo...oo.",
".ooMMMoooo..oooo",
"...ofooohhoooo..",
... | 8 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... | 8 |
public File getFileChoice(Component parent) {
if (chooser.showSaveDialog(parent) == JFileChooser.APPROVE_OPTION) {
File newFile = chooser.getSelectedFile();
if (chooser.getFileFilter() == zipFilter) {
// ZIP was selected...add .zip to the end of the filename
// if it doesnt exist alrea... | 9 |
@Override
public Connection getConnection() throws DatabaseManagerException {
try {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
return DriverManager.getConnection("jdbc:derby:" + createConnectionString());
} catch (SQLException e) {
throw new DatabaseManagerException("Failed to get connection u... | 2 |
@Override
public void run() {
while (!Vars.stop) {
DatagramSocket sk = null;
try {
sk = new DatagramSocket(3998);
} catch (SocketException e1) {
e1.printStackTrace();
}
if (sk == null) {
return;
}
try {
sk.setSoTimeout(5000);
} catch (SocketException e2) {
e2.printStackTra... | 9 |
public boolean insert(String word){
TrieNode location = root;
boolean result = false;
int char_code;
for(int i = 0; i < word.length(); i++) {
char_code = word.charAt(i) - 'a';
if(location.getBranch(char_code) == null){
location.createBranch(char... | 3 |
public void writeResponse(HttpServletRequest request, HttpServletResponse response) throws IOException {
// Note: This is needed only for development
String referer = request.getHeader("referer");
URI refererUri = null;
try {
refererUri = new URI(referer);
} catch (URISyntaxException e) {
... | 3 |
public static boolean checkPangrams(String s){
String allAlphabets = "abcdefghijklmnopqrstuvwxyz";
boolean[] b = new boolean[26];
char[] charArray = s.toCharArray();
for(char c: charArray) {
if(c >=97 && c <=122) {
if(!b[allAlphabets.indexOf(c)]) {
b[allAlphabets.indexOf(c)] = true;
}
}
... | 6 |
public static void mkDirs(StringBuffer dirPath) {
File dir = new File(dirPath.toString());
if (!dir.isDirectory() && !dir.exists()) {
dir.mkdirs();
}
} | 2 |
public static String getRowString(int row) {
String strRow = "unknown";
switch (row) {
case ROW_1: strRow = "1"; break;
case ROW_2: strRow = "2"; break;
case ROW_3: strRow = "3"; break;
case ROW_4: strRow = "4"; break;
case ROW_5: strRow = "5";... | 8 |
@Override
public void execute(CommandSender sender, String worldName, List<String> args) {
this.sender = sender;
if (worldName == null) {
error("No world given.");
reply("Usage: /gworld allowmonsters <worldname> <true|false>");
} else if (!hasWorld(worldName)) {
reply("World not found: " + worldName)... | 5 |
public void automataStateChange(AutomataStateEvent e) {
setDirty();
} | 0 |
@Override
public void itemStateChanged(ItemEvent e) {
vue.getZoneDesJoueurs()[nbJoueur].getBoutonAcheterMaison().setEnabled(false);
if(e.getStateChange() == ItemEvent.SELECTED && e.getItem() instanceof Propriete) {
Propriete p = (Propriete)e.getItem();
if(p.getNbMaison() != 4) {
vue.getZoneDesJoueu... | 3 |
public void reset()throws TableException{
String createString;
java.sql.Statement stmt;
try{
createString = "drop table " + PRODUCT_TABLE_NAME + ";";
stmt = mysqlConn.createStatement();
stmt.executeUpdate(createString);
} catch (jav... | 3 |
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
} | 1 |
@Override
public boolean selectFileToSave(OutlinerDocument document, int type) {
// we'll customize the approve button
// [srk] this is done here, rather than in configureForOpen/Import, to workaround a bug
String approveButtonText = null ;
// make sure we're all set up
lazyInstantiation();
// Setup ... | 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 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 Map<String, PatchScript> preParsePatchScripts(PromotionManifestParser pManifestParser){
Logger.logInfo("Validating patches...");
Map<String, PatchScript> lParsedScriptMap = new HashMap<String, PatchScript>();
//Map of patch labels to highest orders - used to verify script order is correct
... | 7 |
public void update(TheaterSeats theaterSeats) {
for(int i = 0; i < seatStatus.length; i++)
for(int j = 0; j < seatStatus[i].length; j++)
if(theaterSeats.getSeatStatus(i, j) == 'O')
this.seatStatus[i][j] = 'O';
} | 3 |
public DefaultListModel<Juego> selectAllJuegos(){
DefaultListModel<Juego> model = new DefaultListModel<>();
try {
List<Juego> juegos = juegoDao.queryForAll();
for(Juego j: juegos) model.addElement(j);
} catch (SQLException ex) {
Logger.getLogger(D... | 2 |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String oldpass = new String(p1.getPassword());
oldpass= Md5Hash.passwordsalted(oldpass);
String a= new String (p2.getPassword());
String b= new String (p3.getPassword());
Str... | 6 |
public static void main(String[] argv) {
Properties param = new Properties();
//String midlet = null;
//String jadfile = null;
for (int i = 0; i < argv.length; i++) {
if (argv[i].startsWith("-")) {
param.put(argv[i].substring(1), argv[i + 1]);
... | 6 |
public static void refreshCalendar(final int month, final int year) {
// Variables
final String[] months = { "January", "February", "March", "April",
"May", "June", "July", "August", "September", "October",
"November", "December" };
int nod, som; // Number Of Days, Start Of Month
// Allow/disallow butt... | 7 |
public static void lowestCommonAncestorTwoIterative(BinaryTreeNode root, int d1, int d2) throws IllegalArgumentException {
if (d1 > d2) {
int t = d1;
d1 = d2;
d2 = t;
}
while (root != null) {
if (root.data >= d1 && root.data < d2) {
System.out.println("LCA-2: " + root.data);
return;
... | 6 |
public static int numDistinct(String s, String t) {
if (t.length() == 0)
return 1;
if (s.length() == 0)
return 0;
if (s.length() == 1 && t.length() == 1) {
if (s.charAt(0) == t.charAt(0)) {
return 1;
} else {
return 0;
}
}
if (s.charAt(0) == t.charAt(0))... | 6 |
public void loadCity(int whichCity){
tl.setSquares();
if(whichCity == 1){
//loadCity16();
try{
//rl.saveMap(city1[5], "city1s6");
city1[0] = setMapSecs(rl.getMap("city1",false,"city1s1"));
city1[1] = setMapSecs(rl.getMap("city1",false,"city1s2"));
city1[2] = setMapSecs(rl.getMap("city... | 5 |
@Override
public void setLifeTimeToMax() {
lifetime = MAX_LIFETIME;
for(PositionChangedObservable o : hoveringElements) {
o.accept(new ActivatePowerFailureVisitor());
}
} | 1 |
public World(boolean hardcore){
this.assetManager = ContentManager.getInstance().getAssetManager();
this.hardcore = hardcore;
} | 0 |
public void close(Object ... objects) {
for (Object o : objects) {
String name = o.getClass().getName();
if (name.equals(Connection.class.getName())) {
closeConection((Connection)o);
} else if (name.equals(Statement.class.getName()) ||
name.equals(PreparedStatement.class.getName())) {
closeS... | 5 |
public void startLiveWindowMode() {} | 0 |
@SuppressWarnings("unchecked")
protected boolean addValue(String subject, String variable, String value, boolean addToLines)
{
//if no subject, quit
if ((subject == null) || (subject.length()==0)) return false;
//if no variable, quit
if ((variable == null) || (variable.length()==0)) return false;
//if the... | 7 |
public ResultSet returnPlayersInTeam(String teamName, String matchName){
try {
cs = con.prepareCall("{call returnPlayersInTeam(?,?)}");
cs.setString(1, teamName);
cs.setString(2, matchName);
rs = cs.executeQuery();
} catch (SQLException e) {
e.printStackTrace();
}
return rs;
} | 1 |
public void validate() throws XPathException {
//checkWithinTemplate();
// get the Mode object
if (!useCurrentMode) {
mode = getPrincipalStylesheet().getRuleManager().getMode(modeName, true);
}
// handle sorting if requested
AxisIterator kids = iterateAxis... | 9 |
private void incrementVariables(int round, int[] plate)
{
choice++;
if(round == 0)
choicesleft = (nplayers - index - choice) - 1; //Excluding the current plate
else
choicesleft = (nplayers + 1 - choice) - 1;
if(initflag)
{
for(int i = 0; i < length; i++)
numfruits = numfruits + plate[i];
if... | 7 |
public void addDoc(int did) {
// Check if we need to add a skip list node
if (numDocs == 0) {
SkipNode node = new SkipNode(did, docs.size(), weights.size());
skipList.add(node);
} else if (numDocs % SKIP_INTERVAL == 0) {
SkipNode node = new SkipNode(lastDid, docs.size(), weights.size());
skipList.add... | 7 |
public String getRWord(){
return rWord;
} | 0 |
public static boolean hasSmallPrimeDivisor(BigInteger w) {
BigInteger prime;
for (int i = 0; i < SMALL_PRIME_COUNT; i++) {
prime = SMALL_PRIME[i];
if (w.mod(prime).equals(ZERO)) {
if (DEBUG && debuglevel > 4) {
debug(prime.toString(16)+" | "+w.toString(16)+"...")... | 6 |
@Override
public void onRepaint(Graphics g) {
try {
for(final int i : Skills.getExperiences()) {
totalXP += i;
}
currCount = totalXP;
totalXP = 0;
if(lastCount != currCount) {
combined = combined + Settings.amount;
}
lastCount = currCount;
paint(g);
} catch (Except... | 3 |
private static InputStream getInputStream(String filePath)
{
InputStream instream = null;
try
{
instream = new FileInputStream(filePath);
}
catch (Exception e)
{
URL url = PropertyReader.class.getClassLoader().getResource(filePath);
if... | 5 |
public boolean isViewed() {
return viewed;
} | 0 |
public static Date ConverteData(String dataString) throws Exception {
if (dataString == null || dataString.equals("")) {
return null;
}
DateFormat fmt = new SimpleDateFormat("dd/MM/yyyy");
java.sql.Date data = new java.sql.Date(fmt.parse(dataString).getTime());
retu... | 2 |
public ClassAnalyzer findAnonClass(String name) {
if (innerAnalyzers != null) {
Enumeration enum_ = innerAnalyzers.elements();
while (enum_.hasMoreElements()) {
ClassAnalyzer classAna = (ClassAnalyzer) enum_.nextElement();
if (classAna.getParent() == this && classAna.getName() != null
&& classAna.... | 5 |
private static String readQueryFromReader(Reader reader, NameChecker nameChecker) throws XPathException {
try {
FastStringBuffer sb = new FastStringBuffer(FastStringBuffer.LARGE);
char[] buffer = new char[2048];
boolean first = true;
int actual;
int li... | 9 |
private static Field getLabelStatusField() {
if (labelStatusField == null) {
labelStatusField = getLabelField("a");
if (labelStatusField == null) {
labelStatusField = getLabelField("status");
}
}
return labelStatusField;
} | 2 |
private TreeWillExpandListener createTreeWillExpandListener() {
return new TreeWillExpandListener() {
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
onWillExpandOrCollapse(event, true);
}
public void treeWillCollapse(TreeExp... | 5 |
@Override
public void moveCustomerToSellerQueue(int currentPhase, Queue lineQueue,
ArrayList<TicketSeller> sellers) {
Customer tmpCustomer;
TicketSeller tmpSeller;
Random rd = new Random();
while(!lineQueue.isEmpty()){
int randomNum = rd.nextInt(Define.theNumberOfTicketSeller);
tmpSeller = s... | 3 |
private void setToolTips()
{
newButton.setToolTipText( LOCALIZER.getString(TT_NEW));
openButton.setToolTipText( LOCALIZER.getString(TT_OPEN));
saveButton.setToolTipText( LOCALIZER.getString(TT_SAVE));
playButton.setToolTipText( LOCALIZER.getString(TT_PLAY));
... | 3 |
public int getOpcode(final int opcode) {
if (opcode == Opcodes.IALOAD || opcode == Opcodes.IASTORE) {
// the offset for IALOAD or IASTORE is in byte 1 of 'off' for
// primitive types (buf == null)
return opcode + (buf == null ? (off & 0xFF00) >> 8 : 4);
} else {
// the offset for other instructions is i... | 4 |
@Override
public String toString() {
int spos = back;
int max = Math.min(start-1, end);
int charCount = 0;
for (int i = 0; i < max + 1 - back && i < BACK; i++) {
char c = buf[max-i];
if (c == '\r' || (c == '\n' && (max-i-1 < 0 || buf[max-i-1] != '\r'))) {
if (charCount > 0) break;
} else if (c != ... | 9 |
public void testNegated() {
Years test = Years.years(12);
assertEquals(-12, test.negated().getYears());
assertEquals(12, test.getYears());
try {
Years.MIN_VALUE.negated();
fail();
} catch (ArithmeticException ex) {
// expected
... | 1 |
private void fillChoice(JComboBox c, String implDir, String selection) {
c.removeAllItems();
Vector<String> names = Global.getImplementations(implDir);
if(!names.contains(selection)) {
names.add(selection);
}
for(String s : names) {
c.addItem(s);
}
c.setSelectedItem(selection);
} | 2 |
void visitAroundDFS(int i,int j, char[][] board)
{
board[i][j] = 'A';
if(i>0&&board[i-1][j]=='O')
{
visitAroundDFS(i-1, j, board);
}
if(i<height-1&&board[i+1][j]=='O')
{
visitAroundDFS(i+1,j,board);
}
if(j>0 && board[i][j-1]=='O')
{
visitAroundDFS(i,j-1,board);
}
if(j<width-1 && board... | 8 |
private void removeSuperiorityImpl() throws TheoryNormalizerException {
List<Superiority> superiority = theory.getAllSuperiority();
List<Rule> rulesToAdd = new ArrayList<Rule>();
Set<String> rulesToDelete = new TreeSet<String>();
removeSuperiority_ruleModification(rulesToAdd, rulesToDelete);
// superiority... | 6 |
@Override
public void run() {
try {
//System.err.println("DBThread Runs");
Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager.getConnection("jdbc:mysql://localhost/cdr_data?user=root&password=root");
preparedStatement = connect.prepareStatement("i... | 2 |
protected int findPrototypeId(String s)
{
int id;
// #string_id_map#
// #generated# Last update: 2007-05-09 08:15:15 EDT
L0: { id = 0; String X = null; int c;
L: switch (s.length()) {
case 4: X="call";id=Id_call; break L;
case 5: X="apply";id=Id_apply; break L;
... | 9 |
@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
if (!(event.getEntity() instanceof Wolf))
return;
if (!(event instanceof EntityDamageByEntityEvent))
return;
EntityDamageByEntityEvent subEvent = (EntityDamageByEntityEvent) event;
Entity at... | 9 |
private void checkForPredefinedFragments() {
String str = getFragmentAsString();
if (str == null)
return;
boolean needPromoter = !str.startsWith(PROMOTER_FRAGMENT_STR);
boolean needStart = !str.startsWith(needPromoter ? START_FRAGMENT_STR : PROMOTER_START_FRAGMENT_STR);
boolean needTerminator = !str.endsW... | 9 |
@Override
public void run() {
Long start = System.nanoTime();
try {
client.setSoTimeout(10000);
} catch (SocketException e) {
WebServer.triggerInternalError("Socket Timeout Set failed for socket on port " + client.getLocalPort()
+ ": " + e.getMessa... | 6 |
public String getEmailAddress() {
return emailAddress;
} | 0 |
public void render() {
BufferStrategy bs = getBufferStrategy();
if (bs == null) {
createBufferStrategy(3);
return;
}
int xOffset = player.x - (screen.width / 2);
int yOffset = player.y - (screen.height / 2);
level.renderTiles(screen, xOffset, yOf... | 8 |
public Product getResult() {
Product product = new Product(partA, partB, partC);
return product;
} | 0 |
public CSVReader(String filename) {
rows = new ArrayList<CSVRow>();
if(FileHelper.fileExists(filename)) {
BufferedReader br = null;
String line = "";
int lineCount = 0;
try {
br = new BufferedReader(new FileReader(filename));
while ((line = br.readLine()) != null) {
if(ROW_LIMIT == -1 ||... | 9 |
public static void main(String[] args) {
Circle circle = new Circle();
circle.draw();
// Add Triangle
} | 0 |
@EventHandler
public void onTimeBanEvent(TimeBanBanEvent event) {
String admin;
if (event.getSender() != null && event.isSenderPlayer()) {
admin = event.getSender().getDisplayName();
} else {
admin = "console";
}
// get ban
Ban b = event.getBa... | 5 |
private boolean checkDuplicate(String userID){
if(count > 0){
for (int i = 0; i < clientObj.length; i++) {
if((clientObj[i].getUserID()).equals(userID)){
return false;
}
}
}return true;
} | 3 |
public int compareTo(FileWrapper o){
return id - o.getId();
} | 0 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final AddressBinding other = (AddressBinding) obj;
if (deviceAddress == null) {
... | 9 |
public void apply() {
heading += headingDelta;
if (heading >= 360)
heading -= 360;
if (heading < 0)
heading += 360;
xPos += Math.cos(Math.toRadians(heading)) * movement;
yPos += Math.sin(Math.toRadians(heading)) * movement;
} | 2 |
public boolean isTransitiva() throws NaoEhRelacao {
HashMap<Integer, HashMap<Integer, Elemento>> map = getMap();
Conjunto c = new Conjunto();
for (Map.Entry<Integer, HashMap<Integer, Elemento>> entry : map.entrySet()) {
Integer i = entry.getKey();
HashMap<Integer, Elemen... | 7 |
public HashMap<Integer, Double> computeMatrixEigenVector(HashMap<Integer, HashMap<Integer, Double>> matrix, int maxIterator)
{
HashMap<Integer, Double> result = new HashMap<Integer, Double>();
//init
Iterator<Integer> it = matrix.keySet().iterator();
while(it.hasNext())
{
int key = it.next();
result.p... | 8 |
@Override
protected void init() {
super.init();
BmTestManager bmTestManager = BmTestManager.getInstance();
bmTestManager.testInfoNotificationListeners.add(new ITestInfoNotification() {
@Override
public void onTestInfoChanged(TestInfo testInfo) {
if (te... | 1 |
public double[] getY(double[] result, double x) {
double m = (x - h) / a;
double q = (1 - m * m) * b * b;
if (result == null) {
result = new double[2];
}
result[0] = Math.sqrt(q) + k;
result[1] = k - Math.sqrt(q);
return result;
} | 1 |
private void processOptions(){
longOptions = new HashMap<String,CmdLnOption>();
shortOptions= new HashMap<Character,CmdLnOption>();
for (CmdLnOption option: options){
option.setImmutable();
for (String name: option.getLongNames()){
if (longOptions.contains... | 5 |
public void testGetCycImage() {
System.out.println("\n**** testGetCycImage ****");
CycAccess cycAccess = null;
try {
try {
if (connectionMode == LOCAL_CYC_CONNECTION) {
cycAccess = new CycAccess(testHostName, testBasePort);
} else if (connectionMode == SOAP_CYC_CONNECTION) {... | 6 |
public static int nextConnectionId(int connectionId) {
if(connectionId == Packet.ANONYMOUS_CONNECTION_ID || connectionId == Packet.MAXIMUM_CONNECTION_ID)
return Packet.MINIMUM_CONNECTION_ID;
return connectionId + 1;
} | 2 |
public void listenToAuctionServer() {
// just build if the connection to the server is ok.
if (ioNotFound == false) {
String incommingMessage;
try {
while((incommingMessage = in.readLine()) != null) {
// server shut down
if (incommingMessage.equals("... | 8 |
public char determineNewPosition(char firstChar,char lastChar) {
switch(firstChar) {
case 'B':
if (lastChar=='I') {
return 'B';
}
else if (lastChar=='E') {
return 'U';
}
else {
System.err.println("1st="+firstChar+" and last="+lastChar);
return 'U';
}
case 'O':
if (lastChar=='O') {
... | 8 |
public void debug_stack() {
StringBuilder sb=new StringBuilder("## STACK:");
for (int i=0; i<stack.size(); i++) {
Symbol s = stack.elementAt(i);
sb.append(" <state "+s.parse_state+", sym "+s.sym+">");
if ((i%3)==2 || (i==(stack.size()-1))) {
debug_message(sb.toString());
sb = new Stri... | 3 |
private void createEdgesAndNodesFromLandPolygons(
HashMap<Integer, GMTShape> landPolygons,
HashMap<Integer, MapNode> nodes,
ArrayList<MapEdge> edges) {
// Create edges and nodes for each land polygon.
for (GMTShape shape : landPolygons.values()) {
if (sh... | 6 |
private void menuPage(){
menuPane = new JPanel();
menuPane.setBackground(SystemColor.activeCaption);
menuPane.setLayout(null);
//*****head label*****
JLabel lbl_menu = new JLabel("Menu");
lbl_menu.setFont(new Font("Arial", Font.BOLD, 30));
lbl_menu.setBounds(445, 20, 83, 56);
menuPane.add(lbl_menu);
... | 3 |
private String[] parseTOC(InputStream toc) throws IOException{
LinkedList<String> ll = new LinkedList<String>();
while(true){
StringBuilder sb = new StringBuilder();
while(true){
char c = (char)toc.read();
if(c == -1){
ll.removeFirst();
ll.removeLast();
return ll.toArray(new String[0]);... | 4 |
public void setLicenseDate(String licenseDate) {
this.licenseDate = licenseDate;
} | 0 |
private static byte[] pack(byte[] data, File path) throws IOException
{
JarInputStream in = new JarInputStream(new ByteArrayInputStream(data))
{
@Override
public ZipEntry getNextEntry() throws IOException
{
ZipEntry ret = super.getNextEntry();
... | 3 |
@Override
public void onServerStatusChanged() {
ServerStatusController.ServerStatus serverStatus = ServerStatusController.getServerStatus();
switch (serverStatus) {
case AVAILABLE:
connectionStatus.setText("SERVER IS AVAILABLE");
connectionStatus.setForegr... | 2 |
private void nameCheck()
{
if (name.text().isEmpty()) {
name.setText(System.getProperty("user.name"));
}
} | 1 |
public static void main(String[] args) throws Exception{
int port = 9999;
ServerSocket listenSocket = new ServerSocket(port);
System.out.println("Multithreaded Server starts on Port "+port);
while (true){
Socket client = listenSocket.accept();
System.out.println("... | 1 |
public void makeOneStep() {
for (int i = 0; i < nRows; i += 1) {
for (int j = 0; j < nColumns; j += 1) {
Denizen denizen = array[i][j];
denizen.makeOneStep(this);
}
}
setChanged();
notifyObservers();
} | 2 |
@Override
public String toString() {
StringBuilder s = new StringBuilder();
int empty = 0;
for (String s1 : notes)
if (s1.isEmpty())
empty++;
if (!(empty >= NOTESIZE && vol == 'q')) {
for (String s1 : notes) {
s.append(s1);
... | 5 |
public Point playerTakesTurn(Player player, Point selectedLocation) throws Connect4Exception, GameException {
Point locationMarkerPlaced = null;
if (player == null) {
throw new Connect4Exception(ErrorType.ERROR107.getMessage());
}
if (player.getPlayerType() != PlayerType.R... | 6 |
public int checkGG()
{
boolean teamOneDefeat = true;
for(Integer i: teamOneInd)
{
if(!shipList.get(i).isDestroyed())
{
teamOneDefeat = false;
}
}
boolean teamTwoDefeat = true;
for(Integer i: teamTwoInd)
{
... | 8 |
public void run() {
try {
boolean eos=false;
byte[] buffer=new byte[8192];
while(!eos) {
OggPage op=OggPage.create(source);
synchronized (drainLock) {
int listSize=pageOffsets.size();
long pos=
... | 8 |
public static void main(String[] args) {
CycLParser parser = new CycLParser(System.in);
try {
parser.term(true);
} catch (Exception e) {
System.err.println(e);
}
} | 1 |
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerMove(final PlayerMoveEvent event) {
final Location last = this.lastBlockChange.get(event.getPlayer().getName());
final Location to = event.getTo();
// only check further on block transitions
... | 3 |
public WeightedMove getBestMove(ChessGame game, int player, int depth){
calls++;
ArrayList<WeightedMove> possibleMoves = new ArrayList<WeightedMove>();
int[][] board = game.getBoard();
for(int x=0;x<8;x++){
for(int y=0;y<8;y++){
if(board[x][y]/7!=player)
continue;
Piece p = Piece.getPiece(board,... | 9 |
@Override
public BigInteger convertControlValueToControlComparable(Object aValue)
{
if ( aValue instanceof BigInteger )
{
return (BigInteger) aValue;
}
else if ( aValue instanceof Integer )
{
return new BigInteger( ((Integer) aValue).toString() );
}
else if ( aValue instanceof String )
{
Stri... | 8 |
private BaseCmd getCommands(String s) {
for (BaseCmd cmd : cmds) {
if (cmd.cmdName.equalsIgnoreCase(s)) {
return cmd;
}
}
return null;
} | 2 |
public boolean overlaps(CourseTime c) {
int[] cdays = c.getDays();
for(int i : cdays) {
for(int j : this.days) {
if(i == j) {
if(c.getStartTime() >= startTime && c.getStartTime() <= endTime) return true;
else if(c.getEndTime() <= endTime && c.getEndTime() >= startTime) return true;
else return... | 7 |
final void method50ms() {
long timeMillis = System.currentTimeMillis();
while (true) {
if (System.currentTimeMillis() > timeMillis + 50)
return;
try {
Thread.sleep(51);
} catch (InterruptedException e) {
Thread.interrupted();
}
}
} | 3 |
public void update() {
if(!isRunning) return;
for (Entity entity : entities) {
entity.update(0);
}
if(null != actions ){
synchronized (actions){
Iterator i = actions.iterator();
while (i.hasNext()){
((LoopedActi... | 4 |
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.