text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void setPersonId(int personId) {
this.personId = personId;
} | 0 |
protected void inTag(final char c)
{
switch(c)
{
case ' ': case '\t': case '\r': case '\n':
if(canStartPiece(bufDex))
{
startPiece(bufDex);
changedTagState(State.BEFOREATTRIB);
}
else
changeTagState(State.START);
return;
case '<': changeTagState(State.BEFORETAG); return;
case '>':
... | 9 |
public SpecialCommand(TotalPermissions p) {
plugin = p;
} | 0 |
public static void executeTasks(List<Task> tasks, final CountDownLatch latch, ExecutorService pool) {
for(final Task t : tasks) {
pool.submit(new Runnable() {
@Override
public void run() {
try {
t.execute();
} catch(Exception e) {
e.printStackTrace();
} finally {
latch.cou... | 3 |
public void testMultipliedBy_int() {
Days test = Days.days(2);
assertEquals(6, test.multipliedBy(3).getDays());
assertEquals(2, test.getDays());
assertEquals(-6, test.multipliedBy(-3).getDays());
assertSame(test, test.multipliedBy(1));
Days halfMax = Days.days(In... | 1 |
public String[] readCmd() throws IOException {
if( chunkLeft > 0 ) throw new IOException("Cannot read command; there are "+chunkLeft+" chunk bytes left to be read");
int lineLength;
do {
lineLength = readLine( cmdBuffer );
} while( lineLength >= 0 && isEntirelyWhitespace( cmdBuffer, lineLength ) );
if( ... | 7 |
public static double range(double[] vals) {
double min = vals[0];
double max = vals[0];
for (double v : vals) {
if (v < min) {
min = v;
}
if (v > max) {
max = v;
}
}
return max - min;
} | 3 |
private long normalize(IDecimal decimal, int toFactor)
{
if (decimal.getFactor() == toFactor)
{
return decimal.getBase();
}
else
{
return (long) (decimal.getBase() * pow(toFactor - decimal.getFactor()));
}
} | 1 |
private final String createMsg(
ListResourceBundle fResourceBundle,
String msgKey,
Object args[]) //throws Exception
{
String fmsg = null;
boolean throwex = false;
String msg = null;
if (msgKey != null)
msg = fResourceBundle.getString(msgKey);
... | 9 |
public static void main(String[] args) {
Properties pr = new Properties();
FileInputStream fis = null;
try {
fis = new FileInputStream(
System.getProperty("user.dir") + "/src/io/test.properties");
pr.load(fis);
for (Object objKey : pr.keySet()) {
String key = (String)objKey;
System.ou... | 4 |
public static int getSkillId(String skillName) {
Iterator<Integer> iterator = skillsMap.keySet().iterator();
int skillId = 0;
while(iterator.hasNext()){
int key = iterator.next();
String value = skillsMap.get(key);
if(value.equals(skillName))
skillId = key;
}
return skillId;
} | 2 |
public static void addProcessor(Processor processor){
executor.execute(processor);
} | 0 |
public int[] sensed_cell(int[] p, int direction, Direction sense_dir){
int[] x = new int[2];
switch(sense_dir){
case HERE: x = p;
break;
case AHEAD: x = adjacent_cell(p, direction);
break;
case LEFTAHEAD: x = adjacent_cell(p, Turn(LeftRight.LEFT, direction));
break;
case RIGHTAHEAD: x = adjacent_cell(... | 4 |
public void verify(List<T> target) throws PatchFailedException {
if (last() > target.size()) {
throw new PatchFailedException("Incorrect Chunk: the position of chunk > target size");
}
for (int i = 0; i < size(); i++) {
if (!target.get(position + i).equals(lines.get(i))) ... | 3 |
public void inserir(int key){
Nodo nodoAnt = null;
Nodo nodoPos = root;
Nodo novo = null;
while(nodoPos != null && nodoPos.getKey() != key){
nodoAnt = nodoPos;
if(key < nodoPos.getKey()){
nodoPos = nodoPos.getLeft();
}
... | 6 |
public static Complex[] fft (Complex[] x) {
ra.check();
int n = x.length;
if (n == 1) {
return new Complex[] { x[0] };
}
if (n % 2 != 0) {
throw new RuntimeException("N is not a power of 2");
}
Complex[] even = new Complex[n/2];
... | 6 |
@Override
public boolean isMoveValid(int srcRow, int srcCol, int destRow, int destCol) {
// TODO Auto-generated method stub
boolean result = false;
//For Black Pawn
if(isWhite == false){
if(((destRow == (srcRow + 1)) && (destCol == srcCol))){
result = true;
}
else{
return result;
... | 6 |
public int read(char[] cbuf, int off, int len) throws IOException {
init();
return internalIn2.read(cbuf, off, len);
} | 0 |
public void countBagReferences(Instance bag){
int index = 0, referencesIndex = 0;
if(m_TrainBags.numInstances() < m_NumReferences)
referencesIndex = m_TrainBags.numInstances() - 1;
else
referencesIndex = m_NumReferences;
if(m_CitersDebug == true){
System.out.println("-------Reference... | 8 |
protected Constructor<? extends ConfigurationSerializable> getConstructor() {
try {
return clazz.getConstructor(Map.class);
} catch (NoSuchMethodException ex) {
return null;
} catch (SecurityException ex) {
return null;
}
} | 3 |
public PrintWriter luoKirjoitin(){
try {
PrintWriter kirjoitin = new PrintWriter(tiedosto);
return kirjoitin;
} catch (Exception e) {
System.out.println("Tiedostoa ei löydy!");
}
return null;
} | 1 |
@EventHandler(priority = EventPriority.HIGHEST)
public void onjoin(PlayerJoinEvent e) {
if (core.getDB().secplayers.containsKey(e.getPlayer().getName())) {
SecretPlayer player = core.getDB().secplayers.get(e.getPlayer().getName());
player.setInitialLocation(e.getPlayer().getLocation());
if (!player.isLogged... | 7 |
@Override
public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints) {
return new CompositeContext() {
/**
* Composes the two source Raster objects and places the result in the destination WritableRaster.
*
... | 5 |
private CancelMessage(ByteBuffer buffer, int piece,
int offset, int length) {
super(Type.CANCEL, buffer);
this.piece = piece;
this.offset = offset;
this.length = length;
} | 0 |
@Override
public boolean inStartingPosition()
{
if (hasMoved())
return false;
if ((getColor() == ChessPieceColor.WHITE) && (getRow() == 1)) {
return (getColumn() == 3) || (getColumn() == 6);
}
else if ((getColor() == ChessPieceColor.BLACK) && (getRow() == ... | 7 |
protected void printTopWordsDistribution(int topK, String topWordFile) {
Arrays.fill(m_sstat, 0);
System.out.println("print top words");
for (_Doc d : m_trainSet) {
for (int i = 0; i < number_of_topics; i++)
m_sstat[i] += m_logSpace ? Math.exp(d.m_topics[i])
: d.m_topics[i];
}
Utils.L1Normaliza... | 9 |
public void findAvailRec()
{
int logQuantity = 0;
int stoneQuantity = 0;
for (Inventory inventory : inventorys) {
if (inventory.getQuantity() > 0) {
switch (inventory.getItemCode()) {
case 1:
logQuantity = inventory.getQuantity();
break;
case 2:
... | 5 |
@Override
public void componentMoved(ComponentEvent e) {} | 0 |
private void interpolate(int iLower, int iUpper) {
int dx = (int) Math.floor(txRaster[iUpper]) - (int) Math.floor(txRaster[iLower]);
if (dx < 0)
dx = -dx;
float dy = (int) Math.floor(tyRaster[iUpper]) - (int) Math.floor(tyRaster[iLower]);
if (dy < 0)
dy = -dy;
if ((dx + dy) <= 1)
return;
float tLow... | 8 |
private boolean checkNorthEastEdge(EdgeLocation normEdgeLocation, ArrayList<Road> roads, int playerIndex) {
HexLocation thisHexLoc = normEdgeLocation.getHexLoc();
HexLocation NEHexLoc = normEdgeLocation.getHexLoc().getNeighborLoc(EdgeDirection.NorthEast);
HexLocation SEHexLoc = normEdgeLocation.getHexLoc().getNei... | 9 |
private void splitWord(String word) {
overlapp = "";
if (word == null || word.length() == 0) {
this.first = "";
this.focus = "";
this.last = "";
return;
}
if (word.length() == 1) {
this.first = "";
this.foc... | 6 |
public static Matrix createSubMatrix(Matrix matrix, int excluding_row, int excluding_col) {
Matrix mat = new Matrix(matrix.getNrows()-1, matrix.getNcols()-1);
int r = -1;
for (int i=0;i<matrix.getNrows();i++) {
if (i==excluding_row)
continue;
r++;
... | 4 |
* @return this
*/
public Request with(Object... args) {
if (args != null) {
if (args.length % 2 != 0) throw new IllegalArgumentException("need even number of arguments");
for (int i = 0; i < args.length; i += 2) {
add(args[i].toString(), args[i + 1]);
... | 3 |
private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed
//Toma lo que hay en la caja de texto y se lo asigna al String nombre
String nombre = String.valueOf(txtNombreArchivo.getText());
General g = new General();
if( ... | 2 |
@Override
public Status execute(String command) throws MenuException {
switch (command) {
case "N":
return Status.NEW_GAME;
case "B":
return Status.BEST_TIMES;
case "?":
return Status.HELP;
case "Q":
... | 4 |
@Override
public void deleteMax() throws EmptyCollectionException,
KeyNotFoundException {
if (treeIsEmpty())
throw new EmptyCollectionException();
Node x = root;
while (x.right != null)
x = x.right;
delete(x.key);
} | 2 |
public static void go() {
long x = 0;
for (int i = 1; i < 10; i++) {
for (int j = 0; j < 10; j++) {
for (int k = 0; k < 10; k++) {
x = i * 100 + j * 10 + k;
if (x == (Math.pow(i, 3) + Math.pow(j, 3) + Math.pow(k, 3))) {
... | 4 |
@Override
public boolean add(Object item) {
conn = new SQLconnect().getConnection();
String sqlcommand = "INSERT INTO `Timeline_Database`.`Eventnodes` (`owner`, `description`, `display`) VALUES ('%s', '%s', '%s');";
if(item instanceof Eventnode)
{
Eventnode newitem = new Eventnode();
newitem = (Eventnode... | 2 |
private long safeSizeOf(Object key, ICacheable value) {
long result = value.sizeOf();
if (result < 0) {
throw new IllegalStateException("Negative size: " + key + "=" + value);
}
return result;
} | 1 |
private boolean filter(short a, short b) {
boolean x = a >= 0;
boolean y = b >= 0;
if(x && y) {
return a < b;
}
if(!x && y) {
return a > b;
}
if(x && !y) {
return a + b < 0;
}
... | 6 |
public List<Aluno> pesquisaAlunoPeloNome(String nome) {
List<Aluno> listaNomes = new ArrayList<Aluno>();
for (Aluno e : alunos) {
if (e.getNome().indexOf(nome) != -1) {
listaNomes.add(e);
}
}
return listaNomes;
} | 2 |
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
PypAdmAgend pypAdmAgend;
try {
pypAdmAgend = em.getReference(Py... | 7 |
public void injectPlayer(Player... pl) {
for(Player p : pl) {
if(attachments.get(p.getName()) != null) attachments.put(p.getName(), p.addAttachment(getPlugin()));
for(Entry<String, Boolean> permission : attachments.get(p.getName()).getPermissions().entrySet()) {
if(getPermissions(p.getName()).contains(permi... | 9 |
public void updateSchema(Class<?> klass) throws SQLException
{
ConnectionWrapper cw = getConnectionWrapper();
try
{
persist.getTableManager().updateTableForClass(klass, cw);
cw.commitAndDiscard();
}
catch (Exception e)
{
// cancel the operation
cw.rollbackAndDiscard();
// re-throw the origin... | 2 |
public static TextShiftStrategy shiftInvardsByPosition(){
return new TextShiftStrategy() {
@Override
public double getShift( TextStrategyParameters parameters ) {
double position = parameters.getPosition();
Point2D normal = parameters.getPath().getNormalAt( position );
if( normal.getY() > 0 ){
... | 1 |
public Vector3d abs() {
if(x < 0) x = -x;
if(y < 0) y = -y;
if(z < 0) z = -z;
return this;
} | 3 |
public void addElement(TreeValue value, int id) throws AlreadyExistException{
if (root != null) {
constructTree(root, value, id);
} else {
root = new TreeElement<>(value, id);
}
} | 1 |
private void setSelectedProductComboboxItem(String productName) {
for (String str : comboBoxItems) {
if (str.equals(productName))
productComboBox.setSelectedItem(str);
}
} | 2 |
public void logVelocityMessage( int level, String msg )
{
switch ( level )
{
// velocity info messages are too verbose, just consider them as debug messages...
// case INFO_ID:
// log.info( msg );
// break;
case WARN_ID:
... | 2 |
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 setIdPosControlTransacciones(int idPosControlTransacciones) {
this.idPosControlTransacciones = idPosControlTransacciones;
} | 0 |
private boolean jj_2_12(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_12(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(11, xla); }
} | 1 |
private void compressStream(CompressionStream stream) {
if (benchmark) startTime = System.currentTimeMillis() ;
// Create the Huffman table.
huffmanTable = new HuffmanTable() ;
// Quantize the stream, compute deltas between consecutive elements if
// possible, and histogram the data length distribution.
stream.... | 8 |
private String[][] parseLines(List<String> lines) {
int wordsNum = lines.get(0).split("\\s+").length;
String[][] result = new String [lines.size()][wordsNum];
int count = 0;
for(String line: lines) {
String []words = line.split("\\s+");
for(int i=0; i<wordsNum; i+... | 2 |
public void checkUnits() {
Vector<WargusUnit> units = wp.getUnits();
boolean unactive = true;
for (int u : unitGroups.get(0)) {
for (WargusUnit w : units) {
String status = WargusStateImporter.statusToString(w.getStatus()[0]);
if (status != "idle" && w.getUnitID() == u)
{
unactive = false;
... | 7 |
@Override
public float calculateDesire() {
float desire = 0f;
Actor actor = ai.getActor();
if (actor == null) {
return desire;
}
Player p = registry.getPlayerManager().getPlayerById(ai.getPlayer());
//if robot is in aggressive mode, it will alw... | 5 |
public synchronized void update(long time){
if(frames.size()>1){
animTime+=time;
if(animTime>=duration){
animTime%=duration;
currentFrame=0;
}
while(animTime>getFrame(currentFrame).endTime){
currentFrame++;
}
}
} | 3 |
public Cashpoint openCashpoint(){
boolean opened = false;
Cashpoint cashpoint = null;
if(getOpenCashpoints().size() < 6){
for (int i = 1; i < 7 && opened == false; i++) {
cashpoint = findCashpointByNr(i);
if(cashpoint != null && cashpoint.isOpen() == false){
Thread m = new Thread(cashpoint);
... | 5 |
public void atualizar(Pesquisa pesquisa) throws Exception
{
String sql = "UPDATE pesquisa SET " +
"titulo = ?," +
"orientador = ?," +
"pesquisador_responsavel = ?," +
"ano_submissao = ?," +
"tempo_duracao = ?," +
"tipo = ?," +
"qualificacao = ?," +
"impacto_pesquisa = ?," +
"gerou... | 1 |
public Boolean suoritaKomento() {
String vastaus = io.lueRivi().toLowerCase();
if (vastaus.isEmpty()) {
return true;
}
if (vastaus.equals("sulje")) {
return false;
}
if (vastaus.equals("viite")) {
luoViite();
} else if (vasta... | 9 |
public void setDirected(boolean directed) {
this.directed = directed;
for (int i = 0; i < edges.getSize(); i++) {
edges.get(i).setDirected(directed);
}
} | 1 |
@Override
public void cleanUp() {
// Iterate all of the children layers and remove their events
for (GameLayer gameLayer : gameLayers.values()) {
gameLayer.cleanUp();
}
KeyEventHandler.getInstance().removeEvents(this);
} | 1 |
public Transition<TransitionInput> findFirstValidTransitionFromState(State<TransitionInput> tailState, TransitionInput input) {
for(Transition<TransitionInput> transition : transitionsByTail.get(tailState)) {
if(transition.isValid(input)) {
return transition;
}
}
for(CompositeState<TransitionInput> com... | 7 |
@Override
public void mousePressed(MouseEvent event) {
DockContainer dc = getDockContainer();
if (dc.getCurrentDockable() != mDockable) {
dc.setCurrentDockable(mDockable);
dc.acquireFocus();
} else if (!dc.isActive()) {
dc.acquireFocus();
}
} | 2 |
public Color getSelectedColor(int button)
{
switch (button)
{
case MouseEvent.BUTTON1:
return left;
case MouseEvent.BUTTON3:
return right;
default:
if ((button & (MouseEvent.BUTTON1_MASK | MouseEvent.BUTTON1_DOWN_MASK)) != 0) return left;
if ((button & (MouseEvent.BUTTON3_MASK | MouseEve... | 4 |
public void setpage(byte [] array)
{
data = array;
} | 0 |
@Override
public String execute(SessionRequestContent request) throws ServletLogicException{
String page;
try {
Criteria criteria = new Criteria();
String login = request.getParameter(JSP_USER_LOGIN);
Validator.validateLogin(login);
criteria.addParam(D... | 4 |
private boolean addPosition(KrakenState state, XYLocation kingLocation,XYLocation location,
ArrayList<KrakenMove> list,XYLocation finalLocation){
if (state.distance(kingLocation, location, finalLocation)){
if (state.isEmpty(finalLocation)){
list.add(new KrakenMove(location, finalLocation));
return fa... | 5 |
public void mouseClicked(MouseEvent e) {
if(paused){
if(buttons.get(0).isInside(e.getX(), e.getY())){
paused=false;
leftPressed = false;
rightPressed = false;
firePressed = false;
bombPressed = fals... | 8 |
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 interactClick(int mod) {
if(!isActual()) return;
if (UI.instance.mapview != null) {
UI.instance.mainview.wdgmsg("itemact", JSBotUtils.getCenterScreenCoord(), position(),
mod, gob_id, position());
}
} | 2 |
public void remove(EntradaBean oEntradaBean) throws Exception {
try {
oMysql.conexion(enumTipoConexion);
oMysql.removeOne(oEntradaBean.getId(), "entrada");
oMysql.desconexion();
} catch (Exception e) {
throw new Exception("EntradaDao.remove: Error: " + e.g... | 1 |
@Column(name = "name")
@Id
public String getName() {
return name;
} | 0 |
public static String parseFileName(String s) {
String fileName = s;
fileName = fileName.replace('/', File.separatorChar);
fileName = fileName.replace('\\', File.separatorChar);
int i = fileName.lastIndexOf('.');
if (i > 0) {
fileName = fileName.substring(0, i).replace('.', File.se... | 3 |
public void setPgenCounter(byte[] value) {
this.pgenCounter = value;
} | 0 |
public int compareTo(Object o) {
TreeElement other = (TreeElement) o;
if (leaf != other.leaf)
// files come after directories
return leaf ? 1 : -1;
return fullName.compareTo(other.fullName);
} | 2 |
public JSONArray optJSONArray(int index) {
Object o = opt(index);
return o instanceof JSONArray ? (JSONArray)o : null;
} | 1 |
public void saveReward(int n, ItemStack itemStack)
{
if (!getMain().loot.isConfigurationSection("items." + n))
getMain().loot.createSection("items." + n);
if (itemStack == null)
itemStack = new ItemStack(Material.AIR);
ConfigurationSection data = getMain().loot.getConfigurationSection("items." + n);
d... | 4 |
public GroupObject(String name, String header, String footer) {
this.name = name;
this.header = header;
this.footer = footer;
} | 0 |
public Set<Integer> lookUp(final String key) {
final int len = key.length();
Set<Integer> result = new HashSet<Integer>();
// no point in checking if
// the word is longer than the longest
// word in the trie or if it is an empty word
if (charBuffer.length < len || len =... | 7 |
public static boolean isOneEditDistance(String s, String t) {
int m = s.length(), n = t.length();
if (m > n)
return isOneEditDistance(t, s);
if (n - m > 1)
return false;
boolean firsttime = true;
int i = 0, j = 0;
while (i < m) {
if (s.charAt(i) != t.charAt(j)) {
if (!firsttime)
return fal... | 8 |
public static int[][] reconstructQueue(int[][] people) {
if (people == null || people.length <= 1) {
return people;
}
Arrays.sort(people, new Comparator<int[]>() {
@Override
public int compare(int[] o1, int[] o2) {
return o1[0] == o2[0] ? o1[1] - o2[1] : o1[0] - o2[0];
}
});
int n = people.len... | 9 |
private static void returnPalindromes() {
setProvenPalindromes(new ArrayList<Integer>());
for (Integer integer : getProductOfThreeDigitIntegers()) {
if (isItPalindrome(integer)) {
getProvenPalindromes().add(integer);
}
}
} | 2 |
public String getDescription() {
return description;
} | 0 |
protected static InetAddress convertBindAddress(String value) throws Exception {
InetAddress retval=null;
Util.AddressScope addr_scope=null;
try {
addr_scope=Util.AddressScope.valueOf(value.toUpperCase());
}
catch(Throwable ex) {
}
... | 7 |
@Test
public void jsonTransformEquality() throws InvalidJSONException, JSONException {
Position p1 = new Position(42.123, 45.456);
Position p2 = null;
p2 = new Position(p1.toJSON());
assertTrue((p1.getLatitude() == p2.getLatitude()) && p1.getLongitude() == p2.getLongitude());
} | 1 |
public void setCurrentFrameID(String id) {
int i = 0;
for (TextureFrame tex : textures) {
if (tex.id.equals(id)) {
break;
}
i++;
}
if (animationType == EnumAnimationType.STATE_RENDERED && i < textures.length) {
TextureFrame ... | 5 |
public void setToIdentityMatrix() {
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
m[i][j] = (i == j) ? 1 : 0;
} | 3 |
@Override
protected void afterEnteredFocus(FocusChangeDirection direction) {
if(items.isEmpty())
return;
if(direction == FocusChangeDirection.DOWN)
selectedIndex = 0;
else if(direction == FocusChangeDirection.UP)
selectedIndex = items.size() - 1;
... | 3 |
@SuppressWarnings({ "unchecked", "rawtypes" })
public static FieldGrammar<?> get(Field field) throws SecurityException, NoSuchMethodException
{
if(CharSequence.class.isAssignableFrom(field.getType()))
{
Regex annotation_regex = field.getAnnotation(Regex.class);
if(null != annotation_regex)
... | 7 |
public Object getValue(ObjectFields of) {
switch (of.getType()) {
case "integer":
return of.getIntval();
case "long":
return of.getLongval();
case "double":
return of.getFloatval();
case "date":
retur... | 5 |
private int parseInstruction(String line, int i)
{
//retrieve the instruction code from the string
String instr = getToken(line, i);
//Check for empty token (syntax error)
if (instr.length() == 0)
{
System.out.println("\nERROR (line " + m_lineNum + "): Empty toke... | 5 |
static protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos... | 9 |
@Override
public void startObstacle(List<Element> elements, Element e) {
if (isActive() && e instanceof Player)
forceFieldConnection.incrementPlayerTrappedCount(((Player) e));
} | 2 |
private void deleteGoal(int x, int y)
{
for(int i=0; i<Goals.size(); i++)
{
if(Math.sqrt(((x-Goals.elementAt(i)[0])*(x-Goals.elementAt(i)[0])) + ((y-Goals.elementAt(i)[1])*(y-Goals.elementAt(i)[1]))) <= 10)
{
Goals.remove(i);
return;
}
}
} | 2 |
public int declareWinner() {
int winner;
if (redFood > blackFood) {
winner = 2;
} else if (blackFood > redFood) {
winner = 1;
} else if (blackFood == redFood) {
winner = 0;
} else {
winner = -1;
}
// Calculates winne... | 3 |
public CardsTesterJPanel() {
loadAllCardImagesAndSetUpCardDimensions();
addPanelsOfComponents();
addMouseListener(this);
reset();
} | 0 |
public int[] fetchStats()
{
Scanner sc = getFile();
if (sc == null) return null;
int total = 0;
int[] count = new int[precision];
while (sc.hasNextLine())
{
double ratio = getRatio(sc.nextLine());
if (ratio == 1) count[pre... | 3 |
public boolean amatch(String ln, Int i) {
logger.fine("SEmult amatch() called on " + ln.charAt(i.get()));
boolean metMin = minimum == 0; // if 0 minimum, already met minimum.
for (int j=minimum; j<maximum && i.get()<ln.length(); j++) {
if (!target.amatch(ln, i))
break;
// else at least one matched, so w... | 3 |
private void searchJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchJButtonActionPerformed
String searchStr = inputJTextField.getText();
String searchCriteria = (String) searchCriteriaJComboBox.getSelectedItem();
infoJTextArea.setText(""); // clear the f... | 3 |
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.