text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void actionPerformed(ActionEvent e) {
if (aliens.size()==0)
{
ingame = false;
}
ArrayList ms = prometheus.getMissiles();
for (int i = 0; i < ms.size(); i++)
{
Missile m = (Missile) ms.get(i);
if (m.getIsVisible())
... | 5 |
public boolean findAtEast(int piece, int x, int y){
if(y==7 || b.get(x,y+1)==EMPTY_PIECE) return false;
else if(b.get(x,y+1)==piece) return true;
else return findAtEast(piece,x,y+1); // there is an opponent
} // end findAtEast | 3 |
public boolean isFuelBlock(int itemID)
{
boolean res = false;
if((fuelBlocksGroupIDlist_Wool.contains(itemID)) ||
(fuelBlocksGroupIDlist_CraftedWood.contains(itemID)) ||
(fuelBlocksGroupIDlist_Log.contains(itemID)) ||
(fuelBlocksGroupIDlist_CoalOre.contains(itemID)))
... | 4 |
@Override
public Node getNodeAtIndex(int index) {
// TODO Auto-generated method stub
assert !isEmpty() && (1<=index && index<=size);
Node currentNode=firstNode;
for (int count=0;count<index;count++){
currentNode=currentNode.getNext();
}
assert currentNode!=null;
return currentNode;
} | 3 |
protected void shift() throws IOException {
int bit = (int)(low >>> (STATE_SIZE - 1));
output.write((byte)bit);
// Write out saved underflow bits
for (; underflow > 0; underflow--)
output.write((byte)(bit ^ 1));
} | 1 |
protected void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
String url = "/";
PurchaseViewHelper purchaseViewHelper =
ViewHelperFactory.getInstance().getPurchaseViewHelper(req);
Customer customer = (Customer) req.getSession().getAttribute("loggedInC... | 2 |
public void setPriority(byte byte0, int i, int j) {
if (clientInstance.caches[0] == null)
return;
if (versions[i][j] == 0)
return;
byte abyte0[] = clientInstance.caches[i + 1].decompress(j);
if (crcMatches(versions[i][j], crcs[i][j], abyte0))
return;
filePriorities[i][j] = byte0;
if (byte0 > highes... | 4 |
public boolean isRunning(){
return running;
} | 0 |
public String[] getClaims()
{
if(claims!=null)
return claims;
String s=getParmsNoTicks();
if(s.length()==0)
{ claims=defclaims; return claims;}
final char c=';';
int x=s.indexOf(c);
if(x<0) { claims=defclaims; return claims;}
s=s.substring(x+1).trim();
x=s.indexOf(c);
if(x<0) { claims=defclaims... | 9 |
private void choosePrefixes() {
if (options.defaultNamespace != null) {
if (defaultNamespace != null && !defaultNamespace.equals(options.defaultNamespace))
warning("default_namespace_conflict");
defaultNamespace = options.defaultNamespace;
}
else if (defaultNamespace == null)
defau... | 8 |
@Override
protected void run()
{
Set<UUID> objectsWithComponent = objectManager.getAllObjectsWithComponent(HCKeyMotion.class);
if (objectsWithComponent.isEmpty()) {
return;
}
keyboard.update();
if (keyboard.esc) System.exit(0);
for (UUID o : objectsWithComponent) {
HCVelocity v... | 7 |
public boolean lootSpice() {
GroundItem spice = Util.getSpice();
if (spice != null && spice.isOnScreen()) {
Mouse.move(spice.getCentralPoint(), 30, 50);
return (spice.interact("Take", spice.getGroundItem().getName()));
} else {
Camera.setPitch(Random.nextInt(40, 90));
Camera.setAngle(Camera.getMobileA... | 2 |
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... | 9 |
public static void main(String[] args) throws Exception
{
BufferedReader reader = new BufferedReader(new FileReader(new File(
ConfigReader.getMbqcDir() + File.separator + "dropbox" + File.separator +
"raw_design_matrix.txt")));
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(
Con... | 8 |
@Override
public CarType[] getCarTypes() {
return this._carTypes;
} | 0 |
public void add(InstrInfo info) {
if (info.nextTodo == null) {
/* only enqueue if not already on queue */
info.nextTodo = first;
first = info;
}
} | 1 |
public void render(Graphics g) {
if (image != null) {
int xPos = particleEmitter.mapToPanelX((int)mapX);
int yPos = particleEmitter.mapToPanelY((int)mapY);
//flip the yPos since drawing happens top down versus bottom up
yPos = particleEmitter.getPHeight() - yPos;... | 1 |
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();
... | 6 |
public void setJSONList (JSONObject obj) {
try {
JSONArray fileList = obj.getJSONArray("files");
if (fileList.length() > 0) {
for (int i = 0; i < fileList.length(); i++) {
JSONObject single = fileLis... | 4 |
static boolean isPDConstructor(Statement stmt) {
Object target = stmt.getTarget();
String methodName = stmt.getMethodName();
Object[] args = stmt.getArguments();
String[] sig = new String[pdConstructorSignatures[0].length];
if (target == null || methodName == null || args == null... | 9 |
public char skipTo(char to) throws JSONException {
char c;
try {
long startIndex = this.index;
long startCharacter = this.character;
long startLine = this.line;
this.reader.mark(1000000);
do {
c = this.next();
if... | 3 |
public static void clearEditable(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree);
JoeNodeList nodeList = tree.getSelectedNodes();
for (int i = 0, limit = nodeList.size(); i < limit; i++) {
clearEditableForSingl... | 3 |
public static void main(String[] args) {
try {
if(args.length == 2){
String xpath=args[0];
String path =args[1];
FileInputStream file = new FileInputStream(new File(path));
DocumentBuilderFactory builderFactory = DocumentBuilderFact... | 9 |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
/*Metodo que muestra los datos de los clientes almacenados al ingresar su rut, si este no está registrado,
* permite la adicion de sus datos, además muestra el valor total de la venta
*/
... | 4 |
public void verifyDeadEnd() {
int deadCount = 0;
if(this.checkerObject.getUp()==0) {
deadCount++;
}
if(this.checkerObject.getLeft()==0) {
deadCount++;
}
if(this.checkerObject.getDown()==0) {
deadCount++;
}
if(this.checkerObject.getRight()==0) {
deadCount++;
}
if(deadCount==3) {
backT... | 5 |
private boolean testSymmetry(int ks, int bs) {
try {
IMode mode = (IMode) this.clone();
byte[] iv = new byte[cipherBlockSize]; // all zeroes
byte[] k = new byte[ks];
int i;
for (i = 0; i < ks; i++) {
k[i] = (byte) i;
}
int blockCount = 5;... | 5 |
public static void main(String args[])
{
final History history = new History();
if (Constants.DEBUG)
{
System.out.println("History: " + history.toString());
}
final ProbabilityGenerator probabilityGen = new ProbabilityGenerator(history);
final Random ran... | 7 |
public Rectangle getBounds() {
if(width == 0 || height ==0) return new Rectangle(-100, -100, 1, 1);
return new Rectangle((int)drawX, (int)drawY, width, height);
} | 2 |
private int jjMoveStringLiteralDfa1_2(long active0)
{
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return 1;
}
switch(curChar)
{
case 47:
if ((active0 & 0x100L) != 0L)
return jjStopAtPos(1, 8);
break;
default :
return 2... | 3 |
public void untapAll(int player) {
for (Object e : table.getComponents()) {
if ((e.getClass().equals(TCard.class)
|| e.getClass().equals(Token.class))
&&((TCard) e).getID().charAt(0) == 'A' + player) {
((TCard) e).untap();
}
... | 4 |
public Matrix multSlow(Matrix m) {
Matrix n = new Matrix();
for (int c = 0; c != 4; c++) {
for (int r = 0; r != 4; r++) {
float v = 0;
for (int k = 0; k != 4; k++)
v += get(k, r) * m.get(c, k);
n.set(c, r, v);
}
}
return n;
} | 3 |
public List findAll() {
//return (List) getEntityManager().createQuery("FROM " + getObjectType().getSimpleName()).setHint("org.hibernate.cacheable", true).getResultList();
return (List) getEntityManager().createQuery("FROM " + getObjectType().getSimpleName()).getResultList();
} | 0 |
private boolean canServeUri(String uri, File homeDir) {
boolean canServeUri;
File f = new File(homeDir, uri);
canServeUri = f.exists();
if (!canServeUri) {
String mimeTypeForFile = getMimeTypeForFile(uri);
WebServerPlugin plugin = mimeTypeHandlers.get(mimeTypeForF... | 2 |
protected Value getElementValue(final Value objectArrayValue)
throws AnalyzerException {
Type arrayType = ((BasicValue) objectArrayValue).getType();
if (arrayType != null) {
if (arrayType.getSort() == Type.ARRAY) {
return newValue(Type.getType(arrayType.getDescriptor()
.substring(1)));
} else if ... | 3 |
public Pattern simplify(ExpressionVisitor visitor) throws XPathException {
// detect the simple cases: no parent or ancestor pattern, no predicates
if (parentPattern == null &&
ancestorPattern == null &&
filters == null &&
!firstElementPattern &&
... | 9 |
public int length()
{
int total = 0;
for ( int i=0;i<rows.size();i++ )
{
Row r = rows.get( i );
for ( int j=0;j<r.cells.size();j++ )
{
FragList fl = r.cells.get( j );
for ( int k=0;k<fl.fragments.size();k++ )
... | 3 |
@Override
public String toString () {
StringBuilder sb = new StringBuilder(TrackerResponse.class.getSimpleName());
sb.append("{");
if (failed) {
sb.append("FailureReason=\"");
sb.append(failureReason);
sb.append("\"");
} else {
sb.app... | 2 |
public double infoX(Integer featureId) {
double result = 0D;
for (String fValue : Feature.possibleFeatures.get(featureId).getPossibleValues()) {
double positive = 0.0;
double negative = 0.0;
for (ClassifiableObject co : partitionedObjects.get(fValue)) {
if (co.isAcceptable()) {
positive++;
} e... | 3 |
public boolean uniformCostSearch(int root_id,int value){
rootNode=g.all_nodes.get(root_id);
frontier.insert(rootNode,1);
rootNode.is_discovered=true;
rootNode.totalcost=0;
while(!frontier.isEmpty()){
Node n = (Node)frontier.getItem();
if(n.node_id==value){
output.append("found it!\n");
bac... | 8 |
@Override
public void sendDeath(Entity source) {
final NPCCombatDefinitions defs = getCombatDefinitions();
final NPC npc = (NPC) source;
resetWalkSteps();
getCombat().removeTarget();
setNextAnimation(null);
// deathEffects(npc);
WorldTasksManager.schedule(new WorldTask() {
int loop;
@Override
p... | 6 |
private void processMoveResult(String result, CardMove move) {
if (result.isEmpty()) {
game.getHistory().push(move);
} else if (!result.equals("ONTO_SELF")) {
storeError(result);
}
} | 2 |
public void viewAccepted(View v) {
member_size=v.size();
if(mainFrame != null)
setTitle();
members.clear();
members.addAll(v.getMembers());
if(v instanceof MergeView) {
System.out.println("** " + v);
// This is an example of a simple merge fu... | 9 |
private Quest getQuest(String named)
{
if((defaultQuestName.length()>0)&&(named.equals("*")||named.equalsIgnoreCase(defaultQuestName)))
return defaultQuest();
Quest Q=null;
for(int i=0;i<CMLib.quests().numQuests();i++)
{
try
{
Q = CMLib.quests().fetchQuest(i);
}
catch (final Exception e)
... | 8 |
private Face getTurn(Face direction){
int leftAmount = 0;
switch (playerDirection){
case NORTHERN:
//no need compute anything else here
return direction;
case WESTERN:
leftAmount = 1;
break;
case SOUTHERN:
leftAmount = 2;
break;
case EASTERN:
leftAmount = 3;
default:
break;
}
... | 7 |
public void calculateGPA(Scanner a_scan)
{
System.out.println("Please Select Method to Choose Student(1 or 2): "+"\n1)Search student by Name,\n2)Search Student by techID)");
Student s1;
switch (getMenuChoiceNameOrId(a_scan))
{
case 1:
{
s1 = findStudent(inputStudentName(a_scan));
if (s1 == ... | 4 |
public void update1(float time){//@override Entity
Vector2 tempForce;
LinkedList<MyPoint> temp = new LinkedList<MyPoint>();
for (Link l : neighbors){
tempForce = Vector2.vecSubt(l.other.getPos(), this.pos);
if (tempForce.length() > l.len * breakLength){
temp.add(l.other);
}
}
for (MyPoint p : tem... | 8 |
public static Session getSession() throws HibernateException {
Session session = (Session) threadLocal.get();
if (session == null || !session.isOpen()) {
if (sessionFactory == null) {
rebuildSessionFactory();
}
session = (sessionFactory != null) ? sessionFactory.openSession()
: null;
thr... | 4 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Policeofficer)) {
return false;
}
Policeofficer other = (Policeofficer) object;
if ((this.policeOfficerID == nu... | 5 |
private void writeSubStreamsInfo(
List<Folder> folders,
List<Integer> numUnpackStreamsInFolders,
List<Long> unpackSizes,
List<Boolean> digestsDefined,
List<Integer> digests) throws IOException {
writeByte((byte) Header.NID.kSubStreamsInfo);
fo... | 9 |
public static void undefineModule(Module oldmodule, Module newmodule) {
System.out.println("Redefining the module `" + oldmodule.contextName() + "'");
if (Stella.$SUBCONTEXT_REVISION_POLICY$ == Stella.KWD_DESTROY) {
oldmodule.destroyContext();
return;
}
else if (Stella.$SUBCONTEXT_REVISION_P... | 9 |
public String diff_prettyHtml(LinkedList<Diff> diffs) {
StringBuilder html = new StringBuilder();
int i = 0;
for (Diff aDiff : diffs) {
String text = aDiff.text.replace("&", "&").replace("<", "<")
.replace(">", ">").replace("\n", "¶<br>");
switch (aDiff.operation) {
... | 5 |
public Card(int theValue, int theSuit) {
if(theSuit != SPADES && theSuit != HEARTS && theSuit != DIAMONDS &&
theSuit != CLUBS )
throw new IllegalArgumentException("Illegal playing card suit");
if(theValue <1 || theValue >13)
throw new IllegalArgumentException("I... | 6 |
public DocumentRepositoryEvent(Document doc) {
setDocument(doc);
} | 0 |
@SuppressWarnings("resource")
public Class<?>[] getClassesFromThisJar(Object object)
{
final List<Class<?>> classes = new ArrayList<Class<?>>();
ClassLoader classLoader = null;
URI uri = null;
try
{
uri = object.getClass().getProtectionDomain().getCodeSource()... | 7 |
@Override
public boolean equals(Object object) {
if (this == object)
return true;
if (!(object instanceof AlgoChecksumType))
return false;
AlgoChecksumType other = (AlgoChecksumType)object;
return this.name.equalsIgnoreCase(other.toString());
} | 2 |
public static void main(String[] args)
{
HashMap<Integer,GameData> g=new HashMap<Integer,GameData>();
Vector<Integer> index=new Vector<Integer>();
CalculatingConsole c = new CalculatingConsole();
HashMap<String,PlayerData> p =new HashMap<String,PlayerData>();
for(File f: new File("./").listFiles())
{
S... | 4 |
public Point makeAIMove(OthelloBoard board) {
/** < store the maximum number of the pieces that are flipped */
int m_MaximumFlips = 0;
/** < store all the computer hard move point with the maximum piece flip number */
ArrayList<Point> m_BestFlips = new ArrayList<Point>();
... | 6 |
private void addProgram(String text, int type){
int shader = glCreateShader(type);
if (shader == 0){
System.err.println("Shader creation failed, could not find valid memory location when adding shader");
System.exit(1);
}
glShaderSource(shader,text);
gl... | 2 |
public static BufferedImage stamp(BufferedImage input) {
int stamp[][] = new int[][]{
{0, 1, 0},
{-1, 0, 1},
{0, -1, 0}
};
BufferedImage result = new BufferedImage(input.getWidth(), input.getHeight(), input.getType());
for (int i = 0; i... | 4 |
public void setTileAt(int tx, int ty, Tile ti) {
if (bounds.contains(tx, ty)) {
map[ty - bounds.y][tx - bounds.x] = ti;
}
} | 1 |
private double RD2lng(double x2, double y2) {
// TODO Auto-generated method stub
double a=0;
double dX=1E-5*(x2-X0);
double dY=1E-5*(y2-Y0);
for(int i = 1; 13 > i; i++)
a+=lngpqK[i].K*Math.pow(dX,lngpqK[i].p)*Math.pow(dY,lngpqK[i].q);
return lng0 + a / 3600;
} | 1 |
public static void main(String[] args) {
List<Integer> numberList = new ArrayList<Integer>();
numberList.add(5);
numberList.add(6);
numberList.add(7);
//sum of all numbers
// sumWithCondition(numbers, n -> true);
//sum of all even numbers
sumWithCondition(number... | 0 |
public static void spawnFoodFight (Location loc, int amount) {
int i = 0;
while (i < amount) {
Skeleton FoodFight = (Skeleton) loc.getWorld().spawnEntity(loc,
EntityType.SKELETON);
LeatherArmorMeta meta;
LeatherArmorMeta legMeta;
ItemSt... | 1 |
private EnumMap<JobType, Long> totalTimesForJobs(){
EnumMap<JobType, Long> out = new EnumMap<JobType, Long>(JobType.class);
out.put(JobType.COMBINE, 0l);
out.put(JobType.COMPRESS, 0l);
out.put(JobType.DOWNLOAD, 0l);
out.put(JobType.FORWARD, 0l);
out.put(JobType.UNKNOWN, 0l);
out.put(JobType.WAITING, 0l);
... | 3 |
public synchronized void save() {
if (image == null) return;
if (fc == null) {
String[] paths = {
System.getProperty("user.home") + File.separator + "Pictures",
System.getProperty("user.home") + File.separator + "My Pictures",
System.getProperty("user.home") + File.separator + "Documents" + Fil... | 9 |
public static int loadGame(){
// Get user input
Object[] options = {"1", "2", "3"};
int slot = JOptionPane.showOptionDialog(null, "Select your save slot", "Save Slot", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
slot++;
// Find appropriate save directory for OS
S... | 3 |
public Block domParent(final Block block) {
if (domEdgeModCount != edgeModCount) {
computeDominators();
}
return block.domParent();
} | 1 |
public void emptyField(){
for(int i = 0; i < fieldSize; i++) {
araseLine(i);
}
} | 1 |
@Override
boolean isColliding(int p_X, int p_Y){
//Do something
if(p_X > (posX-10) && p_X < (posX+width+10))
{
if(p_Y > (posY-10) && p_Y < (posY+height+10))
{
return true;
}
}
return false;
} | 4 |
public boolean contains(Component component) {
return tabbed.indexOfComponent(component) != -1;
} | 0 |
private static List<Integer> parseRange(String range, int max) {
List<Integer> idx = new ArrayList<Integer>();
String[] n = range.split(",");
for (String s : n) {
String[] d = s.split("-");
int mi = Integer.parseInt(d[0]);
if (mi < 0 || mi >= max) {
... | 9 |
public int getBeingByPosition(double x, double y){
for (int i = 0; i < beings.size(); i++){
if ( sqrt( (x - beings.get(i).getX())*(x - beings.get(i).getX()) + (y - beings.get(i).getY())*(y - beings.get(i).getY())) < RADIUS_TOUCH_DETECT ){
return i;
}
}
re... | 2 |
public String isOne(String[] words) {
if(words.length<=1)
return "Yes";
for(int i=0;i<words.length;i++){
for(int j=0;j<words.length;j++){
if (words[j].startsWith(words[i]) && !words[j].equals(words[i])) treeMap.put(words[i], i);
}
if(treeMa... | 6 |
static final void method887(Widget class46, int i, int i_5_, int i_6_) {
if (i_6_ == 2147483647) {
anInt1589++;
if (Class289.aClass46_3701 == null && !Class5_Sub1.aBoolean8335
&& (class46 != null
&& (ToolkitException.method141(class46, (byte) -79)
!= null))) {
Class289.aClass46_3701 = class46;
... | 5 |
private boolean flipHorizontal(long binPosition, boolean goesRight){
boolean hasFlippableDisk = false;
long searchPosition = binPosition;
if(goesRight && (binPosition & 0x0101010101010101l) == 0)
searchPosition = binPosition >> 1;
else if( !goesRight && (binPosition & 0x808... | 9 |
boolean isValidReportDirectory(File dir) {
File jsonFile = new File(dir, "jscoverage.json");
File srcDir = new File(dir, Main.reportSrcSubDir);
return isValidDirectory(dir) && isValidFile(jsonFile) && isValidDirectory(srcDir);
} | 2 |
private void writeHql(ArrayList<String> colName, ArrayList<String> colType, ArrayList<String> colRemark, String tabComments) {
StringBuffer content=new StringBuffer();
content.append("USE "+data_db_name.toUpperCase()+";\n");
content.append("DROP TABLE "+tn.toUpperCase()+";\n");
content.a... | 5 |
public ArrayList<ArrayList<Integer>> permute(int[] num) {
LinkedList<TailStack<Integer>> mappers = search(num.length);
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
for (TailStack<Integer> mapper : mappers){
ArrayList<Integer> tmp = new ArrayList<Integer... | 2 |
public void setLSmsOverTime(int second){
this.pconnect.setLSmsOverTime(second);
} | 0 |
public String getRawMessage(){ return RawMessage; } | 0 |
private void reDraw()
{
hitCount = 0;
p.removeAll();
for(int i = 0; i < nums.length; i++)
{
for(int j = 0; j < nums[0].length; j++ )
{
if( nums[i][j] == 0)
p.add( dots[i][j] == 0 ? (new JLabel (groun... | 9 |
public void setCapacidade(int capacidade) {
this.capacidade = (capacidade >= 0) ? capacidade : 0;
} | 1 |
@Override
public void registerDirty(IDomainObject domainObject) {
assert domainObject.getId() != null : "id not null";
assert !removedObjects.contains(domainObject) : "object not removed";
if (!dirtyObjects.contains(domainObject) && !newObjects.contains(domainObject)) {
dirtyObjects.add(domainObject... | 2 |
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
try {
int end = start + length;
while ((start < end) && (ch[start] <= ' ')) {
start++;
}
while ((start < end) && (ch[end - 1] <... | 6 |
public ProjectWizardView() {
setSize(500, 500);
setVisible(true);
} | 0 |
public void crossFold10(String fileLoc){
Instances data = null;
BufferedReader reader = null;
System.out.println("---------------Running Crossfold10 Testing Using Random Forrest On Data---------------");
// Need to build data to fit into evaluation
try {
//Read in data from the .arff file
reader =... | 3 |
public View render(View convertView, final Context context, FeedView feedView) {
// Set up the view holder
if(convertView == null) {
convertView = super.render(convertView, context, feedView);
holder = new ViewHolder();
holder.achievementIconView = (Image... | 9 |
@Override
public String toString() {
StringBuilder theString = new StringBuilder();
theString.append("[");
for (int i = 0; i < this.length; i++) {
theString.append("[");
for (int j = 0; j < this.width; j++) {
theString.append(this.cells[i][j].toBit());
if (j < this.width - 1)
theString.append(... | 4 |
public boolean Salvar(Estoque obj , int idPessoa){
try{
boolean retorno= false;
if(obj.getId() == 0){
PreparedStatement comando = conexao
.getConexao().prepareStatement("INSERT INTO estoques (id,quantidade) VALUES (?,?)");
comando.s... | 2 |
public boolean checkPassword(String pass){
boolean band = true;
int i=0;
for(int x=0;x<4;x++){
if(pass.charAt(x)<48 || pass.charAt(x)>57)
return false;
}
while(band == true && i <= numClientes){
if(pass.equals(clientes[i].getPassword()))
band = false;
else
i++;
}
return band;
} | 6 |
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
String[] options = {"Minimize", "Cancel", "Exit"};
int rsp = JOptionPane.showOptionDialog(null, "Are u making the right decision?", "Message", 0,
JOptionPane.QUESTION_MESSAGE, null, optio... | 2 |
private void checkFirstOrder(){
SVA_Sketch sketch = sketchQueue[(tail-1) % MAX_QUEUE_SIZE];
Timestamp currentTime = sketch.time;
System.out.println("Checking..." + currentTime);
{
double s = sketch.s.zeroOrder.getValue(currentTime, 0);
for(int h = 0; h < H; h ++){
double C = 0;
for(int i = 0; i < ... | 9 |
public void showPanTip()
{
String tipText = null;
Point upperLeft = new Point(0, 0);
JViewport vp = getEnclosingViewport();
if (!isPannableUnbounded() && vp != null)
upperLeft = vp.getViewPosition();
Location loc = locationForPoint(upperLeft);
if (loc != n... | 3 |
public int countCoins(String state) {
int coins = state.length();
if ((coins == 0) || (coins == 1)) {
return 0;
}
char[] coinsArray = state.toCharArray();
if (coinsArray[0] != coinsArray[1]) {
return 2;
}
int count = 0;
if (coinsArray[0] != coinsArray[1]) {
count = 2;
}
for (int i = 1;... | 8 |
public void draw(Graphics2D g2d) {
if (x != -1 && y != -1) {
g2d.drawImage(img_cannon, x, y, null);
missile.draw(g2d);
}
} | 2 |
@Override
public void onPlayerJoin(PlayerJoinEvent event) {
tellUpdate = this.config.yml.getBoolean("Update.Notifications", true);
Player player = event.getPlayer();
if ((!player.isOp() && !player.hasPermission("bcs.admin")) || !tellUpdate) {
return;
}
this.plugin... | 3 |
public String getId() {
return delegate.getId();
} | 0 |
public JSONObject getAnswersTag(int USER_ID,int QUESTION_ID)
{
try {
Class.forName(JDBC_DRIVER);
conn=DriverManager.getConnection(DB_URL,USER,PASS);
stmt=conn.createStatement();
json=new JSONObject();
String SQL="Select * from ANSWERS where QUESTION_ID="+QUESTION_ID;
... | 6 |
@Override
public void map(LongWritable key, Text value,
OutputCollector<Text, IntWritable> output, Reporter reporter)
throws IOException {
// TODO Auto-generated method stub
boolean start = false;
String line = value.toString();
Pattern title_pattern = Pattern.compile("<title>.*</title>");
Matche... | 5 |
@SuppressWarnings("unchecked")
public static final <T> TypeHandler<T> getTypeHandler(Class<T> cls) {
TypeHandler<T> res = (TypeHandler<T>) typehandlers.get(cls);
if (res == null) {
throw new EncodingException("No handler registered for class: " + cls.toString());
}
return... | 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.