text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
protected void fireEditingStopped() {
super.fireEditingStopped();
} | 0 |
public int getMinRANGE() {
return inventory.getItem(0).getMinRANGE();
} | 0 |
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerJoin(PlayerJoinEvent e) {
if (e.getPlayer().hasPermission("playtime.updatenotice")) {
e.getPlayer().sendMessage(this.message);
}
} | 1 |
public List<String[]> getAttributes() {
List <String[]> l = new ArrayList<String[]>();
String[] s = new String[2];
s = new String[2];
s[0] = "CAT2OSMSHAPEID"; s[1] = getShapeId();
l.add(s);
if (ttggss != null){
l.addAll(ttggssParser(ttggss));
}
return l;
} | 1 |
private boolean promptForNew(boolean brandNew)
{
// SO NOW ASK THE USER FOR A LEVEL NAME
String levelName = JOptionPane.showInputDialog(
view,
LEVEL_NAME_REQUEST_TEXT,
LEVEL_NAME_REQUEST_TITLE_TEXT,
JOptionPane.QUESTION_MESSAGE);
... | 6 |
public AttributesButtonCellEditor(AbstractAttributesPanel panel) {
super(new JCheckBox());
this.panel = panel;
} | 0 |
public void selectChoice() {
boolean cease;
String _open = "Open new account";
String _log = "Log into existing account";
String _help = "Help";
String _quit = "Quit";
do {
cease = false;
do {
try {
prompt... | 8 |
public static String normalize(final String s) {
if (s == null) {
return "";
}
final StringBuffer str = new StringBuffer();
final int len = s.length();
for (int i = 0; i < len; i++) {
final char ch = s.charAt(i);
switch (ch) {
... | 9 |
public void cliqueFinTour() {
/* en mode conquete, confirmé, et possède au moins un territoire (sinon il ne peut pas redéployer...) */
if( joueurEnCours.getPeuple().getTerritoiresOccupes().isEmpty() ){
new WinWarn("Veuillez tout d'abord prendre au moins un territoire");
}else if((etape == 0 || etape == 1) && G... | 4 |
private boolean jj_2_74(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_74(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(73, xla); }
} | 1 |
public void execute( Stack stack )
{
for (int i = actions.length-1; i >= 0; i--){
if( Compiler.extendedDebug ){
//System.out.println(actions[i]);
}
actions[i].execute( stack );
}
} | 2 |
public static HDRExposure scaleTo( HDRExposure exp, int width, int height ) {
if( !aspectRatioPreserved(exp.width, exp.height, width, height) ) {
throw new UnsupportedOperationException("Cannot change aspect ratio");
}
double scale = width / exp.width;
if( scale == 0 ) {
return new HDRExposure(0, 0);
... | 8 |
private void CommandNewSource( boolean priority, boolean toStream,
boolean toLoop, String sourcename,
FilenameURL filenameURL, float x,
float y, float z, int attModel,
floa... | 3 |
public static File getWorkPath(String workDir){
String userHome = System.getProperty("user.home", ".");
File workingDirectory;
switch (getPlatform().ordinal()) {
case 0:
case 1:
workingDirectory = new File(userHome, '.' + workDir + '/');
br... | 7 |
public void tabSpecificProcess(String s)
{
if(s.startsWith("/nick"))
{
if(action == -1)
{
addMessage("Changing default nick to " + s.substring(6) + ".");
Main.saveDefaultNickname(Main.user);
}
else
{
getServer().changeNick(s.substring(6));
addMessage("Nick changed to " + s.substring(... | 6 |
Object[] getAttribute(String elName, String name)
{
Hashtable attlist;
Object attribute[];
attlist = getElementAttributes(elName);
if (attlist == null) {
return null;
}
attribute = (Object[]) attlist.get(name);
return attribute;
} | 1 |
@Override
public void run() {
char read;
try {
while ((read = (char) inputStream.read()) != -1) {
if (read == '\n' || read == '\r') {
command = inputBuffer.toString();
printOutputStream.print("\r\nServer: " + command + "\r\n");
inputBuffer = new StringBuffer();
} else if (read == '\u007f'... | 9 |
public void setPhoneNumber(int phoneNumber) {
this.phoneNumber = phoneNumber;
} | 0 |
private void jComboBoxServerContractsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxServerContractsActionPerformed
System.out.println("In Action for Server Combo main tab");
/*String nymID = Utility.getKey(nymMap, (String) jComboBox1.getSelectedItem());
String assetI... | 9 |
public static VisitBathroom getSingleton(){
// needed because once there is singleton available no need to acquire
// monitor again & again as it is costly
if(singleton==null) {
synchronized(VisitBathroom.class){
// this is needed if two threads are waiting at the monitor at the
... | 2 |
private SQLite() {
this.prefix = "storm__";
this.dbg = true;
String dbPath = "jdbc:sqlite::memory:";
try {
Class.forName("org.sqlite.JDBC");
this.con = DriverManager.getConnection(dbPath);
} catch (SQLException e) {
if (this.dbg) {
e.printStackTrace();
}
} catch (ClassNotFoundException ... | 4 |
private boolean testSign(Player player, Block block) {
Sign sign = null;
if (block.getType() == Material.WALL_SIGN
|| block.getType() == Material.SIGN_POST)
sign = (Sign) block.getState();
if (sign != null)
if (sign.getLine(0).equals(
"" + ChatColor.GRAY + ChatColor.BOLD + "["... | 7 |
public double computeSimilarity(int user1, int user2) {
double sim = 0;
// generate arrays containing ratings from users which rated both movies
List<Integer> sharedMovies = findSharedMovies(user1, user2);
if (sharedMovies.isEmpty()) {
return sim;
}
Double[] userOneRatings = new Double[sharedMovies.si... | 4 |
@SuppressWarnings("deprecation")
public static void main(String[] args) {
HashMap<String, ArrayList<Integer>> finalMap = new HashMap<String, ArrayList<Integer>>();
HashMap<String, HashMap<Integer,Integer>> dayCountForStnMap = new HashMap<String, HashMap<Integer,Integer>>();
HashMap<Integer, String> stationIdName... | 8 |
public static String numberToString(Number number) throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
if (string... | 6 |
public static void main(String[] args) throws Exception {
if(args.length < 2) {
System.out.print("Usage : scdecoder -f <file> \n"
+ " : scdecoder -s <string1> [string2] ...\n");
return ;
}
String argument;
if(args[0].equals("-f")) {
argument = args[1];
... | 8 |
@Override
public void run() {
Envelope e = null;
try {
/*
* Loop to check for incoming messages.
*/
while((e=(Envelope)in.readObject()) != null)
{
//Special server message that adds to the user list.
if(e.sender().equals("Server") && e.message().equals("Join."))
{
user... | 7 |
protected void processKeyEvent (java.awt.event.KeyEvent e) {
// TODO: Convert into Actions and put into InputMap/ActionMap?
if (e.getID()==KeyEvent.KEY_PRESSED) {
switch (e.getKeyCode()) {
case KeyEvent.VK_LEFT:
boolean extend = e.isShiftDown();
int offs = Math.max(leadSelectionIndex-1, 0);
c... | 9 |
public void closeChannels() {
try {
if (socketChannel != null) {
socketChannel.close();
}
if (serverChannel != null) {
serverChannel.close();
}
} catch (IOException e) {
stdOut.printError(TAG + " Error while clos... | 3 |
private static byte[] decryptBloc(byte[] input){
byte[] tmp = new byte[input.length];
int t,u;
int aux;
int[] data = new int[input.length/4];
for(int i =0;i<data.length;i++)
data[i] = 0;
int off = 0;
for(int i=0;i<data.length;i++){
data[i] = ((input[off++]&0xff))|
((input[off++]&0xff) << 8) |... | 4 |
public static String parseAndExecute(String statement, Map<String, String> parameters, DB db) {
String result = null;
List<String> sqlParams = new ArrayList<String>();
StringBuffer sb = new StringBuffer();
int prevIdx = 0;
int idx = -1;
while(((idx=statement.indexOf("{", idx+1)))>=0) {
log.finest(sb.t... | 9 |
public void makeSallary() {
method1();
method2();
method3();
} | 0 |
private void powrotDoOknaGlownego()
{
widokUstawien.setVisible(false);
if(oknoMacierzyste.equals("OknoGlowne"))
widokUstawien.widokGlowny.setVisible(true);
if(oknoMacierzyste.equals("OknoDolacz"))
widokUstawien.widokGlowny.widokDolacz.setVisible(true);
if(oknoMacierzyste.equals("OknoUtworz"))
widokUst... | 7 |
public void run() {
println ("This program find the largest and smallest numbers.");
int n = readInt ("? ");
if ( n == SENTINEL) {
println ("The program is terminated by your input of the setinel number. ");
}
/* variable amountInput is for counting the amount of numbers we've input.
* variable largestN... | 7 |
public static byte[] decrypt(byte[] data, String key, String algorithm)
throws InvalidKeyException, NoSuchAlgorithmException,
InvalidKeySpecException, NoSuchPaddingException,
BadPaddingException, IllegalBlockSizeException {
Key k = toKey(SecurityCoder.base64Decoder(key), algorithm);
Cipher cipher = Cipher.... | 0 |
private static BigInteger findPrime(BigInteger number) {
boolean prime = false;
Random r = new Random();
while (!prime) {
prime = true;
for (int j = 0; j < 100; j++) {
BigInteger a = BigInteger.valueOf(number.compareTo(BigInteger
.valueOf(Integer.MAX_VALUE)) == -1 ? (int) number
.intValue() ... | 4 |
public final DccChat dccSendChatRequest(String nick, int timeout) {
DccChat chat = null;
try {
ServerSocket ss = null;
int[] ports = getDccPorts();
if (ports == null) {
// Use any free port.
ss = new ServerSocket(0);
... | 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 |
public static ArchiveDataKindCombination getADKCombination(boolean oa, boolean on, boolean na, boolean nn) {
List<ArchiveDataKind> dataKinds = new ArrayList<ArchiveDataKind>();
if(oa) dataKinds.add(ArchiveDataKind.ONLINE);
if(on) dataKinds.add(ArchiveDataKind.ONLINE_DELAYED);
if(na) dataKinds.add(ArchiveDataKin... | 8 |
private void paivitaTetriminonTippuminen()
{
if(pelitilanne.onTauolla() || pelitilanne.peliOnPaattynyt())
return;
int vauhti = pelitilanne.arvo(Pelitilanne.Tunniste.VAIKEUSTASO) * 50;
if(vauhti >= 500)
vauhti = 450;
if(pelitilanne.tiputusAjastin().on... | 4 |
public void run() {
try {
s = new ServerSocket(GAME_PORT);
incoming = s.accept();
inStream = incoming.getInputStream();
outStream = incoming.getOutputStream();
in = new BufferedReader(new InputStreamReader(inStream));
out = new PrintWriter(... | 7 |
public int getSpawnpointNumber(){
int spawnpoints = 0;
Tile currentJTile = topTile;
for(int j = 0; j < dimension; j++){
Tile currentKTile = currentJTile;
for(int k = 0; k < dimension; k++){
if(currentKTile.tileType == TileType.SPAWN){
spawnpoints++;
}
currentKTile = currentKTile.rightDown;
... | 3 |
public void inOrder() {
// 1 Linker Knoten, 2 Konten selber , 3 Rechter Knoten
if (left != null) {
left.inOrder();
}
print();
if (right != null) {
right.inOrder();
}
} | 2 |
public void updateReward(State s)
{
double outputReward = s.stateScore();
if (outputReward != 0)
{
visits++;
double alpha = (double)(1/(double)visits);
double secondpart = alpha * gamma * outputReward;
double firstpart = (1-alpha) * reward;
reward = firstpart + secondpart;
}
} | 1 |
public FlowersTile(Sprite sprite, String id){
super(sprite, id);
} | 0 |
public static StateManager getInstance()
{
return ourInstance;
} | 0 |
@Override
public boolean equals(Object obj) {
if (obj instanceof AbstractAnswer) {
AbstractAnswer o = (AbstractAnswer) obj;
if ((ignoreCase == o.ignoreCase)
&& variants.size() == o.variants.size()
&& o.variants.containsAll(variants)) {
... | 4 |
void countFile(String fileName) {
String fl = fileName.toLowerCase();
if (fl.endsWith(".bam") || fl.endsWith(".sam")) countSamFile(fileName);
else if (fl.endsWith(".vcf") || fl.endsWith(".vcf.gz")) countVcfFile(fileName);
else if (fl.endsWith(".bed") || fl.endsWith(".bed.gz")) countBedFile(fileName);
else th... | 6 |
private void SetItem() {
if (!jtfTitle.getText().isEmpty())
title = jtfTitle.getText();
if (!jtfAuthor.getText().isEmpty())
author = jtfAuthor.getText();
try {
if (!jtfRating.getText().isEmpty())
rating = Integer.valueOf(jtfRating.getText());
if (jtfLength.getText().isEmpty())
length ... | 9 |
static Smelter[] siteSmelterStrip(
final ExcavationSite site, final Service mined
) {
final World world = site.world() ;
final Tile init = Spacing.pickRandomTile(site.origin(), 4, world) ;
final Smelter strip[] = new Smelter[2] ;
final TileSpread spread = new TileSpread(init) {
protec... | 6 |
public void setMessage(String message) {
this.message = message;
if(this.message != null && this.message.equals(""))
this.message = null;
} | 2 |
public void setElement(int i, int j, double a) {
if (i == j + 1)
lower[j - 1] = a;
else if (i == j)
diag[i - 1] = a;
else if (i == j - 1)
upper[i - 1] = a;
else
System.out.println("(i,j) liegt nicht auf der Tridiagonalen!");
} | 3 |
protected java.security.cert.X509Certificate[] getX509Certificates(SSLSession session)
throws IOException {
Certificate[] certs = null;
try {
certs = session.getPeerCertificates();
} catch (Throwable t) {
log.debug("Error getting client certs", t);
return null;
}
if (certs == null)
return null;... | 7 |
static protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos... | 9 |
public static DataEntry[] getKNearestNeighbours(List<DataEntry> dataSet, final double[] x, int k){
Comparator<DataEntry> distanceComparator = new Comparator<DataEntry>(){
@Override
public int compare(DataEntry arg0, DataEntry arg1) {
double distA = distance(arg0.getX(), x);
double distB = distance(arg1.... | 6 |
public static List<String> decodificarActualizacion(String actualizacionJSON) {
List<String> resultado = new ArrayList<String>();
JSONParser parser = new JSONParser();
try {
Object objeto = parser.parse(actualizacionJSON);
JSONObject objetoJSON = (JSONObject) objeto;
String cantFilas = (String) objetoJSO... | 1 |
public void output()
{
mSender.sendMessage(ChatColor.GOLD + "Rules being exceeded currently: ");
if(mReport.isEmpty())
mSender.sendMessage(ChatColor.GREEN + " None");
else
{
for(Entry<GroupSettings, StringBuilder> entry : mReport.entrySet())
mSender.sendMessage(ChatColor.YELLOW + " " + entry.getKe... | 2 |
public String describePages() {
StringBuilder sb = new StringBuilder(32);
int sz = pages.size();
for (int i = 0; i < sz; i++) {
boolean oddIndex = ((i % 2) == 1);
boolean closingRangeForSinglePage = false;
if (oddIndex) {
closingRangeForSingleP... | 5 |
public int[] maxHeapify(int[] A, int position, int heapSize){
int positionLeft = left(position);
int positionRight = right(position);
int largest = position; //store the largest element between left right and parent
if(positionLeft <= heapSize && A[positionLeft] > A[largest]){
largest = positionLeft;
... | 5 |
private JTextField getJTextFieldSpellDictionaryFilename() {
if (jTextFieldSpellDictionaryFilename == null) {
jTextFieldSpellDictionaryFilename = new JTextField();
}
return jTextFieldSpellDictionaryFilename;
} | 1 |
public static List<ShopAddressInfo> getShopAddresses(int shopId)throws HibernateException {
List<ShopAddressInfo> shopAddressList = null;
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
try {
// Begin unit of work
session.beginTransaction();
String hqlString = "select sa from Sh... | 4 |
public void checkCollision(Dimension rec) {
boolean alive = true;
for(int i = snakeLength; i > 0; i--){
if((i > 4) && (X[0] == X[i]) && (Y[0] == Y[i]))
alive = false;
}
if(Y[0] >= rec.height)
alive = false;
if(Y[0] < 0)
alive = false;
if(X[0] >= rec.width)
alive = false;
if(X[0... | 9 |
public void createXmlFromTemplate(String templateFileName, String fileName, HashMap<String, String> hmap) {
try {
DocumentBuilder rBuilder = init();
Document rDoc = rBuilder.parse(templateFileName);
Element rRoot = rDoc.getDocumentElement();
DocumentBuilder wBuil... | 4 |
public void run() {
setName(this.getClass().getSimpleName() + " [" + actors.playerId + "]");
setPriority(NORM_PRIORITY + 2);
while (gameState != STATE_STOPPED) {
int frames = waitForNextFrame();
for (Updateable c: callbacks)
c.update(gameState == STATE_P... | 3 |
private ClassLoader getBaseClassLoader() throws LogConfigurationException {
ClassLoader thisClassLoader = getClassLoader(LogFactoryImpl.class);
if (useTCCL == false) {
return thisClassLoader;
}
ClassLoader contextClassLoader = getContextClassLoader();
Class... | 7 |
public static Set getSet(int id)
{
Set set = new Set();
Node node = nodeList.item(id);
set.height = new Integer(node.getAttributes().getNamedItem("height").getNodeValue());
NodeList nnm = node.getChildNodes();
set.entities = new Entity[nnm.getLength()];
for (int j = 0; j < nnm.getLength(); j++)
{
... | 4 |
public void buildClassifier(Instances insts) throws Exception {
m_Filter = null;
if (!isPresent())
throw new Exception("libsvm classes not in CLASSPATH!");
// remove instances with missing class
insts = new Instances(insts);
insts.deleteWithMissingClass();
if (!getDoNotReplaceMi... | 8 |
public String getRate(String r){
if (r == null)return null;
int pos = r.lastIndexOf("=");
r = r.substring(pos + 1);
pos = r.lastIndexOf(".");
r = r.substring(0, pos + 6);
if (r.contains(",")){
pos = r.lastIndexOf(",");
r = (r.substring(0, pos)... | 2 |
public void rescale(){
double xmin = Double.MAX_VALUE;
double xmax = Double.MIN_VALUE;
double ymin = Double.MAX_VALUE;
double ymax = Double.MIN_VALUE;
for(drawNode N : nodes)
{
xmin = xmin < N.x ? xmin : N.x;
xmax = xmax > N.x ? xmax : N.x;
... | 7 |
public boolean playerOnPoint(Player p){
Block b = p.getLocation().getBlock();
return Team.blockMaterialIsTeamMaterial(b) || Team.blockMaterialIsTeamMaterial(b.getRelative(BlockFace.DOWN, 1)) || Team.blockMaterialIsTeamMaterial(b.getRelative(BlockFace.DOWN, 2));
} | 2 |
@Override
public void removeExtension(String ext) {
extensions.remove(ext);
} | 0 |
public addGUI(final String lastData) {
answer = true;
setTitle("20 Questions");
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
Main.exitCheck(getContentPane());
}
});
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
setBounds(0, 0, 384, 288);
... | 7 |
public void dispose() {
for (int i = 0; i < resources.size(); i++) {
Object obj = resources.get(i);
if (obj != null && obj instanceof Resource)
((Resource) obj).dispose();
}
resources = new ArrayList();
if (menu1 != null) {
menu1.dispose();
menu1 = null;
}
if (menu2 != null) {
menu2.dispose();
m... | 5 |
private String buildItemString(ItemStack[] items) {
StringBuilder sbItems = new StringBuilder();
StringBuilder sbAmount = new StringBuilder();
StringBuilder sbDurability = new StringBuilder();
StringBuilder sbEnchants = new StringBuilder();
for (ItemStack item : items) {
int itemId = 0;
int amount = 0;... | 4 |
@Override
public Handshakedata translateHandshake( ByteBuffer buf ) throws InvalidHandshakeException {
HandshakeBuilder bui = translateHandshakeHttp( buf, role );
// the first drafts are lacking a protocol number which makes them difficult to distinguish. Sec-WebSocket-Key1 is typical for draft76
if( ( bui.hasF... | 5 |
@Override
public boolean runTest(){
return ((notString("candy").equals("not candy")) &&
(notString("x").equals("not x")) &&
(notString("not bad").equals("not bad")) &&
(notString("bad").equals("not bad")) &&
(notString("not").equals("not")) &&
(notString("is not").equals("not is not")) &&
(no... | 6 |
public String toString(){
String s = "";
if (value == 1) s += "Ace";
else if (value == 11) s += "Jack";
else if (value == 12) s += "Queen";
else if (value == 13) s += "King";
else s += "" + value;
if (suit == 0) s += " of clubs";
else if (suit == 1) s += " of diamonds";
else if (suit == 2) s+= " of h... | 7 |
public double parseDouble() throws IOException {
int sign = 1;
int c = nextNonWhitespace();
if( c == '+' ) {
// Unclear if whitespace is allowed here or not
c = read();
} else if( c == '-' ) {
sign = -1;
// Unclear if whitespace is a... | 7 |
public void updateFileLinksOnWindows() {
if (currentFiles == null) {
currentFiles = getFiles();
}
toUpdate.clear();
List<ServerFile> toDelete = new ArrayList<>();
for (ServerFile file : currentFiles) {
if (file.getFlag() == ServerFile.DELETED) {
file.tryDelete(getController().getConfig().getProper... | 8 |
private static void manageArgs(String[] args) {
for (int i = 0; i < args.length; i++) {
switch (args[i].trim().toLowerCase()) {
case "nogui":
nogui = true;
break;
case "server":
startServer = true;
break;
case "port":
if (i < args.length - 1) {
port = parsePositiveInt(arg... | 5 |
public void setCity(String city) {
if(city == null || city.isEmpty()){
throw new IllegalArgumentException();
}
this.city = city;
} | 2 |
public void setType(ReleaseType type)
{
if (type == null) throw new IllegalArgumentException("Release type cannot be null");
this.type = type;
} | 1 |
private static void Search(int[] array2) {
// TODO Auto-generated method stub
if(array2.length == 1){
return;
}
if(key == array2[(array2.length)/2]){
exists = true;
}else{
if(key < array2[(array2.length)/2] ){
array2 = Arrays.copyOfRange(array2,0, array2.length/2);
Search(array2);
... | 3 |
public void create(){
init = true;
String sound;
float yOff=0;
//initial body shit
switch(ID){
case"boulderFist":
yOff = -1.2f*height;
break;
default:
//do nothing special
}
//define hitbox physics
PolygonShape shape = new PolygonShape();
shape.setAsBox((rw)/PPM, (rh)/PPM);
bdef.... | 6 |
public void drawImage(int i, int k) {
i += drawOffsetX;
k += drawOffsetY;
int l = i + k * DrawingArea.width;
int i1 = 0;
int j1 = imageHeight;
int k1 = imageWidth;
int l1 = DrawingArea.width - k1;
int i2 = 0;
if (k < DrawingArea.topY) {
int j2 = DrawingArea.topY - k;
j1 -= j2;
k = DrawingArea... | 6 |
@Override
public Box recupera(Integer id) throws RemoteException,
ObjetoNaoEncontradoException
{
Box box = h.get(id);
//If there is a object in box, return it, other wise throws a exception
if(box != null)
{
return box;
}
else //throws a exception
... | 1 |
public boolean checkId(String id) {
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
conn = getConnection();
pstmt = conn.prepareStatement("select id from member where id=?");
pstmt.setString(1, id);
rs = pstmt.executeQuery();
if (rs.next()) {
return true;... | 8 |
private void removeAny(Gameboy gb, List<ListState> listStates, StateBuffer initialStates) {
HashMap<Integer, ListState> listStateMap = new HashMap<>();
for (ListState listState : listStates) {
for (State state : initialStates.getStates()) {
State s = listState == null ? state : listState.toState(g... | 4 |
@Override
public void importRead(String path) {
InputStream is = null;
try {
is = new FileInputStream(path);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
InputStreamReader isr = new InputStreamReader(is);
Scanner scan = new Scanner(is);
// skip ... | 7 |
private void setCIMs(IModel<Double, CTDiscreteNode> model, SufficientStatistics lData[]) throws RuntimeException {
// Parameter calculation
NodeIndexing nodeIndexing = model.getNodeIndexing();
for( int iNode = 0; iNode < nodeIndexing.getNodesNumber(); ++iNode) {
CTDiscreteNode node = model.getNode(iNode);
i... | 9 |
public void render(Screen screen, int xScroll, int yScroll) {
screen.renderSprite(tileset.getBackground(), 0, 0, 0, false); // Render background first
// Then the tiles
screen.setOffset(xScroll, yScroll);
int x0 = xScroll >> 4;
int x1 = (xScroll + game.getScaledWidth() + 16) >> ... | 5 |
public boolean attemptDirection(String dir, double x, double y) {
Rectangle nextLoc = new Rectangle(boundingBox);
boolean isDirectionFree = false;
if(dir.equals("up")) {
nextLoc.setLocation( (int)(x+0*speed), (int)(y-1*speed) );
if(room.isLocationFree(nextLoc,isEaten)) {
... | 8 |
public boolean equals(Object o){
StockItem nimi=(StockItem)o;
return nimi.getId()==getId() && nimi.getName()== getName() && nimi.getDescription()== getDescription() && nimi.getPrice()== getPrice() && nimi.getQuantity()==getQuantity();
} | 4 |
public static void main(String[] args) {
while(condition())
System.out.println("Inside �while�");
// do
// System.out.println("Inside �do-while�");
// while(condition());
System.out.println("Exited �while�");
} | 1 |
private void determineTransitions() {
remainingTransitions = new HashSet();
State[] states = minDfa.getStates();
for (int i = 0; i < states.length; i++)
remainingTransitions.addAll(minimizer.getTransitionsForState(
states[i], minDfa, dfa, tree));
} | 1 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Pose other = (Pose) obj;
if (type != other.type) {
return false;
}
return true;
} | 4 |
@OnLoad
public void onLoad() {
super.onLoad();
TeamModel team = null;
if(getParis_sched()!=null) {
if(paris_team_select == Teams.HOME)
team = DataStore.getTeam(((ScheduleTeamModel)getParis_sched()).getSched_home_team_id());
else if(paris_team_select == Teams.AWAY)
team = DataStore.getTeam(((Schedu... | 4 |
String getHandleFileResult(final AndroidDevice aDevice, SubType subType,
String localFile, String remoteFile) {
try {
switch (subType) {
case PULL:
aDevice.getDevice().pullFile(remoteFile, localFile);
break;
case PUSH:
aDevice.getDevice().pushFile(localFile, remoteFile);
break;
default... | 3 |
public int isCurrencySlot(int slot)
{
if (slot == smallCurrencySlot) return smallCurrency;
if (slot == mediumCurrencySlot) return mediumCurrency;
if (slot == largeCurrencySlot) return largeCurrency;
return 0;
} | 3 |
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerDie(EntityDamageByEntityEvent event) {
Entity entity = event.getEntity();
if (entity instanceof Player) {
Player victim = (Player) entity;
Entity entity2 = event.getDamager();
if (entity2 instanceof Player) {
Player damager = (Player) en... | 8 |
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.