text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public void update(Observable o, Object arg) {
if (arg != null) {
if (arg.equals("drawBoard")) {
resetGUI();
menuModel.getBoardModel().generateNewBoard();
drawGameBoard();
}
else if (arg.equals("loadBoard")) {
menuModel.getBoardModel().addObserver(boardView); //when a board i... | 7 |
private String getDatabaseStructureInfo() {
ResultSet schemaRs = null;
ResultSet catalogRs = null;
String nl = System.getProperty("line.separator");
StringBuffer sb = new StringBuffer(nl);
sb.append("Configured schema:").append(schema).append(nl);
sb.append("Configured catalog:").append(catalog).append(nl);... | 6 |
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 |
@Override
public void onStatusMessage(NetworkEvent event) {
if (getType() == Type.CLIENT) {
if (event.getEvent() == NetworkEvents.START_CLIENT)
setActive(true);
else if (event.getEvent() == NetworkEvents.SHUTDOWN_CLIENT)
setActive(false);
} else if (getType() == Type.SERVER) {
if (event.getEvent()... | 6 |
public Character() {
_level = 1;
_generator = new NormalSpread();
_race = new Deva();
_class = new Ardent();
_classMap = new Vector<>();
BaseGenerator g = new SpecialSpread();
for (BaseClass bc : CLASSES) {
for (BaseRace br : RACES) {
... | 4 |
private final void giveExpToCharacter(final MapleCharacter attacker, int exp, final boolean highestDamage, final int numExpSharers, final byte pty) {
if (highestDamage) {
if (eventInstance != null) {
eventInstance.monsterKilled(attacker, this);
} else {
final EventInstanceManager em = attacker.getEventIn... | 8 |
public Ip parser(String ipStr){
String[] split = ipStr.split("\\.");
short[] ip = new short[split.length];
for(int i=0;i<split.length;i++){
ip[i] = Short.parseShort(split[i]);
}
return new Ip(ip);
} | 1 |
private static ArrayList<Point> setPoints(int n)
{
Random r = new Random();
ArrayList<Point> points = new ArrayList<Point>();
ArrayList<Point> available = new ArrayList<Point>();
points.add(new Point(0, 0));
while (n > 0)
{
for (Point location : points)
{
add(points, availa... | 2 |
@Override
public void buy(Command cmd)
{
cmd.execute();
if(Storage.getInstance().getRevenue() < 10000.0)
{
restaurant.setState(restaurant.getBadstate());
}else if(Storage.getInstance().getRevenue() >= 10000.0 && Storage.getInstance().getRevenue() < 20000.0)
{
restaurant.setState(restaurant.getNormalst... | 3 |
public String getAcceptKey() {
String key = this.getValue() + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
Base64 base64 = new Base64();
key = new String(base64.encode(md.digest(key.getBytes("UTF-8"))));
return key;
}
catch(NoSuchAlgorithmExcep... | 2 |
public static void main(String[] args) {
//System.out.println("Pakkausalgoritmi: " + );
long aloitusAika = System.currentTimeMillis();
String algoritmi = System.getProperty("pakkausalgoritmi");
if (algoritmi == null)
algoritmi = "huffman";
if (args.length != 3) {
System.out.println("Vr mr argumentteja.... | 9 |
private static void shuffle(int[] arr)
{
for (int i = 0 ; i != arr.length ; ++i) {
int j = random.nextInt(arr.length - i) + i;
int t = arr[i];
arr[i] = arr[j];
arr[j] = t;
}
} | 1 |
public void doCancel(){} | 0 |
public static void main(String[] args)
{
Song song = new Song(new File("Eine_Kleine_Nachtmusik.mid"));
try {
evaluate(new File("test.ff"), song);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} | 1 |
protected void move(){
if (target!= null && m.checkEnemy(target) == true)
{
//System.out.println(target);
turnTowards(target.getX(), target.getY());
move(speed) ;
}//IllegalActor here making it turn when its not there (DID JAMES ADDD THIS?)
else
... | 2 |
private final List<String> getStringList (Object[] objList) {
List<String> list = new ArrayList<String>();
for (int i = 0; i < objList.length; i++) {
list.add((String)objList[i]);
}
return list;
} | 1 |
public List<String[]> getAttributes(){
List <String[]> l = new ArrayList<String[]>();
String[] s = new String[2];
if (masa != null){
s[0] = "masa"; s[1] = masa;
l.add(s);
}
s = new String[2];
s[0] = "CAT2OSMSHAPEID"; s[1] = getShapeId();
l.add(s);
return l;
} | 1 |
private void handleChannelCountResponse(String response) {
String count = response.split(" ", 3)[1];
if (serverEventsListener != null)
serverEventsListener.channelCountReceived(count);
} | 1 |
private static boolean isDinheiro(String valor) {
final String NUMEROS = "0123456789.";
for (int i = 0; i < valor.length(); i++) {
char caracter = valor.charAt(i);
if (NUMEROS.indexOf(caracter) == -1) {
return false;
}
}
return true;
... | 2 |
private void update_info(int[] bowl, int bowlId, int round,
boolean canPick,
boolean musTake) {
this.bowl = deepCopyArray( bowl );
this.bowlId = bowlId;
this.round = round;
this.canPick = canPick;
this.musTake = musTake;
//... | 7 |
public void move()
{
Grid<Actor> gr = getGrid();
if (gr == null)
return;
Location loc = getLocation();
Location next = loc.getAdjacentLocation(getDirection());
if (gr.isValid(next))
moveTo(next);
else
removeSelfFromGrid();
F... | 2 |
private String escapeString(String string)
{
if (
"and".equalsIgnoreCase(string)
|| "or".equalsIgnoreCase(string)
|| "not".equalsIgnoreCase(string)
) {
return '"' + string + '"';
}
String[] characters = { "\\", "(", ")", "\"" };
... | 5 |
public static int countLines(File cardfile) {
try {
LineNumberReader reader = new LineNumberReader(new FileReader(cardfile));
int cnt = 0;
while (reader.readLine() != null) {}
cnt = reader.getLineNumber();
reader.close();
return cnt;
} catch (Exception e) {
return 0;
}
} | 2 |
public AlgorithmParametersType.ChallengeFormat createAlgorithmParametersTypeChallengeFormat() {
return new AlgorithmParametersType.ChallengeFormat();
} | 0 |
public void DFSforReversedG(int nodeIndex) {
// push to stack, and mark explored;
pushToStack(nodeIndex);
nodesStatus.set(nodeIndex);
// printNodesStack();
// find next node this node has an directed edge to,that's not explored
// yet and do DFS on it, startBit to mark the index from which we
// should s... | 2 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
final MOB mob=msg.source();
if(((msg.amITarget(this))||(msg.tool()==this))
&&(msg.targetMinor()==CMMsg.TYP_ENTER)
&&(!CMLib.flags().isInFlight(mob))
&&(!CMLib.flags().isFalli... | 7 |
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 List<Point> getAvailablePositions(Player player) {
List<Point> positions = new ArrayList<Point>();
int skippedCaseW = Engine.WIDTH/2 / Tile.SIZE;
int skippedCaseH = Engine.HEIGHT/2 / Tile.SIZE;
Point p = new Point(0,0);
Point posPlayer = new Point( (int) player.getX()/Tile.SIZE, (int) player.getY()/... | 4 |
@Before
public void setup () throws IOException {
String explicitFile = System.getProperty("org.newsclub.net.unix.testsocket");
if ( explicitFile != null ) {
this.socketFile = new File(explicitFile);
}
else {
this.socketFile = new File(new File(System.getPrope... | 1 |
private void loadState(int state) {
if (state == STARTMENU) {
gameStates[state] = new StartMenu(this);
} else if (state == CHARACTERSELECT) {
gameStates[state] = new CharacterSelect(this);
} else if (state == GAME) {
gameStates[state] = new Game(this, character);
}
} | 3 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SimpleEmailAddress other = (SimpleEmailAddress) obj;
if (email == null) {
... | 9 |
private boolean safe(Room room) {
if(!wumpusKB.known(room) || wumpusKB.evaluate(room)) { return false; }
if(!batKB.known(room) || batKB.evaluate(room) ) { return false; }
if(!pitKB.known(room) || pitKB.evaluate(room) ) { return false; }
return true;
} | 6 |
public static condition condFromString(String name) {
return getEnumFromString(condition.class, name);
} | 0 |
public void updateAutoSize(CellView view) {
if (view != null && !isEditing()) {
Rectangle2D bounds = (view.getAttributes() != null) ? GraphConstants
.getBounds(view.getAttributes())
: null;
AttributeMap attrs = getModel().getAttributes(view.getCell());
if (bounds == null)
bounds = GraphConstant... | 9 |
public static void main(String[] args) {
int i; // 循环计数变量
int Index = a.length;// 数据索引变量
System.out.print("排序前: ");
for (i = 0; i < Index - 1; i++)
System.out.printf("%3s ", a[i]);
System.out.println("");
ShellSort(Index - 1); // 选择排序
// 排序后结果
System.out.print("排序后: ");
for (i = 0; i < Index - 1; i... | 2 |
public void mute() {
if(masterVolume == 0f)
masterVolume = 2f;
else
masterVolume = 0f;
adjustVolume = true;
} | 1 |
public static void init(final String initCode) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainWindow window = new MainWindow(initCode);
window.frmCompreterA.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} | 1 |
public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} | 6 |
private double rowAdd(Double[][] mat, int rowTo, int rowFrom, double scaleFactor)
{
if (rowTo == rowFrom)
return rowScale(mat, rowTo, scaleFactor + 1);
for (int i = 0; i < mat[0].length; i++)
{
mat[rowTo][i] = mat[rowTo][i] + mat[rowFrom][i] * scaleFactor + 0.0;
}
return 1.0;
} | 2 |
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 void execute(Nodo inicio)
{
fila.add(inicio);
distancias[inicio.getId()]=0;
pred[inicio.getId()]=inicio.getId();
for(Link a: inicio.getLinks()){
distancias[a.getDestino().getId()]=a.getPeso();
pred[a.getDestino().getId()]= inicio.getId();
}
while(!fila.isEmpty())
{
Nodo work= nexter(); ... | 5 |
public static Vector<String> findPackages() {
Vector<String> result;
StringTokenizer tok;
String part;
File file;
JarFile jar;
JarEntry entry;
Enumeration<JarEntry> enm;
HashSet<String> set;
result = new Vector<String>();
set = new HashSet<String>();
// check ... | 7 |
public Combinacion(int idCombinacion, int claveles, int margaritas, int gladiolos, int rosas, int gerberas, int verdes, int lilium, int alstromeria, int anturium, int lisiantus, int paniculata, int ruscus) {
this.idCombinacion = idCombinacion;
this.claveles = claveles;
this.margaritas = margarit... | 0 |
private List<IdentityDisc> getIdentityDiscsOfGrid(Grid grid) {
final List<IdentityDisc> identityDiscs = new ArrayList<IdentityDisc>();
for (Element e : grid.getElementsOnGrid())
if (e instanceof IdentityDisc && !(e instanceof ChargedIdentityDisc))
identityDiscs.add((IdentityDisc) e);
return identityD... | 3 |
public Boolean cadastarNovo(Cidadao cidadao) {
Boolean sucesso = false;
Connection connection = conexao.getConnection();
try {
String valorDoComandoUm = comandos.get("cadastarNovo" + 1);
String valorDoComandoDois = comandos.get("cadastarNovo" + 2);
StringBuild... | 7 |
private void initialize(){
frame.setIconImage(MAIN_ICON.getImage());
frame.setSize(WINDOW_SIZE);
frame.setResizable(false);
frame.setLocation((int) (SCREEN_SIZE.getWidth() / 2 - frame.getWidth() / 2),
(int) (SCREEN_SIZE.getHeight() / 2 - frame.getHeight() / 2));
... | 0 |
private final void diff(final Git session, final RevWalk walk,
final RevCommit commitNew, final ObjectReader reader)
throws MissingObjectException, IncorrectObjectTypeException,
IOException {
int i = 0;
if (commitNew.getParentCount() == 0) {
final RevTree treeNew = commitNew.getTree();
this.treePars... | 7 |
public void RunTest() throws Exception {
System.out.println("RunTest.");
Long id = (Long)conn.call(new CommandContent().addMethod("getClientId"));
System.out.println("Client connection id " + id);
System.out.println("Start calls.");
for (int i = 0; i < callcount; i++) {
String ans = (String)co... | 2 |
public static Session getSession() throws HibernateException {
Session session = (Session) threadLocal.get();
if (session == null || !session.isOpen()) {
if (sessionFactory == null) {
rebuildSessionFactory();
}
session = (sessionFactory != null) ? sessionFactory.openSession()
: null;
thr... | 4 |
@Override
public void dealDamage(int amount, Object source) {
if (source instanceof Projectile) {
Projectile p = (Projectile) source;
if (p.getImageName().equals("arrow")) return;
}
super.dealDamage(amount, source);
} | 2 |
public void printMovieInfo(Movie movie) {
int index = 0;
_showTimes = new ArrayList<ShowTime>();
System.out.println();
System.out.println(movie.getTitle());
System.out.println("=================================");
System.out.println("AVAILABLE IN\t: " + movie.getType());
System.out.println("CAST\t\t: "... | 8 |
public Ticket retrieveTicket(int id) {
Ticket result = null;
ResultSet rs = null;
PreparedStatement statement = null;
try {
statement = conn.prepareStatement("select * from Tickets where TicketID = ?");
statement.setInt(1, id);
int workerid_fk;
int ticketid;
String subject;
boolean pendi... | 6 |
public void calculateWeights(){
for(int i = 0; i < itemIds.length; i++){
weightsUserId1[i] = pearson * ratings1[i];
weightsUserId2[i] = pearson * ratings2[i];
}
} | 1 |
private boolean fn_arr_member() {
// check format: "(" [ argument_list ] ")" | "[" expression "]"
if (lexicalAnalyzer.getToken().getType().equals(LexicalAnalyzer.tokenTypesEnum.PAREN_OPEN.name())) {
//check format: "(" [ argument_list ] ")"
if (!operatorPush(new Opr_SAR(lexicalAn... | 9 |
public synchronized boolean split(Bucket bucket)
{
boolean containsLocalNode = bucket.containsBucketContact(getLocalNode().getNodeId());
if ((containsLocalNode || bucket.equals(smallestSubtreeBucket)) && !bucket.isTooDeep())
{
List<Bucket> buckets = bucket.split();
... | 6 |
public void weeklyBonus(Player player)
{
if (color == player.getColor()) {
for(CastleBuilding b: buildings) {
b.weeklyBonus(player, this);
}
}
} | 2 |
public static void main(String[] args) {
GameKeitai1 taro = new GameKeitai1(
"太郎", "012-1234-5678", "taro@test.jp");
GameKeitai2 hanako = new GameKeitai2(
"花子", "999-8888-7777", "hanako@test.jp");
for(int i=0; i<3; i++){
taro.denwaSuru();
}
for(int i=0; i<3; i++){
hanako.denwaSuru();
}
... | 4 |
public void Commands_time() {
if(args.length == 1) {
if(args[0].equalsIgnoreCase("day")) {
player.getWorld().setTime(0);
}
else if(args[0].equalsIgnoreCase("night")) {
player.getWorld().setTime(12000);
}
else {
player.sendMessage(ChatColor.RED + "Argument invialide");
... | 5 |
public void initAStar() {
if (startX<0||startX>=width||endX<0||endX>=width
||startY<0||startY>=height||endY<0||endY>=height) {
log("ERROR: invalid initialization values!");
}
setHeuristicAll();
openqueue.clear();
grid[startY][startX].G = 0.0;
grid[startY][startX].calcF();
grid[startY][startX].paren... | 8 |
@Override
public ExplicitMod deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
for (String s : Constants.ESCAPED_MODS) {
Pattern p = Pattern.compile(s);
Matcher m = p.matcher(jsonElement.getAsString());
... | 6 |
public LinkedList<Moneys> take(int am,String player,String game)
{
if(this==printer.pot && score < am)//the pot will always give itself money out of air rather than go negative
{
LinkedList<Moneys> temp=new LinkedList<Moneys>();
temp.add(new Moneys(this.name,am-score));
this.give(temp,game);
}
LinkedL... | 8 |
public void deleteBookLanguage(long id) {
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
dbCon.... | 4 |
@Override
public void removeClickListener(ClickListener listener) {
if (listener != null) this.clickListeners.remove(listener);
} | 1 |
public String toString() {
String s = "lastCheckpoint : int = " + String.valueOf(this.lastCheckPoint) + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
s = s + "identifierStack : char["+(this.identifierPtr + 1)+"][] = {"; //$NON-NLS-1$ //$NON-NLS-2$
for (int i = 0; i <= this.identifierPtr; i++) {
s = s + "\"" + String.valueOf... | 7 |
public static void main (String [] args) throws Exception {
try {
System.out.println(System.getProperty("user.dir"));
CatalogReader foo = new CatalogReader ("Catalog.xml");
Map <String, CountedTableData> res = foo.getCatalog ();
System.out.println (foo.printCatalog (res));
... | 7 |
void setAsPossibleBreakPoint() {
possibleBreakpoint = true;
} | 0 |
public static void destroySession(int sessionId) {
Actions.addAction(new Action(ActionType.INFO, "Attempting to kick session id: 0x" + Integer.toHexString(sessionId) + " from the Server..."));
Session sess = sessions.get(sessionId);
if(sess != null) {
final Channel c = sess.getChannel();
BroadcastMessage ki... | 2 |
public void setLength(long value) {
this.length = value;
} | 0 |
public BeansContainer() {
registry = new HashMap<Class<?>, Class<?>>();
interceptors = new Interceptor[] {
new TransactionableInterceptor(),
new BeanInterceptor()
};
} | 2 |
public AssetManager getAssetManager(){
return assetManager;
} | 0 |
public GLWindow() throws InterruptedException {
try {
Display.setDisplayMode(new DisplayMode(800, 600));
Display.setTitle("Renderer");
Display.setResizable(false);
Display.create();
} catch (LWJGLException e) { // Fix for old Computers | Nvidia Processors
if(e.getMessage() == "Pixel Format Not Acce... | 4 |
public void createWindow() throws Exception {
Display.setFullscreen(false);
this.theWorld.generate();
/*
* DisplayMode d[] = Display.getAvailableDisplayModes(); for (int i = 0;
* i < d.length; i++) { if (d[i].getWidth() == 640 && d[i].getHeight()
* == 480 && d[i].getBitsPerPixel() == 32) { displayMode = ... | 3 |
public CheckResultMessage check4(int day) {
BigDecimal a1 = new BigDecimal(0);
int r3 = get(13, 5);
int c3 = get(14, 5);
if (version.equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
a1 = getValue(r3 + day, c3 + 1, 3).subtract(
getValue(r3 + day, c3, ... | 5 |
public static int[] quickSort(int[] array, int start, int end) {
int s = start;
int e = end;
if(end-start < 1) {
return array;
}
if(end-start == 1) {
if(array[start] > array[end]) {
int tmp = array[start];
array[start] = array[end];
array[end] = tmp;
}
return array;
}
int key ... | 8 |
public static void main(String[] args) {
ConcreteAggregate aggregate = new ConcreteAggregate();
aggregate.addObject("1");
aggregate.addObject("3");
aggregate.addObject("5");
aggregate.addObject("7");
aggregate.addObject("9");
Iterator iterator = new ConcreteItera... | 1 |
public ListNode deleteDuplicates(ListNode head) {
// Start typing your Java solution below
// DO NOT write main() function
if (head == null || head.next == null)
return head;
ListNode prev = new ListNode(0); // 当前的前驱节点
ListNode root = prev; // 整体的前驱节点
int preVal = head.val;
ListNode cur = head;
boole... | 6 |
@Override
public final String toString()
{
return "Bencoding Exception:\n"+(this.message == null ? "" : this.message);
} | 1 |
GenericGFPoly(GenericGF field, int[] coefficients) {
if (coefficients.length == 0) {
throw new IllegalArgumentException();
}
this.field = field;
int coefficientsLength = coefficients.length;
if (coefficientsLength > 1 && coefficients[0] == 0) {
// Leading term must be non-zero for anythi... | 6 |
private void preencheTabela(List<UsuarioSistema> lista){
this.modelo = new DefaultTableModel();
modelo.addColumn("Id");
modelo.addColumn("Nome");
modelo.addColumn("Cpf");
modelo.addColumn("Rg");
modelo.addColumn("Data de Nascimento");
modelo.addColumn("Usuario");
... | 1 |
private int getNumero(int[] datos, int i) {
if (i < datos.length) {
return datos[i];
} else {
return 0;
}
} | 1 |
public static Collection<IndexCommit> listCommits(Directory dir) throws IOException {
final String[] files = dir.listAll();
Collection<IndexCommit> commits = new ArrayList<IndexCommit>();
SegmentInfos latest = new SegmentInfos();
latest.read(dir);
final long currentGen = latest.getGeneration();
... | 6 |
public Document buildUpdateStatus(Document document, Element root, ReversiBoard board, boolean update){
Element currentPlayerElement = document.createElement("update_status");
String updateString;
if(update) updateString = "completed";
else updateString = "failed";
Text text = do... | 1 |
private boolean isCastleLocationSafe(int baseYPos, int direction){
Position rookInitPos = (direction == 1) ? new Position(7, baseYPos) : new Position(0, baseYPos);
int xPos = 3+direction;
Position gonnaInspectPos = new Position(xPos, baseYPos);
while(!rookInitPos.equals(gonnaInspectPos)){
//킹과 캐슬 사이는 비... | 4 |
protected void loadMap(String name, String fileName, HashMap<String, String> map) {
if (verbose) Timer.showStdErr("Loading " + name + " from '" + fileName + "'");
int i = 1;
for (String line : Gpr.readFile(fileName).split("\n")) {
String rec[] = line.split("\t");
String id = rec[0];
String componentId =... | 5 |
public void actionPerformed(ActionEvent e){
String option = e.getActionCommand();
if(option.equals("add another")){
JTextField TxtF = new JTextField(10);
TxtF.setFont(Themes.componentsFont);
TxtF.setAlignmentX(Component.CENTER_ALIGNMENT);
tagsPanel.add(TxtF);
JTextField TxtF2 = new JTe... | 9 |
public void acquaireIngridient(Dish dish) {
Vector<Ingredient> dishIngredients= dish.getDishIngredients();
for (int i= 0; i < dishIngredients.size(); i++) {
boolean found= false;
int location= 0;
for (int j= 0; ((!found) && (j < this._availableIngredients.size())); j++) {
found= (this._availableIngredi... | 4 |
public T getSecond() { return second; } | 0 |
private String get(String variable, String lookahead) {
try {
return (String) pane.table.get(variable, lookahead).first();
} catch (IllegalArgumentException e) {
return null;
} catch (NoSuchElementException e) {
return null;
}
} | 2 |
private void drawTile(Tile t, Graphics g, int x, int y, int width,
int height) {
if (t.isCollidable()) {
g.setColor(ColorDirector.getCurrentPrimary((t.isSlowWall() ? ColorType.SLOW_WALL
: ColorType.WALL)));
g.fillRect(x, y, width, height);
if (x < scaledXDistLeft || x > scaledXDistRight)
return;... | 5 |
public void addQuizToDB() {
try {
String statement = new String("INSERT INTO " + DBTable
+ " (name, url, description, category, userid, israndom, isonepage, opfeedback, oppractice, raternumber, rating)"
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
PreparedStatement stmt = DBConnection.con.prepare... | 1 |
public boolean dealerHit() {
if (this.hand.totalvalues()[0] < 17 && this.hand.totalvalues()[0] == this.hand.totalvalues()[1]) {
return true;
} else if (this.hand.totalvalues()[0] <= 17 && this.hand.totalvalues()[0] != this.hand.totalvalues()[1]) {
return true;
} else if (this.hand.totalvalues()[1] < 17 && t... | 6 |
public final synchronized boolean readBoolean(){
boolean retB = true;
String retS = this.readWord();
if(retS.equals("false") || retS.equals("FALSE")){
retB = false;
}
else{
if(retS.equals("true") || ... | 4 |
private boolean searchUpForPrevSupersetNode( Node node, K key, Object[] ret ) {
if( node.mLeft != null && mComp.compareMaxes( key, node.mLeft.mMaxStop.mKey ) <= 0 ) {
ret[0] = node.mLeft;
return false;
}
while( node.mParent != null ) {
if( node == node.mParen... | 8 |
void foo3() {
} | 0 |
public void displayScreen(Screen screen) {
this.currentScreen = screen;
} | 0 |
static boolean isZin(String reeks) {
boolean spatie = false;
for(int i = 0; i < reeks.length(); i++) {
if(reeks.charAt(i) == ' ') {
spatie = true;
break;
}
}
return spatie;
} | 2 |
public boolean move(int dx, int dy, Set<RenderObject> allObjects) {
// Did we encounter a collision during the movement?
boolean collision = false;
if (hasCollision) {
// We need to check for collision.
// Create a set for all possible collision targets.
Set<RenderObject> collisionTargets = new... | 9 |
private void hidePanels(Container lastOpen)
{
buttonPanel.setVisible(false);
manualPanel.setVisible(false);
programmerFrame.setVisible(false);
lastOpen.setVisible(true);
} | 0 |
private static EntropyDecoder getDecoder(String name, InputBitStream ibs)
{
switch(name)
{
case "FPAQ":
case "CM":
case "PAQ":
case "TPAQ":
return new BinaryEntropyDecoder(ibs, getPredictor(name));
case "HUFFMAN":
... | 9 |
public void done() {
done = false;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
closebtn.setEnabled(true);
status.setText("The error has been reported.");
pack();
}
});
synchronized(this) {
try {
while(!done)
wait();
} catch(InterruptedException e) {
... | 2 |
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.