text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void main(String[] args) throws IOException {
/*
* Important: Be sure to fill in your AWS access credentials in the
* AwsCredentials.properties file before you try to run this
* sample.
* http://aws.amazon.com/security-credentials
... | 2 |
void drawHealth(Entity e,Graphics g){
if(e!=null ){
if(e.getHealth() >=
5*e.maxHealth/5){
g.setColor(Color.GREEN); }
if(e.getHealth() == 4*e.maxHealth/5){ g.setColor(Color.YELLOW); }
if(e.getHealth() == 3*e.maxHealth/5){ g.setColor(Color.ORANGE); }
if(e.getHealth() == 2*e.maxHealth/5){ g... | 7 |
public void stopAnimation()
{
if(this.play)
{
this.play = false;
this.allive = false;
}
} | 1 |
@Override
public Class<?> getColumnClass(int columnIndex) {
switch (columnIndex) {
case 0: // ID
return Integer.class;
case 1: // Firstname
return String.class;
case 2: // Lastname
return String.class;
case 3: // Birth
return Date.class;
case 4: // Email
return String.class;
... | 6 |
public Tile(int x, int y, int type) {
this.tileX = x * 40;
this.tileY = y * 40;
this.type = type;
if (type == 5) {
tileImage = GameEngine.tiledirt;
} else if (type == 8) {
tileImage = GameEngine.tilegrassTop;
} else if (type == 4) {
tileImage = GameEngin... | 5 |
public String getLoginpwd() {
return loginpwd;
} | 0 |
@Override
public void setExecCommand(String execCommand) {
this.execCommand = execCommand;
} | 0 |
CarListItf deserializeFromJson(String json) {
AutoBean<CarListItf> bean = AutoBeanCodex.decode(factory, CarListItf.class, "{\"cars\": " + json+ "}");
return bean.as();
} | 0 |
public static PropertyManager getInstance(){
if(instance == null){
instance = new PropertyManager();
}
return instance;
} | 1 |
public AdminLogin() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
setLocationRelativeTo(null);
JPanel panel = ... | 3 |
private boolean testNetworksAccount(){
int testIndex=0;
boolean bError=false;
Properties twitterAccount= null;
Properties blueviaAccount=null;
Properties facebookAccount=null;
++testIndex;
twitterAccount = Util.getNetworkAccount("aleonar@gmail.com", "TwitterAccount");
if (twitterAccount!=null){
... | 8 |
public static void main(String[] args) throws ParsingException, IOException, XMLStreamException
{
if(args.length == 0 || args.length > 3)
{
System.err.println("Incorrect number of arguments");
printHelp();
System.exit(1);
}
boolean compressed = false;
String fileName = null;
for(String arg :... | 9 |
@Override
public HashMap<String, Level> loadAll() {
//Create hashmap of levels
HashMap<String, Level> levels = new HashMap<String, Level>();
//for each file in the directory which has the proper extension
for(File f : getDirectory().listFiles(
new FilenameFilter(){
@Override
public boolean accep... | 9 |
public boolean intersects(BitSet set)
{
for (int i = Math.min(wordsInUse, set.wordsInUse) - 1; i >= 0; i--)
if ((words[i] & set.words[i]) != 0)
return true;
return false;
} | 2 |
public TroubleTest(final File workingDirectory) {
final String name = getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1);
this.working_directory = workingDirectory;
if (!working_directory.isDirectory()) {
Assert.fail("working directory not found: " + working_d... | 4 |
public void exitState(){
if (state == 0){ // determine deal
state ++;
muck();
shuffle();
}
else if (state == 1){ // deal
state ++;
}
else if (state == 2){ // discard and cut
state ++;
selections.clear();
count = 0;
}
else if (state == 3){ // peg
state ++;
computerHand.getCards()... | 7 |
@Test
public void testGetCell() throws Exception {
System.out.println("getCell");
int[] cell = new int[2];
cell[0] = 0;
cell[1] = 0;
World instance = new World();
instance.readInWorld("1.world");
Cell expResult = new Cell(0,0);
AntBrain ab = n... | 0 |
protected void setPieceSkirt()
{
int wmax = width;
int hmax;
skirt = new int[wmax];
for (int i = 0; i < wmax; i++)
{
Point temp = null;
hmax = 10000;
for (int j = 0; j < body.length; j++)
{
... | 4 |
public void refreshFilterRec(File parentFile){
for(File child : parentFile.listFiles()){
if(child.isFile() && !isValidFormat(child.getName())){
continue;
}
if(child.isFile()){
String text = FilenameUtils.getBaseName(child.getAb... | 6 |
public String getUri() {
return uri;
} | 0 |
public void setNextSeg(VehicleAcceptor next) {
if (next == null) throw new IllegalArgumentException();
_next = next;
} | 1 |
public void checkChanges(){
for(File file : listOfPatientFiles){
boolean isInToSend = false;
for(int j = 0; j < listToSend.size(); j++){
File toSend = listToSend.get(j);
//FILE EXISTS
if(file.getName().compareTo(toSend.getName())==0){
isInToSend = true;
//NEW VERSION
if... | 5 |
public static void main(String[] args) {
/*
* Two Dimensional Array
*/
String[][] array = new String[10][10];
for(String[] row : array) Arrays.fill(row, "#");
/*
* Stack
*/
Stack<Character> stack = new Stack<Character>();
stack.isEmpty();
stack.push('a');
st... | 9 |
@Override
public boolean equals(Object other) {
if (other instanceof Tuple) {
Tuple otherPair = (Tuple) other;
return ((this.first == otherPair.first || (this.first != null && otherPair.first != null && this.first.equals(otherPair.first))) && (this.second == otherPair.second || (this.second != null && otherPai... | 8 |
public void trimToSize( )
{
int[ ] trimmedArray;
if (data.length != manyItems)
{
trimmedArray = new int[manyItems];
System.arraycopy(data, 0, trimmedArray, 0, manyItems);
data = trimmedArray;
}
} | 1 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Person)) {
return false;
}
Person other = (Person) object;
if ((this.cedule == null && other.cedule != null) ||... | 5 |
public static boolean readEvents(String name) {
InputStream is = null;
try {
is = new FileInputStream(name);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
InputStreamReader isr = new InputStreamReader(is);
Scanner scan = new Scanner(is);
//... | 7 |
public static int calulateFaceDistance(int x1, int y1, int x2, int y2, int face) {
switch (face) {
case 0:
return calulateUpDistance(x1, y1, x2, y2);
case 1:
return calulateRightDistance(x1, y1, x2, y2);
case 2:
return calulateDownDistance(x1, y1, x2, y2);
case 3:
return calulateLeftDistance(x1, y... | 4 |
private void parseArguements(String[] args, Job job) throws IOException {
for (int i = 0; i < args.length; ++i) {
if ("-input".equals(args[i])) {
String files = args[++i];
for (String file : files.split(",")) {
FileInputFormat.addInputPath(job, new Path(file));
}
} else if ("-output".equals(arg... | 9 |
@Test
public void TallentaminenToimiiKunKasvatetaanOlemassaOlevaa(){
kirjoitaOikeanmuotoinenSyote();
tiedot.LueTiedotTiedostosta();
tiedot.lisaaUusiOpiskelu("opiskelu1", 5);
tiedot.tallennaTiedostoon();
String luettu = lukija.next();
while (lukija.hasNext()){... | 1 |
public boolean startsWith( char[] prefix )
{
int i;
for ( i=0;i<prefix.length&&i<data.length;i++ )
{
if ( data[i] != prefix[i] )
return false;
}
return i==prefix.length;
} | 3 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Recorder)) {
return false;
}
Recorder other = (Recorder) object;
if ((this.id == null && other.id != null) || (... | 5 |
public void onBlockRemoval(World par1World, int par2, int par3, int par4)
{
TileEntityChest var5 = (TileEntityChest)par1World.getBlockTileEntity(par2, par3, par4);
if (var5 != null)
{
for (int var6 = 0; var6 < var5.getSizeInventory(); ++var6)
{
ItemSt... | 6 |
public OpenAction(EditTextPageModel theModel) {
OpenPages pages = theModel.getOpenPages();
System.out.println(pages.size() + "pages");
File fileToOpen = getOpenedFile();
if(fileToOpen!=null){
Scanner scan;
try {
scan = new Scanner(new FileReader(fileToOpen));
String allText="";
whil... | 5 |
public String getImageName()
{
String firstName = isEatable() ? "eatable" : name;
StringBuffer imageName = new StringBuffer(firstName);
String phot = "" + (isEatable() ? photogram % 4 : photogram);
for (int i = 0; i < 3 - phot.length(); i++) {
imageName.append("... | 3 |
public static void main(String[] args) {
// TODO code application logic here
// 1.- Mira esta serie: 7, 6, 8, 4, 9, 2, 10, 0, 11, -2, ...
//Cree una función que recibe dos enteros: x e y. Si alguno de ellos es 0 o negativo, o si son mayores que 255, la función debe devolver -1
//De lo contrario, la función de... | 7 |
private int getDaysInMonth(int month, int year) {
if (month == 0 || month == 2 || month == 4 || month == 6 || month == 7 || month == 9 || month == 11)
return 31;
else if (month != 1)
return 30;
else if (year % 4 == 0)
return 29;
else
return 28;
} | 9 |
private void tryLine(int x, int y, ELine line) {
int count = 1;
EField type = getField(x, y);
x += line.getDx();
y += line.getDy();
while(x < getGameSize() && y < getGameSize() && x >=0 && y >=0) {
if(getField(x, y) != type) {
check(new WinLine(x - cou... | 5 |
public boolean removeColumn(String sheetName, int colNum) {
try{
if(!isSheetExist(sheetName))
return false;
fis = new FileInputStream(path);
workbook = new XSSFWorkbook(fis);
sheet=workbook.getSheet(sheetName);
XSSFCellStyle style = workbook.createCellStyle();
style.setFillForegroundColor(HSSFColor.GR... | 5 |
public void merge(Vertex vertex){
//Remove self-loops
while(this.adjacentVertexes.remove(vertex));
// Add the arrayList in the current vertex to the array list from incoming vertex
for(Vertex n : vertex.getAdjacentVertexes()){
if(n == this)
continue; // skip s... | 4 |
@Override
protected void setup(Context context) throws IOException,
InterruptedException {
headers = context.getConfiguration().get("header").trim()
.split("\\,");
} | 0 |
@Override
public HashMap<String, Sprite> loadAll() {
//First get a hashmap of all images
ImageLoader loader = new ImageLoader();
HashMap<String, BufferedImage> imageMap = loader.loadAll();
//Create a hashmap of sprites
HashMap<String, Sprite> spriteMap = new HashMap<String, Sprite>();
//Declare a buf... | 4 |
public int getLength() {
return getFollowingGlieder();
} | 0 |
public void tick(long delta) {
drawX = (int)(realX - game.getCameraX() - (width / 2));
drawY = (int)(realY - game.getCameraY() - height);
//animation
if(animated) {
animationTimer -= ((0.000000001 * animationSpeed) * delta);
if(animationTimer < 0) {
animFrame... | 3 |
@Override
public void keyPressed(KeyEvent keyEvent) {
int keyCode = keyEvent.getKeyCode();
if (keyCode == KeyEvent.VK_LEFT) {
moveLeft();
} else if (keyCode == KeyEvent.VK_RIGHT) {
moveRight();
} else if (keyCode == KeyEvent.VK_DOWN) {
moveDown();
... | 9 |
public int getVariant() {
int variant = bytes[8] & 0xff;
if (variant >= varRes)
return 3;
if (variant >= varMS)
return 2;
if (variant >= varRFC)
return 1;
else
return 0;
} | 3 |
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
final UPolygon shape = (UPolygon) ushape;
final double points[] = new double[shape.getPoints().size() * 2];
int i = 0;
for (Point2D pt : shape.getPoints()) {
points[i++] = pt.getX() + x;
points[i++] ... | 7 |
public void run()
{
byte buf[] = new byte[DNSPacket.MAX_MSG_ABSOLUTE];
DatagramPacket packet = new DatagramPacket(buf, buf.length);
packet.setLength(buf.length);
while (_bContinueRunning)
{
try
{
synchronized(this) {
... | 6 |
public void print()
{
if (root == null )
{
System.out.println("This TreeBag is empty.");
}else
{
System.out.println("inordered");
root.inorderPrint();
System.out.println("preodered");
root.preorderPrint();
System.out.println("postodered");
... | 1 |
@Override
public QuadTree getQuadTree()
{
if (isParsed)
{
return quadTree;
} else
{
initiateParsing();
return quadTree;
}
} | 1 |
public void getLeader()
{
networkController.SendMessage("getPromotion#" + clientId + "," + clientType + "," + userLeader + "," + userName);
clientType = userLeader;
leader = true;
cleanLabels();
if(observer)
getObserver.setVisible(true);
if(contributor)
getContributor.setVisible(true);
if(repo... | 9 |
@Test
public void scoreIsReset()
{
assertTrue(score.getPoints(1) == 0 && score.getPoints(2) == 0 &&
score.getLives(1) == Const.initialLifeAmount &&
score.getLives(2) == Const.initialLifeAmount &&
score.getCombo(1) == Const.cheesePoints &&
s... | 6 |
@Override
public MidiChannel[] getChannels() {
ArrayList<MidiChannel> all = new ArrayList<MidiChannel>();
if (theSynths.size() == 1)
return theSynths.get(0).getChannels();
else {
for (Synthesizer s : theSynths) {
MidiChannel[] temp = s.getChannels();
... | 4 |
public String getName() {
return Name;
} | 0 |
@Override
public boolean onKeyDown(int key) {
if(super.onKeyDown(key)) {
return true;
}
if(input.onKeyDown(key)) {
display.updateScores();
return true;
}
return false;
} | 2 |
public static void updateVille(int id,int idpays, String nom, String cp)throws SQLException
{
int result;
String query;
try
{
query = "UPDATE VILLE set ID_PAYS=?,VINOM=?,VICP=? WHERE ID_VILLE=? ";
PreparedStatement pStatement = (PreparedStatement) ConnectionB... | 1 |
@Override
@SuppressWarnings("unchecked")
public List<mxGraphAbstractHierarchyCell> getPreviousLayerConnectedCells(int layer)
{
if (previousLayerConnectedCells == null)
{
previousLayerConnectedCells = new ArrayList[1];
previousLayerConnectedCells[0] = new ArrayList<mxGraphAbstractHierarchyCell>(connectsAsSo... | 4 |
public synchronized void dots(){
// clear image and z-buffer
for (int i = pixels.length-1; i >= 0; i--) {
pixels[i] = 0;
pixelsZ[i] = 1000;
}
{
for (int row=0; row<height-1; row++){
for (int col=0; col<width-1; col++){
int i = row*width + col;
PlotVal p0 = plotList[i];
... | 9 |
public ListNode removeNthFromEnd(ListNode head, int n) {
ListNode dummy = new ListNode(0);
ListNode front = dummy, back = dummy;
dummy.next = head;
while(n-- > 0) front = front.next;
while(front.next != null){
front = front.next;
back = back.next;
... | 2 |
public Boolean valida(Usuario u){
conn = Conector.conectorBd();
String nom = u.getNombre();
String ape = u.getApellido();
int pa =u.getPassword();
int co =u.getCodigo();
String di =u.getDireccion();
int fo =u.getFono();
String car =u.getCargo();
int ru =u.getRut();
... | 2 |
@Override
public <T extends PersistentObject> Collection<T> list(Class<T> entityClass) {
CriteriaBuilder qb = em.getCriteriaBuilder();
CriteriaQuery<T> recordsQuery = qb.createQuery(entityClass);
Root<T> root = recordsQuery.from(entityClass);
recordsQuery.select(root);
TypedQ... | 0 |
public Node(int value) {
this.value = value;
this.prev = this.next = null;
this.seqPrev = this;
this.seqNext = this;
} | 0 |
@Override
public void keyReleasedHandler(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_UP) {
getCharacter().setImage(ResourceTools.loadImageFromResource("Resources/rear_idle.png"));
} else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
getCharacter().setImage(ResourceTools.loadI... | 4 |
@Override
protected void loadDatabase() throws DataLoadFailedException {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException ex) {
throw new DataLoadFailedException(ex);
}
try {
connection = DriverManager.getConnection("jd... | 2 |
private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseClicked
// TODO add your handling code here:
database.init();
if (jTextFieldFirstname1.getText().isEmpty() || jTextFieldLastname1.getText().isEmpty() || jTextFieldID1.getText().isEmpty() || jTextFie... | 7 |
public static Assembly buildAssembly(AssemblyType model) {
Assembly assembly = null;
switch(model) {
case MASS:
assembly = new MassAssembly();
break;
case SPRING:
assembly = new SpringAssembly();
break;
case MUSCLE:
assembly = new MuscleAssembly();
break;
default:
throw new IllegalState... | 3 |
public PrimitiveUndoableMoveableChange(Node node, int oldState, int newState) {
this.node = node;
this.oldState = oldState;
this.newState = newState;
} | 0 |
public double evaluate(double x) {
return inputTable.get(name);
} | 0 |
private PDFFile loadPDFFile(File pdfFile) throws IOException
{
// load the pdf file in the byte buffer
// RandomAccessFile raf = new RandomAccessFile(pdfFile, "r");
// FileChannel channel = raf.getChannel();
// ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
//
// PDFFile pdf = ... | 3 |
public NameSurferDataBase(String filename) {
// You fill this in //
dataFile = new HashMap<String, NameSurferEntry>();
try{
BufferedReader source = new BufferedReader(new FileReader(filename));
while(true){
String line = source.readLine();
if(line == null) break;
NameSurferEntry entry = new Name... | 3 |
private void botonInsertarAdministrarCatalogoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonInsertarAdministrarCatalogoActionPerformed
if (this.campoOrigenAdministrarCatalogo.getText().equals("Origen") || this.campoDestinoAdministrarCatalogo.getText().equals("Destino")) {
JO... | 8 |
@Test
@TestLink(externalId="testTestLinkAnnotationWithoutId")
public void testTestLinkAnnotationWithoutId() {
final Description description = Description.createSuiteDescription("foo", new TestLink() {
@Override
public Class<? extends Annotation> annotationType() {
... | 2 |
public FragmentPanel(FragmentRecruiterApp parentPanel)
{
this.parent = parentPanel;
addMouseMotionListener( new MouseMotionListener()
{
public void mouseMoved(MouseEvent e)
{
if( e.getY() < getHeight() - numPixelsReservedForGeneAnnotations ||
genbankAnnotationList == null || ! showGeneAnnotati... | 8 |
public boolean contains(V val) {
if (val == null) {
return false;
}
Node<V> cur = head.next;
while (cur != null) {
if (val.equals(cur.value)) {
return true;
}
cur = cur.next;
}
return false;
} | 3 |
private CacheResult processCacheHit(CacheResult cacheResult, Object cachedItem, Object[] args) {
LOGGER.debug("版本号一致,缓存命中");
String key = cacheResult.getKey();
cacheResult.setRetVal(cachedItem);
CacheDefinition cacheDefinition = cacheDefinitionCollection.getCacheDefinition();
Cache cache = cacheResult.getCa... | 4 |
public Personagem addProtagonista(Personagem personagem, int opcao){
if (opcao == 1) {
Scanner entrada = new Scanner(System.in);
System.out.println("Selecione o personagem:");
System.out.println("\nProtagonistas:");
System.out.println("1) Guerreiro");
... | 7 |
public RawEntityConsumer() {
Injector injector = GuiceInjector.getInjector();
rawEntityStore = injector.getInstance(RawEntityStore.class);
} | 0 |
public void copyColumns(JTable copythis)
{
TableColumnModel tcm = copythis.getColumnModel();
for (int i = 0; i < tcm.getColumnCount(); i++)
{
TableColumn tableColumn = copythis.getColumnModel().getColumn(i);
if (! tableColumn.getResizable()) return;
... | 2 |
@SuppressWarnings("rawtypes")
private static void initializeValidator() throws FileNotFoundException {
String validatorFilePath = validatorProperties.getProperty(PropertyKeys.VALIDATOR_FILE.toString());
validator = (Validator) xmlManager.unmarshal(new BufferedInputStream(new FileInputStream(validatorFilePath)));
... | 0 |
public void drawPicture( Graphics2D g ) // Double buffer
{ // allow re-size
Dimension d = getSize(); // Size of curr. image
if ( ( theAG == null ) ||
( d.width != theAD.width ) ||
( d.height != theAD.height ) )
{ ... | 3 |
public void renderSprite(int xp, int yp, Sprite sprite, boolean fixed) {
if (fixed) {
xp -= xOffset;
yp -= yOffset;
}
for (int y = 0; y < sprite.getHeight(); y++) {
int ya = y + yp;
for (int x = 0; x < sprite.getWidth(); x++) {
int xa = x + xp;
if (xa < 0 || xa >= width || ya < 0 || ya >= heig... | 7 |
private void processClick(int x, int y) {
if (checkButtonClicks()) {
if (!forceUpdate) {
forceUpdate = true;
updateScreen();
}
return;
}
if (gameVisible) {
xClick = -1;
yClick = -1;
int xTemp;
int yTemp;
if (x <= xGridMin) {
xTemp = 0;
} else if (x >= xGridMax) {
xTemp =... | 7 |
public List<BeanProducto> getProductos() {
List<BeanProducto> ls = new ArrayList<BeanProducto>();
try {
PreparedStatement ps = MySQL_Connection.getConection()
.prepareStatement(consultar);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
... | 2 |
protected Look (VorbisStream source, Mode mode) {
int dim=0, acc=0, maxstage=0;
map=mode.getMapping();
parts=Residue.this.getClassifications();
fullbooks=source.getSetupHeader().getCodeBooks();
phrasebook=fullbooks[Residue.this.getClassBook()];
dim=phrasebook.getDi... | 7 |
public float getC() {
return c;
} | 0 |
protected void layoutCells(Object[] cells)
{
if (cells.length > 0)
{
// Invokes the layouts while removing duplicates
mxIGraphModel model = getGraph().getModel();
model.beginUpdate();
try
{
for (int i = 0; i < cells.length; i++)
{
if (cells[i] != model.getRoot())
{
executeLa... | 3 |
private void judgeRoom ()
{
boolean jump = false;
for ( int i = client.chatRooms.size() - 1; i >= 0; i-- )
{
if ( client.chatRooms.get(i).equals(roomId.getText()) ) // check name
{
jump = true;
}
}
if (jump == true)
... | 3 |
public void searchInText(String file){
if(source1.isSelected()){
file="oliver.txt";
File thefile=new File(file);
yourFile=thefile;
gp.searchSource(yourFile);
}
else if(source2.isSelected()){
file="worlds.txt";
File thefile=new File(file);
yourFile=thefile;
gp.searchSource(yourFile);
... | 6 |
static LinkedListNode findCircularHead(LinkedListNode n) {
LinkedListNode fast = null;
LinkedListNode slow = null;
if (n == null) return null;
if (n.next != null && n.next.next != null) {
fast = n.next.next;
slow = n.next;
}
while (fast != null &... | 9 |
public boolean include(final Method method)
{
if (method == null)
{
return false;
}
if (method.isSynthetic())
{
return false;
}
if (method.isBridge())
{
return false;
}
final String name = method.getName();
return name.startsWith("get") && !ReflectionUtils.isStatic(method)
&& !Re... | 5 |
public boolean addAdmin(String name, String password) {
String insert = "INSERT INTO ADMIN VALUES(?,?)";
int n = 0;
try {
PreparedStatement ps = conn.prepareStatement(insert);
ps.setString(1, name);
ps.setString(2, password);
n = ps.executeUpdate();
ps.close();
} catch (SQLException e) {
e.pri... | 1 |
public void execute()
{
switch(selectedItem)
{
case 1:
marioWorld.setWhatcha(Doing.PLAYING);
break;
case 2:
loadAndSave.save();
marioWorld.setWhatcha(Doing.SELECTSTAGE);
break;
case 3:
... | 3 |
@Test
public void testMonopoly() {
MonopolyDevRequest request = new MonopolyDevRequest(0, "wood");
ServerModel aGame;
aGame = gamesList.get(1);
int totalWood = 0;
for(Player player : aGame.getPlayers()){
totalWood += aGame.getPlayers().get(player.getPlayerIndex()).getWood();
}
try {
aGame = m... | 2 |
private static int countMatches(final String bigString, final String substring) {
int lastIndex = 0;
int count = 0;
while (lastIndex != -1) {
lastIndex = bigString.indexOf(substring, lastIndex);
if (lastIndex != -1) {
count++;
lastIndex +=... | 2 |
public byte[] toBinaryByte() throws IOException {
try {
StringBuilder sb = new StringBuilder();
sb.append(getHeader().encodedString());
if(getExtras()!=null) sb.append(getExtras().encodedString());
if(getKey()!=null) sb.append(getEncodedKey());
if(getValue()!=null) {
sb.append(HexUtil.encode(ge... | 5 |
public Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
throws java.awt.datatransfer.UnsupportedFlavorException,
java.io.IOException {
// Native object
if (flavor.equals(DATA_FLAVOR))
return fetcher == null ? data : fetcher.getObject();
// String
if (flavor.equals(java.awt.datatr... | 4 |
public void process(Client sockector) {
ConcurrentLinkedQueue<HashMap<String,String>> msgs = sockector.getBizObjects();
if(msgs.isEmpty()){
return;
}
HashMap<String,String> msg = msgs.poll();
while(msg != null){
msg.put(Constants.FILED_IP, sockector.getIp());
Response rm = Service.getInstance().se... | 3 |
ErrorCode(int value)
{
this.value = value;
} | 0 |
public IMenu readMenu(Document doc){
// Establecemos los valores del menu principal
IMenu menu = new XMLMenu();
XmlParserUtil xpu = new XmlParserUtil();
Node root = doc.getDocumentElement();
menu.setName(xpu.getValueLeafNode(doc, NAME, root));
menu.setDescripction(xpu.getValueLeafNode(doc, DESCRIPTION... | 3 |
private void setDistances(SimpleVector[] dist) {
for(int i = 0; i < dist.length; i++) {
distances[i] = dist[i].calcSub(getLocation());
}
} | 1 |
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.