text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void run(){
while(running){
try {
Object ob = inStream.readObject();
if(ob instanceof ArrayList<?>){
@SuppressWarnings("unchecked")
List<Player> players = (ArrayList<Player>) ob;
moveService.UpdateAllPlayersMovement(players);
}
} catch (ClassNotFoundException e) {
System.er... | 5 |
public void postInit(FMLPostInitializationEvent event)
{
} | 0 |
public List<Character> getCharacterList(String path) {
List<?> list = getList(path);
if (list == null) {
return new ArrayList<Character>(0);
}
List<Character> result = new ArrayList<Character>();
for (Object object : list) {
if (object instanceof Charac... | 7 |
public Message readMessages(String m1Command) throws IOException {
Message msg = null;
Iterator<Message> itr = messages.iterator();
while (itr.hasNext()) {
msg = itr.next();
if (msg.getType().equals(m1Command) || m1Command == null) {
itr.remove();
return msg;
}
}
String s;
MessageFactory m... | 7 |
public EmployeeScreen() {
setBounds(new Rectangle(0, 0, 1365, 799));
EmployeeService empService = new EmployeeService();
getContentPane().setLayout(null);
panelVizualizare = new JPanel();
//list= new JList<>();
list = new JList(new BooksListModel(empService.getBookList()));
listPanel = new JScrollPane(... | 2 |
public void setImgPath_ShutdownUpdateSym(Path img) {
this.imgShutdownUpdateSym = handleImage(img, UIResNumbers.SHUTDOWNUPDATESYMBOL.getNum());
if (this.imgShutdownUpdateSym == null) {
this.imgShutdownUpdateSym = UIDefaultImagePaths.SHUTDOWNUPDATESYMBOL.getPath();
deleteImage(UIRe... | 1 |
@Override
public void unInvoke()
{
final Physical P=affected;
super.unInvoke();
if((P instanceof MOB)&&(this.canBeUninvoked)&&(this.unInvoked))
{
if((!P.amDestroyed())&&(((MOB)P).amFollowing()==null))
{
final Room R=CMLib.map().roomLocation(P);
if(!CMLib.law().doesHavePriviledgesHere(invoker(), ... | 8 |
@SuppressWarnings("unchecked")
private static final Object[] decodeDictionary(byte[] bencoded_bytes, int offset) throws BencodingException
{
HashMap map = new HashMap();
++offset;
ByteBuffer info_hash_bytes = null;
while(bencoded_bytes[offset] != (byte)'e')
{
//... | 8 |
public PeerHost(){
this.bitfield = new boolean[0];
for(int i = 1; i < 10; i++){
port = 6880 + i;
try {
socket = new ServerSocket(port);
System.out.println("Listen port is: " + port);
break;
} catch (NumberFormatException e) {
/* Nope */
} catch (IOException e) {
System.out.println("... | 4 |
@GET
@Produces(MediaType.LIBROS_API_USER_COLLECTION)
public UserCollection getUsers() {
UserCollection users = new UserCollection();
// TODO: Retrieve all stings stored in the database, instantiate one
// Sting for each one and store them in the StingCollection.
Connection conn = null;
Statement stmt = nul... | 4 |
public void inputHandler() {
if(Keys.isPressed(Keys.ESCAPE)) gsm.setPaused(true);
if(blockInput || player.getHealth() == 0) return;
player.setUp(Keys.keyState[Keys.UP]);
player.setLeft(Keys.keyState[Keys.LEFT]);
player.setDown(Keys.keyState[Keys.DOWN]);
player.setRight(Keys.keyState[Keys.RIGHT]);
player.s... | 5 |
public static void main(String args[]){
int firstNumber, secondNumber;
firstNumber = 11;
secondNumber = 40;
if(firstNumber > 10 || secondNumber < 60){ //will be true by default
System.out.println("First statement is true");
}else{
System.out.println("FIrst statement was not true");
}
if(firstNum... | 4 |
public int getMin(int start, int end) {
if (this.start == start && this.end == end)
return minVal;
int mid = (this.start + this.end) / 2;
if (mid >= start && mid >= end)
return left.getMin(start, end);
if (mid < start && mid < end)
return right.getMin(start, end);
return Math.min(left.getMin(start, m... | 6 |
public static boolean ismetabolite(PathCaseNodeRole r) {
return r == PathCaseNodeRole.SUBSTRATEORPRODUCT || r == PathCaseNodeRole.REGULATOR || r == PathCaseNodeRole.INHIBITOR || r == PathCaseNodeRole.ACTIVATOR || r == PathCaseNodeRole.COFACTOR || r == PathCaseNodeRole.COFACTORIN || r == PathCaseNodeRole.COFACTO... | 7 |
public void reset() {
if (!refresher.isRunning()) refresher.start();
if (timer != null) timer.stop();
// Create players
winDelay = false;
playersLeft = playerNum;
playerList = new ArrayList<Tank>();
for(int i = 0; i <= playerNum; i++) {
switch(i) {
case 1: createPlayer(Color.RED,... | 9 |
public XMLLevelLoader() throws LevelLoaderException {
initColorMap();
boxes = new ArrayList<BoxObject>();
playerPos = new Vector3f();
goalPos = new Vector3f();
ccolor = new Color(Color.WHITE);
filename = null;
cattributes = null;
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.se... | 2 |
public void upDateLocations(Drawable i) //Updates the locations of moving objects in the game and moves things to different sectors when needed.
{
i.setX(i.getX() + i.getVelocityX());
i.setY(i.getY() + i.getVelocityY());
if(i.getX() <= 0){
if(activeX !=0)
{
activeX--;
setActiveSector(... | 8 |
@Override
public int find(int p)
{
// The component to which p belongs is immediate from its component-id,
// id[p] only if id[p] is the same as the vertex itself
// Else the component-id is just a link in the path which leads to the
// actual component-id
while (id[p] != p)
p = id[p];
return p;
} | 1 |
boolean SetLcLpPb(int lc, int lp, int pb)
{
if ((lc > 8) || (lp > 4) || (pb > 4))
return false;
m_LiteralDecoder.Create(lp, lc);
int numPosStates = 1 << pb;
m_LenDecoder.Create(numPosStates);
m_RepLenDecoder.Create(numPosStates);
m_PosStateMask = (numPosStates - 1);
return true;
} | 3 |
public int firstMissingPositive(int[] a) {
if (a == null || a.length == 0) {
return 1;
}
for (int i = 0; i < a.length; i++) {
int num = a[i];
if (num > 0 && num < a.length && a[num - 1] != num) {
a[i] = a[num - 1];
a[num - 1] ... | 9 |
public void playOverSound()
{
overClip.start();
} | 0 |
public void setMask(int mask) {
this.mask = mask;
} | 0 |
public User(String u) throws FileNotFoundException{
Username = u;
Scanner sc = new Scanner(new File("Users/" + Username + ".txt"));
while(sc.hasNext()){
String text = sc.next();
if(text.equals("Password:"))
Password = sc.next();
if(text.equals(... | 8 |
public FieldInfos(FieldInfo[] infos) {
boolean hasVectors = false;
boolean hasProx = false;
boolean hasPayloads = false;
boolean hasOffsets = false;
boolean hasFreq = false;
boolean hasNorms = false;
boolean hasDocValues = false;
boolean hasPointValues = false;
TreeMap<Integer, ... | 9 |
private float calculaVendasDoMes(List<Venda> vendas, int mes, int ano) {
float vendasDoMes = 0;
ListIterator<Venda> iteradorDeVendas = vendas.listIterator();
while( iteradorDeVendas.hasNext()) {
Venda venda = iteradorDeVendas.next();
if( venda.getAno() == ano && venda.getMes() == mes) {
v... | 3 |
public static TreeMap<String, Integer> getSystems(ArrayList<Kill> Kills) {
TreeMap<String, Integer> output = new TreeMap<String, Integer>(); // the
// output
// result
// (Name,
// Number of
// occurance)
ArrayList<int[]> systemStats = new ArrayList<int[]>(); // (ID, number of
... | 8 |
public double getAngle()
{
double angle;
double rawAngle;
// Let's avoid dividing by zero.
if (_y == 0)
{
if (_x < 0)
{
angle = 3 * Math.PI / 2;
} else
{
angle = Math.PI / 2;
}
... | 4 |
private void loadManifestEntry(Element activity, String baseClass, String packageName) {
if (activity.getAttribute("android:enabled").equals("false"))
return;
String className = activity.getAttribute("android:name");
entryPointsClasses.add(expandClassName(className));
} | 1 |
private void addToken (StringBuffer chunk, int type, String name) {
tokens.add(chunk.toString());
tokenNames.add(name);
tokenTypes.add(new Integer(type));
} | 0 |
public static Cons javaTranslateDefineMethodUnit(TranslationUnit unit) {
{ Object old$Localgensymtable$000 = Stella.$LOCALGENSYMTABLE$.get();
Object old$Methodbeingwalked$000 = Stella.$METHODBEINGWALKED$.get();
Object old$Currentdummyindex$000 = Stella.$CURRENTDUMMYINDEX$.get();
Object old$Dummyde... | 8 |
public static void main(String[] args) {
launch(args);
} | 0 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost, msg))
return false;
if((msg.source()==affected)
&&(myListen != null)
&&(msg.tool() == myListen)
&&(msg.target() instanceof Room)
&&(msg.target() != msg.source().location())
&&(CMLib.flags().i... | 9 |
public void act(){
if (clicked){
if (counter >= 10){
counter = 0;
clicked = false;
}
else{
counter++;
hoverCounter = 0;
this.setImage (bg[2]);
}
}
else if (selected){
... | 4 |
public static TimerController getInstance(){
if(instance == null){
instance = new TimerController();
}
return instance;
} | 1 |
public String toString() {
StringBuilder sb = new StringBuilder();
// sb.append("Edges:");
// for (Edge<E> e : edges) {
// Vertex<V>[] verts = endVertices(e);
// sb.append(String.format(" (%s->%s, %s)", verts[0].getElement(), verts[1].getElement(), e.getElement()));
// }
// sb.append("\n... | 5 |
public static boolean playerExists(String playerName){
try {
SQL_STATEMENT = SQL_CONNECTION.createStatement();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
SQL_RESULTSET = SQL_STATEMENT.executeQuery("SELECT COUNT(*) AS rows FROM names WHERE username='" +... | 4 |
private static Object[] getDefinition(Object classname, String key, String type) {
Object currentname = classname;
while (classname != null) {
for (int i = 0; i < dtd.length; i += 3) {
if (dtd[i] == classname) {
Object[][] attributes = (Object[][]) dtd[i + 2];
if (attributes != null) {
for (i... | 8 |
public SoundTester() {
// Set JFrame properties
this.setTitle(TITLE);
this.setResizable(false);
this.setSize(WIDTH, HEIGHT);
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
this.setLocationRelativeTo(null);
// get content pane
pane = this.getContentPane();
pane.setLayout(new FlowLa... | 2 |
void init() {
display = new Display();
shell = new Shell(display);
shell.setText(TITLE_WITH_VERSION_AND_PATH);
lockProgrammProcess(shell);
try {
shell.setImage(new Image(display, VermilionCascadeNotebook.class.getResourceAsStream("/images/logo.png")));
GridLayout gl = new GridLayout(1, false);
gl.... | 1 |
private boolean isObjectDependsOnDataset(final Data data) {
if(data.isPlain()) {
final AttributeType att = data.getAttributeType();
if(att instanceof ReferenceAttributeType) {
final ReferenceAttributeType referenceAttributeType = (ReferenceAttributeType)att;
if(referenceAttributeType.getReferenceType() ... | 7 |
public int isMember(String classname, String membername, int index) {
MemberrefInfo minfo = (MemberrefInfo)getItem(index);
if (getClassInfo(minfo.classIndex).equals(classname)) {
NameAndTypeInfo ntinfo
= (NameAndTypeInfo)getItem(minfo.nameAndTypeIndex);
if (getUtf... | 2 |
public void syncUsers(ArrayList<NetworkSharedUser> users) {
model.removeAllElements();
for(NetworkSharedUser u : Users.getUsersOnline()) {
// We don't want to add ourself to the online list.
if(u.getId() == thisUser.getId()) continue;
model.addElement(u.getName());
}
} | 2 |
private boolean jj_3R_10() {
Token xsp;
xsp = jj_scanpos;
if (jj_3R_15()) {
jj_scanpos = xsp;
if (jj_3R_16()) {
jj_scanpos = xsp;
if (jj_3R_17()) {
jj_scanpos = xsp;
if (jj_3R_18())
return true;
}
}
}
return false;
} | 4 |
public void onAction(String name, boolean isPressed, float tpf) {
if (isPressed && name.equals(KeyMapper.RELOAD_WEAPON)) {
long tempTime = System.currentTimeMillis();
if (tempTime - 3000 > timeStamp) {
timeStamp = tempTime;
final List<Spatial> handChildr... | 5 |
@SuppressWarnings("rawtypes")
public boolean equals(Object o) {
if (this == o) return true; // Misma entidad
if (!(o instanceof List)) return false; // Objetos incompatibles
List list = (List) o;
if (this.getSize() != list.getSize()); // Tamanos diferentes
ListIterator i1 = this.iterator();
Lis... | 6 |
public void alterar(Consulta consultaAnt) throws Exception {
if(consultaAnt.getCodMedico() == null){
throw new Exception("Medico não foi selecionado !");
}
if(consultaAnt.getCodPaciente() == null){
throw new Exception("Paciente não foi selecionado !");
}
i... | 5 |
@Test
public void itShouldSerializeMultiPoint() throws Exception
{
MultiPoint multiPoint = new MultiPoint(new LngLatAlt(100, 0), new LngLatAlt(101, 1));
Assert.assertEquals("{\"coordinates\":[[100.0,0.0],[101.0,1.0]],\"type\":\"MultiPoint\"}", mapper.toJson(multiPoint));
} | 0 |
@Test
public void WhenStaticRandomSelect_ExpectRefMaxHostsInResult()
throws UnknownHostException {
ArrayList<Host> list = new ArrayList<Host>(1);
Host host0 = new PGridHost("127.0.0.1", 3333);
Host host1 = new PGridHost("127.0.0.1", 1111);
list.add(host0);
list.ad... | 3 |
public boolean isHomeCollision(int x, int y, home Home)
{
if (Home.x == x && Home.y == y)
{
return true;
}
return false;
} | 2 |
private boolean matches(Recreation r) {
final int tA = r.type, tB = this.type ;
if (tA == Recreation.TYPE_ANY || tB == Recreation.TYPE_ANY) return true ;
if (client != null && client != r.actor()) return false ;
return tA == tB ;
} | 4 |
public HeroClass getBossClass() {
return bossclass;
} | 0 |
public static boolean isNumeric(String string) {
if (string == null || string.length() == 0)
return false;
int l = string.length();
for (int i = 0; i < l; i++) {
if (!Character.isDigit(string.codePointAt(i)))
return false;
}
return true;
... | 4 |
private void cargaPorDefecto() {
File f1 = new File(RUTA_CARGADO1), f2 = new File(RUTA_CARGADO2), f3 = new File(RUTA_CARGADO3);
try {
if (f1.exists()) {
cargarDesdeCSV(f1.getAbsolutePath());
} else if (f2.exists()) {
cargarDesdeCSV(f2.getAbsolutePa... | 4 |
void scrollVertically(ScrollBar scrollBar) {
if (image == null) return;
Rectangle canvasBounds = imageCanvas.getClientArea();
int width = Math.round(imageData.width * xscale);
int height = Math.round(imageData.height * yscale);
if (height > canvasBounds.height) {
// Only scroll if the image is bigger than ... | 3 |
private void chainRecurse(Stack<ArrayList<Point>> visited, int score, WordBuilder wb) {
if (Thread.currentThread().isInterrupted()) {
return;
}
if (wb.grid.cellsRemaining() == 0) {
score += 500;
}
wc.grid = wb.grid;
Collections.sort(wb.buildWordList(), wc);
if (Thread.currentThread().isInterrupted()... | 9 |
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 |
private static Object parseJSONObj(Object obj) {
Object result = null;
if (obj == null) {
// error
return null;
} else {
if (obj instanceof JSONArray) {
JSONArray arrayObj = (JSONArray) obj;
List<Object> list = new ArrayList<Ob... | 5 |
public void downToNext(){
try {
if(allowedValue == null){
int n = this.getValue();
if(specialValue != null){
for(int i=specialValue.length; i>0; i--){
if(n > specialValue[i-1] && specialValue[i-1] % increment == 0){
setNormal();
setText(Integer.toString(specialValue[i-1]));
retur... | 7 |
public MapReader(String mapName, int mapSize, InternalDisplay output) {
this.mapChars = new char[mapSize][19][19];
this.playerInitialX = new int[mapSize];
this.playerInitialY = new int[mapSize];
this.androidInitialX = new int[mapSize];
this.androidInitialY = new int[mapSize];
this.output = output;
for ... | 8 |
public static Article selectArticleById(int id) throws SQLException {
String query;
Article article = new Article();
ResultSet resultat;
query = "SELECT * from ARTICLE where ID_ARTICLE=? ";
PreparedStatement pStatement = ConnectionBDD.getInstance().getPreparedStatement... | 1 |
public void parseCNFFormula(String file) {
setRunning(true);
setGlobalAction(GLOBAL_ACTION_LOAD_FORMULA);
setCurrentAction(CURRENT_ACTION_LOAD_CLAUSES);
formula = new CNFFormula();
testSuite = null;
mutants.clear();
try {
BufferedReader in = new Buffer... | 8 |
public void fire(){
if (currentForm!=4){
if(currentForm==-1){
if(timeSinceLastShot>laserFireRate){
timeSinceLastShot = 0;
shots.add(new Projectile(imageLib,(ship.x + 5),(ship.y + ship.height)-13,0));
shots.add(new Projectile(imageLib, ship.x + 5, ship.y+7, 0));
}
}
else if(currentForm ==... | 9 |
@Override
public void logicUpdate(GameTime gameTime) {
deleteRequiredLayers();
for (GameLayer gameLayer : gameLayers.values()) {
if (gameLayer.currentState != GameLayer.GameLayerState.PAUSED) {
gameLayer.logicUpdate(gameTime);
// We poll this information to see if the game layer now wants
// remove... | 3 |
private static void readData() {
try {
b = new BufferedReader(new FileReader(fileDirectory + dataFile));
String line;
while ((line = b.readLine()) != null) {
String[] s = line.split(":");
int usr = Integer.parseInt(s[0]);
int mov = Integer.parseInt(s[2]);
int rat = Integer.parseInt(s[4]);
... | 6 |
static void terminateBits(int numDataBytes, BitArray bits) throws WriterException {
int capacity = numDataBytes << 3;
if (bits.getSize() > capacity) {
throw new WriterException("data bits cannot fit in the QR Code" + bits.getSize() + " > " +
capacity);
}
for (int i = 0; i < 4 && bits.get... | 8 |
public void tv(){
/*
* verificacao de seguranca.
* se nao houver nenhuma canal na memoria secundaria.
*/
if(canais.isEmpty())
if(JOptionPane.showConfirmDialog(null, "\nSem canais registrados.\n\nAdicionar?","TV",JOptionPane.YES_NO_OPTION) == 0 )
... | 6 |
@Override
public boolean equals(Object obj) {
if (obj instanceof Map.Entry<?,?>) {
Map.Entry<?,?> entry = (Map.Entry<?,?>)obj;
if (!key.equals(entry.getKey())) {
return false;
}
Object entryValue = entry.getValue();
... | 9 |
public void mouseReleased (MouseEvent e){
Container parent = e.getComponent().getParent();
if(SwingUtilities.isLeftMouseButton(e) && dragging && parent != null){
Rectangle bounds = e.getComponent().getBounds();
boolean setBounds = false;
for (int i = 25; ... | 9 |
private void checkDependency(
final SystemObject systemObject, final SystemObject dependencyObject, ConfigurationAreaDependencyKind dependencyKind) {
// Abhängigkeiten nur speichern, wenn mindestens Version 9 des Metamodells vorliegt
if(!_storeDependencies) return;
if(systemObject == null || dependencyObject ... | 7 |
public void setProgressBar(JComponent cmpt) {
if (cmpt instanceof JProgressBar)
progressBar = (JProgressBar)cmpt;
else
throw new IllegalArgumentException("Provided component was not a JProgressBar!");
} | 1 |
@Override
public SourceValue unaryOperation(final AbstractInsnNode insn,
final SourceValue value) {
int size;
switch (insn.getOpcode()) {
case LNEG:
case DNEG:
case I2L:
case I2D:
case L2D:
case F2L:
case F2D:
case D2L:
... | 9 |
@Override
public void paint(Graphics g) {
g.setColor(Color.WHITE);
g.fillRect(0, 0, getWidthGraph(), getHeightGraph());
g.setColor(Color.GRAY);
try {
double xfactor = getWidthGraph() / (xdh - xdl), yfactor = getHeightGraph() / (ydh - ydl); //a normalization factor. alway... | 5 |
private void printIf(Node t, int n)
{
if (t.getCdr().isNull())
{
t.getCar().print(n+4, false);
System.out.println();
if (n > 0)
{
for (int i = 0; i < n; i++)
System.out.print(" ");
}
t.getCdr(... | 3 |
public void run(){
try{
Message assignCmd = new Message(msgType.COMMAND);
assignCmd.setCommandId(CommandType.ASSIGNID);
assignCmd.setWorkerID(workerId);
sendToWorker(assignCmd);
Message workerMessage;
System.out.println("manage... | 9 |
@Override
public void keyPressed(KeyEvent e) {
System.out.println(e.getKeyCode());
switch(e.getKeyCode()){
case 37://left
//Point pL = new Point(entity.getLocation().x-1,entity.getLocation().y-1);
//ArrayDeque<Point> left = new ArrayDeque<Point>();
//left.add(pL);
//testCanvas.moveUnit(entity,left);
... | 5 |
public void validateQueueHead(String queueHead)
{
if(queueHead.isEmpty())
{
System.out.println("NOOOOOOOOOOOOOOOOOOOOOOOOO, Ladder can not be made");
userInter.optionSelect();
}
//looks at word after . removes full stop from wordQueue and removes first from parentlist
if(queueHead =="." && parentsList.... | 5 |
private void awardBiggestArmy(){
Player playerHasBA = players[0];
boolean hasEnough = true;
for (Player p : players){
if (p.getArmy() > playerHasBA.getArmy()) playerHasBA=p;
else if (p.getArmy() == playerHasBA.getArmy() && p.getHasBiggestArmy()) playerHasBA=p;
}
if (playerHasBA.getArmy()<3) hasEnough =... | 9 |
public static void main(String[] args) {
long sum = 0;
if(args.length == 0) {
for(File file : Directory.walk(".").files) {
System.out.print(file + ": ");
System.out.println(file.length());
sum += file.length();
}
} else {
... | 4 |
private static Register.Width join(Register.Width lhs, Register.Width rhs) {
if(lhs == rhs) {
return lhs;
} else if(lhs == Width.ScalarDouble) {
return join(Width.Quad,rhs);
} else if(lhs == Width.ScalarSingle) {
return join(Width.Long,rhs);
} else if(rhs == Width.ScalarDouble) {
return join(lhs,Wi... | 5 |
public String closeAlertAndGetItsText()
{
try
{
Alert alert = driver.switchTo().alert();
if (acceptNextAlert)
{
alert.accept();
}
else
{
alert.dismiss();
}
return alert.get... | 1 |
public ResultSet retrieveLoginPageData() throws SQLException{
try{
databaseConnector=myConnector.getConnection();
stmnt=(Statement)databaseConnector.createStatement();
SQLQuery="SELECT * FROM familydoctor.loginpage";
System.out.println(SQLQuery);
... | 3 |
@Override
public Response list(ListRequest request) throws IOException {
//STAGE3
Mac hmac=null;
try {
hmac = Mac.getInstance("HmacSHA256");
} catch (NoSuchAlgorithmException e) {
System.err.println("NoSuchAlgorithmException (HmacSHA256 not valid): " + e.getMessage());
return new HmacErrorResponse("In... | 4 |
public String getPIDByCoordinate(Statement statement,Double longitude,Double latitude)//根据坐标获取PID
{
String result = null;
sql = "select PID from Park where longitude = '" + longitude +"' and latitude = '"+latitude+"'";
try
{
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
result = rs... | 2 |
public static Rectangle parseLoadRect(String data){
Rectangle rect = new Rectangle();
Point pt;
boolean ptSet = false;
boolean dimSet = false;
for (String l : data.split("\n")){
if (l.matches("pt +\\([0-9]+, ?[0-9]+\\)")){
pt = parsePoint(l.substring(l.indexOf("("), l.indexOf(")")+1));
rect.setLoca... | 7 |
@Override
public void initialize(Problem P) {
double [] opt_values = null;
double opt_cost = Double.NaN;
try {
unknowns = P.get_unique_unknowns();
int num_unknowns = unknowns.size();
// Create a problem
lp_solver = LpSolve.makeLp(0,num_unkn... | 8 |
private DefaultMutableTreeNode addNodes(DefaultMutableTreeNode curTop, File dir){
String currentDirectory;
// try{
currentDirectory = destinationDir.getPath();
// }catch(IOException e){
// currentDirectory = "no such directory";
// }
DefaultMutableTreeNode ... | 6 |
@Override
public Collection<String> getThisPageFiles() {
Collection <String> fileset = new LinkedList<String>();
try {
fileset.add( getChildrenSaveTo() );
} catch (IOException e) {
}
return fileset;
} | 1 |
protected int findKey(int key, boolean include) {
int index = 0;
int size = getSize();
BufferView dataView = getDataView();
for(; index < size; index ++) {
int current = dataView.getInt(8 * index);
if((include && current >= key) || (!include && current > key)) {
break;
}
}
dataView.close();
r... | 5 |
public boolean getIsFaceUp() {
return isFaceUp; //You may need to change this
} | 0 |
public void Ringtone() {
try {
Synthesizer synthesizer = MidiSystem.getSynthesizer();
synthesizer.open();
MidiChannel[] channels = synthesizer.getChannels();
int one = 90;
int two = 110;
for(int i=0; i<100; i++) {
channels[0].noteOn(one, one);
Thread.sleep(50);
channels[0].noteOn(two, tw... | 2 |
private void closeBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeBtnActionPerformed
this.dispose();
}//GEN-LAST:event_closeBtnActionPerformed | 0 |
public boolean isQueryInformationValid(Server sv) {
loadFromServer(server);
String temp = "";
try {
temp = queryServer();
if(temp == null || temp.isEmpty()) {
return false;
}
} catch (IOException e) {
e.printStackTrace();
}
if (temp.contains("disconnected")) {
return false;
}
return t... | 4 |
public void syncSingleFile(String fileName, FileOperation fileOperation, TextProcessor textProcessor) {
byte operation = fileOperation.operation;
long fileLastModifiedTime = fileOperation.file.lastModified();
long fileSize = fileOperation.file.length();
boolean isDir = fileOperation.file... | 7 |
public void compExecTime() {
double newExeTime;
double newCost;
dEval = 0;
dTime = 0;
dCost = 0;
for (int i = 0; i < iClass; i++) {
newExeTime = 0;
System.out.print("Cost[" + i + "]");
for (int j = 0; j < iSite; j++) {
if (dmAlloc[i][j] != -1) {
if (dmAlloc[i][j] < 1) {
newExeTime = ... | 8 |
public static void main(String s[])
{
String X = "ABCABBA";
String Y = "CBABACA";
BULCS bu = new BULCS(X, Y);
for (int i = 0; i < X.length(); i++)
{
for (int j = 0; j < Y.length(); j++)
System.out.print(bu.getLength(i, j) + " ");
System.out.println();
}
/*
* for (int i = 0; i < X.length(); ... | 2 |
protected void startBroadMessage(){
while(noStopRequested){
try{
Response msg = broadMessages.take();//获取广播消息
Iterator<Client> it = this.clients.values().iterator();
boolean isCode = false;
while(it.hasNext()){
//log.info(msg.getBody());
Client socketer = it.next();
if(!isCode){... | 5 |
private int getItemStackIndexBackwards(Item item) {
int ID = item.getID();
ItemStack stack;
for (int i = items.size() - 1; i >= 0; i--) {
stack = items.get(i);
if (stack.getItemInStackID() == ID && stack.getAmount() <= stack.getMaxStackSize())
return i;
... | 3 |
public void stopMovement() {
if (moving) {
setXD(0);
setYD(0);
step = 0;
moving = false;
t.cancel();
t.purge();
timerStarted = false;
}
} | 1 |
protected void execute() {
double left = Robot.driveTrain.getLeftDistance(),
right = Robot.driveTrain.getRightDistance();
if(Math.abs(_goal-left) > Math.abs(_goal-right)) {
_dist = left;
}
else {
_dist = right;
}
... | 2 |
private void logicalOr(LogicalOr lop) {
for(Predicate p : lop.getPredicates()) {
if(p instanceof BinaryContains) {
// ignore them for the time being
} else if(p instanceof Contains) {
this.addToCount(((Contains) p).getA().getName(), 1);
return;
} else if(p instanceof Exactly) {
this.addToCoun... | 6 |
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.