text stringlengths 14 410k | label int32 0 9 |
|---|---|
private String getMatch(String s) {
for (int i = 0; i < dataList.size(); i++) {
String s1 = dataList.get(i).toString();
if (s1 != null) {
if (!isCaseSensitive
&& s1.toLowerCase().startsWith(s.toLowerCase()))
return s1;
if (isCaseSensitive && s1.startsWith(s))
return s1;
}
}
retur... | 6 |
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
RaavareDTO raavare = raavareList.get(rowIndex);
Object value = null;
switch (columnIndex) {
case 0:
value = raavare.getRaavareId();
break;
case 1:
value = raavare.getVareNavn();
break;
case 2:
value = raavare.getLeverandoerI... | 5 |
private int[] generateTestingArray() {
Random r = new Random();
int arraySize = (Integer) spinnerArraySize.getValue();
int[] values = new int[arraySize];
for (int i = 0; i < values.length; i++)
values[i] = r.nextInt(SAVHistoryComponent.PLAYING_CARD_AMOUNT);
if (this.rdbtnSorted.isSelected()) {
Arrays... | 4 |
@SuppressWarnings("unchecked")
void readMolecularOrbitals() throws Exception {
Hashtable[] mos = new Hashtable[5];
Vector[] data = new Vector[5];
int nThisLine = 0;
while (readLine() != null
&& line.toUpperCase().indexOf("DENS") < 0) {
String[] tokens = getTokens(line);
int ptData = ... | 8 |
@Override
public Consulta listByIdUpdate(int codigo) {
Connection con = null;
PreparedStatement pstm = null;
ResultSet rs = null;
Consulta c = new Consulta();
try {
con = ConnectionFactory.getConnection();
pstm = con.prepareStatement(LISTBYIDUPDATE);... | 3 |
public void initChatGroup() {
String sessionId = getSession().getId();
checkUserRegister(getRequest(), sessionId);
int selfChatState = UserState.dao.getUserState(sessionId);
if (selfChatState == Users.onlineWithoutChat || selfChatState == Users.offLine || selfChatState == Users.unExist) {
UserState.dao.updat... | 9 |
@Override
public boolean matches(String[] input) {
for (String word: input) {
if (word.equals("test")) {
return true;
}
}
return false;
} | 2 |
@Override
public boolean isBuffered() {
//if(gcode==null) return false;
if (Constants.GCDEF.G0.equals(gcode) || Constants.GCDEF.G1.equals(gcode) || Constants.GCDEF.G2.equals(gcode) || Constants.GCDEF.M106.equals(gcode) || Constants.GCDEF.M107.equals(gcode) || Constants.GCDEF.G30.equals(gcode) || Constants.GCDEF... | 8 |
public static int strxtoi(String hex)
{
final int ASCII_CUTOFF_INTS = 48;
final int ASCII_CUTOFF_LETTERS = 65;
final int ASCII_SUBTRACT_LETTERS = 55;
final int BASE = 16;
int sum = 0;
for(int i = 0 ; i < hex.length() ; i++){
sum *= BASE;
int val = (int) hex.charAt(i);
if(val >= ASCII_CUTOFF_LETTER... | 2 |
public int getMaxHP() {
return maxHP;
} | 0 |
protected synchronized void paintComponent(Graphics g2) {
if(!animate_) {
return;
}
super.paintComponent(g2);
Graphics2D g2D = (Graphics2D)g2;
g2D.setFont(grFont);
double timeSpan = settings.getTimeSpan();
panelHeight_ = pnLeft.getHeight() - 100 - SHI... | 3 |
@Override
public void removeLayoutComponent(Component component) {
if (defaultComponents.contains(component)) {
defaultComponents.remove(component);
}
if (bottomComponents.contains(component)) {
bottomComponents.remove(component);
}
if (bottomCenter.contains(component)) {
bottomCenter.remove(compone... | 3 |
public static List<?> GetAll(Class aClass) {
if (aClass.equals(Transaction.class))
return allData.getAllTransactions();
if (aClass.equals(Transfer.class))
return allData.getAllTransfers();
if (aClass.equals(ExpenseCategory.class))
return allData.getAllExpenseC... | 6 |
@Override
public String getElementAt(int index) {
// TODO Auto-generated method stub
return names[index];
} | 0 |
public void method212(boolean flag, int j, int k, int l, int i1, int j1)
{
int k1 = 256;
if(flag)
k1 += 0x20000;
l -= anInt290;
i1 -= anInt291;
if(j1 == 1 || j1 == 3)
{
int l1 = j;
j = k;
k = l1;
}
for(int i2 = l; i2 < l + j; i2++)
if(i2 >= 0 && i2 < anInt292)
{
for(int j2 = i1; j... | 9 |
public boolean equals(final Object obj) {
if (obj instanceof Key) {
final Key key = (Key) obj;
return (key.node == node) && (key.blockIndex == blockIndex);
}
return false;
} | 2 |
private void parseBounds(RdpPacket_Localised data, BoundsOrder bounds)
throws OrderException {
int present = 0;
present = data.get8();
if ((present & 1) != 0) {
bounds.setLeft(setCoordinate(data, bounds.getLeft(), false));
} else if ((present & 16) != 0) {
... | 9 |
public static void main(String... args)
{
int nodeNumber = 3; //number of nodes in the network
int initialPort = 8000; //initial UDP port
String userNamePrefix = "TestUser"; //userId common prefix
/*
* PART I : Network initialization
*/
//Create the environ... | 9 |
private static BigDecimal regraC(Transferencia transf) {
long dias = calculaDiasEntreDatas(transf.getCreated(), transf.getAgenda());
BigDecimal valRetorno = null;
if (dias > 30) {
valRetorno = transf.getValor().multiply(new BigDecimal("0.012"));
} else if (dias > 25) {
... | 5 |
private Object newInstance (Class type) {
try {
return type.newInstance();
} catch (Exception ex) {
try {
// Try a private constructor.
Constructor constructor = type.getDeclaredConstructor();
constructor.setAccessible(true);
return constructor.newInstance();
} catch (SecurityException igno... | 7 |
private void CriarEscola_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CriarEscola_ButtonActionPerformed
if (NomeEscola_TextField.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Escreva um nome para a escola!", "Alerta!", JOptionPane.WARNING_MESSAGE);
... | 2 |
public String getNom() {
return nom;
} | 0 |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
DefaultTableModel dft = (DefaultTableModel) jTable3.getModel();
dft.setRowCount(0);
if (jRadioButton2.isSelected()) {
try {
... | 6 |
private Expr statement() throws IOException {
if (lookAheadToken.tag == '(' || lookAheadToken.tag == Tag.NUM || lookAheadToken.tag == Tag.REAL) {
expression();
Expr t = e.gen();
return t.reduce();
} else if (lookAheadToken.tag == Tag.ID) {
Token temp = lo... | 6 |
private static LinkedList<CommMode> parseComm(String path)
throws ParserConfigurationException, SAXException, IOException {
// xml get root
Document partXml = XmlReader.getDoc(path);
Node partNod = partXml.getDocumentElement();
Element partElem = (Element) partNod;
// the return
LinkedList<CommMode> ret ... | 3 |
public double getResult(String expressionCode)
{
StringBuffer expression2 = new StringBuffer();
String expression = (String)hashExpressions.get(expressionCode);
int i = 0;
int lastPoz = 0;
for(; i < expression.length(); i++)
if(i == expression.length() - 1 || Oper... | 6 |
@Override
public int read() throws IOException {
if(bList.isEmpty()) {
return -1;
} else {
//Damn the signed bytes
return bList.pollFirst()&255;
}
} | 1 |
private static String encode_base64(byte d[], int len)
throws IllegalArgumentException {
int off = 0;
StringBuffer rs = new StringBuffer();
int c1, c2;
if (len <= 0 || len > d.length)
throw new IllegalArgumentException ("Invalid len");
while (off < len) {
c1 = d[off++] & 0xff;
rs.append(base64_co... | 5 |
public static void combSort11(double arrayToSort[], int linkedArray[]) {
int switches, j, top, gap;
double hold1; int hold2;
gap = arrayToSort.length;
do {
gap=(int)(gap/1.3);
switch(gap) {
case 0:
gap = 1;
break;
case 9:
case 10:
gap=11;... | 7 |
public static Map<Marker, Marker> collapseZeroGap(Markers markersOri) {
Map<Marker, Marker> collapse = new HashMap<Marker, Marker>();
// Sort markers by start
Markers sorted = new Markers();
sorted.add(markersOri);
sorted.sort(false, false);
// Create new set of markers
Marker markerPrev = null; // Pre... | 9 |
private void setGameCheck(Game game) {
for (int y = 0; y < 9; y++) {
for (int x = 0; x < 9; x++) {
fields[y][x].setBackground(Color.WHITE);
if (fields[y][x].getForeground().equals(Color.BLUE))
fields[y][x].setBackground(game.isCheckValid(x, y) ? Co... | 4 |
@Nullable
public T waitForResult() throws InterruptedException {
if(!set) {
synchronized (waitLock) {
if(!set) {
waitLock.wait();
}
}
}
if(!set) {
throw new IllegalStateException("Notified but never set: " + this);
}
try {
//noinspection unchecked
return (T)result;
} catch (Cla... | 4 |
* @param unit The <code>Unit</code> that is building.
* @param name The new settlement name.
* @return An <code>Element</code> encapsulating this action.
*/
public Element buildSettlement(ServerPlayer serverPlayer, Unit unit,
String name) {
ChangeSet cs = ne... | 9 |
private void restoreTree(List<Component> roots, Map<String, Object> stateMap) {
List<Component> allChildren = new ArrayList<Component>();
for (Component root : roots) {
if (root != null) {
PropertySupport p = getProperty(root);
if (p != null) {
... | 9 |
public String getSaveEncoding() {
return (String) saveEncodingComboBox.getSelectedItem();
} | 0 |
private void cargaBDF(BufferedReader bf) throws IOException
{
String linea;
int indice;
double x,y,z,w;
Nodo nodo;
Elemento elemento;
do
{
linea = bf.readLine();
if(linea.startsWith("GRID"))
{
indice = Integ... | 4 |
@EventHandler
public void WolfNightVision(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getWolfConfig().getDouble("Wolf.NightVisi... | 6 |
public void visitArrayRefExpr(final ArrayRefExpr expr) {
// NullPointerException, ArrayIndexOutOfBoundsException,
// ArrayStoreException
sideEffects |= SideEffectChecker.THROW;
if (expr.isDef()) {
sideEffects |= SideEffectChecker.STORE;
}
sideEffects |= SideEffectChecker.ALIAS;
expr.visitChildren(th... | 1 |
@Override
public final void write(final String text) {
if (text == null) {
System.out.println(INVALID_STRING);
return;
}
System.out.println(text);
} | 1 |
public void draw(GOut g) {
if(state == 0)
g.chcolor(255, 192, 192, 255);
else if(state == 1)
g.chcolor(192, 192, 255, 255);
else if(state == 2)
g.chcolor(192, 255, 192, 255);
g.image(bg, Coord.z, sz);
g.chcolor();
if((state & 1) != 0)
g.image(ol, Coord.z, sz);
else
g.image(sl, Coord.z, s... | 5 |
public static void main(String[] args) {
Game game = new Game();
game.setVisible(true);
game.setResizable(false);
} | 0 |
private void registerListener(Object o) {
Class<?> clazz = o.getClass();
Method [] methods = clazz.getDeclaredMethods();
for (Method m : methods) {
if (m.isAnnotationPresent(EventCallback.class)){
EventCallback cb = (EventCallback) m.getAnnotation(EventCallback.class);
if (cb.ignore()) continue;
... | 7 |
public boolean isNumeric() {
return (this == BYTE || this == SHORT || this == INTEGER
|| this == LONG || this == FLOAT || this == DOUBLE);
} | 5 |
public List<TopicObj> getTopicTable(PreparedStatement pre, boolean join) {
List<TopicObj> items = new LinkedList<TopicObj>();
try {
ResultSet rs = pre.executeQuery();
if (rs != null) {
while (rs.next()) {
TopicObj item = new TopicObj();
... | 4 |
protected AbstractDefinition(Method method) throws DaoGenerateException {
// 如果不传入method,则表示子类会自己根据需要,延迟初始化
if (method != null) {
initDefinition(method);
}
} | 1 |
public CheckResultMessage check15(int day) {
int r1 = get(33, 5);
int c1 = get(34, 5);
int r2 = get(36, 5);
int c2 = get(37, 5);
BigDecimal b = new BigDecimal(0);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
b = getValue(r2 +... | 5 |
private void directionOrThrow(String direct) {
boolean dire = direct.equals(UNDIRECTED) || direct.equals(DIRECTED);
if (!dire)
try {
throw new IOException(
"No Direction Found at first line of given File!");
} catch (IOException e) {
}
} | 3 |
public final boolean method53(int i, Interface14 interface14) {
anInt4994++;
if (!(interface14 instanceof Class126))
return false;
Class126 class126_3_ = (Class126) interface14;
if (((Class126) this).anInt4991 != ((Class126) class126_3_).anInt4991)
return false;
if (i <= 50)
return true;
if (((Clas... | 9 |
private static void startSession() {
Session session = Session.getInstance(true);
Pair<BigInteger, BigInteger> privateKeys = session.getPrivateKey();
System.out.println("");
System.out.println("Private key x: " + privateKeys.getFirst());
System.out.println("Private key y: " + privateKeys.getSecond());
Sys... | 4 |
final void method2964(byte i, OggPacket oggpacket) {
anInt8990++;
if ((((Class348_Sub23) this).anInt6868 ^ 0xffffffff) > -4) {
int i_7_ = aVorbisInfo9006.headerIn(aVorbisComment9002, oggpacket);
if (i_7_ < 0)
throw new IllegalStateException(String.valueOf(i_7_));
if (((Class348_Sub23) this).anInt6868... | 9 |
public static void main(String... args) {
int[] array = {-1, 12, 34, 123, 435, 9876, 0};
sort(array);
for (int i = 0; i < array.length; i++) {
System.out.println(array[i]);
}
} | 1 |
public StringBuilder save() {
StringBuilder data = new StringBuilder();
data.append(totalText.getText().substring(0, totalText.getText().indexOf(' ')));
for(int x = 0; x<swingTimes.length; x++) {
data.append(";" + swingTimes[x]);
}
data.append(System.getProperty("line.separator"));
int i = 0;
if(... | 5 |
public String kertaaTama(int index){
String palautettava = "";
if (tila==KertausmaatinTila.TYHJA) {
palautettava += kerrattavat.get(index)[0]; //näytä kanji
tila = KertausmaatinTila.KANJI;
} else if (tila == KertausmaatinTila.KANJI) {
palautettava = kerrattava... | 3 |
@Override
public boolean isLessThan(CardInterface card, int trump) {
boolean retval;
if (this.value == 0) {
// fool will never get the trick if it wasn't the first card played
if (card.getValue() == 0) {
retval = false;
} else {
ret... | 6 |
public HashMap<String, Object> Match(String rank, String name, boolean strict, boolean verbose,
Map<String, String> taxonomy) {
String urlString = "http://api.gbif.org/v1/species/match?verbose=true";
URL url;
URLConnection conn;
InputStream is;
if(strict)
urlString += "&strict=true... | 5 |
private boolean testEventListEquality(boolean ignoreMachine, List<Event> firstEvents, List<Event> secondEvents) {
if(firstEvents.size() != secondEvents.size()) {
return false;
}
for(int i=0; i<firstEvents.size(); i++) {
if(!eventAreEqual(ignoreMachine, firstEvents.get(i), secondEvents.get(i))) {
return... | 3 |
private void compute()
{
double[] weights = model.getWeights();
double wscale = model.getWscale();
// Unlike the C++ code in sgd, we would like to be RAII
assert (u == null && b == null);
int nPos = sequence.length();
u = new double[nPos][numLabels];
for (int... | 8 |
public int getTopX(){if(dir=='u'||dir=='d')return x-17; return x-30;} | 2 |
private static void readFilename(FileSystem fileSystem, String file, byte[] cmp) throws TestFailedException {
FileHandle handle;
try {
handle = fileSystem.openFile(file, true, true);
} catch (PathNotFoundException e) {
throw new TestFailedException(e);
} catch (AccessDeniedException e) {
throw new Test... | 8 |
private static void buildIndex(String dataFile) {
System.out.println("Building Index ... ");
String indexFile = dataFile + ".idx";
try {
StringBuilder sb = new StringBuilder();
BufferedReader br = new BufferedReader(new FileReader(dataFile));
String line = null;
String tmp = null;
long offset = 0;
... | 9 |
@Override
public void actionPerformed(ActionEvent e) {
if(time == 7) t.stop();
System.out.println();
time++;
for(Line line : l)
line.split();
repaint();
} | 2 |
public static void modifyType(ArrayList<Journal> journalList, JournalTypes journalTypes) {
boolean singleMove;
if (journalList.size() == 1) {
singleMove = true;
} else {
int option = JOptionPane.showConfirmDialog(null, getBundle("BusinessActions").getString("APPLY_SAME_T... | 8 |
void checkModify() throws RuntimeException {
if (isFrozen()) {
String msg = getName() + " class is frozen";
if (wasPruned)
msg += " and pruned";
throw new RuntimeException(msg);
}
wasChanged = true;
} | 2 |
public void setTytul(String tytul) {
this.tytul = tytul;
} | 0 |
public ArrayList<Integer> getPathTo(Node target) {
if(getShortestPathTo(target) == INFINITY)
return null;
else
{
// System.out.println("From " + source + " to " + target);
int p = target.getId();
ArrayList<Integer> result = new ArrayList<>();
result.add(p);
do{
p = pred[p];
result.add(p);... | 2 |
public void checkCollision() {
for(int y = 0; y <mg.getMapSize().getY(); y++){
for(int x = 0; x <mg.getMapSize().getX(); x++){
if(mg.getCol()[x][y]){//Ends loop if not collision square
if(player.getColRect().intersects(new Rectangle(mg.getTileSize().getX()*x, mg.getTileSize().getY()*y,
mg.getTileSi... | 4 |
public byte[] post(String url, Map<String, String> postParams)
throws HttpException {
int numRetries = retry ? maxRetries : 1;
HttpPost httppost = null;
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
if (postParams != null && !postParams.isEmpty()) {
for (Map.Entry<Stri... | 9 |
@Override
public void show() {
Auction a = null;
System.out.println(name + ", type in the required information for a new auction item." + "\n");
System.out.println("Name of product:");
try {
productName = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("De... | 5 |
private void reconnect() {
if (this.reconnecting) return;
final Manager self = this;
this.attempts++;
if (attempts > this._reconnectionAttempts) {
logger.fine("reconnect failed");
this.emitAll(EVENT_RECONNECT_FAILED);
this.reconnecting = false;
... | 3 |
@Override
public Properties getOutputProperties() {
Properties properties = new Properties();
properties.put(NAME, getName());
properties.put(Balances.LEFTNAME, leftName);
properties.put(Balances.RIGHTNAME, rightName);
properties.put(Balances.LEFTTOTALNAME, leftTotalName);
... | 2 |
@Override
public boolean equals(Object o) {
if(this == o) {
return true;
}
if(o == null || getClass() != o.getClass()) {
return false;
}
PlayerData playerData = (PlayerData) o;
if(id != playerData.id) {
return false;
}
if(!name.equals(playerData.name)) {
return false;
}
return true;
... | 5 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UsersSubscribeHashtags that = (UsersSubscribeHashtags) o;
if (hashtagId != that.hashtagId) return false;
if (userId != that.userId) return fals... | 5 |
public static final boolean fullDharokEquipped(Player player) {
int helmId = player.getEquipment().getHatId();
int chestId = player.getEquipment().getChestId();
int legsId = player.getEquipment().getLegsId();
int weaponId = player.getEquipment().getWeaponId();
if (helmId == -1 || chestId == -1 || legsId == -1... | 7 |
@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 TaxonObservationFilterElement)) {
return false;
}
TaxonObservationFilterElement other = (TaxonObservationFilterElement)... | 5 |
@Override
public Comment getComment(int id)
{
/*
* gets a comment we a specific ID
*/
Comment comment = null;
Session session = null;
try {
session = factory.openSession();
session.beginTransaction();
comment = (Comment) session.get(Comment.class, id);
session.getTransaction().commit();
}... | 3 |
@Test
@SuppressWarnings({"unused", "null"})
public void testRecommendation() throws Exception {
String filename = Common.DATASET_FILENAME;
// First concept : a data model holds all the data.
// Instantiate here, a file based data model.
DataModel dataModel = null;
// Second concept : a similarity allo... | 1 |
public static void insert(String eDatabase, String table, byte[] etuple, String VALUES){
Connection gCon = null; // general connection to MYSQL
Connection eCon = null; // connection to database
Statement eStatement = null; // statements for the eDatabase
try{
// Register JDBC driver
Class.forName... | 8 |
private JSONWriter end(char mode, char c) throws JSONException {
if (this.mode != mode) {
throw new JSONException(mode == 'a'
? "Misplaced endArray."
: "Misplaced endObject.");
}
this.pop(mode);
try {
this.writer.write(c);
}... | 3 |
private static String rmvPrePostSc(String target) {
final char SC = '\'';
// ' で囲まれていた場合のみ、削除する。
if(target.charAt(0) != SC || target.charAt(target.length() -1) != SC)
return target;
//前後1文字づつ削除
return StringUtils.substring(target, 1 , target.length() -1 );
} | 2 |
private Color[] calculateColorPoints(int numberOfPoints,
Point2D.Float startPoint,
Point2D.Float endPoint,
float t0, float t1) {
// calculate the slope
float m = (startPoint.y - end... | 3 |
public void ouvrirEcriture(){
try{
// PrintWriter avec un auto flush sinon bloquant.
// directement le flux logique.
pf = new PrintWriter(s.getOutputStream(),true);
// alternative
// PrintStream ps = new PrintStream(s.getOutputStream());
}catch(IOException io){
System.out.println("echec de l'... | 1 |
public boolean getBoolean(int index) throws JSONException {
Object object = get(index);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE)... | 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 void updateColumnInfos() {
if (this.getData() == null || this.getData().size() == 0) return;
int colCnt = this.getData().get(0).length;
initColInfoIfNull(colCnt);
for (ColumnInfo ci : getColumnsInfos()){
ci.setMaxValue(Double.MIN_VALUE);
ci.setMinValue(Do... | 7 |
@Override
public boolean equals(Object o) {
if (o instanceof Pair<?, ?>) {
Pair<?, ?> p = (Pair<?, ?>) o;
return a.equals(p.a) && b.equals(p.b);
}
return false;
} | 8 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int length = Integer.parseInt(in.readLine());
String[] strArray = in.readLine().split(" ");
int[] array1 = new int[length];
int[] array2 = new int[length];
for (int i = 0; i... | 3 |
public static int RoomService(Client joueur) {
int tempDette = 0;
int choiceInt = -1;
boolean wrong = false;
System.out.println("Que voulez vous prendre?"
+ "\n pour de la nourriture tapez 1 (50€)"
+ "\n pour de la boisson tapez 2");
do {
... | 6 |
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
switch (displayedToolIndex) {
case 1:
if (this.getComponentCount() == 0) {
this.add(imageIcon);
}
imageIcon.setLocation(new Point((int)startPoint.getX()-12, (int)startPoint.getY()-12));
break;
case 2:
if ... | 6 |
public void updatePosition() {
if (xPos < xDestination){
prevXPos = xPos;
xPos++;
} //xPos = xPos + 2;
else if (xPos > xDestination){
prevXPos = xPos;
xPos--;
} //xPos = xPos - 2;
if (yPos < yDestination){
prevYPos = yPos;
yPos++;
... | 9 |
public void solve(){
BoardState cState = sState;
visitedList = new ArrayList<BoardState>();
frontierList = new LinkedBlockingQueue<BoardState>();
long startTime, endTime, totalTime; //for time keeping
startTime = System.nanoTime();
while (cState != null && !cState.equals(eState)){ //stop if all nodes explor... | 5 |
public boolean canMove(Square[][] board, char c)
{
LocationSet[] legalMoves = legalMoves(board, c);
for (int x = 0; x < legalMoves.length; x++)
{
for (int y = 0; y < legalMoves[x].destinationNum(); y++)
{
if (legalMoves[x].getIndex(y) != null)
... | 3 |
public static ArrayList<Stock> QueryMultiple(ArrayList<String> codes) {
URL url;
InputStream is = null;
BufferedReader br;
String line;
Stock tmp;
ArrayList<Stock> sList = new ArrayList<>();
String urlStr = "";
for (int i = 0; i < codes.size() - 1; i++) {... | 6 |
@Override
public boolean equals(Object o) {
if (o == null || !(o instanceof Book)) return false;
final Book book = (Book) o;
return Objects.equal(isbn, book.isbn) &&
Objects.equal(title, book.title) &&
authors.containsAll(book.authors) &&
book... | 8 |
public void method() throws Exception
{
System.out.println("From ExceptionTest1 method !");
throw new Exception();
} | 0 |
public Country getCountry(int id) {
Country cnt = null;
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConn... | 5 |
static int mapRejectReason(int state) {
switch (state) {
case 1:
return ACTIVE_BID_CHANGED;
case 11:
case 12:
case 13:
case 14:
return BID_NOT_IMPROVED;
case 15:
case 16:
return PRICE_NOT_BEAT;
default:
return state;
}
} | 7 |
private static void logic(long delta){
for (ListIterator<Asteroid> iterator = asteroidList.listIterator(0); iterator.hasNext();) {
Asteroid asteroid = iterator.next();
asteroid.update(delta);
if(asteroid.getHP() <= 0){
iterator.remove();
if(asteroid.getScale()>0.5f)
try {
iterator.add(new As... | 6 |
public void setFood(int food) {
if (food >= 0) {
this.food = food;
}
} | 1 |
private void OpenActionPerformed(
final java.awt.event.ActionEvent evt) {
int returnVal = fileChooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
// Init TextArea to ""
jTextArea1.setText("");
jTextArea2.setText("");
// Catch the current file path
path = fileChooser.getS... | 6 |
public boolean isLeaf() {
return left == null && right == null;
} | 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.