text stringlengths 14 410k | label int32 0 9 |
|---|---|
public MenuLevelSelect(Game game) {
setVisible(false);
int gridx = 0;
int gridy = 0;
int lvlCount = 0;
if (path.exists()) {
for (File lvl : path.listFiles()) {
if (lvl.getName().contains("terrain")) {
if (lvlCount > 12)
BlueMaggot.e = new Exception("Too many levels added! Max is 12.");
... | 5 |
public int grow(int growdirection) {
int dx =0;
int dy = 0;
switch (growdirection) {
case 0:
dx = 0;
dy = -1;
break;
case 1:
dx = 1;
dy = 0;
break;
case 2:
dx = 0;
dy = 1;
... | 9 |
public char evaluate_char(Object[] dl) throws Throwable {
if (Debug.enabled)
Debug.println("Wrong evaluateXXXX() method called,"+
" check value of getType().");
return '?';
}; | 1 |
public void setItem(Items item) {
this.item = item;
} | 0 |
public static void main(String[] args)
{
try
{
UIManager.setLookAndFeel("com.jtattoo.plaf.texture.TextureLookAndFeel");
}
catch (UnsupportedLookAndFeelException e)
{
try
{
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels())
{
if ("Nimbus".e... | 7 |
public MainFrame_View() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {}
frame = new JFrame("World Map - Interactive Map");
frame.setSize(INIT_WIDTH, INIT_HEIGHT);
frame.setResizable(RESIZABLE);
fra... | 1 |
public void addNode(Node node) {
nodes.add(node);
} | 0 |
private void filterPixels(DirectGif89Frame dgf) throws IOException
{
if (ciLookup == null)
throw new IOException("RGB frames require palette autodetection");
int[] argb_pixels = (int[]) dgf.getPixelSource();
byte[] ci_pixels = dgf.getPixelSink();
int npixels... | 7 |
public void generateMapImage() {
BufferedImage dungeonImage = new BufferedImage(sizeX * TILE_SIZE, sizeY * TILE_SIZE, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = dungeonImage.createGraphics();
for (int y = 0; y < sizeY; y++) {
for (int x = 0; x < sizeX; x++) {
i... | 8 |
private final void resetModDate() {
final Path repo = ((SongData) this.songdata).getRoot()
.resolve(
this.main.getConfigValue(Main.VC_SECTION,
Main.REPO_KEY, "band"));
try {
final Git session = Git.open(repo.toFile());
try {
final ObjectId head = session.getRepository().getRef("HEAD")
... | 3 |
public void keyReleased(KeyEvent key){
switch (key.getKeyCode()){
case KeyEvent.VK_UP:
player.moveY(1);
break;
case KeyEvent.VK_LEFT:
player.moveX(1);
break;
case KeyEvent.VK_RIGHT:
player.moveX(-1);
break;
case KeyEvent.VK_DOWN:
player.moveY(-1);
break;
case KeyEvent.VK_SPACE:
... | 5 |
public String getText(Key key) {
String text = texts.getProperty(key.getProperty());
if (text == null && "month".equals(key.getKind())) {
Calendar c = Calendar.getInstance();
c.set(Calendar.MONTH, key.getIndex());
ComponentFormatDefaults defaults = ComponentFormatDefa... | 4 |
public boolean isValidSudoku(char[][] board) {
int[] cols = new int[9];
int[] rows = new int[9];
int[] squs = new int[9];
Arrays.fill(cols,0);
Arrays.fill(rows,0);
Arrays.fill(squs,0);
for (int i=0; i < 9 ;i++ ) {
for (int j =0 ; j < 9 ;j++ ) {
... | 6 |
@Override
public void init(int l, int h) {
this.grille = new BlocService[l][h];
this.l=l;
this.h=h;
for(int i=0; i<l; i++)
for(int j=0; j<h; j++)
if(i==0 || i==l-1 || j==0 || j==h-1 || (i%2==1 && j%2==1)) {
BlocService t = new BlocImpl();
t.init(BlocType.MURMETAL);
grille[i][j] = t;
}... | 8 |
public Map<String, EventDetail> sendRequest(String params) {
Map<String, EventDetail> result = new HashMap<String, EventDetail>();
RestTemplate rest = new RestTemplate();
String json = rest.getForObject("https://api.guildwars2.com/v1/event_details.json"+params, String.class);
ObjectMapper mapper = new ObjectMap... | 2 |
public boolean actionSupervise(Actor actor, Venue venue) {
//
// If you have any items demanded by the venue, put them away-
for (Item i : actor.gear.allItems()) {
if (i.refers != null || i.type.form != FORM_COMMODITY) continue ;
if (venue.stocks.demandFor(i.type) > 0) actor.gear.transfer(... | 4 |
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 SetRangByScore(){
// Ordre meilleur joueur selon le score
Collections.sort(listeScores, ScoreJoueur.InscritNomComparator);
int i=0;
// ajout le rang au joueur
for(ScoreJoueur joueur : listeScores){
i++;
joueur.setRang(i);
}
} | 1 |
public static Field getField(Class<?> clazz, String name) {
while (clazz != null) {
for (Field field : clazz.getDeclaredFields()) {
if (field.getName().equals(name)) {
field.setAccessible(true);
return field;
}
}
... | 4 |
@Override
public void render(Graphics g, Visibility visibility, float x, float y, float scale) {
if(visibility == Visibility.VISIBLE) {
boolean hasSomeEntities = occupying.size() > 0;
boolean hasSomeEntering = entering.size() > 0;
boolean hasSomeLeaving = leaving.size() > 0;
if(hasSomeEntities) {
if(... | 8 |
public static String normalizePath(String path)
{
String[] comps = path.split("/");
String[] ap = new String[comps.length];
int j = 0;
boolean absolute = comps[0].length() == 0;
for (int i = 0; i < comps.length; ++i)
{
String s = comps[i... | 9 |
@Override
public byte[] save(JoeTree tree, DocumentInfo docInfo) {
String lineEnding = PlatformCompatibility.platformToLineEnding(PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_LINE_ENDING));
// Show dialog where use can pick a CSS or cancel. Do lazy instantiation since text assets won't be... | 3 |
@Override
public void deserialize(Buffer buf) {
objectUID = buf.readInt();
if (objectUID < 0)
throw new RuntimeException("Forbidden value on objectUID = " + objectUID + ", it doesn't respect the following condition : objectUID < 0");
foodUID = buf.readInt();
if (foodUID <... | 3 |
private void checkLaserCollisionsWithSprites(Laser laser){
// update other sprites
//Iterator i = map.getSprites();
LinkedList <Sprite> oldSprites = map.getSprites();
LinkedList <Sprite> sprites = (LinkedList<Sprite>) oldSprites.clone();
//sprites.add(map.getPlayer()); Not doing this right ... | 7 |
public Collection<DependencyNode<V>> toNodes()
{
Map<K, DependencyNode<V>> nodeMap = new HashMap<K, DependencyNode<V>>();
for (Entry<K, V> e : values.entrySet())
{
nodeMap.put( e.getKey(), new DependencyNode<V>( e.getValue() ) );
}
for (Entry<K, DependencyNode<V... | 4 |
public static void check(HttpURLConnection c) throws IOException {
int code = c.getResponseCode();
switch (code) {
case HttpURLConnection.HTTP_OK:
case HttpURLConnection.HTTP_PARTIAL:
return;
case HttpURLConnection.HTTP_MOVED_TEMP:
case HttpURLConnection.HTTP_... | 7 |
public static int minCut(String s) {
if(s.length() == 0)return 0;
int length =s.length();
int[] dp = new int[s.length()+1];
boolean[][] palin = new boolean[s.length()][s.length()];
for(int i =s.length(); i>=0;i--){
dp[i] = length-i;
}
for(int i = length-1; i>=0;i--){
for(int j = i; j < length ... | 7 |
public TableCellEditor getCellEditor(int row, int column) {
if (!finalEdit)
return super.getCellEditor(row, column);
int mc = convertColumnIndexToModel(column);
return cellEditors[row][mc] == null ? super.getCellEditor(row, column)
: cellEditors[row][mc];
} | 2 |
public void resetInteractiveObject() {
for (int i = 0; i < interactiveObjectCachePos; i++) {
InteractiveObject interactiveObject = interactiveObjectCache[i];
method289(interactiveObject);
interactiveObjectCache[i] = null;
}
interactiveObjectCachePos = 0;
} | 1 |
private JButton getJButton0() {
if (jButton0 == null) {
jButton0 = new JButton();
jButton0.setText("SELECT");
jButton0.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent event) {
jButton0MouseMouseClicked(event);
}
});
}
return jButton0;
} | 1 |
public List<String> getTableDescription(String tableName) throws DataBaseTableException {
TableDescription td = null;
for (DataBase db : databases.values()) {
td = db.getTableDescription(tableName);
if (td != null) {
return td.getColumnNames();
}
... | 2 |
public void preUpdate()
{
LinkedList<Element> elementTouch = collisionElementList((int)x, (int)y, Type.ALL, false);
Element elem;
while(!elementTouch.isEmpty())
{
elem = elementTouch.removeFirst();
if(elem.type == Type.BOMBERMAN)
pushEvent(elem,"explosion", power);
if(elem.type == Type.ROBOT)
... | 7 |
public void setUpComboBoxes(Set<Card> cards) {
JComboBox peoplePossibilities = new JComboBox();
JComboBox roomsPossibilities = new JComboBox();
JComboBox weaponsPossibilities = new JComboBox();
for (Card card : cards) {
String name = card.getName();
if (card.getType().equals(CardType.PERSON)) {
people... | 3 |
@AfterGroups("MaxHeapIntegers")
@Test(groups = { "MinHeapIntegers" })
public void testMinHeapIntPushPop() {
Reporter.log("[ ** MinHeap Integer Push ** ]\n");
testQueueInt = new MinPriorityQueue<>(new Integer[seed], true);
try {
Reporter.log("Insertion : \n");
timeKeeper = System.currentTimeMillis();
... | 6 |
public void setAge(String age) {
this.age = age;
} | 0 |
public void read(String filename) throws MySecondException {
String content;
if (filename == null)
throw new MySecondException("The file name provided is null");
File file = new File(filename);
try {
FileReader reader = new FileReader(file);
char[] chars = new char[(int) file.length()];
reader.re... | 2 |
@EventHandler
public void onChat(PlayerBlockChangeEvent event) {
if (event.getPlayer() == getPlayer()) {
found = true;
X = event.getX();
Y = event.getY();
Z = event.getZ();
holding = event.getBlock();
mode = event.getPlaceType();
super.wakeUp();
event.Cancel(true);
}
} | 1 |
private boolean jj_3_58() {
if (jj_3R_74()) return true;
if (jj_scan_token(POINT)) return true;
return false;
} | 2 |
@Override
public boolean addGroup(String group) {
if (!groups.contains(group)) {
groups.add(group);
return true;
}
return false;
} | 1 |
private char[] convertToString(CharSequence s) {
if (s == null && s.length() % 2 != 0) {
throw new IllegalArgumentException();
}
int len = s.length();
char[] dest = new char[len / 2];
for (int i = 0, j = 0; i < len; i += 2, j++)
dest[j] = (char) ((s.charAt... | 3 |
public static void write(HighScore hs, int n, String file){
try{
RandomAccessFile f = new RandomAccessFile(file, "rw");
char[] ch = hs.getName();
f.seek(FILE_SIZE * n);
for(int i = 0; i < STRING_SIZE; i++){
f.writeChar(ch[i]);
}
f.writeInt(hs.getScore());
f.close();
}
catch(Exception e){
... | 2 |
public List<ArrayList<String>> parceEntry(String toCheck) {
List<ArrayList<String>> toReturn = new ArrayList<>();
List<String> books = readBooks();
List<ArrayList<String>> topics = readTopics();
toReturn.add(new ArrayList<>());
toReturn.add(new ArrayList<>());
for (Stri... | 3 |
@Override
public void caretUpdate(CaretEvent e) {
if(isLiveDecode()) {
try {
int methodID = Integer.parseInt(((JTextField) e.getSource()).getName());
parent.executeCipher(methodID);
} catch(Exception ex) {
ex.printStackTrace();
... | 2 |
public void run(QuitKeyListener user) {
window.activate();
sleep(500);
while(!user.hasQuit()){
world.update();
window.repaint();
sleep(25);
}
window.deactivate();
} | 1 |
public static void main (String args[]) {
int iii,i,ic,k,m,n,nread,ntries,nwrite;
int info[] = new int[2];
// int nprob;
// int nfev[] = new int[2];
// int njev[] = new int[2];
int nprobfile[] = new int[29];
int nfile[] = new int[29];
int mfile[] = new int[29];
int... | 8 |
private static void getInput(){
/* Single action input */
if (Keyboard.next()){
if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE){
quitGame();
}
}
/* Game input */
if (Keyboard.isKeyDown(Keyboard.KEY_W)){
Court.player.moveUp();
}
if (Keyboard.isKeyDown(Keyboard.KEY_S)){
Court.player.move... | 4 |
public TabuStageParams(int maxSteps,
int minTheta,
int maxTheta) {
if (maxSteps <= 0) {
throw new IllegalArgumentException("'max steps' <= 0");
}
MAX_STEPS = maxSteps;
if ( minTheta < 0
|| maxTheta < 0) {
... | 4 |
@Override
public List<String> onTabComplete(CommandSender sender, Command command,
String alias, String[] args) {
if (args.length == 1) {
List<String> matches = new ArrayList<String>();
for (String subcommand : subcommands) {
if (StringUtil.startsWithIgnor... | 6 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
try{
MySQLcon db = new MySQLcon("jdbc:mysql://localhost:3306/project","a","a");
ResultSet r = db.Quer("SELECT * FROM project_assignements"... | 7 |
public static String getPrivateKey(Map<String, Object> keyMap)
throws Exception {
Key key = (Key) keyMap.get(PRIVATE_KEY);
return SecurityCoder.base64Encoder(key.getEncoded());
} | 0 |
private static String get_pattern(BufferedReader input, String pattern)
{
PDPM_DEBUG.PDPM_REPORTER_LOG("->get_pattern() pattern: " +
pattern);
String line = null;
String value = null;
while(true)
{
try
{
line = input.r... | 9 |
public static void main(String[] args) {
int rc = 0;
for (String fname : args) {
File file = new File(fname);
if (!file.canRead()) {
System.err.println("Cannot read " + fname);
rc++;
continue;
}
try {
... | 5 |
Color AdvColorPix(int count, String[] ColorIndex) {
int c1;
int c2;
int r;
int g;
int b;
int or; //old red
int og;
int ob;
double dr;
double dg;
double db;
String fg; //foreground colour
String bg; //background colou... | 9 |
public void print(){
int y = 10; // local variable declaration
System.out.println(y);
} | 0 |
@Override
public void channelRead(ChannelHandlerContext channelHandlerContext, Object object) {
ByteBuf byteBuf = ((ByteBuf) object);
boolean isLegacyPing = false;
byteBuf.markReaderIndex();
try {
if (byteBuf.readUnsignedByte() == 254) {
int id = byteBu... | 8 |
private void skip(long amount) throws IOException {
while(amount > 0) {
long skipped = input.skip(amount);
if(skipped < 0) {
throw new EOFException();
}
amount -= skipped;
}
} | 2 |
@Override
public void onCloseFile(String arg0, DokanFileInfo arg1)
throws DokanOperationException {
synchronized (handles)
{
if (DEBUG)
System.out.println("CloseFile: " + arg0);
if (arg1.handle == 0)
return;
FileHandle handle = handles.remove(arg1.handle);
if (handle != null)
{
try {... | 5 |
public ResultSet getList(String whereString) {
StringBuffer sql = new StringBuffer("");
sql.append("SELECT Exam_ID,Instructions,isPublic");
sql.append(" FROM `Exam`");
if (whereString.trim() != "") {
sql.append(" where " + whereString);
}
SQLHelper sQLHelper ... | 1 |
@Override
public void start() throws Exception {
super.start();
} | 0 |
public void updateTime() {
if (this.isActive) {
this.playersTurn.time++;
// if (this.isWhitesTurn) {
// this.playerWhite.time++;
// } else {
// this.playerBlack.time++;
// }
} else {
this.stopTime();
}
this.setWindowTitle();
} | 1 |
public int getPageFirstItem() {
return page * pageSize;
} | 0 |
private List<Distance> getAMatchingDistance(List<Distance> referenceDistances, List<Distance> probeDistances) {
List<Distance> list = new ArrayList<Distance>();
do {
list.clear();
int random = new Random().nextInt(referenceDistances.size());
list.add(referenceDistances.get(random));
for(Distance d : pr... | 7 |
private void checkMaxRotationForMoments()
{
// If the maxrotation is negative, no maxrotation is checked
if (getMaxRotation() < 0)
return;
// limits the moment(s) if needed
for (Point momentorigin: this.moments.keySet())
{
double moment = this.moments.get(momentorigin);
if (Math.abs(moment) >... | 4 |
private void kimmota(Pelihahmo h){
asetaKimmotusehto(h);
if (getEhtoX(h) == 1){
h.setVaakaNopeus((-1)*h.getVaakaNopeus()*h.getNopeudenHidastusKerroin());
if (!h.getSuojakilpi()){
h.setElinvoima(h.getElinvoima() - Math.abs(h.getVaakaNopeus())*VAHE... | 4 |
private void combo_expertizesItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_combo_expertizesItemStateChanged
//заносим в глобальную переменную текущую ID экспертизы
try
{
Globals.idCurrentExpertize = Integer.parseInt(String.valueOf(combo_expertizes.getSelectedItem(... | 1 |
public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
* to str... | 9 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost, msg))
return false;
if((myHost instanceof MOB)&&(myHost == this.affected)&&(((MOB)myHost).location()!=null))
{
if((msg.sourceMinor()==CMMsg.TYP_SHUTDOWN)
||((msg.sourceMinor()==CMMsg.TYP_QUIT)&... | 7 |
public static List<Card> process(String xmlFileName){
List<Card> cards = new ArrayList<Card>();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder;
try {
builder = factory.newDocumentBuilder();
Document doc = builder.parse(XMLDomProcess.class.getRes... | 4 |
private Instances assignClassValue(Instances dataSet) {
if (dataSet.classIndex() < 0) {
if (m_logger != null) {
m_logger.
logMessage("[ClassValuePicker] "
+ statusMessagePrefix()
+ " No class attribute defined in data set.");
m_logger.statusMessage(statusMessagePrefix()
+ "WARNING: N... | 8 |
private String getConcatenated() {
StringBuilder concatenated = new StringBuilder();
concatenated.append("receiver_id=").append(getReceiverId());
concatenated.append("&subject=").append(_subject);
concatenated.append("&body=").append(_body != null ? _body : "");
concatenated.append("&amount=").append(_amount)... | 9 |
public void paintComponent(Graphics g)
{
super.paintComponent(g);
//draw the background
for(int h = 0; h <= 400; h+=cellH)
{
g.drawLine(0, h, 400, h);
}
for(int w = 0; w <= 400; w+=cellW)
{
g.drawLine(w, 0, w, 400);
}
for(int i = 0; i<numEnemy; i++)
enemy[i].draw(g);
p1.draw(g);
if... | 4 |
public void startGame(long noPlayers) {
if (noPlayers != 1 && noPlayers != 2) {
new MemoryGameError().displayError("startGame - invalid number of players specified.");
return;
}
Game game;
if (noPlayers == 1) {
new OptionsMenuV... | 3 |
public boolean isFirstColumn(Column column) {
if (column != null) {
for (Column col : mColumns) {
if (col == column) {
return true;
}
if (col.isVisible()) {
return false;
}
}
}
return false;
} | 4 |
public void sacrifice()
{
} | 0 |
public static double[][] get_line_points_stegers(ImageProcessor ip, double sigma, boolean mode)
{
int image_width = ip.getWidth();
int image_height = ip.getHeight();
int l;
double a;
double b;
//final line points
double[][] line_points = new double[7][image_width*image_height];
// store results of... | 8 |
public void sendToServer(final File fileToSend, final boolean isDirectory) {
//TODO opportunity to append the file
new Thread() {
@Override
public void run() {
try {
boolean haveToShowDialog = false;
boolean appendFile = false;
for (FTPFile f : ftpFiles) {
if (fileToSend.getName().equ... | 8 |
@Override
public void sendMessage(String sender, String receiver, String message, int sentBy) throws RemoteException {
System.out.println("sending ...");
if(_userStore.get(receiver) != null) {
System.out.println("user is online");
ClientInterface client = _userStore.get(receiver);
if(client != null)
c... | 5 |
protected void writeColumnTitles() throws IOException {
final Iterator<String> titleIter = columnTitles.iterator();
while (titleIter.hasNext()) {
final String title = titleIter.next();
if (titleIter.hasNext()) {
this.writeWithDelimiter(title);
} else ... | 2 |
public void registerAll(String fallbackPrefix, List<Subcommand> commands) {
for (Subcommand cmd : commands) {
register(fallbackPrefix, cmd);
}
} | 1 |
@Override
public String toString() {
if (tile == null) {
return "p" + number + " is dead (" + cooldown
+ " turns remaining) with " + points + " points";
}
return "p" + number + " at " + tile.x + "," + tile.y + " with "
+ points + " points";
... | 1 |
public static void main(String[] args) {
final String menu[] = {"Quitter", "Solde", "Paiement", "Retrait", "Dépot"};
int choix;
boolean quit;
Banque compte = new Banque(0);
NumberFormat argent = NumberFormat.getCurrencyInstance();
//boucler tant et aussi longtemps que l'utilisateur n'a pas quitté
qu... | 6 |
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
boolean isValueNumeric = false;
try {
if (value.equals("0") || !value.endsWith("0")) {
Double.parseDouble(value);
isValueNumeric = true;
... | 5 |
private Message collectMessageFromR(int c, int r) {
int messageRound = 0;
Message m;
do {
m = outcome.get(c);
if (m != null) {
messageRound = getRoundFromPayload(m.getPayload());
}
if (isSuspect(c)) {
// r is been suspected, no need to block any further
break;
}
try {
Thread.sl... | 5 |
public void loadSchema(String catalogFile) {
String line = "";
String baseFolder=new File(catalogFile).getParent();
try {
BufferedReader br = new BufferedReader(new FileReader(new File(catalogFile)));
while ((line = br.readLine()) != null) {
/... | 8 |
@Override
public boolean set(T object)
{
if (this.locked())
{
return false;
}
if (this.lis != null && !this.lis.canChange(this))
{
return false;
}
if (super.set(object))
{
this.count++;
return true;
}
return false;
} | 4 |
public void dropAllTables(){
try{
Connection connection = DriverManager.getConnection(connectionString);
Statement s = connection.createStatement();
s.executeUpdate("drop table if exists parent");
s.executeUpdate("drop table if exists recipeingredients");
s.executeUpdate("drop table if exists ingredien... | 1 |
public void output_characterised_trace(String file_path, ArrayList<TraceEntry> trace, boolean debug, boolean output_enabled){
BufferedWriter bw = null;
if(output_enabled){
try {
bw = new BufferedWriter(new FileWriter(new File(file_path),false));
} catch (IOException e) {
System.out.println("Couldn'... | 8 |
static final ArchitectureToolkit getFactory(ARCH architecture)
{
switch (architecture)
{
case ENGINOLA:
return enginolaToolkit;
case EMBER:
return emberToolkit;
} // switch
String errMsg = Integer.toString(architecture.ordinal(... | 2 |
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... | 6 |
public void calculateAdjacentAnts(World world) {
// Iterate through World cells in radius 1 around this cell and update adjacent ants count as necessary
adjacentAntsBlack = 0;
adjacentAntsRed = 0;
for (int i = 0; i < 6; i++) {
int[] adjCell = adjacentCell(i);
Cel... | 5 |
void count(int i, int pos){
for(int digit=0; digit<=digits[pos]; digit++){
if(pos==digits.length-1 && digit==0) continue;
if(isAsserted(i, digit) && !used[digit]){
if(digit<digits[pos]){
dp[1][i]+= factorial(pos);
} else{
... | 7 |
public String saveAssignment(){
preCreateAssignment();
boolean check = true;
if(asmo.getDeadline().isEmpty()){
check = false;
addFieldError("asmo.deadline", "You must to enter a value to deadline");
}else {
SimpleDateFormat df = new SimpleDate... | 5 |
public Map<Integer, Integer> getGeneSpans(String text) {
Map<Integer, Integer> begin2end = new HashMap<Integer, Integer>();
Annotation document = new Annotation(text);
pipeline.annotate(document);
List<CoreMap> sentences = document.get(SentencesAnnotation.class);
for (CoreMap sentence : sentences) {... | 5 |
public List<String> getAllSongs(String artistName){
if(artistName.equals(null) || artistName.equals("")) return null;
List<String> allSongs = null;
String url = buildUrl(artistName,null);
try {
Document document = reader.read(url);
// XMLUtil.writeToFile(document, artistName + " - songs.xml");
... | 6 |
private static AnswerCombination generateAnswerCombination() {
List<Token<AnswerColors>> tokens = new ArrayList<Token<AnswerColors>>();
tokens.add(new Token<AnswerColors> (AnswerColors.BLACK));
tokens.add(new Token<AnswerColors> (AnswerColors.BLACK));
tokens.add(new Token<AnswerColors> (AnswerColors.WHI... | 0 |
private Double pricingPlan(String plan) {
final Properties prop = loadProperties();
if (plan != null) {
if (PLAN_BASIC.equals(plan)) {
return Double.parseDouble(prop.getProperty("plan.basic.fee"));
}
if (PLAN_PREMIER.equals(plan)) {
Double.parseDouble(prop.getProperty("plan.premier.fee"));
}
... | 8 |
public OutlineHeader(Outline owner) {
super();
mOwner = owner;
setOpaque(true);
addMouseListener(this);
addMouseMotionListener(this);
setAutoscrolls(true);
ToolTipManager.sharedInstance().registerComponent(this);
if (!GraphicsUtilities.inHeadlessPrintMode()) {
DragSource.getDefaultDragSource().creat... | 1 |
private void initCloseCode() throws InvalidFrameException {
code = CloseFrame.NOCODE;
ByteBuffer payload = super.getPayloadData();
payload.mark();
if( payload.remaining() >= 2 ) {
ByteBuffer bb = ByteBuffer.allocate( 4 );
bb.position( 2 );
bb.putShort( payload.getShort() );
bb.position( 0 );
code... | 7 |
private void doRequest() {
try {
// jumping to START_OBJECT
if(jp.nextToken() != JsonToken.START_OBJECT) {
System.out.println("Root should be object: quitting");
return;
}
// jumping to fieldName "cell"
jp.nextToken();
// jumping to START_OBJECT
jp.nextToken();
JsonNode n... | 5 |
private int popupExit () {
int choix ;
choix = GUIUtilities.question_YES_NO ( Utilities.getLangueMessage( Constantes.MESSAGE_FERMER_LOGICIEL )) ;
if ( choix == JOptionPane.YES_OPTION ) {
if ( this.fileName != null ) {
choix = GUIUtilities.question_YES_NO_CANCEL ( Util... | 3 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.