text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static String keyToLocatedString(String key) {
String ret = null;
try {
ret = locale.getString(key);
} catch (Exception e) {
ret = key;
}
return ret;
} | 1 |
public double[] instanceToSchema(Instance inst,
MiningSchema miningSchema) throws Exception {
Instances miningSchemaI = miningSchema.getMiningSchemaAsInstances();
// allocate enough space for both mining schema fields and any derived fields
double[] result = new doub... | 7 |
public static Level genWorldRandom(int cols, int rows, TexturePack tp) {
/** Brick density. */
final double pBrick = 0.8;
/** Probability of a light in the bg. */
final double pLight = 0.02;
Level level = new Level(cols, rows, tp);
for (int row = 0; row < rows; r... | 4 |
public static void count_occurences(Integer[] v, Integer k) {
boolean started = false;
int counter = 0;
for (int value : v) {
if(value == k) {
counter++;
started = true;
} else if(started) {
System.out.println(counter);
... | 3 |
public void setConnections() {
System.out.println("Cog - Connecting cog nets");
// ======================== roomnet inhibits 'seenroom' in factnet
/*
for (int i = 0; i < RoomNet.getSize(); i++) {
if (RoomNet.neurons[i].isInhibitory()) {
int toNeuron = (i%40)+760;
RoomNet.neurons[i].addConnection(Fa... | 8 |
public void SetPrices(int posState, int numSymbols, int[] prices, int st)
{
final int a0 = SevenZip.Compression.RangeCoder.Encoder
.GetPrice0(_choice[0]);
final int a1 = SevenZip.Compression.RangeCoder.Encoder
.GetPrice1(_choice[0]);
fi... | 5 |
public void run() {
try {
String response;
udpClient = new DatagramSocket();
udpServer = new DatagramSocket(PORT);
udpPackage = new DatagramPacket(new byte[123], 123);
/* Warte auf eingfehenden Nachrichten */
... | 3 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GcUsage gcUsage = (GcUsage) o;
if (gcCount != gcUsage.gcCount) return false;
if (gcTime != gcUsage.gcTime) return false;
return true;
... | 5 |
public void paintComponent(Graphics g) {
g.setColor(Color.BLACK);
g.fillRect(0, 0, board.length * 30, getHeight());
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board.length; j++) {
if (board[i][j] == PLAYER) g.drawImage(imgPlayer, i * 30, j * 30, null... | 6 |
public void saveAsApplet() {
Frame frame = JOptionPane.getFrameForComponent(this);
fileChooser.setAcceptAllFileFilterUsed(false);
fileChooser.addChoosableFileFilter(FileFilterFactory.getFilter("html"));
fileChooser.setDialogType(JFileChooser.SAVE_DIALOG);
String s = Modeler.getInternationalText("SavePageAsHTM... | 9 |
public void takeShot(int x,int y)
{
this.setShots();
if (Battleship.getPlayers(Battleship.getEnemy()).getHitOrMiss(x,y))
{
this.setHits();
if (!Battleship.getPlayers(Battleship.getEnemy()).isSunk(x,y))
{
Battleship.getPlayers(Battleship.getEnemy()).setBboard(x,y,Color.orange);
if ((this.getU... | 8 |
public int findPlayersFruitId(Player p){
int fruitId = -1;
if(FruitManager.getInstance().getFruitByPlayer(p) == null){
return fruitId;
}
fruitId = FruitManager.getInstance().getFruitByPlayer(p).getId();
return fruitId;
} | 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 |
public Match getNext(){
try
{
// read size of match
int r = 0;
byte[] b = new byte[4];
r = in.read(b);
if(r == -1)
{
return null;
}
ByteBuffer bb = ByteBuffer.wrap(b);
int... | 6 |
public static int getMessageHeight(String message, Font font, Graphics2D g){
g.setFont(font);
if(message.length() == 0)
return 0;
TextLayout tl = new TextLayout(message, font, g.getFontRenderContext());
return(int)tl.getBounds().getHeight();
} | 1 |
static public String numberToString(Number n)
throws JSONException {
if (n == null) {
throw new JSONException("Null pointer");
}
testValidity(n);
// Shave off trailing zeros and decimal point, if possible.
String s = n.toString();
if (s.indexOf('.') > 0 ... | 6 |
public void dispose() {
for (Object cachedFile : cachedFiles) {
String fileName = (String) cachedFile;
try {
boolean success = (new File(fileName)).delete();
if (!success && logger.isLoggable(Level.FINE)) {
logger.fine("Error deleting c... | 4 |
public Particle(int _x, int _y, int _dx, int _dy, int _life, int _imageType, int _r, int _g, int _b){
this.x = _x;
this.y = _y;
this.dx = _dx;
this.dy = _dy;
this.life = _life;
c = new Color(_r, _g, _b);
if(_imageType == 0)
{
try{
image = new Image("Content/ImageFiles/diamond.png");
}catch(Sl... | 6 |
public static int[] runFourCard (int [] c, long dead)
{
int res[] = new int[Valuation.NUM_RANKINGS];
for (int i=0; i<52; i++)
if (((one<<i)&dead) == 0)
for (int j=i+1; j<52; j++)
if (((one<<j)&dead) == 0)
for (int k=j+1; k<52; k++)
if (((one<<k)&dead) == 0)
{
c[4] = i;
c... | 6 |
@Override
public void run() throws NullPointerException{
//public void execution(){
while(!dis.readyQueue.Is_Queue_Empty() || !dis.blockQueue.Is_Queue_Empty()){ //Is both Ready and Block queues empty
//instructionCount =10; //@Pravi: this won't be needed, as we are assigning a value ... | 9 |
private static void write(SootClass sClass, int output_format) {
OutputStream streamOut = null;
try {
String filename = SourceLocator.v().getFileNameFor(sClass, output_format);
if (output_format == Options.output_format_class)
streamOut = new JasminOutputStream(new FileOutputStream(filename));
else
... | 7 |
public ConnectionInfo getConnectionInfo() {
return connectionInfo;
} | 0 |
private void notifyAtListner(final Subscriber<?, ?> listener, final Envelop data) {
executor.execute(new Runnable() {
@Override
public void run() {
final Filter f = listener.getFilter();
if (f.getManagedType() == null || data.getContentTyp... | 5 |
public void sub(int[] S, int start){
for(int i = start; i < len; ++i){
if(i > start && S[i] == S[i-1]) continue;
seq.add(S[i]);
res.add(new ArrayList<Integer>(seq));
sub(S, i+1);
seq.remove(seq.size() - 1);
}
} | 3 |
@Test
public void testSetSocketTimeout() {
LOGGER.log(Level.INFO, "----- STARTING TEST testSetSocketTimeout -----");
String client_hash = "";
String client_hash2 = "";
String client_hash3 = "";
try {
client_hash = server2.addSocket("127.0.0.1", port);
} ca... | 5 |
static int knapsackV(int[] p,int[] v,int maxV){
if (maxV <= 0 || p == null || v == null || p.length != v.length){
return 0;
}
int size = p.length;
if (size == 1){
if (v[0] <= maxV){
return p[0];
} else {
return 0;
... | 8 |
public boolean testScore(String startScore) { //sees if string is valid score
String tempNumStr = "";
Integer firstInt = 0;
Integer secondInt = 0;
Double tempScore = 0.0;
if(startScore == "0") {
return true;
}else {
char[] aCharArray = startScore.toCharArray(); //turns input into array so it can be it... | 9 |
public static void writeFileUTF8(File file, StringBuffer str){
if(!file.exists()){
try {
if (file.createNewFile()){
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file... | 8 |
public static void main(String[] args) {
if(args.length < 3) {
System.err.println("Not enough arguments!");
System.err.println(getHelp());
System.exit(0);
}
try {
float a = (float) Float.valueOf(args[1]);
float b = (float) Float.valueOf(args[2]);
if(a < 0 || b < 0) {
System.err... | 8 |
public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(CONFIG_FILE);
} catch (IOException ex) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
return ... | 2 |
public static ArrayList<Excel> scale(int coeff, ArrayList<Excel> toScale)
{
return Scalign.scale(coeff, toScale);
} | 0 |
public ArrayList<Entity> retrieveSideWarps(){
ArrayList<Entity> warps = new ArrayList<>();
MapProperties prop = tileMap.getProperties();
Warp w;
if(prop.get("next")!=null){
w = main.findWarp(ID, 1);
w.setOffset(-4*Vars.TILE_SIZE, this.groundLevel);
warps.add(w);
// adds a trigger to show the title ... | 4 |
public void insert(String column[], String value[], String type[])
{
if(conn!=null){
try
{
stmt = conn.createStatement();
String query = "insert into " + table_name + " (";
for(int i=0;i<column.length;i++){
query +=... | 7 |
public void updatePlayerDisplayName(Player p) {
String confPath = "players." + p.getName();
String title = fastTitles.getConfig().getString(confPath);
if (title == null || title.equalsIgnoreCase("none")) {
p.setDisplayName(p.getName());
} else {
String titleFormat = getTitle(title);
if (titleFormat != ... | 3 |
@Override
public void cleanup() {
super.cleanup();
client.removeMessageListener(this);
if(!stateSwitch && client != null && client.isConnected()) {
client.close();
}
} | 3 |
public int GetEmptyTrips()
{
return emptyTrips;
} | 0 |
public static void main(String[] args) {
Scanner consoleScanner = new Scanner(System.in);
while (true) {
System.out.print("Would you like to do: [1] convert celsius to fahrenheit, [2] convert fahrenheit to celsius, [3] quit: ");
int input = 0;
input = consoleScanner.n... | 4 |
public void chooseImage() {
// get the entity from the map that is on either side of this. if one is a
// wall then we turn the graphic to a "-" if neither then we leave it as a
// "|"
if (getGameMap().isSceneryAtPoint(getX(), getY() + 1)) {
if (getGameMap().getSceneryAtPoint(getX(), getY() + 1) i... | 4 |
public SimpleFrame() {
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
setTitle("Forest:");
setLocation(400, 200);
Container con = getContentPane();
con.setLayout(new FlowLayout());
button1 = new JButton("Create");
button2 = new JButton("Read");
button3 = new JButton("Update");
button4 = new JButton("Delete")... | 7 |
public byte[] toByteArray() {
return stream.toByteArray();
} | 0 |
public void testConstructor_invalidObject_DateTimeZone() throws Throwable {
try {
new DateMidnight(new Object(), PARIS);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
private static final void method714(int i) {
Widget class46 = AbstractFontRasterizer.getWidget(i);
if (class46 != null) {
int i_520_ = i >>> 16;
Widget[] class46s = Class369_Sub2.aClass46ArrayArray8584[i_520_];
if (class46s == null) {
Widget[] class46s_521_
= Class348_Sub40_Sub33.aClass46ArrayA... | 5 |
* @return The amount
*/
public int getComboAmount(int c) {
if (c == SimpleCreature.COMBO_ONE) {
return SimpleCreature.COMBO_ONE_AMOUNT;
}
if (c == SimpleCreature.COMBO_TWO) {
return SimpleCreature.COMBO_TWO_AMOUNT;
}
if (c == SimpleCreature.COMBO_THREE) {
return SimpleCreature.COMBO_TWO_AMO... | 3 |
public void doSspcCdf(int first, int last, int date) throws CDFException{
float scint_temp = 0, dpu_temp = 0;
int numOfRecs = last - first;
float[][]
sspc_rebin = new float[numOfRecs][256],
sspc_error = new float[numOfRecs][256];
float[]
old_edges,
std_edg... | 9 |
@Override
public boolean setDefault(boolean def) {
return (defaultGroup = def);
} | 0 |
@Override
public Set<String> getGroups() throws DataLoadFailedException {
return getList("groups", "name");
} | 0 |
private void fallIfPossible(World par1World, int par2, int par3, int par4)
{
if (BlockSand.canFallBelow(par1World, par2, par3 - 1, par4) && par3 >= 0)
{
byte var8 = 32;
if (!BlockSand.fallInstantly && par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + v... | 7 |
static void quickSortStringArray(String array[], int lo0, int hi0) {
int lo = lo0 ;
int hi = hi0 ;
String mid = null ;
if ( hi0 > lo0 ) {
mid = array[(lo0+hi0)/2] ;
while (lo <= hi) {
while ((lo < hi0) && (array[lo].compareTo(mid) < 0))
... | 9 |
public static void checkEvolutions()
{
for(int i=0; i<userNumOfPokemon; i++)
{
if(user[i].status!=Pokemon.Status.FNT&&Mechanics.participatedInBattle[i]&&(user[i].evolve(user[i])!=user[i].species||user[i].evolve(user[i],JokemonDriver.trainerIdNumber)!=user[i].species))
{
ynWin=new YesNoWindow();
ynWin... | 9 |
protected void type(By locator, String text)
{
if (text != null)
{
driver.findElement(locator).clear();
driver.findElement(locator).sendKeys(text);
}
} | 1 |
private void getNextTetromino() {
// Get next tetromino and generate new one
Iterator<Tetromino> it = next.iterator();
if (it.hasNext()) {
tetromino = next.pop();
next.add(bag.draw());
} else {
tetromino = bag.draw();
}
// Notify liste... | 4 |
public static void main(String[] args) throws IOException {
String filename = "fairyface";
BufferedImage img = ImageIO.read(new File(filename + ".png"));
int height = img.getHeight();
int width = img.getWidth();
int k = 1;
int horz = 2;
int vert = 4;
int hSize = height / horz;
int wSize = width / vert... | 2 |
private static void printKMax(int[] items, int k) {
Deque<Integer> que = new ArrayDeque<Integer>(k);
for (int i = 0; i < k; i++) {
// Remove index of items smaller than current item in the array
while (!que.isEmpty() && items[i] >= items[que.peekLast()]) {
que.po... | 8 |
@Override
public Pos WhereSet(Bord bord,Pos clickPos) {
Pos retPos = null;
ArrayList<Point> handList = new ArrayList<Point>();
// おけるところすべてを取得してループをまわす
ArrayList<Pos> canSetList = bord.getCanSetList(getMyColor());
for (Pos pos : canSetList) {
Bord vrBord = bord.clone();
// 一度石を置く
vrBord.DoSet(pos... | 5 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
else if (obj == null)
return false;
else if (getClass() != obj.getClass())
return false;
else {
Num other = (Num) obj;
if (x == null && other.x != null)
return false;
else if (!x.equals(other.x))
return false;... | 6 |
public final boolean operator(Screen r) {
if (id != r.id)
return false;
if (!dimensions.equals(r.dimensions))
return false;
if (flags != r.flags)
return false;
return true;
} | 3 |
public void setDepth(int depth) {
this.depth = depth;
for (Node n : children.values()) {
n.setDepth(depth + 1);
}
} | 1 |
public static void main(String[] args) {
try {
f(0);
f(1);
} catch(Exception e) {
e.printStackTrace();
} finally {
System.out.println("Finally: f(1)");
}
try {
f(2);
} catch(Exception e) {
e.printStac... | 4 |
public static void main(String[] args) throws IOException {
boolean running = true;
while (running) {
System.out.println("0.\tQuit");
System.out.println("1.\tCustom packet");
System.out.println("2.\tIdent packet");
System.out.println("3.\tRequest flavors packet");
System.out.println("4.\tRequest to... | 9 |
public void makeDeclaration(Set done) {
super.makeDeclaration(done);
if (isConstructor() && !isStatic()
&& (Options.options & Options.OPTION_ANON) != 0) {
ClassInfo clazz = getClassInfo();
InnerClassInfo outer = getOuterClassInfo(clazz);
ClassAnalyzer clazzAna = methodAnalyzer.getClassAnalyzer(clazz);... | 6 |
@Override
public void keyEnterPressed() {
if (!Game.RELEASE) {
if (shouldRender) {
if (consoleText.isEmpty()) {
opening = false;
closing = true;
} else {
hudManager.processConsoleCommand(consoleText);
... | 3 |
public MultiPointerServer() throws IOException, AWTException
{
thisPtr = this;
loadConfig(CONFIG_FILE);
/*
try
{
localAddr = InetAddress.getLocalHost();
if (localAddr.isLoopbackAddress())
{
localAddr = LinuxInetAddress.getLocalHost();
}
mLocalHostName = localAddr.getHostName();
mLocalH... | 9 |
@Override
public boolean activate() {
return (Bank.isOpen()
&& !Widgets.get(13, 0).isOnScreen()
&& Settings.usingHerb
);
} | 2 |
public void removePerson(P p) {
GameData g = GameData.getCurrentGame();
if (p instanceof Contestant)
g.removeContestant((Contestant) p);
else if (p instanceof User)
g.removeUser((User) p);
fireTableDataChanged();
} | 2 |
public Map<String, Long> getStatistics() {
throw new RuntimeException("not implemented");
} | 0 |
private void reply(IrcMessage rawmessage, String message)
{
if(rawmessage.getType() == MessageTypes.CHANMSG)
{
try{ rawmessage.getClient().PrivMsg(rawmessage.getChannel(), message, false); }
catch(Exception e){}
return;
}
else if(rawmessage.getType... | 4 |
public void Weights(){
for(int i=0; i<inputNodes.length; i++)
for(int j=0; j<inputNodes[i].brnO.length; j++){
// System.out.print(inputNodes[i].brnO[j].getWeight()+"\t");
inputNodes[i].brnO[j].updateWeight(alfa);
// System.out.print(inputNodes[i].brnO[j].getWeight()+"\n");
}
//System.out.print("\n")... | 9 |
@Override
public boolean removeWatcher(WatchKey watchKey) throws IOException {
boolean isWatcherRemoved = JNotify.removeWatch((Integer) ((JNotifyWatchKey) watchKey).getWatchKey());
if (isWatcherRemoved) {
LOG.info(StringUtil.concatenateStrings("Watcher: ", watchKey.toString(), " was successfully unregistered.")... | 1 |
public static TennisGame getInstance(){
if(instancia == null){
instancia = new TennisGame();
}
return instancia;
} | 1 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Timing that = (Timing) o;
if (Double.compare(that.ioResponseTime, ioResponseTime) != 0) return false;
if (Double.compare(that.worstReadeTime, w... | 8 |
@Override
public void testAssumptionFailure(Failure failure) {
setCurrentFailure(failure);
logger.warn("END Testcase '{}' '{}' BLOCKED because '{}'.", new Object[] {getId(failure.getDescription()),
failure.getTestHeader(), failure.getMessage(), });
} | 0 |
static final public void expressao_relacional() throws ParseException {
trace_call("expressao_relacional");
try {
adicao();
label_7:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMPARACAO:
case DIFERENTE:
case MAIOR_QUE:
case MENOR_QUE:
... | 8 |
void disposeAccessibles() {
if (accessibles != null) {
for (int i = 0; i < accessibles.length; i++) {
if (accessibles[i] != null) {
accessibles[i].dispose();
}
}
accessibles = null;
}
} | 3 |
public String[] getSomeStrArray() {
return someStrArray;
} | 0 |
private static boolean isPermutate(int i, int j){
int[] a = new int[10];
int[] b = new int[10];
String si = Integer.toString(i);
String sj = Integer.toString(j);
for(char ii : si.toCharArray()){
a[Integer.parseInt(""+ii)]++;
}
for(char jj : sj.toCharArray()){
b[Integer.parseInt(""+jj)]++;
}
... | 4 |
public static void run(URL warUrl, boolean consoleMode, String[] args)
throws Exception {
if (args.length == 0 || isHelp(args)) {
BootstrapCommon.printUsage(WebappBootstrapMain.class, "usage-webapp.txt");
System.exit(-1);
}
Options options = createOptions();
Parser parser = new GnuPa... | 8 |
public int[][] generateMatrix(int n) {
int[][] matrix = new int[n][n];
int startx = 0;
int starty = 0;
int endx = n - 1;
int endy = n - 1;
int num = 1;
while (startx <= endx && starty <= endy) {
for (int i = starty; i <= endy; i++) {
matrix[startx][i] = num;
num++;
}
for (int i = startx +... | 8 |
private void removeAllComponents(Container container){
if(container.getComponentCount() != 0){
for (Component component : container.getComponents()) {
if(component instanceof Container){
Container childContainer = (Container) component;
if(childContainer.getComponentCount() != 0){
removeAllComponents... | 4 |
public int calcFatorInc(Personagem personagem){
int valor = 0;
switch (personagem.getClasse()){
case 1:
valor = (int) (personagem.getQuantidadeVida() * 0.1);
break;
case 2:
valor = (int) (personagem.getQuantidadeVida() * 0.4);
... | 3 |
public static void main(String[] args) {
final String graphite_path = "/home/inescid/graphite/";
final String sniper_path = "/home/inescid/sniper-5.3/";
final String test_folder_path = "/home/inescid/Desktop/autotests/";
if(args.length == 0 || args.length > 6){
System.out.println("use --help option to obta... | 7 |
private void appendToBuffer(StringBuffer buf, String text, int depth, boolean appendLineEnd) {
for (int i = 0; i < depth; i++) {
buf.append(CHAR_TAB);
}
buf.append(text);
if (appendLineEnd) {
buf.append(CHAR_NEWLINE);
}
} | 2 |
public String getConfigPath(String filename) {
if (isApplet()) return null;
File jgamedir;
try {
jgamedir = new File(System.getProperty("user.home"), ".jgame");
} catch (Exception e) {
// probably AccessControlException of unsigned webstart
return null;
}
if (!jgamedir.exists()) {
// try to crea... | 9 |
@Override
public void actionPerformed(ActionEvent e) {
String action = e.getActionCommand();
switch (action) {
case "Start":
boolean validInput = true;
String userFisrtName = tfUserName.getText();
String userLastName = tfUserLastName.getText();
if (userFisrtName.equals("") || userLastName.equals(""))... | 7 |
public static Image getFaceDownCardImage() {
String curDir = System.getProperty("user.dir");
String pathName = curDir + "/classic_cards/";
Image pic = Toolkit.getDefaultToolkit().getImage(pathName + cardImageFileNames[cardImageFileNames.length - 1]);
return pic;
} | 0 |
@Override
public Object getValue() {
return this.nativeValue;
} | 0 |
@Override
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_D) {
MainChar.setRPress(false);
}
if (e.getKeyCode() == KeyEvent.VK_A) {
MainChar.setLPress(false);
}
if (e.getKeyCode() == KeyEvent.VK_S) {
MainChar.setDPress(false);
}
if (e.getKeyCode() == KeyEvent.VK_W) {
Ma... | 4 |
@Override
public void actionPerformed(ActionEvent e) {
String action = e.getActionCommand();
if (action.equals(">>>>")) {
verplaatsOpdrachtNaarRechts();
} else if (action.equals("<<<<")) {
verwijderOpdrachtVanToegevoegdeOpdrachten();
} else if (action.equals("^^^^")) {
verplaatsOpdrachtNaarBoven... | 4 |
public static void setIntLE(final byte[] array, final int index, final int value, final int size) {
switch (size) {
case 0:
return;
case 1:
Bytes.setInt1(array, index, value);
break;
case 2:
Bytes.setInt2LE(array, index, value);
break;
case 3:
Bytes.setInt3LE(array, index, value);
... | 5 |
private static int[] stringToArray_4(String s) {
int[] ret = null;
if ((s != null) && !s.equals("")) {
String[] tmp = s.split(SkinConstants.SPLIT2);
if (tmp.length == 4) {
ret = new int[4];
try {
for (int i = 0; i < tmp.lengt... | 5 |
private boolean headerAlreadySent(Map<String, String> header, String name) {
boolean alreadySent = false;
for (String headerName : header.keySet()) {
alreadySent |= headerName.equalsIgnoreCase(name);
}
return alreadySent;
} | 1 |
public void tick(long delta) {
// FOLLOW CAM
//------------
//
// Seems to only work correct in 1920 * 1080 resolution
// Probably to do with scaling...
//
// Work on this later! (tired, 23.55 now...)
//
//------------
if(game.her... | 4 |
public static Method findMethod(Class<?> clazz, String method, Class<?>... parameters) {
for (Method m : clazz.getDeclaredMethods())
if (m.getName().equals(method) && Arrays.equals(m.getParameterTypes(), parameters))
return m;
if (clazz.getSuperclass() != null)
re... | 6 |
public static void main(String[] args){
try {
Object obj = Class.forName(args[0]).newInstance();
String[] temp = new String[args.length-1];
for(int i=1 ; i<args.length ; i++){
temp[i-1] = args[i];
}
CommandLineParser.parseCommandLine(temp,obj);
for(Method method : obj.get... | 8 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
else
if((affected!=null)&&(affected instanceof Room)&&(invoker!=null))
{
final Room room=(Room)affected;
for(int i=0;i<room.numInhabitants();i++)
{
final MOB inhab=room.fetchInhabitant(i... | 7 |
public ChordBoardAPPView(SingleFrameApplication app) {
super(app);
initComponents();
// status bar initialization - message timeout, idle icon and busy animation, etc
ResourceMap resourceMap = getResourceMap();
int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeo... | 7 |
public void testDuringAddIndexes() throws Exception {
Directory dir1 = new MockRAMDirectory();
final IndexWriter writer = new IndexWriter(dir1, new WhitespaceAnalyzer(),
IndexWriter.MaxFieldLength.LIMITED);
writer.setInfoStream(infoStream);
writer.setMergeF... | 7 |
public static boolean isPrime(int n) {
if (n <= 3) {
return n >= 2;
} else if (n % 2 == 0 || n % 3 == 0) {
return false;
} else {
for (int i = 5; i < (Math.sqrt(n) + 1); i += 6) {
if (n % i == 0 || n % (i + 2) == 0) {
return... | 6 |
public Queue<String> kamikazeXMLUnit (){
try {
path = new File(".").getCanonicalPath();
FileInputStream file =
new FileInputStream(new File(path + "/xml/papabicho.xml"));
DocumentBuilderFactory builderFactory =
DocumentBuilderFactory.newInstance();
... | 9 |
@Override
public boolean userIsAuthorizedForService(String user, Service service) {
log.info("Checking user {}'s authorization for service {}", user, service);
try {
log.debug("Setting the statement parameters");
int index = params.indexOf("user");
if (index > -1)
statement.setString(index + 1,... | 5 |
public static void main(String[] args) {
System.out.println("Welcome to CHATBOT");
String question;
boolean askAQuestion = true;
Scanner keyboard = new Scanner(System.in);
Bot bot = new Bot();
do {
System.out
.println("Tell Chatbox something (enter Goodbye to leave): ");
question = keyboard.nextL... | 7 |
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.